akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};

double dist (double a, double b,  double c, double d){
    
    return sqrt((a-c)*(a-c) + (b-d)*(b-d));
    
}

int main() {
    int n;cin>>n;
    string s;cin>>s;
    int maxv = 0;
    int x = 0;
    for(auto S:s){
        if(S == 'I') x++;
        else x--;
        
        maxv = max(maxv,x);
    }
    cout << maxv << endl;
    return 0;
}







Measured memory_bytes: 256
#include <stdio.h>
int main() {
  int x, y;

  while(scanf("%d %d", &x, &y)) {

    if(x == 0 && y == 0) {
      break;
    } else {
      if(x > y) {
        printf("%d %d\n", y, x);
      } else {
        printf("%d %d\n", x ,y);
      }
    }

  }

  return 0;
}

Measured memory_bytes: 596
d = 1e-11

while (line = gets)
  ax, ay, bx, by, cx, cy, dx, dy = line.chomp.split(" ").map{|s| s.to_f}

  abx = bx - ax
  aby = by - ay
  cdx = dx - cx
  cdy = dy - cy

  puts ((abx * cdx + aby * cdy).abs < d) ? "YES" : "NO"
end

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

int main(){
    int N,C;
    cin >> N >> C;
    int D[C][C];
    for(int i=0;i<C;i++){
        for(int j=0;j<C;j++){
            cin >> D[i][j];
        }
    }
    int c[N][N];
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            cin >> c[i][j];
        }
    }
    int cnt[3][C];
    for(int i=0;i<3;i++){
        for(int j=0;j<C;j++){
            cnt[i][j]=0;
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            for(int k=0;k<3;k++){
                if((i+j)%3==k){
                    cnt[k][c[i][j]-1]++;
                }
            }
        }
    }
    long long ans=10000000000;
    for(int i=0;i<C;i++){ //グリッドを三色で分ける分け方
        for(int j=0;j<C;j++){
            for(int k=0;k<C;k++){
                if(i!=j&&j!=k&&i!=k){
                    long long tmp=0;
                    for(int l=0;l<C;l++){
                        tmp+=D[l][i]*cnt[0][l]; //変更コスト*余り0~2のそれぞれに存在するlの数
                        tmp+=D[l][j]*cnt[1][l];
                        tmp+=D[l][k]*cnt[2][l];
                    }
                    ans=min(ans,tmp);
                }
            }
        }
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 1280
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        String s = in.next();
        int m = Integer.parseInt(s.substring(0,2));
        int y = Integer.parseInt(s.substring(2));
        
        if(m>0 && m<13 && (y>12 || y<1)) out.println("MMYY");
        else if(y>0 && y<13 && (m>12 || m<1)) out.println("YYMM");
        else if((m<1 || m>12) && (y>12 || y<1)) out.println("NA");
        else out.println("AMBIGUOUS");
    }
    
    /************* SOLUTION ENDS HERE **********/
}

Measured memory_bytes: 23252
<?php
while(1){
  list($m,$f,$r)=explode(' ',trim(fgets(STDIN)));
  if($m==-1&&$f==-1&&$r==-1) break;

  $S='F';
  if($m!=-1&&$f!=-1){
    $x=$m+$f;
    if(80<=$x) $S='A';
    elseif(65<=$x) $S='B';
    elseif(50<=$x) $S='C';
    elseif(30<=$x) $S=(50<=$r)? 'C':'D';
  }
  echo $S,PHP_EOL;
}

