akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

void reader(int &a) { scanf("%d", &a); }
void reader(double &a) { scanf("%lf", &a); }
void reader(char a[]) { scanf("%s", a); }
void reader(char &a) { scanf(" %c", &a); }
void reader(ll &a) { scanf("%lld", &a); }
void reader(ull &a) { scanf("%llu", &a); }
// void reader(string& a){cin >> a;};
template<class T, class U> void reader(T& t, U& u) { reader(t); reader(u); }
template<class T, class U, class V> void reader(T& t, U& u, V& v) { reader(t); reader(u); reader(v); }

void writer(const int a, char c) { printf("%d", a); putchar(c); }
void writer(const ll a, char c) { printf("%lld", a); putchar(c); }
void writer(const ull a, char c) { printf("%llu", a); putchar(c); }
void writer(const double a, char c) { printf("%.20lf", a); putchar(c); }
void writer(const char a[]) { printf("%s", a); };
void writer(const char a[], char c) { printf("%s", a); putchar(c); };
void writer(const char a, char c) { putchar(a); putchar(c); };
template<class T> void writerLn(T t) { writer(t, '\n'); }
template<class T, class U> void writerLn(T t, U u) { writer(t, ' '); writer(u, '\n'); }
template<class T, class U, class V> void writerLn(T t, U u, V v) { writer(t, ' '); writer(u, ' '); writer(v, '\n'); }
template<class T> void writerArr(T x[], int n) { int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }
template<class T> void writerVec(vector<T> x) { int n = x.size(); int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }

vector<string> split(const string &str, char sep) { vector<string> v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) { v.push_back(buffer); }return v; }
// #define int ll
bool test = 1;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define MAX 300000
//.....................
ull mod = (int)1e9 + 7;

