akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;

    string s = "";

    if(n==1 and m==0)
    {
        cout << 0 << endl;
        return 0;
    }

    for (int i = 0; i < n; i++)
        s += '#';

    //cout << s << endl;
    while (m--)
    {
        int i;
        char blank;
        char ch;

        cin >> i >> ch;

        //cout << ch << endl;

        if (s[i - 1] == '#')
        {
            s[i - 1] = ch;
        }

        if (s[i - 1] != ch)
        {
            cout << -1 << endl;
            return 0;
        }
    }

    //cout << s << endl;

    if (s[0] == '0' and n != 1)
    {
        cout << -1 << endl;
        return 0;
    }

    for (int i = 0; i < s.size(); i++)
    {
        if (i == 0 and s[i] == '#')
            s[i] = '1';
        else if (s[i] == '#')
        {
            s[i] = '0';
        }
    }

    cout << s << endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main(){
    let a: u32 = read();
    let b: u32 = read();
    let ans = if (a*b) % 2 == 0 {"Even"} else {"Odd"};
    println!("{}", ans);
}

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

using i64 = int64_t;

int main(){
    i64 n, z, w;
    cin >> n >> z >> w;
    vector<i64> v;
    for(int i=0;i<n;++i){
        i64 a;
        cin >> a;
        v.push_back(a);
    }
    if(n == 1){
        cout << abs(v[0]-w) << endl;
    }else{
        cout << max(abs(v.back()-w), abs(v[v.size()-2]-v.back())) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){

    int a[4];
    cin>>a[0]>>a[1]>>a[2]>>a[3];
    sort(a, a+4);
    if(a[0] == 1 and a[1] == 4 and a[2] == 7 and a[3] == 9){
        cout<<"YES\n";
    }
    else{
        cout<<"NO\n";
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    int n,i;
    long long a,min = 1000000,max = -1000000,sum = 0;
    cin >> n;
    for (i=0;i<n;i++){
        cin >> a;
        if (a<min) min = a;
        if (a>max) max = a;
        sum += a;
    }
    cout << min << " " << max << " " << sum << endl; 
    return 0;
}



Measured memory_bytes: 3112
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>

    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    
    int main(){
      int n;
      cin>>n;
      auto a = vec(int,n);
      auto b = vec(int,n);
      rep(i,n){
        cin>>a[i];
        b[i] = a[i];
      }
      sort(a.begin(),a.end(),greater<int>());
      rep(i,n){
        if(b[i] == a[0])cout<<a[1]<<endl;
        else cout<<a[0]<<endl;
      }
    }


Measured memory_bytes: 3200
#include <iostream>
#include <string>

using namespace std;

int main(){
int n,m;
cin >> n >> m;
long long ret=1,gcd=1;
for(int i = 1;i<=n;i++){
if(n%i==0 && m%i==0){
gcd = i;
}
}
ret = gcd*(n/gcd)*(m/gcd);
string s,t;
cin >> s;
cin >> t;
for(long long i=0;i<ret;i+=(long long)(n/gcd)*(m/gcd)){
if(s[i/(n/gcd)/(m/gcd)*(ret/m)] != t[i/(n/gcd)/(m/gcd)*(ret/n)]){
ret=-1;
break;
}
}
cout<<ret<<endl;
}


Measured memory_bytes: 512
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn pow_mod(base: i64, power: i64, modulo: i64) -> i64 {
    let mut base = base;
    let mut power = power;
    let mut ans = 1;
    while power > 0 {
        if power & 1 == 1 {
            ans = ans * base % modulo;
        }
        power >>= 1;
        base = base * base % modulo;
    }
    ans
}

#[allow(dead_code)]
fn inv_mod(a: i64, modulo: i64) -> i64 {
    pow_mod(a, modulo - 2, modulo)
}

fn main() {
    let p = read::<usize>();
    let mut seq = vec![0; p];
    for i in 0..p {
        seq[i] = read::<usize>();
    }
    let mut anss = vec![0; p];
    anss[0] = seq[0];
    for i in 1..p {
        let mut sum = 0;
        for x in 1..p {
            sum = (sum
                + (seq[x] + p - anss[0])
                    * pow_mod(x as i64, (p - i - 1) as i64, p as i64) as usize)
                % p;
        }
        anss[i] = sum * inv_mod(p as i64 - 1, p as i64) as usize % p;
    }
    for i in 0..p {
        if i != 0 {
            print!(" ");
        }
        print!("{}", anss[i]);
    }
    println!("");
}


Measured memory_bytes: 4476
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

S = list(input())

N = len(S) - 1
N //= 2

for i in range(N, 0, -1):
    if S[:i] == S[i: 2 * i]:
        print (2 * i)
        break
        
        

Measured memory_bytes: 2940
/*
*author: rits1272	
*/
#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define F first
#define S second
#define MAX 1e9
#define MIN -1e9
#define INF 1e18
#define MOD 1000000007
#define int long long
#define FOR(x, n) for(int i=x; i<n; i++)
#define print(x) cout << "[" << #x << ":" << x << "] "; 
#define println(x) cout << "[" << #x << ":" << x << "]\n"; 

int dx[8] = { -1, 0, 0, 1, -1, -1, 1, 1 }; 
int dy[8] = { 0, 1, -1, 0, -1, 1, -1, 1 };  
double PI = acos(-1); 

const int mxN = 1000000;
int n;



int32_t main(){
	ios::sync_with_stdio(0); 
    cin.tie(0); 
	#ifndef ONLINE_JUDGE
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
	cin >> n;
	int ans = 0;
	for(int i=1; i<n; i++){
		ans += (n - 1)/i;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Apr 19 21:53:42 JST 2020
 **/

template <class T> T pow(T x, int n, const T UNION = 1) {
    T ret = UNION;
    while (n) {
        if (n & 1) ret *= x;
        x *= x;
        n >>= 1;
    }
    return ret;
}

/// @docs src/Math/ModInt.md
template <int Mod> struct ModInt {
    int x;
    static int runtime_mod;
    static std::unordered_map<int, int> to_inv;
    // テンプレート引数が負のときは実行時ModInt
    static int mod() { return Mod < 0 ? runtime_mod : Mod; }
    static void set_runtime_mod(int mod) {
        static_assert(Mod < 0, "template parameter Mod must be negative for runtime ModInt");
        runtime_mod = mod;
        to_inv.clear();
    }
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod() + mod()) >= mod()) x -= mod();
    }

    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod()) x -= mod();
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod();
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod();
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod();
        return *this;
    }
    ModInt operator-() const { return -x < 0 ? mod() - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return to_inv.count(this->x) ? to_inv[this->x] : (to_inv[this->x] = pow(*this, mod() - 2).x); }

    friend std::ostream& operator<<(std::ostream& s, ModInt<Mod> a) {
        s << a.x;
        return s;
    }
    friend std::istream& operator>>(std::istream& s, ModInt<Mod>& a) {
        long long tmp;
        s >> tmp;
        a = ModInt<Mod>(tmp);
        return s;
    }
    friend std::string to_string(ModInt<Mod> a) { return std::to_string(a.x); }
};
template <int Mod> std::unordered_map<int, int> ModInt<Mod>::to_inv;
template <int Mod> int ModInt<Mod>::runtime_mod;

