akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

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

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<int>ok(100001);
  int l=1;
  while(l*(l-1)/2<ok.size()){ok[l*(l-1)/2]=l;l++;}
  int n;
  cin>>n;
  if(!ok[n])cout<<"No"<<endl;
  else
  {
    l=ok[n];
    cout<<"Yes"<<"\n";
    cout<<l<<"\n";
    map<pair<int,int>,int> ma;
    int cnt=1;
    rep(i,l)
    {
      cout<<l-1<<" ";
      rep(j,l)
      {
        if(i==j)continue;
        if(ma.count({i,j})){cout<<ma[{i,j}]<<" ";continue;}
        if(ma.count({j,i})){cout<<ma[{j,i}]<<" ";continue;}
        cout<<(ma[{i,j}]=cnt++)<<" ";
      }
      cout<<"\n";
    }
  }

  return 0;

}


Measured memory_bytes: 8064
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;

char s[1001];

vector <int> calc(int x, int y, int z) {
    int i, j, k;
    vector <int> v;
    
    if (x >= y) {
        v.push_back(0);
        v.push_back(99);
    } else if (s[x] == '^' || s[x] == '_') {
        int c = 0, x1 = -1, x2 = -1;
        vector <int> p, q;
        
        for (i = x + 1; i < y; i++) {
            if (s[i] == '(') {
                c++;
            } else if (s[i] == ')') {
                c--;
            }
            
            if (s[i] == ',' && c == 1) {
                x1 = i;
            } else if (s[i] == ')' && c == 0) {
                x2 = i;
            }
        }
        
        if (x1 == -1) {
            p = calc(x + 2, y, 0);
            q.push_back(0);
            q.push_back(99);
        } else if (x2 == -1) {
            p = calc(x + 2, x1, 1);
            q = calc(x1 + 1, y, 0);
        } else {
            p = calc(x + 2, x1, 1);
            q = calc(x1 + 1, x2, 1);
        }
        
        for (j = 0; j < p.size(); j++) {
            for (k = 0; k < q.size(); k++) {
                if (s[x] == '^') {
                    v.push_back(max(p[j], q[k]));
                } else {
                    v.push_back(min(p[j], q[k]));
                }
            }
        }
        
        sort(v.begin(), v.end());
        v.erase(unique(v.begin(), v.end()), v.end());
    } else {
        int p = s[x] - '0';
        
        if (p == 0) {
            v.push_back(0);
        } else if (x + 1 == y) {
            if (z == 0) {
                v.push_back(p);
                v.push_back(p * 10);
                v.push_back(p * 10 + 9);
            } else {
                v.push_back(p);
            }
        } else if (s[x + 1] == '?') {
            v.push_back(p);
        } else {
            v.push_back(p * 10 + s[x + 1] - '0');
        }
    }
    
    return v;
}

int main() {
    int q, i, j;
    
    scanf("%d", &q);
    
    for (i = 0; i < q; i++) {
        int n, l, r, m;
        
        scanf("%s", s);
        
        n = strlen(s);
        
        l = 0, r = n, m = (l + r) / 2;
        
        while (r - l > 1) {
            vector <int> v = calc(0, m, 0);
            
            if (v.size() == 1) {
                r = m;
                m = (l + r) / 2;
            } else {
                l = m;
                m = (l + r) / 2;
            }
        }
        
        printf("%d %d\n", calc(0, r, 0)[0], r);
    }
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			int p = sc.nextInt();
			if( (n|m|p) == 0 ) break;
			
			int sum = 0;
			int tgt = 0;
			for(int i=0;i<n;i++) {
				int x = sc.nextInt();
				sum += x;
				if(i+1 == m) tgt = x;
			}
			
			sum *= 100;
			sum -= sum*p/100;
			if(tgt == 0) System.out.println(0);
			else System.out.println(sum / tgt);
		}
	}

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

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

const int INF=1e18;

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

    int N; cin>>N;
    vector<int> a(N),sum(N+1);
    for(int i=0;i<N;i++){
        cin>>a[i];
        sum[i+1]+=sum[i]+a[i];
    }
    
    vector<vector<int>> dp(N+1,vector<int>(N+1,INF));
    for(int i=0;i+1<=N;i++) dp[i][i+1]=0;
    for(int len=2;len<=N;len++){
        for(int l=0;l+len<=N;l++){
            int r=l+len;
            for(int m=l+1;m<r;m++){
                chmin(dp[l][r],dp[l][m]+dp[m][r]+(sum[r]-sum[l]));
            }
        }
    }
    cout<<dp[0][N]<<endl;
    return 0;
}

