akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>
#include <atcoder/all>

using namespace std;

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

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    for(int i=0;i<n;++i) cout << "ACL";
    cout << endl;
}

Measured memory_bytes: 3628
n = int(raw_input())
ais = [int(raw_input()) for _ in range(n)]
tails = []
import bisect
for a in ais:
	if not(tails) or (tails[-1] >= a):
		tails.append(a)
	else:
		# maintain a decreaing tails
		986643321
		lo,hi = 0, len(tails) - 1
		while(lo<hi):
			med= (lo + hi)/2
			if tails[med] < a:
				hi = med
			else:
				lo = med + 1
		tails[lo] = a
print len(tails)

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

using namespace std;

#define ll long long 
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353
#define inf 1e18

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

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

    ll test=1;
    // cin>>test;
    while(test--)
    {
        ll n;
        cin>>n;

        vector<ll> ar(n);

        for(ll i=0;i<n;i++)
        cin>>ar[i];

        sort(ar.begin(),ar.end());

        ll ans=ar.back();

        ll pro=3;

        for(;pro<=n;pro++)
        {
            if(pro%2)
            {
                ar.popb();
            }

            ans+=ar.back();
        }

        cout<<ans;
    }
}

Measured memory_bytes: 4788
n = int(input())
monsters = list(map(int, input().split()))
heroes = list(map(int, input().split()))

cnt = 0
for i in range(n):
  if heroes[i] <= monsters[i]:
    cnt += heroes[i]
  else:
    cnt += monsters[i]
    heroes[i] -= monsters[i]
    if heroes[i] <= monsters[i+1]:
      cnt += heroes[i]
      monsters[i+1] -= heroes[i]
    else:
      cnt += monsters[i+1]
      monsters[i+1] = 0
  
print(cnt)

Measured memory_bytes: 18624
#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

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

    vi data(3);
    rep(i, 3) cin >> data[i];
    sort(all(data)); reverse(all(data));
    cout << data[0] * 10 + data[1] + data[2] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? ((x) : -(x)))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 3e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, K, Q, T;
map<pair<int, int>, int> mp;
ll twoPow[65];

int main()
{
	int i, j;
	ll x, sum;
	ll two = 1ll;
	int e = 0;
	while (e <= 60) {
		twoPow[e] = two;
		++e;
		two = two * 2ll % MOD;
	}

	sum = 0ll;
	scanf("%d", &N);
	for (i = 1; i <= N; ++i) {
		scanf("%lld", &x);
		for (j = 0; j <= 60; ++j) {
			int bit = x & (1ll << j) ? 1:0;
			sum = (sum + (mp[{j, !bit}] * twoPow[j] % MOD)) % MOD;
			mp[{j, bit}]++;
		}
	}
	printf("%lld", sum);
	return 0;
}

Measured memory_bytes: 256
import numpy as np
X, N = map(int, input().split())
if N == 0:
    print(X)
else:
    p = sorted(list(map(int, input().split())))
    ok = [i for i in range(-101, 201) if i not in p]
    ix = np.argmin(list(map(lambda a: abs(X-a), ok)))
    print(ok[ix])


Measured memory_bytes: 26988
A = list(map(int, input().split()))
print(min(abs(A[1]-A[0])+abs(A[2]-A[1]), abs(A[2]-A[0])+abs(A[1]-A[2]), abs(A[0]-A[1])+abs(A[2]-A[0]), abs(A[2]-A[1])+abs(A[0]-A[2]), abs(A[1]-A[2])+abs(A[0]-A[1]), abs(A[0]-A[2])+abs(A[1]-A[0])))


Measured memory_bytes: 3064
using System;
using System.IO;

class Program{
    static void Main(string[] args){
        var arr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int A = arr[0], B = arr[1], C = arr[2];
        var answer = -1;
        if (!(A > 1 && A == B && A == C)){
            answer = 0;
            while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0){
                (A, B, C) = ((B + C) / 2, (A + C) / 2, (A + B) / 2);
                answer++;}}
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}}

Measured memory_bytes: 27212
n = int(input())
a = list(map(int,input().split()))
i = 0
while i < n-1:
  if a[i] <= 0 and a[i+1] <= 0:
    a[i] = -1*a[i]
    a[i+1] = -1*a[i+1]
    i += 2
  elif a[i] > 0:
    i += 1
  elif a[i] <= 0 and a[i+1] > 0:
    a[i] = -1*a[i]
    a[i+1] = -1*a[i+1]
    i += 1
if a[n-1] < 0:
  a[n-1] = -1*a[n-1]
  print(sum(a)-2*min(a))
else:print(sum(a))

Measured memory_bytes: 14480
import sys
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = int(input())

if N == S:
    print(N + 1)
    exit()