#ifndef CALL_FROM_TEST
using mint = ModInt<1000000007>;
#endif

signed main() {
    Int n, K;
    std::cin >> n >> K;
    mint ans = 0;
    REP(i, K, n + 2) {
        Int l = i * (i - 1) / 2;
        Int r = i * (2 * n - i + 1) / 2;
        ans += r - l + 1;
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 3648
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))

left = [0] * (n + 1)
for i in range(1, n):
    left[i] = gcd(left[i-1], a[i-1])

right = [0] * (n + 1)
for i in range(1, n):
    right[n-i] = gcd(right[n-i+1], a[n-i])

ans = 0
for i in range(n):
    ans = max(ans, gcd(left[i], right[i+1]))
print(ans)


Measured memory_bytes: 89580
// #include<iostream>
// #define MOD 1000000007
// typedef unsigned long long int ll;
// #define fastio ios_base::sync_with_stdio(false);
// using namespace std;

// ll solve(ll l , ll r){
// 	ll temp = l;
// 	ll res=0;
// 	ll k=0;
// 	// while(1){
// 	// 	if(!(r & (1 << k)) && !(temp & (1 << k))){
// 	// 		temp = temp | (1 << k);
// 	// 		if(temp >= r){
// 	// 			break;
// 	// 		}
// 	// 		else{
// 	// 			res  = temp;
// 	// 		}
// 	// 	} 
// 	// 	k++;
// 	// }
// 	for(int i=0;i<62;i++){
// 		if(!(r & (1 << i)) && !(temp & (1 << i))){
// 			temp = temp | (1 << i);
// 			if(temp >= r){
// 				break;
// 			}
// 			else{
// 				res  = temp;
// 			}
// 		} 
// 	}
// 	return res;
// }


