akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

// マクロ
// forループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x)begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
// 出力
#define PRINT(x) cout<<(x)<<endl
#define PRINTA(x,n) REP(i,n)PRINT(x[i])
// 定数
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
// 略記
#define PB push_back
#define MP make_pair

int N;
string S;

int main() {
    cin >> N >> S;
    int ans = 0;
    REP(i, 10) {
        REP(j, 10) {
            REP(k, 10) {
                ll a[] = {i, j, k, 10};
                int ai = 0;
                REP(l, N) {
                    if (S[l] - '0' == a[ai]) ai++;
                }
                if (ai == 3) ans++; 
            }
        }
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int i=1;
    long long int st=100,x;
    scanf("%lld",&x);
    while(i<3800){
        st*=1.01;
        if(st>=x){
            printf("%d",i);
            return 0;
        }else{
            i++;
        }
    }
	return 0;
}

Measured memory_bytes: 1724
import static java.lang.System.*;
import java.util.*;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner sc = new Scanner(in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		
		int count = 0;
		for(int i=Math.min(a, b); i>0; i--) {
			if(a%i==0 && b%i==0) count++;
			if(count==k) {
				out.println(i);
				break;
			}
		}
	}

}


Measured memory_bytes: 22868
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

// Self settings
// clang-format off
#define MAX_N 100000
#define MAX_M 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
// clang-format on
int N, M;
int dp[MAX_N + 1];
vector<int> G[MAX_N + 1];

int f(int x)
{
  if (dp[x] > 0) return dp[x];
  int fans = 0;
  for (int i = 0; i < G[x].size(); i++) fans = max(fans, f(G[x][i]) + 1);
  return dp[x] = fans;
}

void solve()
{
  int ans = 0;
  for (int i = 0; i < N; i++) ans = max(ans, f(i));
  cout << ans << endl;
}

int main(void)
{
  scanf("%d%d", &N, &M);
  int x, y;
  REP(i, M)
  {
    scanf("%d%d", &x, &y);
    x--, y--;
    G[x].push_back(y);
  }
  solve();
  return 0;
}


Measured memory_bytes: 8192
from math import factorial


def main():
    dog, monkey = map(int, input().split())
    answer = 0
    mod = 10 ** 9 + 7
    if dog == monkey or dog + 1 == monkey or dog - 1 == monkey:
       answer = (factorial(dog) % mod) * (factorial(monkey) % mod) % mod
       if dog == monkey:
            answer = answer * 2 % mod
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 4216
program main
  implicit none
  integer :: n, i, res, x
  character(100) :: s
  read (*, *) n
  read (*, *) s
  x = 0
  res = 0
  do i = 1, n
    if (s(i:i) == "I") then
      x = x + 1
    else
      x = x - 1
    end if
    res = max(res, x)
  end do
  write (*, "(i0)") res
end program main


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

