akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline long toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline long toLong(string s) {long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const int INF = 10000;


int main(){
	int n,a,b,c,x;
	while(cin>>n>>a>>b>>c>>x){
		if(n==0&&a==0)break;
		int cnt=0;
		REP(i,n){
			int y;cin>>y;
			while(x!=y){
				if(cnt>=10001)break;
				x=(a*x+b)%c;cnt++;
			}
			if(x==y&&i!=n-1){
				x=(a*x+b)%c;cnt++;
			}
		}
		if(cnt<=10000)cout<<cnt<<endl;
		else cout<<-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include<stdio.h>
#define max 1000000
int main(void){
  int prime[max];
  int n,i,j,cnt;

  prime[0]=prime[1]=0;
  for(i=2;i<max;i++)prime[i]=1;
  
  for(i=2;i*i<max;i++)
    if(prime[i])
      for(j=2*i;j<max;j+=i)
	prime[j]=0;
  
  while(scanf("%d",&n)!=EOF){
    cnt=0;
    
    for(i=2;i<=n;i++)
      cnt+=prime[i];
    printf("%d\n",cnt);
    
  }
  return 0;
}

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

main(){
	int n;
	cin >> n;
	char s[n];
	int red=0;
	int blue=0;
	for(int i=0;i<n;i++){
		cin >> s[i];
		if(s[i]=='R'){
			red++;
		}else if(s[i]=='B'){
			blue++;
		}
	}
	if(red>blue){
		cout << "Yes" <<endl;
	}else{
		cout << "No" <<endl;
	}
}


Measured memory_bytes: 256
var s = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");
var n_m = s[0].split(" ").map(e => parseInt(e, 10));
var town = new Array(n_m[0]).fill(0);
var roads;
for (var i = 1; i <= n_m[1]; i++) {
  roads = s[i].split(" ").map(e => parseInt(e, 10));
  town[roads[0] - 1]++;
  town[roads[1] - 1]++;
}
console.log(town.join("\n"));

Measured memory_bytes: 7372
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int,input().split()))

mFR = [0]*(N+1)
for i in range(N):
    mFR[1] += A[i]*(pow(-1,i))
for i in range(2,N+1):
    mFR[i] = A[i-2]*2-mFR[i-1]
print(*mFR[1:])


Measured memory_bytes: 19932
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main() {
    fastio
	ll n,t,i,j,x,k;
    string s;
    
    cin>>s;
    x=0;
    
    for(i=0;i<s.length();i++)
    x+=(s[i]-'0');
    
    if(x%9) cout<<"No\n";
    else cout<<"Yes\n";
	
	return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef tree<int,null_type,less<int >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v);
#ifdef APURBA
#define HERE cout<<"here - "<<__LINE__<<"\n";
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it)
{
    cout<<endl;
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cout << *it << " = " << a << " ";
    err(++it, args...);
}
#else
#define HERE
#define debug(args...)
#endif
const int N = 1e6+5;
const ll mod = 1e9+7 ;
typedef pair<int,int> pii;
ll bigmod(ll a, ll b)
{
    a%=mod;
    ll ans =1;
    while(b>0)
    {
        if(b&1)
        {
            ans = (ans*a)%mod;
        }
        a= (a*a)%mod;
        b>>=1;
    }
    return ans;
}

void TEST_CASES(int cas)
{
    ll n;
    cin>>n;
    if(n==1)
    {
        cout<<0<<endl;
        return;
    }

    ll ans = bigmod(10,n) - bigmod(9,n) - bigmod(9,n) + bigmod(8,n);
    ans = (ans%mod)+mod;
    ans%=mod;
    cout<<ans<<endl;
}



/*

*/

int main()
{
#ifndef APURBA
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    int t=1,cas=0;
    //cin>>t;
    while(t--)
    {
        TEST_CASES(++cas);
    }
    return 0;
}