// int main(){
// 	fastio
// 	int test;
// 	cin >> test;
// 	while(test--){
// 		ll  l ,r;
// 		cin >> l >> r;
// 		ll res = solve(l ,r);
// 		cout << (res | r) << endl;
// 	}
// 	return 0;
// }


#include<iostream>
using namespace std;


int main(){
	int a , b;
	cin >> a >> b;
	if(a > 2*b){
		cout << a - 2*b <<endl;
	}
	else{
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
list_w = list(map(int, input().split()))

a = 0
for w in list_w:
    a += w

b = 0
for w in list_w:
    a -= w
    b += w
    if (a < b):
        a = min(b-a , a - b + 2 * w)
        break

print(a)


Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
	int a,b,c;
	int conlec=0; int conhisi=0;

	while( scanf("%d,%d,%d", &a,&b,&c)!=EOF){
	if(a*a+b*b==c*c) conlec++;
	else if(a==b) conhisi++;
	};
	printf("%d\n%d\n",conlec, conhisi);
	return (0);
}

Measured memory_bytes: 596
#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 ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    string s,t;
    cin >> s >> t;
    cout << t + s << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(0)
	n = int(sys.stdin.readline())
	s = []
	a = {}
	for i in range(n):
		s.append(input())
	for i in range(n):
		a[s[i]] = a.get(s[i], 0) + 1
	log.print(a)
	print("AC x {}".format(a.get("AC", 0)))
	print("WA x {}".format(a.get("WA", 0)))
	print("TLE x {}".format(a.get("TLE", 0)))
	print("RE x {}".format(a.get("RE", 0)))

	


main()

Measured memory_bytes: 79360
n = int(input())
divisorcount8 = 0
for m in range(1, n + 1, 2):
  kcount = 0
  for k in range(1, m + 1, 2):
      if (m % k  == 0):
        kcount += 1
  if kcount == 8:
    divisorcount8 += 1
print(divisorcount8)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    ll n;
    cin >> n;
    cout << (n - 1LL) * n / 2LL << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if (e-a<=k){
    cout << "Yay!" << endl;
  }
  else {
    cout << ":(" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;


int main() {
    int N;
    string S, T;
    cin >> N >> S >> T;
    for (int i = 0; i < N; i++){
        for (int j = i; j < N; j++){
            if (S.at(j) != T.at(j - i)){
                break;
            }
            if (j == N - 1){
                cout << N + i << endl;
                return 0;
            }
        }
    }
    cout << 2 * N << endl;

}


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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(ll i=x;i<y;i++)
#define frr(i,x,y) for(ll i=x-1;i>=y;i--)
#define inf 1e18+1
const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll x,y;
    cin>>x>>y;
    fr(i,0,101)
    {
        fr(j,0,101)
        {
            if((i*2+j*4==y)&&i+j==x)
            {
                cout<<"Yes\n";
                return;
            }
        }
    }
    cout<<"No\n";
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Measured memory_bytes: 3648
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main (final String[] args) {
        final Scanner sc = new Scanner(System.in);
        String str = sc.next();
      	int count = 0;
      	for (int i = 0; i < str.length()/2; i++) {
          if (str.charAt(i) != str.charAt(str.length() - i - 1)) count++;
        }
        System.out.println(count);
    }
}


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

using namespace std;

typedef complex<double> Point;

double cross(Point a,Point b)
{
    return imag(b*conj(a));
}

double getArea(const vector<Point> &points)
{
    if(points.size()<3) return 0;
    double area = 0;
    for(int i=1;i<points.size();i++)
    {
        area += cross(points[i-1],points[i]);
    }
    area += cross(points[points.size()-1],points[0]);
    return area*0.5;
}

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

    int n;
    cin>>n;
    vector<Point> points;
    for(int i=0;i<n;i++)
    {
        double x,y;
        cin>>x>>y;
        points.emplace_back(x,y);
    }

    cout<<setprecision(1)<<fixed<<getArea(points)<<endl;

    return 0;
}



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

