akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
from collections import Counter
from bisect import bisect_left

def f(i, d, dsum, n):
    return func(i, d) + dsum[i] + dsum[n] - dsum[i+1]

def func(i, w):
    return w[i][1] * max(0, w[i][1]-1) // 2

def main():
    n = int(input().strip())
    v = list(map(int, input().strip().split()))
    d = dict(Counter(v))
    w = []
    for k in sorted(d.keys()):
        w.append([k, d[k]])
    m = len(w)
    c = [0] * (m+1)
    for i in range(1, m+1):
        c[i] = c[i-1] + func(i-1, w)
        # print(func(i-1, w))
    q = [u[0] for u in w]
    # print(c)
    # print(w)
    for i in v:
        g = bisect_left(q, i)
        # print(q)
        # print(i)
        # print('g: ', g)
        w[g][1] -= 1
        print(f(g, w, c, m))
        w[g][1] += 1


if __name__ == '__main__':
    main()


Measured memory_bytes: 114528
#include <stdio.h>
int main(){
  int i,j,N,k,key,A[1000];
  scanf("%d",&N);
  for(i = 0; i < N; i++){
    scanf("%d",&A[i]);
  }
  for(i = 0; i < N; i++){
    key =  A[i];
    j = i - 1;
    while(j >= 0 && A[j] > key){
      A[j+1] = A[j];
      j--;
      A[j+1] = key;
    }
    for(k = 0; k < N-1; k++){
      printf("%d ",A[k]);
    }
    printf("%d\n",A[k]);
  }
  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define ll long long
#define P pair<int,int>
using namespace std;
const int maxn = 3e5 + 50;
int a[maxn];
ll sum[maxn];
int n;
vector<int> v;
void init(){
    scanf("%d", &n);
    for(int i = 0; i < n; ++i){
        int x; scanf("%d", &x); a[x]++;
    }
    for(int i = 1; i <= n; ++i){
        if(a[i]) v.push_back(a[i]);
    }
    sort(v.begin(), v.end());
    sum[0] = v[0];
    for(int i = 1; i < v.size(); ++i) sum[i] = sum[i-1] + v[i];
}
bool check(int k, ll lim){
    int pos = lower_bound(v.begin(), v.end(), lim) - v.begin();
    k -= (v.size() - pos);
    if(k <= 0) return true;
    return sum[pos-1] >= k*lim;
}
void sol(){
    printf("%d\n", n);
    int p = 0;
    for(int k = 2; k <= n; ++k){
        if(k > v.size()){
            printf("0\n"); continue;
        }
        int l = 0, r = n;
        int ans;
        while(l <= r){
            int mid = (l+r)>>1;
            if(check(k,mid)) ans = mid, l = mid + 1;
            else r = mid-1;
        }
        printf("%d\n", ans);
    }
}
int main()
{
	init(); sol();
}


Measured memory_bytes: 5488
n = int(input())
A = [list(map(int, input().split())) for i in range(n)]
dp = [[0,0,0] for i in range(n)]

dp[0] = A[0]
for i in range(n-1):
    for j in range(3):
        for l in range(3):
            if j == l: continue
            dp[i+1][l] = max(dp[i+1][l], dp[i][j]+A[i+1][l])

print(max(dp[n-1]))

Measured memory_bytes: 47312
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)

using namespace std;
typedef long long ll;

int main(){
	int N, M, c;
	ll a[105], ans=0;
	
	cin >> N >> M;

	rep(i,N){
		cout << "lst " << i << endl;
		cin >> a[i];
		rep(j,a[i]) cin >> c;
		ans += a[i] * (a[i]-1);
	}

	cout << "ans " << ans << endl;

	return 0;
}

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

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        public static List<long> GeneratePrime(long max)
        {
            long prime;
            double sqrtMax = Math.Sqrt(max);
            var primeList = new List<long>();

            List<long> searchList = new List<long>();
            for (long i = 2; i <= max - 1; i++)
            {
                searchList.Add(i);
            }

            do
            {
                prime = searchList.First();
                primeList.Add(prime);
                searchList.RemoveAll(n => n % prime == 0);
            } while (prime < sqrtMax);

            primeList.AddRange(searchList);

            return primeList;
        }

        void Omame()
        {
            cin = new Scanner();
            string S = cin.next();
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < S.Length; i++)
            {
                sb.Append("x");
            }

            Console.WriteLine(sb.ToString());
        }

    }
}


Measured memory_bytes: 11220
import java.util.*;
public class Main {
	public static void main(String[] args){
		String result = "APPROVED";
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if (a % 2 == 0) {
				if (a % 3 == 0 || a % 5 == 0) {
					continue;
                }
				result = "DENIED";
				break;
            }
        }
		System.out.println(result);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1e9 + 7;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
const int inf = 1000000000; // 10^9 Ten to the power of nine.
/**** Type Define ****/
 
    int main(){
        ll n;
        cin >>n;
        string ans ="";
         while(n){
            n--;
            ans+=(n%26)+'a';
            n/=26;

         }
         
         	 reverse(ans.begin(), ans.end());
           	 cout << ans << endl;
         
         return 0;}



Measured memory_bytes: 3604
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, M;

