akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = list(map(int, input().split()))

def common_divisor(n):
    cd = []
    for i in range(1,int(n**0.5)+2):
        if n%i==0:
            cd.append(i)
            if i != n//i:
                cd.append(n//i)
    return list(set(cd))

cd_dic = {}
for cd in common_divisor(A[0]):
    cd_dic[cd] = 1

for cd in common_divisor(A[1]):
    if cd not in cd_dic:
        cd_dic[cd] = 1
    else:
        cd_dic[cd] = 2
#print(cd_dic)
for k in cd_dic.keys():
    if cd_dic[k] == 2:
        cd_dic[k] = True
    else:
        cd_dic[k] = False
from copy import copy
for a in A[2:]:
    #print(cd_dic)
    d = copy(cd_dic)
    for k,v in cd_dic.items():
        if a%k!=0:
            if v == True:
                d[k] = False
            else:
                d.pop(k)
    cd_dic = copy(d)
ans = max(cd_dic.keys())
print(ans)

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

int main(int argc, char const *argv[])
{
	int d,t,s;
	cin >> d >> t >> s;
	if (t*s >= d) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var sc = NewScanner(os.Stdin, 1000000)

var a []int

func main() {
	exist := map[int]bool{}

	var tmp int
	var res int
	s := sc.readInt()
	count := 0
	a = append(a, s)
	exist[s] = true
	count++

	for {
		if a[count-1]%2 == 0 {
			tmp = int(a[count-1] / 2)
		} else {
			tmp = a[count-1]*3 + 1
		}
		a = append(a, tmp)
		_, ok := exist[tmp]
		if ok {
			res = count + 1
			break
		}
		exist[tmp] = true
		count++
	}
	fmt.Println(res)
}

type Scanner struct {
	*bufio.Scanner
}

func (scn *Scanner) readInt() int {
	scn.Scanner.Scan()
	i, _ := strconv.Atoi(scn.Scanner.Text())
	return i
}

func NewScanner(r io.Reader, bufSize int) *Scanner {
	buf := make([]byte, bufSize)
	scn := bufio.NewScanner(r)
	scn.Buffer(buf, bufSize)
	scn.Split(bufio.ScanWords)
	return &Scanner{scn}
}


Measured memory_bytes: 768
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using ll = long long;

using namespace std;

const ll mod = 1e9 + 7;

int main(){	
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> table(12345678 , 0);
	for(int i = 0; i < n; i++){
		cin >> a[i];
		table[a[i]]++;
	}
	
	sort(a.begin() , a.end());
	
	ll cnt = 0;
	for(int i = 0; i < n; i++){
		for(int j = 2; a[i] * j <= a[n - 1]; j++){
			table[a[i] * j]++;
		}
	}
	
	int ans = 0;
	for(int i = 0; i < n; i++){
		if(table[a[i]] <= 1)ans++;
	}
	cout << ans << endl;
	return 0;
}
 


Measured memory_bytes: 52348
N = int(input())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
ans = 0
for i in reversed(range(N)):
    a, b = A[i], B[i]
    _, r = divmod(a + ans, b)
    if r > 0:
        ans += b - r
print(ans)

Measured memory_bytes: 11048
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll q;cin>>q;
    ll c=0;
    multiset<ll> le,ri;//leftのendがargmin
    ll lesum=0,risum=0;
    while(q--){
        ll t;cin>>t;
        if(t==1){
            ll a,b;cin>>a>>b;
            c+=b;
            if(le.empty()){
                lesum+=a;
                le.insert(a);
            }
            else if(ri.empty()){
                risum+=a;
                ri.insert(a);
                if(*le.begin()>*ri.begin()){
                    swap(le,ri);
                    swap(lesum,risum);
                }
            }
            else{
                // le.size==ri.sizeかle.size+1==ri.size
                //になるようにうまく動かして持っておく
                ll x=*prev(le.end());
                if(a<=x){
                    le.insert(a);
                    lesum+=a;
                    if(le.size()>ri.size()+1){
                        //サイズ合わせ
                        lesum-=(*prev(le.end()));
                        risum+=(*prev(le.end()));
                        ri.insert(*prev(le.end()));
                        le.erase(prev(le.end()));
                    }
                }
                else{
                    ri.insert(a);
                    risum+=a;
                    if(ri.size()>le.size()){
                        //サイズ合わせ
                        risum-=(*ri.begin());
                        lesum+=(*ri.begin());
                        le.insert(*ri.begin());
                        ri.erase(ri.begin());
                    }
                }
            }
        }
        else{
            ll argmin=*prev(le.end());
            cout<<argmin<<' ';
            cout<<c+argmin*((ll)le.size())-lesum+risum-argmin*((ll)ri.size())<<endl;

            // cout<<endl;
            // debug(le);debug(ri);
            // cout<<lesum<<' '<<risum<<' '<<c<<endl<<endl;
        }
    }
    return 0;
}


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

const int inf = 1e9;

int main() {
    int n, t; scanf("%d %d", &n, &t);
    int mn = inf;
    for(int i = 0, a, b; i < n; ++i) {
        scanf("%d %d", &a, &b);
        if(b <= t) mn = min(mn, a);
    }
    if(mn == inf) puts("TLE");
    else printf("%d\n", mn);
}

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

using namespace std;

void solve()
{
    int n,a;
    cin>>n;

    int even=0;
    while(n--)
    {
        cin>>a;

        while(a%2==0)
        {
            even++;
            a/=2;
        }
    }

    cout<<even<<endl;
}

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

    solve();

  return 0;
}


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