int main() {
	int n, k;
	cin >> n >> k;
	vector<bool> sunuke(n+1);
	for (int i = 0; i < k; ++i)
	{
		int d;
		cin >> d;
		for (int j = 0; j < d; ++j)
		{
			int a;
			cin >> a;
			sunuke[a] = true;
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; ++i)
	{
		if(sunuke[i] == false) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3576
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;

const int MaxN = 100000;
int n, a[MaxN + 5];
LL sum[MaxN + 5];

int main()
{
	while (~scanf("%d", &n)) {
		for (int i = 1; i <= n; i++) {
			scanf("%d", &a[i]);
			sum[i] = sum[i - 1] + a[i];
		}
		LL ans1 = 0, t = 0, cnt = 0;
		for (int i = 1; i <= n; i++) {
			LL now = sum[i] + cnt;
			if (t == 0 && now < 0) {t = 1 - t; continue;}
			if (t == 1 && now > 0) {t = 1 - t; continue;}
			if (t == 0 && now >= 0) {
				cnt -= now + 1;
				ans1 += now + 1;
			}
			if (t == 1 && now <= 0) {
				cnt += 1 - now;
				ans1 += 1 - now;
			}
			t = 1 - t;
		}
		LL ans2 = 0; t = 1; cnt = 0;
		for (int i = 1; i <= n; i++) {
			LL now = sum[i] + cnt;
			if (t == 0 && now < 0) {t = 1 - t; continue;}
			if (t == 1 && now > 0) {t = 1 - t; continue;}
			if (t == 0 && now >= 0) {
				cnt -= now + 1;
				ans2 += now + 1;
			}
			if (t == 1 && now <= 0) {
				cnt += 1 - now;
				ans2 += 1 - now;
			}
			t = 1 - t;
		}
		printf("%lld\n", min(ans1, ans2));
	}	
	return 0;
}

Measured memory_bytes: 1280
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AOJ_ALDS1_1_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            int ans = 0;
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
                for (int j = 2; j <= Math.Sqrt(a[i]); j++)
                {
                    if (a[i] % j == 0 &&a[i]!=j) { ans--; break;}
                }
                ans++;
            }
            Console.WriteLine(ans);
        }
    }
}



Measured memory_bytes: 15876
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define isLeap(x) ((x % 400 == 0) || (x % 100 ? x % 4 == 0 : false))
#define FAST ios_base::sync_with_stdio(0), cin.tie(0)
#define LCM(a, b) (a / __gcd(a, b)) * b;
#define PI acos(-1.0)
#define inf 0x3f3f3f3f
#define fr(m,n,c) for(int i = m; i < n; i+=c)
const int N = 1e5+3;
int ara[N+2];
pair<int, int> pp[N];
vector<int> vv[4*N];
set<int> st;
map<ll, ll> mp;
int ara4[30], ara5[30];
int dp[N];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> ara[i];
	}
	for (int i = 0; i <=n; i++) dp[i] = inf;
	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		if (i + 1 < n) dp[i + 1] = min(dp[i + 1], dp[i] + abs(ara[i] - ara[i + 1]));
		if (i + 2 < n) dp[i + 2] = min(dp[i + 2], dp[i] + abs(ara[i] - ara[i + 2]));
	}
	cout << dp[n - 1] << "\n";
}

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

int main()
{
    long long int n,k,t;
    cin>>n>>k;
    //if(n<k) swap(n,k);
    t=n%k;
    t>k-t?printf("%lld\n", k-t):printf("%lld\n", t);

    return 0;
}


Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

s = input()
t = input()

m = 0
for i in range(len(s)):
    tmp = 0
    for j in range(len(t)):
        if(j + i >= len(s)):
            tmp = 0
            break
        if(s[j + i] == t[j]):
            tmp += 1
    m = max(m, tmp)
print(len(t) - m)


Measured memory_bytes: 75756
import sys
from math import pi

