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

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	for (int i = 0; i < 2 * k - 1; i++)
	{
		cout << (i == 0 ? "" : " ") << x - k + i + 1;
	}

	cout << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

struct UnionFind {
  vector<int> par;
  vector<int> sz;
  UnionFind(int n) { init(n); }

  void init(int n) {
    par.resize(n);
    sz.resize(n);
    REP(i, n) {
      par[i] = i;
      sz[i] = 1;
    }
  }

  int find(int x) {
    if (par[x] == x)
      return x;
    else
      return par[x] = find(par[x]);
  }

  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (sz[x] < sz[y]) {
      par[x] = y;
      sz[y] += sz[x];
    } else {
      par[y] = x;
      sz[x] += sz[y];
    }
  }

  bool same(int x, int y) { return find(x) == find(y); }

  int size(int x) { return sz[find(x)]; }
};

int main() {
  int n, q;
  cin >> n >> q;
  UnionFind uf(n);
  vector<int> vc;
  REP(i, q) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com)
      vc.push_back(uf.same(x, y));
    else
      uf.unite(x, y);
  }
  REP(i, vc.size()) cout << vc[i] << endl;
  return 0;
}


Measured memory_bytes: 3336
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>

using namespace std;

const int N = 190;
const int ANS = 17;

int dp[ANS][N][N][N];
int wr[N][N];

int n, m;

void relax(int i1, int i2, int j, int to) {
    dp[to][j][i1][i2] = -1;
    {
        int l = i1;
        int r = i2 - 1;
        if (i1 < i2 && wr[i1][i2 - 1] != -1 && wr[i1 + 1][i2] != -1) {
            l = max(l, wr[i1][i2 - 1]);
            r = min(r, wr[i1 + 1][i2]);
        }
        for (int mid = l; mid <= r; mid++) {
            int f = dp[to - 1][j][i1][mid];
            int s = dp[to - 1][j][mid  + 1][i2];
            if (dp[to][j][i1][i2] < min(f, s)) {
                dp[to][j][i1][i2] = min(f, s);
                wr[i1][i2] = mid;
            }
        }
    }
    {
        int len = dp[to - 1][j][i1][i2];
        if (j + len == m) {
            dp[to][j][i1][i2] = max(dp[to][j][i1][i2], len);
        } else {
            dp[to][j][i1][i2] = max(dp[to][j][i1][i2], len + dp[to - 1][j + len][i1][i2]);
        }
    }
}

int ps[N][N];
int a[N][N];

void init() {
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            ps[i][j] = ps[i - 1][j] + ps[i][j - 1] - ps[i - 1][j - 1] + a[i - 1][j - 1];
        }
    }
    auto ok = [&](int i1, int i2, int j, int len) {
        i2++;
        int s = ps[i2][j + len] - ps[i1][j + len] - ps[i2][j] + ps[i1][j];
        int rs = (i2 - i1) * len;
        return s == rs || s == 0;
    };
    for (int i1 = 0; i1 < n; i1++) {
        for (int i2 = i1; i2 < n; i2++) {
            for (int j = 0; j < m; j++) {
                for (int len = 0; j + len <= m; len++) {
                    if (ok(i1, i2, j, len)) dp[0][j][i1][i2] = len;
                }
            }
        }
    }
}

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

    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            char c;
            cin >> c;
            a[i][j] = (c == '#');
            // a[i][j] = rand() & 1;
        }
    }
    init();
    for (int to = 1; to < ANS; to++) {
        for (int j = 0; j < m; j++) {
            for (int i1 = 0; i1 < n; i1++) {
                for (int i2 = i1; i2 < n; i2++) {
                    wr[i1][i2] = -1;
                }
            }
            for (int i1 = n - 1; i1 >= 0; i1--) {
                for (int i2 = i1; i2 < n; i2++) {
                    relax(i1, i2, j, to);
                    if (i1 < i2) assert(wr[i1][i2] != -1);
                }
            }
        }   
    }
    for (int to = 0; to < ANS; to++) {
        if (dp[to][0][0][n - 1] == m) {
            cout << to << endl;
            return 0;
        }
    }
}   


Measured memory_bytes: 455424
#include<stdio.h>
#include<stdlib.h>
int *temp;

void MergeSort(int x[ ], int left, int right)
{
    int mid, i, j, k;
	
    if (left >= right)              /* 配列の要素がひとつなら */
        return;                     /* 何もしないで戻る */

                                    /* ここでは分割しているだけ */
    mid = (left + right) / 2;       /* 中央の値より */
    MergeSort(x, left, mid);        /* 左を再帰呼び出し */
    MergeSort(x, mid + 1, right);   /* 右を再帰呼び出し */

      /* x[left] から x[mid] を作業領域にコピー */
    for (i = left; i <= mid; i++)
        temp[i] = x[i];

      /* x[mid + 1] から x[right] は逆順にコピー */
    for (i = mid + 1, j = right; i <= right; i++, j--)
        temp[i] = x[j];

    i = left;         /* i とj は作業領域のデーターを */
    j = right;        /* k は配列の要素を指している */

    for (k = left; k <= right; k++)    /* 小さい方から配列に戻す */
        if (temp[i] <= temp[j])        /* ここでソートされる */
            x[k] = temp[i++];
        else
            x[k] = temp[j--];
}

