akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, M;
int cnt[26];
string S[110];

void solve() {
	cin >> N >> M;
	rep(i, 0, N) cin >> S[i];
	rep(i, 0, N) {
		rep(j, 0, M) {
			int a = S[i][j] - 'a';
			cnt[a]++;
		}
	}
	rep(i, 0, N / 2) {
		rep(j, 0, M / 2) {
			bool found = false;
			rep(k, 0, 26) {
				if(cnt[k] >= 4) {
					found = true;
					cnt[k] -= 4;
					break;
				}
			}
			if(!found) {
				cout << "No\n";
				return;
			}
		}
	}
	if(N % 2 == 1) {
		rep(j, 0, M / 2) {
			bool found = false;
			rep(k, 0, 26) {
				if(cnt[k] >= 2) {
					found = true;
					cnt[k] -= 2;
					break;
				}
			}
			if(!found) {
				cout << "No\n";
				return;
			}
		}
	}
	if(M % 2 == 1) {
		rep(i, 0, N / 2) {
			bool found = false;
			rep(k, 0, 26) {
				if(cnt[k] >= 2) {
					found = true;
					cnt[k] -= 2;
					break;
				}
			}
			if(!found) {
				cout << "No\n";
				return;
			}
		}
	}
	if(N % 2 == 1 && M % 2 == 1) {
		bool found = false;
		rep(k, 0, 26) {
			if(cnt[k] >= 1) {
				found = true;
				cnt[k] -= 1;
				break;
			}
		}
		if(!found) {
			cout << "No\n";
			return;
		}
	}
	cout << "Yes\n";	 
 }

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}

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


// const double PI = acos(-1);
// int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
// int a[12][12];



void solve() {
  int a,b;
  cin >> a >> b;
  cout << a* b << endl;

}

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





Measured memory_bytes: 3636
#include <iostream>
#include <vector>

using namespace std;

void solve()
{
	int N, T, E;
	cin >> N >> T >> E;
	int min = T - E;
	int max = T + E;
	vector<int> time(N);
	for(int i = 0; i < N; ++i)
	{
		cin >> time[i];
	}
	bool okFlag = false;
	for(int i = 0; i < N; ++i)
	{
		if(okFlag)
		{
			break;
		}
		okFlag = false;
		int sum = time[i];
		while(sum <= max)
		{
			if(min <= sum)
			{
				cout << i + 1 << endl;
				okFlag = true;
				break;
			}
			sum += time[i];
		}
	}
	if(!okFlag)
	{
		cout << -1 << endl;
	}
}

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

Measured memory_bytes: 1200
#include<iostream>
int main(){
    int a, b;
    std::cin >> a >> b;
    if(a < b){
        std::cout << "a < b" << std::endl;
    }
    else if(a > b){
        std::cout << "a > b" << std::endl;
    }
    else{
        std::cout << "a == b" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3068
/*	MASTER HAS FAILED MORE TIMES
	THAN BEGINNER HAS EVER TRIED
*/

#include <bits/stdc++.h>

using namespace std;

#define endl            '\n'
#define mem(a, n)       memset(a, n, sizeof(a))
#define repeat(n)       for(int i=0; i<n; i++)
#define Unique(n)       (n).erase(unique(all(n)), (n).end())
#define isPowerOfTwo(n) (n && !(n & (n - 1)))
#define NumofDigits(n)  ((int)log10(n)+1)
#define all(a)          a.begin(), a.end()

unsigned long long pow(long long base, long long power);

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

void quicken(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

/*
    Special functions:
        find_by_order(k) --> returns iterator to the kth largest element counting from 0
        order_of_key(val) --> returns the number of items in a set that are strictly smaller than our item
*/

int main(){
    quicken();

    int n, a=0, b=0; cin >> n;
    int arr[n];
    repeat(n) cin >> arr[i];
    sort(arr, arr+n); reverse(arr, arr+n);

    repeat(n)
        if(i&1) a += arr[i];
        else b += arr[i];

    cout << abs(a-b) << endl;
    return 0;
}

unsigned long long pow(long long base, long long power){
    if(power==0) return 1;
    if(power==1) return base;

    unsigned long long ans = pow(base, power/2);
    ans *= ans; /// ans = (ans%mod)*(ans%mod);

    if(power&1) return ans*base; /// (ans%mod)*(base%mod);
    return ans;
}


Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define INF (int)1e9
#define INFL (ll)1e11
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int H, W;
	cin >> H >> W;
	vector<vector<int>> a(H, vector<int>(W));
	REP(i, H)REP(j, W) {
		cin >> a[i][j];
	}
	vector<vector<int>> res;
	REP(i, H)REP(j, W - 1) {
		if (a[i][j] % 2 == 1) {
			vector<int> tmp = { i,j,i,j + 1 };
			res.push_back(tmp);
			a[i][j + 1]++;
		}
	}
	REP(i, H - 1) {
		if (a[i][W - 1] % 2 == 1) {
			vector<int> tmp = { i,W - 1,i + 1,W - 1 };
			res.push_back(tmp);
			a[i + 1][W - 1]++;
		}
	}
	cout << res.size() << "\n";
	REP(i, res.size())REP(j, 4) {
		if (j < 3) cout << res[i][j] + 1 << " ";
		else cout << res[i][j] + 1 << "\n";
	}

	return 0;
}
		

Measured memory_bytes: 10032
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

from collections import defaultdict  # 初期化済み辞書

def main():
    N = i2n()
    XY = ii2nnn(N)
    # n <= 50 なので、xy[i] → xy[j] の全ての組み合わせについて、距離を全探索できちゃう
    # 距離 dx, dy をkeyに、その距離の i, j ペアの数をvalueとしてカウント
    d = defaultdict(lambda: 0)
    for i in range(N):
        xi, yi = XY[i]
        for j in range(N):
            if i == j:
                continue
            xj, yj = XY[j]
            dxy = (xj - xi, yj - yi)
            d[dxy] += 1
    # 基本はコストN
    # max(value) だけコストを減らせる
    n = N
    dv = d.values()
    if dv:
        n -= max(d.values())
    print(n)

main()


Measured memory_bytes: 39280
#include <stdio.h>

using namespace std;

int main(){
	int n,m,l;
	scanf("%d %d %d",&n,&m,&l);
	int A[n][m],B[m][l];
	long long int C[n][l];
	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			C[i][j] = 0;
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			scanf("%d",&A[i][j]);
		}
	}
	for(int i = 0; i < m; i++){
		for(int j = 0; j < l; j++){
			scanf("%d",&B[i][j]);
		}
	}

	for(int i = 0; i < n; i++){
		for(int k = 0; k < l; k++){
			for(int j = 0; j < m; j++){
				C[i][k] += A[i][j]*B[j][k];
			}
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < l-1; j++){
			printf("%lld ",C[i][j]);
		}
		printf("%lld\n",C[i][l-1]);
	}
}


