akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
int main()
{
	int n,m,k;
	int card[200];
	int tmp[200];
	std::cin>>n>>m;
	
	for(int i=0; i<200; i++)card[i] = i+1;
	
	for(int i=0; i<m; i++){
		std::cin>>k;
		if( k==0 ){
			int t = 0;
			for(int j=0; t<n;){
				tmp[j] = card[t];
				j++;
				tmp[j] = card[n+t];
				j++;
				t++;
			}
		}else{
			for(int j=0; j<2*n-k; j++)tmp[j]=card[j+k];
			for(int j=0; j<k; j++)tmp[2*n-k+j] = card[j];
		}
		
		for(int j=0; j<2*n; j++)card[j]=tmp[j];
		
		//for(int i=0; i<2*n; i++)
		//printf("%d\n",card[i]);
		//puts("");
	}
	for(int i=0; i<2*n; i++)
		printf("%d\n",card[i]);
	return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
int b,z[60],i,m,n;
int main()
{
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++)
    	scanf("%d",&z[i]);
    sort(z+1,z+n+1);
    for(i=1;i<=m;i++)
        b+=z[n-i+1];
    printf("%d\n",b);
    return 0;
}

Measured memory_bytes: 256
<?php
  fscanf(STDIN, '%d %d %d %d %d %d %d', $i, $o, $t, $j, $l, $s, $z);

  $result = floor($i/2)*2+$o*1+floor($j/2)*2+floor($l/2)*2;
  $i_block = floor($i/2);
  $j_block = floor($j/2);
  $l_block = floor($l/2);
  $i_mod = $i - $i_block*2;
  $l_mod = $l - $l_block*2;
  $j_mod = $j - $j_block*2;

    $result_a = $result;
  $result_b = 0;
  if ($i != 0 && $j != 0 && $l != 0) {
    if ($i_mod == 0) {
      $i_block--;
    }
    if ($l_mod == 0) {
      $l_block--;
    }
    if ($j_mod == 0) {
      $j_block--;
    }
    $result_b = $i_block*2+$o*1+$j_block*2+$l_block*2+3;
  }

  echo max($result_a, $result_b);

Measured memory_bytes: 4604
import java.util.*;

public class Main {
    private class Query {
        int a, b, c, d;

        public Query(int a, int b, int c, int d) {
            this.a = a;
            this.b = b;
            this.c = c;
            this.d = d;
        }
    }

    public void main(Scanner sc) {
        char s[] = sc.next().toCharArray();
        char t[] = sc.next().toCharArray();
        int q = sc.nextInt();
        Query data[] = new Query[q];
        for (int i = 0; i < q; i++) {
            data[i] = new Query(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
        }

        int sums[] = new int[s.length + 1];
        int sumt[] = new int[t.length + 1];
        for (int i = 0; i < s.length; i++) {
            sums[i + 1] = (sums[i] + (s[i] == 'A' ? 1 : 2)) % 3;
        }
        for (int i = 0; i < t.length; i++) {
            sumt[i + 1] = (sumt[i] + (t[i] == 'A' ? 1 : 2)) % 3;
        }

        int a, b, c, d;
        for (int i = 0; i < q; i++) {
            a = sums[data[i].a - 1];
            b = sums[data[i].b];
            c = sumt[data[i].c - 1];
            d = sumt[data[i].d];

            System.out.println(((3 + b - a) % 3 == (3 + d - c) % 3) ? "YES" : "NO");
        }
    }

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


Measured memory_bytes: 123964
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
  static void Main(string[] args)
  {
    int n = int.Parse(Console.ReadLine());
    List<string> items = new List<string>();
    items.Add("7");
    items.Add("5");
    items.Add("3");
    
    int count = 0;
    for(int i=1;i<=n.ToString().Length;i++){
      var listWork = make753(items,"",i);
      foreach(string work in listWork){
        if(int.Parse(work) > n) continue;
        if(!work.Contains("7")) continue;
        if(!work.Contains("5")) continue;
        if(!work.Contains("3")) continue;
        count++;
      }
    }
        
    Console.WriteLine(count);
  }
  
  static List<string> make753(List<string> items, string pre, int length){
    List<string> rtn = new List<string>();
    
    for(int i=0;i<items.Count;i++){
      string work=pre+items[i];
      if(work.Length<length){
      	rtn.AddRange(make753(items, work, length));
      }else{
        rtn.Add(work);
      }
    }
    return rtn;
  }
}

Measured memory_bytes: 21976
n, k = input().split()
n = int(n)
k = int(k)

a = [int(input()) for i in range(int(n))]

a.sort()
gosa = []
for i in range(n-k+1):
    gosa.append(a[i+k-1]-a[i])

gosa.sort()
print(gosa[0])


Measured memory_bytes: 11288
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
#define rep(i,n) for (int i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){


