akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=50005;
const double inf=1e9;
int zou[4][2]=
{
    -1,0,
    1,0,
    0,1,
    0,-1
};
struct node
{
    int x,y;
};
int v[25][25];
int w,h;
char c[25][25];
int judge(int x,int y)
{
    if(c[x][y]=='#')
        return 0;
    if(x<=0||x>h||y<=0||y>w)
        return 0;
    return 1;
}
int bfs(int x,int y,node zd)
{
    queue<node> que;
    node a;
    memset(v,-1,sizeof(v));
    a.x=x;
    a.y=y;
    v[x][y]=0;
    que.push(a);
    int sum=0;
    while(!que.empty())
    {
        node n=que.front();
        que.pop();
        if(n.x==zd.x&&n.y==zd.y)
            return v[n.x][n.y];
        for(int i=0; i<4; i++)
        {
            if(v[n.x+zou[i][0]][n.y+zou[i][1]]==-1&&judge(n.x+zou[i][0],n.y+zou[i][1]))
            {
                v[n.x+zou[i][0]][n.y+zou[i][1]]=v[n.x][n.y]+1;
                node ls;
                ls.x=n.x+zou[i][0];
                ls.y=n.y+zou[i][1];
                que.push(ls);
            }
        }
    }
}
int main()
{
    scanf("%d %d",&h,&w);
    for(int i=1; i<=h; i++)
    {
        char ch;
        scanf("%c",&ch);
        for(int j=1; j<=w; j++)
            scanf("%c",&c[i][j]);
    }
    int ma=0;
    for(int i=1; i<=h; i++)
        for(int j=1; j<=w; j++)
        {
            if(judge(i,j))
            {
                for(int ii=i; ii<=h; ii++)
                    for(int jj=1; jj<=w; jj++)
                        if(judge(ii,jj))
                        {
                            node ls;
                            ls.x=ii,ls.y=jj;
                            ma=max(ma,bfs(i,j,ls));
//                            cout<<"qd:"<<i<<" "<<j<<endl;
//                            cout<<"zd:"<<ls.x<<" "<<ls.y<<endl;
//                            cout<<ma<<endl;
                        }
            }
        }
    printf("%d\n",ma);
    return 0;
}


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

