akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(k,i,n) for(long long i=k;i<n;++i)
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    int N;
    cin>>N;
    int A[N],B[N],C[N-1];
    rep(0,i,N)cin>>A[i];
    rep(0,i,N)cin>>B[i];
    rep(0,i,N-1)cin>>C[i];
    int ans=0;
    ans+=B[A[0]-1];
    rep(1,i,N){
        ans+=B[A[i]-1];
        if(A[i]==A[i-1]+1)ans+=C[A[i-1]-1];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

A, B = map(int, input().split())
S = input()

if S[0:A].isdigit() and S[A + 1:].isdigit() and S[A] == "-":
    print("Yes")
else:
    print("No")

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

int main() {
  long a, b, c;
  cin>>a>>b>>c;
  if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
    cout<<0<<endl;
    return 0;
  }
  if (a == b && b == c) {
    cout<<-1<<endl;
    return 0;
  }
  int cnt = 0;
  while (true) {
    ++cnt;
    long new_a = (b + c) / 2;
    long new_b = (c + a) / 2;
    long new_c = (a + b) / 2;
    if (new_a % 2 == 1 || new_b % 2 == 1 || new_c % 2 == 1) {
      cout<<cnt<<endl;
      return 0;
    }
    a = new_a;
    b = new_b;
    c = new_c;
  }
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define MOD 1000000007
#define yn(f) cout << (f ? "Yes" : "No") << endl;
#define YN(f) cout << (f ? "YES" : "NO") << endl;

int n,ans;
vector<pair<int,int>> v;
multiset<int> s;

signed main() {
    cin >> n;
    rep(i,n) {
        int a;
        cin >> a;
        v.pb(mp(a,i));
    }
    sort(rall(v));
    s.insert(-1);
    s.insert(-1);
    s.insert(n);
    s.insert(n);
    s.insert(v[0].se);
    rep11(i,n) {
        int a = v[i].fi, idx = v[i].se;
        int L,l,r,R;
        auto itr = ----s.upper_bound(idx);
        L = *itr;++itr;
        l = *itr;++itr;
        r = *itr;++itr;
        R = *itr;

        ans += a*((idx-l)*(R-r) + (r-idx)*(l-L));

        s.insert(idx);
    }
    cout << ans << endl;
}




Measured memory_bytes: 6512
#include<stdio.h>
#include<stdlib.h>
#define diff(x,y) ((x)>(y)?(x)-(y):(y)-(x))
int comp(const void *a,const void *b){
    return *(int*)a-*(int*)b;
}
int main(void){
    int n,x,min;
    int a[1000];
    while(1){
        scanf("%d",&n);
        if(n==0) break;
        for(int i=0;i<n;i++){
            scanf("%d",&x);
            a[i]=x;
        }
        qsort(a,n,sizeof(int),comp);
        min=diff(a[0],a[1]);
        int tmp;
        for(int i=1;i<n-1;i++){
            if(min>(tmp=diff(a[i],a[i+1]))){
                min=tmp;
            }
        }
        printf("%d\n",min);
    }
    return 0;
}



Measured memory_bytes: 2040
MOD = 10 ** 9 + 7

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

def init(n):
    for i in range(2, n + 1):
        fact.append((fact[-1] * i) % MOD)
        inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
        factinv.append((factinv[-1] * inv[-1]) % MOD)

def nPk(n, k):
    return fact[n] * factinv[n - k] % MOD

def nCk(n, k):
    return fact[n] * factinv[n - k] * factinv[k] % MOD

K = int(input())
N = len(input())

init(N + K)
p25 = [1]
p26 = [1]

for k in range(K):
    p25.append(p25[-1] * 25 % MOD)
    p26.append(p26[-1] * 26 % MOD)

ans = 0
for m in range(K + 1):
    n = N + K
    ans += p25[K - m] * p26[m] * nCk(n - 1 - m, N - 1) % MOD
print(ans % MOD)


Measured memory_bytes: 225764
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>(b);i--)
#define ALL(a, itr) for(auto itr=(a).begin();itr!=(a).end();itr++)
#define pb push_back

typedef long long ll;
using namespace std;
int MOD = 1000000007;
map<int, map<int, vector<int> > > G;
auto GEND = G.end();

