akhauriyash/Code-Regression huggingface dataset:
import sys
import numpy as np
import math  # gcdもあるよ
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化

def main():
    a, b, c = list(map(int,input().split()))
    n = int(input())
    for _ in range(n):
        
        if a >= b:
            b = b * 2
            continue
        if b >= c:
            c = c * 2
            continue
    if a < b and b < c:
        print("Yes")
    else: print("No")
    return 0

if __name__ == "__main__":
    main()

Measured memory_bytes: 27240
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#ifndef M_PI
#define M_PI (3.1415926535897932384626433832795)
#endif
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define F first
#define S second

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

int dp[100000][2];
int in[100000];

main(){
  int n,k;
  while(cin>>n>>k,n|k){
    memset(dp,0,sizeof(dp));
    memset(in,0,sizeof(in));
    int t;
    bool w=false;
    rep(i,k){
      cin>>t;
      if(!t)w=true;
      else dp[t-1][0]=dp[t-1][1]=in[t-1]=true;
    }
    
    int uans=1,ans=1;
    dp[0][1]=true;
    for(int i=1;i<n;i++){
      dp[i][1]=true;
      if(in[i-1] && in[i]){
	dp[i][0]=dp[i-1][0]+1;
	dp[i][1]=dp[i-1][1]+1;
      }
      if(in[i-1] && !in[i]){
	dp[i][0]=0;
	dp[i][1]=dp[i-1][0]+1;
      }
      
      if(!in[i-1] && in[i]){
	dp[i][0]=1;
	dp[i][1]=2;
	if(i>=2)dp[i][1]=dp[i-2][0]+2;
      }
      
      if(!in[i-1] && !in[i]){
	dp[i][0]=0;
	dp[i][1]=1;
      }
      ans=max(ans,dp[i][0]);
      uans=max(uans,dp[i][1]);
      //cout<<dp[i][0]<<' '<<dp[i][1]<<endl;
    }
    
    if(w)cout<<uans<<endl;
    else cout<<ans<<endl;
  }
}

Measured memory_bytes: 2036
#include <iostream>
#include <algorithm>

using namespace std;

int N, K;
int A[1005];
int ans;