Measured memory_bytes: 2824
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n;
char s[N];
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	int mx=0,id=0;
	long long ans=(long long)n*(n+1)/2;
	for(char i='a';i<='z';i++)
	{
		int lst=0,num=0;
		for(int j=1;j<=n;j++)if(s[j]==i)
		{
			if(lst)ans-=(j-lst>1?num:num-1);
			lst=j;num++;
		}
	}
	ans-=n;
	for(int i=1;i<n;i++)if(s[i]==s[i+1])ans--;
	printf("%lld\n",ans+1);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
  
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
typedef long long ll;

const ll MOD=1000000007ll;
const int MAX=5100000;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

ll fact[MAX], fact_inv[MAX];

ll power(ll a, ll b){
	ll res=1;
	while(b>0){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

// nCr
ll comb(ll n, ll r){
	ll t=1000000;
	fact[0]=1;
	REP(i, t) fact[i+1]=fact[i]*(i+1)%MOD;
	fact_inv[t]=power(fact[t], MOD-2);
	FORR(i, 0, t) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
  
int main()
{
  int i,j;
  int N,K; cin >> N >> K;
  int D[K]; FOR(i,0,K){cin >> D[i];}
  FOR(i,0,1000000){
      int ans = N+i;
      int check = N+i;
      int ret = 0;
      do{
          int M = check % 10;
          check = check / 10;
          FOR(j,0,K){if(D[j]==M){ret=1;}}
      }while(check>0);
    if(ret==0){cout << ans << endl; return 0;}  
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int num1 = scan.nextInt();
        int num2 = scan.nextInt();
        //int cost = num2;
        if(num1 <= 12){
            num2 /= 2;
        }
        if(num1 <= 5){
            num2 = 0;
        }
        System.out.println(num2);
        scan.close();
    }
}

Measured memory_bytes: 21972
import java.util.*;
 
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        String T = sc.next();
        int ls = S.length();
        int lt = T.length();
        String a = "?";

        if(ls<lt){
            System.out.println("UNRESTORABLE");
            return;
        }
        int x = -1;
        for(int i=0; i<=ls-lt; i++){
            if(S.charAt(i)==T.charAt(0) || S.charAt(i)==a.charAt(0)){
                for(int j=0; j<lt; j++){
                    if(S.charAt(i+j)!=T.charAt(j) && S.charAt(i+j)!=a.charAt(0)){
                        break;
                    }
                    if(j==lt-1){
                        x = i;
                    }
                }
            }
        }
        if(x==-1){
            System.out.println("UNRESTORABLE");
            return;
        }
        else if(ls==lt){
            S = T;
            System.out.println(S);
            return;
        }
        else if(x==0){
            S = T + S.substring(lt);
        }
        else if(x!=0){
            if(x+lt-1==ls){
                S = S.substring(0, x) + T;
            }
            else{
                S = S.substring(0, x) + T + S.substring(x + lt);
            }
        }
        String st = "";
        for(int i=0; i<ls; i++){
            if(S.charAt(i)==a.charAt(0)){
                st += "a";
            }
            else{
                st += String.valueOf((char)S.charAt(i));
            }
        }
        System.out.println(st);
    }
}

Measured memory_bytes: 23764
#include "bits/stdc++.h"
using namespace std;

#define Rep(i,n) for(int i=0;i<(n);i++)
#define For(i,n1,n2) for(int i=(n1);i<(n2);i++)
#define REP(i,n) for(ll i=0;i<(n);i++)
#define RREP(i,n) for(ll i=(n-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(n1);i<(n2);i++)
#define put(a) cout<<(a)<<"\n";
#define all(a)  (a).begin(),(a).end();
#define SORT(a) sort((a).begin(),(a).end())
#define TDARRAY(int,a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()

typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

ll n,c,k;

int main(){
    cin >> n >> c >> k;
    vector<ll> t(n);
    REP(i,n){
        cin >> t[i];
    }
    SORT(t);
    ll res =  0;
    ll mint = t[0];
    int cnt = 0;
    int index = 0;
    while(index<n){
        mint = t[index];
        cnt = 0;
        while(cnt<c&&t[index]-mint<=k){
            cnt++;
            index++;
        }
        res++;
    }
    put(res);
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ )
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair 
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
#define watch(x) cout << (#x) << " is " << (x) <<"\n"
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 1e9+7;
const ll MAX = 1e6+10;
const ll inf = 1e18+7;


int main(){
	fastio;
	string s;
	cin>>s;
	ll n = sz(s);
	f(i,0,n){
    	if(s[i]!=s[n-1-i]){
    		cout<<"No\n";
    		return 0;
    	}
    }
    f(i,0,(n-1)/2){
    	if(s[i]!=s[(n-1)/2-1-i]){
    		cout<<"No\n";
    		return 0;
    	}
    }
    f(i,(n+1)/2,n){
    	if(s[i]!=s[n-1-i]){
    		cout<<"No\n";
    		return 0;
    	}
    }
    cout<<"Yes\n";
    return 0; 
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 7+1e18
#define lld long double
#define eps 0.000001
#define endl '\n'
using namespace std ;

lli spf[100000+1];
lli const MAXN = 100001;
lli modex(lli x,lli y,lli p);
void getZarr(string str, lli Z[]);
void sieve();
vector<lli> getFactorization(lli x); 

int main()
{
    
    
    lli n,T;
    cin>>n>>T;
    lli t[n],c[n];
    loopl(i,0,n) cin>>c[i]>>t[i];

    lli cost=1000000000;
    loopl(i,0,n)
    {
        if(t[i]<=T) cost=min(cost,c[i]);
    }
    if(cost==1000000000) cout<<"TLE"<<endl;
    else cout<<cost<<endl;

}


void getZarr(string str, lli Z[]){
    Z[0]=0;
    lli n = str.length();
    lli L, R, k;
    L = R = 0;
    loopl(i,1,n){
        if (i > R){
            L = R = i;
            while (R<n && str[R-L] == str[R])
                R++;
            Z[i] = R-L;
            R--;
        } else {
            k = i-L;
            if (Z[k] < R-i+1)
                Z[i] = Z[k];
            else {
                L = i;
                while (R<n && str[R-L] == str[R])
                    R++;
                Z[i] = R-L;
                R--;
            }
        }
    }
}

lli modex(lli x,lli y,lli p) 
{ 
    lli res = 1; 
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
  
        y = y>>1;  
        x = (x*x) % p;   
    } 
    return res; 
}

void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++) 
    spf[i] = i; 
  
    for (int i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        if (spf[i] == i) 
        { 
            for (int j=i*i; j<MAXN; j+=i) 
  
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
vector<lli> getFactorization(lli x) 
{ 
    vector<lli> ret; 
    while (x != 1) 
    { 
        ret.pb(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
}

Measured memory_bytes: 256
from collections import defaultdict
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int,input().split()))
    d = defaultdict(int)
    for x in A:
        d[x] += 1
    A = list(set(A))
    A.sort(reverse = True)
    l = len(A)
    
    def exp(x):
        l = len(str(bin(x))[2:])
        return 2**l

    ans = 0
    for i in range(l):
        a = A[i]
        if exp(a)//2 == a:
            ans += int(d[a]//2)
        else:
            m = min(d[a],d[exp(a)-a])
            ans += m
            d[a] -= m
            d[exp(a)-a] -= m
            
    print(ans)
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 59728
w,h,n = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
xl = 0
xr = w
yh = h
yr = 0
for i in range(n):
    if a[i][2] == 1:
        xl = max(xl,a[i][0])
    elif a[i][2] == 2:
        xr = min(xr,a[i][0])
    elif a[i][2] == 3:
        yr = max(yr,a[i][1])
    else:
        yh = min(yh,a[i][1])

x = xr - xl
y = yh - yr

print(0 if x < 0 or y < 0 else x*y)

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

void fnInput(int &rnMaxSiz, vector<int> &rvnSort)
{
  cin >> rnMaxSiz;

  rvnSort.resize(rnMaxSiz);
  for (int i = 0; i < rnMaxSiz; i++)
    cin >> rvnSort[i];
}

void fnMerge(vector<int> &rvnSort, int &rnSortCnt, int nLeft, int nMid, int nRight)
{
  vector<int> vnLeft, vnRight;
  int nLeftSiz = nMid - nLeft;
  int nRightSiz = nRight - nMid;

  vnLeft.resize(nLeftSiz + 1);
  vnRight.resize(nRightSiz + 1);

  for (int i = 0; i < nLeftSiz; i++)
    vnLeft[i] = rvnSort[nLeft + i];
  for (int i = 0; i < nRightSiz; i++)
    vnRight[i] = rvnSort[nMid + i];

  vnLeft[nLeftSiz] = INT_MAX;
  vnRight[nRightSiz] = INT_MAX;
  int i = 0, j = 0;

  for (int n = nLeft; n < nRight; n++)
  {
    if (vnLeft[i] <= vnRight[j])
      rvnSort[n] = vnLeft[i++];
    else
      rvnSort[n] = vnRight[j++];
    rnSortCnt++;
  }
}

void fnMergeSort(vector<int> &rvnSort, int &rnSortCnt, int nLeft, int nRight)
{
  if (nLeft + 1 < nRight)
  {
    int nMid = (nLeft + nRight) / 2;
    fnMergeSort(rvnSort, rnSortCnt, nLeft, nMid);
    fnMergeSort(rvnSort, rnSortCnt, nMid, nRight);
    fnMerge(rvnSort, rnSortCnt, nLeft, nMid, nRight);
  }
}

void fnResult(const vector<int> &cnrvnSort, int nSortCnt)
{
  for (int i = 0; i < cnrvnSort.size(); i++)
  {
    if (i != 0)  cout << " ";
    cout << cnrvnSort[i];
  }
  cout << endl;
  cout << nSortCnt << endl;
}

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

  int nMaxSiz;
  vector<int> vnSort;

  fnInput(nMaxSiz, vnSort);

  int nLeft = 0;
  int nRight = nMaxSiz;
  int nSortCnt = 0;
  fnMergeSort(vnSort, nSortCnt, nLeft, nRight);

  fnResult(vnSort, nSortCnt);

  return 0;
}

Measured memory_bytes: 5068
#include "bits/stdc++.h"
#define rep(i,a,n) for(int (i) = (a);(i) < (n);(i)++)

using namespace std;

int main(){
	
	int a,b,n,s,f;
	
	cin >> a >> b >> n;
	
	int l[1010] = {0};
	
	rep(i,0,n){
		cin >> s >> f;
		
		rep(j,s,f){
			l[j] = 1;
		}
		
	}
	
	rep(i,a,b){
		if(l[i]){
			cout << 1 << endl;
			return 0;
		}
	}
	cout << 0 << endl;
	
	return 0;
}


Measured memory_bytes: 3140
str = input()

flg = [False]*4
for s in str:
    if s == 'N':
        flg[0] = True
    elif s == 'S':
        flg[1] = True
    elif s == 'E':
        flg[2] = True
    elif s == 'W':
        flg[3] = True

if flg[0] == flg[1] and flg[2] == flg[3]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
a = int(input())
if a == 0:
    print("0")
else:
    digits = []*10
    base = 1
    i = 0
    while a != 0:
        if a%(base*2) == 0:
            digits.append('0')
        else:
            digits.append('1')
            a -= base
        i += 0
        base *= -2
    print(''.join(digits[::-1]))

Measured memory_bytes: 3060
#include <iostream>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};


struct UnionFind {
  vector<int> data;

  UnionFind(int sz) {
    data.assign(sz, -1);
  }

  bool unite(int x, int y) {
    x = find(x); y = find(y); 
    if (x == y) return false;
    if (data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return true;
  }
  
  bool same(int x, int y) {
    x = find(x); y = find(y); 
    return (x == y);
  }

  int find(int k) {
    if (data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  // 要素 k が属する集合の要素の数を求める
  int size(int k) {
    return -data[find(k)];
  }
};


int N, M;
int p[110000];

int main () {
  cin >> N >> M;

  rep(i, N) cin >> p[i];

  UnionFind uni = UnionFind(N+1);

  rep(i, M) {
    int x, y;
    cin >> x >> y;
    uni.unite(p[x], p[y]);
  }

  int ans = 0;

  rep(i, N) {
    if (uni.same(i, p[i])) ans++;
  }

  cout << ans << "\n";
}

Measured memory_bytes: 1024
/*

 Remember, Hope is a good thing... May be the best of things... and No Good thing ever Dies !!!

*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios::sync_with_stdio(0); cout.tie(0);
#define endl "\n"
#define MOD 1000000007
#define MOD1 1e18
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
typedef long double ld;
const ll inf=(1LL<<60)-1;
const ll mxn=1e5;
int dx[]= {-1,1,0,0};
int dy[]= {0,0,-1,1};
long long ans,a[100005];
ll mod(ll x)
{
    ll res=x%MOD;
    while(res<0)
        res+=MOD;
    return res;
}
ll bigmod(ll x,ll n)
{
    ll res=1;
    while(n>0)
    {
        if(n&1)
            res=(res*x)%MOD;
        x=(x*x)%MOD;
        n>>=1;
    }
    return res;
}
/*
sort(v.begin(),v.end(),[&](const pair<ll,ll>&a,const pair<ll,ll>&b)
   {
       if(a.first==b.first)
           return a.second<b.second;
       else
           return a.first>b.first;
   });
   */
void solve()
{
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    string s,ans;
    cin>>s;
    for(ll i=0; i<s.size(); i++)
    {
        if(s.at(i)!='B')
            ans+=s.at(i);
        else
        {
            if(ans.empty())
                continue;
            else
            {
                ll m=ans.size();
                ans.erase(m-1);
            }
        }

    }
    cout<<ans<<endl;
}
int main()
{
    IOS;
    //ll t;
    //cin>>t;
    //while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 3600
import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args)
			throws java.io.IOException{
		Scanner scan = new Scanner(System.in);
		int count =0;
		String [] keys =new String[256];
		Hashtable<String,Integer> index = new Hashtable<String,Integer>();
		while(scan.hasNext()){
			String str = scan.next();
			if(index.containsKey(str)){
				int value = index.get(str);
				index.remove(str);
				index.put(str,value+1);
			}
			else{
				index.put(str,0);
				keys[count++]=str;
			}

		}
		int max =0;
		int maxlen =0;
		String strf="",strl="";
		for(int i=0;i<count;i++){

			if(index.get(keys[i])>=max){
				max = index.get(keys[i]);
				strf =keys[i];
			}

			if(keys[i].length()>= maxlen){
				maxlen=keys[i].length();
				strl =keys[i];
			}

			}
		System.out.println (strf+" "+strl);
		}
}

Measured memory_bytes: 11000
main = do
  n_ <- getLine
  let 
    n = read $ head $ words n_ :: Int
    house = house_ 12 []
    house_ n ls
      | n > 0     = floor : house_ (n-1) ls
      | otherwise = ls
    floor = floor_ 10 []
    floor_ n ls 
      | n > 0     = 0 : floor_ (n-1) ls
      | otherwise = ls
    showh house = showh_ house 1
    showh_ house n 
      | house == []                = ""
      | (mod n 3) == 0 && n /= 12  = " " ++ (unwords $ map show $ head house) ++ "\n####################\n" ++ (showh_ (tail house) (n+1))
      | otherwise                  = " " ++ (unwords $ map show $ head house) ++ "\n" ++ (showh_ (tail house) (n+1))
    func n house =
      if n > 0 
        then do
          line <- getLine
          let
            [b,f,s,r] = map read $ words line :: [Int]
            enter house b f s r
              | b > 1     = enter house 1 (f+(b-1)*3) s r
              | f > 1     = head house : enter (tail house) b (f-1) s r
              | otherwise = (enter_ (head house) s r) : tail house
            enter_ bldg s r
              | s > 1     = head bldg : enter_ (tail bldg) (s-1) r
              | otherwise = (head bldg) + r : tail bldg
            in
              func (n-1) (enter house b f s r)
        else do
          putStr $ showh house
    in
      func n house



Measured memory_bytes: 4312
def Y(flag):
    if flag:
        print('YES')
    else:
        print('NO')

def y(flag):
    if flag:
        print('Yes')
    else:
        print('No')

a,b = map(int,input().split())
l = [a,b,a-1,b-1]
l = sorted(l)
print(l[-1] + l[-2])

Measured memory_bytes: 3060
#include <stdio.h>

#define YEN_50 50
#define YEN_100 100
#define YEN_500 500

int main(void)
{
    int cnt_500yen;
    int cnt_100yen;
    int cnt_50yen;
    int sum;
    int cost;
    int choice_way;
    int i,j,k;

    choice_way = 0;
    scanf("%d", &cnt_500yen);
    scanf("%d", &cnt_100yen);
    scanf("%d", &cnt_50yen);
    scanf("%d", &cost);
    
    for(i=0; i<=cnt_500yen; i++){
        for(j=0; j<=cnt_100yen; j++){
            for(k=0; k<=cnt_50yen; k++){
                //合計金額算出
                sum = YEN_500*i + YEN_100*j + YEN_50*k;
                if(sum == cost){
                    choice_way++;
                }
            }
        }
    }

    printf("%d\n", choice_way);
}

Measured memory_bytes: 128
#!/usr/bin/env python

# First input is:
# "N" -- integer number of things in the sequnece

# Second input is:
# "B1 B2 B3 ... B(N-1)" -- sequence of B, length N-1
# Each B_i is a non-negative integer

# e.g.
# 5
# 12 0 23 1

input() # Discard first input
Blist       = list(map(int,input().split())) # Create list of B, type int

maxB        = max(Blist) 
Bit1        = iter([maxB] + Blist)  #  Creating two iterators to take
Bit2        = iter(Blist + [maxB])  # consecutive pairwise minimum
pairBit     = zip(Bit1,Bit2)        # along the list of B.

maxAsum     = sum(map(min,pairBit)) # Maximum sum of A is sum of minima

print(maxAsum)

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

int main() {
  string s;
  cin >> s;
  vector<char> ans;
  for(int i=0; i<s.size(); i++) {
    char c = s[i];
    if(c == 'B') {
      if(ans.empty()) continue;
      else ans.pop_back();
    }else ans.push_back(c);
  }
  for(int i=0; i<ans.size(); i++) {
    cout << ans.at(i);
    if(i == ans.size()-1) cout << endl;
  }
}

Measured memory_bytes: 256
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))


n,m = readLine_int_list()
g = [[] for j in range(n)]

for i in range(m):
    a,b = readLine_int_list()
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)
    

prenum = [None] * n
parent = [None] * n
lowest = [None] * n
counter = 0
bridges = set()
 
 
def dfs(cur, prev):
    global counter
    prenum[cur] = lowest[cur] = counter
    counter += 1
    for edge in g[cur]:
        if prenum[edge] is not None:
            if edge != prev:
                lowest[cur] = min(lowest[cur], prenum[edge])
            continue
        parent[edge] = cur
        dfs(edge, cur)
        lowest[cur] = min(lowest[cur], lowest[edge])
    if prenum[cur] == lowest[cur]:
        bridges.add((cur, prev) if cur < prev else (prev, cur))

def main():
    dfs(0, -1)
    print(len(bridges)-1)
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 3192
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define pb push_back
#define f first
#define s second
#define pi 3.141592653589793238
using namespace std;

ll gcd( ll a, ll b )
{
	if(b==0)
	{
		return a;
	}
	else
	{
		return gcd( b, a%b );
	}
}
ll lcm (ll a, ll b)
{
	return (a*b)/gcd(a,b);
}

ll power(ll a, ll b)	//a is base, b is exponent
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	if(b%2 == 1)
		return (power(a,b-1)*a)%mod;
	ll q = power(a,b/2);
	return (q*q)%mod;
}
ll n;
ll a[200000];
ll b[200000];
ll c[200000];
ll dp[2000000][10];
ll solve(ll idx,ll act,ll prev)
{
	//cout << idx<< endl;
	if(idx>n) return 0;
	/*if(idx==n) 
	{
		if(prev==0) return max(b[idx],c[idx]);
		else if(prev==1) return max(a[idx],c[idx]);
		else if(prev==2) return max(a[idx],b[idx]);
	}*/
	else if(dp[idx][act]!=-1)return dp[idx][act];
	
	if(act==0) return dp[idx][act] = max(solve(idx+1,1,0)+b[idx],solve(idx+1,2,0)+c[idx]);
	else if(act==1) return dp[idx][act] = max(solve(idx+1,0,1)+a[idx],solve(idx+1,2,1)+c[idx]);
	else if(act==2) return dp[idx][act] = max(solve(idx+1,0,2)+a[idx],solve(idx+1,1,2)+b[idx]);
	
}