int N, M;

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

  cin >> N >> M;
  FOR(i, 0, M){
    int p, q, c;
    cin >> p >> q >> c;
    if(G.find(c) == GEND) G[c] = map<int, vector<int> >();
    map<int, vector<int> > &gc = G[c];
    if(gc.find(p) == gc.end()) gc[p] = vector<int>();
    if(gc.find(q) == gc.end()) gc[q] = vector<int>();
    gc[p].pb(q);
    gc[q].pb(p);
  }
  vector<int> s[N+1];
  set<int> ks, kg, crawl, group;
  vector<set <int> > groups;
  auto ksEnd = ks.end(), kgEnd = kg.end();
  int groupNum = 0;
  ALL(G, itr){
    ks.clear();
    auto &m = itr->second;
    ALL(m, itr2){
      int n = itr2->first;
      if(ks.find(n) != ksEnd) continue;
      group.clear();
      crawl.clear();
      crawl.insert(n);
      ks.insert(n);
      while(!crawl.empty()){
        int nn = *(crawl.begin());
        group.insert(nn);
        s[nn].pb(groupNum);
        crawl.erase(nn);
        ALL(m[nn], itr3){
          int nnn = *itr3;
          if(ks.find(nnn) != ksEnd) continue;
          ks.insert(nnn);
          crawl.insert(nnn);
        }
      }
      set<int> ss(group);
      groups.pb(ss);
      groupNum++;
    }
  }
  
  int cost = 0;
  set<int> tmp;
  ks.clear();
  crawl.clear();
  ks.insert(1);
  crawl.insert(1);
  while(!crawl.empty()){
    cost++;
    ALL(crawl, itr){
      ALL(s[*itr], itr2){
        if(kg.find(*itr2) != kgEnd) continue;
        ALL(groups[*itr2], itr3){
          if(*itr3 == N){cout << cost << endl;return 0;}
          if(ks.find(*itr3) != ksEnd) continue;
          tmp.insert(*itr3);
          ks.insert(*itr3);
        }
        kg.insert(*itr2);
      }
    }
    swap(crawl, tmp);
    tmp.clear();
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 106664
#include<bits/stdc++.h>
#define REP(i,n)for(ll i=0;i<n;i++)
#define MP make_pair
#define F first
#define S second
typedef long long ll;
using namespace std;
int main(){
    ll n,k,s,t,a[50];cin>>n>>k>>s>>t;
    REP(i,n)cin>>a[i];
    map<pair<ll,ll>,ll> dp[50];
    REP(i,n){
        for(ll j=k-2;j+1;j--){
            for(auto l=dp[j].begin();l!=dp[j].end();l++){
                dp[j+1][MP((l->F.F)&a[i],(l->F.S)|a[i])]+=(l->S);
            }
        }
        dp[0][MP(a[i],a[i])]=1;
    }
    n=0;
    REP(i,k)n+=(dp[i][MP(s,t)]);
    cout<<n;
}

Measured memory_bytes: 153936
def bitadd(a,w,bit): #aにwを加える(1-origin)

    x = a
    while x <= (len(bit)-1):
        bit[x] += w
        x += x & (-1 * x)

def bitsum(a,bit): #ind 0～aまでの和を求める

    ret = 0
    x = a
    while x > 0:
        ret += bit[x]
        x -= x & (-1 * x)
    return ret


N,K = map(int,input().split())

a = []

for i in range(N):

    A = int(input())
    a.append(A-K)


B = [0]

for i in range(N):

    B.append(B[-1] + a[i])

#print (B)
C = B.copy()
C.sort()

dic = {}

num = 1
for i in range(N+1):

    if i == 0:
        dic[C[i]] = num
        num += 1
    elif C[i] != C[i-1]:
        dic[C[i]] = num
        num += 1

for i in range(N+1):
    B[i] = dic[B[i]]

BIT = [0] * (len(B) + 1)

ans = 0

for i in range(N+1):

    ans += bitsum(B[i],BIT)
    bitadd(B[i],1,BIT)

print (ans)
    


Measured memory_bytes: 45932
from math import sqrt
from collections import defaultdict
N = int(input())
factors = defaultdict(int)

upper = int(sqrt(N))
for p in range(2, upper + 1):
    while N % p == 0:
        factors[p] += 1
        N //= p
if N != 1:
    factors[N] = 1

# print(factors)
result = 0
for p in factors:
    fp = factors[p]
    ti = 1
    while True:
        # print(p, fp, ti)
        if fp >= ti:
            fp -= ti
            ti += 1
            result += 1
        else:
            break

print(result)


Measured memory_bytes: 9476
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
int main() {
    ll N, K;
    cin >> N >> K;
    vector<double>P(N);
    vector<double>PD(N);
    rep(i, 0, N){
        cin >> P[i];
        PD[i] = (((1+P[i])*P[i])/2)/P[i];
    }
    double ans = 0;
    ll index = 0;
    double tmp = 0;
    rep(i, 0, N){
        if (i>=K){
            tmp -= PD[index];
            index++;
        }
        tmp += PD[i];
        if (tmp > ans){
          ans = tmp;
        }
    }
    printf("%.12f", ans);
    return 0;
}


Measured memory_bytes: 3328
# -*- coding: utf-8 -*-
from collections import defaultdict


MOD = 1000000007

def fact(n):
  ret = defaultdict(lambda:0)
  m = 2
  while n > 1:
    if n%m == 0:
      ret[m] += 1
      n //= m
    else:
      m += 1
  return ret


N = int(input())
dct = defaultdict(lambda:0)
for i in range(1,N+1):
  dct_i = fact(i)
  for r in dct_i:
    dct[r] += dct_i[r]

ans = 1
for k in dct:
  ans = (ans*(dct[k]+1)) % MOD
print(ans)

Measured memory_bytes: 3316
n,m=map(int,input().split())
arr=[0]+list(map(int,input().split()))
g=[[] for _ in range(n+1)]
for _ in range(m):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
ans=0
for v in range(1,n+1):
  for u in g[v]:
    if arr[u]>=arr[v]:
      break
  else:
    ans+=1
print(ans)

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int N;
int a[55];
vector<P2> ans;

int main(){
	cin >> N;
	int mx = -12345678 , mn = 12345678;
	int s = -1 , t = -1;
	repp(i,0,N){
		cin >> a[i];
		if(a[i]>mx){
			mx = a[i];
			s = i;
		}
		if(a[i]<mn){
			mn = a[i];
			t = i;
		}
	}
	if(mx > -mn){
		repp(i,0,N) if(a[i] <= 0){
			ans.PB(MP(s,i));
			a[i] += a[s];
		}
		repp(i,1,N){
			if(a[i-1] > a[i]){
				ans.PB(MP(i-1,i));
				a[i] += a[i-1];
			}
		}
	} else {
		repp(i,0,N) if(a[i] >= 0){
			ans.PB(MP(t,i));
			a[i] += a[t];
		}
		repm(i,N-1,0){
			if(a[i-1] > a[i]){
				ans.PB(MP(i,i-1));
				a[i-1] += a[i];
			}
		}
	}
	cout << ans.size() << endl;
	for(auto z : ans) cout << z.first+1 << ' ' << z.second+1 << endl;
	return 0;
}


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

int main() {
    int a;
    cin >> a;
    cout << a+a*a+a*a*a << endl;
    return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;

double t[1000000];

void solve(){
}

int main(){
  int n = 0;
  for(int i=0;cin>>t[i];i++,n++);
  sort(t,t+n);
  printf("%.1f\n",t[n-1]-t[0]);
}

Measured memory_bytes: 0
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for(int i=0; i<n; i++) {
            int[] ia = new int[3];
            ia[0] = scanner.nextInt();
            ia[1] = scanner.nextInt();
            ia[2] = scanner.nextInt();
            Arrays.sort(ia);
            if(ia[0]*ia[0] + ia[1]*ia[1] == ia[2]*ia[2]) {
                System.out.println("YES");
            }else {
                System.out.println("NO");
            }
        }
    }
}

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

