akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try (Scanner scan = new Scanner(System.in)) {
          String str = scan.next();
          
          String odd="";
          String even="";
          String[] strArray = str.split("");
          for(int i=1; i<=strArray.length;i++) {
            if(i%2==0) {
             even+=strArray[i-1];
            } else {
              odd+=strArray[i-1];
            }
          }
          
          if(even.contains("R") || odd.contains("L")){
            System.out.println("No");
          } else {
            System.out.println("Yes");
            
          }
        }
   
    }
}

Measured memory_bytes: 21716
l,r = [int(_) for _ in input().split()]
c = (r-l+1)//2019
m = 10**10
if c == 0:
    if r%2019 <= l%2019:
        print(0)
    else:
        for i in range(l%2019, r%2019):
            for j in range(i+1, r%2019+1):
                m = min(m, i*j%2019)
        print(m)
else:
    print(0)


Measured memory_bytes: 3060
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:

};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n >> m;
    vector<int> A(m);
    for (int i = 0; i < m; ++i) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    vector<int> costs{0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

    vector<pair<int,int>> dp(n + 1, make_pair(-1, -1));
    dp[0] = make_pair(0, 0);    

    for (int i = 1; i <= n; ++i) {
        for (int j = m - 1; j >= 0; --j) {
            int ct = costs[A[j]];
            if (i >= ct && dp[i - ct].first >= 0) {
                dp[i] = max(dp[i], make_pair(dp[i - ct].first + 1, A[j]));
            }
        }
    }

    string res;
    int cur = n;
    while (cur > 0) {
        int x = dp[cur].second;
        res += (char)('0' + x);
        cur -= costs[x];
    }
    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int n, k;
const int maxN = (int)1e5 + 10;
const int INF = 1e9;
int x[maxN];
int main() {
    srand(time(0));
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> x[i];
    }
    int ans = INF;
    for (int i = 1; i + k - 1 <= n; i++) {
        int l = x[i];
        int r = x[i + k - 1];
        if (r < 0) ans = min(ans, abs(l));
        if (l > 0) ans = min(ans, r);
        else ans = min(ans, min(abs(l), abs(r)) + r - l);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;

int main(){
  long long N;
  cin>>N;

  map<long long, long long> res;
  for (long long a = 2; a * a <= N; ++a) {
    if (N % a != 0) continue;
    long long ex = 0; 
    while (N % a == 0) {
      ++ex;
      N /= a;
    }
    res[a]=ex;
  }
  if (N != 1) res[N]= 1;
  
  long long ans=0;
  for(auto & x:res){
    long long a=x.second;
    for(int i=1;i<10000;i++){
      if(a>=i){
        ans++;
        a=a-i;
      }
      else break;
    }
  }
  cout<<ans<<endl;
      
  
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<int> A(n); rep(i, n-1) cin >> A[i+1];
  vector<int> cnt(n);
  rep(i, n) if(i) cnt[A[i]-1]++;
  rep(i, n) cout << cnt[i] << "\n";
  return 0;
}


Measured memory_bytes: 4764
#include <bits/stdc++.h>
#define pb(x)                    push_back(x)
#define all(a)                   a.begin(), a.end()
#define dbg(a)                   cout<< #a <<" --> "<<(a)<<endl;
#define IO                       ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define read                     freopen("tst.txt","r",stdin)
#define write                    freopen("out.txt","w",stdout)
typedef long long ll;
using namespace std;


typedef pair<int,int> pp;
#define mx 100005
pp ar[mx];



main(){
//read;
IO;

int n;
cin>>n;
for(int i = 0; i<n; i++){
    cin>>ar[i].first;
    ar[i].second = i+1;
}
sort(ar,ar+n);
for(int i = 0; i<n; i++)
    cout<<ar[i].second<<" ";


return 0;
}


Measured memory_bytes: 1664
S = input()

count = 0
isR = True
result = [0] * len(S)
tmp = 0
i = 0
while i < len(S):
    if S[i] == 'R':
        i += 1
        count += 1
        isR = True
    else:
        if isR:
            isR = False
            tmp = i
            if count % 2 == 1:
                result[i - 1] = (count + 1) // 2
                result[i] = (count + 1) // 2
            else:
                result[i - 1] = count // 2
                result[i] = count // 2 + 1
            count = 0
        else:
            if (i - tmp) % 2 == 0:
                result[tmp] += 1
            else:
                result[tmp - 1] += 1
        i += 1
print(' '.join(map(str, result)))


Measured memory_bytes: 10484
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    set<char> s;
    rep(i,n) {
        char ss;
        cin >> ss;
        s.insert(ss);
    }
    if (s.size()==3) {
        ct("Three");
    } else {
        ct("Four");
    }
    
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	string o,e,ans="";

	cin >>o >>e;
	for(int i=0;i<(int)o.size();i++){
		if(i==(int)o.size()-1&&o.size()!=e.size()){
			ans+=o[i];
			break;
		}
		ans+=o[i];
		ans+=e[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, c, d, s, k;
  in3(a, b, c);
  in2(d, s);
  a = (c - a) * 60;
  a = a + d - b;
  out(a - s);
  memi;
}


Measured memory_bytes: 3624
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var e = xArray("new Set()",n);
  for(var i = 1; i < n; i++){
    var t = o.l(), a = t[0]-1, b = t[1]-1;
    e[a].add(b);
    e[b].add(a);
  }
  var c = o.l().sort((a,b)=>a-b);
  var ans = Array(n), x = 0;
  var q = [0], p = [1];
  while(q.length){
    var l = q.length-1, f = 1;
    for(var i of e[q[l]]){
      if(p[i])continue;
      e[q[l]].delete(i);
      f = 0;
      p[i] = 1;
      q.push(i);
      break;
    }
    if(f){
      ans[q.pop()] = c[x++];
    }
  }
  console.log(c.reduce((a,b)=>a+b)-c[n-1]);
  return ans.join(" ");
}

Measured memory_bytes: 18360
#include <bits/stdc++.h>
using namespace std;

int main() {
	int h, w;
	cin >> h >> w;

	string s;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> s;
			if (s == "snuke") {
				cout << (char)(j + 'A') << (i + 1) << endl;
			}
		}
	}
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vl=vector<ll>;
#define INF 1e18
int main() {
    int N,M,L; cin>>N>>M>>L;
    vector<vl> cost(N,vl(N,INF));
    for (int i = 0; i < M; i++){
        int A,B,C; cin>>A>>B>>C; A--;B--;
        cost[A][B]=C; cost[B][A]=C;
    }
    for (int i = 0; i < N; i++){
        cost[i][i]=0;
    }
    for (int k = 0; k < N; k++){
        for (int i = 0; i < N; i++){
            for (int j = 0; j < N; j++){
                cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
            }
        }
    }
    for (int i = 0; i < N; i++){
        for (int j = 0; j < N; j++){
            if(i==j)cost[i][j]=0;
            if(cost[i][j]<=L)cost[i][j]=1;
            else cost[i][j]=INF;
        }
    }
    for (int k = 0; k < N; k++){
        for (int i = 0; i < N; i++){
            for (int j = 0; j < N; j++){
                cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
            }
        }
    }
    int Q; cin>>Q;
    for (int i = 0; i < Q; i++){
        int s,t; cin>>s>>t; s--;t--;
        if(cost[s][t]!=INF)cout<<cost[s][t]-1<<endl;
        else cout<<-1<<endl;
    }
}

Measured memory_bytes: 4340
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);

		int K = sc.nextInt();
		int N = sc.nextInt();
		int A[] = new int[N];
		
		for(int i=0; i<N; i++) {
			A[i] = sc.nextInt();
		}
		
		int X = 0;
		int Y = A[0]+(K-A[N-1]);
		for(int i=0; i<N-1; i++) {
			X = A[i+1]-A[i];
		if(X>=Y) {
			Y = X;
		}	
		}
		System.out.print(K-Y);
	}
}