template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v)
{
    for(auto i:v)
    {
        os<<"Key : "<<i.first<<" , Value : "<<i.second<<endl;
    }
    return os;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

/*
*/

ll n,dp[1000010][2];
string s;

void init(){
	cin>>s;
	n=s.size();
}

int main(void){
	init();
	dp[n][0]=0;
	dp[n][1]=1e9;
	irep(i,n){
		ll d=s[i]-'0';
		dp[i][0]=min(dp[i+1][0]+d,dp[i+1][1]+d+1);
		dp[i][1]=min(dp[i+1][0]+10-d,dp[i+1][1]+10-d-1);
		// cerr<<dp[i][0]<<","<<dp[i][1]<<endl;
	}
	cout<<min(dp[0][0],dp[0][1]+1)<<endl;
	return 0;
}

Measured memory_bytes: 17028
from collections import deque

n, q = map(int, input().split())

to = [[] for i in range(n)]

for _ in range(n - 1):
    a, b = map(int, input().split())
    to[a - 1].append(b - 1)

point = [0] * n

for _ in range(q):
    p, x = map(int, input().split())
    point[p - 1] += x

node = [0] * n
node[0] = point[0]

d = deque([0])

while len(d) > 0:
    n_now = d.popleft()

    for n_next in to[n_now]:
        d.append(n_next)
        node[n_next] = node[n_now] + point[n_next]

for i in range(n):
    print(node[i], end="")
    if i != n - 1:
        print(" ", end="")

print("")


Measured memory_bytes: 115788
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String answer = "";
        int length = line.length();
        for(int i = 0; i < length; i++){
            char ch = line.charAt(i);
            if(Character.isLowerCase(ch)){
                answer += Character.toUpperCase(ch);
            }
            else{
                answer += Character.toLowerCase(ch);
            }
        }
        System.out.println(answer);
    }    
}


Measured memory_bytes: 31432
fun main() {
  val n = readLine()!!.toInt()
  val l = readLine()!!.split(" ").map(String::toInt).sorted()
  
  var ans = 0
  
  for (i in 0 .. (l.lastIndex-2)) {
    for (j in i .. (l.lastIndex-1)) {
      if(l[i] == l[j]) continue
      for(k in j .. l.lastIndex) {
        if(l[j] == l[k]) continue
        if(l[k] < l[i] + l[j]) ans++
      }
    }
  }
  
  println(ans)
}

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

using namespace std;

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

typedef vector<string> vs;

int n;

bool check(int x, int y) {
	return x >= 0 && x < n && y >= 0 && y < n;
}

int main() {
	int N;
	cin >> N;
	while (N--) {
		cin >> n;
		vs str(n);
		REP(i, n) str[i].resize(n, ' ');
		
		int dx[4] = { 0, 1, 0, -1 };
		int dy[4] = { -1, 0, 1, 0 };
		int nx = 0, ny = n - 1, d = 0, cnt = 0;
		
		while (true) {
			if (cnt == n) break;
			str[ny][nx] = '#';
			
			if (!check(nx + dx[d], ny + dy[d]) ||
				(check(nx + dx[d]*2, ny + dy[d]*2) && str[ny + dy[d]*2][nx + dx[d]*2] == '#') ) {
				d = (d + 1) % 4;
				cnt++;
			}
			else {
				nx += dx[d]; ny += dy[d];
			}
		}
		
		REP(i, n) cout << str[i] << endl;
		if (N != 0) putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
         
using namespace std;
 
#define ll  long long
#define mod 1000000007
#define pb push_back
#define pie 3.141592653589



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


    ll i,n,n2,m,t,j,l,r,pos,mpos,f=0,k,p,n1,z,q,x,y,x1,y1,x2,y2,x3,y3,x4,y4,w;

    cin>>n>>w;
    ll wt[n],ct[n];
    for(i=0;i<n;i++)
        cin>>wt[i]>>ct[i];
    vector<ll> dp1(w+1,0);
    vector<ll> dp2(w+1,0);
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=w;j++)
        {
            if(j>=wt[i-1])
            {
                dp2[j]=max(dp1[j],dp1[j-wt[i-1]]+ct[i-1]);
            }
            else
            {
                dp2[j]=dp1[j];
            }
        }
        dp1=dp2;

    }
    
    cout<<dp1[w];




  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define _Pi 3.1415926535
#define _MOD = 1e9+7;
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> v(n), c(n);
    rep(i,n) cin >> v[i];
    rep(i,n) cin >> c[i];
    rep(i,n) v[i] -= c[i];
    sort(v.begin(),v.end());

    cout << accumulate(upper_bound(v.begin(),v.end(),0),v.end(),0) << endl;

    return 0;
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d", $n);
$x_arr = explode(' ', trim(fgets(STDIN)));

$min = PHP_INT_MAX;
for ($i = 1; $i <= 100; ++$i) {

    $sum = 0;
    foreach ($x_arr as $x) {
        $sum += pow($x - $i, 2);
    }

    if ($sum < $min) {
        $min = $sum;
    }
}

echo $min;


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

