akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define INF 1000000000000
#define MOD 1000000007

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);

    int x;
    cin>>x;
    if(x==0){
        cout<<1<<endl;
    }else{
        cout<<0<<endl;
    }
    return 0;
}

Measured memory_bytes: 3640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  int N, K;
  cin >> N >> K;
  vector<ll> A(N);
  rep(i, N) {
    cin >> A[i];
  }

  ll sum = 0;
  rep(i, N) { sum += A[i]; }
  set<ll> candidates;
  for (int i = 1; i * i <= sum; ++i) {
    if (sum % i == 0) {
      candidates.insert(i);
      candidates.insert(sum / i);
    }
  }
  ll ans = 1;
  for (ll x : candidates) {
    ll need; // required operations
    {
      vector<ll> r(N);
      rep(i, N) { r[i] = A[i] % x; }
      sort(all(r));
      ll B = 0;
      rep(i, N) { B += x - r[i]; }
      ll A = 0;
      need = 1e18;
      rep(i, N) {
        A += r[i];
        B -= x - r[i];
        need = min(need, max(A, B));
      }
    }
    if (need <= K) {
      ans = max(ans, x);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
ll S;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>S;
    ll x2=1e9,y2=1,x3,y3;
    if(S%x2==0){
        y3=S/x2;
        x3=0;
    }else{
        y3=S/x2+1;
        S%=x2;
        x3=x2-S;
    }
    cout<<0<<' '<<0<<' '<<x2<<' '<<y2<<' '<<x3<<' '<<y3<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int a=n/1000;
    int e=n%1000/100;
    int c=n%100/10;
    int d=n%10;
    int f=10*a+e;
    int b=10*c+d;
    if(1<=f & f<=12){
        if(b>=13 ||b==0){
            cout<<"MMYY"<<endl;
        }
        else{
            cout<<"AMBIGUOUS"<<endl;
        }
    }
    else if(f==0){
        if(1<=b & b<=12){
            cout<<"YYMM"<<endl;
        }
        else{
            cout<<"NA"<<endl;
        }
    }
    else{
        if(1<=b & b<=12){
            cout<<"YYMM"<<endl;
        }
        else{
            cout<<"NA"<<endl;
        }
    }
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

void solve()
{
    string s;
    cin >> s;
    int n = s.size();
    rep(i, n)
    {
        if (i == 0 || i % 2 == 1)
            continue;
        s = s.substr(0, n - i);
        string t = s.substr(0, s.size() / 2);
        string u = s.substr(s.size() / 2);
        if (t == u)
        {
            cout << s.size() << endl;
            return;
        }
    }
}

int main()
{
    solve();
    return 0;
}

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

#define int long long
#define vc vector<char>
#define vi vector<int>
#define vs vector<string>
#define si set<int>
#define pii pair<int,int>
#define SORT(c) sort(c.begin(),c.end())
#define SORTC(c, cmp) sort(c.begin(),c.end(),cmp)
#define mapii map<int,int>
#define pb push_back
#define F first
#define S second
#define rep(i, j, k) for (int i=j;i<k;i++)
#define repb(i, j, k) for (int i=j;i>=k;i--)
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define ar array

using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0)

string s, t;

void solve() {
    cin >> s >> t;
    int ans = 0;
    rep(i, 0, s.size()) {
        ans += s[i] != t[i];
    }
    cout << ans;
}


int32_t main() {
    fast;

    int tt{1};
//    cin >> tt;
    while (tt--) {
        solve();
        cout << endl;
    }
    return 0;

}

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

#define MIN(X,Y) ((X)<(Y)?(X):(Y))
#define MAX(X,Y) ((X)>(Y)?(X):(Y))

int main(void){
  int a[100010];
  int n, ans;
  
  cin >> n;
  ans = 0;
  for (int i=0; i<n; i++){
    cin >> a[i];
    ans += i%2==0? a[i]: -a[i];
  }
  cout << ans;
  for (int i=1; i<n; i++){
    ans = 2*a[i-1] - ans;
    cout << " " << ans;
  }
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 3932
def main():
    S = input()
    N = len(S)
    i = 0
    ans = 0
    while i < N:
        inc = 0
        dec = 0
        while i < N and S[i] == "<":
            inc += 1
            i += 1
        while i < N and S[i] == ">":
            dec += 1
            i += 1
        ans += (inc - 1) * inc // 2
        ans += (dec - 1) * dec // 2
        ans += max(inc, dec)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 43552
import java.util.Scanner;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int k = sc.nextInt();
    int count = 0;

    for(int i = 0; i < n; i++){
      if(sc.nextInt() >= k){
        count++;
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 47732
#include<bits/stdc++.h>
using namespace std;
const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};
const int month[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};
vector<int> v[100010];
int ans[100010];
bool use[100010];
void bfs(int now)
{
	queue<int> q;
	q.push(now);
	while(!q.empty())
	{
		now=q.front();
		q.pop();
		for(int i=0;i<v[now].size();i++)
		{
			if(!use[v[now][i]])
			{
				use[v[now][i]]=1;
				ans[v[now][i]]=now;
				q.push(v[now][i]);
			}
		}
	}
}
/*======================================================================*/
int main()
{
  /*
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
  */
  /*====================================================================*/
  int n,m;
  cin>>n>>m;
  for(int i=0;i<m;i++)
  {
  	int a,b;
  	cin>>a>>b;
  	a--,b--;
  	v[a].push_back(b);
  	v[b].push_back(a);
  }
  bfs(0);
  /*rep(i,n)
  {
  	cout<<i<<" "<<use[i]<<endl;
  }*/
  for(int i=0;i<n;i++)
  {
  	if(!use[i])
  	{
  		//cout<<i<<endl;
  		cout<<"No"<<endl;
  		return 0;
	}
  }
  cout<<"Yes"<<endl;
  for(int i=1;i<=n-1;i++)
  {
  	cout<<ans[i]+1<<endl;
  }
  return 0;
}


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

int main(){
  int N;
  int p=-1;
  cin>>N;
  vector<int> menber(N,-1);
  vector<int> count(N,0);

  for(int i=1;i<N;i++){
    cin >> p;
    count[p-1]++;
  }
  for(int i=0;i<N;i++){
    cout<<count[i]<<endl;
  }

}


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

int main()
{
	int n;
	string val;
	cin >> n;
	int count[4] = { 0 };
	for (int i = 0; i < n; ++i)
	{
		cin >> val;
		switch (val[0])
		{
		case 'A':
			count[0]++;
			break;
		case 'W':
			count[1]++;
			break;
		case 'T':
			count[2]++;
			break;
		case 'R':
			count[3]++;
			break;
		default:
			break;
		}
	}
	cout << "AC x " << count[0] << "\nWA x " << count[1] << "\nTLE x " << count[2] << "\nRE x " << count[3] << "\n";

	ios::sync_with_stdio(false);
	cin.tie();
	cout.tie();
	return 0;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> l(N);
    for (int i=0; i<N; i++) cin >> l.at(i);
    sort(l.begin(), l.end(), greater<int>());
    int sum = 0;
    for (int i=0; i<K; i++) sum += l.at(i);
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	ll x,y; cin>>x>>y;
	if(x%y==0) cout<<-1<<endl;
	else cout<<x<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

vector<pair<int,ll>> v[mx];
vector<ll> a(mx);

void dfs(int x, int p){
  for(auto to:v[x]){
    if(to.F==p){ continue; }
    a[to.F]=a[x]+to.S;
    dfs(to.F,x);
  }
}

int main(){
  int n;
  cin >> n;
  rep(i,n-1){
    int x,y,z;
    cin >> x >> y >> z; x--; y--;
    v[x].emplace_back(y,z);
    v[y].emplace_back(x,z);
  }
  dfs(0,-1);
  rep(i,n){ cout << a[i]%2 << endl; }
  return 0;
}


Measured memory_bytes: 13312
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

typedef long long ll;

int MOD=1000000007;


int main(){
    ll N,ans;
    cin >> N;
    for(ll i=1; i<=sqrt(N); i++){
        if(N%i==0) ans =i+(N/i)-2;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=100010;
int n,l,r,mid,j,p[N],siz[N],fa[N];
long long d[N],dis[N];
bool cmp(int x,int y) {return d[x]<d[y];}
long long read() {
	long long tmp=0, fh=1; char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') fh=-1; c=getchar();}
	while (c>='0'&&c<='9') tmp=tmp*10+c-48, c=getchar();
	return tmp*fh;
}
int main() {
	n=read();
	for (int i=1;i<=n;i++) d[i]=read(), p[i]=i, siz[i]=1;
	sort(p+1,p+n+1,cmp);
	for (int i=n,j=i-1;i>1;i--) {
		l=1; r=i;
		while (l+1<r) {
			mid=(l+r)>>1;
			if (d[p[mid]]<=d[p[i]]+siz[p[i]]*2-n) l=mid; else r=mid;
		}
		j=l;
		if (d[p[j]]==d[p[i]]+siz[p[i]]*2-n) siz[p[j]]+=siz[p[i]], dis[p[j]]+=dis[p[i]]+siz[p[i]], fa[p[i]]=p[j];
		else {
			printf("-1\n"); return 0;
		}
	}
	if (dis[p[1]]!=d[p[1]]) printf("-1\n"); else
		for (int i=2;i<=n;i++) printf("%d %d\n",fa[p[i]],p[i]);
	return 0;
} 

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef pair<ll,ll> P;
ll n,a[10005];
ll LCM=1;
ll ans;
ll P[1000001];
ll p[10000];
ll pp=0;
const ll MOD=1000000007;
map<ll,ll> prime_factor(ll n){
    map<ll,ll> res;
    for(ll i=2;i*i<=n;i++){
        bool w=true;
        while(n%i==0){
            res[i]++;
            n=n/i;
            if(w){
                w=false;
                p[pp]=i;
                pp++;
            }
        }
    }
    if(n!=1){
        res[n]=1;
        p[pp]=n;
        pp++;
    }
    return res;
}
ll modinv(ll a,ll MOD) {
    ll b=MOD,u=1,v=0;
    while(b){
        ll t=a/b;
        a-=t*b; swap(a,b);
        u-=t*v; swap(u,v);
    }
    u%=MOD; 
    if(u<0) u+=MOD;
    return u;
}
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        map<ll,ll> M;
        M=prime_factor(a[i]);
        for(int j=0;j<pp;j++){
            P[p[j]]=max(P[p[j]],M[p[j]]);
            p[j]=0;
        }
        pp=0;
    }
    for(int i=0;i<1000001;i++){
        for(int j=0;j<P[i];j++){
            LCM=(LCM*i)%MOD;
        }
    }
    for(int i=0;i<n;i++){
        ans=(ans+(LCM*modinv(a[i],MOD))%MOD)%MOD;
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 7496
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL X, Y,ans;

int main()
{
	in >> X >> Y;
	while (X <= Y)
	{
		X *= 2;
		++ans;
	}
	out << ans << std::endl;
	return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <string>

int main() {
    std::string s;
    std::cin >> s;
    for (int i = s.length() - 1; i > 1; i--) {
        if (i % 2 != 0) continue;
        if (s.substr(0, i / 2) == s.substr(i / 2, i / 2)) {
            std::cout << i << std::endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define Swap(x,y) {int t;t=x;x=y;y=t;}
int main(void)
{
    int a,b,c;
    scanf("%d%d%d", &a, &b, &c);
    if (a>b) Swap(a,b);
    if (b>c) Swap(b,c);
    if (a>b) Swap(a,b);
    printf("%d %d %d\n", a, b, c);
}



Measured memory_bytes: 2076
n = int(input())
nums = []
evens = set()
for i in range(n):
  tmp = int(input())
  nums.append(tmp)
  if i%2==0:
    evens.add(tmp)
nums.sort()
count = 0
for j in range(n):
  if j%2 == 0:
    if nums[j] not in evens:
      count += 1
print(count)

Measured memory_bytes: 9660
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    K = int(readline())
    N = 50

    q, r = divmod(K, N)
    A = [N - 1 + (N + 1) * q - K] * N

    for i in range(r):
        A[i] += N + 1

    print(N)
    print(' '.join(map(str, A)))
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9128
#include<bits/stdc++.h>
using namespace std;
int a[10010];
void fj(int x){
	int d;
	for(d=2;d<=x;d++){
		while(x%d==0){
			x/=d;a[d]++;
		}
	}
	if(x!=1) a[x]++;
}
int main(){
	long long n,i;
	cin>>n;
	for(i=2;i<=n;i++){
		fj(i);
	}
	long long ans=1;
	for(i=2;i<=n;i++){
		if(a[i]!=0){
			ans*=a[i]+1;
			ans%=1000000007ll;
		}
	}
	cout<<ans;
	return 0;
}



Measured memory_bytes: 256
(function() {
    'use strict';

    var lines = [];
    require('readline').createInterface({
      input: process.stdin,
      output: process.stdout
    }).on('line', function(line) {
      lines.push(line);
    });
    process.stdin.on('end', function() {
      //lines.forEach(function(line) {
        //var tokens = line.split(' ').map(Number);
        //    console.log(tokens[0] + ' ' + tokens[1]);
      //}
      //)
      ;

    // ToDo start
      var inLines = lines[0].split(" ")
      var N = inLines[0];
      var A = inLines[1];
      var B = inLines[2];

      var ans = Math.min(A * N,B)

    console.log(ans)
      
//      console.log( Math.pow(parseInt(lines[0]),2) - parseInt(lines[1])  )
    // ToDo end

    });


})();



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



int main(){
  int n;
  cin>>n;
  vector<int>s(30,52);
  vector<int>kari(30,0);
  for(int i=0;i<n;i++){
    string t;
    cin>>t;
    for(int j=0;j<t.size();j++){
      kari.at(t.at(j)-'a')++;
    }
    for(int j=0;j<27;j++){
      s.at(j)=min(s.at(j),kari.at(j));
      kari.at(j)=0;
    }
  }
  for(int i=0;i<26;i++){
    int S=s.at(i);
    for(int j=0;j<S;j++){
      cout << char(i+'a');
    }
  }
}


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

using namespace std;

typedef long long ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    string s;
    cin >> s;
    bool matched = true;
    if(s[2] != s[3]){
        matched = false;
    }
    if(s[4] != s[5]){
        matched = false;
    }
/*    
    for(int i = 0 ; i < 6 ; ++i){
        for(int j = i+1 ; j < 6; ++j){
            if(i == 2 && j == 3){
                continue;
            }
            if(i == 4 && j == 5){
                continue;
            }
            if(s[i] == s[j]){
                matched = false;
            }
        }
    }
*/
    if(matched){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int N;
int C[10000][2];

void solve() {
  int a = 0;
  int b = 0;
  for (int i = 0; i < N; i++) {
    int ac = C[i][0];
    int bc = C[i][1];
    if (ac > bc) {
      a += ac + bc;
    } else if (ac < bc) {
      b += ac + bc;
    } else {
      a += ac;
      b += bc;
    }
  }
  printf("%d %d\n", a, b);
}

int main() {
  for (;;) {
    scanf("%d", &N);
    if (N == 0) { break; }

    for (int i = 0; i < N; i++) {
      scanf("%d%d", &C[i][0], &C[i][1]);
    }
    solve();
  }
}

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

int main() {
	int n;
	cin >> n;
	int n1, n2 = n, ans = 0;
	while (n2 > 0) {
		n1 = n2 % 10;
		ans += n1;
		n2 = (n2 - n1) / 10;
	}
	for (int i = 1; i <= 100000000; i++) {
		if (n == ans*i) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>
#include<deque>
#include<cmath>





using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const ll INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 1000 * 1000 * 1000 + 7;


void solve() {
    string s;
    cin >> s;
    int res = 0;
    int n = s.size();
    for (int i = 0; i < n; ++i) {
        if (s[i] == '?')
            s[i] = 'D';
        if (s[i] == 'D')
            ++res;
    }
    for (int i = 0; i < n - 1; ++i) {
        if ((s[i] == 'P') && (s[i + 1] == 'D'))
            ++res;
    }
    cout << s << endl;

}


//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    solve();



#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


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

typedef long long ll;

using namespace std;

int main() {
    ll N;
    cin >> N;
    ll k = 0, ans = 0, m = 1'000'000'000;
    for (int i = 0; i < N; i++) {
        ll A;
        cin >> A;
        if (A < 0) {
            k++;
            A = -A;
        }
        ans += A;
        m = min(m, A);
    }
    if (k % 2 != 0) {
        ans -= m + m;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import math
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
c=1
test=A[0]
l=0

while test%2 == 0:
  test=test//2
  c*=2
  
for i in np.arange(N-1):
  if A[i+1]%c!=0:
    print(0)
    l=1
    break
  elif A[i+1]%(c*2)==0:
    print(0)
    l=1
    break
  else:
    k=A[i+1]//c
    test=test*k//math.gcd(test,k)
if l==0:
  k=test*c//2
  print(M//k//2+M//k%2)

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


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


	int N;
	cin >> N;
	int A[100000], B[100000];
	rep(i, N) cin >> A[i];
	rep(i, N) cin >> B[i];

	ll tarinai = 0;
	vector<int> V;
	int kotae = 0;

	rep(i, N) {
		if (A[i] > B[i]) {
			V.pb(A[i] - B[i]);
		}
		else if (A[i] < B[i]) {
			tarinai += B[i] - A[i];
			kotae++;
		}
	}
	sort(V.begin(), V.end());
	reverse(V.begin(), V.end());
	for (int i : V) {
		if (tarinai > 0) {
			tarinai -= i;
			kotae++;
		}
		else break;
	}
	if (tarinai > 0) co(-1);
	else co(kotae);

	Would you please return 0;
}

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

int main()
{
    int n = 0;

    while( cin >> n )
    {
        int count = 0;
        for( int a = 0; a <= 9; a++ )
            for( int b = 0; b <= 9; b++ )
                for( int c = 0; c <= 9; c++ )
                    for( int d = 0; d <= 9; d++ )
                    {
                        if( a + b + c + d == n )
                            count++;
                    }
        cout << count << endl;
    }

    return 0;
}


Measured memory_bytes: 3108
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

use std::io::Write;

fn run() {
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    input! {
        n: usize,
        x: [u32; n],
        l: u32,
        q: usize,
        p: [(usize1, usize1); q],
    }
    let mut dp = vec![0; n];
    let mut j = 0;
    for i in 0..n {
        while j < n - 1 && x[j + 1] - x[i] <= l {
            j += 1;
        }
        dp[i] = j;
    }
    let mut dp = vec![dp];
    while dp.last().unwrap()[0] < n - 1 {
        let mut next = vec![0; n];
        {
            let prev = dp.last().unwrap();
            for i in 0..n {
                next[i] = prev[prev[i]];
            }
        }
        dp.push(next);
    }
    for (a, b) in p {
        let (mut a, b) = (std::cmp::min(a, b), std::cmp::max(a, b));
        let mut ans = 0;
        for i in (0..dp.len()).rev() {
            if dp[i][a] < b {
                ans += 1 << i;
                a = dp[i][a];
            }
        }
        ans += 1;
        writeln!(out, "{}", ans).unwrap();
    }
}

fn main() {
    run();
}


Measured memory_bytes: 29432
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
// constexpr ll inf = 1ll<<61;
// constexpr ll mod = 1e9+7;

signed main(){
  int n,m;
  cin >> n >> m;

  int res;
  FOR(i,1,sqrt(m)+2){
    if(m % i == 0){
      if(i <= m/n) res = max(res, i);
      if(m / i <= m / n) res = max(res, m/i);
    }
  }

  cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <set>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }



int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  rep(i,s.size()) {
    s[i] = (s[i] - 'A' + n) % 26 + 'A';
  }
  cout << s << endl;

	return 0;
  }

Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

n,i = map(int, input().split())

print(n-i+1)


Measured memory_bytes: 8980
parseint(x) = parse(Int, x)
parseintmap(x::Array{SubString{String},1}) = map(parseint, x)

function solve(n::Int, m::Int, d, eo)
    ret = 0
    for i in 0:((2^n)-1)
        on = 0
        for j in 1:m
            s = 0
            for switch in d[j]
                if ((i >> (switch - 1)) & 1) == 1
                    s += 1
                end
            end
            if ((s%2) == eo[j])
                on += 1     		
            end
        end
        if on == m
            ret += 1
        end
    end
    ret
end

function main()
    n, m = readline() |> split |> parseintmap
    d = Dict()
    for i in 1:m
        a = readline() |> split |> parseintmap
        d[i] = a[2:a[1]+1]
    end
    eo = readline() |> split |> parseintmap
    println(solve(n, m, d, eo))
end

main()

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end(), less<ll>());
    ll ans;
    ll th = 1e18;
    if (a[0] == 0) {
        ans = 0;
    }
    else {
        ans = 1;
        rep (i, n) {
            if (a[i] > th / ans) {
                ans = -1;
                break;
            }
            else {
                ans *= a[i];
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3916
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

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

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

X = LI()
print(X.index(0) + 1)

Measured memory_bytes: 10844
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int k = scanner.nextInt();

        final long[] verticals = new long[n];
        final long[] horizontals = new long[n];
        final Point[] points = new Point[n];
        for (int i = 0; i < n; i++) {
            final int x = scanner.nextInt();
            verticals[i] = x;
            final int y = scanner.nextInt();
            horizontals[i] = y;
            points[i] = new Point(x, y);
        }

        Arrays.sort(verticals);
        Arrays.sort(horizontals);
        long answer = Long.MAX_VALUE;
        for (int top = n - 1; top > 0; top--) {
            for (int bottom = 0; bottom < top; bottom++) {
                for (int right = n - 1; right > 0; right--) {
                    for (int left = 0; left < right; left++) {
                        int counter = 0;
                        for (final Point point : points) {
                            if (point.x >= verticals[left] && point.x <= verticals[right] && point.y >= horizontals[bottom] && point.y <= horizontals[top]) {
                                counter++;
                            }
                        }
                        if (counter >= k) {
                            answer = Math.min(answer, (verticals[right] - verticals[left]) * (horizontals[top] - horizontals[bottom]));
                        }
                    }
                }
            }
        }
        System.out.println(answer);
    }

    static class Point {
        int x;
        int y;

        Point(final int x, final int y) {
            this.x = x;
            this.y = y;
        }
    }
}


Measured memory_bytes: 23508
import sys
import numpy as np

n, a, b = map(int, sys.stdin.readline().split())
h = np.array(sys.stdin.read().split(), dtype=np.int64)
r = a - b

def can_vanish_all(c):
    res = np.copy(h)
    res = np.maximum(res - b * c, 0)
    res = (res + r - 1) // r
    return np.sum(res) <= c

def main():
    lo = 0 # 不可能最大
    hi = 10**9+1 # 可能最小
    while lo + 1 < hi:
        cnt = (lo + hi) // 2
        if can_vanish_all(cnt):
            hi = cnt
        else:
            lo = cnt
    
    return hi

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 24636
a=input()
num=len(a)
mod_map={0:1}
moji_int=0
Sn=[0]*(num+1)
tens=[1]*(num+1)
for i in range(-1,-num-1,-1):
    tens[-i]=tens[-i-1]*10%2019
    tmp=int(a[i])*(tens[-i-1])
    Sn[-i]=(Sn[-i-1]+tmp%2019)%2019
    mod=Sn[-i]
    if mod not in mod_map:
        mod_map[mod]=1
    else:
        mod_map[mod]+=1

res=0
for i in mod_map.values():
    res+=int(i*(i-1)/2)
print(res)


Measured memory_bytes: 23348
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int n; cin >> n;
	int time=n/100;
	n%=100;
	rep(i,time)
	n-=5;
	if(n<=0)cout<<1<<endl;
	else cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	int n;  cin >> n;
	V a(n);  VECCIN(a);

	sort(ALL(a));
	int ans = 0, keep = 1;
	for(int i = 1 ; i < n; i++){
	  if(a[i - 1] == a[i])  keep += 1;
	  else{
        if(keep > 0 && keep % 2 == 1)  ans += 1;
        keep = 1;
      }
	}
  
  	if(keep > 0 && keep % 2 == 1)  ans += 1;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define iinf 2000000000
#define linf 1000000000000000000LL
#define ulinf 10000000000000000000ull
#define MOD1 1000000007LL
#define mpr make_pair
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned long UL;
typedef unsigned short US;
typedef pair < int , int > pii;
clock_t __stt;
inline void TStart(){__stt=clock();}
inline void TReport(){printf("\nTaken Time : %.3lf sec\n",(double)(clock()-__stt)/CLOCKS_PER_SEC);}
template < typename T > T MIN(T a,T b){return a<b?a:b;}
template < typename T > T MAX(T a,T b){return a>b?a:b;}
template < typename T > T ABS(T a){return a>0?a:(-a);}
template < typename T > void UMIN(T &a,T b){if(b<a) a=b;}
template < typename T > void UMAX(T &a,T b){if(b>a) a=b;}
int n,m,pi[15],hs[15];
char a[15][15],b[15][15];
bool checkcol(int p){
	int i;
	for(i=0;i<n;++i) if(a[pi[i]][p]!=a[pi[n-1-i]][p]) return 0;
	return 1;
}
bool check(int p,int q){
	int i;
	for(i=0;i<n;++i){
		if(a[pi[i]][p]!=a[pi[n-1-i]][q]) return 0;
	}
	return 1;
}
void dfs2(int len,int stt){
	if(len==(m+1)/2){
		printf("YES\n");
		exit(0);
	}
	int i,j,k;
	if((m&1) && len==m/2){
		for(i=0;i<m;++i){
			if(!(stt&(1<<i)) && checkcol(i)){
				dfs2(len+1,stt|(1<<i));
			}
		}
		return;
	}
	for(j=0;(stt&(1<<j));++j);
	stt|=(1<<j);
	for(i=0;i<m;++i){
		if(!(stt&(1<<i)) && check(i,j)){
			dfs2(len+1,stt|(1<<i));
		}
	}
	stt^=(1<<j);
	for(++j;(stt&(1<<j));++j);
	stt|=(1<<j);
	if(j<m){
		for(i=0;i<m;++i){
			if(!(stt&(1<<i)) && check(i,j)){
				dfs2(len+1,stt|(1<<i));
			}
		}
	}
}
void dfs(int len,int stt){
	if(len==(n+1)/2){
		dfs2(0,0);
		return;
	}
	int i,j,k;
	if((n&1) && len==n/2){
		for(i=0;i<n;++i){
			if(!(stt&(1<<i))){
				pi[len]=i;
				dfs(len+1,stt|(1<<i));
			}
		}
		return;
	}
	for(i=0;(stt&(1<<i));++i);
	stt|=(1<<i);
	pi[len]=i;
	for(j=0;j<n;++j){
		if(!(stt&(1<<j)) && hs[i]==hs[j]){
			pi[n-1-len]=j;
			dfs(len+1,stt|(1<<j));
		}
	}
	stt^=(1<<i);
	for(++i;(stt&(1<<i));++i);
	if(i<n){
		stt|=(1<<i);
		pi[len]=i;
		for(j=0;j<n;++j){
			if(!(stt&(1<<j)) && hs[i]==hs[j]){
				pi[n-1-len]=j;
				dfs(len+1,stt|(1<<j));
			}
		}
	}
}
int main(){
    // inputting start
    // 数据结构记得初始化！ n，m别写反！
    scanf("%d%d",&n,&m);
	int i,j,k;
	for(i=0;i<n;++i) {
		scanf("%s",a[i]);
		memcpy(b[i],a[i],sizeof(b[i]));
		sort(b[i],b[i]+m);
	}
    #ifdef LOCAL
        TStart();
    #endif
    // calculation start
    // 数据结构记得初始化！ n，m别写反！
	for(i=0;i<n;++i){
		hs[i]=0;
		for(j=0;j<m;++j) hs[i]=hs[i]*31+b[i][j];
	}
    dfs(0,0);
	printf("NO\n");
    #ifdef LOCAL
        TReport();
    #endif
    return 0;
}

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

const int size_d = 100000;


int main(){
  int n, h, maxa = 0, work, ans=0;
  int b[100000];

  
  cin >> n >> h;

  for(int i=0; i<n; ++i){
    cin >> work >> b[i];
    maxa = max(maxa, work);
  }


  sort(b, b+n);
  //  reverse(b, b+n);

  int cnt=n-1;
  while(h > 0){

    if(cnt>=0 && b[cnt] > maxa){
      h -= b[cnt];
      --cnt;
    }else{
      h-=maxa;
    }
    ++ans;
  }

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<queue>
#include<algorithm>
#include<functional>
#include<vector>
using namespace std;

#define MAX_N 1020
#define INF 123456789

priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>Q;

int L[MAX_N][MAX_N];
int S[MAX_N][MAX_N];
int LD[MAX_N][MAX_N];
int SD[MAX_N][MAX_N];
int DP[MAX_N][MAX_N];
int T[MAX_N], DIST[MAX_N];
int A, B, C, N, M, R, res; char D;

void dijkstra(int v, int st) {
	for (int i = 0; i < MAX_N; i++) {
		DIST[i] = INF;
	}
	DIST[st] = 0;
	Q.push(make_pair(0, st));
	while (!Q.empty()) {
		pair<int, int>p = Q.top(); Q.pop();
		for (int i = 1; i <= N; i++) {
			if (v == 1) {
				if (L[p.second][i] + p.first < DIST[i]) {
					DIST[i] = L[p.second][i] + p.first;
					Q.push(make_pair(DIST[i], i));
				}
			}
			else {
				if (S[p.second][i] + p.first < DIST[i]) {
					DIST[i] = S[p.second][i] + p.first;
					Q.push(make_pair(DIST[i], i));
				}
			}
		}
	}
}

int main() {
	while (true) {
		res = INF;
		for (int i = 0; i < MAX_N; i++) {
			for (int j = 0; j < MAX_N; j++) {
				L[i][j] = INF; S[i][j] = INF;
				LD[i][j] = INF; SD[i][j] = INF;
				DP[i][j] = INF;
			}
		}
		cin >> N >> M;
		if (N == 0 && M == 0) { break; }
		for (int i = 0; i < M; i++) {
			cin >> A >> B >> C >> D;
			if (D == 'L') {
				L[A][B] = C;
				L[B][A] = C;
			}
			if (D == 'S') {
				S[A][B] = C;
				S[B][A] = C;
			}
		}
		cin >> R;
		for (int i = 0; i < R; i++) {
			cin >> T[i];
		}
		for (int i = 1; i <= N; i++) {
			dijkstra(1, i);
			for (int j = 1; j <= N; j++) {
				LD[i][j] = DIST[j];
			}
		}
		for (int i = 1; i <= N; i++) {
			dijkstra(2, i);
			for (int j = 1; j <= N; j++) {
				SD[i][j] = DIST[j];
			}
		}
		DP[0][T[0]] = 0;
		for (int i = 0; i < R - 1; i++) {
			int ST = T[i], GO = T[i + 1];
			for (int j = 1; j <= N; j++) {
				DP[i + 1][j] = min(DP[i + 1][j], DP[i][j] + LD[ST][GO]);
				for (int k = 1; k <= N; k++) {
					DP[i + 1][k] = min(DP[i + 1][k], DP[i][j] + LD[ST][j] + SD[j][k] + LD[k][GO]);
				}
			}
		}
		for (int i = 1; i <= N; i++) {
			res = min(res, DP[R - 1][i]);
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 23424
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int x, l;
unsigned long long k;
char str1[10000], ch;

int main(){

	scanf("%s", str1);
	scanf("%llu", &k);
	x = 0;
	l = strlen(str1);
	ch = '1';
	while (x < l && x < k){
		if (str1[x] != '1'){
			ch = str1[x];
			break;
		}
		x++;
	}
	printf("%c", ch);
	
	return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
  char line[100000];
  int N;
  fgets(line, sizeof(line), stdin);
  sscanf(line, "%d", &N);
  char *str_ptr;
  int i, j;
  int A[100];
  int count=0;
  fgets(line, sizeof(line), stdin);
  str_ptr=strtok(line, " ");
  sscanf(str_ptr, "%d", &A[0]);
  for(i=1; i<N; ++i){
	str_ptr=strtok(NULL, " ");
	sscanf(str_ptr, "%d", &A[i]);
  }
  //ソート
  int tmp;
  for(i=0; i<(N-1); ++i){
	for(j=(N-1); j>=i+1; --j){
	  if(A[j]<A[j-1]){
		tmp=A[j];
		A[j]=A[j-1];
		A[j-1]=tmp;
		++count;
	  }
	}
  }
  //
  for(i=0; i<N; ++i){
	printf("%d", A[i]);
	if(i<(N-1))
	  printf(" ");
  }
  printf("\n");
  printf("%d\n", count);
  return 0;
}



Measured memory_bytes: 2100
A, B, C = map(int, input().split())
cnt = 0
while True:
    if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
        print(cnt)
        break
    elif A == B and A == C:
        print(-1)
        break
    else:
        A, B, C = (B+C)//2, (C+A)//2, (A+B)//2
        cnt += 1

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	long n;
	cin >> n;
	string arr="";
	while(n>0){
		n--;
		arr += (char)(97+n%26);
		n/=26; 
	}
	//cout<<arr;
	reverse(arr.begin(),arr.end());
	cout<<arr;
}

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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

int main()
{
	for(int n;cin>>n && n;){
		vi up;
		rep(i,n){
			char c; cin>>c;
			if(c=='U') up.push_back(1);
			if(c=='D') up.push_back(0);
		}
		n=up.size();
		
		vvl dp(n+1,vl(n+1));
		dp[0][0]=1;
		rep(i,n) rep(j,i+1){
			if(up[i]){
				(dp[i+1][j]+=dp[i][j]*j)%=MOD;
				(dp[i+1][j+1]+=dp[i][j])%=MOD;
			}
			else{
				(dp[i+1][j]+=dp[i][j]*j)%=MOD;
				if(j>0) (dp[i+1][j-1]+=dp[i][j]*j*j)%=MOD;
			}
		}
		cout<<dp[n][0]<<endl;
	}
}

Measured memory_bytes: 1344
#include <bits/stdc++.h>
using namespace std;
# define ll long long int
#define M 1000000007
#define ff first
#define ss second
#define pb push_back  
#define INF 1000000000000
typedef long long C;
typedef complex<C> P; 
#define X real() 
#define Y imag()


									// nestedcode


 int main(){
   ios::sync_with_stdio(0);
   cin.tie(0); cout.tie(0);
   ll h , t = 0,i,ans  = 1;
   cin>>h;
   while(h){
   	t++;
   	h/=2;
   }
   for(i=0;i<t;i++){
   	ans*=2;
   }
   cout<<ans - 1;
   
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int cat = sc.nextInt();
    int mix = sc.nextInt();
    int result = sc.nextInt();
    
    if(cat > result){
      System.out.println("NO");
    
    }else if(cat + mix < result){
      System.out.println("NO");
      
    }else{
      System.out.println("YES");
    }
  }
}


Measured memory_bytes: 19796
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp std::make_pair
#define pb push_back
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::set<int> si;
typedef std::string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
ll N,K;
ll a[100010];
int main(){
  cin>>N>>K;
  rep(i,N) cin>>a[i];
  ll cump[100010];
  cump[0]=0;
  rep1(i,N){
    if(a[i-1]>0) cump[i]=cump[i-1]+a[i-1];
    else cump[i]=cump[i-1];
  }
  ll sum[100010];
  sum[0]=0;
  rep1(i,N){
    sum[i]=sum[i-1]+a[i-1];
  }
  ll res=0;
  rep(i,N-K+1){
    ll s=sum[i+K]-sum[i];
    ll t=cump[i]+cump[N]-cump[i+K];
    if(s<0) res=std::max(res,t);
    else res=std::max(res,s+t);
  }
  prin(res);
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[4] = {-1, 0, 1, 0};
ll dy[4] = {0, 1, 0, -1};

int main(void){
    string s;
    cin >> s;
    bool ok = false;
    for(ll i = 0; i < s.length(); i++){
        if(s[i]=='7') ok = true;
    }
    if(ok==true) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3592
l = input().split()
m = []
for i in range(len(l)):
    if l[i] == "+":
        m[-2] += m[-1]
        m.pop()
    elif l[i] == "-":
        m[-2] -= m[-1]
        m.pop()
    elif l[i] == "*":
        m[-2] *= m[-1]
        m.pop()
    else:
        m.append(int(l[i]))
print(m[0])


Measured memory_bytes: 5604
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  int A, B;
  char op;
  cin >> A >> op >> B;
  if (op == '+') cout << A + B <<endl;
  else if (op == '-') cout << A - B <<endl;
  return 0;
}


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

void solve() {
  int x;
  cin >> x;
  int s = 0, i = 0;
  while (s < x) {
    i++;
    s += i;
  }
  cout << i << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) solve();
}


Measured memory_bytes: 3660
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N; cin >> N;
	VI A(N);
	REP(i, N)cin >> A[i];
	rSORT(A);
	int ans = 0;
	ans += A[0];
	int i = 1;
	N-=2;
	while (N) {
		ans += A[i];
		N--;
		if (N) {
			ans += A[i];
			N--;
		}
		i++;

	}
	cout << ans << endl;



	return 0;
}



Measured memory_bytes: 4740
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#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;

bool check(string S, string T, int num){
  num = 2*S.size() - num;
  bool flag = true;
  range(i, num) if(T[i]!=S[S.size()-num+i]) flag = false;
  return flag;
}
int main(int argc, char const *argv[]) {
  int N, ans=0;
  string s, t;
  std::cin >> N;
  std::cin >> s;
  std::cin >> t;
  ranges(i, N, 2*N+1){
    if(check(s, t, i)) {
      ans = i;
      break;
    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
N,W = map(int,input().split())
vw = [list(map(int,input().split())) for _ in range(N)]
dp = [[0]*(N+1) for i in range(W+1)]

for i in range(1,W+1):
  for j in range(N):
    v = vw[j][0]
    w = vw[j][1]
    if i>=w:
      dp[i][j+1] = max(dp[i-w][j]+v,dp[i][j])
    else:
      dp[i][j+1] = dp[i][j]
      
print(dp[W][N])


Measured memory_bytes: 42832