#define ll long long int
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define sep(i,b,a) for(ll i=b-1;i>=a;i--)
#define vi vector <ll>
#define hell 1000000007
#define pii pair <ll,ll>
#define inf (ll)(1e16)
#define pb push_back
#define p 31

using namespace std;

void solve()
{
    string s;
    cin>>s;
    if(s=="Sunny")
        cout<<"Cloudy";
    else if(s=="Rainy")
        cout<<"Sunny";
    else
        cout<<"Rainy";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#define mod 1000000007
using ll = long long;
using namespace std; 
const double pi = acos(-1);

int main(){
    int x,n; cin >> x >> n;
    int ans=0;
    int far=0;
    map<int,int> M;
    for (int i=-110;i<=200;i++){
        M[i]=0;
    }
    for (int i=0;i<n;i++){
        int a; cin >> a;
        M[a]=1;
    }
    if (M[x]==0){
        cout << x << "\n";
        return 0;
    }
    for (int i=x-1;i>-110;i--){
        if (x-1==0) break;
        if (M[i]==0){
            ans=i;
            far=x-i;
            break;
        }
    }
    for (int i=x+1;i<=200;i++){
        if(M[i]==0){
            int farr=i-x;
            if (farr<far){
                ans=i;
            }
            break;
        }
    }
    cout << ans << "\n";
}



Measured memory_bytes: 3640
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

//#define DEBUG 1
#define POINT_NUMBER 8

double get_area(double x1, double x2, double x3, double y1, double y2, double y3);
int check(double abp, double bcp, double cap, double abc);

main()
{
	double x1, y1, x2, y2, x3, y3, px, py, abp, bcp, cap, abc;

	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py) != EOF)
	{
		
		abp = get_area(x1, y1, x2, y2, px, py);
		bcp = get_area(x2, y2, x3, y3, px, py);
		cap = get_area(x3, y3, x1, y1, px, py);
		abc = get_area(x1, y1, x2, y2, x3, y3);
	

#ifdef DEBUG
		printf("%lf\n%lf\n%lf\n%lf\n", abp, bcp, cap, abc);
#endif
		if(check(abp, bcp, cap, abc) == 1)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	
	return 0;
}

double get_area(double x1, double y1, double x2, double y2, double x3, double y3)
{
	double area;
	area = (y1 * (x2 - x3) + y2 * (x3 - x1) + y3 * (x1 - x2)) / 2;
	
	return area;
}