bool check[20][20];

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

	int H,W;
	int h,w;

	cin >> H >> W;
	cin >> h >> w;

	memset(check,false,sizeof(check));

	int res = H*W;

	for(int i=0;i<h;i++)
	{
		for(int j=0;j<W;j++)
		{
			if(check[i][j]==false)
			{
				res--;
				check[i][j] = true;
			}
		}
	}

	for(int i=0;i<H;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(check[i][j]==false)
			{
				res--;
				check[i][j] = true;
			}
		}
	}

	cout << res << '\n';
	
	return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
# define eps 1e-8
# define INF 1e20
# define pi  acos(-1.0)
# define MX  1005

int lens, lent;
char s[MX];
char t[MX];

bool match(int x,char *p)
{
    for (int i=0;i<lent;i++)
    {
        if (x+i>=lens) return 0;
        if (s[i+x]=='?') continue;
        if (s[i+x]!=p[i]) return 0;
    }
    return 1;
}

int main()
{
    scanf("%s%s",s,t);
    int ok=-1;
    lens = strlen(s);
    lent = strlen(t);
    for(int i=0;i<lens;i++)
    {
        if (match(i,t))
        {
            ok=i;
        }
    }
    if (ok!=-1)
    {
        for (int j=0;j<lent;j++)
                s[ok+j] = t[j];
        for (int i=0;i<lens;i++)
            if (s[i]=='?') s[i]='a';
        printf("%s\n",s);
    }
    else printf("UNRESTORABLE\n");

    return 0;
}


Measured memory_bytes: 256
import math
list_int = [int(e) for e in input().split()]
N = list_int[0]
M = list_int[1]

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)
N_cnt = 0 
M_cnt = 0
if N == 2:
    N_cnt = 1
elif N <= 1:
    N_cnt = 0
else:
    N_cnt = permutations_count(N, 2)/2
if M < 2:
    M_cnt = 0
elif M == 2:
    M_cnt = 1
else:
    M_cnt = permutations_count(M, 2)/2
ans_cnt = N_cnt + M_cnt
print(int(ans_cnt))

Measured memory_bytes: 3064
N = int(input())
ans1 = False
ans2 = False
ans3 = False
for i in range(N):
  D1, D2 = map(int, input().split())
  if D1 == D2 and ans1 == False:
    ans1 = True
  elif D1 == D2 and ans1 == True and ans2 == False:
    ans2 = True
  elif D1 == D2 and ans1 == True and ans2 == True and ans3 == False:
    ans3 = True
    print("Yes")
    exit()
  elif D1 != D2:
    ans1 = False
    ans2 = False
    ans3 = False
print("No")

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

const int mod = 998244353;