    int X;
    cin >>X;

    int ans;
    int va;


    va = max(0,X / 500);
    ans = va * 1000;
    X = X - va * 500;

    va = max(0,X / 5);
    ans += va * 5;
    X = X - va * 5;
    cout << ans << endl;
}

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

int main() {
  int h,w,k;
  cin >> h >> w >> k;

  char c[h+1][w+1];
  

  for(int i=1;i<=h;i++){
      for(int j=1;j<=w;j++){
          cin >> c[i][j];
          
      }
  }

int a[7];
int b[7];
int ans=0;

for(int s=0; s<(1<<(h+w)); s++){
   for(int i=0;i<h+w;i++){
        if(i<=h-1){
        if(s >> i & 1){
            a[i+1]=1;
        }
        else{
            a[i+1]=0;
        }
        }
        else if(i>=h){
            if(s >> i & 1){
            b[i-h+1]=1;
        }
        else{
            b[i-h+1]=0;
        }
        }
    }
    char set[h+1][w+1];
          for(int l=1;l<=h;l++){
              for(int m=1;m<=w;m++){
                  set[l][m]=c[l][m];
              }
          }
      
      for(int i=1;i<=h;i++){
          if(a[i]==1) {
              for(int j=1;j<=w;j++){
                  set[i][j]='^';
              }
          }
      }

      for(int i=1;i<=w;i++){
          if(b[i]==1) {
              for(int j=1;j<=h;j++){
                  set[j][i]='^';
              }
          }
      }
    

    int anan=0;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(set[i][j]=='#') anan++;
        }
    }
    if(anan==k) ans++;
}
  cout << ans << endl;

}

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }
template<typename A, size_t N, typename T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

string s;
ll dp[1000005][2];
void solve() {
    cin >> s;

    s = '0' + s;
    auto n = sz(s);
    fillArray(dp, inf);
    dp[0][0] = 0;
    rep(i, n) rep(j, 2) {
        int x = s[i] - '0';
        x += j;
        if (x < 10) mins(dp[i + 1][0], dp[i][j] + x);
        if (x > 0) mins(dp[i + 1][1], dp[i][j] + (10 - x));
    }

    cout << min(dp[n][0], dp[n][1] + 1) << endn;

}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 16968
#include <iostream>


using namespace std;

int main(){
	int H, W, h, w;

	while (1){
		cin >> H >> W;
		if (H == 0 && W == 0) break;
		for (int i = 0; i < H; i++){
			for (int j = 0; j < W; j++){
				if (i%2==j%2){
					cout << "#";
				}	else {
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;

	}

	return 0;
}

Measured memory_bytes: 1152
N = int(input())
s = []
for i in range(N):
    s.append(int(input()))
sorted_s = sorted(s)
ans = sum(s)
if ans % 10 != 0:
    print(ans)
else:
    for i in sorted_s:
        if (ans - i) % 10 != 0:
            print(ans - i)
            break
    else:
        print(0)

Measured memory_bytes: 3064
n, y = map(int,input().split())

def f(n,y):
    for i in range(n+1):
        for j in range(n-i+1):
            s = 10000*i + 5000*j + 1000*(n-i-j)
            if s == y:
                return '{0} {1} {2}'.format(i,j,n-i-j)

    return '-1 -1 -1'

print(f(n,y))

Measured memory_bytes: 3060
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
#include<stdio.h>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

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

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}

int main(){
    string S;
    cin >> S;
    int L=S.length();
    int N=L;
    L-=2;
    string R=toString(L);
    string T=S[0]+R+S[N-1];
    cout << T;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    double n; cin >> n;
    double ans = 0;
    eFOR(i, 1, n)if (i % 2)ans += 1;
    cout << ans / n << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int X, Y, A, B, C;
	cin >> X >> Y >> A >> B >> C;
	vector<int> p(A), q(B), r(C);
	REP(i, A) scanf("%d", &p[i]);
	REP(i, B) scanf("%d", &q[i]);
	REP(i, C) scanf("%d", &r[i]);
	
	sort(ALL(p), greater<int>());
	sort(ALL(q), greater<int>());
	
	vector<int> v;
	REP(i, X) v.emplace_back(p[i]);
	REP(i, Y) v.emplace_back(q[i]);
	REP(i, C) v.emplace_back(r[i]);
	sort(ALL(v), greater<int>());
	cout << accumulate(v.begin(), v.begin() + X + Y, 0ll) << endl;
}


Measured memory_bytes: 3572
#include <stdio.h>

int euclid( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

    if( a % b == 0 ) return b;
    return euclid( b, a % b );
}


int main(void){
    int a, temp, num, sum, i, j, k;
    scanf("%d", &a);

    sum = 0;

    for(i = 1; i <= a; i++){
        for(j = 1; j <= a; j++){
            for(k = 1; k <= a; k++){
                temp = euclid(i, j);
                num = euclid(temp, k);
                sum += num;
            }
        }
    }

    printf("%d\n", sum);

    return 0;

}

Measured memory_bytes: 1732
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000
#define MAXM 110
#define MAXN 110
typedef long long ll;
// firstは最短距離、secondのfirstは残り冷凍時間、secondは位置
typedef pair <int, pair<int, int> > P;

struct edge {
    int rest, to;
    int cost;
};

int dist[MAXM][MAXN];
int N, M, L, K, A, H;
vector<edge> es[MAXM][MAXN];
vector<int> freeze;

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    for (int i = 0; i <= M; i++) {
        for (int j = 0; j < N; j++) {
            dist[i][j] = INF;
        }
    }
    dist[M][A] = 0;
    que.push(P(0, make_pair(M, A)));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        int m = p.second.first, v = p.second.second;
        if (dist[m][v] < p.first) continue;
        for (int i = 0; i < es[m][v].size(); i++) {
            edge e = es[m][v][i];
            if (dist[e.rest][e.to] > dist[m][v] + e.cost) {
                dist[e.rest][e.to] = dist[m][v] + e.cost;
                que.push(P(dist[e.rest][e.to], make_pair(e.rest, e.to)));
            }
        }
    }
}