Measured memory_bytes: 15436
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
int main() {
  string s;
  cin>>s;
  int ans=0;
  for(int i=1;i<s.size();i++)
  {
    if(s[i]!=s[i-1]) ans++;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define fo(i,a,b) for(int i=a;i<b;i++)
#define fo_(i,a,b) for(int i=a;i>b;i--)
#define M(a) memset(a,0,sizeof a)
#define M_(a) memset(a ,-1,sizeof a)
#define debug(x)  cerr << #x << " = " << x << endl
#define pb push_back
#define F first
#define S second
#define OK order_of_key
#define FO find_by_order
#define PI 3.14159265
#define nmax 100100
const ll inf = std::numeric_limits<ll>::max();
const int infint = std::numeric_limits<int>::max();
const ll mod = 1e9+7;
using namespace __gnu_pbds;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

pll a[nmax],b[nmax];
pll aa[nmax],bb[nmax];
bool seen[nmax];

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    fo(i,0,n) cin >> a[i].F >> b[i].F;
    fo(i,0,n) a[i].S = b[i].S = i;
    fo(i,0,n){
        aa[i].F = a[i].F + b[i].F;
        bb[i].F = aa[i].F;
        aa[i].S = i;
        bb[i].S = i;
    }
    sort(aa,aa+n,greater<pii>());
    sort(bb,bb+n,greater<pii>());
    ll ansa,ansb;
    int ia,ib;
    ia = ib = 0;
    ansa = ansb = 0;
    fo(i,0,n){
        if(i%2){
            while(seen[bb[ib].S]) ib++;
            seen[bb[ib].S] = true;
            ansb += b[bb[ib].S].F;
            continue;
        }
        while(seen[aa[ia].S]) ia++;
        seen[aa[ia].S] = true;
        ansa += a[aa[ia].S].F;
    }
    cout << ansa-ansb;

    return 0;
}



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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		Console.WriteLine(A.Max() - A.Min());
	}
	int N;
	int[] A;
	public Sol(){
		N = ri();
		A = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

int main(){
    int k,a,b;
    cin >> k >> a >> b;
    for(int i = a; i < b+1; i++){
        if(i % k == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}


Measured memory_bytes: 3592
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int x,y;
		double f;
		x=sc.nextInt();
		y=sc.nextInt();
		f=1.0*x/y;
		System.out.print(x/y+" ");
		System.out.print(x%y+" ");
		System.out.print(String.format("%.8f",f));
		sc.close();
	}

}



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

int main(){
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    double con = -1.0;
    int w = 0, s = 0;

    for(int i = 0; i*(100*a) <= f; i++){
        for(int j = 0; j*(100*b) <= f; j++){
            for(int k = 0; k*c <= f; k++){
                for(int l = 0; l*d <= f; l++){
                    int water = i*(100*a) + j*(100*b);
                    int sugar = k*c + l*d;
                    int ws = water + sugar;
                    if(ws <= f && sugar <= e*water/100 && ws > 0){
                        double x = 100.0 * sugar/ws;
                        if(con < x){
                            con = x;
                            w = ws;
                            s = sugar;
                        }
                    }
                }
            }
        }
    }
    cout << w << " " << s << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
    int a,b,c,n,m,ans=0;
    string s,t,u;
    cin>>s;
    bool flag=true;
    rep(i,3){
        if(s[i]==s[i+1])
        flag=false;
    }

    if(flag)
    cout<<"Good"<<endl;
    else
    cout<<"Bad"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <string>

using namespace std;

using i32 = int;
using i64 = long long;
using u32 = unsigned;
using u64 = unsigned long long;

using pii = pair<i32, i32>;

#define rep(i, n) for (i32 i = 0; i < (n); ++i)
#define repr(i, n) for (i32 i = ((n)-1); i >= 0; --i)
#define urep(i, n) for (u32 i = 0; i < (n); ++i)
#define urepr(i, n) for (u32 i = ((n)-1); i >= 0 && i < (n); --i)
#define all(v) v.begin(), v.end()

int main()
{
	long arr[20];
	int n;

	cin >> n;
	rep(i, n) cin >> arr[i];

	int res = 0;
	rep(i, n - 2) {
		if ((arr[i] <= arr[i + 1] && arr[i + 1] <= arr[i + 2]) || (arr[i + 2] <= arr[i + 1] && arr[i + 1] <= arr[i])) {
			res++;
		}
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

int main()
{
    long long a, b;
    std::cin >> a >> b;

    if (a % 2 && b % 2) {
        std::cout << (a ^ ((b - a) / 2 % 2)) << std::endl;
        return 0;
    }

    if (a % 2) {
        std::cout << (a ^ b ^ ((b - a - 1) / 2 % 2)) << std::endl;
        return 0;
    }

    if (b % 2) {
        std::cout << ((b - a + 1) / 2 % 2) << std::endl;
        return 0;
    }

    std::cout << (b ^ ((b - a) / 2 % 2)) << std::endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	
	static List<List<Integer>> list;
	static int status[];
	
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int n=in.nextInt(), m=in.nextInt();list=new ArrayList<List<Integer>>();
		for(int i=0;i<n;i++) {
			List<Integer> l=new ArrayList<>();
			list.add(l);
		}
		
		for(int i=0;i<m;i++) {
			int s=Integer.parseInt(in.next()), t=Integer.parseInt(in.next());
			list.get(s).add(t);
			list.get(t).add(s);
		}
		
		status=new int[n];
		int color=1;
		for(int i=0;i<n;i++) {
			if(status[i]==0) {
				solve(n,i,color);
				color++;
			}
		}
		int q=in.nextInt();
		
		PrintWriter out=new PrintWriter(System.out);
		for(int i=0;i<q;i++) {
			int s=Integer.parseInt(in.next()), t=Integer.parseInt(in.next());
			if(status[s]==status[t])out.println("yes");
			else out.println("no");
		}
		out.flush();
	}
	
	static void solve(int n,int s,int c) {
		Queue<Integer> q=new ArrayDeque<>();
		q.add(s);
		status[s]=c;
		
		while(!q.isEmpty()) {
			int u=q.remove();
			for(int i=0;i<list.get(u).size();i++) {
				int next=list.get(u).get(i);
				if(status[next]==0) {
					status[next]=c;
					q.add(next);
				}
			}
		}
	}
}



Measured memory_bytes: 86936
use std::str::FromStr;
use std::fmt::Debug;

fn read_line<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).unwrap();
  s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()
}

fn main() {
  let a : Vec<i32> = read_line();
  let b : Vec<i32> = read_line();
  let c : i32 = b[0] - a[0] + b[0];
  println!("{}", c);
}

Measured memory_bytes: 4352
s = input()
t = input()

def match(k):
    flag = True
    for i in range(len(t)):
        if s[i + k] != t[i] and s[i + k] != "?":
            flag = False
            break
    return flag

flag = False
for k in reversed(range(len(s) - len(t) + 1)):
    if match(k):
        s = s[:k] + t + s[k + len(t):]
        flag = True
        break

if flag:
    print(s.replace('?', 'a'))
else:
    print('UNRESTORABLE')

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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int MOD = 1e9+7;
const long long INF = 1LL << 60;
const int inf = 1e9;
typedef long long ll;
int N, K, ans = inf;
vector<int> x(100010);
int main() {
    cin >> N >> K;
    int cost;
    rep(i,N) cin >> x[i];
    for(int l=0;l+K-1<N;l++){
        int r=l+K-1;
        cost = abs(x[l])+abs(x[r]-x[l]);
        if(cost<ans){
            ans = cost;
        }
        cost = abs(x[r])+abs(x[r]-x[l]);
        if(cost<ans){
            ans = cost;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int n,A[101],B[101];
bool yes[10000010];
int pr[670010],P;
int fir[210],dep[210],head[210],dis[3000010],nxt[3000010],w[3000010],id=1,S,T;
void link(int a,int b,int c){
	nxt[++id]=fir[a],fir[a]=id,dis[id]=b,w[id]=c;
	nxt[++id]=fir[b],fir[b]=id,dis[id]=a,w[id]=0;
}
bool BFS(){
	static int que[210],hd,tl;
	hd=tl=0;que[tl++]=S;memset(dep,0,sizeof dep);
	dep[S]=1;
	while(hd^tl){
		int x=que[hd++];
		for(int i=fir[x];i;i=nxt[i])
			if(w[i]&&!dep[dis[i]])dep[dis[i]]=dep[x]+1,que[tl++]=dis[i];
	}
	return dep[T];
}
int Dinic(int x,int maxflow){
	if(x==T)return maxflow;
	int ret=0;
	for(int&i=head[x];i;i=nxt[i])
		if(dep[dis[i]]==dep[x]+1&&w[i]){
			int d=Dinic(dis[i],std::min(w[i],maxflow-ret));
			w[i]-=d,w[i^1]+=d;ret+=d;if(ret==maxflow)break;
		}
	return ret;
}
int main(){
	n=gi();
	for(int i=1;i<=n;++i)A[i]=gi();
	std::sort(A+1,A+n+1),n=std::unique(A+1,A+n+1)-A-1;
	A[0]=A[n+1]=-1;
	int m=0;
	for(int i=1;i<=n;++i){
		if(A[i]!=A[i-1]+1)B[++m]=A[i]-1;
		if(A[i]!=A[i+1]-1)B[++m]=A[i];
	}
	S=m+1,T=m+2;
	int odd=0,even=0;
	for(int i=1;i<=m;++i)if(B[i]&1)++odd,link(S,i,1);else++even,link(i,T,1);
	for(int i=2;i<=A[n];++i){
		if(!yes[i])pr[++P]=i;
		for(int j=1;j<=P&&i*pr[j]<=A[n];++j){
			yes[i*pr[j]]=1;
			if(i%pr[j]==0)break;
		}
	}
	yes[0]=yes[1]=yes[2]=1;
	for(int i=1;i<=m;++i)if(B[i]&1)
		for(int j=1;j<=m;++j)
			if(!yes[abs(B[j]-B[i])])
				link(i,j,1);
	int ans=0;while(BFS())memcpy(head,fir,sizeof fir),ans+=Dinic(S,1e9);
	printf("%d\n",ans+2*((odd-ans>>1)+(even-ans>>1))+3*(odd-ans&1));
	return 0;
}



Measured memory_bytes: 17024
import numpy as np
import bisect
a,b,q = map(int,input().split())
s = np.array([-np.inf]+[int(input()) for i in range(a)]+[np.inf])
t = np.array([-np.inf]+[int(input()) for i in range(b)]+[np.inf])
x = np.array([int(input()) for i in range(q)])


  
def distance(s,t,xi):
  s_ = bisect.bisect_left(s,xi)
  s_m = abs(s[s_-1]-xi)
  s_p = abs(s[s_]-xi)
  t_ = bisect.bisect_left(t,xi)
  t_m = abs(t[t_-1]-xi)
  t_p = abs(t[t_]-xi)
  
  return min(max(s_m,t_m),s_m+t_p+min(s_m,t_p),s_p+t_m+min(s_p,t_m),max(s_p,t_p))
 
for i in x:
  print(int(distance(s,t,i)))

Measured memory_bytes: 19532
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(n)-1,i##_len=(int)(s);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};
//今回の変数

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
ll Minl(ll a, ll b) {
	return (a)<(b) ? (a) : (b);
}
ll Maxl(ll a, ll b) {
	return (a)>(b) ? (a) : (b);
}

int main() {
	int n,x;
	scanf("%d%d", &n, &x);
	int now = 0;
	int ans = 1;
	REP(i, n) {
		int l;
		scanf("%d", &l);
		now += l;
		if (now <= x) {
			ans++;
		}
		else {
			break;
		}
	}
	PRINTD(ans);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define MAXN 1000
#define MAXS 20000

/*
Let's say the order of the blocks is already defined. We can apply dynamic programming:
dp[i][s] -> maximum achievable value if we consider blocks i..N and currently has solidness s

There are two transitions:
* Skip current block -> we go to state dp[i + 1][s]
* Take current block -> we go to state dp[i + 1][min(s - block weight), (block solidness)] and get current block's value

Now what's left is how to order the blocks. We sort the blocks based on largest (solidness + weight).
With this order, we try to maximize the left over solidness (min(s - block weight), (block solidness)).
*/

struct Block {
    int weight, solidness, value;
    Block() {}
    Block(int _w, int _s, int _v): weight(_w), solidness(_s), value(_v) {}
    bool operator<(Block other) const {
        return weight + solidness > other.weight + other.solidness;
    }
};

int N;
Block blocks[MAXN + 3];
LL dp[MAXN + 3][MAXS + 3];

LL solve(int idx, int s) {
    if (idx == N + 1)
        return 0;

    if (dp[idx][s] != -1)
        return dp[idx][s];

    LL skip = solve(idx + 1, s);
    LL take = 0;

    if (s >= blocks[idx].weight) {
        take = solve(idx + 1, min(s - blocks[idx].weight, blocks[idx].solidness)) + (LL) blocks[idx].value;
    }

    return dp[idx][s] = max(skip, take);
}

int main() {
    cin >> N;
    for (int i = 1; i <= N; i++) {
        int w, s, v;
        cin >> w >> s >> v;

        blocks[i] = Block(w, s, v);
    }

    sort(blocks + 1, blocks + N + 1);

    memset(dp, -1, sizeof(dp));

    cout << solve(1, MAXS) << endl;
}


Measured memory_bytes: 160440
/*
This code By @1353055672(Ligen)
[Warning]You're not excepted to understand this code!
RP++
*/
//#pragma GCC optimize(3)
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#define ll long long
#define ull unsigned long long
#define mn 1000020
#define mod (int)(1e9+7)
#define FOR(a,b,c) for (register ll a=b;a<=c;a++)
#define FORD(a,b,c) for (register ll a=b;a>=c;a--)
using namespace std;
inline ll read(){
    ll x=0,f=1;
    char c=getchar();
    while (c<'0'||c>'9'){
        if (c=='-')f=-1;
        c=getchar();
    }
    while (c>='0'&&c<='9'){
        x=x*10+c-'0';
        c=getchar();
    }
    return x*f;
}
inline void writeln(ll a){
    if(a==0){puts("0");return;}
    if(a<0)putchar('-'),a=-a;
    char c1[120];
    int h=0;
    while(a)c1[++h]=a%10+'0',a/=10;
    FORD(i,h,1)putchar(c1[i]);putchar('\n');
    return;
}
inline ll Max(ll a,ll b){return (a>b)?a:b;}
inline ll Min(ll a,ll b){return (a<b)?a:b;}
inline ll Abs(ll x){return (x<0)?-x:x;}
inline void Swap(ll &x,ll &y){ll t=x;x=y;y=t;}
int a[120];
int main(){
	int n=read(),k=read();
	FOR(i,1,n)a[i]=read();sort(a+1,a+1+n);
	int j=0,ans=0;
	while(k>0&&j<n){j++;if(k>=a[j])k-=a[j],ans++;else break;}
	if(ans==n&&k>0)ans--;
	writeln(ans);
	return 0;
}


Measured memory_bytes: 256
def check(number)
  dfs(number.dup) == 4
end

def dfs(number)
  count = 0

  for i in 0...9 do
    next if number[i] < 3
    number[i] -= 3
    count = [count, 1 + dfs(number.dup)].max
    number[i] += 3
  end

  for i in 0...9-2 do
    next if number[i, 3].find {|e| e == 0}
    for j in i...i+3 do
      number[j] -= 1
    end
    count = [count, 1 + dfs(number.dup)].max
    for j in i...i+3 do
      number[j] += 1
    end
  end

  count
end

while line=gets do
  number = Array.new(9, 0)
  line.chop.chars.map{|e| e.to_i - 1}.each do |e|
    number[e] += 1
  end
  answer = Array.new
  for add in 0...9 do
    next if number[add] >= 4
    number[add] += 1
    for i in 0...9 do
      next if number[i] < 2
      number[i] -= 2
      answer.push(add + 1) if check(number.dup)
      number[i] += 2
    end
    number[add] -= 1
  end
  puts answer.empty? ? 0 : answer.uniq.join(" ")
end

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


int main() {
  int a , b, c;
  cin >> a >> b >> c;
  if(a+b >= c) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

int main(){
  int X,Y; cin >> X >> Y;
  
  int px;
  int py;
  
  for(int i = 3; i >=1 ; i--){
    if(X == i){
      px = 100000 *(4-i);
    }
    if(X > 3){
      px = 0;
    }
    if(Y == i){
      py = 100000 *(4-i);
    }   
    if(Y > 3){
      py = 0;
    }
  }
          
  if(X == 1 && Y ==1){
       cout << px+py+400000 << endl;
   }
   else {
        cout << px +py << endl;
   }
  
  return 0;
  
}

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

#define inf 0x3f3f3f3f
#define INF 1000111000111000111LL
#define mod 1000000007
#define endl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
#define all(cc) (cc).begin(),(cc).end()
using lli = long long int ;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vb = vector<bool> ;
using vvi = vector<vector<int>> ;
using vlli = vector<long long int> ;
using vpii = vector<pair<int, int>> ;

char animal[100005] ;
string s ;

char change(char s1)
  {
    if(s1=='S') return 'W' ;
    else return 'S' ;
  }

int check(char s1, char s2, int length)
  {
  	animal[0]=s1 ;
  	animal[1]=s2 ;
  	s[length]=s[0] ;
  	for (int j=2; j<=(length+1) ; j++)
      {
      	if(s[j-1]=='o' && animal[j-1]=='S') animal[j]=animal[j-2] ;
      	else if (s[j-1]=='o'&& animal[j-1]=='W') animal[j]=change(animal[j-2]) ;
      	else if (s[j-1]=='x' && animal[j-1]=='W') animal[j]=animal[j-2] ;
      	else animal[j]=change(animal[j-2]);
      }
  	if(animal[length]==s1 && animal[length+1]==s2) return 1 ;
  	else return 0 ;
  }

int main()
  {
  	ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
    int n, len ;
    cin>> n ;
    cin>> s ;
    len=s.length() ;
  	if(check('S', 'S', len))
    	for(int i=0 ; i<len ; i++)
        cout<< animal[i] ;
    else if(check('S', 'W', len))
    	for(int i=0 ; i<len ; i++)
        cout<< animal[i] ;
    else if(check('W', 'S', len))
    	for(int i=0 ; i<len ; i++)
        cout<< animal[i] ;
    else if(check('W', 'W', len))
    	for(int i=0 ; i<len ; i++)
        cout<< animal[i] ;
  	else cout<< -1 ;
  }


Measured memory_bytes: 720
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;

char f[20] = "CODEFESTIVAL2016";
char s[20];

int main(int,  char **)
{
#ifdef LOCAL
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
	scanf("%s", s);
	int len = strlen(s);
	int cnt = 0;
	for (int i = 0; i < len; i++)
		if (s[i] != f[i] )
			cnt++;
	printf("%d\n", cnt);


	return 0;
}



Measured memory_bytes: 256
S = input()
s = list(S)
a = 0
if len(s)%2 == 0:
    for i in range(len(s)//2):
        if s[i] != s[len(s)-1-i]:
            a += 1
else:
    for i in range(-(-len(s)//2)):
        if s[i] != s[len(s)-1-i]:
            a += 1
print(a)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main() {
    string s; cin >> s;
    int ans = 0;
    for (int i = 0, j = s.size()-1; i < j; ) {
        if (s[i] == s[j]) { i++; j--; }
        else if (s[i] == 'x') { ans++; i++; }
        else if (s[j] == 'x') { ans++; j--; }
        else { cout << "-1\n"; return 0; }
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read();
    let mut vec: Vec<i32> = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec.sort();
    let l = vec[vec.len() / 2 - 1];
    let r = vec[vec.len() / 2];
    if l == r {
        println!("0");
        return;
    }
    println!("{}", r - l);
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;

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

    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j <= n - i; ++j) {
            if ((10000 * i + 5000 * j + 1000 * (n - i - j)) == y) {
                cout << i << " " << j << " " << n - i - j << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}




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

using namespace std;

int main(void) {
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	sort(a.begin(),a.end());
	int res = 0;
	for (int i = 1; i < N; ++i) {
		res += a[i] - a[i-1];
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<numeric>
#include<list>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//最大公約数
template<class T> T gcd(T a, T b)
{
	while (true)
	{
		T r;
		if (a%b == 0) return b;
		else
		{
			r = a % b;
			a = b;
			b = r;
		}
	}
}
//最小公倍数
template<class T> T lcm(T a, T b)
{
	return a / gcd(a, b)*b;
}
//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//int型0~9を文字0~9に変換
char int_to_char(int c) {
	if (c == 0) return '0';
	if (c == 1) return '1';
	if (c == 2) return '2';
	if (c == 3) return '3';
	if (c == 4) return '4';
	if (c == 5) return '5';
	if (c == 6) return '6';
	if (c == 7) return '7';
	if (c == 8) return '8';
	if (c == 9) return '9';
	else return'x';
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn = 1, Kr = 1, Knr = 1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}
//int型10進数をord桁のstring型2進数に変換する
string binary(int x, int ord)
{
	int y;
	string ans = "";
	for (int i = 0; i < ord; i++)
	{
		y = x / (int)pow(2, ord - 1 - i);
		y %= 2;
		if (y == 0) ans += "0";
		else ans += "1";
	}

	return ans;
}
//ord桁のstring型2進数をint型10進数に変換する
int rep_binary(string x, int ord)
{
	int res = 0;
	for (int i = 0; i < ord; i++)
	{
		if (x[i] == '1') res += (int)pow(2, ord - 1 - i);
	}
	return res;
}
//xとyのビットごとの排他的論理和
template<class T> T XOR(T x, T y)
{
	T n = 0;
	while (max(x, y) > pow(2, n)) n++;
	T ans=0;
	for (int i = 0; i <= n; i++)
	{
		T x1 = (x % (T)pow(2, i + 1)) / (T)pow(2, i);
		T y1 = (y % (T)pow(2, i + 1)) / (T)pow(2, i);
		if (x1 != y1) ans += (T)pow(2, i);
	}
	return ans;
}

/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/


int main()
{
	int N, A[200000];
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	sort(A, A + N);
	bool x = true;
	for (int i = 0; i < N-1; i++)
	{
		if (A[i] == A[i + 1]) x = false;
	}
	if (x) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

const int MAX_V = 10000;
const double INF = 0;

double cost[MAX_V][MAX_V];
double mincost[MAX_V];
bool used[MAX_V];
int V;
pair<int, int> data[MAX_V];

double dist(pair<int, int> a, pair<int, int> b){
  return sqrt((a.first-b.first)*(a.first-b.first) + (a.second-b.second)*(a.second-b.second));
}

double prim(){
  for(int i=0;i<V;++i){
    mincost[i] = INF;
    used[i] = false;
  }
  mincost[0] = 0;
  double res = 0;
  
  for(;;){
    int v = -1;
    for(int u=0;u<V;++u){
      if(!used[u] && (v == -1 || mincost[u] < mincost[v])) v = u;
    }
    if(v == -1) break;
    used[v] = true;
    res += mincost[v];
    for(int u=0;u<V;++u){
      mincost[u] = min(mincost[u], cost[v][u]);
    }
  }
  return res;
}

main(){
  int n, m;
  while(cin >> n >> m && n|m){
    fill(cost[0], cost[n], INF);
    for(int i=0;i<n;++i){
      cin >> data[i].first >> data[i].second;
    }
    double sum = 0.0;
    for(int i=0;i<m;++i){
      int a, b;
      double tmp;
      cin >> a >> b;
      --a;
      --b;
      tmp = dist(data[a], data[b]);
      sum += tmp;
      cost[a][b] = cost[b][a] = -tmp;
    }
    V = n;
    printf("%.3f\n", sum + prim());
  }
  return 0;
}

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


int main() {
	
	int h,w;
	cin >> h >> w;
	vector<vector<char>> a((h+2), vector<char>(w+2,'#'));
	
	for(int i=1; i<h+1; i++){
		string s;
		cin >> s;
		for(int j=1; j<w+1; j++){
			a.at(i).at(j) = s.at(j-1);
		}
	}
	for(auto i : a){
		for(auto j : i) {
			cout << j;
		}
		cout << endl;
	}
	
	return 0;
}

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

int main(){
    ll a[5],N,ans;
    cin >> N;
    for(int i = 0; i < 5; i++) cin >> a[i];
    
    sort(a, a+5);
    
    ans = 5;
    ans += N/a[0];
    if(N % a[0] == 0) ans--;
    
    cout << ans << "\n";
    return 0;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    ll N, L, T;
    cin >> N >> L >> T;
    ll X[N];
    int W[N];
    rep(i, N){
        cin >> X[i] >> W[i];
    }
    ll sum = 0;
    rep2(i, 1, N-1){
        if(W[i] == W[0]) continue;
        ll d;
        if(W[i] == 2 && W[0] == 1){
            d = X[i]-X[0];
        }
        else{
            d = L+X[0]-X[i];
        }
        if(2*T < d) continue;
        if(W[0] == 1){
            sum++;
            sum += (2*T-d)/L;
            sum %= N;
        }
        else{
            sum += N-1;
            sum += 2*N*T-(2*T-d)/L;
            sum %= N;
        }
    }
    rep(i, N){
        if(W[i] == 1){
            X[i] = (X[i]+T)%L;
        }
        else{
            X[i] = (X[i]+L*T-T)%L;
        }
    }
    ll st = X[0], be;
    sort(X, X+N);
    rep(i, N){
        if(X[i] < st) continue;
        elif(X[i] == st){
            if(W[0] == 2){
                if(X[(i+N-1)%N != st]){
                    be = i;
                    break;
                }
            }
            else{
                if(X[(i+1)%N] != st){
                    be = i;
                    break;
                }
            }
        }
    }
    rep(i, N){
        cout << X[(i+N+be-sum)%N] << endl;
    }
}

Measured memory_bytes: 2304
# -*- coding: utf-8 -*-
import sys


def get_num():
    return int(input())


def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


def get_numbers():
    return map(int, input().split())

origin = [int(s) for s in input()]

length = len(origin)
cand_list = [0 for _ in range(length)]
for i in range(0, length, 2):
    cand_list[i] = 1

cnt1 = 0
cnt2 = 0
for i in range(length):
    if origin[i] == cand_list[i]:
        cnt2 += 1
    else:
        cnt1 += 1

print(min(cnt1, cnt2))

Measured memory_bytes: 48348
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

#define mod 1000000007

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; }

string S,temp1="",temp2="";
int mid;

int main(){
    cin>>S;
    for(int i=S.length()-2;i>=0;i-=2){
        mid=i/2;
        for(int j=0;j<mid;j++){
            temp1+=S[j];
        }
        for(int j=mid;j<i;j++){
            temp2+=S[j];
        }
        if(temp1==temp2){
            out(temp1.length()*2);
            return 0;
        }
        temp1="";
        temp2="";
    }
}

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

#define rep(i, a) for (int i = 0; i < (a); i++ )

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    int N;
    cin >> N;
    vector<ll> A;
    rep(i,N) {
        ll a;
        cin >> a;
        if (i>0) {
            if (a==A.back()) continue;
        }
        A.push_back(a);
    }
    N = A.size();

    ll m,p;
    m = 1000;
    p = 0;
    bool next_buy = true;

    ll kai = INF;

    rep(i,N) {
        //cout << i << " " << m << " " << p << endl;
        if (next_buy) {
            ll next_up;
            ll next_min;
            next_min = A[i];
            next_up = A[i];
            for (int j=i+1; j<N; j++) {
                if (A[j]>A[i]) {
                    next_up = A[j];
                    break;
                }
                next_min = min(A[j],next_min);
            }
            if (next_min == A[i] && next_up > A[i]) {
                p = m/A[i];
                m = m%A[i];
                next_buy = false;
                kai = A[i];
            }
            
        }
        else {
            bool uru = false;
            if (A[i]>kai) {
                if (i==N-1) {
                    uru = true;
                }
                else if (A[i]>A[i+1]) {
                    uru = true;
                }
            }
            if (uru) {
                m += p*A[i];
                p = 0;
                next_buy = true;
                kai = INF;
            }
        }
    }
    cout << m << endl;

}

Measured memory_bytes: 3524
N = gets.to_i

graph = Hash.new { |h, k| h[k] = {} }

(N - 1).times do
  u, v, w = gets.split.map(&:to_i)
  graph[u][v] = w
  graph[v][u] = w
end

queue = [[1, 0]]
path = {}
colors = Array.new(N)

until queue.empty?
  v, dist = queue.shift

  if dist.even?
    colors[v - 1] = 0
  else
    colors[v - 1] = 1
  end

  next if path[v]
  path[v] = true

  graph[v].each do |n, w|
    queue << [n, dist + w]
  end
end

puts colors

Measured memory_bytes: 44668
#include <bits/stdc++.h>
#include <cmath>
#include <set>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>

#define fir first
#define sec second
#define get(n) scanf("%d",&n);
#define gets(s) string s;cin >> (s);
#define All(s) (c).begin(), (c).end()
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);
#define rep(i, j) for (int (i)=0;(i)<(j);(i)++)
#define repk(i, j, k) for(int (i)=(j);(i)<(k);(i)++)
#define dump(x)  std::cout << #x << " = " << (x) << std::endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long int ll;
const int max_n = 2 * 1e5 + 1;
const ll INF = 10241024;
long double INFD = 100100100;

vector<int> a(3);
void input(){
    rep(i,3) cin >> a[i];
}


void solve(){
    input();
    int sum = 0;
    rep(i,3){
        sum += a[i];
    }
    if(sum >= 22)
    {
        cout << "bust" << endl;
        return;
    }
    cout << "win" << endl;
    return;
}
int main () {
    solve();
    return 0;
}




Measured memory_bytes: 256
# B - Can you solve this?
import numpy as np
N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = np.zeros((N, M))
for i in range(N):
    A[i,:] = np.array(list(map(int, input().split())))
AB = A * B.reshape((1, M))
print(np.sum(np.sum(AB, 1) > -C))

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;

int main() {
    int i;
    cin >> i;
    cout << i * i * i << endl;
}


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

int main(){
  int A, B;
  cin >> A >> B;
  if(A>=13){
    cout << B << endl;
  }
  else if(A>=6){
    cout << B/2 << endl;
  }
  else{
    cout << 0 << endl;
  }
}

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

string s, es[] { "dream", "dreamer", "erase", "eraser" };

int main() {
	cin >> s;

	bool erasable = 1;
	while (s.size() > 7 && erasable) {
		erasable = 0;
		for (string e : es) {
			bool b = 1;
			for (int i = 0; i < (int) e.size(); i++)
				if (s[s.size() - e.size() + i] != e[i]) {
					b = 0;
					break;
				}
			if (b) {
				erasable = 1;
				s.erase(s.size() - e.size());
				break;
			}
		}
	}
	cout << (find(es, es + 4, s) != es + 4 ? "YES" : "NO") << endl;
}


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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#ifdef MAROON_LOCAL
#define cerr (cerr<<"-- line "<<__LINE__<<" -- ")
#else
class CerrDummy{}cerrDummy;
template<class T>
CerrDummy& operator<<(CerrDummy&cd,const T&){
	return cd;
}
using charTDummy=char;
using traitsDummy=char_traits<charTDummy>;
CerrDummy& operator<<(CerrDummy&cd,basic_ostream<charTDummy,traitsDummy>&(basic_ostream<charTDummy,traitsDummy>&)){
	return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr<<"reached"<<endl
#define DMP(x) cerr<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))
#define ONE(x) memset(x,-1,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

ll read(){
	ll i;
	scanf("%" SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(ll x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341000];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341000];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

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

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

template<class T>
T Sq(const T& t){
	return t*t;
}

#define CAPITAL
void Yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void No(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

const int Nmax=19;
int cnt[Nmax];

signed main(){
	int n=read();
	string s=readString();
	int ans=0;
	REP(bit,1<<n){
		string x,y;
		REP(i,n)if((bit>>i)&1)
			x+=s[i];
		else
			y+=s[i];
		ZERO(cnt);
		cnt[0]=1;
		for(int i=n*2-1;i>=n;i--){
			for(int j=x.size();j>=0;j--){
				int k=n*2-i-j;
				if(!(1<=k&&k-1<int(y.size())&&y[k-1]==s[i]))
					cnt[j]=0;
				if(j>0&&x[j-1]==s[i])
					cnt[j]+=cnt[j-1];
			}
		}
		ans+=cnt[x.size()];
	}
	print(ans);
}


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

#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define sll set<long long>
#define si set<int>
#define stk stack<int>
#define que queue<int>
#define pb push_back
#define ff first
#define ss second
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

int main(){
	int q=1;
	//cin>>q;

	while(q--){
		int n;
		cin>>n;
		cout<<ceil(n/2.0)<<endl;
	}
}

Measured memory_bytes: 256
#include <stdio.h>


int main()
{
    int arr[10], i,j,temp;
    
    for(i=0;i<10;i++){
        scanf("%d",&arr[i]);
    }
    
    for(i=0; i<10; i++){
        for(j=0; j<10-(i+1); j++){
                
                if(arr[j] >arr[j+1]){
                    temp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=temp;
                }
        
        }
        
    }
    for(i = 9; i >=7; i--)
        printf("%d\n",arr[i]);


        return 0;

}

Measured memory_bytes: 600
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    string a;
    cin>>n>>a;
    string s=a.substr(0,n);
    string t=a.substr(n,n);
    reverse(all(t));
    map<pair<string,string>,int> ms,mt;
    rep(i,1<<n){
        string sr="",sb="",tr="",tb="";
        rep(j,n){
            if(i&1<<j){
                sr+=s[j];
                tr+=t[j];
            }
            else{
                sb+=s[j];
                tb+=t[j];
            }
        }
        ms[{sr,sb}]++;
        mt[{tr,tb}]++;
    }
    int ans=0;
    for(pair<pair<string,string>,int> p:ms){
        ans+=ms[p.fi]*mt[p.fi];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 108288
#include <stdio.h>
int main(void) {
	int a, b, c, buf;
	scanf("%d %d %d", &a, &b, &c);

	if (a > b){
		buf = a;
		a = b; b = buf;
	}
	if (a > c){
		buf = a;
		a = c; c = buf;
	}
	if (b > c){
		buf = b;
		b = c;
		c = buf;
	}

	printf("%d %d %d\n", a, b, c);

	return 0;
}

Measured memory_bytes: 596