int main()
{
	std::ios::sync_with_stdio(false);
	cin >> n;
	for(int i =0;i<2000000;i++) for(int j =0;j<10;j++) dp[i][j]=-1;
	for(int i =1;i<=n;i++) cin >> a[i]>>b[i]>>c[i];		
	if(n==1) return cout << max(a[n],max(b[n],c[n])) << endl,0;
	//ll ma;
	//if(a[1]>=b[1]&&a[1]>=c[1]) ma= 0;
	//else if(b[1]>=a[1]&&b[2]>=c[2]) ma=1;
	//else ma=2;
	ll x = solve(1,0,-1);
	ll y = solve(1,1,-1);
	ll z = solve(1,2,-1);
//	cout << x << " " << y << " " << z << endl;
	cout << max(x,max(y,z)) << endl;

	return 0;
}


//Hello, this is a snippet.


Measured memory_bytes: 165120
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int h, w;
string s[55];

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

bool infield(int x, int y) {
    return 0 <= x && x < w && 0 <= y && y < h;
}
    
int solve() {
    int d[h][w];
    int num_b = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            d[i][j] = inf;
            if (s[i][j] == '#') num_b++;
        }
    }
    d[0][0] = 0;

    queue<P> que;
    queue<int> dist;
    que.push(P(0, 0));
    dist.push(0);
    while (!que.empty()) {
        P p = que.front(); que.pop();
        int dc = dist.front(); dist.pop();
        for (int i = 0; i < 4; i++) {
            int x = p.first + dx[i];
            int y = p.second + dy[i];
            if (infield(x, y) && s[y][x] == '.' && d[y][x] == inf) {
                d[y][x] = dc + 1;
                que.push(P(x, y));
                dist.push(dc+1);
            }
        }
    }
    return (d[h-1][w-1] == inf ? -1 : h*w-num_b-d[h-1][w-1]-1);
}