int check(double abp, double bcp, double cap, double abc)
{
	double sum = 0;
	sum += fabs(abp);
	sum += fabs(bcp);
	sum += fabs(cap);
	abc = fabs(abc);
#ifdef DEBUG
		printf("%lf\n%lf\n", sum, abc);
#endif
	if(abc == sum)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

string s;
ll k , p = 0;

int main()
{
    _FastIO;
    cin >> s;
    ll n = s.size();
    cin >> k;
    char c;
    for(ll i = 0; i < n; i++){
        if(s[i] != '1'){
            p = i + 1;
            c = s[i];
            break;
        }
    }
    if(!p || k < p){
        cout << "1" << endl;
        return 0;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int cnt;
    cnt=n%10;
    if(cnt==3)
         cout<<"bon"<<endl;
    else
        if(cnt==2||cnt==4||cnt==5||cnt==9||cnt==7)
             cout<<"hon"<<endl;
    else if(cnt==0||cnt==1||cnt==6||cnt==8)
         cout<<"pon"<<endl;
}


Measured memory_bytes: 3600
def abc165d_floor_function():
    a, b, n = map(int, input().split())
    i = min(n, b-1)
    max_val = a*i//b - a*(i//b)
    # for i in range(1, n+1):
    #     v = a*i//b - a*(i//b)
    #     max_val = max(max_val, v)
    print(max_val)

abc165d_floor_function()

Measured memory_bytes: 8984
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define fi first
#define se second
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int y,m,d;
	while(cin>>y>>m>>d){
		if(y<=1868&&m<=9&&d<=7) cout<<"pre-meiji"<<endl;
		else if(y<1912){
			cout<<"meiji "<<y-1868+1<<" "<<m<<" "<<d<<endl;
		}
		else if(y==1912){
			if(m<=7){
				if(d<=29) cout<<"meiji "<<y-1868+1<<" "<<m<<" "<<d<<endl;
				else cout<<"taisho "<<y-1912+1<<" "<<m<<" "<<d<<endl;
			}
			else cout<<"taisho "<<y-1912+1<<" "<<m<<" "<<d<<endl;
		}
		else if(y<=1926&&m<=12&&d<=24){
			cout<<"taisho "<<y-1912+1<<" "<<m<<" "<<d<<endl;
		}
		else if(y<1989){
			cout<<"showa "<<y-1926+1<<" "<<m<<" "<<d<<endl;
		}
		else if(y==1989){
			if(m<=1){
				if(d<8) cout<<"showa "<<y-1926+1<<" "<<m<<" "<<d<<endl;
				else cout<<"heisei "<<y-1989+1<<" "<<m<<" "<<d<<endl;
			}
			else cout<<"heisei "<<y-1989+1<<" "<<m<<" "<<d<<endl;
		}
		else{
			cout<<"heisei "<<y-1989+1<<" "<<m<<" "<<d<<endl;
		}
	}
}

Measured memory_bytes: 1160
import math
import sys
import collections
import bisect


def main():
    h, w = map(int, input().split())
    hw = [["."] * (w + 2)] + [0] * h + [["."] * (w + 2)]
    for i in range(h):
        hw[i + 1] = ["."] + list(input()) + ["."]
    for i in range(1, h + 1):
        for j in range(1, w + 1):
            if hw[i][j] == "#":
                if hw[i - 1][j] == "#" or hw[i + 1][j] == "#" or hw[i][j - 1] == "#" or hw[i][j + 1] == "#":
                    continue
                else:
                    print("No")
                    return
    print("Yes")


if __name__ == '__main__':
    main()


Measured memory_bytes: 9444
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<map>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if(a + b > c + d) cout << "Left" << endl;
	else if(a + b < c + d) cout << "Right" << endl;
	else cout << "Balanced" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
import os
import math
import string
import collections

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    H = il()
    H = sorted(H, reverse=True)
    print(sum(H[K:]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 24008
using System;

namespace C20191120
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            var A = (int)str[0] - '0';
            var B = (int)str[1] - '0';
            var C = (int)str[2] - '0';
            var D = (int)str[3] - '0';
            var op = new[] { "+", "-" };
            var aff = new[] { 1, -1 };

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    for (int k = 0; k < 2; k++)
                    {
                        if (A + (aff[i] * B) + (aff[j] * C) + (aff[k] * D) == 7)
                        {
                            Console.WriteLine("{0}{1}{2}{3}{4}{5}{6}=7", A, op[i], B, op[j], C, op[k], D);
                            return;
                        }
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 13140
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define put(a) cout << (a) << endl

#define INF 1000000001
#define MOD 1000000007
#define INF64 1000000000000000001
#define llint long long int

#define F first
#define S second

#define Pii  pair<int,int>
#define Pll  pair<long long,long long>
#define Piii pair<int,pair<int,int>>
#define Plll pair<long long,pair<long long,long long>>

#define Vll(a,b,c)    vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a,b,c,d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))

#define MAX_N 1000000

int main (void)
{
	//INPUT
	llint N;
	cin >> N;

	//SOLVE
  llint ans=0;
  // ans += 1;
  // rep(i,2,N){
  //   ans += (i % (i+1));
  // }
  ans = N * (N-1) / 2;

	//OUTPUT

	cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    string S; cin >> S;
    if(S[2] == S[3] && S[4] == S[5]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(),(v).end())
#define RSORT(v) sort((v).rbegin(),(v).rend())
const ll MOD = 1000000007;

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}



void solve(std::string O, std::string E){
    int i = 0;

    while(i < O.size() || i < E.size()){
        if(i < O.size()){
            cout << O[i];
        }

        if(i < E.size()){
            cout << E[i];
        }

        i++;
    }

    cout << endl;
    
    
}

int main(){
    std::string O;
    std::cin >> O;
    std::string E;
    std::cin >> E;
    solve(O, E);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Rep(i, N) for(int i = 0; i < N; i++)

typedef pair<int, int> Pi;
#define fi first
#define se second

signed main()
{
  bool prime[1000005];

  fill_n(prime, 1000005, true);
  prime[1] = false;
  for(int i = 2; i * i <= 1000005; i++) {
    if(prime[i]) {
      for(int j = i * i; j <= 1000005; j += i) prime[j] = false;
    }
  }

  int A, D, N;
  
  while(cin >> A >> D >> N, A || D || N) {
    int cnt = 0;
    while(cnt < N) {
      cnt += prime[A];
      A += D;
    }
    cout << A - D << endl;
  }

  return 0;
}

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

int main(){
	int N,Y,i=0,j=0,w=0;

	cin >> N >> Y;

	for(i=0;i<=N;i++){
		for(j=0;j<=N-i;j++){
			if(9000*i+4000*j+N*1000==Y){
				w++;
				cout << i << " " << j << " " << N-i-j;
				break;
			}
		}
		if(w!=0) break;
	}
				
	if(w==0) cout << "-1 -1 -1";
}


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

void Main() {
  int a, b;
  cin >> a >> b;

  int ans = -1;
  for (int i = min(a, b); i < 10000; i++) {
    if (int(i * 0.08) == a && int(i * 0.1) == b){
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
n = int(input())
p = make_divisors(n)
print(min([a+n//a-2 for a in p]))

Measured memory_bytes: 3424
#include<bits/stdc++.h>
//This code is written by Itst
using namespace std;

inline int read(){
	int a = 0;
	char c = getchar();
	bool f = 0;
	while(!isdigit(c)){
		if(c == '-')
			f = 1;
		c = getchar();
	}
	while(isdigit(c)){
		a = (a << 3) + (a << 1) + (c ^ '0');
		c = getchar();
	}
	return f ? -a : a;
}

const int MOD = 1e9 + 7 , MAXN = 4e6;
int dp[2010][2010] , N , K , jc[MAXN + 10] , ny[MAXN + 10];

inline int poww(long long a , int b){
	int times = 1;
	while(b){
		if(b & 1)
			times = times * a % MOD;
		a = a * a % MOD;
		b >>= 1;
	}
	return times;
}

inline void init(){
	jc[0] = 1;
	for(int i = 1 ; i <= MAXN ; ++i)
		jc[i] = 1ll * jc[i - 1] * i % MOD;
	ny[MAXN] = poww(jc[MAXN] , MOD - 2);
	for(int i = MAXN - 1 ; i >= 0 ; --i)
		ny[i] = 1ll * ny[i + 1] * (i + 1) % MOD;
}

int main(){
	init();
	N = read();
	K = read();
	if(K == 1){
		puts("1");
		return 0;
	}
	init();
	for(int i = 1 ; i <= N ; ++i){
		dp[i][0] = 1;
		for(int j = 1 ; j <= i ; ++j){
			int t = N * K - i - (j - 1) * (K - 1) - 1;
			dp[i][j] = (dp[i - 1][j] + 1ll * dp[i][j - 1] * jc[t] % MOD * ny[K - 2] % MOD * ny[t - K + 2] % MOD * (N - j + 1) % MOD) % MOD;
		}
	}
	cout << dp[N][N];
	return 0;
}


Measured memory_bytes: 47232
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9

struct cake{
    int w,d;
    cake(){}
    cake(int W, int D):w(W),d(D){}
    bool operator>(cake a){return w*d>a.w*a.d;}
    bool operator<(cake a){return w*d<a.w*a.d;}
    int s(){return w*d;}
};
int main(){
    int n,w,d;
    while(cin>>n>>w>>d,w){
        vector<cake> c(1,cake(w,d));
        rep(lp,n){
            int num,len;
            cin>>num>>len;
            auto f=c[num-1];
            c.erase(c.begin()+num-1);
            int cut=len%(f.w+f.d);
            cake c1,c2;
            if(cut<f.w){
                c1=cake(cut,f.d);
                c2=cake(f.w-cut,f.d);
            }else{
                c1=cake(f.w,cut-f.w);
                c2=cake(f.w,f.d+f.w-cut);
            }
            if(c1>c2)swap(c1,c2);
            c.pb(c1);
            c.pb(c2);
        }
        sort(all(c));
        rep(i,n+1){
            cout<<c[i].s();
            if(i==n)cout<<endl;
            else cout<<" ";
        }

    }
    
	return 0;
}



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

int main() {
  int N;
  cin >> N;
  
  vector<int> a(N);
  
  int Ali = 0;
  int Bob = 0;

  for(int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  
  for(int i = 0; i < N; i++){
    Ali += a.at(i);
    i++;
    if(i == N) break;
    Bob += a.at(i);
  }
  
  cout << Ali - Bob << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N, M, T; cin >> N >> M >> T;
	vector<ll> a(N);
	for (int i = 0; i < N; i++) cin >> a[i];
	ll ans = 0;
	ans += a[0] - M;
	for (int i = 1; i < N;i++) {
		if (a[i] - a[i - 1] <= 2 * M) continue;
		else {
			ans += a[i] - a[i - 1] - 2 * M;
		}
	}
	ans += max(0LL, T - a[N - 1] - M);
	cout << ans << endl;
}

Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
ll mx=INT_MAX;
ll mi=INT_MIN;
const ll mod=1e9+7;

int main()
{
    ll t,tt;
       ll n,a=0,b=0,c=0,d,i,j,k,s=0,m;
       vll v,vv(30,0);
       cin>>k>>n>>m;
       if((m/k)-(n-1)/k!=0) cout<<"OK";
       else cout<<"NG";
       string ss;
       
       
    
    
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int h, w, k;
int cnt = 0;

void check(vector<vector<char>> &vec, int x, int y) {
  int bcnt = 0;
  for(int i = y; i < h; i++) {
    for(int j = x; j < w; j++) {
      if (vec[i][j] == '#') bcnt++;
    }
  }
  if (bcnt == k) cnt++;
}

int main()
{
  
  cin >> h >> w >> k;
  vector<vector<char>> vec;
  rep(i, h) {
    vector<char> tmp(w);
    rep(j, w) cin >> tmp[j];
    vec.push_back(tmp);
  }
  for(int i = 0; i < (1 << h); i++) {
    for(int j = 0; j < (1 << w); j++) {
      int temp_cnt = 0;
      for(int k = 0; k < h; k++) {
        for(int l = 0; l < w; l++) {
          if (i >> k & 1) continue;
          if (j >> l & 1) continue;
            
          if (vec[k][l] == '#') temp_cnt++;
        }
      }
      if (temp_cnt == k) cnt++;
    }
  }

  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#define N 20
#define Q 2000

//int rec(int,int [N],int [N],int,int,int);
int solve(int ,int ,int ,int [N],int);

int main(){
  int num,n[N],qu,q[Q],i,S[N];

  scanf("%d",&num);

  for(i=0;i<num;i++) scanf("%d",&n[i]);

  scanf("%d",&qu);

  for(i=0;i<qu;i++) scanf("%d",&q[i]);

  for(i=0;i<qu;i++){
    if(solve(0,q[i],num,n,0)==1) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}


int solve(int i,int q,int num,int n[N],int res){
  if(q==0 || res==1) return 1;
  if(i>=num) return 0;
  res = solve(i+1,q,num,n,res);
  res = solve(i+1,q-n[i],num,n,res);
  return res;
}

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

typedef long long LL;

const int N=2000,mod=1000000007;

int add(int a,int b,int p=mod){return a+b>=p?a+b-p:a+b;}
int sub(int a,int b,int p=mod){return a-b<0?a-b+p:a-b;}
int mul(int a,int b,int p=mod){return (LL)a*b%p;}
void sadd(int &a,int b,int p=mod){a=add(a,b,p);}
void ssub(int &a,int b,int p=mod){a=sub(a,b,p);}
void smul(int &a,int b,int p=mod){a=mul(a,b,p);}

int n,m,sk;

void into(){
  scanf("%d%d%d",&n,&m,&sk);
}

int dp[N*2+9][N+9][2],sum[N+9],ans;

void Get_dp(){
  dp[0][0][0]=1;
  for (int i=1;i<=n+m;++i){
	sum[0]=add(dp[i-1][0][0],dp[i-1][0][1]);
	for (int j=1;j<=n;++j) sum[j]=add(sum[j-1],add(dp[i-1][j][0],dp[i-1][j][1]));
	for (int j=0;j<=n;++j){
	  dp[i][j][0]=sub(sum[j],sum[j-1]);
	  if (j) dp[i][j][1]=sub(sum[j-1],j<sk?0:sum[j-sk]);
	}
	for (int j=0;j<=n;++j){
 	  int t=sk-1;
      if (j%t==n%t&&(i*t-j+1)%t==m%t&&(i*t-j+1)<=m) sadd(ans,dp[i][j][1]);
	}
  }
}

void work(){
  Get_dp();
}

void outo(){
  printf("%d\n",ans);
}

int main(){
  into();
  work();
  outo();
  return 0;
}

Measured memory_bytes: 63104
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define endl "\n"
#define inf 1000000007
#define for(i, a, b) for(int i=a; i<b; i++)
int dp[1000001] = {0};

void solve(){
	int n, res=0;
	cin>>n;
	int arr[n-1];
	for(i, 0, n-1)cin>>arr[i];
	res+=arr[0];
	for(i, 1, n){
		res+=min(arr[i-1], arr[i]);
	}
	cout<<res;
}
signed main(){	
	#ifdef _DEBUG
		freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
	
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
 
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<P> p(M);
    rep(i, M) cin >> p[i].first >> p[i].second;
    rep(x, 1000) {
        int nx = x/10;
        vector<int> d(1, x%10);
        while(nx) {
            d.push_back(nx%10);
            nx /= 10;
        }
        if (d.size() != N) continue;
        reverse(d.begin(), d.end());
        bool ok = true;
        rep(i, M) {
            if (d[p[i].first - 1] != p[i].second) ok = false;
        }
        if (ok) {
            cout << x << endl;
            return 0;
        }
    }
    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 256
// 有點不耐煩會破壞偉大的計劃

#include <bits/stdc++.h>

#define append push_back

using namespace std;
using ll = long long;

const int N = 1e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 22, BL = 400;
const double EPS = 1e-9, PI = acos(-1);
const int dx[] = {1, 0, 0, -1, -1, 1, -1, 1};
const int dy[] = {0, 1, -1, 0, -1, 1, 1, -1};

void debug() {
	cerr << "\n";
}
template<typename Type1, typename... Type2>
void debug(Type1 a, Type2... b) {
    cerr << a << " ";
    debug(b...);
}

long long slow(long long &a, long long &b, long long &c) {
    long long cnt = 1000, ans = 0;
    while(cnt--){
        if((a & 1) + (b & 1) + (c & 1) > 0) break;
        long long x = (a & 1 ? 0 : a / 2);
        long long y = (b & 1 ? 0 : b / 2);
        long long z = (c & 1 ? 0 : c / 2);
        a = a + y + z - x * 2;
        b = b + x + z - y * 2;
        c = c + x + y - z * 2;
        ans++;
    }
    return ans;
}

int main() {
//    freopen(".in", "r", stdin);
//    freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    long long a, b, c;
    cin >> a >> b >> c;

    long long ans = slow(a, b, c);

    if(ans == 1000) ans = -1;

    cout << ans;

    return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    
    if((1<=A && A<=9) && (1<=B && B<=9)){
      System.out.println(A * B);
    } else {
      System.out.println("-1");
    }
  }
}

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

using namespace std;
int main(){
    int n; cin>>n;
    int a[n];
    int ans=0;
    long long res=0;;
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++){
    ans=max(ans,a[i]);
    res+=ans-a[i];
    }
  cout<<res;
  return 0;
}

Measured memory_bytes: 4376
n, m = gets.split.map(&:to_i)
h = Hash.new(0)
h[0] = 1
sum = 0
as = gets.split.map(&:to_i)
as.each{|a|
  sum = (sum + a) % m
  h[sum] += 1
}
p h.map{|k, v| v  * (v-1) / 2}.reduce(:+)

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

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

    vector<int> v;
    v.push_back(1);
    for (int i = 2; i < 40; i++) {
        for (int j = 2; j < 10; j++) {
            int n = pow(i, j);
            if (n > X) break;
            v.push_back(n);
        }
    }

    sort(v.begin(), v.end(), greater<int>());

    cout << v[0] << endl;
}

Measured memory_bytes: 640
import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)

for i in range(n):
    if a[i]%2 == 0 and ((not a[i]%3 == 0) and (not a[i]%5 == 0)):
        print("DENIED")
        break
    if i == n-1:
        print("APPROVED")
        break


Measured memory_bytes: 12592
import math
import copy
from queue import Queue
import heapq

#n = int(input())
n, m = [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for j in range(n)]
#table = [list(input()) for n in range(h)]
s = [int(i) for i in input().split()]
#s = [int(i) for i in range(n)]
#s = [int(input()) for i in range(n)]
#s = input()
#list = list(s)
# dp = [[0 for _ in range(2)] for _ in range(13)]

#a = [[0 for _ in range(n+1)] for _ in range(n+1)]
#b = [[0 for _ in range(n+1)] for _ in range(n+1)]

s = list(map(lambda x: x*(-1), s))
heapq.heapify(s)

for i in range(m) :
    heapq.heappush(s, math.ceil(heapq.heappop(s)/2))

print(sum(s)*(-1))

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

    public static void main(String[] args) {
        Scanner yomi = new Scanner(System.in);
        String n =yomi.next();
        if (n.equals("Sunny")){
            System.out.println("Cloudy");
        }else if (n.equals("Cloudy")){
            System.out.println("Rainy");
        }else if (n.equals("Rainy")){
            System.out.println("Sunny");
        }

    }
}


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

t_prev = 0
x_prev = 0
y_prev = 0
possible = True
for i in range(n):
    t, x, y = map(int, input().split())

    z = (t - t_prev) - (abs(x - x_prev) + abs(y - y_prev))
    if z < 0 or z % 2 == 1:
        possible = False

    t_prev, x_prev, y_prev = t, x, y

if possible:
    print("Yes")
else:
    print("No")


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

#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))

#define sum(v) accumulate(all(v), 0)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))

#define INF 1000000000
#define MOD 1000000007

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>

using namespace std;

main {
  int a,b;
  while(cin>>a>>b) cout<<(int)(log10(a+b))+1<<endl;
  bye;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int sum = 0;
    for(int i = 1; i <= 3; i++) {
        int a;
        cin >> a;
        sum += a;
    }
    string ans = "win";
    if(sum >= 22) ans = "bust";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

vector<ll> inv, fact, invfact;
void mod_build(int n = 101010){
    fact.resize(n+1);
    inv.resize(n+1);
    invfact.resize(n+1);
    fact[0] = inv[0] = invfact[0] = 1;
    inv[1] = 1;
    REP(i, n){
        fact[i+1] = fact[i] * (i+1) % MOD;
        if(i > 0) inv[i+1] = MOD - inv[MOD % (i+1)] * (MOD / (i+1)) % MOD;
        invfact[i+1] = invfact[i] * inv[i+1] % MOD;
    }
}
ll perm(int n, int k){
    if(n < 0 || k < 0 || k > n) return 0;
    return fact[n] * invfact[n-k] % MOD;
}
ll comb(int n, int k){
    if(n<0 || k<0 || k>n) return 0;
    return (fact[n] * invfact[n-k] % MOD) * invfact[k] % MOD;
}

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

    // mod_build();
    // ll N = comb(100, 2);
    // pr(N);

    for(ll k = 1; k*(k-1) <= 2*N; k++){
        if(2*N == k*(k-1)){
            pr("Yes");
            pr(k);
            vector<vector<ll>> v(k);
            ll id = 1;
            REP(i, k){
                Rep(j, i+1, k){
                    // pr("debug", i, j);
                    v[i].pb(id);
                    v[j].pb(id);
                    id++;
                }
            }
            REP(i, k){
                cout << v[0].size() << " ";
                // for(auto&& vi : v[i]) cout << vi << " ";
                REP(j, k-1){
                    cout << v[i][j];
                    if(j != k-2) cout << " ";
                }
                cout << endl;
            }
            return 0;
        }
    }  
    pr("No");
}

Measured memory_bytes: 3200
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <queue>
#include <stack>
#include <set>

using namespace std;

#define ALL(co) co.begin(), co.end()
#define tpl(...) make_tuple(__VA_ARGS__)

typedef long long LL;
typedef pair<int, int> P; typedef pair<int, P> IP; typedef pair<P, P> PP;
typedef vector<int> Array; typedef vector<vector<int> > Array2;
typedef vector<LL> LArray; typedef vector<P> PArray; typedef vector<string> SArray;

const int INF = 1 << 29;
const LL LINF = 1LL << 60;

inline int getInt() { int itiv; return (cin >> itiv, itiv); }
template <typename T> void readAll(vector<T>& vec) { for (int i = 0, size = vec.size(); i < size; i++) cin >> vec[i]; }
template <typename T, typename U> void readAll(vector<pair<T, U> >& vec) { for (int i = 0, size = vec.size(); i < size; i++) cin >> vec[i].first >> vec[i].second; }
template < typename T > inline string toString( const T &a ){ ostringstream oss; oss << a; return oss.str(); };
inline bool between(int min, int max, int n) { return min <= n && n <= max; }
inline bool inRange(int begin, int end, int n) { return begin <= n && n < end; }
inline bool inRange(int size, int n) { return 0 <= n && n < size; }

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

int x, n;

const int MAX_N = 1000000;
int prime[MAX_N];
bool is_prime[MAX_N + 1];
int eratos(int n)
{
	int p = 0;
	for (int i = 0; i <= n; i++) is_prime[i] = true;
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= n; i++)
	{
		if(is_prime[i])
		{
			prime[p++] = i;
			for (int j = 2*i; j <= n; j += i) is_prime[j] = false; 
		}
	}
	return p;
}

bool dp[1000000];

int main(void)
{
	ios::sync_with_stdio(false);
	while(cin >> n >> x && n)
	{
		memset(dp, false, sizeof(dp));
		int ps = eratos(x);
		dp[0] = true;
		int ans = -1;
		for (int i = 0; i < n; i++)
		{
			int price = getInt();
			for (int j = 0; j <= x; j++)
			{
				if(dp[j] && is_prime[j]) ans = max(ans, j);
				if(j + price <= x && dp[j]) dp[j + price] = dp[j];
			}
		}

		cout << (ans == -1 ? "NA" : toString(ans)) << endl;
	}
	return 0;
}

Measured memory_bytes: 5316
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;
int maxx=-0x3f,a[100005];
int s[100005],n;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	sort(a+1,a+1+n);
	for(int i=1;i<=n;i++){
		s[a[i]-1]++;
		s[a[i]]++;
		s[a[i]+1]++;
		maxx=max(maxx,max(s[a[i]-1],max(s[a[i]],s[a[i]+1])));
	}
	printf("%d",maxx);
	return 0;
} 


Measured memory_bytes: 1024
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 100002;
#define endl '\n'
#define int ll
#define ld long double
#define all(x) (x).begin(),(x).end()

int32_t main()
{ 
   IOS
 
  int n;
  cin >> n;
  int ans = 0;
  for(int i = 1;i<=n;i++){
    int x;
    cin >> x;
    if(i%2 and x%2)
      ans++;
  }
  cout << ans << endl;
  



  

  

  
  
  
  

  
  
  
    


  


  
}

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

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

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

int main() {
  long a, b; 

  while(cin >> a >> b) {

    cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
  }
}

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

int main(){
  int n, sum;
  while(cin >> n, n){
    int N = n;
    sum = 1;
    for(int i = 1; i <= n; i++){
      if(n % i == 0) {
	  int j = 1, temp = 1;
	  while(n % i == 0 && i != 1){
	    n /= i;
	    temp += (int)pow(i,j++);
	  }
	  //	  cout <<"temp"<< temp << endl;
	  sum *= temp;
      }
    }
    sum -= N;
    //        cout << sum << endl;
    if(sum > N) cout << "abundant number" << endl;
    else if(sum < N) cout << "deficient number" << endl;
    else cout << "perfect number" << endl;

    
  }
  return 0;
}

Measured memory_bytes: 1196