Source Code
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
int loki [100001];
  int ans=0;
  int n;
  int k;

  cin >> n ;
  cin >> k;

  for (int i=0;i<n;i++){
    cin >> loki[i]; 
  }

  for (int i=0; i<n;i++){
    ans =max (ans,loki[i+k]);
  }
  cout<<ans+1<<endl;
  return 0;
  
}
Copy
Offer King_Of_Asgard
GNU G++17
2 ms
560 KB
Wrong Answer