int main()
{
int N,C,K,B,P,s,F;
int *T;
int i,j;

scanf("%d %d %d",&N,&C,&K);
T = (int *)malloc(N * sizeof(int));
temp = (int *)malloc(N * sizeof(int));

B=1;
P=0;

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

MergeSort(T,0,N-1);

F=T[0];
for(i=0;i<N;i++){
if(P<C && (T[i]-F)<=K){
P++;
}else if(P==C || (T[i]-F)>K){
B++;
P=1;
F=T[i];
}
}

printf("%d",B);
free(T);
return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int arr[100005];
int dp[3005][3005];
int anss  = 0 ;
char rep[100005];
int c=0;
string str1,str2;
int lcs(int first,int last)
    {
        if(first<=0|last<=0)
            {
                return 0;
            }
        if(dp[first][last]!=-1)
            return dp[first][last];
        if(str1[first]==str2[last]&&(first!=str1.size()&&last!=str2.size()))
        {
            dp[first][last]=1+lcs(first-1,last-1);
            anss = max(anss,dp[first][last]);
 
        }
        else
            {
            dp[first][last] = max(dp[first][last],max(lcs(first-1,last),lcs(first,last-1)));
            }
        return dp[first][last];
 
    }
void printstring()
    {
        int i = str1.size();
        int j = str2.size();
        //int idx = anss;
        int idx=lcs(str1.size()-1,str2.size()-1);
        char str[anss+1];
        str[idx+1]='\0';
        while(i>0&&j>0)
        {
            if(str1[i]==str2[j])
            {
                str[idx]= str1[i];
                idx--;
                i--;
                j--;
            }
            else if(dp[i-1][j]>dp[i][j-1])
            {
                i--;
            }
            else
                j--;
        }
        cout<<str<<endl;
    }
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    for(int i=0;i<3006;i++)
        for(int j=0;j<3006;j++)
            dp[i][j]=-1;
    cin>>str1>>str2;
    str1="X"+str1;
    str2="Y"+str2;
    string ans="";
    int n = min(str2.size(),str1.size());
    int n1 = max(str2.size(),str1.size());
    //lcs(str1.size()-1,str2.size()-1);
    printstring();
 
}
 

Measured memory_bytes: 39300
#include <iostream>