using namespace std;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int r, g, b, n, res;
	cin >> r >> g >> b >> n;
	res = 0;
	rep(i, 0, 3000)rep(j, 0, 3000)
	{
		if (r * i + g * j <= n && (n - (r * i + g * j)) % b == 0)++res;
	}
	cout << res << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define eps 1e-6
#define mp make_pair
const long long INF=1e18+2;
const int MX=100004;
int N, M, k;
int arr[MX];
int s[MX];
map<int,int> m;
int main()
{
    scanf("%d", &N);
    ll an=0;
    for(int i=1; i<=N; i++)
    {
        scanf("%d", &arr[i]);
        if(i&1) m[arr[i]]++;
        else m[arr[i]]+=2;
        s[i]=arr[i];
    }
    sort(s+1, s+1+N);
    for(int i=1; i<=N; i++)
    {
       if((i&1) && m[s[i]] == 2) ++an;
       else if(i%2 == 0 && m[s[i]] == 1) ++an;
    }
    cout<<an/2<<"\n";
    return 0 ;
}



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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    double r;
    cin>>r;
    cout<<r*r*M_PI<<' '<<2*r*M_PI<<'\n';
    return 0;
}

Measured memory_bytes: 1292
n,m,l = map(int,input().split())
a = [None] * n
b = [None] * m
c = [[None for _ in range(l)] for _ in range(n)]
for i in range(n):
    a[i] = list(map(int,input().split()))

for i in range(m):
    b[i] = list(map(int,input().split()))

for w in range(n):
    for h in range(l):
        tmp = 0
        for i in range(m):
            tmp += a[w][i] * b[i][h]
        c[w][h] = tmp

for line in c:
    print(" ".join(map(str, line)))


Measured memory_bytes: 6892
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n;
ll T, t[200005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n >> T;
	ll res = 0;
	FOR(i, n) cin >> t[i];
	FOR(i, n-1) {
		res += min(T, t[i+1]-t[i]);
	}
	res += T;
	cout << res << endl;
	return 0;
}

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

int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[8] = { 0, 1, 0, -1, 1, -1, 1, -1 };
int H, W;

bool In(int x, int y){
	return 0 <= x && x < W && 0 <= y && y < H;
}

string b[50];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	cin >> H >> W;
	for(int i = 0; i < H; i++){
		cin >> b[i];
	}

	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			if(b[i][j] == '#') cout << "#";
			else{
				int sum = 0;
				for(int k = 0; k < 8; k++){
					int nx = j + dx[k], ny = i + dy[k];
					if(In(nx, ny) && b[ny][nx] == '#') sum++;
				}
				cout << sum;
			}
		}
		cout << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
 
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=n;i<=N;++i)
#define asd(i,n,N) for(int i=n;i< N;++i)
#define rap(i,n,N) for(int i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>> " << #x << " -> " << x << endl
#define mems(x,y) memset(x,y,sizeof x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define plll pair<pll,ll>
#define piii pair<int,pii>
#define piiii pair<pii,pii>
#define psi pair<string,int>
#define endl '\n'
const int MAX = 1e6+5;
const ll MAX2 = 11;
const ll MOD = 1000000007;
const ll MOD2 = 1000005329;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 555;

ll tc,n,x,y,z,a,b,sz,id,tmp,res,cnt;
string s,t;

int main(){
//	cout<<fixed<<setprecision(2);
//    freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>s;
    for(auto i:s){
    	if(i=='R')++cnt;
    	else res = max(res,cnt), cnt = 0;
	}
	cout<<max(res,cnt)<<endl;
    return 0;
}

Measured memory_bytes: 3652
N = int(input())
A = list(map(int, input().split()))
dp = [[float('inf')]*N for _ in range(N)]
for i in range(N):
  if (N-1)%2==0:
    dp[i][i] = A[i]
  else:
    dp[i][i] = -A[i]
