akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void){
    // Your code here!
    int c[3][3];
    
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            scanf("%d",&c[i][j]);
        }
    }
    
    for(int a1 = 0; a1 <= 100; a1++){
        int b1,b2,b3;
        b1 = c[0][0] -a1;
        b2 = c[0][1] -a1;
        b3 = c[0][2] -a1;
        
        if(b1 < 0 || b2 < 0 || b3 < 0){
            break;
        }
        
        for(int a2 = 0; a2 <= 100; a2++){
            for(int a3 = 0; a3 <= 100; a3++){
                int flag = 1;
                int a[3];
                a[1] = a2;
                a[2] = a3;
                int b[3];
                b[0] = b1;
                b[1] = b2;
                b[2] = b3;
                for(int i = 1; i < 3; i++){
                    for(int j = 0; j < 3; j++){
                        if(c[i][j] - b[j] != a[i]){
                            flag = 0;
                        }
                    }
                }
                
                if(flag == 1){
                    printf("Yes\n");
                    return 0;
                }
            }
        }
    }
    
    printf("No\n");
}


Measured memory_bytes: 1624
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>

using namespace std;
using ll = long long int;

int main()
{
  int n;
  cin >> n;
  vector<pair<ll, ll>> dish(n);
  for(int i = 0; i < n; i++)
  {
    ll a, b;
    cin >> a >> b;
    dish[i] = {a, b};
  }
  vector<pair<ll, int>> dish_sum(n);
  for(int i = 0; i < n; i++)
  {
    dish_sum[i] = {dish[i].first + dish[i].second, i};
  }
  sort(dish_sum.begin(), dish_sum.end());
  reverse(dish_sum.begin(), dish_sum.end());
  ll takashi = 0;
  ll aoki = 0;
  for(int i = 0; i < n; i++)
  {
    if(i % 2 == 0)
    {
      takashi += dish[dish_sum[i].second].first;
    }else{
      aoki += dish[dish_sum[i].second].second;
    }
  }
  cout << takashi - aoki << endl;
}


Measured memory_bytes: 3328
#include<iostream>
#include<string>
#include<math.h>
using namespace std;

int main() {
	char S[20];
	string T;
	string p;
	string Q;
	double m;
	int a = 0;
	int A = 0;
	int b = 0;
	int B = 0;
	int c = 0;
	int C = 0;
	int q, w, z;
	int n = 0;
	int x = 0;
	int y = 0;
	int ans = 0;
	int X[100] = { 0 };
	int Y[100] = { 0 };
	cin >> a >> b >> c >> x >> y >> n;
	Y[0] = a;
	Y[1] = b;
	Y[2] = c;
	Y[3] = x;
	Y[4] = y;
	for (int i = 0; i < 5; i++) {
		for (int j = i + 1; j < 5; j++) {
			X[A] = Y[i] - Y[j];
			A++;


		}
	}

	for (int i = 0; i < 10; i++) {
		X[i] *= -1;
		if (X[i] > n) {
			ans++;
			break;
		}
	}
	if (ans != 0) {
		cout << ":(";
	}
	else {
		cout << "Yay!";
	}

}


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

#define ll long long int
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define finput ifstream cin;cin.open("in.txt")
#define foutput ofstream cout;cout.open("out.txt")  
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 1000000007

ll gcd(ll x, ll y){ 
	if(x<y) 
		swap(x,y); 
	if(x%y==0)
		return y;
	return gcd(y, x%y);
}

ll pwm(ll a, ll n){
	ll ans = 1;
	while(n>0){
		if(n%2==1){
			ans = (ans * a)%mod;
		}
		a = (a*a)%mod;
		n /= 2;
	}
	return ans%mod;
}

const int pwn = 100010;
ll pw[pwn];
void pwtwo(){
	pw[0] = 1;
	for(int i=1; i<pwn; i++){
		pw[i] = (pw[i-1]*2)%mod;
	}
}


ll gcdExtended(ll a, ll b, ll *x, ll *y); 
  
ll modInverse(ll a, ll m) 
{ 	
	if(a==1)
		return 1;
	//cout<<"mi "<<a<<" "<<m<<" ";
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
    if (g != 1){
        //cout << "Inverse doesn't exist"<<endl; 
        return -1;
    }
    else
    { 
        // m is added to handle negative x 
        ll res = (x%m + m) % m; 
        //cout<<res<<endl;
        return res;
        // cout << "modular multiplicative inverse is " << res; 
    } 
} 
  
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
  
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
} 

ll fact[1010];
ll init(){
	fact[0] = 1;
	for(int i=1; i<1010; i++)
		fact[i] = (fact[i-1]*i)%mod;
}

ll ncr(ll n, ll r){
	ll ans = fact[n];
	if(r>n)
		return 0;
	//if(r!=0)
	ans = (ans*modInverse(fact[r], mod))%mod;
	// if(n-r!=0)
	ans = (ans*modInverse(fact[n-r], mod))%mod;

	return ans;
}

