akhauriyash/Code-Regression huggingface dataset:
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let (h, _) = get!(usize, usize);
    let mp = get!(String; h);
    for i in 0..h {
        println!("{}", mp[i]);
        println!("{}", mp[i]);
    }
}

Measured memory_bytes: 4352
//
// Created by yuki on 2019/06/19.
//
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int MAX_N = 1<<19;
vec segdp(MAX_N,0);//1-indexed,hiはhi+2^18に入れてる（0-indexed）
void update(ll id,ll x){
    if(id == 0) return;
    segdp.at(id)=max(x,segdp.at(id));
    id>>=1;
    update(id,x);
}
//hi未満を見つける（注：hiは0-indexed）
//l,rはセグ木のカバー区間[l,r)、初期値[0,1<<18)
//kはsegdpにおけるid、初期値1
//なんで蟻本のがr=nで代入なのか分からない…
ll query(ll hi,ll k,ll l,ll r){
    if(l>=hi)return 0;
    if(r<=hi) return segdp.at(k);
    /*if(k >= (1<<19)){
        cout<<hi<<' '<<k<<' '<<l<<' '<<r<<endl;
        return 0;
    }*/
    ll vl = query(hi,k*2,l,(l+r)/2);
    ll vr = query(hi,k*2+1,(l+r)/2,r);
    return max(vl,vr);
}
int main() {
    cin>>N;
    ll x;
    vec h(N),a(N);
    rep(i,N) cin>>h[i];
    rep(i,N) cin>>a[i];
    rep(i,N){
        ll hi = h[i], ai = a[i];
        --hi;
        x = ai+query(hi,1,0,1<<18);
        hi += 1<<18;
        update(hi,x);
        //cout<<x<<endl;
    }
    cout<<segdp.at(1)<<endl;
}


Measured memory_bytes: 7552
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);  cin.tie(0) ; cout.tie(0);
#define debug(x) cout << #x << " : " << x << endl;
#define pi 3.14159265359
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
using ll = long long int;
using db = double;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
const int MOD = 1e9+9;

void solve()
{
    int x;
    cin >> x;
    if(x >= 30)
        cout <<"Yes\n";
    else
            cout <<"No\n";
    
    
}

int main()
{
//  #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin); 
//     freopen("output.txt", "w", stdout);
//  #endif
    fastio;

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

Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
int main(){
  ll h,w;
  cin>>h>>w;
  if(h%3==0||w%3==0){
    cout<<0<<endl;
    return 0;
  }
  ll ans=min(h,w);
  if(h==1 ||w==1){
    cout<<ans<<endl;
    return 0;
  }
  ll y;
  for(ll x=1;x<w;x++){
    y=h/2;
    ans=min(ans,max({abs(h*x-y*(w-x)),abs(h*x-(h-y)*(w-x)),abs(y*(w-x)-(h-y)*(w-x))}));
  }
  swap(h,w);
  for(ll x=1;x<w;x++){
    y=h/2;
    ans=min(ans,max({abs(h*x-y*(w-x)),abs(h*x-(h-y)*(w-x)),abs(y*(w-x)-(h-y)*(w-x))}));
  }
  cout<<ans<<endl;
}
  
  

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;
 
#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7
 
typedef long long ll;
typedef long long int lli;
int calc(int num) {
    if(num >= 100) {
        num = num%100;
    }
    if (num >= 10) {
        num = num%10;
    }
    if (num == 0) {
        num = 10;
    }
    return num;
}
 
int main() {
    int A, B, C, D, E;
    int res;
    cin >> A >> B >> C >> D >> E;
    res = A + B + C + D + E + (10-calc(A)) + (10-calc(B)) + (10-calc(C)) + (10-calc(D)) + (10-calc(E));
	res = res - (10-min({calc(A), calc(B), calc(C), calc(D), calc(E)}));
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  int d,n;
  cin >> d >> n;
 
  if(n==100) n=101;
  
  cout << n;
  
  rep(i,d) {
  cout << "00";
  }
  
}

Measured memory_bytes: 256
N,K = list(map(int,input().split()))
P = list(map(int,input().split()))

def bubblesort(l):
    for index in range(len(l)-1, 0, -1):
        for low in range(index):
            if l[low] > l[low+1]:
                tmp = l[low+1]
                l[low+1] = l[low]
                l[low] = tmp
    return l

bubblesort(P)
sum = 0
for i in range(K):
	sum = sum + P[i]
print(sum)

Measured memory_bytes: 9144
#include<iostream>
#include<algorithm>
using namespace std;
int sort_1(int a[], int n) {
	int k = 0;
	for (int i = n; i > 0; i--)
	{
		int flag = false;
		for (int j = 0; j < i-1; j++) {
			if (a[j] > a[j + 1]) {
				swap(a[j], a[j + 1]);
				flag = true;
				k++;
			}
		}
		if (!flag) break;
	}
	return k;
}
int main(void) {
	int n;
	cin >> n;
	int a[100];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int k = sort_1(a, n);
	for (int i = 0; i < n; i++) {
	    if(i>0) cout<<" ";
		cout << a[i];
	}
	cout << endl << k<<endl;
}


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

int main()
{
    int n ;
    string a ;
    while(cin >> n)
    {
        cin >> a ;
        int counts = 1 ;
        for(int i=1; i<n; i++)
        {
            if(a[i] != a[i-1])
            {
                counts++ ;
            }
        }
        cout << counts << '\n' ;
    }
}


Measured memory_bytes: 512
import itertools

antenas = list(map(int, [input() for _ in range(5)]))
k = int(input())
c_list = list(itertools.combinations(antenas, 2))

for combi in c_list:
    length = abs(combi[0] - combi[1])
    if length > k:
        print(':(')
        exit()
print('Yay!')


Measured memory_bytes: 3060
n, k, q = map(int, input().split())
aq = [int(input()) for i in range(q)]
point = [k for i in range(n)]
correct_ans = [0] * n

for i in range(q):
    correct_ans[aq[i] - 1] += 1
    
point = ['Yes'  if p - (q - ca) > 0 else 'No' for (p, ca) in zip(point, correct_ans)]
print(*point, sep='\n')

Measured memory_bytes: 10980
import heapq
import math
import os
import sys

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

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

SX, SY, TX, TY = list(map(int, sys.stdin.readline().split()))
N = int(sys.stdin.readline())
XYR = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]