Measured memory_bytes: 60452
while True:
	a,b = map(int,input().split())
	if a == 0 and b == 0:
		break
	n = int(input())
	xy = [tuple(map(int,input().split())) for i in range(n)]
	dp = [[0] * b for i in range(a)]
	dp[0][0] = 1
	for i in range(a):
		for j in range(b):
			if (i + 1,j + 1) in xy:
				continue
			if i >= 1:
				dp[i][j] += dp[i - 1][j]
			if j >= 1:
				dp[i][j] += dp[i][j - 1]
	print(dp[a - 1][b - 1])


Measured memory_bytes: 5596
#include <stdio.h>
#include <math.h>

#define sfd(type, fn)   type fn(P a
#define isfd(type, fn)  inline sfd(type, fn)
#define fd(type, fn)    type fn(P a, P b
#define ifd(type, fn)   inline fd(type, fn)
#define PT(p)	&(p).x, &(p).y

;
typedef double frac;
typedef struct { frac x, y; } Point, P;
  
ifd(frac, cross))   { return (a.x * b.y - a.y * b.x);  }
ifd(frac, dot))     { return (a.x * b.x + a.y * b.y);  }
ifd(P, plus))       { return (P){a.x + b.x, a.y + b.y};}
ifd(P, minus))      { return (P){a.x - b.x, a.y - b.y};}
isfd(P, multi),int x){ return (P){a.x * x, a.y * x};   }
isfd(P, sq))        { return (P){a.x * a.x, a.y * a.y};}
isfd(frac, scalar)) { return (a.x + a.y);              }
isfd(frac, norm))   { return (a.x * a.x + a.y * a.y);  }