def f(b, n):
    if n < b:
        return n
    return f(b, n // b) + n % b

ans = float('inf')

for b in range(1, int(N**0.5) + 100):
    if b > 1 and f(b, N) == S:
        ans = min(ans, b)

    q = S - b
    b = (N - q) // b
    if b > 1 and f(b, N) == S:
        ans = min(ans, b)

if ans == float('inf'):
    print(-1)
else:
    print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
    int n;
    string s;
    cin >> s;
    if (s[1] == 'A' && (s[0] == 'B' || s[2] == 'B')) cout << "Yes" << endl;
    else if (s[1] == 'B' && (s[0] == 'A' || s[2] == 'A')) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?9e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m;
	cin>>n>>m;
	int co=n;
	vi cnt(n),hul(n),in(n);
	rep(i,n){
		int a;cin>>a;
		in[i]=a;
		cnt[a-1]++;
		if(a-cnt[a-1]<0)continue;
		if(!hul[a-cnt[a-1]])co--;
		hul[a-cnt[a-1]]++;
	}
	rep(_,m){
		int t,b;
		cin>>t>>b;
		int a=in[t-1]-1;
		in[t-1]=b;
		cnt[a]--;
		if(a-cnt[a]>=0){
			hul[a-cnt[a]]--;
			if(!hul[a-cnt[a]])co++;
		}
		cnt[b-1]++;
		if(b-cnt[b-1]>=0){
			if(!hul[b-cnt[b-1]])co--;
			hul[b-cnt[b-1]]++;
		}
		cout<<co<<endl;
	}
}









Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define int long long
using namespace std;

inline int read(){
    int X=0,w=0; char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
    while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
    return w?-X:X;
}

inline void write(int x){
     if(x<0) putchar('-'),x=-x;
     if(x>9) write(x/10);
     putchar(x%10+'0');
}

inline void writeln(int x){
     if(x<0) putchar('-'),x=-x;
     if(x>9) write(x/10);
     putchar(x%10+'0');
     puts("");
}

signed main(){
    int n=read(),ac=0,wa=0,tle=0,re=0;
    
    for(int i=1;i<=n;i++){
        string s;
        cin>>s;
        
        if(s=="AC")
            ac++;
        else if(s=="WA")
            wa++;
        else if(s=="TLE")
            tle++;
        else
            re++;
    }
    
    cout<<"AC x "<<ac<<"\n"<<"WA x "<<wa<<"\n"<<"TLE x "<<tle<<"\n"<<"RE x "<<re<<"\n";
    
    return 0;
}

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

#define int long long int
#define ff first
#define ss second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int mod = 1e9 + 7;
const int cmod = 998244353;
const int N = 4e5 + 5;
const int inf = 1e16 + 2;

int a[102] , cache[100001][2] , n , k;
double dp(int p , int cur , int mn) {
    if(p < mn) {
        if(cur) return 1;
        else return 0;
    }
    int  &ans = cache[p][cur];
    if(ans != -1) return ans;
    int cnt = 0;
    for(int i = 0 ; i < n ; i ++) {
        if(p < a[i] and cur) {
            cnt ++;
            continue;
        }
        if(p >= a[i] and dp(p - a[i] , cur ^ 1 , mn)) cnt ++;
    }
    if(cur == 0) {
        if(cnt) ans = 1;
        else ans = 0;
    }
    else {
        if(cnt == n) ans = 1;
        else ans = 0;
    }
    return ans;
}
void solve(int Case) {
    memset(cache , -1 , sizeof cache);
    cin >> n >> k;
    int m = inf;
    for(int i = 0 ; i < n ; i ++) cin >> a[i] , m = min(m , a[i]);
    if(dp(k , 0 , m)) cout << "First" << '\n';
    else cout << "Second" << '\n';
}
/*
 */

int32_t main()
{
    fastio
    int testcase = 1;
    //cin >> testcase;
    int Case = 1;
    while(testcase --) {
        solve(Case ++);
    }
    return 0;
}
 



Measured memory_bytes: 11340
def main():
    n, k = [int(v) for v in input().split(' ')]
    lst_a = [int(v) for v in input().split(' ')]

    for i in range(n - k):
        if lst_a[i] < lst_a[k + i]:
            print('Yes')
        else:
            print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 31436
#include <iostream>

using namespace std;
using LL = long long;

LL rec(LL H) {
    if (H == 1)
        return 1;
    return 1 + rec(H / 2) * 2;
}

int main() {
    LL H;
    cin >> H;
    cout << rec(H) << endl;
}

Measured memory_bytes: 1016
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
	int a, b, e, f, g;
	double c, d;
	cin >> a >> b;
	c = a * 12.5;//8%最小値
	d = b * 10;//10%最小値
	e = a % 2;
	if (e == 1) {
		c = c + 0.5;
		f = c + 11;//8%最大値
		g = d + 9;//10%最大値
	}
	else {
		f = c + 12;
		g = d + 9;
	}
	if (f < d) {
		cout << -1;
	}
	else if (g < c) {
		cout << -1;
	}
	else {
		if (c < d) {
			cout << d;
		}
		else {
			cout << c;
		}
	}
}