int main(void) {
    while (1) {
        cin >> N >> M >> L >> K >> A >> H;
        if (N == 0) break;
        for (int i = 0; i < MAXM; i++)
            for (int j = 0; j < MAXN; j++)
                es[i][j].clear();
        freeze.clear();
        for (int i = 0; i < L; i++) {
            int l;
            cin >> l;
            freeze.push_back(l);
        }
        for (int i = 0; i < K; i++) {
            int x, y, t;
            cin >> x >> y >> t;
            edge e;
            for (int j = t; j <= M; j++) {
                e.rest = j - t; e.to = y; e.cost = t; es[j][x].push_back(e);
                e.to = x; es[j][y].push_back(e);
            }
        }
        for (int i = 0; i < freeze.size(); i++) {
            for (int j = 0; j < M; j++) {
                edge e;
                e.rest = j+1; e.to = freeze[i]; e.cost = 1; es[j][freeze[i]].push_back(e);
            }
        }
//        for (int i = 0; i < N; i++) {
//            for (int j = 0; j <= M; j++) {
//                printf("(rest:%d, pos:%d)\n", j, i);
//                for (int k = 0; k < es[j][i].size(); k++) {
//                    edge e = es[j][i][k];
//                    printf("torest:%d, to:%d, cost:%d\n", e.rest, e.to, e.cost);
//                }
//            }
//        }
        dijkstra(A);
        int ret = INF;
        for (int i = 0; i <= M; i++) {
            ret = min(ret, dist[i][H]);
        }
        if (ret < INF) cout << ret << endl;
        else cout << "Help!" << endl;
    }

    return 0;
}

Measured memory_bytes: 5292
<?php
fscanf(STDIN,"%d",$a);
fscanf(STDIN,"%d",$b);
fscanf(STDIN,"%d",$c);
fscanf(STDIN,"%d",$d);
fscanf(STDIN,"%d",$e);
fscanf(STDIN,"%d",$k);
$s=max($a,$b,$c,$d,$e)-min($a,$b,$c,$d,$e);
if($s<=$k){
  echo "Yay!";
}else{
  echo ":(";
}

echo "\n";


  
  
  
  
  
  
  ?>

Measured memory_bytes: 3700
#include<stdio.h>
int D[7][7]={{},
{0,0,4,2,5,3,0},
{0,3,0,6,1,0,4},
{0,5,1,0,0,6,2},
{0,2,6,0,0,1,5},
{0,4,0,1,6,0,3},
{0,0,3,5,2,4,0}},G[7],N,i,t,f;
int sc(int d)
{
	int i;
	for(i=1;i<=6;i++)
		if(G[i]==d)
			return i;
}
int main()
{
	for(i=1;i<7;i++)scanf("%d",G+i);
	scanf("%d",&N);
	for(;N--;)
	{
		scanf("%d%d",&t,&f);
		printf("%d\n",G[D[sc(f)][sc(t)]]);
	}
	return 0;
}

Measured memory_bytes: 596
N = int(input())
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
Alice = []
Bob = []
for i in range(N) :
    if i % 2 == 0 :
        Alice.append(A[i])
    else :
        Bob.append(A[i])
