akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique((c).begin(), (c).end()), (c).end());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


void solve(LL N, LL M, vector<LL> a, vector<LL> b){
	vector<PII> S;
	S.resize(M);
	REP(i, M) {
		S[i] = MP(a[i], b[i]);
	}
	SORT(S);
	stable_sort(S.begin(), S.end(), [](const PII& x, const PII& y){return x.second < y.second;});

	int index = 0;
	LL r = 0;
	int sum = 0;
	while (index < M) {
		r = S[index].second - 1;
		sum++;
		while (S[index].first <= r) {
			index++;
		}
	}
	cout << sum << endl;
}


int main(){	
	LL N;
	LL M;
	scanf("%lld",&N);
	scanf("%lld",&M);
	vector<LL> b(M-1+1);
	vector<LL> a(M-1+1);
	for(int i = 0 ; i <= M-1 ; i++){
		scanf("%lld",&a[i]);
		scanf("%lld",&b[i]);
	}
	solve(N, M, a, b);
	return 0;
}



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

namespace ConsoleApplication11 {
    class Program {
        static void Main(string[] args) {
            new Program().solve();
        }

        void solve() {
            while (true) {
                int num = int.Parse(Console.ReadLine());
                if (num == 0) {
                    return;
                }

                int opCount = 0;
                while (num != 1) {
                    if (num % 2 == 1) {
                        num = num * 3 + 1;
                    } else {
                        num = num / 2;
                    }
                    opCount++;
                }
                Console.WriteLine(opCount);
            }
        }
    }
}

Measured memory_bytes: 9104
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    char cur = s[0]; int answer=0;
    for(int i =0; i<s.size(); i++){
        if(s[i]!=cur){
            answer++; cur=s[i];
        }
    }
    cout<<answer;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int A=stdIn.nextInt();
		int B=stdIn.nextInt();
		int C=stdIn.nextInt();
		int z=0,max=A,mid=B,min=C;
		if(max<B){
			max=B;mid=A;
		}
		if(max<C){
			max=C;min=A;
		}
		if(mid<min){
			z=mid;mid=min;min=z;z=0;
		}
		z+=(max-min)/2+(max-mid)/2;
		if((max-min)%2==0&&(max-mid)%2==0)
			System.out.println(z);
		if((max-min)%2==1&&(max-mid)%2==1)
			System.out.println(z+1);
		if((max-min)%2==1&&(max-mid)%2==0)
			System.out.println(z+2);
		if((max-min)%2==0&&(max-mid)%2==1)
			System.out.println(z+2);
	}
}

