akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static         Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static int K,N;
	static long mod =1000000007;
	public static void main(String[] args) {
		int N=sc.nextInt();
		int T=sc.nextInt();
		int A=sc.nextInt();
		int ans=0;
		
		double m=111111111;
		for(int i=0;i<N;i++) {
			int x=sc.nextInt();
			double c=T-x*0.006;
			if(m>Math.abs(A-c)) {
				m=Math.abs(A-c);
				ans=i;
			}
		}
		p(ans+1);
	}

	
	//static ArrayList<Integer> cc = new ArrayList<>(10001);
	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	public static int gcd(int a, int b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 23124
n = int(input())
x = []
for i in range(n):
  x.append([int(i) for i in input().split()])
x.sort(key=lambda a: a[1])
t = 0
for i in range(n):
  t += x[i][0]
  if t > x[i][1]:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 41168
using System;
using System.Collections.Generic;
class D_Megalomania{
	static void Main(string[] args){
		int N = int.Parse(Console.ReadLine());
		AB[] Time = new AB[N];
		for(int i = 0;i < N;i++){
			string[] ABi = Console.ReadLine().Split(' ');
			Time[i] = new AB(long.Parse(ABi[0]),long.Parse(ABi[1]));
		}
		Array.Sort(Time,CompareArray);
		long Current = 0;
		string Alive = "Yes";
		for(int i = 0;i < N ;i++){
			Current += Time[i].A;
			if(Time[i].B < Current){
				Alive = "No";
				break;
			}
		}
		Console.WriteLine(Alive);
	}
	static int CompareArray(AB x,AB y){
		if(x.B > y.B)return 1;
		else if(x.B < y.B)return -1;
		else return 0;
	}
}
class AB{
	public long A,B;
	public AB(long A,long B){
		this.A = A;
		this.B = B;
	}
}

Measured memory_bytes: 26536
S = input()
L = len(S)

if(S == 'keyence'):
    print('YES')
    exit()

for i in range(L):
    count = 0
    for j in range(i, L):
        if (i == 0 and count == 0):
            s = S[1:]
        elif(i == L - 1):
            s = S[:i]
        else:
            s = S[:i] + S[i + count + 1:]

        if (s == 'keyence'):
            print('YES')
            exit()
        else:
            count += 1

print('NO')


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

int main() {
  int n;
  cin >> n;
  vector<int> num(n);
  
  for(int i = n - 1; i > -1; i--) cin >> num.at(i);
  for(int i = 0; i < n; i++) {
    if(i != n - 1) cout << num.at(i) << " ";
    else cout << num.at(i) << endl;
  }
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
bool sortbysec(const pair<int,int> &a,
               const pair<int,int> &b)
{
    return (a.second < b.second);
}
int main()
{
    ll t=1,i,j,k=0,n,z,a,b,d,x,y,m;
    //cin>>t;
    while(t--)
    {
       cin>>x>>k>>d;
       if(x<0)
       {
           x=-x;
       }
       if(d<x)
       {

               m=x/d;
               a=m*d;

               if(k<m)
               {
                   cout<<x-(k*d)<<endl;
               }
              else if(m%2==0)
               {
                   if(k%2==0)
                   {
                       cout<<x-a<<endl;
                   }
                   else
                   {
                       cout<<d-(x-a)<<endl;
                   }
               }
               else
               {
                   if(k%2==0)
                   {
                       cout<<d-(x-a)<<endl;
                   }
                   else
                    cout<<x-a<<endl;
               }


       }
       else if(x==d)
       {
           if(k%2==0)
           {
               cout<<d<<endl;
           }
           else
            cout<<0<<endl;
       }
       else

       {
           if(k%2==0)
           {
               cout<<x<<endl;
           }
           else
            cout<<d-x<<endl;
       }

    }
    return 0;
}


Measured memory_bytes: 3620
#include<stdio.h>

struct DICE {
		int data;
		struct DICE *N;
		struct DICE *E;
		struct DICE *S;
		struct DICE *W;
		struct DICE *B;
		};

struct DICE *turn(struct DICE *NOW,char com);


int main(void){
struct DICE A[6],B[6],*NOW;
int i,up,front;

for(i=0;i<6;i++){
	scanf("%d",&A[i].data);
}
A[0].N=&A[4];
A[0].E=&A[2];
A[0].S=&A[1];
A[0].W=&A[3];
A[0].B=&A[5];

for(i=0;i<6;i++){
	scanf("%d",&B[i].data);
}
B[0].N=&B[4];
B[0].E=&B[2];
B[0].S=&B[1];
B[0].W=&B[3];
B[0].B=&B[5];

NOW=&B[0];
up=A[0].data;
front=A[0].S->data;

while(1){
for(i=0;i<4;i++){
if(NOW->S->data==front){break;}
    NOW=turn(NOW,'S');
}
if(i==4){NOW=turn(NOW,'E');}else{break;}
}
for(i=0;i<4;i++){
if(NOW->data==up){break;}
    NOW=turn(NOW,'E');
}

if(NOW->data==A[0].data && NOW->S->data==A[0].S->data && NOW->N->data==A[0].N->data && NOW->E->data==A[0].E->data && NOW->W->data==A[0].W->data && NOW->B->data==A[0].B->data){printf("Yes\n");}else{printf("No\n");}


return 0;
}

struct DICE *turn(struct DICE *NOW,char com){
	struct DICE *TEMP;
	TEMP=NOW;
	switch(com){
	case 'N':
		NOW=NOW->S;
		NOW->N=TEMP;
		NOW->S=TEMP->B;
		NOW->E=TEMP->E;
		NOW->W=TEMP->W;
		NOW->B=TEMP->N;
		break;
	case 'S':
		NOW=NOW->N;
		NOW->N=TEMP->B;
		NOW->S=TEMP;
		NOW->E=TEMP->E;
		NOW->W=TEMP->W;
		NOW->B=TEMP->S;
		break;
	case 'E':
		NOW=NOW->W;
		NOW->N=TEMP->N;
		NOW->S=TEMP->S;
		NOW->E=TEMP;
		NOW->W=TEMP->B;
		NOW->B=TEMP->E;
		break;
	case 'W':
		NOW=NOW->E;
		NOW->N=TEMP->N;
		NOW->S=TEMP->S;
		NOW->E=TEMP->B;
		NOW->W=TEMP;
		NOW->B=TEMP->W;
		break;
	}
	return(NOW);
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(x) push_back(x)

int main()
{

    ll a,b,n;
    cin>>a>>b>>n;
    if(max(a,b)<=n)
    {
        ll i=b-1;
        ll p=(ll)((a*i)/b)-(ll)(a*(ll)(i/b));
        cout<<p<<endl;
    }
    else
    {
        if(b>n)
        {
            ll i=n;
            ll p=(ll)((a*i)/b)-(ll)(a*(ll)(i/b));
            cout<<p<<endl;

        }
        else
        {
            ll i=b-1;
            ll p=(ll)((a*i)/b)-(ll)(a*(ll)(i/b));
            cout<<p<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3576
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
int main(){
	long long a,b,c;
	scanf("%lld%lld.%lld",&a,&b,&c);
	printf("%lld\n",(a*b*100+a*c)/100);
}

Measured memory_bytes: 1732
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int N;
LL x,A[2000];

LL dp[2000][2000] = {};
LL solve(int now, int t){
	if(now == -1) return solve(N-1,t);
	if(t == 0) return A[now];
	if(dp[now][t] != 0) return dp[now][t];
	return dp[now][t] = min(solve(now-1,t-1),A[now]);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

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

	LL ans = LL_MAX;
	for(int i=0; i<N; i++){
		LL tmp = x*i;
		for(int j=0; j<N; j++){
			tmp += solve(j,i);
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 31488
#include<stdio.h>
#include<math.h>
int main(){
    long long int r,c,i,j,k,co=0,s=0,b;
    scanf("%lld %lld",&r,&c);
    long long int a[r][c];
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            scanf("%lld",&a[i][j]);
        }
    }
    for(i=0;i<r;i++){
        for(j=i+1;j<r;j++){
                s=0;
            for(k=0;k<c;k++){
                s=s+pow((a[i][k]-a[j][k]),2);
            }
            b=sqrt(s);
            if(b*b==s)co++;
        }
    }
    printf("%lld",co);}

Measured memory_bytes: 2148
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;

int main(){
    int n;
   cin>>n;
    vector<double>v(n);
    rep(i,n)cin>>v[i];
    sort(v.begin(),v.end());
    double sum=(v[0]+v[1])/2;
    rep(i,n-2){
        sum+=v[i+2];
        sum/=2.0;
    }
cout<<sum;
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
//CODE
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<random>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,a[100010],b[100010];
    ll suma[100010],sumb[100010];
    cin>>n;
    rep(i,n){
        cin>>a[i];
        suma[i+1]=suma[i]+a[i];
    }
    rep(i,n){
        cin>>b[i];
    }
    repr(i,n){
        sumb[i]=sumb[i+1]+b[i];
    }
    ll ans=0;
    rep2(i,1,n+1){
        ans=max(ans,suma[i]+sumb[i-1]);
    }
    cout<<ans<<endl;
    return 0;
}

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

#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl

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

constexpr ll MOD = 1000000007LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;

vector<int> KMP(const string& S)
{
    vector<int> A(S.size() + 1);
    A[0] = -1;
    ll j = -1;
    for (ll i = 0; i < S.size(); i++) {
        while (j >= 0 && S[i] != S[j]) {
            j = A[j];
        }
        j++;
        A[i + 1] = j;
    }
    return A;
}

template <typename T, typename A>
ostream& operator<<(ostream& os, const vector<T, A>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename T>
T gcd(const T a, const T b) { return (b != 0) ? gcd(b, a % b) : a; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string w;
    cin >> w;
    if (w == string(w.size(), w.front())) {
        cout << w.size() << "\n1" << endl;
        return 0;
    }
    const int size = w.size();
    vector<int> A  = KMP(w);
    vector<int> per(size);
    for (int i = 0; i < size; i++) {
        per[i] = i + 1 - A[i + 1];
    }
    //    show(A);
    reverse(w.begin(), w.end());
    A = KMP(w);
    vector<int> revper(size);
    for (int i = 0; i < size; i++) {
        revper[i] = i + 1 - A[i + 1];
    }
    // show(per);
    // show(revper);
    if (per[size - 1] == size or size % per[size - 1] != 0) {
        cout << "1\n1" << endl;
    } else {
        int ans = 0;
        for (int i = 0; i < size; i++) {
            if ((per[i] == i + 1 or (i + 1) % per[i] != 0) and (revper[size - i - 2] == size - i - 1 or (size - i - 1) % revper[size - i - 2] != 0)) {
                ans++;
            }
        }
        cout << "2\n"
             << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 6708
#include <iostream>

using namespace std;

int main()
{
    int a, b, c, d; cin >> a >> b >> c >> d;

    if (a <= c) {
        if (b <= c) {
            cout << 0 << endl;
        } else {
            if (d <= b) {
                cout << d - c << endl;
            } else {
                cout << b - c << endl;
            }
        }
    } else {
        if (d <= a) {
            cout << 0 << endl;
        } else {
            if (b <= d) {
                cout << b - a << endl;
            } else {
                cout << d - a << endl;
            }
        }
    }


    return 0;
}

Measured memory_bytes: 256
li = []
b = []
cl = [[0]*3]*3
for i in range(3):
    l = list(map(int,input().split()))
    li.append(l)
N = int(input())
for i in range(N):
    b.append(int(input()))
ii = [0]*3
kk = [0]*3
for i in range(3):
    for k in range(3):
        if li[i][k] in b:
            ii[i] += 1
            kk[k] += 1
if (3 in ii) or (3 in kk):
    print("Yes")
elif ((li[0][0] in b) and(li[1][1] in b) and(li[2][2] in b)) or ((li[0][2] in b) and (li[1][1] in b) and (li[2][0] in b) ):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define puts(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int p[4] = {1000, 100, 10, 1};
string q[4] = {"m", "c", "x", "i"};

void solve(void){
	int N;
	cin >> N;
	map <char, int> mp;
	mp['m'] = 1000;
	mp['c'] = 100;
	mp['x'] = 10;
	mp['i'] = 1;

	while (N--) {
		string s1, s2;
		cin >> s1 >> s2;
		int n1 = 0, n2 = 0, tmp = 1;
		for (char c : s1) {
			if ('0' <= c && c <= '9') {
				tmp = c - '0';
				continue;
			}
			n1 += mp[c] * tmp;
			tmp = 1;
		}
		for (char c : s2) {
			if ('0' <= c && c <= '9') {
				tmp = c - '0';
				continue;
			}
			n2 += mp[c] * tmp;
			tmp = 1;
		}
		int n = n1 + n2;
		string ans = "";
		rep(4, i) {
			if (n / p[i]) ans += (n / p[i] == 1 ? "" : to_string(n / p[i])) + q[i];
			n %= p[i];
		}
		putln(ans);
	}
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (size_t NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (size_t NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
#define VEC(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)
#define VEC2(TYPE, A, B, NAME, INIT) vector<vector<TYPE>> NAME(A, vector<TYPE>(B, (INIT)))

vector<int> a;
vector<int> b;
int n;

bool dfs( int k )
{
	if( k == 0 ) return true;
	BREP( i, b.size() )
	{
		if( i + 1 < b[i] ) return false;
		if( i + 1 == b[i] )
		{
			b.erase( b.begin() + i );
			if( dfs( k - 1 ) )
			{
				a.push_back( i + 1 );
				return true;
			}
			return false;
		}
	}
	return false;
}

int main()
{
	cin >> n;
	b.assign( n, 0 );
	REP(i,n) cin >> b[i];
	if( dfs( n ) )
	{
		REP( i, a.size() ) cout << a[i] << endl;
	}
	else
	{
		cout << -1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#define IL inline
#define N 500007
#define K 20
#define REP(a,b,c) for(a=b;a<=c;a++)
using namespace std;
char s[N];
int f[N][27],fa[K][N];
IL int rd(){
	int res=0;char c;while((c=getchar())<'0'||c>'9');
	while(c>='0'&&c<='9')res=res*10+c-'0',c=getchar();return res;
}
int main(){
  scanf("%s",s+1);int n=strlen(s+1),q,i,j,c;
	for(i=n;i;i--){
		c=s[i]-'a';f[i][c]=i+1;
		for(j=c+1;j<=26;j++)f[i][j]=f[f[i][j-1]][j-1];
		for(j=c-1,c=fa[0][i]=f[i][26];j>=0;j--)f[i][j]=f[c][j];
	}
	for(j=1;j<K;j++)
		REP(i,1,n)fa[j][i]=fa[j-1][fa[j-1][i]];
	q=rd();
	while(q--){
		i=rd(),j=rd()+1;
		for(c=K-1;c>=0;c--)
			if(fa[c][i]&&fa[c][i]<=j)i=fa[c][i];
		puts(i==j?"Yes":"No");
	}
  return 0;
}

Measured memory_bytes: 92800
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b;
  cin>>a>>b;
  if(a<=0&&0<=b)cout<<"Zero"<<endl;
  else if(a<0){
    if((a-b+1)%2==0)cout<<"Positive"<<endl;
    else cout<<"Negative"<<endl;
  }
  else cout<<"Positive"<<endl;
  return(0);
}
  


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

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

string s;
int a[214514] = {};
int dp[214514] = {};
int dp2[1<<26] = {};

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> s;
	REP(i, s.size()){
		a[i+1] = a[i]^(1 << (s[i]-'a'));
	}
	fill(dp, dp+214514, INF);
	fill(dp2, dp2+(1 << 26), INF);
	dp[0] = 0;
	dp2[0] = 0;
	FOR(i, 1, s.size()+1){
		dp[i] = min(dp[i], dp2[a[i]]+1);
		REP(j, 26){
			dp[i] = min(dp[i], dp2[a[i]^(1 << j)]+1);
		}
		dp2[a[i]] = min(dp2[a[i]], dp[i]);
	}
	cout << dp[s.size()] << endl;
}


Measured memory_bytes: 264468
#include <iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;
int main() {
	long long int  a = 0, b = 0, x = 0;
	long long int  n = 0, ans = 0, count = 0;
	string s,t,u;
	vector<long long int> z;
	vector<long long int>::iterator position;
	bool q = false;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		cout << "x";
	}
		cout <<  endl;
}

Measured memory_bytes: 256
s=input()
ans = []
while len(s)>1:
    count = 1
    a = s[0]
    s=s[1:]
    for i in range(len(s)-1,-1,-1):
        if s[i] == a:
            s=s[:i] + s[i+1:] 
            count += 1
    ans += [count]
if ans==[2,2]:
    print("Yes")
else:
    print("No")

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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  n = n % 10;
  if (n  == 3){
	cout << "bon" << "\n";
  }else if (n == 0 || n == 1 || n == 6 || n == 8){
	cout << "pon" << "\n";
  }else{
	cout << "hon" << "\n";
  }
return 0;
}


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

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

Measured memory_bytes: 512
<?php
$N = trim(fgets(STDIN));
$p = [];
for ($i = 0; $i <= $N - 1; $i++) {
    $p[] = explode(" ", trim(fgets(STDIN))) + [2 => 'r'];
}
for ($i = 0; $i <= $N - 1; $i++) {
    $p[] = explode(" ", trim(fgets(STDIN))) + [2 => 'b'];
}

array_multisort(array_column($p, 0), SORT_ASC, $p);
$rs = [];
$count = 0;

for ($i = 0; $i <= 2 * $N - 1; $i++) {
    if ($p[$i][2] == 'r') {
        $rs[] = $p[$i];
    }
    if ($p[$i][2] == 'b') {
        array_multisort(array_column($rs, 1), SORT_DESC, $rs);
        $num = count($rs);
        for ($j = 0; $j <= $num - 1; $j++) {
            if ($p[$i][1] > $rs[$j][1]) {
                unset($rs[$j]);
                $rs = array_values($rs);
                $count++;
                break;
            }
        }
    }
}

echo $count;

Measured memory_bytes: 4728
#include <bits/stdc++.h>
 
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

template<class D>
struct Hungarian {
    V<D> le, ri;
    V<int> perm;

    Hungarian(const VV<D> &c) {
        int n = int(c.size()), m = int(c[0].size());
        assert(n <= m);
        le = V<D>(n, D(0)); ri = V<D>(m, D(0));
        perm = V<int>(n);
        V<int> to_r(n, -1), to_l(m, -1);

        auto cost = [&](int l, int r) { return c[l][r] + le[l] + ri[r]; };
        for (int l = 0; l < n; l++) {
            V<bool> l_u(n), r_u(m);
            V<int> tr(m, -1), min_l(m, l);
            l_u[l] = true;
            V<D> cost_buf(m);
            for (int j = 0; j < m; j++) cost_buf[j] = cost(l, j);
            while (true) {
                int b = -1;
                D d = numeric_limits<D>::max();
                for (int j = 0; j < m; j++) {
                    assert(abs(cost_buf[j] - cost(min_l[j], j)) <= 1e-9);
                    if (!r_u[j] && cost(min_l[j], j) < d) {
                        b = j;
                        d = cost(min_l[j], j);
                    }
                }
                for (int i = 0; i < n; i++) if (l_u[i]) le[i] -= d;
                for (int j = 0; j < m; j++) {
                    if (r_u[j]) ri[j] += d;
                    else cost_buf[j] -= d;
                }
                tr[b] = min_l[b];
                int c = to_l[b];
                if (c == -1) {
                    while (b != -1) {
                        int a = tr[b], z = to_r[a];
                        to_l[b] = a;
                        to_r[a] = b;
                        b = z;
                    }
                    break;
                }
                l_u[c] = r_u[b] = true;
                for (int j = 0; j < m; j++) {
                    if (cost(c, j) < cost(min_l[j], j)) {
                        min_l[j] = c;
                        cost_buf[j] = cost(c, j);
                    }
                }
            }
        }
        perm = to_r;
    }    
};

 
using D = double;
const D PI = acos(D(-1)), EPS = 1e-10;
using P = complex<D>;
 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;
 
    D ans = 0;
 
    int n;
    cin >> n;
    V<P> up(n), dw(n);
    D x, y;
    cin >> x >> y;
    for (int i = 0; i < n; i++) {
        cin >> x >> y; up[i] = P(x, y);
        cin >> x >> y; dw[i] = P(x, y);
        ans += abs(up[i]-dw[i]);
    }
 
    int l = int(up.size()), r = int(dw.size());
    VV<D> cost(l, V<D>(r));
    for (int i = 0; i < l; i++) {
        for (int j = 0; j < r; j++) {
            cost[i][j] = abs(up[i] - dw[j]);
        }
    }
    auto perm = Hungarian<D>(cost).perm;
    for (int i = 0; i < l; i++) {
        ans += cost[i][perm[i]];
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3896
/**
	Language: C++
	Author  : 21
**/

#include <bits/stdc++.h>

using namespace std;

#define FastIO() ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define Debug(v) cerr << '\n' << #v << ":\t" << v << '\n'

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;

int main() {
	// FastIO();
	int n;
	ll k;
	cin >> n >> k;
	vi a(n);
	for (int &a_i: a) cin >> a_i;
	int t = 1;
	vi p;
	unordered_set<int> app;
	app.insert(1);
	p.push_back(1);
	int lo = 1;
	while (true) {
		t = a[t - 1];
		if (app.find(t) != app.end()) {
			lo = t;
			break;
		}
		app.insert(t);
		p.push_back(t);
	}
	vi o;
	for (int i = 0; i < p.size(); ++i) {
		if (p[i] == t) {
			lo = i;
			break;
		} else {
			o.push_back(p[i]);
		}
	}
	if (k < o.size()) {
		t = o[k];
	} else {
		int s = p.size() - lo;
		// for (int &x: p) cout << x << ' '; cout << '\n';
		k -= o.size();
		t = p[lo + k%s];
	}
	cout << t << '\n';
	return 0;
}


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


using namespace std;
int main(){
    int N=0,A=0,B=0,a;
    cin >> N;
    vector<int> v(N);
    for(int i=0; i < N; i++) {
        cin >> a;
        v[i]=a;
    }

    sort(v.rbegin(),v.rend());
    for(int i=0; i < N; i+=2) A += v[i];
    for(int i=1; i < N; i+=2) B += v[i];
    cout<<A-B;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

    long MOD = 1_000_000_007;
    int N = scanner.nextInt();
    int M = scanner.nextInt();
    int K = scanner.nextInt();

    long sum = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < M; j++) {
        long a = N - i;
        a *= M - j;
        a %= MOD;
        a *= i + j;
        a %= MOD;
        if (i > 0 && j > 0) {
          a *= 2;
          a %= MOD;
        }
        sum += a;
        sum %= MOD;
      }
    }
    sum *= choose((long) N * M - 2, K - 2, MOD);
    sum %= MOD;
    System.out.println(sum);
  }

  private static long choose(long n, long k, long mod) {
    if (k > n - k) return choose(n, n - k, mod);
    long res = 1;
    for (int i = 0; i < k; i++) {
      res = (res * (n - i)) % mod;
    }
    for (int i = 1; i <= k; i++) {
      res = (res * inverse(i, mod)) % mod;
    }
    return res % mod;
  }

  private static long inverse(long a, long mod) {
    return modpow(a, mod - 2, mod);
  }

  private static long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
      if (n % 2 == 1) res = (res * a) % mod;
      a = (a * a) % mod;
      n >>= 1;
    }
    return res % mod;
  }
}


Measured memory_bytes: 21844
MOD = 10**9+7

N = int(input())
S = input().strip()

# nums[c]: Sの中の文字cの個数
nums = dict()
for c in S:
    if c in nums: nums[c] += 1
    else: nums[c] = 1  # 1個目

# print(nums)

res = 1
for _, v in nums.items():
    res = res * (v+1) % MOD

res -= 1
print(res)


Measured memory_bytes: 3188
#include<stdio.h>
int main()
{
  int c[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  scanf("%d",&K);
  if (K >= 1 && K <= 32)
  {
    printf("%d",c[K-1]);
  }
}

Measured memory_bytes: 128
function Scanner(input) {
	var self = this;
	self.itemNo = 0;
	self.orgStr = input;
	self.splitedStrs = (function(target) {
		var result = [];
		var target = target.replace(/[\n \t]+/g, " ");
		var strs = target.split(" ");
		for (var i = 0, len = strs.length; i < len; i++) {
			result.push(strs[i]);
		}
		return result;
	}(input));

	self.next = function() {
		var result = self.splitedStrs[self.itemNo];
		self.itemNo++;
		return (result != null) ? result : null;
	}

	self.nextInt = function() {
		var result = self.splitedStrs[self.itemNo];
		self.itemNo++;
		return (result != null) ? parseInt(result) : null;
	}

	self.nextBigDecimal = function() {
		var result = self.splitedStrs[self.itemNo];
		self.itemNo++;
		return (result != null) ? parseFloat(result) : null;
	}
	
	self.nextByte = function() {
		var result = self.splitedStrs[self.itemNo];
		self.itemNo++;
		return (result != null) ? new Int8Array(result) : null;
	}

}

function Main(sc) {

	var S = sc.nextInt();
	var W = sc.nextInt();
	
	console.log((W >= S) ? "unsafe" : "safe");
}
Main(new Scanner(require("fs").readFileSync("/dev/stdin", "utf8")));
// Main(new Scanner("10 1 2 5 3 4 6 7 3 2 4 1 2 2 3 3 4 4 5 3 6 6 7 1 8 8 9 9 10"));

// var str1 = sc.next(); // Stringで取得
// var int1 = sc.nextInt(); // intで取得
// var bd1 = sc.nextBigDecimal(); // BigDecimalで取得
// var byte1 = sc.nextByte(); // byteで取得
// for (var i = 0; i < 1000000000; i++) var toDelay = "aaa"; // 1000msくらいの遅延
// console.log(wrtnNos); return;


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;

const int MOD = 1000000007;


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

    vector<vector<ll>> dp(S.size()+1, vector<ll>(13, 0));
    
    dp[0][0] = 1;
    REP(i,S.size()){
        REP(j,13){
            if(S[i] == '?'){
                REP(k,10){
                    dp[i+1][(j*10+k)%13] += dp[i][j];
                    dp[i+1][(j*10+k)%13] %= MOD;
                }

            }else{
                int num = S[i] - '0';
                dp[i+1][(j*10+num)%13] += dp[i][j];
                dp[i+1][(j*10+num)%13] %= MOD;
            }
        }
    }
    cout << dp[S.size()][5] << endl;

    return 0;
}

Measured memory_bytes: 16700
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;
	
	char buf[L], *S , *T, c;
	 
	char getchar() {
		if(__builtin_expect(S == T, 0)) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}
	
	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	unsigned inpu()
	{
		unsigned x = 0; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar());
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x;
	}
	
	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	char B[25], *outs=B+20, *outr=B+20;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;
		
		if(!a)*--outs = '0';
		else 
			while(a)
				*--outs = (a % 10) + 48, a /= 10;
		
		if(x)
			*--outs = x;
		
		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;

ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}

const int MAXN = 110;
const int MAXP = 10000000;
const u64 MOD = 1000000007;
const f80 MI = f80(1)/MOD;
const int INF = 1000000010;

int n;
int b[MAXN], tot, p[MAXN];
int a[MAXN];
int F[MAXN][MAXN];

int main()
{
	
	cin >> n;
	for (int i = 2; i <= 100; ++ i)
	{
		if (!b[i])
		{
			p[++ tot] = i;
			for (int j = i+i; j <= 100; j += i)
				b[j] = 1;
		}
	}
	
	for (int i = 1; i <= n; ++ i)
	{
		int t = i;
		for (int j = 1; j <= tot; ++ j)
		{
			while (t%p[j] == 0)
			{
				a[j] ++;
				t /= p[j];
			}
		}
	}
	
	F[0][1] = 1;
	for (int i = 1; i <= tot; ++ i)
		for (int s = 1; s <= 75; ++ s)
		{
			for (int j = 0; j <= a[i]; ++ j)
			{
				if (s*(j+1) <= 100) F[i][s*(j+1)] += F[i-1][s];
			}
		}
	
	cout << F[tot][75] << endl;
	
	return 0;
}


Measured memory_bytes: 256
N,Y = map(int,input().split())
m,g,s=10000,5000,1000
for i in range(Y//m+1):
    for j in range((Y-m*i)//g+1):
        z = (Y-(m*i+g*j))//s
        if i+j+z==N:
            print(i,j,z)
            exit(0)
else:print(-1,-1,-1)

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

int dp[10010];
int main(){
    int C,N,M;cin >> C >> N >> M;
    vector<int> s(N),p(N);
    for(int i=0;i<N;i++){
        cin >> s[i] >> p[i];
    }
    fill(dp,dp+10010,0);
    
    for(int j=0;j<N;j++){
        for(int i=10010;i>=0;i--){
        if(i<s[j]){
            dp[i] = dp[i];
        }
        else dp[i] = max(dp[i],dp[i-s[j]]+p[j]);
       }        
    }
    for(int i=1;i<=M;i++){
        cout << dp[C/i]*i << endl;
    }  
}


Measured memory_bytes: 3216
#include <cstdio>

int main() {
	int n;
	int F[50];
	scanf("%d", &n);

	F[0] = 1;
	F[1] = 1;

	for (int i = 2; i <= n; i++) F[i] = F[i - 1] + F[i - 2];

	printf("%d\n", F[n]);
	return 0;
}



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

set<char> vowel = {'a', 'e', 'i', 'o', 'u'};

int main() {
  char c;
  cin >> c;
  string ans = (vowel.find(c) != vowel.end()) ? "vowel" : "consonant";
  cout << ans << endl;
  return 0; 
}

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

int main(){
    int x,n;
    cin >> x >> n;
    set<int> a;
    rep(i,n){ 
        int xx;
        cin >> xx;
        a.insert(xx);
    }
    
    int ans;
    rep(i,100){
        int b = x-(i);
        if(a.find(b) == a.end()){
            ans = b;
            break;
        }
        int c = x+(i);
        if(a.find(c) == a.end()){
            ans = c;
            break;
        }
    }
    cout << ans << endl;

    return 0;
}

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

typedef long double                 ld;
typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define endl                        '\n'
#define file_io                     freopen("input.txt" , "r+" , stdin) ; freopen("output.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define kill(x)                     return cout << x << endl , 0;
#define pb                          push_back

const ll MXN = 3e3 + 3;
const ll MX5 = 3e5 + 3;
const ll MX6 = 1e6 + 3;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; //998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}
string base2(ll n){
    string a="";while(n>=2){a+=(char)(n%2+'0');n/=2;}a+=(char)(n+'0');reverse(all(a));return a;
}

ll n;
ld P[MXN], dp[MXN][MXN];

int main(){
    //fast_io
    //file_io
    cout << fixed << setprecision(12);
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> P[i];
    }
    dp[0][0] = 1.0 - P[0];
    dp[0][1] = P[0];
    for(int i=1;i<n;i++){
        for(int j=0;j<=i+1;j++){
            /// j : number of heads
            dp[i][j] = P[i] * dp[i-1][j-1] + (1.0 - P[i]) * dp[i-1][j];
        }
    }
    ld ans = 0.0;
    ll Min = n/2+1;
    for(int i=Min;i<=n;i++){
        ans += dp[n-1][i];
    }
    cout << ans;
    return 0;
}
//! N.N


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

constexpr int INF = 1e9 + 1;

vector<int> adj[100000];

void dfs(int d[100000], int p, int v, int k = 1) {
	for (int i = 0; i < adj[v].size(); ++i) {
		int c = adj[v][i];
		if (c == p) {
			continue;
		}

		d[c] = k;
		dfs(d, v, c, k + 1);
	}
}

int main() {
	int n, u, v;
	cin >> n >> u >> v;
	--u;
	--v;

	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		cin >> a >> b;

		--a;
		--b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}

	int ud[100000];
	ud[u] = 0;
	dfs(ud, u, u);

	int vd[100000];
	vd[v] = 0;
	dfs(vd, v, v);

	int ans = 0;
	for (int i = 0; i < n; ++i) {
		if (ud[i] < vd[i] && vd[i] > ans) {
			ans = vd[i] - 1;
		}
	}

	cout << ans;
	
	return 0;
}
	

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


int main(void)
{
  int n, m;
  vector<int> t;
  int sum = 0;
  
  cin >> n;
  for(int i=0; i<n; i++){
      int tmp;
      cin >> tmp;
      t.push_back(tmp);
      sum += tmp;
  }
  
  cin >> m;
  for(int i=0; i<m; i++){
      int p, x;
      cin >> p >> x;
      p--;
      
      cout << (sum - t[p] + x) << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> array = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			array.add(Integer.parseInt(sc.next()));
		}
		Integer[] list = array.toArray(new Integer[array.size()]);

		System.out.println(threeOrTwo(n, list));
		sc.close();
	}

	public static int threeOrTwo(int n, Integer list[]) {
		int count = 0;
		while (true) {
			int even = 0;
			for (int i = 0; i < n; i++) {
				if (list[i] % 2 == 0) {
					list[i] = list[i] / 2;
					even++;
					break;
				} 
			}
			if (even ==  0) {
				return count;
			} else {
				count++;
			}
		}
	}
}

Measured memory_bytes: 36360
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
#define int long long
#define lowbit(x) ((x)&-(x))
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
    static char ch;bool f=1;
    for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
    for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
}
template<typename T>
void print(T x)
{
    if (x<0) x=-x,putchar('-');
    if (x>9) print(x/10);
    putchar(x%10+48);
}
template<typename T>
inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
template<typename T>
inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
template<typename T>
inline void chkmin(T &x,const T &y) {x=x<y?x:y;}
#define stack Fading
vector<int> v[21],v1;
int n,m,x,y,ans,ver[101],nxt[101],head[51],tot,stack[51],top;
bool mp[51];
void dfs(int x,int fa,int id) {
	if(x==y) {
		for(res i=1;i<=top;++i) v[id].push_back(stack[i]);
		return;
	}
	for(res i=head[x];i;i=nxt[i]) {
		if(ver[i]==fa) continue;
		stack[++top]=i+1>>1,dfs(ver[i],x,id),--top;
	}
}
inline void add(int x,int y) {ver[++ans]=y,nxt[ans]=head[x],head[x]=ans;}
signed main()
{
	ios::sync_with_stdio(false);
	cin>>n,tot=1;
	for(res i=1;i<n;++i) tot<<=1;
	for(res i=1;i<n;++i) cin>>x>>y,add(x,y),add(y,x);
	cin>>m;
	for(res i=1;i<=m;++i) {
		cin>>x>>y;
		top=0,dfs(x,0,i);
	}
	int all=(1<<m)-1;
	for(res i=1;i<=all;++i) {
		int cnt=0,sum=1;
		memset(mp,false,sizeof(mp));
		for(res j=1;j<=m;++j) if((i>>(j-1))&1) {
			++cnt;
			for(vector<int>::iterator it=v[j].begin();it!=v[j].end();++it) mp[*it]=true;
		}
		for(res j=1;j<n;++j) if(!mp[j]) sum<<=1;
		if(cnt&1) tot-=sum;else tot+=sum;
	}
	cout<<tot<<'\n';
	cout<<flush;
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/ 

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int n;
	cin >> n;
	vector<int>w(n);
	int i;
	int sum = 0;
	for (i = 0; i < n; i++)
	{
		cin >> w.at(i);
	}
	int a, b,c,d;
	a = b = c=0;
	d = n - 1;
	int cnt = 0;
	while (cnt < n)
	{
		if (a <= b)
		{
			a += w.at(c);
			c++;
		}
		else
		{
			b += w.at(d);
			d--;
		}
		cnt++;
	}
	cout << abs(a - b) << endl;


}

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

int main()
{
	int N, K;
	int h[100001];
	int count = 0;

	cin >> N >> K;

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

	for (int i = 0; i < N; i++)
	{
		if (h[i] >= K)count++;
	}

	cout << count << endl;
}

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

int main() {
  int N;
  cin >> N;
  if(N % 10 == 0){
    cout << "pon";
  }
  else if(N % 10 == 1){
    cout << "pon";
  }
  else if(N % 10 == 2){
    cout << "hon";
  }
  else if(N % 10 == 3){
    cout << "bon";
  }
  else if(N % 10 == 4){
    cout << "hon";
  }
  else if(N % 10 == 5){
    cout << "hon";
  }
  else if(N % 10 == 6){
    cout << "pon";
  }
  else if(N % 10 == 7){
    cout << "hon";
  }
  else if(N % 10 == 8){
    cout << "pon";
  }
  else if(N % 10 == 9){
    cout << "hon";
  }
}

Measured memory_bytes: 3624
import bisect

a, b, q = map(int, input().split())
ss = sorted([int(input()) for _ in range(a)])
ts = sorted([int(input()) for _ in range(b)])
xs = [int(input()) for _ in range(q)]

for x in xs:
    sindex = bisect.bisect(ss, x)
    if sindex == 0:
        sl = float('inf')
        sr = ss[sindex] - x
    elif sindex == a:
        sl = x - ss[sindex - 1]
        sr = float('inf')
    else:
        sl = x - ss[sindex - 1]
        sr = ss[sindex] - x
    tindex = bisect.bisect(ts, x)
    if tindex == 0:
        tl = float('inf')
        tr = ts[tindex] - x
    elif tindex == b:
        tl = x - ts[tindex - 1]
        tr = float('inf')
    else:
        tl = x - ts[tindex - 1]
        tr = ts[tindex] - x
    print(
        min([
            max(sl, tl),
            max(sr, tr),
            2 * sl + tr,
            2 * tl + sr,
            2 * sr + tl,
            2 * tr + sl,
        ]))

Measured memory_bytes: 17268
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0044
{
	class Program
	{
		static void Main(string[] args)
		{
			var	prime	= new List<int>();
			for( int i = 1; i <= 50000; i++ ) {
				if( is_prime( i ) ) {
					prime.Add( i );
				}
			}				
			for( int i = 50001; ; i++ ) {
				if( is_prime( i ) ) {
					prime.Add( i );
					break;
				}
			}
			//Console.WriteLine( "cnt={0} num={1}", prime.Count, prime[ prime.Count - 1 ] );

			while( true ) {
				var	str	= Console.ReadLine();
				if( str == null ) {
					break;
				}

				var	n	= int.Parse( str );
				var	min	= 0;
				var	max	= 0;
				for( int i = 0; i < prime.Count; i++ ) {
					if( prime[ i ] >= n ) {
						min	= prime[ i - 1 ];
						break;
					}
				}
				for( int i = prime.Count - 1; i >= 0; i-- ) {
					if( prime[ i ] <= n ) {
						max	= prime[ i + 1 ];
						break;
					}
				}
				Console.WriteLine( min + " " + max );
			}
		}
		
		// 素数判定
		static bool is_prime( int n )
		{
			if( n <= 1 ) {
				return( false );
			} else if( n <= 3 ) {
				return( true );
			} else if( (n % 2) == 0 ) {
				return( false );
			} else {
				for( int i = 3; i <= (int)Math.Sqrt( n ); i += 2 ) {
					if( (n % i) == 0 ) {
						return( false );
					}
				}
			}
			return( true );
		}
	}
}

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

using namespace std;
typedef long long ll;

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s; cin >> s;
    s[1] = 'R' - s[1] + 'B';
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

int main() {
    string s; cin >> s;
    deque<int> q;
    rep(i,s.size()) {
        if (s[i] != 'B') q.push_back(s[i]-'0');
        else {
            if (!q.empty()) q.pop_back();
        }
    }
    while (!q.empty()) {
        int x = q.front(); q.pop_front();
        cout << x;
    }
    cout << endl;
}

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

int main() {
	int n;
	while (cin >> n, n != 0) {
		double sum = 0, var = 0;
		for (int i = 0; i < n; i++) {
			int s;
			cin >> s;
			sum += s;
			var += s * s;
		}
		cout << setprecision(10) << sqrt(var / n - sum * sum / n / n) << endl;
	}
}


Measured memory_bytes: 3252