akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<string>
#include<stack>
using namespace std;

int main(){
	stack<int> S;
	string s;
	int a, b;

	while (cin >> s){
		if (s[0] == '+'){
			a = S.top(); S.pop();
			b = S.top(); S.pop();
			S.push(a + b);
		}
		else if (s[0] == '*'){
			a = S.top(); S.pop();
			b = S.top(); S.pop();
			S.push(a * b);
		}
		else if (s[0] == '-'){
			b = S.top(); S.pop();
			a = S.top(); S.pop();
			S.push(a - b);
		}
		else S.push(atoi(s.c_str()));
	}

	cout << S.top() << endl;

	return 0;
}

Measured memory_bytes: 1196
#!/usr/bin/env python3

a = int(input())
d = list(map(int, input().split()))

d.sort()

center = len(d)//2-1

if d[center] == d[center+1]:
    print(0)
    exit()
else:
    d[center]

    print(d[center+1]-d[center])
    exit()


Measured memory_bytes: 14556
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 1000010
/* ちゃんと考えてわかって実装 */

int main(void){
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = 0;
    if((b - a) % 2 == 0){
        ans = (b-a) / 2;
    }
    else{
        if(a-1 < n-b){
            ans += a;
            b -= a;
            a = 1;
            ans += (b-a) / 2;
        }
        else{
            ans += (n-b)+1;
            a += (n-b+1);
            b = n;
            ans += (b-a) / 2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int cnt1,cnt2;
    if(a%d==0){
        cnt1 =a/d;
    }else{
        cnt1 = a/d+1;
    }
    if(c%b==0){
        cnt2 =c/b;
    }else{
        cnt2 = c/b+1;
    }
    if(cnt2<=cnt1){
        cout << "Yes" << endl;
    }else{
        cout <<"No" <<endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
	//days[1]=31; days[2]=28; days[3]=31; days[4]=30; days[5]=31; days[6]=30; 
	//days[7]=31; days[8]=31; days[9]=30; days[10]=31; days[11]=30; days[12]=31;
	scanf("%d%d",&a,&b);
	int ans=0;
	for (int i=1; i<=12; i++){
		if (i>a) break;
		if ((i==a)&&(i>b)) break;
		ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
fn main(){
 loop{
  let mut w=r();
  if w=="-"{break};
  let m=r();
  let m=m.parse().unwrap();
  for _ in 0..m{
   let n=r();
   let n=n.parse().unwrap();
   w = format!("{}{}",&w[n..],&w[..n]);
  }
  println!("{}",w);
 }
}
fn r()->String{
 let mut b=String::new();
 std::io::stdin().read_line(&mut b).unwrap();
 b.trim().to_string()
}


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

int main(){ 
    int n,m,x,c=0;
    cin >> n >> m;
	int A[n][m]= {};
    int b[m]= {};
    for(int i=0;i<n;i++){
    	for(int j=0;j<m;j++){
    		cin >> x;
    		A[i][j] = x;
		}
	}
	for(int i=0;i<m;i++){
		cin >> x;
		b[i]=x;
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			c+=A[i][j]*b[j];
		}
		cout << c << endl;
		c=0;
	}
	
} 


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof (x))
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define kill _z_kill
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outv(x) cerr<<#x" = "<<x<<"  "
#define outtag(x) cerr<<"--------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
	For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
#define User_Time ((double)clock()/CLOCKS_PER_SEC)
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned uint;
typedef long double LD;
typedef vector <int> vi;
typedef pair <int,int> pii;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
template <class T> void ckmax(T &x,const T y){
	if (x<y)
		x=y;
}
template <class T> void ckmin(T &x,const T y){
	if (x>y)
		x=y;
}
//int Pow(int x,int y){
//	int ans=1;
//	for (;y;y>>=1,x=(LL)x*x%mod)
//		if (y&1)
//			ans=(LL)ans*x%mod;
//	return ans;
//}
//void Add(int &x,int y){
//	if ((x+=y)>=mod)
//		x-=mod;
//}
//void Del(int &x,int y){
//	if ((x-=y)<0)
//		x+=mod;
//}
//int Add(int x){
//	return x>=mod?x-mod:x;
//}
//int Del(int x){
//	return x<0?x+mod:x;
//}
const int N=1<<19,P=200003;
int n;
int g;
int vis[P],vv[P];
int cnt[N];
void getg(){
	for (g=2;;g++){
		memset(vis,-1,sizeof vis);
		int v=1;
		int flag=1;
		For(i,0,P-2){
			if (vis[v]!=-1){
				flag=0;
				break;
			}
			vis[v]=i;
			vv[i]=v;
			v=(LL)v*g%P;
		}
		if (flag)
			break;
	}
}
const LD pi=acosl(-1.0);
struct C{
	LD r,i;
	C(){}
	C(LD _r,LD _i){
		r=_r,i=_i;
	}
	friend C operator + (C a,C b){
		return C(a.r+b.r,a.i+b.i);
	}
	friend C operator - (C a,C b){
		return C(a.r-b.r,a.i-b.i);
	}
	friend C operator * (C a,C b){
		return C(a.r*b.r-a.i*b.i,a.r*b.i+a.i*b.r);
	}
}w[N],a[N];
int R[N];
void init(int n){
	int d=0;
	while ((1<<d)<n)
		d++;
	For(i,0,n-1)
		R[i]=(R[i>>1]>>1)|((i&1)<<(d-1));
	For(i,0,n-1)
		w[i]=C(cosl(pi*2*i/n),sinl(pi*2*i/n));
}
void FFT(C *a,int n,int flag){
	For(i,0,n-1)
		if (i<R[i])
			swap(a[i],a[R[i]]);
	for (int t=n>>1,d=1;d<n;d<<=1,t>>=1)
		for (int i=0;i<n;i+=d<<1)
			for (int j=0;j<d;j++){
				C tmp=w[t*j]*a[i+j+d];
				a[i+j+d]=a[i+j]-tmp;
				a[i+j]=a[i+j]+tmp;
			}
	if (flag<0){
		reverse(a+1,a+n);
		For(i,0,n-1)
			a[i].r/=n,a[i].i/=n;
	}
}
int main(){
	n=read();
	getg();
	LL ans=0;
	For(i,1,n){
		int x=read();
		ans-=(LL)x*x%P;
		if (x)// outval(vis[x]),
			cnt[vis[x]]++;
	}
	n=N;
	init(n);
	For(i,0,n-1)
		a[i].r=cnt[i];
	FFT(a,n,1);
	For(i,0,n-1)
		a[i]=a[i]*a[i];
	FFT(a,n,-1);
	For(i,0,n-1){
		LL val=(LL)(a[i].r+0.5);
//		if (val>0){
//			outval(i);
//			outval(val);
//			outval(vv[i%(P-1)]);
//		}
		ans+=val*vv[i%(P-1)];
	}
	assert(ans%2==0);
	cout<<ans/2<<endl;
	return 0;
}

Measured memory_bytes: 41104
w=int(input())
n=int(input())
S=[i for i in range(1,w+1)]
for i in range(n):
    a,b = [int(i) for i in input().split(",")]
    tmp=S[a-1]
    S[a-1]=S[b-1]
    S[b-1]=tmp
for i in S:
    print(i)



Measured memory_bytes: 5596
#include<iostream>
using namespace std;
int main(){
    string s;
    cin>>s;
    bool no=false;
    if(s[0]!='A'){
        no=true;
    }
    bool inside=false;
    for(int i=1;i<s.size();i++)
    {
        if(s[i]>='A'&&s[i]<='Z'){
            if(!inside&&s[i]=='C'&&(i>=2&&i<=s.size()-2)){
                inside=true;
                continue;
            }
            else{  
                no=true;
                break;
            }
        }
    }
    if(no||!inside){
        cout<<"WA"<<endl;
    }
    else{
        cout<<"AC"<<endl;
    }
}

Measured memory_bytes: 3624
#!/usr/bin/env python3
# -*- Coding: utf-8 -*-

import sys


input = sys.stdin.readline


def main():
    N = int(input())

    ary = []
    n = 1
    while n**2 <= N:
        if N % n == 0:
            ary.append(n)
        n += 1

    ans = 99999999999999999999999
    for i in ary:
        ans = min(ans, i+N//i-2)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39024
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define INF 0x3f3f3f3f
#define LL long long
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;	
}
using namespace std;
int ans=INF;
int w,c[2001];
int m,b[2001];
int n,k,q,a[2001];
int main()
{
	re(n);re(k);re(q);
	for(int i=1;i<=n;++i)re(a[i]);
	for(int i=0;i<=n;++i)
	{
		for(int j=1;j<=n;++j)
			if(a[j]>a[i])
				b[++m]=a[j];
			else
			{
				if(m>=k)
				{
					sort(b+1,b+m+1);
					for(int l=1;l<=m-k+1;++l)
						c[++w]=b[l];
				}
				m=0;
			}
		if(m>=k)
		{
			sort(b+1,b+m+1);
			for(int l=1;l<=m-k+1;++l)
			c[++w]=b[l];
		}
		m=0;
		sort(c+1,c+w+1);
/*		for(int j=1;j<=w;++j)
			printf("%d ",c[j]);
		puts("");*/
		if(w>=q)
			ans=min(ans,c[q]-c[1]);
		w=0;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#define ll long long

using namespace std;

int main(){

  int S, W;
  cin >> S >> W;
  if(S > W){
    cout << "safe" << endl;
  } else {
    cout << "unsafe" << endl;
  }

  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main(){
	int n; cin >> n;
	
	i64 pos = 1;
	std::set<i64> st, stt; st.insert(0);
	while(pos <= 4e9) {
		stt = st;
		for(auto s : st) stt.insert(s + pos);
		st = stt;
		pos *= 4;
	}
	
	for(auto x : st) {
		i64 y = x - n;
		if(y % 2) continue;
		y /= 2;
		if(!st.count(y)) continue;
	
		std::string ans = "";
		for(int i = 0; ;i++) {
			if(i % 2) {
				ans += '0' + y % 4;
				y /= 4;
			} else {
				ans += '0' + x % 4;
				x /= 4;
			}
			
			if(!x and !y) break;
		}
		
		reverse(begin(ans), end(ans));
		cout << ans << endl;
		return 0;
	}
	assert(false);
}


Measured memory_bytes: 6528
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using System.Threading.Tasks;

namespace Counting_Characters
{
    class Program
    {
        static void Main(string[] args)
        {

            String input;
            String abc = "abcdefghijklmnopqrstuvwxyz";
            int[] ans = new int[26];
            while (true)
            {
                input = Console.ReadLine();
                if (input == null) break;
                char[] str = input.ToArray();
                for (int i = 0; i < input.Length; ++i)
                {
                    if (char.IsUpper(str[i])) ++ans[str[i] - 'A'];
                    if (char.IsLower(str[i])) ++ans[str[i] - 'a'];
                }
            }
            for (int i = 0; i < 26; ++i)
            {
                Console.WriteLine("{0} : {1}", abc[i], ans[i]);
            }
        }
    }
}


Measured memory_bytes: 9556
def main():
	N, K = map(int, input().split())
	V = list(map(int, input().split()))
	pick_num = min(N, K)
	INF = 10**9+7
	dp = [-INF]*(N+K+1)
	dp[0] = 0
	dp[1] = max(V[0], V[-1])
	for i in range(2, pick_num+1):
		for j in range(i+1):
			l = V[:j]
			r = V[-i+j:] if i != j else []
			tmp = sum(l+r)
			dp[i] = max(dp[i], tmp)
			this_list = list(l+r)
			this_list.sort()
			for trash in range(K-i+1):
				dp[i+trash] = max(dp[i+trash], tmp-sum(this_list[:trash]))
	ans = dp[0]
	for i in range(1, K+1):
		ans = max(ans, dp[i])
	print(ans)


if __name__ == '__main__':
	main()

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <climits>
#include <cstdio>

#define nl '\n'

using namespace std;

long long n, m, t;

int main(){

    cin >> n >> m;

    if(n > 0){
        t += (n*(n-1))/2;
    }
    if(m > 0){
        t += (m*(m-1))/2;
    }

    cout << t;

}
 
//g++ -std=c++14 comp.cpp -o c && c.exe
//g++ -std=c++14 comp.cpp -o c; ./c.exe
//g++ -std=c++14 comp.cpp && ./a.out


//Surely this is going to AC

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main() {
  int n;
  scanf("%d", &n);
  long long a[n];
  
  long long all=0;
  for(int i=0;i<n;i++){
    scanf("%lld", &a[i]);
    all = all^a[i];
  }  
  for(int i=0;i<n;i++){
    printf("%d ", all^a[i]);
  }
  
  return 0;
}

Measured memory_bytes: 4084
import java.math.BigDecimal;
import java.util.Scanner;

/**
 * @author : Ritchie Zhang
 * @date : 2020/5/10
 * @description： TODO
 * @modifiedBy：
 * @version: 1.0
 */
public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long a = s.nextLong();
        System.out.println(change(a));


    }

    public static String change(long n){
        String s = "";
        while (n>0){
            long m = n % 26;
            if (m == 0)
            {
                m = 26;
            }
            s = (char)(m + 96) + s;
            n = (n - m) / 26;
        }
        return s;
    }
}




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

int main(void){
	//int i,k,j,n,s,sum,count;
	//?????°??§?????????????????????
	//?????????????????????????????´????????¨
	int count,n,s,q,w,e,r,t,y,u,i,o;
	while(scanf("%d%d",&n,&s),n+s){
		count=0;
		/*
		sum=0;
		for(i=9,k=0;i>=0;i--){
			sum+=i;
			if(sum>s){
				sum-=i;
				continue;
			}
			k++;
			if(k==n){
				count++;
				k--;
				sum-=i;
			}
		}
		*/
		switch(n){
			case 1:
				for(q=0;q<10;q++){
					if(q==s)count++;
				}
				break;
			case 2:
				for(q=0;q<10;q++){
					for(w=q+1;w<10;w++){
						if(q+w==s)count++;
					}
				}
				break;
			case 3:
				for(q=0;q<10;q++){
					for(w=q+1;w<10;w++){
						for(e=w+1;e<10;e++){
							if(q+w+e==s)count++;
						}
					}
				}
				break;
			case 4:
				for(q=0;q<10;q++){
					for(w=q+1;w<10;w++){
						for(e=w+1;e<10;e++){
							for(r=e+1;r<10;r++){
								if(q+w+e+r==s)count++;
							}
						}
					}
				}
				break;
			case 5:
				for(q=0;q<10;q++){
					for(w=q+1;w<10;w++){
						for(e=w+1;e<10;e++){
							for(r=e+1;r<10;r++){
								for(t=r+1;t<10;t++){
									if(q+w+e+r+t==s)count++;
								}
							}
						}
					}
				}
				break;
			case 6:
				for(q=0;q<10;q++){
					for(w=q+1;w<10;w++){
						for(e=w+1;e<10;e++){
							for(r=e+1;r<10;r++){
								for(t=r+1;t<10;t++){
									for(y=t+1;y<10;y++){
										if(q+w+e+r+t+y==s)count++;
									}
								}
							}
						}
					}
				}
				break;
			case 7:
				for(q=0;q<10;q++){
					for(w=q+1;w<10;w++){
						for(e=w+1;e<10;e++){
							for(r=e+1;r<10;r++){
								for(t=r+1;t<10;t++){
									for(y=t+1;y<10;y++){
										for(u=y+1;u<10;u++){
											if(q+w+e+r+t+y+u==s)count++;
										}
									}
								}
							}
						}
					}
				}
				break;
			case 8:
				for(q=0;q<10;q++){
					for(w=q+1;w<10;w++){
						for(e=w+1;e<10;e++){
							for(r=e+1;r<10;r++){
								for(t=r+1;t<10;t++){
									for(y=t+1;y<10;y++){
										for(u=y+1;u<10;u++){
											for(i=u+1;i<10;i++){
												if(q+w+e+r+t+y+u+i==s)count++;
											}
										}
									}
								}
							}
						}
					}
				}
				break;
			case 9:
				for(q=0;q<10;q++){
					for(w=q+1;w<10;w++){
						for(e=w+1;e<10;e++){
							for(r=e+1;r<10;r++){
								for(t=r+1;t<10;t++){
									for(y=t+1;y<10;y++){
										for(u=y+1;u<10;u++){
											for(i=u+1;i<10;i++){
												for(o=i+1;o<10;o++){
													if(q+w+e+r+t+y+u+i+o==s)count++;
                                            	}
											}
										}
									}
								}
							}
						}
					}
				}
				break;
		}
		printf("%d\n",count);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
using namespace std;
#define ll long long
//なんで？(半ギレ)
int main(){
    ll ans=0,n;
    cin >>n;
    for(int i=0;i<n;i++){
        ll t;
        cin>>t;
        ans^=t;
    }
    if(!ans)cout <<"Yes"<<endl;
    else cout <<"No"<<endl;
    return 0;

}

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

public class Program
{
	static void Main(string[] args)
	{
		var array = new int[5];
		for (int i = 0; i < 5; i++)
		{
			array[i] = int.Parse(Console.ReadLine());
		}

		var limit = int.Parse(Console.ReadLine());
		var flag = true;
		for (int i = 0; i < 4; i++)
		{
			for(int y = 4; y > i;y--)
			{
				if (array[y] - array[i] > limit)
				{
					flag = false;
				}
			}
		}

		if (flag)
		{
			Console.WriteLine("Yay!");
		}
		else
		{
			Console.WriteLine(":(");
		}
	}
}


Measured memory_bytes: 13140
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <tuple>
#include <climits>
#include <unordered_map>

using namespace std;


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

    string s;
    int k;
    int c = 0;
    cin>>s>>k;
    int n = s.length();
    bool same = s[0] == s[n-1];
    int one = 0, cur = 1;
    for (int i=1; i<n; i++) {
        if (s[i] == s[i-1]) cur++;
        else one += cur / 2, cur = 1;
    }
    one += cur / 2;
    if (same) {
        int left = 1, right = 1;
        for (int i=1; i<n; i++) {
            if (s[i] != s[i-1]) break;
            left++;
        }
        for (int i=n-2; i>=0; i--) {
            if (s[i] != s[i+1]) break;
            right++;
        }
        if (left == n) cout<<1LL * n * k / 2<<endl;
        else cout<<1LL*(left + right) / 2 * (k - 1) + left / 2 + right / 2 + 1LL * (one - left / 2 - right / 2) * k<<endl;
    } else {
        cout<<1LL * one * k<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import math
X=int(input())
x=1
while 1:
    if X<2*pow(x,5):
        break
    x+=1
while 1:
    M=pow(x,5)-X
    if M<0:
        M=-1*M
        if pow(M,0.2)-int(pow(M,0.2))<=pow(10,-6):
            print(x,-1*(int(pow(M,0.2))))
            break
    else:
        if pow(M,0.2)-int(pow(M,0.2))<=pow(10,-6):
            print(x,int(pow(M,0.2)))
            break
    x+=1



    

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    cout << "x";
  }
  cout << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main {

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

    for (int i = 1; i < n; i++) {
      a[i] = sc.nextInt();
    }

    int[] data = new int[n];

    for (int i = 1; i < n; i++) {
      data[a[i]-1]++;
    }

    for (int i = 0; i < n; i++) {
      System.out.println(data[i]);
    }

  }

}


Measured memory_bytes: 62492
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;


int main(void){
  int N=0;
  double answer=0;

  cin >> N;
  
  if(N%2==0) answer=0.5;
 else{
   answer=(N+1)/2;
   answer=answer/N;
 }
  
  printf("%f", answer);
  
  return 0;
  
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int n;
	scanf("%d",&n);
		if(n/100==7||(n%100)/10==7||n%10==7)
		{
			printf("Yes\n");
		}
		else 
		{
			printf("No\n");
		}
	return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define LLINF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    vector<vector<ll>> dp(110, vector<ll>(100100, 0));
    for (ll i = 0; i < N; i++)
    {
        cin >> w[i] >> v[i];
    }
    // dp[i][j]:=i番目までの品物を見て、重さの総和がj以下になるような価値の総和の最大値
    for (ll i = 0; i < N; i++)
    {
        for (ll j = 0; j <= W; j++)
        {
            if (j + w[i] <= W)
            {
                chmax(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
            }
            chmax(dp[i + 1][j], dp[i][j]);
        }
    }
    cout << dp[N][W] << endl;
}

Measured memory_bytes: 87296
#include <stdio.h>

int main() {
	unsigned long long int a;
	unsigned long long int b;
	unsigned long long int x;
	unsigned long long int s;

	s = 0;
	scanf("%llu%llu%llu", &a, &b, &x);

	if((a % x) == 0) {
		s++;
	}
	s += (b / x) - (a / x);

	printf("%llu\n", s);

	return 0;
}

Measured memory_bytes: 128
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

int main(void){
    string s;
    cin >> s;

    vector<int> best(s.size() + 1, 0);

    int cnt = 0;

    best[0] = 0;

    for(int i = 0; i < s.size(); i++){
        if(s[i] == '<'){
            cnt++;
            best[i + 1] = cnt;
        } else {
            cnt = 0;
        }
    }

    for(int i = s.size() - 1; i >= 0; i--){
        if(s[i] == '>'){
            cnt++;
            best[i] = max(best[i], cnt);
        } else {
            cnt = 0;
        }
    }

    ll ans = 0;

    for(int i = 0; i < best.size(); i++){
        ans += best[i];
    }

    cout << ans << endl;


    
}


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

const long long MAX_N = 1e5 + 5;
long long n, x, ans;
long long a[MAX_N];
long long l[MAX_N];
long long cnt[MAX_N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for (long long i = 0; i < n; i++)
		cin >> a[i];
		
	for (long long i = 0; i < n; i++)
		x ^= a[i];
		
	for (long long i = 0; i < n; i++) {
		l[i] = __builtin_ctz(a[i]);
		cnt[l[i]]++;
	}
		
	
	for (long long i = 32; ~i; i--)
		if ((x >> i) & 1) {
			if (!cnt[i]) {
				cout << "-1\n";
				return 0;
			}
			
			cnt[i]--;
			x = ~x;
			ans++;
		}

	cout << ans << "\n";
	return 0;
}

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

int main()
{
    int N, K;
    cin >> N >> K;
    priority_queue<int> H;
    for (int i = 0; i < N; i++)
    {
        int64_t an=0;
        cin >> an;
        H.push(an);
    }

    int64_t answer = 0;
    for (int i = 0; i < K; i++)
    {
        H.pop();
        if (H.empty())
        {
            cout << 0;
            exit(0);
        }
        
    }

    while (!H.empty())
    {
        answer += H.top();
        H.pop();
    }
    
    cout << answer;
    
    
}


Measured memory_bytes: 1400
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n, m = Input()
    max_l = 0
    min_r = 1e6
    for i in range(m):
        l, r = Input()
        max_l = max(max_l, l)
        min_r = min(min_r, r)

    ans = min_r - max_l + 1
    ans = max(ans, 0)
    print(ans)

main()

Measured memory_bytes: 9192
#include <iostream> 
#include <sstream> 
#include <iomanip> 
#include <algorithm> 
#include <cmath> 
#include <string> 
#include <vector> 
#include <list> 
#include <queue> 
#include <stack> 
#include <set> 
#include <map> 
#include <bitset> 
#include <numeric> 
#include <climits> 
#include <cfloat> 
using namespace std;

void primeNumber(int N, vector<bool>& prime) // 0ツ暗按湘」Nツ暗按可コツづ個青ョツ青板つゥツづァツ素ツ青板づーツ探ツつキ
{
    prime.assign(N+1, true);
    prime [0] = prime[1] = false;
    for(int i=2; i*i<=N; i++){
        if(prime[i]){
            for(int j=i; i*j<=N; j++){
                prime[i*j] = false;
            }
        }
    }
}

int main()
{
    long long a, b;
    cin >> a >> b;
    a = a - b;
    b = a + 2 * b;
    a = max(a, 2LL);

    vector<bool> prime(1000500, true);
    primeNumber(1000500, prime);

    vector<int> prev(b-a+1, INT_MAX);
    for(long long i=2; i*i<=b; ++i){
        if(!prime[i])
            continue;

        for(long long j=(a+i-1)/i*i; j<=b; j+=i){
            long long x = j;
            int curr = 0;
            while(x % i == 0){
                x /= i;
                ++ curr;
            }
            if(curr > prev[j-a])
                prev[j-a] = -1;
            else
                prev[j-a] = curr;
        }
    }

    int ret = 0;
    for(int i=0; i<b-a+1; ++i){
        if(prev[i] != -1)
            ++ ret;
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 4904
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int k=n%10;
  if(k==2||k==4||k==5||k==7||k==9)
  {cout<<"hon";}
  else if(k==0||k==1||k==6||k==8)
  {cout<<"pon";}
  else{cout<<"bon";}
  return 0;
}


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

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

    int N = scanner.nextInt();
    int W = scanner.nextInt();

    int[] w = new int[N];
    int[] v = new int[N];

    for (int i = 0; i < N; i++) {
      w[i] = scanner.nextInt();
      v[i] = scanner.nextInt();
    }

    long[][] vw = new long[4][N + 1];
    for (int i = 0; i < N; i++) vw[w[i] - w[0]][i] = v[i];
    for (int i = 0; i < 4; i++) {
      Arrays.sort(vw[i]);
      reverse(vw[i], 1, N);
      for (int j = 1; j <= N; j++) vw[i][j] += vw[i][j - 1];
    }

    long max = 0;
    for (int a = 0; a <= N; a++) {
      for (int b = 0; b <= N; b++) {
        for (int c = 0; c <= N; c++) {
          for (int d = 0; d <= N; d++) {
            long tw = (long) w[0] * a + (w[0] + 1L) * b + (w[0] + 2L) * c + (w[0] + 3L) * d;
            long tv = vw[0][a] + vw[1][b] + vw[2][c] + vw[3][d];
            if (tw > W) continue;
            max = Math.max(max, tv);
          }
        }
      }
    }
    System.out.println(max);
  }

  private static void swap(long[] a, int i, int j) {
    long tmp = a[i];
    a[i] = a[j];
    a[j] = tmp;
  }

  private static void reverse(long[] a, int i, int j) {
    if (i > j) throw new IllegalArgumentException("i must be less than j");
    while (i < j) {
      swap(a, i, j);
      i++;
      j--;
    }
  }
}


Measured memory_bytes: 24404
#include <iostream>
#include <stdio.h>
#include <algorithm>

using namespace std;

int n;
int l[15];

int main(void)
{
	cin >> n;
	for(int i = 0; i < n; i++) cin >> l[i];
	sort(l, l+n);
	reverse(l, l+n);
	
	int sm = 0;
	for(int i = 1; i<= n; i++) sm += l[i];
	if(l[0] < sm) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
//  Author : Amit Kumar 
//  Date   : Monday 06 July 2020 01:10:30 PM IST

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

int main(void){
    

#ifdef HELL_JUDGE
    freopen("input","r",stdin);
    freopen("output","w",stdout);
    freopen("error","w",stderr);
#endif 

#ifdef HELL_JUDGE
    auto INITIAL_TIME = high_resolution_clock::now();
#endif 
    int h,w,x; cin >> h >> w >> x;
    vector<string>grid(h);
    for(auto&itr:grid){
        cin >> itr;
    }
    int ans{};
    for(int i=0; i<(1<<h); ++i){
        for(int j=0;j<(1<<w);++j){
            int counter{};
            for(int k = 0; k<h; ++k){
                for(int l = 0; l<w; ++l){
                    if(grid[k][l]!='#')continue;
                    if((i&(1<<k))!=0 || (j&(1<<l))!=0){
                        continue;
                    }
                    ++counter;
                }
            }
            if(counter ==x){
                ++ans;
            }
        }
    }
    cout << ans << '\n'; 
#ifdef HELL_JUDGE
    auto FINAL_TIME = high_resolution_clock::now();
    cout << "Time : "
         << duration_cast<milliseconds>(FINAL_TIME-INITIAL_TIME).count() 
         << " ms" << '\n'; 
#endif 
    return 0;
}


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

using namespace std;

int main(){

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

	string str;
	for (int i = 0; i < w + 2; i++) {
		str += ".";
	}

	vector<string> s(h+2,str);

	for (int i = 1; i <= h; i++) {
		cin >> s[i];
		s[i] += "..";
		for (int j = w; j >=1; j--) {
			swap(s[i][j], s[i][j - 1]);
		}
	}

	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (s[i][j] == '#') {
				int counter = 0;
				if (s[i - 1][j] == '#') { counter++; }
				if (s[i + 1][j] == '#') { counter++; }
				if (s[i][j-1] == '#') { counter++; }
				if (s[i][j+1] == '#') { counter++; }
				if (counter == 0) { cout << "No" << endl; return 0; }
			}
		}
	}
	cout << "Yes" << endl;
}

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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main() {
	ll N;
	cin >> N;
	cout << N*(N-1)/2 <<endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int a[101];

int main(void){
	int n,m,s=-1,i,cnt=0;
	cin >> n >> m;
	for(i=0; i<n; ++i){
		cin >> a[i];
		s += a[i];
	}
	s /= (4*m);
	for(i=0; i<n; ++i){
		if(a[i]>s){
			++cnt;
		}
	}
	cout << ((cnt>=m)?"Yes":"No") << endl;
	return 0;
}


Measured memory_bytes: 256
def MAIN():
    n = int(input())
    ans = [[i, 0, 0] for i in range((n + 1))]
    G = [[] for _ in range((n + 1))]
    for _ in range(n):
        u, k, *v = map(int, input().split())
        G[u] = v
    cnt = 1
    def dfs(u):
        nonlocal ans
        if ans[u][1] != 0:
            return
        nonlocal cnt
        ans[u][1] = cnt
        cnt += 1
        for v in G[u]:
            dfs(v)
        ans[u][2] = cnt
        cnt += 1
    for i in range(1, n + 1):
        if ans[i][1] == 0:
            dfs(i)
    for i in range(1, n + 1):
        print(" ".join(map(str, ans[i])))
MAIN()



Measured memory_bytes: 5628
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx")

#include <cstdio>
#include <vector>
#include <bitset>

using namespace std;

using int64 = long long;

template<class T> inline void fastin(T &num) {
  T c;
  num = 0;
  c = getchar_unlocked();
  for (; (c > 47 && c < 58); c = getchar_unlocked()) num = (num << 3) + (num << 1) + c - 48;
}

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

  vector<int> dp(41, 0);
  // dp[i] : i 桁目の bit が立っている a_i がいくつあるか

  for (int i = 0; i < n; ++i) {
    bitset<41> bit(a[i]);
    for (int j = 0; j < 41; ++j) {
      dp[j] += bit.test(j);
    }
  }

  int64 ans = 0;
  int64 tmp = 0;
  for (int i = 0; i < n; ++i) {
    tmp += (a[i] ^ k);
  }

  ans = tmp;

  for (int i = 40; i >= 0; --i) {
    bitset<41> kbit(k);
    if (kbit.test(i)) {
      kbit.reset(i);
      for (int j = i - 1; j >= 0; --j) {
        if (dp[j] > n - dp[j]) {
          kbit[j] = 0;
        } else {
          kbit[j] = 1;
        }
      }
      int64 best = kbit.to_ullong();
      int64 t = 0;
      for (int j = 0; j < n; ++j) {
        t += (best ^ a[j]);
      }
      ans = max(ans, t);
    }
  }

  printf("%lld\n", ans);

  return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";


    void Solve()
    {
        int N = cin.Nextint;
        int now = 0;
   
        var A = cin.Scanlong;
        Array.Sort(A);
        long cnt = A[0];
        for (int i = 1; i < N; i++)
        {
            if(2 * cnt < A[i])
            {
                now = i;
            }
            cnt += A[i];
        }
        WriteLine(N - now);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 27736
sa=input()
sb=input()
sc=input()

t=sa[0]
while True:
    if t=="a":
        if len(sa)==0:
            print("A")
            break
        else:
            t=sa[0]
            sa=sa[1:]
    elif t=="b":
        if len(sb)==0:
            print("B")
            break
        else:
            t=sb[0]
            sb=sb[1:]
    elif t=="c":
        if len(sc)==0:
            print("C")
            break
        else:
            t=sc[0]
            sc=sc[1:]

Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
using namespace std;
const int INF=0x3f3f3f3f;
const int maxn=105;
int a[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    int minn=INF,maxx=-INF;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        minn=min(minn,a[i]);
        maxx=max(maxx,a[i]);
    }
    int ans=INF;
    for(int i=minn;i<=maxx;i++)
    {
        int tmp=0;
        for(int j=1;j<=n;j++)
            tmp+=((a[j]-i)*(a[j]-i));
        ans=min(ans,tmp);
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i,N) for(int i=0;i<(int)N;i++)
const char letters[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
int diff[62];char pw[129],query[129];
static inline int ask(void){int x;printf("? %s\n",query);fflush(stdout);return !scanf("%d",&x)?-1:x;}
int main(void)
{
  int l=0,len=0,mid=0,r=0,total=0;
  rep(i,62){rep(j,128){query[j]=letters[i];}query[128]=0;diff[i]=128-ask();total+=diff[i];}
  rep(i,62)
  {
    if(len==0){len=diff[i];rep(j,diff[i])pw[j]=letters[i];}
    else
    {
      l=0;
      for(int k=diff[i];k>=1;k--)
      {
        r=len;
        while(l<r)
        {
          mid=(l+r+1)/2;
          rep(j,mid)query[j]=pw[j];
          rep(j,k)query[mid+j]=letters[i];
          query[mid+k]=0;
          if(ask()==total-mid-k)l=mid;else r=mid-1;
        }
        len++;rep(j,len-l){pw[len-j]=pw[len-j-1];}pw[l]=letters[i];
      }
    }
  }
  pw[len]=0;return printf("! %s\n",pw),0;
}

Measured memory_bytes: 3808
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(v) v.begin(), v.end()
typedef long long ll;



int main() {
    string s;
    cin >> s;
    if(s == "ABC") dunk("ARC");
    else dunk("ABC");
    
    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repb(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for(auto v:(V))cout<<v<<" "<<endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const int MOD = 1000000007;

int main()
{
    string s;
    cin >> s;
    try
    {
        while(s.size() != 0)
        {
            if(!s.compare(s.size() - 5, 5, "dream"))
                s.erase(s.size() - 5, 5);
            else if (!s.compare(s.size() - 5, 5, "erase"))
                s.erase(s.size() - 5, 5);
            else if (!s.compare(s.size() - 6, 6, "eraser"))
                s.erase(s.size() - 6, 6);
            else if (!s.compare(s.size() - 7, 7, "dreamer"))
                s.erase(s.size() - 7, 7);
            else
            {
                cout << "NO" << endl;
                return 0;
            }
        }
    }
    catch (std::out_of_range e)
    {
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 512
import collections

N, M = map(int, input().split())
A = [list(map(int, input().split())) for i in range(N)]
ans = N  # １種類だけ開催

s = set()
for _ in range(M-1):
    count = [0]*M
    for i in range(N):
        for x in A[i]:
            if x in s:
                continue
            else:
                count[x-1] += 1
                break
    ans = min(ans, max(count))
    idx = count.index(max(count))
    s.add(idx + 1)

print(ans)


Measured memory_bytes: 10516
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iterator>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int l;cin>>l,l;){
		vi a(12);
		rep(i,12){
			int m,n; cin>>m>>n;
			a[i]=(i==0?0:a[i-1])+m-n;
		}
		int res=lower_bound(allof(a),l)-a.begin();
		if(res==12)
			cout<<"NA"<<endl;
		else
			cout<<res+1<<endl;
	}
	
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;
using ll = long long;

void solve();

int main(void){
    int A, B;
    cin >> A >> B;
    int kosuu = 1;
    if(B == 1){cout << 0 << endl; return 0;}
    if(A >= B) cout << 1 << endl;
    else{
        int inc = A-1;
        while(A < B){
            A += inc;
            kosuu++;
        }
        cout << kosuu << endl;
    }
    return 0;
}

void solve(){}

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

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n);
	for (auto& v : a) cin >> v;
	for (auto& v : b) cin >> v;
	for (auto& v : c) cin >> v;
	sort(begin(a), end(a));
	sort(begin(b), end(b));
	sort(begin(c), end(c));
	long long patterns = 0;
	for (auto m : b) {
		auto ulim = lower_bound(begin(a), end(a), m);
		long long upper = distance(begin(a), ulim);
		auto blim = upper_bound(begin(c), end(c), m);
		long long bottom = distance(blim, end(c));
		patterns += upper * bottom;
	}
	cout << patterns << endl;
}


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

using namespace std;

int number_of_day(int year, int month, int day) {
	int days = 0;
	
	for(int indexYear = year + 1; indexYear < 1000; ++indexYear)
		days += (indexYear % 3 == 0) ? 200 : 195;
		
	for(int indexMonth = month + 1; indexMonth <= 10; ++indexMonth) {
		if(year % 3 == 0)
			days += 20;
		else
			days += (indexMonth % 2 == 0) ? 19 : 20;
	}
	
	days += (year % 3 != 0 && month % 2 == 0) ? (20 - day) : (21 - day);
	
	return days;
}

int main() {
	int numero_caso;
	
	int year, month, day;
	
	cin >> numero_caso;
	
	for(int index = 0; index < numero_caso; ++index) {
		cin >> year >> month >> day;
		
		cout << number_of_day(year, month, day) << endl;
	}
	return 0;
}



Measured memory_bytes: 3052
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        String ans = "";
        List<String> strs = new ArrayList<>();

        for (int i = 0; i < n; i++) {
            strs.add(sc.next());
        }

        strs.stream().sorted((x,y)->x.compareTo(y)).forEach(x-> System.out.print(x));


    }


}


Measured memory_bytes: 28752
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;
const LL MOD = 1e9 + 7;
const int MAXV = 1e5 + 5;
double solve(int a, int b, int c, auto &dp, int n) {
    if (dp[a][b][c] != -1) return dp[a][b][c];
    double sum = 0;
    if (a - 1 >= 0)
        sum += solve(a - 1, b, c, dp, n) / n * a;
    if (b - 1 >= 0)
        sum += solve(a + 1, b - 1, c, dp, n) / n * b;
    if (c - 1 >= 0)
        sum += solve(a, b + 1, c - 1, dp, n) / n * c;
    sum++;
    sum *= n, sum /= a + b + c;
    return dp[a][b][c] = sum;
}
void marmot0814() {
    int n; cin >> n;
    vector<LL> cnt(3, 0);
    for (int i = 0 ; i < n ; i++) {
        int v; cin >> v; v--;
        cnt[v]++;
    }
    vector<vector<vector<double>>> dp(n + 1, vector<vector<double>>(n + 1, vector<double>(n + 1, -1)));
    dp[0][0][0] = 0;
    cout << fixed << setprecision(20) << solve(cnt[0], cnt[1], cnt[2], dp, n) << '\n';
}
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int t = 1, kase = 0; // cin >> t;
    while (t--) {
        // cout << "Case #" << ++kase << ":";
        marmot0814();
    }
}

Measured memory_bytes: 219912
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ld long double
#define ull unsigned long long int
#define ll long long int
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007ll
#define rep(i,L,R) for(ll i=L;i<R;i++)
#define f(n) rep(i,0,n)
#define DEBUG
#ifdef DEBUG
#define deb2(args...) {dbg,args; cerr<<endl;}
#else
#define deb2(args...)
#endif
struct debb{template<typename T> debb& operator,(const T &v){cerr<<v<<" ";return *this;}}dbg;
#define deb1(args...) do {cerr << #args << " : "; dbg,args; cerr << "\n";} while(0)
#define printa(a,L,R) rep(i,L,R) cout << a[i] <<' ';cout<<"\n";
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
template<typename T>T gcd(T a,T b){if(b==0)return a;else return gcd(b,a%b);}
template<typename T>T lcm(T a,T b){return a/gcd(a,b)*b;}
ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1)res=((res%p)*(x%p))%p;y=y>>1;x=(x*x)%p;}return res;}
ll pow1(ll x,ll y){ll res=1;while(y>0){if(y&1)res=(res*x);y=y>>1;x=x*x;}return res;}
const ll INF = 1e18l+10,N = 2e5+10,MAX = 5000000;
#define sq(X) ((X)*(X))

int main()
{
    ld r;
    cin>>r;
    cout<<2*r*3.14159265<<"\n";
}

Measured memory_bytes: 3788
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e6+5;
const int mod = 1e9+7;

int n;
string s;
int mem[N][2];

int go(int idx , int carry){
    if(idx == -1)
        return carry;
    if(~mem[idx][carry])
        return mem[idx][carry];
    int c1 = (carry + s[idx] - '0') + go(idx - 1 , 0);
    int c2 = 10 - (carry + s[idx] - '0') + go(idx - 1 , 1);
    return mem[idx][carry] = min(c1 , c2);
}

int main(){
    cin >> s;
    n = s.size();
    memset(mem , -1 , sizeof mem);
    cout << go(n - 1 , 0);
}


Measured memory_bytes: 56068
def main():
    D = int(input())
    c = list(map(int,input().split()))
    s = []
    for d in range(D):
        s.append(list(map(int,input().split())))
        
    t = []
    for d in range(D):
        t.append(int(input())-1)
    
    last = [0 for i in range(26)]
    
    v = 0
    
    for d in range(D):
        v += s[d][t[d]]
        last[t[d]] = d+1
        for i in range(26):
            v -= c[i]*(d+1-last[i])
        print(v)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 9388
# ABC102 C - Linear Approximation
n = int(input())
a = [int(x) for x in input().split()]
b = []
m = 0.0

for i in range(n):
    b.append(a[i]-i)

b.sort()

if n%2 == 0:
    m = (b[n//2] + b[(n//2)-1])//2
else:
    m = b[((n+1)//2)-1]
for i in range(n):
    b[i] = abs(b[i]-m)

print(int(sum(b)))

Measured memory_bytes: 25200
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
int n,a[300000];
signed main(){
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    int ans=0;
    for(int i=0;i<60;i++){
        int cnt=0;
        for(int j=0;j<n;j++)
            cnt+=a[j]>>i&1;
        (ans+=(1ll<<i)%mod*cnt%mod*(n-cnt)%mod)%=mod;
    }
    cout<<ans%mod<<endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 10;
char s[N];
int main() {
    int n;  cin >> n;
    map <string, int> mp;
    for (int i = 1; i <= n; i++) {
        string s;   cin >> s;
        mp[s]++;
    }
    cout << mp.size();
#ifndef ONLINE_JUDGE
    system("pause");
#endif
    return 0;
}

Measured memory_bytes: 19228
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
const ll INF = 1e9 + 7;
typedef pair<int,int> P;// pair型は２つの値の組を表せる

int main(){
    int n,m; cin >> n >> m; //桁数n,条件がm個
    vector<P> p(m);
    //p[i].firstが左から～桁目
    //p[i].secondがその桁の数値
    rep(i,m) cin >> p[i].first >> p[i].second;
    //候補0~999を試す
    rep(x,1000){
        string s=to_string(x);
        int keta=s.length();

        if (keta!=n) continue;
        bool ok=true;
        rep(i,m){
            if (s[p[i].first-1]!=p[i].second+'0') ok=false;
        }
        if(ok){
            cout << x << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;

}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, a: "List[int]"):
    ret = sum(a) - N
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316