using namespace std;

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

	for (int a = 1; a <= 9; a++) {
		for (int b = 1; b <= 9; b++) {
			if (a * b == N) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;
	

}






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

mod = 10**9+7
a = 10 ** 100 % mod

def calc(n, k):
  return (2*n-k+1) * (k // 2) if k % 2 == 0 else (2*n-k+1) * (k // 2) + (n + (n-k+1)) // 2

def choose(n, k):
  x1 = calc(n, k)
  x2 = calc(k-1, k)
  return (x1 - x2 + 1) % mod

res = 0
for i in range(k, n+2):
  a = choose(n, i)
  res += a
  res %= mod

print(res)


Measured memory_bytes: 9120
a,b,k=[int(i) for i in input().split()]

if b-a+1>=2*k:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
else:
    for i in range(a,b+1):
        print(i)

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

void solve()
{
    unordered_set <ll> x;
    ll s=7;
   int k,count=1,flag=0;
   cin>>k;
   while(true)
   {
       if(s%k==0)
       {
           flag = 1;
           break;
       }
       s = s%k;
       if(x.count(s)==1) break;
       else x.insert(s);
       s = s*10+7;
       count++;
   }
   if(flag==0) cout<<-1;
   else cout<<count;
}
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 42592
N = list(map(int, input()))
pon = [0, 1, 6, 8]
hon = [2, 4, 5, 7, 9]
bon = [3]

if N[-1] in pon:
  print('pon')
  
if N[-1] in hon:
  print('hon')
  
if N[-1] in bon:
  print('bon')

Measured memory_bytes: 9172
N,X = map(int,input().split())
m = [0] * N
for i in range(N):
	m[i] = int(input())

m = sorted(m)

i = 0
res = 0
for i in range(N):
	if m[i] <= X:
		X -= m[i]
		res += 1
	else:
		break
res += X // m[0]

print(res)

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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  int count = 0;
  for(int i = 0; i < n; i++) {
    cin >> p.at(i);
  }
  for(int i = 1; i < n-1; i++) {
    if(p.at(i-1) < p.at(i) && p.at(i) < p.at(i+1)) {
      count = count + 1;
    }
    else if(p.at(i+1) < p.at(i) && p.at(i) < p.at(i-1)) {
      count = count + 1;
    }
  }
  cout << count << endl;
  
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

const int mod = INF+7;
int main(){
    string s;cin>>s;
    int res = 0;
    rep(i,4){
        if(s[i]=='+')res++;
        else res--;
    }
    cout<<res<<endl;
}



Measured memory_bytes: 256
/*input
takahashi
*/

#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  string s; cin >> s;
  cout << s.substr(0, 3);

  return 0;
}

Measured memory_bytes: 3652
(function() {
    'use strict';

    var lines = [];
    require('readline').createInterface({
      input: process.stdin,
      output: process.stdout
    }).on('line', function(line) {
      lines.push(line);
    });
    process.stdin.on('end', function() {
      //lines.forEach(function(line) {
        //var tokens = line.split(' ').map(Number);
        //    console.log(tokens[0] + ' ' + tokens[1]);
      //}
      //)
      ;

    // ToDo start
      var inLines = lines[0].split(" ")
      var X = inLines[0];
      var Y = inLines[1];
      var ans = "";

      if( X < Y ){
        ans = "<"
      } else if ( X > Y ){
        ans = ">"
      } else {
        ans = "="
      }

    console.log(ans)
      
//      console.log( Math.pow(parseInt(lines[0]),2) - parseInt(lines[1])  )
    // ToDo end

    });


})();



Measured memory_bytes: 21448
#include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
int main(){
  int n;
  cin >> n;
  vector<int>p(n),ind(n,0);
  for(int i = 0; i < n; i++){
    cin >> p[i];
    
  }

  /*
  for(int i = 0; i < n ;i++)cout << ind[i] << " ";
  cout <<endl;
  */
  int ans = 99999999;
  for(int i = 0; i <= 3; i++){
    for(int i = 0; i < n; i++)ind[i] = p[i];
    int kind = i;
    ind[0] -= kind;
    for(int j = 0; j < n-1; j++){
      
      if(ind[j] < 0)ind[j] = 0;
      int temp = ind[j];
      ind[j+1] -= temp;
      kind += temp*2;
    }
    if(ind[n-1] < 0)ind[n-1] = 0;
    ans = min(ans,kind+ind[n-1]); 
  }
  /*
  for(int i = 0; i < n; i++)cout << p[i] << " ";
  cout << endl;
  */  
  cout << ans << endl;
}



Measured memory_bytes: 3132
n = [int(x) for x in input()]
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
 op = ["-"] * op_cnt
 # print(op)
 for j in range(op_cnt):
  if((i >> j) & 1):
   op[op_cnt - 1 -  j] = "+"
 # print(op)

 formula = ""
 for p_n, p_o in zip(n, op + [""]):
  # print(p_n, p_o)
  formula += (str(p_n) + str(p_o))
 if eval(formula) == 7:
  print(formula + "=7")
  break




Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define pii pair < int, int >
typedef vector<int> vi;
typedef   long long ll;
const int mod =1e9+7;




void solve(){
	string s;
	cin>>s;
	for(int i=0;i<sz(s);++i){
		if(s[i]=='?')s[i]='D';
	}
	
	cout<<s;
}


int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 3740
import sys

def solve(n):
  count = 0
  for i in xrange(n):
    i += 1
    if 10 <= i < 100:
      continue
    if 1000 <= i < 10000:
      continue
    if 100000 <= i:
      continue

    count += 1

  return count

if __name__ == '__main__':

  n = int(sys.stdin.readline().strip())
  print solve(n)

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

struct Node{
  int k;
  struct Node *right;
  struct Node *left;
  struct Node *parent;
};

struct Node *root, *NIL;

void Insert(int);
void Inorder(struct Node *);
void Preorder(struct Node *);

int main(){
  int str1 = 0, str2 = 0;
  int i,n,value;
  char C1[10], C2[10]="insert", C3[10]="print";

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++){
    scanf("%s",C1);
    
    if(strcmp(C1,C2) == 0) str1 = 1;
    if(strcmp(C1,C3) == 0) str2 = 1;
    
    if(str1 == 1){
      scanf("%d",&value);
      Insert(value);
      str1 = 0;
    }
    else if(str2 == 1){
      str2 = 0;
      Inorder(root);
      printf("\n");
      Preorder(root);
      printf("\n");
    }
  }

  return 0;
}

void Insert(int n){
struct  Node *p = root;
struct  Node *q = NIL;
struct  Node *r;

 r = (struct Node *)malloc(sizeof(struct Node));
 r -> k = n;
 r -> left = NIL;
 r -> right = NIL;
 
 while(p != NIL){
   q = p;
   if(r->k < p->k){
     p = p -> left;
   }
   else{
     p = p -> right;
   }
 }
 
 r -> parent = q;
  if(q == NIL){
    root = r;
  }
  else{
    if(r->k < q->k){
      q -> left = r;
    }
    else{
      q -> right = r;
    }
  }
}

void Inorder(struct Node *x){
  if(x == NIL) return;
  Inorder(x -> left);
  printf(" %d",x -> k);
  Inorder(x -> right);
}

void Preorder(struct Node *x){
  if(x == NIL) return;
  printf(" %d",x -> k);
  Preorder(x -> left);
  Preorder(x -> right);
}