def solve():
    input = sys.stdin.readline
    A, B = map(int, input().split())
    if A <= 0 <= B: print("Zero")
    elif 0 < A: print("Positive")
    else:
        if (min(-1, B) - A) % 2 == 1: print("Positive")
        else: print("Negative")
    

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<vector>
#define R register
#define next kkksc03
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
inline ll read();
inline void write(ll x);
inline void writesp(ll x);
inline void writeln(ll x);
char s1[1000000],s2[1000000];
ll n;
int main(){	
	n=read();
	scanf("%s%s",s1,s2);
	for(R ll i=0;i<n;i++){
		putchar(s1[i]);
		putchar(s2[i]);
	}
	putchar('\n');
}
inline ll read(){
	ll x=0,t=1;char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') t=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*t;
}
inline void write(ll x){
	if(x<0){putchar('-');x=-x;}
	if(x<=9){putchar(x+'0');return;}
	write(x/10);putchar(x%10+'0');
}
inline void writesp(ll x){
	write(x);putchar(' ');
}
inline void writeln(ll x){
	write(x);putchar('\n');
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    int n;
    cin >> n;
    vector<int> b(n);
    for(int i = 0; i < n-1; i++)
    {
        cin >> b[i];
    }
    vector<int> a(n);
    a[0] = b[0];
    b[n-1] = b[n-2];
    for(int i = 1; i < n; i++)
    {
        a[i] = min(b[i-1], b[i]);
    }
    int sum = 0;
    for(int i = 0; i < n; i++)
    {
        sum += a[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int d = scanner.nextInt();
        int n = scanner.nextInt();
        int m = 0;
        if (d == 0) {
            if (n == 100) {
                m = 101;
            }else{
                m = n;
            }
        }else if (d == 1) {
            if (n == 100) {
                m = 100*101;
            }else{
                m = 100*n;
            }
        }else if (d == 2) {
            if (n == 100) {
                m = 10000*101;
            }else{
                m = 10000*n;
            }
        }
        System.out.println(m);
    }
}

Measured memory_bytes: 23252
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/4;
    public static final int inf = Integer.MAX_VALUE/4;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni(), k = in.ni();
        int[] v = in.ni(n);
        PriorityQueue<Integer> que;
        long max = 0, sum = 0, remove;
        for (int i = 0; i<=k && i<=n; i++) {
            for (int j = 0; j+i<=k && i+j<=n; j++) {
                sum = 0;
                que = new PriorityQueue<>();
                for (int l = 0; l < i; l++) {
                    sum += v[l];
                    if(v[l]<0) que.add(v[l]);
                }
                for (int l = n-1; l >=n-j ; l--) {
                    sum += v[l];
                    if(v[l]<0) que.add(v[l]);
                }
                remove = 0;
                while(!que.isEmpty() && remove+i+j<k){
                    sum -= que.poll();
                    remove++;
                }
                max = Math.max(max, sum);
            }
        }
        out.println(max);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 24532
#include <bits/stdc++.h>
using namespace std;
const int N = 103;
long long weight[N],value[N],n,w;
long long dp[N][100003];

long long solve(long long taille,long long w){
		if(taille <0)
			return 0;
		if(dp[taille][w] != -1)return dp[taille][w];
		if(weight[taille-1]>w)
			return dp[taille][w] = solve(taille-1,w);
		else
			return dp[taille][w] = max( solve(taille-1,w-weight[taille-1]) + value[taille-1] ,
			 solve(taille-1,w) );



}

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

    memset(dp,-1,sizeof(dp));
	cin>>n>>w;
	for(int i=0;i<n;i++)
		cin>>weight[i]>>value[i];

	long long ans = solve(n,w);
	cout<<ans;

	return 0;
}

Measured memory_bytes: 80768
#include<stdio.h>

//Card's struct
typedef struct{
  char c;
  int n;
}Card;


int main()
{
  int N;
  Card card1[36], card2[36], card3[36];
  Card copy;
  char c;
  int mini;
  int i, j, k;

  //Read N and Cards
  scanf("%d\n", &N);
  for(i=0; i<N; i++)
    {
      scanf("%c%d", &card1[i].c, &card1[i].n);
      //this operation is a step to read ' '.
      scanf("%c", &c);
    }

  //Copy to card_selectiotn and order
  for(i=0; i<N; i++)card2[i]=card1[i];

  //this sort is very stable.
  k=0;
  for(i=1; i<=9; i++)
    {
      for(j=0; j<N; j++)
	{
	  if(card1[j].n==i)
	    {
	      card3[k]=card1[j];
	      k++;
	    }
	}
    }

  //---------------------start----------------------------
  //Begin Bubble Sort
  for(i=0; i<N; i++)
    {
      for(j=N-1; j>=i+1; j--)
	{
	  if(card1[j].n<card1[j-1].n)
	    {
	      copy=card1[j];
	      card1[j]=card1[j-1];
	      card1[j-1]=copy;
	    }
	}
    }

  //print
  for(i=0; i<N; i++)
    {
      if(i!=N-1)printf("%c%d ", card1[i].c, card1[i].n);
      else printf("%c%d\n", card1[i].c, card1[i].n);
    }

  //Is this Stable?
  k=0;
  for(i=0; i<N; i++)
    {
      if(card1[i].c!=card3[i].c)
	{
	  printf("Not stable\n");
	  k++;
	  break;
	}
    }
  if(k==0)printf("Stable\n");

  //------------------------------------------
  //Selection Sort
  for(i=0; i<N; i++)
    {
      mini=i;
      for(j=i; j<N; j++)
	{
	  if(card2[j].n<card2[mini].n)mini=j;
	}
      copy=card2[i];
      card2[i]=card2[mini];
      card2[mini]=copy;
    }


  //print
  for(i=0; i<N; i++)
    {
      if(i!=N-1)printf("%c%d ", card2[i].c, card2[i].n);
      else printf("%c%d\n", card2[i].c, card2[i].n);
    }

  //Is this Stable?
  k=0;
  for(i=0; i<N; i++)
    {
      if(card2[i].c!=card3[i].c)
	{
	  printf("Not stable\n");
	  k++;
	  break;
	}
    }
  if(k==0)printf("Stable\n");
  return 0;
}