Measured memory_bytes: 23252
#include "bits/stdc++.h"

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    size_t N;
    cin >> N;
    vector<tuple<string, int, int>> vec(N);
    for (size_t i = 0; i < N; ++i) {
        string s; int p;
        cin >> s >> p;
        vec[i] = make_tuple(s, -p, i + 1);
    }
    sort(vec.begin(), vec.end());
    for (auto &e : vec) {
        cout << get<2>(e) << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;
const LL MOD = 1000000007;

int main(int argc, char *argv[]) {
	string s;
	cin >> s;
	int len = (int)s.length();
	vector<vector<LL>> dp(len + 1, vector<LL>(13));
	for (int j = 0; j < 10; ++j) {
		dp[0][0] = 1;
	}
	LL r = 1;
	for (int i = 0; i < len; ++i) {
		int col = len - i - 1;
		for (int d = 0; d < 10; ++d) {
			if (s[col] == '?' || s[col] - '0' == d) {
				for (int j = 0; j < 13; ++j) {
					LL w = (r * d + j) % 13;
					dp[i + 1][w] = (dp[i + 1][w] + dp[i][j]) % MOD;
				}
			}
		}
		r = (r * 10) % 13;
	}
	LL ans = dp[len][5];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 13696
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define sz(x) ((ll)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

ll f(ll b, ll n) {
  if (n < b)
    return n;
  else
    return f(b, n / b) + n % b;
}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

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

  if (n == s) {
    cout << n + 1 << endl;
    return 0;
  }

  if (s > (n + 1) / 2) {
    cout << -1 << endl;
    return 0;
  }


  repp(b, 2, sqrt(n) + 1) {
    if (f(b, n) == s) {
      cout << b << endl;
      return 0;
    }
  }

  auto divs = divisor(n - s);
  for (auto b : divs) {
    ll p = (n - s) / b;

    b++;
    if (b < sqrt(n))
      continue;

    ll q = s - p;
    if (q < 0 || p >= b || q >= b)
      continue;

    cout << b << endl;
    return 0;
  }
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> c(n+1);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        c[a].push_back(b);
        c[b].push_back(a);
    }
    vector<int> v;
    sort(begin(c[1]), end(c[1]));
    sort(begin(c[n]), end(c[n]));
    set_intersection(begin(c[1]), end(c[1]), begin(c[n]), end(c[n]), back_inserter(v));
    cout << (!v.empty() ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}


Measured memory_bytes: 12016
S = input()
S = list(S)
s = ''.join(list(reversed(S)))
def main(s):
  l = ["resare", "esare","remaerd", "maerd"]
  for i in l:
    s = s.replace(i, '')
  return s
if main(s) == '':
  print('YES')
elif main(s) != '':
  print('NO')

Measured memory_bytes: 4652
#include <iostream>
#include <string>

int main(void){
	using namespace std;
	string odd, even;
	
	cin >> odd >> even;
	
	string ans;
	ans.resize(odd.size() + even.size());
	
	for(int i = 0; i < odd.size(); ++i){
		ans[i * 2] = odd[i];
	}
	for(int i = 0; i < even.size(); ++i){
		ans[i * 2 + 1] = even[i];
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

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

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)
ll dp[3009][3009];
string a,b;

ll LCS(ll i,ll j)
{
    if(dp[i][j]!=-1)
    {
        return dp[i][j];
    }
    if(i==0 || j==0)
    {
        return dp[i][j] = 0;
    }
    if(a[i-1]==b[j-1])
    {
        return dp[i][j] = 1 + LCS(i-1,j-1);
    }
    else
    {
        return dp[i][j] = max(LCS(i-1,j),LCS(i,j-1));
    }
}
void path(ll i,ll j)
{
    if(i==0 || j==0)
        return;
    if(a[i-1]==b[j-1])
    {
        path(i-1,j-1);
        cout<<a[i-1];
    }
    else
    {
        if(dp[i][j]==dp[i-1][j])
        {
            path(i-1,j);
        }
        else path(i,j-1);
    }
}
int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    cin>>a>>b;
    memset(dp,-1,sizeof dp);
    n = a.size();
    m = b.size();
    x = LCS(n,m);
    path(n,m);
    return 0;
}



Measured memory_bytes: 71296
n = gets.chomp.to_i
ans = []
while(true)
    s = gets.chomp
    ans.push(s)
    if ans.size == n
        break
    end
end

kotae = [0,0,0,0]
ans.each do |value|
    if value == "AC"
        kotae[0] += 1
    elsif value == "WA"
        kotae[1] += 1
    elsif value == "TLE"
        kotae[2] += 1
    elsif value == "RE"
        kotae[3] += 1
    end
end
puts "AC x #{kotae[0]}"
puts "WA x #{kotae[1]}"
puts "TLE x #{kotae[2]}"
puts "RE x #{kotae[3]}"

Measured memory_bytes: 21528
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------
func pow(b, p int) int {
	return int(math.Pow(float64(b), float64(p)))
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func main() {
	defer stdout.Flush()
	x := readInt()
	var ans int
	for p := 2; p <= 10; p++ {
		for b, v := 1, 1; v <= x; b, v = b+1, pow(b+1, p) {
			ans = max(ans, v)
		}
	}
	println(ans)
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007ll
#define mod1 998244353ll
#define endl "\n"
#define inf (ll)1e18+1
using namespace std::chrono;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,m;
    cin>>n>>m;
    vector<ll> ar(n);
    for(ll x=0;x<n;x++){
        cin>>ar[x];
        ar[x]/=2;
    }
    ll lcm=ar[0];
    for(ll x=1;x<n;x++){
        lcm=lcm*ar[x]/__gcd(lcm,ar[x]);
        if(lcm<0){
            break;
        }
    }
    if(lcm<=0 || lcm>m){
        cout<<0<<endl;
        return 0;
    }
    bool found=false;
    for(ll x=0;x<n;x++){
        if((lcm/ar[x])%2==0){
            found=true;
            break;
        }
    }
    if(found){
        cout<<0<<endl;
        return 0;
    }
    ll how=m/lcm;
    ll ans=ceil(how/2.0);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
const ll INF = 1LL << 60; //MAX 9223372036854775807
struct point
{
  ll x, y, val;
  point() {}
  point(ll x, ll y, ll val) : x(x), y(y), val(val){};
  point(ll x, ll y) : x(x), y(y), val(0){};
};
//演算の定義
auto query = [](ll x, ll y) { return min(x, y); };
//単位元
const ll unit = INF;
struct SegTree
{
private:
  ll n;
  vector<ll> node;

public:
  SegTree(vector<ll> v)
  {
    node.resize((1LL << 64 - __builtin_clzll(v.size())) * 2 - 1, unit); //最小値なので残りはINFで埋める
    n = 1LL << 64 - __builtin_clzll(v.size());
    for (ll i = 0; i < v.size(); i++)
      node[i + n - 1] = v[i]; //最下段から構築
    for (ll i = n - 2; i >= 0; i--)
      node[i] = query(node[2 * i + 1], node[2 * i + 2]);
  }

  void update(ll x, ll val)
  {
    x += (n - 1);  // 最下段index
    node[x] = val; //valを加算などするときは+=
    while (x > 0)
    {
      x = (x - 1) / 2;
      node[x] = query(node[2 * x + 1], node[2 * x + 2]);
    }
  }

  // 要求区間 [a, b) 中の要素の最小値を答える k := 自分がいるノードのインデックス 対象区間は [l, r) にあたる
  ll getmin(ll a, ll b, ll k = 0, ll l = 0, ll r = -1)
  {
    // 最初に呼び出されたときの対象区間は [0, n)
    if (r < 0)
      r = n;
    // 要求区間と対象区間が交わらない -> 適当に返す
    if (r <= a || b <= l)
      return unit;
    // 要求区間が対象区間を完全に被覆 -> 対象区間を答えの計算に使う
    if (a <= l && r <= b)
      return node[k];
    // 要求区間が対象区間の一部を被覆 -> 子について探索を行う
    // 左側の子を vl ・ 右側の子を vr としている
    // 新しい対象区間は、現在の対象区間を半分に割ったもの
    ll vl = getmin(a, b, 2 * k + 1, l, (l + r) / 2);
    ll vr = getmin(a, b, 2 * k + 2, (l + r) / 2, r);
    return query(vl, vr);
  }
};
bool cmp(const point &a, const point &b)
{
  if (a.y == b.y)
    return a.x < b.x;
  else
    return a.y < b.y;
}
int main()
{
ll n , m ;
cin >> n >> m ;
vector<point> v;
rep(i,m){
  ll l , r , c ;
  cin >> l >> r >> c ;
  l--;r--;
  v.emplace_back(l,r,c);
}
sort(v.begin(),v.end(),cmp);
vector<ll> t(n,(1LL<<60)-1);
t[0]=0;
SegTree s(t);
rep(i,m){
  ll mi=s.getmin(v[i].x, n);
  ll aaa=min(mi+v[i].val,s.getmin(v[i].y, v[i].y+1));
  s.update(v[i].y, aaa);
}
ll ans=s.getmin(n-1, n);
if(ans>(1LL<<58))ans=-1;
cout << ans << endl;
return 0;
}

Measured memory_bytes: 6768
d = dict()
wa = ac = 0
N, M= map(int,input().split())
for i in range(M):
  a, b = input().split()
  if a not in d:
    d[a] = 0
  if d[a] >= 0 and b == "AC":
    ac += 1
    wa += d[a]
    d[a] = -1
  elif d[a] >= 0:
    d[a] += 1
print(ac,wa)

Measured memory_bytes: 17116
#include <iostream>
#include <algorithm>
using namespace std;
 
string str;
char c[128];
 
void c2c(){
    c['['] = ']';
    c['('] = ')';
    c['{'] = '}';
    c[']'] = '[';
    c[')'] = '(';
    c['}'] = '{';
}
 
int solve(string left,string right){
    int cnt = 0;
    c2c();
 
    for(int i = 0 ; i < (1 << left.length()) ; i++){
	string nleft = "";
	for(int j = 0 ; j < left.length() ; j++){
	    if(i >> j & 1){
		nleft += left[j];
	    }
	}
	for(int j = 0 ; j < (1 << right.length()) ; j++){
	    string nright = "";
	    for(int k = 0 ; k < right.length() ; k++){
		if(j >> k & 1){
		    nright += c[right[k]];
		}
	    }
	    if(nright.length() != nleft.length()){
		continue;
	    } 
	    int t = 0;
	    for(int j = 0 ; j < nleft.length() ; j++){
		if(nleft[j] != nright[nleft.length()-j-1]) break;
		++t; 
	    }
	    cnt = max(cnt,t);     
	}  
    }
    return 2*cnt+3;
}
 
int main(){
    cin >> str;
 
    string left = "" , right = "";
    int length = str.length();
 
    int i;
    for(i = 0 ; i < length ; i++){
	if(str[i] == 'i') break;
	left += str[i];
    }
    i += 2;
    for(int j = i ; j < length ; j++){
	right += str[j];
    }
    cout << solve(left,right) << endl;
    return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    string s; cin>>s;
    ll n=s.size();
    map<char, ll> m;
    rep(i,n){
        if(m[s[i]]>0){
            cout<<"no"<<endl;
            return 0;
        }
        m[s[i]]++;
    }
    cout<<"yes"<<endl;
    return 0;
}

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



int main() {
    int n,k;
    cin >> n >> k;
    vector<int> x(n);
    rep(i,n)cin >>x[i];

    int ans = 0;
    rep(i,n){
        if(x[i]<k-x[i]) ans +=x[i];
        else ans += k-x[i]; 
    }
    cout << 2*ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  ll x;
  cin >> x;
  for (ll a = -200; a <= 200; ++a) {
    for (ll b = -200; b <= 200; ++b) {
      if (a * a * a * a * a - b * b * b * b * b == x) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3600
#include <unistd.h>

char ibuf[(11<<18)+5];
char *ibufe = ibuf-1;

extern inline void readall(){
  int k, t = 0;
  while((k=read(STDIN_FILENO, ibuf+t, sizeof(ibuf)-t))>0) t += k;
}

int read_uint(){
  int x=0;
  while(*(++ibufe) <'0');
  do {
    x *= 10;
    x += *ibufe-'0';
  } while(*(++ibufe) >='0');

  return x;
}

char buf[40];
char *bufe = buf;

void write_uintln(int x){
  int i;
  static char tmp[13];
  if(x==0){
    *bufe++ = '0';
    *bufe++ = '\n';
    return;
  }

  for(i=0; x; i++){
    tmp[i] = '0' + x % 10;
    x /= 10;
  }
  for(i--; i >= 0; i--){
    *bufe++ = tmp[i];
  }
  *bufe++ = '\n';
}

extern inline void writeall(){
  int k, t = 0;
  while((k=write(STDOUT_FILENO, buf+t, bufe-buf-t))>0) t += k;
}


#define MAX(x, y) ((x) > (y) ? (x) : (y))

int n;
int A[1<<18];
int B[1<<18];

void zeta(int n){
  int i, j;
  int m = 1 << n;
  for(i=1;i<m;i<<=1){
    for(j=0;j<m;j++){
      if(j&i){
        int maxi = (A[j] > A[j^i]) ? j : j^i;
        int mini = maxi^i;
        B[j] = MAX(A[mini], B[maxi]);
        A[j] = A[maxi];
      }
    }
  }
}


int main(){
  int i, max;
  readall();
  n = read_uint();
  for(i=0;i<(1<<n);i++){
    A[i] = read_uint();
  }
  zeta(n);
  max = 0;
  for(i=1;i<(1<<n);i++){
    max = MAX(max, A[i]+B[i]);
    write_uintln(max);
  }
  writeall();
  return 0;
}


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

using namespace std;

int main(){
	long long w,h,i,j;
	
	while(1){
		cin>>w>>h;
		if(w==0 && h==0) break;
		for(i=1;i<=w;i++){
			for(j=1;j<=h;j++){
				if((i+j)%2==0) cout<<"#";
				  else cout<<".";
			}
			cout<<"\n";
		}
		cout<<"\n";
	}
}


Measured memory_bytes: 3072
while True:
	x=list(map(int,input().split()))
	if x[0]==0 and x[1]==0:
		break
	else:
		print('#'*x[1])
		for i in range(x[0]-2):
			print('#'+'.'*(x[1]-2)+'#')
		print('#'*x[1])
	print('')


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < n; i++)

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input values
    int N, K;
    cin >> N >> K;

    vector<int> h(N);
    rep (i, N) {
        cin >> h[i];
    }

    // dp table
    vector<int> dp(100100, INF);

    // init dp table

    // init condition
    dp[0] = 0;

    // loop
    rep (i, N) {
        for (int j = 1; j <= K; j++) {
            chmin(dp[i+j], dp[i]+abs(h[i+j]-h[i]));
        }
    }

    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
function Main(input) {
  input = input.split(" ");
  var A = input[0];
  var B = input[1];
  if(A<10&&B<10){
    console.log(A*B);
  }
  else{
    console.log("-1");
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){
  int A, B, M;
  cin >> A >> B >> M;
  vector<int> a(A), b(B);
  rep(i, A) cin >> a[i];
  rep(i, B) cin >> b[i];
  int ans = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());
  rep(i, M){
    int x1, y1, c1;
    cin >> x1 >> y1 >> c1;
    x1--; y1--;
    ans = min(ans, a[x1] + b[y1] - c1);
  }
  cout << ans << endl;
  return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl;
#define CNO cout<<"No"<<endl;

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  vector<bool> vs(n,false);
  rep(i,n) cin >> p[i];
  deque<pair<int,int>> q;
  q.push_back({0,0});
  while(!q.empty()){
    auto now = q.front();
    q.pop_front();
    if(vs[now.first]) continue;
    vs[now.first]=true;
    if(now.first==n-1){
      cout << now.second << endl;
      return 0;
    }
    if(p[now.first]==0){
      rep(i,6){
        if(now.first+i+1>=n) continue;
        q.push_back({now.first+i+1,now.second+1});
      }
    }else{
      q.push_front({now.first+p[now.first],now.second});
    }
  }
  return 0;
}



Measured memory_bytes: 3372
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String n = scan.next();
		if(n.charAt(1)==n.charAt(2)) {
			if(n.charAt(0)==n.charAt(1) || n.charAt(1)==n.charAt(3)) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
// typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

// llong POW(llong a, llong b){
//   if(b == 0) return 1;
//   else{
//     if(b%2 == 0) return POW(a * a % MOD, b / 2) % MOD;
//     else return a * POW(a * a % MOD, b / 2) % MOD;
//   }
// }

int main(){
  llong X, A, B;
  cin >> X >> A >> B;
  if(B-A <= 0) cout << "delicious" << endl;
  else if(B-A <= X) cout << "safe" << endl;
  else cout << "dangerous" << endl;
}

Measured memory_bytes: 256
#a,b=map(int,input().split())
#p_3,p_4=map(int,input().split())
n=int(input())
#g=input()
#recipe=[list(input().split())for _ in range(n)]
#m=int(input())
#have=[list(input().split())for _ in range(m)]
#s=[list(input())for _ in range(n)]
#h=list(map(int,input().split()))
v=list(map(int,input().split()))
#c=list(map(float,input().split()))
#n=int(input())
#s=[list(map(int,input().split()))for _ in range(n)]
#s=[list(input().split())for _ in range(n)]
#s=[input()for _ in range(n)]
v.sort()
ans=0
ans+=v[0]/2**(n-1)
j=n-1
for i in range(1,n):
    ans+=v[i]/2**j
    j-=1
print(ans)

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────

int main() {
	int n;
	cin >> n;
	cout << round_int(n, 2) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>

#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順

signed main(){
    int n;
    string s,t;
    cin >> n >> s >> t;
    REP(i,n){
        cout << s[i] << t[i];
    }
    cout << endl;

    return 0;
}

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


int main() {
  int N;
  int countAC=0;
  int countWA=0;
  int countTLE=0;
  int countRE=0;
  cin >> N;
  
  vector<string> vec(N);
  for (int i=0; i < N; i++) {
    cin >> vec.at(i);
  }
  for (int i=0; i < N; i++) {
    if(vec.at(i)=="AC"){
      countAC=countAC+1;
    }
    if(vec.at(i)=="WA"){
      countWA=countWA+1;
    }
    if(vec.at(i)=="TLE"){
      countTLE=countTLE+1;
    }
    if(vec.at(i)=="RE"){
      countRE=countRE+1;
    }
  }
    
    cout << "AC x " << countAC << endl << "WA x "<< countWA << endl << "TLE x "<< countTLE << endl << "RE x "<< countRE;

}

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

int main()
{
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (int i=0; i<N; i++){
    cin >> A[i];
  }
  vector<ll> B(N);
  for (int i=0; i<N; i++){
    cin >> B[i];
  }
  vector<ll> C(N-1);
  for (int i=0; i<N-1; i++){
    cin >> C[i];
  }

  ll ans = 0;
  ll prev = -100;
  for (int i=0; i<N; i++) {
    ans += B[A[i]-1];
    if (prev+1 == A[i]-1) ans += C[prev];
    prev = A[i]-1;
  }
  cout << ans << endl;

  return 0;
}


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

int main () {
  int N;
  cin >> N;
  string S;
  int i = 0;
  
  while(i < N){
    cin >> S;
    
    if (S == "Y"){
      cout << "Four" << endl;
      break;
    }
    
    i++;
    
    if (i == N){
      cout << "Three" << endl;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#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>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<set>

int main() {
	string s;
	cin >> s;
	int k = s.size();
	if (s[k - 1] == 's') {
		s.push_back('e');
	}
	s.push_back('s');
	cout << s;
	return 0;
}

Measured memory_bytes: 3628
import java.util.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    while (scanner.hasNext()) {
      int n = scanner.nextInt();
      if (n == 0) {
        break;
      }
      scanner.nextLine();
      List<aaaa> ts = new ArrayList<aaaa>();
      for (int ii = 0; ii < n; ii++) {
        String[] works = scanner.nextLine().split(" ");
        int ww = 0;
        int ll = 0;
        for (int jj = 1; jj < n; jj++) {
          if (works[jj].equals("0")) {
            ww++;
          } else if (works[jj].equals("1")) {
            ll++;
          }
        }
        aaaa aaa = new aaaa(works[0], ww, ll, ii);
        //aaa.t = works[0];
        ts.add(aaa);
      }
      Collections.sort(ts, new ac());
for (aaaa el : ts) {
      System.out.println(el.t);
}
    }
  }

  private static class aaaa {
    public String t;
    public int ww;
    public int ll;
    public int ii;
    public aaaa (String ta, int wwa, int lla, int iia) {
      t = ta;
      ww = wwa;
      ll = lla;
      ii = iia;
    }
  }

  private static class ac implements Comparator<aaaa> {
    public int compare(aaaa a, aaaa b) {
      if (a.ww < b.ww) {
        return 1;
      } else if (a.ww > b.ww) {
        return -1;
      } else {
        if (a.ll < b.ll) {
          return -1;
        } else if (a.ll > b.ll) {
          return 1;
        } else {
          if (a.ii < b.ii) {
            return -1;
          } else if (a.ii > b.ii) {
            return 1;
          } else {
            return 0;
          }
        }
      }
    }
  }

}

Measured memory_bytes: 23164
#include <iostream>
#include <string.h>

using namespace std;

int main()
{
    char s[11], v[11];
    cin>>s;
    int a=0, b;
    b=strlen(s);
    for(int i=0; i<b; i++){
        if(s[i]=='B'){
            if(a==0)
                continue;
            a--;
        }
        else{
            v[a]=s[i];
            a++;
        }
    }
    for(int i=0; i<a; i++)
        cout<<v[i];

    return 0;
}


Measured memory_bytes: 256
def judge(m, f, r):
    p = m + f
    if (m == -1 or f == -1 or p < 30):
        a = 'F'
    elif (p >= 80):
        a = 'A'
    elif (p >= 65 and p < 80):
        a = 'B'
    elif (p >= 50 and p < 65 or r >= 50):
        a = 'C'
    elif (p >= 30 and p < 50):
        a = 'D'
    return a

while True:
    m, f, r = map(int, input().split())
    if (m == -1 and f == -1 and r == -1):
        break
    print(judge(m, f, r))

Measured memory_bytes: 7716
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  vector<int> x(N), y(M);
  for(int i = 0; i < N; i++){
    cin >> x.at(i);
  }
  for(int i = 0; i < M; i++){
    cin >> y.at(i);
  }
  sort(ALL(x)); sort(ALL(y));
  if(X <= x.at(N-1) && x.at(N-1) < y.at(0) && y.at(0) <= Y) cout << "No War" << endl;
  else cout << "War" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    vint a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    --k;
    
    cout << a[k] << endl;
    return 0;
}

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

signed main(){
  int n,x;
  cin>>n>>x;
  int a=x,b=n-x,c=n;
  int res=x;
  if(a==b)return cout<<x*3,0;
  while(true){
    if(a>b){
      int t=a/b;
      if(t>1)--t;
      res+=t*b*2;
      cerr<<t<<"\n";
      a-=t*b;
      c-=t*b;
      cerr<<"a,c:"<<a<<","<<c<<"\n";
    }
    else if(a<b){
      res+=c;
      int an,bn,cn;
      an=2*b-c;
      bn=c-b;
      cn=b;
      a=an;
      b=bn;
      c=cn;
    }
    else{
      res+=b*2;
      return cout<<res,0;
    }
  }
  
}

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

struct restaurant {
    int64_t i;
    char S[11];
    int64_t P;
};

int compare (const void *a, const void *b)
{
    int rc;
    rc = strcmp(((struct restaurant *)a)->S, ((struct restaurant *)b)->S);
    if (rc == 0) {
        if(((struct restaurant *)a)->P - ((struct restaurant *)b)->P < 0)
            return 1;
        if(((struct restaurant *)a)->P - ((struct restaurant *)b)->P > 0)
            return -1;
        return 0;
    } else {
        return rc;
    }
}

int main (int argc, char const *argv[])
{
    int64_t N;
    struct restaurant r[100];
    int64_t ans = 0;

    scanf("%"PRId64, &N);
    for (int i = 0; i < N; i++) {
        scanf("%s""%"PRId64, r[i].S, &r[i].P);
        r[i].i = i + 1;
    }

    qsort(r, N, sizeof(struct restaurant), compare);

    for (int i = 0; i < N; i++) {
        printf("%"PRId64"\n", r[i].i);
    }
}


Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int N;
    cin >> N;
    vector<int> a;
    int tmp;
    for (int i = 0; i < N; i++)
    {
        cin >> tmp;
        a.push_back(tmp);
    }
    bool f[8];
    for (int i = 0; i < 8; i++)
    {
        f[i] = false;
    }
    int count = 0;
    int count2 = 0;
    for (int i = 0; i < N; i++)
    {

        if ((int)(a[i] / 400) == 0 && f[0] == false)
        {
            count++;
            f[0] = true;
        }
        else if ((int)(a[i] / 400) == 1 && f[1] == false)
        {
            count++;
            f[1] = true;
        }
        else if ((int)(a[i] / 400) == 2 && f[2] == false)
        {
            count++;
            f[2] = true;
        }
        else if ((int)(a[i] / 400) == 3 && f[3] == false)
        {
            count++;
            f[3] = true;
        }
        else if ((int)(a[i] / 400) == 4 && f[4] == false)
        {
            count++;
            f[4] = true;
        }
        else if ((int)(a[i] / 400) == 5 && f[5] == false)
        {
            count++;
            f[5] = true;
        }
        else if ((int)(a[i] / 400) == 6 && f[6] == false)
        {
            count++;
            f[6] = true;
        }
        else if ((int)(a[i] / 400) == 7 && f[7] == false)
        {
            count++;
            f[7] = true;
        }
        else if ((int)(a[i] / 400) > 7)
        {
            count2++;
        }
    }
    if (count > 0)
    {
        cout << count << " " << count + count2 << endl;
    }
    else
    {
        cout << 1 << " " << count + count2 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <cstdio>
using namespace std;

#define ll long long
#define vecint vector<int>
#define listint list<int>
#define Pii pair<int, int>

#define REP(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define print(a) cout << a << endl

#define MOD 1000000007
#define NIL -1


int main(){
  int W,H,N;

  cin>>W>>H>>N;

  int max_x=W,min_x=0,max_y=H,min_y=0;


  rep(i,N){
    int x,y,a;
    cin>>x>>y>>a;
    switch(a){
      case 1: min_x=max(min_x,x); break;
      case 2: max_x=min(max_x,x); break;
      case 3: min_y=max(min_y,y); break;
      case 4: max_y=min(max_y,y); break;
    }
  }
  int ans;
  if(max_x<min_x||max_y<min_y){
    ans=0;
  }else{
    ans=(max_x-min_x)*(max_y-min_y);
  }
  print(ans);


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>

using namespace std;
typedef long long ll;

int main(){

  int N;
  cin >> N;

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


  
  for(int i=0;i<101;i++){
    for(int j=0;j<101;j++){
      int ch=1000001010;
      for(int l=0;l<N;l++){
	ch=min(ch,h[l]+abs(i-x[l])+abs(j-y[l]));
      }
      int f=0;
      for(int l=0;l<N;l++){
	if(h[l]!=max(ch-abs(i-x[l])-abs(j-y[l]),0)){
	  f=1;break;
	}
      }
      if(f==0){
	cout << i << " " << j << " " << ch << endl;
	return 0;
      }
	  
    }
  }

}


Measured memory_bytes: 256
while line = gets
  n, x = line.chomp.split(' ').map(&:to_i)
  break if n == 0 && x == 0
  res = 0
  (1..n).to_a.combination(3) do |a, b, c|
    if a + b + c == x
      res += 1
    end
  end
  puts res
end

Measured memory_bytes: 6104
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A = LIST()

print("bust" if sum(A)>=22 else "win")


Measured memory_bytes: 5844
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define vout(v) for(int i=0;i<(int)v.size()-1;i++){cout<<v[i]<<" ";}cout<<v[v.size()-1]<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL);
#define debg(a) cerr<<#a<<" "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}


void solve(long long D, long long G, std::vector<long long> p, std::vector<long long> c){
    ll n = D;
    ll cnt = INF;
    for (ll bit = 0; bit < (1<<n); bit++) {
        V v;
        ll maxn=-1;
        for (ll i = 0; i < n; i++) {
            if(bit & (1<<i)) {
                v.push_back(i);
                /*code*/
            }else{
                maxn=i;
            }
        }
        ll scr = 0;
        ll cntl = 0;
        if(v.size()!=0){
            for (ll i = 0; i < v.size(); i++) {
                scr += p[v[i]] * 100 * (v[i]+1);
                scr += c[v[i]];
                cntl += p[v[i]];
            }
        }
        if(maxn!=-1 && scr < G){
            for (ll i = 0; i < p[maxn]; i++) {
                scr += 100*(maxn+1);
                cntl++;
                if(scr>=G) break;
            }
        }
        // out(cntl);
        // debg(maxn);
        // cout << v.size() << "\n";
        if(scr>=G) cnt = min(cnt, cntl);

        // cout << bit << ": ";
        // for (ll i = 0; i < v.size(); i++) {
        //     cout << v[i] << " ";
        // }
        // cout << endl;

    }
    cout << cnt << "\n";
}

int main(){
    long long D;
    scanf("%lld",&D);
    long long G;
    scanf("%lld",&G);
    std::vector<long long> p(D);
    std::vector<long long> c(D);
    for(int i = 0 ; i < D ; i++){
        scanf("%lld",&p[i]);
        scanf("%lld",&c[i]);
    }
    solve(D, G, std::move(p), std::move(c));
    return 0;
}


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

long long sum = 0;
  string S;
  int n;



int dfs(int i, vector<int> k) {
  if(i == n){
    k.push_back(S.size());
    for(int j=0; j<k.size()-1; j++){
      sum += stoll(S.substr(k[j],k[j+1]-k[j]));
    }
    return 0;
  }

  dfs(i+1, k);
  k.push_back(i+1);
  dfs(i+1, k);

  return 0;
}


int main() {
  cin >> S;
  n = S.size()-1;
  vector<int> k = {0};

  dfs(0, k);
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
typedef long long ll;
using namespace std;
const int N = 1 + 10;
int main() {
	string s;
	cin >> s;
	s = s.substr(0, 4);
	if (s == "YAKI") cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import bisect
import sys


input = sys.stdin.readline
sys.setrecursionlimit(100000)


class v:
    def __init__(self, f):
        self.f = f
        self.v = None

    def __str__(self):
        return str(self.v)

    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n)


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


def read_list():
    return list(read_values())


def f(N, M, b_k, D, i):
    res = 0
    for d in range(D - 1, i, -1):
        res += 2 ** d * (M[d] if b_k[d] == "0" else N - M[d])

    res += 2 ** i * M[i]

    for j in range(i):
        res += 2 ** j * (M[j] if M[j] * 2 > N else N - M[j])

    return res


def main():
    N, K = read_values()
    A = read_list()
    T = max(K + 1, max(A))
    D = len(bin(T)) - 2

    M = [0] * D
    for a in A:
        b = format(a, "0" + str(D) + "b")
        for i, s in enumerate(b):
            M[i] += int(s)

    M.reverse()
    b_k = format(K + 1, "0" + str(D) + "b")[::-1]
    res = v(max)
    for i in range(D):
        if b_k[i] == "0":
            continue
        res.ud(f(N, M, b_k, D, i))

    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 14748
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<stack>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
#define MAX 510000
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;}
using namespace std;


int main(){
  bool CAN=false;
  int A,B;
  cin>>A>>B;
  
  for(int i=1; i<=15000; ++i){
    if(i*2/25==A&&i/10==B){
      cout<<i<<endl;
      return 0;
    }
  }
  
  cout<<-1<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cmath>

typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

using namespace std;

int main(void) {
    string input;
    cin >> input;
    cout << input[0] << input.length() - 2 << input[input.length() - 1] << endl;

    return 0;
}


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

int main() {
  int a, b;
  char op;
  while (cin >> a >> op >> b, op != '?') {
    int ans;
    switch (op) {
    case '+':
      ans = a + b;
      break;
    case '-':
      ans = a - b;
      break;
    case '*':
      ans = a * b;
      break;
    case '/':
      ans = a / b;
      break;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3072
#include <cassert>
#include <iostream>
#include <vector>

int main() {
  int N, M;
  std::cin >> N >> M;
  std::vector<int> k(M);
  std::vector<std::vector<int>> s(M);
  for (int i = 0; i < M; ++i) {
    std::cin >> k[i];
    s[i].resize(k[i]);
    for (int j = 0; j < k[i]; ++j) {
      std::cin >> s[i][j];
      --s[i][j];
    }
  }
  std::vector<int> p(M);
  for (int i = 0; i < M; ++i)
    std::cin >> p[i];

  int res = 0;
  for (int bit = 0; bit < (1 << N); ++bit) {
    std::vector<bool> state(N, false);
    for (int i = 0; i < N; ++i)
      if (bit & (1 << i))
        state[i] = true;

    // Check
    int all = true;
    for (int i = 0; i < M; ++i) {
      int numOn = 0;
      for (int j = 0; j < k[i]; ++j)
        if (state[s[i][j]])
          ++numOn;
      if (numOn % 2 == p[i])
        continue;
      else {
        all = false;
        break;
      }
    }
    if (all)
      ++res;
  }

  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;

int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n,k; cin>>n>>k;
	int ans=n-k+1;
	cout<<ans<<endl;




	return 0;
}


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

int main(){

    long long a, b, c, k; cin >> a >> b >> c >> k;
    if(k % 2 == 0){
        cout << a - b << endl;
    }else{
        cout << b - a << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256