print(sum(Alice)-sum(Bob))



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
int main()
{
   char a[200010];
   while(scanf("%s",a)!=EOF)
   {
       int nums[27];
       memset(nums,0,sizeof(nums));
       ll ans=1;
       int len=strlen(a);
       nums[a[0]-'a']++;
       for(int i=1;i<len;i++)
       {
           ans+=i;
           ans-=nums[a[i]-'a'];
           nums[a[i]-'a']++;
       }
       cout<<ans<<endl;
   }

   return 0;
}


Measured memory_bytes: 384
def initSets(N):
    return [ x for x in range(N) ]

def getRoot(arr, n):
    while arr[n] != n:
        arr[n] = arr[arr[n]]
        n = arr[n]
    return n

def union(arr, n, m):
    a = getRoot(arr, n)
    b = getRoot(arr, m)
    if a != b:
        arr[a] = b

def isSameSet(arr, n, m):
    return getRoot(arr, n) == getRoot(arr, m)

def getFibs():
    fibs = []
    a = 1
    b = 1
    while len(fibs) < 1000:
        c = (a + b) % 1001
        a = b
        b = c
        fibs.append(c)
    return fibs
        
if __name__ == '__main__':
    try:
        FIBS = getFibs()
        while True:
            V, d = list(map(int, input().strip().split()))

            fibs = FIBS[:V]
            arr = initSets(V)

            for i in range(V):
                for j in range(i + 1, V):
                    if abs(fibs[i] - fibs[j]) < d:
                        union(arr, i, j)
            
            subsets = {}
            for i in range(V):
                root = getRoot(arr, i)
                if root in subsets:
                    subsets[root].append(fibs[i])
                else:
                    subsets[root] = [fibs[i]]

            print(len(subsets))

    except EOFError:
        pass


Measured memory_bytes: 5652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    string S, T;
    cin >> S >> T;
    int N = sz(S);
    int ans = 0;
    rep(i, N){
        if(S[i] != T[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3916
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  int a[n]={0};
  while(k--)
  {
    int d;
    cin>>d;
    for(int i=0;i<d;i++)
    { int c;cin>>c;a[c-1]++;}
  }
  int cnt=0;
  for(int i=0;i<n;i++)
  {
  if(a[i]==0)cnt++;
  }
  cout<<cnt<<endl;
}
  
      
  


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <array>
#include <iomanip>
using namespace std;
long Nchoose2(long n){
    return n*(n-1)/2;
}
template<typename TypeInt>
std::string Itoa(const TypeInt v, int base)
{
	static const char table[] = "abcdefghijklmnlpqrstuvwxyz";
	string ret;
	static numeric_limits<TypeInt> t;
	TypeInt n = v;
	if (t.is_signed) {
		if (v < 0) n *= -1;
	}
 
	while (n >= base) {
		ret += table[n%base];
		n /= base;
	}
	ret += table[n];
	if (t.is_signed) {
		if (v < 0 && base == 10) ret += '-';
	}
	// 文字列の順番を逆にする
	std::reverse(ret.begin(), ret.end());
 
	return ret;
}
int main(){
    long n;
    cin >> n;
    string ans;

    while(n > 0){
        n--;
        ans += ('a'+n%26);
        n /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    
   return 0;
}

Measured memory_bytes: 3576
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
a = LI()

anss = []
ans_base = 0
for i in range(N):
    ans_base ^= a[i]

for i in range(N):
    anss.append(ans_base ^ a[i])


anss = map(str, anss)
print(" ".join(anss))


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

const int INF = 1e9;

int main() {
    int n, k;
    cin>>n>>k;
    double  a[n+1];
    a[0] = 0;

    for (int i=1; i<=n; i++) {
        if (i >= k) {
            a[i] = 1.0 / n;
            continue;
        }
        int x = (int)log2((k - 1)/ i) + 1;
        a[i] = pow(0.5, x) / n;
    }
    double ans = 0.0;
    for (int i=1; i<=n; i++) {
        ans += a[i];
    }
    printf("%.16f", ans);
}

Measured memory_bytes: 1024
#pragma comment(linker, "/stack:247474112")
#pragma GCC optimize("Ofast")
#include"bits/stdc++.h"
using namespace std;
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define int long long
#define ends ' '
#define endl '\n'
#define pb emplace_back
#define x first
#define y second
#define pii pair<int, int>
#define sz(x) (int)(x).size()

void solve() {
    int a, b, x, y;
    cin >> a >> b >> x >> y;
	int ans = LLONG_MIN;
  	vector<int> v{a*x, a*y, b*x, b*y};
  	cout << *max_element(v.begin(), v.end());
}

int32_t main() {
	IOS;

    int t = 1;
    while(t--) {
        solve();
    }
		
	return 0;
}

Measured memory_bytes: 3640
def Main(N, A):
    d = {}
    d2 = {}
    ans = 0
    for i in range(N):
        p = i+A[i]
        if p not in d:
            d[p] = []
        d[p].append(i)
    for i in range(N):
        q = i-A[i]
        if q not in d2:
            d2[q] = []
        d2[q].append(i)
    for k, v in d.items():
        if len(v) > 0 and k in d2:
            ans += len(v) * len(d2[k])
    return ans
        
    
def main():
    N = int(input())
    A = list(map(int, input().split()))
    print(Main(N, A))

if __name__ == '__main__':
    main()

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

static const int N = 1000;

int lcs(string X,string Y){
  int c[N+1][N+1];
  int m = X.size();
  int n = Y.size();
  int maxl = 0;

  X = ' ' + X;
  Y = ' ' + Y;

  for(int i=0;i<=m;i++){
    c[i][0]=0;
  }
  for(int j=1;j<=n;j++){
    c[0][j]=0;
  }

  for(int i=1;i<=m;i++){
    for(int j=1;j<=n;j++){
      if(X[i]==Y[j]){
        c[i][j] = c[i-1][j-1]+1;
      }else{
        c[i][j] = max(c[i-1][j],c[i][j-1]);
      }
      maxl = max(maxl,c[i][j]);
    }
  }
  return maxl;
}

int main(){
  string s1,s2;
  int n; cin >> n;
  for(int i=0;i<n;i++){
    cin >> s1 >> s2;
    cout << lcs(s1,s2) << endl;
  }
  return 0;
}



Measured memory_bytes: 7116
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner scan = new Scanner(System.in);
        
        String s = scan.nextLine();
        
        String s1 = s.substring(0 , 1);
        String s2 = s.substring(1 , 2);
        String s3 = s.substring(2 , 3);
        
        int topping = 0;
        
        if (s1.equals("o")) {
                topping++;
        }if (s2.equals("o")) {
                topping++;
        } if (s3.equals("o")) {
            topping++;
        }
        
        int noodle = 700 + topping*100;
        
        System.out.println(noodle);
    }
    
}

Measured memory_bytes: 35792
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }
        sc.close();

        int prev = h[n - 1];
        for (int i = n - 2; i >= 0; i--) {
            if (h[i] <= prev) {
                // do nothing
                prev = h[i];
            } else if (h[i] == prev + 1) {
//                prev = prev;
            } else {
                System.out.println("No");
                System.exit(0);
            }
        }
        System.out.println("Yes");
    }

}


