akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;
const int SIZE =  200001;

int N;
vector<int> to[SIZE];
bool visited[SIZE];
bool even[SIZE];

void dfs(int n, bool wasEven = false) {
    if (!visited[n]) {
        visited[n] = true;
        even[n] = !wasEven;
        for (int next: to[n]) {
            dfs(next, !wasEven);
        }
    }
}

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

    int N;
    cin >> N;
    rep(i, N-1) {
        int a, b;
        cin >> a >> b;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    dfs(1);
    int evenCount = 0;
    for (int i = 1; i <= N; ++i) {
        if (even[i]) ++evenCount;
    }

    int r0 = 3;
    int r1 = 1;
    int r2 = 2;

    if (evenCount <= N/3) {
        //! Put multiples of 3 on even nodes
        for (int i = 1; i <= N; ++i) {
            int x;
            if (even[i]) {
                x = r0;
                r0 += 3;
            } else {
                if (r1 <= N) {
                    x = r1;
                    r1 += 3;
                } else if (r2 <= N) {
                    x = r2;
                    r2 += 3;
                } else {
                    x = r0;
                    r0 += 3;
                }
            }
            cout << x << ' ';
        }
        
    } else if (N-evenCount <= N/3) {
        //! Put multiples of 3 on odd nodes
        for (int i = 1; i <= N; ++i) {
            int x;
            if (!even[i]) {
                x = r0;
                r0 += 3;
            } else {
                if (r1 <= N) {
                    x = r1;
                    r1 += 3;
                } else if (r2 <= N) {
                    x = r2;
                    r2 += 3;
                } else {
                    x = r0;
                    r0 += 3;
                }
            }
            cout << x << ' ';
        }

    } else {
        //! Put 1mod3 on odd nodes, 2mod3 on even nodes. Put multiples of 3 when running out 1mod3 or 2mod3
        for (int i = 1; i <= N; ++i) {
            int x;
            if (even[i]) {
                if (r2 <= N) {
                    x = r2;
                    r2 += 3;
                } else {
                    x = r0;
                    r0 += 3;
                }
            } else {
                if (r1 <= N) {
                    x = r1;
                    r1 += 3;
                } else {
                    x = r0;
                    r0 += 3;
                }
            }
            cout << x << ' ';
        }

    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 15744
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#include<chrono>
#include<random>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=2005;
int n;bitset<MAXN> pre[MAXN],suf[MAXN],flg[MAXN];
bitset<MAXN> now;
char ch[MAXN];
int main()
{
	n=read();
	for(int i=2;i<=n;i++)
	{
		scanf("%s",ch+1);
		for(int j=1;j<i;j++)flg[i][j]=(ch[j]-'0'),flg[j][i]=flg[i][j]^1;
	}
	for(int i=1;i<=n;i++)pre[i][i-1]=suf[i][i+1]=1;
	for(int i=1;i<=n;i++)for(int x=1;x+i-1<=n;x++)
	{
		int y=x+i-1;
		now=flg[x-1]|flg[y+1];
		now=now&((pre[x]<<1)&(suf[y]>>1));
		if(now.any())pre[x][y]=suf[y][x]=1;
	}int ans=0;
	for(int i=1;i<=n;i++)
		if(pre[1][i-1]&&suf[n][i+1])
			++ans;
	pr2(ans);
	return 0;
}



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

#define nax 100009
#define FOR(i,n,m) for(int i =(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define pb push_back

typedef long long ll;

int main(){
	int w,n;
	ll dp[nax],v[nax],we[nax];

	cin>>n>>w;
	REP(i,n){
		cin>>we[i]>>v[i];
	}

	//dp(val): min peso que se puede obtener en este valor
	REP(i,nax) dp[i] = 100000000000000LL;
	dp[0] = 0;

	int ans =0;
	REP(i,n){
		for(int j = nax-1;j>=0;j--){
			if(j-v[i]<0) continue;
			if(dp[j-v[i]]+we[i]<dp[j] && dp[j-v[i]]+we[i]<=w)
				ans = max(ans,j);
			dp[j] = min(dp[j],dp[j-v[i]]+we[i]);
		}
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 2560
Module Module1

    Sub main()

        Dim user1 = Console.ReadLine()
        Dim dogNum As Double = CDbl(user1)
        Dim result As String = ""
        Dim names As New List(Of Char)


        ' 26進数除算
        Do
            Dim nowTag = ((dogNum - 1) Mod 26)
            Dim chrTag = Chr(Asc("a") + nowTag)
            names.Add(chrTag)
            dogNum = Math.Floor((dogNum - 1) / 26)
        Loop While dogNum > 0
        names.Reverse()

        Console.WriteLine(String.Join("", names.ToArray))
    End Sub
  end module

Measured memory_bytes: 28680
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <list>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <ctime>
#include <cmath>

using namespace std;

int main() {

    vector<int> msk(27,0);
    string s;
    cin>>s;

    for(auto& c: s){
        if(msk[c-'a'] == 1){
            cout<<"no"<<endl;
            return 0;
        }
        else{
            msk[c-'a'] = 1;
        }

    }

    cout<<"yes"<<endl;

    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    var a : MutableList<Int> = readLine()!!.split(" ").map{i -> i.toInt()}.toMutableList()
    var count = 0;

    loop@ while(true) {
        for (i in 0..n - 1) {
            if (a[i] % 2 == 0) {
                a[i] /= 2
            } else {
                break@loop
            }
        }
        count++
    }
    println(count)
}

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

#define NIL -1

typedef struct Node {
    int key, parent, left, right;
} Node;

int n;
Node *tree;

Node* initNodeWith(int key) {
    Node *node = (Node *)malloc(sizeof(Node));
    node->key = key;
    node->parent = NIL;
    node->left = NIL;
    node->right = NIL;

    return node;
}

void printTree(int ns) {
    for (int i = 0; i < ns; i++) {
        printf("node %d: key = %d, ", i + 1, tree[i].key);

        /// Print Keys
        if (tree[i].parent != NIL)  printf("parent key = %d, ", tree[tree[i].parent].key);
        if (tree[i].left != NIL)    printf("left key = %d, ", tree[tree[i].left].key);
        if (tree[i].right != NIL)   printf("right key = %d, ", tree[tree[i].right].key);

        printf("\n");
    }
}

int main() {
    n = 0;
    scanf("%d", &n);

    int key;
    tree = (Node *)malloc(sizeof(Node) * n);

    /// Append Nodes
    for (int i = 0; i < n; i++) {
        scanf("%d", &key);
        Node *node = initNodeWith(key);
        tree[i] = *node;
    }

    /// Refer
    for (int i = 0; i < n; i++) {
        int index = i + 1;
        if (i) tree[i].parent = index / 2 - 1;
        if (index * 2 <= n) tree[i].left = index * 2 - 1;
        if (index * 2 + 1 <= n) tree[i].right = index * 2;
    }

    printTree(n);

    free(tree);

    return 0;
}



Measured memory_bytes: 2100
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#define FINAL_OUT(x) {cout << (x) << '\n'; exit(0); }

int main()
{
//    freopen("in.txt","r", stdin);
//    freopen("output.txt", "w", stdout);
//    cout << fixed << setprecision(10);
    ios_base::sync_with_stdio(false);

    int n,m;
    cin >> n >> m;

    long long res = 0;

    vector<vector<long long> > arr;
    for(int i = 0; i < n; ++i)
    {
        long long x,y,z;
        cin >> x >> y >> z;
        arr.push_back({x,y,z});
    }

    for(int mask = 0; mask < 8; ++mask)
    {
        vector<int> coef{1,1,1};
        for(int j = 0; j < 3; ++j)
            if (mask & (1 << j))
                coef[j] *= -1;

        sort(begin(arr), end(arr), [&](const vector<long long>& a, const vector<long long>& b){
            long long va = a[0] * coef[0] + a[1] * coef[1] + a[2] * coef[2];
            long long vb = b[0] * coef[0] + b[1] * coef[1] + b[2] * coef[2];
            return va > vb;
        }
        );

        long long cur = 0;
        for(int i = 0; i < m; ++i)
        {
            cur += arr[i][0] * coef[0] + arr[i][1] * coef[1] + arr[i][2] * coef[2];
        }
        res = max(res, cur);
    }
    cout << res << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
using namespace std;
int flag=1,sa,s[10000],i,n,no[10],minn1,minn2;
void run(void)
{
	flag=1;
	for(i=s[0];i&&flag;i--)
		if(no[s[i]])
		{
			while(no[s[i]]&&s[i]<=9)s[i]++;
			flag=0;
		}
	if(s[i+1]<=9)
	{
		for(int j=i;j;j--)s[j]=minn1;
	}
	else
	{
		if((s[0]-i)==1)
			s[0]++;
		s[i+2]++;for(i++;i;i--)s[i]=0;
		run();
	}
}
int main()
{
	cin>>sa>>n;
	for(int u=1;u<=n;u++)
	{
		cin>>i;
		no[i]=1;
	}
	for(int u=0;u<=9;u++)if(!no[u]){minn1=u;break;}
	for(int u=1;u<=9;u++)if(!no[u]){minn2=u;break;}
	while(sa)s[++s[0]]=sa%10,sa/=10;
	run();
	for(i=s[0];i;i--)cout<<s[i];
} 

Measured memory_bytes: 256
if __name__ == '__main__':                                                                                                                                   
    A,B = list(map(int,input().split()))                                                                                                                     
    N = 2                                                                                                                                                    
                                                                                                                                                             
    a,b = A,B                                                                                                                                                
                                                                                                                                                             
    res = 0                                                                                                                                                  
    for x in range(N):                                                                                                                                       
        if a>b:                                                                                                                                              
            res = a+res                                                                                                                                      
            a = a-1                                                                                                                                          
        else:                                                                                                                                                
            res = b+res                                                                                                                                      
            b = b-1                                                                                                                                          
                                                                                                                                                             
    print(res)   

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, m, n) for(ll i = m; i <= n; i++)
#define per(i, m, n) for(ll i = m; i >= n; i--)
#define pb push_back
#define mp make_pair
#define pii pair<ll, ll> 
#define vi vector<ll> 
#define vll vector<ll> 
#define sz(v) (ll) v.size()
const ll INF = 0x3f3f3f3f;

const ll maxn = 2e5 + 5;

ll a[maxn], sum[maxn], N; 

int main() {
    ios::sync_with_stdio(false); 
    cin.tie(0); cout.tie(0); 
    cin >> N;
    rep(i, 1, N) cin >> a[i], sum[i] = sum[i - 1] + a[i];
    ll ans = 1e18; 
    // ll mid1 = 1, first_sum = a[1], second_sum = 0, third_sum = 0, fourth_sum = sum[N] - sum[2], mid2 = 2;
    ll mid1 = 1, mid2 = 2, first_sum, second_sum, third_sum, fourth_sum; 
    for (ll i = 2; i <= N - 2; i++) {
    	// 1 - i is the first half, while i + 1 - N is the second half;
    	first_sum = sum[mid1], second_sum = sum[i] - sum[mid1]; 
    	ll temp = abs(first_sum - second_sum), temp_mid = mid1; 
    	// 1 ~ mid is first_sum, mid + 1 ~ i is second_sum; want to evenly distribute sum1 and sum2; 
    	for (ll l = temp_mid + 1; l <= i - 1; l++) {
    		first_sum += a[l];
    		second_sum -= a[l]; 
    		if (abs(first_sum - second_sum) <= temp) temp = abs(first_sum - second_sum), mid1 = l; 
    		else break; 
    	} 
    	// cout << sum[mid1] << " " << sum[i] - sum[mid1] << endl;  
    	// third_sum -= a[i]; 
    	third_sum = sum[mid2] - sum[i], fourth_sum = sum[N] - sum[mid2]; 
    	temp = abs(third_sum - fourth_sum), temp_mid = mid2;
    	// i + 1 ~ mid2 is third_sum, mid2 + 1 ~ N is the fourth_sum; 
    	for (ll r = temp_mid + 1; r <= N - 1; r++) {
    		third_sum += a[r], fourth_sum -= a[r]; 
    		if (abs(third_sum - fourth_sum) <= temp) temp = abs(third_sum - fourth_sum), mid2 = r;
    		else break;
    	}  
    	// cout << sum[mid2] - sum[i] << " " << sum[N] - sum[mid2] << endl; 
    	ll minn = min(min(sum[mid1], sum[i] - sum[mid1]), min(sum[mid2] - sum[i], sum[N] - sum[mid2])); 
    	ll maxx = max(max(sum[mid1], sum[i] - sum[mid1]), max(sum[mid2] - sum[i], sum[N] - sum[mid2])); 
    	ans = min(ans, maxx - minn); 
    }
    cout << ans << endl; 
    return 0; 
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;


using namespace std;

#define int         long long
#define ld          double
#define vi          vector <int>
#define vp          vector <pair<int,int>>
#define vvi         vector <vector <int>>
#define pb          push_back
#define mp          make_pair
#define pi          pair<int,int>
#define all(a)      a.begin(),a.end()
#define sz(a)       a.size()
#define sl(a)       a.length()
#define rev(a)      sort(all(a),greater<int>())
#define ff          first
#define ss          second
#define minel(a)	*min_element(all(a))
#define maxel(a)	*max_element(all(a))
#define Mod         1000000007
#define deb(x)      cout << x << endl;
#define o(x)        for(auto a:x)cout << a <<" ";cout << endl;
#define o2(x,n,m)   for(int i =0;i<n;i++){for(int j=0;j<m;j++)cout << x[i][j] << " ";cout << endl; } 
#define i(x,n)      for(int i=0;i<n;i++)cin >> x[i];
#define i2(x,n,m)   for(int i =0;i<n;i++){for(int j=0;j<m;j++)cin >> x[i][j]; }
int inf = 1e18;




signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,k;
    cin >> n >> k;

    
    vi a(n+1);
    for(int i=1;i<n+1;i++)cin >> a[i];

    int dp[n+1][k+1];


    for(int j=0;j<k+1;j++)dp[0][j]= 0;
    for(int i=0;i<n+1;i++)dp[i][0] = 1;

    vi pref(k+1,1);


    for(int i=1;i<n+1;i++)
    {
        for(int j =1;j<k+1;j++)
        {
            int x = max(j-a[i],(long long)0);
            if(x == 0)
            {
                dp[i][j] = pref[j];
            }
            else
            {
                dp[i][j] = (pref[j] - pref[x-1] + Mod)%Mod;
            }
        }
        pref.clear();
        pref.resize(k+1,0);
        pref[0] = dp[i][0];
        for(int j=1;j<k+1;j++)
        {
            pref[j] = (pref[j-1] + dp[i][j])%Mod;
        }
    }

    //o2(dp,n+1,k+1);

    deb(dp[n][k]);




    
}



Measured memory_bytes: 82908
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int inputInt = scanner.nextInt();
        double oneSide = inputInt / 3.0;
        double answer = oneSide * oneSide * oneSide;
        System.out.println(answer);
    }
}

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

using namespace std;

#define all(v)   v.begin(), v.end()
#define pb       push_back
#define sz(x)    (int) (x.size())
#define endl "\n"
#define isOdd(n)    (n&1)
#define pow(n, m) (ll)powl(n, m)
#define clr(x, val)    memset(x, val, sizeof(x)) //be careful of value and TLE

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;


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

    int n; cin >> n;
    unordered_map<string, int> mp;
    for(int i = 0; i < n; i++){
        string s; cin >> s;
        mp[s]++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
    return 0;
}


Measured memory_bytes: 3668
#include<iostream>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b+c||b==a+c)
    cout<<"Yes"<<endl;
  else if(c==a+b)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
using ll = long long;

using namespace std;



int main() {
    int a,b;
    cin >> a >> b;
    int ans = 6 - a - b;
    cout << ans << endl;

    return 0;
}


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

vector<int> graph[100010];
vector<int> tree[100010];

int mas[100010];
int n;

bool used[100010] = {};
void makeTree(int m){
  used[m] = true;
  for(int i = 0;i < graph[m].size();i++){
    if(!used[graph[m][i]]){
      tree[m].push_back(graph[m][i]);
      makeTree(graph[m][i]);
    }
  }
  return;
}

int dp[100010] = {};
int ep[100010] = {};
int fp[100010] = {};

void dfs(int x){
  dp[x] = mas[x];
  ep[x] = 0;
  fp[x] = 0;

  if(tree[x].size() == 0) return;

  for(int i = 0;i < tree[x].size();i++){
    dfs(tree[x][i]);
  }

  //bool used[100010] = {};
  memset(used,false,sizeof(used));
  for(int i = 0;i < tree[x].size();i++){
    if(dp[tree[x][i]] - 2 >= 0){
      used[tree[x][i]] = true;
      dp[x] += dp[tree[x][i]] - 2;
    }
  }

  int kari = 0;
  int kari2 = 0;
  for(int i = 0;i < tree[x].size();i++){
    if(used[tree[x][i]]){
      if(ep[tree[x][i]]+1 > kari){
        kari2 = kari;
        kari = ep[tree[x][i]]+1;
      }else if(ep[tree[x][i]]+1 > kari2){
        kari2 = ep[tree[x][i]]+1;
      }
    }else{
      if(ep[tree[x][i]]+1+dp[tree[x][i]]-2 > kari){
        kari2 = kari;
        kari = ep[tree[x][i]]+1+dp[tree[x][i]]-2;
      }else if(ep[tree[x][i]]+1+dp[tree[x][i]]-2 > kari2){
        kari2 = ep[tree[x][i]]+1+dp[tree[x][i]]-2;
      }
    }
  }

  if(kari >= 0){
    ep[x] = kari;
  }

  int kari3 = 0;
  for(int i = 0;i < tree[x].size();i++){
    if(used[tree[x][i]]){
      kari3 = max(kari3,fp[tree[x][i]]);
    }else{
      kari3 = max(kari3,fp[tree[x][i]]+dp[tree[x][i]]-2);
    }
  }

  fp[x] = max(kari3,max(kari+kari2,max(kari,kari2)));
  return;
}


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

  int a, b;
  for(int i = 0;i < n-1;i++){
    cin >> a >> b;
    a--; b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  makeTree(0);
  dfs(0);

  int ans = INT_MIN;
  for(int i = 0;i < n;i++){
    ans = max(ans,dp[i]+fp[i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 23472
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int a,L;


int result(int a){
	vector<int> S;
	for(int i=0;i<L;i++){
		S.push_back(a%10);
		a/=10;
	}
	sort(S.begin(),S.end());
	int min=S[0];
	for(int i=1;i<L;i++)
		min*=10,min+=S[i];
	int max=S[L-1];
	for(int i=L-2;i>=0;i--)
		max*=10,max+=S[i];
	return max-min;
}

int main(void){
	while(cin >> a >> L,a|L){
		map<int ,int> list;
		int j;
		list[a]=0;
		for(j=1;j<21;j++){
			a=result(a);
			if(list.find(a)!=list.end())
				break;
			else
				list[a]=j;
		}
	cout << list[a] <<" " << a <<" " << j-list[a] << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
using namespace std;
int main(){
  int n, time, i, ans, tt, m=10000;
  cin >> n >> tt;
  int c[n], t[n];
  for(i=0; i<n; i++){
    cin >> c[i] >> t[i];
    if(t[i]<=tt&&c[i]<m){
      m=c[i];
    }
  }
  if(m==10000) cout <<"TLE";
    else
  cout << m;
  return 0;
}

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


int main(){
    int x,y;cin>>x>>y;
    int min = 2*x;
    int max = 4*x;
    bool flag = false;
    for(int i=min;i<=max;i+=2 ){
        if(i==y){
            flag =true;
            break;
        }
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}


Measured memory_bytes: 3636
function main()
	N,M=map(x->parse(Int,x),split(readline()))
	g=1
	c=-1
	for a=map(x->parse(Int,x),split(readline()))
		a>>=1
		g=lcm(g,a)
		t=0
		while a%2==0
			a>>=1
			t+=1
		end
		if c<0
			c=t
		elseif c!=t
			println(0)
			exit()
		end
	end
	if g>M
		println(0)
	else
		t=div(M,g)
		println(div(t+1,2))
	end
end
main()


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

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int x[n];
    int tot = 0;
    for (int i = 0; i < n; i++) {
        cin >> x[i];
        tot += x[i];
    }
    int f_avg = floor(tot * 1.0 / n);
    int c_avg = ceil(tot * 1.0 / n);
    int f_cost = 0, c_cost = 0;
    for (auto &i : x) {
        f_cost += pow((i - f_avg), 2);
        c_cost += pow((i - c_avg), 2);
    }
    cout << min(f_cost, c_cost) << endl;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Pavel Mavrin
 */
public class Main {

    private void solve() throws IOException {
        int n = nextInt();
        int[]a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        int res = 0;
        boolean up = false;
        boolean down = false;
        for (int i = 0; i < n; i++) {
            if (i == 0 || (a[i] > a[i - 1] && down) || (a[i] < a[i - 1] && up)) {
                up = false;
                down = false;
                res++;
            } else {
                if (a[i] > a[i - 1]) up = true;
                if (a[i] < a[i - 1]) down = true;
            }
        }
        out.println(res);
    }

    // ------------------

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st;
    PrintWriter out = new PrintWriter(System.out);

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

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

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    private void run() throws IOException {
        solve();
        out.close();
    }

}


Measured memory_bytes: 36876
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double x = nextDouble(scanner);
        double y = nextDouble(scanner);
        double a = ((4 * x) - y) / 2;
        double b = ((y - (2 * x)) / 2);
        if (b == Math.floor(b)  && b >= 0 && a >= 0) {
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }

    private static int nextInt(Scanner scanner) {
        return Integer.parseInt(scanner.next());
    }

    private static long nextLong(Scanner scanner) {
        return Long.parseLong(scanner.next());
    }

    private static float nextFloat(Scanner scanner) {
        return Float.parseFloat(scanner.next());
    }

    private static double nextDouble(Scanner scanner) {
        return Double.parseDouble(scanner.next());
    }


}





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

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

  for (int i = 0; i <= n; i++) {
    for (int j = 0; j<= n-i; j++) {
      int k = n - i - j;
      int sum = 10000*i + 5000*j + 1000*k;

      if (sum == y) {
        cout << i << ' ' << j << ' ' << k << endl;
        return 0;
      }
    }
  }
  cout << -1 << ' ' << -1 << ' ' << -1 << endl;
}

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

int main(){
    int n;
    cin>>n;
    int a[n];
    map<int,int> mp;
    for(int i=0;i<n;i++){
        cin>>a[i];
        mp[a[i]]=i;
    }
    int ans=1,ret=1;
    for(int i=2;i<=n;i++){
        if(mp[i]>mp[i-1]) ret++;
        else ans=max(ret,ans),ret=1;
    }
    ans=max(ret,ans);
    cout<<n-ans;

}

Measured memory_bytes: 10368
#include <iostream>
#include <algorithm>
#include <set>
#include <functional>
#include <list>
#include <bitset>
#include <numeric>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <deque>

#define INF 1e9
#define MOD 1000000007
#define ll long long
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
typedef unsigned long long ull;
typedef pair<ll, ll> pr;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll k,a,b;
    cin>>k>>a>>b;
    if(k<a||b<=a+2ll){
        cout<<1+k;
        return 0;
    }
    long ans=a;
    k-=(a-1ll);
//    cout<<ans<<endl;
    ans+=(k/2ll)*(b-a);
//    cout<<ans<<endl;

    ans+=k%2ll;
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
x = int(input())


if x >= 64:
    print(64)
elif x >= 32:
    print(32)
elif x >= 16:
    print(16)
elif x >= 8:
    print(8)
elif x >= 4:
    print(4)
elif x >= 2:
    print(2)
else:
    print(1)

Measured memory_bytes: 3060
//BISMILLAH
#include <bits/stdc++.h>
using namespace std;
int main(){
    
    string s;
    
    cin >> s;
    if(s[s.size() - 1] == 's') {
        cout << s << "es" << endl;
    }else cout << s << 's' << endl;
    
    
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    int N, M;
    cin >> N >> M;
    cout << (1900*M + 100*(N - M))*pow(2, M) << endl;
    return 0;
}

Measured memory_bytes: 4272
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  
  int a,b;
  cin>>a>>b;
  int ans;
  ans = max(a*b,max(a+b,a-b));
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <math.h>
#include <algorithm>
#include <utility>
#include <numeric>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define print(x) cout << #x << " = " << x << endl;

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const long double pi = acos(-1);
const long double eps = 1e-7;

inline ll gcd(int a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	string S, T;
	cin >> S;
	cin >> T;

	ll L = lcm(N, M);

	ll bet = lcm(L / N, L / M);
	bool b = false;
	for (ll ix = 0; ix < L; ix += bet) {
		if (S[ix / (L / N)] != T[ix / (L / M)]) {
			cout << "-1";
			b = true;
			break;
		}
	}
	if (!b) {
		cout << L;
	}
	system("pause");
	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

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

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main()
{
	int n,m;
	cin>>n>>m;
	vector<int> sum(n+1,0);
	for (int i = 0; i < m; i++){
		int l,r;
		cin>>l>>r;
		l--;
		r--;
		sum[l]++;
		sum[r+1]--;
	}
	int ans = 0;
	for (int i = 1; i <= n; i++){
		sum[i] += sum[i-1];
		
	}
	for (int i = 0; i < n; i++){
		if(sum[i] == m) ans++;
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>

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

using namespace std;
int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<int> e(n, 0), w(n, 0), total(n, 0);
    for(int i = 0; i < n - 1; i++) {
        if (s[i] == 'W') w[i] += 1;
        w[i+1] += w[i];
    }

    for(int i = n - 1; i > 0; i--) {
        if(s[i] == 'E') e[i] += 1;
        e[i-1] += e[i];
    }

    rep(i, n) total[i] = w[i] + e[i];

    sort(all(total));
    cout << total[0] - 1 << endl;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    int mn = 1001001001;
    REP(i, n) {
        multiset<int> b;
        vector<int> c;
        REP(j, n) {
            if (a[j] < a[i]) {
                sort(ALL(c));
                REP(l, (int)c.size() - k + 1) b.insert(c[l]);
                c.clear();
            } else {
                c.push_back(a[j]);
            }
        }
        sort(ALL(c));
        REP(l, (int)c.size() - k + 1) b.insert(c[l]);
        if (b.size() >= q) {
            auto it = b.begin();
            REP(i, q - 1) it++;
            chmin(mn, *it - a[i]);
        }
    }

    cout << mn << endl;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    priority_queue<ll> pq;
    for (int i = 0; i < n; i++) {
        ll a;
        cin >> a;
        pq.push(a);
    }
    while (m--) {
        int x = pq.top();
        if (x == 0) break;
        pq.pop();
        pq.push(x / 2);
    }
    ll ans = 0;
    while (!pq.empty()) {
        ans += pq.top();
        pq.pop();
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n, alice = 0, bob = 0;
    cin >> n;
        vector<int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a.at(i);
    }
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());

    for(int i = 0;i < n; ++i){
        if(i%2 == 0)
            alice += a.at(i);
        else
        {
            bob += a.at(i);
        }
        
    }
    cout << alice-bob <<endl;
}


Measured memory_bytes: 3108
class Segment:
    def __init__(self, N, init_val):
        self.N0 = 2**(N-1).bit_length()
        # 0-indexedで管理
        self.dat = [identity_element]*(2*self.N0)
        # 値を代入
        for i in range(N):
            self.dat[i+self.N0-1]=init_val[i]    
        # 構築
        for i in range(self.N0-2,-1,-1) :
            self.dat[i]=segfunc(self.dat[2*i+1],self.dat[2*i+2]) 

    # k番目の要素の値をxに変更
    def update(self, k, x):
        k += self.N0-1
        self.dat[k] = x
        while k >= 0:
            k = (k-1)//2
            self.dat[k] = segfunc(self.dat[2*k+1], self.dat[2*k+2])

    # 区間[l, r)の最小値を求める
    def query(self, l, r):
        L = l + self.N0
        R = r + self.N0
        s = identity_element
        # 区間を列挙しながら最小値を求める
        while L < R:
            if R & 1:
                R -= 1
                s = segfunc(s, self.dat[R-1])
            if L & 1:
                s = segfunc(s, self.dat[L-1])
                L += 1
            L >>= 1; R >>= 1
        return s
def segfunc(x,y):
    return min(x,y)
identity_element = 2**31-1

n,q = map(int,input().split())
seg = Segment(n,[identity_element]*n)

for i in range(q):
    c,x,y=map(int,input().split())
    if c:
        print(seg.query(x,y+1))
    else:
        seg.update(x,y)


Measured memory_bytes: 8696
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int a;
	while (cin >> a, a) {
		int b[1000];
		for (int c = 0; c < a; c++)scanf("%d", &b[c]);
		sort(b, b + a);
		int MAX = 1 << 29;
		for (int i = 1; i < a; i++) {
			MAX = min(MAX, abs(b[i] - b[i - 1]));
		}
		cout << MAX << endl;
	}
}

Measured memory_bytes: 3156
#include <iostream>
#include <string>
#include <vector>


int main()
{
	std::string mojiretu;
	std::cin >> mojiretu;
	for (int i = 0; i < 3; i++) {
		switch (mojiretu[i])
		{
		case '1':
			mojiretu[i] = '9';
			break;
		case '9':
			mojiretu[i] = '1';
			break;
		default:
			break;
		}
	}
	std::cout << mojiretu << std::endl;
	
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		long[][] in = new long[n][3];
		for (int i = 0; i < n; i++) {
			in[i][0] = sc.nextLong();
			in[i][1] = sc.nextLong();
			in[i][2] = sc.nextLong();
		}
		long[] a = new long[n];
		long max = 0, sum = 0;
		for(int e: new int[] {-1,1}) {
			for(int f: new int[] {-1,1}) {
				for(int g: new int[] {-1,1}) {
					for (int j = 0; j < n; j++) a[j] = e*in[j][0]+f*in[j][1]+g*in[j][2];
					Arrays.parallelSort(a);
					for (int j = 0; j < m; j++) sum += a[n-j-1];
					max = Math.max(max,sum);
					sum = 0;
				}
			}
		}
		System.out.println(max);
		sc.close();
	}
}


Measured memory_bytes: 26284
n = int(input())
red = [list(map(int, input().split())) for _ in range(n)]
blue = [list(map(int, input().split())) for _ in range(n)]
red.sort(key=lambda x:x[0])
blue.sort(key=lambda x:x[0])
res = 0
for i in range(len(blue)):
    index = -1
    maxy = -1
    for j in range(len(red)):
        if red[j][0] < blue[i][0] and red[j][1] < blue[i][1]:
            if red[j][1] > maxy:
                maxy = red[j][1]
                index = j
    if index != -1:
        red.pop(index)
        res += 1
print(res)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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; }

int main() {
	string S;
	cin >> S;
	rep(i,3) if(S[i] == '7') {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    int x = 0;
    int y = 0;
    int a[n + 1];
    int b[n + 1];
    a[0] = 0;
    b[0] = 0;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++) {
        x += a[i];
    }
    for (int i = 2; i <= (n - 1); i += 2) {
        y = y + a[i];
    }
    y *= 2;
    x = x - y;
    b[1] = x;
    for (int i = 2; i <= n; i++) {
        b[i] = (2 * a[i - 1] - b[i - 1]);

    }
    for (int i = 1; i <= n; i++)
        cout << b[i] << " ";


    return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int a[10];
	for ( int i=0; i<10; i++ )
		cin>>a[i];
	sort(a,a+10);
	cout << a[9]<<endl;
	cout << a[8]<<endl;
	cout << a[7]<<endl;
	return 0;
}

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

Measured memory_bytes: 604
#include <iostream>

using namespace std;

int main()
{
   long long x,k,d;
   cin>>x>>k>>d;
   long long i,j,s;
   if(x<0)
    x=-x;
   i=x%d;
   j=x/d;
   if(k<j)
   {
     s=x-k*d;
   }
   else if(k==j)
   {
       s=i;
   }
   else if(k>j)
   {
       long long m;
      m=k-j;
      if(m%2!=0)
      {
            s=d-i;
      }
      else
      {
          s=i;
      }
   }
   cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3672
// WIP

#include <bits/stdc++.h>
using namespace std;

// Utility
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, X, Y) for (int I = (X); I < (Y); I++)
using ll = int64_t;
using ull = uint64_t;
template<typename T> struct is_container {
template<typename C> static char test(typename C::const_iterator*); template<typename> static int test(...);
static bool const value = sizeof(test<T>(nullptr)) == sizeof(char) && !std::is_same<std::string, T>::value;
};
namespace std {
template<class ...Ts>        istream& operator>>(istream& i, tuple<Ts...>& x) { apply([&](auto&&... ys){ ((i >> ys), ...); }, x); return i; }
template<class T1, class T2> istream& operator>>(istream& i, pair<T1, T2>& x) { i >> x.first >> x.second; return i; }
template<class T, enable_if_t<is_container<T>::value, int> = 0>
istream& operator>>(istream& i, T& x) { for (auto& y : x) { i >> y; } return i; }
}

// Debugging
#ifndef DEBUG
#define DEBUG 0
#endif
#define dbg(X) do { if (DEBUG) { cout << #X ": " << (X) << endl << flush; } } while (0)
#define dbg2(X) do { if (DEBUG) { cout << #X ":" << endl; for (auto& __x : (X)) { cout << __x << endl << flush; } } } while (0)
#define dbgv(...) do { if (DEBUG) { cout << "(" #__VA_ARGS__ "): " << make_tuple(__VA_ARGS__) << endl << flush; } } while (0)
namespace std {
template<class ...Ts>        ostream& operator<<(ostream& o, const tuple<Ts...>& x) { o << "("; apply([&](auto&& y, auto&&... ys){ o << y; ((o << ", " << ys), ...); }, x); o << ")"; return o; }
template<class T1, class T2> ostream& operator<<(ostream& o, const pair<T1, T2>& x) { o << tie(x.first, x.second); return o; }
template<class T, enable_if_t<is_container<T>::value, int> = 0>
ostream& operator<<(ostream& o, const T& x) { o << "{"; for (auto it = x.begin(); it != x.end(); it++) { if (it != x.begin()) { o << ", "; } o << *it; } o << "}"; return o; }
}

// Main
void mainCase() {
  ll a, b, n;
  cin >> a >> b >> n;
  ll x = min(n, b - 1);
  ll res = (a * x) / b - a * (x / b);
  cout << res << endl;
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  mainCase();
  return 0;
}

/*
python misc/run.py atcoder/abc165/d/main.cpp --check

%%%% begin
5 7 4
%%%%
2
%%%% end
*/


Measured memory_bytes: 3656
#include <stdio.h>

int main(int argc, char const *argv[])
{
	int n;
	int id;

	// キャンディーの個数を入力
	// 入力はEOFで終了
	while(scanf("%d", &n) != EOF) {
		// キャンディの個数は1以上10,000以下
		if (n >= 1 && n <= 10000) {
			id = n % 39;
			if (id == 0)
				id = 39;
			printf("3C%02d\n",id);
		}
	}
	return 0;
}

Measured memory_bytes: 608
#include<stdio.h>
int main(){
  int a,b,c,d,e,f,g,h;
  double m,n;
  a=b=c=d=e=f=g=h=0;
  while(scanf("%lf%lf",&m,&n)!=-1){
    if(0.2>m)
      d++;
    else if(0.6>m)
      c++;
    else if(1.1>m)
      b++;
    else
      a++;
    if(0.2>n)
      h++;
    else if(0.6>n)
      g++;
    else if(1.1>n)
      f++;
    else
      e++;
  }
  printf("%d %d\n",a,e);
  printf("%d %d\n",b,f);
  printf("%d %d\n",c,g);
  printf("%d %d\n",d,h);
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>
#include <set>

int max_bit(int value) {
	int res = 0;
	while (value != 1) { 
		++res;
		value >>= 1;
	}
	return res;
}
struct Edge {
	int from, to, distance;
};
std::ostream& operator<<(std::ostream& os, const Edge& e) {
	return os << e.from << ' ' << e.to << ' ' << e.distance;
}
int main() {
	int l; std::cin >> l;
	const auto n = max_bit(l) + 1;
	std::vector<Edge> edges;
	for (auto i = 1; i < n; ++i) {
		edges.push_back(Edge{ i, i + 1, 1 << (n - i - 1) });
		edges.push_back(Edge{ i, i + 1, 0 });
	}
	auto rest = l - (1 << (n - 1));
	auto current = 1 << (n - 1);
	for (auto s = 0; rest != 0; ++s) if ((rest & 1 << s) != 0) {
		edges.push_back(Edge{ 1, n - s, current });
		current += 1 << s;
		rest -= 1 << s;
	}
	std::cout << n << ' ' << edges.size() << '\n';
	for (const auto e : edges) {
		std::cout << e << std::endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>
#include <cmath>

#define MOD 1000000007

using namespace std;

typedef long long ll;

typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<vl> vvl;
typedef vector<vi> vvi;

typedef pair<ll, ll> pll;
typedef pair<int, int> pi;

typedef vector<pll> vpl;
typedef vector<pi> vpi;

typedef queue<ll> ql;
typedef queue<int> qi;

template <class T>
void printv(vector<T> vc)
{
    for (auto e : vc)
        cout << e << " ";
    cout << endl;
}

template <class T>
void printvv(vector<T> vvc)
{
    for (auto vc : vvc)
    {
        for (auto e : vc)
            cout << e << " ";
        cout << endl;
    }
}

template <class T>
void printvp(vector<pair<T, T> > vp)
{
    for (auto pT : vp)
        cout << pT.first << " " << pT.second << endl;
}

int main() {
    int n;
    cin >> n;
    vi v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    sort(v.begin(), v.end(), greater<int>());
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (i % 2 == 0) {
            ans += v[i];
        } else {
            ans -= v[i];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
const int N=55;
struct loc{
    int x,y;
    loc(){};
    loc(int x,int y):x(x),y(y){}
};
int main(){
    int h,w,p,ans[N][N];
    int dx[4]={0,0,1,-1},dy[4]={1,-1,0,0},xx,yy;
    string s[N];
    cin>>h>>w;
    p=h*w;
    for(int i=0;i<h;i++){
        cin>>s[i];
        for(int j=0;j<w;j++){
            if(s[i][j]=='#')p--;
        }
    }
    memset(ans,-1,sizeof(ans));
    queue<loc>q;
    loc k;
    ans[0][0]=0;
    q.push(loc(0,0));
    while(!q.empty()){
        k=q.front(); q.pop();
        for(int i=0;i<4;i++){
            xx=dx[i]+k.x; yy=dy[i]+k.y;
            if(xx<0||xx>=h||yy<0||yy>=w||ans[xx][yy]!=-1||s[xx][yy]=='#')continue;
            ans[xx][yy]=ans[k.x][k.y]+1;
//            cout<<xx<<yy<<' '<<ans[xx][yy]<<'\n';
            q.push(loc(xx,yy));
        }
    }
    if(ans[h-1][w-1]==-1){
        cout<<-1<<'\n';
    }else{
        cout<<p-ans[h-1][w-1]-1<<'\n';
    }
}


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

using namespace std;


typedef long long ll;
ll mod=1e9+0LL;
ll MOD=1e18+0LL;
double pi=acos(-1);
ll md=1000000007;
ll gcd(ll a,ll b){
    //if(b>a) swap(a,b);
    return b==0?abs(a):gcd(b,a%b);
}
ll pow(ll a ,ll n)
{
    if(n==0) return 1;
    if(n%2==0)
    {
        ll b=pow(a,n/2);
        return (b*b)%md;
    }
    return (pow(a,n-1)*a)%md;
}
int main()
{
    int cs=1;
    //scanf("%d",&cs);
    while(cs--)
    {
        string s,t;
        cin>>s>>t;
        t.erase(t.begin()+s.size());
        if(s==t)
        {
            printf("Yes\n");
        }else
        {
            printf("No\n");
        }

    }
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <cstring>
#include <unordered_set>
#include <unordered_map>

using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const ll MOD = 998244353;
 
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int main(){
  int n;
  cin >> n;
  int pre = -1;
  int ans = 0;
  int tmp = 101;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  FOR(i, 1, n){
    if(a[i - 1] == a[i]){
      a[i] = tmp;
      tmp++;
    }
  }
  cout << tmp - 101 << endl;
}

Measured memory_bytes: 256