akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;

template<int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod-p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = (int)(1LL*x*p.x%mod); return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) { t = a/b; a -= t*b; swap(a, b); u -= t*v; swap(u, v); }
        return ModInt(u);
    }
    ModInt pow(int e) const {
        long long a = 1, p = x;
        while(e > 0) {
            if(e%2 == 0) {p = (p*p) % mod; e /= 2;}
            else {a = (a*p) % mod; e--;}
        }
        return ModInt(a);
    }
    friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

template<int mod> ModInt<mod> LCMmod(const vector<int> &A) {
    const int N = (int)A.size(); assert(0 < N);
    const int MAX = (int)*max_element(A.begin(), A.end());
    vector<int> prime(MAX+2, 0); 
    prime[0] = prime[1] = false;
    for (int i = 2; i <= MAX; i++) if (!prime[i]) {
        for (int j = i+i; j <= MAX; j += i) if (!prime[j]) {
            prime[j] = i;
        }
        prime[i] = i;
    }
    unordered_map<int, int> mx;
    for (auto num : A) {
        unordered_map<int, int> temp;
        while (num > 1) {
            int factor = prime[num];
            temp[factor]++;
            num /= factor;
        }
        for (auto it : temp) {
            mx[it.first] = max(mx[it.first], it.second);
        }
    }
    ModInt<mod> ret = 1;
    for (auto it : mx) {
        ModInt<mod> res = it.first;
        ret *= res.pow(it.second);
    }
    return ret;
}

int main() {
    using mint = ModInt<MOD>;
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    mint lcm = LCMmod<MOD>(A), ans = 0;
    for (auto e : A) ans += lcm/e;
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    ll ans = 0;
    rep (i, N) {
        ll a;
        cin >> a;
        if (ans+1 == a) {
            ans++;
        }
    }

    if (ans == 0) {
        cout << -1 << endl;
    } else {
        cout << N-ans << endl;
    }
    return 0;
}

Measured memory_bytes: 384
import java.awt.geom.Point2D;
import java.util.*;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}

	public Main(){
		new AOJ2000().doIt();
	}
	
	class AOJ2000{
		int n;
		Point2D target[];
		int[][] map;
		void print(){
			for(int i=0;i<21;i++){
				for(int s=0;s<21;s++)System.out.print(map[i][s]+" ");
				System.out.println();
			}
		}
		
		boolean solve(){
			map = new int[21][21];
			for(int i=0;i<21;i++)Arrays.fill(map[i],-1);
			int x = 10;int y = 10;
			int a = in.nextInt();
			int[] sx = {0,1,0,-1};int[] sy = {-1,0,1,0};
			HashMap<Character, Integer> hash = new HashMap<Character, Integer>();
			hash.put('N',2);hash.put('E', 1);hash.put('S', 0);hash.put('W', 3);
			map[y][x] = 0;
			for(int i=0;i<a;i++){
				char h = in.next().toCharArray()[0];
				int d = in.nextInt();
				int nx = x,ny = y;
				for(int s=0;s<d;s++){
					nx+=sx[hash.get(h)];
					ny+=sy[hash.get(h)];
					map[ny][nx] = i;
				}
				x = nx;y = ny;
			}
//			print();
			for(int i=0;i<target.length;i++){
				if(map[(int)target[i].getY()][(int)target[i].getX()]<0)return false;
			}
			return true;
		}
		
		void doIt(){
			while(in.hasNext()){
				n = in.nextInt();
				if(n==0)break;
				target = new Point2D[n];
				for(int i=0;i<n;i++)target[i] = new Point2D.Double(in.nextDouble(), in.nextDouble());
				boolean sw = solve();
				System.out.println(sw? "Yes":"No");
			}
		}
	}
	
}

Measured memory_bytes: 43544
#include <bits/stdc++.h>
#include<iostream>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int h[N];
int main(){
   ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)cin>>h[i];
    sort(h,h+n);
    int mini=1e9+5;
    for(int i=0;i<n-m+1;i++){
        mini=min(mini,h[i+m-1]-h[i]);
    }
    cout<<mini;
    return 0;
}


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

int main()
{
  vector<int> a(5);
  int k;
  for (int i = 0; i < 5; ++i) {
    cin >> a[i];
  }
  cin >> k;
  
  int c_min = 1000000000;
  int c_max = 0;
  
  for (auto& c : a) {
    c_min = min(c_min, c);
    c_max = max(c_max, c);
  }
  
  if (c_max - c_min > k) {
    cout << ":(" << endl;
  }
  else {
    cout << "Yay!" << endl;
  }
}

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

typedef long long LL;
typedef double DB;

#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define R(i,n) for(int i=0;i<(n);++i)
#define fill(a,b) memset(a,b,sizeof a)

const int maxn = 1e5 + 10;
int n;
int a[maxn];

int main()
{
//	freopen("test.txt","r",stdin);
	scanf("%d",&n);
	R(i,n) scanf("%d",a+i);
	sort(a,a+n,greater<int>());
	int c = 0;
	while(c+1 < n && c+1 < a[c+1]) ++c;
	int t = a[c] - c,p = 1;
	F(i,c+1,n-1)
		if(a[i] == c+1) ++p;
		else break;
//	printf("%d %d\n",t,p);
	if((t&1) && (p&1))
		puts("Second");
	else
		puts("First");
	return 0;
}


