akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define fastio  cin.sync_with_stdio(0); cin.tie(0);cin.exceptions(cin.failbit);
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a,v) memset(a, v, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1e9+7;
const int N=2e5+5;
int main() {
  
    fastio;
    int T=1;
    // cin>>T;
    while(T--){
        ll n;cin>>n;
        ll a[n];
        rep(i,n)cin>>a[i];
        rep(i,n){
            if(a[i]==0){
                cout<<0;return 0;
            }
        }
        ll ans=1;
        ll ma=1e18;
        rep(i,n){
            if((ans)>(ma/a[i])){
                cout<<-1;return 0;
            }
            ans=ans*a[i];
            if(ans>ma){
                cout<<-1;return 0;
            }
        }
        cout<<ans;
    }   
    timecalculater();
    return 0;   
} 

Measured memory_bytes: 4432
# coding: utf-8
# Your code here!
n,a,b,c,d=map(int,input().split())
for i in range(n):
    x,y=(a+c*i,a+d*i)
    j=n-i-1
    z,w=(b+c*j,b+d*j)
    if x<=z<=y or x<=w<=y:
        print('YES')
        break
else:
    print('NO')
    
    


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int a[109];
int main() {
	int n; cin>>n;
	for (int i=0;i<n; i++)cin>>a[i];
		for (int k=0;k<n-1;k++)cout<<a[k]<<" ";
		cout<<a[n-1]<<endl;
	for (int i=1;i<n;i++){
		int key = a[i];
		int j=i-1;
		while(j>=0 && a[j]>key){a[j+1]=a[j];j--;}
		a[j+1]=key;
		for (int k=0;k<n-1;k++)cout<<a[k]<<" ";
		cout<<a[n-1]<<endl;
	}
	// 10 min
	return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define ll long long int
#define F(i,j,k,in) for(int i=j;i<k;i+=in)
#define DF(i,j,k,in) for(int i=j;i>=k;i-=in)
#define feach(it,l) for (auto it = l.begin(); it != l.end(); ++it)
#define fitr(it,it1,itr2) for(auto it=itr1;it!=itr2;++it)
#define fall(a) a.begin(),a.end()
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define eq equal_range
#define fs first
#define ss second
#define ins insert
#define mkp make_pair
#define endl "\n"
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vin;
typedef vector<char> vch;
typedef vector<string> vst;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int,int>> vvin;
typedef vector<pair<ll,ll>> vpll;
typedef vector<pair<int,int>> vpin;
typedef set<ll> sll;
typedef set<int> sint;
typedef set<char> sch;
typedef set<string> sst;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef queue<int> qin;
typedef priority_queue<int> pqin;
typedef map<ll,ll> mpll;
typedef map<int,int> mpin;
typedef pair<ll,ll> pll;
typedef pair<int,int> pin;
const ll MOD=1000000007;
const long double PI=3.1415926535897932384626433832795;
ll pwr(ll b,ll p){ll res=1;while(p){if(p&1) {res*=b; p--;}else{b*=b; p>>=1;}}return res;}
const int maxn=1e5+1, maxn1 = 101;
ll dp[maxn][maxn1];
int main()
{
ios_base::sync_with_stdio(false) , cin.tie(NULL) , cout.tie(NULL);
ll n,w;
cin>>n>>w;
vpll A(n+1);
F (i,1,n+1,1) {
  ll a,b; cin>>a>>b;
  A[i]=mkp(a,b);
}
ll sum=0;
F (i,1,n+1,1) sum+=A[i].ss;
F (i,0,n+1,1) dp[0][i]=0;
F (i,1,sum+1,1) dp[i][0]=INT_MAX;
F (i,1,n+1,1) {
  F (j,1,sum+1,1) {
    dp[j][i] = dp[j][i-1];
    if (j>=A[i].ss) {
      if (dp[j-A[i].ss][i-1]<=w) dp[j][i]=min(dp[j][i] ,dp[j-A[i].ss][i-1]+A[i].fs);
    }

  }
}
ll ans;
F (i,1,sum+1,1) {
    if (dp[i][n]<=w) ans=i;
}
cout<<ans;

return 0;
}





Measured memory_bytes: 82376
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repm(i, m, n) for (int i = m; i < (n); i++)
#define eps (1e-7)
#define inf (1e9)
#define pi (acos(-1))
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

    string str;
    cin >> str;

    int _min = inf;
    rep(i, str.size() - 2)
    {
        string s = str.substr(i, 3);
        int si = stoi(s);
        _min = min(_min, abs(si - 753));
    }

    cout << _min << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
prime = [0]
isPrime = [1 for i in range(1000000)]
isPrime[0] = 0
isPrime[1] = 0
for i in sys.stdin:
    n = int(i)
    if prime[len(prime)-1] < n:
        for i in range(prime[len(prime)-1]+1,n+1):
            if isPrime[i] == 1:
                prime.append(i)
                for j in range(i*2, 1000000, i):
                    isPrime[j] = 0
    print(sum(isPrime[:n+1]))

Measured memory_bytes: 27108
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
  ll n;
  cin>>n;
  ll a=2,b=1,c=0;
  for(int i=2;i<=n;i++)
  {
     c=a+b;
      a=b;
      b=c;
  }
  if(n==1)
    cout<<1<<endl;
  else 
  cout<<c<<endl;
    
}
return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<pair<string, int>> r(n);
  int p;
  for (int i = 0; i < n; i++) {
    cin >> r.at(i).first;
    cin >> p;
    r.at(i).second = 0 - p;
  }
  auto s = r;
  sort(r.begin(), r.end());
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (r.at(i) == s.at(j)) {
        cout << j + 1 << endl;
      }
    }
  }
}




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

