akhauriyash/Code-Regression huggingface dataset:
#include <iostream>  
    #include <stdio.h>  
    #include <string.h>  
    #include <queue>  
    using namespace std;  
    const int maxn=10050,maxm=20050,inf=0x3f3f3f3f;  
    struct Edge  
    {  
        int to,next,dis,cos ;  
    }edge[maxm*2];  
    struct Pair  
    {  
        int D,V,C;  
        Pair(){;}  
        Pair(int d,int c,int v)  
        {  
            D=d,V=v,C=c;  
        }  
        friend bool operator <(const Pair a,const Pair b)  
        {  
            if(a.D!=b.D)  
            return a.D>b.D;  
            else return a.C>b.C;  
        }  
    };  
    int tot,head[maxn],dist[maxn],cost[maxn];  
    bool vis[maxn];  
    void init()  
    {  
        tot=0;  
        memset(head,-1,sizeof(head));  
    }  
    void add_edge(int u,int v,int d,int c)  
    {  
        edge[tot].to=v;  
        edge[tot].dis=d;  
        edge[tot].cos=c;  
        edge[tot].next=head[u];  
        head[u]=tot++;  
    }  
    int dijstra(int start)  
    {  
        memset(vis,false,sizeof(vis));  
        memset(dist,inf,sizeof(dist));  
        int ans=0;  
        dist[start]=0;  
       // vis[start]=true;  
        priority_queue<Pair>que;  
        que.push(Pair(0,0,start));  
        while(!que.empty())  
        {  
            Pair now=que.top();  
            que.pop();  
            if(vis[now.V])  
                continue;  
            vis[now.V]=true;  
            ans+=now.C;  
            for(int i=head[now.V];i!=-1;i=edge[i].next)  
            {  
                int to=edge[i].to;  
                que.push(Pair(now.D+edge[i].dis,edge[i].cos,to));  
            }  
        }  
        return ans;  
    }  
    int main()  
    {  
        int u,v,d,c;  
        int n,m;  
        while(scanf("%d%d",&n,&m)!=-1)  
        {  
            init();  
            if(n==0&&m==0)break;  
            for(int i=0;i<m;i++)  
            {  
                scanf("%d%d%d%d",&u,&v,&d,&c);  
                add_edge(u,v,d,c);  
                add_edge(v,u,d,c);  
            }  
            printf("%d\n",dijstra(1));  
        }  
        return 0;  
    }  

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  
  for (int i = 0; i < N;i++) {
    cin >> vec.at(i);
  }
  
  int A = vec.at(0);
  int B = 0;
  int j;
  
  for (j = 0;j < N;j++) {
    B++;
    if (A == 2) {
      break;
    }
    A = vec.at(A - 1);
  }
  
  if (j == N) {
    cout << -1 << endl;
  } else {
    cout << B << endl;
  }
}
 

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