Measured memory_bytes: 640
#AtCorder Begginer Contest 049 C Daydream

s = input()
s = s[::-1]

dream = "dream"[::-1]
dreamer = "dreamer"[::-1]
erase = "erase"[::-1]
eraser = "eraser"[::-1]

for i in range(len(s)):
    if s.startswith(dreamer):
        s = s.replace(dreamer,"",1)
    elif s.startswith(dream):
        s = s.replace(dream,"",1)

    if s.startswith(eraser):
        s = s.replace(eraser,"",1)
    elif s.startswith(erase):
        s = s.replace(erase,"",1)

if len(s) == 0:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3188
// Problem : B - Judge Status Summary
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

void solve(){
    int n;
    map<string,int> m;
    cin>>n;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        m[s]++;
    }
    cout<<"AC x "<<m["AC"]<<endl;
    cout<<"WA x "<<m["WA"]<<endl;
    cout<<"TLE x "<<m["TLE"]<<endl;
    cout<<"RE x "<<m["RE"]<<endl;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    Q = ii()
    cnt = collections.Counter(A)
    sm = sum(A)

    for q in range(Q):
        B, C = il()
        sm += (C - B) * cnt[B]
        print(sm)
        cnt[C] += cnt[B]
        cnt[B] = 0


if __name__ == '__main__':
    main()


Measured memory_bytes: 25380
import java.util.Comparator;
import java.util.stream.IntStream;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        int[] u1 = new int[n / 2], u2 = new int[n / 2], count1 = new int[100001], count2 = new int[100001];
        for (int i = 0; i < n / 2; i++) {
            count1[u1[i] = scanner.nextInt()]++;
            count2[u2[i] = scanner.nextInt()]++;
        }

        int max1 = IntStream.range(0, 100001)
                .boxed()
                .max(Comparator.comparingInt(i -> count1[i]))
                .orElse(0);
        int max2 = IntStream.range(0, 100001)
                .boxed()
                .max(Comparator.comparingInt(i -> count2[i]))
                .orElse(0);
        if (max1 == max2) {
            int next1 = IntStream.range(0, 100001)
                    .filter(i -> i != max1)
                    .boxed()
                    .max(Comparator.comparingInt(i -> count1[i]))
                    .orElse(0);
            int next2 = IntStream.range(0, 100001)
                    .filter(i -> i != max2)
                    .boxed()
                    .max(Comparator.comparingInt(i -> count2[i]))
                    .orElse(0);
            System.out.println(n - Math.max(count1[next1] + count2[max2], count1[max1] + count2[next2]));
        } else {
            System.out.println(n - count1[max1] - count2[max2]);
        }
    }
}

Measured memory_bytes: 62568
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <string>
#include <set>
using namespace std;
#define maxn 100000+5
typedef long long int ll;
const double INF = 1e20;
const double pi = acos (-1.0);
int main () {
    int n,k;
    while(scanf("%d%d",&n,&k)!=EOF){
        int coun=0;
        for(int i=1;i<=n;i+=2){
            coun++;
        }
        if(coun>=k)printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}());
const ll mod=1000000007;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=10;
int h,w,k,sum;
char s[N][N];
bool vis[N][N];

int rec(VI a,VI b) {
	if (SZ(a)==h&&SZ(b)==w) {
		memset(vis,0,sizeof(vis));
		int tmp=0;
		rep(i,0,h) {
			if (a[i]==1) {
				rep(j,0,w) {
					if (!vis[i][j]&&s[i][j]=='#') {
						vis[i][j]=true;
						tmp++;
					}
				}
			}
		}
		rep(i,0,w) {
			if (b[i]==1) {
				rep(j,0,h) {
					if (!vis[j][i]&&s[j][i]=='#') {
						vis[j][i]=true;
						tmp++;
					}
				}
			}
		}
		if (sum-tmp==k) return 1;
		return 0;
	}
	if (SZ(a)==h) {
		VI mir_b=b;
		mir_b.pb(1);
		b.pb(0);
		return rec(a,b)+rec(a,mir_b);
	}
	VI mir_a=a;
	mir_a.pb(1);
	a.pb(0);
	return rec(a,b)+rec(mir_a,b);
}

int main() {
	scanf("%d%d%d",&h,&w,&k);
	rep(i,0,h) {
		scanf("%s",s[i]);
		rep(j,0,w) if (s[i][j]=='#') sum++;
	}
	VI a,b;
	printf("%d\n",rec(a,b));
}

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

long f(long i, long j) {
  if (i == -1) return 0;
  else return i / j + 1;
}