Measured memory_bytes: 256
l = map(int,raw_input().split())
if(l[0]+l[1]) > (l[2]+l[3]):
    print "Left"
elif (l[0] + l[1]) < (l[2] + l[3]):
    print "Right"
elif (l[0] + l[1]) == (l[2] + l[3]):
    print "Balanced"


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

int main() {
	int N;
	cin >> N;
	vector<int> a;
	for (int i = 0; i < N; i++) {
		int val;
		cin >> val;
		a.push_back(val);
	}
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	int alice = 0, bob = 0;
	for (int i = 0; i < N; i++) {
		if (i % 2 == 0) alice += a[i];
		else bob += a[i];
	}
	cout << alice - bob << endl;
	return 0;
}

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


int main()
{
	int n, b, f, r, v;
	cin >> n;
	int data[12][10];

	for (int i = 0; i < 12; i++) {
		for (int j = 0; j < 10; j++) {
			data[i][j] = 0;
		}
	}
	for (int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		data[(b-1)*3 + (f-1)][r-1] += v;
	}

	for (int i = 0; i < 12; i++) {
		for (int j = 0; j < 10; j++) {
			cout << " " << data[i][j];
		}
		cout << endl;
		if (i % 3 == 2 && i != 11)cout << "####################" << endl;
	}


	return 0;
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define pii pair<int, int>
#define fir first
#define sec second
using namespace std;
const int MAXN = 1e5 + 7;
vector<pair<int, int> >G[MAXN];
int col[MAXN], ans = 0;
void dfs(int u, int fa, int c)
{
    int cnt = 1;
    for (auto x : G[u])
    {
        if (x.fir == fa) continue;
        if (cnt == c) ++ cnt;
        col[x.sec] = cnt++;
        ans = max(ans, col[x.sec]);
        dfs(x.fir, u, col[x.sec]);
    }
}
int main()
{
    int n; scanf("%d", &n);
    for (int i = 1, u, v; i < n; i++)
    {
        scanf("%d%d", &u, &v);
        G[u].emplace_back(v, i); G[v].emplace_back(u, i);
    } 
    dfs(1, 0, 0); 
    printf("%d\n", ans);
    for (int i = 1; i < n; i++) printf("%d\n", col[i]);
    return 0;
}

Measured memory_bytes: 9344
#include <bits/stdc++.h>
#define mins(x,y) (x=min(x,y))
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P  = pair<int,int>;
using v  = vector<int>;
using vv = vector<v>;

int main(){
    int n;
    cin >> n;
    
    cout << n*(n-1)/2 -n/2 << endl;
    
    for(int i=1; i<=(n/2)*2; i++){
        for(int j=i+1; j<=(n/2)*2; j++){
            if(i + j == (n/2)*2+1)continue;
            cout << i <<" "<< j << endl;
        }
    }
    
    if(n%2){
        for(int i=1; i<n; i++){
            cout << i <<" "<< n << endl;
        }
    }
    //ぜんぶつなぐと和はn(n+1)/2 - i
    //n=8のばあい
    //1 -> 35 - 8
    //2 -> 34 - 7
    //5 -> 31 - 4
    //8 -> 28 - 1
    
    //n=9のばあい
    //1 -> 44 - 8
    //2 -> 43 - 7
    //5 -> 40 - 4
    //8 -> 37 - 1
    //9 -> 36
    
    return 0;
}

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

int main() {
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());

    int a, b, c;
    cin >> a >> b >> c;

    bool isOK = false;
    if (a == 5) {
        if (b == 7 && c == 5 || b == 5 && c == 7) {
            isOK = true;
        }
    } else if (a == 7) {
        if (b == 5 && c == 5) {
            isOK = true;
        }
    }

    if (isOK) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int p, q, r;
    cin >> p >> q >> r;
    cout << min({p + q, q + r, r + p}) << endl;
    return 0;
}

Measured memory_bytes: 256
<?php
	fscanf(STDIN, "%d %d", $A, $B);
	$Group1 = [1, 3, 5, 7, 8, 10, 12];
	$Group2 = [4, 6, 9, 11];

	if($A === 2 && $B === 2){
		echo 'Yes';
	}else if((in_array($A, $Group2) && in_array($B, $Group2)) || (in_array($A, $Group1) && in_array($B, $Group1))){
		echo 'Yes';
	}else{
		echo 'No';
	}
?>

Measured memory_bytes: 4604
import sys
n=int(input())
a=list(map(int,input().split()))
lis=[0 for i in range(n)]
for i in a:lis[i]+=1
if(1):
  if(lis[0]!=n%2):
    print(0)
    sys.exit()
  num=0
  for i in range(1,n):
    if(i%2==n%2):
      if(lis[i]!=0):
        print(0)
        sys.exit()
    else:
      if(lis[i]!=2):
        print(0)
        sys.exit()
      else:num+=1
  print((2**num)%(10**9+7))

