akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;

ll gcd (ll a , ll b ){ return b ? gcd(b,a%b) : a;}

int main() {
  int n ;
  cin >> n ;
  ll ans = 0 ;
  for(int i = 1 ; i <= n ; i++ ){
    for(int j = 1 ; j <= n ; j++ ){
      for(int k = 1 ; k <= n ; k++ ){
        int a = gcd(i,j) ;
        int b = gcd(a,k) ;
        ans += b ;
      }
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 3632
a = list(map(int,input().split())) #input from array of integer like "1 2 3"

x = []
for i in range(10):
  if i == 0:
    x.append(a[0]*a[2]-a[1])
  else:
    x.append(a[0]*x[i-1]-a[1])
  print(x[i])


Measured memory_bytes: 2940
// Copyright lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef std::pair<int, int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef std::pair<long long, long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i, j, k)  for (register int i = (int)(j); i <= (int)(k); i++)
#define rrep(i, j, k) for (register int i = (int)(j); i >= (int)(k); i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

inline ll read() {
  ll x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = 10 * x + ch - '0';
    ch = getchar();
  }
  return x * f;
}

const int maxn = 3030;
int n, m;
char a[maxn], b[maxn];
int f[maxn][maxn];

void dfs(int x, int y) {
  if (!x || !y) return;
  if (f[x][y] == f[x - 1][y - 1] + 1 && a[x] == b[y]) {
    dfs(x - 1, y - 1);
    putchar(a[x]);
  } else {
    if (f[x][y] == f[x - 1][y]) dfs(x - 1, y);
    else dfs(x, y - 1);
  }
}

void work() {
  scanf("%s", a + 1);
  scanf("%s", b + 1);
  n = strlen(a + 1); m = strlen(b + 1);
  rep(i, 1, n) rep(j, 1, m) {
    f[i][j] = max(f[i][j - 1], f[i - 1][j]);
    if (a[i] == b[j]) f[i][j] = max(f[i][j], f[i - 1][j - 1] + 1);
  }
  dfs(n, m);
}

int main() {
  #ifdef LZT
    freopen("in", "r", stdin);
  #endif

  work();

  #ifdef LZT
    Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
  #endif
}


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

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

  int ans = 0;
  for (int i = 1; i < N-1; i++) {
    if ( (a[i-1] < a[i] && a[i] < a[i+1]) || (a[i-1] > a[i] && a[i] > a[i+1])) {
      ans++;
    }
  }
  
  cout << ans << endl;
       

        
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()

using namespace std;

void execute()
{
	lint count, total;
	cin >> count >> total;

	lint def1 = total % 5000 / 1000;
	lint count5 = 0;
	for (int i = 0; i <= min(count, total / 10000); i++)
	{
		for (int j = def1; i + j <= count && i * 10 + j <= total / 1000; j += 5)
		{
			count5 = count - i - j;
			if (total / 1000 - i * 10 - j == count5 * 5)
			{
				cout << i << " " << count5 << " " << j << endl;
				return;
			}
		}
	}
	cout << "-1 -1 -1" << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  ll N,M;
  cin >> N >> M;
  vector<ll> A(M);
  for(int i=0;i<M;i++)  cin >> A.at(i);

  ll sum=0;
  for(int i=0;i<M;i++)  sum+=A.at(i);

  if(sum>N) cout << -1 << endl;
  else  cout << N-sum << endl;

  return 0;
}

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

/*
,,,,
　　　　　　　　　　　　　　　　　　　　　　　　　　,.斗*''“i:i:{
　　　　　　　　　　　　　,.　｡. . . * : : : ''' : : : :” :”“ ''ｰ - 弋,,_
　　　　　 　 　 ,.斗*''“ : : : : : : : : : : : : : ' ' ' ' ' ' : : : : : : : : : : :”: '':* ｡ ,
　　　 ,.斗*''“ ” ＼：　　 ”・・． ' ' ' '　　　　　　　　 ' ' ' ' : : : : : : : : : : : : ”ミ*｡,,,,,,　　　　　　 　 　 　 ＿
　　く.　 ◎　 ﾞ:.ﾞ:..　ﾟ:,　:　───────────　　　--　　,,,,,,__ ' ' ' :.:.:.:.:.”≧s｡.　　＿,,,｡s*i:i:i:i:<
　　ﾏ*s｡ :,　 }　ﾟ:,　 :}　　　　　　　　　　　　　　　　　　　　　　　　　　　　”　''　-　”””：：”：：`*｡i:i:i:i:i:i:i;:’
　　　` .｡`　 ,　,ノ ／｡ ,,,_　　　　　　　　　　　　　　　　　　　　　　　　　　　　　＿＿`　　} }　　ﾉi:i:i:i:i:ﾂ
　　　　　 `　*　｡　　`*｡i:i:i::*=-　　　　　　　　　　　＿＿　　　　　　,,,....｡s*'i,:’　　　”`*｡＿,*’i:i:i:i:r’
　　　　　　　　　　　”　─ --　　　　｡｡｡｡｡　　 -　－`''''''''ヽ ─ '''”　　　｀ｰ“　　　　　　　`*｡i:i:i:i:i:i:
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*｡i:i:::
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*ﾟ:,
         fozubaoyou    no BUGs alive!
*/

typedef long long ll;

//{
#define mp make_pair
#define nsort(a) sort(a.begin(),a.end())
#define rsort(a) sort(a.rbegin(),a.rend())
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define dumo dump
#define hi debug("hi");
//}

#define debug_interval ','
#define dump_interval endl
#define debug_toggle 0

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cout<<endl;}
template<class...A> inline void debug_rest() {cout<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cout<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cout<<first,debug_rest(rest...);}
//}

int a,b,c,maxv,ans,minv,s,midv,sum;

int main(){
    cin>>a>>b>>c;
    s=a%2+b%2+c%2;
    maxv=max({a,b,c});
    minv=min({a,b,c});
    midv=a+b+c-maxv-minv;
    sum=a+b+c;
    if(s==0){
        ans=(3*maxv-sum)/2;
    }else if(s==2){
        if(!(maxv%2))ans=(maxv-midv)+(maxv-(maxv-midv))/2;
        if(!(midv)%2)ans=(3*maxv-sum-2)/2+1;
        else ans=(3*maxv-sum-2)/2+3;
    }else if(s==3){
        ans=(3*maxv-sum)/2;
    }else if(s==1){
        if(maxv%2)ans=(midv-minv)/2+(maxv-midv);
        else ans=(midv-minv)/2+(maxv-midv)+2;
    }
    dump(ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  int N,K;
  cin >> N >> K;
  string S;
  cin >> S;
  int cnt = 1;
  char flag = 'L';
  bool right = false;
  if(S[0] == 'R'){
    right = true;
    flag = 'R';
  }
  int happy = 0;
  for(int i = 1; i < N; ++i){
    if(S[i] != flag){
      cnt++;
      if(flag == 'L') flag = 'R';
      else flag = 'L';
    }else{
      happy++;
    }
  }

  while(cnt > 1 && K > 0){
    if(cnt >= 3){
      K--;
      happy += 2;
      cnt -= 2;
    }else{
      K--;
      happy++;
      cnt--;
    }
  }

  cout << happy << endl;
}


Measured memory_bytes: 512
N = int(input())
p= list(map(int,input().split()))
ans =0
for i in range(len(p)):
    if not p[i]== i+1:
        continue
    if i+1 <N and p[i]!= i+2 or i==0:
        tmp = p[i]
        p[i] =p[i+1]
        p[i+1]=tmp
        ans+=1
    else:
        tmp=p[i]
        p[i]=p[i-1]
        p[i-1]=tmp
        ans +=1
    #print(p)

print(ans)

Measured memory_bytes: 14008
// by betrue12
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;
typedef long long ll;

vector<ll> len(51);
vector<ll> patti(51);

ll rec(int n, ll x){
    ll ans = 0;

    if (x == len[n]) return patti[n];
    
    // 最初のバンズをカウント
    x--;

    // 最初の l - 1 バーガーの部分のパティをカウント
    if (x > 0){
        ll l = min(x, len[n - 1]);
        ans += rec(n - 1, l);
        x -= l;
    }

    // 真ん中のパティをカウント
    if (x > 0){
        ans++;
        x--;
    }

    // 二番目の l - 1 バーガーの部分のパティをカウント
    if (x > 0){
        ll l = min(x, len[n - 1]);
        ans += rec(n - 1, l);
        x -= l;
    }

    return ans;
}

int main(){
    int n;
    ll x;
    cin >> n >> x;

    len[0] = 1;
    patti[0] = 1;

    for (int i = 1; i <= n; i++){
        len[i] = 2 * len[i - 1] + 3;
        patti[i] = 2 * patti[i - 1] + 1;
    }

    cout << rec(n, x) << endl;

    return 0;
}

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

int main(int argc, char** argv)
{
	long long N, A, ans = 1;
	std::cin >> N;
	for (int i = 0; i < N; i++)
	{
		std::cin >> A;
		if (A == 0)
		{
			ans = 0;
		}
		if (ans > 0)
		{
			if (std::log10(ans) + std::log10(A) > 18)
			{
				ans = -1;
			}
			else
			{
				ans *= A;
				if (ans > 1000000000000000000)
				{
					ans = -1;
				}
			}
		}
	}
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int A,B,C;
  cin>>A>>B>>C;
  A=A-B;
  if(A>C){
    cout << 0 << endl;
  }
  else{
    cout << C-A << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long n,k;
    cin >> n >> k;
    long a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    for(int i=k;i<n;i++){
        if(a[i-k] < a[i])cout << "Yes"<<endl;
        else cout <<"No"<<endl;
    }
}

Measured memory_bytes: 5192
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

int main() {
    int n, k;
    cin >> n >> k;
    map<int, int> mp;
    rep(i, k){
        int num;
        cin >> num;
        rep(j, num){
            int sunuke;
            cin >> sunuke;
            mp[sunuke]++;
        }
    }
    int cnt = 0;
    for(int i=1; i<=n; i++){
        if(mp[i] == 0) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3604
/*Obada*/
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    int A , B ;
    cin >> A >> B ;

    if (A>=1 && A<=9 && B>=1 && B <= 9)
        cout << A*B ;

    else
        cout << -1 ;

    return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
const int INFI = 2147483647;
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }


int main() {
  int n; cin >>n;
  int minus = 0;
  int zero = 0;
  ll res = 0;
  int minimum = 1000000000;
  rep(i, n){
    int a; cin >>a;
    if (a < 0) minus++;
    if (a == 0) zero++;
    a = max(a, -a);
    minimum = min(minimum, a);
    res += a; 
  }
  if (zero == 0 && minus % 2 == 1) res -= 2 * minimum;
  cout <<res <<endl;
}


Measured memory_bytes: 256
#include <cstdio>

int main(void){
    int x, y, t;
    while (1) {
        scanf("%d %d", &x, &y);
        if (x == 0 && y == 0) break;;
        if (x > y) {t = x; x = y; y = t;}
        printf("%d %d\n", x, y);
    }
    return 0;
}

Measured memory_bytes: 1028
import java.util.Scanner;

public class Main 
{

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt()/1000;
		
		for(int tenk = 0; tenk <= n; tenk++)
		{
			int remon = y - (tenk*10);
			
			int bills = n - tenk;
			
			int min = bills;
			int max = bills*5;
			//min, min+4, min+8, ..., max-4, max
			
			if(remon >= min && remon <= max && (remon-min)%4 == 0)
			{
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			}
		}
		
		System.out.println("-1 -1 -1");
	}

}


Measured memory_bytes: 21844
#include <stdio.h>

main(){
  int i,b,c, A[251];

  scanf("%d", &c);

  for(i = 1; i <= c; i++) scanf("%d", &A[i]);

  for(i = 1; i <= c; i++){
    printf("node %d: key = %d, ", i,A[i]);
    if(i/2){
      printf("parent key = %d, ", A[i/2]);
    }
    if(2*i<=c){
      printf("left key = %d, ", A[2*i]);
    }
    if(2*i+1<=c){
      printf("right key = %d, ", A[2*i+1]);
    }
    printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
int a[50][50],sum[50],c[50],ans=1<<30,cost=0;
int n,m,x;
void dfs(int cur){
	if (cur==n+1){
		bool bad=0;
		for (int i=1;i<=m;i++){
			if (sum[i]<x){
				bad=1;
			}
		}
		if (bad){
			return;
		}
		ans=min(ans,cost);
		return;
	}
	dfs(cur+1);
	for (int i=1;i<=m;i++){
		sum[i]+=a[cur][i];
	}
	cost+=c[cur];
	dfs(cur+1);
	for (int i=1;i<=m;i++){
		sum[i]-=a[cur][i];
	}
	cost-=c[cur];
}
int main(){
	cin>>n>>m>>x;
	for (int i=1;i<=n;i++){
		cin>>c[i];
		for (int j=1;j<=m;j++){
			cin>>a[i][j];
		}
	} 
	dfs(1);
	if (ans==1<<30){
		cout<<-1;
	}else{
		cout<<ans;
	}
	return 0;
}


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

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)

#define nl '\n'
#define ioi exit(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};

string conv(int a){
	stringstream ss;
	ss << a;
	string str = ss.str();
	return str;
}


string conv(char a){
	stringstream ss;
	ss << a;
	string str = ss.str();
	return str;
}

int conv(string a){
    stringstream geek(a); 
    int x = 0; 
    geek >> x;   
	return x;
}

char tab[1010][1010];

struct par{int x,y;};
bool comp(const par &a,const par &b){
	if(a.x < b.x)
		return true;
	else if(a.x == b.x){
		if(a.y < b.y)
			return true;
		else return false;
	}
	else return false;
}

vector< par > lpoin;
queue< par > qnum;
bool vis[1000010];

bool ok(int x, int y, int n, int m){
	return 1<= x && x <= n && 1 <= y && y <= m;
}

int binsearch(int x,int y, int i, int j){
	if(i > j) 
		return -1;
	int m = (i+j)/2;
	if(lpoin[m].x == x && lpoin[m].y == y){
		return m;
	}
	else if(lpoin[m].x < x){
		return binsearch(x,y,m+1,j);
	}
	else if(lpoin[m].x > x){
		return binsearch(x,y,i,m-1);
	}
	else if (lpoin[m].x == x){
		if(lpoin[m].y < y){
			return binsearch(x,y,m+1,j);
		}
		else if (lpoin[m].y > y){
			return binsearch(x,y,i,m-1);
		}
	}
	return -1;
}

int main(void) 
{	
	clr(vis,false);
	int n, m; cin>> n >> m;
	
	rep(i,1,n){
		string s; cin>>s;
		rep(j,1,m){
			tab[i][j] = s[j-1];
			par p;
			p.x = i;
			p.y = j;
			if(tab[i][j] == '.'){				
				lpoin.pb(p);
			}
			if(tab[i][j] == '#'){
				qnum.push(p);
				
			}
		}
	}
	
	sort(lpoin.begin(),lpoin.end(),comp);
	
	int cont = sz(lpoin);
	int ans = 0;
	while(cont > 0){
		vector<par> aux;
		par tmp;
		while (!qnum.empty())
		{
			tmp = qnum.front();
			int x = tmp.x;
			int y = tmp.y;
			rep(k,0,3){
				int a = x + dx[k];
				int b = y + dy[k];
				if(ok(a,b,n,m)){
					int index = binsearch(a,b,0,sz(lpoin)-1);
					if( index != -1 && vis[index] == false){
						par num;
						num.x = a;
						num.y = b;
						aux.pb(num);
						vis[index] = true;
						tab[a][b] = '#';
						cont--;
					}
				}
			}
			qnum.pop();
		}
		rep(i,0,sz(aux)-1){
			qnum.push(aux[i]);
		}
		
		ans++;
	}
	
	
	cout<<ans;
	
	
	return 0;
} 



Measured memory_bytes: 19448
#include<iostream>
#include<iomanip>
#include<cmath>

using namespace std;

int main() {
	
	double x, h;
	double ans;
	
	while(cin >> x >> h) {
		
		ans = 0;
		
		if( x == h && h == 0)
			break;
			
		ans = x * x + sqrt( (x / 2) * (x / 2) + h * h) * x * 2;
			
		cout << fixed << setprecision(6) << ans << "\n";
		
	}
	
	return 0;
}



Measured memory_bytes: 3260
/* [Template].cpp 
Example code to use when starting new code. This particular problem was problem 
977A_Wrong_Subtraction from CodeForces

Compile: g++  -o B_Triple_Dots.exe B_Triple_Dots.cpp 
Execute: ./B_Triple_Dots
*/ 

#include <cstdio>
#include <iostream>
#include <cmath> 
#include <iomanip>
#include <cstring> 
#include <bits/stdc++.h> 
#include <string>
using namespace std;

int main() { 	
	int K; 
	string S; 
	cin >> K >> S; 
	
	int length_S = S.length();

	if(length_S > K) {
		cout << S.substr(0,K) << "..." << endl; 
	} else {
		cout << S << endl; 
	} 
	
	return 0; 
} 


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define SZ(X) ((int)(X).size())
#define endl "\n";
bool isEven(string s){
	int n=SZ(s)/2;
	for (int i = 0; i <n ; ++i)
	{
		if(s[i]!=s[n+i]) return false;
	}
	return true;
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
    string s;
    cin>>s;
    int n =SZ(s);	
    while(n>1){
    	s.erase(s.begin() + (n-1));
    	n=SZ(s);
    	
    	if(isEven(s)&&n%2==0) {
    		cout<<SZ(s);
    		return 0;
    	}
    	
    	
    }
  
   return 0;
}


Measured memory_bytes: 3616
#!usr/bin/env python3
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def LIR(n): return [LI() for i in range(n)]

#A
"""
s = S()
if s[0] != "A":
    print("WA")
else:
    count = []
    for i in range(2,len(s)-1):
        if s[i] == "C": count.append(i)
    if len(count) != 1:
        print("WA")
    else:
        for i in range(1,len(s)):
            if i not in count:
                if s[i] == s[i].upper():
                    print("WA")
                    quit()
        print("AC")
"""

#B
"""
n,m,k = LI()
for i in range((n+1)//2):
    if (k - m*i) % (n - 2*i) == 0 and (k-m*i)//(n-2*i) >= 0 and (k-m*i)//(n-2*i) <= m:
        print("Yes")
        quit()
print("No")
"""

#C
from collections import defaultdict
n,k = LI()
d = defaultdict(int)
for i in range(n):
    a,b = LI()
    d[a] += b
s = list(d.items())
s.sort(key = lambda x:x[0])
su = 0
for i in range(len(s)):
    su += s[i][1]
    if su >= k:
        print(s[i][0])
        break
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


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

namespace B___81
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var res = new int[9 * 9];

            for (int i = 0; i < 9; i++)
                for (int j = 0; j < 9; j++)
                    res[(9 * i) + j] = (i + 1) * (j + 1);

            Console.WriteLine(res.Contains(N) ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13268
#include <stdio.h>
#include <stdlib.h>

int q(const long *a,const long *b)
{
	return *a-*b;
}

int main(void)
{
	long n[3],i;
	for(i=0;i<3;i++)scanf("%ld",&n[i]);
	qsort(n,3,sizeof(long),q);
	printf("%ld",n[0]*n[1]*((n[2]+1)/2)-n[0]*n[1]*(n[2]/2));
	return 0;
}

Measured memory_bytes: 128
class UnionFind():
    def __init__(self, N):
        self.N = N
        self.parents = [-1] * N

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            st = []
            while self.parents[x] >= 0:
                st.append(x)
                x = self.parents[x]
            for y in st:
                self.parents[y] = x
            return x

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

import sys
input = lambda:sys.stdin.buffer.readline().rstrip()

N,Q = map(int,input().split())
uf = UnionFind(N)
for i in range(Q):
    t,u,v = map(int,input().split())
    if t:
        print(int(uf.same(u,v)))
    else:
        uf.union(u,v) 

Measured memory_bytes: 75120
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
ll mod=(ll)1e9+7;
ll dp[53][2];
string a,b;
ll solve(ll n,ll last)
{
	if(n==-1)return 1;
 	else if(n<-1)return 0;
 	if(dp[n][last]!=-1)return dp[n][last];
 	if(last==1)
 	{
 		if(a[n]==b[n])
 		{
 			return dp[n][last]=(2*solve(n-1,1))%mod;
 		}
 		return 
 		    dp[n][last]=(2*solve(n-2,0))%mod;
 	}
 	else
 	{
 		if(a[n]==b[n])
 			return dp[n][last]=solve(n-1,1)%mod;
 		return 
 		    dp[n][last]=(3*solve(n-2,0))%mod;
 	}
}
int main()
{
	ll n;
	cin>>n;
	memset(dp,-1,sizeof(dp));
	cin>>a>>b;
	ll ans=0;
	if(a[n-1]==b[n-1])ans=(3*solve(n-2,1))%mod;
	else ans=(6*solve(n-3,0))%mod;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
/******************************************
*    AUTHOR:         CHIRAG AGARWAL       *
*    INSTITUITION:   BITS PILANI, PILANI  *
******************************************/
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL; 
typedef long double LD;
const int MAX=502;
int ans[MAX][MAX];

int main() 
{
	int H,W,h,w;
	scanf("%d %d %d %d",&H,&W,&h,&w);
	if(((H%h)==0)&&((W%w)==0))
	{
		printf("No\n");
		return 0;
	}
	else if((H%h))
	{
		int a=(H%h);
		int dec=(H/h);
		int val=(dec+a-1)/a;
		val++;
		for(int i=1;i<=H;i++)
		{
			for(int j=1;j<=W;j++)
			{
				if(i%h)
				{
					ans[i][j]=val;
				}
				else
				{
					ans[i][j]=-((val*(h-1))+1);
				}
			}
		}
	}
	else 
	{
		int a=(W%w);
		int dec=(W/w);
		int val=(dec+a-1)/a;
		val++;	
		for(int i=1;i<=H;i++)
		{
			for(int j=1;j<=W;j++)
			{
				if(j%w)
				{
					ans[i][j]=val;
				}
				else
				{
					ans[i][j]=-((val*(w-1))+1);
				}
			}
		}
	}
	printf("Yes\n");
	for(int i=1;i<=H;i++)
	{
		for(int j=1;j<=W;j++)
		{
			printf("%d ",ans[i][j]);
		}
		printf("\n");
	}
	return 0;
}


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

#define rep(i,m) for(int i = 0; i < m; i++)
using ll = long long;

int main(){
  int h,w;
  cin>>h>>w;
  vector<string> a(h);
  rep(i,h)cin>>a.at(i);
  rep(i,w+2)cout<<'#';
  cout<<endl;
  rep(i,h){
    cout<<'#'<<a.at(i)<<'#'<<endl;
  }
  rep(i,w+2)cout<<'#';
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
// 2020-07-01 00:54:03
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
struct mint {
  ll divisor = 998244353;
  ll val;
  constexpr mint(ll v = 0) noexcept : val(v % divisor) {
    if (val < 0) val += divisor;
  }
  constexpr mint operator + (const mint& rhs) const noexcept {
    return mint(*this) += rhs;
  }
  constexpr mint operator - (const mint& rhs) const noexcept {
    return mint(*this) -= rhs;
  }
  constexpr mint operator * (const mint& rhs) const noexcept {
    return mint(*this) *= rhs;
  }
  constexpr mint operator / (const mint& rhs) const noexcept {
    return mint(*this) /= rhs;
  }
  constexpr mint operator ~ () const noexcept {
    ll a = this->val, b = divisor, u = 1, v = 0;
    while (b > 0) {
      ll t = a / b;
      a -= t * b;
      u -= t * v;
      ll c = a; a = b; b = c;
      ll w = u; u = v; v = w;
    }
    if (u < 0) u += divisor;
    u %= divisor;
    return u;
  }
  constexpr mint& operator += (const mint& rhs) noexcept {
    val += rhs.val;
    if (val >= divisor) val -= divisor;
    return *this;
  }
  constexpr mint& operator -= (const mint& rhs) noexcept {
    if (val < rhs.val) val += divisor;
    val -= rhs.val;
    return *this;
  }
  constexpr mint& operator *= (const mint& rhs) noexcept {
    val = val * rhs.val % divisor;
    return *this;
  }
  constexpr mint& operator /= (const mint& rhs) noexcept {
    val = val * (~(mint(rhs))).val % divisor;
    return *this;
  }
  friend mint modpow (mint a, ll n) noexcept {
    auto res = mint(1);
    while(n > 0) {
      if(n&1) res *= a;
      a *= a;
      n >>= 1;
    }
    return res;
  }
  friend std::ostream& operator << (std::ostream& os, const mint& a) noexcept {
    return os << a.val;
  }
};

void answer() {
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<mint> dp(s+1, 0), p(s+1, 0);
  dp[0] = 1;
  rep(i, n) {
    swap(dp, p);
    repc(j, s) {
      dp[j] = p[j] * 2;
      if(j - a[i] >= 0) dp[j] += p[j - a[i]];
    }
  }
  cout << dp[s] << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3696
function Main(input) {
    if(input.indexOf("7") >= 0) {
      console.log("Yes");
    } else {
      console.log("No");
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 30008
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
using namespace std;
using ll=long long;

int main(){
	int n,s,t,dp[100010];

	cin>>n;

	dp[0]=0;
	for(int i=1;i<=n;i++){
		s=6,t=9;
		dp[i]=dp[i-1]+1;
		while(i-s>=0){
			dp[i]=min(dp[i],dp[i-s]+1);
			s*=6;
		}
		while(i-t>=0){
			dp[i]=min(dp[i],dp[i-t]+1);
			t*=9;
		}
	}
	cout<<dp[n];
}

		

Measured memory_bytes: 640
class uf_tree:
    def __init__(self, n):
        self._size = n
        self.sizes = [1] * n
        self.par = list(range(n))
 
    def find(self, x):
        if x == self.par[x]:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]
 
    def unite(self, x, y):
        self._size -= 1
        x, y = self.find(x), self.find(y)
        if x == y:
            return
        if self.sizes[x] < self.sizes[y]:
            x, y = y, x
        self.par[y] = x
        self.sizes[x] += self.sizes[y]
 
    def same(self, x, y):
        return self.find(x) == self.find(y)
 
    def size(self, x):
        return self.sizes[self.find(x)]


n, m = map(int, input().split())
uf = uf_tree(n+1)

for _ in range(m):
    x, y, z = map(int, input().split())
    if uf.same(x, y):
        continue
    uf.unite(x, y)
    #print("x, y", uf._size)

ans = uf._size - 1
print(ans)


Measured memory_bytes: 78040
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
using ll =long long;

int main (void) {
  string O,E;
  string ans;
  cin >> O;
  cin >> E;
  for (int i;i<O.size();i++){
    ans += O[i];
    if (E.size()<i+1) {
      cout << ans;
      return 0;
    }
    ans += E[i];
  }
  cout << ans;
}

Measured memory_bytes: 384
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N = input()
V = map(int, raw_input().split())
C = map(int, raw_input().split())

ans = 0
for i in range(N):
    ans += max(0, V[i] - C[i])
print ans

Measured memory_bytes: 2812
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30 - 1)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

int a[50];
int b[50];
int c[50];
int d[50];

void dfs(vector<int> x) {
    if (x.size() == N) {
        dump(x);
        int cnt = 0;
        REP(i, Q) {
            if (x[b[i]] - x[a[i]] == c[i]) {
                cnt += d[i];
            }
        }
        ans = max(cnt, int(ans));
    } else {
        for (int i = x.back(); i <= M; i++) {
            x.push_back(i);
            dfs(x);
            x.pop_back();
        }
    }
}

signed main() {
    cin >> N >> M >> Q;
    vi p(N, 0);
    REP(i, Q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        b[i]--, a[i]--;
    }
    dump(p);
    vi x;
    x.push_back(1);
    dfs(x);
    cout << ans << endl;
}

Measured memory_bytes: 3628
N,M = map(int,input().split())
A_array = map(int,input().split())

ans_dict = {0:1}
ans = 0
now_sum = 0
for a in A_array:
    now_sum = (a+now_sum) % M    
    if now_sum in ans_dict:
        ans_dict[now_sum] += 1
    else:
        ans_dict[now_sum] = 1

for v in ans_dict.values():
    ans += v * (v-1) //2

print(ans)

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

int main()
{
  	string s;
  	cin>>s;
  	for(int i = 0; i < s.length(); i++)
  	{
    	if(s[i] == ',')
      		cout<<" ";
      	else
      		cout<<s[i];
    }
  	cout<<"\n";
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <array>
#include <functional>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <sstream>
#include <stack>

int main()
{
	//std::cout << std::fixed << std::setprecision(15);

	int n;
	std::cin >> n;

	std::ostringstream max_os;
	max_os << n;
	std::string max_str = max_os.str();
	int max_keta = max_str.size();
	int max_first = std::stoi(max_str.substr(0, 1));
	int max_last = std::stoi(max_str.substr(max_str.size() - 1, 1));
	
	long long number = 0;
	for (size_t i = 1; i <= n; ++i)
	{
		std::ostringstream os;
		os << i;
		std::string str = os.str();
		int first = std::stoi(str.substr(0, 1));
		int last = std::stoi(str.substr(str.size() - 1, 1));

		if (first == last && first <= n)
		{
			number++;
		}

		if (last == 0)
		{
			continue;
		}

		if (last * 10 + first <= n)
		{
			number++;
		}
		if (max_keta <= 2)
		{
			continue;
		}

		for (size_t j = 3; j < max_keta; ++j)
		{
			number += std::pow(10, j - 2);
		}

		if (last < max_first)
		{
			number += std::pow(10, max_keta - 2);
		}
		else if (last == max_first)
		{
			number += (n - max_first * pow(10, max_keta - 1)) / 10 + 1;
			if (first > max_last)
			{
				number--;
			}
		}
		
	}

	std::cout << number << std::endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

  int n;
  string s, t;
  cin >> n;
  cin >> s;
  cin >> t;
  for(int i=0; i<n; i++){
    cout << s[i] << t[i];
  }
  cout << endl;

	return 0;
}

Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
k = Array.new(m-1)
for i in 0..(m-1)
  k[i] = gets.split.map(&:to_i)
end
p = gets.split.map(&:to_i)
cnt = 0
for i in 0..(2**n - 1)
  num = i
  sw = Array.new(n, 0)
  sid = 0
  while sid < n
    sw[sid] = num % 2
    num /= 2
    sid += 1
  end
  flag = 0
  for j in 0..(m-1)
    cntsw = 0
    for l in 1..k[j][0]
      if sw[k[j][l] - 1] == 1
        cntsw += 1
      end
    end
    if cntsw % 2 != p[j]
      flag = 1
      break
    end
  end
  if flag == 0
    cnt += 1
  end
end
puts cnt

Measured memory_bytes: 3836
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        int a;cin>>a;
        n-=a;
    }
    if(n<0)cout<<-1<<endl;
    else cout<<n<<endl;
    return 0;
}


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

int main(){
  int n,x,i;
  cin >> n >> x; 
  vector<int> m(n);
  for(i=0; i<n; i++){
    cin >> m[i];
    x-=m[i];
  }
  sort(m.begin(), m.end());
  cout << n+x/m[0];
}

Measured memory_bytes: 256
#author : dokueki

import sys


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def main():
    k, n = map(int, sys.stdin.readline().split())
    a = list(map(int, sys.stdin.readline().split()))
    minn = min(a[n - 1] - a[0], int(10e10))
    for i in range(n):
        ans = (a[n - 1] - a[i]) + (k + a[i - 1] - a[n - 1])
        minn = min(ans, minn)
    print(minn)


if __name__ == "__main__":
    # IOE()
    main()


Measured memory_bytes: 72012
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author User
 */
public class Main {
    public static void main(String[] args) {
         Scanner input = new Scanner(System.in);
         int x =input.nextInt();
         for (int i = 0; i < x; i++) {
            ArrayList<Integer> out = new ArrayList<Integer>();
             for (int j = 0; j < 3; j++) {
                 out.add(input.nextInt());
             }
             Collections.sort(out);
             System.out.println(Math.pow(out.get(out.size()-1), 2)==Math.pow(out.get(0), 2)+Math.pow(out.get(1), 2)?"YES":"NO");
        }
    }
}

Measured memory_bytes: 23396
import java.util.*;

public class Main {
    public static void main(String[] args) {
        aldl_1_3_a();
    }

    static void aldl_1_3_a() {
        Scanner sc = new Scanner(System.in);
        String[] data = sc.nextLine().split(" ");
        sc.close();

        ArrayList<Integer> stack = new ArrayList<Integer>();

        for (int i = 0; i < data.length; i++) {
            String value = data[i];
            int first, second;

            switch (value) {
                case "+":
                    first = stack.get(stack.size() - 2);
                    second = stack.get(stack.size() - 1);
                    int a = first + second;
                    stack.remove(stack.size() - 1);
                    stack.remove(stack.size() - 1);
                    stack.add(a);
                    break;
                case "-":
                    first = stack.get(stack.size() - 2);
                    second = stack.get(stack.size() - 1);
                    int b = first - second;
                    stack.remove(stack.size() - 1);
                    stack.remove(stack.size() - 1);
                    stack.add(b);
                    break;
                case "*":
                    first = stack.get(stack.size() - 2);
                    second = stack.get(stack.size() - 1);
                    int c = first * second;
                    stack.remove(stack.size() - 1);
                    stack.remove(stack.size() - 1);
                    stack.add(c);
                    break;
                default:
                    stack.add(Integer.parseInt(value));
                    break;
            }
        }
        System.out.println(stack.get(0));
    }
}


Measured memory_bytes: 26136
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	ns := strings.Split(sc.Text(), " ")
	n, e := strconv.Atoi(ns[0])
	n2, e2 := strconv.Atoi(ns[1])
	if e != nil || e2 != nil {
		return
	}
	if n*n2%2 == 0 {
		fmt.Println("Even")
	} else {
		fmt.Println("Odd")
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;cin>>N>>M;
  vector<vector<char>> a(N,vector<char>(M));
  vector<int> p(N),q(M);
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      cin>>a.at(i).at(j);
      if(a.at(i).at(j)=='#'){
        p.at(i)++;
        q.at(j)++;
      }
    }
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      if(p.at(i) && q.at(j))cout<<a.at(i).at(j);
    }
    if(p.at(i))cout<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int arr[5+2];
   for(int i=0;i<5;i++)
    scanf("%d",&arr[i]);
   sort(arr,arr+5);
   for(int i=4;i>=1;i--)
    cout<<arr[i]<<" ";
    cout<<arr[0]<<endl;
    return 0;
}

Measured memory_bytes: 1224
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N,K=LI()
A=[]
B=[]
AB=[]
for i in range(N):
	a,b=LI()
	A.append(a)
	B.append(b)
	AB.append([a,b])
A=list(set(A))
A.sort()
counts={}
for a in A:
	counts[a]=0

for ab in AB:
	counts[ab[0]]+=ab[1]
if K<N/2:
	c=0
	for item in A:
		c+=counts.get(item)
		if c>=K:
			print(item)
			exit()
else:
	c=sum(B)
	for item in reversed(A):
		c-=counts.get(item)
		if c<K:
			print(item)
			exit()
		
	





Measured memory_bytes: 31452
/**********************************
	author:  mariogzsl
**********************************/

#include <bits/stdc++.h>

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,b,a) for(int i=b-1;i>=a;i--)
#define f first
#define s second
#define puts(x) cout<<x<<endl
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	char in;
	cin>>in;
	if(in=='A')cout<<'T'<<endl;
	if(in=='T')cout<<'A'<<endl;
	if(in=='C')cout<<'G'<<endl;
	if(in=='G')cout<<'C'<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  //os << v[0]; for (ll i = 1; i < (ll)v.size(); i++){ os << " " << v[i]; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

ll gcd(ll a, ll b)
{
  while (b != 0) {
    a %= b;
    std::swap(a, b);
  }
  return a;
}

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

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

  ll A, B, C, D;
  std::cin >> A >> B >> C >> D;

  ll X = A - 1;
  ll Y = B;
  ll tmp1 = X - (X / C + X / D - X / lcm(C, D));
  ll tmp2 = Y - (Y / C + Y / D - Y / lcm(C, D));
  ll ans = tmp2 - tmp1;
  print(ans);

  return 0;
}


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

#define int long long
#define counter(m)     for(int i=0;i<m;i++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int32_t main() {
    nitin;
    int n;
    cin>>n;
    int k;
    cin>>k;
    vector<int>v(n);
    for(auto &c:v) cin>>c;
    int g=0;
    for(auto c:v)
        g=gcd(g,c);
    if(k%g==0 && k<=maxe(v.begin(),v.end()))
        cout<<"POSSIBLE"<<endl;
    else
        cout<<"IMPOSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 3928
#include<iostream>
using namespace std;
int digit_sum(int n){
 if(n < 10) return n;
  return digit_sum(n/10) + n%10;
}
int main(){
  unsigned int n, a, b;
  cin >> n >> a >> b;
  int sum = 0;
  for(int i = 1; i <= n; i++){
    int d_sum = digit_sum(i);
    if(a<= d_sum && d_sum <= b) sum += i;
    //cout << d_sum;
  }
  cout << sum;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 9223372036854775807;
const ll mininf = -9223372036854775807;
const ll nax = 0;
ll n, k;

int main(){
	IOS
	cin >> n >> k;
	cout << min(n%k, k-(n%k)) << '\n';
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if (A + B > C + D) {
    cout << "Left" << endl;
  } else if (A + B < C + D) {
    cout << "Right" << endl;
  } else {
    cout << "Balanced" << endl;
  }
    
}

Measured memory_bytes: 256
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    AIN(ll, A, N + 1);
    vi c(N + 2, 1);
    REP(i, N + 1)
    {
        if (c[i] < A[i])
        {
            OUT(-1);
            return 0;
        }
        c[i + 1] = 2 * (c[i] - A[i]);
        if (c[i + 1] > INF)
        {
            c[i + 1] = INF;
        }
    }
    ll ans = 0;
    ll m = 0;
    for (ll i = N; i >= 0; --i)
    {
        ll k = min(c[i], m + A[i]);
        ans += k;
        m = k;
    }
    OUT(ans);
}

Measured memory_bytes: 4780
/** BiSmIlLaHiR rAhMaNiR rAhIm **\

*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*
*$*                                             *$*
*$*    ||||||||  ||||||||  ||||||||  ||||||||   *$*
*$*    ||    ||  ||           ||     ||         *$*
*$*    ||||||||  ||||||||     ||     ||||||     *$*
*$*    ||    ||        ||     ||     ||         *$*
*$*    ||    ||  ||||||||  ||||||||  ||         *$*
*$*                                             *$*
*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*

            \**  DIIT(17th batch) **/

#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define pf printf
#define sf scanf
#define endl "\n"
#define pb push_back
#define eb emplace_back
#define makep make_pair
#define MOD 1000000007
#define PI 2*acos(0.0)
#define PII pair<ll, ll>
#define pii pair<int, int>
#define what_is(x) cerr<<#x<<" is "<<x<<endl;
#define fio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    fio();
    ll count=0,i,n,k,p=0,pos;
    cin>>n>>k;
    ll a[n];
    for(i=0;i<n;i++){
    	cin>>a[i];
    	if(a[i]==1)
    		pos=i+1;
    }
    count+=ceil((double)(n-1)/(double)(k-1));
    if(n==k)
    	count=1;
    cout<<count<<endl;
}

Measured memory_bytes: 1024