int main() {
  long  a, b, x;
  cin >> a >> b >> x;
  cout << f(b, x) - f(a - 1, x) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int gdc(int a,int b){
    if(a%b==0)return b;
    return gdc(b,a%b);
}
void yaku(int a,int b){
    int g=gdc(max(a,b),min(a,b));
    cout<<a/g<<'/'<<b/g<<endl;
}
int main(void){
    char s[9];
    cin>>s;
    int k=10,x=0,l=strlen(s),i;
    for(i=0;s[i]!='.';i++){
        x*=10;
        x+=int(s[i]-'0');
    }
    int m=1;
    for(i++;s[i]!='(';i++,k*=10,m*=10){
        x*=10;
        x+=int(s[i]-'0');
        if(i==l-1){
            yaku(x,k);
            return 0;
        }
    }
    int y=x;
    for(i++;s[i]!=')';i++,k*=10){
        x*=10;
        x+=int(s[i]-'0');
        
    }
    k/=10;
    yaku(x-y,k-m);
}

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

int main() {
  int A, B;
  cin >> A >> B;
  if(A >= 13) {
    cout << B << endl;
  }
  else if(A >= 6) {
    cout << B / 2 << endl;
  }
  else {
    cout << 0 << endl;
  }
}

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

using namespace std;

#define N 305
#define pb push_back
#define sz size()
#define ff first
#define ss second

int dp[N][N], D[N][N];
int n, m, q, L;

int main(){

    int x, y, w;

    scanf("%d %d %d",&n, &m, &L);

    for(int i = 0;i < n; i++){
        for(int j = i + 1; j < n; j++)dp[i][j] = dp[j][i] = 1e9 + 10;
    }

    for(int i = 0; i < m; i++){
        scanf("%d %d %d",&x, &y, &w);
        x--, y--;
        dp[x][y] = dp[y][x] = w;
    }

    for(int k = 0; k < n; k++){
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++)dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
        }
    }

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

            if(i == j)continue;

            if(dp[i][j] > L)D[i][j] = 1e9 + 10;
            else D[i][j] = 1;
        }
    }

    for(int k = 0; k < n; k++){
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++)D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
        }
    }
    
    cin >> q;
    
    while(q--){
        scanf("%d %d",&x, &y);
        x--, y--;
        printf("%d\n", D[x][y] > n ? -1 : D[x][y] - 1);
    }

    return 0;
}

Measured memory_bytes: 1280
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect
mod = 10**9+7

if __name__ == "__main__":
    n = int(input())
    A = sorted(list(map(int,input().split())))
    B = sorted(list(map(int,input().split())))
    C = sorted(list(map(int,input().split())))
    ans = 0
    for b in B:
        a = bisect.bisect_left(A,b)
        c = n - bisect.bisect_left(C,b+1)
        ans += a*c
    print(ans)

Measured memory_bytes: 104348
#include <bits/stdc++.h>
    #define N 200005
    #define ll long long
    #define For(i,x,y) for(int i=(x);i<=(y);++i)
    #define Rof(i,x,y) for(int i=(x);i>=(y);--i)
    #define Edge(x) for(int i=head[x];i;i=e[i].nxt)
    #define mset(x,y) memset(x,y,sizeof(x))
    #define strL strlen
    #define p_b push_back
    #define mcpy(x,y) memcpy(x,y,sizeof(x))
    #define lson l,mid,(o<<1)
    #define rson mid+1,r,((o<<1)|1)
    #define Ls (t[o].ls)
    #define Rs (t[o].rs)
    #define mod 924844033
    #define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
    using namespace std;
    const int G=5;
    int num[N],sz[N],len,_len,cnt,head[N],n,bit,rev[N*5];
    ll fac[N],ans[N],_fac[N],g[N*5],_g[N*5],A[N*5],B[N*5];
    struct ed{ int v,nxt; }e[N<<1];
    void add(int u,int v){
    	e[++cnt]=(ed){v,head[u]},head[u]=cnt;
    	e[++cnt]=(ed){u,head[v]},head[v]=cnt;
    }
    ll qpow(ll x,int y){
    	ll tmp=1;
    	for(;y;y>>=1,(x*=x)%=mod) if(y&1) tmp=1ll*tmp*x%mod;
    	return tmp;
    }
    ll C(int x,int y){
    	if(x<y) return 0;
    	return 1ll*fac[x]*_fac[y]%mod*_fac[x-y]%mod;
    }
    ll mnS(ll x,ll y){ return x-y<0?x-y+mod:x-y; } 
    void init(){
    	fac[0]=_fac[0]=fac[1]=_fac[1]=1;
    	For(i,2,n){
    		fac[i]=1ll*fac[i-1]*i%mod;
    		_fac[i]=(1ll*mod-mod/i)*_fac[mod%i]%mod;
    	}
    	For(i,2,n) (_fac[i]*=_fac[i-1])%=mod;
    	for(bit=0,len=1;len<=2*n+1;len<<=1,bit++);
    	For(i,0,len-1) rev[i]=(rev[i>>1]>>1)|((i&1)<<bit-1);
    	g[len]=qpow(1ll*G,(mod-1)/len),_g[len]=qpow(g[len],mod-2);
    	for(int i=(len>>1);i>=2;i>>=1){
    		g[i]=g[i<<1]*g[i<<1]%mod;
    		_g[i]=_g[i<<1]*_g[i<<1]%mod;
    	}
    	_len=(int)qpow(len,mod-2);
    }
    void dfs(int x,int f){
    	sz[x]=1;
    	Edge(x){
    		int to=e[i].v;
    		if(to!=f){
    			dfs(to,x);
    			sz[x]+=sz[to];
    		}
    	}
    	if(x!=1){
    		num[sz[x]]++;
    		num[n-sz[x]]++;		
    	}
    }
    void NTT(ll *a,int f){
    	For(i,0,len-1) if(rev[i]>i) swap(a[rev[i]],a[i]);
    	for(int i=2;i<=len;i<<=1){
    		ll omega;f==1?omega=g[i]:omega=_g[i];
    		int mid=i>>1;
    		for(int j=0;j<len;j+=i){
    			ll w=1;
    			for(int k=j;k<j+mid;++k,(w*=omega)%=mod){
    				ll u=a[k],v=a[k+mid]*w%mod;
    				a[k]=(u+v)%mod;
    				a[k+mid]=(u-v+mod)%mod;
    			}
    		}
    	}
    	if(f==-1) For(i,0,len-1) (a[i]*=1ll*_len)%=mod; 
    }
    int main(){
    	int u,v;
    	scanf("%d",&n);
    	init();
    	For(i,1,n-1) scanf("%d%d",&u,&v),add(u,v);
    	dfs(1,0);
    	For(i,0,n) A[i]=fac[i]*num[i]%mod;
    	For(i,0,n) B[n-i]=_fac[i];
    	NTT(A,1),NTT(B,1);
    	For(i,0,len-1) A[i]=A[i]*B[i]%mod;
    	NTT(A,-1);
    	For(i,1,n)
    		ans[i]=mnS(1ll*n*C(n,i)%mod,_fac[i]*A[n+i]%mod);
    	For(i,1,n-1) printf("%lld\n",ans[i]);
    	printf("%lld",ans[n]);
    }