signed main(void)
{
	while (1) {
		int n;
		cin >> n;
		if (n == 0) return 0;
		vector<string> f(n);
		rep(i, n) cin >> f[i];
		int cnt = 0;
		bool left_up = false;
		bool right_up = false;
		bool double_up = false;
		rep(i, n) {
			if (f[i] == "lu") {
				left_up = true;
			} else if (f[i] == "ru") {
				right_up = true;
			}	else if (f[i] == "ld") {
				left_up = false;
			} else if(f[i] == "rd") {
				right_up = false;
			}
			if (!double_up && right_up && left_up) {
				double_up = true;
				cnt++;
			}
			if (double_up && !right_up && !left_up) {
				double_up = false;
				cnt++;
			}
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 100100100100100100
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,a,n) for(int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> PLL;

int main() 
{
    int a,b,c;
    cin >> a;
    cin >> b;
    cin >> c;
    
    cout << a*b/2 << endl;

    return 0;
}



Measured memory_bytes: 256
k = int(input())
s = 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
print(s[k-1])

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

int main(){
  ll a, b;
  cin >> a >> b;
  
  for(int i=0; i<max(a,b); i++){
  	cout << min(a,b);
  }
  return 0;
}


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

#define ll long long
#define pb push_back
#define vi vector<int>
#define sz(a) (int((a).size()))
#define mp make_pair
#define f first
#define s second
#define pii pair<int, int>

using namespace std;

const int N = 200200;
int n, m;
vi g[N];
bool ok[N], col[N], del[N];
int a[2][N], used[N];
queue<int> q;
string ans[2] = {"No", "Yes"};

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n >> m;
	string s;
	cin >> s;
	for (int i = 1; i <= n; i++)
		col[i] = s[i - 1] == 'B';
	
	for (int i = 1; i <= m; i++) {
		int x, y;
		cin >> x >> y;
		if (x == y) {
			ok[x] = 1;
			a[col[x]][x]++;
		} else {
			a[col[y]][x]++;
			a[col[x]][y]++;
			g[x].pb(y);
			g[y].pb(x);
		}
	}
	
	for (int i = 1; i <= n; i++) {
		if (!(a[0][i] && a[1][i])) {
			q.push(i);
		        del[i] = 1;
		}
	}
	
	
	while (!q.empty()) {
		int v = q.front();
		q.pop();
		for (int i = 0; i < sz(g[v]); i++) {
			int to = g[v][i];
			if (!del[to]) {
				a[col[v]][to]--;
				if (!(a[0][to] && a[1][to])) {
					del[to] = 1;
					q.push(to);
				}
			}
		}
	}
	
	int cnt = 0;
	for (int i = 1; i <= n; i++) {
		cnt += !del[i];
	}
	
	cout << ans[cnt > 0] << "\n";
	
	return 0;
}


Measured memory_bytes: 13008
# B https://atcoder.jp/contests/abc113/tasks/abc113_b
N=int(input())
T,A= map(int, input().split())
Building_Heights=list(map(int,input().split()))
Buildings_Temps =list(map(lambda x:abs(A-(T-(x*0.006))),Building_Heights))
print(Buildings_Temps.index(min(Buildings_Temps))+1)

Measured memory_bytes: 3060
#include <iostream>
#include <queue>
#define P pair<int,int>
#define PP pair<int,P>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

int solve(int a)
{
    int res = 0;
    while(a%2 == 0)
    {
        res++;
        a /= 2;
    }

    return res;
}

int main() {
   
    int n;cin>>n;
    int ans = 0;

    rep(i,n)
    {
        int a;cin>>a;
        ans += solve(a);
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
	
	int i, smin, tmax, snum=0, tnum=0, num, count;
	char s[256], t[256];
	scanf("%s", s);
	scanf("%s", t);
	while(s[++snum]!='\0');
	while(t[++tnum]!='\0');
	num = snum<tnum?snum:tnum;
	for(count=0; count<num;count++){
		smin=0;
		tmax=0;
		i=-1;
		while(s[++i] != '\0')	if(s[i] < s[smin])	smin = i;
		i=-1;
		while(t[++i] != '\0')	if(t[i] > t[tmax])	tmax = i;
		if(s[smin]<t[tmax]){
			printf("Yes\n");
			break;
		}else if(s[smin]==t[tmax]){
			s[smin] = 'z'+1;
			t[tmax] = 'a'-1;
		}else{
			printf("No\n");
			break;
		}
	}
	if(count==num){	
		if(snum<tnum)	printf("Yes\n");
		else	printf("No\n");
	}
	return 0;
}

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

namespace AOJ000
{
    class Program
    {
        static void Main(string[] args)
        {
            var datas = Console.ReadLine().Split(' ');

            var w = int.Parse(datas[0]);
            var h = int.Parse(datas[1]);
            var x = int.Parse(datas[2]);
            var y = int.Parse(datas[3]);
            var r = int.Parse(datas[4]);

            if (w >= x + r && h >= y + r && x > 0 && y > 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 9372
#include<iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
    char c;
    cin >> c;
    char pair;

    switch(c){
        case 'A':
            pair = 'T';
            break;
        case 'C':
            pair = 'G';
            break;
        case 'G':
            pair = 'C';
            break;
        case 'T':
            pair = 'A';
            break;
    }

    cout << pair << endl;

    return 0;
}

Measured memory_bytes: 256
n, *A = map(int, open(0).read().split())
a=sorted(A)
if n%2:
    print(sum(a[-n//2+1:])*2 - sum(a[:n//2])*2 - min(a[n//2+1]-a[n//2],a[n//2]-a[n//2-1]))
else:
    print(sum(a[n//2+1:])*2 -sum(a[:n//2-1])*2 +a[n//2] -a[n//2-1])


Measured memory_bytes: 20012
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define reprev(i,n) for(int i=n-1; i<=0; i--)

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

  cout << N*N*N << endl;
  return 0;
}

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

int main()
{
    int n;
    cin>>n;
    int arr[n][3];
    for(int i = 0; i<n;i++){
        cin>>arr[i][0];
        cin>>arr[i][1];
        cin>>arr[i][2];
    }
    int dp[n][3];
    dp[0][0] = arr[0][0];
    dp[0][1] = arr[0][1];
    dp[0][2] = arr[0][2];

    for(int i = 1;i<n;i++){
        for(int j = 0; j<3;j++){
            dp[i][j] = max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+arr[i][j];
        }
    }
    int ans = max(dp[n-1][0],dp[n-1][1]);
    ans= max(ans,dp[n-1][2]);
    cout<<ans;
}


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

typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) (in),(in)+(K)

#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

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

ll input(){
  ll a;
  cin >> a;
  return a;
}

vi sub(vector<bool> fin,ll n) {
  vi ret;
  REP(i,n) {
    if(fin.at(i))continue;
    vector<bool> cp = fin;
    cp.at(i) = true;
    vi result = sub(cp,n);
    ret.insert(ret.end(),result.begin(),result.end());
  }
  return ret;
}

int main() {
  ll n,m;
  cin >> n >> m;
  cout << (n>9?m:1000-100*n+m) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <memory.h>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <cmath>
using namespace std;

#define rep(i, n) for(int i = 0; i< n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1 << 29;
const double EPS = 1e-10;

int cnt[100010];

int main(){
  int N, a, b;
  while(cin >> N){
    int best = 0;
    memset(cnt, 0, sizeof(cnt));
    rep(i, N){
      cin >> a >> b;
      cnt[a]++;
      cnt[++b]--;
    }
    int num = 1;
    rep(i, 100002){
      num += cnt[i];
      if(num >= i) best = i;
    } 
    cout << best - 1 << endl;
  }
  return 0;
}

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

int main(){
    int n, x;
    cin >> n >> x;
    if (x == 1 || x == 2*n - 1) cout << "No" << endl;
    else {
        cout << "Yes" << endl;
        if (n == 2) {
            cout << 1 << endl;
            cout << 2 << endl;
            cout << 3 << endl;
            exit(0);
        }

        vector<int> ans(2*n);
        for (int i = 0; i < 2*n; i++) ans[i] = i;
        if (x!= n) {
            if (x != 2){
                swap(ans[n], ans[x]);
                swap(ans[1], ans[n-1]);
                swap(ans[2*n - 1], ans[n+1]);
                for (int i = 1; i < 2*n - 1; i++) {
                    if (ans[i] != 1 && ans[i] != x && ans[i] != 2*n - 1 && ans[i] < x){
                        swap(ans[i], ans[n+2]);
                        break;
                    }
                }
            }
            else{
                swap(ans[n], ans[x]);
                swap(ans[1], ans[n+1]);
                swap(ans[2*n - 1], ans[n-1]);
            }
        }
        for (int i = 1; i < 2*n; i++) cout << ans[i] << endl;
    }
}


Measured memory_bytes: 2304
N=int(input())
A=list(map(int,input().split()))
i,j,ans=0,0,0
while i<N:
    j=i
    while j<N and A[j]==A[i]: j+=1
    k=j
    while k<N and A[i]<A[j] and A[k-1]<=A[k]: k+=1
    while k<N and A[i]>A[j] and A[k-1]>=A[k]: k+=1
    ans+=1
    i=k
print(ans)

Measured memory_bytes: 62704
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int n,m,p,x,i;
    long int sum=0;
    cin>>n;
    vector<long int> a(n);
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    cin>>m;
    while(m--)
    {
        cin>>p;
        cin>>x;
        cout<<sum-a[p-1]+x<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n,i;
	scanf("%d",&n);
	double sum=0,x[n];
	char u[n][3];
	for(i=0;i<n;i++){
		scanf("%lf %s",&x[i],u[i]);
		if(u[i][0]=='J') sum+=x[i];
		else sum+=(x[i]*380000.0);
	}
	printf("%lf",sum);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {

	int n;

	cin >> n;

	vector<int> data;
	int wk;
	for (int i = 0; i < n; i++) {
		cin >> wk;
		data.push_back(wk);
	}

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

	int saisyou = data[0];
	int saidai = data[data.size() - 1];

	vector<int> mainasu;
	vector<int> purasu;

	for (int i = 1; i < data.size() - 1; i++) {
		if (data[i] > 0) {
			purasu.push_back(data[i]);
		}
		else {
			mainasu.push_back(data[i]);
		}
	}

	long long int sum = 0;

	sum = saidai - saisyou;
	for (int i = 0; i < purasu.size(); i++) {
		sum += purasu[i];
	}
	for (int i = 0; i < mainasu.size(); i++) {
		sum -= mainasu[i];
	}

	cout << sum << endl;

	//ここまでが計算。以下は手順出力

	for (int i = 0; i < mainasu.size(); i++) {
		cout << saidai << " " << mainasu[i] << endl;
		saidai -= mainasu[i];
	}

	for (int i = 0; i < purasu.size(); i++) {
		cout << saisyou << " " << purasu[i] << endl;
		saisyou -= purasu[i];
	}

	cout << saidai << " " << saisyou << endl;
	
	return 0;



}



Measured memory_bytes: 2936
N,M,Q = map(int,input().split())

l = [i+1 for i in range(M)]

abcd = [list(map(int,input().split())) for i in range(Q)]

import itertools

ans = 0

for v in itertools.combinations_with_replacement(l, N):
    answ = 0
    make = 1
    for i in range(Q):
        if v[abcd[i][1]-1] - v[abcd[i][0]-1] == abcd[i][2]:
            answ += abcd[i][3]
    ans = max(ans,answ)
        
print(ans)

Measured memory_bytes: 9216
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, a, b, n;
  scanf("%lld%lld%lld", &a, &b, &n);
  printf("%lld", b - 1 < n ? a * (b - 1) / b : a * n / b);
  return 0;
}

Measured memory_bytes: 1732
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#define ll long long
#define mod 1000000007
#define maxn 100010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buff[20],len; len=0;
	if(x<0)putchar('-'),x=-x;
	for(;x;x/=10)buff[len++]=x%10;
	if(!len)putchar('0');
	else while(len)putchar(buff[--len]+'0');
}
inline void writeln(ll x)
{
	write(x); putchar('\n');
}
inline void writesp(ll x)
{
	write(x); putchar(' ');
}
int a[maxn],b[maxn],delta[maxn];
int n;
bool cmp(int a,int b){return a>b;}
int main()
{
	n=read();
	ll sum=0;
	for(int i=1;i<=n;i++)
		a[i]=read(),sum+=a[i];
	for(int i=1;i<=n;i++)
		b[i]=read(),sum-=b[i];
	if(sum<0){
		writeln(-1); return 0;
	}
	for(int i=1;i<=n;i++)
		delta[i]=a[i]-b[i];
	std::sort(delta+1,delta+n+1,cmp);
	sum=0;
	int cnt=0;
	for(int i=1;i<=n;i++)
		if(delta[i]<0)sum-=delta[i],++cnt;
	if(sum==0){
		writeln(0); return 0;
	}
	for(int i=1;i<=n;i++){
		++cnt; sum-=delta[i];
		if(sum<0)break;
	}
	writeln(cnt);
}

Measured memory_bytes: 1280
#!/usr/bin/env python3
import sys


def solve(N: int, A: int, B: int):
    print(min(A*N,B))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(N, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){

    char a[200000][11];
    int table[200000];
    int N,i, max=-1;

    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%s",a[i]);
        table[i] = 1;
    }

    qsort(a,N,sizeof(a[0]),strcmp);

    for(i=1;i<N;i++){
        if(strcmp(a[i],a[i-1])==0){
            table[i] += table[i-1];
        }
        if(max<table[i]){
            max = table[i];
        }
    }

    for(i=0;i<N;i++){
        if(table[i]==max){
            printf("%s\n",a[i]);
        }
    }

    return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;

bool iseven(ull v)
{
    return (v & 1ULL) ? false : true;
}

int main()
{
    ios_base::sync_with_stdio(false);
    ull h, w;
    cin >> h >> w;
    ull g = h * w;
    ull ans;
    if (h == 1 || w == 1) {
        ans = 1ULL;
    } else if (iseven(h) || iseven(w)) {
        ans = g / 2ULL;
    } else {
        ans = g / 2ULL + 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum = 0;
        int idx = 0;
        while(idx <= n) {
        	sum += idx;
        	if(sum >= n) break;
        	idx++;
        }
        int diff = sum - n;
        for(int i = 1; i <= idx; i++) {
        	if(i == diff) continue;

        	System.out.println(i);
        }
    }
}


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


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 1e4;
ll arry[N];
int main(){
    ll n;
    cin>>n;
    ll a,b;
    cin>>a>>b;
    ll first[N] = {0},second[N] = {0}, third[N] = {0};
    for(int i = 0; i < n; i++){
      ll x;
      cin>>x;
      if(x <= a){
        first[++first[0]] = x;
      }else if( x >= a+1 && x <= b){
        second[++second[0]] = x;
      }else{
        third[++third[0]] = x;
      }
    }
    ll cmp = 0;
    // cout<<first[0]<<" "<<second[0]<<" "<<third[0]<<endl;
    cmp = first[0] ;
    if(second[0]  <cmp){
      cmp  = second[0];
    }
    if(third[0]  < cmp){
      cmp = third[0] ;
    }

    cout<<cmp<<endl;

}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int h,w;
		while(true) {
			h=scan.nextInt();
			w=scan.nextInt();
			if(h==0&&w==0)break;
			for(int i=0;i<h;i++) {
				for(int j=0;j<w;j++) {
					if(0<i&&i<h-1&&0<j&&j<w-1)System.out.print(".");
					else System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
		}
		scan.close();
	}

}


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

namespace ALDS1_9_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int H = int.Parse(Console.ReadLine());

            int[] heapNodes = Console.ReadLine()
                                    .Split(' ')
                                    .Select(s => int.Parse(s))
                                    .ToArray();

            for (int i = 0; i < heapNodes.Length; i++)
            {
                Console.Write(string.Format("node {0}:", i + 1));
                Console.Write(string.Format(" key = {0},", heapNodes[i]));
                if (i != 0)
                {
                    Console.Write(string.Format(" parent key = {0},", heapNodes[(int)Math.Floor((double)(i+1)/2) - 1]));
                }
                if (2 * (i + 1) - 1 < heapNodes.Length)
                {
                    Console.Write(string.Format(" left key = {0},", heapNodes[2*(i+1)-1]));
                }
                if (2 * (i + 1) < heapNodes.Length)
                {
                    Console.Write(string.Format(" right key = {0},", heapNodes[2*(i+1)]));
                }
                Console.WriteLine(" ");
            }
            //Console.ReadLine();
        }
    }
}



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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

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

  string ans;
  while(n>0){
    int x = n%26;
    if(x==0) x=26;
    n-=x;
    n/=26;
    x--;
    ans.pb('a'+x);
  }
  reverse(all(ans));
  prt(ans);
}


Measured memory_bytes: 3624
#include <stdio.h>
int main(){
int a,b,x;
char o;
for(;scanf("%d %c %d",&a,&o,&b);){
switch(o){
case '+':x=a+b;break;
case '-':x=a-b;break;
case '*':x=a*b;break;
case '/':x=a/b;break;
case '?':return 0;
}printf("%d\n",x);}return 0;}

Measured memory_bytes: 600
#include <stdio.h>

int main(){
  int n,i;
  int count=0;
  scanf("%d",&n);
  int data[n+1];
  data[0]=0;
  for(i=1;i<=n;i++){
    scanf("%d",&data[i]);
    if(i%2!=0 && data[i]%2!=0){
      count++;
    }
  }

  printf("%d\n",count);
  return 0;
}


Measured memory_bytes: 1644
#include<bits/stdc++.h>
using namespace std;
int main(){
  #define int long
  int h,w,r;
  cin>>h>>w;
  r=min(h,w);
  if(h%3==0||w%3==0)r=0;
  else{
    for(int i=1;i<w/2+1;++i){
      r=min(r,max({
        abs((h/2)*(w-i)-i*h),
        abs((h-h/2)*(w-i)-i*h),
        abs((h/2)*(w-i)-(h-h/2)*(w-i))
      }));
    }
    for(int i=1;i<h/2+1;++i){
      r=min(r,max({
        abs((w/2)*(h-i)-i*w),
        abs((w-w/2)*(h-i)-i*w),
        abs((w/2)*(h-i)-(w-w/2)*(h-i))
      }));
    }
  }
  cout<<r;
  return 0;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
C = [list(map(int,input().split())) for _ in range(10)]
cntA = {}
for _ in range(H):
  for a in map(int,input().split()):
    if a not in cntA:
      cntA[a] = 1
    else:
      cntA[a] += 1

for k in range(10):
  for i in range(10):
    for j in range(10):
      C[i][j] = min(C[i][j], C[i][k]+C[k][j])
      
ans = 0
for key, num in cntA.items():
  if key not in [-1,1]:
    ans += C[key][1]*num
print(ans)

Measured memory_bytes: 40300
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    int N, L;
    cin >> N >> L;

    long long sum = 0;
    bool flag = false;
    for (int i = 1; i <= N; i++) {
        int temp = L + i - 1;
        if (!flag && temp >= 0) {
            flag = true;
            continue;
        }
        sum += temp;
    }

    if (!flag) {
        sum -= (L + N - 1);
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

  int a, b, c;

  cin >> a >> b >> c;

  int count = 0;
  if (a != b){
    count += 1;
  }
  if (b != c){
    count += 1;
  }
  if (c != a){
    count += 1;
  }

  if (count == 0){
    count += 1;
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = arr[0];
        var a = arr[1];
        var b = arr[2];
        var c = 0;
        var d = 0;
        var s = Console.ReadLine();
        var stringBuilder = new StringBuilder();
        for (int i = 0; i < n; i++)
        {
            if (s[i] == 'c')
            {
                stringBuilder.Append("No").AppendLine();
                continue;
            }
            if(c < a + b)
            {
                if (s[i] == 'a')
                {
                    stringBuilder.Append("Yes").AppendLine();
                    c++;
                    continue;
                }

                if (d < b)
                {
                    stringBuilder.Append("Yes").AppendLine();
                    c++;
                    d++;
                    continue;
                }
            }

            stringBuilder.Append("No").AppendLine();
        }
        
        var answer = stringBuilder.ToString();
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}

Measured memory_bytes: 29992
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String S = scanner.nextLine();
		String T = scanner.nextLine();

		String t = T.substring(0,S.length());

		if(S.compareTo(t) == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		//System.out.println(T + "," + t);



		scanner.close();

	}

}


Measured memory_bytes: 35652
from sys import stdin
from fractions import gcd

N,M=[int(i) for i in input().split()]
datas = []
for i in range(M):
    x,y=[int(i) for i in input().split()]
    datas.append([y,x])
datas.sort()
count = 0
start = 0
for data in datas:
    if data[1] < start : continue
    end = data[0]
    start = end 
    count +=1        
        
print(count)

Measured memory_bytes: 23032
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n, cnt, a[MAXN];
int main() {
	read(n), cnt = 0;
	for (int i = 1; i <= n; i++)
		read(a[i]), cnt += a[i] != 0;
	if (cnt == 0) {
		puts("Yes");
		return 0;
	}
	if (n % 3) {
		puts("No");
		return 0;
	}
	sort(a + 1, a + n + 1);
	if ((a[n / 3] ^ a[n / 3 * 2] ^ a[n]) == 0 && a[1] == a[n / 3] && a[n / 3 + 1] == a[n / 3 * 2] && a[n / 3 * 2 + 1] == a[n]) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, a, n) for (ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll solve(ll K, ll A, ll B) {
  if (B - A < 2) {
    return K + 1;
  }

  if (K - (A - 1) < 0) {
    return K + 1;
  }

  ll x = K - (A - 1);
  return A + x / 2 * (B - A) + x % 2;
}

int main(void) {
  ll K, A, B;
  cin >> K >> A >> B;

  cout << solve(K, A, B) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i;
	int j;
	
	for (i = 1; i <= 9; i++){
		for (j = 1 ; j <= 9; j++){
			printf("%dx%d=%d\n", i, j, i * j);
		}
	}
	return(0);
}

Measured memory_bytes: 524
#include <stdio.h>
 
#define MAX 100000

int par[MAX];
 
void init(int);
int depth(int);

int tree[MAX][20],idx[MAX];

int main(){
  int n,i,j;
  
  scanf("%d",&n); init(n);
  for(i = 0 ; i < n ; i++){
    int id,k,c;
 
    scanf("%d%d",&id,&k);
    for(j = 0 ; j < k ; j++){
      scanf("%d",&c);
      par[c] = id;
      tree[id][idx[id]++] = c;
    }
  }
 
  for(i = 0 ; i < n ; i++){
    printf("node %d: parent = %d, depth = %d, "
           ,i,par[i],depth(i));
    
    if(par[i] == -1){
      printf("root, [");
    }else if(!idx[i]){
      printf("leaf, [");
    }else{
      printf("internal node, [");
    }

    for(j = 0 ; j < idx[i] ; j++){
      printf("%d",tree[i][j]);
      if(j < idx[i]-1) printf(", ");
    }
    puts("]");
  }
 
  return 0;
}

void init(int n){
  int i;
  for(i = 0 ; i < n ; i++){
    par[i] = -1;
  }
}

int depth(int x){
  if(par[x] == -1){
    return 0;
  }
  return depth(par[x]) + 1;
}

Measured memory_bytes: 1824
#include<iostream>
using namespace std;
int main(){
   char change[]={'S','H','C','D'};
   int n;
   cin>>n;
   bool check[4][13];
   for(int i=0;i<4;++i){
       for(int j=0;j<13;++j) {
           check[i][j]=true;
       }
   }
   int a;
   char b;
   for(int i=0;i<n;++i) {
       cin>>b>>a;
       switch(b){
               case 'S':
               check[0][a-1]=false;
               break;
               case 'H':
               check[1][a-1]=false;
               break;
               case 'C':
               check[2][a-1]=false;
               break;
               case 'D':
               check[3][a-1]=false;
               break;
       }
   }
   for(int i=0;i<4;++i){
       for(int j=0;j<13;++j) {
           if(check[i][j]){
               cout<<change[i]<<' '<<j+1<<endl;
           }
       }
   }
   return 0;
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
int health(int P,int X){
    return (P-X)*(P-X);
}
int main(void){
    int N,X[101];
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> X[i];
    }
    int L=X[0],R=X[0];
    for(int i=0;i<N;i++){
        L=min(L,X[i]);
        R=max(R,X[i]);
    }
    int ans=1000000000;
    int cost;
    for(int i=L;i<=R;i++){
        cost=0;
        for(int j=0;j<N;j++){
            cost+=health(i,X[j]);
        }
        ans=min(ans,cost);
    }
    cout << ans;
}

Measured memory_bytes: 3508
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] text = br.readLine().split(" ");
		int[] range_numbers = { Integer.valueOf(text[0]), Integer.valueOf(text[1]) };
		int result = 0;
		for (int i = range_numbers[0]; i <= range_numbers[1]; i++) {
			String number = String.valueOf(i);
			String a = number.substring(3, 4);
			String b = number.substring(4, 5);
			if (number.substring(0, 2).equalsIgnoreCase(b + a)) result++;
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 38868
#include <iostream>


using namespace std;

int main(){
  int A;
  int B;
  int C;
  
  cin >> A >> B >> C;
  int out;
  out = A - B;
  if(out > C){
     cout <<  0  << endl;
  }else{
     cout <<  C - out << 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 ll long long

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

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

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

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


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

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

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

int fact(int n) {
    if (n <= 1) return n;
    return n * fact(n-1);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N; cin >> N;
    int a = 0, b = 0;
    v<int> c, d(N), e(N); rep(i, N) c.push_back(i+1);
    rep(i, N) cin >> d[i];
    rep(i, N) cin >> e[i];
    int k = 1;
    while(a == 0 || b == 0) {
        if (d == c) a = k;
        if (e == c) b = k;
        ++k;
        next_permutation(c.begin(), c.end());
    }
    cout << abs(a - b) << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

import heapq

lefts = a[:n]
lefts_sums = [sum(lefts)]
heapq.heapify(lefts)

for x in range(n, 2 * n):
    l = heapq.heappop(lefts)
    if l < a[x]:
        heapq.heappush(lefts, a[x])
        lefts_sums.append(lefts_sums[-1] - l + a[x])
    else:
        heapq.heappush(lefts, l)
        lefts_sums.append(lefts_sums[-1])

rights = [-_a for _a in a[2 * n:]]
rights_sums = [sum(rights)]
heapq.heapify(rights)

for x in reversed(range(n, 2 * n)):
    r = heapq.heappop(rights)
    if r < -a[x]:
        heapq.heappush(rights, -a[x])
        rights_sums.append(rights_sums[-1] - r - a[x])
    else:
        heapq.heappush(rights, r)
        rights_sums.append(rights_sums[-1])

rights_sums = rights_sums[::-1]
ans = -float('inf')
for i in range(len(lefts_sums)):
    ans = max(ans, lefts_sums[i] + rights_sums[i])
# print(lefts_sums, rights_sums)
print(ans)


Measured memory_bytes: 37212
N = int(input())
S = []
S = input()

alphabets = []
for alphabet in range(ord('A'), ord('Z')+1):
    alphabets.append(chr(alphabet))


ans_list = []
for i in S:
    num = alphabets.index(i)
    position = num + N
    if position > 25: 
        position -= 26 
    ans_list.append(alphabets[position])

for i in ans_list:
    print(i, end='')


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

int main(){
  int n;
  cin >> n;
  int c[n-1],s[n-1],f[n-1];
  for(int i = 0;i < n-1;i++){
    cin >> c[i] >> s[i] >> f[i];
  }
  for(int i = 0;i < n-1;i++){
    int time = s[i];
    for(int j = i;j < n-1;j++){
      if(time < s[j]){
        time = s[j];
      }
      //cout << time << " " << i << " " << j << endl;
      if(time % f[j] != 0){
        time += f[j] - time % f[j];
      }
      time += c[j];
    }
    cout << time << endl;
  }
  cout << 0 << endl;
}     

Measured memory_bytes: 256
def bfs(v):
  distance=[-1]*n
  distance[v]=0
  next=connection[v]
  next2=[]
  visited=[-1]*n
  visited[v]=1
  visitct=1
  ct=0
  while len(next)!=0 and visitct!=n:
    ct+=1
    for i in range(len(next)):
      if visited[next[i]]==-1:
        distance[next[i]]=ct
        visited[next[i]]=1
        visitct+=1
        for j in range(len(connection[next[i]])):
          if visited[connection[next[i]][j]]==-1:
            next2.append(connection[next[i]][j])
    next=next2
    next2=[]
    
  return distance

n=int(input())
l=[list(map(int,input().split())) for i in range(n-1)]
connection=[[] for i in range(n)]
for i in range(n-1):
  connection[l[i][0]-1].append(l[i][1]-1)
  connection[l[i][1]-1].append(l[i][0]-1)

if max(bfs(bfs(0).index(max(bfs(0)))))%3==1:
  print('Second')
else:
  print('First')

Measured memory_bytes: 120612
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define int long long
#define boost() ios_base :: sync_with_stdio(0); cin.tie(); cout.tie(); cout << fixed; cout << setprecision(15); srand(time(NULL))
#define all(x) x.begin(), x.end()
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int n, h[100010];
int dp[100010][5];

int sol (int idx, int jump) {
  if (idx >= n) return INT_MAX;
  if (idx == n - 1) return 0;
  int &ret = dp[idx][jump];
  if (ret != -1) return ret;
  ret = INT_MAX;
  ret = min (ret, sol (idx + 1, 1) + abs (h[idx] - h[idx + 1]));
  ret = min (ret, sol (idx + 2, 2) + abs (h[idx] - h[idx + 2]));
  return ret;
}

signed main () {
  cin >> n; memset (dp, -1, sizeof dp);
  for (int i = 0; i < n; i++) cin >> h[i];
  cout << sol (0, 0) << endl;
  return 0;
}


Measured memory_bytes: 8064
n, k = list(map(int, input().split()))
# a, b, c = list(map(int, input().split()))
a = []
for i in range(k*2):
    a.append(list(map(int, input().split())))

count = 0
have = [0]*n
for i in range(k*2):
    if i % 2 != 0:
        for j in range(len(a[i])):
            have[a[i][j]-1] += 1

for i in range(n):
    if have[i] == 0:
        count += 1
print(count)


Measured memory_bytes: 9200
#include<iostream>
using namespace std;
int main()
{
	int x=0,y=0,x1[101]={0},y1[101]={0},xj=0,yj=0;
    string a;
    cin>>a;
    for(int i=0;i<=a.length()-1;i++)
    {
    	if(a[i]=='C')
    	{
    		x++;
    		xj++;
    		x1[xj]=i;
		}
		if(a[i]=='F')
		{
			y++;
			yj++;
			y1[yj]=i;
		}
	}
	if(x>=1&&y>=1)
	{
		for(int i=1;i<=xj;i++)
		{
			for(int j=1;j<=yj;j++)
			{
				if(x1[i]<y1[j])
				{
					cout<<"Yes";
					return 0;
				}
			}
		} 
	}
	cout<<"No";
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int q = sc.nextInt();
      Map<Integer, List<Integer>> tree = new HashMap<>();
      for(int i = 1; i <= n; i++)
        tree.put(i, new ArrayList<>());

      for(int i = 1; i < n; i++) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        tree.get(a).add(b);
        tree.get(b).add(a);
      }
      
      long[] arr = new long[1+n];
      for(int i = 0; i < q; i++)
        arr[sc.nextInt()] += sc.nextLong();

      Set<Integer> visited = new HashSet<>();
      visited.add(1);
      Queue<Integer> queue = new LinkedList<>();
      queue.offer(1);
      while(!queue.isEmpty()) {
        int node = queue.poll();
        for(int adj : tree.get(node)) {
          if(visited.contains(adj)) continue;
          arr[adj] += arr[node];
          visited.add(adj);
          queue.offer(adj);
        }
      }
      for(int i = 1; i <= n; i++) {
        if(i == n)
          System.out.println(arr[i]);
        else
          System.out.print(arr[i] + " ");
      }
  }
}

Measured memory_bytes: 265936
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

bool prime[1000006];
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}

int main() {
    // O(MlogM)
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    rep(i, N) prime[A[i]] = 1;
    ll g = A[0];
    rep(i, N) g = gcd(g, A[i]);
    if (g != 1) {
        puts("not coprime");
        return 0;
    }
    for (int i = 2; i < 1000006; i++) {
        int temp = 0;
        for (int j = i; j < 1000006; j += i) {
            if (prime[j]) temp++;            
        }
        if (temp >= 2) {
            puts("setwise coprime");
            return 0;
        }
    }
    puts("pairwise coprime");
    return 0;
}

Measured memory_bytes: 8176
#include <bits/stdc++.h>
#define pvar(x) clog<<"["<<#x<<":"<<x<<"]\n"
using namespace std;
using ll = long long int;
int main(){
  int n;
  cin>>n;
  vector<string> v({"AC","WA","TLE","RE"});
  map<string,int> mp = {
  	{"AC",0},{"WA",0},{"TLE",0},{"RE",0}
  };
  string s;
  for(int i=0;i<n;i++){
  	cin>>s;
  	mp[s]++;
  }
  for(int i=0;i<4;i++){
  	cout<<v[i]<<" x "<<mp[v[i]]<<endl;
  }
}
 


Measured memory_bytes: 3600
#include<stdio.h>
#include<math.h>

int main()
{
   long int X,t,m=0;
    scanf("%ld %ld",&X,&t);
    if(1<=X && X<=pow(10,9) && 1<=t && t<=pow(10,9))
    {
     m= X - t;
     if(m<0) printf("0");
     else printf("\n%ld\n",m);
    }
return 0;
}

Measured memory_bytes: 1732
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x*f;
}

int main(){
    int N=read(),B=read();
    int Sum=(B+B+N-1)*N/2,c=0;
    if(B>=0) printf("%d",Sum-B);
    else if(B+N-1>=0) printf("%d",Sum);
    else printf("%d",Sum-B-N+1);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
#define ll                  long long int
#define ull                 unsigned long long int
#define ld                  long double
#define fi                  first
#define se                  second
#define pb                  push_back
#define pbb                 pop_back
#define mp                  make_pair
#define pii     	        pair<int,int>
#define all(x)              x.begin(), x.end()
#define uniq(x)             x.erase(unique(x.begin(),x.end()),x.end())
#define mem(array, value)   memset(array, value, sizeof(array))
#define lcm(a,b)            (abs(a)/gcd(a,b))*abs(b)
#define PI      	        2*acos(0.0)
#define INF     	        1e9
#define EPS     	        1e-8
#define line                cout << "\n==========\n"
#define fastRead 	        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet; 

int ans;

int main ()
{
    #ifdef Lollipop
    //freopen ("input.txt", "r", stdin);
    //freopen ("output.txt", "w", stdout);
    #endif
    int n, m;
    cin >> n >> m;
    int ara[m];
    for (int i = 0; i<m; i++){
        cin >> ara[i];
    }
    sort(ara, ara+m);
    vector<int> v;
    for (int i = 1; i<m; i++){
        v.pb(ara[i] - ara[i-1]);
    }
    sort(all(v));
    for (int i = 0; i < max(m-n, 0); i++){
        ans += v[i];
    }
    cout << ans << endl;
    return 0;
}



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

int x[100010];
long long sa[100010];
vector<int> koma;

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

	for(int i = 0;i < m;i++){
		cin >> x[i];
	}

	if(n >= m){
		cout << 0 << endl;
		return 0;
	}

	sort(x, x+m);
	n--;
	koma.push_back(0);
	priority_queue<pair<long long, int> > que;
	for(int i = 1;i < m;i++){
		long long saa = x[i] - x[i-1];
		que.push(make_pair(saa, i));
		sa[i] = sa[i-1] + saa;
	}

	for(int i = 0;i < n;i++){
		koma.push_back(que.top().second);
		que.pop();
	}

	koma.push_back(m);
	sort(koma.begin(), koma.end());

	long long ans = 0;
	for(int i = 0;i < koma.size()-1;i++){
		ans += sa[koma[i+1]-1] - sa[koma[i]];
	}
	
	cout << ans << endl;
	return 0;
}





Measured memory_bytes: 3824
#include <stdio.h>
#include <math.h>

int main(void) {
  int num;
  long long int prime;
  int count_prime = 0;
  int i, j;

  scanf("%d", &num);

  for (i = 0; i < num; i++) {
    int count = 0;
    scanf("%lld", &prime);
    if (prime == 2) {
      count_prime++;
    } else if (prime > 2 && prime % 2 != 0) {
      for (j = 2; j <= sqrt(prime); j++) {
        if (prime % j == 0)
          count++;
      }
      if (count == 0)
        count_prime++;
    }
  }

  printf("%d\n", count_prime);

  return 0;
}



Measured memory_bytes: 2140
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    for(int i = 0; i < Math.max(A,B); i++){
      System.out.print(Math.min(A,B));
    }
    System.out.println();
  }
}

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

int main() {
  string S;
  cin >> S;
  int C = 0;
  
  if (S.at(0) == 'R') {
    C = C + 1;
    if (S.at(1) == 'R') {
      C = C + 1;
      if (S.at(2) == 'R') {
        C = C + 1;
      }
    }
  }
  else {
    if (S.at(1) == 'R') {
      C = C + 1;
      if (S.at(2) == 'R') {
        C = C + 1;
      }
    }
    else {
      if (S.at(2) == 'R') {
        C = C + 1;
      }
    }
  }
  
  cout << C;
 
}


Measured memory_bytes: 3612
N, M = gets.split.map(&:to_i)
s = []
c = []
str = Hash.new
M.times do |i|
  s[i], c[i] = gets.split.map(&:to_i)
  if str[s[i]-1].nil?
    str[s[i]-1] = []
  end
  str[s[i]-1] << c[i]
end

# puts "#{str}"

ans = []
ans = ans.fill('0',0..N-1)
if N>=2
  ans[0] = '1'
end

str.each do |key, val|
  if key==0 and val.first==0 and N>=2
    puts -1
    exit
  end
  val.uniq!
  if val.size >= 2
    puts -1
    exit
  end
  ans[key] = val.first.to_s
end
puts "#{ans.inject(:+)}"

Measured memory_bytes: 14344
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << endl;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
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;}

// 0 false, 1 true 
// stringの数字をint型にしてアスキーコードになったら -48する
// 切り上げ　ceil(a)
// コンパイル　g++ -std=c++17 a.cpp


int main() {
    ll n, m;
    cin >> n;
    map<string, ll> s1;
    rep(i,n){
        string s_str;
        cin >> s_str;
        s1[s_str]++;
    }
    cin >> m;
    rep(i,m){
        string t_str;
        cin >> t_str;
        s1[t_str]--;
    }

    ll ans = 0;
    for(auto i: s1){
        chmax(ans, i.second);
    }
    cout << ans << endl;


}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
using namespace std;

typedef long long LL;
typedef pair<int,int> pii;

int bfs(int s, int t, const vector<vector<int> > &G, vector<int> &cnt){
	int n = G.size();
	vector<int> ds(n, -1);
	ds[s] = 0;
	queue<int> q;
	q.push(s);
	q.push(-1);
	int tm = 1;
	while(q.size() > 1){
		int u = q.front();
		q.pop();
		if(u == -1){
			q.push(-1);
			++tm;
		}
		else{
			for(int v : G[u]){
				if(ds[v] == -1){
					ds[v] = tm;
					q.push(v);
				}
			}
		}
	}

	cnt.assign(n, 0);
	for(int i = 0; i < n; ++i){
		if(ds[i] != -1){ ++cnt[ds[i]]; }
	}

	return ds[t];
}

int main(){
	int n, m, s, t;
	scanf("%d%d%d%d", &n, &m, &s, &t);
	vector<vector<int> > G(n + 1), rG, tmp;
	vector<int> cnt1, cnt2;
	for(int i = 0; i < m; ++i){
		int x, y;
		scanf("%d%d", &x, &y);
		G[x].push_back(y);
		G[y].push_back(x);
	}

	int ds = bfs(s, t, G, cnt1);
	bfs(t, s, G, cnt2);
	LL ans = 0;
	for(int i = 0; i < n; ++i){
		if(ds - i - 2 >= 0){
			ans += (LL)cnt1[i] * cnt2[ds - i - 2];
		}
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 8656