akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
#define chmax(x, a)  do { x = max(x, a); } while(0)
#define chmin(x, a)  do { x = min(x, a); } while(0)

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll,ll> PLL;

ll N, K;
ll a[300000];

bool f(ll m) {
  ll t = 0;
  rep(i, N) {
    ll p = (a[i] + m - 1) / m;
    if (p >= 2)
      t += p - 1;
  }
  return t <= K;
}

int main(void) {
  cin >> N >> K;
  rep(i, N) {
    cin >> a[i];
  }
  ll l = 0, r = 1e10;
  while (l + 1 < r) {
    ll m = (l+r)/2;
    if (f(m))
      r = m;
    else
      l = m;
  }
  cout << r << endl;
  
  return 0;
}


Measured memory_bytes: 5064
#include "bits/stdc++.h"
using namespace std;
const int N = 2e5 + 5;
int n;
int par1[N];
int par2[N];
int deg1[N];
int deg2[N];
vector < pair < int , int > > v[N];
int deg[N];
int val[N];
int done[N * 2];
int dest;
void dfs(int node){
	while(!v[node].empty()){
		auto edge = v[node].back();
		v[node].pop_back();
		if(done[edge.second]){
			continue;
		}
		int next = edge.first;
		if(edge.second > n * 2){
			val[node] = 1;
			val[next] = -1;
		}
		--deg[node];
		--deg[next];
		done[edge.second] = 1;
		if(next == dest){
			break;
		}
		dfs(next);
		break;
	}
}
void solve(int node){
	dest = node;
	dfs(node);
}
int main(){
	scanf("%d" , &n);
	for(int i = 1 ; i <= n ; ++i){
		scanf("%d" , par1 + i);
		par1[i] = max(par1[i] , 0);
		++deg1[par1[i]];
		++deg1[i];
	}
	for(int i = 1 ; i <= n ; ++i){
		scanf("%d" , par2 + i);
		par2[i] = max(par2[i] , 0);
		++deg2[par2[i]];
		++deg2[i];
	}
	for(int i = 1 ; i <= n ; ++i){
		if((deg1[i] & 1) != (deg2[i] & 1)){
			printf("IMPOSSIBLE\n");
			return 0;
		}
	}
	printf("POSSIBLE\n");
	deg[0] = 2;
	for(int i = 1 ; i <= n ; ++i){
		deg[i] = deg1[i];
	}
	for(int i = 1 ; i <= n ; ++i){
		deg[i + n] = deg2[i];
	}
	for(int i = 1 ; i <= n ; ++i){
		if(par2[i]){
			par2[i] += n;
		}
	}
	for(int i = 1 ; i <= n ; ++i){
		v[par1[i]].emplace_back(make_pair(i , i));
		v[i].emplace_back(make_pair(par1[i] , i));
		v[par2[i]].emplace_back(make_pair(i + n , i + n));
		v[i + n].emplace_back(make_pair(par2[i] , i + n));
	}
	for(int i = 1 ; i <= n ; ++i){
		if(deg[i] & 1){
			v[i].emplace_back(make_pair(i + n , i + n + n));
			v[i + n].emplace_back(make_pair(i , i + n + n));
			++deg[i];
			++deg[i + n];
		}
		else{
			val[i] = 0;
		}
	}
	for(int i = 0 ; i <= n + n ; ++i){
		while(deg[i]){
			solve(i);
		}
	}
	for(int i = 1 ; i <= n ; ++i){
		printf("%d%c" , val[i] , " \n"[i == n]);
	}
}

Measured memory_bytes: 18432
#include <stdio.h>
#include <stdlib.h>

int main()
{
	char s[10], y[5], m[3];
	
	scanf("%s", &s);

	strncpy(y, s, 4);
	y[4] = '\0';
	
	if(atoi(y) != 2019){
		if(atoi(y) > 2019)
			printf("TBD");
		else
			printf("Heisei");
	}else{
		strncpy(m, &s[5], 2);
		m[2] = '\0';
		if(atoi(m) > 04)
			printf("TBD");
		else
			printf("Heisei");
	}

	return 0;
}

Measured memory_bytes: 128
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res

def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

n = I()
a = LI()
b = LI()
s = 0
for i in range(n):
    if a[i] < b[i]:
        k = b[i]-a[i]
        k += k&1
        s += (k>>1)
        a[i] += k
for i in range(n):
    if b[i] < a[i]:
        k = a[i]-b[i]
        if s < k:
            print("No")
            quit()
        b[i] += k
        s -= k
print("Yes")


Measured memory_bytes: 41968
#include <stdio.h>
 