Measured memory_bytes: 49280
import java.util.*;
import java.text.DecimalFormat;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		Random rn = new Random();
		DecimalFormat df = new DecimalFormat("#,###.##");

		int r = sc.nextInt(), num;

		num = (int)((Math.pow(r,2))/(1));

		System.out.println(num);
	}
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  int sumA=0,sumB=0;
  for (int i=0;i<N;i+=2){
    sumA+=vec.at(i);
  }
  for (int j=1;j<N;j+=2){
    sumB+=vec.at(j);
  }
  cout << sumA-sumB << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;

int main(){
    long long n;
    cin >> n;

    long long cT,cA;
    cin >> cT >> cA;

    for(long long i=1;i<n;i++){
        long long t,a;
        cin >> t >> a;

        long long loop;

        if(cT/t > cA/a)
            loop = cT/t;
        else
            loop = cA/a;
        while(1){
            long long tmpT=loop*t,tmpA=loop*a;
            if(cT<=tmpT && cA <=tmpA){
                cT=tmpT;
                cA=tmpA;
                break;
            }
            loop++;
        }


    }
    cout << cT+cA<<endl;
}


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

int main() {
  int X,Y;
  cin >> X >> Y;
  int ans=0;
  ans += (X<4 ? (4-X)*100000 : 0);
  ans += (Y<4 ? (4-Y)*100000 : 0);
  ans += (ans == 600000 ? 400000 : 0);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<stdio.h> 
#include<bitset> 
#include<iomanip>
#include <cmath>
#define ll long long
using namespace std;
ll gcd(ll a, ll b) {
	while (b) {
		ll mod = a % b; a = b; b = mod;
	}
	return a;
}

bool cmp(pair<int, ll> A, pair<int, ll> B) {
	return A.second < B.second;
}
int main() {
	ll a, b;
	cin >> a >> b;
	ll com = gcd(a, b);
	//cout << com << '\n';
	ll qty = 1;
	if (com == 1) {
		cout << com;
		return 0;
	}
	for (ll i = 2; i <= sqrt(com); i++) {
		if (com % i == 0) {
			//cout << "true" << endl;
			while (com%i == 0) {
				com /= i;
			}
			//cout << com<<'\n';
			qty++;
		}
	}
	if (com != 1) {
		qty++;
	}
	cout << qty;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
from collections import Counter
n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
cd=Counter(d)
ct=Counter(t)
#print(cd,ct)
for k,v in ct.items():
    if cd[k]<v:
        print("NO")
        exit()
print("YES")

Measured memory_bytes: 57056
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
ll a[maxn];
int main()
{
    int n;
    while (scanf("%d",&n)!=EOF) {
        for(int i=1;i<=n;i++)scanf("%lld",a+i),a[i]-=i;
        sort(a+1,a+n+1);
        ll tmp=a[(n+1)/2];
        ll sum=0;
        for(int i=1;i<=n;i++)sum+=abs(a[i]-tmp);
        printf("%lld\n",sum);
    }
    return 0;
}

Measured memory_bytes: 1792
<?php
list($t_Hp, $t_At, $a_Hp, $a_At) = explode(' ', fgets(STDIN));
while (1) {
    $a_Hp -= $t_At;
    if ($a_Hp <= 0) {
        echo 'Yes';
        break;
    }
    $t_Hp -= $a_At;
    if ($t_Hp <= 0) {
        echo 'No';
        break;
    }
}

Measured memory_bytes: 16148
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M=1e5+5;
int p[M];
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>p[i];
	k--;
	for(int i=1;i<=n;i++)
	{
		if(p[i]!=1)
			continue;		
		int ans = 1e9;
		for(int j=k;j>=0;j--)
		{
			int lt = max(0,(i-1)-j);
			int rt = max(0,(n-i)-(k-j));
			ans = min(ans,1+(lt+k-1)/(k)+(rt+k-1)/k);
		}
		cout<<ans<<"\n";
		break;
	}
	return 0;
}

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


int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(b/a >= c) cout << c <<endl;
    else cout << b/a <<endl;   
}

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