Measured memory_bytes: 14008
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;
 
class Program
 {
        static void Main(string[] args)
        {
          //入力を受け取る
          var NM = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
          var N = NM[0];
          var M = NM[1];
          if(N > 2 && M > 2){
            Console.WriteLine((N-2)*(M-2));
          }else if(N == 1 && M == 1){
            Console.WriteLine(1);
          }else if(N == 1){
            Console.WriteLine(M-2);
          }else if(M == 1){
            Console.WriteLine(N-2);
          }else{
            Console.WriteLine(0);
          }
        }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll n;
  cin >> n;
  ll ans = 0;
  REP(i, n){
    ll a;
    cin >> a;
    while(a%2 == 0){
      a /= 2;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc042c()
}

fun abc042c() {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val dList = readLine()!!.split(' ').map { it.toInt() }

    var answer = n
    while (answer.toString().any { dList.contains(it.toString().toInt()) }) answer++

    println(answer)
}


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

string s;

int solve() {
  cin >> s;
  int sum = 0;
  for (char c: s) {
    sum += (c - '0');
  }
  if (sum % 9 == 0) printf("Yes\n");
  else printf("No\n");
  return 0;
}

int main() {
  int t = 1;
  // scanf("%d", &t);
  for (int tc = 0; tc < t; ++tc) {
    // printf("Case #%d: ", tc+1);
    solve();
  }
  return 0;
}


Measured memory_bytes: 3740
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
bool white=false;
bool cards[100010];
int main()
{
	while(1)
	{
		int n,k;
		white=false;
		memset(cards,0,sizeof(cards));
		cin >> n >> k;
		if(n==0&&k==0)break;
		for(int i=0;i<k;i++)
		{
			int a;
			cin >> a;
			if(a==0)white=true;
			else cards[a]=true;
		}
		int count1=0,count2=0;
		vector<int> vec;
		int start=0;
		int end=0;
		for(int i=1;i<=n;i++)
		{
			if(cards[i])
			{
				if(count2==0)count1++;
				else
				{
					if(start==0)start=1;
					end=1;
					vec.pb(count2);
					count2=0;
					count1++;
				}
			}
			else
			{
				if(count1==0)count2++;
				else
				{
					if(start==0)start=2;
					end=2;
					vec.pb(count1);
					count1=0;
					count2++;
				}
			}
		}
		if(end==1)
		{
			vec.pb(count1);
			vec.pb(count2);
		}
		if(end==2)
		{
			vec.pb(count2);
			vec.pb(count1);
		}
		vector<int> ans;
		if(start==1)
		{
			for(int i=0;i<vec.size();i++)
			{
				if(white)
				{
					if(i%2==0)
					{
						if(i==0||i==vec.size()-1)continue;
						if(vec[i]==1)ans.pb(vec[i-1]+vec[i+1]+1);
					}
				}
				if(i%2==1)
				{
					ans.pb(vec[i]);
				}
			}
		}
		if(start==2)
		{
			for(int i=0;i<vec.size();i++)
			{
				if(white)
				{
					if(i%2==1)
					{
						if(i==vec.size()-1)continue;
						if(vec[i]==1)ans.pb(vec[i-1]+vec[i+1]+1);
					}
				}
				if(i%2==0)
				{
					ans.pb(vec[i]);
				}
			}
		}
		SORT(ans);
		cout << ans[ans.size()-1] << endl;
		
	}
	return 0;
}

Measured memory_bytes: 1568
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int mtoi( string str );
string itom( int sumi );

int main(int argc, char const *argv[]) {
    int n, sumi;
    string first, second, sum_str;
    vector<string> results;

    cin>>n;
    for (int i = 0; i < n; i++) {
        cin>>first>>second;
        sumi  = mtoi( first ) + mtoi( second );
        sum_str = itom( sumi );
        results.push_back( sum_str );
    }

    for(auto it = results.begin(); it != results.end(); it++){
        cout<<*it<<endl;
    }

    return 0;
}

int mtoi( string str ){
    int str_num = 1;
    int result = 0;

    for(int i = 0; i < str.size(); i++ ){
        if( i > 0 && ( 9 < (str[i-1] - '0') ||  (str[i-1] - '0') < 2 ) ) str_num = 1;
        switch (str[i]) {
            case 'm': result += str_num * 1000; break;
            case 'c': result += str_num * 100; break;
            case 'x': result += str_num * 10; break;
            case 'i': result += str_num * 1; break;
            default : str_num = str[i] - '0';
        }
    }
    return result;
}

string itom( int sumi ){
    string str;
    int divi = 1000;
    int tmp;
    for( int i = 0; i < 4; i++ ){
        tmp = sumi / divi;
        sumi -= tmp * divi;
        divi /= 10;
        if(tmp==0) continue;
        switch (i) {
            case 0 :
                if( tmp > 1 ) str.push_back( tmp + '0' );
                str.push_back('m'); break;
            case 1 :
                if( tmp > 1 ) str.push_back( tmp + '0' );
                str.push_back('c'); break;
            case 2 :
                if( tmp > 1 ) str.push_back( tmp + '0' );
                str.push_back('x'); break;
            case 3 :
                if( tmp > 1 ) str.push_back( tmp + '0' );
                str.push_back('i'); break;
        }
    }
    return str;
}

Measured memory_bytes: 3264
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

int n;



int main(){
	cin >> n;
	vector<int> v(n);
	pair<int ,int> ans;
	for(int i=0;i<n;i++){
		cin >> v[i];
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	//int now = v[0];
	//ans = make_pair(v[0],v[1]);
	for(int i=0;i<n;i++){
		pair<int,int> nowans;
		int l = 0,r=n-1;
		int m = (l+r)/2;
		while(l+1<r){
			m = (l+r)/2;
			if(v[i]/2>=v[m]){
				r = m;
			}else{
				l = m;
			}
		}
		//cout << v[r] << endl;
		int b = max(v[i]-v[r],v[r]);
		int c = max(v[i]-v[r-1],v[r-1]);
		if(b>c) nowans = make_pair(v[i],v[r-1]);
		else nowans = make_pair(v[i],v[r]);//n=v[i]のときのmax
		int a = max(ans.first-ans.second,ans.second);
		int na = max(nowans.first-nowans.second,nowans.second);
		if(i==0) ans = nowans;
		else if(abs(ans.first-v[i])+1<=abs(a-na) && a>=v[i]/2){
			ans = nowans;
		}
	}
	cout << ans.first << " " << ans.second;
}

Measured memory_bytes: 640
use std::io::stdin;
use std::str::FromStr;

fn read_line<T>() -> Vec<T>
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn main() {
    let in_vec: Vec<i32> = read_line();
    let n = in_vec[0];
    let res: Vec<char> = n.to_string().chars().collect();

    if res.contains(&'7') {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2164
M,D=[int(i) for i in input().split()]

if D<20:
  print(0)
else :
  count = 0
  for i in range(1,M+1):
    for id in list(range(20, D+1)):
      if int((str(id))[1]) >= 2 and ( int(str(id)[0]))*int((str(id))[1]) == i :
         count += 1
  print(count)


Measured memory_bytes: 3060
using System;

namespace ABC060B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] bufs = Console.ReadLine().Split(' ');
            int A = Int32.Parse(bufs[0]);
            int B = Int32.Parse(bufs[1]);
            int C = Int32.Parse(bufs[2]);

            int tmp = A;
            for (int i = 0; i < B; i++)
            {
                if (tmp % B == C)
                {
                    Console.WriteLine("YES");
                    return;
                }
                tmp += A;
            }

            Console.WriteLine("NO");
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
 
#define int             long long
#define pb              push_back
#define mp              make_pair
#define scan(a, n) 		for(int i = 0; i < n;i++)cin >> a[i];
#define print(a, n) 	for(int i = 0; i < n;i++)cout << a[i] <<' ';cout<<endl;
#define w(x)            int x; cin>>x; while(x--)
#define ms(s, n) 		memset(s, n, sizeof(s))
#define sz(a) 			int((a).size())
#define endl 			'\n'
const int MOD = 		(int) 1e9 + 7;
#define all(v) 			v.begin(),v.end()
#define Sort(v) 		sort(v.begin(), v.end())
#define vi 				vector<int>
#define vs 				vector<string>
#define db(...) 		__f(#__VA_ARGS__, __VA_ARGS__)
#define rep(i, n) 		for (int (i) = 0; (i) < (int)(n); ++(i))
#define prefixsum(a,b)	partial_sum(all(a),b.begin())

 
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
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...);
}
 
template <typename T, typename U> 
inline void chkmax(T& x, U y) {
	if (x < y) x = y;
}
  
template <typename T, typename U>
inline void chkmin(T& x, U y) {
	if (y < x) x = y;
}

void code()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("/home/tushar/Desktop/input.txt", "r", stdin);
    freopen("/home/tushar/Desktop/output.txt", "w", stdout);
#endif
}
// template end here


void solve() 
{
	int i, j, k, q ,n, m, ans = 0, cnt = 0, sum = 0,input;
	cin>>k;
	int a,b;
	cin>>a>>b;

	ans= (a/k)*k;
	// cout<<"a/k: "<<ans<<endl;
	if(ans==a)cout<<"OK"<<endl;
	else
	{
		ans+=k;
		// cout<<ans<<endl;
		if(ans<=b)cout<<"OK"<<endl;
		else cout<<"NG"<<endl;
	}
}
 
int32_t main()
{
    // code();
    solve();
    return 0;
}




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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll N, A[202020],M,B[202020];
ll i,j,ans;
int main(){
    scanf("%lld", &N);
    fornum(i,0,N){
        scanf("%lld", &A[i+1]);
    }
    for (i = N; 1 <= i;i--){
        ll a = 0;
        for (j = i * 2; j <= N;j+=i){
            a += B[j];
        }
        if((a+A[i])%2==1){
            B[i] = 1;
            M++;
        }
    }
    printf("%lld\n", M);
    fornum(i,0,N){
        if(B[i+1]==1)
            printf("%lld ", i + 1);
    }

    return 0;
}

Measured memory_bytes: 3968
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n; rd(n);
  auto a=readln.split.to!(int[]);
  auto b=readln.split.to!(int[]);
  auto c=readln.split.to!(int[]);
  sort(a); sort(b); sort(c);

  import std.range;
  auto xs=a.assumeSorted, zs=c.assumeSorted;
  long tot=0;
  foreach(y; b){
    tot+=xs.lowerBound(y).length*zs.upperBound(y).length;
  }
  writeln(tot);
}