  std::cin >> N >> M;

  std::cout << (M >= N ? "Yes" : "No") << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 1000003
#define inf 1e18
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define sumall(v) accumulate(all(v),(ll)0)
#define sum accumulate
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::floatfield );std::cout.precision(15)
#define PI M_PI
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define showzero cout<<std::showpoint
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define br "\n"
#define sp " "
#define zero (ll)0
using namespace  std ;
typedef double db;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v , ll a = 0)
{
    //ll a ;
    for(ll i=a ; i<v.size() ; i=i+1)
    {
        v[i] = max((ll)0,v[i]);
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
/*vbool isprime(N,true);
vll spf(N,0);
vll prime;
void sieve()
{
    isprime[0] = isprime[1] = false;
    for(ll i = 2 ; i<N ; i++)
    {
        if(isprime[i])
        {
            for(ll j=2*i ; j<N ; j+=i)
            {
                isprime[j] = false;
                if(spf[j]==0)
                {
                    spf[j] = i;
                }
            }
            prime.pb(i);
        }
    }
}*//*
ll nck(ll n , ll k ,ll m=1e18+7)
{
    ll i , j,b=1,c=1 ;
    if(n-k<k)
    {
        k = n-k ;
    }
    while(k)
    {
        b*=n ;
        c*=k ;
        ll g = __gcd(b,c) ;
        b/=g ;
        c/=g ;
        n--;
        k-- ;
    }
    return(b) ;
}*//*
long long power(long long k , long long n , long long m=mod)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}*/
ll n,m,k,l,r;
bool ok = false;
int main()
{
    FastIO ;
    PRECISION ;
    ll a,b,c,d,i,j,t,x,y,z;//,x1,y1,z1,e,f;
    ll p,q,r,u,w ;
    char ch,chr ;
    string str,st,str1,str2,str3,str4;
    //ll a1=0,a2=0,b1=0,b2=0,c1=0 ;
    //cin>>str>>str1;
    cin>>a>>b>>c>>d;
    x = (c+b-1)/b;
    y = (a+d-1)/d;
    if(x>y)
    {
        cout<<"No";
    }
    else
    {
        cout<<"Yes";
    }
}


Measured memory_bytes: 3628
//Minimum Spanning Tree
//Kruskal's algorithm

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Scanner;

class Edge implements Comparable<Edge> {
	public int v1,v2,w;
	Edge(int v1,int v2,int w){
		this.v1=v1; this.v2=v2; this.w=w;
	}
	public int compareTo(Edge e){
		return this.w - e.w;
	}
}

class Main {

	private static final int                         EMPTY = -1;
	private static       ArrayList<Edge>             E     = new ArrayList<Edge>();
	private static       ArrayList<HashSet<Integer>> V     = new ArrayList<HashSet<Integer>>();

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int t;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				t = sc.nextInt();
				if(t!=EMPTY && j>=i+1){
					E.add(new Edge(i,j,t));
				}
			}
		}
		Collections.sort(E);
		HashSet<Integer> set,t1,t2;
		int v1=EMPTY, v2=EMPTY,sum_w=0;
		out:while(!E.isEmpty()){
			Edge e = E.remove(0);
			t1 = null; t2 = null;
			for(int i=0;i<V.size();i++){
				set = V.get(i);
				if        (set.contains(e.v1)&&set.contains(e.v2)){
					continue out;
				} else if (set.contains(e.v1)){
					t1 = set; v2 = e.v2;
				} else if (set.contains(e.v2)){
					t2 = set; v1 = e.v1;
				}
				if(t1!=null&&t2!=null){break;}
			}
			sum_w += e.w;
			if     (t1!=null&&t2!=null){t1.addAll(t2); V.remove(t2);}
			else if(t1!=null)          {t1.add(v2)   ;}
			else if(t2!=null)          {t2.add(v1)   ;}
			else                       {
				HashSet<Integer> s = new HashSet<Integer>();
				s.add(e.v1); s.add(e.v2); V.add(s);
			}
		}
		System.out.println(sum_w);
	}
}

Measured memory_bytes: 36216
#include <iostream>

using namespace std;