void input() {
    cin >> h >> w;
    for (int i = 0; i < h; i++) cin >> s[i];
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static int[,] c;

        static void Main(string[] args)
        {
            //[summary]C - Takahashi's Information
            c = GetGrid();

            var combis = new List<Numbers>();
            
            for(int i = 0; i <= c[0, 0]; i++)
            {
                var nums = new Numbers(i, c[0, 0]);
                combis.Add(nums);
            }

            if (IsCorrectNumbers(combis))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }            
        }

        static bool IsCorrectNumbers(List<Numbers> combis)
        {
            foreach (var nums in combis)
            {
                nums.A[1] = c[1, 0] - nums.B[0];
                nums.A[2] = c[2, 0] - nums.B[0];
                nums.B[1] = c[0, 1] - nums.A[0];
                nums.B[2] = c[0, 2] - nums.A[0];

                if (IsMatchCalc(nums))
                {
                    return true;
                }
            }

            return false;
        }

        static bool IsMatchCalc(Numbers nums)
        {
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    if (nums.A[i] + nums.B[j] != c[i, j])
                    {
                        return false;
                    }
                }
            }

            return true;
        }

        static int[,] GetGrid()
        {
            var grid = new int[3, 3];

            for(int i = 0; i < 3; i++)
            {
                var line = ReadLine();

                grid[i, 0] = line[0];
                grid[i, 1] = line[1];
                grid[i, 2] = line[2];
            }

            return grid;
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var array = line.Split(' ');

            return array.Select(x => int.Parse(x)).ToList();
        }
    }

    struct Numbers
    {
        public int[] A { set; get; }
        public int [] B { set; get; }

        public Numbers(int a1, int c)
        {
            A = new int[3];
            B = new int[3];

            A[0] = a1;
            B[0] = c - a1;
        }
    }
}

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