int main()
{   
    string w;
    cin>>w;
    int a[26]={0};
    for(int i=0;i<w.size();i++){
        a[w[i]-'a']++;
    }
    for(int i=0;i<26;i++){
        if(a[i]%2==1){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<queue>
#include<cstring>
#include<climits>
#include<sstream>
#include<deque>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<bitset>

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;


const int MAX_V = 2000; /////////////////////////////////////////////////////////////

struct Edge{ int to,cap,rev; };

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


void add_edge(int from,int to,int cap){
  G[from].push_back((Edge){to,cap,(int)G[to].size()});
  G[to].push_back((Edge){from,0,(int)G[from].size()-1});
}

int dfs(int v,int t,int f){
  if( v == t ) return f;
  used[v] = true;
  for(int i=0;i<(int)G[v].size();i++){
    Edge &e = G[v][i];
    if( !used[e.to] && e.cap > 0 ){
      int d = dfs(e.to,t,min(f,e.cap));
      if( d > 0 ){
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow = 0;
  for(;;){
    memset(used,0,sizeof(used));
    int f = dfs(s,t,INT_MAX);
    if( f == 0 ) return flow;
    flow += f;
  }
}

void init(int _size=MAX_V){ rep(i,_size) G[i].clear(); }

int V;
int a[110],b[110],c[110],d[110];

int main() {
  cin >> V;
  rep(i,V) cin >> a[i] >> b[i];
  rep(i,V) cin >> c[i] >> d[i];
  int source = 2 * V;
  int sink = source + 1;
  init(sink+1);
  rep(i,V) add_edge(source,i,1);
  rep(i,V) add_edge(V+i,sink,1);
  rep(i,V) {
    rep(j,V) {
      if( c[i] > a[j] && d[i] > b[j] ) {
	add_edge(i,V+j,1);
      }
    }
  }
  cout << max_flow(source,sink) << endl;
  return 0;
}


Measured memory_bytes: 384
def main():
    n=int(input())
    d=list(map(int,input().split()))
    d.sort(reverse=True)
    
    #print(d)
    
    ans=0
    for large in range(0,n-2):
        presmall=n-1
        for middle in range(large+1,n-1):
            if d[large]<d[middle]+d[presmall]:
                ans+=presmall-middle
                #print(d[large],d[middle],d[presmall],"   ",d[presmall]+d[middle],presmall)
            else:
                flag=False
                for i in range(presmall-1,middle,-1):
                    #print(presmall)
                    if d[large]<d[middle]+d[i]:
                        presmall=i
                        flag=True
                        break
                if flag==False:
                    break
                else:
                    ans+=presmall-middle
                    #print(d[large],d[middle],d[presmall],"   ",d[presmall]+d[middle],presmall,"#")
    print(ans)
main()


Measured memory_bytes: 42860
// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);
//#define _GLIBCXX_DEBUG//only for debugging
/*BISMILLAH UR RAHMAN*/ 
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<fixed<<setprecision(10);
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define debug(x) std::cerr << #x << ": " << (x) << '\n';
#define sz(x) int(x.size())
#define INF INT_MAX;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
double startTime;
double getCurrentTime()
{return ((double)clock() - startTime) / CLOCKS_PER_SEC;}
typedef long long int ll;
typedef pair<int,int> ii;
int mod=int(1e9+7);
char arr[1001][1001];
int cnt[1001][1001];
int dp(int m,int n)
{
  if(m<=0||n<=0)return 0;
  if(arr[m-1][n-1]=='#')return 0;
  if(cnt[m][n]!=-1)return cnt[m][n];
  if((m==1&&n==2)||(n==1&&m==2)) return cnt[m][n]=1;
  int ans;
  if(m-1>0&&n-1>0)
  ans=(dp(m-1,n)%mod+dp(m,n-1)%mod)%mod;
  else
  {
    if(m-1>0)
      ans=dp(m-1,n)%mod;
    else
      ans=dp(m,n-1)%mod;
  }

  return cnt[m][n]=ans;
}
int main()
{  
  //fast
  int h,w;
  cin>>h>>w;
  for(int i=0;i<h;++i)
    for(int j=0;j<w;++j)
      cin>>arr[i][j]; 
    memset(cnt,-1,sizeof(cnt));
    //startTime = (double)clock();
    cout<<dp(h,w)%mod<<endl;
    //cout<<getCurrentTime()<<endl;

}


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

using namespace std;

typedef long long ll;
#define pb push_back
#define dbg(x) cerr << #x << " " << x << "\n"

int f[4];

int main () {
    ios::sync_with_stdio (false);
    cin.tie (0); cout.tie (0);
    ll a, b;
    cin >> a >> b;
    cout << a * b / __gcd (a, b);

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <vector>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;

using Cand = tuple<int, int>;

int get_name(const Cand &c) { return get<0>(c); }
int get_point(const Cand &c) { return get<1>(c); }

tuple<Cand, Cand> get_top_two_cands(const vector<int> &point) {
  Cand top = make_tuple(-1, -1),
    second = make_tuple(-1, -1);
  REP(j, 26) {
    if (point[j] > get_point(top)) {
      second = top;
      top = make_tuple(j, point[j]);
    } else if (point[j] > get_point(second)) {
      second = make_tuple(j, point[j]);
    }
  }
  return make_tuple( top, second );
}

int main() {
  int N;
  while (cin >> N && N) {
    vector<char> C(N);
    REP(i, N) { cin >> C[i]; }

    vector<int> point(26, 0);
    int votes = 0;
    Cand top = make_tuple(0, 0), second = make_tuple(0, 0);
    for (;
        votes < N && (N - votes) >= (get_point(top) - get_point(second));
        ++votes, tie(top, second) = get_top_two_cands(point)) {
      ++point[C[votes] - 'A'];
    }
    if (get_point(top) > get_point(second)) {
      char name = 'A' + get_name(top);
      cout << name << " " << votes << endl;
    } else {
      cout << "TIE" << endl;
    }
  }
  return 0;
}

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

int main() {
  string A;
  cin>>A;
  if(A=="MON"){
     cout<<6<<endl;
  }
  if(A=="TUE"){
    cout<<5<<endl;
  }
  if(A=="WED"){
    cout<<4<<endl;
  }
  if(A=="THU"){
    cout<<3<<endl;
  }
  if(A=="FRI"){
    cout<<2<<endl;
  }
  if(A=="SAT"){
    cout<<1<<endl;
  }
  if(A=="SUN"){
    cout<<7<<endl;
  }
}


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

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

template<class T> using v = std::vector<T>;
template<class T> using vv = v<v<T>>;

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; }}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; }}

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

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

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

    ll n; cin >> n;
    if (n % 2 != 0) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 0;
    ll five = 5;
    while(five <= n) {
        ll temp = n / five;
        temp /= 2;
        ans += temp;
        five *= 5;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

var par []int

func main() {
	var n, m, k int
	fmt.Scan(&n, &m, &k)

	par = make([]int, n)
	for i := range par {
		par[i] = i
	}

	ps := make([][]int, n)
	for i := 0; i < m; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		a--
		b--
		ps[a] = append(ps[a], b)
		ps[b] = append(ps[b], a)
		unite(a, b)
	}

	pc := make([]int, n)
	for i := range par {
		r := root(par[i])
		pc[r]++
	}

	ans := make([]int, n)
	for i := range par {
		ans[i] = pc[root(par[i])] - 1
		ans[i] -= len(ps[i])
	}

	for i := 0; i < k; i++ {
		var c, d int
		fmt.Scan(&c, &d)
		c--
		d--
		if same(c, d) {
			ans[c]--
			ans[d]--
		}
	}

	for i := range ans {
		fmt.Println(ans[i])
	}
}

func root(x int) int {
	if par[x] == x {
		return x
	}
	par[x] = root(par[x])
	return par[x]
}

func unite(x, y int) {
	rx := root(x)
	ry := root(y)
	if rx == ry {
		return
	}
	par[rx] = ry
}

func same(x, y int) bool {
	return root(x) == root(y)
}


Measured memory_bytes: 14848
#include<iostream>
#include<cstring>
#include <cstdio>
#include<cstdlib>
using namespace std;
const int limit=200;
char st[limit];
int a[limit];
int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int aa;
	gets(st);
	int n=strlen(st);
	while (!((st[0]=='.')&&(n==1)))
	{
		for(int i=0;i<=n;i++)
		{
			if(st[i]=='[') a[++aa]=1;
			else if(st[i]==']') a[++aa]=2;
			else if(st[i]=='(') a[++aa]=3;
			else if(st[i]==')') a[++aa]=4;	
		}	
		bool ok=true;
		while ((ok)&&(aa>0))
		{
			ok=false;
			for (int i=1;i<=aa-1;i++) if(((a[i]==1)&&(a[i+1]==2))||((a[i]==3)&&(a[i+1]==4)))
			{
				for(int j=i;j<=aa-2;j++) a[j]=a[j+2];
				a[aa]=0; a[aa-1]=0;
				aa=aa-2;
				ok=true;
				break;
			}
		}
		if(aa==0) cout<<"yes";
		else cout<<"no";
		cout<<endl;
		for(int i=1;i<=aa;i++) a[i]=0;
		aa=0;
		gets(st);
		n=strlen(st);
	}		
}

Measured memory_bytes: 1116
#include<cstdio>
#include<cstring>

int n,len[40];
char word[11];

int solve(int pos) {
	int rest;
	rest = 5;
	while (rest > 0) {
		rest -= len[pos++];
		if (rest < 0)return 0;
	}
	rest = 7;
	while (rest > 0) {
		rest -= len[pos++];
		if (rest < 0)return 0;
	}
	rest = 5;
	while (rest > 0) {
		rest -= len[pos++];
		if (rest < 0)return 0;
	}
	rest = 7;
	while (rest > 0) {
		rest -= len[pos++];
		if (rest < 0)return 0;
	}
	rest = 7;
	while (rest > 0) {
			rest -= len[pos++];
			if (rest < 0) return 0;
	}
	return 1;
}

int main() {
	while (1) {
		scanf("%d\n", &n);
		if (n == 0)break;
		for (int i = 0; i < n; i++) {
			scanf("%s\n", word);
			len[i] = strlen(word);
		}
		for (int j = 0; j < n; j++) {
			if (solve(j)) {
				printf("%d\n", j + 1);
				break;
			}
		}
	}
}


Measured memory_bytes: 2576
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)


N = I()
b = LI()

result = []
while True:
    #  print(b)
    for i in range(1, len(b)+1):
        #  print(i)
        if b[-i] == len(b)-i+1:
            #  print('break')
            result.append(b[-i])
            b.pop(-i)
            break
    else:
        if not b:
            break
        print(-1)
        exit()
for i in result[::-1]:
    print(i)




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

int main(){
    int A, B;
    scanf("%d", &A);
    scanf("%d", &B);
    
    if (2 * B >= A) {
        printf("%d\n", 0);
    } else {
        printf("%d\n", A - 2 * B);
    }
    
    return 0;
}


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

import static java.util.Comparator.reverseOrder;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] list = new int[]{1,2,4,8,16,32,64,128};
        for (int i = 0; i < 8; i++) {
            if (list[i] > n) {
                System.out.println(list[i-1]);
                return;
            }
        }
    }
}