Measured memory_bytes: 49932
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

class UnionFind():
    def __init__(self, n):
        self.n = n
        # parents[i]: 要素iの親要素の番号
        # 要素iが根の場合、parents[i] = -(そのグループの要素数)
        self.parents = [-1] * n
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    # 要素xが属するグループの要素数を返す
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    # 要素xが属するグループに属する要素をリストで返す
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    # 全ての根の要素をリストで返す
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    # グループの数を返す
    def group_count(self):
        return len(self.roots())
    # 辞書{根の要素: [そのグループに含まれる要素のリスト], ...}を返す
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    # print()での表示用
    # all_group_members()をprintする
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N, M = MAP()
A = LIST()
ab = [LIST() for i in range(M)]
graph = defaultdict(list)
tree = UnionFind(N)
for a, b in ab:
    tree.union(a-1, b-1)
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
# a = tree.group_count()
# print(a)
cnt = 0
for i in range(N):
    my_h = A[i]
    tmp = 0
    for node in graph[i]:
        if A[node] < my_h:
            tmp += 1
    if tmp == len(graph[i]):
        cnt += 1

print(cnt)

Measured memory_bytes: 60332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N,M;
    cin >> N >> M;
    int num = M/N;
    while(num>=0){
        if((M-N*num)%num==0){
            cout << num << endl;
            return 0;
        }
        num--;
    }
    cout << "ERROR" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int i,sum;
	char c[1001];
	while (1){
		scanf("%s",c);
		if (c[0]=='0') break;
		sum=0;
		for (i=0; c[i]>='0'&&c[i]<='9'; i++)
			sum += c[i]-'0';
		printf("%d\n", sum);
	}
	return 0;
}


Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define Would
#define you
#define please

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


	int N;
	cin >> N;

	int kotae = 1000;

	rep1(i, N - 1) {
		int A = i;
		int B = N - i;

		int A2 = 0;
		int B2 = 0;

		while (A) {
			A2 += A % 10;
			A /= 10;
		}
		while (B) {
			B2 += B % 10;
			B /= 10;
		}
		kotae = min(kotae, A2 + B2);
	}

	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