const int MAX = 100000;

int main() {
	int N;
	int64_t K;
	cin >> N >> K;

	int64_t num[MAX+1] = {0};

	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;

		num[a] += b;
	}

	for (int i = 1; i <= MAX; i++) {
		K -= num[i];

		if (K <= 0) {
			cout << i << endl;
			break;
		}
	}
}
		


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while (true) {
      int n = sc.nextInt();
      int x = sc.nextInt();
      if (n == 0 && x == 0) {
        break;
      } else {
        int count = 0;
        for (int i = 1; i < n - 1; i++) {
          for (int j = i + 1; j < n; j++) {
            if (x - j - i > j && x - j - i <= n) {
              count++;
            }
          }
        }
        System.out.println(count);
      }
    }
    sc.close();
  }
}


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

int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;

  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    A.at(i) -= i + 1;
  }

  sort(A.begin(), A.end());

  int b = A.at(N / 2);

  long long ans = 0;

  for (int i = 0; i < N; i++) {
    ans += abs(A.at(i) - b);
  }

  cout << ans << "\n";
}


Measured memory_bytes: 1024
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        w: f64, h: f64, x: f64, y: f64
    }

    let cx = w / 2.0;
    let cy = h / 2.0;
    println!("{} {}", w * h / 2.0, (cx == x && cy == y) as u64);
}