for k in range(1,N):
  for i in range(N):
    j = i+k
    if j>N-1:
      break
    if (N-(k+1))%2==0:
      dp[i][j] = max(dp[i][j-1]+A[j],dp[i+1][j]+A[i])
    else:
      dp[i][j] = min(dp[i][j-1]-A[j],dp[i+1][j]-A[i])
ans = dp[0][N-1]
print(ans)

Measured memory_bytes: 385276
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = (int) 2e5 + 5;
int n, m;
int a[maxn];

bool read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return false;
  }
  for (int i = 0; i < 2 * n; i++) {
    scanf("%d", &a[i]);
  }
  return true;
}

void check1(int pos, int z, bool &up, bool &down) {
  for (int i = 0; i < pos / 2; i++) {
    if (a[i] + a[pos - 1 - i] > z) {
      down = true;
    }
  }
  for (int i = pos; i < 2 * n - 1 - (i - pos); i++) {
    int cur = a[i] + a[2 * n - 1 - (i - pos)];
    if (cur < m) {
      up = true;
    }
    if (cur > m + z) {
      down = true;
    }
  }
}

bool check(int z) {
  int l = -1, r = n + 1;
  while (l < r - 1) {
    int mm = (l + r) / 2;
    bool up = false, down = false;
    check1(2 * mm, z, up, down);
    if (up && down) {
      return false;
    }
    if (!up && !down) {
      return true;
    }
    if (up) {
      l = mm;
    } else {
      r = mm;
    }
  }
  return false;
}