template <int Modulus>
struct modint {
    ll x;  // typedef long long ll;
    modint(ll x = 0) : x((x % mod + mod) % mod) {}
    modint operator-() const { return modint(-x); }
    modint& operator+=(const modint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    modint& operator-=(const modint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    modint& operator*=(const modint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    modint operator+(const modint a) const { return modint(*this) += a; }
    modint operator-(const modint a) const { return modint(*this) -= a; }
    modint operator*(const modint a) const { return modint(*this) *= a; }
    modint pow(ll t) const {
        if (!t) return 1;
        modint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    modint inv() const { return pow(mod - 2); }
    modint& operator/=(const modint a) { return *this *= a.inv(); }
    modint operator/(const modint a) const { return modint(*this) /= a; }
};
template <int Modulus>
istream& operator>>(istream& is, modint<Modulus>& a) {
    return is >> a.x;
}
template <int Modulus>
ostream& operator<<(ostream& os, const modint<Modulus>& a) {
    return os << a.x;
}

signed main() {
    using mint = modint<mod>;
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    vector<vector<mint>> dp(c + 1, vector<mint>(d + 1, 0));
    dp[a][b] = 1;
    for (int i = a; i <= c; ++i)
        for (int j = b; j <= d; ++j) {
            if (i == a && j == b) continue;
            // A or B = A + B - (A and B)
            dp[i][j] = dp[i - 1][j] * j + dp[i][j - 1] * i -
                       dp[i - 1][j - 1] * (i - 1) * (j - 1);
        }
    cout << dp[c][d] << endl;
}

Measured memory_bytes: 73632
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    lli ans=0;
    lli n;
    cin>>n;
    vi a(n);
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n){
        rep(j,n){
            if(i<=j){ 
                continue;
            }
            ans+=a[i]*a[j];
        }
    }
    out(ans);
}

Measured memory_bytes: 3592
#!/usr/bin/env python3
import sys


def solve(X: int, N: int, p: "List[int]"):
    if not X in p:
        print(X)
        return
    for i in range(1, 100):
        left = X - i
        if not left in p:
            print(left)
            return
        right = X + i
        if not right in p:
            print(right)
            return
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(X, N, p)

if __name__ == '__main__':
    main()


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

int main() {
  int64_t N;
  cin>>N;
  vector<int64_t> vecA(N);
  vector<int64_t> vecB(N);
  for(int i=0;i<N;i++){
    cin>>vecA.at(i)>>vecB.at(i);
  }
  int64_t kai=0;
  int64_t rui=0;
  for(int i=N-1;i>=0;i--){
    int64_t son;
    if(vecA.at(i)+rui>=vecB.at(i)){
      son=(((vecA.at(i)+rui)+vecB.at(i)-1)/vecB.at(i))*vecB.at(i)-vecA.at(i)-rui;
    }
    else{
      if(vecA.at(i)+rui==0) son=0;
      else son=vecB.at(i)-vecA.at(i)-rui;
    }
    kai+=son;
    rui+=son;
  }
  cout<<kai<<endl;
    
  
  
  
  
}

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

#define SIZE(a) ((int)(a).size())
#define REP(i, n) for (int i = 0; i < (n); ++i)

typedef long long ll;

const int N = 200005;
const int A = 2;

int n;
ll l;

int trie[N][A], str[N], sz = 1;

void add(const string& s) {
	int v = 1;
	for (auto c : s) {
		c -= '0';
		if (!trie[v][c]) trie[v][c] = ++sz;
		v = trie[v][c];
	}
	str[v] = 1;
}

ll go(int v, int depth = 0) {
	if (!v) {
		int now = 1;
		ll h = l - depth + 1;
		while (h % 2 == 0) h /= 2, now *= 2;
		return 1+now;
	}
	if (str[v]) return 0;
	auto lf = go(trie[v][0], depth+1);
	auto rt = go(trie[v][1], depth+1);
	return lf ^ rt;
}

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

	cin >> n >> l;
	REP(i, n) {
		string s;
		cin >> s;
		add(s);
	}
	cout << (go(1) > 0 ? "Alice" : "Bob") << '\n';

	return 0;
}

Measured memory_bytes: 4332
#include <stdio.h>

int main(void){
    int a;
    int b;
    int c;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    if(a<b&&b<c){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    
    return 0;
}


Measured memory_bytes: 1852
import java.util.Scanner;

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

		int N = sc.nextInt();
		long p[] = new long[N];

		long min = sc.nextLong();
		long max = min;

		long ans = 1;

		for (int i = 1; i < p.length; i++) {
			p[i] = sc.nextLong();
			if (min > p[i]) {
				ans++;
				min = p[i];
			}
			if (max < p[i]) {
				max = p[i];
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 65312
def main(d):
    t=0
    for i in range(-10**3,10**3):
        if t==0:
            for j in range(-10**3,10**3):
                if i**5-j**5==d:
                    print(i,j)
                    t+=1
                    break
d=int(input())
main(d)

Measured memory_bytes: 9080
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

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

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

ans = 0
for a in A:
    while a % 2 == 0:
        a //= 2
        ans += 1
print(ans)


Measured memory_bytes: 23660
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;

// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 

#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 

#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 


#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)

#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>

// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;

#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)1e5+5

void solve(){
    string s, t;
    cin>>s>>t;
    ll ans = 0;
    loop(i,0,3){
        if(s[i] == t[i]) ans++;
    }
    print(ans);
}

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

    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }

struct Tmp
{
public:
  Tmp(int N);
};

Tmp::Tmp(int N){}

void solve(void)
{
  int A, B, M; cin >> A >> B >> M;
  vector<int> SA(A);
  for (auto& a : SA) {
    cin >> a;
  }
  vector<int> SB(B);
  for (auto& b : SB) { cin >> b; }

  auto itrMinA = boost::min_element(SA);
  auto itrMinB = boost::min_element(SB);

  int res = *itrMinA + *itrMinB;
  for (int _ = 0; _ < M; ++_) {
    int x, y, c; cin >> x >> y >> c;
    --x; --y;
    auto cost = SA[x] + SB[y] - c;
    chmin(res, cost);
  }
  
  cout << res << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define printV(v) for(int i=0;i<v.size();i++){cout << v[i]<< " ";} cout << endl
#define printRev(v) for(int i=v.size()-1;i >= 0;i--){cout << v[i] << " ";} cout << endl
#define sortV(v) sort(v.begin(),v.end())
#define revV(v) reverse(v.begin(),v.end())
#define FOR(i,n) for(int i=0;i<n;i++)
    
    ll a,b,c,d,e,f,g,n,m,k,t,p,x,h,w,q;
    ll curr = 1;
    ll mod = 998244353;


    void solve(){
       cin >> n >>m;
       ll one = n % m;
       ll two = (m - n% m);
       cout << min(one,two);
    }
  
   
    int main(){
    ios_base::sync_with_stdio(false);
   
    int cases = 1;
    //cin >> cases;
  
    while(cases--){ 
        solve();
    }

    return 0;

    }

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;

int P[10010];
void init(int n){
    for(int i=0;i<n;++i)P[i]=i;
}
int root(int a) {
    if(P[a]==a)return a;
    return (P[a]=root(P[a]));
}
bool is_same_set(int a,int b){
    return root(a) == root(b);//代表元を求める
}
void unite(int a,int b){
    P[root(a)]=root(b);
}//対set,グラフ？

double dot_product(xy_t a, xy_t b) { return (conj(a)*b).real(); }//内積
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }//外積
xy_t projection(xy_t p, xy_t b) { return b*dot_product(p,b)/norm(b); }//投影
//対図形

#define mod 1000000007
ll f[2001];
//int n,k とかしておく

ll pw(ll x, ll y){//euclidの互除法より
    ll a= 1;
    while(y){
        if(y&1){//奇数なら
            a = a*x%mod;
        }
        x = x*x%mod;
        y /= 2;
    }
    return a;
}

ll modinv(ll x){//逆元を求める
    return pw(x, mod - 2 );
}

ll comb(int n,int r){
    if(n<r){
        return 0;
    }
    return f[n] * modinv(f[r])%mod*modinv(f[n-r])%mod;
}//対combination

int main(){
    int n,s;
    cin >> n;
    pair<pair<string,int>,int > res[100];
    string in;
    int t;
    rep(i,n){
        cin >> in >> t;
        res[i]=make_pair(make_pair(in,-t),i);
    }
    sort(res,res+n);
    rep(i,n){
        cout<< res[i].second+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        if(s.equals(s2.substring(0,s2.length()-1))&&(s2.length()==s.length()+1))
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35600
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

s = input()[:-1]

po = ord(s) - 97

if po < 0:
	print("A")
else:
	print("a")


Measured memory_bytes: 65176
ans = 0

N, M = map(int, input().split())
graph = [[0 for i in range(N)] for j in range(N)]
route = []

for i in range(M):
    a, b = map(int, input().split())
    graph[a-1][b-1] = 1
    graph[b-1][a-1] = 1

    route.append((a, b))

for a, b in route:
    graph[a-1][b-1] = 0
    graph[b-1][a-1] = 0

    visited = [False] * N
    visited[0] = True
    q = [i for i in range(N) if graph[0][i]]

    while q:
        r = q.pop(0)
        visited[r] = True
        for i in range(N):
            if graph[r][i] and not visited[i]:
                q.append(i)

    if False in visited:
        ans += 1
    graph[a-1][b-1] = 1
    graph[b-1][a-1] = 1

print(ans)

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

int mmnmm(int num)
{
    int bit = 0;
    int nnum = num;
    while (num) {
        bit++;
        num /= 2;
    }
    return (1LL << bit) - nnum;
}

int find(vi &data, int targ)
{
    if (data.back() == targ) return data.size()-1;
    if (data[0] == targ) return 0;
    int left = 0, right = data.size()-1;
    while (right - left > 1) {
        int mid = (right + left) / 2;
        if (data[mid] < targ) {
            left = mid;
        } else if (data[mid] > targ) {
            right = mid;
        } else {
            return mid;
        }
    }
    if (data[right] == targ) return right;
    else if (data[left] == targ) return left;
    else return -1;
}

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

    Int(n);
    map<int, int> funami;
    vector<int> data(n);
    for (int i = 0; i < n; i++) {
        cin >> data[i];
        funami[data[i]]++;
    }
    sort(all(data)); reverse(all(data));

    int ans = 0;
    rep(i, n) {
        if (funami[data[i]]) {
            funami[data[i]]--;
            int targ = mmnmm(data[i]);
            //std::cout << targ;
            if (funami[targ]) {
                funami[targ]--;
                ans++;
                //cout << " yes ";
            }
            //cout << endl;
        }
    }
    std::cout << ans << std::endl;

    /*
    sort(all(data));
    vi used(n, 0);

    int ans = 0;
    for (int i = n-1; i >= 0; i--) {
        if (!used[i]) {
            int targ = mmnmm(data[i]);
            int yui = find(data, targ);
            std::cout << targ << " " << yui << std::endl;
            if (yui != -1) {
                ans++; 
                used[yui] = 1;
            }
        }
    }

    std::cout << ans << std::endl;
    */

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
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<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

constexpr ll INF=(1LL<<60);

int n;
ll k, a[252521];

bool is_ok(ll mid){
  ll cnt=0;
  REP(i, n){
    if(a[i]==0){
      if(mid>=0){
        cnt+=n-1;
      }
    }
    else if(a[i]<0){
      ll tmp=mid/a[i];
      if(mid<0 && mid%a[i]!=0){
        ++tmp;
      }
      cnt+=a+n-lower_bound(a, a+n, tmp);
      if(a[i]*a[i]<=mid){
        --cnt;
      }
    }
    else{
      ll tmp=mid/a[i];
      if(mid<0 && mid%a[i]!=0){
        --tmp;
      }
      cnt+=upper_bound(a, a+n, tmp)-a;
      if(a[i]*a[i]<=mid){
        --cnt;
      }
    }
  }
  cnt/=2;
  return cnt>=k;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  cin>>n>>k;
  REP(i, n){
    cin>>a[i];
  }
  sort(a, a+n);
  ll lb=-INF, ub=INF;
  while(ub-lb>1){
    ll mid=(ub+lb)/2;
    if(is_ok(mid)){
      ub=mid;
    }
    else{
      lb=mid;
    }
  }
  cout<<ub<<'\n';
  return 0;
}


Measured memory_bytes: 1792
// #include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define trace(x) cerr << #x << ": " << x << " " << endl;
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
 
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}
     
 //using namespace __gnu_pbds;
 //#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set
// mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); for randomized solution

vector<int> v[200001];
int dp[200001];
int fact[200001];
int sub[200001];
int n;
void dfs(int u,int par)
{
	int te=0;
	int k=1;
	int f=1;
	for(auto i:v[u])
	{
		if(i==par)
			continue;
		dfs(i,u);
		te+=sub[i];
		k*=power(fact[sub[i]],mod-2);
		k%=mod;
		f*=dp[i];	
		f%=mod;
	}
	k*=fact[te];
	k%=mod;
	
	
	k*=f;
	dp[u]=k;
	dp[u]%=mod;
	sub[u]=te+1;
	

}
int dp1[200001];
int dfs1(int u,int par,int ans,int size)
{
	if(par!=0)
	{
		int te=0;
		int k=1;
		int f=ans;
		for(auto i:v[u])
		{
			if(i==par)
				continue;
			te+=sub[i];
			k*=power(fact[sub[i]],mod-2);
			k%=mod;
			f*=dp[i];	
			f%=mod;
		}
		k*=power(fact[size],mod-2);
		k%=mod;
		k*=fact[te+size];
		k%=mod;
		
		k*=f;	
		k%=mod;

		dp1[u]=k;
	}

	int te=1;
	int x=0;
	int f=1;
	for(auto i:v[u])
	{
		if(i==par)
			continue;
		te*=power(fact[sub[i]],mod-2);
		te%=mod;
		te*=dp[i];
		te%=mod;
		x+=sub[i];
	}
	x+=size;
	te*=power(fact[size],mod-2);
	te%=mod;
	te*=ans;
	te%=mod;
	
	for(auto i:v[u])
	{
		if(i==par)
			continue;
		int temp=te*fact[sub[i]];
		temp%=mod;

		temp*=fact[x-sub[i]];

		temp%=mod;
		temp*=power(dp[i],mod-2);
		temp%=mod;
		
		dfs1(i,u,temp,n-sub[i]);
		
	}
}
int32_t main()
{
    IOS
    
        
    
    cin>>n;
    for(int i=1;i<=n-1;i++)
    {
    	int x,y;
    	cin>>x>>y;
    	v[x].push_back(y);
    	v[y].push_back(x);
    }
  
    fact[0]=1;
    for(int i=1;i<=200000;i++)
    	fact[i]=fact[i-1]*i,fact[i]%=mod;
    dfs(1,0);
    dp1[1]=dp[1];
    dfs1(1,0,1,0);
    for(int i=1;i<=n;i++)
    	cout<<dp1[i]<<" ";

}       


Measured memory_bytes: 20976
#!/usr/bin/env python
# -*- coding: utf-8 -*-
M = 1000000007


def main():
  n, m = map(int, input().split())
  a = [int(input()) for _ in range(m)]
  a.sort()
  a += [-1, -1]
  b = 0
  w = [0] * (n + 2)
  w[0] = 1

  for i in range(n):
    if a[b] == i:
      b += 1
      continue
    elif a[b] == i + 1 and a[b + 1] == i + 2:
      print(0)
      return

    if a[b] != i + 1:
      w[i + 1] = (w[i] + w[i + 1]) % M

    if a[b] != i + 2:
      w[i + 2] = (w[i] + w[i + 2]) % M

  print(w[-2])


if __name__ == '__main__':
  main()



Measured memory_bytes: 7848
#include <bits/stdc++.h>
 
#define TARGET "slv"

using namespace std;

using ll = long long;
using pii = pair<int, int>;

const int MOD = (int) 1e9+7;
const int C = (int) 2e5+5;

void add(int& x, int y) {
    x += y;
    if (x >= MOD)
        x -= MOD;
}

int main() {
#ifdef INSPIRATION
    freopen(TARGET".in", "r", stdin);
    freopen(TARGET".out", "w", stdout);
#endif    
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> c(n+1), dp(n+1);
    for (int i = 1; i <= n; i++)
        cin >> c[i];
    c[0] = *max_element(c.begin(), c.end())+1;
    vector<int> s(C);
    s[c[0]]++;
    for (int i = 0; i <= n; i++) {
        dp[i] = s[c[i]];
        if (i < n && c[i] != c[i+1])
            add(s[c[i+1]], dp[i]);
    }
    cout << dp[n];
    return false;
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> a(N); for(auto& in:a) cin >> in;
    ll cntfour = 0, cnttwo = 0;
    for(int i = 0; i < N;i++){
        if(a[i]%2 == 0) cnttwo++;
        if(a[i]%4 == 0) cntfour++;
    }
    cnttwo -= cntfour;
    if(2*cntfour+1 >= N) {
        cout << "Yes" << endl;
        return 0;
    }
    if(2*cntfour+cnttwo >= N){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    int n=s.size();
    int m=t.size();
    int min_count=INT_MAX;
    for(int i=0;i<=n-m;i++)
    {
        int count=0;
        for(int j=0,k=i;j<m;j++,k++)
        {
             if(s[k]!=t[j])
             count++;
        }
        min_count=min(min_count,count);
    }
    cout<<min_count<<'\n';
 
    
    
    return 0;
}

Measured memory_bytes: 3620
using System;

public class my
{
	public static void Main()
	{
		string s;
		
		while( null != ( s = Console.ReadLine()) ) {
			var n = int.Parse(s);
			int cnt = 0;
			
			if(n >= 0 && n <= 36) {
			
				for(int a = 0; a <= 9; a++) {
					for(int b = 0; b <= 9; b++) {
						for(int c = 0; c <= 9; c++) {
							var d = n -(a + b + c);
							
							if(d >= 0 && d <= 9) cnt++;
						}
					}
				}
			}
			
			Console.WriteLine(cnt);
		}
	}
}

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

int dp[101][10001];

int main()
{
  int n, W, ans = 0;
  cin >> n >> W;
  int v[n + 1], w[n + 1];
  
  for (int i = 0; i < n; i++){
    cin >> v[i] >> w[i];
  }
  for (int i = 0; i < n; i++){
    for (int j = 0; j <= W; j++){
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
    }
    for (int j = 0; j <= W; j++){
      if (j + w[i] <= W){
        dp[i + 1][j + w[i]] = max(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
      }
    }
  }

  for (int i = 0; i <= W; i++){
    ans = max(ans, dp[n][i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 5068
#include <stdio.h>
int main(void){
    int N;
    int a[101];
    int count=0;
    scanf("%d",&N);
    for(int i=1; i<=N; i++){
        scanf("%d",&a[i]);
    }
    for(int i=1; i<=N; i++){
        if(a[i]%2==1 && i%2==1){
            count++;
        }
    }
    printf("%d",count);
    return 0;
}

Measured memory_bytes: 1736
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	printf("%d\n",min(b/a,c));
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<map>
using namespace std;

#define rep(i,n) for(i=0;i<n;i++)
int main(){
    int i,n;
    cin>>n;
    string b;
    int c=0;
    map<string,int> mp;
    rep(i,n){
        string a;
        cin>>a;
        mp[a]++;
    }
    for(const auto& [key,value]:mp){
        if(value>c){
            c=value;
            b=key;
        }
    }
    for(const auto& [key,value]:mp){
        if(value==c){
            cout<<key<<endl;
        }
    }
}


Measured memory_bytes: 19260
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;using pld=pair<ld,ld>;
const ll INF=1LL<<60;void solve();int main(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d!=0&&d>0?i<n:i>n;i+=d)
template<class T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b; return 1;} return 0;}
template<class T> void contout(const T &v){for(auto it=v.begin();it!=v.end();++it,cout<<(it!=v.end()?" ":"\n"))cout<<*it;}

void solve(){
  ll n; cin>>n;
  vector<ll> A(n);
  rep(i,n) cin>>A[i];
  auto dp=make_v(n+1,n+1,(ll)-1);
  function<ll(ll,ll)> dfs=[&](ll L,ll R){
    if(L==R) return (ll)0;
    if(dp[L][R]!=-1) return dp[L][R];
    ll turn=n-(R-L);
    if(turn%2==0){
      return dp[L][R]=max(dfs(L+1,R)+A[L],dfs(L,R-1)+A[R-1]);
    }else{
      return dp[L][R]=min(dfs(L+1,R)-A[L],dfs(L,R-1)-A[R-1]);
    }
  };
  cout<<dfs(0,n)<<"\n";
}

Measured memory_bytes: 71040
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

#define N 51

int main(void){
  while(true){
    int n;
    cin >> n;
    if(n == 0){ break; }

    string s;
    vector<set<string> > airport(N);
    set<char> mother;
    mother.insert('a');
    mother.insert('i');
    mother.insert('u');
    mother.insert('e');
    mother.insert('o');
    for(int i = 0; i < n; i++){
      cin >> s;
      string code = string() + s[0];
      airport[code.length()].insert(code);
      for(size_t j = 0; j < s.length() - 1; j++){
        if(mother.count(s[j]) != 0){
          code += s[j + 1];
          airport[code.length()].insert(code);
        }
      }
      for(int j = code.length() + 1; j < N; j++){ airport[j].insert(code); }
    }

    int ans = -1;
    for(int i = 0; i < N; i++){
      if((int)airport[i].size() == n){
        ans = i;
        break;
      }
    }
    cout << ans << endl;    
  }
  
  return 0;
}

Measured memory_bytes: 3264
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
char s[100050];
int cnt[100],n,i,j;
int main()
{
	scanf("%s",s);n=strlen(s);int tot=0;
	for (i=0;i<n;i++) cnt[s[i]-'a']++;
	for (i=0;i<26;i++) if (i!='x'-'a'&&(cnt[i]&1)) tot++;
	if (tot>=2){
		puts("-1");return 0;
	}
	for (i=0;i<n;i++) if (s[i]!='x') break;
	if (i==n){
		puts("0");return 0;
	}int l=0,r=n-1;
	for (j=0;j<26;j++) if (j!='x'-'a'){
		int gh=0;
		for (i=0;i<n;i++){
			if (s[i]-'a'==j){
				if (++gh==(cnt[j]+1>>1)) l=max(l,i);
				if (gh==(cnt[j]>>1)+1) r=min(r,i);
			}
		}
	}
	if (l>r){
		puts("-1");return 0;
	}
	int nl=0,nr=n-1,ans=0;
	while (nl<=l){
		while (nl<=l&&s[nl]==s[nr]) nl++,nr--;
		if (nl>l) break;
		if (s[nl]!=s[nr]&&s[nl]!='x'&&s[nr]!='x'){
			puts("-1");return 0;
		}
		if (s[nl]=='x') nl++,ans++;
		else if (s[nr]=='x') nr--,ans++;
	} printf("%d\n",ans);
	return 0;
}

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

 



int main() {
	ll A, B, K;
	cin>> A >> B>> K;
	
	if (A >=K) {
		A =A - K;
	}
	else {
		K = K - A;
		A = 0;
		B - K >= 0 ? B = B - K : B = 0;
	}
	cout << A<<" "<<B << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int n , m , a[N] , z ;
pair<int , int> v[N];
long long int sum = 0;
int main(){
   cin >> n >> m;
   for(int i = 0 ; i < n ; i++){
       cin >> a[i];
   }
   sort(a , a + n);
   for(int i = 0 ; i < m ; i++){
       int x , y;
       cin >> x >> y;
       v[i] = make_pair(y , x);
   }
   sort(v , v + m);
   reverse(v , v + m);
   for(int i = 0 ; i < m ; i++){
       int c = 0;
       while(a[z] < v[i].first && c < v[i].second && z < n){
           z++;
           c++;
       }
       sum += 1LL * c * v[i].first;
   }
   for(int i = z ; i < n ; i++)
        sum += a[i];
    cout << sum ;
    return 0;
}

Measured memory_bytes: 1408