int main()
{
    int n, s=0, stwp;
    cin >> n;
    int a[n+1], b[n+1], c[n+1], A[n+1], B[n+1], C[n+1];
    for(int i=1; i<=n; i++)
    {
          cin >> a[i]  >> b[i] >> c[i];
    }
    A[1]=a[1];
    B[1]=b[1];
    C[1]=c[1];
    for(int i=2; i<=n; i++)
    {
        A[i]=max(B[i-1],C[i-1])+a[i];
        B[i]=max(A[i-1],C[i-1])+b[i];
        C[i]=max(B[i-1],A[i-1])+c[i];
    }
    cout << max(A[n],max(B[n],C[n])) <<endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 305;

int a[MAX_N][MAX_N];
int d[MAX_N][MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n){
        rep(j,n){
            cin >> a[i][j];
        }
        a[i][i] = INF;
    }
    ll ans = 0;
    rep(i,n){
        srep(j,i+1,n){
            int res = INF;
            rep(k,n){
                cmn(res, a[i][k]+a[k][j]);
            }
            if(res < a[i][j]){
                cout << "-1\n";
                return 0;
            }else if(res > a[i][j]){
                ans += a[i][j];
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 640
import java.util.*

fun main(args: Array<String>) {
    val s = HashMap<Long, Long>()
    val n = getInt()
    val a = getLongs()
    a.forEach {
        s[it] = (s[it] ?: 0) + 1
    }

    val b = HashMap<Long, Long>()
    val c = HashMap<Long, Long>()
    s.forEach {
        val k = it.key
        val v = it.value
        b[k] = v * (v - 1) / 2
        c[k] = (v - 1) * (v - 2) / 2
    }
    val total = b.map { it.value }.sum()
    
    val out = ArrayList<Long>()

    a.forEach {
        out.add(total - b[it]!! + c[it]!!)
    }
    println(out.joinToString("\n"))
}

fun getInt() = readLine()!!.toInt()
fun getInts() = readLine()!!.split(" ").map { it.toInt() }
fun getLong() = readLine()!!.toLong()
fun getLongs() = readLine()!!.split(" ").map { it.toLong() }


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

int main() {

    int X;
    cin >> X;

    int d = 360;
    while (d%X != 0) {
        d += 360;
    }

    cout << (d / X) << endl;

    return 0;
}


Measured memory_bytes: 3628
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            while(true)
            {
                var sq = Math.Sqrt(N);
                if(sq==(int)sq)
                {
                    Console.WriteLine(N);
                    return;
                }
                N--;
            }
        }
    }
}


Measured memory_bytes: 13140
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;

using namespace std;


int main() {
	ios::sync_with_stdio(false);
	string s[10] = { "",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz" };
	cin >> N;
	for (int i = 0; i < N; i++) {
		string t;
		string ret;
		cin >> t;
		int box = 0;
		int bag = 0;
		for (auto j : t) {
			if (j == '0') {
				if (box) {
					ret += s[bag][(box - 1) % s[bag].size()];
				}
				box = 0;
			}
			else {
				if (bag == (int)(j - '0'))box++;
				else {
					bag = j - '0';
					box = 1;
				}
			}
		}
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 3124
from collections import deque

h, w = map(int, input().split())
sy, sx = map(int, input().split())
gy, gx = map(int, input().split())
map = []
move = [[0, 1], [1, 0], [0, -1], [-1, 0]]
visit = [[-1]*w for i in range(h)]
visit[sy - 1][sx - 1] = 0
warp = []
cnt = 0

for i in range(-2, 3):
    for j in range(-2, 3):
        if i == 0 and j == 0:
            continue
        else:
            warp.append([i, j])

for i in range(h):
    s = input()
    map.append(s)

route = deque([[sy - 1, sx - 1]])
wroute = deque()

while route:
    while route:
        y, x = route.popleft()
        wroute.append([y, x])
        for i, j in move:
            k = y + i
            l = x + j
            if 0 <= k < h and 0 <= l < w:
                if map[k][l] == ".":
                    if visit[k][l] == visit[y][x]:
                        continue
                    visit[k][l] = visit[y][x]
                    route.append([k, l])
    while wroute:
        y, x = wroute.popleft()
        for i, j in warp:
            k = y + i
            l = x + j
            if 0 <= k < h and 0 <= l < w:
                if map[k][l] == ".":
                    if visit[k][l] != -1:
                        continue
                    visit[k][l] = visit[y][x] + 1
                    route.append([k, l])
    cnt += 1

print(visit[gy - 1][gx - 1])

Measured memory_bytes: 113492
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def egcd(a: int, b: int):
    """extended gcd"""
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y


def mod_inv(a, mod=10**9 + 7):
    """mod inversion """
    g, x, y = egcd(a, mod)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % mod


def mod_combination(n, r, mod=10**9 + 7) -> int:
    r = min(r, n - r)
    res = 1
    for i in range(r):
        res = res * (n - i) * mod_inv(i + 1, mod) % mod
    return res


def main():
    MOD = 10**9 + 7
    n, k = input_int_list()
    for i in range(1, k + 1):
        # 青を仕切る赤が足りない場合
        if i > n - k + 1:
            print(0)
        else:
            # 青を分割するパターン
            div_pat = mod_combination(k - 1, i - 1)
            # 残った赤を配置するパターン
            rem = n - k - (i - 1)
            red_pat = mod_combination(rem + i, rem)
            cnt = (div_pat * red_pat) % MOD
            print(cnt)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 75236
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b
long long gcd(ll x,ll y){
	if(x<y)swap(x,y);
	ll r;
	while(y>0){
		r=x%y;
		x=y;
		y=r;
	}
	return x;
}



signed main(){
	ll x,y; cin>>x>>y;
	cout<<gcd(x,y)<<endl;
	return 0;
}


Measured memory_bytes: 3084
ONE = '1'.freeze
def inv(x)
    res = 1 # 逆元をどんどんかけるやつ
    beki = x # 逆元を計算したい値のMOD化でのべき乗
    (MOD - 2).to_s(2).reverse.chars do |digest|
        res = (beki * res) % MOD if digest == ONE
        beki = (beki * beki) % MOD
    end
    res
end

def nCk(n,k)
    res = 1
    i = k
    j = 1
    while i > 0
        res = res * (n-i+1)
        res %= MOD
        j *= i
        j %= MOD
        i -= 1
    end
    res *= inv(j)
    res %= MOD
    res
end

MOD = 10**9+7
str = gets.split
N,a,b = str[0].to_i, str[1].to_i, str[2].to_i
n = N

answer = 1
c = 2
while n > 0
    d = n % 2
    answer *= d == 1 ? c : 1
    answer %= MOD
    c *= c
    c %= MOD
    n /= 2
end
answer += MOD - 1
answer %= MOD
answer += MOD - nCk(N,a)
answer %= MOD
answer += MOD - nCk(N,b)
answer %= MOD

puts answer

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

typedef long long int ll;

int main () {
    vector<int> xs(5,0);
    int ans = 0;
    for (int i = 0; i < 5; i++){
        cin >> xs[i];
        if (xs[i] == 0) {
            ans = i + 1;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3192
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())
ans = len(make_divisors(N-1))-1

for i in make_divisors(N):
  if i == 1:
    continue
    
  Ni = int(N/i)
  
  while Ni % i == 0:
    Ni = int(Ni/i)
    
  if Ni % i == 1:
    ans+=1
    

print(ans)

Measured memory_bytes: 3188
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N, K = map(int, input().split())
MAX = 10 ** 6 + 5
MOD = 10 ** 9 + 7

fac = [0 for i in range(MAX)]
finv = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]

def comInit(mod):
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod


def com(n, r, mod):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod

def p(n, r, mod):
    return fac[n] * finv[n - r] % mod
    
comInit(MOD)

ans = 0
if K + 1 >= N:
    ans = com(N + N - 1, N - 1, MOD)
else:
    for i in range(K + 1):
        ans += com(N, i, MOD) * com(i + N - i - 1, i, MOD) % MOD
        ans %= MOD
print(ans % MOD)

Measured memory_bytes: 128016
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

vector<int> memo;
int rec(int n) {
    if (n == 0) return 0;
    if (~memo[n]) return memo[n];
    int res = n;
    for (int pow6 = 1; pow6 <= n; pow6 *= 6) chmin(res, rec(n - pow6) + 1);
    for (int pow9 = 1; pow9 <= n; pow9 *= 9) chmin(res, rec(n - pow9) + 1);
    return memo[n] = res;
}

int main() {
    int n; cin >> n;
    memo.assign(n + 1, -1);
    cout << rec(n) << endl;
    return 0;
}

Measured memory_bytes: 5376
#include<stdio.h>

int main(void)
{
    int n, m, i, j, A[100][100], b[100], c[1000];
    
    scanf("%d %d", &n, &m);
    
    for(i=0; i<n; i++){
        for(j=0; j<m; j++){
            scanf("%d ", &A[i][j]);
        }
    }
    for(i=0; i<m; i++){
        scanf("%d", &b[i]);
    }
    
    for(i=0; i<n; i++){
        for(j=0; j<m; j++){
            A[i][j]=A[i][j]*b[j];
            c[i]+=A[i][j];
        }
        printf("%d\n", c[i]);
    }
    
    return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

class CumulativeSum {
    vector<ll> numbers;
    vector<ll> sums;

public:
    CumulativeSum(int n) {
        numbers.resize(n);
        sums.resize(n);
    }

    void set(int i, ll value) {
        numbers[i] = value;
    }

    ll getSum(int i) {
        if (i == -1) return 0;
        if (i == sums.size()) return sums.back();
        return sums[i];
    }

    ll getSectionSum(int start, int end) {
        return getSum(end) - getSum(start - 1);
    }

    void build() {
        for (int i = 0; i < numbers.size(); i++) {
            sums[i] = getSum(i - 1) + numbers[i];
        }
    }

};

int main() {

    int n, k;
    cin >> n >> k;

    vector<int> prev(n);
    rep(i, n)cin >> prev[i];

    rep(_, k) {
        vector<int> next(n, 0);

        rep(i, n) {
            int l = max(0, i - prev[i]);
            next[l]++;
            int r = i + prev[i];
            if (r + 1 < n) {
                next[r + 1]--;
            }
        }

        rep(i, n - 1) {
            next[i + 1] += next[i];
        }

        if (prev == next) {
            break;
        }
        prev = next;
    }

    rep(i, n) {
        cout << prev[i] << ' ';
    }
    cout << endl;


}


Measured memory_bytes: 4844
#include <bits/stdc++.h>
#define rep(i,n) for ((i)=1;(i)<=(n);(i)++)
#define per(i,n) for ((i)=n;(i)>=(1);(i)--)
using namespace std;
const int mod=1e9+7;
int n,m,lim[25][25],ans;
int dp[2][21][1<<20],nxt[1<<20][21];
int main()
{
	int i,j,k,l;
	cin>>n>>m>>k;n--;
	memset(lim,-1,sizeof(lim));
	while(k--)
	{
		int x,y,z;
		cin>>x>>y>>z;
		lim[x][y-1]=z;
	}
	for(i=0;i<(1<<n);i++)
	{
		int lst=-1;
		for(j=n-1;j>=0;j--)
		{
			if((i>>j)&1) lst=j;
			nxt[i][j]=lst;
		}
	}
	dp[0][n][0]=1;
	rep(i,m)
	{
		memset(dp[i&1],0,sizeof(dp[i&1]));
		memcpy(dp[i&1][0],dp[(i-1)&1][n],sizeof(dp[0][0]));
		for(j=0;j<n;j++)
		{
			for(k=0;k<(1<<n);k++) if(dp[i&1][j][k])
			{
//				cerr<<i<<' '<<j<<' '<<k<<' '<<dp[i&1][j][k]<<endl;
				for(l=0;l<=1;l++)
				{
					if(lim[i][j]!=-1&&lim[i][j]!=l) continue;
					if(((k>>j)&1)&&l==0) continue;
					if(((k>>j)&1)==l)
					{
						(dp[i&1][j+1][k]+=dp[i&1][j][k])%=mod;
					}
					else
					{
						int p=nxt[k][j];
						if(p==-1) (dp[i&1][j+1][k^(1<<j)]+=dp[i&1][j][k])%=mod;
						else (dp[i&1][j+1][k^(1<<j)^(1<<p)]+=dp[i&1][j][k])%=mod;
					}
				}
			}
		}
	}
	for(i=0;i<(1<<n);i++) (ans+=dp[m&1][n][i])%=mod;
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
	int a,b;
	cin >> a >> b;
	bool ans=false;
	for(int i=1;i<=3;i++)if((a*b*i)%2==1)ans=true;
	if(ans)cout << "Yes";
	else cout << "No";
	cout << endl;
	return 0;
}

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

if p.count(x)==0:
  print(x)
else:
  a = 1
  while True:
    x1,x2 = x-a,x+a
    if p.count(x1)==0:
      print(x1)
      break
    elif p.count(x2)==0:
      print(x2)
      break
    else:
      a += 1

Measured memory_bytes: 9196
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <numeric>
#include <algorithm>
using namespace std;
int n, a, b, c, x;

int main() {
    while(cin>>n>>a>>b>>c>>x, n||a||b||c||x){
        vector<int> v;
        for(int i=0; i<n; ++i){
            int a; cin >> a;
            v.push_back(a);
        }
        int index=0, frame=0, rm=(a*x+b)%c;
        if(v[0]==x) index++;
        while(index!=n){
            if(frame>10000) break;
            if(rm==v[index]) index++;
            rm = (a*rm+b)%c;
            frame++;
            
        }
        if(frame>10000) cout << -1 << endl;
        else cout << frame << endl;
    }
    return 0;
}


Measured memory_bytes: 3168
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>
#include <atcoder/all>

using namespace std;
using namespace atcoder;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define chmax(x,y) x = max(x,y)
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll n, k, a[300005] = {}, ans = 0;

ll op(ll a, ll b) {
	return max(a, b);
}

ll e() {
	return 0;
}

int main() {
	cin >> n >> k;
	segtree<ll, op, e> seg(300005);
	rep(i, n) {
		cin >> a[i];
		seg.set(a[i], seg.prod(max((ll)0, a[i] - k), min((ll)300000, a[i] + k) + 1) + 1);
		chmax(ans, seg.get(a[i]));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 13860
n = int(input())
mx = 55555
ans = []
primes = [2]
for i in range(3, mx + 1, 2):
    if all(i % p != 0 for p in primes):
        primes.append(i)
        if i % 5 == 1:
            ans.append(i)
        if len(ans) == n:
            break
print(*ans)

Measured memory_bytes: 38896
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>


typedef long long ll;
ll max(ll a, ll b){ return ( a > b )?a:b;}
ll min(ll a, ll b){ return ( a < b )?a:b;}

ll N;

ll pow(ll n, int k){
        if(k==0) return 1;
        ll ans  =1;
        while(k--) ans *= n;
        return ans;
}

#define SPACE 20
ll plus[(1 << SPACE)];
ll minus[(1 << SPACE)];

int main(){
        scanf("%lld",&N);
        if(N == 0){
                 puts("0");
                 return 0;
        }

        for(int x = 0; x < (1<<SPACE); x++){
                for(int r = 0; r < SPACE; r++){
                        if((1<<r) & x) plus[x] += pow(4,r);
                        if((1<<r) & x) minus[x] += 2*pow(4,r);
                }
        }

        std::sort(minus,minus+(1<<SPACE)-1);


        ll p,m;
        for(int x = 0; x < (1<<SPACE); x++){
                p = plus[x];
                ll min = plus[x]-N;
                ll * poi = std::lower_bound(minus,minus+(1<<SPACE)-1,min);
                if( min == *poi){
                        m = min;
                        break;
                }
        }


        char output = 0;
        for(int i = 50; i >= 0; i--){
                if( ( 1L << i ) & (p+m) ) output = 1;
                if(output){
                        if( ( 1 << i) & (p+m) ) printf("1");
                        else printf("0");
                }
        }puts("");

}

Measured memory_bytes: 16640
#include<bits/stdc++.h>
#include <numeric>
#define int long long
#define what_is(x) cerr << #x << " is " << x << endl;
const int MOD = 1e9 + 7;
using namespace std;
int powmod(int a, int b, int MOD = MOD){
    if(!a and !b)    return 1ll;
    if(!a)    return a;
    int res = 1ll;
    b %= (MOD - 1ll), a %= MOD;
    while(b){
        if(b%2 == 1)    res = (res * a) % MOD;
        a = (a * a) % MOD;
        b /= 2;
    }
    return res;
}

void panda() {
    int k, a, b;
    cin >> k >> a >> b;
    for (int i = a; i <= b; ++i) {
        if (i % k == 0) {
            cout << "OK";
            return;
        }
    }
//   int q=a/k;
//   if((q+1)*k>=a and (q+1)*k<=b)
//       cout<<"OK";
//   else cout<<"NG";
    cout << "NG";
}

int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
//    int t;
//    cin>>t;
//    while(t--)
    panda();
}

Measured memory_bytes: 3652
N, M = map(int, input().split())
# N: student, M:check point
stu_x = {}
stu_y = {}
chk_x = {}
chk_y = {}
for i in range(N):
    stu_x[i], stu_y[i] = map(int, input().split())
for i in range(M):
    chk_x[i], chk_y[i] = map(int, input().split())

for i in range(N):
    X = stu_x[i]
    Y = stu_y[i]
    dis = []
    for j in range(M):
        row = abs(X - chk_x[j])
        col = abs(Y - chk_y[j])

        dis.append(row + col)
    index = dis.index(min(dis)) + 1
    print(index)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>

using namespace std;
using ll = long long;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

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;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


ll n, W, V = 0;
ll w[110], v[110];


int main() {
    cin >> n >> W;
    rep(i, n) {
        cin >> w[i] >> v[i];
        V += v[i];
    }
    // dp[i+1][j] = { i+1までのアイテムで価値jにしたときの最小の重み }
    vector<vector<ll>> dp(n+1, vector<ll>(V+1, 1000100000));
    dp[0][0] = 0;
    rep(i, n) {
        rep(j, V+1) {
            if (j >= v[i])
                dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]] + w[i]);
            else
                dp[i+1][j] = dp[i][j];
        }
    }
    ll ans = -1;
    rep(i, V+1) {
        if (dp[n][i] <= W) {
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}


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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

// 最大公約数
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int N;
int A[550][550];
deque<int> prime;
unordered_map<int, int> mpA, mpB;
signed main() {
    cin >> N;
    for (int i = 2; i <= 8000; i++) {
        for (int j = 2; j <= sqrt(i); j++) {
            if (i % j == 0)goto nene;
        }
        prime.push_back(i);
nene:;
    }
    for (int i = 0; i <= N + 1; i++) {
        if (i % 2 == 0) {mpA[2 * i] = prime.front(); prime.pop_front();}
        else {mpA[2 * i] = prime.back(); prime.pop_back();}
    }
    for (int i = 0; i <= N + 10; i++) {
        if (i % 2 == 0) {mpB[2 * i - (N + 4) - N % 2] = prime.front(); prime.pop_front();}
        else {mpB[2 * i - (N + 4) - N % 2] = prime.back(); prime.pop_back();}
    }
    for (int i = 0; i <= N + 1; i++) {
        for (int j = 0; j <= N + 1; j++) {
            if ((i + j) % 2 == 1)continue;
            A[i][j] = mpA[i + j] * mpB[i - j];
        }
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            if ((i + j) % 2 == 0) {cout << A[i][j] << " "; continue;}
            int cur = 1;
            for (int k = 0; k < 4; k++) {
                cur = cur / gcd(cur, A[i + dy[k]][j + dx[k]]) * A[i + dy[k]][j + dx[k]];
            }
            cout << cur * 2 + 1 << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 5376
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ns[] = new int[n];
        for (int i = 0; i < n; i++) {
            ns[i] = sc.nextInt();
        }
        int counts[] = new int[9];
        for (int i = 0; i < n; i++) {
            int cr = ns[i] / 400;
            cr = cr > 8 ? 8 : cr;
            counts[cr]++;
        }
        int min = 0, max = 0;
        for (int i = 0; i < 8; i++) {
            if (counts[i] != 0) {
                min++;
            }
        }
        max = min + counts[counts.length-1];
        min = min == 0 ? 1 : min;
        System.out.println(min + " " + max);
    }
}


Measured memory_bytes: 21972
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let s : Vec<char> = get_one::<String>().chars().collect();
    let mut pos_a = None;
    let mut pos_z = None;
    for (i,c) in s.iter().enumerate() {
        if c == &'A' && pos_a == None {
            pos_a = Some(i);
        }
        else if pos_a != None && c == &'Z' {
            pos_z = Some(i);
        }
    }
    println!("{}", pos_z.unwrap() - pos_a.unwrap() + 1);
}


Measured memory_bytes: 4352
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < (n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < (n); ++(i))
using namespace std;
template <class T>
void setmax(T &a, T const &b) {
    if (a < b) a = b;
}

template <class T>
void setmin(T &a, T const &b) {
    if (a > b) a = b;
}

template <typename T, typename X>
auto vectors(T a, X x) { return vector<T>(x, a); }

template <typename T, typename X, typename Y, typename... Zs>
auto vectors(T a, X x, Y y, Zs... zs) {
    auto cont = vectors(a, y, zs...);
    return vector<decltype(cont)>(x, cont);
}

const int MAX_AI = 1000010;
#define PRINT(X) cout << #X << " : " << X << endl

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    vector<int> prime(MAX_AI);
    for (int i = 0; i < MAX_AI; ++i) {
        prime[i] = i;
    }
    for (int i = 2; i < MAX_AI; ++i) {
        if (prime[i] == i) {
            for (int j = 2 * i; j < MAX_AI; j += i) {
                if (prime[j] == j) prime[j] = i;
            }
        }
    }

    vector<bool> used(MAX_AI, false);
    bool flg = false;
    for (int x : A) {
        while (x > 1) {
            if (used[prime[x]]) {
                flg = true;
                break;
            }
            used[prime[x]] = true;
            int tmp = prime[x];
            while (x % tmp == 0) x /= tmp;
        }
        if (flg) break;
    }
    if (!flg) {
        cout << "pairwise coprime" << endl;
        return 0;
    }

    int res = __gcd(A[0], A[1]);
    for (int i = 2; i < A.size(); ++i) {
        res = __gcd(res, A[i]);
    }
    if (res == 1) {
        cout << "setwise coprime" << endl;
    } else {
        cout << "not coprime" << endl;
    }
    return 0;
}

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;

  if (N * A < B) {
    cout << N * A << endl;
  }
  // ここにプログラムを追記
  else {
    cout << B << endl;
  }
}

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  
  int res = 0;
  if (a == b && b == c) {
    res = 1;
  } else if (a == b || b == c || c == a) {
    res = 2;
  } else {
    res = 3;
  }
    
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;


int main() {
    

    ll n;
    cin >> n;
    set <ll> v;
    for (ll i=0;i<n;i++){
        ll k;
        cin >> k;
        v.insert(k);
    }
    cout << (v.size() == n ? "YES" : "NO") << endl;
}

Measured memory_bytes: 9600
N,Y = map(int, input().split())
for i in range(0, N+1):
    for j in range(0, N+1-i):
        if i == ((Y - 1000*N - 4000*j) / 9000):
            if (N-i-j) >= 0: print(str(i) + " " + str(j) + " " +str(N-i-j))
            exit()
print ("-1 -1 -1")

Measured memory_bytes: 9156
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

int main() {
  int a1, a2, a3;
  scanf("%d %d %d", &a1, &a2, &a3);

  string result = ((a1 + a2 + a3) >= 22) ? "bust" : "win";
  cout << result << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

int main() {
  int s;
  cin >> s;
  map<int, int> mp;
  int ans = 0;
  mp[s]++;
  for (int i = 1; i < 1000001; i++) {
    if (s % 2 == 0) {
      s /= 2;
      mp[s]++;
      if (mp[s] == 2) {
        ans = i + 1;
        break;
      }
    } else {
      s = 3 * s + 1;
      mp[s]++;
      if (mp[s] == 2) {
        ans = i + 1;
        break;
      }
    }
  }
  cout << ans;

  return 0;
}


Measured memory_bytes: 3640
n = int(input())
a = list(map(int, input().split()))
b = [a[i] for i in range(n) if i % 2 == 0]
c = [a[i] for i in range(n) if i % 2 == 1]
if n % 2 == 0:
  d = c[::-1] + b
elif n % 2 == 1:
  d = b[::-1] + c
s = ' '.join([str(e) for e in d])
print(s)

Measured memory_bytes: 37000
import collections


def solve(h1, m1, h2, m2, k):
    mins1 = h1*60 + m1
    mins2 = h2*60 + m2

    return mins2-mins1-k


[h1, m1, h2, m2, k] = list(map(int, input().strip().split()))

print(solve(h1, m1, h2, m2, k))


Measured memory_bytes: 64856
#include<stdio.h>

int main(){

int n,i,ans=0;

scanf("%d",&n);

char a[n],b[n],c[n];

scanf("%s",a);
scanf("%s",b);
scanf("%s",c);

for(i=0;i<n;i++){
if(a[i] == b[i]){
  if(a[i] == c[i]) continue;
  else ans++;
}
else if(a[i] == c[i]) ans++;
else if(b[i] ==c[i]) ans++;
else ans +=2;
}

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

  return 0;

}


Measured memory_bytes: 128
M = 10 ** 6 + 1
N = int(input())
A = list(map(int, input().split()))
 
A.sort()
not_divisible = [True] * (M)
# print(A)

result = 0
for i in range(N):
    target = A[i]
    if not_divisible[target]:
        if i+1 <= N-1 and A[i+1] == A[i]:
            pass
        else:
            result += 1
        for j in range(target, M, target):
            not_divisible[j] = False
print(result)

Measured memory_bytes: 32296
#include<iostream>
#include<math.h>
#include<complex>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include <cstdint>
#include<string.h>

typedef unsigned long long ll;

using namespace std;

int main() {
	string b;
	int i = 0;
	cin >> b;
	
	int a = 0;
	i = 0;

	int cnt = 0;
	int max = 0;
	for (i = 0;b[i] != '\0';i++) {
		if (b[i] == 'A' || b[i] == 'C' || b[i] == 'G' || b[i] == 'T') {
			cnt+=1;
		}
		else {
			if (max < cnt) {
				max = cnt;
				
			}
			cnt = 0;
		}
	}
	if (max < cnt) {
		max = cnt;
	}


	cout << max;


}



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

int main() {
    int n,m;
    cin >> n >> m;
    int mat[n][m];
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            cin >> mat[i][j];
        }
    }
    int vec[m];
    for(int k = 0; k < m; k++) {
        cin >> vec[k];
    }
    vector<int> ans(n,0);
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            ans.at(i) += mat[i][j]*vec[j];
        }
        cout << ans.at(i) << endl;
    }
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
#define INF 1e9

using namespace std;

int main()
{
  int n;
  int a[105];
  
  cin >> n;

  for(int i=0;i < n;i++){
    cin >> a[i] >> a[i+1];
  }
  //dp[i][j] := iからj番目の行列積に必要なスカラー積の最小値
  int dp[105][105] = {};

  //init
  for(int i=0;i < n;i++){
    for(int j=0;j < n;j++){
      if(i == j) dp[i][j] = 0;//iからiまでは当然 0回
      else dp[i][j] = INF;
    }
  }
  
  for(int m = 0; m < n ;m++){
    for(int i = 0; m+i < n ;i++){
      int j = m+i;
      for(int k = i; k < j ;k++){
	dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + a[i]*a[k+1]*a[j+1]);
      }
    }
  }
  cout << dp[0][n-1] << endl;
  return 0;
}