int main(){
	// finput;
	// foutput;
	fast;

	ll n, k, i, j, x, m;
	// ll ans = 0ll;
	cin>>n;

	bool dp[n+1][n+1][n+1];
	char a[n+1][n+1];

	for(i=0; i<n; i++){
		for(j=0; j<n; j++){
			cin>>a[i][j];
			dp[1][i][j] = true; 
		}
	}

	for(i=2; i<=n; i++){
		for(j=0; j<n; j++){
			for(k=0; k<n; k++){
				// cout<<a[j][k]<<" "<<a[(j+i-1)%n][(k+i-1)%n]<<" "<<a[j][(k+i-1)%n]<<" "<<a[(j+i-1)%n][k]<<endl;
				if(a[j][(k+i-1)%n]==a[(j+i-1)%n][k] 
					&&	dp[i-1][j][k] && dp[i-1][(j+1)%n][(k+1)%n] ){
					dp[i][j][k] = true;
					// cout<<"t "<<i<<" "<<j<<" "<<k<<endl;
				}
				else{
					dp[i][j][k] = false;
					// cout<<"f "<<i<<" "<<j<<" "<<k<<endl;

				}
			}
		}
	}

	int ans = 0;

	for(i=0; i<n; i++)
		for(j=0; j<n; j++)
			if(dp[n][i][j])
				ans++;

	cout<<ans;

	return 0;
}

Measured memory_bytes: 27008
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll a,b,c,n,k;
    string s, t;
    ll ans;
    double dans;
    string sans;


    cin  >> s;

    sans = "Yes";

    rep(i, s.size()){
        if(i%2 == 1){
            if(s[i] == 'R'){
                sans ="No";
                break;
            }
        }
        else{
            if(s[i] == 'L'){
                sans = "No";
                break;
            }
        }
    }

    // std::cout << ans << endl; 
    std::cout << sans << endl; 
    
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+10;
ll dp[N];
ll n;
const int mod = 1e9+7;
ll solve(ll j) {
	if(j==n) {
		return dp[j] = 1;
	}
	if(j>n) return dp[j]=0;
	if(dp[j]!=-1) {
		return dp[j];
	}	
	int ret=0;
	for(int i=3;i<=n-j;i++) {
		ret = (ret+solve(j+i))%mod;
	}
	return dp[j] = ret;
}
int main() {
	memset(dp,-1,sizeof(dp));
	cin>>n;
	ll ans=0;
	cout<<solve(0)<<endl;
    return 0;
} 

Measured memory_bytes: 4372
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using graph = vector<vector<int>>;
using P = pair<int,int>;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
ll tenjou(ll x,ll y){return (x-y+1)/y;}
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
ll llmax(ll a,ll b){if(a>b) return a; else return b;}
int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    if(a == b) cout << 1 << endl;
    else if(a > b) cout << 0 << endl;
    else if(n < 2) cout << 0 << endl;
    else cout << (b-a)*(n-2)+1 << endl;
}

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

int main() {
  int n; cin>>n;    
  int AC =0;
  int WA =0;
  int RE =0;
  int TLE =0;
  rep(i,n){
    string k;      
   cin>>k;
   if(k=="AC"){
       AC++;
   }else if(k=="WA"){
       WA++;
   }else if(k=="RE"){
       RE++;
   }else{
       TLE++;
   }
  }
  cout<<"AC x "<<AC<<endl;
  cout<<"WA x "<<WA<<endl;
  cout<<"TLE x "<<TLE<<endl;
  cout<<"RE x "<<RE<<endl;
}


Measured memory_bytes: 3600
def main():
    mod = 2019
    s = input()
    dp = []
    mods = {}
    for i in range(len(s)):
        x = int(s[i])*pow(10,len(s)-1-i,mod)
        x %= mod
        if not dp:
            dp.append(x)
        else:
            dp.append(dp[-1]+x)

        dp[-1] %= mod
        if dp[-1] not in mods.keys():
            mods[dp[-1]] = 0

        mods[dp[-1]] += 1

    ans = 0
    for i in mods.keys():
        if i == 0:
            ans += mods[i]

        x = mods[i]
        ans += x*(x-1)//2

    print(ans)


main()


Measured memory_bytes: 16524
N=int(input())
arr=list(map(int,input().split()))
min_,max_=min(arr),max(arr)
ans=None

if max_-min_ > 1:
    ans=False
elif max_-min_ == 1:
    A=max_
    y=len([a for a in arr if a==max_])
    x=N-y
    nc=A-x
    ans=(A-x)>0 and y >=2*(A-x)
else:
    ans=N>=2*min_ or min_+1==N

print("Yes" if ans else "No")


Measured memory_bytes: 56132
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#define ll long long
#define inf 0x3f3f3f3f
#define maxn 500010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buf[20];
	int len=0;
	if(x<0)putchar('-'),x=-x;
	for(;x;x/=10)buf[len++]=x%10+'0';
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]);
}
inline void writesp(ll x){write(x); putchar(' ');}
inline void writeln(ll x){write(x); putchar('\n');}
int cnt[maxn];
ll a[maxn],sum[maxn];
int n,tot;
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
		a[i]=read(),++cnt[a[i]];
	tot=0;
	for(int i=1;i<=n;i++)
		if(cnt[i])a[++tot]=cnt[i];
	std::sort(a+1,a+tot+1,std::greater<int>());
	sum[tot+1]=0;
	for(int i=tot;i;i--)
		sum[i]=sum[i+1]+a[i];
	for(int i=1;i<=n;i++){
		if(i==1){
			writeln(n); continue;
		}
		if(i>tot){
			puts("0"); continue;
		}
		int l=1,r=i;
		while(l<r){
			int mid=(l+r)>>1;
			if(sum[mid+1]/(i-mid)>=a[mid])r=mid;
			else l=mid+1;
		}
		writeln(sum[l]/(i-l+1));
	}
}