uintmax_t combination(unsigned int n, unsigned int r) {
    if(n < 2) return 0;
    if ( r * 2 > n ) r = n - r;
    uintmax_t dividend = 1;
    uintmax_t divisor  = 1;
    for ( unsigned int i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return dividend / divisor;
}

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

    uintmax_t mem = 0;
    //vector<int> num(n + 1, 0);
    int *num = new int[n + 1];
    memset(num, 0, sizeof(int) * (n + 1));
    for(int i = 0; i < n; i++) num[a[i]]++;
    for(int i = 1; i < n + 1; i++) mem += combination(num[i], 2);

    for(int i = 0; i < n; i++){
        uintmax_t ans = mem;
        ans -= combination(num[a[i]], 2);
        ans += combination(num[a[i]] - 1, 2);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 4096
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
S = sr()
if N&1:
    answer = 'No'
else:
    answer = 'No' if any(x != y for x, y in zip(S[:N//2], S[N//2:])) else 'Yes'

print(answer)


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

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

struct edge{
	int to,cost;
};

int n;
int d[114514];
vector<edge>g[114514];

void dijkstra(int s){
	priority_queue<P,vector<P>,greater<P>> que;
	fill(d,d+n,inf);
	d[s]=0;
	que.push(P(0,s));
	while(!que.empty()){
		P p=que.top();que.pop();
		int v=p.second;
		for(int i=0;i<g[v].size();i++){
			edge e=g[v][i];
			if(d[e.to]>d[v]+e.cost){
				d[e.to]=d[v]+e.cost;
				que.push(P(d[e.to],e.to));
			}
		}
	}
}

signed main() {
	cin>>n;
	rep(i,n-1){
		int a,b,c;
		cin>>a>>b>>c;
		a--,b--;
		edge x={b,c},y={a,c};
		g[a].push_back(x),g[b].push_back(y);
	}
	int q,k;
	cin>>q>>k;
	dijkstra(k-1);
	rep(i,q){
		int x,y;
		cin>>x>>y;
		x--,y--;
		cout<<d[x]+d[y]<<endl;
	}

	return 0;
}


Measured memory_bytes: 11504
n = int(input())
xyh = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: -x[2])
for x in range(101):
    for y in range(101):
        h=xyh[0][2]+abs(x-xyh[0][0])+abs(y-xyh[0][1])
        for X,Y,H in xyh[1:]:
            if H != max(h-abs(x-X)-abs(y-Y),0):
                break
        else:
            print(x,y,h)
            exit()

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

using namespace std;

int rt(int pow, int n) {
    int min = 0;
    int max = 1000;
    while (min < max) {
        int mid = (min + max + 1) / 2;
        int val = mid;
        for (int i = 1; i < pow; ++i) {
            val *= mid;
        }
        if (val > n) {
            max = mid - 1;
        } else {
            min = mid;
        }
    }
    return max;
}

int main() {
    //cout << rt(2, 4) << endl;
    //cout << rt(3, 7) << endl;
    
    
    while (1) {
        int e;
        cin >> e;

        if(e == 0) break;

        int m = 10000000;
        int zmax = rt(3, e);
        for (int z = 0; z <= zmax; ++z) {
            int y = rt(2, e - z * z * z);
            int x = e - z * z * z - y * y;
            if (m > x + y + z) m = x + y + z;
        }
        cout << m << endl;
        
    }
}

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

int main()
{
	int n;
	
	cin>>n;
	
	int h[n+1], i, maxv=0, t;

	for(i=1; i<=n; i++)
	{
		cin>>h[i];
	}
	
	for(i=1; i<=n; i++)
	{
		if(h[i]>=maxv)
		{
			t++;
			maxv=h[i];
		}
	}

    cout<<t<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define all(V) (V).begin(), (V).end() 
using namespace std;
typedef long long ll;

int main() {fio;
	int a, b, c;
	cin >> a >> b >> c;
	cout << c << ' '  << a << ' '<<  		b;
	
    return 0;
}

Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    a = [0] * n
    step = [0] * (n + 1)
    for i in range(m):
        step[int(input())] = -1
    step[0] = 1
    step[1] = 1 if step[1] != -1 else -1
    for i in range(2, n + 1):
        if step[i - 2] == -1 and step[i - 1] == -1:
            print(0)
            return
        if step[i] == -1:
            continue
        step[i] = (step[i - 2] if step[i - 2] != -1 else 0) + \
            (step[i - 1] if step[i - 1] != -1 else 0)
        step[i] %= 1000000007
    print(step[n])


if __name__ == '__main__':
    main()


Measured memory_bytes: 7668
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int a,b;
    cin >> a >> b;
    if((a*b) % 2 == 0){
        cout << "Even" << endl;
    } else {
        cout << "Odd" << endl;
    }
}


Measured memory_bytes: 3124
#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<<"Right"<<endl;
  else if(a+b==c+d)cout<<"Balanced"<<endl;
  else cout<<"Left"<<endl;
}

Measured memory_bytes: 3544
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int A = sc.nextInt();
	int B = sc.nextInt();
	if(B%A == 0) {
	    System.out.println(A+B);
	}else {
	    System.out.println(B-A);
	}
    }
}

Measured memory_bytes: 23124
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>

int testcase_ends() {
  size_t n, r;
  scanf("%zu %zu", &n, &r);
  if (n == 0 && r == 0) return 1;

  std::vector<int> a(n);
  std::iota(a.begin(), a.end(), 1);
  std::reverse(a.begin(), a.end());

  for (size_t i = 0; i < r; ++i) {
    size_t p, c;
    scanf("%zu %zu", &p, &c);
    --p;
    std::vector<int> a0(a.begin()+p, a.begin()+p+c);
    std::vector<int> a1(a.begin(), a.begin()+p);
    a0.insert(a0.end(), a1.begin(), a1.end());
    for (size_t j = 0; j < a0.size(); ++j) a[j] = a0[j];
  }
  printf("%d\n", a[0]);
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 2748
#include<iostream>
using namespace std;
int main(){
  while(1){  
    int n,h,an;
    cin>>n>>h;
    if(n==0)break;
    an=n*n*n-n*h;
    int xy[501][501]={},yz[501][501]={},xz[501][501]={}; 
    
    for(int i=0;i<h;i++){
      int a,b;
      string c;
      cin>>c>>a>>b;
      if(c=="xy"){
	for(int j=1;j<=n;j++){
	  if(yz[b][j]==1)an++;
	  else if(xz[a][j]==1)an++;
	}
	xy[a][b]=1;
      }
      
      if(c=="yz"){
	for(int j=1;j<=n;j++){
	  if(xy[j][a]==1)an++;
	  else if(xz[j][b]==1)an++;
	}
	yz[a][b]=1;
      }      
      
      if(c=="xz"){
	for(int j=1;j<=n;j++){
	  if(xy[a][j]==1)an++;
	  else if(yz[j][b]==1)an++;
	}	
	xz[a][b]=1;
      }
      
    }
    cout<<an<<endl;
  
  }
  return 0;
}

Measured memory_bytes: 4160
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline long toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline long toLong(string s) {long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const int INF = 10000;


int main(){
	string str;
	string qwert="qwertasdfgzxcvb";
	
	while(cin>>str){
		if(str=="#")break;
		int cnt=0;
		bool flag=false;
		if(qwert.find(str[0])!=string::npos)flag=true;
		
		FOR(i,1,SZ(str)){
			if(flag&&qwert.find(str[i])==string::npos){
				cnt++;
				flag=false;
			}else if(!flag&&qwert.find(str[i])!=string::npos){
				cnt++;
				flag=true;
			}
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 1188
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

LL n,x[60],y[60],p,q,nx,ny,res,ans=1e9,st1,st2;
bool vis[60],has;

void go(LL pos,LL xx,LL yy)
{
	nx=x[pos];
	ny=y[pos];
	vis[pos]=true;
	while(true)
	{
		has=false;
		rep(i,n)
		{
			if(x[i]!=nx+xx||y[i]!=ny+yy||vis[i]) continue;
			vis[i]=true;
			has=true;
			nx=x[i];
			ny=y[i];
		}
		if(!has) break;
	}
}

int main()
{
	cin>>n;
	rep(i,n) cin>>x[i]>>y[i];
	rep(i,n)
	{
		rep(j,n)
		{
			st1=i;
			st2=j;
			res=0;
			p=x[i]-x[j];
			q=y[i]-y[j];
			memset(vis,0,sizeof(vis));
			rep(k,n)
			{
				if(vis[k]) continue;
				res++;
				go(k,p,q);
				go(k,-p,-q);
			}
			ans=min(ans,res);
		}
	}
	cout<<ans<<endl;
	rt0;
}

Measured memory_bytes: 256
import collections

N = int(input())
A = list(map(int, input().split()))

c = collections.Counter(A)
keys = c.keys()
comb = 0
for i in keys:
    comb += (c[i] * (c[i]-1)) //2

for i in A:
    ans = comb - (c[i]-1)
    print(ans)

Measured memory_bytes: 33804
#include <cstdio>
#include <cstdlib>
#include <cmath>

#include <iostream>

#include <string>
#include <vector>
#include <algorithm>

#define rep(index,num) for(int index=0;index<num;++index)

using namespace std;

int X,N;
int L[101];

int solve(int X,int N){
  int count = 0;
  int D = 0;
  while(D <= X && count < N+1){
    D = D + L[count++];
    //cout << count << " " << D << endl;
  }
  return count;
}

int main(){
  std::cin >> N >> X;
  rep(i,N) cin >> L[i];

  cout << solve(X,N)<< endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))

ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

const ll mod = 1e9 + 7;
const ll IMF = 1LL<< 29;
const double PI = 3.14159265358979323846;


int main(){
        ll n,h;
        cin >> n >> h;
        ll mx = 0;
        vector<ll> b(n);
        rep(i, n){
                ll a;
                cin >> a >> b[i];
                chmax(mx, a);
        }

        sort(all(b));
        ll res = 0;
        while(h > 0 && !b.empty()){
                ll t = b.back();
                if(t<=mx) break;
                res++;
                h -= t;
                b.pop_back();
        }

        if(h > 0) res += (h+mx-1)/mx;
        cout << res << endl;
        return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <functional>
using namespace std;

int N, K;
int memo[11][2001];
vector<vector<int> > books(11);
vector<int> costs[11];

int rec(int g, int k){
	if(memo[g][k] != -1)return memo[g][k];
	if(g == 10)return 0;
	
	int best = 0;
	for(int i = 0; i < costs[g].size() && k + i <= K; i++){
		best = max(best, rec(g + 1, k + i) + costs[g][i] + (i - 1) * i);
	}
	
	return memo[g][k] = best;
}

int main() {
	for(int i = 0; i <= 10; i++)
		for(int j = 0; j <= 2000; j++)
			memo[i][j] = -1;
	
	cin >> N >> K;
	int c, g;
	for(int i = 0; i < N; i++){
		cin >> c >> g;
		books[g - 1].push_back(c);
	}
	for(int i = 0; i < 10; i++){
		sort(books[i].begin(), books[i].end() ,greater<int>());
		costs[i].push_back(0);
		for(int j = 0; j < books[i].size(); j++)
			costs[i].push_back(costs[i][j] + books[i][j]);
	}
	
	cout << rec(0, 0) << endl;
	
	return 0;
}

Measured memory_bytes: 1332
#include <stdio.h>
#include <string.h>

int main(){
  char str[11];
  scanf("%s", str);
  int length;
  for(length=0; str[length]!='\0'; length++);

  int max = 0;
  char subst[11];
  int i, j, k;
  for(i=0; i<=length-1; i++){
    for(j=1; j<=length-i; j++){
      strncpy(subst, str+i, j);
      subst[j] = '\0';
      for(k=0; k<j; k++){
	if(!(subst[k]=='A' || subst[k]=='T' || subst[k]=='C' || subst[k]=='G')){
	  break;
	}
      }
      if(k == j) max = max>j ? max : j;
    }
  }
  printf("%d\n", max);
  return 0;
}


Measured memory_bytes: 128
n,k=map(int,input().split())
seq=list(map(int,input().split()))
v=[False]*n
path=[1]
i=0
v[0]=True
while True:
        if v[seq[i]-1]==False:
                v[seq[i]-1]=True
                path.append(seq[i])
                i=seq[i]-1
                
        else:
                t=seq[i]
                break

ind=path.index(t)
path2=path[ind:]
path1=path[:ind]
x=len(path1)
if k>=x:
        k-=x
        #print(t,ind,path1,path2)
        print(path2[(k%len(path2))])

else:
        print(path1[k])
        


                


Measured memory_bytes: 32264
#include <stdio.h>
int main(){
    int X,x,a_num,b_num,ans;
    scanf("%d",&X);
    a_num =X/500;
    x= X % 500;
    b_num = x / 5;
    ans = a_num * 1000 + b_num *5;
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
s=input()
k-=1
if k==0:
    s=s[k].lower()+s[1:]
elif k==1:
    s=s[0]+s[k].lower()+s[2:]
elif k>1:
    s=s[0]+s[1:k]+s[k].lower()+s[k+1:]
print(s)

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  string S;
  cin >> S;
  bool YYMM = false;
  bool MMYY = false;
  if ((S.at(2) == '0' && S.at(3) != '0') || (S.at(2) == '1' && S.at(3) < '3')) YYMM = true;
  if ((S.at(0) == '0' && S.at(1) != '0') || (S.at(0) == '1' && S.at(1) < '3')) MMYY = true;
  if (YYMM && MMYY) cout << "AMBIGUOUS" << endl;
  else if (YYMM && !MMYY) cout << "YYMM" << endl;
  else if (!YYMM && MMYY) cout << "MMYY" << endl;
  else cout << "NA" << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws IOException
	{
		int n=nextInt();
		int m=nextInt();
		int cnt[]=new int[n+1];
		boolean red[]=new boolean[n+1];
		Arrays.fill(cnt,1);
		red[1]=true;
		for(int i=1;i<=m;i++)
		{
			int x=nextInt();
			int y=nextInt();
			cnt[x]--;
			cnt[y]++;
			if(red[x])
				red[y]=true;
			if(cnt[x]==0)
				red[x]=false;
		}
		int ans=0;
		for(int i=1;i<=n;i++)
			if(red[i])
				ans++;
		out.println(ans);
	}

	 
	///////////////////////////////////////////////////////////

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

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

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;
 
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;

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

}

Measured memory_bytes: 256
from math import sqrt
from bisect import bisect_left
def circle_center(x1, y1, x2, y2):
    xd = x2 - x1; yd = y2 - y1
    d = xd**2 + yd**2
    k = sqrt((4.0 - d) / d) / 2.0
    xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0
    xd *= k; yd *= k
    return [[xc - yd, yc + xd], [xc + yd, yc - xd]]
while 1:
    n = int(raw_input())
    if n==0: break
    p = sorted(map(float, raw_input().split()) for i in xrange(n))
    prev = 0
    ans = 1
    for i in xrange(n):
        bx, by = p[i]
        while bx - p[prev][0] >= 2.0: prev += 1
        for j in xrange(i+1, n):
            cx, cy = p[j]
            if cx - bx >= 2.0: break
            if (bx - cx)**2 + (by - cy)**2 <= 4.0:
                for ex, ey in circle_center(bx, by, cx, cy):
                    count = 2
                    for k in xrange(prev, n):
                        if k==i or k==j: continue
                        dx, dy = p[k]
                        if dx - ex >= 1.0: break
                        if (ex - dx)**2 + (ey - dy)**2 <= 1.0:
                            count += 1
                    ans = max(ans, count)
    print ans

Measured memory_bytes: 6552
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	int n,m;cin >> n >> m;
	int use = min(m/2,n);
	n -= use;
	m -= use*2;
	use += m/4;


	cout << use << endl;
	return 0;
}

Measured memory_bytes: 3608
n = int(input())

a_list = list(map(int,input().split()))
b_list = list(map(int,input().split()))
c_list = list(map(int,input().split()))

cnt = 0
temp = -1

for x in a_list:
    cnt += b_list[x-1]
    if temp == x -1:
        cnt += c_list[temp-1]
    temp = x
    
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N; cin >> N;
    vector<string> S(N); for (auto &s : S) cin >> s;
    vector<int> A(N);
    queue<pair<int, int>> Q;
    int ans = -1;
    for (int i = 0; i < N; i++) {
        fill(begin(A), end(A), -100);
        Q.emplace(i, 1);
        bool fail = false;
        while (!Q.empty()) {
            int node, dist; tie(node, dist) = Q.front(); Q.pop();
            if (A[node] == -100) {
                A[node] = dist;
            } else if (A[node] == dist || A[node] == dist - 2) {
                continue;
            } else {
                fail = true;
                break;
            }
            for (int j = 0; j < N; j++) if (S[node][j] == '1') {
                Q.emplace(j, dist + 1);
            }
        }
        if (!fail) {
            for (auto a : A) ans = max(ans, a);
        } else {
            while (!Q.empty()) Q.pop();
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N;
  cin>>N;
  ll maxnum, minnum;
  ll tmp;
  string ans;
  for(int i=32;i>=0;--i) {
    tmp = 1;
    maxnum = 0;
    minnum = 0;
    for(int j=0;j<i;++j) {
      if(j%2==0) maxnum += tmp;
      else minnum += tmp;
      tmp *= -2;
    }
    if(minnum<=N-tmp && N-tmp<=maxnum) {
      ans.push_back('1');
      N -= tmp;
    }
    else {
      ans.push_back('0');
    }
  }
  bool ok = false;
  for(int i=0;i<ans.size();++i) {
    if(ok) cout<<ans[i];
    else {
      if(ans[i]=='1') {
        ok = true;
        cout<<ans[i];
      }
    }
  }
  if(!ok) cout<<0<<endl;
}



Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a;
    int sum = 0;
    for(int i = 0;i < 3;i++) {
        cin >> a;
        sum += a;
    }
    if(sum>21)cout << "bust" << endl;
    else cout << "win" << endl;
}

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

using namespace std;

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

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

const int N = 1e5 + 10;
vector<ii> a[N];
int color[N];

void DFS(int u, int parent, int up) {
  int c = 1;
  for (auto& it : a[u]) {
    int k = it.second, v = it.first;
    if (v == parent) continue;
    if (c == up) ++c;
    color[k] = c;
    DFS(v, u, c);
    ++c;
  }
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x; --y;
    a[x].push_back({y, i});
    a[y].push_back({x, i});
  }
  DFS(0, -1, 0);
  int maxd = 0;
  for (int i = 0; i < n; ++i) maxd = max(maxd, (int)a[i].size());
  printf("%d\n", maxd);
  for (int i = 0; i < n - 1; ++i) {
    printf("%d\n", color[i]);
  }
  return 0;
}


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

int main(void)
{
	char n,*h,i;
	int ans;
	scanf("%hhd",&n);
	h = (char *)malloc(sizeof(char) * n);

	for (i=0;i<n;i++) scanf("%hhd",&h[i]);
	ans = 0;
	
	for (i=1;i<n;i++) {
		if (h[i-1] <= h[i]) continue;

		ans += h[i-1] - h[i];
	}
	ans += h[n-1];

	printf("%d\n",ans);
	
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main(void){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a == 1){
    a += 13;
  }
  if(b == 1){
    b += 13;
  }
  if(a == b){
    printf("Draw");
  }else if(a > b){
    printf("Alice");
  }else{
    printf("Bob");
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int k = scanner.nextInt();
		int x = scanner.nextInt();
		int startIndex = x - k + 1;
		StringBuffer resultString = new StringBuffer();
		for (int i = 0; i < k*2-1; i++) {
			resultString.append(startIndex + i);
			resultString.append(" ");
		}
		System.out.println(resultString.toString());
	}

}

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

const ll INF = 1LL << 60;

bool is_prime(int n) {
	if (n < 2) return false;
	if (n > 2 && n % 2 == 0) return false;
	for (int i = 3; i * i <= n; i += 2) {
		if (n % i == 0) return false;
	}
	return true;
}

int main() {
	vector<int> s(100005);
	rep(i, 100005) {
		if (is_prime(i) && is_prime((i + 1) / 2)) s[i + 1] = s[i] + 1;
		else s[i + 1] = s[i];
	}
	int q;
	cin >> q;
	rep(i, q) {
		int l, r;
		cin >> l >> r;
		cout << s[r + 1] - s[l] << endl;
	}
	return 0;
}

Measured memory_bytes: 3732
n, m = map(int, input().split())
ab = sorted([list(map(int, input().split())) for i in range(n)])
count = 0
ans = 0

for i in range(n):

    if count + ab[i][1] >= m:
        ans += ab[i][0] * (m - count)
        print(ans)
        exit()

    else:
        count += ab[i][1]
        ans += ab[i][0] * ab[i][1]

Measured memory_bytes: 28652
#include <bits/stdc++.h>
#define IO                       \
    ios::sync_with_stdio(false); \
    cin.tie(0);                  \
    cout.tie(0);
#define mem(a, x) memset(a, x, sizeof(a))
#define per(x, a, b) for (int x = a; x <= b; x++)
#define rep(x, a, b) for (int x = a; x >= b; x--)

using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
const int mod = 1e9 + 7;
const double eps = 1e-8;

int a[maxn], b[maxn];
vector<int> G[maxn];

bool solve() {
    int now = 1;
    for (int i = 1; i <= 4; i++) {
        if (G[i].size() > 2)
            return false;
        if (G[i].size() == 1)
            now = i;
    }
    bool vis[5] = {false};
    while (true) {
        if (vis[now])
            break;
        vis[now] = true;
        for (int i = 0; i < (int)G[now].size(); i++) {
            int to = G[now][i];
            if (vis[to])
                continue;
            now = to;
            break;
        }
    }
    int cut = 0;
    for (int i = 1; i <= 4; i++) {
        cut += vis[i];
    }
    return cut == 4;
}

int main() {
#ifdef LOCAL_IM0QIANQIAN
    freopen("test.in", "r", stdin);
//    freopen("test.out", "w", stdout);
#else
    IO;
#endif // LOCAL_IM0QIANQIAN

    for (int i = 0; i < 3; i++) {
        cin >> a[i] >> b[i];
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    if (solve()) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,f[100003]={};
    long long int res=1;
    cin>>n;
    if(n%2==0)
    {
        for(int i=0;i<n;i++)
        {
            int a;
            cin>>a;
            f[a]++;
        }
        if(f[1]!=2)
        {
            cout<<0;
            exit(0);
        }
    }
    else
    {
        for(int i=0;i<n;i++)
        {
            int a;
            cin>>a;
            f[a]++;
        }
        if(f[0]!=1)
        {
            cout<<0;
            exit(0);
        }
    }
    for(int i=0;i<n;i++)
    {
        if(f[i]==0)
        {
            f[i]++;
        }
        res = (res*f[i])%1000000007;
    }
    cout<<res;
    return 0;
}

Measured memory_bytes: 768
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef vector<int> vi;
typedef vector<string> vs;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

int main() {
	string in;
	cin >> in;

	rep(i,0,in.size()) {
		if (i == 4) cout << " ";
		cout << in[i];
	}
	cout << endl;


	return 0;
}


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e9
#define MOD 1000000007

bool ch(ll x)
{

    set<ll> st;
    while(1)
    {

        if(x==0) break;
        st.insert(x%10);
        x/=10;
    }
    if(st.size()==1) return true;
    else return false;
}

int main()
{

    ll n;
    cin >> n;
    while(1)
    {

        if(ch(n)) break;
        n++;
    }
    cout << n;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

#define LL long long

using namespace std;

int main(void){

    vector<int> a;

    for (int i = 0; i < 3; i++){
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }

    if (a[0] == a[1] && a[1] == a[2]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


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

int main(){
  int A, B;
  cin >> A >> B;
  if(A == 1)
    A += 13;
  if(B == 1)
    B += 13;
  if(A > B){
    cout << "Alice" << endl;
  }
  else if(A == B){
    cout << "Draw" << endl;
  }
  else{
    cout << "Bob" << endl;
  }
}


Measured memory_bytes: 256
#if 0
date +%Y.%m.%d

题解先咕着。
        ▁▃▄▄▄▃▃▃▃▄▶
      ▗▇▀▔    ▔▔▔▔
     ▄▛   ▃▅━━■▄▂
    ▟▊   ▐▘     ▀▙
   ▟▜▌   ▐▖   ▋  ▐▍
  ▟▘ ▜   ▝▀▇▆●▘  ▐▌
▗▟▘   ▜▃       ▁▅▛
▔▀▼▅▄▃▃██▅▄▄▄▅■▀▔   CopyRight :)
      ▔▔▔▔▔▔
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

const int maxn = 200005;
char s[maxn];

int main () {
	scanf("%s", s);
	for (int i = 0; s[i]; i ++)
		if (s[i] == '?')
			s[i] = 'D';
	puts(s);
}


Measured memory_bytes: 1856
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int p[] = new int[N];
		int temp[] = new int[N];
		for (int i=0;i<N;i++) {
			temp[i] = sc.nextInt();
			p[i] = temp[i];
		}
		Arrays.parallelSort(p);
		int count =0;
		for (int i=0;i<N;i++) {
			if (temp[i]!=p[i]) {
				count ++;
			}
		}
		if (count<=2) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> vecA(N);
    for (int i = 0; i < N; i++){
        cin >> vecA.at(i);
    }
    sort(vecA.begin(), vecA.end());
	vector<pair<int, int>> bc;
    for (int i = 0; i < M; i++){
        int B,C;
        cin >> B >> C;
        bc.emplace_back(C, B);
    }
    sort(bc.rbegin(), bc.rend());
    for (int i = 0, j = 0; i < M && j < N; i++) {
		int cnt = bc.at(i).second, val = bc.at(i).first;
		while (j < N && vecA.at(j) < val && cnt--) {
            vecA.at(j) = val;
            j++;
        }
	}
	cout << accumulate(vecA.begin(), vecA.end(), 0LL) << endl;
}


Measured memory_bytes: 1784
use proconio::input;

fn main() {
    input!(n:i32);
    let mut v = Vec::with_capacity(n as usize);
    for _ in 0..n {
        input!(e:i32);
        v.push(e);
    }
    let mut difs = [0;2_00001];
    let mut adds = [0;2_00001];
    for (i,e) in v.iter().enumerate() {
        if i as i32 + *e < 2_00000 {adds[i + *e as usize] += 1;}
        if i as i32 - *e < 2_00000  && i as i32 - *e >= 0{difs[i - *e as usize] += 1;}
    }
    let mut ans = 0i64;
    for (i,e) in difs.iter().enumerate() {
        ans += *e * adds[i];
    }
    println!("{}",ans);
}


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string S; cin >> S;
  ll K, n=S.size(); cin >> K;
  ll ans = 0, num_of_same = 1;
  for (ll i = 0; i < n-1; ++i) {
    if (S[i]==S[i+1]) num_of_same += 1;
    else {
      ans += num_of_same/2;
      num_of_same = 1;
    }
  }
  ans += num_of_same/2;
  if (n == num_of_same) cout << n*K/2 << endl;
  else if (S[0] != S[n-1]) cout << ans*K << endl;
  else {
    ll num_of_same_front = 1, i=0;
    while(S[i]==S[i+1]) {num_of_same_front += 1; ++i;}
    ll diff1 = num_of_same_front/2;
    ll diff2 = num_of_same/2;
    ll diff3 = (num_of_same_front + num_of_same)/2;
    ll newans = ans*K - (diff1+diff2-diff3)*(K-1);
    cout << newans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
from collections import deque
n,m=map(int,input().split())
data=[[] for i in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  data[a].append(b)
  data[b].append(a)
que=deque()
que.append(1)
cnt=[0]*(n+1)
while que:
  h=que.popleft()
  for u in data[h]:
    if cnt[u]!=0:
      continue
    cnt[u]=h
    que.append(u)
print('Yes')
for i in range(2,n+1):
  print(cnt[i])

Measured memory_bytes: 98784
n,k = map(int,input().split())
h = tuple(map(int,input().split()))

dp = [0] + [float("inf")]*(n-1)
for i in range(1,n):
    for j in range(max(0,i-k),i):
        dp[i] = min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[-1])

Measured memory_bytes: 88504
import math
import collections
from operator import mul
from functools import reduce


n,k=map(int,input().split())
a=[(0,0)]*n
for i in range(n):
  a[i]=tuple(map(int,input().split()))

a=sorted(a)
for ai in a:
    k-=ai[1]
    if k<=0:
        print(ai[0])
        exit()


Measured memory_bytes: 55384
gets
n = gets.split("\s").map(&:to_i)
n.delete 1
result = 1

if n.include? 0
  result = 0
elsif n.size > 60
  result = -1
else
  n.each do |i|
    result *= i
    if result > 10**18
      result = -1
      break
    end
  end
end

p result

Measured memory_bytes: 21624
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	long long int n, c, k;
	cin >> n >> c >> k;
	long long int t[100001];
	for(int i = 0; i < n; i++){
		cin >> t[i];
	}
	sort(t, t + n);
	long long int ans = 0;
	for(int i = 0; i < n; i++){
		ans++;
		long long int limit = t[i] + k;
		long long int nowperson = 1;
		while(i < n && t[i] <= limit && nowperson <= c){
			i++;
			nowperson++;
		}
		i--;
	}
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 9223372036854775807
#define MOD 1000000007

int main(void)
{

    ll h, w;
    cin >> h >> w;

    if(h==1 || w == 1)
        cout << 1 << endl;
    else{
       cout << (h * w + 1) / 2 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
#mod = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    A=LIST()
    ans=[0]*n
    rain=sum(A)
    temp=rain
    for i in range(n):
        if i%2==1:
            temp-=A[i]*2
    ans[0]=temp
    for i in range(1,n):
        ans[i]=A[i-1]*2-ans[i-1]
    
    print(*ans)

if __name__=='__main__':
    do()

Measured memory_bytes: 20544
// Coached by rainboy
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 200000, A = 1000000;

int aa[N], kk[A + 1];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin >> n;
	for (int i = 0; i < n; i++)
		cin >> aa[i];
	for (int i = 0; i < n; i++)
		kk[aa[i]]++;
	for (int a = A; a >= 1; a--)
		for (int b = a + a; b <= A; b += a)
			kk[b] += kk[a];
	int k = 0;
	for (int i = 0; i < n; i++)
		if (kk[aa[i]] == 1)
			k++;
	cout << k << '\n';
	return 0;
}


Measured memory_bytes: 8336
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,s=0,c=0;
    cin >> n>> m;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
 
    
    for(int i=0; i<n; i++) s += a[i];

    for(int i=0; i<n; i++) if(a[i]*4*m >= s) c++;
 
    if(c>=m) cout << "Yes" << endl;
    else cout << "No" << endl;
 
    return 0;
}

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

using namespace std;

int main()
{
	int n;
	cin>>n;
	set<string> name;
	string input;
	
	    for(int i =0;i<n;i++)
	        {
	        	cin>>input;
	        	name.insert(input);
			}
	
	    int res = name.size();
	    
	    cout<<res;
}


Measured memory_bytes: 19212
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)

int main()
{
  string s,t;
  cin >> s >> t;
  bool ans = false;
  for (int i = 0; i < s.size(); i++)
  {
    s = s.back() + s.substr(0, s.size() - 1);

    if (s == t){
      ans = true;
      break;
    }
  }
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n)repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
const int inf = 1e9;

int a[10100];
P solve1(int n){
	int res = 0, cnt = 0;
	repi(i,0,n){
		if(a[i] > 0){
			res += a[i];
			cnt++;
		}
		i++;
	}
	return P(res, cnt);
}
P solve2(int n){
	int res = 0, cnt = 0;
	repi(i,1,n){
		if(a[i] > 0){
			res += a[i];
			cnt++;
		}
		i++;
	}
	return P(res, cnt);
}
P solve3(int n){
	P p = P(-inf-1,0);
	rep(i,n){
		if(p.fi < a[i])p = P(a[i], i);
	}
	return p;
}

signed main(){
	int n,f;
	scanf("%lld", &n);
	rep(i,n)scanf("%lld",&a[i]);
	P t1 = solve1(n);
	P t2 = solve2(n);
	P t3 = solve3(n);
	P p;
	if(t1.fi > t2.fi){
		p = t1;f = 0;
		rep(i,n)if(i%2 == 1)a[i] = -1;
	}
	else {
		p = t2;f = 1;
		rep(i,n)if(i%2 == 0)a[i] = -1;
	}
	
	vector<int> ans;
	if(p.fi > 0){
		int k = 0;a[n] = 1;
		while(a[k]<=0){
			ans.push_back(1);
			k++;
		}
		if(f == 0 && k%2 == 1){ans.push_back(1);k++;}
		if(f == 1 && k%2 == 0){ans.push_back(1);k++;}
		repi(i,k+2,n+1){
			if(a[i] > 0)ans.push_back(2);
			else ans.push_back(3);
			if(i == n-1 && a[i]<=0)ans.push_back(2);
			i++;
		}
		int m = ans.size();
		printf("%lld\n%lld\n",p.fi, m);
		rep(i,m)printf("%lld\n", ans[i]);
	}else{
		printf("%lld\n%lld\n", t3.fi, n-1);
		drep(i,n-1,t3.se+1)printf("%lld\n", i+1);
		rep(i,t3.se)printf("1\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[10][10];
int ans;
int i,j;
int main()
{
	cin>>a[1][1]>>a[1][2]>>a[2][2];
	ans=a[2][2]*3;
	a[1][3]=ans-a[1][1]-a[1][2];
	a[3][3]=ans-a[1][1]-a[2][2];
	a[2][3]=ans-a[1][3]-a[3][3];
	a[2][1]=ans-a[2][2]-a[2][3];
	a[3][1]=ans-a[1][1]-a[2][1];
	a[3][2]=ans-a[3][1]-a[3][3];
	for(i=1;i<=3;i++){
		for(j=1;j<=3;j++){
			cout<<a[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}

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


signed main(){
  int a,b,c,n;
  cin>>a>>b>>c>>n;
  vector<int> x(n),y(n),z(n);
  int ans=0;
  ans+=(a*b);
  ans+=(a*c);
  ans+=(b*c);
  ans*=2;
  int num=0;
  num=(n*6);
  rep(i,n){
    int aa,bb,cc;
    cin>>aa>>bb>>cc;
    if(aa==0) num-=2;
    if(bb==0) num-=2;
    if(cc==0) num-=2;
    if(aa==a-1) num-=2;
    if(bb==b-1) num-=2;
    if(cc==c-1) num-=2;
    x[i]=aa;
    y[i]=bb;
    z[i]=cc;
  }
  rep(i,n){
    for(int j=i+1;j<n;j++){
      if((abs(x[i]-x[j])+abs(y[i]-y[j])+abs(z[i]-z[j]))==1){
        num-=2;
      }
    }
  }
  ans+=num;
  cout<<ans<<endl;

}



Measured memory_bytes: 3132
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        n: usize,
        k: u64
    }

    let mut ret = 1u64;
    for _ in 0..n {
        if ret * 2 < ret + k {
            ret *= 2;
        } else {
            ret += k;
        }
    }
    println!("{}", ret);
}

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

#define ankit_2305 cerr<<"\nTime taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<" sec\n";
#define START clock_t
#define TIMER time_p=clock();
#define ll long long

#define MOD 1000000007

using namespace std;

int main(){
    START TIMER
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	string s;
	cin>>s;
	for(int i=0;i<(int)s.size();i++)
		cout<<"x";
    ankit_2305
    return 0;
}


Measured memory_bytes: 256