#define F first
#define S second
using namespace std;
using namespace atcoder;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
typedef pair<ll, ll> P;
ll Mod = 1000000007;

ll N;
ll calc(ll a,ll b) {
  if (__gcd(a,b) != 1) {
    return -1;
  }
  // a < b
  vector<P> E;
  ll c = a;
  ll d = b;
  E.emplace_back(a,b);
  while (d % c != 0) {
    ll f = d % c;
    d = c;
    c = f;
    E.emplace_back(c,d);
  }
  int sz = (int)E.size();
  ll x = 1;
  ll y = -(E[sz-2].S / E[sz-2].F);
  for (int i = sz - 3; i >= 0; i--) {
    ll z = -(E[i].S / E[i].F);
    ll nx = y;
    ll ny = (x + (y * z));
    x = nx;
    y = ny;
  }
  x *= -1;
  y *= -1;
  ll way1 = x % a;
  ll way2 = y % b;
  if (way1 < 0) way1 += a;
  if (way2 < 0) way2 += b;
  ll res = min(way1 * b,way2 * a);
  return res;
}

int main() {
  cin >> N;
  vector<P> vec;
  if (N == 1) {
    cout << 1 << endl;
    return 0;
  }
  ll ans = N - 1;
  for (ll i = 2; i <= sqrt(N*2); i++) {
    if ((N*2) % i == 0) {
      vec.emplace_back(i,(N*2)/i);
    }
  }
  for (int i = 0; i < (int)vec.size(); i++) {
    ll res = calc(vec[i].F,vec[i].S);
    if (res == -1) {
      continue;
    }
    if (ans == -1) {
      ans = res;
    } else {
      ans = min(ans,res);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
#define gr vector<vpii>
#define str string
#define mask vector<bool>
#define vs vector<str>
#define pq priority_queue
#define si set<int>
#define ordered_set_of(T) tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define nub(x) x.resize(unique(all(x)) - x.begin())
#define sq(x) ((x) * (x))
#define TWO class T1, class T2
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define GAME_OVER return 0
using namespace std;
using namespace __gnu_pbds;
char _$ = ' ';
struct sep {sep(char c) {_$ = c;}};
ostream& operator<<(ostream& o, sep s) {return o;}
template<TWO> ostream& operator<<(ostream& o, pair<T1, T2> x) {return o << x.fi << ' ' << x.se;}
template<TWO> istream& operator>>(istream& i, pair<T1, T2>& x) {return i >> x.fi >> x.se;}
template<class T> ostream& operator<<(ostream& o, vector<T> x) {for (auto it : x) o << it << _$; return o;}
template<class T> istream& operator>>(istream& i, vector<T>& x) {for (auto& it : x) i >> it; return i;}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    vs a(n);
    cin >> a;
    int res = 0;
    for (int mski = 0; mski < (1 << n); mski++)
        for (int mskj = 0; mskj < (1 << m); mskj++)
        {
            int cnt = 0;
            for (int i = 0; i < n; i++)
                for (int j = 0; j < m; j++)
                    if (!(mski & (1 << i)) && !(mskj & (1 << j)) && a[i][j] == '#')
                        cnt++;
            if (cnt == k)
                res++;
        }
    cout << res << endl;
    GAME_OVER;
}

Measured memory_bytes: 3608
#include <stdio.h>
int main(void) {
    int a, b, i, c, d, e, f, g;
    e = 1;
    
    

    scanf("%d %d", &a, &b);
    if(a > b) {
        f = a;
        a = b;
        b = f;
    }
    if(b % a == 0) {
       e = a;
        }
    else {
    g = b % a;

    for(i = 1; i <= g; i++) {
        if(g % i == 0) {
            c = i;
        
        if(b % i == 0) {
            d = i;
        }
    }
        if(c == d) {
            e = c;
        }
    }
}

    printf("%d\n", e);
    return 0;
}

Measured memory_bytes: 592
var x = require('fs').readFileSync('/dev/stdin', 'utf8');

var array = x.split(" ").map(Number);

var a = array[0];
var b = array[1];
var d = Math.floor( a / b);
var r = a % b;
var f = ( a / b ).toFixed(5);

console.log(d + " " + r + " " + f);



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

int main() {
	int N, X;
	cin >> N >> X;

	int m[N];
	for (int i=0; i<N; ++i) {
		cin >> m[i];
	}

	int minM = m[0];

	int donuts = 0;

	for (int i=0; i<N; ++i) {
		X -= m[i];
		donuts++;
		if (m[i] < minM) minM = m[i];
	}

	donuts += X/minM;

	cout << donuts << endl;
}


Measured memory_bytes: 256
from collections import deque

n,q=map(int,input().split())
E=[[] for _ in range(n)]
P=[0]*n
V=[False]*n
for i in range(n-1):
    a,b=map(int,input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)
for i in range(q):
    p,x=map(int,input().split())
    P[p-1]+=x

que=deque([0])
while que:
    s=que.popleft()
    V[s]=True
    for ni in E[s]:
        if V[ni]==False:
            P[ni]+=P[s]
            que.append(ni)
print(*P)

Measured memory_bytes: 105236
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string str;
		vector<int> max,min,an;
		cin>>str;
		sort(str.begin(),str.end());
		for(int j=0;j<str.length();j++){
			min.push_back(str[j]-48);
			max.push_back(str[str.length()-1-j]-48);
		}
		for(int k=0;k<max.size();k++){
			if(min[min.size()-1-k]>max[max.size()-k-1]){
				max[max.size()-1-k] += 10;
				max[max.size()-2-k]--;
			}
			an.push_back(max[max.size()-1-k]-min[min.size()-1-k]);
		}
		for(int p=0;p<an.size();p++){
			if(an[an.size()-1-p]==0){
				if(p==an.size()-1) cout<<"0";
				continue;
			}else{
				for(int q=p;q<an.size();q++){
					cout<<an[an.size()-1-q];
				}
				break;
			}
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
const long long mod = 1e9+7;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;

ll modpow(ll x,ll y){
	ll tmp = 1;
	x %= mod;
	while(y>0){
		if(y%2){
			tmp= (tmp*x)%mod;
		}
		y =y>>1;
		x = (x*x)%mod;
	}
	return tmp;
}
ll modinv(ll x){
	x = x%mod;
	FOR(i,1,mod){
		if((x*i)%mod == 1)return i;
	}
}

ll modfac(ll x){
	ll tmp = 1;
	FOR(i,1,x+1){
		tmp = (tmp*i)%mod;
	}
	return tmp;
}
ll mod_binomial_coefficient(ll n,ll k){
	//return modfac(n)*modinv(modfac(k))%mod*modinv(modfac(n-k))%mod;
	ll tmp = 1;
	FOR(i,0,k){
		tmp *= (n-i);
		tmp = tmp%mod;
		tmp *= modpow(i+1,mod-2);
		tmp = tmp%mod;
	}
	return tmp;
}
int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	inl(n);
	ll allforone = modpow(2,n)-1;
	inl(x,x1);
	allforone -= mod_binomial_coefficient(n,x)+mod;
	allforone = allforone%mod;
	allforone -= mod_binomial_coefficient(n,x1)+mod;
	allforone = allforone%mod;
	out((allforone+mod)%mod);
	return 0;
}



Measured memory_bytes: 256
n, m, x = map(int, input().split())
books = []
book_total_price = []
for _ in range(n):
    book = list(map(int, input().split()))
    books.append(book)
 
for i in range(2**n):
    reference_book = []
    book_price = 0
    for j in range(n):
        if (i >> j) & 1:
            reference_book.append(books[j])
            book_price += books[j][0]
    err = 0
    for k in range(1, m+1):
        r = [row[k] for row in reference_book]
        if sum(r) < x:
            err += 1
    if err == 0:
        book_total_price.append(book_price)
if book_total_price == []:
    print('-1')
else:
    print(min(book_total_price))

Measured memory_bytes: 9316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(ll i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 1e18
#define five 100005;
#define six 1000005;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//___________________________________________________________________________________________________________________________________________________________
int main()
{
       string s;
       cin>>s;
       if(s[0]=='7' || s[1] == '7' || s[2] == '7'){cout<<"Yes";}
       else{cout<<"No";
                     }
}



Measured memory_bytes: 3628
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

N=int(input())
# A=list(map(int,input().split()))
A=[int(i) for i in input().split()]

m=0
for a in A:
    m=gcd(a,m)
print(m)

Measured memory_bytes: 14224
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
    	public void solve(int testNumber, InputReader in, PrintWriter out) {
    		int N = in.nextInt();
    		int[] a = new int[N];
    		for(int i = 0; i < N; i++) {
    			a[i] = in.nextInt();
    		}
    		int count = 0;
    		for(int i = 0; i < N; i++) {
    			while(a[i] % 2 == 0) {
    				a[i] /= 2;
    				count++;
    			}
    		}
    		out.println(count);
    	}
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 25300
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int dy[] = {0, 0, 1, -1};
    int dx[] = {1, -1, 0, 0};
    const int INF = INT_MAX/2;

    for(;;){
        int r;
        cin >> r;
        if(r == 0)
            return 0;

        int w[2], h[2], x0[2], y0[2];
        vector<vector<int> > room[2];
        for(int i=0; i<2; ++i){
            cin >> w[i] >> h[i] >> x0[i] >> y0[i];
            room[i].assign(h[i]+2, vector<int>(w[i]+2, INF));
            for(int j=1; j<=h[i]; ++j){
                for(int k=1; k<=w[i]; ++k){
                    cin >> room[i][j][k];
                }
            }
        }

        vector<int> level[2];
        for(int i=0; i<2; ++i){
            level[i].resize(h[i]*w[i]+1, INF);
            level[i][0] = 0;
            multimap<int, pair<int, int> > mm;
            vector<vector<int> > check(h[i]+2, vector<int>(w[i]+2, INF));
            mm.insert(make_pair(room[i][y0[i]][x0[i]], make_pair(y0[i], x0[i])));
            check[y0[i]][x0[i]] = room[i][y0[i]][x0[i]];
            int a = 1;
            while(!mm.empty()){
                int l = mm.begin()->first;
                int y = mm.begin()->second.first;
                int x = mm.begin()->second.second;
                mm.erase(mm.begin());
                if(l > check[y][x])
                    continue;
                level[i][a] = l;
                ++ a;
                for(int j=0; j<4; ++j){
                    int y1 = y + dy[j];
                    int x1 = x + dx[j];
                    if(max(l, room[i][y1][x1]) < check[y1][x1]){
                        mm.insert(make_pair(max(l, room[i][y1][x1]), make_pair(y1, x1)));
                        check[y1][x1] = max(l, room[i][y1][x1]);
                    }
                }
            }
        }

        int ret = INF;
        for(unsigned i=0; i<=r; ++i){
            if(i >= level[0].size() || r-i >= level[1].size())
                continue;
            ret = min(ret, level[0][i] + level[1][r-i]);
        }
        cout << ret << endl;
    }
}

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

using namespace std;

const int MOD = 1e9 + 7;
const long long INF = 1e18;
const int MaxN = 21;

int dp[MaxN][1 << MaxN];

int a[MaxN][MaxN];
int n;

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);

    cin >> n;
    for(int i = 0; i < n; ++i)
    {
        for(int j = 0; j < n; ++j)
            cin >> a[i][j];
    }

    for(int i = 0; i < n; ++i)
        if(a[0][i])
            dp[0][1 << i] = 1;

    vector <int> possibleMasks[n + 1];

    for(int i = 1; i < (1 << n); ++i)
        possibleMasks[__builtin_popcount(i)].push_back(i);

    for(int i = 1; i < n; ++i)
    {
        for(int j = 0; j < n; ++j)
            if(a[i][j])
                for(int prevMask : possibleMasks[i])
                    if(!(prevMask & (1 << j)))
                        up(dp[i][prevMask | (1 << j)], dp[i - 1][prevMask]);
    }

    cout << dp[n - 1][(1 << n) - 1] << '\n';;

    return 0;
}