Measured memory_bytes: 9728
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    int N, M;
    cin >> N >> M;

    vector<vector<int>> adj(N, vector<int>(N, 0));
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        adj[a - 1][b - 1] = 1;
        adj[b - 1][a - 1] = 1;
    }

    struct Recursive {
        int n;
        ll count = 0;
        void recursive(int index, unsigned int through_flag, const vector<vector<int>> &adj_mat) {
            if (through_flag == (unsigned int)(pow(2, n) - 1)) {
                count += 1;
                return;
            }
            for (int i = 0; i < n; i++) {
                if (adj_mat[index][i] == 1 && (through_flag >> i) % 2 == 0) {
                    recursive(i, through_flag + (1 << i), adj_mat);
                }
            }
        }
    };

    Recursive rec = {.n = N, .count = 0};
    rec.recursive(0, 1, adj);
    cout << rec.count << endl;

    return 0;
}

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

using namespace std;
const int len = 200010;
int n,m;

struct node {
	int a,b;
}p[len];

bool cmp(node x,node y) {
	return (x.a == y.a) ? x.b < y.b : x.a < y.a;
}

map <int,bool> mp;

int main() {
	ios :: sync_with_stdio(false);	
	mp.clear();
	cin >> n >> m;
	for (int i=1;i<=m;i++) {
		cin >> p[i].a >> p[i].b;
	}
	sort(p+1,p+m+1,cmp);
	bool f = false;
	for (int i=1;i<=m;i++) {
		if (p[i].a == 1) mp[p[i].b] = true;
		else break;
	}
	for (int i=m;i>=1;i--) {
		if (p[i].b == n) {
			if (mp[p[i].a]) {
				f = true;
				break;
			}
		}
	}
	if (f) cout << "POSSIBLE";
	else cout << "IMPOSSIBLE";
    return 0;
}

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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;

  vector<int> A(N);
  for ( int i = 0; i < N; i++ ) {
    cin >> A[i];
  }

  for ( int i = 100; i >= 0; i-- ) {
    int sum = 0;
    for ( int j = 0; j < N; j++ ) {
      sum += A[j];
      if ( sum < i ) break;
      sum -= i;      
      if ( j == N-1 ) {
	cout << i << endl;
	return 0;
      }
    }
  }  
  
  return 0;
}



Measured memory_bytes: 3216
import java.util.*;

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

        for(int i = 0;i < n;i++){
            dif[i] = sc.nextInt();         
        }
      
        Arrays.sort(dif);
        System.out.println(dif[n/2]-dif[(n/2)-1]);
    }
}

Measured memory_bytes: 50688
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,tes,t,i,j,jm[100009],raod[100009],n,msh[100009][19],lc,tim,lf[100009],rg[100009],dep[100009],x,y;
pair <long long, long long> mas[100009][3];
vector <pair <long long, pair <long long, long long> > > v[100009];
pair <pair <long long, long long>, pair <long long, long long> > p[100009];
vector <pair <long long, pair <long long, long long> > > g[100009];
void dfsst(long long q, long long w){
	tim++;
	lf[q]=rg[q]=tim;
	msh[q][0]=w;
	for(i=1; i<=18; i++) msh[q][i]=msh[msh[q][i-1]][i-1];
	for(vector <pair <long long, pair <long long, long long> > >::iterator it=v[q].begin(); it!=v[q].end(); it++){
		if((*it).first==w) continue;
		dep[(*it).first]=dep[q]+(*it).second.second;
		dfsst((*it).first,q);
		if(rg[q]<rg[(*it).first]) rg[q]=rg[(*it).first];
	}
}
bool anc(long long q, long long w){
	if(lf[q]<=lf[w]&&rg[q]>=rg[w]) return 1; else return 0;
}
long long lca(long long q, long long w){
	if(anc(q,w)) return q;
	if(anc(w,q)) return w;
	for(long long h=18; h>=0; h--){
		if(msh[q][h]!=0&&anc(msh[q][h],w)==0) q=msh[q][h];
	}
	return msh[q][0];
}
void dfs(long long q, long long w){
	for(long long h=0; h<g[q].size(); h++){
		mas[g[q][h].second.first][g[q][h].second.second].first=raod[g[q][h].first];
		mas[g[q][h].second.first][g[q][h].second.second].second=jm[g[q][h].first];
	}
	for(vector <pair <long long, pair <long long, long long> > >::iterator it=v[q].begin(); it!=v[q].end(); it++){
		if((*it).first==w) continue;
		jm[(*it).second.first]+=(*it).second.second;
		raod[(*it).second.first]++;
		dfs((*it).first,q);
		jm[(*it).second.first]-=(*it).second.second;
		raod[(*it).second.first]--;
	}
}
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>n>>tes;
	for(i=1; i<n; i++){
		cin>>a>>b>>c>>d;
		v[a].push_back(make_pair(b,make_pair(c,d)));
		v[b].push_back(make_pair(a,make_pair(c,d)));
	}
	dfsst(1,0);
	for(t=1; t<=tes; t++){
		cin>>p[t].first.first>>p[t].first.second>>p[t].second.first>>p[t].second.second;
		lc=lca(p[t].second.first,p[t].second.second);
		g[lc].push_back(make_pair(p[t].first.first,make_pair(t,2)));
		g[p[t].second.first].push_back(make_pair(p[t].first.first,make_pair(t,1)));
		g[p[t].second.second].push_back(make_pair(p[t].first.first,make_pair(t,0)));
	}
	dfs(1,0);
	for(t=1; t<=tes; t++){
		c=mas[t][0].first+mas[t][1].first-mas[t][2].first*2;
		d=mas[t][0].second+mas[t][1].second-mas[t][2].second*2;
      y=p[t].first.second;
		cout<<dep[p[t].second.first]+dep[p[t].second.second]-dep[lca(p[t].second.first,p[t].second.second)]*2-d+y*c<<endl;
	}
	return 0;
}

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

vector<vector<int>> H(101, vector<int>(101, -1));
vector<vector<int>> sup(101, vector<int>(101, 2000000000));

