akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int x,y,d,res,i;
    cin>>x>>d>>y;
    res=(x*y)-d;
    cout<<res<<endl;
    for(i=0;i<9;i++)
    {
        res=(res*x)-d;
        cout<<res<<endl;
    }
}


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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n, m;
  cin >> n >> m;
  
  vector<ll> a(n + 1);
  for(int i = 1; i <= n; i++){
    cin >> a.at(i);
    a.at(i) += a.at(i - 1);
    a.at(i) %= m;
  }
  
  map<ll, ll> mp;
  ll ans = 0;
  for(int i = 1; i <= n; i++){
    ans += mp[a.at(i)];
    mp[a.at(i)]++;
    
    // 単独でMの倍数のとき
    if(a.at(i) == 0) ans++;
  }
  
  cout << ans << "\n";
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#pragma optimize("O2")
#define IOS cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false)
using namespace std;

int dp[10][10];
int fi(int x){
	int res = 0;
	while(x){
		res = x % 10;
		x /= 10;
	}
	return res;
}

int la(int x){
	return x % 10;
}

int main(){
	IOS;
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		dp[fi(i)][la(i)]++;
	}
	long long ans = 0;
	for(int i = 1; i <= 9; i++){
		for(int j = i; j <= 9; j++){
			if(i == j){
				ans += dp[i][j] * dp[i][j];
			}else{
				ans += 2 * (dp[i][j]) * (dp[j][i]);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(ll i=0;i<(n);++i)
#define Fr(i,n) for(long long i=1;i<=(n);++i)
#define ifr(i,n) for(long long i=(n)-1;i>=0;--i)
#define iFr(i,n) for(long long i=(n);i>0;--i)
using Graph = vector<vector<int>>;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a,b,c;
  ll n,k;
  cin>>n>>k;
  vector<pair<int, int> > pairs(n);
  for (int i = 0; i < n; i++) {
    cin>>a>>b;
    pairs[i] = make_pair(a,b);
  }
  int i=0;
  c=0;
  sort(pairs.begin(), pairs.end());
  while(c<k){
    if(c+pairs[i].second<k){
      c+=pairs[i].second;
      ++i;
    }
    else{
      cout<<pairs[i].first;
      exit(0);
    }
  }
}  

Measured memory_bytes: 1024
package main

import (
	"fmt"
)

func main() {

	var s string
	var tmp, ans int
	fmt.Scan(&s)

	for i := 0; i < len(s); i++ {
		if s[i] == 'R' {
			tmp++
		} else {
			if tmp > ans {
				ans = tmp
			}
			tmp = 0
		}
	}
	if tmp > ans {
		ans = tmp
	}

	fmt.Println(ans)
}


Measured memory_bytes: 1772
#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#define rep(i,x,y) for(int i=x; i<=y; ++i)

using namespace std;
const int N=105,M=10000005,INF=1000000000;
int n,a[N],L[N],R[N],totl,totr;
bool vis[M];
int prm[M],ans;
int s,t,h[N<<1],cnt,cur[N<<1],g[N<<1],dis[N<<1];
struct edge{int v,f,n;} e[(N*N+N+N)*2];

int getint()
{
	char ch;
	while(!isdigit(ch=getchar()));
	int x=ch-48;
	while(isdigit(ch=getchar())) x=x*10+ch-48;
	return x;
}

void addedge(int u,int v)
{
	e[cnt]=(edge){v,1,h[u]},h[u]=cnt++;
	e[cnt]=(edge){u,0,h[v]},h[v]=cnt++;
}

int isap(int x,int rt)
{
	if(x==t) return rt;
	int sum=0;
	for(int i=cur[x]; i!=-1; i=e[i].n)
		if(e[i].f && dis[x]==dis[e[i].v]+1)
		{
			int f=isap(e[i].v,min(rt-sum,e[i].f));
			e[i].f-=f,e[i^1].f+=f,sum+=f;
			if(cur[x]=i,sum==rt || dis[s]>=t) return sum;
		}
	if(!(--g[dis[x]++])) dis[s]=t;
	++g[dis[x]],cur[x]=h[x];
	return sum;
}

int main()
{
	n=getint();
	rep(i,1,n) a[i]=getint();
	for(int i=1,j; i<=n; i=j+1)
	{
		for(j=i; j+1<=n && a[j]+1==a[j+1]; ++j);
		if(a[i]&1) ++totl,L[totl]=a[i];
		else ++totr,R[totr]=a[i];
		if((a[j]+1)&1) ++totl,L[totl]=a[j]+1;
		else ++totr,R[totr]=a[j]+1;
	}
	
	vis[1]=1;
	rep(i,2,a[n])
	{
		if(!vis[i]) prm[++*prm]=i;
		rep(j,1,*prm)
		{
			if(i*prm[j]>a[n]) break;
			vis[i*prm[j]]=1;
			if(i%prm[j]==0) break;
		}
	}

	s=totl+totr+1,t=s+1;
	memset(h,-1,sizeof(h));
	rep(i,1,totl) rep(j,1,totr) if(!vis[abs(L[i]-R[j])]) addedge(i,j+totl);
	rep(i,1,totl) addedge(s,i);
	rep(i,1,totr) addedge(i+totl,t);
	memcpy(cur,h,sizeof(h));
	for(g[0]=t; dis[s]<t; ans+=isap(s,INF));
	printf("%d\n",ans+(totl-ans>>1)*2+(totr-ans>>1)*2+((totl-ans)&1)*3);
	return 0;
}

Measured memory_bytes: 14208
#include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(int i=1;i<=n;i++)
#define FORl(i,l,n) for(int i=l;i<n;i++)
using namespace std;
#define pi pair<int,int>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<in>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14

ll power(ll num,ll g,ll mod)
{
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}


int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if (a+b+c>=22) cout << "bust";
	else cout << "win";
}

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

void selectionSort(vector<pair<char, int>>& a, int n) {
  for (int i = 0; i < n; i++) {
    int minj = i;
    for (int j = i; j < n; j++) {
      if (a.at(minj).second > a.at(j).second) minj = j;
    }
    swap(a.at(minj), a.at(i));
  }
}

void bubbleSort(vector<pair<char, int>>& a, int n) {
  for (int i = 0; i < n; i++) {
    for (int j = n - 1; j > i; j--) {
      if (a.at(j - 1).second > a.at(j).second) swap(a.at(j - 1), a.at(j));
    }
  }
}

void print(vector<pair<char, int>>& a) {
  for (int i = 0; i < a.size(); i++) {
    if (i > 0) {
      cout << " ";
    }
    cout << a.at(i).first << a.at(i).second;
  }
  cout << endl;
}

bool isStable(vector<pair<char, int>> a, vector<pair<char, int>> b) {
  for (int i = 0; i < a.size(); i++) {
    if (a.at(i).first != b.at(i).first) {
      return false;
    }
  }
  return true;
}

int main() {
  int n, sw;
  cin >> n;
  vector<pair<char, int>> c1(n), c2(n);
  for (int i = 0; i < n; i++) {
    cin >> c1.at(i).first >> c1.at(i).second;
    c2.at(i).first = c1.at(i).first;
    c2.at(i).second = c1.at(i).second;
  }
  bubbleSort(c1, n);
  selectionSort(c2, n);

  print(c1);
  cout << "Stable" << endl;
  print(c2);
  if (isStable(c1, c2)) {
    cout << "Stable" << endl;
  } else {
    cout << "Not stable" << endl;
  }
  return 0;
}


Measured memory_bytes: 3096
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Program
{
    public class ABC085D
    {
        static public void Main(string[] args)
        {
            var N = NextInt;
            var H = NextLong;
            var count = 0;
            var maxa = 0L;
            var sum = 0L;
            var bary = new long[N];
            for (int i = 0; i < N; ++i)
            {
                var a = NextLong;
                var b = NextLong;
                if (maxa < a) maxa = a;
                bary[i] = b;
            }
            Array.Sort(bary, (x, y) => y.CompareTo(x));
            foreach (var item in bary)
            {
                if (item < maxa) continue;
                sum += item;
                ++count;
                if (sum >= H)
                {
                    Console.Write(count);
                    return;
                }
            }
            Console.WriteLine(count + (H - sum - 1) / maxa + 1);
        }

        static class Console_
        {
            private static Queue<string> param = new Queue<string>();
            public static int NextInt() => int.Parse(NextString());
            public static long NextLong() => long.Parse(NextString());
            public static string NextString()
            {
                if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item);
                return param.Dequeue();
            }
        }
        static int NextInt => Console_.NextInt();
        static long NextLong => Console_.NextLong();
        static string NextString => Console_.NextString();

        static IEnumerable<int> Prime(int x)
        {
            if (x < 2) yield break;
            yield return 2;
            var halfx = x / 2;
            var table = new bool[halfx + 1];
            var max = (int)(Math.Sqrt(x) / 2);
            for (int i = 1; i <= max; ++i)
            {
                if (!table[i])
                {
                    var add = 2 * i + 1;
                    yield return add;
                    for (int j = 2 * i * (i + 1); j <= halfx; j += add)
                    {
                        table[j] = true;
                    }
                }
            }
            for (int i = max + 1; i <= halfx; ++i)
            {
                if (!table[i]) yield return 2 * i + 1;
            }
        }
    }
}