int main(){
    int a,b;
    cin >> a >> b;
    for(int x=1;x<(10*10*10*10/8)+1;x++){
        if(8*x/100==a){
            if(x/10==b){
                cout << x << endl;
                return 0;
            }
        }
        if((8*x/100)>a){
            cout << -1 << endl;
            return 0;
        }
    }
}

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

int main()
{
    while(1)
    {
        int n;
        scanf("%d",&n);if(!n)return 0;
        int ds=0;
        for(int i=1;i*i<=n;++i){
            if(!(n%i))ds+=i+(n/i);
            if(i*i==n)ds-=i;
        }
        ds-=n;
        if(ds==n)puts("perfect number");
        else if(ds<n)puts("deficient number");
        else puts("abundant number");
    }
    return 0;
}

Measured memory_bytes: 1012
#include <iostream>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
// long long -> lint
using lint = long long;
// fast cin and cout from hitonanode-san's code
// w/o 71 ms -> w/ 18 ms (tested on ABC148-D with C++14(GCC 5.4.1))
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

int main(){
    // input
    int N;
    string S;
    cin >> N >> S;

    // calc
    int ans = 0;
    for( int i=2 ; i<N; i++ ){
        if( S.substr( i-2, 3 ) == "ABC" ) ans++;
    }

    // out
    cout << ans << endl;
} 

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<queue>
using namespace std;
const int N=100001;
int n;
map<pair<int,int>,int> book;
set<int> e[N];
queue<pair<int,int> >q;
int f[N];
int find(int v)
{
	if(v==f[v]) return v;
	f[v]=find(f[v]);
	return f[v];
}
pair<int,int> make(int x,int y)
{
    if(x>y) swap(x,y);
    return make_pair(x,y);
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    	f[i]=i;
    for(int i=1;i<=(n-1)*2;i++)
	{
        int x,y;
        scanf("%d%d",&x,&y);
        e[x].insert(y);
		e[y].insert(x);
        pair<int,int> t=make(x,y);
        book[t]++;
        if(book[t]==2) q.push(t);
        if(book[t]>2)
        {
        	printf("NO");
        	return 0;
		}
    }
    for(int i=1;i<n;i++)
	{
        if(q.empty())
        {
        	printf("NO");
        	return 0;
		}
        int x=0,y=0;
        while(x==y)
        {
        	x=find(q.front().first),y=find(q.front().second);
        	q.pop();
		}
        if(e[x].size()>e[y].size()) swap(x,y);
        f[x]=y;
        for(set<int>::iterator it=e[x].begin();it!=e[x].end();it++)
		{
            int v=find(*it);
            e[v].erase(e[v].find(x));
            if(v==y) continue;
            e[v].insert(y),e[y].insert(v);
            pair<int,int> t=make(v,y);
            book[t]++;
            if(book[t]==2) q.push(t);
        }
        e[x].clear();
    }
    printf("YES");
    return 0;
}

Measured memory_bytes: 40704
#include <bits/stdc++.h>
using namespace std;
 
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define FILL(a, value) memset(a, value, sizeof(a))
 
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(), a.end()
 
typedef long long LL;
typedef pair<int, int> PII;

const int mod = 998244353;
const int MAX = 304;

int add(int a, int b)
{
	return a + b < mod ? a + b : a + b - mod;
}

int sub(int a, int b)
{
	return a - b >= 0 ? a - b : a - b + mod;
}

int mult(int a, int b)
{
	return (LL)a * b % mod;
}

void updAdd(int& x, int val)
{
	x += val;
	if(x >= mod)
		x -= mod;
}

int dp[MAX][3][MAX][MAX];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	string s;
	int K;
	cin >> s >> K;
	K = min(K, SZ(s));
	dp[0][0][0][0] = dp[0][2][0][0] = 1;
	FOR(i, 0, SZ(s))
		FOR(was, 0, 3)
			FOR(j, 0, K + 1)
				RFOR(k, K + 1, 0)
				{
					int curDP = dp[i][was][j][k];
					if(s[i] == '0')
					{
						if(was == 0)
							updAdd(dp[i][0][j + 1][k + 1], curDP);
						if(was != 2)
						{
							updAdd(dp[i + 1][0][j][k], curDP);
							updAdd(dp[i + 1][2][j][k], curDP);
						}
					}
					else
					{
						if(was == 2)
						{
							if(k)
							{
								updAdd(dp[i + 1][1][j][k - 1], curDP);
								updAdd(dp[i + 1][2][j][k - 1], curDP);
							}
						}
						else
						{
							updAdd(dp[i + 1][was][j][k], curDP);
						}
					}
				}
	int ans = 0;
	FOR(was, 0, 2)
		FOR(j, 0, K + 1)
			updAdd(ans, dp[SZ(s)][was][j][0]);
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 325748
import re
import sys
input = sys.stdin.readline