int input_p(P *a){return scanf("%lf,%lf",&a->x,&a->y); }

int main(int argc, char const *argv[])
{
	P a, b, q;

	while (~scanf("%lf,%lf,%lf,%lf,%lf,%lf", PT(a), PT(b), PT(q))) {
		P x, y, m, ans;

		x = minus(q, a);
		y = minus(b, a);
		m = (P){a.x + y.x * dot(x, y) / scalar(sq(y)), a.y + y.y * dot(x, y) / scalar(sq(y))};

		ans = plus(m, minus(m, q));

		printf("%f %f\n", ans.x, ans.y);
	}
	return (0);
}

Measured memory_bytes: 652
n, k = list(map(int, input().split()))

MOD = 10**9 + 7
ans = 0

for c in range(k, n + 2):
  m = c * (c - 1) // 2
  M = c * (2 * (n + 1) - c - 1) // 2
  ans += M - m + 1
  ans %= MOD

print(ans)


Measured memory_bytes: 9184
#include <bits/stdc++.h>

using namespace std;

#define all(a) a.begin(), a.end()
#define pi acos(-1)
#define eps 1e-6
#define inf 1e14

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

const int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy[8] = {-1, 0, 1, -1, 1, 0, 1, -1};
const int maxn = 100;
const int mod = 1e9 + 7;
const int maxa = 1e5 + 1;

int mul(int a, int b) { return a * 1LL * b % mod;}
int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b;}
int sub(int a, int b) { return a >= b ? a - b : a - b + mod;}
int pow(int a, int k)
{
    int res = 1;
    while (k)
    {
        if (k % 2) res = mul(res, a);
        a = mul(a, a);
        k /= 2;
    }

    return res;
}

int inv(int a)
{
    return pow(a, mod - 2);
}

int W, n;
ll dp[maxn][maxa], cost[maxn], val[maxn];

ll f(int id, ll w)
{
    if (id == n)
        return 0;

    if (dp[id][w] != -1)
        return dp[id][w];

    dp[id][w] = f(id + 1, w);
    if (w + cost[id] <= W)
        dp[id][w] = max(dp[id][w], f(id + 1, w + cost[id]) + val[id]);
        
    return dp[id][w];
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    memset(dp, -1, sizeof(dp));
    cin >> n >> W;
    for (int i = 0; i < n; ++i)
        cin >> cost[i] >> val[i];
    
    cout << f(0, 0) << '\n';
}


Measured memory_bytes: 78336
#include <stdio.h>

int main(void){
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(W >= x+r && r <= x && H >= y+r && r <= y){printf("Yes\n");}
    else{printf("No\n");}
    return 0;
} 

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
 
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

const int NM = 200000 + 10;
int p[NM];
int k[NM];

void initk() {
    for(int i=0; i<NM-2; i++){
        k[i+1] = k[i] + (i+1);
    }
}

