akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <random>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
ll mod = 1000000007 ;
//long double pie = acos(-1) ;
ll INF = 1ll<<61 ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
void fix_cout(){cout << fixed << setprecision(20) ;}
void chmax(ll &a,ll b){	if(a<b) a = b ;}
void chmin(ll &a,ll b){ if(a>b) a = b ;}

map<pll,ll> ans ;

void DFS(vector<vector<int>> &g,int p,int pre,int c){
	int cnt = 0 ;
	for(int i=0;i<g.at(p).size();i++){
		if(g.at(p).at(i)==pre) continue ;
		ans[{min(p,g.at(p).at(i)),max(p,g.at(p).at(i))}] = cnt+(cnt>=c) ;
		DFS(g,g.at(p).at(i),p,cnt+(cnt>=c)) ;
		cnt++ ;
	}
}

int main(){
	ll n ; cin >> n ;
	vector<vector<int>> g(n) ;
	vector<pll> edge(n-1) ;
	for(int i=0;i<n-1;i++){
		ll a,b ;
		cin >> a >> b ;
		a-- ; b-- ;
		if(a>b) swap(a,b) ;
		g.at(a).push_back(b) ;
		g.at(b).push_back(a) ;
		edge.at(i) = pll(a,b) ;
	}
	ll root,k=0 ;
	for(int i=0;i<n;i++){
		if(g.at(i).size()>k){
			k = g.at(i).size() ;
			root = i ;
		}
	}
	DFS(g,root,-1,n) ;
	cout << k << endl ;
	for(int i=0;i<n-1;i++) cout << ans[edge.at(i)]+1 << endl ;
}


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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    ll n,k;
    cin >> n >> k;
    cout << min(n%k,k-n%k) << newl;
}

Measured memory_bytes: 256
import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase
# def gcd(a,b):
#     if b==0:

#         return a
#     else:
#         return gcd(b,a%b)
def main():
    # mod=10**9+7
    #for _ in range(int(input())):
    a,b=map(int,input().split())
    print(a*b)        







BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()