Measured memory_bytes: 25172
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const int maxn=2e5+10;
int a[maxn],b[maxn];
main(){
    int n,m,k;
    cin>>n>>m>>k;
    ios::sync_with_stdio(false);
    cin.tie(0);
    for(int i=0;i<n;++i)cin>>a[i];
    for(int i=0;i<m;++i)cin>>b[i];
    int pa=0,pb=0;
    a[n]=inf;
    b[m]=inf;
    int ans=0;
    int out=0;
    while(k>=a[pa]){
        k-=a[pa];
        pa++;
        ans++;
        out=max(out,ans);
    }
    while(k>=b[pb]){
        k-=b[pb];
        pb++;
        ans++;
    }
    out=max(out,ans);
    while(pa){
        k+=a[pa-1];
        pa--;
        ans--;
        while(k>=b[pb]){
            k-=b[pb];
            pb++;
            ans++;
        }
        out=max(out,ans);
    }
    cout<<out<<endl;
}


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

int main(){
	int n;
	cin >> n;
	int odd = 0;
	int even = 0;
	for(int i = 0; i< n; i++){
		int x;
		cin >> x;
		if(x%2 == 0) even++;
		if(x%2 == 1) odd++;
	}
	if(odd % 2 == 0) cout << "YES" << endl;
	if(odd % 2 == 1) cout << "NO" << endl;
}


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

typedef long long ll;

const int INF = 100000000;

int main() {
    int N;
    int ans = 0;
    string S;
    cin >> N >> S;
    string number = "0123456789";

    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            for (int k = 0; k < 10; k++) {
                bool check1 = true;
                bool check2 = true;
                bool check3 = true;
                for (int a = 0; a < N; a++) {
                    if (check1) {
                        if (S[a] == number[i]) {
                            check1 = false;
                        }
                        continue;
                    }
                    if (check2) {
                        if (S[a] == number[j]) {
                            check2 = false;
                        }
                        continue;
                    }
                    if (check3) {
                        if (S[a] == number[k]) {
                            check3 = false;
                        }
                        continue;
                    }
                    break;
                }
                if (!check1 && !check2 && !check3) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
int *insert_sort(int *a, int n){
    for(int i = 0; i < n; i++){
        int v = a[i];
        int j = i-1;
        while(j >= 0 && a[j] > v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        for(int j = 0; j < n-1; j++)
            printf("%d ", a[j]);
        printf("%d\n", a[n-1]);
    }
    return a;
}


int main(){
    int n; scanf("%d", &n);
    int a[10000];
    for(int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    insert_sort(a, n);
    return 0;
}



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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }



int main() {
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	vector<vector<pii>> r(n);
	VI cn(n), ans(n-1);
	
	rep(i, n-1){
		int a, b;
		cin >>a >>b;
		a--;b--;
		r[a].emplace_back(b, i);
		r[b].emplace_back(a, i);
		cn[a]++; cn[b]++;
	}
	int mxs = *max_element(all(cn));
	
	auto dfs=[&](auto g, int s, int p, int c)->void{
		int nc = c;
		for(auto z: r[s]){
			if(z.first == p) continue;
			nc = (nc + 1) %mxs;
			//dbg(s,z.first, p,c, nc);
			ans[z.second] = nc;
			g(g, z.first, s, nc);
		}
	};

	dfs( dfs, 0, -1, -1);
	
	
	cout << mxs <<"\n";
	for(auto x :ans) cout<<x+1<<"\n";
	
	return 0;
}


Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,x;
    while(true){
        int count=0;
        scanf("%d%d",&n, &x);
        if(n==0 && x==0)break;
        for(int i=1;i<=n;i++){
            for(int j=i;j<=n;j++){
                for(int k=j;k<=n;k++){
                    if((i!=j && j!=k && i!=k) && (i+j+k==x))count++; 
                }
            }    
        }
        cout << count << endl;
    }
}


Measured memory_bytes: 3168
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	long x=sc.nextLong(),n=100,f=0;
  	while(x>n){
  		n=(long)(n*1.01);
  		f++;
  	}
  	System.out.print(f);
  }
}

Measured memory_bytes: 35696
#include <bits/stdc++.h>
#define ll long long
#define w(t) while(t--)
#include <iostream>
using namespace std;