Measured memory_bytes: 0
#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;
const ll MOD = 1e9+7;

int main()
{
  int N, M; cin >> N >> M;
  vector<bool> a(N+1, true);
  REP(i, M) {
    int t; cin >> t;
    a[t] = false;
  }

  vector<ll> dp(N+1);
  dp[0] = 1;
  for (int i = 0; i < N; ++i) {
    for (int next = i+1; next <= min(N, i+2); ++next) {
      if (a[next]) {
        dp[next] += dp[i];
        dp[next] %= MOD;
      }
    }
  }

  cout << dp[N] << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define int long long
const int mod = 1e9 + 7;
int exp(int a, int b){
	int res = 1;
	while(b){
		if(b&1) {
			res *= a;
			res %= mod;
		}
		a *= a;
		a %= mod;
		b /= 2;
	}
	return res;
}
void test_case(){
	int n; cin>>n;
	
	int a = exp(10, n);
	int b = exp(9, n);
	int c = exp(8, n);
	
	
	int ans = (a - (((b + b) % mod - c + mod) % mod) + mod) % mod;
	cout<<ans<<endl;
	
}
		
 
signed main(){
	IOS;
	int t=1, i=1; 
	//cin>>t;
	while(t--){
		//cout<<"Case #"<<i<<": ";
		test_case();
		i++;
	}
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String n = sc.next();
			int len = n.length();
			int amari = 0;
			for (int i = 0; i < len; i++) {
				int keta = Integer.parseInt(n.substring(i, i + 1));
				amari = (amari + keta) % 9;
			}
			if (amari % 9 == 0) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}
}

Measured memory_bytes: 49540
#include<bits/stdc++.h>
using namespace std;
// make pair, tuple
// __gcd(int, int)
// bool isPrime(int n){
//       if(n <= 1)return false;
//       if(n <= 3)return true;
//       if(n % 2 == 0 || n % 3 == 0)return false;
//       for(int i = 5;i * i <= n;i += 6){
//             if(n % i == 0 || n % (i + 2) == 0)return false;
//       }
//       return true;
// }
// int countSubString(string s, string temp){
//       int ans = 0;
//       size_t f = s.find(temp);
//       while(f != string::npos){
//             ans++;
//             f = s.find(temp, f + 1);
//       }
//       return ans;
// }

int c(int x){
    if(x == 0)return 0;
    return c(x >> 1) + (x & 1);
}

int main(){
    int n;cin >> n;
    int a[n + 5];
    int x[n + 5][n + 5];
    int y[n + 5][n + 5];
    for(int i = 0;i < n;i++){
        cin >> a[i];
        for(int j = 0;j < a[i];j++){
            cin >> x[i][j] >> y[i][j];
        }
    }
    int ans = 0;
    for(int b = 1;b < (1 << n);b++){
        bool flag = true;
        for(int i = 0;i < n;i++){
            if(b & (1 << i)){
                for(int j = 0;j < a[i];j++){
                    if(((b >> (x[i][j] - 1)) & 1) ^ y[i][j])flag = false;
                }
            }
        }
        if(flag)ans = max(ans, c(b));
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
 
#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main() {
    ll a,b,t;
    cin >> a >> b >> t;
    cout << t / a * b << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

score = [A, B, C, D, E]
sum = 0
for i in range(5):
    if score[i] < 40:
        score[i] = 40
    sum += score[i]
ans = int(sum / 5)
print(ans)



Measured memory_bytes: 5604
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

constexpr lint INF=1e18;

int main()
{
	int N,M,L;
	int A[310]={};
	int B[310]={};
	lint C[310]={};
	int Q;
	int s[100010]={};
	int t[100010]={};

	lint dist[310][310]={};
	for(int i=0;i<310;i++)
		for(int j=0;j<310;j++)
			if(i!=j)dist[i][j]=INF;

	cin >> N >> M >> L;
	for(int i=0;i<M;i++)
	{
		cin >> A[i];
		cin >> B[i];
		cin >> C[i];
		A[i]--;
		B[i]--;
		dist[A[i]][B[i]]=C[i];
		dist[B[i]][A[i]]=C[i];
	}
	cin >> Q;
	for(int i=0;i<Q;i++)
	{
		cin >> s[i];
		cin >> t[i];
		s[i]--;
		t[i]--;
	}

	for(int k=0;k<N;k++)
		for(int i=0;i<N;i++)
			for(int j=0;j<N;j++)
				dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);

	lint cnt[310][310]={};
	for(int i=0;i<310;i++)
		for(int j=0;j<310;j++)
			if(i!=j && dist[i][j]>L)cnt[i][j]=INF;
	
	for(int k=0;k<N;k++)
	{
		for(int i=0;i<N;i++)
		{
			for(int j=0;j<N;j++)
			{
				lint ncnt=cnt[i][k]+cnt[k][j];
				if(dist[i][k]+dist[k][j]>L)
					ncnt++;
				cnt[i][j]=min(cnt[i][j],ncnt);
			}
		}
	}

	for(int i=0;i<Q;i++)
	{
		lint ans=cnt[s[i]][t[i]];
		if(ans==INF)ans=-1;
		cout << ans << endl;
	}
	return 0;
}


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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  ll n;
  cin >> n;
  vll b(n - 1);
  REP(i, n - 1) {
    cin >> b[i];
  }
  ll total = b[0];
  // COUT(total);
  FOR(i, 1, n - 2) {
    total += min(b[i], b[i - 1]);
  }
  total += b[n - 2];
  COUT(total);
}