void rd(Type...)(ref Type x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}

Measured memory_bytes: 11592
s=input()
n=len(s)+1
list=[]
stock1 = 0
stock2 = 0
for i in range(0,n-1):
    if s[i] == "<":
        if i==0 or (i>0 and s[i-1]==">"):
            for j in range(0,stock1+1):
                if j == 0:
                    list.append(max(stock1,stock2)-j)
                else:
                    list.append(stock1-j)
            stock1 = 0
            stock2 = 1
        else:
            list.append(list[i-1]+1)
            stock2 += 1
    else:
        stock1 += 1

if s[-1] == ">":
    for j in range(0,stock1+1):
        if j == 0:
            list.append(max(stock1,stock2)-j)
        else:
            list.append(stock1-j)
else:
    list.append(list[-1]+1)

ans=0
for i in list:
    ans += i

print(ans)


Measured memory_bytes: 24092
S = input()
even=0
odd=0
Rpos=0
RLmode = 0
S=S+"R"
N=[0 for i in range(len(S))]
for i in range(len(S)):
    if (RLmode == 1 and S[i]=="R") or i==len(S)-1:
        # print("sakaime")
        if Rpos % 2 == 0:
            N[Rpos] += even
            N[Rpos + 1] += odd
        else:
            N[Rpos] += odd
            N[Rpos + 1] += even
        even = 0
        odd = 0
    if S[i]=="R":

        RLmode=0
        Rpos = i
    else:
        RLmode=1

    if i%2==0:
        even+=1
    else:
        odd+=1
    # print(S[i])