S = N
T = N + 1
XYR.append([SX, SY, 0])
XYR.append([TX, TY, 0])
graph = [[] for _ in range(N + 2)]
for i, (xi, yi, ri) in enumerate(XYR):
    for j, (xj, yj, rj) in enumerate(XYR):
        if i == j:
            continue
        d = math.sqrt((xi - xj) ** 2 + (yi - yj) ** 2) - ri - rj
        graph[i].append((max(0, d), j))

heap = [(0, S)]
heapq.heapify(heap)
dist = [IINF] * (N + 2)
while heap:
    w, v = heapq.heappop(heap)
    if w > dist[v]:
        continue
    for dw, u in graph[v]:
        if w + dw < dist[u]:
            dist[u] = w + dw
            heapq.heappush(heap, (w + dw, u))
print(dist[T])


Measured memory_bytes: 130568
#!/usr/bin/env python
# -*- coding:utf-8 -*-

from __future__ import division, print_function, absolute_import, unicode_literals

N = int(input())
s = input()
t = input()

correspoint_cnt = 0
for i in range(1, len(s)+1):
    # print(s[-i:], t[:i])
    if s[-i:] == t[:i]:
        correspoint_cnt = i
# print(len(s), len(t), correspoint_cnt)
if len(s) + len(t) - correspoint_cnt < N:
    print(N)
else:
    print(len(s) + len(t) - correspoint_cnt)


Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string s;
  cin >> s;
  s.at(3) = '8';
  cout << s << endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
/*メモ 
*/
int main(){
    int n;
    std::cin >> n;
    VEC(int,a,n);
    int ans=pow(3,n),c=0;
    rep(i,n){
        if(a[i]%2==0)c++;
    }
    std::cout << ans-pow(2,c) << std::endl;
}



Measured memory_bytes: 256
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

string S;