Measured memory_bytes: 4352
#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 n ;
  cin >> n;
  if(n %2 ==0)cout<<n/2<<endl;
  else cout <<n/2+1<<endl;
  return 0;
}


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args&&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#define pi 3.141592653589
#define MOD 1000000007
#define to() int t; cin>>t; while(t--)
#define pb push_back
#define in insert
#define mp make_pair
#define ff first
#define ss second
#define si(s) s.size()
#define fori(it,v) for(it=v.begin();it!=v.end(); it++) 
#define for1(low,high,k) for(int i=low;i<high;i+=k)
#define for11(low,high,k) for(int j=low;j<high;j+=k)
#define for2(low,high,k) for(int i=low;i<=high;i+=k)
#define rev(high,low,k)  for(int i=high;i>=low ;i-=k)
#define all(x) x.begin(), x.end()
#define fil(x,i) memset(x,i,sizeof(x));
#define setbits(x) __builtin_popcount(x)
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout) 
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
const int N=1e6+5;
int vis[N];
void seive(){
	for(int i=1;i<N;i++)
		vis[i]=i;
		
	for(int i=4;i<N;i+=2)
		vis[i]=2;
	for(int i=3;i*i<N;i+=2){
		if(vis[i]==i){
			for(int j=i*i;j<N;j+=2*i)
				if(vis[j]==j) vis[j]=i;
		}
	}
}