string S;
int ctr[100001];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> S;
  string T = "";
  for (char c : S) {
    if (c != 'x') T += c;
    else ctr[T.length()]++;
  }
  string Trev(T); reverse(all(Trev));
  if (T != Trev) {
    cout << -1 << "\n";
    return 0;
  }

  int len = T.length();
  int l = (len-1)/2, r = (len+1)/2;
  if (len % 2 == 0) l = len/2-1, r = len/2+1;
  int s = 0;
  for (; l>=0 && r<=T.length(); l--, r++) {
    s += abs(ctr[l]-ctr[r]);
  }
  cout << s << "\n";
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) {
    cin >> A.at(i);
  }
  sort(A.rbegin(), A.rend());
  
  int t = N - 1;
  long long ans = 0;
  rep(i, N) {
    int lim = 2;
    if(i == 0) lim = 1;
     rep(j, lim) {
      if(t > 0) {
        ans += A.at(i);
        t--;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3916
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

S = input()[:-1]
N = len(S)
ans = 0
left = 0
right = N-1

while left <= right:
    if S[left] == S[right]:
        left += 1
        right -= 1
    elif S[left] == "x":
        left += 1
        ans += 1
    elif S[right] == "x":
        right -= 1
        ans += 1
    else:
        print(-1)
        break
else:
    print(ans)


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

int main()
{
    int x[5];
    for (int i = 0; i < 5; i++)
    {
        cin >> x[i];
        if (x[i] == 0)
        {
            cout << i + 1 << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3596
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#define RG register
using namespace std;
int n;
char s[101],t[101];
void dfs(int st)
{
	for(int i=st,j=1;i<=n;i++,j++)
	{
		if(s[i]!=t[j]) return dfs(st+1);
	}
	printf("%d\n",st+n-1);
	exit(0);
}
int main()
{
	//freopen("Encyclopedia of Permutations.in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d%s%s",&n,s+1,t+1);
	dfs(1);
	//fclose(stdin); fclose(stdout);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main (void)
{
    long long N;
    long long ans=0;
    long long i,s;

    scanf("%lld",&N);


    // }

    if(N<10){
        ans=N;
    }else if(N<100){
        ans=9;

    }else if(N<1000){
        ans=9+N-99;

    }else if(N<10000){
        ans=909;
    }else if(N<100000){
        ans=909+N-9999;
    }else{
        ans=90909;
    }

    printf("%lld",ans);

    return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
n = int(input())
al = list(map(int, input().split()))

def gcd(a,b):
    while b>0:
        a,b = b,a%b
    return a

ll = [0]*n
ll[0] = al[0]
for i in range(1,n):
    ll[i] = gcd(al[i], ll[i-1])

rl = [0]*n
rl[n-1] = al[n-1]
for i in range(n-2,-1,-1):
    rl[i] = gcd(al[i],rl[i+1])

res = -1

for i in range(n):
    if i==0:
        res = max(res, rl[1])
    elif i==n-1:
        res = max(res, ll[n-2])
    else:
        res = max(res, gcd(ll[i-1],rl[i+1]))

print(res)


Measured memory_bytes: 14440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ALL(a) (a).begin(), (a).end()

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        a[i]*=2;
    }
    ll b[n];
    ll count=0;
    for(int i=0;i<n;i++){
        if(i%2==0){
            count+=a[i];
        }
        else{
            count-=a[i];
        }
    }
    
    b[0]=count/2;
    for(int i=1;i<n;i++){
        b[i]=a[i-1]-b[i-1];
    }
    for(int i=0;i<n;i++){
        cout<<b[i]<<endl;
    }
}


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

int main(){

    while(1){
        int w,h;
        cin >> w >> h;
        if(w==0&&h==0){
            break;
        }
        vector<vector<int>> t(h,vector<int>(w-1));
        vector<vector<int>> y(h-1,vector<int>(w));
        rep(i,2*h-1){
            if(i%2==0){
                rep(j,w-1){
                    cin >> t[i/2][j];
                }
            }else{
                rep(j,w){
                    cin >> y[i/2][j];
                }
            }
        }
        queue<pair<int,int>> q;
        q.push({0,0});
        int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
        vector<vector<int>> f(h,vector<int>(w,-1));
        f[0][0]=1;
        while(q.size()!=0){
            pair<int,int> now=q.front();
            q.pop();
            rep(i,4){
                int nx=now.first+dx[i];
                int ny=now.second+dy[i];
                if(0<=nx&&nx<w&&0<=ny&&ny<h&&f[ny][nx]==-1){
                    //cout << now.first << " " << now.second <<" " << i << endl;
                    if(i==0&&y[now.second][now.first]==1)continue;
                    if(i==1&&t[now.second][now.first]==1)continue;
                    if(i==2&&y[now.second-1][now.first]==1)continue;
                    if(i==3&&t[now.second][now.first-1]==1)continue;
                    f[ny][nx]=f[now.second][now.first]+1;
                    q.push({nx,ny});
                }
            }
        }
        f[h-1][w-1]=max(f[h-1][w-1],0);
        cout << f[h-1][w-1] << endl;
    }

    return 0;
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9 + 7;
const int INF = 9e18;

signed main(){
    int N;
    cin >> N;
    vector<int> A(N);
    cin >> A;
    map<int, int> check;
    check[-1] = 3;
    vector<int> count(N);
    for (int i = 0; i < N; i++) {
        count[i] = check[A[i] - 1];
        check[A[i] - 1]--;
        check[A[i]]++;
    }
    int ans = 1;
    for (int i = 0; i < N; i++) {
        ans = (ans * count[i]) % MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 8064
#include<iostream>
#include<algorithm>
#include<set>
#include<vector>
using namespace std;
const int maxn = 100001;

vector<int> G[maxn];
struct Edge
{
    int u, v;
};

vector<Edge> ans;
bool cmp(Edge a, Edge b)
{
    if(a.u != b.u)
        return a.u < b.u;
    else
        return a.v < b.v;
}
int n, e;
int prenum[maxn], parent[maxn], lowest[maxn], vis[maxn];
int cnt;
void dfs(int i,int Father)
{
    parent[i]=Father;
    prenum[i]=lowest[i]=cnt++;
    for(int j=0;j<G[i].size();++j)
    {
        int k=G[i][j];
        if(prenum[k]==-1)
        {
            dfs(k,i);
            lowest[i]=min(lowest[i],lowest[k]);
        }
        else if(Father!=k)
            lowest[i]=min(lowest[i],prenum[k]);
    }
}

void bridge()
{
    for(int i = 0; i < n; i++)
        prenum[i] = -1;
    cnt = 0;
    parent[0] = -1;
    dfs(0, -1);
    int rootCnt = 0;

    for(int i = 1; i < n; i++)
    {
        int p = parent[i];
        if(p == 0) rootCnt++;
        if(prenum[p] < lowest[i])
        {
            Edge e;
            if(p < i)
            {
                e.u = p;
                e.v = i;
            }
            else
            {
                e.u = i;
                e.v = p;
            }
            ans.push_back(e);
        }
    }

    sort(ans.begin(), ans.end(), cmp);
    for(int i = 0; i < ans.size(); i++)
        cout << ans[i].u << " " << ans[i].v << endl;
}

int main()
{
    cin >> n >> e;
    for(int i = 0; i < e; i++)
    {
        int u, v;
        cin >> u >> v;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    bridge();
    return 0;
}



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

#define TRUE 1
#define FALSE 0
#define MAX 10000

int isprime(int);

int main()
{
  int i, n, num = 0;
  int numbers[MAX];

  scanf("%d", &n);
  for(i=0; i<n; i++) {
    scanf("%d", &numbers[i]);
  }

  for(i=0; i<n; i++) {
    if(isprime(numbers[i]) == TRUE)
      num++;
  }
  printf("%d\n", num);
  return 0;
}

int isprime(int number)
{
  int i = 3;
  if(number == 2)
    return TRUE;
  if(number<2 || number%2==0)
    return FALSE;
  while(i <= sqrt(number)) {
    if(number%i == 0)
      return FALSE;
    i+=2;
  }
  return TRUE;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  vector<string> blue(N);
  for(int i=0; i<N ;i++){
    cin >> blue.at(i);
  }
  int M;
  cin >> M;
  vector<string> red(M);
  for(int i=0; i<M; i++){
    cin >> red.at(i);
  }
  int maximum = 0;
  for(int i=0;i<N; i++){
    int count = 0;
    string str = blue.at(i);
    for(int j=0;j<N;j++){
      if(blue.at(j) == str){
        count++;
      }
    }
    for(int k=0;k<M;k++){
       if(red.at(k) == str){
        count--;
      }
    }
    maximum = max(maximum,count);
  }
  cout << maximum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <set>
#include <sstream>
#include <cmath>
#include <deque>
#include <list>
#include <bitset>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long int64;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define FST first
#define SND second

signed main(){
    lint H, W, N;
    cin >> H >> W >> N;
    map<P, int> m;
    REP(i, N){
        int a, b; cin >> a >> b;
        FOR(i, a-1, a+2){
            FOR(j, b-1, b+2){
                if(i>1 and i<H and j>1 and j<W){
                    m[P(i, j)]++;
                }
            }
        }
    }
    vector<lint> res(10, 0);
    for(auto &cnt: m){
            res[cnt.second]++;
    }
    lint sum = (H-2)*(W-2);
    for(int i=1; i<10; i++) sum -= res[i];
    res[0] = sum;
    REP(i, 10){
        cout << res[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 56448
import numpy as np

N, K = map(int,input().split())
d_list = []
A_list = []
sunuke = np.ones(N)

for i in range(K):
    d = int(input())
    A_list = list(map(int, input().split()))

    for j in range(d):
        sunuke[A_list[j]-1] -= 1

nokori = sunuke[sunuke > 0]
print(len(nokori))


Measured memory_bytes: 27016
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) printf(f,##__VA_ARGS__),fflush(stdout)

typedef long long ll;

const int N=105;

int n,m,ans;
char ult,s[N],t[N]; 

bool chk(){
	rep(i,2,m)if(t[i]!=t[i-1])return false;
	return true;
}

void op(){
	rep(i,1,m-1){
		if(t[i]==ult||t[i+1]==ult)t[i]=ult;
	}
	--m;
}

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	freopen("dat.in","r",stdin);
	freopen("my.out","w",stdout);
#endif
	scanf("%s",s+1); 	
	n=strlen(s+1); 
	for(ult='a';ult<='z';++ult){
		m=n;
		rep(i,1,m)t[i]=s[i]; 
		while(!chk()){
			op(); 
		}
		cmax(ans,m); 
	}
	printf("%d\n",n-ans);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

#define mod 1000000007

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; }

int N;
long long sum=0,sum2=0,mini;

int main(){
    cin>>N;
    int a[N];
    rep(i,N){
        cin>>a[i];
        sum+=a[i];
    }
    mini=abs(sum-2*a[0]);
    rep(i,N-1){
        sum2+=a[i];
        mini=min(mini,abs(sum-2*sum2));
    }
    out(mini);
    return 0;
}

Measured memory_bytes: 1024
n = int(input())
T = list(map(int, input().split()))
m = int(input())
PX = []
for i in range(m):
    p, x = map(int, input().split())
    p -= 1
    PX.append((p, x))

S = sum(T)
for i in range(m):
    p, x = PX[i]
    ans = S - T[p] + x
    print(ans)


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}

template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}

template <class T>
T Sq(const T &t) {
  return t * t;
}

signed main() {
  int n = read();
  if (n % 2 == 0)
    print(n);
  else
    print(n * 2);
}


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

int main(){
    int N;
    cin >> N;
    int A[110];
    double mother = 0;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        mother += (double)1/(double)A[i];
    }
    cout << fixed;
    cout << setprecision(5);
    cout << ((double)1 / (double)mother) << endl;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a, b, c, n;
string s;



int main()
{
	
  cin>>s;
  sort(all(s));
  if(s=="abc")
    cout<<"Yes"<<endl;
  else
	cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <stack>
#include <queue>
#include <set>

#define mod 1000000007
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    set<string> st;
    string a;
    rep(i, n){
        cin >> a;
        st.insert(a);
    }
    cout << st.size();
    return 0;
}

Measured memory_bytes: 19216
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  string s;
  cin >> s;
  string k = "keyence";
  rep(i,sz(s)) {
    srep(j,i,sz(s)+1) {
      string a = s.substr(0,i) + s.substr(j,sz(s)-j);
      if(sz(a) == sz(k) && a ==k) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    ll ans = 0;
    ans += abs(a[0]);
    ans += abs(a[n-1]);
    for(int i = 0; i < n-1; i++)
        ans += abs(a[i+1]-a[i]);
    ll fans = ans;
    fans -= abs(a[0])+abs(a[0]-a[1]);
    fans += abs(a[1]);
    cout << fans << endl;
    for(int i = 1; i < n-1; i++){
        fans = ans;
        fans -= abs(a[i]-a[i-1])+abs(a[i+1]-a[i]);
        fans += abs(a[i+1]-a[i-1]);
        cout << fans << endl;
    }
    fans = ans;
    fans -= abs(a[n-1])+abs(a[n-1]-a[n-2]);
    fans += abs(a[n-2]);
    cout << fans << endl;
    return 0;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int N,M,Q;
vector<int> a,b,c,d;
ll ans = 0;

void DFS(vector<int> &V){
    if(V.size()==N+1){
        ll tmp = 0;
        rep(i,Q){
            if(V[b[i]]-V[a[i]]==c[i]){
                tmp += d[i];
            }
        }
        ans = max(ans,tmp);
        return;
    }else{
        int tail = V.back();
        for(int i=tail;i<=M;i++){
            V.push_back(i);
            DFS(V);
            V.pop_back();
        }
    }
}
int main(){
    cin >> N >> M >> Q;
    rep(i,Q){
        int a_,b_,c_,d_;
        cin >> a_ >> b_ >> c_ >> d_;
        a.push_back(a_);
        b.push_back(b_);
        c.push_back(c_);
        d.push_back(d_);
    }
    vector<int> V(1,1);
    DFS(V);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
{-# LANGUAGE OverloadedStrings, OverloadedLists, UnboxedTuples, TemplateHaskell #-}

import Data.List
import Data.List.Split
import qualified Data.Map as M

main = do
    --a <- readFile "in"
    a <- getContents

    let aa = splitOn "\n" a

    -- orders
    let a1 = head aa
    let a2 = splitOn " " $ head $ tail aa
    let b1 = head $ tail $ tail $ init aa
    let b2 = splitOn " " $ head $ tail $ tail $ tail $ init aa

    let i = concatMap (\x -> map (\y -> if x == y then (show y) else "") b2) a2
    let a = foldl' aaa M.empty i

    --print a1
    --print a2
    --print b1
    --print b2
    let aa = M.delete "" a
    print $ M.size aa

    return ()

aaa :: M.Map String String -> String -> M.Map String String
aaa m s = M.insert s "" m



Measured memory_bytes: 5884
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int n,m,a[20],b[20],i,j,c,ans=1e9,s,d;
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++)scanf("%d %d",&a[i],&b[i]);
  for(i=0;i<(1<<n);i++){
    s=m/100;
    for(j=c=0;j<n;j++){
      if(i&(1<<j)){
	s-=b[j]/100+a[j]*(j+1);
	c+=a[j];
      }
    }
    for(j=n;j;j--){
      if((i&(1<<(j-1)))||s<=0)continue;
      d=MIN((s-1)/j+1,a[j-1]);//printf("s%d %d\n",s,d);
      s-=d*j;
      c+=d;
    }
    if(s<=0)ans=MIN(ans,c);//printf("%d %d\n",c,i);
  }
  printf("%d\n",ans);
  return 0;
}
      


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

const int mod = 1e9+7;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> grid(h);
    rep(i,h) cin >> grid[i];
    vector<vector<int>> dp(h, vector<int>(w, 0));
    dp[0][0] = 1;
    rep(i,h){
        rep(j,w){
            if(i == 0 && j == 0) continue;
            if(grid[i][j] == '.'){
                if(i != 0 && grid[i-1][j] == '.')
                    dp[i][j] += dp[i-1][j];
                    dp[i][j] %= mod;
                if(j != 0 && grid[i][j-1] == '.')
                    dp[i][j] += dp[i][j-1];
                    dp[i][j] %= mod;
            }
        }
    }
    cout << dp[h-1][w-1] << endl;
}


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

const int INF = 1e9;
const int N = 20020;
const int M = 260;
const int S = 128;
int dp[N][M];

signed main() {
    while(true) {
        int n, m;
        cin >> n >> m;
        if (n == 0 && m == 0) {
            break;
        }

        rep(i,N) rep(j,M) dp[i][j] = INF;
        vector<int> code(m);
        vector<int> a(n);
        rep(i, m) cin >> code[i];
        rep(i, n) cin >> a[i];

        for(int i = 0; i < m; i++){
            int x = code[i] + S;
            if(x >= 255) x = 255;
            if(x <= 0) x = 0;
            dp[0][x] = (x - a[0]) * (x - a[0]);
        }

        for(int i = 1; i < n; i++){
            for(int j = 0; j < M; j++){
                for(int k = 0; k < m; k++){
                    int x = j + code[k];
                    if(x >= 255) x = 255;
                    if(x <= 0) x = 0;
                    int sq = (x - a[i]) * (x - a[i]);
                    dp[i][x] = min(dp[i][x], dp[i-1][j] + sq);
                }
            }
        }

        int ans = INF;
        for(int i = 0; i < M; i++) ans = min(ans,dp[n-1][i]);
        cout << ans << endl;
    }
}




Measured memory_bytes: 43836
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
//typedef __int64 LL;
typedef vector<int> ivec;
typedef vector<string> svec;
int a[200020];
//ivec ans;
int main(){
	int n;
	cin>>n;
	for(int i=2;i<=n;i++)
	{
		int x;
		cin>>x;
	        a[x]++;
	}
	for(int i=1;i<=n;i++)
	{
		cout<<a[i]<<endl;
	}
}

Measured memory_bytes: 4368
#include<bits/stdc++.h>
using namespace std;
#define ar array
#define endl '\n'
#define ll long long
#define in insert
#define pb push_back
#define vt vector
#define P_Q(x) priority_queue<x>
#define p_q(x) priority_queue<x, vector<x>, greater<x>>
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(ll i=a;i>=b;i--)
#define FOR(m) Rep(i,1,m)
#define For(m) Rep(i,0,m-1)
#define Rbl(x,a) for(auto &x : a)
#define FIO ios::sync_with_stdio(0);   cin.tie(0);
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define vpii vector<pii>
#define vpll vector<pll>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
const ll INF = 1e7;
#define mod 1000000007
 
const int mxN = 1e5 + 1;
ll a[mxN];
ll w[mxN];
vt<ll> dp(mxN, 2e9);
ll n, W;
 
 
int main()
{
FIO
 
    cin >> n >> W;
    FOR(n) cin >> w[i] >> a[i];
    dp[0] = 0;
    Rep(i,1,n)
    {
        Rev(j,100000,1)
        {
            if(a[i] <= j && dp[j-a[i]] < W)
            {
                dp[j] = min(dp[j], dp[j-a[i]] + w[i]);
            }

        }
    }

    for(int i = 100000; i >= 0; i--)
    {
        if(dp[i] <= W)
        {
            cout << i << endl;
            return 0;
        }
    }
    

    // cout << ans << endl;
    
}

Measured memory_bytes: 3852
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  scanf("%d", &n);
  map<int, int> cnt;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  int ret = 0;
  for (auto& it : cnt) {
    ret += it.second - 1;
  }
  n -= (ret + 1) / 2 * 2;
  printf("%d\n", n);
  return 0;
}


Measured memory_bytes: 4992
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    string s;
    cin >> s;
    s[1] ^= 'B' ^ 'R';
    cout << s << endl;

    return 0;
}


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

int main()
{
    int x;
    int res = 0;
    int time = 0;
    cin >> x;
    while (res < x){
        res = time*(time+1)/2;
        time += 1;
    }
    time -= 1;
    

    cout << time << endl;
}


Measured memory_bytes: 3620
#include <stdio.h>
int main(){
	//A = *2
	//B = +k
	//N test cases
	int N, k;	//N divisor B	
	scanf("%d %d", &N, &k);
	
	if(k%N==0){	//kalo b bisa dibagi a, jumlahkan
		printf("%d", k+N);
	}
	else {		//kalo ga kurangin
		printf("%d", k-N);
	}
	
	return 0;
}

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

using namespace std;

int main(){
        string s;
        cin>>s;
        int i1=-1, i2=-1;
        for(int i=0;i<(int)s.length()-1;i++){
                if(s[i]==s[i+1]){
                        i1=i+1;
                        i2=i+2;
                        break;
                }
                else if(i!=(int)s.length()-2&&s[i]==s[i+2]){
                        i1=i+1;
                        i2=i+3;
                        break;
                }
        }
        cout<<i1<<" "<<i2<<endl;
        return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int R=1,C=1,H[2000010],N[2000010];
//評価関数（いまはMIN）
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]<N[H[b]]?1:0;
}
//挿入関数
void hin(int a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//取り出す関数
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
  return rt;
}
int main(){
  int n,m,a,d[200010],i,r=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a);
    hin(a);
  }
  for(i=0;i<n;i++)d[i]=N[hout()];
  R=C=1;
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&a);
    hin(a);
  }
  d[n]=-1;
  //for(i=0;i<=n;i++)printf("%d\n",d[i]);
  for(i=0;i<m;i++){
    a=N[hout()];//printf("%d\n",a);
    while(d[r]<a&&r<n)r++;
    if(d[r++]-a)goto END;
  }
  printf("YES\n");
  return 0;
 END:;
  printf("NO\n");
  return 0;
}


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

int main(void) {
    int N;cin>>N;
    int X[N+1];
    X[0] = 0;
    for (int i = 1; i <= N; i++) cin>>X[i];
    int M;cin>>M;
    for (int i = 1;i <= M; i++) {
        int A;cin>>A;
        if (A == N) {
            if (X[N] < 2019) X[N] += 1;
        } else {
            if (X[A] < X[A + 1] - 1) X[A] += 1;
        }
    }
    for (int i = 1; i <= N; i++) cout << X[i] << endl;
    return 0;
}


Measured memory_bytes: 3104
using System;

class Program
{
  public static void Main(string[] args)
  {
    while(true)
    {
      string[] read = Console.ReadLine().Split(' ');
      int H = int.Parse(read[0]);
      int W = int.Parse(read[1]);
      if(H == 0 && W == 0) break;
      for(int i = 0;i < H;i++)
      {
        for(int j = 0;j < W;j++)
        {
          if(i == 0 || i == H - 1 || j == 0 || j == W - 1) {
            Console.Write("#");
          } else Console.Write(".");
        }
        Console.WriteLine();
      }
      Console.WriteLine();
    }
  }
}

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

const int MOD = 1000000007;
int main() {
  
  int n;
  cin>>n;
  long cnt =1;
  for (long i = 0; i < n; ++i) {
    cnt = (cnt*(i+1))%MOD;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $n, $k);
$stdin = trim(fgets(STDIN));
$l_arr = explode(" ", $stdin);

rsort($l_arr);

$result = 0;
for ($i = 0; $i < $k; $i++) {
	$result += $l_arr[$i];
}

echo $result . "\n";

?>


Measured memory_bytes: 4856
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
using namespace std;
struct Node
{
    int key;
    Node *right,*left,*parent;
};
Node *root,*NIL;

void insert(int k)
{
    Node *y=NIL;
    Node *x=root;
    Node *z;

    z=(Node *)malloc(sizeof(Node));
    z->key=k;
    z->left=NIL;
    z->right=NIL;

    while(x!=NIL)
    {
        y=x;
        if(z->key<x->key)
        {
            x=x->left;
        }
        else
        {
            x=x->right;
        }
    }
    z->parent=y;
    if(y==NIL)
    {
        root=z;
    }
    else
    {
       if(z->key<y->key)
       {
            y->left=z;
       }
     else
     {
        y->right=z;
     }
    }
}
void inorder(Node *u)
{
    if(u==NIL)return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node *u)
{
    if(u==NIL)return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}
int main()
{
    int n,i,x;
    string com;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        cin>>com;
        if(com=="insert")
        {
            scanf("%d",&x);
            insert(x);
        }
        else if(com=="print")
        {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 26700
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X))
#define rrep(X, Y) for (int(X) = (Y)-1; (X) >= 0; --(X))
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const long long MOD = 1000000007;

void solve(long long N, std::vector<std::string> S) {
  ll ans;
  bool isVert;
  int n;

  if (S[0][0] == S[0][1]) {
    ans = 6;
    isVert = false;
    n = 2;
  } else {
    ans = 3;
    isVert = true;
    n = 1;
  }

  while (n < N) {
    if (n + 1 < N && S[0][n] == S[0][n + 1]) {
      if (isVert) {
        ans *= 2;
        ans %= MOD;
        isVert = false;
      } else {
        ans *= 3;
        ans %= MOD;
        isVert = false;
      }
      n += 2;
    } else {
      if (isVert) {
        ans *= 2;
        ans %= MOD;
      }
      isVert = true;
      n++;
    }
  }

  print(ans);
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<std::string> S(2);
  for (int i = 0; i < 2; i++) {
    std::cin >> S[i];
  }
  solve(N, std::move(S));
  return 0;
}


Measured memory_bytes: 256
//XOR_IS_FRUSTRATED

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;


#define fastio ios_base::sync_with_stdio(false), cin.tie(NULL)
#define rep(a,x,b) for(a=x;a<b;a++)
#define repv(a,it) for(auto it=a.begin();it!=a.end();it++)
#define repr(a,x,b) for(a=x;a>=b;a--)
#define pb 
#define mm(a,x) memset(a,x,sizeof(a))
#define all(v) (v).begin(), (v).end()
#define pll pair<ll, ll>
#define mp map<pair<ll,ll>,ll>
#define ret(a) return a
#define br break
#define con continue

ll mod=pow(10,9)+7;
ll n,m,a[1000005],i,j,t,k;
ll prime[1000005]={0};
vector<ll>vprime;
ll max3(ll a, ll b, ll c)
{
        ret(max(a,max(b,c)));
}
ll min3(ll a, ll b, ll c)
{
        ret(min(a,min(b,c)));
}
ll inv(ll x1,ll y1)
{
        if(y1==0)
                ret(1);
        ll temp=inv(x1,y1/2);
        temp=(temp*temp)%mod;
        if(y1%2)
                temp=(temp*x1)%mod;
        ret(temp);        
}
ll inv1(ll a1,ll m1)
{
        ll m0=m1,x0=0,y0=1;
        if(m1==1)
                ret(0);
        while(a1>1)
        {
                ll q=a1/m1;
                ll temp=m1;
                m1=a1%m1;
                a1=temp;
                temp=y0;
                y0=x0-q*y0;
                x0=temp;
        }
        x0=(x0+m0)%m0;
        ret(x0);
}

void sieve()
{
        rep(i,2,1000)
        {
                if(prime[i]==0)
                {
                        
                        for(j=i*i;j<=1000000;j+=i)
                                prime[j]=1;
                }
        }
        rep(i,2,1000001)
        {
                if(prime[i]==0)
                    vprime.push_back(i);
        }
}

int main()
{
        
        fastio;
        cin>>n;
        rep(i,1,n+1)
                cin>>a[i];
        ll b[n+1],c[n+1];        
        rep(i,1,n+1)
        {
                cin>>b[i];
        }
        rep(i,1,n)
                cin>>c[i];
        ll ans=b[a[1]];
        ll prev=a[1];
        rep(i,2,n+1)
        {
                if(prev+1==a[i])
                {
                        ans+=c[prev];
                        
                }
                ans+=b[a[i]];
                prev=a[i];
        }
        cout<<ans;
        
        
        
        
        
        
        ret(0);
}

Measured memory_bytes: 2304
import itertools

H, W, K = list(map(int,input().split()))
board = []
for i in range(H):
    row = input()
    board.append(row)

result = []
for n in range(len(board)+1):
    for conb in itertools.combinations(board, n):
        result.append(list(conb))

rotate_result = []
for i in range(len(result)):
    rotate_result.append([list(x) for x in zip(*result[i])])

ans = 0
result2 = []
for i in range(len(rotate_result)):
    for j in range(len(rotate_result[i])+1):
        for conb in itertools.combinations(rotate_result[i], j):
            result2.append(list(conb))
            l = list(itertools.chain.from_iterable(list(conb)))
            if l != []:
                count = 0
                for k in range(len(l)):
                    if l[k] == "#":
                        count += 1
                    if k == len(l)-1 and count == K:
                        ans += 1

print(ans)


Measured memory_bytes: 74444
N = int(input())
a = list(map(int, input().split()))

diff = []
former = a[0]
latter = sum(a[1:])
diff = [abs(a[0]-sum(a[1:]))]
for n in range(1,N-1):
    former += a[n]
    latter -= a[n]
    diff.append(abs(former-latter))
print(min(diff))





Measured memory_bytes: 24812
# Python template 
from collections import defaultdict 
import sys
import math 

def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

(n,x,t) = get_ints()
print(math.ceil(n/x)*t)

Measured memory_bytes: 9368
import java.io.*;
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] P = new int[N];
        for(int n=0; n<N; n++) P[n]=sc.nextInt();

        int ans = 0;
        int min = 1000000;
        for(int n=0; n<N; n++){
            if(P[n] < min) ans++;
            min = Math.min(min, P[n]);
        }
        System.out.println(ans);
    }


}


Measured memory_bytes: 87388
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

int a, b;

int main() {
	cin >> a >> b;


	int ans1 = a + b;
	int ans2 = a - b;
	int ans3 = a * b;
	

	cout << max({ ans1,ans2,ans3 }) << endl;
}

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

int main(){
	int N;
	cin>>N;
	int res=100000;
	for(int i=1;i<=N;i++){
		res=res*105/100;
		res=(res+999)/1000*1000;
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 2988
from sys import stdin, stdout
input = stdin.readline
print = stdout.write
from functools import reduce
n, k = map(int,input().split())
a = list(map(int,input().split()))
prod = a[0]
ans = []
for i in range(k,n):
    prod = a[i-k]
    prodt = a[i]
    if prodt>prod:
        ans.append('Yes')
    else:
        ans.append('No')
ans = '\n'.join(ans)
print(ans)

Measured memory_bytes: 105524
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
lis1 = [i for i in range(1,N+1)]
lis2 = [i for i in range(1,N+1)]
def number(a, lis):
  total_order = 1
  for i in range(N):
    tmp_order = lis.index(a[i])
    lis.remove(a[i])
    total_order += tmp_order * math.factorial(len(lis))
  return total_order
print(abs(number(P, lis1) - number(Q, lis2)))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool dfs(int st,int par,vector<vector<int> >&adj,vector<int>&p,vector<int>&h,vector<int>&g,vector<int>&b){
    bool ans=true;
    int flag=0;
    int x,y;
    for(int j=0;j<adj[st].size();j++){
        if(adj[st][j]!=par){
        //cout<<adj[st][j]<<" "<<par<<" "<<st<<endl;
            flag=1;
            ans=ans&dfs(adj[st][j],st,adj,p,h,g,b);
            g[st]+=g[adj[st][j]];
            b[st]+=b[adj[st][j]];
            p[st]+=p[adj[st][j]];
        }
    }
    if(flag==0){
        if(abs(h[st])>p[st]){
        	//cout<<st<<endl;
        	return false;
		}
        else {
            g[st]=(p[st]+h[st])/2;
            b[st]=(p[st]-h[st])/2;
            //cout<<st<<" "<<p[st]<<" "<<h[st]<<" "<<g[st]<<" "<<b[st]<<endl;
            if(g[st]+b[st]==p[st])
            return true;
            else return false;
        }
    }
    else{
        int x=(p[st]+h[st])/2;
        int y=(p[st]-h[st])/2;
        //cout<<st<<" "<<p[st]<<" "<<h[st]<<" "<<g[st]<<" "<<b[st]<<" "<<ans<<endl;
        if(x<0||y<0||(x+y)!=p[st]||(x-y)!=h[st]||abs(h[st])>p[st]||x<g[st])return ans&false;
        else {
        	g[st]=x;
        	b[st]=y;
        	return ans&true;
		}
    }
}

int main()
{
    int k;
    cin>>k;
    int ans=1;
    int mod=7%k;
    int N=1e6+5;
    while(mod!=0 && ans<N) {
        mod=(mod*10+7)%k;
        ans++;
    }
    if(mod==0)
        cout<<ans<<endl;
    else
        cout<<-1<<endl;
}


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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

using namespace std;

const int MOD = 1e9 + 7;
const int MAX = 510000;

int main()
{
	cin.tie(0); ios::sync_with_stdio(false);

	int n;
	cin >> n;

	vector<string> s(n);
	rep (i, 0, n)
		cin >> s[i];

	ll m, a, r, c, h;
	m = a = r = c = h = 0;
	rep (i, 0, n) {
		if (s[i][0] == 'M')
			m++;
		else if (s[i][0] == 'A')
			a++;
		else if (s[i][0] == 'R')
			r++;
		else if (s[i][0] == 'C')
			c++;
		else if (s[i][0] == 'H')
			h++;
	}

	ll res = (m * a * r) + (m * a * c) + (m * a * h) + (m * r * c) + (m * r * h) + (m * c * h) + (a * r * c) + (a * r * h) + (a * c * h) + (r * c * h);
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 5760
use proconio::input;
use std::f64::consts::PI;

fn main() {
    input! {
        a: f64,
        b: f64,
        h: f64,
        m: f64,
    }
    let minutes = h * 60.0 + m;
    let rad = (5.5 * minutes % 360.0) / 180.0 * PI; 
    let distance = (a*a + b*b - 2.0*a*b*rad.cos()).sqrt();

    println!("{}", distance);

}


Measured memory_bytes: 3060
//abc144A

#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void) {
  int n, i, j;
  scanf("%d", &n);

  for(i=1; i < 10; i++)
    for(j=1; j < 10; j++)
      if(i * j == n){
        printf("Yes");
        return 0;
      }
  printf("No");
  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 rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll fac(ll n){
    if (n > 0) {
        return  n * fac(n - 1);
    }else{
        return 1;
    }
}

int main()
{
    int h,w;
    cin >> h >> w;
    vector<string> s(h + 2,".");
    rep(i, w + 1){
        s[0] += '.';
        s[h + 1] += '.';
    }
    string t;
    nfor(i, 1, h + 1){
        cin >> t;
        s[i] += t;
        s[i] += '.';
    }
    nfor(i, 1, h + 1){
        nfor(j, 1, w + 1){
            if (s[i][j] == '#') {
                if (s[i + 1][j] == '#') {
                }else if (s[i][j - 1] == '#') {
                }else if (s[i][j + 1] == '#') {
                }else if (s[i - 1][j] == '#') {
                }else{
                    No;
                    return 0;
                }
            }
        }
    }
    Yes;
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	nums := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&nums[i])
	}
	var count int
	flag := true
	for flag {
		flag = false
		for i := N - 1; 0 < i; i-- {
			if nums[i] < nums[i-1] {
				nums[i], nums[i-1] = nums[i-1], nums[i]
				count++
				flag = true
			}
		}
	}
	for i, v := range nums {
		if i != 0 {
			fmt.Print(" ")
		}
		fmt.Print(v)
	}
	fmt.Println()
	fmt.Println(count)
}



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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int main(void){

	
	ll N; cin >> N;

	ll ans = 0;
	ll d = (int)(sqrt(double(N))) + 1;
	while(d > 0){
		if(N % d == 0){
			ll p = N / d;
			ll q = N / p;
			ans = p - 1 + q - 1;
			break;
		}
		d--;

	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

long long gcd(long long x, long long y) {
    long long a = min(x, y), b = max(x, y);
    if (b % a == 0)
        return a;
    
    return (gcd(a, b%a));
}

int main() {
    long long n, *a;
    cin >> n;
    a = new long long[n];
    for (int i =0; i < n;i++)
        cin >> a[i];

    long long *r = new long long[n], *l = new long long[n];

    l[0] = a[0];
    r[n-1] = a[n-1];

    for (int i = 1; i < n; i++) {
        l[i] = gcd(l[i-1], a[i]);
        r[n-i-1] = gcd(r[n-i], a[n-i-1]);
    }

    long long ans = r[1];

    for (long long i = 1; i < n-1; i++) {
        long long x = gcd(l[i-1], r[i+1]);
        ans = max(ans, x);
    }

    ans = max(l[n-2], ans);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2688