int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}

/*
3
2 5
*/


Measured memory_bytes: 3600
import sys


x, n = map(int, input().split())
p = {int(i): True for i in input().split()}

i = 0

while True:
    try:
        if p[x-i]:
            pass
            
    except KeyError:
        print(x-i)
        sys.exit()
    
    try:
        if p[x+i]:
            pass
    except KeyError:
        print(x+i)
        sys.exit()
    
    i += 1

Measured memory_bytes: 9184
#include <iostream>
#include <vector>
#include <set>

using namespace std;

int main(void)
{
  int a;
  set<string> st;
  
  cin>>a;
  
  for(int i=0;i<a;i++){
    string str;
    cin>>str;
    st.insert(str);
  }
  
  cout<<st.size()<<endl;
}

Measured memory_bytes: 19212
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define SZ(x) ((int)(x).size())
#define MEM(x,a) memset(x,a,sizeof(x))
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
const ll mod=1000000007,N=1e5+5,M=1e5+5,INF=0x3f3f3f3f;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//head

int main(void){
    int n,m,sum=0;
    cin>>n>>m;
    rep(i,0,m){
        int x;cin>>x;
        sum+=x;
    }
    n-=sum;
    cout<<(n>=0?n:-1);
    return 0;
}

Measured memory_bytes: 3596
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