Measured memory_bytes: 21972
#include <stdlib.h>
#include <iostream>
#include <list>
using namespace std;

void insertion_sort(int *array, int n, int g, int &cnt);
void shell_sort(int *array, int n);
void print_array(int *array, int size);
int main(){
	int n;

	cin >> n;

	int* array = (int*)malloc(n * sizeof(int));

	if(n < 1){
		return 0;
	}

	for(int i = 0; i < n; i++){
		cin >> array[i];
	}
	shell_sort(array, n);
	return 0;
}
void insertion_sort(int *array, int n, int g, int &cnt){
	//g???????????????
	for(int i = g; i < n; i++){
		int v = array[i];
		int j = i - g;
		//g??¢???????????°?????????????????\?????????i=4g?????¨??????4g??¨3g 3g??¨2g 2g??¨g g??¨0
		while(j >= 0 && array[j] > v){
			array[j+g] = array[j];
			j -= g;
			++cnt;
		}
		array[j+g] = v;
	}
}

void shell_sort(int *array, int n){
	int* G = (int*)malloc(n * sizeof(int));
	int g = 1;
	int m = 0;
	int cnt = 0;
	do{
		G[m] = g;
		++m;
		g *= 3;
		g += 1;
	}
	while(g < n);

	for(int i = m-1; i >= 0; --i){
		insertion_sort(array, n, G[i], cnt);
	}
	cout << m << endl;
	print_array(G, m);
	cout << cnt << endl;
	for(int i = 0; i < n; ++i){
		cout << array[i] << endl;
	}

}

void print_array(int *array, int size){
	for(int i = size-1; i >= 0; --i){
		cout <<  array[i];
		if(i != 0){
		cout << " " ;
		}
	}
	cout << endl;
}

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

/* // Ordered Set
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define os_find(k) find_by_order(k)
#define os_order(k) order_of_key(k)
*/

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef vector<int> vi;
#define f0(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define f2(i,a,b) for(int i=a;i>b;i--)
#define f3(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define int long long
#define fi first
#define se second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define make_graph(k) int x,y; f0(i,0,k){cin>>x>>y; adj[x].pb(y); adj[y].pb(x);}
#define test int t;cin>>t;while(t--)
// int ncr(int n,int r) {return (fact[n]*modInv(fact[r]))%mod*modInv(fact[n-r])%mod;}
// int modInv(int i) {return binExp(i,mod-2);}

