akhauriyash/Code-Regression huggingface dataset:
#include<string.h>
#include<stdio.h>
main(){
        int s[50],p,n,t;
        int i,j,sum;

        while(1){
                memset(s,0,sizeof(s));
                scanf("%d %d",&n,&p);
                if(n==0&&p==0){
                        break;
                }
                t=p;
                for(i=0;;i++){
                        if(p==0){
                                p=s[i%n];
                                s[i%n]=0;
                        }else{
                                s[i%n]++;
                                p--;
                                if(p==0&&s[i%n]==t){
                                        break;
                                }
                        }
                }
                printf("%d\n",i%n);
                s[i%n]=0;
        }
        return 0;
}

Measured memory_bytes: 600
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H,K;
	string s;
	while(cin>>N) {
		VI a(N);
		REP(i, N) cin>>a[i];
		VI b(a);
		sort(ALL(b));
//		DD(b);
		REP(i, N) {
			cout<<(a[i]<=b[N/2-1] ? b[N/2]:b[N/2-1])<<endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 5376
if __name__ == '__main__':
    s = input()
    alpha = list([1 for i in range(26)])
    if len(s) != 26:
        for i in range(len(s)):
            if(alpha[ord(s[i])-97] == 0):
                print("-1")
                exit()
            alpha[ord(s[i])-97] = 0
        for i in range(len(alpha)):
            if alpha[i]==1:
                print(str(s)+chr(i+97))
                exit()
        print("-1")
        exit()
    else:
        max = ord(s[-1])-97
        alpha[ord(s[-1])-97] = 0
        
        for i in reversed(range(len(s)-1)):
            if ord(s[i])-97 <  max:
                for j in range(len(alpha)):
                    if alpha[j] == 0 and ord(s[i])-97<j:
                        print(s[:i]+chr(j+97))
                        exit()
            else:
                max = ord(s[i])-97
            alpha[ord(s[i])-97] = 0
        print("-1")
        exit()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string s;
    cin>>n>>s;
    if(n&1) puts("No");
    else{
        for(int i=0;i<n/2;i++){
            if(s[i]!=s[i+n/2]){
                puts("No");
                return 0;
            }
        }
        puts("Yes");
    }
    //puts("Yes");
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reg(i,a,b) for(int i=(a);i<=(b);i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=(b);i>=(a);i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX


char is[25];
int lis;
void dfs(string ns,vector<string>& firs,vector<string>& ends,lli& sum){
	int nl = ns.size();
	if(nl==lis){
		sum++;
		firs.push_back(ns);
		sort(firs.begin(),firs.end());
		if(firs.size()>5)firs.erase(firs.begin()+5);
		
		ends.push_back(ns);
		sort(ends.begin(),ends.end(),greater<string>());
		if(ends.size()>5)ends.erase(ends.begin()+5);
	}
	else{
		char nc = is[nl];
		if(nc!='a'){
			char c=nc;
			bool ok = false;
			rep(i,nl)if(ns[i]==c)ok=true;
			if(ok)dfs(ns+c,firs,ends,sum);
		}
		else dfs(ns+'a',firs,ends,sum);
		
		if(nc!='z'){
			char c=nc+1;
			bool ok = true;
			rep(i,nl)if(ns[i]==c)ok=false;
			if(ok)dfs(ns+c,firs,ends,sum);
		}
	}
}

int main(void){
	for(;;){
		scanf("%s",is);
		if(is[0]=='#')break;
		lis = strlen(is);
		
		vector<string> firs,ends;
		lli sum=0;
		string s="";
		dfs(s,firs,ends,sum);
		
		printf("%lld\n",sum);
		rep(i,firs.size()){
			printf("%s\n",firs[i].c_str());
		}
		irep(i,min((lli)ends.size(),sum-5)){
			printf("%s\n",ends[i].c_str());
		}
	}
	return 0;
}

Measured memory_bytes: 1076
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<climits>
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n; cin >> n;
  int ans = -1;
  vector<int> v(n);
  vector<int> p(n);
  vector<int> q(n);
  for(int i=0;i<n;i++) v[i] = i+1;
  for(int i=0;i<n;i++) cin >> p[i];
  for(int i=0;i<n;i++) cin >> q[i];

  if(p > q){
    vector<int> tmp;
    tmp = p;
    p = q;
    q = tmp;
  }

  do{
    if(v == p){
      ans = 0;
    }
    if(ans >= 0){
      if(v == q){
        break;
      }
      else{
        ans++;
      }
    }
  }while(next_permutation(v.begin(),v.end()));

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(int i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;

int main() {
	string S;
	cin >> S;
	vector<vector<ll>> dp(2, vector<ll>(S.size(), 0));

	// 最初の2文字 xy
	dp[0][0] = 1; // x
	if(S[0]==S[1]) dp[0][1] = 0; 
	else dp[0][1] = 2; // x y

	dp[1][0] = 0;
	dp[1][1] = 1; // xy
	
	int i=2;
	// dp[0][i]
	if(S.substr(i,1)==S.substr(i-1,1)) { // y=z
		dp[0][i] = dp[1][i-1] + 1; // xy z
	} else {
		dp[0][i] = max(dp[0][i-1],dp[1][i-1]) + 1; // x y z
	}
	// dp[1][i]
	dp[1][i] = max(dp[0][i-2], dp[1][i-2]) + 1; // x yz
	

	for(int i=3; i<S.size(); i++) {
		// dp[0][i]
		if(S.substr(i,1)==S.substr(i-1,1)) { // y=z
			if(dp[1][i-1]==0) dp[0][i] = 0;
			else dp[0][i] = dp[1][i-1] + 1; // ... yz z 
		} else {
			dp[0][i] = max(dp[0][i-1],dp[1][i-1]) + 1; // ... yz w or ... z w
		}

		// dp[1][i]
		if(S.substr(i-1,2)==S.substr(i-3, 2)){
			if(dp[0][i-2]==0) dp[1][i] = 0;
			else dp[1][i] = dp[0][i-2] + 1; // ...z w zw
		} else {
			dp[1][i] = max(dp[0][i-2], dp[1][i-2]) + 1; // ...x y zw or ...xy zw
		}
	}

	cout << max(dp[0][S.size()-1], dp[1][S.size()-1]) << endl;

	// rep(j, 2) {
	// 	rep(i, S.size()) {
	// 		cout << dp[j][i] << ' ';
	// 	}
	// 	cout << endl;
	// }

	return 0;
}

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

int main() {
	int n, h;
	cin >> h >> n;
	int tot = 0;
	for(int i = 1; i <= n; ++i) {
		int x;
		cin >> x;
		tot += x;
	}
	if(h > tot)
		cout << "No";
	else
		cout << "Yes";
}

Measured memory_bytes: 3596
#include <iostream>
using namespace std;
class Dice {
    private:
        int num[6];

    public:
        Dice(int *_num) {
            for (int i=0;i<6;i++) {
                num[i] = _num[i];
            }
        }

        int getRightNum(int top, int front) {
            int ret = 0;
            if (top == num[0]) {
                if (front == num[1]) ret = num[2];
                else if (front == num[2]) ret = num[4];
                else if (front == num[4]) ret = num[3];
                else if (front == num[3]) ret = num[1];
            } else if (top == num[1]) {
                if (front == num[0]) ret = num[3];
                else if (front == num[3]) ret = num[5];
                else if (front == num[5]) ret = num[2];
                else if (front == num[2]) ret = num[0];
            } else if (top == num[2]) {
                if (front == num[0]) ret = num[1];
                else if (front == num[1]) ret = num[5];
                else if (front == num[5]) ret = num[4];
                else if (front == num[4]) ret = num[0];
            } else if (top == num[3]) {
                if (front == num[0]) ret = num[4];
                else if (front == num[4]) ret = num[5];
                else if (front == num[5]) ret = num[1];
                else if (front == num[1]) ret = num[0];
            } else if (top == num[4]) {
                if (front == num[0]) ret = num[2];
                else if (front == num[2]) ret = num[5];
                else if (front == num[5]) ret = num[3];
                else if (front == num[3]) ret = num[0];
            } else if (top == num[5]) {
                if (front == num[1]) ret = num[3];
                else if (front == num[3]) ret = num[4];
                else if (front == num[4]) ret = num[2];
                else if (front == num[2]) ret = num[1];
            }
            return ret;
        }
};

int main() {
    int num[6], q, top, front;
    cin >> num[0] >> num[1] >> num[2] >> num[3] >> num[4] >> num[5];
    Dice D(num);
    cin >> q;
    for (int i=0;i<q;i++) {
        cin >> top >> front;
        cout << D.getRightNum(top, front) << endl;
    }
    return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int a[N], n, cnt, m;
int main() {
    scanf("%d %d", &n, &m);
    for (int i  = 1; i <= m; i++) scanf("%d", &a[i]);
    for (int i  = 1; i <= m; i++) if (a[i] & 1) cnt ++;
    if (cnt > 2) {
    	puts("Impossible");
    	return 0;
    }
	for (int i = 1; i <= m; i++) 
        if ((a[i] & 1) && (!(a[1] & 1))) swap(a[i], a[1]); 
        else if (a[i] & 1) swap(a[i], a[m]);
	for (int i = 1; i <= m; i++) cout << a[i] << " " ; cout << endl;
	if (!cnt) {
		int ans = m + 2;
		if (a[1] == 2) ans--;
		cout << ans << endl;
		if (a[1] != 2) cout << a[1] - 2 << " " ; cout << "1 ";
		for (int i = 2; i <= m; i++) cout << a[i] << " " ; cout << 1 << endl;
	}
	else if (cnt == 1) {
		int ans = m + 1;
		if (a[1] == 1) ans--;
        cout << ans << endl;
		if (a[1] != 1) cout << a[1] - 1 << " " ; 
		for (int i = 2; i <= m; i++) cout << a[i] << " " ; cout << 1 << endl;
	}
	else if (cnt == 2) {
		int ans = m;
		if (a[1] == 1) ans--;
        cout << ans << endl;
		if (a[1] != 1) cout << a[1] - 1 << " " ; 
		for (int i = 2; i < m; i++) cout << a[i] << " " ; cout << a[m] + 1 << endl;
	}
	return 0;
}
    


Measured memory_bytes: 256
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def main(argv)
  n = InputLine.to_i
  a = InputLine.to_ia

  b = a.select{|v| (v % 2) == 0}

  c = b.select{|v| (v % 3) == 0 || (v % 5) == 0}

  if b.size == c.size then
    puts 'APPROVED'
  else
    puts 'DENIED'
  end
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788
x, y = list(map(int,input().split()))
# x,y = 0,1

if y==0:
	if x<0:
		print(abs(x))
	else:
		print(abs(x)+1)
elif x==0:
	if y<0:
		print(abs(y)+1)
	else:
		print(abs(y))
elif x<0:
	if y<0:
		if x<=y:
			print(y-x)
		else:
			print(x-y+2)
	else:
		if -x<y:
			print(y+x+1)
		else:
			print(-x-y+1)
else:
	if y<0:
		if x<=-y:
			print(abs(y)-abs(x)+1)
		else:
			print(x+y+1)
	else:
		if x<=y:
			print(y-x)
		else:
			print(x-y+2)




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

int main(){
    int H,N;
    cin >> H >> N;
    int sum = 0,A = 0;
    for(int i = 0;i < N;i++){
        cin >> A;
        sum += A;
    }
    if(H <= sum) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>

using namespace std;

const int N = 100010;

int f[N];

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    
    while(m --)
    {
        int x, y;
        scanf("%d%d", &x, &y);
        if(x == 1 && !y && n != 1 || f[x] && f[x] != y)
        {
            puts("-1");
            return 0;
        }
        f[x] = y;
    }
    if(n != 1 && !f[1])  f[1] = 1;
    
    int res = 0;
    for(int i = 1; i <= n; i ++)
        res = res * 10 + f[i];
    printf("%d", res);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	string a,b,c;
	cin>>a>>b>>c;
	char A=a.at(0)-0x20;
	char B=b.at(0)-0x20;
	char C=c.at(0)-0x20;
	cout<<A<<B<<C<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<map>
#include <algorithm>
#include<cstdlib>
#include<cmath>
#include<deque>
#include <numeric>
#include<valarray>
typedef unsigned long long ull;
typedef  long long ll;

int main() {
	ll A;
	ll B;

	std::cin >> A >>B ;


	ll K = std::abs(A + B);

	if (K % 2)
	{
		std::cout << "IMPOSSIBLE" << std::endl;
	}
	else
	{
		std::cout << K / 2 << std::endl;
	}


	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main(void)
{

    int n;
    cin >>n;

    string s,t;
    cin >>s >>t;

    for(int i = 0; i < n; i++){
        printf("%c", s[i]);
        printf("%c", t[i]);
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 256
import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

S = input()
K = INT()

N = len(S)
numlist = []
count = 1

for i in range(1, N):
    if S[i] == S[i - 1]:
        count += 1
    else:
        numlist.append(count)
        count = 1
numlist.append(count)
if len(numlist) == 1:
    ans = (N * K) // 2
elif S[0] == S[-1]:
    center = numlist[0] + numlist[-1]
    ans = (center // 2) * (K - 1)
    ans += numlist[0] // 2
    ans += numlist[-1] // 2
    for i in range(1, len(numlist)-1):
        ans += (numlist[i] // 2) * K
else:
    ans = 0
    for i in range(len(numlist)):
        ans += (numlist[i] // 2) * K
print(ans)


Measured memory_bytes: 38384
import numpy as np
n=int(input())
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
N=np.zeros(n)
for i in range(n):
    N[i]=a1[i]+np.sum(a2)
    a2[i]=0
    if i!=n-1:
        a1[i+1]+=a1[i]
print(int(np.max(N)))

Measured memory_bytes: 14444
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>




using namespace std;
int main() {

	int n, y;
	cin >> n >> y;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n - i; j++) {
			if (i * 10000 + j * 5000 + (n - i - j)*1000 == y) {
				cout << i << " " << j << " " << n - i - j << endl;
				return 0;
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;

	return 0;
}

Measured memory_bytes: 256
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)*}
    };
}

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

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! {
        x: usize,
        a: usize,
    };

    if x >= a {
        println!("{}", 10);
    } else {
        println!("{}", 0);
    }
}


Measured memory_bytes: 4352
n = int(input())
s = input()

alphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabet = alphabet.upper()
alphabets = [w for w in alphabet]

words = []
for i in s:
    index = alphabets.index(i)
    new_index = index + n
    if new_index > 25:
        new_index -= 26
    words.append(alphabets[new_index])

ans = ''.join(words)
print(ans)

Measured memory_bytes: 9152
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n), sum(n+1);
  rep(i, n) {
    cin >> a[i];
    sum[a[i]]++;
  }
  
  ll ans = 0;
  rep(i, n) {
    ans += sum[i+1]*(sum[i+1]-1)/2;
  }
  
  rep(i, n){
    ll dim = sum[a[i]]*(sum[a[i]]-1)/2;
    ll add = (sum[a[i]]-1)*(sum[a[i]]-2)/2;
    cout << ans+add-dim << endl;
  }
  
  return 0;
}

Measured memory_bytes: 5760
import sys

A,B,C=map(int,input().split())
K=int(input())
for i in range(K+1):
  #print(K,A,B,C,i)
  if( A < B and B < C):
    print('Yes')
    sys.exit()
  else:
    if(i >= K):
      print('No')
      sys.exit()
    else:
      if(A >= B):
        B *= 2
      elif(B >= C):
        C *= 2
      else:
        pass


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

using namespace std;

#ifdef LOCAL
#define DBG_MACRO_NO_WARNING
#include <dbg.h>
#else
#define dbg(...) 0
#endif

using ll = long long;
using ull = unsigned long long;

void solve() {
  int a, b;
  cin >> a >> b;
  if (a > b) {
    for (auto i = 0; i < a; ++i) {
      cout << b;
    }
  } else {
    for (auto i = 0; i < b; ++i) {
      cout << a;
    }
  }

  cout << "\n";
}

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

#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  solve();

  return 0;
}

Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))

dp = [0]*N
dp[1] = abs(h[1]-h[0])

for i in range(2, N):
  dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))

print(dp[N-1])

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

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

	sort(a.begin(), a.end());
	int ans = 0, sum = 0;
	for (int i = 0; i < n; i++) {
      	if (sum + a[i] > x) break;
		sum += a[i];
		ans++;
      	if (i==n-1 && x > sum) ans--;
	}
  
	cout << ans << endl;
}