Measured memory_bytes: 3144
#include <iostream>
#include <cstdio>
#include <cstring>
#define MAX_N 50100
using namespace std;

bool prime[MAX_N + 1];

bool isPrime(int n) {
    //今回、０、１をこの関数の引数に取らない
    for(int r = 2; r * r <= n; r++) {
        if(n % r == 0) return(false);
    }
    return(true);
}

void initialize() {
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1] = false; //0,1は素数ではない。
    for(int r = 2; r * r <= MAX_N; r++) {
        if(isPrime(r)) {
            for(int c = r * 2; c <= MAX_N; c += r) prime[c] = false; //倍数は素数で無い事が分かっている
        }
    }
}

int searchSmall(int num) {
    for(int r = num - 1; r >= 0; r--)
        if(prime[r]) return(r);
    return(-1);
}

int searchLarge(int num) {
    for(int r = num + 1; r <= MAX_N; r++)
        if(prime[r]) return(r);
    return(-1);
}

int main(void) {
    initialize();
    
    int input;
    while(cin >> input) {
        int max = searchSmall(input), min = searchLarge(input);
        cout << max << " " << min << endl;
    }
    return(0);
}

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

using namespace std;

const int wbr = 753;
int main()
{
	long long s,m=1000000000;
  	cin>>s;
  	while(s>100){
    	m=min(m,abs(s%1000-753));
    	s/=10;
  	}
    cout<<m;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
s = [0]
sum = 0
for i in range(len(a)):
    sum += a[i]
    s += [sum]
s.sort()
ans = 0
k = 1
for i in range(1,len(s)):
    if s[i]==s[i-1]:
        k+=1
        if i==len(s)-1:
            ans += k*(k-1)//2
    else:
        if k>1:
            ans += k*(k-1)//2
        k = 1
print(ans)


Measured memory_bytes: 26136
#include <bits/stdc++.h>
#define MP make_pair
#define PB emplace_back
using namespace std;
typedef long long ll;
template<typename T>
inline T read(T&x){
	x=0;int f=0;char ch=getchar();
	while (ch<'0' || ch>'9') f|=(ch=='-'),ch=getchar();
	while (ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x=f?-x:x;
}
const int N=1e5+10;
int n,i,a[N],cnt[N][2];
vector<pair<int,int> >A,B;
inline bool cmp(const pair<int,int>&a,const pair<int,int>&b){
	return a.second<b.second;
}
int main(){
	read(n);
	for (i=1;i<=n;++i){
		read(a[i]);
		if (i&1) cnt[a[i]][0]++;
		else cnt[a[i]][1]++;
	}
	int ans=0;
	for (i=1;i<=1e5;++i){
		A.PB(MP(i,n/2-cnt[i][0]));
		B.PB(MP(i,n/2-cnt[i][1]));
	}
	sort(A.begin(),A.end(),cmp);
	sort(B.begin(),B.end(),cmp);
	if (A[0].first==B[0].first){
		ans=min(A[1].second+B[0].second,A[0].second+B[1].second);
	}
	else ans=A[0].second+B[0].second;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3188