signed main()
{
    fast

    #ifndef ONLINE_JUDGE
        freopen("inputf.in","r",stdin);
        freopen("outputf.in","w",stdout);
    #endif

    int n;
    cin>>n;

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

    int ans = 1;
    int ded = 1;
    int add = 1;
    f0(i,0,n)
    {
        ans = (ans*10)%mod;

        ded = (ded*9)%mod;

        add = (add*8)%mod;
    }
    
    ans = (ans - 2*ded + 2*mod + add)%mod;

    cout<<ans;
}

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

int main() {
	string s;
	int m, h;
	while (1) {
		cin >> s;
		if (s == "-") break;
		cin >> m;
		for (int i = 0; i < m; i++) {
			cin >> h;
			string copy;
			copy = s.substr(0, h);
			s.erase(s.begin(), s.begin() + h);
			s = s + copy;
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
N = int(input())
task = [list(map(int,input().split())) for i in range(N)]
task.sort(key=lambda a:a[1])
now = limit = 0
for i in range(N):
    limit = task[i][1]
    now += task[i][0]
    if now>limit:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 53660
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<iomanip>
#include<cstring>
#define R register
#define EN printf("\n")
#define LL long long
inline LL read(){
	LL x=0,y=1;
	char c=std::getchar();
	while(c<'0'||c>'9'){if(c=='-') y=-1;c=std::getchar();}
	while(c>='0'&&c<='9'){x=x*10+(c^48);c=std::getchar();}
	return x*y;
}
int n,x;
int notp[200006],p[200006];
int main(){
	x=read();
	n=std::max(20,x*2);
	for(R int i=2;i<=n;i++){
		if(notp[i]) continue;
		p[++p[0]]=i;
		for(R int j=i+i;j<=n;j+=i) notp[j]=1;
	}
	for(R int i=1;;i++){
		if(p[i]>=x) return std::printf("%d",p[i]),0;
	}
	return 0;
}


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

namespace A
{
    class Program
    {
        public static void Main(string[] args)
        {
            var n = ReadLineIntSpilit();
            var re = "error";

            if(n[0]+n[1] < 10) {
                Console.WriteLine(n[0]+n[1]);
                return;
            }

            Console.WriteLine(re);
            ReadLine();
        }

        /// <summary>
        /// stringを一文字ずつintにキャストして配列に変換します。
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static int[] StringCharArrayIntArray(string str)
        {
            List<int> b = new List<int>();
            for (int i = 0; i < str.Length; i++) {
                b.Add( int.Parse(str[i].ToString()));
            }
            return b.ToArray();
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }

        public static int ReadLineInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static string[] ReadLineStringSplit(char a = ' ')
        {
            return ReadLine().Split(a).ToArray();
        }

        public static int[] ReadLineIntSpilit(char a = ' ')
        {
            return ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        }
    }
}

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

#define LL long long
#define MOD 1000000007
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define print(a, n) for(LL e=0; e<n; e++) cout<<a[e]<<" "; cout<<"\n"
#define prints(a) for(auto i: a) cout<<i<<" "; cout<<"\n"
#define read(a, n) for(LL e=0; e<n; e++) cin>>a[e]

int main()
{
	fastio;
	char c;
	cin>>c;
	if(c>='A' && c<='Z')
		cout<<'A'<<"\n";
	else
		cout<<'a'<<"\n";
	
	exit(0);
}

Measured memory_bytes: 3608
#include <stdio.h>
int main(){
  char *S[3];
  scanf("%s",S);
  if(strcmp(S,"AAA")==0 || strcmp(S,"BBB")==0){
    printf("No");
    return 0;
  }
  else{
    printf("Yes");
    return 0;
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i,m,n) for(int i = m;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
int main() {
  lli A,B=0,C=0,D=0,F=0;
  cin >> A>>B>>C>>D;
  A=max(A,C);
  B=min(B,D);
  if(B-A<0)Out(0);
  else Out(B-A);
}

Measured memory_bytes: 256
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
int INF = 1001001001;

int main()
{
    string s,t;
    in s>>t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<int>());
    if(s<t)py;
    else pn;

}


Measured memory_bytes: 256
import math

A,B = map(int,input().split())

#税率8%の消費税から元値のリストを作る
#A*12.5（切り上げ）が元値の取りうる最小値
motone_8 = math.ceil(A*12.5)
#最小値から＋12した数に0.08かけてA+1以上か
if (motone_8 + 12) * 0.08 >= A+1:
    #以上なら該当値は12個
    gaitou_8 = 12
#下回ったら該当値は13個
else:
    gaitou_8 = 13

#最小値～最小値＋該当値-1までをリストにいれる
gaitou_list_8 = list(range(motone_8,motone_8 + gaitou_8))

#税率10%の消費税から元値のリストを作る
#B*10が元値の取りうる最小値
motone_10 = B*10

#最小値～最小値＋10までをリストにいれる
gaitou_list_10 = list(range(motone_10,motone_10 + 10))


#二つのリストの共通項を見つける
kyotu_list = set(gaitou_list_8) & set(gaitou_list_10)
#print(gaitou_list_8)
#print(gaitou_list_10)
#print(kyotu_list)

if len(kyotu_list) == 0:
    print(-1)
else:
    print(min(kyotu_list))

Measured memory_bytes: 3064
namespace global
  open System
  open System.Collections
  open System.Collections.Generic

  type Color = | Black | White

  [<AutoOpen>]
  module Operators =
    let read f = Console.ReadLine().Split([|' '|]) |> Array.map f

  module Program =
    [<EntryPoint>]
    let main _ =
      let stoa (str: string) = str.ToCharArray()
      let neigh = [|
        1, 0
        0, -1
        -1, 0
        0, 1
      |]

      match read int with
      | [|H; W|] ->
        let board =
          [|
            for _ in 0..(H + 2) ->
              Array.replicate (W + 2) Black
          |]
        for y in 1..H do
          let line = Console.ReadLine()
          for i in 0..(W - 1) do
            if line.[i] = '.' then
              board.[y].[i + 1] <- White
        let whiteCount =
          board |> Seq.collect id |> Seq.sumBy (fun t -> if t = White then 1 else 0)

        let set = HashSet<_>()
        let queue = Queue<_>()
        queue.Enqueue(((1, 1), 1))
        let rec go () =
          if queue.Count = 0 then
            -1
          else
            let ((y, x), d) = queue.Dequeue()
            if board.[y].[x] = Black then
              go ()
            else if (y, x) = (H, W) then
              whiteCount - d
            else
              for (dy, dx) in neigh do
                let y' = y + dy
                let x' = x + dx
                if set.Add((y', x')) then
                  queue.Enqueue(((y', x'), d + 1))
              go ()
        let dist = go ()
        printfn "%d" dist
      | _ -> ()
      0


Measured memory_bytes: 15580
/*input
4
20 18 2 18
*/
#include <bits/stdc++.h>
using namespace std;
const long long md=1e9+7;
long long a[1000005],n;

int main(){
	#ifdef ONLINE_JUDGE
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	#endif
	long long q,m,k,h,ans=0,sum=0,p,x,y;
	cin>>n;
	for(int i=0;i<n;cin>>a[i++]);
	sort(a,a+n,greater<int>());
	for(int i=0;i<n;++i){
		x = a[i];
		if(i%2) ans-=x;
		else ans+=x;
	}
	cout<<ans;
}

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

int main(){
	int i;
	char *S = (char *)malloc(sizeof(char) * 100);
	scanf("%s", S);
	for(i = 0; S[i] != '\0'; i++){}
	S[i - 8] = '\0';
	printf("%s\n", S);
	return 0;
}

Measured memory_bytes: 128
N = int(input())
H = list(map(int, input().split()))
total = 0
max_total = 0

for i in range(N-1):
    if H[i] >= H[i+1]:
        total += 1
        max_total = max(total, max_total)
    else:
        total = 0

print(max_total)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define local
//if you find any bug in my code, please tell me.
int main()
{
#ifdef local
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
#endif
    int a,b,x;
    cin>>a>>b>>x;
    if(x>=a&&x<=a+b) printf("YES");
    else printf("NO");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
//#include <bits/stdc++.h>
// a&1 check odd or not and a>>=1 halfs a
// (n-1-i)%i previous in circle (i+n-1)%n next one
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define pb(x) push_back(x)
#define F first
#define S second
using namespace std;

string a;
void solve(){
	cin>>a;
	int c,d;
	int n=a.size();
	bool ans=false;
	loop(i,0,n-1){
		if(a[i]==a[i+1]){
			c=i+1;
			d=i+2;
			ans=true;
		}
	}
	if(ans==false){
		loop(i,0,n-2){
			if(a[i]==a[i+2]){
				c=i+1;
				d=i+3;
				ans=true;
			}
		}
	}
	if(!ans) cout<<"-1"<<" "<<"-1"<<endl;
	else cout<<c<<" "<<d<<endl;
}	

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

	return 0;
}




Measured memory_bytes: 512
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << endl;
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << "";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define wh while
#define ve vector
#define mp make_pair
#define tp tuple
#define mt make_tuple
#define pb push_back
#define pof pop_front
#define pob pop_back
#define pf push_front
#define fr front
#define ft first
#define sc second
#define tos to_string
#define len length
#define rt return
#define br break
#define con continue
#define lcm(n, m) (n * m / __gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m) - 1;i>=(int)(n);i--)
#define rev(i, m) revi(i, m, 0)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) n.begin(), n.end()
#define allr(n) n.rbegin(), n.rend()
#define sp(n) cout << fixed << setprecision(n)
#define pi 3.14159265358979323846
#define inf 1000000007
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

ve<int> dx = {0, 0, 1, -1}, dy = {1, -1, 0, 0};

int main() {
  int a;
  ci(a);
  co(a + a * a + a * a * a);
}


Measured memory_bytes: 3628
import math
a, b = map(int, input().split())
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


a_div = divisor(a)
b_div = divisor(b)
a_b_div = list(set(a_div) & set(b_div))

def is_prime(n):
    if n == 1:
        return True
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

ans = 0
for i in a_b_div:
    if is_prime(i) == True:
        ans += 1
    else:
        pass

print(ans)

Measured memory_bytes: 41968
#include <iostream>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<string>
#include <map>
using namespace std;


int main() {
	int N;
	cin >> N;
	string S;
	cin >> S;

	int nn;
	nn = S.size();
	if (nn % 2 != 0) {
		cout << "No" << endl;
		return 0;
	}

	for (int i = 0; i < nn/2; i++) {
		if (S[i] != S[i + nn / 2]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
void swap(int* max,int* min){
  int temp=*max;
  *max=*min;
  *min=temp;
}
void sort(int* x,int* y,int* z){
  if(*x>*y) swap(x,y);
  if(*y>*z) swap(y,z);
  if(*x>*y) swap(x,y);

}

int main(){
  int a,b,c;
  scanf("%d %d %d",&a ,&b, &c);
  sort(&a,&b,&c);

  printf("%d %d %d\n",a,b,c);

}



Measured memory_bytes: 2076
#include<stdio.h>
int main()
{
	int a[100],i,n,t,s=0,p;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	scanf("%d",&a[i]);
	t=n;
	while(t>0)
	{
		for(i=0;i<n;i++)
		{
			if(a[i]!=0)break;
		}
		p=a[i];
		s++;
		for(;i<n;i++)
		{
			if(a[i]==p)
			{
				a[i]=0;
				t--;
			}
		}
	}
	printf("%d",s);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
	fast_io
	int d;
	cin>>d;
	string s="Christmas ",m="Eve ";
	rep(i, 25-d) s+=m;
	cout<<s;
	
	return 0;
}

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

long dp[5500];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n, a; cin >> n >> a;
    int x[50]; for(int i=0; i < n; ++i) cin >> x[i], x[i] -= a;

    dp[2500] = 1;
    for(int i=0; i < n; ++i) {
        if(x[i] >= 0) {
            for(int j=5000; j >= x[i]; --j) {
                dp[j] += dp[j - x[i]];
            }
        } else {
            for(int j=0; j <= 5000; ++j) {
                dp[j] += dp[j - x[i]];
            }
        }
    }

    cout << dp[2500] - 1 << '\n';
    return 0;
}

Measured memory_bytes: 256
/**
 * C - Digits in Multiplication
 * https://atcoder.jp/contests/abc057/tasks/abc057_c
 **/
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<numeric>
#include<functional>
#include<sstream>
#include<iomanip>
#include<queue>

using namespace std;

#define ll long long

int main() {
    ll n; cin >> n;
    ll sqrtn = floor(sqrt(n));
    for(ll i=sqrtn; i>=1; i--) {
        if(n%i==0) {
            cout << to_string(n/i).length() << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int n,sum;
  std::cin >> n >> sum;

  for(int i=0; i<=n; i++){
    for(int j=0; j<=n-i; j++){
      int x=10000*i,y=5000*j,z=1000*(n-i-j);
      if(x+y+z==sum){
        std::cout << i << " " << j << " " << n-i-j << '\n';
        return 0;
      }
    }
  }
  std::cout << "-1" << " " << "-1" << " " << "-1" << '\n';

  
  return 0;
}


Measured memory_bytes: 256
unittest
{
	assert( [ "5", "6 7 9 10 31" ].parse.expand.solve == "APPROVED" );
	assert( [ "3", "28 27 24" ].parse.expand.solve == "DENIED" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	auto ans = 0L;
	foreach( a; as )
	{
		if( a % 2 == 0 && a % 3 != 0 && a % 5 != 0 ) return "DENIED";
	}
	return "APPROVED";
}


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

int main(){
  queue<int> year;
  int a,b,cou,count,tmp,i,as=0;
  while(1){
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    if(as != 0){
      cout << endl;
    }
    cou = b - a + 1;
    for(i=0;i<cou;i++){
      tmp = a + i;
      if(tmp%4 == 0 && tmp%100 != 0 || tmp%400 == 0){
	year.push(tmp);
      }
    }
    count = year.size();
    if(count == 0){
      cout << "NA" << endl;
    }
    else{
      for(i=0;i<count;i++){
	cout << year.front() << endl;
	year.pop();
      }
    }
    as = 1;
  }
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
	int n,m;
	cin>>n>>m;
	vector<int> s(m,0),c(max(m,n),-1);
	bool flag=true;
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		x--;
		if(x==0 && n!=1 && y==0)
			flag=false;
		if(c[x]==-1 || c[x]==y)
			c[x]=y;
		else
			flag=false;
	}

	if(flag){
		int mul=1,ans=0;
		for(int i=c.size()-1;i>=0;i--){
			if(c[i]==-1){
				c[i]=0;
			}
			ans+=mul*c[i];
			mul*=10;
		}
		// bool flag1=false;
		if(n==1){
			if(ans<10){
				cout<<ans<<"\n";
			}
			else{
				cout<<-1<<"\n";
			}
		}
		if(n==2){
			if(ans<10){
				cout<<ans+10<<"\n";
			}
			if(ans>=10 && ans<100)
				cout<<ans<<"\n";
			if(ans>=100){
				cout<<-1<<"\n";
			}
		}
		if(n==3){
			if(ans<100){
				cout<<ans+100<<"\n";
			}
			if(ans>=100 && ans<1000)
				cout<<ans<<"\n";
			if(ans>=1000){
				cout<<-1<<"\n";
			}
		}
	}
	else{
		cout<<-1<<"\n";
	}
}	

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	solve();
	return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    string S;
    int Q;
    cin >> S >> Q;

    int T;
    bool is_reversed = false;
    deque<char> prefix, suffix;
    rep(_, Q) {
        cin >> T;
        if (T == 1) {
            is_reversed = !is_reversed;
        } else {
            int F;
            char C;
            cin >> F >> C;
            if (is_reversed) {
                if (F == 1) suffix.push_back(C);
                else prefix.push_front(C);
            } else {
                if (F == 1) prefix.push_front(C);
                else suffix.push_back(C);
            }
        }
    }

    string ans;
    while (!prefix.empty()) {
        ans += prefix.front();
        prefix.pop_front();
    }
    ans += S;
    while (!suffix.empty()) {
        ans += suffix.front();
        suffix.pop_front();
    }

    if (is_reversed) reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


Measured memory_bytes: 1248
#標準入力
N = int(input())
S = input()
K = int(input())
#文字列の取得
alt_str = S[K-1]
alt_txt = ""
for i in range(N):
    if S[i] != alt_str:
        alt_txt += '*'
    else:
        alt_txt += alt_str
print(alt_txt)


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

typedef long long ll;

int N;
map<int, int> M;
vector<int> A, P;

void input_init(void) {
	cin >> N;
	A.resize(N + 1);
	P.resize(N + 1);
	A[0] = P[0] = 0;
	for (int i = 1; i <= N; ++i) {
		cin >> A[i];
		P[i] = i + A[i];
	}
}

ll solve(void) {
	ll cnt = 0;
	++(M[N - A[N]]);
	for (int i = N - 1; i >= 1; --i) {
		if (M.find(P[i]) != M.end())
			cnt += (ll)M[P[i]];
		++(M[i - A[i]]);
	}
	return cnt;
}

int main(void) {
	input_init();
	ll ans = solve();

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 13472
def main():
    n = int(input())
    h = [int(i) for i in input().split()]
    memo = [0 for _ in range(n)]
    memo[1] = abs(h[0] - h[1])
    for i in range(2,n):
        memo[i] = min(memo[i-2] + abs(h[i]-h[i-2]), memo[i-1] + abs(h[i]-h[i-1]))
    print(memo[-1])


if __name__ == '__main__':
    main()



Measured memory_bytes: 52720
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;

int main(){
  int H[10000], W[10000], i, j, k, end;
  for(k=0; k<10000; k++){
    cin>>H[k]>>W[k];
    if(H[k]==0 && W[k]==0){
      end = k;
      break;
    }
  }
  for(k=0; k<end; k++){
    for(j=0; j<W[k]; j++) cout<<"#";
    cout<<endl;
    for(i=1; i<H[k]-1; i++) {
      cout<<"#";
      for(j=1; j<W[k]-1; j++) cout<<".";
      cout<<"#"<<endl;
    }
    for(j=0; j<W[k]; j++) cout<<"#";
    cout<<endl<<endl;
  }
  return 0;
}



Measured memory_bytes: 3060
N, Y = map(int, input().split())

for i in range(N+1):
    for j in range(N-i+1):
        tmp = 10000 * i + 5000 * j + 1000 * (N-i-j)
        if tmp == Y:
            print(str(i) + ' ' + str(j) + ' ' + str(N-i-j))
            quit()

print('-1 -1 -1')

Measured memory_bytes: 40684
#include<bits/stdc++.h>
#define int long long
#define M 1000000007
#define deb(x) cout<<#x<<'='<<x<<endl
using namespace std;
const int N=1e6;
signed main()
{
    int n;
    cin>>n;
    int f[n+1];
    memset(f,0,sizeof(f));
    int x;
    for(int i=1; i<n; i++)
    {
        cin>>x;
        f[x]++;
    }
    for(int i=1; i<=n; i++)
        cout<<f[i]<<endl;
}

Measured memory_bytes: 5200
import Data.Bits

main = do
    n <- read <$> getLine
    a <- map read <$> words <$> getLine
    putStrLn $ show $ solve n a

solve :: Integer -> [Integer] -> Integer
solve n a = doit 1
  where
    m = maximum a
    doit :: Integer -> Integer
    doit b | b > m     = 0
           | otherwise = ((b * count * (n - count)) + doit (b * 2)) `mod` 1000000007
      where
        count = fromIntegral $ length $ filter ((/= 0) . (.&. b)) a


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

int main()
{
	int n;
	cin >> n;
	vector<int> a;
	int in;
	for (int i = 0; i < n; ++i)
	{
		cin >> in;
		a.push_back(in);
	}
	int ans = 0;
	for (auto &v : a)
	{
		while(v % 2 == 0)
		{
			++ans;
			v /= 2;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>

int main(){
  char s[1002];
  int i = 0;
  scanf("%s",s);

  while(s[i] != '\0'){
    if(s[i] == 'A'){
      s[i] = 'X';
    }else if(s[i] == 'B'){
      s[i] = 'Y';      
    }else if(s[i] == 'C'){
      s[i] = 'Z';
    }else{
      s[i] = s[i] - 3;
    }
   i++;
  }
  printf("%s\n",s);  

  return 0;
}

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

int main()
{
	int a,b,c,i,ans = 0;
	cin >> a >> b >> c;
	for (i = a; i <= b; i++)
	{
		if (c % i == 0)
		{
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1164
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>

using namespace std;
typedef long long ll;

int main(){
  char a[3]; cin>>a;
  int b=0;
  for(int i=0; i<3; i++){
    if(a[i]=='1'){
      b++;
    }
  }
  cout<<b<<endl;
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(n) scanf("%d",&n)
#define sff(n1,n2) scanf("%d %d",&n1,&n2)
#define sfff(n1,n2,n3) scanf("%d %d %d",&n1,&n2,&n3)
#define sl(n) scanf("%lld",&n)
#define sll(n1,n2) scanf("%lld %lld",&n1,&n2)
#define slll(n1,n2,n3) scanf("%lld %lld %lld",&n1,&n2,&n3)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define nl puts("");
#define pb push_back
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define sz(x) x.size()
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define line puts("-------");
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
typedef long long int ll;
using namespace std;
int main()
{
    ll n;
    cin>>n;
    cout<<sq(n);
}


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

int S, K;

void solve() {
  int count = 0;
  int sum = 0;

  for (int i = 0; i <= K; i++){
    for (int j = 0; j <= K; j++){
      if (i + j + K >= S && i + j <= S) count++; 
    }
  }

  printf("%d", count);
}

int main() {
  scanf("%d %d", &K, &S);
  solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N; cin>>N;
  vector<ll> A(N,0);
  ll tmp=0;
  for(ll i=0; i<N; i++){
    ll a; cin>>a;
    A[i]=a;
    tmp^=a;
  }
 
  for(ll i=0; i<N; i++){
    ll z=tmp^A[i];
    cout<<z<<" ";
  }
  cout<<endl;
}

Measured memory_bytes: 4788
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) v.erase(remove(v.begin(), v.end(), a), v.end())
using namespace std;

signed main()
{
	int H, W;
	cin >> H >> W;

	int ans = INT_MAX;

	for (int j = 0; j < 2; j++)
	{
		int a = W / 3;
		int b = (W - a) / 2;
		int c = W - (a + b);
		int max = MAX(a, MAX(b, c));
		int min = MIN(a, MIN(b, c));
		ans = MIN(ans, (max - min) * H);

		for (int i = 0; i < W; i++)
		{
			int ar = i * H;
			int h1 = H / 2;
			int h2 = H - h1;
			int ww = W - i;
			int br = ww * h1;
			int bc = ww * h2;
			int max2 = MAX(ar, MAX(br, bc));
			int min2 = MIN(ar, MIN(br, bc));
			ans = MIN(ans, (max2 - min2));
		}

		int temp = W;
		W = H;
		H = temp;
	}

	cout << ans << endl;
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int kosu = sc.nextInt();
        int hen [] = new int [3];

        for(int j=0; j<kosu; j++ ){
            for(int k=0; k<3; k++){
                int len = sc.nextInt();
                 hen[k] = len*len;
            }
             Arrays.sort(hen);
            
            if((hen[0] + hen[1]) == hen[2]){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
            
        }

    }
    
    }

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

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

  bool cards[4][13] = {};
  char mark;
  int rank;
  for (int i = 0; i < n; i++) {
    cin >> mark >> rank;
    if (mark == 'S') cards[0][rank - 1] = true;
    if (mark == 'H') cards[1][rank - 1] = true;
    if (mark == 'C') cards[2][rank - 1] = true;
    if (mark == 'D') cards[3][rank - 1] = true;
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      if (!cards[i][j]) {
        if (i == 0) mark = 'S';
        if (i == 1) mark = 'H';
        if (i == 2) mark = 'C';
        if (i == 3) mark = 'D';
        cout << mark << " " << j + 1 << endl;
      }
    }
  }
  
  return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ans, n, a[200010], beforeodd[200010], beforeeven[200010], afterodd[200010], aftereven[200010], pre[200010];
int main()
{
	scanf("%lld", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%lld", &a[i]);
	}
	partial_sum(a+1, a+n+1, pre+1);
	for (int i = 1; i <= n; i++)
	{
		// Compute odd
		beforeodd[i] = beforeodd[i-1];
		beforeodd[i] += !(a[i]%2);
		beforeodd[i] = min(beforeodd[i], pre[i]);
		// Compute even
		beforeeven[i] = beforeeven[i-1];
		beforeeven[i] += (a[i]%2) + (!a[i])*2;
		beforeeven[i] = min(beforeeven[i], pre[i]);
		beforeodd[i] = min(beforeodd[i], beforeeven[i]);
	}
	for (int i = n; i >= 0; i--)
	{
		// Compute odd
		afterodd[i] = afterodd[i+1];
		afterodd[i] += !(a[i]%2);
		afterodd[i] = min(afterodd[i], pre[n] - pre[i-1]);
		// Compute even
		aftereven[i] = aftereven[i+1];
		aftereven[i] += (a[i]%2) + (!a[i])*2;
		aftereven[i] = min(aftereven[i], pre[n] - pre[i-1]);
		afterodd[i] = min(afterodd[i], aftereven[i]);
	}
	ans = 1e18;
	for (int i = 0; i <= n; i++)
	{
	//	printf("%lld %lld %lld %lld\n", beforeodd[i], beforeeven[i], afterodd[i], aftereven[i]);
		ans = min(ans, beforeodd[i] + aftereven[i+1]);
		ans = min(ans, beforeeven[i] + afterodd[i+1]);
	}
	printf("%lld\n", ans);
}

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


int main(){
  int n,m;cin>>n>>m;
  if(n==m)cout <<"Yes";
  else cout << "No";
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a[110] = {0}; //辺の長さが同じものを格納する箱
    int p; //辺の長さ
    for(int i = 1; i <= 12; i++){
        cin >> p;
        a[p]++;
    }

    int count = 0; //4辺が等しければ１カウントする
    for(int i = 1; i <= 100; i++){
        if(a[i] == 4) count++;
        if(a[i] == 8) count += 2;
        if(a[i] == 12) count += 3;
    }
    if(count == 3) cout << "yes" << endl;
    else cout << "no" << endl;
}



Measured memory_bytes: 3116