Measured memory_bytes: 3608
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long k = long.Parse(Console.ReadLine());
            Queue<long> numbers = new Queue<long>();
            for (int i = 1; i < 10; i++)
                numbers.Enqueue(i);
            long nFound = 0;
            long tocheck = 0;

            while (nFound < k)
            {
                tocheck = numbers.Dequeue();

                if (tocheck % 10 != 0)
                    numbers.Enqueue(tocheck * 10 + (tocheck%10) -1);
                numbers.Enqueue(tocheck * 10 + (tocheck%10));
                if (tocheck % 10 != 9)
                    numbers.Enqueue(tocheck * 10 + (tocheck % 10) + 1);
                nFound++;
            }
            long res = tocheck;

            Console.WriteLine(res);
        }

    }
}


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

int main(){
	string s;
	cin >> s;
	if(s[0] == 'A'){
		int cnt(0), c_pos;
		int n = s.size();
		for(int i(2);i<=n-2;++i){
			if(s[i] == 'C'){
				c_pos = i;
				cnt++;
			}
		}
		if(cnt == 1){
			for(int i(0);i<n;++i){
				if(i == c_pos) continue;
				if(i == 0) continue;
				if(s[i] - 'a' >= 26 || s[i] - 'a' < 0){
					cout << "WA" << endl;
					return 0;
				}
			}
			cout << "AC" << endl;
			return 0;
		}
	}
	cout << "WA" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
vector<ll> tree[100010];
ll parent[100010] = {};
ll cnt[100010] = {};
ll val[100010] = {};
ll N,K;
void dfs(ll cur, ll par){
    if(par == -1){
        val[cur] = K;
    }else if(par == 0){
        val[cur] = K - 1 - cnt[par];
        cnt[par]++;
    }else{
        val[cur] = K - 2 - cnt[par];
        cnt[par]++;
    }
    for(auto &e: tree[cur]){
        if(e == par) continue;
        dfs(e, cur);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    ll a[100010], b[100010];
    rep(i,0,N-1){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        if(a[i] > b[i]) swap(a[i], b[i]);
        parent[b[i]] = a[i];
        tree[a[i]].push_back(b[i]);
        tree[b[i]].push_back(a[i]);
    }
    parent[0] = -1;
    dfs(0,-1);
    ll ans = 1;
    rep(i,0,N){
        ans *= val[i];
        ans %= MOD;
    }
    print(ans);
    
}

Measured memory_bytes: 13184
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int main(){
	int N;
	cin >> N;
	vi A(N+1);
	vi B(N);
	for(int i=0;i<N+1;i++){
		cin >> A[i];
	}
	for(int i=0;i<N;i++){
		cin >> B[i];
	}
	int pre = 0;
	ll ans = 0;
	for(int i=0;i<N+1;i++){
		ans += min(pre,A[i]);
		A[i] -= min(pre,A[i]);
		ans += min(B[i],A[i]);
		pre = B[i]-min(B[i],A[i]);
	}
	cout << ans << endl;	
	return 0;
}


Measured memory_bytes: 1024
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
  int i;
  cin >> i;
  if(i == 1){
    cout << "Hello World" << endl;
  }else{
    int a,b;
    cin >> a >> b;
    cout << a + b << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] vote = new int[N];
    int sum = 0;
    for(int i=0; i<N; i++){
      int tmp = sc.nextInt();
      vote[i] = tmp;
      sum += tmp;
    }
    double AVG = sum*(1d/(4*M));
    int cnt = 0;
    for(int i=0; i<N; i++){
      if(vote[i] >= AVG){
        cnt++;
      }
    }
    if(cnt<M){
      System.out.print("No");
    }else{
      System.out.print("Yes");
    }
  }
}
    
    