int main()
{
    ll t=1;
    //cin>>t;
    w(t)
    {
      ll k,n;
      cin>>k>>n;
      ll a[n],i,l,r,ans,temp=k;
      ans=k;
      for (int i = 0; i < n; ++i)
      {
          cin>>a[i];
      }
      sort(a,a+n);
      for(i=0;i<n;i++)
      {
        r=i+1;
        if(i+1==n) r=0;
        temp=abs(a[i]-a[r]);
        if(a[i]<a[r]) temp=k-temp;
        ans=min(temp,ans);
        l=i-1;
        if(l==-1)
            l=n-1;
          
        temp=abs(a[i]-a[l]);
          if(a[i]>a[l]) temp=k-temp;
        ans=min(ans,temp);

      }
      cout<<ans;
    }
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

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

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

ll mod_ = 1e9 + 7;
ll mod = 13;

ll pow_(ll x, long long int n){
	ll res(1);
	while(n){
		if(n&1){
			res = ((res%mod) * (x%mod))%mod;
		}
		n >>= 1;
		x = ((x%mod) * (x%mod))%mod;
	}
	return res%mod;
}


int main(){
	int r;
	cin >> r;
	cout << 3 * r * r << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define for(i, a, b) for (int i=a; i<(b); i++)
using namespace std;
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
    int N; 
	cin>>N;
    int cur; 
	cin>>cur;
	cur--;
    int data[N-1]; 
	for(i,1,N) 
	cin>>data[i-1];
    for(i,1,N) 
	{
        int nxt=data[i-1];
        if(nxt>cur){
            nxt--;
        }
        if(nxt<cur){
            cout<<"No"<<endl;
            return 0;
        }
        cur=nxt;
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <utility>
using namespace std;

template <typename T>
void print_vec(const vector<T> &v) {
  int n = v.size();
  for (int i = 0; i < n; ++i) {
    if (i > 0) cout << ' ';
    cout << v[i];
  }
  cout << '\n';
}

int main() {
  string s;
  cin >> s;
  if (s.back() == 's') {
    cout << s + "es" << '\n';
  } else {
    cout << s + "s" << '\n';
  }

  return 0;
}


Measured memory_bytes: 3632
#include<cmath>
#include<iostream> 
#define ll long long
//参考阶乘因数公式； 
using namespace std;
ll cal(ll n,ll p){
	if(n<p)return 0;
	else return (n/p+cal(n/p,p));
}ll prime(ll x){
	ll q=sqrtl(x);
	for(ll i=2;i<=q;i++)
	if(x%i==0)return 0;
	return 1;
}
int main()
{
	ll n,s=1;
	cin>>n;
	for(ll i=2;i<=n;i++){
		if(prime(i)){
		s*=(cal(n,i)+1);
		s%=1000000007;
		}
	}cout<<s;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){

  int n, m, i;
  int min = 0;
  int max = 0;
  int count = 0;
  int l[100000], r[100000];
  scanf("%d", &n);
  scanf("%d", &m);

  max = n;
  min = 0;
  for(i = 0; i < m; i++){
    scanf("%d", &l[i]);
    scanf("%d", &r[i]);
    if (r[i] < max)max = r[i];
    if (l[i] > min)min = l[i];
  }

  for(i = 1; i <= n; i++){
    if(i >= min && i <= max){
      count += 1;
    }
  }

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

  return 0;
}


Measured memory_bytes: 896
while 1:
	a, op, b = raw_input().split()
	a = int(a)
	b = int(b)
	if op == '+':
		print a + b
	if op == '-':
		print a - b
	if op == '*':
		print a * b
	if op == '/':
		print a / b
	if op == '?':
		break

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

bool used[25][25];
int s;
int n,m;

void check(int x,int y){
	if(x<0 || n<=x || y<0 || m<=y)return;
	if(used[x][y])return;
	used[x][y]=true,s++;
	check(x+1,y);
	check(x-1,y);
	check(x,y+1);
	check(x,y-1);
}

int main(){
	int i,j,k;
	int a,b,c;
	int x,y;
	char ca[26];
	while(cin>>m>>n){
		if(!n)break;
		memset(used,false,sizeof(used));
		for(i=0;i<n;i++){
			cin>>ca;
			for(j=0;j<m;j++){
				if(ca[j]=='#')used[i][j]=true;
				if(ca[j]=='@')x=i,y=j;
			}
		}
		s=0;
		check(x,y);
		cout<<s<<endl;
	}
}



Measured memory_bytes: 3088
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

int main() {
    string s;
    cin >> s;
    int m = 0, ans = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
            m++;
            ans = max(ans, m);
        }
        else {
            m = 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())

flag = 0

for i in range(9):
  i += 1
  if (n > 81):
    flag = 1
    break
  if n % i == 0:
    if (0 <= n/i <= 9):
      break
    else:
      continue
  else:
    if (i == 9):
      flag = 1
    else:
      continue

if (flag == 0):
  print("Yes")
else:
  print("No")


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

int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  int tmp=1,ans=0;
  rep(i,n){
    if(a[i]==tmp){
      tmp++;
      continue;
    }
    ans++;
  }
  if(ans==n){
    cout<<-1<<endl;
  }else{
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define r(i, n) for (int i=0;i<n;i++)
using namespace std;
int main() {
  string s,t;
  cin >> s >> t;
  int a=0;
  r(i,3) {
    if (s.at(i)==t.at(i)) {
      a++;
    }
  }
  cout << a << endl;
  return 0;
}

Measured memory_bytes: 256
/*
NOTE :
*min_element(.begin(),.end())
*max_element(.begin(),.end())
stack push pop top
queue push pop front
priority_queue<> pq
 push()  pop() size()  top()
map<>
 find() begin() end() insert(map<>::value_type())
pair<>
sort(.begin(), .end())
sort(arr, arr+N)
sort(a, a+N, greater<int>())
binary_search(vc.begin(), vc.end(), x)  //binary_search???true, false?????????
vector<int>::iterator lit = lower_bound(vc.begin(), vc.end(), x);
  lower_bound?????????????????????"??\???"????????????????????????????????????????????¬???????????????
vector<int>::iterator uit = upper_bound(vc.begin(), vc.end(), x);
  upper_bound????????????????????????"?¶???????"?????????????????????????????????????????¬???????????????
*/
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cassert>
#include <sstream>
#include <algorithm>
#include <valarray>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

#define MAX 100
#define INF 1<<20
#define LLINF 10e12 // 1<<31 // 2^31
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,a,n) for(int i=(a);i<(n);i++)
#define SET(a,c) memset(a,c,sizeof a)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique(ALL((o))), (o).end());
#define SQ(x) ((x)*(x))

using namespace std;
typedef long long ll;
typedef valarray<int> array_t;
/////

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // FROM HERE
  int n; cin >> n;
  REP(i,n)
  {
      double x1, x2, y1, y2, r1, r2;
      cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
      double d = sqrt(SQ(x1-x2)+SQ(y1-y2));
      if(d > r1 + r2) cout << "0" << endl;
      else if(d < fabs(r1-r2)) cout << 2*(r1>r2?1:-1) << endl;
      else cout << "1" << endl;
  }
  return 0;
}

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

int main() {
	long long n;
	cin >> n;
	long long k;
	cin >> k;
	vector<long long> arr;
	for(long long i=0;i<n;i++){
		long long a;
		cin>>a;
		arr.push_back(a);
	}sort(arr.begin(),arr.end());
	long long ans=INT_MAX;
	for(long long i=0;i<n-k+1;i++){
		long long na=arr[i+k-1]-arr[i];
		if(na<ans){
			ans=na;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4264
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
using ll=long long;
using ii=pair<ll,ll>;

int main() {
    int n;
    cin>>n;
    char *s = (char*)malloc(n);
    char *t = (char*)malloc(n);

    cin>>s>>t;
    for (int i = 0; i < n; i++) {
        printf("%c%c", s[i], t[i]);
    }
    return 0;
}

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer n;
  for(n = nil->next; n != nil ; n = n->next){
    if(n->key == key) break; 
  }
  return n;
}


void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  if(t == nil) return;
  t->next->prev = t->prev;
  t->prev->next = t->next;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  NodePointer t = nil->prev;
  if ( t == nil ) return;
  deleteNode(t); 
}

void delete(int key){
  NodePointer n;
  n = listSearch(key);
  deleteNode(n);
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil; 
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}



Measured memory_bytes: 32976
n, _ = gets.chomp.split.map(&:to_i)
d = gets.chomp.split.map(&:to_i)
loop do
  flag = true
  n.to_s.split('').each do |i|
    if d.include?(i.to_i)
      flag = false
      break
    end
  end
  break if flag

  n += 1
end
puts n

Measured memory_bytes: 14128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
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;}
int const INF = 1001001001;


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

int n; cin >> n;
vi a(n+2);
rrep(i,n) cin >> a[i];

ll sum = 0;
rep(i,n+1) {
    sum += abs(a[i+1] - a[i]);
}

rrep(i,n) {
    ll ans = sum;
    ans -= abs(a[i-1] - a[i]) + abs(a[i+1] - a[i]);
    ans += abs(a[i+1] - a[i-1]);
    cout << ans << endl;
}
return 0;
}

Measured memory_bytes: 1664
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int vx = x2 - x1, vy = y2 - y1;
    int x4 = x1 - vy, y4 = y1 + vx;
    printf("%d %d %d %d\n", x4 + vx, y4 + vy, x4, y4);
    return 0;
}


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

