akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct {
	char arierukamo[256];
} num_t;

num_t create_num(int l,int u) {
	num_t ret;
	int i;
	for(i=0;i<256;i++)ret.arierukamo[i]=(l<=i && i<=u)?1:0;
	return ret;
}

typedef int (*p_op)(int,int);

int add(int a,int b){return a+b;}
int sub(int a,int b){return a-b+256;}
int mul(int a,int b){return a*b;}
int waru(int a,int b){return a/b;}

num_t calc_num(const num_t *a,const num_t *b,p_op op) {
	num_t ret;
	int i,j;
	for(i=0;i<256;i++)ret.arierukamo[i]=0;
	for(i=0;i<256;i++) {
		for(j=0;j<256;j++) {
			if(a->arierukamo[i] && b->arierukamo[j]) {
				ret.arierukamo[op(i,j)%256]=1;
			}
		}
	}
	return ret;
}

int main(void) {
	int m,n,i;
	char names[100][32];
	num_t vars[100];
	num_t stack[100];
	int stack_pos=0;
	int error_flag=0;
	if(scanf("%d",&m)!=1)return 1;
	for(i=0;i<m;i++) {
		int l,u;
		if(scanf("%s%d%d",names[i],&l,&u)!=3)return 1;
		vars[i]=create_num(l,u);
	}
	if(scanf("%d",&n)!=1)return 1;
	for(i=0;i<n;i++) {
		char data[1024];
		char* end;
		int num;
		if(scanf("%s",data)!=1)return 1;
		if(error_flag)continue;
		num=(int)strtol(data,&end,10);
		if(*end=='\0') {
			stack[stack_pos++]=create_num(num,num);
		} else if(strcmp(data,"+")==0) {
			if(stack_pos<2)error_flag=1;
			else {
				stack_pos--;
				stack[stack_pos-1]=calc_num(&stack[stack_pos-1],&stack[stack_pos],add);
			}
		} else if(strcmp(data,"-")==0) {
			if(stack_pos<2)error_flag=1;
			else {
				stack_pos--;
				stack[stack_pos-1]=calc_num(&stack[stack_pos-1],&stack[stack_pos],sub);
			}
		} else if(strcmp(data,"*")==0) {
			if(stack_pos<2)error_flag=1;
			else {
				stack_pos--;
				stack[stack_pos-1]=calc_num(&stack[stack_pos-1],&stack[stack_pos],mul);
			}
		} else if(strcmp(data,"/")==0) {
			if(stack_pos<2 || stack[stack_pos-1].arierukamo[0]!=0)error_flag=1;
			else {
				stack_pos--;
				stack[stack_pos-1]=calc_num(&stack[stack_pos-1],&stack[stack_pos],waru);
			}
		} else {
			int j;
			int index=-1;
			for(j=0;j<m;j++) {
				if(strcmp(data,names[j])==0) {
					index=j;
					break;
				}
			}
			if(index<0)error_flag=1; else stack[stack_pos++]=vars[j];
		}
	}
	if(stack_pos!=1)error_flag=1;
	puts(error_flag?"error":"correct");
	return 0;
}

Measured memory_bytes: 620
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

int A,B,C,N,W,H,ans,dp[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){
	if(A <= C && B >= C){
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}
}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> A >> B >> C;
	
	solve();
	#ifdef DEBUG
	debug();
	#endif
	// answer();

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

const ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
int compare(string a, string b) {
	int i;
	for (i = 0; i < a[i] != '\0'; i++) {
		if (b[i] == '\0')
			return -1;
		else if (a[i] < b[i])
			return 1;
		else if (a[i] > b[i])
			return -1;
	}
	if (b[i] != '\0')
		return 1;
	else
		return 0;
}
int ans[333333],k,n,p;
void check(int a) {
	if (ans[a] == 0) {
		ans[a - 1]--;
		ans[a]=k;
		p--;
      if(p>0)
		check(a - 1);
	}
}
int main() {
	int i;
	cin >> k >> n;
	if (k % 2 == 0) {
		for (i = 0; i < n; i++) {
			if (i == 0)
				cout << k/2;
			else
				cout << k;
			cout << " ";
		}
		return 0;
	}
	if (k == 1) {
		if (n % 2 == 0)
			n /= 2;
		else
			n = n / 2 + 1;
		for (i = 0; i < n; i++)
			cout << "1 ";
		return 0;
	}
	for (i = 0; i < n; i++)
		ans[i] = k / 2 + 1;
	p = n / 2;
	while (p > 0) {
		ans[n - 1]--;
      p--;
      if(p>0)
		check(n - 1);
	}
	for (i = 0; i < n; i++){
      if(ans[i]>0)
		cout << ans[i] << " ";
      else
        break;
    }
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI=acos(-1);
const int INF = numeric_limits<int>::max();

int main(){
    int a, b;
    cin >> a >> b;

    if (a >=10 || b >= 10) cout << -1 << endl;
    else cout << a * b << endl;

    return 0;
    
}

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

int main() {
    ll x;
    cin >> x;
    for (ll a = -201; a <= 201; a++) {
        for (ll b = -201; b <= 201; b++) {
            ll a5 = a * a * a * a * a;
            ll b5 = b * b * b * b * b;
            if (a5 - b5 == x) {
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>

#define SIZE 100001

int main(){
    int n, t, a;
    scanf("%d", &n);
    scanf("%d", &t);
    scanf("%d", &a);

    int h[SIZE];
    double tt[SIZE];
    double hyouka;
    double min;
    int mini;
    for(int i=0; i<n; i++){
	scanf("%d", &h[i]);
	tt[i] = t - h[i]*0.006;
	hyouka = tt[i] - a;
	if(hyouka<0)hyouka=-hyouka;
	if(i==0 || min>hyouka){
	    min = hyouka;
	    mini = i;
	}
    }

    printf("%d\n", mini+1);
    


    return 0;
}


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

int main(void){
	unsigned char *word = "abcdefghijklmnopqrstuvwxyz";
	short cnt[256] = {};
	int c;

	for(;;){
		// Input
		c = getchar();
		// EOF Check
		if( c == EOF ){
			break;
		}
		// Work Check
		if( isupper(c) ){
			cnt[tolower(c)] ++;
		} else if( islower(c) ){
			cnt[c] ++;
		}
	}

	// Output
	for(c=0;c<26;c++){
		printf("%c : %d\n",word[c],cnt[word[c]]);
	}

	return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

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

typedef long long ll;

int main()
{
	ll n, a, b;
	cin >> n >> a >> b;
	ll ans;
	if ((a + b) % 2 == 0) {
		ans = abs(a - b) / 2;
	} else {
		ll ma, mi;
		ma = max(a, b);
		mi = min(a, b);
		ans = min(mi - 1, n - ma);
		ans += (ma + 1 - mi) / 2;
	}
	cout << ans;
	return 0;
}

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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> x;
    x.push_back(a);
    x.push_back(b);
    x.push_back(c);
    sort(x.begin(), x.end());
    if (x[0] + x[1] == x[2])
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}

Measured memory_bytes: 256
import java.io.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {

		int N = nextInt();
		int A = nextInt();
		int B = nextInt();
		String S = nextString();

		int a=0,b=0;
		int ac=0;
		for(int i=0;i<N;i++){
			if(S.charAt(i)=='a'){
				a++;
				if(ac <A+B ){
					System.out.println("Yes");
					ac++;
				}else{
					System.out.println("No");
				}
			}else if(S.charAt(i)=='b'){
				b++;
				if(ac <A+B && b<=B){
					System.out.println("Yes");
					ac++;
				}else{
					System.out.println("No");
				}
			}else{
				System.out.println("No");
			}
		}
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nestInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nestLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nestStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 34464
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;
const double pi=2*acos(0.0);
//abc169d

ll prime_factor(ll n){
    map<ll,ll> res;
    for(ll i=2;i*i<=n;i++){
        while(n%i==0){
            ++res[i];
            n/=i;
        }
    }
    if(n!=1) res[n]=1;
    ll ans=0;
    V<ll> d;
    for(ll i=1;i*i<=1000000000000;i++)d.push_back(i*(i+1)/2);
    for(auto p:res){
        ll x=ub(all(d),p.sc)-d.begin();
        ans+=x;
    }
    return ans;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    cout<<prime_factor(n)<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/


Measured memory_bytes: 11592
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
typedef pair<int, int> P;
int N;
struct edge {
  ll u, v, cost;
  edge(ll a, ll b, ll c) {
    u = a, v = b, cost = c;
  }
};
// union - find tree !!!!!!!!!!!!!!!!!!!!!!!!!
vector<int> par; //oya
vector<int> rnk; //ki no hu ka sa
// n要素で初期化
void init(int n){
    par.resize(n);rnk.resize(n);
    FOR(i, 0, n){par[i] = i;rnk[i] = 0;}
}
//木の根を求める
int find(int x){
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
}
//xとyの属する集合を併合
void unite(int x, int y){
    x = find(x);y = find(y);
    if(x == y) return;
    if(rnk[x] < rnk[y])par[x] = y;
    else{par[y] = x;if(rnk[x] == rnk[y]) rnk[x]++;}
    return;
}
bool isSame(int x, int y){return find(x) == find(y);}

// クラスカル法(最小全域木求めるやつ)
bool comp(edge& e1, edge& e2){
  return e1.cost < e2.cost;
}

vector<edge> es;
ll kruskal(){
  sort(es.begin(), es.end(), comp);
  init(N);
  ll res = 0;
  FOR(i,0,es.size()){
    edge e = es[i];
    if(!isSame(e.u, e.v)){
      unite(e.u, e.v);
      res += e.cost;
    }
  }
  return res;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  vector<P> x(N), y(N);
  FOR(i,0,N) {
    int xx, yy; cin >> xx >> yy;
    x[i] = P(xx, i);
    y[i] = P(yy, i);
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  FOR(i,0,N-1) {
    es.push_back(edge(x[i].second, x[i+1].second, abs(x[i].first - x[i+1].first)));
    es.push_back(edge(y[i].second, y[i+1].second, abs(y[i].first - y[i+1].first)));
  }
  cout << kruskal() << endl;
  return 0;
}

Measured memory_bytes: 10096
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>

using namespace std;
#define ll long long
#define pb push_back

// 前に&をつけるとvectorの参照渡しになる
void solve(int x, int y, vector<vector<char> >& tile, int H, int W, vector<vector<bool> >& flag) {
    // cout << "(" << y << ","<< x << endl;
    char flutes = tile[y][x];
    flag[y][x] = false;
    
    if (y + 1 < H) {
        if (tile[y + 1][x] == flutes && flag[y + 1][x]) {
            solve(x, y + 1, tile, H, W, flag);
        }
    }
    if (y - 1 >= 0) {
        if (tile[y - 1][x] == flutes && flag[y - 1][x]) {
            solve(x, y - 1, tile, H, W, flag);
        }
    }
    if (x + 1 < W) {
        if (tile[y][x + 1] == flutes && flag[y][x + 1]) {
            solve(x + 1, y, tile, H, W, flag);
        }
    }
    if (x - 1 >= 0) {
        if (tile[y][x - 1] == flutes && flag[y][x - 1]) {
            solve(x - 1, y, tile, H, W, flag);
        }
    }
    return;
}

int main() {

    int H, W;
    while(true) {
        cin  >> H >> W;
        if (W==0 && H == 0) break;
        vector<vector<char> > tile(H, vector<char>(W));
        vector<vector<bool> > flag(H, vector<bool>(W, true));
        int count = 0;

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                cin >> tile[i][j];
            }
        }

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (flag[i][j]) {
                    count++;
                    // cout << "f : " << i << "," << j << endl;
                    solve(j, i, tile, H, W, flag);
                }
            }
        }

        cout << count << endl;
    }

}



Measured memory_bytes: 4724
#include<iostream>
using namespace std;
int main() {
	int n, y;
	cin >> n >> y;
	int a, b;
	for (a = 0; a <= n; a++) {
		for (b = 0; b <= n; b++) {
			if(a*10000+b*5000+(n-(a+b))*1000==y&&a+b<=n){
				cout << a << ' ' << b << ' ' << n - (a + b) << endl;
				return 0;
			}
		}
	}
	cout << -1 << ' ' << -1 << ' ' << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a;
    cin>>a ;
    if(a==25) {
        cout<< "Christmas\n";
    }else if (a==24) {
        cout<< "Christmas Eve\n";
    }else if (a==23) {
        cout<< "Christmas Eve Eve\n";
    }else {cout<< "Christmas Eve Eve Eve\n";}
}

Measured memory_bytes: 256
//
// Created by SUN on 2018-12-27.
//

#include <iostream>

#define ll long long
using namespace std;

ll patty[51]; // N level patty's size
ll level[51]; // N level burger's size

ll solution(ll N, ll X) {

    if (N == 0) {
        return 1;
    }

    ll ret = 0;

    ll part1 = 1;
    ll part2 = part1 + 1;
    ll part3 = part2 + level[N - 1];
    ll part4 = part3 + 1;
    ll part5 = part4 + level[N - 1];

    if (part1 <= X && X < part2) {
        ret = 0;
    } else if (part2 <= X && X < part3) {
        ret = solution(N - 1, X - 1);
    } else if (part3 <= X && X < part4) {
        ret = patty[N - 1] + 1;
    } else if (part4 <= X && X < part5) {
        ret = patty[N - 1] + 1 + solution(N - 1, X - part4 + 1);
    } else {
        ret = patty[N - 1] * 2 + 1;
    }

    return ret;
}


int main() {
    long long N, X;
    cin >> N >> X;

    patty[0] = 1;
    for (int i = 1; i <= 50; i++) {
        patty[i] = patty[i - 1] * 2 + 1;
    }
    level[0] = 1;
    for (int i = 1; i <= 50; i++) {
        level[i] = 3 + level[i - 1] * 2;
    }
    ll ans = solution(N, X);

    cout << ans << '\n';

    return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  
  if ((A + B) % 2 == 0) {
    cout << (A + B) / 2 << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	int N; cin>>N;
	vi A(N+1),B(N+1);
	rp(i,1,N+1){
		cin>>A[i];
		A[i] += A[i-1];
	}
	rp(i,1,N+1){
		cin>>B[i];
		B[i] += B[i-1];
	}

	// rp(i,0,N+1){cout<<A[b]<<" "<<B[i]<<"\n";}//

	int ans = 0;

	rp(i,1,N+1){
		ans =max(ans, A[i]+B[N]-B[i-1]);
	}

	ote(ans);
}


Measured memory_bytes: 256
//lec05
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<stdio.h>
#include<fstream>
#include<stdlib.h>
#include<math.h> 
#include<queue>
#include<string.h>
#include<stack>


using namespace std;
struct Node {
  Node* r;
  Node* l;
  int key,priotity;
};

Node* rightRotate(Node* t){
	Node* s=t->l;
	t->l=s->r;
	s->r=t;
	return s;
}

Node* leftRotate(Node* t){
	Node* s=t->r;
	t->r=s->l;
	s->l=t;
	return s;
}

Node* insert(Node *t,int key,int priotity){
	if(t==NULL){
		Node* t=new Node;
		t->l=NULL;
		t->r=NULL;
		t->key=key;
		t->priotity=priotity;
		return t;
	}

	if(key==t->key){
		return t;
	}
	if(key < t->key){
		t->l=insert(t->l,key,priotity);
		if(t->priotity < t->l->priotity){
			t=rightRotate(t);
		}
	}
	else{
		t->r=insert(t->r,key,priotity);
		if(t->priotity < t->r->priotity){
			t=leftRotate(t);
		}
	}
	return t;
}


Node* del(Node* t,int key){
	if(t==NULL){
		return NULL;
	}
	if(key==t->key){
		if(t->l==NULL&&t->r==NULL)return NULL;
		else if(t->l==NULL)t=leftRotate(t);
		else if(t->r==NULL)t=rightRotate(t);
		else{
			if(t->l->priotity > t->r->priotity)t=rightRotate(t);
			else t=leftRotate(t);
		}
		return del(t,key);
	}
 	if(key < t->key){
 		t->l=del(t->l,key);
 	}
  	else {
  		t->r=del(t->r,key);
  	}
  	return t;
}

void find(Node* t,int key){
	while(t!=NULL&&key!=t->key){
		if(key < t->key){
			t=t->l;
		}
		else{
			t=t->r;
		}
	}
	if(t==NULL){
		cout<<"no"<<endl;
	}
	else{
		cout<<"yes"<<endl;
	}
}


void inorder(Node* t){
	if(t==NULL)return;
	inorder(t->l);
	cout<<" "<<t->key;
	inorder(t->r);
}

void preorder(Node* t){
	if(t==NULL)return;
	cout<<" "<<t->key;
	preorder(t->l);
	preorder(t->r);
}


int main(){
	int n;
	cin>>n;
	string in;
	int k,p;
	Node* root=NULL;
	for(int i=0;i<n;i++){
		cin>>in;
		if(in=="insert"){
			cin>>k>>p;
			root=insert(root,k,p);
		}
		else if(in=="find"){
			cin>>k;
			find(root,k);
		}
		else if(in=="delete"){
			cin>>k;
			root=del(root,k);
		}
		else{
			inorder(root);
			cout<<endl;
			preorder(root);
			cout<<endl;
		}
	}
}


Measured memory_bytes: 9408
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
using namespace std;

int main (void){
	char s[200001];
	long long int a[200001],i,n,count=0,bs=0;
	cin >> s;
	n=strlen(s);
	for(i=0;i<n;i++){
		if(s[i]=='B') a[i]=1;
		else a[i]=0;
	}
	if(n==1){
		cout << 0 << endl;
		return 0;
	}
	for(i=n-1;i>=0;i--){
		if(a[i]==1){
			bs++;
			if(n-i>bs) count=count+n-i-bs;
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 2048
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int d = sc.nextInt();
		int[] numbers = new int[m];
		for (int i = 0; i < m; i++) {
		    numbers[i] = sc.nextInt();
		}
		int[][] dayNums = new int[d][m];
		for (int i = 0; i < d; i++) {
		    for (int j = 0; j < m; j++) {
		        dayNums[i][j] = sc.nextInt();
		    }
		}
		for (int i = 0; i < d; i++) {
		    boolean flag = true;
		    while (flag && n >= 0) {
		        flag = false;
		        for (int j = 0; j < m; j++) {
		            int x = dayNums[i][j];
		            if (x == -1) {
		                continue;
		            }
		            if (n % numbers[j] != x) {
		                flag = true;
		                n -= (n % numbers[j] - x + numbers[j]) % numbers[j];
		                break;
		            }
		        }
		    }
		}
		if (n < 0) {
		    System.out.println(-1);
		} else {
		    System.out.println(n);
		}
	}
}



Measured memory_bytes: 30232
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main(void) {
    int n,k;
    cin>>n>>k;
    vi v(n);rep(i,n)cin>>v[i];
    
    fin(ceil( (n-1)/(double)(k-1)));

}


Measured memory_bytes: 640
//
//AtCoder Beginner Contest 140
//A - Password
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int n;

    cin >> n;

    int ans = 1;
    REP(i, 3) ans *= n;

    cout << fixed;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
x, k, d = map(int, input().split(' '))
b = x + k * d;
if b > 0:
    a = int(b / (2 * d))
    if a <= k:
        print(min(b-a*2*d, -(b-(a+1)*2*d)))
    else:
        print(b-k*2*d)
else:
    print(-b)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
#define y1 cgbngfgn
#define pb push_back
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fir first
#define m_p make_pair
#define sec second
#define files(name) freopen(name".in","r",stdin); freopen (name".out","w",stdout);
#define time pdojegoritg
#define left eorgjrptgj
#define right rtyjtokh
#define int ll
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int arr=4e7+100;

signed main()
{
    int n,a,b;
    cin>>n>>a>>b;

    if (abs(a-b)%2==1)
        cout<<"Borys"; else
        cout<<"Alice"<<'\n';
}
/*
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define min(a,b) (a<b?a:b)
#define ll long long
//#define file
using namespace std;

int a[51][51],b[51][51],c[51],d[51],T,n,i,j,k,l,ans,t;
bool bz1[51],bz2[51],Bz[51],Bz2[51];

void add(int t) {if (bz1[t] && bz2[t] && !Bz[t]) d[++::t]=t,Bz[t]=1;}
void bfs(int st)
{
	static int d[51];
	int i,h=0,t=1;
	d[1]=st;
	while (h<t)
	{
		++h;Bz2[d[h]]=1;
		fo(i,1,n)
		if (a[d[h]][i] && b[d[h]][i] && !Bz[i])
		Bz[i]=1,d[++t]=i,::d[++::t]=i;
	}
}
void work(int st,int Ans)
{
	static int c[51];
	int i,j,k,l;
	
	memset(bz1,0,sizeof(bz1));memset(bz2,0,sizeof(bz2));
	memset(Bz,0,sizeof(Bz));memset(Bz2,0,sizeof(Bz2));
	memset(c,0,sizeof(c));
	t=1;d[1]=st;Bz[st]=1;bfs(st);
	fo(i,1,n-1)
	{
		fo(j,i+1,n)
		if (a[i][j])
		++c[i],++c[j];
	}
	fo(i,1,n) if (c[i]==1) bz1[i]=1;
	Ans+=n-t;
	
	while (t)
	{
		l=d[t],--t;
		if (!Bz2[l])
		{
			Bz2[l]=1;
			fo(i,1,n)
			if (a[l][i])
			{
				--c[i];
				if (c[i]==1) bz1[i]=1,add(i);
			}
		}
		fo(i,1,n) if (b[l][i]) bz2[i]=1,add(i);
	}
	
	fo(i,1,n) if (!Bz[i]) return;
	ans=min(ans,Ans);
}

int main()
{
	#ifdef file
	freopen("agc027f.in","r",stdin);
	freopen("b.out","w",stdout);
	#endif
	
	scanf("%d",&T);
	for (;T;--T)
	{
		memset(a,0,sizeof(a)),memset(b,0,sizeof(b)),memset(c,0,sizeof(c));
		scanf("%d",&n);
		fo(i,1,n-1) scanf("%d%d",&j,&k),a[j][k]=a[k][j]=1,++c[j],++c[k];
		fo(i,1,n-1) scanf("%d%d",&j,&k),b[j][k]=b[k][j]=1;
		
		ans=114514;
		fo(i,1,n)
		if (c[i]==1)
		{
			fo(j,1,n) if (a[i][j]) break;
			fo(k,1,n)
			if (!a[i][k] && i!=k && j!=k)
			{
				a[i][j]=a[j][i]=0,a[i][k]=a[k][i]=1;
				work(i,1);
				a[i][j]=a[j][i]=1,a[i][k]=a[k][i]=0;
			}
			work(i,0);
		}
		printf("%d\n",(ans>n)?-1:ans);
	}
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}

Measured memory_bytes: 3800
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        
        long N =sc.nextLong();
        long K =sc.nextLong();
        
        long answer = K;
        for (int i=1;i<N;i++){
            if (N==1){
                break;
            }else{
                
                answer *= K - 1;
            
            
            }
        }
         
    System.out.println(answer);
        
        
        
        
        
        
    }
}


Measured memory_bytes: 35624
#include <bits/stdc++.h>
#include <atcoder/convolution>

/**
 * @docs join.md
 */
namespace haar_lib {
  template <typename Iter>
  std::string join(Iter first, Iter last, std::string delim = " "){
    std::stringstream s;

    for(auto it = first; it != last; ++it){
      if(it != first) s << delim;
      s << *it;
    }

    return s.str();
  }
}


int main(){
  namespace hl = haar_lib;
  namespace ac = atcoder;

  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  int N, M; std::cin >> N >> M;
  std::vector<int> a(N), b(M);
  for(int i = 0; i < N; ++i) std::cin >> a[i];
  for(int i = 0; i < M; ++i) std::cin >> b[i];

  auto c = ac::convolution(a, b);

  std::cout << hl::join(c.begin(), c.begin() + (N + M - 1)) << "\n";

  return 0;
}


Measured memory_bytes: 31856
K = int(input())

from collections import deque
q = deque(range(1, 10))
for _ in range(K - 1):
    d = q.popleft()
    if d % 10 > 0:
        q.append(d * 10 + d % 10 - 1)
    q.append(d * 10 + d % 10)
    if d % 10 < 9:
        q.append(d * 10 + d % 10 + 1)
print(q.popleft())


Measured memory_bytes: 11912
# include <iostream>
using namespace std; 
int main(){
  int l, r, d,count,i; 
  cin>>l>>r>>d; 
  count=0;
  for(i=l;i<=r;i++){
    if(i%d==0){
      count++;
    }
  }
  cout<<count; 
  return 0;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

string s;
int x, y;

bool dp[2][4010][20010];
const int B = 10000;

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

	int d = 0;
	int cnt = 0;
	vi vec;

	rep(i, s.size()) {
		if (s[i] == 'F') {
			++cnt;
		} else {
			vec.pb(cnt);
			cnt = 0;
			d ^= 1;
		}
	}
	if (cnt) vec.pb(cnt);

	int c[2] = {};
	rep(i, 2) {
		dp[i][0][B] = 1;

		for (int j = i; j < vec.size(); j += 2) {
			rep(k, 20010) if (dp[i][c[i]][k]) {
				if (j != 0) {
					dp[i][c[i]+1][k-vec[j]] = 1;
				}
				dp[i][c[i]+1][k+vec[j]] = 1;
			}
			++c[i];
		}
	}

	bool ok = dp[0][c[0]][x+B] && dp[1][c[1]][y+B];
	puts(ok ? "Yes" : "No");

	return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  sort(h.begin(), h.end());
  int min_d = 1e9 + 7;
  for (int i = 0; i + k - 1 < n; ++i) {
    int h_max = h[i + k - 1];
    int h_min = h[i];
    min_d = min(min_d, h_max - h_min);
  }
  cout << min_d << endl;
  return 0;
}

Measured memory_bytes: 3704
def main():
    mod = 10 ** 9 + 7
    X, Y = map(int, input().split(" "))
    if (2 * X - Y) % 3 == 0 and (2 * Y - X) % 3 == 0:
        s = (2 * X - Y) // 3
        t = (2 * Y - X) // 3
        if s < 0 or t < 0:
            print(0)
        else:
            numerator = 1
            denominator = 1
            for i in range(s + 1, s + t + 1):
                numerator = (numerator * i) % mod
            for i in range(1, t + 1):
                denominator = (denominator * i) % mod
            print(numerator * pow(denominator, mod - 2, mod) % mod)
            # math.factorialはTLEになりそう?
    else:
        print(0)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e16;

/*
<url:>
問題文============================================================

=================================================================

解説=============================================================

================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N, A, B; cin >> N >> A >> B;
	if ((B - A) % 2 == 0) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Borys" << endl;
	}
	return 0;
}


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

const double PI = acos(0.0)*2;

vector<complex<double>> fft(vector<complex<double>> a, bool inverse=false){
    int n = a.size();
    int h = 0;
    while(1<<h < n) h++;
    for(int i = 0; i < n; i++){
        int j = 0;
        for(int k = 0; k < h; k++)  j |= (i>>k & 1) << (h-1-k);
        if(i < j)   swap(a[i], a[j]);
    }
    // butter-fly
    for(int b = 1; b < n; b *= 2){  // ステップb、ブロックサイズ2*b
        for(int j = 0; j < b; j++){ // ブロック内j個目
            complex<double> w = polar(1.0, -(2*PI) / (2*b) * j * (inverse ? -1 : 1));
            for(int k = 0; k < n; k += 2*b){    // kを先頭とするブロック
                complex<double> s = a[j+k];
                complex<double> t = a[j+k+b]*w;
                a[j+k] = s+t;
                a[j+k+b] = s-t;
            }
        }
    }
    if(inverse) for(int i = 0; i < n; i++)  a[i] /= n;
    return a;
}

vector<complex<double>> fft(vector<double> a, bool inverse=false){
    vector<complex<double>> a_complex(a.size());
    for(int i = 0; i < a.size(); i++)   a_complex[i] = complex<double>(a[i], 0);
    return fft(a_complex, inverse);
}

vector<double> convolve(vector<double> a, vector<double> b){
    int s = a.size() + b.size() - 1;
    int t = 1;
    while(t < s)    t *= 2;
    a.resize(t);
    b.resize(t);
    vector<complex<double>> A = fft(a);
    vector<complex<double>> B = fft(b);
    for(int i = 0; i < t; i++)  A[i] *= B[i];
    A = fft(A, true);
    a.resize(s);
    for(int i = 0; i < s; i++)  a[i] = A[i].real();
    return a;
}

typedef long long ll;

int main(){
    int n;
    ll m;
    cin >> n >> m;
    vector<double> v(100001);
    for(int i = 0; i < n; i++){
        int x;  cin >> x;
        v[x]++;
    }
    vector<double> ret = convolve(v, v);
    ll ans = 0;
    for(int i = ret.size()-1; i >= 0; i--){
        ll take = min(m, (ll)(ret[i]+0.5));
        ans += take*i;
        m -= take;
    }
    cout << ans << endl;
    return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

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

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


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

    int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	FOR(i, 1, n - 1) {
		bool x[26] = {};
		REP(j, i) x[s[j] - 'a'] = true;
		bool y[26] = {};
		FOR(j, i, n) y[s[j] - 'a'] = true;
		int cnt = 0;
		REP(j, 26) cnt += (int)(x[j] && y[j]);
		ans = max(ans, cnt);
	}
	cout << ans << endl;

    return 0;
}




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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

const int INF = 1001001001;

vvi to;
vi a;
vi ans;
vi lis;

void dfs(int v = 0, int p = -1){
    auto it = lower_bound(all(lis), a[v]);
    int change = int(it - lis.begin());
    int value = *it;
    
    *it = a[v];
    int l = lower_bound(all(lis), INF) - lis.begin();
    ans[v] = l - 1;
    
    for(auto u : to[v]){
        if(u == p) continue;
        dfs(u, v);
    }
    lis[change] = value;
    return;
}

void Main() {
    int n; cin >> n;

    a.resize(n);
    rep(i, n) {
        cin >> a[i];
        a[i]--;
    }
    
    to.resize(n);
    rep(i, n-1){
        int u, v; cin >> u >> v;
        u--; v--;
        to[u].pb(v);
        to[v].pb(u);
    }

    ans.resize(n);

    lis.resize(n+1, INF);
    lis[0] = -INF;
    dfs();
    
    rep(i, n) cout << ans[i] << endl;
    return;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 27932
def main():
    n,k=map(int,input().split())
    arr = []
    for _ in range(n):
        a,b=map(int,input().split())
        arr.append((a, b))
    arr.sort()
    for x, c in arr:
        if k <= c:
            print(x)
            break
        else:
            k -= c
    
if __name__ == "__main__":
    main()

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

int main(){
  int n;
  string s;
  cin >> n >> s;
  int k=0,ans=0;
  for(int i=0; i<n; i++){
    if(s[i]=='I') k++;
    else k--;
    ans=max(ans,k);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3516
// Cease to struggle and you cease to live
// A.cpp
// Created by Nickwzk on 2019-02-16 20:16
#include <bits/stdc++.h>
using namespace std;

inline int read() {
	int x = 0, ch = getchar(); bool fg = 1;
	while(ch < '0' || ch > '9') { if(ch == '-') fg = 0; ch = getchar(); } 
	while(ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return fg ? x : -x;
}
int main() {
	int a = read(), b = read();
	if(b % a == 0) cout << a + b;
	else cout << b - a;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int cnt=0;
int res=0;
int main()
{
	string s;
	cin>>s;
	if(s[1]=='C')
	{
		cout<<"WA"<<endl;
		return 0;
	}
	if(s[0]=='A')
	{
		if(s[s.size()-1]<'a')
		{
			cout<<"WA"<<endl;
			return 0;
		}
		for(int i=1;i<s.size()-1;i++)
		{
			if(s[i]<'a')
			cnt++;
			if(cnt==2)
			{
				cout<<"WA"<<endl;
				return 0;
			}
			if(s[i]=='C')
			res++;
		}
		if(res==1)
		{
			cout<<"AC"<<endl;
			return 0;
		}
	}
	cout<<"WA"<<endl;
	return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split(" "))
G = [[] for x in range(N)]
E = [0]*N
for i in range(M):
    a,b = map(int,input().split(" "))
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

def search(x):
    a = 0
    E[x] = 1
    if 0 not in E:
        a += 1
    for g in G[x]:
        if E[g] == 0:
            a += search(g)
    E[x] = 0
    return a

print(search(0))

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

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

  double tax = 1.08;
  double x = (N+1)/tax;
  int ix = int(x);

  if(int(ix*tax)!=int(N)){
    cout << ":(" << endl;
  }else{
    cout << ix << endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pi = pair<int, int>;
using lint = long long;
const int mod = 1e9 + 7;
const int MAXN = 100005;

int n;
char str[MAXN];

int main(){
	scanf("%s", str);
	n = strlen(str);
	bool x = (str[0] == str[n - 1]);
	bool y = (n % 2);
	puts(x != y ? "First" : "Second");
}


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

int main(){
    int N, M;
    int field[21][21];
    int i, j;
    int x, y;
    char D;
    int dist;
    int pos[2];
    int xory;
    int porm;
    int n;
    cin >> N;
    while(N){
        pos[0] = 10;
        pos[1] = 10;
        n = 0;
        for(i=0;i<21;i++){
            for(j=0;j<21;j++){
                field[i][j] = 0;
            }
        }
        for(i=0;i<N;i++){
            cin >> x >> y;
            field[x][y] = 1;
        }
        cin >> M;
        for(i=0;i<M;i++){
            cin >> D >> dist;
            if(D=='N'){
                xory = 1;
                porm = 1;
            }else if(D=='S'){
                xory = 1;
                porm = -1;
            }else if(D=='E'){
                xory = 0;
                porm = 1;
            }else if(D=='W'){
                xory = 0;
                porm = -1;
            }
            for(j=0;j<dist;j++){
                pos[xory] += porm;
                if(field[pos[0]][pos[1]]){
                    field[pos[0]][pos[1]] = 0;
                    n++;
                }
            }
        }
        if(n<N){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
        cin >> N;
    }
}

Measured memory_bytes: 0
package main

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

func main() {
	s := getIntSlice(3)

	ans := "No"
	if max(s...) == sum(s...)-max(s...) {
		ans = "Yes"
	}

	fmt.Println(ans)
}

func max(ns ...int) int {
	max := ns[0]
	for i := 1; i < len(ns); i++ {
		if max < ns[i] {
			max = ns[i]
		}
	}
	return max
}

func sum(ns ...int) int {
	var sum int
	for _, n := range ns {
		sum += n
	}
	return sum
}

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

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    string s;
    cin >> s;
    ll n = s.size();
    if (n == 2)
    {
        if (s[0] == s[1])
            cout << 1 << " " << 2 << endl;
        else
            cout << -1 << " " << -1 << endl;
        return 0;
    }
    loop(i, n - 1)
    {
        if (s[i] == s[i + 1])
        {
            cout << i + 1 << " " << i + 2 << endl;
            return 0;
        }
    }
    loop(i, n - 2)
    {
        if (s[i] == s[i + 2])
        {
            cout << i + 1 << " " << i + 3 << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << endl;
    return 0;
}


Measured memory_bytes: 3768
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>
using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

int q1, b, c1, c2, q2, a1, a2;
bool ok;

int main() {
	while( 1 ) {
		cin >> q1;
		if(q1 == 0) break;
		cin >> b >> c1 >> c2 >> q2;

		a1 = a2 = 0;
		ok = false;
		repd(i,q2,0) {
			a1 = i;
			if(a1 * c1 > b) continue;
			a2 = (b - c1 * a1) / c2;
			if(a1 + a2 >= q1 && a1 >= 1) {
				ok = true;
				break;
			}
		}
		if(ok) printf("%d %d\n", a1, a2);
		else printf("NA\n");
	}
}

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

int main() {
    ll a,b,c,d,m;
    cin >> a >> b >> c >> d;
    m=max({a*c,a*d,b*c,b*d});
    cout << m;
    }


Measured memory_bytes: 3604
import sys,queue,math,copy,itertools,bisect,collections,heapq
INF = 10**18
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())

N = NI()
a = LI()
sn = [[0 for _ in range(N)] for _ in range(N)]
dp = [[INF for _ in range(N)] for _ in range(N)]
for i in range(N):
    x = 0
    for j in range(i,N):
        x += a[j]
        sn[i][j] = x
for i in range(N):
    dp[i][i] = 0
    if i < N-1:
        dp[i][i+1] = sn[i][i+1]

for j in range(2,N):
    for i in range(j-2,-1,-1):
        for k in range(0,j-i):
            dp[i][j] = min(dp[i][j],dp[i+k+1][j]+ dp[i][i+k] + sn[i][j])
print(dp[0][-1])


Measured memory_bytes: 45160
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  int n;
  int a,b,sum1,sum2;
  while(cin>>n){
  for(int i=1;i<=n;i++){
    cin>>a>>b;
    if(a>b) {sum1=sum1+a+b;}
    else if(a<b) {sum2=sum2+a+b;}
    else if(a==b) {sum1=sum1+a;sum2=sum2+b;}
    }
    if(sum1!=0||sum2!=0){cout<<sum1<<" "<<sum2<<endl;}
    sum1=0,sum2=0;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <algorithm>
using namespace std;
int a[30];
int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
		scanf("%d", a+i);
	int cnt= 1;
	int mx = a[0];
	for(int i = 1 ; i < n; i++){
		if(a[i] >= mx){
			cnt++;
			mx = a[i];
		}
	}
	printf("%d\n", cnt);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, ll> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 510;
const int MAXM = 35;
const int MAXK = 510;
const int MAXQ = 200010;

int n, m, d[MAXM][MAXM], c[MAXN][MAXN], f[3][MAXM];
vector<int> a[3];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m;
    FOR(i,1,m) FOR(j,1,m) cin >> d[i][j];
    FOR(i,1,n) FOR(j,1,n) cin >> c[i][j];
    FOR(i,1,n)
        FOR(j,1,n) a[(i + j) % 3].emplace_back(c[i][j]);
    
    FOR(i,1,m)
        FOR(p,0,2)
            FOR(j,0,SZ(a[p])-1) {
                int col = a[p][j];
                int wrn = d[col][i];
                f[p][i] += wrn;
            }
    int res = 1000000000;
    FOR(i,1,m)
        FOR(j,1,m)
            FOR(k,1,m)
                if (i != j && j != k && i != k) {
                    res = min(res, f[0][i] + f[1][j] + f[2][k]);
                }
    cout << res;
    return 0;
}

Measured memory_bytes: 2544