s = input()
s = s.replace('BC', 'D')
s = re.split('[BC]', s)
res = 0

for kk in s:
  if not kk:
    continue
  d = 0
  for a in kk[::-1]:
    if a == 'D':
      d += 1
    else:
      res += d
    
print(res)

Measured memory_bytes: 5608
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  int n;
  cin >> n;
  vector<int>v(n),c;
  rep(i,n)cin >> v[i];
  c = v;
  sort(all(c));
  map<int,int>cnt;
  rep(i,n){
    if(cnt[c[i]])continue;
    cnt[c[i]] = i + 1;
  }
  int m = n / 2;
  int l = c[m - 1],r = c[m];
  rep(i,n){
    if(cnt[v[i]] > m)cout << l << endl;
    else cout << r << endl;
  }
  return 0;
}

Measured memory_bytes: 12928
#include<stdio.h>
#include <stdlib.h>
typedef long long ll;

int compare_int(const void *a, const void *b)
{
  return *(ll*)a - *(ll*)b;
}

int main(void)
{
  int n;
  scanf("%d",&n);
  ll a[100010];
  for(int i=0;i<n;i++){
    scanf("%lld",&a[i]);
  }
  qsort(a,n, sizeof(ll), compare_int);

  // for(int i=0;i<n;i++){
  //   printf("%lld ",a[i]);
  // }
  //
  // puts("");

  ll start=a[0];
  int sum=0;

  for(int i=0;i<n;){
    int count=0;
    while(a[i]==start){
      count++;
      i++;
    }
    if(start>count){
      sum+=count;
    }else{
      sum+=(count-start);
    }
    start=a[i];
  }
  printf("%d\n",sum);
  return 0;
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int n,m;
  cin>>n>>m;
  cout<<(n-1)*(m-1)<<endl;
  return 0;
}


Measured memory_bytes: 256
from sys import setrecursionlimit
setrecursionlimit(10 ** 5)

def find(parent, i):
    t = parent[i]
    if t < 0:
        return i
    t = find(parent, t)
    parent[i] = t
    return t


def unite(parent, i, j):
    i = find(parent, i)
    j = find(parent, j)
    if i == j:
        return
    parent[j] += parent[i]
    parent[i] = j

n, m, k = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(k)]

parent = [-1] * n
friends = [[] for _ in range(n)]

for a, b in ab:
    unite(parent, a-1, b-1)
    friends[a-1].append(b-1)
    friends[b-1].append(a-1)
    
blocks = [[] for _ in range(n)]
for c, d in cd:
    blocks[c-1].append(d-1)
    blocks[d-1].append(c-1)

result = []

for i in range(n):
    p = find(parent, i)
    t = -parent[p] - 1
    t -= len(friends[i])
    for b in blocks[i]:
        if p == find(parent, b):
            t -= 1
    result.append(t)
    
print(*result)

Measured memory_bytes: 101280
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		int N = nextInt();
		ArrayList<Integer> list = nextIntArray();
		int output = 0;
		for(int i = 1; i <= N; i++){
			try{
			int tmp = list.get(i - 1);
			int tmp2 = list.get(tmp - 1);
			if(tmp2 == i){
				output++;
				list.set(i - 1, -1);
				list.set(tmp - 1, -1);
			}
			}catch(Exception e){}
		}
		myout(output);
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 80568
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int>v[100000];
int st[100000],et[100000],tim=1;
int f[100001];
void update(int p,int v){
	while(p<=n){
		f[p]+=v;
		p+=p&-p;
	}
}
int query(int x){
	int sum=0;
	while(x>0){
		sum+=f[x];
		x-=x&-x;
	}
	return sum;
}
void dfs(int u){
	st[u]=tim++;
	for(auto i:v[u]){
		if(!st[i]){
			dfs(i);
		}
	}
	et[u]=tim;
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int k;
		cin>>k;
		while(k--){
			int l;
			cin>>l;
			v[i].emplace_back(l);
		}
	}
	dfs(0);
	int q;
	cin>>q;
	while(q--){
		bool op;
		cin>>op;
		if(op){
			int k;
			cin>>k;
			cout<<query(st[k])<<"\n";
		}
		else{
			int u,x;
			cin>>u>>x;
			update(st[u],x);
			update(et[u],-x);
		}
	}
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<int> vec;

void solve(){
	int n, k; cin >> n >> k;
	int x = 1;
	rep(i, n) {
		x = min(x + k, 2 * x);
	}
	cout << x << endl;
}

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


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

// * Shortcut

#define sort(s) sort(s.begin(), s.end());
#define ll long long
#define real long double