inline int gcd(int a, int b)
{
if(a==0)	return b;
return gcd(b%a,a);
}

int main()
{
	boost;
	seive();
	//trace(m);
	int n; cin>>n;
	vector<int>v(n),a(n);
	for1(0,n,1){ cin>>v[i]; a[i]=v[i]; }
	vector<int>cnt(N,0);
	int f1=0;
	for(int i=0;i<n;i++){
		while(a[i]!=1){
			int j=vis[a[i]];
			cnt[j]++;
			while(a[i]%j==0 && a[i]!=1 )a[i]/=j;
			j=vis[a[i]];
		}
	}
	
	for(int i=2;i<N;i++){
		if(cnt[i]>=2){
			f1=1; break;
		}
	}
	
	int f2=1;
	int temp=v[0];
	for1(1,n,1){
		 temp=gcd(temp,v[i]);
		 if(temp==1) break;
	}
	if(temp==1) f2=0;
	
	if(f1==0)
		cout<<"pairwise coprime"<<endl;
		else if(f2==0)
			cout<<"setwise coprime"<<endl;
			else
				cout<<"not coprime"<<endl;
		
return 0;
}


Measured memory_bytes: 18780
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 30;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int x, a, b;

int main()
{
	cin >> x >> a >> b;
	int t = a - b;

	if (t >= 0) {
		cout << "delicious" << endl;
	}
	else if (-t <= x) {
		cout << "safe" << endl;
	}
	else {
		cout << "dangerous" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7


def main():
    a = input()
    b = input()
    c = input()
    t = {'a':a, 'b':b, 'c':c}
    k = 'a'
    if len(a) < 1:
        return 'A'
    while len(t[k]) > 0:
        kk = t[k][0]
        t[k] = t[k][1:]
        k = kk
    if k == 'a':
        return 'A'
    if k == 'b':
        return 'B'
    return 'C'


print(main())


Measured memory_bytes: 7952
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <iterator>
#include <utility>
#define		fast			ios::sync_with_stdio(false);cin.tie(0);cout.tie(NULL);
#define		rep(i,n)		for(int i = 1; i<=n; i++)
#define		all(p)			p.begin(),p.end()
#define		mem(ar,val)		memset(ar, val, sizeof(ar))
#define		sz(c)			(int)c.size()
#define		pb(x)			push_back(x)
#define		mkp(x,y)		make_pair(x,y)
#define 	deb			cout<<"hehehe\n"
#define		ff			first
#define		ss			second
#define 	pf 			printf
#define 	sf 			scanf
#define		ll			long long
#define		pii			pair<int, int>
#define 	pll			pair<ll, ll>
#define 	vll			vector<long long>
#define 	vi			vector<int>
#define		nl			"\n"
#define		pnl			printf("\n");
#define		S(a)			scanf("%lld",&a)
#define		SS(a,b)			scanf("%lld %lld",&a,&b)
#define		SSS(a,b,c)			scanf("%lld %lld %lld",&a,&b,&c)
#define		P(a)			printf("%lld\n",a)
#define		PP(a,b)			printf("%lld %lld\n",a,b)
#define 	total_bit(a)		__builtin_popcount(a)
#define 	UNIQUE(a)		sort(all(a)); a.erase(unique(all(a)), a.end())
#define		FI			freopen("input.txt", "r", stdin);
#define 	FO			freopen("output.txt", "w", stdout);
using namespace std;
const double pi = acos(-1.0);
const int INF = 0x7f7f7f7f;
const int M = 1e9 + 7;
const int N = 1e6+7;
void solve()
{
	char a;
	cin>>a;
	if(a>= 97&& a<=122) cout<<"a\n";
	else cout<<"A\n";
}
int main()
{
//	ll t;
//	S(t);
//	while(t--)
//	{
		solve();
//	}
	return 0;
}


Measured memory_bytes: 3564
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 = Integer.parseInt(sc.next());
		
		int []x = new int [n];
		
		for(int i= 0 ;i < n ;i++) {
			x[i] = Integer.parseInt(sc.next());
		}
		
		Arrays.sort(x);
		int min = n* x[n-1] * x[n-1];
		for(int i = x[0] ; i <= x[n-1] ;i++) {
			int temp = 0;
			for(int j = 0 ; j < n ; j++) {
				temp += Math.pow(i-x[j], 2);
			}
			min = Math.min(temp, min);
		}
		
		System.out.println(min);

	}

}