Measured memory_bytes: 65912
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,p;
    cin>>a>>b>>c;
    p=a*b;
    if(p>=c){
        cout<<c<<endl;
    }
    else{
        cout<<p<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
//From Naruto to Hokage
//#include <RJ>
#include<bits/stdc++.h>
using namespace std;

#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=405;
vi v(N);
ll dp[N][N];
ll pre[N];
ll rec(ll l,ll r){
	ll &ans=dp[l][r];
	if(ans!=-1) return ans;
	if(r==l) return 0;
	// if(r-l==1) return ans=v[l]+v[r];
	ans=INF;
	rep(i,l,r-1){
		ans=min(ans,rec(l,i)+rec(i+1,r)+pre[r]-pre[l-1]);
	}
	return ans;
}
void solve(){
    ll n;
    cin>>n;
    rep(i,1,n) cin>>v[i],pre[i]=v[i]+pre[i-1];
    memset(dp,-1,sizeof(dp));
    // sort(all(v),greater<ll>());
    rec(1,n);
    cout<<dp[1][n]<<endl;
    // rep(i,0,n-1) rep(j,0,n-1) cout<<dp[i][j]<<" \n"[j==n-1];
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 1536
// #include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

#define rep(i,n) for (int i = 0; i < n; ++i)
#define repr(i,n) for (int i = n; i > 0; --i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int MAX = 100;
const int INF = (1<<12);

int main() {
  string s;
  cin >> s;
  int maxV = 0;
  int count = 0;
  rep(i,s.size()){
    if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
      count++;
    }
    else{
      count = 0;
    }
    maxV = max(maxV, count);
  }
  cout << maxV << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll w,h,x,y;
  scanf("%lld%lld%lld%lld",&w,&h,&x,&y);
  printf("%.6lf ",w*h/2.0);
  if(x*2==w&&y*2==h)puts("1");
  else puts("0");
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bitset>
using namespace std;
typedef long long ll;
typedef bitset<65> bitnum;
const ll mof = 1e9+7;
ll mem[70][2][2];
ll dp(int pos,bitnum& l,bitnum& r,bool isu, bool isd) {
	if(pos < 0)
	{
		return 1;
	}
	if(mem[pos][isu][isd]){
		return mem[pos][isu][isd];
	}
	ll ret = 0;
	// 0 0
	if(!(isd && l[pos]))
	{
		bool nu=isu,nd=isd;
		if(isu && r[pos])
		{
			nu = 0;
		}
		ret += dp(pos-1,l,r,nu,nd);
	}
	// 1 1
	if(!(isu && !r[pos]))
	{
		bool nu=isu,nd=isd;
		if(isd && !l[pos]){
			nd = 0;
		}
		ret += dp(pos-1,l,r,nu,nd);
	}
	// 1 0
	if(!(isu && !r[pos]) && !(isd && l[pos]))
	{
		bool nu = isu,nd = isd;
		ret += dp(pos-1,l,r,nu,nd);
	}
	ret %= mof;
	mem[pos][isu][isd] = ret;
	return ret;
}
ll solve(ll L,ll R) {
	bitnum l,r;
	for(int i=0;i<64;++i)
	{
		if(L>>i & 1)
			l[i] = 1;
		if(R>>i & 1)
			r[i] = 1;
	}
	int high,low;
	for(high = 64;high>=0;--high) {
		if(r[high]) break;
	} 
	for(low = 64;low >=0;--low) {
		if(l[low]) break;
	}
	ll ans = 0;
	for(int b=high;b>=low;--b) {
		ans += dp(b-1,l,r,b==high,b==low);
		ans %= mof;
	}
	return ans;
}
int main() {
	ll L,R;
	cin>>L>>R;
	cout<<solve(L,R)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <functional>
#include <bits/stdc++.h>
#include <cmath>
using namespace std;

int main () {
  int n, m, c;
  cin >> n >> m >> c;
  int b[m];
  for (int i = 0; i < m; i++){
    cin >> b[i];
  }
  
 
  int count = 0;
  for (int j = 0; j < n; j++){
    int sum = 0;
    for (int k = 0; k < m; k++){
      int tmp;
      cin >> tmp;
      sum += b[k] * tmp;
    }
    if (sum + c > 0){
      count++;
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
class Program {

    static void Main (string[] args) {
        string[] astr = Console.ReadLine ().Split (' ');
        int a = int.Parse (astr[0]);
        int b = int.Parse (astr[1]);
        int c = int.Parse (astr[2]);

        string rtn = string.Empty;
        if (a < c) {
            if (a <= c && b >= c) {
                rtn = "Yes";
            } else {
                rtn = "No";
            }
        } else {
            if (a > c && b < c) {
                rtn = "Yes";
            } else {
                rtn = "No";

            }
        }
            Console.WriteLine (rtn);
        }

    }

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

int64_t MOD = 1000000007;
int64_t MAX = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int64_t N;
    cin >> N;
    vector<int64_t> list;
    int keta = 1;
    while (N > pow(26, keta))
    {
        N -= pow(26, keta);
        keta++;
    }
    N -= 1;
    while (N != 0)
    {
        list.push_back(N % 26);
        N /= 26;
    }
    list.resize(keta);
    reverse(list.begin(), list.end());
    for (auto x : list)
    {
        cout << (char)('a' + x);
    }
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string inp;
	cin>>n;
	getchar();
	cin>>inp;
	long long size=inp.size(),j,i,red=0,green=0,blue=0;
	for(i=0 ; i<size ; i++){
		if(inp[i]=='R') red++;
		else if(inp[i]=='G') green++;
		else blue++;
	}
	long long ans=red*green*blue;
	for(i=0 ; i<size-2 ; i++){
		for(j=i+1 ; j<size-1; j++){
			long long k=2*j - i;
		//	cout<<i<<" "<<j<<" "<<k<<endl;
			if(k<size){
				if(inp[i]+inp[j]+inp[k]=='R'+'G'+'B') ans--;}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

#define rep(i,n) for(int i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;

const int INF = 1001001001;

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

    int n,a=0,b=0;
    int flag = 0;
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    rep(i,n){
        cin >> p[i];
    }
    rep(i,n){
        cin >> q[i];
    }
    vector<int> ans(n);
    rep(i,n){
        ans[i] = i+1;
    }
    int i=1;
    do{
        if (ans == p)
        {
            flag++;
            a = i;
        }
        if(ans == q){
            flag++;
            b = i;
        }
        if(flag >= 2){
            break;
        }
        i++;

    }while(next_permutation(all(ans)));

    int an = abs(a-b);
    cout << an << endl;
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
	public static long gcd(long a, long b) {
		return a%b==0 ? b : gcd(b, a % b);
	}

	public static void main(String[] $){
		System.err.println();
		Scanner s=new Scanner(System.in);
		long a=s.nextLong(),b=s.nextLong(),r=1;
		PrimeIterator pi=new PrimeIterator(10_000_000);
		for(long i:pi) {
			if(a%i==0&&b%i==0) {
				while(a%i==0)
					a/=i;
				while(b%i==0)
					b/=i;
				++r;
			}
			if(i*i>a||i*i>b) {
				if(gcd(a,b)>1)
					++r;
				break;
			}
		}
		System.out.println(r);
	}
}

class PrimeIterator implements Iterable<Integer>,PrimitiveIterator.OfInt{
	BitSet		bitset;
	private int	currentvalue,limit;

	public PrimeIterator(int limit){
		currentvalue=0;
		bitset=new BitSet(limit+1);
		this.limit=limit;
		construct();
	}
	/** Atkin's sieve */
	private final void construct(){
		int sqLim=(int)Math.sqrt(limit+0.5);
		{
			int n;
			for(int z=1;z<=5;z+=4){
				for(int y=z;y<=sqLim;y+=6){
					int ysq=y*y;
					for(int x=1;x<=sqLim&&(n=4*x*x+ysq)<=limit;++x)
						bitset.flip(n);
					for(int x=y+1;x<=sqLim&&(n=3*x*x-ysq)<=limit;x+=2)
						bitset.flip(n);
				}
			}
			for(int z=2;z<=4;z+=2){
				for(int y=z;y<=sqLim;y+=6){
					int ysq=y*y;
					for(int x=1;x<=sqLim&&(n=3*x*x+ysq)<=limit;x+=2)
						bitset.flip(n);
					for(int x=y+1;x<=sqLim&&(n=3*x*x-ysq)<=limit;x+=2)
						bitset.flip(n);
				}
			}
			for(int y=3;y<=sqLim;y+=6){
				int ysq=y*y;
				for(int z=1;z<=2;++z)
					for(int x=z;x<=sqLim&&(n=4*x*x+ysq)<=limit;x+=3)
						bitset.flip(n);
			}
		}
		{
			//remove square
			for(int n=5;n<=sqLim&&n!=-1;n=bitset.nextSetBit(n+1)){
				int nsq=n*n;
				for(int k=nsq;k<=limit;k+=nsq)
					bitset.clear(k);
			}
		}
		bitset.set(2);
		bitset.set(3);
	}

	@Override
	public boolean hasNext(){
		int r=getNextValue();
		return 0<=r&&r<=limit;
	}
	private int getNextValue(){
		return bitset.nextSetBit(currentvalue+1);
	}
	@Override
	public int nextInt(){
		int r=getNextValue();
		if(r<0||limit<r) throw new NoSuchElementException();
		return currentvalue=r;
	}
	@Override
	public OfInt iterator(){
		return this;
	}
	public BitSet getClonedBitSet(){
		return (BitSet)bitset.clone();
	}
}


Measured memory_bytes: 30440
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const ll INF=1e18;
const int MOD=1e9+7;
const double pi=acos(-1);

int main(){
  ll n,x,y;
  cin >>n >> x >> y;
  vector<ll>ans(n);
  for(ll i=1;i<=n;i++){
    for(ll j=i+1;j<=n;j++){
      ll d=min(j-i,abs(i-x)+1+abs(y-j));
      ans[d]++;
    }
  }
  for(ll i=1;i<=n-1;i++){
    cout << ans[i] << endl;
  } 
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;

int main()
{
  cout << setprecision(6);
  cout << setiosflags(ios::scientific);
  cout.flags(ios::fixed);

  double r;
  cin >> r;

  cout << r * r * M_PI << " " << 2 * r * M_PI << endl;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

using namespace std;
typedef long long ll;

int main(int argc, char const *argv[])
{

	int n; cin >> n;
	vector<int> a(n), b(n), c(n), d(n);
	rep(i, n) cin >> a[i] >> b[i];
	rep(i, n) cin >> c[i] >> d[i];

	vector<pair<int, int>> blue(n);
	rep(i, n) blue[i] = make_pair(c[i], d[i]);
	sort(blue.begin(), blue.end());

	int ans = 0;
	rep(i, n) {
		int index = -1, max = -1;
		// printf("blue %d %d\n", blue[i].first, blue[i].second);
		rep(j, n) {
			// printf("red %d %d\n", a[j], b[j]);
			if (a[j] >= blue[i].first || b[j] >= blue[i].second) continue;
			if (max < b[j]) {
				index= j; max = b[j];
			}
		}

		if (index == -1) continue;
		// printf("index %d\n", index);
		a[index] = 1e9, b[index] = 1e9;
		ans++;
	}

	printf("%d\n", ans);
	return 0;
}




Measured memory_bytes: 384
/* --- author: dxm --- */
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

void qread(int &x){
	int neg=1;x=0;
	char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')neg=-1;c=getchar();}
	while(c>='0'&&c<='9')x=10*x+c-'0',c=getchar();
	x*=neg;
}

const int maxn=3005;
const int mod=998244353;
int n,x;
int fac[maxn*2],ifac[maxn*2];
int C(int a,int b){
	return (b<0||a<b)?0:1LL*fac[a]*ifac[b]%mod*ifac[a-b]%mod;
}

int main(){
#ifdef FILE
	freopen("FILE.in","r",stdin);
	freopen("FILE.out","w",stdout);
#endif
	scanf("%d%d",&n,&x);
	fac[0]=fac[1]=ifac[0]=ifac[1]=1;
	for(int i=2;i<=2*n;i++){
		fac[i]=1LL*fac[i-1]*i%mod;
		ifac[i]=1LL*(mod-mod/i)*ifac[mod%i]%mod; 
	}
	REP(i,2*n)ifac[i]=1LL*ifac[i-1]*ifac[i]%mod;
	int tot=0;
	rep(i,n+1){
		int ans=0;
		rep(s,x)ans=(ans+C(i,s-i))%mod;
		rep(j,i){
			int l=i-j+1,r=j;
			if(l>r){
				if(x-1==2*j)ans=(ans+1)%mod;
				continue;
			}
			int s=x-1-2*(i-j);
			if(s<0)continue;
			ans=(ans+C(r-l+1,s-(r-l+1)))%mod;
		} 
		tot=(tot+1LL*ans*C(n,i)%mod)%mod; 
	}
	printf("%d\n",tot);
#ifdef TIME
	printf("Running Time = %d ms\n",int(clock()*1000.0/CLOCKS_PER_SEC));
#endif
	return 0;
}

/*
Input:
-----------------
Output:
*/


Measured memory_bytes: 256
#include <bits/stdc++.h> //g++-9で実行（gcc version 9.3.0），g++だとデフォルトのclang

using namespace std;

//#define int long long                         //intでオーバフローした時の切り替え用
#define debug(x) cerr << #x << ": " << x << endl //エラー出力として変数名と変数の中身表示
#define DEBUG_VEC(v)                   \
    cerr << #v << ":";                 \
    for (int i = 0; i < v.size(); i++) \
        cerr << " " << v[i];           \
    cerr << endl;
#define DEBUG_MAT(v)                          \
    cerr << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cerr << v[i][j] << " ";           \
        }                                     \
        cerr << endl;                         \
    }
#define Sp(p) cout << setprecision(25) << fixed << p << endl; //小数点以下を25桁で表示
#define all(obj) (obj).begin(), (obj).end()
#define pb push_back

//usingエイリアス（別名という意味，型定義のこと）
using ll = long long;
//template <class T> using Vec = std::vector<T>;//エイリアステンプレート

const ll MOD = (ll)1e9 + 7;
//const ll MOD = 998244353;
const ll INF = (ll)1e18 + 1;
const double EPS = 1e-9;
const long double pi = 3.1415926535897932384626433832795028841971L;

//マクロでintをlong longと定義したときはsinged
int main()
{
    cin.tie(0);                  //cinとcoutの同期を切る（高速化)
    ios::sync_with_stdio(false); //iostreamとstdioの同期を切る（高速化)

    string s,t;
    cin >> s >> t;

    for (int i =0;i<s.size();i++){
    if(s[i]!=t[i]){
      cout << "No" <<endl;
      return 0;
    }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

string pairs[2][3] = { {"null","one pair","two pair"},
					  {"three card","full house",""} };

int main() {
	int n[5], c, three, two;
	while (scanf("%d,%d,%d,%d,%d",&n[0],&n[1],&n[2],&n[3],&n[4]) != EOF) {
		int card[13] = { 0 }, c = 0, three = 0, two = 0;
		for (int i = 0; i < 5; i++) {
			card[n[i] - 1]++;
		}

		for (int i = 0; i < 13; i++) {
			if (card[i] == 4) {
				c = 114514;
				break;
			} else if (card[i] == 3) {
				three++;
			} else if (card[i] == 2) {
				two++;
			} else if (card[i] == 1) {
				c++;
				if (c == 5) {
					break;
				}

				if (c == 4 && i == 12 && card[0] == 1) {
					c = 5;
					break;
				}
			} else if(card[i] == 0 && c != 0) {
				c = 0;
			}
		}

		if (c == 5) {
			cout << "straight" << endl;
		} else if (c == 114514) {
			cout << "four card" << endl;
		} else {
			cout << pairs[three][two] << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,c=0,mini;

    cin>>n;

    int a[210];

    for(int i=0;i<n;i++)
        cin>>a[i];

    for(int i=0;i<n;i++)
    {
        mini=i;
        for(int j=i; j<n; j++)
        {
            if(a[mini]>a[j])
            {
                mini=j;
            }
        }

        if(a[i]>a[mini])
        {
            swap(a[i],a[mini]);
            c++;
        }
    }


    for(int i=0;i<n;i++)
    {
        if(i==n-1)
            cout<<a[i]<<endl;
        else
            cout<<a[i]<<' ';
    }


    cout<<c<<endl;
}

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

bool isprime(int num){
    if(num == 2 || num == 3) return true;
    for(int di = 2; di*di <= num; di ++)
    {
        if(num % di == 0) return false;
    }
    return true;
}

int main(){
    int num;
    cin >> num;
    while(!isprime(num)){
        num ++;
    }
    cout << num << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long a,b,c=2017*2018;
  cin >> a >> b;
  if((b/2019-(a-1)/2019)!=0)
    cout << 0 << endl;
  else{
     a%=2019;
     b%=2019;
     for(long i=a;i<=b;i++){
       for(long j=i+1;j<=b;j++){
         c = min(c,(i*j)%2019);
       }
     }
    cout << c << endl;
  }
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define int long long
signed main(){
    int a,b,c;
    cin>>a>>b>>c;
    if((a==5&&b==5&&c==7)||(a==7&&b==5&&c==5)||(a==5&&b==7&&c==5))cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

int main() {
	ll h, w;
	cin >> h >> w;
	map<P, set<P>> graph;
	vector<vector<bool>> wall(h, vector<bool>(w, false));
	int white = 0;
	rep(i, h) {
		rep(j, w) {
			char c;
			cin >> c;
			wall[i][j] = c == '#';
			if (!wall[i][j]) white++;
		}
	}
	vector<vector<ll>> dist(h, vector<ll>(w, INF));
	queue<t3> q;
	q.emplace(0, 0, 1);
	while (!q.empty()) {
		auto t = q.front(); q.pop();
		ll x, y, d;
		tie(x, y, d) = t;
		if (dist[y][x] <= d) {
			continue;
		}
		dist[y][x] = d;
		const P shift[] = { {0,-1},{0,1},{-1,0},{1,0} };
		for (auto e : shift) {
			ll nx = x + e.first;
			ll ny = y + e.second;
			if (nx < 0 || nx >= w) continue;
			if (ny < 0 || ny >= h) continue;
			if (wall[ny][nx]) continue;
			if (dist[ny][nx] <= d + 1) {
				continue;
			}
			q.emplace(nx, ny, d + 1);
		}
	}
	auto t = dist[h - 1][w - 1];
	if (t == INF) {
		cout << -1 << endl;
	}
	else {
		cout << white - t << endl;
	}
	return 0;
}


Measured memory_bytes: 3640
// Template
#include <bits/stdc++.h>
#define rep_override(x, y, z, name, ...) name
#define rep2(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep3(i, l, r) for (int i = (int)(l); i < (int)(r); ++i)
#define rep(...) rep_override(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define per(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003LL;
template <typename T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}
struct IOSET {IOSET() {cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10);}} ioset;

// Mod-Int
constexpr int MOD = 1000000007;
struct ModInt {
    ll val;
    ModInt() = default;
    ModInt(ll x) : val(x % MOD + (x < 0 ? MOD : 0)) {}
    ModInt &operator+= (const ModInt &x) {if ((val += x.val) >= MOD) val -= MOD; return *this;}
    ModInt &operator-= (const ModInt &x) {if ((val -= x.val) < 0) val += MOD; return *this;}
    ModInt &operator*= (const ModInt &x) {(val *= x.val) %= MOD; return *this;}
    ModInt operator+ (const ModInt &x) const {return ModInt(*this) += x;}
    ModInt operator- (const ModInt &x) const {return ModInt(*this) -= x;}
    ModInt operator* (const ModInt &x) const {return ModInt(*this) *= x;}
    ModInt pow(ll t) const {
        if (!t) return ModInt(1);
        ModInt m = pow(t / 2);
        m *= m;
        if (t & 1) m *= *this;
        return m;
    }
    ModInt inv() const {return pow(MOD - 2);}
    ModInt &operator/= (const ModInt &x) {return *this *= x.inv();}
    ModInt operator/ (const ModInt &x) const {return ModInt(*this) /= x;}
    friend istream &operator>> (istream &is, ModInt &x) {is >> x.val; return is;}
    friend ostream &operator<< (ostream &os, const ModInt &x) {os << x.val; return os;}
};

// Main
int main() {
    int n;
    cin >> n;
    cout << ModInt(10).pow(n) - ModInt(9).pow(n) - ModInt(9).pow(n) + ModInt(8).pow(n) << "\n";
    return 0;
}


Measured memory_bytes: 3632
#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>;
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; }


int main(){
    int n, m, x;
    cin >> n >> m >> x;
    int a[n+1][m+2];
    rep(i,n){
        rep(j,m+1){
            cin >> a[i][j];
        }
    }
    int minmoney=1000000000;
    for (int bit = 0; bit < (1<<n); ++bit) {
        vector<int> b(m,0);
        int money=0;
        int flag=0;
        for(int i=0; i<n; ++i){
            if(bit & (1<<i)){
                rep(k,m){
                    b[k]+= a[i][k+1];
                }
                money += a[i][0];
                rep(i,m){
                    if(b[i]<x){
                        flag=1;
                    }
                }
                if(flag==0 && minmoney>money){
                    minmoney=money;
                }
                flag = 0;
            }
        }
    }
    if(minmoney==1000000000){
        cout << -1 << "\n";
    }else{
        cout << minmoney << "\n";
    }
    return 0;
}

Measured memory_bytes: 3520
#include <iostream>
#include <string>
#include <vector>
#include <set>

using namespace std;

int main(){
	int n;
	while(cin >> n){
		if(n == 0) break;
		vector<string> airport;
		vector<string> code;
		int max_code_size = 0;
		for(int i = 0; i < n; i++){
			string in;
			cin >> in;
			airport.push_back(in);
		}

		//??¨???????????????????????????????????????
		for(int i = 0; i < (int)airport.size(); i++){
			string code_name;
			code_name += airport[i][0];
			for(int j = 0; j < (int)airport[i].size() - 1; j++){
				if(airport[i][j] == 'a'
                   || airport[i][j] == 'i'
                   || airport[i][j] == 'u'
                   || airport[i][j] == 'e'
                   || airport[i][j] == 'o'){
					code_name += airport[i][j + 1];
				}
			}
			if(code_name.size() > max_code_size){
				max_code_size = code_name.size();
			}
			code.push_back(code_name);
		}
		//cout << max_code_size << endl;

		//k????¢???????????????£?????¨???????????????????????°??????????????§??????
		int ans_k = 0;
		for(int k = 1; k <= max_code_size; k++){
			set<string> st;	
			for(int i = 0; i < code.size(); i++){
				string in;
				for(int j = 0; j < k && j < code[i].length(); j++){
					in += code[i][j];
				}
				st.insert(in);
			}
			if(st.size() == code.size()){
				ans_k = k;
				break;
			}
		}
		if(ans_k == 0){
			cout << -1 <<endl;
		}else{
			cout << ans_k << endl;
		}
	}
	return 0;
}

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

int main() {
	int A, B, C, K;
	int sum = 0;
	cin >> A >> B >> C >> K;

	if (K < A) {
		cout << K;
		return 0;
	} 
	else if (A <= K && K <= A + B) {
		cout << A;
	}
	else if (A + B < K && K < A + B + C) {
		cout << 2 * A + B - K;
	}
	else {
		cout << A - C;
	}
	return 0;
}

Measured memory_bytes: 3176
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var stdin = bufio.NewScanner(os.Stdin)

func main() {
	func() int { stdin.Scan(); i, _ := strconv.Atoi(stdin.Text()); return i }()
	arr := scanArrayInt()
	var t float64
	for _, v := range arr {
		t += 1 / v
	}
	fmt.Println(1 / t)
}
func scanArrayInt() []float64 {
	var ret = []float64{}
	stdin.Scan()
	for _, s := range strings.Split(stdin.Text(), " ") {
		i, _ := strconv.Atoi(s)
		ret = append(ret, float64(i))
	}
	return ret
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
char a[10]={'g','a','e','i','o','u'};
char c;
int main()
{
    c=getchar();
    for(int i=1;i<=5;i++)
    {
        if(c==a[i])
        {
            cout<<"vowel"<<endl;
            return 0;
        }
    }
    cout<<"consonant"<<endl;
    return 0;
}

Measured memory_bytes: 256
w = input()
bar = range(w)
n = input()
p = 0
while p != n:
    rev = raw_input().split(',')
    bar[int(rev[0])-1],bar[int(rev[1])-1] = bar[int(rev[1])-1],bar[int(rev[0])-1]
    p += 1
for i in bar:
    print i+1

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

ll A, B, N;

ll f(ll i)
{
    return (A * i) / B - A * (i / B);
}

int main()
{
    cin >> A >> B >> N;
    cout << f(min(N, B - 1)) << endl;
}


Measured memory_bytes: 3560
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
#define RED(j,n) for(int i=j;i<n;i++)

int main() {
	int N,h[100000];
	cin >> N;
	RED(0, N) {
		cin >> h[i];
	}

	int dp[100000];
	RED(0, N) {
		dp[i] = INFINITY;
	}

	dp[0] = 0;

	RED(1, N) {
		dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
		if (i > 1) dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
	}

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

Measured memory_bytes: 1024
dance = input()
i=1
flag=0
for char in dance:
  if i%2==1:
    if not char in ['R','U','D']:
      flag=1
      break
  else:
    if not char in ['L','U','D']:
      flag=1
      break   
  i += 1
if flag == 1:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 3060
N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
MOD = 10 ** 9 + 7
a = [[0 for j in range(M + 1)] for i in range(N + 1)]
for i in range(N+1):
    for j in range(M+1):
        if i == 0 or j == 0:
            a[i][j] = 1
        else:
            a[i][j] = a[i-1][j] + a[i][j-1] - (a[i-1][j-1] if S[i-1] != T[j-1] else 0)
            a[i][j] %= MOD
print(a[N][M])


Measured memory_bytes: 74204
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
char a[101010],b[101010];
int gcd(int n,int m)
{
	if(m==0)
		return n;
	return gcd(m,n%m);
}
int main()
{
	int tmp1,tmp2,n,m,G,i;
	scanf("%d%d",&n,&m);
	scanf("%s",a+1);
	scanf("%s",b+1);
	G=gcd(n,m);
	tmp1=n/G,tmp2=m/G;
	for(i=1;i<=G;i++)
	{
		if(a[(i-1)*tmp1+1]!=b[(i-1)*tmp2+1])
		{
			puts("-1");
			return 0;
		}
	}
	printf("%lld\n",(long long)n*m/G);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
 	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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; }
typedef long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int A, B; std::cin >> A >> B;
  if ( !( A>=1  && A <=9 ) ) {
    std::cout << -1 << std::endl;
    return 0;
  }
  if ( !( B>=1  && B <=9 ) ) {
    std::cout << -1 << std::endl;
    return 0;
  }
  std::cout << A * B << std::endl;
  return 0;
}


Measured memory_bytes: 256
import math
from collections import defaultdict


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    visited = [-1 for _ in range(N)]
    visited[0] = 0

    current = 0
    th = -1
    per_loop = -1
    for i in range(1, N+1):
        current = A[current] - 1

        if visited[current] >= 0:
            # print(i, current, visited[current])
            per_loop = i - visited[current]
            th = visited[current]
            break
        else:
            visited[current] = i

    current = 0
    # print(th, per_loop)

    if K < th:
        num_rep = K
    else:
        num_rep = th + (K - th) % per_loop

    for i in range(num_rep):
        current = A[current] - 1

    print(current + 1)


if __name__ == '__main__':
    main()


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

int N;
ll A[100010];

int main()
{
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	sort(A, A + N);
	ll sum1 = 0, sum2 = 0;
	{
		bool tail = true;
		ll l, r, il = 1, ir = N - 1, n = 1;
		auto& sum = sum1;
		l = r = A[0];
		//cerr << A[0] << " ";
		for (int i = 1; i < N; i += 2) {
			int idx1, idx2;
			if (tail) {
				idx1 = ir;
				idx2 = ir - 1;
				ir -= 2;
			}
			else {
				idx1 = il;
				idx2 = il + 1;
				il += 2;
			}
			sum += abs(l - A[idx1]);
			l = A[idx1];
			++n;
			//cerr << A[idx1] << " ";
			if (n < N) {
				sum += abs(r - A[idx2]);
				r = A[idx2];
				++n;
				//cerr << A[idx2] << " ";
			}
			tail = !tail;
		}
		//cerr << endl;
	}
	{
		bool tail = false;
		ll l, r, il = 0, ir = N - 2, n = 1;
		auto& sum = sum2;
		l = r = A[N-1];
		//cerr << A[N-1] << " ";
		for (int i = 1; i < N; i += 2) {
			int idx1, idx2;
			if (tail) {
				idx1 = ir;
				idx2 = ir - 1;
				ir -= 2;
			}
			else {
				idx1 = il;
				idx2 = il + 1;
				il += 2;
			}
			sum += abs(l - A[idx1]);
			l = A[idx1];
			++n;
			//cerr << A[idx1] << " ";
			if (n < N) {
				sum += abs(r - A[idx2]);
				r = A[idx2];
				++n;
				//cerr << A[idx2] << " ";
			}
			tail = !tail;
		}
		//cerr << endl;
	}
	ll sum = max(sum1, sum2);
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define ld long double
#define hell 1000000007
#define hell1 1000000006
#define pb push_back
#define x first
#define y second
#define MAXL 100005
#define pll pair<ll,ll>
#define pii pair<int,int>
#define L LLONG_MAX
#define all(v) (v).begin(),(v).end()
#define tcFile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
using namespace std;
//vector<int>prime(15000005,0);
ll mM(ll a,ll b,ll p=hell){ll res = 0;if(a>=p)a %= p;while(b){if (b & 1ll)res = (res + a);if(res>=p) res%= p;a = (2 * a); if(a>=p)a%=p;b >>= 1ll;}return res;}
ll fpow(ll x,ll y,ll p=hell){if(x>=p)x=x%p;ll res=1;while(y){if(y&1ll)res*=x;if(res<0)res+=p;if(res>=p)res%=p;y=y>>1ll;x*=x;if(x<0)x+=p;if(x>=p)x%=p;}return res;}
ll inv(ll n,ll p=hell){return fpow(n,p-2,p);}
ll modmul(ll x,ll y,ll p = hell){if(x<0)x+=p;if(x>=p)x%=p;if(y<0)y+=p;if(y>=p)y%=p;return (x*y)%p;}
ll modadd(ll x,ll y,ll p = hell){if(x<0)x+=p;if(x>=p)x%=p;if(y<0)y+=p;if(y>=p)y%=p;ll temp=x+y;if(temp>=p)temp%=p;return temp;}
/*void sieve(){
    prime[0] = -1;
    prime[1] = 0;
    for(int i=2;i<=15000000;i++)
        if(!prime[i])
            for(int j=i;j<=15000000;j+=i)
            	if(!prime[j])
            		prime[j] = i;
}*/
int main(){
	ios
	int t = 1,tc = 0;
	//cin >> t;
	while(t--){
		int n;
		cin >> n;
		vector<ld>p(n+1);
		for (int i = 1; i <= n; i++)
			cin >> p[i];
		vector<vector<ld>>dp(n+1, vector<ld>(n+1, 0));
		dp[0][0] = 1;
		for (int j = 1; j <= n; j++) {
			ld head = p[j], tail = 1 - p[j];
			//cout << j << " " << head << " " << tail << "\n";
			dp[0][j] = tail*dp[0][j-1];
			for (int i = 1; i <= j; i++)
				dp[i][j] = head*dp[i-1][j-1] + tail*dp[i][j-1];
		}
		//for (int i = 0; i <= n; i++,cout << "\n")
		//	for (int j = 0; j <= n; j++,cout << " ")
		//		cout << dp[i][j];
		ld ans = 0;
		for (int i = (n/2) + 1; i<= n; i++)
			ans += dp[i][n];
		cout << fixed << setprecision(10) << ans << "\n";
	}
}


Measured memory_bytes: 144224
def grid_bfs(h,w,start,maxD):
    INF = 10**9+7
    distance = [[INF for _ in range(w)] for _ in range(h)]
    queue = deque()
    for s in start:
        queue.append(s)
        distance[s[0]][s[1]] = 0
    while len(queue):
        y, x = queue.popleft()
        for i in range(0, 4):
            nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]
            if (0 <= nx < w and 0 <= ny < h):
                if (distance[ny][nx] > distance[y][x] + 1):
                    queue.append([ny, nx])
                    distance[ny][nx] = distance[y][x] + 1
                    if maxD<distance[ny][nx]:
                        maxD = distance[ny][nx]
    return maxD
def examA():
    H, W = LI()
    A = [[1 if a == "#" else 0 for a in SI()] for _ in range(H)]
    start = []
    for i in range(H):
        for j in range(W):
            if A[i][j]==1:
                start.append([i,j])
    ans = grid_bfs(H,W,start,0)
#    print(D,V)
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()


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

using namespace std;

int min(int a, int b)
{
    if(a<b) return a; return b;
}

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);

    string s, t; cin>>s>>t;
    int a, b; cin>>a>>b;
    string u; cin>>u;
    if(u==s) cout<<a-1<<" "<<b<<endl;
    else cout<<a<<" "<<b-1<<endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
number = list(map(int, input().split()))
seki = 1
if 0 in number:
  seki = 0
else:
  for i in number:
    seki = seki*i
    if seki > 10 ** 18:
      seki = -1
      break
    else:
      continue
print(seki)
  


Measured memory_bytes: 21408
#include <bits/stdc++.h>
#define R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
using namespace std;

template <class T>
inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}

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

Measured memory_bytes: 256
import math

mod = 10 ** 9 + 7
N = int(input())

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0

    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]
    
d = {}
P = primes(N + 1)

for p in P:
    d[p] = 0
    k = p
    while k <= N:
        d[p] += N // k
        k *= p

res = 1
for v in d.values():
    res *= v + 1
    res %= mod
print(res)


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

using ll = long long;

bool check (vector <pair<int, int>> a) {
	int cur = 0;
	for (auto i:a) {
		if (cur + i.first < 0) return 0;
		cur += i.second;
	}
	return 1;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, total = 0;
	cin >> n;
	vector <pair<int, int>> ls, rs;
	for (int i=0; i<n; i++) {
		string s;
		cin >> s;
		int mn = 0, cur = 0;
		for (char &i:s) {
			cur += (i == '(' ? 1 : -1);
			mn = min(mn, cur);
		}
		total += cur;
		if (cur > 0) {
			ls.emplace_back(mn, cur);
		} else {
			rs.emplace_back(mn-cur, -cur);
		}
	}
	sort(ls.rbegin(), ls.rend());
	sort(rs.rbegin(), rs.rend());
	if (!total && check(ls) && check(rs)) {
		cout << "Yes";
	} else {
		cout << "No";
	}
	return 0;
}


Measured memory_bytes: 18908
import sys
from bisect import bisect_right

sys.setrecursionlimit(500000)


class DualSegmentTree:
    def __init__(self, n) :
        self.n = n
        self.N0 = 1 << n.bit_length()
        self.data = [0] * (self.N0*2)
 
    def update(self, l, r, val) :
        l += self.N0
        r += self.N0
        while l < r:
            if l & 1:
                self.data[l] = self.data[l] + val
                l += 1
            if r & 1:
                self.data[r-1] = self.data[r-1] + val
                r -= 1
            l //= 2
            r //= 2
 
    def query(self, i):
        i += len(self.data) // 2
        ret = self.data[i]
        while i > 0:
            i //= 2
            ret = ret + self.data[i]
        return ret

def main():
    N, D, A = map(int, input().split())
    monsters = []

    for i in range(N):
        x, h = map(int, input().split())
        monsters.append((x,h))

    seg = DualSegmentTree(N)
    monsters.sort()
    X = [0] * N
    H = [0] * N
    for i in range(N):
        X[i], H[i] = monsters[i]
    ans = 0
    for i in range(N):
        tmp_dist = monsters[i][0] + 2 * D
        tmp_hp = int(monsters[i][1] - seg.query(i))
        if tmp_hp <= 0:
            continue
        idx = bisect_right(X, tmp_dist)
        cnt = tmp_hp // A if tmp_hp % A == 0 else tmp_hp // A + 1
        ans += cnt
        seg.update(i,idx,cnt*A)

    print(ans)
    


    


if __name__ == "__main__":
    main()

Measured memory_bytes: 80984
from functools import reduce

N, M = map(int, input().split())
MOD = 10 ** 9 + 7
if abs(N - M) >= 2:
    print(0)
elif abs(N - M) == 1:
    n = reduce(lambda x, y: x * y % MOD, range(1, N + 1))
    m = reduce(lambda x, y: x * y % MOD, range(1, M + 1))
    print(n * m % MOD)
else:
    n = reduce(lambda x, y: x * y % MOD, range(1, N + 1))
    m = reduce(lambda x, y: x * y % MOD, range(1, M + 1))
    print(n * m * 2 % MOD)


Measured memory_bytes: 3572
#include<iostream>
//#include<cstring>
#include<cmath>
//#include<cstdio>
//#include<algorithm>
using namespace std;

int ans=1,n,k;

int main(){
	cin>>n>>k;
	for(int i=0; i<n; i++){
		ans=ans+min(ans,k);
	}
	cout<<ans<<endl;
	return 0;
} 

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

/* 
 * g++ -std=c++17 main.cpp -o main
 */
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  stack<char> stk;
  string output = "";
  for(char c : s) {
    if (c == 'B' ) {
      if (!stk.empty()) stk.pop();
    } else {
      stk.push(c);
    }
  }
  while(!stk.empty()) {
    char c = stk.top();
    stk.pop();
    output = c + output;
  }
  cout<<output<<endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define REPI(i, a, b) for (ll (i) = (a); (i) < (b); (i)++)
#define int long long
#define MOD 1000000007
using namespace std;
using P = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
class UnionFind {
public:
  VI par, rank;
  UnionFind(int n) {
    par = VI(n); iota(par.begin(), par.end(), 0);
    rank = VI(n, 0);
  }
  int root(int x) {
    if (par[x] == x) {
      return x;
    } else {
      return par[x] = root(par[x]);
    }
  }
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) { return; }
    if (rank[x] < rank[y]) {
      par[x] = y;
    } else {
      par[y] = x;
      if (rank[x] == rank[y]) { rank[x]++; }
    }
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
};

struct edge { int u, v, cost; };
bool comp(const edge& e1, const edge& e2) { return e1.cost < e2.cost; }
struct neigh { int to, cost; };
vector<vector<neigh>> g;
vector<edge> es2;
int kruskal(int V, vector<edge>& es) {
  sort(es.begin(), es.end(), comp);
  UnionFind uf(V);
  int ans = 0;
  for (edge e: es) {
    if (uf.same(e.u, e.v)) { es2.push_back(e); continue; }
    uf.unite(e.u, e.v);
    ans += e.cost;
    g[e.u].push_back({e.v, e.cost});
    g[e.v].push_back({e.u, e.cost});
  }
  return ans;
}
vector<bool> visited;
int dfs(int v1, int v2, int acc) {
  if (v1 == v2) { return acc; }
  visited[v1] = true;
  int ans = -1;
  for (neigh nei: g[v1]) {
    if (visited[nei.to]) { continue; }
    ans = max(ans, dfs(nei.to, v2, max(acc, nei.cost)));
  }
  return ans;
}
int pow_mod(int x) {
  if (x == 0) { return 1; }
  int tmp = pow_mod(x / 2);
  return tmp * tmp % MOD * (x % 2 ? 2 : 1) % MOD;
}
signed main() {
  int N, M, X;
  cin >> N >> M >> X;
  vector<edge> es(M);
  g = vector<vector<neigh>>(N);
  REP (i, M) {
    cin >> es[i].u >> es[i].v >> es[i].cost;
    es[i].u--; es[i].v--;
  }
  int S = kruskal(N, es);
  int D = X - S;
  if (D < 0) {
    cout << 0 << endl; return 0;
  }
  int eqs = 0;
  int ups = 0;
  int lws = 0;
  for (edge e: es2) {
    visited = vector<bool>(N, false);
    int path = dfs(e.u, e.v, 0);
    assert(path <= e.cost);
    if (e.cost == path + D) { eqs++; }
    else if (e.cost > path + D) { ups++; }
    else { lws++; }
  }
  assert(eqs + ups + lws == es2.size());
  int tmp = 2 * (pow_mod(eqs) - 1) % MOD * pow_mod(ups) % MOD;
  if (D == 0) {
    cout << ((pow_mod(N-1) - 2) % MOD * pow_mod(M-N+1) % MOD + tmp) % MOD << endl;
  } else {
    cout << tmp << endl;
  }
}


Measured memory_bytes: 1280
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;


void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n;
    // int arr[n];
    vi arr;
    for(int i=0;i<n;i++){
        cin>>a;
        if(i==0 or arr[sz(arr) - 1] !=a){
            arr.pb(a);
        }
    }

    n = sz(arr);
    sum = 1000;

    int stocks = 0;

    for(int i=0; i<n; i++) {

        //check for local minima so that we can buy

        if((i == 0 || arr[i] < arr[i - 1]) && (i!=n - 1 && arr[i] < arr[i + 1])){
            stocks += sum/arr[i];
            sum = sum%arr[i];
        }

        //local maxima to sell

        else if((i == n-1 || arr[i] > arr[i + 1]) && (i!=0 && arr[i] > arr[i - 1])){

            sum += stocks*arr[i];
            stocks = 0;
        }
    }

    cout<<sum<<endl; 
}

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

  return 0;
}


Measured memory_bytes: 3644