// * Constant
const ll mod = 1E9 + 7;
const ll fftmod = 998244353;
const ll inf = LONG_LONG_MAX;
const ll n_inf = LONG_LONG_MIN;

using namespace std;

bool prime(ll x)
{
	if (x < 2)
	{
		return false;
	}
	else if (x > 2)
	{
		if (x % 2 == 0)
			return false;
		else
		{
			for (ll i = 3; i <= sqrt(x); i += 2)
			{
				if (x % i == 0)
					return false;
			}
		}
	}
	return true;
}

bool vowel(char ch)
{
	ch = tolower(ch);
	return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'y');
}

ll fact(ll n)
{
	if (n == 0 || n == 1)
		return 1;
	else
		return n * fact(n - 1);
}

ll C(ll n, ll r)
{
	if (r == 0)
		return 1;
	if (n < r)
		return 0;

	/*
     Extra computation saving for large R,
     using property:
     N choose R = N choose (N-R)
    */
	if (r > n / 2)
		return C(n, n - r);

	double res = 1;

	for (int k = 1; k <= r; ++k)
	{
		res *= n - k + 1;
		res /= k;
	}

	return (ll)(res);
}

//  Variable

// ? Problem Local Function

ll fib(int n)
{
	long long p1 = 1, p2 = 1, ans;
	if (n <= 2)
		return 1;
	else
	{
		for (int i = 3; i <= n; i++)
		{
			ans = p1 + p2;
			p1 = p2;
			p2 = ans;
		}
	}
	return ans;
}

long long n, q;

void initdsu(vector<long long> &f, long long n)
{
	for (long long i = 0; i <= n; i++)
	{
		f[i] = i;
	}
}

long long Find(vector<long long> &f, long long n)
{
	if (f[n] == n) // ! not a root
	{
		return n;
	}
	else // ! using recursion to find root
	{
		return f[n] = Find(f, f[n]);
	}
	// return (f[n]==n) ? n : Find(f[n]);
}

void Union(vector<long long> &f, long long x, long long y)
{
	long long xset = Find(f, x);
	long long yset = Find(f, y);
	if (xset != yset)
	{
		f[max(xset, yset)] = min(xset, yset);
	}
}

int main()
{

	freopen("submit.err", "w+", stderr);

	// * DSU Code

	cin >> n >> q;
	vector<long long> check(n + 1), f(n + 1);
	initdsu(f, n);
	for (long long i = 0; i < q; i++)
	{
		long long x, y, z;
		cin >> x >> y >> z;
		check[x] = true;
		check[y] = true;
		Union(f, x, y);
	}
	long long ans = 0;
	map<long long, long long> d;
	for (long long i = 1; i <= n; i++)
	{
		d[Find(f, i)] = 1;
	}
	for (auto &x : d)
		ans++;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 8064
N = int(input())
A = list(map(int, input().split()))

ans = 32
for i in range(len(A)):
    tmp_ans = 0
    while A[i] % 2 == 0:
        A[i] /= 2
        tmp_ans += 1
    ans = min(ans, tmp_ans)
    
print(ans)

Measured memory_bytes: 2940
package main

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

var sc = bufio.NewScanner(os.Stdin)

// Road is 通路構造体
type Road struct {
	to []int
}

// Heya is 部屋構造体
type Heya struct {
	depth int
	prev  int
}

func main() {
	list := getStdinIntArr()
	N := list[0]
	M := list[1]
	road := make([]Road, N) // 通路
	heya := make([]Heya, N) // 部屋

	// 通路初期化
	for i := 0; i < N; i++ {
		road[i].to = make([]int, 0)
	}
	// 通路
	for i := 0; i < M; i++ {
		list2 := getStdinIntArr()
		A := list2[0]
		B := list2[1]
		A = A - 1 // 0スタートに直す
		B = B - 1
		road[A].to = append(road[A].to, B)
		road[B].to = append(road[B].to, A)
	}
	// 部屋初期化
	for i := 0; i < N; i++ {
		if i == 0 {
			heya[i].depth = 0
			heya[i].prev = -1
		} else {
			heya[i].depth = math.MaxInt32
			heya[i].prev = -1
		}
	}
	// 0部屋から幅優先探索する
	parent := []int{0}
	for {
		parentTmp := parent[:]
		parent = parent[len(parent):]

		for _, val := range parentTmp {
			for _, to := range road[val].to {
				if heya[to].prev != -1 {
					continue
				}
				heya[to].depth = heya[val].depth + 1
				heya[to].prev = val
				parent = append(parent, to)
			}
		}

		if len(parent) == 0 {
			break
		}
	}
	// 答え出力
	fmt.Printf("Yes\n")
	for idx, val := range heya {
		if idx == 0 {
			continue
		}
		fmt.Printf("%d\n", val.prev+1) // 1スタートに戻す
	}

	fmt.Printf("\n")
}

func getStdin() string {
	sc.Scan()
	return sc.Text()
}
func getStdinInt() int {
	sc.Scan()
	rtn, _ := strconv.Atoi(sc.Text())
	return rtn
}
func getStdinIntArr() []int {
	sc.Scan()
	str := sc.Text()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}


Measured memory_bytes: 22256
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
int main() {
    int N;
    string s;
    vector<string> v;
    set<string> st;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> s;
        v.push_back(s);
        st.insert(s);
    }
    if (v.size() != st.size()) {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < N - 1; ++i) {
        if (v[i].back() != v[i + 1].front()) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
     
    using namespace std;
    const int mod=1000000007;
     
    int tab[107];
    long long dp[107][100007];
     
    int main()
    {
        int N,K;
        cin >> N >> K;
        for(int i=1; i<=N; i++)
            cin >> tab[i];
        dp[0][0]=1;
        for(int i=1; i<=N; i++)
        {
            long long x=0;
            for(int j=0; j<=K; j++)
            {
                x=(x+dp[i-1][j])%mod;
                dp[i][j]=x;
                if(j >= tab[i])
                    x=(x-dp[i-1][j-tab[i]]+mod)%mod;
            }
        }
        /*
        for(int i=0; i<=N; i++)
        {
            for(int j=0; j<=K; j++)
            {
                cout << dp[i][j] << " ";
            }
            cout << "\n";
        }
        */
        cout << dp[N][K];
    }

Measured memory_bytes: 79360
#include"bits/stdc++.h"
using namespace std;
using ll=int64_t;
using ull=uint64_t;
constexpr auto inf=static_cast<ll>(1e18);
inline void setp(int n,ostream&os=cout){os<<fixed<<setprecision(n);}
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T=ll>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    int a[3];for(ll i=0;i<3;++i)a[i]=in();
    sort(a,a+3);
    cout<<(a[0]==5&&a[1]==5&&a[2]==7?"YES":"NO")<<endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
namespace A___Rounding
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray();
            int X = line[0];
            int A = line[1];
            if (X < A)
            {
                Console.WriteLine(0);
            }
            if (X >= A)
            {
                Console.WriteLine(10);
            }
        }
    }
}