N.pop(-1)
N=[str(a) for a in N]
N = ' '.join(N)
print(N)

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

int main() {
	int N, T, c, t, count = 0, r[100];
	cin >> N >> T;
	for (int i = 0; i < N; i++) {
		cin >> c >> t;
		if (t <= T) {
			r[count] = c;
			count++;
		}
	}
	if (count == 0) cout << "TLE" << endl;
	else {
		sort(r, r + count);
		cout << r[0] << endl;
	}
}

Measured memory_bytes: 256
#include <stdio.h>


int main()
{
    int a,b,i,c[5],d,w,j,n=0;
    
    scanf("%d %d",&a,&b);

    for(i=a;i<=b;i++){
        w=i;
        j=0;
        while(w>0){
            c[j]=w%10;
            w/=10;
            j++;
        }
        d=c[0]*10000+c[1]*1000+c[2]*100+c[3]*10+c[4];
        if(d==i){n++;}
    }
    printf("%d\n",n);
            

    return 0;
}

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

int main(){
	int x,y,w,h,r;
	cin >> w >> h >> x >> y >> r;
	
	if((x<=w-r)&&(x>=r)&&(y<=h-r)&&(y>=r )) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

ll q;
vll as, bs, cs, ds;

ll ysfk = 0;
void dfs(ll n, ll m, vll& seq) {
  if ((ll)seq.size() == n) {
    ll tmp = 0;
    rep(i, q) {
      if (seq[bs[i]-1] - seq[as[i]-1] == cs[i]) tmp += ds[i];
    }
    chmax(ysfk, tmp);
    return;
  }

  ll st = seq.empty() ? 1 : seq.back();
  repLRE(i, st, m) {
    seq.push_back(i);
    dfs(n, m, seq);
    seq.pop_back();
  }

  return;
}

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n, m;
  cin >> n >> m >> q;

  as.resize(q), bs.resize(q), cs.resize(q), ds.resize(q);
  rep(i, q) cin >> as[i] >> bs[i] >> cs[i] >> ds[i];

  vll emp;
  dfs(n, m, emp);

  cout << ysfk << endl;

  return 0;
}


Measured memory_bytes: 3636
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#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 <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)

typedef unsigned long long ull;

int main(){
	int n; cin>>n;
	ll sum = 0;
	FOR(i,n){ ll x; cin>>x; sum += x;}
	cout << sum / n << endl;

	return 0;
}