int main(){
    int a,b,c;
    double s,l,h;
    cin>>a>>b>>c;
    double PI=acos(-1);
    double d=c*PI/180;
    s=0.5*a*b*sin(d);
    l=sqrt(a*a+b*b-2*a*b*cos(d))+a+b;
    h=b*sin(d);
    printf("%lf\n%f\n%f\n",s,l,h);
    return 0;
    
    
}


Measured memory_bytes: 3520
#include<bits/stdc++.h>
#define MAX 1000000007
#define ll long long int
#define fo(i,n) for(int i=0;i<n;i++)
#define ull unsigned long long int
#define pb push_back
#define eb emplace_back
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
//    int t;
//    cin>>t;
    int x=1;
//    while(t--) {
     int n,m;
     cin>>n>>m;
     int z[m];
     int sum=0;
     fo(i,m){
         cin>>z[i];
         sum+=z[i];
     }

     if(sum>n){
         cout<<-1<<endl;
     }
     else{
         cout<<n-sum<<endl;
     }




       x++;
//    }
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>

using namespace::std;

int main() {
    int array[10];

    for(int i=0;i<10;i++)
      cin >> array[i];

    sort(array,array+10);

    for(int i=9;i>6;i--)
      cout << array[i] << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

const int MAXN = 3005;
const ll MOD = 998244353;

int A,B,C,D;

ll f[MAXN][MAXN];

int main()
{
	cin >> A >> B >> C >> D;
	for (int i = A;i <= C;i++)
		for (int j = B;j <= D;j++)
		{
			if (i == A && j == B)
			{
				f[i][j] = 1;
				continue;
			}
			if (i == A)
				f[i][j] = f[i][j - 1] * i % MOD;
			if (j == B)
				f[i][j] = f[i - 1][j] * j % MOD;
			if (i != A && j != B)
				f[i][j] = (f[i][j - 1] * i + f[i - 1][j] * j - f[i - 1][j - 1] * (i - 1) % MOD * (j - 1)) % MOD;
		}
	cout << (f[C][D] + MOD) % MOD << endl;
	return 0;
}

Measured memory_bytes: 74072
#include<iostream>
#include<string>
using namespace std;
int a[10010];
int c[150][150];
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);

    int H,W,N;
    cin >> H;
    cin >> W;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    int count=1,color=1;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(i%2==0){
                c[i][j]=color;
            }
            else{
                c[i][W-1-j]=color;
            }
            if(count==a[color-1]){
                count=1;
                color++;
            }
            else{
                count++;
            }
        }
    }

    for(int i=0;i<H;i++){
        cout << c[i][0];
        for(int j=1;j<W;j++){
            cout << " "<< c[i][j];
        }
        cout << "\n";
    }
	return 0;
}

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