Measured memory_bytes: 13268
//                          VIVEK UPADHYAY
//                         MANIT, BHOPAL(M.P)
/**********************************************************************************************/
/**********************************************************************************************/
//                        $$ JAB-TAK TODEGA NHI,
//                           TAB -TAK CHODEGA NHI :D
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<"\n" ;
#define ok cout<<"ok\n" ;
#define dbg(x) cout<<#x<<" = "<<(x)<<"\n";
typedef long long ll;
const int MAXN = 1e6 + 10 ;
const int MAX = 1e7 + 1 ;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e18 ;
ll mod = 500500507;
ll powr(ll a , ll b){ if(b==0) return 1LL ; ll x = powr(a,b/2) ; x = (x*x)%mod ; if(b%2) return ((a%mod)*x)%mod ; return x ;}
ll gcd(ll a , ll b){if(a==0) return b ; return gcd(b%a,a);}

vector<int> prm ;
bool p[MAXN] ;
void seive() {
    
    for(int i = 0; i < MAXN;i++) p[i] = true ;
    p[0] = p[1] = false ;
    for(int i = 4 ; i < MAXN;i+=2) p[i] = false ;
    for(int  i = 3 ; i <= sqrt(MAXN);i+=2)
        if(p[i])
            for(int j = 2*i ; j < MAXN;j+=i)
                p[j] = false ;
    prm.pb(2) ;
    for(int i  =3 ; i< MAXN;i+=2)
        if(p[i]) prm.pb(i) ;
}
int main () {
    
    int N ;
    cin >> N ;
    ll a[N] ;
    for(int i =0 ; i < N ;i++)
        cin >> a[i] ;
    int turn  = 1 ;
    for(int i = 0;i<N;i++){
        if(a[i]%2) {
            cout<<"first\n" ;
            return 0;
        }
    }
    
    cout<<"second\n" ;
    return 0 ;
}
//


Measured memory_bytes: 1024
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

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

int main()
{
    int n, x;
    cin >> n;
    
    x = n / 1.08;
    for (int i = x - 20; i < x + 20; i++)
    {
        if (int(i * 1.08) == n)
        {
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    int h[n];
    for(int i = 0; i < n; i++)  cin >> h[i];
    int ans = 0;
    for(int i = 0; i < n; i++){
        bool judge = true;
        for(int j = 0; j < i; j++)  judge &= h[j] <= h[i];
        if(judge)   ans++;
    }
    cout << ans << endl;
    return 0;
}

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

string ch[] = {"ld", "rd", "lu", "ru"};

signed main()
{
  int N;
  string S;
  
  while(cin >> N, N) {
    
    bool flag = false;
    int cnt = 0, bit = 3;
    
    Rep(i, N) {
      
      cin >> S;
      Rep(j, 4) {
	
	if(S == ch[j]) {
	  bit |= 1 << j;
	  bit &= ~(1 << ((j + 2) % 4));
	}
      }
      if(flag && bit == 3) cnt++, flag = false;
      if(!flag && bit == 12) cnt++, flag = true;
    }
    
    cout << cnt << endl;

  }

  return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, m;

signed main() {
	cin >> n >> m;
	cout << n * m << endl;
}


Measured memory_bytes: 3100