Measured memory_bytes: 17448
#include <iostream>
#include <vector>
#include <algorithm>
#include<stdio.h>
#include<functional>
using namespace std;
typedef long long ll;
int main() {
    int A;
    int B;
    int T;
    cin >> A >> B >> T;
    int ans;
    ans=int((T+0.5)/A)*B;

    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; i++)
#define repR(i,n) for(int i = n; i >= 0; i--)
#define FOR(i,m,n) for(int i = m; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


int main(){
    int h,w;
    cin >> h >> w;
    char c[h][w];
    bool y[h], x[w];
    rep(i,h){
        y[i] = false;
        rep(j,w) {
            cin >> c[i][j];
            x[j] = false;
        }
    }
    rep(i,h){
        rep(j,w)if(c[i][j] == '#') y[i] = true;
    }
    rep(j,w){
        rep(i,h)if(c[i][j] == '#') x[j] = true;
    }

    rep(i,h){
        rep(j,w){
            if(y[i] && x[j]) cout << c[i][j];
        }
        if(y[i]) cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
int main(){
    int a, b, cnt=0;
    scanf("%d %d", &a, &b);
    for(int i=a; i<=b; i++){
        if(i/10000 == i%10 && (i/1000 - i/10000*10) == (i%100/10))
            cnt++;
    }
    printf("%d", cnt);
}


Measured memory_bytes: 384
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int A[]=new int[N];
		for(int i=0;i<N;i++) A[i]=sc.nextInt();
		int D[][] = new int[M][2];
		for(int i=0;i<M;i++) {
			D[i][0]=sc.nextInt();//B
			D[i][1]=sc.nextInt();//C
		}
		sc.close();
		Queue<Integer> pq = new PriorityQueue<Integer>();
		for(int i=0;i<N;i++)pq.offer(A[i]);
		//reverse sort D by C
		Arrays.sort(D,(d1,d2)->d2[1]-d1[1]);
		
		boolean fin = false;
		for(int i=0;i<M;i++) {
			int tB = D[i][0];
			int tC = D[i][1];
			for(int j=0;j<tB;j++) {
				if(pq.peek()<tC) {
					pq.poll();
					pq.offer(tC);
				}else {
					fin = true;
					break;
				}
			}
			if(fin)break;
		}
		long ans = 0;
		while(!pq.isEmpty()) {
			ans += pq.poll();
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 95440
#include<stdio.h>

int main(void){

    int n;
    int ans;
    
    scanf("%d",&n);

    int a[n];
    int x;

    for (int i=0;i<n;i++){
        a[i]=0;
    }
    
    for (int i=0;i<n-1;i++){
        scanf("%d",&x);
        //printf("%d\n",x);
        a[x-1]=a[x-1]+1;
    }

    for (int i=0;i<n;i++){
        // ans=0;
        // for (int j=1;j<n;j++){
        //     if (i==a[j])
        //         ans=ans+1;
        //     else
        //         ans=ans+0; 
        // }
        printf("%d\n",a[i]);
    }

    return 0;
}

Measured memory_bytes: 2508
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ll long long
template <typename T>
bool PN(T x){ if (x <= 1) return false; if (x == 2) return true; for (int i = 2; i < sqrt(x) + 1; i++) if (x % i == 0) return false; return true;}

const ll MOD = 1e9+7;

void solve(){
  int n; cin >> n;
  vector<int> L;
  ll ans = 0;
  if(n == 1 || n == 2) {
    cout << 0 << endl;
    return;
  }
  rep(i, n) {
    int tmp; cin >> tmp;
    L.push_back(tmp);
  }
  sort(L.begin(), L.end());
  for(int i = 0; i < n-2; i++){
    for(int j = i + 1; j < n-1; ++j){
      for(int k = j + 1; k < n; ++k){
        if(L[i] == L[j] || L[j] == L[k]) continue;
        if(max(L[i], max(L[j], L[k])) < L[i] + L[j] + L[k] - max(L[i], max(L[j], L[k]))){
          ans++;

        }    
      }
    }
  }
  cout << ans << endl;
}

int main(){
  solve();
  return 0;
}


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

int comp(const void *a, const void *b)
{
	return *(int *)a - *(int *)b;
}

int main()
{
	int n;
	unsigned int min;
	int a[1000];
	while (scanf("%d", &n) && n) {
		min = -1;
		for (int i = 0; i < n; i++)
			scanf("%d", &a[i]);
		qsort(a, n, sizeof(int), comp);
		for (int i = 0; i < n - 1; i++)
			if (min > a[i + 1] - a[i])
				min = a[i + 1] - a[i];
		printf("%u\n", min);
	}
	return 0;
}



Measured memory_bytes: 2028
s=input()
count=0
for i in range(0,len(list(s))-1):
    if(s[i]!=s[i+1]):
        count+=1
    elif(s[i]==s[i+1]):
        count+=0

if(count>1 or count==1):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9096
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        //MyDebugger.MakeTestCase("../TextFile2.txt");
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl   = input.ReadLine().Split(' ');
        long n    = long.Parse(spl[0]);
        long k    = long.Parse(spl[1]);
        long q    = long.Parse(spl[2]);
        //int[] aa = new int[q];

        long[] points = new long[n];

        for (int i=0; i<q; i++) {
            //aa[i] = int.Parse(input.ReadLine());
            var a = int.Parse(input.ReadLine());
            a--;

            points[a]++;
        }

        StringBuilder buil = new StringBuilder(100);

        for(int i=0; i<n; i++) {
            var point = points[i];
            if(k - q + point > 0) {
                buil.Append("Yes");
            } else {
                buil.Append("No");
            }
            buil.Append(Environment.NewLine);
        }
        return buil.ToString();
    }
}


Measured memory_bytes: 15840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main () {
    string s, t;
 cin >> s >> t;
 int ans = 0;
 if(s[0] == t[0]) ans++;
 if(s[1] == t[1]) ans++;
 if(s[2] == t[2]) ans++;
 cout << ans << endl;
 return 0;
    
    
    
    
    
    
    
    
}
 

Measured memory_bytes: 3576
n=int(input())
p=0
def f(n):
    a=0
    for i in range(2,n):
        if n%i==0:
            a+=1
    if a==6 and n%2==1:
        return True
    else:
        return False
        
if n<105:
    print(0)
else:
    for i in range(105,n+1):
        if f(i)==True:
            p+=1
    print(p)
        

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
using ll = long long;
using graph = std::vector<std::vector<ll>>;

using namespace std;

int main() {
    int N;
    cin >> N;
    int bucket[13];
    for(int i = 0; i < 13; i++){
        bucket[i] = 0;
    }
    bucket[0]++;
    for(int i = 0;i < N; i++){
        int tmp;
        cin >> tmp;
        bucket[tmp]++;
    }
    int pos[24];
    for(int i = 0; i < 24; i++){
        pos[i] = 0;
    }
    pos[0] = bucket[0];
    pos[12] = bucket[12];
    if(pos[0] == 2 || pos[12] == 2){
        cout << 0 << endl;
        return 0;
    }
    for(int i = 1; i < 12; i++){
        if(bucket[i] == 0){
            continue;
        }else if(bucket[i] == 1){
            int rm = 100;
            int lm = 100;
            for(int j = 0;j < i; j++){
                if(pos[j] != 0){
                    rm = i - j;
                }
                if(pos[(24 - j) % 24] != 0){
                    lm = i - j;
                }
            }
            if(rm > lm){
                pos[i] = 1;
            }else{
                pos[24 - i] = 1;
            }
        }else if(bucket[i] == 2){
            pos[i] = 1;
            pos[24 - i] = 1;
        }else{
            cout << 0 << endl;
            return 0;
        }
    }

    int m = 50;
    for(int i = 0; i < 24; i++){
        for(int j = 0; j < 24; j++){
            if(pos[i] == 0 || i == j){
                continue;
            }
            if(pos[j] != 0){
                m = min(m, min(abs(j - i),24 - abs(j - i)));
            }
        }
    }
    cout << m << endl;
}


Measured memory_bytes: 256
N,X=map(int,input().split())
if N!=1:
  L=list(map(int,input().split()))
  tot=0
  count=1
  for i in range(N):
    tot+=L[i]
    if X>=tot:
      count+=1
  print(count)
else:
  L=int(input())
  if X>=L:
    print(2)
  else:
    print(1)

Measured memory_bytes: 3060
/**
*    author:  souzai32
*    created: 13.08.2020 20:24:28
**/

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

int main() {

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);
    sort(a.begin(),a.end(),greater<>());

    int num=a.at(1);
    for(int i=2; i<n; i++){
        if(abs(a.at(i)-a.at(0)/2)<abs(num-a.at(0)/2)) num=a.at(i);
    }
    cout << a.at(0) << ' ' << num << endl;
    return 0;
}