using namespace std;

int main(void) {
    long long N;
    cin >> N;
    long long count = 0;
    for (long long i = 1; i <= N - 1; i++) {
        count += (N - 1) / i;
    }
    cout << count << endl;
}


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

int64_t gcd(int64_t a, int64_t b){
  int64_t buf;
  while(b > 0){
    buf= a;
    a= b;
    b= buf%b;
  }
  return a;
}

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

  int ans= 0;
  for(int i=1; i<=K; i++){
    for(int j=1; j<=K; j++){
      for(int k=1; k<=K; k++){
        ans+= gcd(i, gcd(j,k));
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define IOS cin.tie(0); ios::sync_with_stdio(false)
const int INF = 1e9;
using namespace std;

main() {
    string S; cin >> S;
    rep(i,S.size()){
        cout << S[i];
        if(i==3) cout << " ";
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <set>
#include <algorithm>
#include <vector>
#define llint long long

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint a[100005];
P p[100005];
vector<P> vec;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	sort(a+1, a+n+1);
	reverse(a+1, a+n+1);
	
	for(int i = n-1; a[i] < 0 && i >= 2; i--){
		vec.push_back(make_pair(a[1], a[i]));
		a[1] -= a[i];
	}
	for(int i = 2; a[i] >= 0 && i <= n-1; i++){
		vec.push_back(make_pair(a[n], a[i]));
		a[n] -= a[i];
	}
	vec.push_back(make_pair(a[1], a[n]));
	cout << a[1] - a[n] << endl;
	for(int i = 0; i < vec.size(); i++) cout << vec[i].first << " " << vec[i].second << endl;
	
	return 0;
}

Measured memory_bytes: 4336
arr = (1..999).to_a
arr2 = Array.new(1001, 0)
for x in 2..44
    for y in 0..(arr.length-x)
        sum = arr[y, x].inject(:+)
        break if sum > 1000
        arr2[sum] += 1
    end
end

while true
    n = gets.to_i
    break if n == 0
    puts arr2[n]
end


Measured memory_bytes: 6868
import numpy as np

n = int(input())

x = []
y = []
for i in range(n):
  l = list(map(int, input().split()))
  x.append(l[0])
  y.append(l[1])

x = np.array(x)
y = np.array(y)

xy0 = x + y
xy1 = x - y

print(max(max(xy0)-min(xy0),max(xy1)-min(xy1)))

Measured memory_bytes: 44256
# AtCoder Beginner Contest 123
# https://atcoder.jp/contests/abc123
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    abcde = ii2nn(5)
    n = 0
    modmin = 10
    for t in abcde:
        n += t
        mod = t % 10
        if mod != 0:
            n += 10 - mod
            if mod < modmin:
                modmin = mod
    if modmin != 10:
        n -= 10 - modmin
    print(n)

main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int a, b, c;
  cin >> a >> b >> c;
  
  if ( a == b && b == c ) {
    cout << 1 << endl;
  }
  else if ( a == b && b != c || a == c && c != b || b == c && c != a) {
    cout << 2 << endl;
  }
  else {
    cout << 3 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
const double pi = acos(-1);
 
int main() {
    double a, b, x;
    cin >> a >> b >> x;

    x /= a;
    double z = 180.0/pi;  // zを掛けるとラジアンが度数になる

    if(x <= a*b/2.0) {
        exout( z*atan( (b*b)/(2.0*x) ) );
    }
    else {
        exout( z*atan( (2.0*(a*b - x))/(a*a) ) );
    }
    
    re0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

    using namespace std;
 
int b[200010]={1};

    int main(){
      int n;
      cin >> n;
      int x[n],y[n],h[n];
      rep(i,n)cin >> x[i] >> y[i] >> h[i];
      int H=-1,cx=-1,cy=-1;
      int P=0;
      while(h[P]==0)P++;
      rep(i,101){
       rep(j,101){
         bool flag=true;
         int C=abs(x[P]-i)+abs(y[P]-j)+h[P];
        rep(k,n){
          if(max(C-abs(x[k]-i)-abs(y[k]-j),0)!=h[k])flag=false;
        }
         if(flag){
           cx=i;
           cy=j;
           H=C;
         }
       }
      }
      cout << cx << ' ' << cy << ' ' << H << endl;
      return 0;}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}

using namespace std;
ll k (ll a){
    a--;
    ll ans =0;
    while(a != 0){
        ans += a;
        a--;
        
    }
    return ans;
}


int main(){
    int  n;
    cin >> n;
    int MOD = 1e9 + 7;
    vector<ll> vec(n);
    REP(i,n){
        cin >> vec[i];
    }
    ll ans = 0;
    for(int i = 0; i < 60 ; i++){
        ll x0 = 0, x1 = 0;

        for(int j = 0; j < n; j++){
            ll s = (vec[j] >> i) & 1;
            if(s == 0){
                x0++;
            }else{
                x1 ++;
            }
        }
         ll bi = 1;
        for(int j = 0; j < i; j++){
            bi *= 2;
            bi %= MOD;
        }
        ll count = (x0 * x1) % MOD;
        ans += count * bi;
        ans %= MOD;
    }
    cout << ans <<endl;
}



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

#define FOR(a,b,c) for(int a=(b),a##_end__=(c);a<=a##_end__;a++)
#define ll long long

void Rd(ll &res){
    char c;res=0;
    while(c=getchar(),c<48);
    do res=(res<<3)+(res<<1)+(c^48);
    while(c=getchar(),c>47);
}

void Wt(int x){
    static int stk[24];int p=0;
    do stk[++p]=x%10^48;
    while(x/=10);
    while(p) putchar(stk[p--]);
}


ll n,a,b,c,d;
int main(){
    Rd(n);Rd(a);Rd(b);Rd(c);Rd(d);n--;
    FOR(i,0,n){
        ll x=a+i*d-(n-i)*c;
        ll y=a+i*c-(n-i)*d;
        if(b<=max(x,y) && min(x,y)<=b) {printf("YES");return 0;}
    }
    
    printf("NO");
    return 0;
}

Measured memory_bytes: 256
import math
s = int(input())

def combinations(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

sep = 0
cnt = 0
while (n := s-sep*2-3) >= sep:
    cnt += combinations(n, sep)
    sep += 1

print(cnt % (10**9 + 7))


Measured memory_bytes: 9228
#include <iostream>
#include <algorithm> //fillを使うため
#include <vector>
#include <queue>

using namespace std;

#define INF 1e9

struct edge {
    int from; //出発点
    int to;   //到達点
    long long cost; //移動コスト
};

int main()
{
    int V; //頂点の数
    int side; //辺の数
    int S; //始点
    int G; //終点
    vector<long long> d(V, 1e9); //始点からそこまで行くのにかかるコスト
    vector<edge> edges; //移動の情報を保存する

    cin >> V;
    cin >> side;
    int P;cin >> P;
    S = 0;
    G = V-1;
    vector<vector<int>> vec(V);
    vector<vector<int>> v(V);
    d[S] = 0; //始点を0にする
    for (int i = 0; i < side; i++) {
        struct edge add;
        cin >> add.from;
        add.from--;
        cin >> add.to;
        add.to--;
        cin >> add.cost;
        vec.at(add.to).push_back(add.from);
        v.at(add.from).push_back(add.to);
        add.cost  = P - add.cost;
        edges.push_back(add);
    }

    vector<bool> f(V, false);
    queue<int> que;
    //f.back() = true;
    que.push(V-1);
    while(!que.empty()){
        int q = que.front();
        que.pop();
        if(f[q])continue;
        f[q] = true;
        for(int a : vec.at(q)){
            if(!f[a])que.push(a);
        }
    }
    vector<bool> ef(V, false);
    queue<int> nque;
    //f.back() = true;
    nque.push(0);
    while(!nque.empty()){
        int q = nque.front();
        nque.pop();
        if(ef[q])continue;
        ef[q] = true;
        for(int a : v.at(q)){
            if(!ef[a])nque.push(a);
        }
    }

    /*
    for(int i = 0;i < V;i++){
        cout<<f[i]<<endl;
    }
    */
    vector<edge> nq;
    for(auto a : edges){
        if(f[a.from] && f[a.to] && ef[a.from] && ef[a.to]){
            nq.push_back(a);
        }
    }
    edges = nq;
    for (int i = 0; i < V; i++) {
        for (int j = 0; j < (int)edges.size(); j++) {

            struct edge e = edges[j];

            if (d[e.to] > d[e.from] + e.cost) {  //移動した後のコストが小さいと、頂点のコストを更新
                d[e.to] = d[e.from] + e.cost;
                if (i == V-1) {         //頂点の数と同じ回数ループすると、負の閉路があるのでループをぬける
                    cout << -1<< endl;
                    return 0;
                }
            }
        }
    }
    cout<<max(0LL,-d[G])<<endl;
}


Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define FI first
#define SE second
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int MOD=1e9+7;
const int INF=1e9+7;
const double PI=3.141592653589793238462643383279;
//
int main(){
  long long N,K;
  PA A[100000];
  cin>>N>>K;
  FOR(i,0,N){
    cin>>A[i].FI>>A[i].SE;
  }
  sort(A,A+N);
  long long cnt=0;
  int i=0;
  while(1){
    cnt+=A[i].SE;
    if(cnt>=K){
      break;
    }
    i++;
  }
  cout<<A[i].FI<<endl;
  return 0;
}


Measured memory_bytes: 1024
/*input
7


*/


#include <bits/stdc++.h>
using namespace std; 
#define int long long int
// #define max(x, y) ((x) > (y) ? (x) :(y))
#define pii pair< int , int> 
#define vi vector<int>
#define fore( i ,st) for ( int i= 0 ; i < (int)(st) ; i ++)
#define REP( i , st , en ) for ( int i =st; i < (int)en; i++)
#define REPD( i , en , st ) for ( int i =en; i >= (int)st; i--)
#define SZ(a) (int)a.size()
#define all(v) v.begin() , v.end()
#define pb push_back
#define F first
#define S second
#define bug(x) cout <<__LINE__ << ":"<<__FILE__ << " : " <<   #x  << " = " << x << "\n";
#define bitch_i_m_on_fiyaah_yeahhhh ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod = 1e9+7;
ostream& operator << ( ostream&  o, vector<int> s){for ( int i = 0;  i < (int)s.size() ; i++)o << s[i] << " ";o << "\n";return o;}
int  add( int a, int b){int c = a + b; if ( c> mod ) c-= mod; return c;}
void sub( int &a, int b){a = a - b;if ( a < 0) a += mod;}
int mul( int a , int b){return ((a %mod) * (b %mod) ) %mod;}
int exp( int a , int pow){ return (pow == 0 ? 1 : ( pow & 1  ? mul ( a ,exp( mul(a, a) , pow /2) ) : exp(mul(a ,a) , pow/2)));}
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
// void in( vector<int> &v){for (int i=0;i<(int)v.size();i++)cin>>v[i];}
// void in(int &n) {cin >> n; }

const int maxn = 2e6 +5;

void solve( int test){
	
	
	int s;
	cin >> s;
	int dp[s+1];
	fore(i ,s+1) dp[i]=0;
	REP( i , 3 , s+1) dp[i]=1;
	
	
	for ( int target =3 ; target <=s ; target ++ ){
		for ( int getting = 3 ; getting <= target ;getting++ )
			dp[target] = add( dp[target] , dp[target- getting]);
	}
	// fore( i ,8) cout << dp[i] << " " ;
	cout << dp[s];
}	
signed main(){
	bitch_i_m_on_fiyaah_yeahhhh
	int t =1; 
	// cin >> t;
	for ( int i = 0 ; i < t; i++)
		solve(i+1);
}

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

int main(){
  int n,i,kotae;
  cin>>n;
  int a[n],b[n],c[n-1];
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  for(i=0;i<n;i++){
    cin>>b[i];
  }
  for(i=0;i<n-1;i++){
    cin>>c[i];
  }
  kotae=b[a[0]-1];
  for(i=1;i<n;i++){
    kotae+=b[a[i]-1];
    if(a[i]-a[i-1]==1){
      kotae+=c[a[i-1]-1];
    }
  }
  cout<<kotae;
}

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

using namespace std;

const int vy[] = {0, 1, 0, -1}, vx[] = {1, 0, -1, 0};

int H, W;
string S[200];
int v[200][200];

bool bfs()
{
  queue< pair< int, int > > que;
  memset(v, -1, sizeof(v));

  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      if(S[i][j] == '%') {
        que.emplace(j, i);
        v[j][i] = 0;
      }
    }
  }
  int me = 1 << 30, enemy = 1 << 30;

  while(!que.empty()) {
    auto p = que.front();
    que.pop();
    if(S[p.second][p.first] == '@') me = v[p.first][p.second];
    else if(S[p.second][p.first] == '$') enemy = min(enemy, v[p.first][p.second]);
    for(int i = 0; i < 4; i++) {
      int nx = p.first + vx[i], ny = p.second + vy[i];
      if(nx < 0 || ny < 0 || nx >= W || ny >= H) continue;
      if(S[ny][nx] == '#') continue;
      if(~v[nx][ny]) continue;
      v[nx][ny] = v[p.first][p.second] + 1;
      que.emplace(nx, ny);
    }
  }
  return (me < enemy);
}

int main()
{
  cin >> H >> W;
  for(int i = 0; i < H; i++) cin >> S[i];
  if(bfs()) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main(){
  vector<string> s(5);
  for(int i=0; i<5; i++){
    cin >> s.at(i);
  }
  int ans=0;
  int MIN=10;
  for(int i=0; i<5; i++){
    if(s.at(i).at(s.at(i).size()-1)-'0'==0){ans += stoi(s.at(i));}
    else{
      ans += (stoi(s.at(i))/10)*10 + 10;
      MIN = min(s.at(i).at(s.at(i).size()-1)-'0',MIN);
    }
  }
  ans -= 10;
  ans += MIN;
  cout << ans << endl;
}
    


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,i,j,sum=0;
	int a[59];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		sum+=a[i]*a[j];
	}
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
int main()
{
    long long n,c=0; cin>>n;
    long long l[n];
    for(long long i=0;i<n;i++)
    {
        cin>>l[i];
    }
    sort(l,l+n);
    for(long long i=0;i<n;i++)
    {
        for(long long j=i+1;j<n;j++)
        {
            for(long long k=j+1;k<n;k++)
            {
                if(l[i]!=l[j] && l[j]!=l[k] && l[k]!=l[i])
                {
                    //cout<<i<<" "<<j<<" "<<k<<endl;
                    if((l[i]+l[j]+l[k]-(max(l[i],max(l[j],l[k]))))>max(l[i],max(l[j],l[k])))
                    {
                        //cout<<l[i]<<" "<<l[j]<<" "<<l[k]<<endl;
                        c++;
                    }
                }
            }
        }
    }
    cout<<c;
    return 0;
}

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

#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 
int main()
{
    int N, K;
    cin >> N >> K;
    int ans = 0;
    while (N >= K){
        N/= K;
        ans++;
    }
    cout << ans + 1; 
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <stdio.h>
#include <bitset>
#include<math.h>
#include<list>
#include<map>
using namespace std;
typedef long long ll;
#define PI 3.14159265358979323846  

int main() {
	int n,before=-999;
	int minv=10000000,value;
	cin >> n;
	vector<int> x(n,0), dis(n-1,0);
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	sort(x.begin(), x.end());
	for (int i = x[0]; i <= x[n-1]; i++) {
		value = 0;
		for (int j = 0; j < n; j++) {
			value += pow(x[j] - i, 2);
		}
		minv = min(minv, value);
	}
	cout << minv << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)
const ll mod = 1000000007;
const double pi = 3.14159265358979;

int main() {
    ll s, w;
    cin >> s >> w;
    if (s <= w) {
        cout << "unsafe" << endl;
    }
    else {
        cout << "safe" << endl;
    }
}

Measured memory_bytes: 3636
A, B, K = map(int, input().split())

count=0
if A > B:
    for i in range(B, 0, -1):
        if A%i==0 and B%i==0:
            count += 1
            if count == K:
                break
else:
    for i in range(A, 0, -1):
        if A%i==0 and B%i==0:
            count += 1
            if count == K:
                break

print(i)



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

int main() {
    int n;
    cin >> n;
    int pn;
    cin >> pn;
    int count = 1;
    for (int i = 1; i < n; i++) {
        int pnn;
        cin >> pnn;
        if (pn > pnn) {
            pn = pnn;
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3580
from collections import defaultdict
import itertools
N = int(input())
name_dict = defaultdict(list)
for _ in range(N):
    name = input()
    f_n = list(name)[0]
    name_dict[f_n].append(name)
count = 0
start_name = ['M', 'A', 'R', 'C', 'H']
del_list = []
comb_name = list(itertools.combinations(start_name, 3))
for k in name_dict.keys():
    if k not in start_name:
        del_list.append(k)
for k in del_list:
    del name_dict[k]
for name in start_name:
    if name not in name_dict:
        name_dict[name] = []
for comb in comb_name:
    a, b, c = comb
    count += len(name_dict[a]) * len(name_dict[b]) * len(name_dict[c])
print(count)

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> vs;
  int skip_row_cnt = 0;
  for (int i = 0; i < h; i++) {
    string s;
    cin >> s;
    if (s.find('#') != string::npos) {
      vs.push_back(s);
    } else {
      skip_row_cnt++;
    }
  }
  int skip_column[w];
  for (int i = 0; i < w; i++) {
    skip_column[i] = 0;
  }
  for (int i = 0; i < w; i++) {
    bool dot_only = true;
    for (int j = 0; j < h - skip_row_cnt; j++) {
      if (vs[j][i] == '#') {
        dot_only = false;
        break;
      }
    }
    if (dot_only) {
      skip_column[i] = 1;
    }
  }

  for (int i = 0; i < h - skip_row_cnt; i++) {
    for (int j = 0; j < w; j++) {
      if (skip_column[j]) continue;
      cout << vs[i][j];
    }
    cout << '\n';
  }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.*;

public class Main {
    private static final class FastInput {
        private final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        private StringTokenizer st;

        private int nextInt() throws Exception {
            return Integer.parseInt(nextWord());
        }

        private long nextLong() throws Exception {
            return Long.parseLong(nextWord());
        }

        private String nextWord() throws Exception {
            if (st == null || !st.hasMoreElements()) st = new StringTokenizer(br.readLine(), " ");
            return st.nextToken();
        }

        private long[] lineToIntArr(int len) throws Exception {
            long[] arr = new long[len];
            for (int i = 0; i < arr.length; i++) arr[i] = nextLong();
            return arr;
        }
    }

    public static void main(String[] args) throws Exception {
        FastInput in = new FastInput();
        int n = in.nextInt();
        int k = in.nextInt();
        long[] a = in.lineToIntArr(n);
        long[] dp = new long[n+1];
        for(int i = 0; i <= n; ++i){
            dp[i] = 1000000007;
        }
        dp[0] = 0;
        for(int i = 0; i < n; ++i){
            for(int j = 1; j <= k; ++j){
                if(i + j < n)
                    dp[i+j] = Math.min(dp[i+j], dp[i] + Math.abs(a[i] - a[i+j]));
            }
        }
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        bw.write(String.valueOf(dp[n - 1]));
        bw.flush();
    }
}

Measured memory_bytes: 33864
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    AB = [[] for _ in range(N)]
    for i in range(N):
        AB[i] = list(map(int, input().split()))

    AB.sort(key=lambda x: x[1])
    asum = [0 for _ in range(N + 1)]
    for i in range(N):
        asum[i + 1] = asum[i] + AB[i][0]

    ans = 'Yes'
    for i in range(N):
        if asum[i + 1] > AB[i][1]:
            ans = 'No'
            break

    print(ans)


if __name__ == '__main__':
    solve()


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

int N, A[1000000];

int max_A[1000000][2];

int main(){
    cin >> N;
    for(int i = 0; i < (1 << N); i++){
        cin >> A[i];
    }
    for(int i = 0; i < (1 << N); i++){
        if(A[i] >= A[0]){
            max_A[i][0] = i;
        }else{
            max_A[i][1] = i;
        }
        for(int j = 0; j < N; j++){
            if(i & (1 << j)){
                for(int k = 0; k < 2; k++){
                    int tmp = max_A[i ^ (1 << j)][k];
                    if(A[tmp] > A[max_A[i][0]]){
                        max_A[i][1] = max_A[i][0];
                        max_A[i][0] = tmp;
                    }else if(A[tmp] > A[max_A[i][1]] && tmp != max_A[i][0]){
                        max_A[i][1] = tmp;
                    }
                }
            }
        }
        int tmp = i;
        if(A[tmp] > A[max_A[i][0]]){
            max_A[i][1] = max_A[i][0];
            max_A[i][0] = tmp;
        }else if(A[tmp] > A[max_A[i][1]] && tmp != max_A[i][0]){
            max_A[i][1] = tmp;
        }
    }
    int dp[1000000] = {};
    for(int i = 1; i < (1 << N); i++){
        dp[i] = max(dp[i-1], A[max_A[i][0]] + A[max_A[i][1]]);
        cout << dp[i] << endl;
    }
}


Measured memory_bytes: 15104
//ÎÞÎýÊÐ½ðÇÅ³õÖÐ ·ÑË¼Á¿
#include <bits/stdc++.h>
using namespace std;

int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	string s;
	getline(cin, s);
	int s1 = -1;
	int s2 = -1;
	int len = s.size();
	for(int i = 0;i < len;i++)
	{
		if(s[i] == 'C') s1 = i;
		if(s[i] == 'F') s2 = i;
	}
	if(s1 != -1 && s2 != -1 && s1 < s2) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
n, k = [0] * 2

mod = 10**9 + 7

def format_input(filename = None):
	global n, k
	if filename == None:
		n, k = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(1, 2 * 10**5)
		k = rng(1, n+1)
		print(n, k)

def get_answer():
	answer = ((n+1) * (n+2)) // 2 * n + ((n+1) * (n+2)) // 2 - ((n+1) * (n+2) * (2*n+3)) // 6 + (n+1)
	answer -= (k * (k-1)) // 2 * n + (k * (k-1)) // 2 - (k * (k-1) * (2*k-1)) // 6 + (k-1)
	answer %= mod
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)


Measured memory_bytes: 9236
#include <stdio.h>



 int main(){

  int m,f,r;

  while(1){
    scanf("%d %d %d",&m,&f,&r);
    if(m==-1 && f==-1 && r == -1 )break;


      if (m==-1 || f ==-1) {
        printf("F\n");
      }

      else if(m+f >= 80){
        printf("A\n");
       }
       else if(m+f >= 65 && m+f< 80){
         printf("B\n");
       }
       else if(m+f >= 50 && m+f< 65){
         printf("C\n");
       }
       else if(m+f >= 30 && m+f< 50){
         if(r>=50){
           printf("C\n");
         }
         else{
           printf("D\n");
         }
       }
       else{
         printf("F\n");
       }
      }







return(0);
}

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

int ans=99999999;
int n;
int a[200];

int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int j=0;j<=120;j++)
    {
        int k=0;
        for(int i=1;i<=n;i++)
            k+=(j-a[i])*(j-a[i]);
        if(k<ans)
            ans=k;
    }
    cout<<ans<<endl;
    return 0;
}

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


using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define printfloat(x) cout << fixed << setprecision(7) << (x) << endl;
#define printbit(x) cout << bitset<15>(x) << endl;
using ll = long long int;



long double pi = 3.14159265359;

int n;
long double a, ans, rev;


int main(){
    cin >> n;
    rep(i,n){
        cin >> a;
        rev += 1/a;
    }
    ans = 1/rev;
    printfloat(ans);


return 0;
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int N;
  cin >> N;

  ll max_a = -1;
  ll ans = 0;
  rep(i, N){
    ll a, b;
    cin >> a >> b;
    if(chmax(max_a, a)){
      ans = a + b;
    }
  }

  cout << ans << endl;



  return 0;
}


Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N; cin >> N;
    string S; cin >> S;

    int ans = 0;
    FOR(i,1,N-1) {
        string ls = S.substr(0, i);
        string rs = S.substr(i);
        set<char> lst, rst;
        for (char c : ls) lst.insert(c);
        for (char c : rs) rst.insert(c);

        set<char> product;
        set_intersection(lst.begin(), lst.end(),
            rst.begin(), rst.end(),
            inserter(product, product.end()));
        ans = max(ans, (int)product.size());
    }

    cout << ans << endl;

    return 0;
}

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

#define M 100000
int main(){
  int n,i,c=0;
  string s;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>s;
    if(s=="E869120")c++;
  }
  cout<<c<<endl;
  return 0;
}



Measured memory_bytes: 3176
#include <iostream>

using namespace std;

int main() {

	int a, b;
	cin >> a >> b;
	if (a < 13 && a > 5){
		b = b / 2;
	}
	else if (a < 6){
		b = 0;
	}

	cout << b << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.*;
public class Main {
 static int loc=0;
 static int line=0;
 static String str[];
 static String buffer="";
 static String str2="";
 static String str3="";
 static int a;
 public static void main(String[] args){
 try{
  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  str=new String[1000];
  int j=0;
  while (true) {
   String str1 = br.readLine();
   if(str1.equals("END_OF_TEXT")){a=j; break;}
   str[j]=str1;
   j++;
  }
  while(true){
   char ch=br.readLine().charAt(0);
   if(ch=='-') break;
   else if(ch=='a')a();
   else if(ch=='e')e();
   else if(ch=='p')p();
   else if(ch=='n')n();
   else if(ch=='f')f();
   else if(ch=='b')b();
   else if(ch=='d')d();
   else if(ch=='k')k();
   else if(ch=='y')y();
  }
  for(int i=0;i<a;i++)System.out.println(str[i]);
 }
 catch(Exception e){System.out.println("err");}
 }

 public static void a(){
  loc=0;
 }
 public static void e(){
  loc=str[line].length();
 }

 public static void p(){
  loc=0;
  if(line!=0)line--;
 }
 public static void n(){
  loc=0;
  if(line!=a-1)line++;
 }
 public static void f()

{
  if(loc != str[line].length())loc++;
  else if(loc==str[line].length() && line!=a-1) {
   loc=0;
   line++;
  }
 }
 public static void b(){
  if(loc!=0)loc--;
  else if(loc==0 && line!=0)loc=str[--line].length();
 }
 public static void d(){
  if(loc!=str[line].length()){
   str2=str[line].substring(0, loc)+str[line].substring(loc+1);
   str[line]="";
   str[line]+=str2;
  }
  else if(loc==str[line].length() && line!=a-1){
   str[line]+=str[line+1];
   str[line+1]="";
   for(int i=line+2;i<a;i++){
    str[i-1]+=str[i];
    str[i]="";
   }
   a--;
  }
 }

 public static void k(){
  if(loc!=str[line].length()){
   buffer=str[line].substring(loc);
   str2=str[line].substring(0, loc);
   str[line]="";
   str[line]+=str2;
  } 
  else if(loc==str[line].length() && line!=a-1){
   buffer="\n";
   for(int i=line+1;i<a;i++){
    str[i-1]+=str[i];
    str[i]="";
   }
   a--;
  }
 }

 public static void y(){
  if(buffer.equals("\n")) {
  str2=str[line].substring(0,loc);
  str3=str[line].substring(loc);
   for(int i=a-1;i>line;i--){
    str[i+1]="";
    str[i+1]+=str[i];
   }
   str[line]="";
   str[line]+=str2;
   str[line+1]="";
   str[line+1]+=str3;
   a++;
   loc=0;
   line++;
  }
  else if(buffer!="") {
   str2=str[line].substring(0,loc);
   str3=str[line].substring(loc);
   str[line]="";
   str[line]=str2+buffer+str3;
   loc+=buffer.length();
  }
 }
}




Measured memory_bytes: 24240
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  int ans=0;
  for(int i=0;i<N;i++){
  int sum=0;
    int x;
    cin>>x;
    for(int j=0; ;j++){
    if(x%2==0){
      x=x/2; sum=j+1;
              }else{
        break;
    }
    }
    ans+=sum;
  
  
  }cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//pair<string,int> pa[2];
int l,a[200001],n,ans;
string s;
int main() 
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=1;i<n;i++)
    {
        if(a[i]==a[i-1])
        {
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES";
    
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	vi a(3); cin >> a;
	sort(ALL(a));
	int ans = 1e9;;
	do
	{
		chmin(ans, abs(a[2] - a[1]) + abs(a[1] - a[0]));
	} while (next_permutation(ALL(a)));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
vectors = [list(map(int, input().split())) for i in range(N)]

sumamry = [0] * M
for vec in vectors:
    ans = vec[1:]
    for a in ans:
        sumamry[a-1] += 1

ret = 0
for s in sumamry:
    if s == N:
        ret += 1

print(ret)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
	
	ll n,x,t;
	cin>>n>>x>>t;
	ll i = 0;
	ll num = 0;
	while(num<n){
		num += x;
		i++;
	}
	cout<<i*t;
				
	return 0;
}

Measured memory_bytes: 3632
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	k := getNextInt(scanner)
	s := getNextString(scanner)
	n := len(s)
	var ans, c26, c25 mint
	c26 = 26
	c25 = 25
	mc := newModcom(n + k + 1)
	for i := 0; i < k+1; i++ {
		ans.addAs(mc.choose(i+n-1, n-1).mul(c26.pow(mint(k - i))).mul(c25.pow(mint(i))))
	}
	fmt.Fprintln(writer, ans)
}

type modcom struct {
	facs, invs []mint
}

func newModcom(n int) modcom {
	facs := make([]mint, n+1)
	invs := make([]mint, n+1)
	facs[0] = 1
	for i := 0; i < n; i++ {
		facs[i+1] = facs[i].mul(mint(i + 1))
	}
	invs[n] = facs[n].inv()
	for i := n - 1; i >= 0; i-- {
		invs[i] = invs[i+1].mul(mint(i + 1))
	}
	return modcom{
		facs: facs,
		invs: invs,
	}
}
func (mc *modcom) choose(n, k int) mint {
	return mc.facs[n].mul(mc.invs[k]).mul(mc.invs[n-k])
}

type mint int64

func (mt mint) mod() mint {
	m := mint(1e9 + 7)
	mt %= m
	if mt < 0 {
		return mt + m
	}
	return mt
}
func (mt mint) inv() mint {
	return mt.pow(mint(0).sub(2))
}
func (mt mint) pow(n mint) mint {
	p := mint(1)
	for n > 0 {
		if n&1 == 1 {
			p.mulAs(mt)
		}
		mt.mulAs(mt)
		n >>= 1
	}
	return p
}
func (mt mint) add(x mint) mint {
	return (mt + x).mod()
}
func (mt mint) sub(x mint) mint {
	return (mt - x).mod()
}
func (mt mint) mul(x mint) mint {
	return (mt * x).mod()
}
func (mt mint) div(x mint) mint {
	return mt.mul(x.inv())
}
func (mt *mint) addAs(x mint) *mint {
	*mt = mt.add(x)
	return mt
}
func (mt *mint) subAs(x mint) *mint {
	*mt = mt.sub(x)
	return mt
}
func (mt *mint) mulAs(x mint) *mint {
	*mt = mt.mul(x)
	return mt
}
func (mt *mint) divAs(x mint) *mint {
	*mt = mt.div(x)
	return mt
}


Measured memory_bytes: 36160
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#define ll long long
using namespace std;
const int maxn = 500010, inf = 1e9 + 233;
int n;
char s[maxn];

template<typename T>
inline void read(T &k)
{
    int f = 1; k = 0; char c = getchar();
    while (c < '0' || c > '9') c == '-' && (f = -1), c = getchar();
    while (c <= '9' && c >= '0') k = k * 10 + c - '0', c = getchar();
    k *= f;
}

int main()
{
    read(n);
    scanf("%s", s + 1); 
    int cnt = 0;
    for (int i = 1; i <= n; i++) cnt += s[i] == 'R';
    puts(cnt > n - cnt ? "Yes" : "No");
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin >> N;
	int ans = 0;

	for (int i = 1; i <= N; i+=2)
	{
		int cnt = 0;
		for (int j = 1; j <= i; j++) {
			if (i%j == 0) {
				cnt++;
			}
			if (cnt == 8) {
				ans++;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MP make_pair
#define FR first
#define SE second
using namespace std;

const int S=(1<<20)+5;
char buf[S],*H,*T;
inline char Get()
{
    if(H==T) T=(H=buf)+fread(buf,1,S,stdin);
    if(H==T) return -1;return *H++;
}
inline int read()
{
    int x=0;char c=Get();
    while(!isdigit(c)) c=Get();
    while(isdigit(c)) x=x*10+c-'0',c=Get();
    return x;
}

const int N=200010;
struct Edge{int to,next;} e[N<<1];
int fa[N],sz[N],n,m,h[N],sum=0;
pair<int,int> circle[N];
bool parity[N],odd[N];
int cnt[2];

int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}

void add_edge(int u,int v)
{
    e[++sum].to=v;
    e[sum].next=h[u];
    h[u]=sum;
}

void dfs(int u,int fa)
{
    parity[u]=parity[fa]^1;
    for(int t=h[u];t;t=e[t].next)
        if(e[t].to!=fa) dfs(e[t].to,u);
}

int main()
{
    int u,v,tot=0;
    n=read();m=read();
    for(int i=1;i<=n;i++) fa[i]=i,sz[i]=1;
    for(int i=1;i<=m;i++)
    {
        u=read();v=read();
        if(find(u)!=find(v))
        {
            add_edge(u,v);
            add_edge(v,u);
            u=find(u);v=find(v);
            fa[u]=v;sz[v]+=sz[u];
        }
        else circle[++tot]=MP(u,v);
    }
    for(int i=1;i<=n;i++)
        if(fa[i]==i) dfs(i,0);
    for(int i=1;i<=tot;i++)
        if(parity[circle[i].FR]==parity[circle[i].SE])
            odd[find(circle[i].FR)]=1;
    int alone=0;
    long long ans=0;
    for(int i=1;i<=n;i++)
    {
        if(fa[i]!=i) continue;
        if(sz[i]==1) alone++,ans+=n;
        else cnt[odd[i]]++;
    }
    ans+=1ll*(n-alone)*alone;
    ans+=2ll*cnt[0]*cnt[0];
    ans+=1ll*cnt[1]*(cnt[1]+2*cnt[0]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 8192