Measured memory_bytes: 1164
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	for (;;) {
		int N, T, L, B;
		cin >> N >> T >> L >> B;
		if (N == 0) break;
		string s(N + 1, ' ');
		while (L--) {
			int i; cin >> i;
			s[i] = 'L';
		}
		while (B--) {
			int i; cin >> i;
			s[i] = 'B';
		}
		vector< vector<double> > dp(T + 2, vector<double>(N + 1));
		dp[0][0] = 1;
		for (int t = 0; t < T; t++) {
			for (int i = 0; i < N; i++) {
				if (dp[t][i] == 0) continue;
				double x = dp[t][i] / 6;
				for (int j = 1; j <= 6; j++) {
					int _i = i + j;
					if (_i > N) _i = N * 2 - _i;
					if (s[_i] == ' ') dp[t + 1][_i] += x;
					else if (s[_i] == 'L') dp[t + 2][_i] += x;
					else if (s[_i] == 'B') dp[t + 1][0] += x;
				}
			}
			dp[t + 1][N] += dp[t][N];
	}
		printf("%.10f\n", dp[T][N]);
	}
}

Measured memory_bytes: 1332
#pragma GCC optimize ("O3")
// #pragma GCC target ("avx")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int X;

void MAIN() {
    scanf("%d", &X);
    int ans = 0;
    int cur = 0;
    while (1) {
	cur += X;
	cur %= 360;
	ans++;
	if (cur == 0) break;
    }
    printf("%d\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



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


int main(){
    int n,count=0;
    int *d;
    cin >> n;
    d = new int[n];
    for(int i=0;i<n;i++)scanf("%d",&d[i]);
    sort(d,d+n);

    
    cout << d[n/2] - d[n/2-1] <<endl;


}

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

int main(){
  stack<int>a;
  string s;
  int t1,t2,temp;
  while(cin>>s){
    if(s[0]=='+'){
      t1=a.top();
      a.pop();
      t2=a.top();
      a.pop();
      temp=t1+t2;
      a.push(temp);
    }
    else if(s[0]=='-'){
      t1=a.top();
      a.pop();
      t2=a.top();
      a.pop();
      temp=t2-t1;
      a.push(temp);
    }
    else if(s[0]=='*'){
      t1=a.top();
      a.pop();
      t2=a.top();
      a.pop();
      temp=t2*t1;
      a.push(temp);
    }
    else{
      a.push(atoi(s.c_str()));
    }
  }
  cout<<a.top()<<endl;
} 


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

#define ll long long

int main()
{
	string s;
	cin>>s;
	if(s[0]=='7'||s[1]=='7'||s[2]=='7')
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
}


Measured memory_bytes: 3628
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
#include <map>
#include <numeric>

#define ll long long
using namespace std;
static ll imin = std::numeric_limits<ll>::min();
static ll imax = std::numeric_limits<ll>::max();
#define rep(i, n) for(int i = 0; i<n; ++i)
#define rep1(i, n) for(int i = 1; i<n; ++i)
#define rev_rep(i, n) for(int i = n - 1; i >= 0; --i)
#define range(a, i, b) for(int i = a; i <b; ++i)
#define dump(x) cout << #x << ":" << x << "\n";
#define all(v) v.begin(), v.end()
#define readl(N) ll N; cin >> N
#define readlv(N, vec) vector<ll> vec(N); rep(i, N){cin >> vec[i];}
#define greater_than [](ll l, ll r){return l > r;}
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::map<T1, T2>& mp);
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair);
template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec);
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair){
  os << '(' << pair.first << ',' << pair.second << ')';
  return os;
}

template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(int i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}

template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::map<T1, T2>& mp){
  std::size_t n = mp.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(auto && x:mp){
    os << x << " ";
  }
  os << std::endl;
  return os;
}

template<class T>
std::ostream& operator << (std::ostream& os, std::set<T>& mp){
  std::size_t n = mp.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(auto && x:mp){
    os << x << " ";
  }
  os << std::endl;
  return os;
}

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


#ifndef BOOST_TEST_MAIN
int main(int const argc, char const** argv){
  readl(N);
  vector<vector<ll>> a(N), dp(N + 1);
  rep(i, N){
    dp[i].resize(3);
    a[i].resize(3);
    rep(j, 3){
      cin >> a[i][j];
    }
  }
  dp[N].resize(3);
  
  rep(i, N){
    rep(j, 3){
      rep(k, 3){
        if(j == k){
          continue;
        }
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + a[i][j]);
      }
    }
  }
  // dump(a);
  // dump(dp);
  ll res = 0;
  rep(i, 3){
    res = max(res, dp[N][i]);
  }
  cout << res;
}
#endif


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, d, x;
	cin >> n >> d >> x;
	vector<ll> a(n);
	REP(i, n){cin >> a[i];}
	ll ans = x;
	REP(i, n){
		ans += (d-1)/a[i]+1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
inline ll read(){
    ll x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<3)+(x<<1)+c-'0';
        c=getchar();
    }
    return x*f;
}
ll n;
int main(){
	n=read();
	cout<<n*(n-1)/2<<endl;
	return 0;
}