Measured memory_bytes: 3764
using System;
using System.Linq;

namespace _0169
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x[0] == 0)
                {
                    break;
                }
                int n = 0;
                int one = 0;
                for (int i = 0; i < x.Count(); i++)
                {
                    if (x[i] == 1)
                    {
                        n++;
                        one++;
                    }
                    else if (x[i] < 10)
                    {
                        n += x[i];
                    }
                    else
                    {
                        n += 10;
                    }
                }
                for (int i = 0; i < one && n <= 11; i++)
                {
                    n += 10;
                }
                Console.WriteLine(n <= 21 ? n : 0);
            }
        }
    }
}

Measured memory_bytes: 9572
import numpy as np
 
N,K=map(int, input().split())
p=[list(input().split()) for _ in range(N)]
grid = [[[0]*2 for j in range(K)] for i in range(K)]

for i in range(N):
  x, y, c = p[i]
  x, y = int(x), int(y)
  mx, my = x%K, y%K
  f = False
  if (x//K)%2 != (y//K)%2:
    f = not f
  if c == "W":
    f = not f
  if f:
    grid[0][0][0] += 1
    grid[mx][0][0] -= 1
    grid[0][my][0] -= 1
    grid[mx][my][0] += 2
  else:
    grid[0][my][0] += 1
    grid[mx][0][0] += 1
    grid[mx][my][0] -= 2
  f = False
  if (x//K)%2 != (y//K)%2:
    f = not f
  if c == "B":
    f = not f
  if f:
    grid[0][0][1] += 1
    grid[mx][0][1] -= 1
    grid[0][my][1] -= 1
    grid[mx][my][1] += 2
  else:
    grid[0][my][1] += 1
    grid[mx][0][1] += 1
    grid[mx][my][1] -= 2
grid = np.array(grid)
grid = np.cumsum(grid, axis=0)
grid = np.cumsum(grid, axis=1)
print(int(np.max(grid)))

Measured memory_bytes: 153592
#include<complex>
#include<cstdio>
#include<cmath>
using namespace std;
typedef complex<double> P;
#define F(a,b,c) (acos((b*b+c*c-a*a)/2/b/c))
int main(){
	int n;
	double d,e,f,g,h,i;
	for(scanf("%d",&n);n--;){
		scanf("%lf%lf%lf%lf%lf%lf",&d,&g,&e,&h,&f,&i);
		P a(d,g),b(e,h),c(f,i);
		double A=abs(b-c),B=abs(c-a),C=abs(a-b),
		s=sin(2*F(A,B,C)),t=sin(2*F(B,C,A)),u=sin(2*F(C,A,B)),v=s+t+u;
		printf("%.3f %.3f %.3f\n",(d*s+e*t+f*u)/v,(g*s+h*t+i*u)/v,A/sin(F(A,B,C))/2);
	}
}

Measured memory_bytes: 0
from collections import Counter

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    a_c = Counter(a)
    for i in range(1, n+1):
        ans = a_c.get(i)
        if ans:
            print(ans)
        else:
            print(0)
        
if __name__ == '__main__':
    main()

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

#define MAX_N 2003

bitset <MAX_N*MAX_N> bs;

int main()
{
	int n ,sum = 0;
	scanf("%d",&n);
	bs[0] = 1;
	for(int a,i=0; i<n; i++){
		scanf("%d",&a);
		bs |= (bs << a);
		sum += a;
	}
	
	for(int i=(sum+1)/2; i<bs.size(); i++)
		if(bs[i]){
			printf("%d\n",i);
			return 0;
		}
}

Measured memory_bytes: 1664
n = int(input())
A = list(map(int, input().split()))

flag = False
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            flag = True
if flag:
    print("DENIED")
else:
    print("APPROVED")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define pb push_back
#define pf push_front

using namespace std;	
typedef long long int lli;
lli n,k,m,t,a,b,l,r,temp1,temp2,s,x,y,temp,q,d,mod=1e9+7,w,p,c;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  	
  	cin>>n;
  	vector<lli>v(n);
  	lli sum=0;
  	lli ans=0;
  	for(int i=0;i<n;i++)
	{
		cin>>v[i];
		sum+=v[i];
	}
	
	
	for(int i=0;i<n;i++)
	{
		sum-=v[i];
		
		ans=(ans%mod+((v[i]%mod)*(sum%mod))%mod)%mod;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 4776
#include<stdio.h>
int main(void){
  int n,num,m,i,j,k;
  scanf("%d",&n);
  int a[n];
  int x[n][n];
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      x[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d",&num); scanf("%d",&m); 
    for(j=0;j<m;j++){
      scanf("%d",&a[j]);
      x[i][a[j]-1]=1;
    }
    for(k=0;k<n;k++){
      a[k]=0;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",x[i][j]);
      if(j<n-1){
	printf(" ");
      }
    }
    putchar('\n');
  }
    return 0;
}
  



Measured memory_bytes: 2076
import numpy as np
N, K = list(map(int, input().split(' ')))
x = N
min_x = x
while True:
    x1 = x % K if x >= K else np.abs(x - K)
    if x1 == min_x:
        break

    if x1 < min_x:
        min_x = x1
    
    x = x1
print(min_x)

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

typedef long long int ll;
typedef long double ld;

//****************************************************                
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n" //comment it for interactive questions
#define trace1(a) cerr << #a << ": " << a << endl;
#define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
#define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
#define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
#define OC freopen("input.txt" , "r", stdin); freopen("output.txt" , "w", stdout) 
#define MOD (ll)1e9+7; //change it for other mods
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        //*******************************************************
//Some Functions

ll powmod(ll a,ll b)
{
   ll res = 1;
   while(b > 0) {
      if(b & 1) res = (res * a) % MOD;
      a = (a*a)%MOD;
      b = b >> 1; 
  }
  return res % MOD;
}

void solve()
{
    ll n;
    cin >> n;
    if(n%2 == 1) {
    	cout << "0\n";
    } else {
    	ll k = n/2;
    	ll ans = 0;
    	while(k > 0) {
    		k/=5;
    		ans += k;
    	}
    	cout << ans << "\n";
    }
}

int main()
{
    FAST_IO;
    #ifndef ONLINE_JUDGE 
      // OC;
    #endif
    ll t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
unsigned long long inf = 0;
int main(){
	char ch;
	string str;
	cin>>str;
	if(str=="0"){cout<<"Yes"<<endl;return 0;}
	int leng=str.length();
	for(int i=0;i<str.length();i++){
		inf += str[i]-'0';
		inf %= 9;
	}
	if(!inf){
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3744
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int char_count(char a, char b, char c){
    set<char> se;
    se.insert(a); se.insert(b); se.insert(c);
    int n = se.size();
    return n-1;
}

int main(){
    int N; string a, b, c; cin >> N >> a >> b >> c;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        ans += char_count(a[i], b[i], c[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
use std::cmp;

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

#[allow(dead_code)]
fn find_min(x: &[u64]) -> u64 {
    let mut min: u64 = x[0];
    let mut x_iter = x.iter();
    while let Some(i) = x_iter.next() {
        min = cmp::min(*i, min);
    }
    return min;
}

#[allow(dead_code)]
fn find_max(x: &[u64]) -> u64 {
    let mut max: u64 = x[0];
    let mut x_iter = x.iter();
    while let Some(i) = x_iter.next() {
        max = cmp::max(*i, max);
    }
    return max;
}
fn main() {
    let init: Vec<usize> = read_vec();
    let n = init[0];
    let m = init[1];

    let mut x: Vec<i32> = read_vec();

    if n < m {
        x.sort();

        let mut l: Vec<i32> = Vec::new();
        for i in 0..m - 1 {
            l.push(x[i + 1] - x[i]);
        }

        l.sort();

        let mut ans: i32 = x[m - 1] - x[0];

        for i in 0..n - 1 {
            ans -= l[m - 2 - i];
        }

        println!("{}", ans);
    } else {
        println!("{}", 0);
    }
}


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

int main()
{
    int ans = 0;
    vector<char> S(4);
    for (int i = 0; i < 4;i++){
        cin >> S.at(i);
        if(S.at(i)=='+'){
            ans++;
        }
        else{
            ans--;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define H 500

int A[H],n;

int main(void){

  int k,p,l,r,i;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }

  for(i=1;i<=n;i++){
    k = A[i];
    p = A[i/2];
    l = A[2*i];
    r = A[(2*i)+1];

    printf("node %d: key = %d, ",i,k);
    if(p!=0 && i != 1) printf("parent key = %d, ",p);
    if(l!=0) printf("left key = %d, ",l);
    else{
      printf("\n");
      continue;
    }
    if(r!=0)  printf("right key = %d, ",r);
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;

int a[101010];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int k,t;
	cin>>k>>t;
	for (int i=0;i<t;i++){
		cin>>a[i];
	}
	int v=0;
	int e=-1;
	for (int i=0;i<k;i++){
		int ma=0;
		int f=-1;
		for (int j=0;j<t;j++){
			if (j!=e&&a[j]>ma){
				ma=a[j];
				f=j;
			}
		}
		if (f==-1){
			v++;
			a[e]--;
		}
		else{
			a[f]--;
			e=f;
		}
	}
	cout<<v<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int X;
	while(1){
	scanf("%d",&X);
		if(X>=1&&X<=9){
			break;
		}
	}
	if(X==3||X==5||X==7){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n), h(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> h[i];
  }

  for (int PosX = 0; PosX <= 100; PosX++) {
    for (int PosY = 0; PosY <= 100; PosY++) {
      int high = -1;
      for (int i = 0; i < n; i++) {
        if (h[i] > 0) {
          int tmp = h[i] + abs(PosX - x[i]) + abs(PosY - y[i]);
          if (high == -1) {
            high = tmp;
          } else {
            if (high != tmp) {
              high = -2;
              break;
            }
          }
        }
      }
      if (high == -2)
        continue;

      // 高さがゼロの時の処理
      for (int i = 0; i < n; i++) {
        if (h[i] == 0) {
          int tmp = abs(PosX - x[i]) + abs(PosY - y[i]);
          if (!(high <= tmp)) {
            high = -2;
            break;
          }
        }
      }
      if (high == -2)
        continue;

      cout << PosX << ' ' << PosY << ' ' << high << endl;
      return 0;
    }
  }
}


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

int main() {
  int n,m;
  cin>>n>>m;
  vector<pair<int,int>>p(n);
  for(int i=0;i<n;i++) cin>>p[i].first>>p[i].second;
  vector<pair<int,int>>c(m);
  for(int i=0;i<m;i++) cin>>c[i].first>>c[i].second;
  for(int i=0;i<n;i++){
    int x=1000000000;
    int ans;
    for(int j=0;j<m;j++){
      if(x>abs(p[i].first-c[j].first)+abs(p[i].second-c[j].second)){
        x=abs(p[i].first-c[j].first)+abs(p[i].second-c[j].second);
        ans=j+1;
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 256
w, h, n = map(int, input().split())
xya = [tuple(int(x) for x in input().split()) for _ in range(n)]

s = [0,0]
t = [w, h]
for x, y, a in xya:
    if a == 1:
        s[0] = max(s[0], x)
    elif a == 2:
        t[0] = min(t[0], x)
    elif a == 3:
        s[1] = max(s[1], y)
    elif a == 4:
        t[1] = min(t[1], y)

if s[0] >= t[0] or s[1] >= t[1]:
    print(0)
else:
    print((t[0] - s[0]) * (t[1] - s[1]))

Measured memory_bytes: 3064
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const int mod = 1000000007;
const int INF = 1 << 30;
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define vin(v,n) rep(i,n)cin>>v[i];
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define sz size()
#define fi first
#define se second0
#define pb push_back
#define prqueue priority_queue<ll,vector<ll>,greater<ll>>
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
ll f(ll n) {
	ll m = n;
	ll sum = 0;
	while (m>0) {
		sum += m % 10;
		m /= 10;
	}
	return sum;
}
int main() {
	ll n, a, b,ans=0;
	cin >> n >> a >> b;
	for (ll i = 1; i <= n; ++i) {
		ll num = f(i);
		if (num >= a && num <= b)ans+=i;	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	int n,dp[400][400] = {};
	cin >> n;
	for(int i = 0;i < n;i++){
		int s,l,p;
		cin >> s >> l >> p;
		for(int j = 0;j < 400;j++){
			dp[i + 1][j] = max(dp[i + 1][j],dp[i][j]);
			for(int k = s;k <= l;k++) {
				int now = j + k;
				for(int l = 1;now < 400;l++,now += k){
					dp[i + 1][now] = max(dp[i + 1][now],dp[i][j] + p * l);
				}
			}
		}
	}
	int m,ans[400];
	cin >> m;
	for(int i = 0;i < m;i++){
		int w;
		cin >> w;
		ans[i] = dp[n][w];
		if(!ans[i]){
			cout << -1 << endl;
			return 0;
		}
	}
	for(int i = 0;i < m;i++) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 3700
'use strict';
(function(stdin) {
	var lines  = stdin.toString().split('\n');
	var result = (function(data) {
		return new Range(1,data)
		.filter(function(v) {
			return ((v % 3 === 0) || contain_three(v));
		}).join(' ');
	}(parseInt(lines[0],10)
		));
	console.log('',result);

	function contain_three(num) {
		var digit = num;
		while (digit > 0) {
			if (digit % 10 === 3) return true;
			digit = ~~(digit / 10);
		}
		return false;
	}

	function Range(begin,end) { 
		var result = [];
		for (var i = begin; i <= end; i++) result.push(i);
			return result;
	}
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 9808
package main

import "fmt"

func main() {
	var X, Y int
	fmt.Scan(&X)
	fmt.Scan(&Y)
	prize := 0
	if X <= 3 {
		prize += (4 - X) * 100000
	}
	if Y <= 3 {
		prize += (4 - Y) * 100000
	}
	if X == 1 && Y == 1 {
		prize += 400000
	}
	fmt.Println(prize)
}


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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int []a = new int [n];
		int sum = 0;
		
		for(int i = 0;i < n;i++) {
			a[i] = sc.nextInt();
			sum += a[i] - 1;
		}
		System.out.println(sum);

	}

}


Measured memory_bytes: 25960
#pragma GCC optimize("Ofast")
#include<iostream>
int mod=1e9+7;
using namespace std;
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n,k,p[5000],c[5000];
	cin>>n>>k;
	for(int i=0;i<n;i++)
		cin>>p[i],p[i]--;
	for(int i=0;i<n;i++)
		cin>>c[i];
	long long ans=-mod;
	long long mpsco[5000];
	int mpcnt[5000];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			mpsco[j]=0;
			mpcnt[j]=-1;
		}
		int pos=i,cnt=0;
		long long sco=0;
		while(true){
			if(mpcnt[pos]!=-1)
				break;
			else{
				mpsco[pos]=sco;
				mpcnt[pos]=cnt;
			}
			pos=p[pos];
			sco+=c[pos];
			cnt++;
		}
		int per=cnt-mpcnt[pos];
		long long psc=sco-mpsco[pos];
		long long pans=-mod,tmp=0;
		int tpos=i;
		for(int j=0;j<min(k,cnt);j++){
			tpos=p[tpos];
			tmp+=c[tpos];
			pans=max(pans,tmp);
		}
		if(k-(k-mpcnt[pos])%per-per>=mpcnt[pos]){
			tmp=(k-(k-mpcnt[pos])%per-per-mpcnt[pos])/per*psc+mpsco[pos];
			tpos=pos;
			for(int j=k-(k-mpcnt[pos])%per-per;j<k;j++){
				tpos=p[tpos];
				tmp+=c[tpos];
				pans=max(pans,tmp);
			}
		}
		ans=max(pans,ans);
	}
	cout<<ans<<'\n';
}

Measured memory_bytes: 3656
/*
@author: sharrad99
*/
#include<bits/stdc++.h>
using namespace std;
int main(){

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

	string s;
	cin >> s;

	bool a = false, b = false;
	for(int i = 0; i < 3; i++) {
		a |= s[i] == 'A';
		b |= s[i] == 'B';
	}

	cout << (a and b ? "Yes\n" : "No\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxN = 80, inf = 1e7, dd = 80*80; int n, m;
int a[2][maxN][maxN];

int memo[maxN][maxN][2*dd + 1];
int solve(int i = 0, int j = 0, int da = 0, int db = 0)
{
  if (i == n - 1 && j == m - 1) return min(abs((da + a[0][i][j]) - (db + a[1][i][j])), abs((da + a[1][i][j]) - (db + a[0][i][j])));
  if (memo[i][j][da - db + dd] != -1) return memo[i][j][da - db + dd];
  int ans = inf;
  if (i + 1 < n)
  {
    ans = min(ans, solve(i + 1, j, da + a[0][i][j], db + a[1][i][j]));
    ans = min(ans, solve(i + 1, j, da + a[1][i][j], db + a[0][i][j]));
  }
  if (j + 1 < m)
  {
    ans = min(ans, solve(i, j + 1, da + a[0][i][j], db + a[1][i][j]));
    ans = min(ans, solve(i, j + 1, da + a[1][i][j], db + a[0][i][j]));
  }
  return memo[i][j][da - db + dd] = ans;
}

int main()
{
  while (scanf("%d %d", &n, &m) != EOF)
  {
    for (int i = 0; i < 2; i ++)
      for (int j = 0; j < n; j ++)
        for (int k = 0; k < m; k ++)
          scanf("%d", &a[i][j][k]);
    memset(memo, -1, sizeof(memo));
    int ans = solve();
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 320384
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;

const int MAX = 1500 * 1000;
int cnt[MAX + 1];

void input(vector<int>& vec, int size) {
	for(int i = 1; i <= size; ++i) {
		cin >> vec[i];
		vec[i] += vec[i - 1];
	}
}

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

	for(int n, m; cin >> n >> m, n;) {
		vector<int> vertical(n + 1, 0), horizontal(m + 1, 0);
		input(vertical, n);
		input(horizontal, m);

		memset(cnt, 0, sizeof(cnt));
		for(int i = 0; i < n; ++i)
			for(int j = i + 1; j <= n; ++j)
				++cnt[vertical[j] - vertical[i]];

		int ans = 0;
		for(int i = 0; i < m; ++i)
			for(int j = i + 1; j <= m; ++j)
				ans += cnt[horizontal[j] - horizontal[i]];

		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 7076
#include <stdio.h>
 
int main(void) {
    char c;
    while((c=getchar())!='\n' && c!=EOF) {
        if(c>='a' && c<='z')
            printf("%c",c-'a'+'A');
        else
            printf("%c",c);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 524
def cd(a, b, c, d, s):
    for i in range(b, d + 1):
        if s[i] + s[i + 1] == "##":
            return "No"
    for i in range(a, c + 1):
        if s[i] + s[i + 1] == "##":
            return "No"
    return "Yes"


def dc(a, b, c, d, s):
    flag = False
    for i in range(b, d + 1):
        if s[i] + s[i + 1] == "##":
            return "No"
        if s[i - 1] + s[i] + s[i + 1] == "...":
            flag = True
    for i in range(a, c + 1):
        if s[i] + s[i + 1] == "##":
            return "No"
    if flag:
        return "Yes"
    else:
        return "No"


if __name__ == "__main__":
    n, a, b, c, d = map(int, input().split())
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    s = input()+"##"

    if c < d:
        ans = cd(a, b, c, d, s)
    else:
        ans = dc(a, b, c, d, s)
    print(ans)


Measured memory_bytes: 3572
/**
 * File              : B.cpp
 * Author            : JCHRYS <jchrys@me.com>
 * Date              : 16.02.2020
 * Last Modified Date: 16.02.2020
 * Last Modified By  : JCHRYS <jchrys@me.com>
 */

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

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        if (tmp &1) {

        } else {
            if (tmp % 3 == 0 || tmp % 5 == 0) {

            } else {
                cout << "DENIED";
                return 0;
            }

        }

    }
    cout << "APPROVED";
    return 0;
}


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

using int64 = long long;

const int64 MOD = 1e9 + 7;

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

    vector<pair<int, int>> vec;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        vec.emplace_back(a, -1);
    }
    for (int i = 0; i < N; i++) {
        int b;
        cin >> b;
        vec.emplace_back(b, 1);
    }
    sort(vec.begin(), vec.end());

    int64 ans = 1;
    int64 h = 0;
    for (int i = 0; i < 2 * N; i++) {
        int sec = vec[i].second;
        if (h * sec < 0) (ans *= abs(h)) %= MOD;
        h += sec;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2420
def solver(n, m, ab_list):
    ab_list = sorted(ab_list, key=lambda ab:ab[0])
    ans = 0
    for ab in ab_list:
        if (m > ab[1]):
            m -= ab[1]
            ans += ab[0] * ab[1]
        else:
            ans += ab[0] * m
            return ans


if __name__ == '__main__':

    n, m = map(int, input().split())
    ab_list = []
    for _ in range(n):
        ab_list.append(list(map(int, input().split())))

    ans = solver(n, m, ab_list)
    print(ans)

Measured memory_bytes: 29796
using System;

class Program
{
	static void Main()
	{
		string[] data = Console.ReadLine().Split(' ');
		int W, H, x, y, r;
		W = Int32.Parse(data[0]);
		H = Int32.Parse(data[1]);
		x = Int32.Parse(data[2]);
		y = Int32.Parse(data[3]);
		r = Int32.Parse(data[4]);
		if (x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H)
		{
			Console.WriteLine("Yes");
		}
		else
		{
			Console.WriteLine("No");
		}
	}
}

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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a1 = Integer.parseInt(str[0]);
    int a2 = Integer.parseInt(str[1]);
    int a3 = Integer.parseInt(str[2]);
    System.out.println(a1+a2+a3>=22?"bust":"win");
  }
}

Measured memory_bytes: 25044
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>
#include <queue>
#include <stack>

using namespace std;



int main() {
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	sort(h.begin(), h.end());
	int mini = 1000000000;
	for (int i = 0; i <= n - k; i++) {
		int dif = h[i + k - 1] - h[i];
		mini = min(mini, dif);
	}
	cout << mini << endl;
	return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#define int long long
using namespace std;

signed main(){
	int w,h,n,x[100000],y[100000],mx[100000],my[100000];
	cin >> w >> h >> n;
	for(int i = 0;i < n;i++){
		cin >> x[i] >> y[i];
		mx[i] = x[i];
		my[i] = y[i];
	}
	sort(x,x + n);
	sort(y,y + n);
	int sum = 0,ma = 0,xx,yy;
	if(n % 2 == 1){
		for(int i = 0;i < n;i++){
			int d = abs(x[n / 2] - mx[i]) + abs(y[n / 2] - my[i]);
			sum += d;
			ma = max(ma,d);
		}
		cout << sum * 2 - ma << endl;
		cout << x[n / 2] << " " << y[n / 2] << endl;
	}
	else{
		int mas = 1e+18;
		for(int j = 0;j < 2;j++){
			for(int k = 0;k < 2;k++){
				sum = 0;
				ma = 0;
				for(int i = 0;i < n;i++){
					int d = abs(x[n / 2 - j] - mx[i]) + abs(y[n / 2 - k] - my[i]);
					sum += d;
					ma = max(ma,d);
				}
				if(mas >= sum * 2 - ma){
					mas = min(mas,sum * 2 - ma);
					xx = x[n / 2 - j];
					yy = y[n / 2 - k];
				}
			}
		}
		cout << mas << endl;
		cout << xx << " " << yy << endl;
	}
	return 0;
}

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

#define int long long

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll H, W, N; cin >> H >> W >> N;
    map<pl, ll> m; // 左上の座標が(h, w)である3*3の正方形に含まれる黒い点の数
    REP(i, N)
    {
        ll a, b; cin >> a >> b;
        for(ll h = a-2; h <= a; h++)
        {
            for(ll w = b-2; w <= b; w++)
            {
                if(1 <= h && h <= H-2 && 1 <= w && w <= W-2) m[mp(h, w)]++;
            }
        }
    }
    
    vl count(10);
    for(auto itr = m.begin(); itr != m.end(); itr++)
    {
        count[itr->second]++;
    }
    ll n = accumulate(ALL(count), 0);
    n = (H-2) * (W-2) - n;
    count[0] = n;
    REP(i, 10) cout << count[i] << endl;
}

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

int		main(void)
{
	int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;

	cin >> k;
	cout << a[k - 1] << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    string S;
    cin >> S;
    int N=S.length();
    lint ans=0;
    rep(i,N-1){
        if(S[i]=='<' && S[i+1]=='>'){
            lint A=0,B=0,Ap=i,Bp=i+1;
            while(S[Ap]=='<' && Ap>=0){
                A++;
                Ap--;
            }
            while(S[Bp]=='>' && Bp<N){
                B++;
                Bp++;
            }
            ans-=min(A,B);
        }
    }
    lint count=0;
    char save=S[0];
    rep(i,N){
        if(S[i]==save) count++;
        else{
            ans+=(count*(count+1))/2;
            count=1;
            save=S[i];
        }
    }
    if(count>0){
        ans+=(count*(count+1))/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1172
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define ub upper_bound
#define lb lower_bound
#define bit __builtin_popcount
#define memset(x) memset(x,0,sizeof(x))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vector<int>> matrix;

inline void boost(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const ll maxn=2e5+123;
const ll inf=1e9+123;
const ll linf=1e18+123;
const ll mod=1e9+7;
const double eps=1e-9;
const double pi=acos(-1);
int dx[8]={0,1,-1,0,1,-1,1,-1};
int dy[8]={1,0,0,-1,1,1,-1,-1};
vector<int>v;
int main(){
    boost();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int m,k;
    cin>>m>>k;
    if((m==1 && k==1) || k>=(1<<m)){
        cout<<"-1";
        return 0;
    }
    if(k==0){
        for(int i=0;i<=(1<<m)-1;i++){
            cout<<i<<" "<<i<<" ";
        }
        return 0;
    }
    cout<<"0 "<<k<<" 0 ";
    for(int i=1;i<=(1<<m)-1;i++){
        if(i!=k){
            cout<<i<<" ";
        }
    }
    cout<<k<<" ";
    for(int i=(1<<m)-1;i>=1;i--){
        if(i!=k){
            cout<<i<<" ";
        }
    }
	exit(0);
}


Measured memory_bytes: 1792
a = 0
while a < 100:
    h, w = map(int, input().split())

    if h == 0 and w == 0:
        break
    elif h == 1 and w == 1:
        print("#")
    elif h == 2 and w == 2:
        print("#.")
        print(".#")
    elif h % 2 == 0 and w % 2 == 0:
        b = 0
        while b <= (h - 2) / 2:
            for i in range(int(w/2)):
                print("#.", end = "")
            print()
            for j in range(int(w/2)):
                print(".#", end = "")
            print()
            b += 1
    elif h % 2 == 1 and w % 2 == 0:
        b = 0
        while b < (h - 2) / 2:
            for i in range(int(w/2)):
                print("#.", end = "")
            print()
            for j in range(int(w/2)):
                print(".#", end = "")
            print()
            b += 1
        for i in range(int(w/2)):
            print("#.", end = "")
        print()
    elif h % 2 == 0 and w % 2 == 1:
        b = 0
        while b <= (h - 2) / 2:
            for i in range(int(w/2)):
                print("#.", end = "")
            print("#")
            for j in range(int(w/2)):
                print(".#", end = "")
            print(".")
            b += 1
    elif h % 2 == 1 and w % 2 == 1:
        b = 0
        while b <= (h - 2) / 2:
            for i in range(int(w/2)):
                print("#.", end = "")
            print("#")
            for j in range(int(w/2)):
                print(".#", end = "")
            print(".")
            b += 1
        for i in range(int(w/2)):
            print("#.", end = "")
        print("#")
    print()
    a += 1


Measured memory_bytes: 6412