signed main(){

    in(S);
    map<char,int> res;
    for(auto c:S){
        res[c]++;
    }
    for(auto e:res){
        if(e.sc&1){
            No;
            return 0;
        }
    }
    Yes;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
   long long n, i, ans=0;
   cin >> n;
   for(i=1;i<=n;i++){
      if(i%3!=0 && i%5!=0) ans+=i;
   }
   cout << ans <<endl;

   return 0;
}



Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
int main(void){
int sx,sy,tx,ty;
	cin >> sx >> sy >> tx >> ty;
	const int dx=tx-sx,dy=ty-sy;
	cout << string(dy,'U') << string(dx,'R');
	cout << string(dy,'D') << string(dx,'L');
	cout << 'L' << string(dy+1,'U') << string(dx+1,'R') << 'D';
	cout << 'R' << string(dy+1,'D') << string(dx+1,'L') << 'U';
	cout << endl;
	return 0;
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

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

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

class UnionFind{
  public:
  // 親の番号を格納する．親の場合は-(その集合のサイズ)
  vector<int> Parent; 
  
  // 全て-1
  UnionFind(int N){
    Parent = vector<int>(N, -1);
  }
  
  // Aがどのグループに属しているか
  int root(int A){
    if(Parent[A] < 0) return A;
    return Parent[A] = root(Parent[A]); // return前に自分の親を更新することで高速化
  }
  
  // 自分のいるグループの頂点数を調べる
  int size(int A){
    return -Parent[root(A)]; 
  }
  
  // AとBをくっつける
  bool connect(int A, int B){
    // AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
    A = root(A);
    B = root(B);
    if(A == B){
      // すでにくっついているからくっつけない
      return false;
    }
    
    // グループのサイズが大きい方(A)に小さい方(B)をくっつけたい
    // 大小が逆ならひっくり返す
    if(size(A) < size(B)) swap(A, B);
    
    // Aのサイズを更新する
    Parent[A] += Parent[B];
    // Bの親をAに変更する
    Parent[B] = A;
    
    return true;
  }
};

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n,m; cin>>n>>m;
  vi X(m), Y(m), Z(m);
  rep(i,m) {
    cin>>X[i]>>Y[i]>>Z[i];
    X[i]--; Y[i]--; Z[i]--;
  }
  auto uf = UnionFind(n);
  rep(i,m){
    uf.connect(X[i],Y[i]);
  }
  map<int, int> ma;
  int ans=0;
  rep(i,n){
    int p=uf.root(i);
    if(ma[p]==0){
      ma[p]++;
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 6528
# include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long 
ll dp[10005][105][2];
int n;string str;int k;
vector<int> v;
ll get(int pos,ll sum,bool  f)
{ ll& ans=dp[pos][sum][f];
  
  if(pos==n)
 { 
    if(sum%k==0) return (ans=1);
    else
      return (ans=0);
 }
 
 if(ans!=-1) return ans;
 ans=0;
  int lim=(f)? 9:v[pos];
  for(int i=0;i<=lim;i++)
  { 
    ans=(ans+get(pos+1,(sum+i)%k,f | (i<v[pos])))%mod;

  }
   return ans;
  
}

int main()
{  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  //string str;
 // cin.ignore();
  cin>>str;
  cin>>k;
  n=str.size();
 // cout<<str<<" ";
 //cout<<k<<" ";
 for(auto& i:str)
  v.push_back(i-'0');
   memset(dp, -1, sizeof (dp));
 cout<<(get(0,0,0)-1+mod)%mod;
  return 0;
  
}

Measured memory_bytes: 17536
import sys
x,n=map(int,input().split())
ans=10000
ans1=[]
ans2=[]
if n>0:
    l=list(map(int,input().split()))
else:
    print(x)
    sys.exit()
for i in range(len(l)):
    if abs(ans-l[i])<ans:
        ans1.append(l[i])
        ans1.append(l[i]-1)
        ans1.append(l[i]+1)
ans1=sorted(ans1)
for j in range(len(ans1)):
    if abs(x-ans1[j])<ans and ans1[j] not in l:
        ans2.append(ans1[j])
        ans=min(ans,x-ans1[j])
print(max(ans2))

Measured memory_bytes: 9260
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        v: [usize; 4]
    }
    let mut l = vec![false; 4];
    for x in v {
        if x == 1 {
            l[0] = true;
        } else if x == 9 {
            l[1] = true;
        } else if x == 7 {
            l[2] = true;
        } else if x == 4 {
            l[3] = true;
        }
    }
    println!("{}", if l.iter().all(|&x| x) {"YES"} else {"NO"});
}


Measured memory_bytes: 4352
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int main()
{
	int n,total;
	scanf("%d%d",&n,&total);
	total/=1000;
	for(int i=0;i<=n;++i)
	{
		for(int j=0;j+i<=n;++j)
		{
			int h=n-i-j;
			if(i+5*j+10*h==total)
			{
				printf("%d %d %d",h,j,i);
				return 0;
			}
		}
	}
	printf("-1 -1 -1");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
  int n,S,r;
  while(cin>>n>>S,n|S){
    vector<int>v(n);
    for(int i=0;i<n;i++){
      cin>>v[i];
    }
    sort(v.begin(),v.end(),greater<int>());
    int ans=0;
    for(int i=0;i<n-1;i++){
      if(v[i]>S){
	ans += n-i-1;
	continue;
      }
      if(v[i]+v[i+1]<=S)break;
      for(int j=i+1;j<n;j++){
	if(v[i]+v[j]<=S)break;
	ans++;
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << #x << "]: " << (x) << endl;

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

    int n;
    cin >> n;

    ll ans = 0;
    for (int i=1; i<n; i++) {
        ans += (n-1) / i;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<numeric>
#include<iomanip>
#include<utility>
#include<cstdlib>
#include<typeinfo>
#include<stack>
#include<cassert>
#include<functional>
#define int long long int
#define double long double
using namespace std;
#define INT_MAX 1000000005
#define INF 1000000005
const int MAX_N = 1 << 17;
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

signed main()
{
int n,x;
std::cin >> n >> x;
int mid = n;
std::vector<int> check(2 * n,0);
std::vector<int> out(2 * n,0);
if(n == 2){
    if(x == 2){
        std::cout << "Yes" << std::endl;
        std::cout << 1 << std::endl;
        std::cout << 2 << std::endl;
        std::cout << 3 << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
} else if(x == 1 || x == 2 * n - 1){
    std::cout << "No" << std::endl;
} else {
    std::cout << "Yes" << std::endl;
    if(x <= mid){
        int index = 1;
        out[mid - 2] = 2 * n - 1;
        check[2 * n - 1] = 1;
        out[mid - 1] = 1;
        check[1] = 1;
        out[mid] = x;
        check[x] = 1;
        out[mid + 1] = 2 * n - 2;
        check[2 * n - 2] = 1;
        for(int i = 1; i < 2 * n; i++){
            while(check[index] == 1){
                index++;
            }
            if(out[i] == 0){
                out[i] = index;
                check[index] = 1;
            }
        }
        for(int i = 1; i < 2 * n; i++){
            std::cout << out[i] << std::endl;
        }
    } else {
        int index = 1;
                out[mid-2] = 1;
                check[1] = 1;
                out[mid - 1] = 2 * n - 1;
                check[2 * n - 1] = 1;
                out[mid] = x;
                check[x] = 1;
                out[mid + 1] = 2;
                check[2] = 1;
        for(int i = 1; i < 2 * n; i++){
            while(check[index] == 1){
                index++;
            }
            if(check[index] != 1 && out[i] == 0){
                out[i] = index;
                check[index] = 1;
            }
        }
        for(int i = 1; i < 2 * n; i++){
            std::cout << out[i] << std::endl;
        }
    }
}
return 0;
}

Measured memory_bytes: 4608
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    ones = 0
    for a in A:
        # 数列Aの全要素の(二進法表記の)i桁目の１の数を集計する
        if a & (1 << i):
            ones += 1
    # Aの要素から任意の2つを選んで排他的論理和をとってできた数列をBとすると、
    # 数列Bの全要素のi桁目の合計は、(Aのi桁目の１の数)*(0の数)となる
    # 選んだ２つのAの要素が(0,1)の組み合わせになっている場合(XOR)だけに、Bの桁を構成する要素になるため
    ans = (ans + ones * (N - ones) * (1 << i)) % mod

print(ans)

Measured memory_bytes: 124584
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7
N = readline().decode().rstrip()
L = len(N)
dp = [[0]*2 for _ in range(L+1)]
dp[0][0] = 1
for i in range(L):
    nd = int(N[i])
    if nd == 0:
        dp[i+1][0] = dp[i][0]
        dp[i+1][1] = (3 * dp[i][1]) % MOD
    else:    
        dp[i+1][0] = 2 * dp[i][0] % MOD
        dp[i+1][1] = (3 * dp[i][1] + dp[i][0]) % MOD
print(sum(dp[L])%MOD)


Measured memory_bytes: 23980
def main():
    N = int(input())
    P = [int(input()) for _ in range(N)]

    #f1(N, P)
    editorial(N, P)


def editorial(N, P):
    """
    入力例3
        N=8
        P=63127485
         |6   7 8 |
         | 3   4 5|
         |  12    |
        上記の3つの列は要素ai+1=aiである部分列
            連続する列が長いほど、移動しなくて済む要素は多い
            連続するためには、最小未満は左・最大より大きいものは末尾に移動する
        部分列(wikipediaより)
            残った要素がもとの数列における相対的な序列を保つ
            与えられた列からいくつかの要素を取り去ることによって得られる列
    """
    if N == 1:
        print(0)
        return

    # WA(N, P)
    a = [0] * (N+1)
    for i, p in enumerate(P):
        a[p] = i

    tmp = 1
    max_len = 1
    for i in range(1, N):
        if a[i] < a[i+1]:
            tmp += 1
            max_len = max(max_len, tmp)
        else:
            tmp = 1

    ans = N - max_len
    print(ans)


def WA(N, P):
    tmp = 0
    ans = 0
    for i, p in enumerate(P):
        if i == 0 or P[i-1] + 1 == p:
            tmp += 1
        else:
            ans = max(ans, tmp)
            tmp = 1

    print(N - ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 18860
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;
const int N=1000010;
struct A{int x,y;}p[N],st[N];
char a[N],b[N];
int n,k=0;
bool ok(int x){
	for(int i=1;i<=k-x;i++)
		if(st[i+x].x-x<st[i].y) return false;
	return true;
}
int main(){
	int i,j,lb=0,rb,mid;
	scanf("%d%s%s",&n,a+1,b+1);
	for(i=1;i<=n;i++) if(a[i]!=b[i]) break;
	if(i>n){printf("0");return 0;}
	for(i=n,j=n;i>=1;i--){
		j=min(j,i);
		while(j&&a[j]!=b[i]) j--;
		if(j==0){printf("-1\n");return 0;}
		p[i]=(A){j,i};
	}
	for(i=1;i<=n;i++){
		if(p[i].x==p[i-1].x) st[k]=p[i];
		else st[++k]=p[i];
	}
	lb=0;rb=k;
	while(rb-lb>1){
		mid=lb+rb>>1;
		if(ok(mid)) rb=mid;
		else lb=mid;
	}
	printf("%d\n",rb);
	return 0;
}

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



template<class Ty>
class priority {
public:
	vector<Ty> inst;

	bool c(Ty good, Ty bad) {
		return good > bad;
	}

	bool empty() const { return inst.empty(); }
	size_t size() const { return inst.size(); }
	void shrink_to_fit() { inst.shrink_to_fit(); }
	void reserve(size_t s) { inst.reserve(s); }
	void insert(const Ty & a) {
		size_t i = size();
		inst.push_back(a);
		while (i != 0) {
			if (!c(inst[i], inst[(i - 1) / 2])) break;
			swap(inst[i], inst[(i - 1) / 2]);
			i = (i - 1) / 2;
		}
	}
	void insert(Ty && a) {
		size_t i = size();
		inst.push_back(a);
		while (i != 0) {
			if (!c(inst[i], inst[(i - 1) / 2])) break;
			swap(inst[i], inst[(i - 1) / 2]);
			i = (i - 1) / 2;
		}
	}
	const Ty &get() {
		return inst.front();
	}
	void pop() {
		swap(inst.front(), inst.back());
		inst.pop_back();
		size_t i = 0;
		while (true) {
			if (size() <= i * 2 + 1) break;
			if (size() > i * 2 + 2) {
				int j = (c(inst[i * 2 + 1], inst[i * 2 + 2])) ?
					(i * 2 + 1) : (i * 2 + 2);
				if (c(inst[j], inst[i])) {
					swap(inst[j], inst[i]);
					i = j;
					continue;
				}
			}
			else if (size() > i * 2 + 1) {
				if (c(inst[i * 2 + 1], inst[i])) {
					swap(inst[i * 2 + 1], inst[i]);
					i = i * 2 + 1;
					continue;
				}
			}
			break;
		}
	}
	Ty pick() {
		Ty buf = move(inst.front());
		pop();
		return move(buf);
	}
};

using node = pair<pair<int, int>, int>;
long long x[1000], y[1000], z[1000];

node tonode(int x, int y, int z) {
	return make_pair(make_pair(x, y), z);
}
long long val(node n) {
	return x[n.first.first] + y[n.first.second] + z[n.second];
}

int main() {
	priority<
		pair<long long, pair<pair<int, int>, int>>
	> q;

	set<pair<pair<int, int>, int>>u;

	int X, Y, Z, k; cin >> X >> Y >> Z >> k;
	for (int i = 0; i < X; i++)cin >> x[i];
	for (int i = 0; i < Y; i++)cin >> y[i];
	for (int i = 0; i < Z; i++)cin >> z[i];
	sort(x, x + X);
	sort(y, y + Y);
	sort(z, z + Z);

	node beg = tonode(X - 1, Y - 1, Z - 1);
	q.insert(make_pair(val(beg), beg));

	for (int i = 0; i < k; i++) {
		auto a = q.pick();
		if (u.count(a.second)) {
			i--; continue;
		}
		u.insert(a.second);
		cout << a.first << endl;
		if (a.second.first.first != 0) {
			a.second.first.first--;
			a.first = val(a.second); q.insert(a);
			a.second.first.first++;
		}
		if (a.second.first.second != 0) {
			a.second.first.second--;
			a.first = val(a.second); q.insert(a);
			a.second.first.second++;
		}
		if (a.second.second != 0) {
			a.second.second--;
			a.first = val(a.second); q.insert(a);
			a.second.second++;
		}
	}


	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,m,ans1=0,ans2=0,a;
    cin>>n>>m;
    rep(i,n){
        cin>>a;
        ans1+=(2*i-n+1)*a;
    }
    rep(i,m){
        cin>>a;
        ans2+=(2*i-m+1)*a;
    }
    cout1(((ans1%MOD)*(ans2%MOD))%MOD);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 5;
ll dp[N][2],arr[N];
void solve()
{
	int n;
	cin >> n;

	for (int i = 1; i < n + 1; i++)
		cin >> arr[i];
	memset(dp, 0, sizeof(dp));
	dp[2][1] = arr[2];
	dp[2][0] = arr[1];
	for (int i = 3; i < n + 1; i++)
	{
		if (i & 1)
		{
			ll temp = max({dp[i-3][1],dp[i-3][0],dp[i-2][1],dp[i-2][0]});
			//i为奇数 i要选x个  x=i/2
			//i-1 位置已经维护好 x个  那么只能从 选了x-1的 地方进行转移，很明显i-2   i-3  是维护好了x-1个
			dp[i][1] = arr[i] + temp;

			dp[i][0]=max({dp[i-1][1],dp[i-1][0],arr[i-2]+dp[i-3][0]});
			//该位置不选，从x继承dp[i-1][1]
			//从 x-1 的两个位置：i-2,i-3转移
		}
		else
		{
			dp[i][1]=arr[i]+max({dp[i-2][1],dp[i-2][0],dp[i-1][0]});///偶数位置 i  要选 i/2个 i-2的位置（i/2-1）
			//以及前一个不选
			dp[i][0] = arr[i-1]+dp[i-2][0];//i不选，一定选i-1  维护前i个必须选i/2个的特性
		}
	}
	cout << max(dp[n][1], dp[n][0]) << endl;
	return;
}

int main()
{
	solve();
	return 0;
}
/*
没有两个相邻的被选上
8
1 2 3 4 -1 -2 -3 -4
*/


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

int main(){
    int a, b;
    cin >> a >> b;
    string A, B = "";
    rep(i, b) A += to_string(a);
    rep(i, a) B += to_string(b);

    if(A<=B) cout << A << endl;
    else cout << B << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stack>

int OR[3][3]={
	{0,1,2},
	{1,1,2},
	{2,2,2},
};
int AND[3][3]={
	{0,0,0},
	{0,1,1},
	{0,1,2},
};

int conv(char a, int p, int q, int r){
	switch(a){
		case 'P':
			return p;
		case 'Q':
			return q;
		case 'R':
			return r;
		case '0':
			return 0;
		case '1':
			return 1;
		case '2':
			return 2;
	}
}

bool calc(char *s, int P, int Q, int R){
	std::stack<char> st;
	
	for(int i=0; s[i]!='\0'; i++){
	
		if(s[i] == ')'){
			int m;
		
			char rc = st.top();
			st.pop();
			int r = conv(rc, P, Q, R);
			for(m=0; st.top()=='-'; m++)
				st.pop();
			if(m%2)
				r = 2-r;
			
			char o = st.top();
			st.pop();
			
			char lc = st.top();
			st.pop();
			int l = conv(lc, P, Q, R);
			for(m=0; st.top()=='-'; m++)
				st.pop();
			if(m%2)
				l = 2-l;
			st.pop();
			
			int tmp;
			if(o == '*')
				tmp = AND[r][l];
			else
				tmp = OR[r][l];
				
			for(m=0; !st.empty() && st.top()=='-'; m++)
				st.pop();
			if(m%2)
				tmp = 2-tmp;

			st.push((char)(tmp+'0'));
		}
		else
			st.push(s[i]);
			
	}

	int tmp = conv(st.top(), P, Q, R);
	st.pop();
	int m;
	for(m=0; !st.empty() && st.top()=='-'; m++)
		st.pop();
	if(m%2)
		tmp = 2-tmp;

	if(tmp == 2)
		return true;
	return false;
}

int solve(char *s){
	int ans = 0;
	for(int p=0; p<3; p++)
		for(int q=0; q<3; q++)
			for(int r=0; r<3; r++)
				if(calc(s, p, q, r))
					ans++;
	return ans; 
}

int main(){

	char x[100];

	while(true){
		std::cin >> x;

		if(x[0] == '.')
			break;

		std::cout << solve(x) << std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  bool turn = true;
  while(A > 0 && C > 0)
  {
    if(turn)
      C -= B;
    else
      A -= D;
    turn = !turn;
  }
  if(A <= 0)
    cout << "No" << endl;
  else if(C <= 0)
    cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf{int(1e9)};
int main(void){
  int H, W;
  cin >> H >> W;
  vector <string> C(H);
  rep(i,H) cin >> C[i];

  rep(i,H){
    cout << C[i] << endl << C[i] << endl;
  }
}


Measured memory_bytes: 3600
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

double length(pair<int, int> a, pair<int, int> b){
    int aa = (b.first - a.first) * (b.first - a.first);
    int bb = (b.second - a.second) * (b.second - a.second);
    return sqrt(aa + bb);
}

int main(int argc, const char * argv[]) {
    // input from txt （提出時にこの箇所は削除すること）
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int n, x, y;
    cin >> n;
    vector<pair<int, int>> v(n);
    for(int i=0; i<n; i++){
        cin >> x >> y;
        v.at(i) = make_pair(x, y);
    }
    double res = 0;
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            res += length(v.at(i), v.at(j));
        }
    }
    res = res * 2 / n;
    cout << setprecision(15) << res << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String line = br.readLine();
	    int W = Integer.parseInt(line.split(" ")[0]);
	    int H = Integer.parseInt(line.split(" ")[1]);
	    int x = Integer.parseInt(line.split(" ")[2]);
	    int y = Integer.parseInt(line.split(" ")[3]);
	    int r = Integer.parseInt(line.split(" ")[4]);

	    if (r <= x && x <= (W - r) && r <= y && y <= (H - r)) {
		    System.out.println("Yes");
	    } else {
		    System.out.println("No");
	    }
	}
}

Measured memory_bytes: 24464
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
using P=pair<int,int>;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,k;
  cin >> n >> k;
  cout << (n-1+k-1-1)/(k-1) << endl;
}

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

int main()
{
	long long ans=0;
	int a,b,c,x,y;
	cin>>a>>b>>c>>x>>y;
	c<<=1;
	if(c<a+b)
	{
		if(c>a&&c>b)
		{
			int qaq=min(x,y);
			ans+=1ll*c*qaq;
			ans=ans+1ll*a*(x-qaq)+1ll*b*(y-qaq);
			cout<<ans<<endl;
			return 0;
		}
		if(c<=a)
		{
			ans+=1ll*c*x;
			y-=x;
			if(y>0)
				ans+=1ll*y*min(c,b);
			cout<<ans<<endl;
			return 0;
		}
		if(c<=b)
		{
			ans+=1ll*c*y;
			x-=y;
			if(x>0)
				ans+=1ll*x*min(a,c);
			cout<<ans<<endl;
			return 0;
		}
	}
	cout<<1ll*a*x+1ll*b*y;
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

ll mod(ll a) {
	if (a > 0) return a % MOD;
	if (a % MOD == 0) return 0;
	ll x = -a / MOD + 1;
	a += x * MOD;
	return a % MOD;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
template <typename T> void dump(T x) { cout << x << endl; }
void dumpf(double x, ll t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
// ll dx[4] = {1, 0, -1, 0};
// ll dy[4] = {0, 1, 0, -1};
// ll pas[5001][5002];

ll fact[364364] = {}, facti[364364] = {};

const ll MOD2 = 998244353;
ll n;
ll ok(ll a, ll b) { return (a % b == 0 && a / b >= 0 && a / b <= n); }

int main() {
	IOS();
	ll a, b, k;
	cin >> n >> a >> b >> k;
	fact[0] = facti[0] = 1;
	for (ll i = 1; i <= n; ++i) {
		fact[i]  = (fact[i - 1] * i) % MOD2;
		facti[i] = powm(fact[i], MOD2 - 2, MOD2);
	}
	ll ans = 0;
	for (ll i = 0; i <= n; ++i) {
		if (ok(k - i * a, b)) {
			ll j   = (k - i * a) / b;
			ll tmp = (((fact[n] * facti[i]) % MOD2) * facti[n - i]) % MOD2;
			tmp *= (((fact[n] * facti[j]) % MOD2) * facti[n - j]) % MOD2;
			tmp %= MOD2;
			ans += tmp;
			ans %= MOD2;
		}
	}
	dump(ans);
	return 0;
}

Measured memory_bytes: 5504
// Problem B - Vacation - MATA52
#include <iostream>
#include<bits/stdc++.h>

using namespace std;

int main() {
    int days;
    int max_a = -1, max_b = -1, max_c = -1, max_happiness = -1;
    int a_ant = 0, b_ant = 0, c_ant = 0, a, b, c;
    
    cin >> days;
    for(int i = 0; i < days; i++) {
        cin >> a >> b >> c;     // read activities 
        int today_a = max(b_ant + a, c_ant + a);     // activity a with others
        max_a = max(today_a, max_a);                 // max of activities a
        max_happiness = max(max_a, max_happiness);   // max Taro happiness
        
        int today_b = max(a_ant + b, c_ant + b);    // activity b with others
        max_b = max(today_b, max_b);                // max of activities b
        max_happiness = max(max_b, max_happiness);  // max Taro happiness
        
        int today_c = max(b_ant + c, a_ant + c);    // activity c with others
        max_c = max(today_c, max_c);                // max of activities c
        max_happiness = max(max_c, max_happiness);  // max Taro happiness
        
        // update activities of yesterday with the choices of today
        a_ant = today_a;
        b_ant = today_b;
        c_ant = today_c;
    }
    // print max happiness obtained
    cout << max_happiness << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define si(x) scanf("%d",&x)
#define sf(x) scanf("%lf",&x)
#define sl(x) scanf("%lld",&x)
#define pr(x) printf("%d\n",x)
#define prll(x) printf("%lld\n",x)
 
#define ll long long int
#define ull unsigned long long int
#define F first
#define S second
 
#define rep(i,x,y) for(int i=x;i<y;i++)
#define ii pair<int,int> 
#define pll pair<ll,ll> 
#define vi vector<int> 
#define vvi vector< vi > 
#define vl vector<long long int>
#define vvl vector< vl >
#define vii vector< ii >
#define vvii vector< vii >
#define priority_queue pq;
#define sz(a) ll((a).size()) 
#define pb push_back 
#define mp make_pair
 
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)
#define SET(a,b) memset(a,b,sizeof(a))
#define all(c) (c).begin(),(c).end() 
#define tr(i,c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ison(x,i) (((x) >> (i)) & 1)	//checks if ith bit is on
#define set0(x,i) (x & ~(1 << i))		//set ith bit in x to be zero
#define clr(a) memset(a,0,sizeof(a))
 
#define MOD 1000000007
#define INF 4000000000000000000
#define MAX 100000+5
using namespace std;

int a[MAX]={0};

int main()
{
	int n,p;
	si(n);
	rep(i,0,n)
	{
		si(p);
		a[p]++;
		if(p>=1)
			a[p-1]++;
		a[p+1]++;
	}
	int ans=0;
	rep(i,0,MAX)
		ans = max(ans,a[i]);
	pr(ans);
	return 0;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

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

#define rep(i, n) for (ll i = 0; i < n; i++)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S;
    cin >> S;

    bool Nflag = false;
    bool Sflag = false;
    bool Wflag = false;
    bool Eflag = false;
    rep (i, S.size()) {
        if (S[i] == 'N') {
            Nflag = true;
            break;
        }
    }
    rep (i, S.size()) {
        if (S[i] == 'W') {
            Wflag = true;
            break;
        }
    }
    rep (i, S.size()) {
        if (S[i] == 'S') {
            Sflag = true;
            break;
        }
    }
    rep (i, S.size()) {
        if (S[i] == 'E') {
            Eflag = true;
            break;
        }
    }

    if (Nflag == Sflag && Wflag == Eflag) {
        Yes;
    } else {
        No;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.size();i++){
		rotate(s.begin(),s.begin()+1,s.end());
		if(s==t){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

void solve() {
	int n,l;
	string s, ans="";
	vector<string> list;
	cin >> n >> l;
	
	while(n--) {
		cin >> s;
		list.emplace_back(s);
	}
	
	sort(list.begin(), list.end());
	
	for(string st: list) {
		ans += st;
	}
	cout << ans << endl;
}
		
			
		

int32_t main() {
	IOS;
	solve();
	return 0;
}


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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

//Write From this Line

const int mod = 1e9+7;
int main()
{
	int n , k ;
	cin>> n >> k ;
	//n個のボールに書かれている数字の種類をK以下にしたいk
	vector<int> a(n);
	rep(i,n) cin >>a[i];

	map<int,int> p;
	rep(i,n){
		p[a[i]] ++ ;
	}
	int ans = 0 ;
	vector<int> count(0);
	if(p.size() > k ){
		for(auto x : p) {
			count.push_back( x.second);	
		}
		SORT(count);
		rep(i,p.size()-k){
			ans += count[i];
		}
	}
	cout << ans << endl;
}


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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);


int n,memo[100][26],ans;
string s;

main() {
    cin >> n >> s;
    rep(i,n) memo[i][(int)(s[i]-'a')]++;
    rep(j,26) rep1(i,n-1) memo[i][j] += memo[i-1][j];
    rep(i,n-1) {
        int cnt=0;
        rep(j,26) if (memo[i][j] && memo[i][j] != memo[n-1][j]) cnt++;
        ans = max(ans,cnt);
    }
    ct(ans)
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define sc(x)   scanf("%c",&x);
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;

int mpow(int base, int exp); 
bool isprime(ll n);

const int mod = 1000000007;
const int N = 3e5, M = N;
//=====================================================

//vi g[N];
//int a[N];

void solve() {
  int a;si(a);
  int ans=pow(a,1)+pow(a,2)+pow(a,3);
  pi(ans); 
  
}

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

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

    return 0;
    
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
bool isprime(ll n){
    if(n<=1)
        return false;
    if(n==2)
        return true;
    if(n%2==0)
        return false;
    ll rt = sqrt(n);
    for(ll i=3;i<rt;i+=2){
        if(n%i==0)
            return false;
    }
    return true;
}



Measured memory_bytes: 4240
N=int(input())
alist=list(map(int,input().split()))

div2list=[]
for a in alist:
  cnt=0
  while(True):
    if a%2==1:
      break
    else:
      a//=2
      cnt+=1
  div2list.append(cnt)
  
print(sum(div2list))

Measured memory_bytes: 4148