Measured memory_bytes: 1536
import java.io.*;
import java.util.*;
public class Main{
	public static void main(String args[]) throws Exception{
		Scanner cin= new Scanner(System.in);
		final int W= cin.nextInt();
		final int H= cin.nextInt();
		int x= cin.nextInt();
		int y= cin.nextInt();
		int r= cin.nextInt();
		
		if( x-r>=0 && x+r<=W && y-r>=0 && y+r<=H ){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
	}
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n; cin>>n;
	map<ll, int> mp;
	for(int i = 0; i < n; i++){
		ll x; cin>>x;
		mp[x]++;
	}
	ll ans = 0;
	vector<ll> vec;
	for(auto x : mp){
		if(x.second >= 4)ans = max(ans, x.first*x.first);
		if(x.second >= 2)vec.push_back(x.first);
	}
	sort(vec.rbegin(), vec.rend());
	if(vec.size() >= 2){
		ans = max(ans, vec[0]*vec[1]);
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 6528
import numpy as np
h,w=map(int,input().split())
A= [list(input()) for i in range(h)]
A_np=np.array(A)
del_index=[]
del_row=[]
for i in range(h):
    if A[i].count('.')==len(A[i]):
        del_index.append(i)
for j in range(w):
    c=0
    for i in range(h):
        if A[i][j]=='#':
            c+=1
    if c==0:
        del_row.append(j)
del_index.sort(reverse=True)
del_row.sort(reverse=True)
for j in del_row:
    A_np=np.delete(A_np,j,1)
for i in del_index:
    A_np=np.delete(A_np,i,0)
ans=list(A_np)
if ans ==[]:
    print()
else:
    for i in range(len(ans)):
        print(*ans[i],sep='')

Measured memory_bytes: 18640
#include <stdio.h>
#include <vector>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
using ll = long long;

int main(){
  string str;
  cin >> str >> str;
  string ans;
  ans = 'A';
  ans += str[0];
  ans += 'C';
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
rot_set = [
    (1,2,4,3,1), #0
    (0,3,5,2,0), #1
    (0,1,5,4,0), #2
    (0,4,5,1,0), #3
    (0,2,5,3,0), #4
    (1,3,4,2,1)  #5
]

dice_int = list(map(int, input().split()))
q = int(input())
right_face = []

for _ in range(q):
    a, b = map(int, input().split())
    a_idx = dice_int.index(a)
    b_idx = dice_int.index(b)

    for i in range(6):
        for j in range(4):
            if (a_idx, b_idx) == (rot_set[i][j], rot_set[i][j+1]):
                right_face.append(dice_int[i])

for i in range(q):
    print(right_face[i])


Measured memory_bytes: 5592
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;

struct Edge{
	int src,dst,weight;
	Edge(){}
	Edge(int src,int dst,int weight):src(src),dst(dst),weight(weight){}
};

bool operator<(const Edge& lhs,const Edge& rhs)
{
	return lhs.weight<rhs.weight;
}

bool operator>(const Edge& lhs,const Edge& rhs)
{
	return lhs.weight>rhs.weight;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void Dijkstra(const Graph& g,int begin,vi& cost,vi& prev)
{
	int size=g.size();
	cost.assign(size,INFTY);
	prev.assign(size,-1);
	
	priority_queue<Edge,vector<Edge>,greater<Edge> > pq;
	pq.push(Edge(-1,begin,0));
	cost[begin]=0;
	while(!pq.empty()){
		Edge e=pq.top();
		pq.pop();
		if(prev[e.dst]!=-1)
			continue;
		prev[e.dst]=e.src;
		rep(i,g[e.dst].size()){
			Edge cand=g[e.dst][i]; // candidate
			if(cost[cand.dst]>e.weight+cand.weight){
				cost[cand.dst]=e.weight+cand.weight;
				pq.push(Edge(cand.src,cand.dst,e.weight+cand.weight));
			}
		}
	}
}

int main()
{
	for(int w,h; cin>>w>>h,w|h;){
		vs field(h+2);
		field[0]=field[h+1]=string(w+2,'.');
		rep(i,h){
			cin>>field[i+1];
			field[i+1]='.'+field[i+1]+'.';
		}
		h=field.size();w=field[0].size();
		Graph g(h*w);
		rep(i,h) rep(j,w){
			int di[]={-1,1,0,0};
			int dj[]={0,0,-1,1};
			rep(k,4){
				int ni=i+di[k],nj=j+dj[k];
				if(ni<0 || h<=ni || nj<0 || w<=nj)
					continue;
				g[i*w+j].push_back(Edge(i*w+j,ni*w+nj,field[i][j]=='#' && field[ni][nj]!='#'));
			}
		}
		vi cost,prev;
		Dijkstra(g,0,cost,prev);
		rep(i,h) rep(j,w)
			if(field[i][j]=='&')
				cout<<cost[i*w+j]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {
	auto data = readln.split;
	auto N = data[0].to!int;
	int[] prime_list = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,91,97];
	
	if (1<=N && N<=5) { 0.writeln; return; }
	
	auto order_list = prime_list.map!(a => order(a, N));
	ulong c2 = order_list.count!"a>=b"(2), c4 = order_list.count!"a>=b"(4),
	c14 = order_list.count!"a>=b"(14), c24 = order_list.count!"a>=b"(24), c74 = order_list.count!"a>=b"(74);
	
	writeln( c74 + c4*(c4-1)/2 * (c2-2) + c24*(c2-1) + c14*(c4-1));
}

// how many times can n! be devided by prime
int order(int prime, int n) {
	auto power = prime;
	int result;
	while (true) {
		auto a = n / power;
		if (a != 0) result += a;
		else break;
		power *= prime;
	}
	return result;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	cin >> N;
	vector<int> ANS(N, 0);
	int A;
	rep(i, 0, N-1)
	{
		cin >> A;
		ANS[A-1]++;
	}

	rep(i, 0, N)
	{
		cout << ANS[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 4764
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include<algorithm>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;

int main()
{
    ll N,res,T,A;
    cin >> N;

    if( N % 2 == 0)res = N;
    else res = N * 2;


    cout << res << endl;

}



Measured memory_bytes: 256
#define _DEBUG 1
#define _GLIBCXX_DEBUG

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

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                         \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z     \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll N, ll K) {
  ll result;
  ll a = N % K;
  if (a == 0) {
    result = 0;
  } else {
    result = min(a, abs(a - K));
  }
  cout << result << endl;
}

int main() {
  ll N;
  scanf("%lld", &N);
  ll K;
  scanf("%lld", &K);
  solve(N, K);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
int N; scanf("%d", &N);
int mi; scanf("%d", &mi);
int ma = mi;
for (int i = 1; i < N; i++) {
int a; scanf("%d", &a);
ma = max(a, ma);
mi = min(a, mi);
}
printf("%d\n", ma - mi);
}

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



Measured memory_bytes: 2056
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>

using namespace std;


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

enum Situation{
	RIGHT,
	LEFTDOWN,
	DOWN,
	RIGHTUP,
};

int main(){

	int n;
	int cs=1;

	while(cin>>n&&n!=0){
		cout<<"Case "<<cs<<":"<<endl;
		cs++;
		int field[11][11];
		for(int i = 0; i < n; i++)
			for(int j = 0; j < n; j++)
				field[i][j]=-1;
		int cx=0;
		int cy=0;
		Situation s=RIGHTUP;
		field[0][0]=1;
		int cnt=2;
		while(1){
			if(cy==n-1&&cx==n-1)
				break;
			if(s==RIGHT){
				int ny=cy+dy[LEFTDOWN];
				int nx=cx+dx[LEFTDOWN];
				if(ny>=0&&nx>=0&&ny<n&&nx<n&&field[ny][nx]==-1){
					cy=ny;
					cx=nx;
					field[ny][nx]=cnt;
					cnt++;
					s=LEFTDOWN;
				}
				else{
					ny=cy+dy[RIGHTUP];
					nx=cx+dx[RIGHTUP];
					if(ny>=0&&nx>=0&&ny<n&&nx<n&&field[ny][nx]==-1){
						cy=ny;
						cx=nx;
						field[ny][nx]=cnt;
						cnt++;
						s=RIGHTUP;
					}
				}
			}
			else if(s==LEFTDOWN){
				int ny=cy+dy[LEFTDOWN];
				int nx=cx+dx[LEFTDOWN];
				if(ny>=0&&nx>=0&&ny<n&&nx<n&&field[ny][nx]==-1){
					cy=ny;
					cx=nx;
					field[ny][nx]=cnt;
					cnt++;
					s=LEFTDOWN;
				}
				else{
					// ¶ºÖ¢¯È¢Èç
					ny=cy+dy[DOWN];
					nx=cx+dx[DOWN];
					if(ny>=0&&nx>=0&&ny<n&&nx<n&&field[ny][nx]==-1){
						cy=ny;
						cx=nx;
						field[ny][nx]=cnt;
						cnt++;
						s=DOWN;
					}
					else{
						// ºÖà¢¯È¢Èç
						ny=cy+dy[RIGHT];
						nx=cx+dx[RIGHT];
						if(ny>=0&&nx>=0&&ny<n&&nx<n&&field[ny][nx]==-1){
							cy=ny;
							cx=nx;
							field[ny][nx]=cnt;
							cnt++;
							s=RIGHT;
						}
					}
				}
			}
			else if(s==DOWN){
				int ny=cy+dy[RIGHTUP];
				int nx=cx+dx[RIGHTUP];
				if(ny>=0&&nx>=0&&ny<n&&nx<n&&field[ny][nx]==-1){
					cy=ny;
					cx=nx;
					field[ny][nx]=cnt;
					cnt++;
					s=RIGHTUP;
				}
				else{
					int ny=cy+dy[LEFTDOWN];
					int nx=cx+dx[LEFTDOWN];
					if(ny>=0&&nx>=0&&ny<n&&nx<n&&field[ny][nx]==-1){
						cy=ny;
						cx=nx;
						field[ny][nx]=cnt;
						cnt++;
						s=LEFTDOWN;
					}
				}
			}
			else if(s==RIGHTUP){
				int ny=cy+dy[RIGHTUP];
				int nx=cx+dx[RIGHTUP];
				if(ny>=0&&nx>=0&&ny<n&&nx<n&&field[ny][nx]==-1){
					cy=ny;
					cx=nx;
					field[ny][nx]=cnt;
					cnt++;
					s=RIGHTUP;
				}
				else{
					int ny=cy+dy[RIGHT];
					int nx=cx+dx[RIGHT];
					if(ny>=0&&nx>=0&&ny<n&&nx<n&&field[ny][nx]==-1){
						cy=ny;
						cx=nx;
						field[ny][nx]=cnt;
						cnt++;
						s=RIGHT;
					}
					else{
						ny=cy+dy[DOWN];
						nx=cx+dx[DOWN];
						if(ny>=0&&nx>=0&&ny<n&&nx<n&&field[ny][nx]==-1){
							cy=ny;
							cx=nx;
							field[ny][nx]=cnt;
							cnt++;
							s=DOWN;
						}
					}
				}
			}
		}
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				printf("%3d",field[i][j]);
			}
			cout<<endl;
		}
	}

	return 0;
}

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

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

    int count = 0;
    sort(v.begin(), v.end());
    for (int i = 0; i < n; i++){
        for (int j = i; j < n; j++){
            for (int k = j; k < n; k++){
                if (v[i] == v[j] || v[i] == v[k] || v[j] == v[k]) continue;
                if (v[i] + v[j] <= v[k]) continue;
                count++;
            }
        }
    }

    cout << count << "\n";
}


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

int main() {
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;

	double rate, maxrate=-1.0;
	int water,sugar,maxsugar;
	int x,y;
	for(int i=0; i*a*100<=f; i++) {
		for(int j=0; j*b*100<=f; j++) {
			water=i*a*100+j*b*100;
			maxsugar=(i*a+j*b)*e;
			for(int k=0; k*c<=maxsugar; k++) {
				for(int l=0; l*d<=maxsugar; l++) {
					sugar=k*c+l*d;
					if(sugar>maxsugar) continue;
					if(water+sugar>f)  continue;
					rate=(double)100*sugar/(water+sugar);
					if(maxrate<rate) {
						maxrate=rate;
						x=water;
						y=sugar;
					}
				}
			}
		}
	}
	
	cout<<x+y<<' '<<y<<endl;

	return 0;
}

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

int a, b;

int main() {
	cin>>a>>b;
	if(a==b) {
		cout<<"Draw"<<endl;
	}
	else {
		if(a==1) cout<<"Alice"<<endl;
		if(b==1) cout<<"Bob"<<endl;
		if(a!=1&&b!=1) {
			if(a>b) cout<<"Alice"<<endl;
			if(a<b) cout<<"Bob"<<endl;
		}
	}
}

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

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

typedef long long ll;
using namespace std;

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

    if(n >= 30){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}


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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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




double a[1000005];

int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,k,n;
    double x,ans=0;
    cin >> n >> k;
    for(i=1;i<=n;i++)
    {
        cin >> x;
        x=((x*(x+1.00))/2.00)/x;
        a[i]=a[i-1]+x;
    }
    for(i=k;i<=n;i++)ans=max(ans,a[i]-a[i-k]);
    cout << fixed << setprecision(10) << ans;
    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		String a=s.next(),b=s.next();
		outer:
		for(int i=0;i<a.length();i++) {
			for(int j=0;j<b.length();j++) {
				if(a.charAt((i+j)%a.length())!=b.charAt(j))
					continue outer;
				//System.err.printf("%d %d\n",i,j);
			}
			System.out.println("Yes");
			return;
		}
		System.out.println("No");
	}
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc() {
	string s;
	string ans;

	cin >> s;

	ll a = 0, b = 0;
	rep(i,s.size()){
		if (s[i]=='A') a++;
		else if (s[i]=='B') b++;
	}

	if (a!=0 && b!=0){
		ans = "Yes";
	}
	else{
		ans = "No";
	}

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

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

	solve_abc();

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  ll n;
  cin >> n;
  n--;
  string ans;
  while(n>=0){
    ans=(char)('a'+n%26)+ans;
    n/=26;
    n--;
  }
  cout << ans << endl;
  return 0;
}


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

int main() {

  int A,B,C,D;
  cin >> A >> B >> C >> D;

  if(A+B == C+D){
    cout << "Balanced" << endl;
   }else if (A+B <= C+D){
    cout << "Right" << endl;
  }else{
    cout << "Left" << endl;
  }
    
}

Measured memory_bytes: 256
inpl = lambda: list(map(int,input().split()))
N = int(input())
s = 0
result = False
for _ in range(N):
    a, b = inpl()
    if a == b:
        s += 1
        if s >= 3:
            result = True
    else:
        s = 0
if result:
    print('Yes')
else:
    print('No')


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

int n, m;
vector <int> even;
vector <int> odd;

int MAIN()
{
	cin >> n >> m;
	for(int i = 1; i <= m; i++)
	{
		int t;
		cin >> t;
		if(t % 2 == 0)
			even.push_back(t);
		else
			odd.push_back(t);
	}
	if(odd.size() > 2)
	{
		cout << "Impossible" << endl;
	}
	else
	{
		if(n == 1)
		{
			cout << 1 << endl;
			cout << 1 << endl;
			cout << 1 << endl;
		}
		else
		{
			vector <int> lis;
			if(odd.size() == 0)
			{
				lis.push_back(1);
				for(int i = 0; i < even.size(); i++)
					lis.push_back(even[i]);
				lis[lis.size()-1] --;
			}
			if(odd.size() == 1)
			{
				if(even.size() > 0)
				{
					lis.push_back(odd[0]+1);
					for(int i = 0; i < even.size(); i++)
						lis.push_back(even[i]);
					lis[lis.size()-1] --;
				}
				else
				{
					lis.push_back(1);
					lis.push_back(odd[0]-1);
				}
			}
			if(odd.size() == 2)
			{
				if(even.size() > 0)
				{
					lis.push_back(odd[0]+1);
					for(int i = 0; i < even.size(); i++)
						lis.push_back(even[i]);
					if(odd[1] != 1)
						lis.push_back(odd[1]-1);
				}
				else
				{
					lis.push_back(odd[0]+1);
					if(odd[1] != 1)
						lis.push_back(odd[1]-1);
				}
			}

			vector <int> old;
			if(odd.size() > 0)
				old.push_back(odd[0]);
			for(int i = 0; i < even.size(); i++)
				old.push_back(even[i]);
			if(odd.size() > 1)
				old.push_back(odd[1]);
			for(int i = 0; i < old.size(); i++)
				cout << old[i] << (i == old.size()-1 ? "\n" : " ");
			cout << lis.size() << endl;
			for(int i = 0; i < lis.size(); i++)
				cout << lis[i] << (i == lis.size()-1 ? "\n" : " ");
		}
	}
	return 0;
}

int main()
{
	int start = clock();
	#ifdef LOCAL_TEST
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
	ios :: sync_with_stdio(false);
	cout << fixed << setprecision(16);
	int ret = MAIN();
	#ifdef LOCAL_TEST
		cout << "[Finished in " << clock() - start << " ms]" << endl;
	#endif
	return ret;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

string R1, R2;

int main() {
    cin >> R1 >> R2;
    reverse(R1.begin(), R1.end());
    if (R1 == R2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

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

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;

const long long INF = 1LL << 60;

int main()
{
    vector<bool> is_prime(100001, true);
    is_prime[0] = is_prime[1] = false;
    repd(i, 2, 100001) {
        if (is_prime[i]) {
            for (int j = 2 * i; j <= 100001; j += i) {
                is_prime[j] = false;
            }
        }
    }

    vector<int> cnt(100001, 0);
    rep(i, 100001) {
        if (i % 2 == 1) {
            if (is_prime[i] && is_prime[(i + 1) / 2]) {
                cnt[i]++;
            }
        }
    }

    repd(i, 1, 100001) {
        cnt[i] += cnt[i - 1];
    }

    int Q;
    cin >> Q;

    rep(i, Q) {
        int l, r;
        cin >> l >> r;
        cout << cnt[r] - cnt[l - 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define DIM 22
#define DIM2 2097152
#define modulo 1000000007LL
using namespace std;

long long ng;
int a[DIM][DIM];
long long d[DIM][DIM2];

int bit(int mask, int k)
{
    k--;
    return (mask>>k)&1;
}
int erbit(int &mask, int k)
{
    k--;
    mask^=1<<k;
}
long long F(int n, int mask)
{
    if(d[n][mask] != -1) return d[n][mask];
    if(n == 0) return 1;
    d[n][mask] = 0;
    for(int i = 1; i <= ng; ++i)
        if(a[n][i] && bit(mask, i))
    {
        int nmask = mask;
        erbit(nmask,i);
        d[n][mask] = (d[n][mask] + F(n-1,nmask)) % modulo;
    }
    return d[n][mask];
}
int main()
{
    cin>>ng;
    for(int i = 1; i <= ng; ++i)
        for(int j = 1; j <= ng; ++j)
            cin>>a[i][j];

    memset(d,-1,sizeof(d));
    cout<<F(ng,(1<<ng)-1);
    return 0;
}


Measured memory_bytes: 360704
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	/** 4????????´??°??§??¨???????????§??? */
	private static int MAX = 36;

	/**
	 * AOJ 0008 Sum of 4 Integers
	 */
	public static void main(String[] args) throws IOException {

		ArrayList<Integer> sumList = getInputs();

		for (int sum : sumList) {

			if (sum > MAX) {
				System.out.println(0);
			} else {
				System.out.println(getSumOf4(sum));
			}
		}
	}

	public static int getSumOf4(int sum) {
		int[] total = new int[37];
		for (int a = 0; a <= 9; a++) {
			for (int b = 0; b <= 9; b++) {
				for (int c = 0; c <= 9; c++) {
					for (int d = 0; d <= 9; d++) {
						total[a + b + c + d]++;
					}
				}
			}
		}
		return total[sum];
	}

	public static ArrayList<Integer> getInputs() throws IOException {
		BufferedReader bufferedReader = new BufferedReader(
				new InputStreamReader(System.in));
		ArrayList<Integer> list = new ArrayList<Integer>();
		try {
			String input = null;
			while ((input = bufferedReader.readLine()) != null) {
				list.add(Integer.parseInt(input));
			}
		} finally {
			bufferedReader.close();
		}
		return list;
	}
}

Measured memory_bytes: 19828
#include <bits/stdc++.h>
using namespace std;
int n,m,x;
long long result = 1e5 * 12 + 1;

void dfs (vector<vector<int>>list, int idx, vector<int> understanding,long long total){
    bool isMoreThanX = true;
 
    total += list[idx][0];
    for(int i = 0;i < m;i++) {
        understanding[i] += list[idx][i + 1];
        if(understanding[i] < x) {
            isMoreThanX = false;
        }
    }

    // cout << idx << " "<< total << " " << understanding[0] << " " << understanding[1] << " " << understanding[2] << " " << isMoreThanX << endl;
    if((n - 1 == idx && isMoreThanX) || isMoreThanX) {
        result = min(result,total);
    }
    else {
        for(int i = idx + 1;i < n;i++) {
            dfs(list, i, understanding, total);
        }
    }
}

int main() {
    cin >> n >> m >> x;
    vector<vector<int>> list(n);
    vector<int> understanding(m);
    int tmp;
    for(int i = 0;i < n ;i++) {
        for(int j = 0;j < m + 1;j++) {
            cin >> tmp;
            list[i].push_back(tmp);
        }
    }
    long long total = 0;
    for(int startIdx = 0;startIdx < n;startIdx++) {
        // cout << startIdx << "\n";
        dfs(list,startIdx,understanding,total);
    }
    if(result == 1e5 * 12 + 1) result = -1;
    cout << result << "\n";
    return 0;
}

Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS

//#include "stdafx.h"
#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "list"
#include "deque"
#include "complex"
#include "bitset"
#include "cmath"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include <cassert>
#include "numeric"
#include <cstdio>
#include "random"
#include "chrono"
#include "cstring"

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target_ans("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++)
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb push_back
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
//#define endl '\n'

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;

#define int long long
//#define int unsigned int
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;
typedef vector<vi> vvi;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

vi xx = { 1, 0, -1, 0 };
vi yy = { 0, 1, 0, -1 };
string dir = "LRUD";

const int N = 2e5 + 50, oo = 5e18 + 500;
const int mod = 998244353;
//const int mod = 1e9 + 7;
//const int mod = 1e9 + 9;
const double eps = 1e-6, PI = 2 * acos(0.0);
int n, m, k;
int cnt = 0;
int lg = 18;
vi g[N];
vi rg[N];
vi visit(N, 0);


signed main()
{
	ios::sync_with_stdio(0);
	cout.tie(0); cin.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	cin >> n;

	vi a(n);

	set<int> ind;
	vpii vc;
	for (int i = 0; i < n; i++)
	{
		cin >> m;
		vc.pb({ m, i });
	}

	sort(all(vc));
	ind.insert(-1);
	ind.insert(n);

	for (int i = 0; i < n; i++)
	{
		int x = vc[i].first;
		int j = vc[i].second;

		auto itr = ind.upper_bound(j);
		auto itl = itr;
		itl--;

		int l = *itl;
		int r = *itr;

		cnt += (j - l)*(r - j)*x;
		ind.insert(j);
	}

	cout << cnt;
}



Measured memory_bytes: 28016
import math
import copy
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, q = map(int, input().split())
inputStr = map(str, input())
condi = getSomeInputListInt(q)

string = list(inputStr)

cnt = 0
cntArray = np.zeros(len(string))

tmpstring = []
for i in range(1, len(string)):
    if string[i-1]=="A" and string[i]=="C":
        cnt+=1
    cntArray[i] = cnt

for i in range(q):
    ans = cntArray[condi[i][1]-1] - cntArray[condi[i][0]-1]
    print(int(ans))


Measured memory_bytes: 33764
n,m=map(int,input().split())
ans=1
ps=[]
for i in range(1,int(m**(1/2))+1):
    if m%i:continue
    if n*(i)<=m:ans=max(i,ans)
    if n*(m//i)<=m:ans=max(ans,m//i)
print(ans)

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

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

	int x2 = x;
	int fx = 0;

	while (x2 != 0) {
		fx += x2 % 10;
		x2 /= 10;
	}
	
	if (x % fx == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include                            <iostream>
#include                            <list>
#include                            <stdio.h>
#include                            <math.h>
#include                            <string.h>
#include                            <time.h>
#include                            <stdlib.h>
#include                            <string>
#include                            <bitset>
#include                            <vector>
#include                            <set>
#include                            <map>
#include                            <queue>
#include                            <algorithm>
#include                            <sstream>
#include                            <stack>
#include                            <iomanip>
#include                            <numeric>
#include                            <unordered_map>



using namespace                     std;
#define                             int long long int

#define MOD 1000000007



signed main()
{
    int t = 1; //cin >> t;
    for (int test = 1; test <= t; test++)
    {
        int n, x, y; ; cin >> n;
        vector<int> arr, brr;
        for (int i = 0; i < n; i++)
        {
            cin >> x >> y;
            arr.push_back(x + y);
            brr.push_back(x - y);
        }
        sort(begin(arr), end(arr));
        sort(begin(brr), end(brr));
        cout << max(arr.back() - arr.front(), brr.back() - brr.front());

    }
    return 0;
}

Measured memory_bytes: 6316
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

const int N = 1000000;
void eratosthenes(vector<int> &prime)
{
    rep(0, i, N) prime.at(i) = 1;
    prime.at(0) = prime.at(1) = 0;
    rep(0, i, N)
    {
        if (prime.at(i))
        {
            for (int j = i + i; j < N; j += i)
            {
                prime.at(j) = 0;
            }
        }
    }
}

bool IsPrime(ll num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main()
{
    ll n;
    cin >> n;
    vector<int> prime(1000000);
    eratosthenes(prime);
    vector<ll> value;

    rep(0, i, 1000000)
    {
        if (prime.at(i))
        {
            value.push_back(i);
        }
    }

    ll ans = 0;

    for (auto v : value)
    {
        if (n % v == 0)
        {
            ll c = v;
            while (n % c == 0)
            {
                ans++;
                n /= c;
                c *= v;
            }
        }
    }
    for (auto v : value)
    {
        if (n % v == 0)
        {
            ll c = v;
            while (n % c == 0)
            {
                n /= c;
            }
        }
    }

    if (IsPrime(n) && (n > 1000000))
    {
        cout << ans + 1 << endl;
        return 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 8288
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll x,y,z,k;
  cin >> x >> y >> z >> k;
  ll a[x],b[y],c[z];
  rep(i,x)cin >> a[i];
  rep(i,y)cin >> b[i];
  rep(i,z)cin >> c[i];
  sort(a,a+x);
  sort(b,b+y);
  sort(c,c+z);
  reverse(a,a+x);
  reverse(b,b+y);
  reverse(c,c+z);
  vector<ll> u,v;
  rep(i,x){
    rep(j,y){
      u.push_back(a[i]+b[j]);
    }
  }
  sort(u.begin(),u.end(),greater<ll>());
  ll s=u.size();
  rep(i,min(s,k)){
    rep(j,z){
      v.push_back(u[i]+c[j]);
    }
  }
  sort(v.begin(),v.end(),greater<ll>());
  rep(i,k)cout << v[i] << endl;
return 0;}


Measured memory_bytes: 43236
fun main(arg: Array<String>) {
    val n = readLine()!!.toInt()
    val list: MutableList<Pair<String, Int>> = mutableListOf()
    for (i in 0..n-1) {
        val (a, b) = readLine()!!.split(" ")
        list.add(Pair(a, b.toInt()))
    }
    for (mark in listOf("S", "H", "C", "D")) {
        for (i in 1..13) {
            if (!list.contains(Pair(mark, i))) {
                println(mark + " " + Integer.toString(i))
            }
        }
    }
}


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

using namespace std;

	int main(){
      int N,max;
      cin>>N;
      int V[N],C[N];
      max=0;
      for(int i=0;i<N;i++){
        cin>>V[i];
      }
      for(int i=0;i<N;i++){
        cin>>C[i];
        if(V[i]>C[i]){
          max+=V[i]-C[i];
        }
      }
      cout<<max<<endl;
    }

Measured memory_bytes: 256
#include<iostream>
using namespace std;
class Cube{
public:
  int f[6];
  Cube(){}
  void roll_z(){
    roll(1,2,4,3);
  }
  void roll_y(){
    roll(0,2,5,3);
  }
  void roll_x(){
    roll(0,1,5,4);
  }
  void roll(int i,int j,int k,int l){
    int t=f[i];
    f[i]=f[j];
    f[j]=f[k];
    f[k]=f[l];
    f[l]=t;
  }
  void move(char ch){
    if(ch == 'E') for(int i=0;i<3;i++) roll_y();
    if(ch == 'W') roll_y();
    if(ch == 'N') roll_x();
    if(ch == 'S') for(int i=0;i<3;i++) roll_x();
  }
};
int main(){
  Cube c;
  string com;
  for(int i=0;i<6;i++) cin>>c.f[i];
  cin>>com;
  for(int i=0;i<com.size();i++) c.move(com[i]);
  cout<<c.f[0]<<endl;
}

Measured memory_bytes: 3224
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
typedef long long LL;
template<typename T>
inline void read(T &x){
	int ch = getchar();
	bool flag = false;
	x = 0;
	while((ch < '0' || ch > '9') && ch != '-') ch = getchar();
	if(ch == '-'){
		flag = true;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9'){
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	if(flag) x = -x;
}
int n, k; 
int main(){
	read(n); read(k);
	if(k == 1) puts("0");
	else printf("%d\n", n - k);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class key, class value, class cmp = std::less<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

template<class key, class value, class cmp = std::less_equal<key>>
using ordered_multimap = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;

ll mod = 1e9+7;

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll n;
    cin >> n;
    vector <vector<ll>> arr(n,vector<ll>(n));
    for (int z=0;z<n;z++){
    	for (int x=0;x<n;x++){
    		cin >> arr[z][x];
    	}
    }
    vector <ll> dp(1<<n,0);
    dp[0] = 1;
    for (int z=1;z<(1<<n);z++){
    	int now = __builtin_popcount(z) - 1;
    	for (int x=0;x<n;x++){
    		if (z & (1<<x) && arr[now][x]){
    			dp[z] = dp[z]+dp[z^(1 << x)];
    			dp[z] %= mod;
    		}
    	}
    }
    cout << dp[(1<<n)-1] << endl;
    cin >> n;
}

Measured memory_bytes: 16640
Scanf.scanf "%d %d" (fun h w ->
    let step2 hw0 h1 w1 =
        let hw1 = h1 * w1 in
        let hw2 = h * w - hw0 - hw1 in
        max hw0 (max hw1 hw2) - min hw0 (min hw1 hw2)
    in
    let step1 h0 w0 =
        let hw = h0 * w0 in
        if w0 = w then (
            let h1 = h - h0 in
            let a1 = step2 hw h1 (max 1 ((w0 + 0) / 2)) in
            let a2 = step2 hw h1 (max 1 ((w0 + 1) / 2)) in
            let a3 = step2 hw (max 1 ((h1 + 0) / 2)) w0 in
            let a4 = step2 hw (max 1 ((h1 + 1) / 2)) w0 in
            min (min a1 a2) (min a3 a4)
        ) else (
            let w1 = w - w0 in
            let a1 = step2 hw h0 (max 1 ((w1 + 0) / 2)) in
            let a2 = step2 hw h0 (max 1 ((w1 + 1) / 2)) in
            let a3 = step2 hw (max 1 ((h0 + 0) / 2)) w1 in
            let a4 = step2 hw (max 1 ((h0 + 1) / 2)) w1 in
            min (min a1 a2) (min a3 a4)
        )
    in
    let a1 = step1 (max 1 ((h + 0) / 3)) w in
    let a2 = step1 (max 1 ((h + 2) / 3)) w in
    let a3 = step1 h (max 1 ((w + 0) / 3)) in
    let a4 = step1 h (max 1 ((w + 2) / 3)) in
    min (min a1 a2) (min a3 a4) |> Printf.printf "%d\n"
)

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back
#define F first
#define S second


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

bool app[50][50][50][50];
char lr[53][53],rr[53][53];
string ans;

main(){
  int w,h;
  while(cin>>w>>h,w|h){
    memset(app,0,6250000);
    rep(i,h)scanf(" %s %s ",lr[i],rr[i]);

    int rsx,rsy,lsx,lsy;
    rep(i,h)rep(j,w){
      if(lr[i][j]=='L')lsx=i,lsy=j;
      if(rr[i][j]=='R')rsx=i,rsy=j;
    }
    ans="No";
    queue<pair<PI,PI> > Q;
    Q.push(mp(mp(lsx,lsy),mp(rsx,rsy)));

    while(!Q.empty()){
      PI tp=Q.front().F;
      int clx,cly,crx,cry;
      clx=tp.F,cly=tp.S;
      tp=Q.front().S;Q.pop();
      crx=tp.F,cry=tp.S;
      if(lr[clx][cly]=='%' && rr[crx][cry]=='%'){
        ans="Yes";
        break;
      }
      if(lr[clx][cly]=='%' || rr[crx][cry]=='%')continue;
      app[clx][cly][crx][cry]=true;

      rep(i,4){
        int nrx=crx+dx[i],nlx=clx+dx[i],nry=cry+dy[i],nly=cly-dy[i];
        if(nrx<0 || nry<0 || nrx>=h || nry>=w || rr[nrx][nry]=='#')nrx=crx,nry=cry;
        if(nlx<0 || nly<0 || nlx>=h || nly>=w || lr[nlx][nly]=='#')nlx=clx,nly=cly;
        if(app[nlx][nly][nrx][nry])continue;
        app[nlx][nly][nrx][nry]=true;
        Q.push(mp(mp(nlx,nly),mp(nrx,nry)));
      }
/*      
      rep(i,h){
        rep(j,w){
          if(clx==i && cly==j)cout<<'L';
          else if(lr[i][j]=='L')cout<<'.';
          else cout<<lr[i][j];
        }
        cout<<" ";
        rep(j,w){
          if(crx==i && cry==j)cout<<'R';
          else if(rr[i][j]=='R')cout<<'.';
          else cout<<rr[i][j];
        }
        cout<<endl;
      }
      cout<<endl;
*/
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 7960