int main() {
	int N;
	scanf("%d",&N);
	int A[N], ans[N+1];
	for (int i = 0; i < N; i++) {
		scanf("%d",&A[i]);
		ans[i] = -1;
	}
	ans[N] = -1;
	for (int i = 0; i < N; i++) {
		int point = 0;
		while (1) {
			if (ans[point] < A[i]) {
				ans[point] = A[i];
				break;
			}
			else point++;
		}
	}
	int cnt = 0;
	for (int i = 0; ans[i] != -1; i++) {
		cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
#define Imax 1e9+5
#define LLmax 1e18
#define Imin -1e9-5
#define LLmin -1e18
string day [] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
vector <string> v;
bool sortByFirst(const pair<int,int>&a,const pair<int,int>&b){
    return a.first>b.first;
}
void dfs (string str, string t = "", int cnt = 0) {
    if (cnt == 2) {
        v.push_back (t);
        return;
    } else {
        for (int i = 0; i <str.size (); i ++) {
            dfs (str, t + str [i], cnt + 1);
        }
    }
}
int main () {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    string str;
    while(cin>>str){
        int ln=str.length(),cnt=0;
        for(int i=0,j=ln-1;i<=j;i++,j--){
            if(str[i]!=str[j])cnt++;
        }
        cout<<cnt<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    string N;
    cin >> N;
    bool flag=false;
    if(N.at(0)==N.at(1)&&N.at(1)==N.at(2))flag=true;
    else if (N.at(1)==N.at(2)&&N.at(2)==N.at(3))flag=true;
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readInputLine().toInt()
    
    val nameStartsNums = mutableListOf<Long>(0L, 0L, 0L, 0L, 0L)
    
    for (i in 1..n) {
        val c = readInputLine().get(0)
        
        /*
        if (c == 'M') {
            nameStartsNums[0]++
        } else if (c == 'A') {
            nameStartsNums[1]++
        } else if (c == 'R') {
            nameStartsNums[2]++
        } else if (c == 'C') {
            nameStartsNums[3]++
        } else if (c == 'H') {
            nameStartsNums[4]++
        }
        */
        if (c == 'M') {
            nameStartsNums[0] = nameStartsNums[0] + 1
        } else if (c == 'A') {
            nameStartsNums[1] = nameStartsNums[1] + 1
        } else if (c == 'R') {
            nameStartsNums[2] = nameStartsNums[2] + 1
        } else if (c == 'C') {
            nameStartsNums[3] = nameStartsNums[3] + 1
        } else if (c == 'H') {
            nameStartsNums[4] = nameStartsNums[4] + 1
        }
    }
    
    var ans = 0L
    
    for (i in 0 until 5) {
        for (j in i + 1 until 5) {
            for (k in j + 1 until 5) {
                ans += nameStartsNums[i] * nameStartsNums[j] * nameStartsNums[k]
            }
        }
    }

    println(ans)
}
 
fun readInputLine(): String {
    return readLine()!!
}


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

#define REP(i,n) for(int i=0,len=(n); i<len; i++)
#define all(x) (x).begin(),(x).end()

using namespace std;

int main(){
	int n;
	int sum[2];
	int ans;
	
	cin >> n;
	
	int w[n];
	
	for(int i=0; i<n; i++){
		cin >> w[i];
	}
	
	ans=100000;
	for(int i=0; i<n; i++){
		sum[0]=0;
		sum[1]=0;
		
		for(int j=0; j<i; j++){
			sum[0]+=w[j];
		}
		for(int j=i; j<n; j++){
			sum[1]+=w[j];
		}
		
		ans=min(ans,abs(sum[0]-sum[1]));
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
  int h,w,i,j;
  char s='#',x='.';
  while(1){
    cin>>h>>w;
    if(h==0&&w==0) break;
    for(j=0;j<w;j++){
	cout<<s;
    }
    printf("\n");
    for(i=0;i<h-2;i++){
      cout<<s;
      for(j=0;j<w-2;j++){
	cout<<x;	
      }
      cout<<s;
      printf("\n");
    }
    for(j=0;j<w;j++){
	cout<<s;
    }
    printf("\n");
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 3028
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define mp make_pair
#define ff first
#define ss second
#define MAXN  1000005
#define endl "\n"
using namespace std;

const int INF = 1e9 + 5;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k, v[100005];
    vector<int>dp(100005, INF);
    cin>>n>>k;
    for(int i =  0; i < n; i++){
        cin>>v[i];
    }
    dp[0]=0;

    for(int i = 1; i < n; i++){
        for(int j = max(0, i - k);j < i;j++){
            dp[i]=min(abs(v[i] - v[j]) + dp[j], dp[i]);
        }
    }
    cout<<dp[n-1];

    return 0;
}



Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))

if len(a) < n:
    n = len(a)

isLoop = True
count = 0
while isLoop:
    for i in range(n):
        if a[i] % 2 == 0:
            a[i] = a[i] / 2
        else:
            isLoop = False
            break
    else:
        count += 1
print(count)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long N, K;
  cin >> N >> K;
  vector<long> x(N);
  rep (i, N) cin >> x[i];
  long result = 0;
  rep (i, N) result += min(x[i], K-x[i]);
  cout << result * 2 << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

/**
 * b進数(-10≦b≦-2、2≦b≦10)に変換した値を求めます
 * @param N 変換したい10進数の値
 * @param b 変換する進数
 * @return 変換後の値
 */
string getBaseNum(int N, int b) {
	string ret = N == 0 ? "0" : ""; // N==0の時はfor文通らないので例外条件
	int c = abs(b);
	for (int x = (N + (c - N) / c * c) % c;N != 0;N = (N - x) / b, x = (N + (c - N) / c * c) % c) {
		/* xは常に正であり、N%cを表す(N<0の時は必要なだけcを足している)
		c-NはN>0の時はNより小さいので(c-N)/c*cはN以下になるから問題なく、N<0の時はc-Nは|N|より大きいので(c-N)/c*cは|N|以上になる
		なので(N+(c-N)/c*cは0以上であり、かつ/c*cによってcの倍数だけ足してるから条件を満たすよ */
		ret += '0' + x;
	}
	reverse(ret.begin(), ret.end()); // そのまま後ろにくっつけると逆順になっているから注意
	return ret;
}
int main() {
	int N;
	cin >> N;
	cout << getBaseNum(N, -2);
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

N進数におけるxの値の導出手段は以下のようになる
ただし、a%bはaをbで割った余りとするが、a<0の時はa>0になるまでabs(b)をaに足してから割った余りとする
1. 1の位はx%Nで導出できる
2. 残りの値はx-x%Nであり、これは(x-x%N)をN進数上で1個右シフトすると1の手順を用いて導出できるので、
(x-x%N)/Nを1の手順で導出してから1個左シフトすれば求められる(→再帰的に導出できる)
*/

Measured memory_bytes: 256
#include<iostream>
int main() {
	int a, b, c, d, p;
	std::cin >> a >> b >> c >> d >> p;
	if (p > c) {
		if (a*p < b + (p - c) * d) {
			std::cout << a * p << std::endl;
		}
		else {
			std::cout << b + (p - c) * d << std::endl;
		}
	}
	else {
		if (a*p < b) {
			std::cout << a * p << std::endl;
		}
		else {
			std::cout << b << std::endl;
		}
	}
}


Measured memory_bytes: 3092
#include <cstdio>
#include <queue>
#include <algorithm>

using namespace std;

struct Edge {
	int next, to;
};

int n, m;
Edge e[200021];
int tot, head[100021], ind[100021];
bool vis[100021];
int f[100021];
int ans;

void Add_edge(int u, int v) {
	++tot; e[tot].next = head[u]; e[tot].to = v; head[u] = tot; ++ind[v];
}

void Topsort(int s) {
	queue<int> q;
	q.push(s);
	while (!q.empty()) {
		int u = q.front(); q.pop();
		vis[u] = true;
		ans = max(ans, f[u]);
		for (int i = head[u]; i; i = e[i].next) {
			int v = e[i].to;
			if (!vis[v]) {
				if (--ind[v] == 0) {
					q.push(v);
				}
				f[v] = max(f[v], f[u] + 1);
			}
		}
	}
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; ++i) {
		int x, y;
		scanf("%d%d", &x, &y);
		Add_edge(x, y);
	}
	for (int i = 1; i <= n; ++i) {
		if (!vis[i] && ind[i] == 0) {
			Topsort(i);
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 2304
def counter(b,N,K):
    return(max((N//b)*(b-K)+max(N%b-K+1,0),0))

N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
    ans+=counter(i,N,K)

if K==0:
    print(N**2)
else:
    print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;



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


    int N, N2, R_count;
    // R or S
    // char src[] = "";


    int i,count=0;
    char input[1024],check;

    string A, src;
    check = 'R';

    cin >> N >> input;

    // もし、Nの半分よりも
    // Rの出現数を調べる
    N2 = N / 2;


    for(i=0;input[i]!='\0';i++)
    {
        if(input[i]== check )
        {
            count++;
        }
    }


    if (N2 < count) {
        A = "Yes";
    }
    else {
        A = "No";
    }

    cout << A << "\n";
}

Measured memory_bytes: 256
import sys
# import numpy

N, X = map(int, input().split())
x_list = list(map(int, input().split()))
x_list.insert(0, 0)

tmp = 0
sum_x = []
for x in x_list:
    tmp += x
    sum_x.append(tmp)
# sum_x = numpy.cumsum(x_list)

max_robo = -(-1 * N // 2)
ans = sys.maxsize
for k in range(1, max_robo + 1):
    t_ans = (N + k) * X + 5 * sum_x[N]
    for j in range(1, -(-(N - k) // k)):
        t_ans += 2 * sum_x[N - (j + 1) * k]

    ans = min(ans, t_ans)

print(ans)

Measured memory_bytes: 26260
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define debug(x) cerr << #x << "=" << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1e9+7;

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

//********************************template END****************************************//

void solve(void){

	ll N, x;
	cin >> N >> x;
	vecll as(N);
	rep(N, i) {cin >> as[i];}

	sort(all(as));

	ll ans = 0, i = 0;

	while(x > 0 && i < N)
	{
		x -= as[i];
		ans++;
		i++;
	}

	if (x != 0LL)
	{
		ans--;
	}

	cout << ans << endl;

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


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

int main() {
    int n, l;
    cin >> n >> l;

    int pie = 0;;
    int sweet = 1 << 30;
    for (int i = 0; i < n; i++){
        int apple = l + i;
        pie += apple;
        if (abs(apple) < abs(sweet)){
            sweet = apple;
        }
    }

    cout << pie - sweet << endl;
}

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

#define ll          long long
#define endl        "\n"
#define inf         10000000002
#define pb          push_back
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define MAX         100
#define yes         cout<<"YES"<<endl
#define no          cout<<"NO"<<endl
#define bye         return 0

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

      string str;
      cin>>str;

      ll sum=0;
      for(int i=0; str[i]!='\0'; i++){
            ll digit=str[i]-'0';
            sum+=digit;
      }

      if(sum%9){cout<<"No"<<endl;}
      else cout<<"Yes"<<endl;


      bye;
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

#define mem(ar,a)       memset(ar,a,sizeof ar)
#define iOS           	ios_base::sync_with_stdio(false);cin.tie(NULL); 
#define pb(x)           push_back(x)
#define all(c)          c.begin(), c.end()
#define int             long long
#define ff              first
#define ss              second
#define nl              '\n'

int32_t main()
{
	iOS
	int r,d,x;cin>>r>>d>>x;
	vector<int> v(12);
	v[1]=x;
	for(int i=2;i<=11;i++){
		v[i]=r*v[i-1]-d;
		cout<<v[i]<<nl;
	}

}



Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>
int main() {
  int n,t,x,y,d,pt=0,px=0,py=0;
  bool a=true;
  std::cin >> n;
  while(std::cin>>t>>x>>y) {
    d = abs(x-px) + abs(y-py);
    if(t-pt<d||(t-pt-d)%2) {a=false;break;}
    pt = t;
    px = x;
    py = y;
  }
  std::cout << (a?"Yes":"No") << "\n";
}
    
    

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


int main()
{
    int n;string s;cin>>n>>s;
    int sum = 0;
    for(int i = 0; i<n; i++) {
        if(s[i] == 'R') sum++;
    }
    cout << (sum > n-sum?"Yes":"No")<<endl;
}

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

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

  int X; cin >> X;
  vector<ll> dp(100200, 0);
  dp[0] = 1;
  for (int j = 100; j < 106; j++) {
    for (int i = 0; i <= 100000; i++) {
      if (dp[i] == 1 ) {
        dp[i + j] = 1;
      }
    }
  }

  cout << dp[X] << '\n';
  return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
ll mod = 1000000007, oo = 1000000009;

void Emsawy() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

#define clr(v,d)     memset(v, d, sizeof(v))
#define sz(v)	     ((int)((v).size()))
#define all(v)	     ((v).begin()), ((v).end())
#define allr(v)	     ((v).rbegin()), ((v).rend())
#define V	         vector
#define MP	         make_pair
#define bug(n)           cout<< #n <<" = "<< n << endl;
int dx[] = { 1, -1, 0, 0, 1, -1, 1, -1 };
int dy[] = { 0, 0, 1, -1, 1, -1, -1, 1 };

V<V<int> > adj;
const ll N = 100000 + 5;
int n, m, k, w;

int main() {

	//Emsawy(); 
	while (cin >> n) {
		V<int>v(n);
		int ans = 0;
		for (int i = 0; i < n; i++) {
			cin >> v[i];
			while (v[i] % 2 == 0) {
				v[i] /= 2;
				ans++;
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){	
  	int A,B,K;
  	cin>>A>>B>>K;
  	if(B-A<2*K)for(int i=A;i<=B;i++)cout<<i<<"\n";
  	else for(int i=A;i<=B;i++)if(i<A+K||B-K<i)cout<<i<<"\n";
  	return 0;
}


Measured memory_bytes: 256
n = gets.to_i
x = 0
n.times do |i|
  if(( (i+1) % 2 )!= 0)then
     c = 0
     (i+1).times do |j|
        if((i+1) % (j+1) == 0)then
         c += 1
        end
      end
          if(c == 8)then
            x += 1
            end
    end
end
puts x


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main()
{
	unsigned long long a=100,x,y=0,ans=0;
	cin>>x;
	while(a<x)
	{
		a*=1.01;
		ans+=1;
	}
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 3620
//       Author: Mostafa Mounir Shehab
 
#include <bits/stdc++.h>
using namespace std;
 
#define PI  3.14159265  // PI = acos(-1)
#define EPS (1e-10)
#define endl "\n"
#define SZ(v) (int)(v.size())
typedef long long ll;
typedef long double ld;
//template <class Type>
 
 
void Fast(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL);
}
 
inline int D(){
	int t;
	scanf("%d",&t);
	return t;
}
inline ll llD(){
	ll t;
	scanf("%lld",&t);
	return t;
}
 
 
ll MOD=1e9 + 7; 
const int N=1e5 + 5,M=50 + 1;
int arr[N][4];
ll dp[N][4];
ll OO=1e12; 
 
ll n,m,k,cnt,SU,idx,len,MN,MX;
ll l,r,mid;
ll a,b,c,d;

ll Solve(int idx,int row){
	
		
	if(idx == n)
		return 0;
	
	ll &ret = dp[idx][row];
	if(~ret)
		return ret;
	
	ret = -OO;
	
	for(int i=1;i<=3;++i)
		if(row != i)
			ret = max(ret,arr[idx][i] + Solve(idx+1,i));
	
	return ret;
}



 
 
int main(){
	
	memset(dp, -1 ,sizeof dp);
	cin>>n;
	for(int i=0;i<n;++i)
		cin>>arr[i][1]>>arr[i][2]>>arr[i][3];

	cout<<Solve(0,0)<<endl;
	

	


}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a[100005];
int rest[100005];

int main(void){
	scanf("%d",&n);
	ll ans=1;
	rest[0]=3;
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		ans=ans*rest[a[i]]%MOD;
		rest[a[i]+1]++;
		rest[a[i]]--;
	}
	printf("%lld\n",ans);
	return 0;
}


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

int main(){
    int s;
    cin >> s;
    int hour, min,second;
    hour = s / 3600;
    s %= 3600;
    min = s / 60;
    second = s % 60;

    cout << hour << ":" << min << ":" << second << endl;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define fo(i,m,n) for(int i = m; i <= n; i++)
#define fod(i,m,n) for(int i = m; i >= n; i--)
#define fov(i,x) for(auto &i : x)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> _ii;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	i64 n, mod = 1e9+7;
	cin >> n;
    if(n == 1) cout << 0 << '\n';
    else
    {
        i64 a = 1,b = 1, c = 1;
        fo(i,1,n)
        {
            a *= 10;
            a %= mod;
            b *= 9;
            b %= mod;
            c *= 8;
            c %= mod;
        }
        i64 ans = a - b*2 + c;
        while(ans < 0) ans += mod;
        while(ans >= mod) ans -= mod;
        cout << ans << '\n';
    }
    return 0;
}


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

int main(){
  int L, R;
  cin >> L >> R;

  int ans = 0;

  for(int a=1; a<10; a++){
    for(int b=0; b<10; b++){
      for(int c=0; c<10; c++){
        int x = 10001*a + 1010*b + 100*c;
        if(x >= L && x <= R){
          ans++;
        }
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N, M int
	fmt.Scanf("%d %d", &N, &M)
	res := make([]int, N)
	for i := 0; i < N; i++ {
		res[i] = -1
	}
	for i := 0; i < M; i++ {
		var s, c int
		fmt.Scanf("%d %d", &s, &c)
		if res[s-1] != -1 && c != res[s-1] {
			fmt.Println(-1)
			return
		}
		if s-1 == 0 && c == 0 && N != 1 {
			fmt.Println(-1)
			return
		}
		res[s-1] = c
	}
	var ss string
	for i := 0; i < N; i++ {
		if i >= 1 && res[i] == -1 {
			ss += "0"
			continue
		}
		if i == 0 && res[i] == -1 && N != 1 {
			ss += "1"
			continue
		}
		if i == 0 && res[i] == -1 && N == 1 {
			ss += "0"
			continue
		}
		ss += fmt.Sprintf("%d", res[i])
	}
	fmt.Println(ss)

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using llong = long long;

const int INF = 100100100;
const int MOD = 1e9 + 7;

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

    llong M;
    cin >> M;

    llong d[300000];
    llong c[300000];
    REP(i, M) {
        llong tmp_d, tmp_c;
        cin >> tmp_d >> tmp_c;
        d[i] = tmp_d;
        c[i] = tmp_c;
    }

    llong now = d[0];
    c[0]--;
    llong index = 0;
    llong count = 0;
    while (index < M) {
        llong sum = now + c[index] * d[index];
        if (sum >= 10) {
            if (sum % 9 == 0) {
                count += c[index] + sum / 9 - 1;
                now = 9;
            } else {
                count += c[index] + sum / 9;
                now = sum % 9;
            }
        } else {
            count += c[index];
            now = sum;
        }

        /*
        while (c[index] >= 1) {
            now += d[index];
            c[index]--;
            count++;
            if (now >= 10) {
                now = now - 9;
                count++;
            }
        }
        */
        index++;
    }

    cout << count << "\n";

    return 0;
}


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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, l, r)  (a).begin()+(l),(a).begin()+(r)


int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int cnt = 0;
	FOR(i, 0, n - 1) {
		cnt++;
		while (s[i] == s[i + 1]) {
			i++;
			if (i == n - 1) {
				pv(cnt);
				return(0);
			}
		}
	}
	pv(cnt);
	return(0);
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		char []s = sc.next().toCharArray();
		int []dp = new int [n+1];
		
		sc.close();
		
		for(int i = 0; i < n ; i++) {
			if(s[i] == 'W') {
				dp[i] += 0;	
				}
			if(s[i] == 'E') {
				dp[i] += 1;
			}
			dp[i+1] += dp[i];
		}
		int min = 300001;
		for(int i = 0; i < n ; i++) {
			int temp = 0;
			if(i > 0) {
				temp += i - dp[i-1];
			}
			temp += dp[n-1] -dp[i];
			
			min = Math.min(min,temp);
		}
		System.out.println(min);
	}

}


Measured memory_bytes: 30472
w,h,n = map(int,input().split())
width = w*[1]
height = h*[1]

for _ in range(n):
  x,y,a = map(int,input().split())
  if a == 1:
    width[:x] = x*[0]
  elif a == 2:
    width[x:] = (w-x)*[0]
  elif a == 3:
    height[:y] = y*[0]
  else:
    height[y:] = (h-y)*[0]
 
print(width.count(1)*height.count(1))

Measured memory_bytes: 8996
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=10000;
const int Max = 1e6+10;
const double pi = acos(-1);
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;}
void solve(){
    int n,m;
    cin>>n>>m;
    VI a(m);
    for(auto &x:a)cin>>x;
    int ans = n-accumulate(all(a),0);

    cout<<(ans>=0?ans:-1);
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}






Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
int main(){
	/*
	#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	#endif
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	n/=2;
	int p=a[n-1];
	int q=a[n];
	if(q==p) cout<<0;
	else{
		cout<<q-p;
	}
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int mod=1000000007;
const double PI = 3.14159265359;
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define INF 1000000000000
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define FOR(i,n) for(int i=0;i<(n);i++)
#define FORA(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define count_1(n)  __builtin_popcountll(n)
#define parity(n)   __builtin_parityll(n)   //Even parity 0 as output
void show    (int a[], int arraysize) { for (int i = 0; i < arraysize; ++i)  {cout << a[i] << " ";}	cout<<endl;}
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b);}
void sieve(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}
int main()
{FAST
int n,k,sum=0;
cin>>n>>k;
int a[n];
FOR(i,n)
{
	cin>>a[i];
}
sort(a,a+n);
FOR(i,k)
{
	sum+=a[i];
}
cout<<sum<<endl;
return  0;
}






Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <cmath>

#define MOD 1000000007

using namespace std;

int main(){
  int i,j,N,c,x;
  long long ans;
    vector <int> p;
    cin >> N;
    for(i=2;i<=N;i++){
        c = 0;
        for(j=1;j<=N;j++){
            if(i%j==0){
                c++;
            }
        }
        if(c==2){
            p.push_back(i);
        }
    }
    p.push_back(0);
    i = 0;
    c = 0;
    ans = 1;
    while(p[i]!=0){
        for(j=2;j<=N;j++){
            x =j;
            while(x!=0 && x%p[i]==0){
                c++;
                x = x/p[i];
            }
        }
        ans = ans%MOD*(c+1)%MOD;
        i++;
        c = 0;
    }
    cout << ans%MOD << endl;
}

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


public class Main {
    public static void main (String[]args)throws IOException {
        Scanner scanner = new Scanner(System.in);
        int x=scanner.nextInt();
        int y=scanner.nextInt();
        int z=scanner.nextInt();
        System.out.println(z+" "+x+" "+y);
    }
}


Measured memory_bytes: 21844
#include <stdio.h>
//#include <string.h>

int main(void){

  char s[7];
  scanf("%s", s);
  
  if(s[0]=='S') printf("Cloudy\n");
  else if(s[0]=='C') printf("Rainy\n");
  else if(s[0]=='R') printf("Sunny\n");

  return 0;
}


Measured memory_bytes: 1588
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define Mod 1000000007
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
#define INF 999999999999999999
#define NN (ll)(1e6+5)
int mod(string s,int a) 
{ 
    int ans=0; 
    for (int i=0;i<s.length();i++) 
         ans=(ans*10+(int)s[i]-'0')%a; 
    return ans; 
}
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {    
       ll n,k,i,d,j,x,c=0;
       cin>>n>>k;
       vector <ll> v[k],hash(n+1,0);
       for(i=0;i<k;i++)
       {
           cin>>d;
           for(j=0;j<d;j++)
           {
               cin>>x;
               hash[x]++;
           }
       }
       for(i=1;i<=n;i++)
        if(hash[i]==0)
         c++;
       cout<<c<<"\n";  
   }
}

Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int A, B;
  std::cin >> A >> B;
  if(A == B){
    std::cout << 2*A << '\n';
  }else{
    std::cout << 2* max(A, B) -1<< '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int s[15][15];
int p[20];
int k[15];
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>k[i];
		for(int j=0;j<k[i];j++){
			cin>>s[i][j];
			s[i][j]--; 
		}
	}
	for(int i=0;i<m;i++)cin>>p[i];
	int ans=0;
	for(int msk=0;msk<(1<<n);msk++){
		int b[n]={};
		for(int i=0;i<n;i++){
			if((msk>>i)&1)b[i]=1;
		}
		bool ok=true;
        for(int i=0;i<m;i++){
            int x=0;
            for(int j=0;j<k[i];j++){
				if(b[s[i][j]])x=1-x;
			}
            if(x!=p[i])ok=false;
        }
        ans+=ok;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
#define pii pair<int,int>
#define pll pair<LL,LL>

using namespace std;

int main(){

    int W,a,b;cin>>W>>a>>b;
    int ans=0;
    if(b>a+W)ans = b-(a+W);
    else if(a>b+W)ans = a-(b+W);
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <algorithm>
#include <iostream>

using namespace std;
typedef long long ll;

ll floor_sum(ll n, ll m, ll a, ll b) {
  long long ans = 0;

  if (a >= m) {
    ans += (n - 1) * n * (a / m) / 2;
    a %= m;
  }

  if (b >= m) {
    ans += n * (b / m);
    b %= m;
  }

  ll y_max = (a * n + b) / m;
  ll x_max = (y_max * m - b);

  if (y_max == 0) return ans;

  ans += (n - (x_max + a - 1) / a) * y_max;
  ans += floor_sum(y_max, a, m, (a - x_max % a) % a);

  return ans;
}

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

  int N, M, A, B;
  for (int i = 0; i < T; ++i) {
    cin >> N >> M >> A >> B;

    cout << floor_sum(N, M, A, B) << endl;
  }

  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    
    deque<int> q;
    rep(i,n){
        int x=lower_bound(all(q),a[i])-q.begin();
        if(x==0) q.push_front(a[i]);
        else q[x-1]=a[i];
    }
    cout<<q.size()<<endl;
}



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

int main() {

    int h, w;
    cin >> h >> w;
    
    cout << std::string(w + 2, '#') << endl;
    string a = "";
    for (int i = 0; i < h; i++){
        cin >> a;
        cout << '#' << a << '#' << endl;
    }
    cout << std::string(w + 2, '#') << endl;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(){
  int a, b;
  scanf("%d%d", &a, &b);
  if(a > b){
      printf("a > b\n");
  }else if(a < b){
      printf("a < b\n");
  }else{
    printf("a == b\n");
  }
  return 0;
}

Measured memory_bytes: 580
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX*/

using namespace std;

using ll = long long;

#define mp make_pair

const int p = 998244353;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

/*const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

bool check(vector<ll> &a, int k)
{
    int n = a.size();
    ll ans = 0;
    for (int i = 0; i<=k; i++) ans+=a[i];
    for (int i = k+1; i<n; i++)
    {
        if (ans*2<a[i]) return false;
        ans+=a[i];
    }
    return true;
}


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

    int n;
    cin>>n;
    vector<ll> a(n);
    for (int i = 0; i<n; i++) cin>>a[i];
    sort(a.begin(), a.end());

    if (check(a, 0)) {cout<<n; return 0;}
    int L = 0; int R = n-1;
    while (R-L>1)
    {
        int mid = (L+R)/2;
        if (check(a, mid)) R = mid;
        else L = mid;
    }
    cout<<n - R;

}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
#include<iomanip>
using namespace std;

long long N;

int main() {
    cin >> N;
    if (N % 2) {
        cout << 0 << endl;
        return 0;
    }
    N /= 2;
    long long power_of_five = 5;
    long long five = 0;
    while(power_of_five <= N) {
        five += N / power_of_five;
        power_of_five *= 5;
    }
    cout << five << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 1e2 + 7;
const int mod = 1e9+7;
int n,m;
char a[N][N];
bool x[N],y[N];
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%s",a[i]+1);
    }
    for(int i=1;i<=n;i++){
        bool flag=1;
        for(int j=1;j<=m;j++){
            if(a[i][j]=='#'){
                flag=0;break;
            }
        }
        if(flag)x[i]=1;
    }
    for(int j=1;j<=m;j++){
        bool flag=1;
        for(int i=1;i<=n;i++){
            if(a[i][j]=='#'){
                flag=0;break;
            }
        }
        if(flag)y[j]=1;
    }
    for(int i=1;i<=n;i++){
        if(x[i])continue;
        bool flag=0;
        for(int j=1;j<=m;j++){
            if(y[j])continue;
            flag=1;
            putchar(a[i][j]);
        }
        if(flag)puts("");
    }
    return 0;
}


Measured memory_bytes: 256
mod = 998244353
N = int(input())
D = list(map(int,input().split()))
D_max = max(D)
C = [0]*(D_max + 1)
for i in range(len(D)):
    C[D[i]] += 1
tmp = 1
for i in range(len(C)-1):
    tmp = tmp * (C[i]**C[i+1]) % mod
if D[0] != 0 or C[0] > 1:
    tmp = 0
print(tmp)

Measured memory_bytes: 14396
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


struct edge {ll from,to,cost;};

int main()
{
    int n,m;
    cin >> n >> m;
    edge es[m];
    for(int i = 0; i < m; i++){
        ll a,b,c;
        cin >> a >> b >> c;
        a--; b--;
        es[i].from = a;
        es[i].to = b;
        c *= -1;
        es[i].cost = c; 
    }
    ll d[n],dis[n];
    for(int i = 0; i < n; i++){
        d[i] = INF;
        dis[i] = INF;
    }
    d[0] = 0;
    dis[0] = 0;

    for(int i = 0; i < n-1; i++){
        for(int j = 0; j < m; j++){
            edge e = es[j];
            if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
            }
        }
    }
    ll ans = d[n-1];
    
    bool negative[n];
    for(int i = 0; i < n; i++){
        negative[i] = false;
    }

    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            edge e = es[j];
            if(dis[e.from] != INF && dis[e.to] > dis[e.from] + e.cost){
                dis[e.to] = dis[e.from] + e.cost;
            }
        }
    }
    ll ans1 = dis[n-1];

    if(ans == ans1){
        cout << -1 * ans << endl;
    }else{
        cout << "inf" << endl;
    }

}


Measured memory_bytes: 256
#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define MGN 8
#define LINF (LONG_MAX/2)
using namespace std;
typedef long long ll; typedef unsigned long long ull;
typedef vector<int> vi; typedef vector<vi> vvi;
typedef vector<ll> vl; typedef vector<vl> vvl;
typedef vector<double> vd; typedef vector<string> vs;
typedef pair<int, int> pii; typedef pair<ll, ll> pll;
typedef vector<bool> vb; typedef vector<vb> vvb;
template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
    return left.second > right.second;
}
vs split(string str, char sep) {
    vs v; stringstream ss(str); string t;
    while (getline(ss, t, sep)) v.push_back(t);
    return v;}
vs re_search_g(string s, regex re) {
    vs ret; smatch mc; auto it = s.cbegin();
    while (regex_search(it, s.cend(), mc, re)) {
        ret.push_back(mc[0]);
        it += mc.position(0) + mc.length();}
    return ret;}
#endif

void init_global_C() {}

int main_C() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N; cin >> N;
    vi a(N); REP(i,N) cin >> a[i];

    vector<char> c(4801, '?');
    FOR(i,1,4801){
        if (i <= 399) c[i] = 'h';
        else if (i <= 799) c[i] = 'c';
        else if (i <= 1199) c[i] = 'g';
        else if (i <= 1599) c[i] = 'm';
        else if (i <= 1999) c[i] = 'b';
        else if (i <= 2399) c[i] = 'y';
        else if (i <= 2799) c[i] = 'o';
        else if (i <= 3199) c[i] = 'r';
        else c[i] = '?';
    }

    set<char> st;
    int cnt = 0;
    REP(i,N) {
        if (3200 <= a[i]) cnt++;
        else st.insert(c[a[i]]);
    }
    int M = st.size();

    int lo, hi;
    if (M == 0) {
        lo = 1;
        hi = cnt;
    } else {
        lo = M;
        hi = M + cnt;
    }
    cout << lo << " " << hi << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
 char c;
 cin>>c;
  
 if(c=='a'){
  cout<<"vowel"<<endl;
 }
 else if(c=='i'){
  cout<<"vowel"<<endl;
 }
 else if(c=='u'){
  cout<<"vowel"<<endl;
 }
 else if(c=='e'){
  cout<<"vowel"<<endl;
 }
 else if(c=='o'){
  cout<<"vowel"<<endl;
 }
 else{
  cout<<"consonant"<<endl;
 }
}

Measured memory_bytes: 3584
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
vector<vector<int>> g;
vector<int> color;
vector<int> visited;

bool bi = true;

void dfs(int now, int c){
    color[now] = c;
    for(int i = 0; i < g[now].size(); i++){
        int next = g[now][i];
        if(color[next] != -1){
            if(color[next] == c){
                bi = false;
                return;
            }
        } else {
            if(visited[next]) continue;
            color[next] = !c;
            visited[next] = true;
            dfs(next, !c);
        }
    }
}

int main(void){
    ll n, m;
    cin >> n >> m;
    g.resize(n);
    color.resize(n, -1);
    visited.resize(n, 0);
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(0, 0);

    if(bi){
        ll w = 0;
        ll b = 0;
        for(int i = 0; i < n; i++){
            if(color[i] == 0){
                w++;
            } else {
                b++;
            }
        }

        cout << w * b - m << endl;
    } else {
        cout << n * (n - 1) / 2 - m << endl;
    }


}

Measured memory_bytes: 6784
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

using namespace std;
using ll = long long;

int keta(int n){
    int result =1;
    int tmp =n;
    while(n/10>0){
        result++;
        n/=10;
    }
    return result;
}

int ketanum(int n,int s){
    n = n/pow(10,keta(n)-s);
    return n%10;
}

int main(){
    int n,m;
    cin>>n>>m;
    int s[m],c[m];
    for(int i=0;i<m;i++){
        cin>>s[i]>>c[i];
    }

    int ans=-1;
    bool ok=true;
    for(int i=0;i<pow(10,n);i++){
        if(keta(i)!=n) continue;
        ok =true;
        for(int j=0;j<m;j++){
            if(ketanum(i,s[j]) != c[j]) ok=false;
        }
        if(ok){
            ans=i;
            break;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args&&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#define ll long long
const int N = 2e6 + 15;
int main(){
	ll n;
	cin >> n;
	ll ans = 0;
	n--;
	vector<ll> v;
    for(ll i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            v.push_back(i);
            if(n / i != i) {
                v.push_back(n / i);
            }
        }
    }
    ans += v.size()-1;
    n++;
	for (ll i = 2; i*i <= n; ++i) {
		if (n%i == 0) {
			ll k = i;
			ll temp = n;
			while (temp%k == 0)
				temp /= k;
			if (temp%k == 1) ans++;
			if (i != n/i) {
				k = n/i;
				temp = n;
				while (temp%k == 0)
				temp /= k;
				if (temp%k == 1) ans++;
			
			}
		}
	}
	cout << ans + 1<< "\n";
	return 0;
}


Measured memory_bytes: 256