Measured memory_bytes: 21716
# 10
a = int(input())
# 2
b = int(input())
# 1
c = int(input())
x = int(int(input())/50)
d = [0] * x
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 10*i+2*j+k == x:
                ans += 1
print(ans)

Measured memory_bytes: 9168
#include<iostream>
#include<cmath>
#include<algorithm>
const long double PI=acos(-1);
typedef long long ll;
using namespace std;
void solve()
{//printf("%.20f\n",PI);
	 double a,b;
	 double h,m;
	cin>>a>>b>>h>>m;
	 double rad = PI * 2 * ( ( double)h / 12.0 + (( double)m / 60.0) / 12.0 - ( double)m / 60.0);

	 double ans=sqrt(a*a+b*b-2*a*b*cos(rad));
	printf("%20.20f",ans);
}
int main() 
{
//	ios::sync_with_stdio(false);
	solve();
	return 0;
}

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

int main()
{
    int a,b,c,n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>b>>c;
        if(a*a==b*b+c*c)
            cout<<"YES"<<endl;
        else if(b*b==a*a+c*c)
            cout<<"YES"<<endl;
        else if(c*c==a*a+b*b)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

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


int main(){
  string s;
  cin >> s;
  int ans=0;
  for(int i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
    	if(s[i]=='0')
          	s[i+1]='1';
      	else
          	s[i+1]='0';
      	ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	IN(int, l, r, d);
	int ans = 0;
	incII(i, l, r) { if(i % d == 0) { ans++; } }
	OUT(ans);
}


Measured memory_bytes: 3580
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[8] = { 0,0,1,-1, 1,1,-1,-1 };// 前４つで４近傍
const int c_Dy[8] = { 1,-1,0,0 ,1,-1,1,-1};// 全部で８近傍
const int c_div = 1000000007; //10^9 + 7
const double PI = 3.14159265358979323846;


int main() {

	char S[1000000], R[19999];

	scanf("%s", S);

	bool check[30];
	for (int i = 0; i < 30; i++) {
		check[i] = false;
	}


	int base = 'a';

	for (int i = 0; i < strlen(S); i++) {
		check[S[i] - base] = true;
	}

	for (int i = 0; i < 26; i++) {
		if (!check[i]) {
			printf("%c", base + i);
			return 0;
		}
	}

	printf("None");

}







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

int main(){
	ll x,y;
	cin >> x >> y;
	ll res = 0;
	while(x <= y){
		res++;
		x *= 2;
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a;
    cin>>a;
    a/=200;
    if(9<=a){
        cout<<1<<endl;
    }else if(8<=a){
        cout<<2<<endl;
    }else if(7<=a){
        cout<<3<<endl;
    }else if(6<=a){
        cout<<4<<endl;
    }else if(5<=a){
        cout<<5<<endl;
    }else if(4<=a){
        cout<<6<<endl;
    }else if(3<=a){
        cout<<7<<endl;
    }else{
        cout<<8<<endl;
    }
}

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

int v,e;
// hasparent
set<int> hp;
// children,parent
map<int,set<int>> c;
map<int,set<int>> p;
// topsort seq
vector<int> t;

int main(){
  cin>>v>>e;
  for(int i=0;i<e;i++){
    int a,b;cin>>a>>b;
    c[a].insert(b);
    p[b].insert(a);
  }
  for(int i=0;i<v;i++){
    if(p[i].empty())hp.insert(i);
  }
  while(hp.size()){
    int o=*hp.begin();
    t.push_back(o);
    hp.erase(hp.begin());
    for(auto h:c[o]){
      p[h].erase(o);
      if(p[h].empty())hp.insert(h);
    }
  }
  copy(t.begin(),t.end(),ostream_iterator<int>(cout,"\n"));
}

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

int N, M;
vector<int> next_verts[100000];
vector<int> longest_path_length_from_vert(100000, -1);

int calc_longest_path_from(int now){
    if(longest_path_length_from_vert[now] >= 0){
        return longest_path_length_from_vert[now];
    }
    if(next_verts[now].size() == 0){
        longest_path_length_from_vert[now] = 0;
        return 0;
    }

    int ret = 0;
    for(auto itr = next_verts[now].begin(); itr != next_verts[now].end(); itr++){
        ret = max(ret, calc_longest_path_from(*itr));
    }
    longest_path_length_from_vert[now] = ret + 1;
    return ret + 1;
}


int main(){
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        next_verts[x].push_back(y);
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
        longest_path_length_from_vert[i] = calc_longest_path_from(i);
        ans = max(ans, longest_path_length_from_vert[i]);
    }

    cout << ans << endl;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int m, k;
  cin >> m >> k;
  vector<int> b;
  if (m == 0) {
    if (k == 0) {
      cout << "0 0" << endl;
    } else {
      cout << "-1" << endl;
    }
    return 0;
  } else if (m == 1) {
    if (k == 0) {
      cout << "0 0 1 1" << endl;
    } else {
      cout << "-1" << endl;
    }
    return 0;
  }
  ll bit = 1 << m;
  if (k >= bit) {
    cout << -1 << endl;
    return 0;
  }
  b.push_back(k);
  for (int i = 0; i < bit; i++) {
    if (i == k) continue;
    b.push_back(i);
  }
  b.push_back(k);
  for (int i = bit - 1; i >= 0; i--) {
    if (i == k) continue;
    b.push_back(i);
  }
  cout << b[0];
  for (int i = 1; i < bit * 2; i++) cout << " " << b[i];
  cout << endl;
  return 0;
}


Measured memory_bytes: 2932
n,k,*a=map(int,open(0).read().split())
a.sort()
p=a.pop
s=b=~k%2or p()
i=0
while k>1:
 x=a[i]*a[i+1]
 if x*b>a[-1]*a[-2]*b:i+=2
 else:x=p()*p()
 s=s*x%(10**9+7);k-=2
print(s)

Measured memory_bytes: 111728
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	m := make(map[int]int)
	for i := 0; i < n; i++ {
		var s int
		fmt.Scan(&s)
		m[s]++
	}

	fmt.Println(len(m))
}


Measured memory_bytes: 512
#include <stdio.h>

const long long mod = 998244353;
long long inv[300300] = {0,1}, fact[300300] = {1,1}, ifact[300300] = {1,1};

int main()
{
	int N; long long A, B, K; scanf ("%d %lld %lld %lld",&N,&A,&B,&K);

	for (int i=2;i<=N;i++){
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
		fact[i] = fact[i-1] * i % mod;
		ifact[i] = ifact[i-1] * inv[i] % mod;
	}

	long long ans = 0;
	for (long long i=0;i<=N;i++){
		long long R = K - i * A;
		if (R % B) continue;
		long long j = R / B;
		if (j < 0 || j > N) continue;

		long long p = fact[N] * ifact[i] % mod * ifact[N-i] % mod;
		long long q = fact[N] * ifact[j] % mod * ifact[N-j] % mod;
		ans = (ans + p * q) % mod;
	}
	printf ("%lld\n",ans);

	return 0;
}

Measured memory_bytes: 7168
import fractions
a,b = map(int,input().split())

gcd = fractions.gcd(a,b)

def prime_factorize(n):
    result = []
    for i in range(2,int(n**0.5)+1):
        while n % i == 0:
            n //= i
            result.append(i)
    if n != 1:
        result.append(n)
    return result

ans = len(set(prime_factorize(gcd)))

print(ans+1)

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


int main(){
    int k;
    cin >> k;
    string s;
    cin >> s;
    if(s.size() <= k){
        cout << s << endl;
    }
    else{
        string ans = s.substr(0,k);
        ans += "...";
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll N = 1e6 + 5, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(0), cin.tie(0);
    ll a, b;
    cin >> a >> b;
    cout << max(0ll, a - 2 * b);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
template<typename T> inline void debug(const vector<T> &xs){
#ifdef DEBUG
	pr(xs);
#endif
}

int main(){
	int N, M;
	cin >> N >> M;
	vector<ll> A(N);
	for(int i=0; i<N; i++) cin >> A[i];

	priority_queue<ll> que;
	for(int i=0; i<N; i++) que.push(A[i]);

	for(int i=0; i<M; i++){
		ll x = que.top();
		que.pop();
		que.push(x/2);
	}

	ll ans = 0;
	for(int i=0; i<N; i++){
		ans += que.top();
		que.pop();
	}
	cout << ans << endl;

	return 0;
}


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

vector<long long> fact(200010);
vector<long long> inv(200010);

long long powMod(long long p, long long r) {
    long long modulo = (long long)pow(10,9) + 7;
    if(r == 0) {
        return 1;
    } else {
        long long temp = powMod(p, r / 2);
        if(r % 2 == 0) {
            return temp * temp % modulo;
        } else {
            return (temp * temp % modulo) * p % modulo;
        }
    }
}

long long invMod(long long a) {
    long long modulo = (long long)pow(10,9) + 7;
    return powMod(a, modulo - 2);
}

long long combMod(long long fact_p, long long fact_r, long long fact_cr) {
    long long modulo = (long long)pow(10,9) + 7;
    long long fact1 = fact_p;
    long long fact2 = invMod(fact_r);
    long long fact3 = invMod(fact_cr);
    return (((fact1 * fact2) % modulo) * fact3) % modulo;
}

int main() {
    long long modulo = (long long)pow(10,9) + 7;
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    vector<long long> fact(h + w);
    fact.at(0) = 1; 
    for(int i = 1; i < h + w; i++) {
        fact.at(i) = fact.at(i - 1) * i % modulo;
    }
    long long res = combMod(fact.at(h + w - 2), fact.at(w - 1), fact.at(h - 1));
    for(int i = 0; i < b; i++) {
        res = (res - combMod(fact.at(h - a + i - 1), fact.at(h - a - 1), fact.at(i)) * combMod(fact.at(a + w - i - 2), fact.at(a - 1), fact.at(w - i - 1))) % modulo;
    }
    if(res < 0) {
        res += modulo;
    }
    
    cout << res << endl;
}

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

public class Main{


	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int X = s.nextInt();
		int N = s.nextInt();
		int[] p = new int[N];
		for(int i=0; i<N; i++) {
			p[i] = s.nextInt();
		}
		int ans =0;
		Arrays.sort(p); //昇順にソート
		for(int i=0; i<=101; i++) {
			boolean include = false;
			for(int k=0; k<p.length; k++) {
				if(i == p[k]) {include = true; break;}
			}
			
			if(!include && Math.abs(X-ans) > Math.abs(X-i)  ) {
				ans = i; 
			}
		}
		
		System.out.println(ans);
		
	}

}


Measured memory_bytes: 35916
import math
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


k = int(input())
ans = 0
for l in range(1, k+1):
    for m in range(1, k+1):
        for n in range(1, k+1):
            abc = gcd(l, m, n)
            ans += abc
print(ans)

Measured memory_bytes: 74700
object Scanner {
  private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0
  @inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
  @inline private def hasNextByte(): Boolean =
    if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else { true }
  @inline private def hasNext(): Boolean = {
    while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
    hasNextByte()
  }
  @inline private def readByte(): Byte =
    if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else { -1 }
  def next(): String = {
    if(!hasNext()) ???
    val sb = new StringBuilder; var b = readByte()
    while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
    sb.toString
  }
  def nextInt(): Int = {
    val n = nextLong()
    if (n < Int.MinValue || Int.MaxValue < n) ???
    n.toInt
  }
  def nextLong(): Long = {
    if(!hasNext()) ???
    var minus = false; var b = readByte()
    if (b == '-') { minus = true; b = readByte() }
    def go (b: Byte, n: Long = 0): Long =
      if ('0' <= b && b <= '9') { go(readByte(), n * 10 + b - '0') }
      else if (minus) { -n } else { n }
    go(b)
  }
  def nextDouble(): Double = next.toDouble
}


object Main extends App {
  val n = Scanner.nextInt()
  val m = Scanner.nextInt()
  val py = Array.fill(m,2)(Scanner.nextInt())
  val sortedpy = py.zipWithIndex.sortWith((x,y)=>{
    if (x._1(0) == y._1(0)){
      x._1(1) < y._1(1)
    } else {
      x._1(0) < y._1(0)
    }
  })
  var sequence = 0
  var pnow = -1
  val pw = new java.io.PrintWriter(System.out)
  sortedpy.map(pyi=>{
    if (pyi._1(0)!=pnow){
      sequence = 1
      pnow = pyi._1(0)
    } else {
      sequence = sequence + 1
    }
    (pyi._1(0),sequence,pyi._2)
  }).sortWith((x,y)=>{
    x._3 < y._3
  }).foreach(pyi => {
    if (pyi._1<100000){
      pw.print(0)
    }
    if (pyi._1<10000){
      pw.print(0)
    }
    if (pyi._1<1000){
      pw.print(0)
    }
    if (pyi._1<100){
      pw.print(0)
    }
    if (pyi._1<10){
      pw.print(0)
    }
    pw.print(pyi._1)
    if (pyi._2<100000){
      pw.print(0)
    }
    if (pyi._2<10000){
      pw.print(0)
    }
    if (pyi._2<1000){
      pw.print(0)
    }
    if (pyi._2<100){
      pw.print(0)
    }
    if (pyi._2<10){
      pw.print(0)
    }
    pw.print(pyi._2)
    pw.println()
  })
  pw.flush()
}

Measured memory_bytes: 77488
n,m=map(int,input().split())
def soinsuu(a):
    yakusuu=[]
    j=2
    while(a>1):
        for i in range(j,int(a**0.5)+1):
            if a%i==0:
                yakusuu.append(i)
                a=a//i
                j=i
                break
        else:
            yakusuu.append(a)
            break
    yakusuu.sort()
    return yakusuu
from collections import Counter
a=Counter(soinsuu(m))
ans=1
for i,j in a.items():
    ans*=max(i**(j//n),1)
print(ans)

Measured memory_bytes: 3316
def main():
    s = input()

    ans1 = 0
    ans0 = 0

    s_len = len(s)

    for i in range(s_len):
        if i % 2 == 0:
            if s[i] == '0':
                ans1 += 1
        else:
            if s[i] == '1':
                ans1 += 1
            
    for i in range(s_len):
        if i % 2 == 0:
            if s[i] == '1':
                ans0 += 1
        else:
            if s[i] == '0':
                ans0 += 1

    print(min(ans0,ans1))

if __name__ == '__main__':
    main()

Measured memory_bytes: 40432
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;



class Myon
{
	public Myon() { }
	public static int Main()
	{
		cin = new Scanner();
		new Myon().calc();
		return 0;
	}

	static Scanner cin;

	void calc()
	{
		int l, r;
		l = cin.nextInt();
		r = cin.nextInt();

		int ans;

		if (l / 2019 != r / 2019)
		{
			ans = 0;
		} else
		{
			l %= 2019;
			r %= 2019;
			if (l > r) swap<int>(ref l, ref r);
			int min = 2019;
			for (int i = l; i <= r; i++)
			{
				for (int j = i + 1; j <= r; j++)
				{
					min = Math.Min(min, (i * j) % 2019);
				}
			}
			ans = min;
		}
		Console.WriteLine(ans);
	}


	//swap
	void swap<T>(ref T a, ref T b)
	{
		T c = a;
		a = b;
		b = c;
	}


}



class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		if (s.Length == 0) return next();
		i = 0;
		return s[i++];
	}

	public int nextInt()
	{
		return int.Parse(next());
	}
	public int[] ArrayInt(int N, int add = 0)
	{
		int[] Array = new int[N];
		for (int i = 0; i < N; i++)
		{
			Array[i] = nextInt() + add;
		}
		return Array;
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public long[] ArrayLong(int N, long add = 0)
	{
		long[] Array = new long[N];
		for (int i = 0; i < N; i++)
		{
			Array[i] = nextLong() + add;
		}
		return Array;
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}


	public double[] ArrayDouble(int N, double add = 0)
	{
		double[] Array = new double[N];
		for (int i = 0; i < N; i++)
		{
			Array[i] = nextDouble() + add;
		}
		return Array;
	}
}


Measured memory_bytes: 13140
#include <stdio.h>
int main(void)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a >= b) {
		printf("No\n");
	} else if (b >= c) {
		printf("No\n");
	} else {
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = LLONG_MAX / 3;
const double eps = (1e-9);

int solve(vector<int>& h) {
  int s = -1, e = -1, num = 0;
  int mi = 0;
  for (int i = 0; i < h.size(); i++) {
    if (h[i] == 0 && s == -1) continue;
    if (h[i] == 0 && s != -1) {
      e = i-1;
      break;
    }
    if (s == -1 && h[i] != 0) {
      s = i;
      mi = h[i];
    }
    chmin(mi, h[i]);
  }

  if (s != -1) {
    if (e == -1) e = h.size() -1;
    for (int j = s; j <= e; j++) {
      h[j] -= mi;
    }
    num += mi;
  }
  if (num != 0) num += solve(h);
  return num;
}

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

  int n; cin >> n;
  vector<int> h(n);
  rep(i, n) cin >> h[i];

  int ans = 0;
  ans = solve(h);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
	
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int i = sc.nextInt();
		int rc = i * (i - 1) / 2;
		int ten[] = new int[i];
		for(int j = 0; j < i; j++){
			ten[j] = 0;
		}
		for(int j = 0; j < rc; j++){
			int team1 = sc.nextInt();
			int team2 = sc.nextInt();
			int score1 = sc.nextInt();
			int score2 = sc.nextInt();
			if(score1 > score2){
				ten[team1-1] = ten[team1-1] + 3;
			}else if(score1 < score2){
				ten[team2-1] = ten[team2-1] + 3;
			}else if(score1 == score2){
				ten[team1-1] = ten[team1-1] + 1;
				ten[team2-1] = ten[team2-1] + 1;
			}
		}
		for(int j = 0; j < i; j++){
			int cnt = 0;
			for(int k = 0; k < i; k++){
				if(ten[j] >= ten[k]){
					cnt = cnt + 1;
				}
			}
			int rank = i - cnt + 1;
			System.out.println(rank);
		}
	}
}

Measured memory_bytes: 42056