double getk(int m, int idx) {
    double sum = 0.0;
    for(int i=idx; i<idx+m; i++) {
        int ii = p[i];
        sum += (double)k[ii]/(double)ii;
    }
    return sum;
}
int main() {
    std::cout<<std::fixed<<std::setprecision(10);
    int n, k; cin >> n >> k;
    rep(i, n){
        cin >> p[i];
    }
    initk();
    // get maximum 
    int mx = 0;
    int sum = 0;
    int st = 0, ed = k-1;
    int idx = 0;
    for(int i=st; i<=ed; i++) {
        sum += p[i];
    }
    mx = sum;
    while(ed != n-1){
       sum = sum-p[st]+p[ed+1];
       if(sum > mx) {
           mx = sum;
           idx = st+1;
       }
       st++; ed++;
    }
    double ans = getk(k, idx);
    cout << ans << endl;

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
# define M_PI 3.14159265358979323846
using ll = long long int;
const int MOD = 1e9 + 7;
int main()
{
    int n,m;
    cin>>n>>m;
    int days_needed=0;
    for (int i = 0; i < m; i++)
    {
        int temp;
        cin>>temp;
        days_needed+=temp;
    }
    if(days_needed>n)
    {
        cout<<-1<<endl;
    }
    else
    {
        cout<<n-days_needed<<endl;
    }
    
}

Measured memory_bytes: 3588
#include <algorithm>
#include <iostream>
#include <string>

// https://atcoder.jp/contests/abc123/tasks/abc123_b

using namespace std;

int main() {
  int a[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }

  int sum = 0;
  int diff = 0;
  for (int i = 0; i < 5; i++) {
    int num;
    if (a[i] % 10 == 0) {
      num = a[i];
    } else {
      num = a[i] / 10 * 10 + 10;
    }
    sum += num;
    diff = max(num - a[i], diff);
  }
  cout << sum - diff << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  string s;
  cin>>h>>w;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>s;
      if(s=="snuke"){
	cout<<(char)('A'+j)<<i+1<<endl;
      }
    }
  }
  return(0);
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int A;
    int B;
    int C;
    int K;
    int ans = 0;

    scanf("%d", &A); // 1
    scanf("%d", &B); // 0
    scanf("%d", &C); // -1
    scanf("%d", &K); // K

    if (A >= K) {
        ans = K;
    } else {
        if (B >= (K - A)) {
            ans = A;
        } else {
            ans = A - (K - A - B);
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1732
#include <iostream>
using namespace std;

long int gcd(long int x,long int y){
  if(y%x==0) return x;
  else return gcd(y-(y/x)*x,x);
}

int main(){
  long int i,x,y,g,N;
  cin>>N;
  cin>>x>>y;
  g=gcd(x,y);
  for(i=0;i<N-2;i++){
    cin>>x;g=gcd(g,x);
  }
  cout << g << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007
int main(){
	fast;
	ll a,b;
	cin>>a>>b;
	if(a==b)
	{
		cout<<"Draw";
		return 0;
	}
	if(a==1)
	{
		cout<<"Alice";
		return 0;
	}
	if(b==1)
	{
		cout<<"Bob";
		return 0;
	}
	if(a>b)
		cout<<"Alice";
	else
		cout<<"Bob";
	
	return 0;
	
}



Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <typeinfo>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

// prime=>true, not prime=>false
// bool isPrime(int i){
//     for(int j=2; j<=i/2; j++){
//         if(i%j==0){
//             return false;
//         }
//     }
//     return true;
// }

bool isPrime(int n){
    if(n<2){
        return false;
    }else if(n==2){
        return true;
    }
    if(n%2==0){
        return false;
    }
    for(int i=3; i<=n/i; i+=2){
        if(n%i==0){
            return false;
        }
    }
    return true;
}

int main(){

    int n;
    cin >> n;

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

    int prime_count = 0;
    for(int i=0; i<n; i++){
        if(isPrime(n_nums[i])){
            prime_count += 1;
        }
    }

    cout << prime_count << endl;
    return 0;
}



Measured memory_bytes: 3164
# @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-05-10 21:37
# @url:https://atcoder.jp/contests/abc167/tasks/abc167_d

import sys,os
from io import BytesIO, IOBase
import collections,itertools,bisect,heapq,math,string
# region fastio

BUFSIZE = 8192

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# ------------------------------
def main():
    nk=list(map(int,input().split()))
    n,k=nk[0],nk[1]
    A=list(map(int,input().split()))
    pos=[1]
    cnt=0
    s=set()
    s.add(1)
    while cnt<len(A):
        temp=A[pos[-1]-1]
        pos.append(temp)
        # 注意要使用set来判断集合元素是否存在,
        # 不能使用 in pos的操作，数组的in存在超时的风险
        if temp in s:
            # pos.append(A[pos[-1]-1])
            break
        s.add(temp)
        cnt+=1
    # print (pos)
    index=pos.index(pos[-1])
    if k<index:
        print (pos[k])
    else:
        mod=(k-index)%(len(pos[index:])-1)
        # print (mod)
        print (pos[index+mod])
if __name__ == "__main__":
    main()


Measured memory_bytes: 132964
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <map>
#include <string>

#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORN(i, n, s) for (int i = s; i < n; i++)
#define OUT(s) cout << s << endl;
#define IN(a) cin >> a;
#define PACK(a, n) \
  for (int i = 0; i < n; i++) cin >> a[i];
#define PACKN(a, n, s) \
  for (int i = s; i < n; i++) cin >> a[i];
#define LIST(a, n) \
  for (int i = 0; i < n; i++) cout << "[" << i << "] " << a[i] << endl;

using namespace std;

int main() {
  int N, M, X, Y;
  IN(N >> M >> X >> Y);
  int x[N];
  PACK(x, N);
  int y[M];
  PACK(y, M);
  int xMax = x[0];
  FOR(i, N) {
    if (x[i] > xMax) xMax = x[i];
  }
  int yMin = y[0];
  FOR(i, M) {
    if (y[i] < yMin) yMin = y[i];
  }
  if (xMax < yMin && X < yMin && Y > xMax) {
    OUT("No War");
  } else {
    OUT("War");
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class Program{
    static void Main(string[] args){
        int[] nums=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        if(nums[0]<nums[1]&&nums[1]<nums[2]){
            Console.WriteLine("Yes");
        }else{
            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 16364
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define INF 1200000000
int x;
int parti(int A[],int p,int r){
    x=A[r];
    int i=p-1;
    int a;
    rep(j,p,r){
        if(A[j]<=x){
            i++;
            a=A[i];
            A[i]=A[j];
            A[j]=a;
        }
    }
    a=A[i+1];
    A[i+1]=A[r];
    A[r]=a;
    return i+1;
}


int main(){
    int n,A[100010];
    cin>>n;
    rep(i,0,n)cin>>A[i];
    int bra=parti(A,0,n-1);
    rep(i,0,n){
        if(i)cout<<" ";
        if(i==bra)cout<<"["<<A[i]<<"]";
        else cout<<A[i];
    }
    cout<<endl;
    
}





Measured memory_bytes: 3460
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repq(i,a,n) for(int i=a; i<=n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    string s; cin >> s;

    int ok[100010] = {};
    repr(i,s.length()-1,0) {
        int cnt = s.length() - i;
        if(s[i] == 'e') {
            if(cnt >= 5) {
                string sub = s.substr(i,5);
                if(sub == "erase") {
                    ok[i]++;
                    ok[i+5]--;
                }
            }
            if(cnt >= 6) {
                string sub = s.substr(i,6);
                if(sub == "eraser") {
                    ok[i]++;
                    ok[i+6]--;
                }
            }
        }
        else if(s[i] == 'd') {
            if(cnt >= 5) {
                string sub = s.substr(i,5);
                if(sub == "dream") {
                    ok[i]++;
                    ok[i+5]--;
                }
            }
            if(cnt >= 7) {
                string sub = s.substr(i,7);
                if(sub == "dreamer") {
                    ok[i]++;
                    ok[i+7]--;
                }
            }
        }
    }
    bool ans = true;
    if(ok[0] == 0) ans = false;
    rep(i,1,s.length()) {
        ok[i] += ok[i-1];
        if(ok[i] == 0) {
            // cout << i << endl;
            ans = false;
        }
    }
    cout << (ans ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 1408
A  = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]


K  = input()
k = int(K)

print(A[k-1])


Measured memory_bytes: 2940
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for a in range (A+1):
    for b in range (B+1):
        for c in range (C+1):
            if a*500 + b*100 + c*50 == X:
                count += 1
print(count) 

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(void){

    int N;
    bool ifPrime;
    vector<int> Primes;
    vector<int> numPrimes(1000, 0);
    cin >> N;

    for(int i=2; i<=N; i++){
        ifPrime = true;
        for(int j=2; (double)(j)<=sqrt((double)(i)); j++){
            if(i%j==0)ifPrime=false;
        }
        if(ifPrime){
            Primes.push_back(i);
        }
    }

    int divN;
    long long res = (long long)1;

    for(int p: Primes){
        divN = N;
        while(divN > 0){
            divN = divN / p;
            numPrimes[p] += divN;
        }
        res = (res * (long long)(1+numPrimes[p])) % (long long)1000000007;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



void solve(){
    ll n;
    cin>>n;
    ll d[110];
    rep(i,n) cin>>d[i];
    ll a[110]={};
    rep(i,n) a[d[i]]++;
    ll ans=0;
    rep(i,101) if(a[i]>0) ans++;
    cout<<ans<<endl;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    solve();

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#define MAX_N 300000
using namespace std;

int L1[MAX_N];
int L2[MAX_N];
int R1[MAX_N];
int R2[MAX_N];
int U1[MAX_N];
int U2[MAX_N];
int D1[MAX_N];
int D2[MAX_N];

char A[MAX_N];
char B[MAX_N];
int n;
int h,w;
int sr,sc;
char ch;
int res;
bool solve()
{
    int left,right,up,down;
    left = sc;
    right = w+1-sc;
    up = sr;
    down = h+1-sr;
    /*
    cout<< left<<" "<<right<<" "<<up<<" "<<down<<endl;
    for(int i = 0;i<n;i++){
        cout<<L1[i]<<" "<<R1[i]<<" "<<U1[i]<<" "<<D1[i]<<endl;
    }
    cout<<"------"<<endl;
    for(int i = 0;i<n;i++){
        cout<<L2[i]<<" "<<R2[i]<<" "<<U2[i]<<" "<<D2[i]<<endl;
    }
    */
    //left
    left = sc;
    for(int i = 0;i<n;i++){
        if(A[i] == 'L')left -=1;
        if(left<1)return false;
        if(B[i] == 'R' && left<w)left +=1; 
    }
    //right
    right = sc;
    for(int i = 0;i<n;i++){
        if(A[i] == 'R')right+=1;
        if(right>w)return false;
        if(B[i] == 'L' && right>1)right-=1;
    }
    up = sr;
    for(int i = 0;i<n;i++){
        if(A[i]=='U')up-=1;
        if(up<1) return false;
        if(B[i] == 'D' && up<h)up+=1;
    }
    down = sr;
    for(int i = 0;i<n;i++){
        if(A[i] == 'D')down+=1;
        if(down>h)return false;
        if(B[i]=='U' && down>1)down-=1;
    }
    /*
    for(int i = 0;i<n;i++){
        if(L1[i]-min(R2[i],right-1)>=left ||
            R1[i]-min(L2[i],left-1)>=right ||
            U1[i]-min(D2[i],down-1)>=up ||
            D1[i]-min(U2[i],up-1)>=down)
            return false;
            
    }
    */
    return true;
}

int main()
{
    cin>>h>>w>>n;
    cin>>sr>>sc;
    for(int i = 0;i<n;i++){
        cin>>ch;
        A[i] = ch;
        if(ch=='L')
            L1[i]+=1;
        if(ch=='R')
            R1[i]+=1;
        if(ch=='U')
            U1[i]+=1;
        if(ch=='D')
            D1[i]+=1;
        L1[i+1]=L1[i];
        R1[i+1]=R1[i];
        U1[i+1]=U1[i];
        D1[i+1]=D1[i];
    }
    for(int i = 1;i<=n;i++){
        cin>>ch;
        B[i-1]=ch;
        if(ch=='L')
            L2[i]+=1;
        if(ch=='R')
            R2[i]+=1;
        if(ch=='U')
            U2[i]+=1;
        if(ch=='D')
            D2[i]+=1;
        L2[i+1]=L2[i];
        R2[i+1]=R2[i];
        U2[i+1]=U2[i];
        D2[i+1]=D2[i];
    }
    if(solve()){
        cout<<"YES"<<endl;
    }
    else
        cout<<"NO"<<endl;
}


Measured memory_bytes: 8832
#include<iostream>
#include<string>
using namespace std;

typedef long long int ll;
int main()
{
    string n;
    ll i,sum=0;

    cin>>n;

    for(i=0;i<n.size();i++){
        sum = sum +(n[i]-48);
    }

    if(sum%9 == 0){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }

    return 0;
}


Measured memory_bytes: 3688
#include<stdio.h>

int main(){
	
	//準備部分
	int a,num,count[26]={};
	char ch;

	//入力・計算部分
	while(scanf("%c",&ch)!=EOF){
		num=ch-'a';
		if(num<0)num=ch-'A';
		count[num]++;
	}
	
	//出力部分
	for(a=0;a<26;a++){
		printf("%c : %d\n",a+'a',count[a]);
	}
	
	return 0;
}



Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
using ll = long long;
#define pi 3.1415926
 
int a[3];
 
int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(a){
        c = c - b;
        if(c <= 0){  
            cout << "Yes";
            break;
        }
        a = a - d;
        if(a <= 0){
            cout << "No";
            break;
        }
    }
}


Measured memory_bytes: 3648
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
from heapq import heappush, heappop, heapify

x, y, a, b, c = map(int, input().split())
p = [int(item) for item in input().split()]
p.sort(reverse=True)
q = [int(item) for item in input().split()]
q.sort(reverse=True)
r = [int(item) for item in input().split()]
r.sort(reverse=True)

aa = p[:x]
heapify(aa)
bb = q[:y]
heapify(bb)

for item in r:
    if aa[0] >= item and bb[0] >= item:
        break
    if aa[0] <= bb[0] and aa[0] < item:
        heappop(aa)
        heappush(aa, item)
    elif bb[0] < aa[0] and bb[0] < item:
        heappop(bb)
        heappush(bb, item)
    
ans = sum(aa) + sum(bb)
print(ans)

Measured memory_bytes: 100904
#include <iostream>
using namespace std;

int main(){
  int n,k,q;
  cin >> n >> k >> q;

  int *point = new int[n];
  const int normalFinalPoint = k-q;
  for(int i=0;i<n;i++){
    point[i]=normalFinalPoint;
  }

  int who;
  for(int i=0;i<q;i++){
    cin >> who;
    point[who-1]++;
  }

  // answer
  for(int i=0;i<n;i++){
    if(point[i]>0){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    if(x >= 30) YES;
    else NO;

}


Measured memory_bytes: 3648
#include<iostream>
using namespace std;

main(){
  int n,t,i,c,tt,ans=1001;
  cin >> n >> t;
  for (i=0;i<=n;i++){
    cin >> c >> tt;
    if (tt<=t && ans>c) ans=c;
  }
  if (ans==1001) cout << "TLE" << endl;
  else cout << ans << endl;
}


Measured memory_bytes: 256
K = int(input())
kouho = []


def rec(d, n):
    if d == 12:
        return
    kouho.append(n)

    r = n % 10
    if r == 0:
        rec(d + 1, n * 10 + r)
        rec(d + 1, n * 10 + r + 1)
    elif r == 9:
        rec(d + 1, n * 10 + r)
        rec(d + 1, n * 10 + r - 1)
    else:
        rec(d + 1, n * 10 + r)
        rec(d + 1, n * 10 + r - 1)
        rec(d + 1, n * 10 + r + 1)



# def rec(s):
#     if len(s) == 12:
#         return
#     kouho.append(int(s[::-1]))
#     n = int(s[::-1])
#     if 1 <= n <= 8:
#         rec(s + str(n - 1))
#         rec(s + str(n))
#         rec(s + str(n + 1))
#     if n == 0:
#         rec(s + str(n))
#         rec(s + str(n + 1))
#     if n == 9:
#         rec(s + str(n - 1))
#         rec(s + str(n))

for i in range(1, 10):
    rec(1, i)

kouho.sort()
# print(kouho[:50])
print(kouho[K - 1])


Measured memory_bytes: 29728
a,b = map(int,input().split(" "))
list = []
for i in range(999):
    if i == 0:
        list.append(1)
    else:
        list.append(list[i-1]+i+1)
#print(list)
#print(list[998])

for i in range(998):
    if list[i+1] - list[i] == b - a:
        #print(list[i])
        print(list[i]-a)
        break

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;

int main(){
    int N, M; cin >> N >> M;

    if( abs(N-M) > 1 ){
        cout << 0 << endl;
        return 0;
    }

    if( abs(N-M) <= 1 ){
        long ans = 1;
        for( long i = 1; i <= N; i++ ){
            ans *= i;
            ans %= 1000000007l;
        }
        for( long i = 1; i <= M; i++ ){
            ans *= i;
            ans %= 1000000007l;
        }

        if( abs(N-M) == 0 ){
            ans *= 2;
            ans %= 1000000007l;
        }

        cout << ans << endl;
    }
}

Measured memory_bytes: 256
cards, mark={}, ["S","H","C","D"]
mark.each{|m| cards[m]=(1..13).to_a }
cnt=gets.to_i
(1..cnt).each{|i| a,b=gets.split
  cards[a].delete(b.to_i)
}
mark.each{|m| cards[m].each{|n| puts "#{m} #{n}"}}

Measured memory_bytes: 6104
#include <iostream>
using namespace std;

int main()
{
  int a,b,c,d;
  cin>> a;
  cin >>b;
  cin>>c;
  d=(a*b);
  if(d<c) 
  {
  cout <<d<<endl;
  }
  else
  {
  cout << c<<endl;
  }
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int ans = 0;
  for (int i = 1; i <= 5; ++i) {
    int x;
    cin >> x;
    if (x == 0) ans = i;
  }
  cout << ans << "\n";
}


Measured memory_bytes: 3476
n, m, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))

for i in range(1, n+1): a[i] += a[i-1]
for i in range(1, m+1): b[i] += b[i-1]

b_cnt = m
res = 0
for a_cnt in range(n+1):
    if(a[a_cnt] > k): break
    while(a[a_cnt] + b[b_cnt] > k): b_cnt -= 1
    res = max(res, a_cnt+b_cnt)

print(res)






Measured memory_bytes: 40044
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int N;
	string s, t, ans;

	cin >> N >> s >> t;

	ans = s;

	rrepc(len, N, 0) {
		if (len == 0) ans += t;
		else if (s.substr(N - len, len) == t.substr(0, len)) {
			ans += t.substr(len, N - len);
			break;
		}
	}

	cout << ans.length() << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a;
    char str[50];
    scanf("%d %s",&a,str);
    if(a>=3200)
    {
        printf("%s",str);
    }
    else if(a<3200)
    {
        printf("red\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<int,int>;

const int MOD = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int n, h, w;
    cin >> n >> h >> w;

    int H = n - h + 1;
    int W = n - w + 1;

    cout << H*W << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>

using namespace std;

int main(){
	long long i,x,y;
	
	for(i=1;i<=i;i++){
		cin>>x>>y;
		if(x==0 && y==0) break;
		if(x>y) cout<<y<<" "<<x<<endl;
		  else cout<<x<<" "<<y<<endl;
	}
			      
	return 0;
}


Measured memory_bytes: 3000
n=int(input())
ans=[]
a=[]
b=[]
c=[]
d=[]
for i in range(n):
    x,y=map(int,input().split())
    a.append(x-y)
    b.append(x+y)
a=sorted(a)
b=sorted(b)
ans=[a[-1]-a[0],b[-1]-b[0]]
print(max(ans))


Measured memory_bytes: 103048
A, B, C = [int(_) for _ in input().split()]
if [A, B] == [B, C] and A % 2 == 0:
    print(-1)
    exit()
i = 0
while [A % 2, B % 2, C % 2] == [0, 0, 0]:
    A, B, C = (B + C) / 2, (C + A) / 2, (A + B) / 2
    i += 1
print(i)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(auto i = (N) - 1; i >= 0; i -= 1)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define rand mtrand
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cout << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,...) do { cout << #v << " = "; array_out(v , ##__VA_ARGS__);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
#endif
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = 0x1FFFFFFFFFFFFFFFLL;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}

using P = pair<int,int>;
random_device seed_gen; mt19937_64 mtrand(seed_gen());
constexpr int MOD = 1000000007;
//////////////////////////////////////////


int main(){
  ini(N);
  vi a(N); in(a);
  deque<int> b;
  rep(i,N){
    if( (i + N) % 2) b.push_front(a[i]);
    else b.pb(a[i]);
  }
  vrep(b , it){
    cout << (it==b.begin() ? "" : " ") << *it;
  }
  out();
}

Measured memory_bytes: 3840
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*                                                    
      I ♥ CLARICE STARLING...                                                               
        EXPLAINATION BELOW->
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
const ll INF = (ll)2e18 + 77;
void solve()
{
   ll n,k,i;cin>>n>>k;
   ll a[n];
   fo(i,0,n)cin>>a[i];
   i=k;
   ll j=0;
   while(i<n)
   {
       if(a[i]>a[j])cout<<"Yes\n";
       else cout<<"No\n";
       i++;j++;
    
   }
   
}
int main()
{
   fastio
   //Test_cases
   solve();
  return 0;
}
//**always check if you are not killing input in between
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
// Syntax to create a min heap for priority queue priority_queue <int, vector<int>, greater<int>>; 
//for modinverse use modularexponention(x,M-2,M);
//for "each" subtraction from ans(ans-k) if(ans<0) do ans+=MOD,ans%=MOD
//vector<vector<int>>dp(201,vector<int>(n+1)); A way to initialize vector of vector
//string2=string1.substr(pos,length);if len no specified then till end
//void fill (ForwardIterator first, ForwardIterator last, const T& val);
//The range filled is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last.


//If wrong on pretest 2 means logically wrong
/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


Measured memory_bytes: 5220
#include<bits/stdc++.h>
using namespace std;
namespace io{
	const int l=1<<20;
	char buf[l],*s,*t;
	char gc(){
		if(s==t){
			t=(s=buf)+fread(buf,1,l,stdin);
			return s==t?EOF:*s++;
		}
		return *s++;
	}
	char c;
	template<class IT>inline void gi(IT &x){
		x=0;c=gc();while(c<'0'||c>'9')c=gc();
		while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^'0');c=gc();}
	}
};
using io::gi;
#define ll long long
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}

int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	printf("%d",max(max(a+b,a-b),a*b));
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int a,b,c;
    scanf("%d %d %d",&a, &b, &c);
    if(a==b && c!=a) {
        printf("Yes");
        return 0;
    }
    if(b==c && a!=b){
        printf("Yes");
        return 0;
    }
    if(c==a && b!=c){
        printf("Yes");
        return 0;
    }
    else printf("No");
}

Measured memory_bytes: 128
#include <iostream>
int main(int argc, char *argv[])
{
  int n;
  std::cin >> n;
  if (n < 10){
    std::cout << n << std::endl;
  }
  else if (n < 100)
  {
    std::cout << 9 << std::endl;
  }
  else if (n < 1000){
    std::cout << 9 + (n - 99) << std::endl;
  }
  else if (n < 10000)
  {
    std::cout << 909 << std::endl;
  }
  else if (n < 100000){
    std::cout << 909 + (n - 9999) << std::endl;
  }
  else
  {
    std::cout << 90909 << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main() {
  int K, S;
  cin >> K >> S;
  int ans=0;
  for (int i=0; i<=K; i++) {
    for (int j=0; j<=K; j++) {
      if (i+j >= S-K && i+j <= S) ans++;
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;

int main() {
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s.at(i) == '?'){
            s.at(i) = 'D';
        }
    }
    cout << s << endl;
}

Measured memory_bytes: 3728
use std::io::*;
use std::str::FromStr;

fn main(){
    let (a,b) = (read::<i32>(), read::<i32>());
    println!("{}", if (a+b)%2==0 {(a+b)/2} else {(a+b+1)/2})
}
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin.bytes().map(|c| c.expect("Error") as char) 
        .skip_while(|c| c.is_whitespace()).take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("Error")
}

Measured memory_bytes: 4352