int main()
{
	cin >> N >> K;
	for (int i = 1; i <= N; i++)
		cin >> A[i];
	sort(A + 1, A + N + 1);
	for (int i = 1; i <= K; i++)
		ans += A[i];
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;

int main(){
	ll n;
	ll A[100010];
	cin>>n;
	for(int i=0;i<n;i++)cin>>A[i];
	
	sort(A,A+n);
	ll b[2]={0,0};
	for(int k=n-1;k>=1;k--){
		if(A[k]==A[k-1]){
			if(b[0]==0)b[0]=A[k];
			else if(b[1]==0)b[1]=A[k];
			k--;
		}
	}
	cout<<b[0]*b[1]<<endl;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
bool tate[101]={};
bool yoko[101]={};
int main(){
    int h, w;
    cin >> h >> w;
    char a[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> a[i][j];
        }
    }
    
    for(int i=0;i<h;i++){
        int count=0;
        for(int j=0;j<w;j++){
            if(a[i][j]=='.') count++;
        }
        if(count==w) yoko[i]=true;
    }
    for(int j=0;j<w;j++){
        int count=0;
        for(int i=0;i<h;i++){
            if(a[i][j]=='.') count++;
        }
        if(count==h) tate[j]=true;
    }
    bool pre=false;
    for(int i=0;i<h;i++){
        if(!yoko[i]){
            for(int j=0;j<w;j++){
                if(!tate[j]){
                        cout << a[i][j];
                }
            }
            cout << endl;
        }
    }
    return 0;
}

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

signed main(){
  int K;
  cin>>K;
  vector<int> vec={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};
  cout<<vec[K-1]<<endl;
}

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

int main(){
    int N,K;
    cin >>N>>K;
    if (N==1 && K==1)cout <<"YES";
    else{
    if(N%2==0){
        if((N/2)>=K) cout<<"YES";
        else cout <<"NO";
    }
    else {
      if(((N/2)+1)>=K) cout <<"YES";
      else cout <<"NO";
    }
    }
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

int main() {
    int N;
    cin >> N;
    vi B(N-1);
    REP(i,N-1) cin >> B[i];
    vi A(N);
    FOR(i,0,N){
        if(i==0) A[i] = B[i];
        else if(i==N-1) A[i]=B[i-1];
        else A[i] = min(B[i],B[i-1]);
    }
    int ans = 0;
    REP(i,N) ans += A[i];
    cout << ans << endl;
}



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

lp=0
rp=0
for i in range(n):
  if s[i]=='(':
    rp+=1
  else:
    rp=rp-min(rp,1)
for i in range(n-1,-1,-1):
  if s[i]==')':
    lp+=1
  else:
    lp=lp-min(lp,1)

print('('*max(0,lp)+s+max(0,rp)*')')

Measured memory_bytes: 9148
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long N){
  cout<<(N-2)*180<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 384
ARGF.each{|line|
  n, s = line.chomp.split.map{|c| c.to_i}
  break if n == 0 && s == 0
  count = 0
  (0..9).to_a.combination(n){|a|
    count+=1 if a.inject(:+) == s
  }

  puts count
}

Measured memory_bytes: 8660
#include <stdio.h>
#include<string.h> 
int main()
{
	char a[20];
	char b[20];
	gets(a);
	gets(b);
	int i;
	for(i=0;i<strlen(a);i++){
		if(a[i]!=b[i]){
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	return 0;
} 

Measured memory_bytes: 1604
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include <bits/stdc++.h>

#define for0(i,n) for(int i = 0;i < (n);i++)
#define for1(i,n) for(int i = 1;i<=(n);i++)
#define for2(i,n) for(ll i = 2;i<=(n);i++)
#define rep(i,st,en,cnt) for(ll i = st;i <= en;i+=cnt)
#define PB push_back
#define MP make_pair
#define fastio cin.tie(0);cout.tie(0);ios::sync_with_stdio(0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define bit(x,n) (x & (1<<(n)))
#define EPS 1e-8
#define INF 0x3f3f3f3f3
#define NEGINF -INF
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define inp_arr(a,n) for0(i,n) {cin>>a[i];}
#define out_arr(a,n) for0(i,n) {cout<<a[i]<<" ";}

using namespace std;

typedef pair<int,int> ii;
typedef pair<long long,long long> pll;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<long long> vl;
typedef vector<vector<ll> > vvl;
typedef vector<pair<long long, long long> > vll;
/*
ii DR8[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}};
ii DR4[] = {{-1,0},{0,-1},{0,1},{1,0}};

const ll mod =  1e9+7;

ll nop = 100;
vi primes(nop+1,1);

void sieve(){
    primes[1] = primes[0] = 0;
    for(ll i = 2;i * i <= nop;i++){
        if(primes[i]){
            for(ll j = i*i; j <= nop;j+=i){
                primes[j] = 0;
            }
        }
    }
}

ll gcd(ll a,ll b){    //a larger, b smaller
    if(b>a) swap(b,a);
    if(b==0) return a;
    return gcd(b,a%b);
}

void extgcd(ll a,ll b,ll& x,ll& y){  //a smaller b larger
    if(a==0) {
        x = a;y = b;
        return;
    }
    extgcd(b%a,a,x,y);
    ll y1 = y,x1 = x;
    x = y1 - (b/a)*x1;
    y = x1;
}

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

ll bexp(ll num,ll e){
    ll ans = 1;
    while(e>0){
        if(e&1){
            ans *= num;
        }
        num *= num;
        e>>= 1;
    }
    return ans;
}

ll mexp(ll num,ll e){
    ll ans = 1;
    while(e>0){
        if(e&1){
            ans = (ans*num)%mod;
        }
        num = (num*num)%mod;
        e>>=1;
    }
    return ans%mod;
}

ll modinv(ll a){
    return mexp(a,mod-2);
}
*/

void solve() {
    long double a,b;
    cin>>a>>b;
    cout<<ll(a*b)<<endl;
}

int main() {
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int t = 1;
    //cin>>t;
    for1(T,t){
        //cout<<"Case #"<<T<<": ";
        solve();
    }
    /* #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif */
    return 0;
}


Measured memory_bytes: 3744
#include<iostream>
#include<stdio.h>   
#include<math.h>
#include<string> 
#include<set>  
using namespace std;    
int main()   
{   
long long n,k,cnt=0;
cin>>n>>k;
if(k==0)
{cout<<n*n;
 system("pause");
 return 0;}
for(int i=k+1;i<=n;i++)
{
cnt+=(i-k)*((n+1)/i);
if((n+1)%i-k>0)
cnt+=(n+1)%i-k;}
cout<<cnt;
system("pause");
return 0;  
}

Measured memory_bytes: 504
while line = gets.chomp
  if line == "0000"
    break
  elsif line.count(line[0]) == 4
    puts "NA"
    next
  end

  cnt = 0
  n = line
  while n != "6174"
    mini = n.split("").sort.join("")
    maxi = mini.reverse

    n = (maxi.to_i - mini.to_i).to_s.rjust(4, "0")
    cnt += 1
  end
  puts cnt
end

Measured memory_bytes: 9596
from sys import stdin


def main():
    A, B, C, X = [int(stdin.readline().rstrip()) for _ in range(4)]
    count = 0
    for a in range(A + 1):
        for b in range(B + 1):
            for c in range(C + 1):
                if 500 * a + 100 * b + 50 * c == X:
                    count += 1
    print(count)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#define F first
#define S second

using namespace std;

typedef pair<int,int> P;

bool cmp_x( const pair<P,P> &p , const pair<P,P> &q ){return p.F < q.F;}
bool cmp_y( const pair<P,P> &p , const pair<P,P> &q ){return p.S < q.S;}

int main(void){
  
  int n,r,x1,x2,y1,y2;
  
  while(cin >> n >> r){
    if(n==0 && r==0)break;
    
    vector<pair<P,P> > in;
    
    for(int i=0;i<n;i++){
      scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
      in.push_back(make_pair(make_pair(x1,x2), make_pair(y1,y2)));
    }
    
    sort(in.begin(),in.end(),cmp_x);
    
    int S=0,L=0;
    vector<P>v;
    for(int i=0;i+1<10001;i++){
      v.clear();
      for(int j=0;j<n;j++){
	if(in[j].S.S>=i+1 && i>=in[j].S.F)
	  v.push_back(make_pair(in[j].F.F,in[j].F.S));
      }
      
      if(v.size()!=0){
	int b=v[0].F,e=v[0].S;
	for(int j=1;j<v.size();j++){
	  int B=v[j].F,E=v[j].S;
	  if(e>=B)e=max(e,E);
	  else S+=e-b, b=B, e=E, L+=2;
	}
	S+=e-b, L+=2;
      }
    }
    cout << S << endl;
    
    if(r==2){  
      sort(in.begin(),in.end(),cmp_y);
      
      for(int i=0;i+1<10001;i++){
	v.clear();
	for(int j=0;j<n;j++){
	  if(in[j].F.S>=i+1 && i>=in[j].F.F)
	    v.push_back(make_pair(in[j].S.F,in[j].S.S));
	}
	if(v.size()!=0){
	  int b=v[0].F,e=v[0].S;
	  
	  for(int j=1;j<v.size();j++){
	    int B=v[j].F,E=v[j].S;
	    
	    if(e>=B)e=max(e,E);
	    else b=B, e=E, L+=2;
	  }
	  L+=2;
	}
      }
      cout << L << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1628
using System;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        // Your code here!
        
        string input = Console.ReadLine();
        char[] chArray = input.ToCharArray();
        int sum = 700;
        foreach(char c in chArray)
        {
            if(c == 'o')
            {
                sum += 100;
            }
            
        }
        
        Console.WriteLine(sum);
        
    }
}

Measured memory_bytes: 11092
# 2019/07/20
# AtCoder Beginner Contest 134 - C

# Input
n = int(input())

# Input and Search Max and 2nd Max
a = list()
amax1st = -1
amax2nd = -1
for i in range(n):
    wka = int(input())
    if wka >= amax1st:
        amax2nd = amax1st
        amax1st = wka
    elif wka >= amax2nd:
        amax2nd = wka
        
    a.append(wka)

for i in range(n):
    if a[i] == amax1st:
        ans = amax2nd
    else:
        ans = amax1st
    # Output
    print(ans)


Measured memory_bytes: 12532
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i <(int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i,k,n) for (int i = (int)(n)-1; i >= k; i--)
#define mod 1000000007
#define inf 999999999
int main(){
  int n,m,x;
  int a[110];
  cin >> n >> m >> x;
  rep(i,m){
    cin >> a[i];
  }
  int c = 0;
  int d = 0;
  rep(i,m){
    if(a[i]<x) c++;
    else d++;
  }
  cout << min(c,d) << endl;


  return 0;
}


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

using namespace std;

#define INF 999999999
#define REP(i,n) for(int i=0; i<(int)(n); i++)

struct megaman{
	int s, t;
	bool operator<(const megaman& a) const{
		if(t!=a.t) return t > a.t;
		if(s!=a.s) return s > a.s;
	}
};

int dp[1<<17];
bool ch[1<<17];
queue <int> q;
int t[17][17];

int count(int k,int n){
	int ans =0;
	REP(i,n)if(k&(1<<n))ans++;
	return ans;
}

void search(int n,int x){
	//cout << "s:"<< static_cast<bitset<17> >(z) <<"-" <<dp[z]<<endl;
	REP(z,1<<n){
		if(count(z,n)==x){
			REP(a,n){
				if(!(z&(1<<a))){
					if(t[a][0]+dp[z]<dp[z+(1<<a)]){
						dp[z+(1<<a)] = t[a][0]+dp[z];
					}
					REP(b,n){
						if(z&(1<<b)){
							if(t[a][b+1]+dp[z]<dp[z+(1<<a)]){
								dp[z+(1<<a)] = t[a][b+1]+dp[z];
							}
						}
					}
					if(!ch[z+(1<<a)]){
						ch[z+(1<<a)]=1;
					}
					//cout << "p:"<< static_cast<bitset<17> >(z+(1<<a)) << "-" <<dp[z+(1<<a)]<<endl;
				}
			}
		}
	}
	if(x<n)search(n,x+1);
}

int main(){
	int i, j, n;
	int ans;
	while(1){
		cin >> n;
		if(!n) break;
		REP(a,1<<n){
			dp[a]=99999999;
			ch[a]=0;
		}
		dp[0]=0;
		REP(a,n)REP(b,n+1) cin >> t[a][b];
		ch[0]=1;
		//cout << "ok" << endl;
		search(n,0);
		cout << dp[(1<<n)-1] <<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1524
#include <bits/stdc++.h>
 
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
ll mod =  1000000007;
ll maxn = 1000000000;
 
//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pii = pair<int, int>; // これ以降 pii という型名はpair<int, int> と同じ意味で使える
//---------------------------------------------------------------------------------------------------
 
int main(){
   ll n,m;
   cin>>n>>m;
   ll maxl=0,minr=n+1;
   vll l(m),r(m);
   rep(i,m){
       cin>>l.at(i)>>r.at(i);
       maxl=max(maxl,l.at(i));
       minr=min(minr,r.at(i));
   }
   if(minr-maxl>=0)cout<<1-maxl+minr<<endl;
   else cout<<0<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#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++)

const int MOD = 1000000007;

const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    int A, B;
    cin >> A >> B;
    int ans = max({ A + A - 1, A + B, B + B - 1 });
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main(void){
    long long h, w, ans;
    std::cin >> h >> w;

    if (h == 1 || w == 1){
        ans = 1;
    } else if (h * w % 2 == 0){
        ans = h * w / 2;
    } else {
        ans = h * w / 2 + 1;
    }

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 3548
#include <iostream>
#include <string>

using namespace std;

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

    
    int ans = 700;

    for (int i = 0; i < S.length(); i++){
        if (S[i] == 'o'){
            ans += 100;
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define arrprint(v,n) rep(i,0,n-1)cout << v[i] << " ";cout << endl;
#define matprint(v,n,m) rep(i,0,n-1){rep(j,0,m-1){cout << v[i][j] << " ";}cout << endl;}
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
typedef long long ll;
typedef pair<int,int> P;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; //小さいものから取り出す

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

    cout << (double)3.141592 * 2 * r << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 3792
#include<stdio.h>

int main(){
  int a,b,d,r;
  double f;
  scanf("%d %d",&a,&b);
if(a >= 1&&b <= 1000000000){
  d = a / b;
  r = a % b;
  f = (double)a / b;
  printf("%d %d %lf\n",d,r,f);
}
  return 0;
}

Measured memory_bytes: 1820
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fi first
#define se second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>
#define LEAD (lead && !i)
#define LIM (lim && i == buc[pos])
 
using std::cin;
using std::cout;
using std::endl;
 
typedef long long ll;
typedef unsigned long long ull;
 
const int N = 100000 + 5;
const int M = 1000 + 5;
const int K = 1e7 + 5;
const int MOD = 1e9 + 7;
const int inv2 = 500000004;
const int LOG = 40;
const ull BASE = 19260817;
const int INF = 0x3f3f3f3f;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };
// const double PI = acos(-1);
const double PI = 3.14159;

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
 
template<class T>
inline T readT() {
    T res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}
#define read readT<int>

namespace Comb{
const int N = 10 + 5;
inline void exgcd(ll a, ll b, ll &g, ll &x, ll &y) {
    if (!b) g = a, x = 1, y = 0;
    else exgcd(b, a % b, g, y, x), y -= x * (a / b);
}
 
inline ll inv(ll a) {
    ll g, res, tmp;
    exgcd(a, MOD, g, res, tmp);
    return ((res % MOD) + MOD) % MOD;
}
 
ll f[N], invFact[N];
 
inline void prepare() {
    f[0] = 1;
    int n = 200000;
    for (int i = 1; i <= n; i++) f[i] = f[i - 1] * i % MOD;
    invFact[n] = inv(f[n]);
    for (int i = n - 1; i >= 1; i--) invFact[i] = invFact[i + 1] * (i + 1) % MOD;
}
 
inline ll C(int n, int m) {
    if (!m) return 1;
    if (n == m) return 1;
    if (m > n) return 0;
    if (m < 0) return 0;
    return f[n] * invFact[m] % MOD * invFact[n - m] % MOD;
}
}

int n;
ll f[2005][2005], a[2005], x;
ll g[2005];

int main() {
    cin >> n >> x;
    for (int i = 0; i < n; i++) cin >> a[i];
    memset(f, 0x3f, sizeof(f));
    memset(g, 0x3f, sizeof(g));
    for (int i = 0; i < n; i++) f[0][i] = a[i];
    for (int i = 1; i < n; i++) {
        for (int j = 0; j < n; j++) {
            // f[i][j]
            chkmin(f[i][j], f[i - 1][j]);
            chkmin(f[i][j], a[((j - i) % n + n) % n]);
        }
    }
    ll ans = LLONG_MAX;
    for (int i = 0; i < n; i++) {
        ll tmp = 0;
        for (int j = 0; j < n; j++) {
            tmp += f[i][j];
        }
        chkmin(ans, tmp + i * x);
    }

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

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

int main() {
  int N;
  cin >> N;
  int A[N];
  cin >> A[0];
  bool array[N];
  for(int i=0;i<N;i++){
    array[i] = true;
  }
  bool kotae = true;
  int j;
  for(int i=1;i<N;i++){
    cin >> A[i];
    if(A[i] - A[i-1] < 0) {
      A[i-1] = A[i-1] - 1;
      array[i-1] = false;
      j = i-1;
      while(true) {
        if(A[j] - A[j-1] < 0 && array[j-1] == false) {
          kotae = false;
          break;
        }
        else if(A[j] - A[j-1] < 0) {
          A[j-1] = A[j-1] - 1;
          array[j-1] = false;
          j = j-1;
        }
        else {
          break;
        }
      }
    }
  }
  for(int i=1;i<N;i++){
    if(A[i] - A[i-1] < 0) {
      kotae = false;
      break;
    }
  }
  if(kotae) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = 2e9;
const int MAX_N = 1;

int main() {
  vi a(3); cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());
  int ans = 0;
  ans += a[1] - a[0];
  ans += a[2] - a[1];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input=sys.stdin.readline
from random import randint
##import numpy as np
#sys.setrecursionlimit(10**7)
mo=10**9+7
def cin():
    return map(int,sin().split())
def ain():            
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())

for _ in range(1):
    a,b,c=cin()
    if(b*1.0>=(a/c)):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 76616
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

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

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	vector<int> a;
	for (int i = 0; i < n; i++)
	{
		int q;
		cin >> q;

		int x;

		switch (q)
		{
			case 0:
				cin >> x;
				a.push_back(x);
				break;

			case 1:
				cin >> x;
				println(a[x]);
				break;

			case 2:
				a.pop_back();
				break;
		}
	}
}




Measured memory_bytes: 3936
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll INF=1e18;

int main() {
  int k;
  cin>>k;
  string s="ACL";
  rep(i,k-1){
    s+="ACL";
  }
  cout<<s;
}


Measured memory_bytes: 3600
def main():
    from sys import setrecursionlimit, stdin
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**9+10
    N,K = LMIIS()
    ans = 0

    if K % 2 == 1:
        print((N//K)**3)
        return
    
    
    

    #(N//K) ありうるKの倍数の数(0以外)

    #a,b,c,全部がKの倍数 のパターン
    ans += (N//K)**3
    #a,b,c,全部がKの倍数+K//2　のパターン
    ans += ((N-K//2)//K+1)**3
    print(ans)


    


    





    
main()

Measured memory_bytes: 38384
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility> // pair
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm> // sort
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <bitset>
#define PI acos(-1)
typedef long long ll;
const long long mod = 1000000007;
const long long maxn = 1e6 + 5; 
using namespace std;

int main()
{
	ll A, B, N, x;
	scanf("%lld %lld %lld",&A, &B, &N);
	x = min(N, B - 1);
	printf("%d\n",(A * x) / B);
	return 0;
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
};



int main(){
  int A,B,C;
  cin>>A>>B>>C;

  if(A+B>=C){
    cout<<"Yes"<<"\n";
  }else{
    cout<<"No"<<"\n";
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#define MAX 101

int A[MAX];
int n;

void print() {
    for (int i = 0; i < n; i++) {
        if (i) std::cout << " ";
        std::cout << A[i];
    }
    std::cout << std::endl;
}

void insertionSort(int A[], int n) {
    for (int i = 1; i < n; i++) {
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        print();
    }
}

int main() {
    scanf("%d", &n);
    
    for (int i = 0; i < n; i++) {
        std::cin >> A[i];
    }
    
    print();
    insertionSort(A, n);
    
    return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
using namespace std; using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
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;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n,a,b;
    IN(n,a,b);
    ll x = 0,y=0,z=0;
    rep(i,n){
        int s;
        cin >>s;
        if(s <= a) x++;
        else if(s <= b) y++;
        else z++;
    }
    cout << min({x,y,z}) << endl;
}

Measured memory_bytes: 256
from collections import deque
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=deque(map(int,input().split()))
a=deque()
t=0
for i in range(N):
    if t+A[i]<=K:
        a.append(A[i])
        t+=A[i]
    else:
        break
m=K-t
ans=len(a)
while B and B[0]<=m:
    m-=B[0]
    B.popleft()
    ans+=1
if not B:
    print(ans)
    exit()
c=ans
while a:
    m+=a.pop()
    c-=1
    while B and B[0]<=m:
        m-=B[0]
        B.popleft()
        c+=1
    ans=max(ans,c)
print(ans)

Measured memory_bytes: 40532
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}

int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  ll a,b,x;cin>>a>>b>>x;
  ll ans=b/x-a/x;
  if(a%x==0)ans++;
  cout(ans);
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main(){
    cin>>N>>K;
    ++N;
    vec h(N,0);
    rep(i,N-1) cin>>h[i+1];
    mat dp(N, vec(N - K, INF));
    //dp[i][j]:右端i番目、個数j個
    dp[0][0] = 0;
    reps(i,1,N){
        rep(j,N - K){
            ll &now = dp[i][j];
            if(j != 0){
                rep(k, i) {
                    now = min(now, dp[k][j-1] + max(0LL, h[i] - h[k]));
                }
            }
        }
    }
    /*rep(i,N){
        rep(j,N - K) cout<<dp[i][j]<<' ';
        cout<<endl;
    }*/
    ll ans = INF;
    rep(i,N){
        ans = min(ans, dp[i][N - K - 1]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
vector<string> ans;
char tmpstr[100];
inline void Plus(int i, int j, int k) {
	sprintf(tmpstr, "+ %d %d %d", i, j, k);
	ans.emplace_back(tmpstr);
}
inline void Less(int i, int j, int k) {
	sprintf(tmpstr, "< %d %d %d", i, j, k);
	ans.emplace_back(tmpstr);
}
int tot, lg2[30], a[30], b[30];
void gao(int *a, int t) {
	for (int i = 29; i >= 0; i--) {
		a[i] = ++tot;
		++tot;
		for (int j = 0; j < i; j++) {
			Plus(lg2[j], a[i], a[i]);
		}
		for (int j = i + 1; j <= 29; j++) {
			Plus(a[j] + 1, a[i], a[i]);
		}
		Less(a[i], t, a[i]);
		Plus(a[i], a[i] + 1, a[i] + 1);
		for (int j = 0; j < i; j++) {
			Plus(a[i] + 1, a[i] + 1, a[i] + 1);
		}
	}
}
int main() {
	Plus(0, 1, 3);
	Less(2, 3, 3);
	lg2[0] = tot = 3;
	for (int i = 1; i <= 29; i++) {
		lg2[i] = ++tot;
		Plus(tot - 1, tot - 1, tot);
	}
	gao(a, 0);
	gao(b, 1);
	for (int i = 0; i <= 29; i++) {
		for (int j = 0; j <= 29; j++) {
			++tot;
			Plus(a[i], b[j], tot);
			Less(3, tot, tot);
			for (int k = 0; k < i + j; k++) Plus(tot, tot, tot);
			Plus(tot, 2, 2);
		}
	}
	printf("%d\n", (int)ans.size());
	for (int i = 0; i < (int)ans.size(); i++) puts(ans[i].c_str());
	return 0;
}

Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
template <class T>
ostream& operator<<(ostream& s, vector<T>& d) {
    REP(i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " ");
    return s;
}
using Int = long long;

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

    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'x') {
            cnt++;
            if (cnt == 2) {
                cout << i << endl;
                return 0;
            }
        } else {
            cnt = 0;
        }
    }
    cout << n << endl;
}



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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

 int main(){
string N;
cin >> N;
REP(i, N.size()) if(N.at(i) == '9') {
  yes;
 return 0;
}
no;
 }

Measured memory_bytes: 256
n = int(input())
#n, W = map(int, input().split())
al = list(map(int, input().split()))
#al=[list(input()) for i in range(n)]


def div2(v, a):
    res = 0
    if v == 0:
        return res
    while v % a == 0:
        v = v//a
        res += 1
    return res


ans = 0
for a in al:
    ans += div2(a, 2)
print(ans)


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

#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n - 1; i > -1; --i)
#define all(a) begin(a), end(a)
#define rall(a) rbegin(a), rend(a)
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;
const ll digit=50;

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for (ll i = 0; i < n; ++i){
        cin >> a[i];
    }
    ll dp[100][2];
    memset(dp, -1, sizeof(dp));
    int cnt = 0;
    dp[0][0] = 0;
    for(ll i = 0; i < digit; ++i) {
        ll mask = 1ll << (digit - i - 1);
        cnt = 0;
        for (ll j = 0; j < n; ++j) if (a[j] & mask) ++cnt;

        if (dp[i][1] != -1) {
            dp[i + 1][1] = max(dp[i + 1][1], dp[i][1] + max(mask * cnt, mask * (n - cnt)));
        }
        if (dp[i][0] != -1) {
            if (k & mask) {
                dp[i + 1][1] = max(dp[i + 1][1], dp[i][0] + mask * cnt);
                dp[i + 1][0] = max(dp[i + 1][0], dp[i][0] + mask * (n - cnt));
            } else {
                dp[i + 1][0] = max(dp[i + 1][0], dp[i][0] + mask * cnt);
            }
        }
    }
    cout << max(dp[digit][0], dp[digit][1]) << endl;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+1;
const ll p=1e9+7;
priority_queue<ll>q;
ll a[3*N],b[N];
int main()
{
    int n,i;
    cin>>n;
    for(i=0;i<3*n;i++)scanf("%lld",a+i);
    ll sum=0,ans;
    for(i=0;i<n;i++)
    {
        sum+=a[i];
        q.push(-a[i]);
    }
    b[0]=sum;
    for(;i<2*n;i++)
    {
        sum+=a[i];
        q.push(-a[i]);
        sum+=q.top();
        b[i-n+1]=sum;
        q.pop();
    }
    sum=0;
    reverse(a,a+3*n);
    while(!q.empty())q.pop();
    for(i=0;i<n;i++)
    {
        sum+=a[i];
        q.push(a[i]);
    }
    ans=b[n]-sum;
    for(;i<2*n;i++)
    {
        sum+=a[i];
        q.push(a[i]);
        sum-=q.top();
        ans=max(ans,b[2*n-i-1]-sum);
        q.pop();
    }
    cout<<ans;
	return 0;
}


Measured memory_bytes: 4340
#include <bits/stdc++.h>
 
using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
bool dp[100100];
 
 
int main () {
    int X, Y, Z;
    scanf("%d%d%d",&X,&Y,&Z);

    printf("%d %d %d\n",Z,X,Y);

}

Measured memory_bytes: 3784
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
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 putsp(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;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//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;}

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1000000007;

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

//********************************template END****************************************//

void solve(void){
	int N;
	cin >> N;

	ll ans = 0;

	rep(N, i)
	{
		ll d;
		cin >> d;
		int cnt = 0;
		while(d % 2 == 0)
		{
			cnt++;
			d /= 2;
		}
		ans += cnt;
	}
	cout << ans << endl;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> *i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> " " >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

const int MOD=1e9+7;
signed main() {
    int n;
    cin>>n;
    vector<string> s(2);
    cin>>s[0]>>s[1];
    int ans=1;
    REP(i,n) {
        if(s[0][i]==s[1][i]) {
            if(i==0) {
                ans*=3;
            }
            else if(s[0][i-1]==s[1][i-1]) {
                ans*=2;
            }
        } else {
            if(i==0) {
                ans*=6;
            }
            else if(s[0][i-1]!=s[1][i-1]) {
                ans*=3;
            } else {
                ans*=2;
            }
            i++;
        }
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
/*
* @Author Silviase(@silviasetitech)
* For ProCon
*/

import java.util.*;
import java.lang.*;
import java.math.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        String w = sc.next();
        List l = new ArrayList<Integer>();
        for (int i = 0; i < w.length(); i++) {
            if (w.charAt(i) == 'B') {
                if (l.size() > 0){
                    l.remove(l.size()-1);
                }
            } else {
                l.add(w.charAt(i));
            }
        }
        for (int i = 0; i < l.size(); i++) {
            System.out.print(l.get(i));
        }
        System.out.println("");


        sc.close();
    }

}





Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  char s[n];
  for(int i=0;i<n;i++){
    cin >> s[i];
    if(s[i]=='Y'){
      cout << "Four";
      return 0;
    }
  }
  cout << "Three";
}


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

#define ll long long
#define db double
#define deb(x) cout<<#x<<": "<<x<<"\n"
#define all(x) x.begin(),x.end()
#define fo(i, n) for(i=0 ; i<n ; i++)
#define Fo(i, k, n) for(i=k ; i<n ; i++)

using namespace std;

const ll mod = 1000000007;
const ll N = 200005;  // array size
const ll inf = 10000000000000000;


void print(vector<ll> v) {
    ll i;
    fo(i, v.size())cout << v[i] << " ";
    cout << "\n";
}

vector<ll> read(ll n) {
    ll i;
    vector<ll> arr(n, 0);
    fo(i, n)cin >> arr[i];
    return arr;
}

vector<ll> read(ll n, ll k) {
    ll i;
    vector<ll> arr(n + k, 0);
    Fo(i, k, n + k)cin >> arr[i];
    return arr;
}

bool isEven(ll n) {
    return n % 2 == 0;
}

bool isOdd(ll n) {
    return n % 2 == 1;
}


void solve() {
    ll t;
    cin >> (t);
    while (t--) {

        ll i, j, k, n, m, p, q, x, y, a, b, l, r;


    }
}


bool cmp(pair<string, pair<ll, ll> > p1, pair<string, pair<ll, ll> > p2) {
    if (p1.first != p2.first) {
        return (p1.first < p2.first);
    }

    return (p1.second.first > p2.second.first);
}

int main() {


    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


    ll i, j, k, n, m, p, q, x, y, a, b, l, r;


    vector<pair<string, pair<ll, ll> > > arr;
    cin >> n;
    fo(i, n) {
        string str;
        cin >> str;
        cin >> x;
        arr.push_back({str, {x, i + 1}});
    }

    sort(all(arr), cmp);

    fo(i,n){
        cout<<arr[i].second.second<<"\n";
    }

    return 0;
}




Measured memory_bytes: 3660
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using lint=long long;
using namespace std;

int main()
{
	int N,M;
	
	cin >> N >> M;
	vector<vector<int>> edge(N);
	vector<int> in(N);
	
	for(int i=0;i<M;i++)
	{
		int x,y;
		cin >> x >> y;
		x--;
		y--;
		edge[x].push_back(y);
		in[y]++;
	}
	
	//tsort and dp
	queue<int> q;
	for(int i=0;i<N;i++)
		if(in[i]==0)
			q.push(i);
	int dp[100010]={};
	while(!q.empty())
	{
		int cur=q.front();
		q.pop();
		for(auto&& i:edge[cur])
		{
			//tsort
			in[i]--;
			if(in[i]==0)
				q.push(i);
			//dp
			dp[i]=max(dp[i],dp[cur]+1);
		}
	}
	
	//ans
	int ans=0;
	for(auto&& i:dp)
		ans=max(ans,i);
	
	cout << ans << endl; 
	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;


signed main(){
    int n,k;
    cin>>n>>k;
    if(k<=(n+1)/2) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
 
   
    return 0;
}

Measured memory_bytes: 256
def third_root(q):
    x=q/2
    while abs(x**3-q)>=q*10**(-5):
        x=x-(x**3-q)/(3*x**2)
    return x
while 1:
    q=int(input())
    if q==-1:break
    ans=third_root(q)
    print(ans)

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

#define faster      ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi          acos(-1.0)
#define nl          '\n'

///Library
#define mem(a,b)    memset(a,b,sizeof(a))
#define all(a)      a.begin(),a.end()
#define Sort(x)     sort(x.begin(),x.end())
#define Reverse(x)  reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b)    __gcd(a,b)
#define lcm(a,b)    (a*(b/gcd(a,b)))
#define sq(x)       (x)*(x)

#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min(b,min(c,d)))
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max(b,max(c,d)))
#define ABS(x)             ((x)<0?-(x):(x))
#define pb                 push_back
#define mod                1000000007
#define end                printf("\n")
#define yes                printf("YES\n")
#define no                 printf("NO\n")

///data type
typedef long long int ll;
typedef unsigned long long int  llu;

int main()
{
	faster
	ll a,b,c,ans,x,y;
	cin>>a>>b>>c;
	if(a>=0)
	{
		x=a/c;
		if(x==b)cout<<a-(c*x)<<nl;
		else if(x>b)cout<<a-(c*b)<<nl;
		else{
			a=a-(c*x)-c;
			x++;
			y=b-x;
			if(y%2==0)cout<<abs(a)<<nl;
			else cout<<a+c<<nl;
		}
	}
	else{
		ans=abs(a);
		x=ans/c;
		if(x==b)cout<<abs(a+c*x)<<nl;
		else if(x>b)cout<<abs(a+(c*b))<<nl;
		else{
			a=a+(c*x)+c;
			x++;
			y=b-x;
			if(y%2==0)cout<<abs(a)<<nl;
			else cout<<abs(a-c)<<nl;
		}
	}
	return 0;

}


Measured memory_bytes: 3588