Measured memory_bytes: 256
P = [list(map(int,input().split())) for i in range(3)]
#[print(i) for i in P]
#C11を取得
c_11 = P[0][0]
#引き算する
for i in range(3):
    for j in range(3):
        P[i][j] -= c_11

#[print(i) for i in P]

A_1 = 0
A_2 = P[1][0]
A_3 = P[2][0]
B_1 = 0
B_2 = P[0][1]
B_3 = P[0][2]

Flag = "Yes"

if not A_2 + B_2 == P[1][1]:
    Flag = "No"
if not A_2 + B_3 == P[1][2]:
    Flag = "No"
if not A_3 + B_2 == P[2][1]:
    Flag = "No"
if not A_3 + B_3 == P[2][2]:
    Flag = "No"

print(Flag)


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.lang.Math;


public class Main {

	private static Scanner sc;

	public static void main(String[] args) {
		Main instance = new Main();
		sc = instance.new Scanner();
		instance.solve();
	}

	private void solve() {
		try {
			int a11 = sc.nextInt();
			int a12 = sc.nextInt();
			int a13 = sc.nextInt();
			int a21 = sc.nextInt();
			int a22 = sc.nextInt();
			int a23 = sc.nextInt();
			int a31 = sc.nextInt();
			int a32 = sc.nextInt();
			int a33 = sc.nextInt();
			
			int[] a1 = new int[] { a11, a12, a13 };
			int[] a2 = new int[] { a21, a22, a23 };
			int[] a3 = new int[] { a31, a32, a33 };
			int[] a4 = new int[] { a11, a22, a33 };
			int[] a5 = new int[] { a13, a22, a31 };
			int[] a6 = new int[] { a11, a21, a31 };
			int[] a7 = new int[] { a12, a22, a32 };
			int[] a8 = new int[] { a13, a23, a33 };

			int n = sc.nextInt();
			boolean ret = false;
			for (int i = 0; i < n ; i++ ) {
				int z = sc.nextInt();
				if(ret) continue;
				
				
				int aa1 = 0;
				int aa2 = 0;
				int aa3 = 0;
				int aa4 = 0;
				int aa5 = 0;
				int aa6 = 0;
				int aa7 = 0;
				int aa8 = 0;
				for ( int j = 0; j < 3; j++ ) {
					if( a1[j] == z ) {
						a1[j] = 0;
					}
					if( a2[j] == z ) {
						a2[j] = 0;
					}
					if( a3[j] == z ) {
						a3[j] = 0;
					}
					if( a4[j] == z ) {
						a4[j] = 0;
					}
					if( a5[j] == z ) {
						a5[j] = 0;
					}
					if( a6[j] == z ) {
						a6[j] = 0;
					}
					if( a7[j] == z ) {
						a7[j] = 0;
					}
					if( a8[j] == z ) {
						a8[j] = 0;
					}
					aa1 += a1[j];
					aa2 += a2[j];
					aa3 += a3[j];
					aa4 += a4[j];
					aa5 += a5[j];
					aa6 += a6[j];
					aa7 += a7[j];
					aa8 += a8[j];
				}
				if( aa1 == 0 || aa2 == 0 || aa3 == 0 || aa4 == 0 || aa5 == 0 || aa6 == 0 || aa7 == 0 || aa8 == 0) {
					ret = true;
				}
			}
			
			
			System.out.println(ret ? "Yes" : "No");
			
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private class Scanner {
		String[] s;
		int i;
		BufferedReader br;
		String regex = " ";

		public Scanner() {
			s = new String[0];
			i = 0;
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		@Override
		protected void finalize() throws Throwable {
			try {
				super.finalize();
			} finally {
				destruction();
			}
		}

		private void destruction() throws IOException {
			if (br != null)
				br.close();
		}

		public String next() throws IOException {
			if (i < s.length)
				return s[i++];
			String st = br.readLine();
			while (st == "")
				st = br.readLine();
			s = st.split(regex, 0);
			i = 0;
			return s[i++];
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public Long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public Double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
	}
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N = pow(10,9)+7;

bool is_prime(int x){
    for(int i=2; i*i<=x; i++){
        if(x%i==0) return false;
    }
    return true;
}

int main(){
    int n;
    cin >> n;
    vector<int> prime;
    for(int i=2; i<=n; i++){
        if(is_prime(i)) prime.push_back(i);
    }
    vector<ll> cnt;
    for(int i=0; i<prime.size(); i++){
        int p=prime.at(i);
        ll time=0;
        for(int i=2; i<=n; i++){
            int calc=i;
            while(calc%p == 0){
                calc = calc/p;
                time++;
            }
        }
        cnt.push_back(time);
    }
    ll ans=1;
    for(int i=0; i<cnt.size(); i++){
        ans = (ans*(cnt.at(i)+1))%N;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632