void solve() {
  sort(a, a + 2 * n);
  int l = -1, r = m - 1;
  while (l < r - 1) {
    int mm = (l + r) / 2;
    if (check(mm)) {
      r = mm;
    } else {
      l = mm;
    }
  }
  printf("%d\n", r);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define size(a) int(a.size())

const ll mod = 1e9 + 7;
const ll inf = ll(1e18);
const double PI = acos(-1);

ll modexp(ll x, ll n, int md) {
    if (n == 0)return 1;
    if (n % 2 == 0)return modexp((x * x) % md, n / 2, md);
    return (x * modexp((x * x) % md, n / 2, md)) % md;
}

int main() {
    fastio;
    // clock_t tm = clock();
    ll n;
    cin>>n;
    ll ans=0;
    for(ll i=1;i<=n;++i){
        ans=ans+(i*(i+1))/2;
    }
    if(n>1) {
        vll e(n - 1);
        f(i, 0, n - 1) {
            cin >> e[i].first >> e[i].second;
        }
        f(i,0,n-1){
            ans=ans-min(e[i].first,e[i].second)*(n+1-max(e[i].first,e[i].second));
        }
    }
    cout<<ans<<endl;
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}


Measured memory_bytes: 6356
left :: String -> Int
left string = sub string 0 0
  where 
    sub :: String -> Int -> Int -> Int
    sub [] ans m = m
    sub (c:s) ans m = if c == '(' then sub s (ans+1) m else {-c == ')'-} sub s (ans-1) $ min m $ ans-1

right :: String -> Int
right string = sub string 0 0
  where 
    sub :: String -> Int -> Int -> Int
    sub [] ans m = m
    sub (c:s) ans m = if c == ')' then sub s (ans+1) m else {-c == '('-} sub s (ans-1) $ min m $ ans-1


main :: IO ()
main = do
  n <- readLn::IO Int
  s <- getLine
  
  putStrLn $ (replicate ((-1)*(left s)) '(') ++ s ++ (replicate ((-1)*(right $ reverse s)) ')')
      
      

Measured memory_bytes: 508
long d['~~'];A,x,i,j;main(n){for(scanf("%d%d",&n,&A),d[n*=A]=1;~scanf("%d",&x);i=5e3-i)for(x-=A,j=2*n;j--;)d[5000-i+j]=d[i+j]+(j<x?0:d[i+j-x]);printf("%ld",d[i+n]-1);}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>

using namespace std;

typedef long long LL;
LL a[100010];
LL c, d;
int i, n;

int main(){
	scanf("%d", &n);
	for(i = 1; i <= n; ++i) scanf("%d", &a[i]);
	sort(a + 1, a + n + 1);
	for(i = n - 1; i >= 0; --i)
		if(a[i] == a[i+1]){c = a[i]; break;}
	for(i -= 2; i >= 0; --i)
		if(a[i] == a[i+1]){d = a[i]; break;}
	printf("%lld\n", c * d);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h> 
#define pb push_back
#define mp make_pair 
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define f(i,a,n) for(int i=a;i<n;i++)
using namespace std;
typedef vector<int> vi;
typedef map<int,int> mii;
typedef pair<int,int> pii; 
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<string> vs;

int main() {

    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif*/
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;

    //int t; cin>>t; while(t--) {
    int n,w; cin>>n>>w;
    vll dp(w+1,0) ;
    f(items,0,n) {
        int weight,value;
        cin>>weight>>value;
        for(int weight_already=w-weight;weight_already>=0;weight_already--) 
            dp[weight_already+weight]=max(dp[weight_already+weight],dp[weight_already]+value);
        
    }
    ll ans=0;
    f(i,0,w+1) ans=max(ans,dp[i]);
    cout<<ans;

    return 0 ;

}

Measured memory_bytes: 1024
import collections

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = []


for i in range(q):
    bci = list(map(int, input().split()))
    bc.append(bci)

cc = collections.Counter(a)
li = cc.most_common()
su = sum(a)

for i in range(q):
    b, c = bc[i]
    if cc[b]:
        num = (c-b)*cc[b]
    else:
        num = 0
    su += num
    print(su)
    if cc[c]:
        cc[c] += cc[b]
    else:
        cc[c] = cc[b]
    cc[b] = 0

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

int main(){
    int N;
    cin>>N;
    int P[N];
    rep(i,N){
        P[i]=i;
    }
    int x[N],y[N];
    rep(i,N){
        cin>>x[i]>>y[i];
    }
    double ans=0,cnt=0;
    
    do {
        rep(i,N-1){
            ans+=sqrt(pow(abs(x[P[i]]-x[P[i+1]]),2)+pow(abs(y[P[i]]-y[P[i+1]]),2));
        }
        cnt++;
    } while(next_permutation(P,P+N));
  
  
    double ave=(double) ans/cnt;
    cout << fixed << setprecision(10);
    cout<<ave<<endl;
    }
    
    
    
    
    
  
 
 




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

using ll = long long;
using namespace std;


int main() {
	ll ans;
	ll x, y;
	cin >> x >> y;
	if (x >= 0 && y > 0) {
		if (y > x) {
			cout << y - x;
		}
		else if (y < x) {
			cout << x - y + 2;
		}
	}
	else if (x < 0 && y < 0) {
		if (x < y) {
			cout << y - x;
		}
		else if (y < x) {
			cout << x - y + 2;
		}
	}
	else if ((x >= 0 && y < 0) || (y > 0 && x < 0)) {
		cout << abs(y + x) + 1;
	}
	else if (x < 0 && y == 0) {
		cout << -x;
	}
	else if (x > 0 && y == 0) {
		cout << x + 1;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  int N,M=0,t=0;
  cin>>N;
  int A[N+1],B[N+1];
  for(int i=1; i<=N; ++i){
    cin>>A[i];
    B[i]=0;
  }
  
  
  for(int i=N; i>0; --i){
    if(i>(N/2)){
      if(A[i]==1){
        B[i]=1;
        M++;
      }
    }
    else{
      t=0;
      for(int j=1; j<=(N/i); ++j) t+=B[j*i];
      if((t%2)!=A[i]){
        B[i]=1;
        M++;
      }
    }
  }
  
  cout<<M<<endl;
  if(M>0){
    for(int i=1; i<=N; ++i){
      if(B[i]==1) cout<<i<<" ";
    }
    cout<<endl;
  }
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    string s, t;
    cin >> s >> t;
    int n, m;
    n = s.size();
    m = t.size();
    sort(ALL(s));
    sort(ALL(t));
    reverse(ALL(t));
    if(s < t) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

using namespace std;


//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用


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

	int a;
	cin >> a;
	cout << a % 10 + (a / 10) % 10 + (a / 100) << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll a,b,x;
  cin >> a >> b >> x;
  ll res = 0;
  res = b / x;
  if(a > 0)a--;
  else res++;
  res -= a / x;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int H, W;
    char S;
    string bom,ans;

    cin >> H >> W;
    for(int i=0; i<H; i++){
        if(i == 0){
            for(int j=0; j<W+2; j++){
                bom += '.';
            }
        }
        for(int j=0; j<W; j++){
            if(j == 0){
                bom += '.';
            }   
            cin >> S;
            bom += S;
            if(j == W-1){
                bom += '.';
            }
        }
        if(i == H-1){
            for(int j=0; j<W+2; j++){
                bom += '.';
            }
        }
    }

    // cout << bom << endl;

    int f0 = -W-1-2;
    int f1 = -W-2;
    int f2 = -W+1-2;
    int f3 = -1;
    int f4 = 1;
    int f5 = W-1+2;
    int f6 = W+2;
    int f7 = W+1+2;

    vector<int> vec = { f0, f1, f2, f3, f4, f5, f6, f7};

    int number = 0;
    for(int i=1; i<=H; i++){
        for(int j=1+(2+W)*i; j<1+(2+W)*i+W; j++){
            if(bom.at(j) == '#'){
                cout << '#';
                continue;
            }
            for(int k=0; k<vec.size(); k++){
                if(bom.at(j+vec.at(k)) == '#'){
                    number++;
                }
                if(k == vec.size()-1){
                    cout << number;
                    number = 0;
                }
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string a;
    int count=0,t,l;
    while((cin>>a)!=0){
    	l=a.size();
	t=0;
	for(int i=0;i<l;i++){
	    if(a[i]==a[l-1-i])t++;
	}
	if(t==l)count++;
    }
    cout<<count<<endl;
    return 0;
}

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

int main() {
  int A;
  cin>>A;
  int ans=0;
  for(int i;i<A; i++){
    char h;
    cin>>h;
    if(h=='Y'){
      cout<<"Four"<<endl;
      break;
    }
    else if(i+1>=A){
      cout<<"Three"<<endl;
      break;
    }
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define OUT 0
#define IN 1
#define MAX 100
class Event{
public:
int id, type, t;
Event(int id=0, int type=0, int t=0):id(id), type(type), t(t){}
bool operator < ( const Event &e) const{
if ( t == e.t ) return type < e.type;
return t < e.t;
}
};
main(){
int s = 150, n, a, b, M[MAX];
while( cin >> n && n ){
Event events[MAX*2];
int ne = 0;
for ( int i = 0; i < n; i++ ){
cin >> M[i] >> a >> b;
events[ne++] = Event(i, IN, a);
events[ne++] = Event(i, OUT, b);
}
sort(events, events + ne);
bool fail = false;
int cur = 0;
for ( int i = 0; i < ne; i++){
if ( events[i].type == OUT ) cur-= M[events[i].id];
if ( events[i].type == IN ) cur += M[events[i].id];
if ( cur > s ) fail = true;
}
if ( fail ) cout << "NG" << endl;
else cout << "OK" << endl;
}
}

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

using namespace std;

int main()
{
    int a;

    for (int i = 1; i < 6; i++)
    {
        cin >> a;
        if(a != i) {
            cout << i << endl;
            return 0;
        }
        /* code */
    }
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;
const int maxn = 200010;
int n;
map<int,int> mp;
int cnt = 0;
int main(){
	cin >> n;
	for(int i = 0;i < n;i++){
		int a;
		cin >> a;
		if(mp[a]%2==0){
			cnt++;
		}else{
			cnt--;
		}
		mp[a]++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int t[]={a,b,c};
  if(count(t,t+3,5)==2 && count(t,t+3,7)==1)
    cout<<"YES";
  else
    cout<<"NO";
  return 0;
}

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

int main() {
    int N, D, x, cnt = 0;
    cin >> N >> D >> x;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j * A.at(i) + 1 <= D; j++) {
            cnt += 1;
        }
    }
    cout << cnt + x << endl;
}

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

int main(){
	int tramp[4][13];
	int i,j;
	for (i=0; i<4; i++){
		for (j=0; j<13; j++){
			tramp[i][j] =j+1;
		}
	}
	
	int n;
	cin >>n;
	
	char x;
	int y;
	for (int k=0; k<n; k++){
		cin >>x >>y ;
		for (j=0; j<13; j++){
			if (x=='S' && y==j+1) tramp[0][j] =0;
			if (x=='H' && y==j+1) tramp[1][j] =0;
			if (x=='C' && y==j+1) tramp[2][j] =0;
			if (x=='D' && y==j+1) tramp[3][j] =0;
		}
	}
	
	for (i=0; i<4; i++){
		for (j=0; j<13; j++){
			if (tramp[i][j]==0) continue;
			if (i==0) cout << "S" <<" "<< j+1 <<"\n";
			if (i==1) cout << "H" <<" "<< j+1 <<"\n";
			if (i==2) cout << "C" <<" "<< j+1 <<"\n";
			if (i==3) cout << "D" <<" "<< j+1 <<"\n";
		}
	}	
	
	return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define ll long long
#define INF 1e9 + 1
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

int main() {
    int a, b;
    stack<int> s;
    string c;
    while (cin >> c) {
        if (c == "+") {
            a = s.top();
            s.pop();
            b = s.top();
            s.pop();
            s.push(a + b);
        } else if (c == "-") {
            a = s.top();
            s.pop();
            b = s.top();
            s.pop();
            s.push(b - a);
        } else if (c == "*") {
            a = s.top();
            s.pop();
            b = s.top();
            s.pop();
            s.push(a * b);
        } else {
            s.push(stoi(c));
        }
    }
    cout << s.top() << endl;
}


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

int calc(int a, int b, int c, int d, char op1, char op2, char op3){
    int ans = a;
    if (op1 == '+'){
        ans += b;
    }else{
        ans -= b;
    }

    if (op2 == '+'){
        ans += c;
    }else{
        ans -= c;
    }

    if (op3 == '+'){
        ans += d;
    }else{
        ans -= d;
    }

    return ans;
}

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

    int a = n/1000;
    int b = (n/100)%10;
    int c = (n/10)%10;
    int d = n%10;

    char op1 = '+';
    char op2 = '+';
    char op3 = '+';

    // cout << calc(a, b, c, d, op1, op2, op3) << endl;

    for (int i = 0; i<2; i++){
        op2 = '+';
        for (int j = 0; j<2; j++){
            op3 = '+';
            for (int k = 0; k<2; k++){
                if (calc(a, b, c, d, op1, op2, op3) == 7){
                    cout << a << op1 << b << op2 << c << op3 << d << "=7" << endl;
                    return 0;
                }
                op3 = '-';
            }
            op2 = '-';
        }
        op1 = '-';
    }

}

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

int main() {
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    ll min_price = 10000000000000;
    
    for(int i = 0; ; i = i + 2) {
        if(i / 2 > max(x,y)) break;

        int price;
        if(x - i/2 < 0)       price = b*(y-i/2) + c*i;
        else if(y - i/2 < 0)  price = a*(x-i/2) + c*i;
        else                price = a*(x-i/2) + b*(y-i/2) + c*i;

        if(min_price > price) min_price = price;
    }
    cout << min_price << endl;



}

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

int main()
{
int a,b;
   cin>>a;
   bool chk=false;
   for(int i=1;i<=9;i++)
   {
       if(a%i==0)
       {
           if(a/i<=9)
           {
               chk=true;
               break;
           }
       }
   }
   if(chk==true)
    cout<<"Yes";
   else
    cout<<"No";



    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

const ll MOD = 1e9 + 7;

using mat = vec<ll, 2>;

mat eye(int n) {
  mat I(n, vector<ll>(n));
  for (int i = 0; i < n; ++i)
    I[i][i] = 1;
  return I;
}

mat mul(mat A, const mat& B) {
  for (int i = 0; i < A.size(); ++i) {
    vector<ll> x(A[0].size());
    for (int k = 0; k < B.size(); ++k)
      for (int j = 0; j < B[0].size(); ++j)
        (x[j] += A[i][k] * B[k][j] % MOD) %= MOD;
    A[i].swap(x);
  }
  return A;
}

mat pow(mat A, ll k) {
  mat X = eye(A.size());
  for (; k > 0; k /= 2) {
    if (k & 1) X = mul(X, A);
    A = mul(A, A);
  }
  return X;
}

int main() {
  ll N, K;
  while (cin >> N >> K) {
    vec<int, 2> G = make_v(N, N, 0);
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        cin >> G[i][j];
      }
    }
    mat A = make_v(N, N, 0ll);
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        A[i][j] = G[j][i];
      }
    }
    mat P = pow(A, K);
    ll res = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        res = (res + P[i][j]) % MOD;
      }
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;

int main(){
    priority_queue<ll,vector<ll> > pque;
    ll n,m;
    cin >> n >> m;
    ll a[n];

    rep(i,0,n){
        cin >> a[i];
        pque.push(a[i]);
    }

    rep(i,0,m){
        ll v = pque.top();
        pque.pop();

        v /= 2;
        pque.push(v);
    }

    ll ans = 0;
    while(!pque.empty()){
        ans += pque.top();
        pque.pop();
    }

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

Measured memory_bytes: 1912
#include <iomanip>
#include <vector>
#include <numeric>
#include <algorithm>
#include <queue>
#include <cstring>
#include <iostream>
using namespace std;

int main() {
    int n; cin >> n;
    int p[n][n], P[n*n];
    for (int i = 0; i < n*n; i++) {
        int x; cin >> x;
        x--;
        p[x/n][x%n] = i;
        P[i] = x;
    }

    int dist[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            dist[i][j] = min({i, n - i - 1, j, n - j - 1});
        }
    }

    int ans = 0;
    for (int m = 0; m < n*n; m++) {
        int i = P[m] / n, j = P[m] % n;
        const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
        int d = dist[i][j];
        ans += d;
        queue<pair<int, int> > q;
        q.push({i, j});
        p[i][j] = -1;
        while (!q.empty()) {
            int x = q.front().first, y = q.front().second;
            q.pop();
            for (int k = 0; k < 4; k++) {
                int x1 = x + dx[k], y1 = y + dy[k];
                if (0 <= x1 && x1 < n && 0 <= y1 && y1 < n) {
                    int d1 = dist[x][y] + (int)(p[x][y] >= 0);
                    if (dist[x1][y1] > d1) {
                        dist[x1][y1] = d1;
                        q.push({x1, y1});
                    }
                }
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 6524
S = input()
T = input()
lenS,lenT = len(S),len(T)
n,Ans = 10000,"UNRESTORABLE"
if lenS >= lenT:
    for i in range(lenS-lenT,-1,-1):
        check = True
        for j in range(lenT):
            if S[i+j] != "?" and S[i+j] != T[j]:
                check = False
                break
        if check:
            n = i
            break
    if n < 10000:
        Ans = ""
        for i in range(lenS):
            if i >= n and i < n+lenT:
                Ans += T[i-n]
            elif S[i] == "?":
                Ans += "a"
            else:
                Ans += S[i]
print(Ans)           
            

Measured memory_bytes: 3064
import java.io.IOException;
import java.util.Scanner;
public class Main {
	static int mod=1000000007;
	static Scanner scan=new Scanner(System.in);
	static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
	static long lcm (long a, long b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
			}
		else {
			return a/b+1;
		}
	}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	static String reverce(String str) {
		String strr="";
		for(int i=str.length()-1;i>=0;i--) {
			strr+=str.charAt(i);
		}
		return strr;
	}
	static long modpow(long a,long n) {
		if(n==0) return 1;
		else if(n==1)return a;
		long tmp=modpow(a,n/2);
		tmp%=mod;
		tmp*=tmp;
		tmp%=mod;
		if(n%2==0)return tmp;
		else return (tmp*a)%mod;
	}
	public static void main(String[] args) throws IOException {
		int a=scan.nextInt();
		String str=scan.next();
		System.out.println(a>=3200?str:"red");
	}
}


Measured memory_bytes: 23892
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
ar=gsmi
puts_yesno ar.uniq.size==2

Measured memory_bytes: 1788
// inputに入力データ全体が入る
function Main(input) {
    var str = "CODEFESTIVAL2016"
	input = input.split("\n");
  	input = input[0].split("");
  	str = str.split("\n");
    str = str[0].split("");
    var index = 0;
    var sum=0;
    for(l of input){
      if(l != str[index]){
        sum++;
      }
      index++;
    }
	console.log(sum);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){

  char c[6];
  for(int i=0;i<6;i++){
    cin >> c[i];
  }
  if((c[0]==c[5])&&(c[1]==c[4])&&(c[2]==c[3])){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define sqr(x)  ((x) * (x)) 
#define cub(x)  ((x) * (x) * (x))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
  ll n; cin >> n;
  ll a[n];
  FOR(i,0,n-1) cin >> a[i];

  bool ok = true;

  ll sum = 0;

  FOR(i,0,n-1){
    if(a[i]>=a[i-1]+2) ok = false;
    else if(a[i]>i) ok = false;
    else if(a[i]-a[i-1]==1) ++sum;
    else sum += a[i];
  }

  if(!ok) cout << -1 << endl;
  else cout << sum << endl;
}



Measured memory_bytes: 1792
using System;


public class C
{
	public static void Main()
	{	
		string[] args;
		args = Console.ReadLine().Split(' ');
		int N = Int32.Parse(args[0]);
		int K = Int32.Parse(args[1]);
		
		int[] h = new int[N];
		for(int i = 0; i < N; i++)
			h[i] = Int32.Parse(Console.ReadLine());
		
		Array.Sort(h);
		
		int d = Int32.MaxValue;
		for(int i = 0; i < N - K + 1; i++)
			d = Math.Min(d, h[i+K-1] - h[i]);
		
		Console.WriteLine(d);
	}
}

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

int main(){
  int n;
  cin >> n;
  vector<int> mt(n);
  for ( int i = 0; i < n; i++) cin >> mt.at(i);
  
  int p = n;
  
  for (int i = 0; i < n;i++){
    bool ok = true;
    for (int j = 0; j <=i; j++){
      if(mt.at(j) > mt.at(i)){
        ok = false;
        break;
      }
    }
    if(!ok)p--;
  }
  cout << p << endl;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll MRINF = 5000000000000000;

int main() {

    ll N;
    cin >> N;
    vector<ll> a(N);
    REP(i, N)cin >> a[i];
    ll ans = 0;
    REP(i, N){
        while(1){
            if(a[i]%2!=0)break;
            ans++;
            a[i] /= 2;
        }
    }
    cout << ans << endl;
    

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 3732
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl '\n'
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repab(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define  printarr(v) for(auto x:v){cout<<x<<" "; }
#define debug1(a) cout<<#a<<" "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<" "#c<<" "<<(c)<<endl;
typedef long double ld;
void solve()
{
	ll n;
	cin >> n;
	vector<vector<ll>> v(4, vector<ll>(n));
	rep(i, n)
	{
		ll x, y;
		cin >> x >> y;
		v[0][i] = (x - y);
		v[1][i] = (x + y);
		v[2][i] = (-x + y);
		v[3][i] = (-x - y);
	}
	for (int i = 0; i < 4; i++)
	{
		sort(v[i].begin(), v[i].end());
	}
	ll res = LLONG_MIN;
	for (int i = 0; i < 4; i++)
	{
		res = max(res, v[i][n - 1] - v[i][0]);
	}
	cout << res << endl;

}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	t = 1;
	while (t--)
	{
		solve();

	}
}


Measured memory_bytes: 11100
#include <bits/stdc++.h>
using namespace std;
int main(){
while(1){
int a,b;string s;int ans;
cin>>a>>s>>b;
if(s=="?")break;
if(s=="+")ans=a+b;
if(s=="-")ans=a-b;
if(s=="*")ans=a*b;
if(s=="/")ans=a/b;
cout<<ans<<endl;
}

return 0;
}


Measured memory_bytes: 3140
S = input()

left = int(S[:2])
right = int(S[2:])
if left == 0:
  if 0 < right <= 12:
    print("YYMM")
  else:
    print("NA")
else:
  if left > 12:
    if 0 < right < 13:
      print("YYMM")
    else:
      print("NA")
  elif left > 0:
    if 0 < right < 13:
      print("AMBIGUOUS")
    else:
      print("MMYY")

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using static kyoupuro.Input;
using static kyoupuro.MyMath;

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var N = NextInt();
            var array = new long[N + 1];
            array[0] = 2;
            array[1] = 1;

            for (int i = 2; i <= N; i++) {
                array[i] = array[i - 1] + array[i - 2];
            }

            Console.WriteLine(array[N]);
        }
    }

    class MyMath {
        static long Gcd(long a, long b) {
            return b == 0 ? a : Gcd(b, a % b);
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

Measured memory_bytes: 13268
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define maxn 25

struct node 
{
       double x,y,z;
}a[maxn];
double dis[maxn][maxn];
int n,m;
int visit[maxn],use[maxn];
double ans;

double cal(struct node p,struct node q)
{
       return (p.x-q.x)*(p.x-q.x)+(p.y-q.y)*(p.y-q.y)+(p.z-q.z)*(p.z-q.z);
}

void judge()
{
     int i,j;
     double tmp=0;
     for (i=1;i<=m;i++)
         for (j=i+1;j<=m;j++)
             tmp+=dis[use[i]][use[j]]; 
     if (ans-tmp<0.000001)
        ans=tmp;    
}

void updata(int k,int p)
{
     int i;
     
     if (k==m+1)
     {
              judge();
              return;
     }
     for (i=p;i<=n;i++)
         if (!visit[i])
         {
            visit[i]=1;
            use[k]=i;
            updata(k+1,i+1);
            visit[i]=0;
         }
}
int main()
{
    scanf("%d %d",&n,&m);
    int i,j;
    for (i=1;i<=n;i++)
        scanf("%lf %lf %lf",&a[i].x,&a[i].y,&a[i].z);
    for (i=1;i<=n;i++)
        for (j=i+1;j<=n;j++)
        {
            dis[i][j]=cal(a[i],a[j]);
            dis[j][i]=dis[i][j];
        }
    updata(1,1);
    printf("%.20lf\n",ans); 
    return 0;   
}

Measured memory_bytes: 772
#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($( { splits.next().unwrap().parse::<$t>().unwrap() },)*)
    }}
}

#[allow(unused_macros)]
macro_rules! invec {
    ( $ t : ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s
                .trim()
                .split_whitespace()
                .map(|s| s.parse::<$t>().unwrap())
                .collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }};
}


#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (n, k) = input!(usize, usize);
    let scores = invec!(u64);

    for i in 0..(n - k) {
        if scores[i] < scores[k + i] {
            println!("Yes");
        } else {
            println!("No");
        }
    }

}

fn main() {
    solve();
}


Measured memory_bytes: 5876
package main

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

var sc = bufio.NewScanner(os.Stdin)
	
func main() {

	line0 := strings.Split(nextLine(), " ")
 	M, _ := strconv.Atoi(line0[1])
	X, _ := strconv.Atoi(line0[2])
	
	line1 := strings.Split(nextLine(), " ")
    costL := 0
    for i := 0; i < len(line1); i++ {
         num, _:= strconv.Atoi(line1[i])
        if num < X {
            costL += 1
        } else {
            break; 
        }
    }
    
    costR := M - costL
    if costL < costR {
        fmt.Println(costL)
    } else {
        fmt.Println(costR)
    }
    
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}



Measured memory_bytes: 640
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    int N;
    cin >> N;
    int x = 10;
    int cnt=0;
    for (int i = 0; i < 9;i++){
        cnt += (N % x) / (x / 10);
        x *= 10;
    }
    if (N%cnt==0)
        cout << "Yes";
    else
        cout << "No";
    cout << endl;
}

Measured memory_bytes: 256