int main() {
	int n;
	cin >> n;
	for (int i = 0, x, y, h; i < n; i++) {
		cin >> x >> y >> h;
		for (int cx = 0; cx <= 100; cx++) {
			for (int cy = 0; cy <= 100; cy++) {
				if (h) {
					if (H[cx][cy] < 0) {
						H[cx][cy] = h + abs(cx - x) + abs(cy - y);
					} else {
						if (H[cx][cy] != h + abs(cx - x) + abs(cy - y))
							sup[cx][cy] = 0;
					}
				} else {
					sup[cx][cy] = min(sup[cx][cy],
							h + abs(cx - x) + abs(cy - y));
				}
			}
		}
	}

	for (int cx = 0; cx <= 100; cx++) {
		for (int cy = 0; cy <= 100; cy++) {
			if (sup[cx][cy] >= 1 && H[cx][cy] <= sup[cx][cy])
				cout << cx << " " << cy << " " << H[cx][cy] << endl;
		}
	}
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = (ll)(1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n; cin >> n;
	ll xorsum = 0;
	rep(i, n) {
		ll a, k; cin >> a >> k;
		if (a < k)continue;
		while (a%k != 0) {
			ll d = a / k;
			ll inf = d * k;
			ll dif = a - inf;
			if (dif % (d + 1) == 0) {
				a -= (d + 1)*(dif / (d + 1));
			}
			else {
				a -= (d + 1)*(dif / (d + 1) + 1);
			}
		}
		xorsum ^= max((ll)0,a/k);
	}
	if (xorsum)cout << "Takahashi" << endl;
	else cout << "Aoki" << endl;
	return 0;
}


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

int main(){
  int n,i,ans=0;
  string s;
  cin >> n;
  cin >> s;
  int white=0,black=0;
  for(i = 0;i < n;i++){
    if(s[i] == '#'){
      black++;
    }else{
      white++;
    }
  }
  if(black > white){
    ans = white;
  }else{
    ans = black;
  }
  int rw=0,rb=0,lw=0,lb=0;
  rw = white;
  rb = black;
  for(i = 0;i<n;i++){
    if(s[i] == '#'){
      rb--;
      lb++;
    }else{
      rw--;
      lw++;
    }
    if(rw + lb < ans){
      ans = rw + lb;
    }
  }
  cout << ans << endl;
}

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

const ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

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

    int n, a, mn = 1e9, ans = 0;
    cin >> n;
    rep(i, n) {
        cin >> a;
        if(chmin(mn, a)) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
#define sz(x) ((int)(x).size())
#define rep(i,l,r) for(int i=(l),I=(r);i<I;++i)
//-------head-------
const int N = 2e5 + 7;
int n, a[N], b[N];
bool check(int x) {
	rep(i, 1, 2 * n) b[i] = a[i] >= x;
	int c = b[n];
	rep(i, 1, n) {
		c ^= 1;
		if (b[n - i] != c || b[n + i] != c) {
			if (b[n + i - 1] == 0) {
				return b[n - i] & b[n + i - 1];
			} else {
				return b[n - i] | b[n + i];
			}
		}
	}
	return b[1];
}
int main() {
	scanf("%d", &n);
	rep(i, 1, 2 * n) scanf("%d", &a[i]);
	int l = 1, r = 2 * n - 1;
	while (l + 1 < r) {
		int m = (l + r) >> 1;
		check(m) ? l = m : r = m;
	}
	printf("%d", check(l) ? l : r);
	return 0;
}

Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main()

{
    int k;
    cin >> k;
    if (k % 2 == 0)
    {
        cout << (k / 2) * (k / 2);
    }
    else
    {
        cout << ((k - 1) / 2) * ((k - 1) / 2 + 1);
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;

int main() {
  ll N, W;
  cin >> N >> W;

  ll weights[100001];
  ll values[101];

  for (ll i = 0; i < N; i++) {
    cin >> weights[i+1];
    cin >> values[i+1];
  }

  ll dp[101][100001];

  for (ll i = 0; i < 101; i++) {
    for (ll j = 0; j < 100001; j++) {
      dp[i][j] = 0;
    }
  }

  for (ll i = 1; i <= N; i++) {
    for (ll j = 1; j <= W; j++) {
      dp[i][j] = dp[i-1][j];
      if (j - weights[i] >= 0) {
        dp[i][j] = max(dp[i][j], dp[i-1][j - weights[i]] + values[i]);
      }
    }
  }

  // for (ll i = 0; i < N + 1; i++) {
  //   for (ll j = 0; j < W + 1; j++) {
  //     cout << dp[i][j] << ' ';
  //   }
  //   cout << endl;
  // }

  cout << dp[N][W] << endl;

  return 0;
}


Measured memory_bytes: 79872
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll                long long int
#define ld                long double
#define pb                push_back
#define mk                make_pair
#define vi                vector<ll>
#define vii               vector<pair<ll,ll>>
#define vpp               vector<pair<ll,pair<ll,ll>>>
#define vll               vector<ll>
#define vc                vector<char>
#define vs                vector<string>
#define mll               map<ll,ll>
#define mci               map<char,ll>
#define msi               map<string,ll>
#define in(i,a,n)         for(ll i=0;i<n;++i) cin>>a[i];
#define out(i,a,n)        for(ll i=0;i<n;++i) cout<<a[i]<<" ";
#define sz(c)             (ll)c.size()
#define len(c)            (ll)c.length()
#define hell              (ll)1000000007
#define all(c)            c.begin(), c.end()
#define rall(c)           c.rbegin(), c.rend()
#define trav(a,i)         for(auto& i: a)
#define loop(i,a,b)       for(ll i=a;i<b;i++)
#define rloop(i,a,b)      for(ll i=a;i>b;i--)
#define invect(v,n)       for(ll i=0;i<n;i++ ){ll arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        forloop(n){ll aset;cin>>aset;s.insert(aset);}
#define F                 first
#define S                 second
#define pii               pair<ll,ll>
#define PB                pop_back
#define copy(a,b)         copy(all(a),back_inserter(b));
#define section(a,b,w)    set_intersection(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define union(a,b,w)      set_union(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define diff(a,b,w)       set_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define symdiff(a,b,w)    set_symmetric_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define sp(n)             setprecision(n)
#define fin               freopen( "input.txt", "r", stdin );
#define fout              freopen( "output.txt", "w", stdout );
#define outall(a)         loop(i,0,sizeof(a)/sizeof(a[0])) cout<<a[i]<<" "; cout<<endl
#define endl "\n"
const ll N=300001;
const ll MOD = 1000 * 1000 * 1000 + 7;
ll mod(ll n) {
    return (n % MOD + MOD) % MOD;
}

//vector<ll> v;
 /*ll powm(ll a,ll b, ll m){
    if(b==0) return 1;
    ll t=powm(a,b/2,m);
    if(b%2) return a*t%m*t%m;
    return t*t%m;
 }
 */
/*ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}*/
 
/*int bs(int a[],int low, int high, int val)
{
    int mid=(low+high)/2;
    if(low>high) return -1;
    if(a[mid]>val) bs(a,low,mid-1,val);
    else if(a[mid]<val) bs(a,mid+1,high,val);
    else return mid;
}*/
 
void solve(){
    ll n,l,r,i,j,sum=0,count=0,max_sum=INT_MIN,max_value=INT_MIN;
    cin>>n;
    loop(i,1,n+1){
        if(i%3!=0&&i%5!=0) sum+=i;
    }
    cout<<sum;
}

signed main(){
    //fin fout
    fast
    ll t=1; //cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 3652
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=a[0]
if n==1:
    print(0)
    exit()
elif n==2:
    print(a[0])
    exit()
if n%2==0:
    ans+=2*sum(a[1:(n-2)//2+1])
   
    print(ans)
else:
    ans+=2*sum(a[1:(n-2)//2+1])+a[(n-2)//2+1]
    print(ans)

Measured memory_bytes: 93944
import copy

h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]

hpattern = []
for i in range(2 ** h):
    temp = [0] * h
    for j in range(h):
        if i >> j & 1:
            temp[j] = 1
    hpattern.append(temp)

wpattern = []
for i in range(2 ** w):
    temp = [0] * w
    for j in range(w):
        if i >> j & 1:
            temp[j] = 1
    wpattern.append(temp)

ans = 0
for hp in hpattern:
    for wp in wpattern:
        cc = copy.deepcopy(c)
        for i in range(h):
            for j in range(w):
                if hp[i] == 1:
                    cc[i][j] = -1
                if wp[j] == 1:
                    cc[i][j] = -1

        black = sum([l.count('#') for l in cc])
        if black == k:
            ans += 1

print(ans)


Measured memory_bytes: 9348
/**
 *  author:   TakeruOkuyama
 *  created:  2020-04-09 14:53:46
**/
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;

int main(){
    int K;
    cin >> K;
    int sum = 0;
    rep(i, K){
        rep(j, K){
            rep(k, K){
                sum += __gcd(__gcd(i + 1, j + 1), k + 1);
            }
        }
    }
    cout << sum << endl;
return 0;}

/**
 * g++ code.cpp
 * ./a.out
 * shift + ctrl + i
**/ 

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n, a[100005];
bool used[100005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1, cnt = 0; ; i = a[i], cnt++) {
		if (i == 2) {
			cout << cnt << endl;
			return 0;
		}
		else if (used[i]) {
			cout << -1 << endl;
			return 0;
		}
		used[i] = true;
	}
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  string s;
  set<string> S;
  for(int i=0;i<N;i++){
    cin >> s;
    S.insert(s);
  }
  cout << S.size() << endl;
}

Measured memory_bytes: 19236
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,a) for(int i=0;i<(a);i++)
#define MOD 1000000007

const int INF=INT_MAX/2;
int D[13];

int main(){
  int N; cin>>N;
  D[0]=2;
  rep(i,N){
    int x; cin>>x;
    D[x]++;
    if(D[x]>2){
      cout<<0<<endl;
      return 0;
    }
  }
  if(D[12]>1){
    cout<<0<<endl;
    return 0;
  }
  int ans=0;
  rep(i,(1<<12)){
    vector<int> x;
    if(D[12]) x.push_back(12);
    rep(j,12){
      if(D[j]==2){
        x.push_back(j);
        x.push_back(24-j);
      }
      if(D[j]==1){
        if((i>>j)&1) x.push_back(j);
        else x.push_back(24-j);
      }
    }
    sort(x.begin(),x.end());
    int tmp=24,sz=x.size();
    rep(j,sz-1){
      tmp=min(tmp,x[j+1]-x[j]);
    }
    ans=max(ans,tmp);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unordered_map<long long, int, custom_hash> safe_map;

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    int n;
    string s,t;
    cin>>n>>s>>t;

    string ans = "";
    for(int i=0;i<n;i++)
    {
        ans += s[i];
        ans += t[i];
    }
    cout<<ans,nl;

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int g[12][12][60][12][12];//y, x, air, l, r
int event[12][12];
int w, h, f, m, o;
int dx[] = {1, 0, -1}, dy[] = {0, 1, 0};

typedef struct state{
  int cost, air, x, y, l, r;
  bool operator<(const state &a)const{
    return cost < a.cost;
  }
  bool operator>(const state &a)const{
    return cost > a.cost;
  }
}state;

bool range(int y, int x){
  return (0 <= x and x < w and
          0 <= y and y < h);
}

void solve(){
  priority_queue<state, vector<state>, greater<state> > que;
  for (int i = 0; i < w; i++) {
    if(m <= 1)continue;
    if(event[0][i] < 0){
      g[0][i][m - 1][i][i] = -event[0][i];
      state tmp = (state){-event[0][i], m - 1, i, 0, i, i};
      que.push(tmp);
    }else{
      int air = min(o, m + event[0][i] - 1);
      g[0][i][air][i][i] = 0;
      state tmp = (state){0, air, i, 0, i, i};
      que.push(tmp);
    } 
  }
  while(not que.empty()){
    state tmp = que.top();
    que.pop();
    int l = tmp.l, r = tmp.r;
    int cost = tmp.cost;
    int air = tmp.air;
    int x = tmp.x, y = tmp.y;
    if(air <= 1)continue;
    for (int i = 0; i < 3; i++) {
      int nx = x + dx[i], ny = y + dy[i];
      if(not range(ny, nx))continue;
      int nl = min(l, nx), nr = max(r, nx);
      if(y != ny){
        nl = nx;
        nr = nx;
      }
      if(event[ny][nx] < 0){
        int add = -event[ny][nx];
        if(l <= nx and nx <= r and y == ny)add = 0;
        if(g[ny][nx][air - 1][nl][nr] > cost + add){
          g[ny][nx][air - 1][nl][nr] = cost + add;
          int c = cost + add;
          tmp = (state){c, air - 1, nx, ny, nl, nr};
          que.push(tmp);
        }
      }else{
        int nair = min(air - 1 + event[ny][nx], o);
        if(l <= nx and nx <= r and y == ny)
          nair = air - 1;
        if(g[ny][nx][nair][nl][nr] > cost){
          g[ny][nx][nair][nl][nr] = cost;
          tmp = (state){cost, nair, nx, ny, nl, nr};
          que.push(tmp);
        }
      }
    }
  }
}

void init(){
  for (int i = 0; i < h; i++) 
    for (int j = 0; j < w; j++) 
      for (int k = 0; k <= o; k++) 
        for (int l = 0; l < w; l++) 
          for (int m = 0; m < w; m++) 
            g[i][j][k][l][m] = 1e9;
}


int main(){
  while(std::cin >> w >> h, w){
    std::cin >> f >> o >> m;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        std::cin >> event[i][j];
      }
    }
    init();
    solve();
    int ans = 1e9;
    for (int i = 0; i < w; i++) {
      for (int j = 1; j <= o; j++) {
        for (int k = 0; k < w; k++) {
          for (int l = 0; l < w; l++) {
            ans = min(ans, g[h - 1][i][j][k][l]);
          }
        }
      }
    }
    if(ans > f)std::cout << "NA" << std::endl;
    else std::cout << ans << std::endl;
  }
  return 0;
}

Measured memory_bytes: 4924
#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define str string
#define ALL(a)  (a).begin(),(a).end()

using Graph = vector<vector<int>>;

ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Max = INF, Min = -1;
ll a = 0, b = 0, c = 0, h = 0, m = 0, sum = 0, n = 0, gx, gy;
ll A[100010] = {}, B[50][3000] = {}, dp[50][2600][50] = {}, rui[500010] = {}, bitdp[1 << 12] = {};
int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
str S;
bool check = true;	vector<ll> va(a);

bool isOK(ll x) {

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < a; j++) {

		}
	}
	return sum > a;

}



int main() {
	//Code Line
	
	cin >> n >> a;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
		b += A[i];
		
	}
dp[0][0][0] = 1;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= i; k++) {

			if (dp[i][j][k]) {
				if (dp[i+1][j][k] == 0)dp[i + 1][j][k] = dp[i][j][k];
				else dp[i + 1][j][k] += dp[i][j][k];
					dp[i + 1][j + A[i]][k + 1] += dp[i][j][k];
				}

				
			}
		}
	}
	
		for (int j = 0; j <= b; j++) {
			for (int k = 1; k <= n; k++) {
			
				if (dp[n][j][k]) { if ((double)j / (double)k == a)sum+= dp[n][j][k]; }


			}
		}
	


	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 53632
import java.util.Scanner;

public class Main {

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

        int ans = 0;
        for (int i = 1; i < s.length(); i++) {
            if ((s.length() - i) % 2 != 0) {
                continue;
            }
            String before = s.substring(0, (s.length() - i) / 2);
            String after = s.substring((s.length() - i) / 2, s.length() - i);
            if (before.equals(after)) {
                ans = before.length() + after.length();
                break;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 24148
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int N, K;
	long long ans = 0;
	cin >> N >> K;

	vector<int> H(N);
	for (int i = 0; i < N; i++)
		cin >> H[i];

	if (N > K)
	{
		sort(H.begin(), H.end());

		for (int i = 0; i < K ; i++)
		{
			H[N - i - 1] = 0;
		}
		for (int i = 0; i < N; i++)
		{
			ans += H[i];
		}
		cout << ans;
	}
	else
		cout << 0;
	return 0;
}

Measured memory_bytes: 1024
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let m: usize = sc.read();
    let mut switches = vec![vec![]; m];
    for i in 0..m {
        let k: usize = sc.read();
        for _ in 0..k {
            let s: usize = sc.read::<usize>() - 1;
            switches[i].push(s);
        }
    }
    let p: Vec<usize> = sc.vec(m);

    let mut ans = 0;
    for mask in 0..(1 << n) {
        let mut ok = true;
        for (i, switch) in switches.iter().enumerate() {
            let mut count = 0;
            for &i in switch.iter() {
                if mask & (1 << i) != 0 {
                    count += 1;
                }
            }

            if count % 2 != p[i] {
                ok = false;
                break;
            }
        }

        if ok {
            ans += 1;
        }
    }

    println!("{}", ans);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

using namespace std;

typedef long long llint;

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  int ans = 0;
  if (c * 2 < a + b) {
    int m = min(x, y);
    x -= m, y -= m;
    ans += 2 * c * m;
  }
  if (c * 2 < a) {
    ans += 2 * c * x;
    x = 0;
  }
  if (c * 2 < b) {
    ans += 2 * c * y;
    y = 0;
  }
  ans += a * x + b * y;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String s = scan.next();
		long k = scan.nextLong();
		for(int i = 0; i < k; i++) {
			if(s.charAt(i) != '1') {
				System.out.println(s.charAt(i));
				return;
			}
		}
		System.out.println('1');
	}
}

Measured memory_bytes: 27044
from sys import stdin
from decimal import Decimal

def main():

    input = stdin.readline

    X,N = map(int,input().split())
    P = list(map(int,input().split()))

    ans = X

    if ans not in P:
        print(ans)
        return


    for i in range(1,100):
        if ans - i not in P:
            print(ans - i)
            return
        elif ans + i not in P:
            print(ans + i)
            return

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9920
N, C = map(int, input().split())
channel_list = [[0 for _ in range(10**5+1)]for _ in range(C)]
count_list = [0 for _ in range(10**5+1)]
for i in range(N):
    s, t, c = map(int, input().split())
    channel_list[c-1][s-1] += 1
    channel_list[c-1][t] -= 1

for i in range(C):
    for t in range(1, 10**5):
        if t == 10 ** 5:
            continue
        channel_list[i][t] += channel_list[i][t-1]
        if channel_list[i][t] >= 1:
            count_list[t] += 1
x = 0
for t in range(1, 10**5+1):
    count = count_list[t]
    if count > x:
        x = count
print(x)


Measured memory_bytes: 27500
#include <iostream>
using namespace std;
int main(void){
    int n,m;
    std::cin >> n >>m;
    int s[2][50];
    int p[2][50];
    for (int i = 0; i < n; i++) {
        std::cin >> s[0][i] >>s[1][i];
    }
    for (int i = 0; i < m; i++) {
        std::cin >> p[0][i] >> p[1][i];
    }
    
    for (int i = 0; i < n; i++) {
        int min=1000000000;
        int t;
        int ans=0;
        for (int j = 0; j < m; j++) {
            t=abs(s[0][i]-p[0][j])+abs(s[1][i]-p[1][j]);
            if(t<min){
                min=t;
                ans=j;
            }
        }
        std::cout << ans+1 << std::endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
class UnionFind
{
public:
    UnionFind(int size) : m_Nodes(size)
    {
        Init();
    }
 
    void Init()
    {
        for (int i = 0, size = m_Nodes.size(); i < size; ++i)
        {
            m_Nodes[i].Init(i);
        }
    }
 
    int Root(int x)
    {
        const int parent = m_Nodes[x].m_Parent;
        if (parent == x)
        {
            return x;
        }
        else
        {
            return m_Nodes[x].m_Parent = Root(parent);
        }
    }
 
    bool Same(int x, int y)
    {
        return Root(x) == Root(y);
    }
 
    bool Unite(int x, int y)
    {
        x = Root(x);
        y = Root(y);
 
        if (x == y) return false;
 
        if (m_Nodes[x].m_Rank < m_Nodes[y].m_Rank)
        {
            m_Nodes[x].m_Parent = y;
            m_Nodes[y].m_Size += m_Nodes[x].m_Size;
        }
        else
        {
            m_Nodes[y].m_Parent = x;
            m_Nodes[x].m_Size += m_Nodes[y].m_Size;
            if (m_Nodes[x].m_Rank == m_Nodes[y].m_Rank) ++m_Nodes[x].m_Rank;
        }
 
        return true;
    }
 
    int Size(int x)
    {
        return m_Nodes[Root(x)].m_Size;
    }
 
private:
    struct Node
    {
    public:
        void Init(int index)
        {
            m_Parent = index;
            m_Rank = 0;
            m_Size = 1;
        }
 
        int m_Parent = -1;
        int m_Rank = -1;
        int m_Size = -1;
    };
 
    vector<Node> m_Nodes;
};

void _main()
{
    int N, M;
    cin >> N >> M;
    UnionFind uf(N);
    rep(i, 0, M)
    {
        int X, Y, Z;
        cin >> X >> Y >> Z;
        --X; --Y;
        uf.Unite(X, Y);
    }

    int ans = 0;
    int sz = 0;

    vector<bool> done(N, false);
    rep(i, 0, N)
    {
        const int root = uf.Root(i);
        if (done[root]) continue;

        ++ans;
        sz += uf.Size(i);

        done[root] = true;
    }

    ans += N - sz;

    cout << ans << endl;
}


Measured memory_bytes: 1408
n, x = map(int, input().split())

a, p = [1], [1]

for i in range(n):
  a.append(a[i]*2 + 3)
  p.append(p[i]*2 + 1)

def f(n, x):
  if n == 0:
    return 0 if x <= 0 else 1
  elif x <= 1 + a[n-1]:
    return f(n-1, x-1)
  else:
    return p[n-1] + 1 + f(n-1, x-2-a[n-1])

print (f(n,x))

Measured memory_bytes: 9112
program abc171
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: n,i,q,ans
    integer(int64):: cnt(100000)=0
    integer(int64), allocatable:: a(:),b(:),c(:)


    read*, n
    allocate(a(n))
    read*, a(:)
    ans = sum(a)
    do i=1,n
        cnt(a(i))=cnt(a(i))+1
    end do
    read*, q
    allocate(b(q),c(q))
    do i=1,q
        read*, b(i),c(i)
    end do
    do i=1,q
        ans = ans+(c(i)-b(i))*cnt(b(i))
        cnt(c(i)) = cnt(c(i)) + cnt(b(i))
        cnt(b(i)) = 0
        print'(i0)', ans
    end do
end program abc171

Measured memory_bytes: 6116
h,w=map(int,input().split())
s=[list(input()) for i in range(h)]
L=[[0 for i in range(w)] for i in range(h)]
x=0;ct=0
for i in range(h):
  for j in range(w):
    if s[i][j]=='.':
      if ct==0:
        x=j
      ct+=1
    if ct!=0 and (s[i][j]=='#' or j==w-1):
      for k in range(ct):
        L[i][x+k]+=ct
      ct=0

for j in range(w):
  for i in range(h):
    if s[i][j]=='.':
      if ct==0:
        x=i
      ct+=1
    if ct!=0 and (s[i][j]=='#' or i==h-1):
      for k in range(ct):
        L[x+k][j]+=ct
      ct=0
ans=[]
for i in range(len(L)):
  ans.append(max(L[i]))
print(max(ans)-1)

Measured memory_bytes: 217864
#include <iostream>
#include<string>
#include<cstring>

using namespace std;

int main()
{
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    int n=k-a-b;
    int sum=a;

    if(n>=0){
        sum=a-n;
    }
    else if(n<0 && a<=k){
        sum=a;
    }
    else if(n<0 && a>k){
        sum=k;
    }

    cout << sum;
    return 0;
}


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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

//===




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

	string S; cin >> S;
	int lenS = (int)S.size();

	int ans = 0;
	
	for (int i = 0; i < lenS / 2; ++i) {
		int j = lenS - i - 1;
		if (S[i] != S[j]) ++ans;
	}

	cout << ans << endl;

	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    auto p = max_element(a,a+n);
    int max_index = p - a;
    sort(a,a+n);
    for(int i=0; i<n; i++){
        if(i != max_index){
            cout << a[n-1] << endl;
        }
        else cout << a[n-2] << endl;
    }
    return 0;
}


Measured memory_bytes: 2432
#include<iostream>
#include<algorithm>
typedef long long int ll;
using namespace std;
int main()
{
    int n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    ll ans = a[n-1];
    if(n%2==0)
    {
        for(int i=n-2;i>=n/2;i--)
            ans += 2*a[i];
    }
    else
    {
        for(int i=n-2;i>n/2;i--)
            ans += 2*a[i];
        ans+= a[n/2];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,l,r) for (ll i = (ll)l; i < (ll)(r); i++)
const ll INF = 1e9;

using Graph  = vector<vector<int> >;

int N,M;
Graph G;

int main(){
    cin >> N >> M;
    G.assign(N,vector<int>());
    rep(i,0,M){
        int a,b; cin >> a >> b; a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<int> ans(N,INF);
    ans[0] = -1;
    queue<int> que;
    que.push(0);
    while(que.size()){
        int v = que.front(); que.pop();
        for(auto &nv : G[v]){
            if(ans[nv] == INF){
                que.push(nv);
                ans[nv] = v;
            }
        }
    }
    cout << "Yes" << endl;
    for(auto &v : ans){
        if(v == -1) continue;
        cout << v+1 << endl;
    }
}

Measured memory_bytes: 10244
function Main(input) {
  input = input.split(" ").map(Number);
  
  var A = input[0];
  var B = input[1];
  var C = input[2];
  
  var ans = C - (A - B);
  
  if (ans < 0) ans = 0;
  
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));

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

#define NMAX 100001
#define MAX(a, b) (a > b ? a : b)

using namespace std;

//ifstream fin("f.in");
//ofstream fout("f.out");

char tiles[NMAX];
int moves;
int n;

int main()
{
    cin.getline(tiles, NMAX, '\n');
    n = strlen(tiles);
    for(int i = 1; i < n; i++)
    {
        if(tiles[i] == tiles[i - 1])
        {
            tiles[i] = (tiles[i - 1] == '0' ? '1' : '0');
            moves++;
        }
    }
    cout << moves << '\n';
    return 0;
}


Measured memory_bytes: 384
n = int(input())
s = list(input())
ans = []

for i in range(1,len(s)):
    if s[i-1]==s[i]:
        s[i-1] = "" 
        
for i in range(n):
    if s[i] != "":
        #print(s[i])
        ans.append(s[i])
moji = ''.join(ans)
print(len(moji))

Measured memory_bytes: 49776
#include <iostream>

using namespace std;

void solve(int n) {
    if(n==3) {
        cout << "2 3 25" << endl;
        return;
    }
    cout << "2 3 4 9";
    n -= 4;
    int p24_ct = min(4999, n/2);
    n -= p24_ct * 2;
    for(int i=1; i<=p24_ct; i++) {
        cout << " " << i*6+2 << " " << i*6+4;
    }
    int p33_ct = min(2499, n/2);
    n -= p33_ct * 2;
    for(int i=1; i<=p33_ct; i++) {
        cout << " " << i*12+3 << " " << i*12+9;
    }
    while(n>0) {
        cout << " " << n--*6;
    }
    cout << endl;
}

int main() {
    int n;
    cin >> n;
    solve(n);
}


Measured memory_bytes: 384