int main() {
  int A1, A2, A3;
  1<=A1==A2==A3<=13;
  cin >> A1 >> A2 >> A3;

  if (A1+A2+A3<=21) {
    cout << "win" << endl;
  }
  else if (A1+A2+A3>=21){
    cout << "bust" << endl;
  }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n, k = map(int, input().split())
h = tuple(map(int, input().split()))

dp = [0] + [float("inf")]*(n-1)
dp[0] = 0
for i in range(1,n):
    for j in range(max(0,i-k), i):
        dp[i] = min( dp[i], dp[j]+abs(h[i]-h[j]) )
print(dp[-1])

Measured memory_bytes: 58460
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int max = 0;
		for(int i = 1;;i++) {
			if(i * i > N) {
				break;
			}
			if(i * i >= max) {
				max = i * i;
			}
		}
		System.out.println(max);
	}
}

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

int main() {
  int N,cnt=0;
  cin>>N;
  vector<string> S(N);
  for(int i=0;i<N;i++) cin>>S.at(i);
  sort(S.begin(),S.end());
  
  for(int i=0;i<N-1;i++){
    if(S.at(i)!=S.at(i+1)) cnt++;
  }
      
  cout<<cnt+1;
}

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

int main() {
    vector<int> A(3);
    for(int i = 0; i < 3; ++i) {
        cin >> A[i];
    }
    int ans = 1000;
    for(int i = 0; i < 55; ++i) {
        int tmp = 0;
        bool ng = false;
        for(int j = 0; j < 3; ++j) {
            int dif = i - A[j];
            if(dif < 0) ng = true;
            tmp += dif;
        }
        if(tmp % 2 || ng) continue;
        ans = min(ans, tmp / 2);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		String a=sc.next();
		String b=sc.next();
		String c=sc.next();
		a=a.toUpperCase();
		b=b.toUpperCase();
		c=c.toUpperCase();
		System.out.println(a.charAt(0)+""+b.charAt(0)+""+c.charAt(0));
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
	
}


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

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

	n %= 10;

	if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
	{
		cout << "hon" << endl;
	}
	else if (n == 0 || n == 1 || n == 6 || n == 8)
	{
		cout << "pon" << endl;
	}
	else if (n == 3)
	{
		cout << "bon" << endl;
	}

	return 0;
}

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

#define ll long long

using namespace std;

int n;
ll a[300000];
multiset<ll> l, r, rn;
ll suml, sumr;
ll res = -1e18;

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        l.insert(a[i]);
        suml += a[i];
    }
    for (int i = n; i < 3 * n; ++i) {
        cin >> a[i];
        rn.insert(a[i]);
    }
    for (int i = 0; i < n; ++i) {
        ll c = *rn.begin();
        r.insert(c);
        rn.erase(rn.find(c));
        sumr += c;
    }
    for (int i = 0; i < n; ++i) {
        res = max(res, suml - sumr);
        ll c = a[n + i];
        if (c > *l.begin()) {
            suml -= *l.begin();
            l.erase(l.begin());
            l.insert(c);
            suml += c;
        }
        if (rn.count(c)) {
            rn.erase(rn.find(c));
        } else {
            sumr -= c;
            r.erase(r.find(c));
            ll cc = *rn.begin();
            r.insert(cc);
            rn.erase(rn.find(cc));
            sumr += cc;
        }
    }
    res = max(res, suml - sumr);
    cout << res << "\n";
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int w,h;
string s[55];
bool vis[55][55];
int cnt;
int flag;
int d[5]={-1,0,1,0,-1};