Measured memory_bytes: 169404
#include <bits/stdc++.h>
#define LEN 100005
using namespace std;

typedef struct pp
{
    char name[100];
    int t;
} P;

P Q[LEN];
int head, tail, n;

void enqueue(P x)
{
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}
P dequeue()
{
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}

int main()
{
    int elaps = 0, c;
    int i, q;
    P u;
    cin >> n >> q;

    for (int i=1; i<=n; ++i) {
        cin >> Q[i].name >> Q[i].t;
    }
    head = 1; tail = n + 1;

    while (head != tail) {
        u = dequeue();
        c = min(q, u.t);
        u.t -= c;
        elaps += c;
        if (u.t > 0) enqueue(u);
        else {
            cout << u.name << " " << elaps << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 13252
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<(n);++i)
#define int long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define yn(b) cout<<((b)?"Yes":"No")<<endl
#define YN(b) cout<<((b)?"YES":"NO")<<endl
#define call(a) for(auto t:a)cout<<t<<" ";cout<<endl
#define ENDL printf("\n");
#define debg(a) cout<<#a<<":"<<a<<endl;
#define SORT(a) sort(all(a));
#define out(i) cout<<i<<endl;
#define m_p make_pair
#define m_t make_tuple
#define Vec vector
typedef long long ll;
typedef string str;
typedef vector<int> V;
typedef vector<pair<int,int>> VP;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
int min(int a,int b){if(a>b)return b;return a;}
int max(int a,int b){if(a>b)return a;return b;}
int gcd(int a,int b){if(b==0)return a; return gcd(b,a%b);}
int lcm(int a,int b){return a/gcd(a,b)*b;}
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
const ll INF=1ll<<60;
const ll MOD=1e9+7;

signed main(){
  int n,a,b;
  cin>>n>>a>>b;
  if((b-a)%2==0){
    cout<<"Alice"<<endl;
  }
  else cout<<"Borys"<<endl;

  
  
  return 0;
}



Measured memory_bytes: 256