const double PI = acos(-1);

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Yes[2] = {"No", "Yes"};
string YES[2] = {"NO", "YES"};
string Psb[2] = {"Impossible", "Possible"};
string psb[2] = {"impossible", "possible"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    ll ans = 0;
    forn(i, n)
    {
        ll a;
        cin >> a;
        while (a % 2 == 0) ans++, a /= 2;
    }
    cout << ans;
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 256
//ford-fulkerson法 
//O(F|E|)

//参考　蟻本！
//judge http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_A&lang=jp

#include<iostream>
#include<vector>

using namespace std;

typedef long long ll;

#define rep(i,n) for(int i=0;i<(n);i++) 
#define MAX_V (1000)

struct edge{
        ll to; /*どの頂点に向かうか*/ 
        ll cap; /*現在の辺のキャパシティ*/ 
        ll rev_id;/*逆辺の添字*/ 
};

vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(ll from,ll to,ll cap) {
    G[from].push_back((edge){to,cap,(ll)G[to].size()});//辺の追加
    G[to].push_back((edge){from,0,(ll)G[from].size() - 1});//辺の逆辺
}

ll dfs(ll v,ll t,ll f) {
    if(v == t)return f;//終点についたらフローを返す。

    used[v] = true;

    for(auto &e : G[v]) {
        if(!used[e.to] && e.cap > 0) {
            ll d = dfs(e.to,t,min(f,e.cap));
            if(d > 0) {
                e.cap -= d;
                G[e.to][e.rev_id].cap += d;
                return d;
            }
        }
    }
    return 0;
}

ll max_flow(ll s/*始点*/,ll t/*終点*/) {
    ll flow = 0;
    for(;;) {
        fill(used,used+MAX_V,false);
        ll f = dfs(s,t,1000000000);
        if(f == 0)break;
        flow += f;
    }
    return flow;
}

int main() {
    ll V,E;
    cin >> V >> E;

    rep(i,E) {
        ll u,v,c;
        cin >> u >> v >> c;
        add_edge(u,v,c);
    }

    cout << max_flow(0,V-1) << endl;
    return 0;
}


Measured memory_bytes: 3272
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#include<queue>
#include<tuple>
#include<stdio.h>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	double n;
	cin>>n;
	printf("%f\n", 2*n*3.141592);
	return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,d;
	cin>>n>>d;
	int sum=2*d+1;
	int ans=1;
	while(1){
		if(ans*sum>=n){
			cout<<ans<<endl;
			return 0;
		}
		ans++;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 1111116
#define mod 1000000007
#define next nxt
 
int n,x[N],y[N],z[N],next[N],p[N],h[N],q[N],s[N],cnt,cmt,cir;
long long fac[N],inv[N],ans;
vector<int> v[N];
 
long long C(int x,int y){
	return fac[x]*inv[y]%mod*inv[x-y]%mod;
}
 
void travel(int x,int pre){
	h[x]=true;q[++cnt]=x;
	for (int t=p[x];t;cmt++,t=next[t])
		if (!h[y[t]]) travel(y[t],t);
		else if (t/2!=pre/2) cir=t;
}
 
void build(int x,int pre){
	for (int t=p[x];t;t=next[t])
		if (t/2!=pre/2){
			if (y[t]<y[pre^1]) v[x].push_back(y[t]),h[y[t]]=true;
			if (t/2!=cir/2) build(y[t],t);
		}
}
 
long long solve(int x){
	s[x]=0;long long ans=1;
	for (int i=0;i<(int)v[x].size();i++){
		ans=ans*solve(v[x][i])%mod;
		s[x]+=s[v[x][i]];
		ans=ans*C(s[x],s[v[x][i]])%mod;
	}
	s[x]++;return ans;
}
 
int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-')  f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}
 
int main(){
	n=read();
	for (int i=1;i<=2*n;i++){
		x[2*i]=y[2*i+1]=read();
		y[2*i]=x[2*i+1]=n+read();
		z[2*i]=z[2*i+1]=x[2*i]+y[2*i];
		next[2*i]=p[x[2*i]];p[x[2*i]]=2*i;
		next[2*i+1]=p[x[2*i+1]];p[x[2*i+1]]=2*i+1;
	}
	fac[0]=fac[1]=inv[0]=inv[1]=1;
	for (int i=2;i<N;i++) fac[i]=fac[i-1]*i%mod;
	for (int i=2;i<N;i++) inv[i]=-(mod/i)*inv[mod%i]%mod;
	for (int i=2;i<N;i++) inv[i]=inv[i-1]*inv[i]%mod;
	ans=fac[2*n];
	for (int i=1;i<=2*n;i++)
		if (!h[i]){
			cnt=cmt=0;travel(i,0);
			if (cmt!=cnt*2) {printf("0\n");return 0;}
			
			v[0].clear();
			for (int i=1;i<=cnt;i++)
				v[q[i]].clear(),h[q[i]]=false;
			build(y[cir],cir);
			for (int i=1;i<=cnt;i++)
				if (!h[q[i]]) v[0].push_back(q[i]),h[q[i]]=1;
			long long tmp=solve(0);
			
			v[0].clear();
			for (int i=1;i<=cnt;i++)
				v[q[i]].clear(),h[q[i]]=false;
			build(y[cir^1],cir^1);
			for (int i=1;i<=cnt;i++)
				if (!h[q[i]]) v[0].push_back(q[i]),h[q[i]]=1;
			tmp+=solve(0);
			
			ans=ans*tmp%mod*inv[cnt]%mod;
		}
	printf("%lld\n",(ans+mod)%mod);
	return 0;
}

Measured memory_bytes: 72956
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<=n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
using namespace std;
int n,a[100000],ans[100001];
int main(){
	cin>>n;
	rep(i,n)
	cin>>a[i];
	rep(i,n){
		ans[a[i]]=i;
	}
	forn(i,1,n){
		cout<<ans[i]+1<<" ";
	}
	re 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
ll K,A,B;
int main(){
	cin>>K>>A>>B;
	ll ans=K+1;
	if(K+1>=A){
		ans=max(ans,A+(B-A)*((K-A+1)/2)+(K-A+1)%2);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a,b,c,k;
    cin >> a >> b >> c >> k;
    if(a>=k)cout << k;
    else if(a+b>=k)cout << a;
    else if(a+b<=k)cout << a+(k-a-b)*-1;
}

Measured memory_bytes: 3624