void dfs(int i,int j){
	vis[i][j]=true;
	cnt++;
	rep(dd,5){
		int ni=i+d[dd],nj=j+d[dd+1];
		if(ni<0||ni>=h||nj<0||nj>=w)continue;
		if(s[ni][nj]=='B'){
			flag|=1;
		}else if(s[ni][nj]=='W'){
			flag|=2;
		}else if(!vis[ni][nj]&&s[ni][nj]=='.'){
			dfs(ni,nj);
		}
	}
}

int main(){
	cin.sync_with_stdio(false);
	while(1){
		cin>>w>>h;
		if(h==0)break;
		rep(i,h){
			cin>>s[i];
		}
		memset(vis,0,sizeof(vis));
		int res[4];
		memset(res,0,sizeof(res));
		rep(i,h)rep(j,w){
			if(vis[i][j]||s[i][j]!='.')continue;
			cnt=flag=0;
			dfs(i,j);
			res[flag]+=cnt;
		}
		cout<<res[1]<<" "<<res[2]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3368
#include <iostream>
using namespace std;
long long g(long long a, long long b){
    if(a%b == 0)return b;
    return g(b, a%b);
}
long long f(long long x, long long y){
    return x / y;
}
long long h(long long a, long long c, long long d){
    return a - a / c - a / d + a / ( c * d / g(c, d));
}
int main(void){
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << h(b, c, d) - h(a-1, c, d) << endl;
}


Measured memory_bytes: 256
// #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);
#define fou(i,a,n) for(int i=a;i<n;i++)
#define fod(i,a,n) for(int i=n-1;i>=a;i--)
#define rep(n) fou(_,0,n)
#define tra(a,x) for(auto& a : x)
#define elif(c) else if(c)
#define VI vector<int>
#define VD vector<double>
#define VC vector<char>
#define VS vector<string>
#define VVI vector<VI>
#define VVD vector<VD>
#define VVC vector<VC>
#define VVS vector<VS>
#define emb emplace_back
#define pub push_back
#define pob pop_back
#define mp make_pair
#define fi first
#define se second
#define si(vec) ((int)(vec).size())
#define all(vec) vec.begin(),vec.end()
#define lla(vec) vec.rbegin(),vec.rend()
#define range(vec,x,y) vec.begin()+x,vec.begin()+y
#define sortup(vec) sort(all(vec))
#define sortdown(vec) sort(lla(vec))
#define eraseif(vec,condition_x) vec.erase(remove_if(all(vec),[](auto x){return condition_x;}),vec.end())
#define countif(vec,condition_x) count_if(all(vec),[](auto x){return condition_x;})
#define replaceif(vec,condition_x,n) replace_if(all(vec),[](auto x){return condition_x;},n)
#define optvalue(vec,condition_x,relation_x_opt) *min_element(all(vec),[](int x,int opt){return condition_x ? (opt==0)||!(relation_x_opt):false;})
#define erase_unique(vec) vec.erase(unique(all(vec)),vec.end())
#define calcvec(vec,calc_x) for_each(all(vec),[](int&x){x= calc_x;})
#define calc2vec(vec1,op,vec2) {rep(1){int s=min(si(vec1),si(vec2));fou(i,0,s)vec1[i]=vec1[i] op vec2[i];}}
template<class C>void mini(C &a,C b){a=min(a,b);}
template<class C>void maxi(C &a,C b){a=max(a,b);}
#define in(T,...) T __VA_ARGS__;_cin(__VA_ARGS__);
#define out(...) _cout(__VA_ARGS__);
void _cin(){}template<class Head,class...Tail>void _cin(Head&head,Tail&&...tail){cin>>head;_cin(forward<Tail>(tail)...);}
template<class Head>void _cout(Head head){cout<<head<<endl;}template<class Head,class...Tail>void _cout(Head head,Tail...tail){cout<<head<<" ";_cout(forward<Tail>(tail)...);}
template<class C>void outvec(vector<C> vec){int vecsize=si(vec);fou(i,0,vecsize-1)cout<<vec[i]<<" ";out(vec[vecsize-1]);}
template<class C> C gcd(C a,C b){if(a&&b)return gcd(min(a,b),max(a,b)%min(a,b));else return a;}
template<class C> C lcm(C a,C b){return a/gcd(a,b)*b;}




// #define int int64_t
// #define double long double


// 無名関数template
// map,makepair

signed main(){
  IOS;

  in(int,n);
  VI l(2*n);
  fou(i,0,2*n) cin>>l[i];

  sortdown(l);

  int ans=0;
  fou(i,0,n) ans+=l[2*i+1];
  
  out(ans);


}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
class Program
{
    static void Main()
    {
        string input = ReadLine();
        string[] a = input.Split(' ');
        int[] b = new int[a.Length];
        for (int i = 0; i < a.Length; i++){
            b[i] = int.Parse(a[i]);
        }
        if(b[0] + b[1] > b[2] + b[3]){
            WriteLine("Left");
        }else if(b[0] + b[1] < b[2] + b[3]){
            WriteLine("Right");
        }else{
            WriteLine("Balanced"); 
        }
    }
}

Measured memory_bytes: 11092