Measured memory_bytes: 23508
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush()
	sc.Scan()
	ns := sc.Text()
	n, _ := strconv.Atoi(ns)
	sc.Scan()
	ys := sc.Text()
	y, _ := strconv.Atoi(ys)
	// 10000a+5000b+1000c = y, a+b+c=n
	fin := false
	for a := 0; a <= n && fin == false; a++ {
		for b := 0; b <= n; b++ {
			c := n - a - b
			if 0 <= c && a*10000+b*5000+c*1000 == y {
				fmt.Fprintf(out, "%d %d %d\n", a, b, c)
				fin = true
				break
			}
		}
	}
	if fin == false {
		fmt.Fprintln(out, "-1 -1 -1")
	}
}


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

int main(void)
{
	int a[5], k;
	int i, j;
	
	for(i = 0; i < 5; i++) {
		scanf("%d", &a[i]);
	}
	scanf("%d", &k);
	
	for(i = 0; i < 4; i++) {
		for(j = i + 1; j < 5; j++) {
			if(abs(a[i] - a[j]) > k) {
				printf(":(\n");
				return 0;
			}
		}
	}
	
	printf("Yay!\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int mod = 1e9 + 7;

struct range {
  double bot = 1e9, top = -1e9;
  void insert(double x) {
    bot = min(bot, x);
    top = max(top, x);
  }
};

int main() {
  int n;
  cin >> n;
  range x_dec, x_stop, x_inc, y_dec, y_stop, y_inc;
  for (int i = 0; i < n; i++) {
    int x, y;
    string d;
    cin >> x >> y >> d;
    switch (d.front()) {
      case 'R': {
        x_inc.insert(x);
        y_stop.insert(y);
        break;
      }
      case 'L': {
        x_dec.insert(x);
        y_stop.insert(y);
        break;
      }
      case 'U': {
        x_stop.insert(x);
        y_inc.insert(y);
        break;
      }
      case 'D': {
        x_stop.insert(x);
        y_dec.insert(y);
        break;
      }
    }
  }

  double r = 1e18;
  for (ll i = 0; i <= 4e8; i++) {
    double t = i / 2.0;
    double w = max({x_dec.top - t, x_stop.top, x_inc.top + t}) - min({x_dec.bot - t, x_stop.bot, x_inc.bot + t});
    double h = max({y_dec.top - t, y_stop.top, y_inc.top + t}) - min({y_dec.bot - t, y_stop.bot, y_inc.bot + t});
    r = min(r, w * h);
  }
  cout << fixed << setprecision(9);
  cout << r << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <climits>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

int main(int argc, char const* argv[])
{
  string s;
  cin >> s;
  cout << s.substr(0, 4);
  cout << " ";
  cout << s.substr(4, s.size() - 4) << endl;
	return 0;
}


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

int main() {
    unsigned long long n; std::cin >> n;
    int m = -1;
    for (unsigned long long i = 1; i <= std::sqrt(n); i++) {
        if ((n % i) != 0) {
            continue;
        }

        int d = std::max((int)(std::log10(i) + 1), (int)(std::log10(n / i) + 1));
        if (m == -1 || m > d) {
            m = d;
        }
    }

    std::cout << m << std::endl;
    return 0;
}

Measured memory_bytes: 504