akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

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

  if(A.size() > B.size()){
    cout << "GREATER" << endl;
    return 0;
  }
  else if(B.size() > A.size()){
    cout << "LESS" << endl;
    return 0;
  }
  else{
    rep(i, A.size()){
      if(A[i] > B[i]){
	cout << "GREATER" << endl;
	return 0;
      } else if(B[i] > A[i]){
	cout << "LESS" << endl;
	return 0;
      }
    }
  }

  cout << "EQUAL" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define sec second
#define fir first
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
typedef vector<int> Vec;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};

Vec fact;

void init_fact(int n) {
    fact = Vec(n);
    fact[0] = 1;
    REP(i, 1, n+1) fact[i] = fact[i-1] * i % MOD;
}

int mod_pow(int x, int pow) {
    if (pow == 0) return 1;
    int a = mod_pow(x, pow / 2);
    a = a * a % MOD;
    if (pow % 2 == 1) a *= x;
    return a % MOD;
}
 
int mod_div(int a, int b) {
    return a * mod_pow(b, MOD - 2) % MOD;
}

// n! / r! * (n - r)!
int calc_comb(int n, int r) {
    if(n < r) return 0;
    return mod_div(fact[n], fact[r] * fact[n - r] % MOD);
}

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

    init_fact(200000);
    int n, k;
    cin >> n >> k;
    Vec a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));

    int res = 0;
    REP(i, 1, n) {
        int cur = calc_comb(n, k);
        cur -= calc_comb(i, k), cur += MOD;
        cur -= calc_comb(n - i, k), cur += MOD;
        res += cur * (a[i] - a[i - 1]), res %= MOD;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2560
n = int(input())
h = list(map(int, input().split()))
flag = True
for i in range(n-1, 1, -1):
    if h[i] - h[i - 1] < 0:
        h[i - 1] -= 1
        if h[i] - h[i - 1] < 0:
            flag = 0
if h[0] > h[-1]:
    flag = 0

# print(h)
print("Yes" if flag else 'No')


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

int main() {
  int N; cin >> N;
  
  int count = 0;
  
  for (int i = 0; i <= N; ++i) {
    for (int j = 0; j <= N; ++j) {
	  int total = 4 * i + 7 * j;
      if (total == N) ++count;
    }
  }
  if (count > 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3636
N = int(input())
listA = list(map(int, input().split()))

cost = 0
length = 0
for a in listA:
    length += a

padding = 0
if (length % 2 != 0):
    cost += 1
    length += 1
#    padding = 1

half = int(length / 2)

i = 0
sum = padding
while sum < half:
    sum += listA[i]
    i += 1

if (sum != half):
    rightSum = 0
    for j in range(i - 1, N):
        rightSum += listA[j]

    if (sum > rightSum):
        sum -= listA[i - 1]
        print(int(rightSum - sum))
    else:
        rightSum -= listA[i - 1]
        print(int(sum - rightSum))
else:
    print(0)


Measured memory_bytes: 26220
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>

typedef long long ll;

using namespace std;

int main()
{
	int p;
	string s;
	map<string, set<int> > b;
	while (cin >> s >> p)
		b[s].insert(p);

	for (map<string, set<int> >::iterator i = b.begin(); i != b.end(); ++i)
	{
		string w = i->first;
		cout << w << endl;
		set<int>& t = i->second;
		for (set<int>::iterator it = t.begin(); it != t.end(); ++it)
		{
			if (it != t.begin())
				cout << " ";
			cout << *it;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;



int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int h,w,k;
    cin >> h >> w >> k;
    vector<string> c(h);
    rep(i, h) cin >> c[i];
    ll ans = 0;
    for (int hbit = 0; hbit < (1<<h); ++hbit)
    {
        for(int wbit = 0; wbit < (1<<w); ++wbit){
            ll count = 0;
            for (int i = 0; i < h; ++i) {
                for (int j = 0; j < w; ++j) {
                    if(hbit & (1<<i) && wbit & (1 << j)) {
                        if(c[i][j] == '#') count++;
                    }
                }
            }
            
        if(count == k) ans++;
        }
    }
    
    print(ans);

}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 100000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    vector<int>num;
    if(s[0]=='0')num.push_back(0);
    for(int i=0;i<s.size();){
       int j=i;
       while(s[j]==s[i] and j<s.size()){
          j++;
       }
       num.push_back(j-i);
       i=j;
       
    }
    if(s.back()=='0')num.push_back(0);
    vector<int>sum(num.size()+1,0);
    for(int i=0;i<num.size();i++){
       sum[i+1]=sum[i]+num[i];
    }
    int ans=0;
    for(int l=0;l<sum.size();l+=2){
       int r=l+k*2+1;
       if(r>=sum.size())r=sum.size()-1;
       ans=max(ans,sum[r]-sum[l]);
    }
    cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 1272
n = int(input())
for i in range(n):
  x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
  v1x = x1 - x2
  v1y = y1 - y2
  v2x = x3 - x4
  v2y = y3 - y4
  if abs(v1x * v2y - v2x * v1y) < 10 ** -10 :
    print("YES")
  else:
    print("NO")


Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
const int maxn=8e5+9,p=924844033;
int r[maxn];
inline int poww(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=1ll*ans*a%p;
        b>>=1;
        a=1ll*a*a%p;
    }
    return ans%p;
}
inline int inv(int x){
    return poww(x,p-2)%p;
}
inline int getrev(int n,int m){
    int lim=1,l=0;
    while(lim<=n+m)++l,lim<<=1;
    for(int i=0;i<=lim;++i)r[i]=r[i>>1]>>1|(i&1)<<l-1;
    return lim;
}
inline void NTT(int limit,int *A,int type){
    int pr=5;
    for(int i=0;i<limit;++i)if(r[i]>i)swap(A[i],A[r[i]]);
    for(int mid=1;mid<limit;mid<<=1){
        int wn=poww(type==-1?inv(pr):pr,(p-1)/(mid<<1));
        for(int j=0,R=mid<<1;j<limit;j+=R){
            int w=1;
            for(int k=0;k<mid;++k,w=1ll*w*wn%p){
                int x=A[j+k],y=1ll*w*A[j+k+mid]%p;
                A[j+k]=(x+y)%p;
                A[j+k+mid]=(x-y+p)%p;
            }
        }
    }
    if(type==-1){
        int INV=inv(limit);
        for(int i=0;i<limit;++i)A[i]=1ll*A[i]*INV%p;    
    }
}
vector<int>v[maxn];
int cnt[maxn],n,fac[maxn],ifac[maxn],siz[maxn];
void dfs(int x,int fa){
	siz[x]=1;
	for(auto y:v[x]){
		if(y==fa)continue;
		dfs(y,x);
		siz[x]+=siz[y];
		++cnt[siz[y]];
	}
	++cnt[n-siz[x]];
}
int a[maxn],b[maxn];
int main(){
	cin>>n;
	fac[0]=1;for(int i=1;i<=n;++i)fac[i]=1ll*fac[i-1]*i%p;
	ifac[n]=inv(fac[n]);for(int i=n-1;i>=0;--i)ifac[i]=1ll*ifac[i+1]*(i+1)%p;
	for(int i=1,x,y;i<n;++i){
		cin>>x>>y;v[x].push_back(y);v[y].push_back(x);
	}
	dfs(1,0);cnt[0]=0;
	for(int i=1;i<=n;++i)a[i]=1ll*fac[i]*cnt[i]%p;
	for(int i=0;i<=n;++i)b[i]=ifac[i];
	reverse(a,a+n+1);
	int lim=getrev(n,n);
	NTT(lim,a,1);NTT(lim,b,1);
	for(int i=0;i<=lim;++i)a[i]=1ll*a[i]*b[i]%p;
	NTT(lim,a,-1);
	reverse(a,a+n+1);
	for(int i=1;i<=n;++i)a[i]=1ll*a[i]*ifac[i]%p,a[i]=(1ll*n*fac[n]%p*ifac[i]%p*ifac[n-i]%p+p-a[i])%p;
	for(int i=1;i<=n;++i)cout<<a[i]<<endl;
}

Measured memory_bytes: 56576
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <new>

#define FOR(i,m,n)    for(int i=m;i<n;i++)
#define FORB(i,m,n)    for(int i=m;i>=n;i--)
#define INF 999999999
#define ll long long
#define PUSH(a) push_back(a)
#define POP() pop_back()
#define SORT(v,n) sort(v,v+n)
#define VSORT(v) sort(v.begin(),v.end())

using namespace std;

int dy[] = { 0,0,1,-1 };
int dx[] = { 1,-1,0,0 };

int main() {
	string S;
	cin >> S;
	int counter = 0;
	for (int i = 0;i < 6;i++) {
		if (S[i] == '1') counter++;
	}

	cout << counter << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int A[3];
  int sum=0;
  int i;

  for(i=0;i<3;i++)scanf("%d",&A[i]);
  sum = A[0] + A[1] + A[2];
  if(sum>=22)puts("bust");
  else puts("win");

  return 0;
}



Measured memory_bytes: 128
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	t := make([]int, n)
	for i := range t {
		fmt.Scan(&t[i])
	}
	var m int
	fmt.Scan(&m)
	p := make([]int, m)
	x := make([]int, m)
	for i := range p {
		fmt.Scan(&p[i], &x[i])
	}
	sum := 0
	for i := range t {
		sum += t[i]
	}

	ans := make([]int, m)
	for i := range p {
		tmp := sum - t[p[i]-1] + x[i]
		ans[i] = tmp
	}

	for i := range ans {
		fmt.Println(ans[i])
	}

}


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

signed main(){
  
  int n,k;
  cin >> n >> k;
  
  vector<int> h;

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

    h.push_back(x);
  }

  sort(h.begin(), h.end());

  int ans = 0;

  for(int i = 0;i<n-k;i++){
    ans+=h[i];
  }

  cout << ans << endl;
  return 0;
}
    
  


Measured memory_bytes: 2420
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int K = in.nextInt();
            int Q = in.nextInt();
            int[] A = new int[Q];
            for (int i = 0; i < Q; i++) {
                A[i] = in.nextInt() - 1;
            }

            int[] win = new int[N];
            for (int i = 0; i < Q; i++) {
                win[A[i]]++;
            }

            boolean[] isWin = new boolean[N];
            for (int i = 0; i < N; i++) {
                isWin[i] = K - (Q - win[i]) > 0;
            }

            StringBuilder res = new StringBuilder();
            for (int i = 0; i < N; i++) {
                res.append(isWin[i] ? "Yes" : "No").append("\n");
            }
            System.out.print(res.toString());
        }
    }
}


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

int main()
{
    int n;
    std::cin >> n;
    std::vector<std::string> s(n);
    for (int i = 0; i < n; ++i)
    {
        std::cin >> s[i];
    }

    std::sort(s.begin(), s.end());
    s.erase(std::unique(s.begin(), s.end()), s.end());
    std::cout << s.size() << std::endl;
    return 0;
}

Measured memory_bytes: 9600
import sys
sys.setrecursionlimit(10**6)

readline = sys.stdin.readline
n = int(readline())
G = [[] for _ in range(n)]
ans = [-1] * n
for _ in range(n-1):
    u, v, w = map(int, readline().split())
    u -= 1
    v -= 1
    G[u].append((v, w))
    G[v].append((u, w))
q = [0]
ans[0] = 1
while q:
    x = q.pop()
    for i, d in G[x]:
        if ans[i] != -1:
            continue
        if d % 2:
            ans[i] = int(not ans[x])
        else:
            ans[i] = ans[x]
        q.append(i)
print(*ans, sep='\n')


Measured memory_bytes: 40364
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
import numpy as np
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

start = time.time()

D = ni()
c = na()
s = [na() for _ in range(D)]
#out = [ni() for _ in range(D)]
sat = 0
last = [0] * 26
t = []
for d in range(D):
    li = []
    for k in range(26):
        last_t = last.copy()
        sat_t = sat
        j = k
        last_t[j] = d + 1
        for i in range(26):
            sat_t -= (d + 1 - last_t[i]) * c[i]
        sat_t += s[d][j]
        li.append(sat_t)
    sat = max(li)
    day = np.argmax(li)
    last[day] = d + 1
    #print(day+1, sat)
    t.append(day+1)

now = sat
while time.time() - start < 1.8:
    d = random.randint(1, D)
    q = random.randint(1, 26)
    if t[d - 1] == q:
        continue
    old = t[d-1]
    t[d-1] = q
    sat = 0
    last = [0] * 26
    for k in range(D):
        j = t[k] - 1
        last[j] = k + 1
        for i in range(26):
            sat -= (k + 1 - last[i]) * c[i]
        sat += s[k][j]
    if now > sat:
        t[d-1] = old
    else:
        now = sat
for i in range(D):
    print(t[i])


Measured memory_bytes: 27360
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

int dp[512][100001];

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

	cin >> N;
	vector<int>v(N + 1);
	vector<int>w(N + 1);
	for (int i = 1; i <= N; i++) {
		cin >> v[i] >> w[i];
	}
	vector<int>m(1024);
	for (int i = 1; i < 1024; i++) {
		for (int j = 0; j < 10; j++) {
			if ((i >> j) & 1) {
				m[i] = j;
				break;
			}
		}
	}
	M = min(511, (int)N);
	for (int i = 1; i <= M; i++) {
		for (int j = 100000; j >= 0; j--) {
			dp[i][j] = dp[i / 2][j];
			if (j >= w[i])dp[i][j] = max(dp[i / 2][j - w[i]] + v[i], dp[i][j]);
		}
		for (int j = 1; j <= 100000; j++) {
			dp[i][j] = max(dp[i][j], dp[i][j - 1]);
		}
	}
	pair<int, int>a[1024];
	cin >> K;
	while (K--) {
		cin >> L >> R;
		vector<int>V;
		vector<int>W;
		int box = L;
		while (box > M) {
			V.emplace_back(v[box]);
			W.emplace_back(w[box]);
			box >>= 1;
		}
		int ans = dp[box][R];
		for (int i = 1; i < 1 << V.size(); i++) {
			a[i] = a[i ^ (1 << m[i])];
			a[i].second += V[m[i]];
			a[i].first += W[m[i]];
			if(R-a[i].first>=0)ans = max(ans, dp[box][R - a[i].first] + a[i].second);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 205036
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    map<string, int> m;
    int mx = 0;
    REP(i, n) {
        string s;
        cin >> s;
        m[s]++;
        chmax(mx, m[s]);
    }
    for (auto x : m) {
        if (x.second == mx) cout << x.first << endl;;
    }
}


Measured memory_bytes: 23808
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;

int main() {
    ll n; cin >> n;
    if (n&1) {
        cout << "0"; return 0;
    }
    ll pow5 = 10ll, ans = 0ll;
    while (pow5 <= n) {
        ans += n / pow5;
        pow5 *= 5;
    }
    cout << ans;


    return 0;
}


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

typedef struct{
  int p;
  int l;
  int r;
}NODE;

void Preorder(int);
void Inorder(int);
void Postorder(int);

NODE A[300];

int main()
{
  int n,i,id,l,r,root;

  scanf("%d",&n);
  if(n<1 || n>25) exit(1);

  for(i=0;i<n;i++)
    A[i].p = -1; //rootの判定をするため
  
  for(i=0;i<n;i++){
    scanf("%d %d %d",&id,&l,&r);
    A[id].l = l; 
    A[id].r = r;
    if(l != -1) A[l].p = id; //子がいたらその子の親を設定
    if(r != -1) A[r].p = id; //同上
  }

  for(i=0;i<n;i++){
    if(A[i].p == -1) root = i;
  }

  printf("Preorder\n");
  Preorder(root); //上→左→右
  printf("\nInorder\n");
  Inorder(root); //左→上→右
  printf("\nPostorder\n");
  Postorder(root); //左→右→上
  printf("\n");
  
  return 0;
}
void Preorder(int root)
{
  if(root == -1) return; 
  printf(" %d",root); //上
  Preorder(A[root].l); //左
  Preorder(A[root].r); //右
}

void Inorder(int root)
{
  if(root == -1) return;
  Inorder(A[root].l); //左
  printf(" %d",root); //上
  Inorder(A[root].r); //右
}

 void Postorder(int root)
 {
   if(root == -1) return ;
   Postorder(A[root].l); //左
   Postorder(A[root].r); //右
   printf(" %d",root); //上
 }



Measured memory_bytes: 2056
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		String str=s.nextLine();
		s.close();
		Set<Character> map=new HashSet<Character>();
		char[ ]ch={'A','C','G','T'};
		for(char c : ch){
			map.add(c);
		}
		char[] tmp=str.toCharArray();
		int counter=0;
		int max=0;
		for(int i=0;i<tmp.length;i++){
			if(map.contains(tmp[i])){
				counter++;
			}else{
				max=Math.max(max, counter);
				counter=0;
			}
		}
		max=Math.max(max, counter);
		System.out.println(max);
	}
}

Measured memory_bytes: 22612
#include <iostream>

using namespace std;
bool judge(int a,int b,int c);
int main()
{
    int n;
    int num=0;
    cin>>n;
    int lenth[n+5];
    for(int i=0;i<n;i++)
        cin>>lenth[i];
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            for(int k=j+1;k<n;k++)
            {
                if(judge(lenth[i],lenth[j],lenth[k]))
                    num++;
            }
        }
    }
    cout<<num;
    return 0;
}

bool judge(int a,int b,int c)
{
    if(a<b+c)
        if(b<a+c)
            if(c<a+b)
                return 1;
    return 0;
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long 
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define pw(x) (1<<(x))
#define inf 10000000000000000
#define MOD 1000000007	
#define N 200005
#define M 100005
#define LOG 20
#define KOK 5880
#define EPS 0.00000001
using namespace std;

int n,a,b,cnt;
vector<int> tmp,res[2];

void fp(vector<int> cur) {

	if(sz(cur)==0) {

		res[cnt].pb(0);

		return ;

	}

	if(sz(cur)==1) {

		res[cnt].pb(0);
		res[cnt].pb(pw(cur[0]));

		return ;

	}

	vector<ii> alw;

	alw.pb({0,0});
	alw.pb({0,1});
	alw.pb({1,1});
	alw.pb({1,0});

	int l1=cur.back();

	cur.ppb();

	int l2=cur.back();

	cur.ppb();

	fp(cur);

	tmp.clear();

	int tut=sz(res[cnt]);
	int now=0;

	for(int i:res[cnt]) {

		++now;

		for(ii x:alw) {

			tmp.pb(i+(x.st*pw(l1))+(x.nd*pw(l2)));

		}

		if(now==tut-1) {

			alw.insert(alw.begin(),alw.back());

			alw.ppb();

		}
		else {

			reverse(all(alw));

		}

	}

	swap(tmp,res[cnt]);

}

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

	scanf("%d %d %d",&n,&a,&b);

	b^=a;

	if(__builtin_popcount(b)%2==0) {

		printf("NO");

		return 0;

	}

	vector<int> z,o;

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

		if(pw(i)&b) o.pb(i);
		else z.pb(i);

	}

	fp(z);

	++cnt;

	fp(o);

	printf("YES\n");

	for(int i:res[1]) {

		for(int j:res[0]) {

			printf("%d ",(i+j)^a);

		}

		reverse(all(res[0]));

	}
	

}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll a, b, c; cin >> a >> b >> c;
  ll d = c - a - b;
  if (d >= 0 && 4 * a * b < d * d) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <set>
#include <unordered_set>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}
	int res = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			res += (nums[i] * nums[j]);
		}
	}

	cout << res;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            var A=Sarray();
            var nums = new long[N + 1];
            nums[0] = 3;
            var ans = 1L;
            for (var i = 0; i < N; ++i)
            {
                ans = (ans * nums[A[i]]) % Mod;
                --nums[A[i]];
                ++nums[A[i] + 1];
            }
            WriteLine(ans);
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 21984
#include<stdio.h>
#include<string.h>
int main()
{
 char s[100000];
 int i;
 int b1=0;
 int w1=0;
 scanf("%s",s);
 
 for(i=0;i<strlen(s);i++){
     if(i%2==0){
       if(s[i]=='0'){
         b1++; 
       }
     }
   
   else if(i%2==1){
      if(s[i]=='1'){
        b1++;
      }
   }
 }

     

   for(i=0;i<strlen(s);i++){
   if(i%2==0){
     if(s[i]=='1'){
      w1++; 
     }
   }
   else if(i%2==1){
      if(s[i]=='0'){
        w1++;
      }
   }
 }
     
 if(b1<=w1){
   printf("%d",b1);
 }
 else if(b1>w1){
   printf("%d",w1);
 }
   
 
   return 0;
}
    

Measured memory_bytes: 256
n=int(input())
M=[[-1]*n for _ in[0]*n]
for _ in[0]*n:
 e=list(map(int,input().split()))
 for i in range(e[1]):k=2*-~i;M[e[0]][e[k]]=e[k+1]
d=[0]+[1e6]*~-n
c=[1]*n
while 1:
 m,u=1e6,-1
 for i in range(n):
  if m>d[i]and c[i]:m,u=d[i],i
 if u<0:break
 c[u]=0
 for v in range(n):
  if c[v]and 1+M[u][v]and d[v]>d[u]+M[u][v]:
   d[v]=d[u]+M[u][v]
for i in range(n):print(i,d[i])


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

int main(){
  int x,y,a,b,c; cin>>x>>y>>a>>b>>c;
  vector<long long> p(a), q(b), r(c);
  for (int i=0; i<a; i++) cin>>p[i];
  for (int j=0; j<b; j++) cin>>q[j];
  for (int k=0; k<c; k++) cin>>r[k];
  sort(p.begin(), p.end());
  sort(q.begin(), q.end());
  sort(r.begin(), r.end());
  reverse(p.begin(), p.end());
  reverse(q.begin(), q.end());
  reverse(r.begin(), r.end());
  vector<long long> ans;
  for (int l=0; l<x; l++) ans.push_back(p[l]);
  for (int m=0; m<y; m++) ans.push_back(q[m]);
  for (int n=0; n<c; n++) ans.push_back(r[n]);
  sort(ans.begin(),ans.end());
  reverse(ans.begin(), ans.end());
  long long ans_d=0;
  for (int o=0; o<x+y; o++) ans_d+=ans[o];
  cout<<ans_d<<endl;
}

Measured memory_bytes: 8432
#include<stdio.h>
#include<string.h>
#define LEN 100005
  
typedef struct pp{
  char name[100];
  int t;
}P;
  
P Q[LEN+1];
int head, tail, n;
  
void enqueue(P x){
  Q[tail] = x;
  if(tail + 1 == LEN+1)tail = 0;
  else tail++;
}
  
P dequeue(){
  P a;
  a = Q[head];
  if(head + 1 == LEN + 1) head = 0;
  else head++;
  return a;
}
  
int isEmpty(){
  if(head == tail) return 1;
  else return 0;
}
  
int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);
  
  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  
  head =1;
  tail = n + 1;
    
  for(;;){
    u = dequeue();
    c = u.t - q;
      
    if(c > 0){
      elaps += q;
      u.t = c;
      enqueue(u);
    }
      
    else if(c <= 0){
      elaps += u.t;
      printf("%s %d\n", u.name, elaps);
    }
  
    if(isEmpty() == 1)break;
    else continue;
  }
  return 0;
}

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

struct UnionFind {
    vector<int> parent;
    
    UnionFind(int n) : parent(n, -1) { }
    void init(int n) { parent.assign(n, -1); }
    
    int root(int x) {
        if (parent[x] < 0) return x;
        else return parent[x] = root(parent[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (parent[x] > parent[y]) swap(x, y); // merge technique
        parent[x] += parent[y];
        parent[y] = x;
        return true;
    }
    
    int size(int x) {
        return -parent[root(x)];
    }
};
 
int main() {
    int N,M,K;
    cin >> N >> M >> K;
    int X[N] = {}; 
    UnionFind U(N);
    rep(i,M){
        int A,B;
        cin >> A >> B;
        A--,B--;
        X[A]++;
        X[B]++;
        U.merge(A,B);
    }
    rep(i,K){
        int C,D;
        cin >> C >> D;
        C--,D--;
        if(U.issame(C,D)){
            X[C]++;
            X[D]++;
        }
    }
    rep(i,N-1){
        cout << U.size(i) - X[i] - 1 << " ";
    }
    cout << U.size(N-1) - X[N-1] - 1 << endl;
    
    return 0;
}


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

public class Main{

static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split("\\s+");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split("\\s+");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static int Modpow(int a,int p,int m){int res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
//......................................@uthor_Alx..............................................
static long mod=(long)1e9+7;
static int f(int[] a, int[] b){
	return a[2]-b[2];
}
static int disj(char[][] g, int sx, int sy,int ex,int ey,int h,int w)  throws  IOException {
	PriorityQueue<int[]> pq=new PriorityQueue<>((a,b)->f(a,b));
	pq.add(new int[]{sx,sy,0});
	boolean[][] b=new boolean[h][w];
	int[][] c=new int[h][w]; int inf=800000000;
	int[] dx=new int[]{1,-1,0,0};
	int[] dy=new int[]{0,0,1,-1};
	for(int i=0;i<h;i++){Arrays.fill(c[i],inf);}
	c[sx][sy]=0;
	while(!pq.isEmpty()){
		int[] p=pq.poll();
		if(p[0]==ex&&p[1]==ey) return p[2];
		if(b[p[0]][p[1]]) continue;
		b[p[0]][p[1]]=true;
		//out.write(p[0]+" "+p[1]+" "+p[2]+"\n");
			for(int i=0;i<4;i++){
			int nx=p[0]+dx[i],ny=p[1]+dy[i],cc=p[2];
			if(nx<0||nx>=h||ny<0||ny>=w||b[nx][ny]||g[nx][ny]=='#') continue;
			if(c[nx][ny]>cc){
				c[nx][ny]=cc;
				pq.add(new int[]{nx,ny,cc});
			}
		}
		for(int i=Math.max(0,p[0]-2);i<=Math.min(h-1,p[0]+2);i++){
			for(int j=Math.max(0,p[1]-2);j<=Math.min(w-1,p[1]+2);j++){
				if(i==p[0]&&j==p[1]) continue;
				if(b[i][j]||g[i][j]=='#') continue;
				if(c[i][j]>p[2]+1){
					c[i][j]=p[2]+1;
					pq.add(new int[]{i,j,p[2]+1});
				}
			}
		}
	}
	return -1;
}
public static void main(String[] args) throws  IOException{
                assign();
                int[] x=int_arr(),x1=int_arr(),x2=int_arr();
                int h=x[0],w=x[1],sx=x1[0],sy=x1[1],ex=x2[0],ey=x2[1];
                sx--;sy--;ex--;ey--;
                char[][] g=new char[h][w];
                for(int i=0;i<h;i++){
                	g[i]=read().toCharArray();
                }

              out.write(disj(g,sx,sy,ex,ey,h,w)+"");
                out.flush();

    }
}

Measured memory_bytes: 66380
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split(' '))))

i = A.argmax()
j = 0
if i == 0:
    j = 1

for n in range(1, N):
    if j == i:
        continue

    if abs(A[i]/2 - A[n]) < abs(A[i]/2 - A[j]):
        j = n

print(A[i], A[j])

Measured memory_bytes: 31728
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

class Cell{
	char c;
	int i, j;
	int _value;
	bool isVisited = false;
	Cell[] adjCells;
	this(char c, int i, int j){
		this.c = c;
		this.i = i;
		this.j = j;
		}
	int value(int x){
		this._value = x;
		this.isVisited = true;
		return this._value;
		}
	int value(){
		return this._value;
		}
	void add(Cell ce){
		this.adjCells ~= ce;
		ce.adjCells ~= this;
		}
	void runUntil(int k){
		if(k > 0){
			foreach(ce; this.adjCells){
				if(ce.c == '.' && (!ce.isVisited || ce.value > this.value + 1)){
					ce.value = this.value + 1;
					ce.runUntil(k - 1);
					}
				}
			}
		}
	}

X[] q;

class X{
	Cell cell;
	int value;
	this(Cell cell, int value){
		this.cell = cell;
		this.value = value;
		}
	void go(){
		cell.value = this.value;
		if(this.value > 0){
			foreach(ce; cell.adjCells){
				if(ce.c == '.' && !ce.isVisited){
					ce.isVisited = true;
					q ~= new X(ce, this.value - 1);
					}
				}
			}
		q = q[1 .. $];
		}
	}

void main(){
	int h = read.to!int;
	int w = read.to!int;
	int k = read.to!int;
	
	Cell[][] cells;
	foreach(i; 0 .. h){
		char[] cs = readln.chomp.to!(char[]);
		Cell[] xs;
		cells ~= xs;
		foreach(j, c; cs){
			Cell x = new Cell(c, i, cast(int) j);
			cells[i] ~= x;
			if(i > 0) x.add(cells[i - 1][j]);
			if(j > 0) x.add(cells[i][j - 1]);
			}
		}
	
	foreach(i; 0 .. h) foreach(j; 0 .. w) if(cells[i][j].c == 'S'){
		q ~= new X(cells[i][j], k);
		}
	while(q.length){
		q[0].go();
		}
	
	debug writeln("k=", k);
	debug foreach(i; 0 .. h) cells[i].map!(x => x.isVisited? '*': x.c).writeln;
	
	
	int minToWall = 1000;
	foreach(i; 0 .. h) foreach(j; 0 .. w) if(cells[i][j].isVisited){
		int t = min(i, h - 1 - i, j, w - 1 - j);
		if(t < minToWall) minToWall = t;
		}
	
	debug writeln("minToWall: ", minToWall);
	
	int ans = 1 + (minToWall + (k - 1)) / k;
	
	ans.writeln;
	
	
	}

Measured memory_bytes: 133180
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using o_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) find_by_order(i)
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
using cd = complex<double>;
const double pi = acos(-1);
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
#define int ll
vector<ll> ft(1, 1LL);


/*======================================================================*/
const int MX = 8;

char inp[MX][MX], mat[MX][MX];
 
vector<int> decToBin(int n) 
{
    vector<int> B(MX, 0);
    int i = 0; 
    while (n > 0) B[i] = n % 2, n = n / 2, i++; 
    return B; 
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
        int n, m, k;
    rep(i, 0, MX) rep(j, 0, MX) inp[i][j] = '-';
    cin >> n >> m >> k;
    rep(i, 0, n) rep(j, 0, m) cin >> inp[i][j];
 
    int X = 1 << n;
    int Y = 1 << m;
    int ans = 0;
 
    rep(i, 0, X){
        rep(j, 0, Y){
            rep(x, 0, MX) rep(y, 0, MX) mat[x][y] = inp[x][y];
            vector<int> A = decToBin(i);
            vector<int> B = decToBin(j);
            rep(x, 0, MX) if(A[x] == 1) rep(a, 0, MX) mat[x][a] = '+';
            rep(x, 0, MX) if(B[x] == 1) rep(a, 0, MX) mat[a][x] = '+';
 
            int cunt = k;
            rep(x, 0, MX) rep(y, 0, MX) cunt -= mat[x][y] == '#';
            if(cunt == 0) ans++;
        }
    }
 
    cout << ans;
    }
}

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

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

  map<int, int> p;

  for (int i = 0; i < m; i++) {
    int s, c;
    cin >> s >> c;
    if (!p.count(s))
      p[s] = c;
    else if (p[s] != c) {
      cout << "-1" << endl;
      return 0;
    }
  }

  int ans = 0;
  for (auto q : p) {
    auto s = q.first;
    auto c = q.second;

    if (n > 1 && s == 1 && c == 0) {
      cout << "-1" << endl;
      return 0;
    }
    ans += (int)pow(10, n - s) * c;
  }

  if (n > 1 && !p.count(1)) ans += (int)pow(10, n - 1);
  cout << ans << endl;
}

Measured memory_bytes: 512
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int read() { return readln.chomp.to!int; }
int[] reads() { return readln.split.to!(int[]); }

int gcd(int a, int b) {
    return !b ? a : gcd(b, a%b);
}

void main() {
    int n, x; readf("%d %d\n",&n,&x);
    int[] xs = (reads ~ x)
        .sort()
        .array;

    int[] difs;
    foreach (i; 0..n)
        difs ~= xs[i + 1] - xs[i];
    difs ~= difs.front;
    writeln(difs.reduce!(gcd));
}

Measured memory_bytes: 4532
n = int(input())
h = list(map(int,(input().split())))

#単調非減少にできるか

for i in range(n,1,-1):
    #print(i)
    if h[i-2]-h[i-1] >= 2:
        print("No")
        exit()
    elif h[i-2]-h[i-1] ==1:
        h[i-2] -= 1

print("Yes") 

Measured memory_bytes: 14396
#include<stdio.h>
int main(){
    int a,b,i=0,flag=0;
    char s[10],t[10],u[10];

    scanf("%s %s\n%d %d\n%s",s,t,&a,&b,u);

    while(s[i]==u[i]){
        if(u[i]=='\0'||s[i]=='\0'){
            a--;
            flag=1;
            break;
        }
        i++;
    }
    if(flag==0){
        b--;
    }

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

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main() {
	int t[5];
	int sum = 0;
	int aSum = 0;
	int aMax = 0;
	for(int i=0;i<5;i++){
		cin >> t[i];
		sum += t[i];
		int tmp = (10 - (t[i] % 10))%10;
		aSum += tmp;
		if(aMax < tmp) {
			aMax = tmp;
		}
 	}
 	aSum -= aMax;
 	sum += aSum;
 	cout <<sum <<endl;
	return 0;
}

Measured memory_bytes: 256
// 2011/09/05 Tazoe

#include <iostream>
using namespace std;

int main()
{
	const int B[11] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024};

	while(true){
		int R, C;
		cin >> R >> C;
		if(R==0&&C==0)
			break;

		int S[10][10000];
		for(int i=0; i<R; i++)
			for(int j=0; j<C; j++)
				cin >> S[i][j];

		int max = -1;
		for(int i=0; i<B[R-1]; i++){
			for(int j=0; j<R; j++){
				if(S[j][0]!=i/B[j]%2)
					for(int k=0; k<C; k++)
						S[j][k] = (S[j][k]+1)%2;
			}

			int sum = 0;
			for(int j=0; j<C; j++){
				int sum2 = 0;
				for(int k=0; k<R; k++)
					sum2 += S[k][j];
				if(sum2<R-sum2)
					sum2 = R-sum2;
				sum += sum2;
			}

//			cout << sum << endl;

			if(sum>max)
				max = sum;

/*
		for(int i2=0; i2<R; i2++){
			for(int j2=0; j2<C; j2++){
				cout << S[i2][j2];
				if(j2<C-1)
					cout << ' ';
				else
					cout << endl;
			}
		}
*/
		}
		cout << max << endl;
	}

	return 0;
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
#define DEBUG
#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif

//#define int long long
typedef long long ll;
constexpr int INF = 1e9;
constexpr int MOD = 1000000007;

decltype(1) main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << ((a + b + c) < 22 ? "win" : "bust") << endl;
    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
PS=[list(map(str,input().split())) for _ in range(m)]

no,prob=[0]*n,[-1]*n
for i in range(m):
  p,s=int(PS[i][0]),PS[i][1]
  if s=='AC': prob[p-1]=1
  if s=='WA' and prob[p-1]==-1: no[p-1]+=1
pena,ans=0,0
for i,p in enumerate(prob):
  if p==1:
    pena+=no[i]
    ans+=1
print(ans,pena)

Measured memory_bytes: 33680
import java.util.*;

public class Main {
	int N, A, B, C;
	int[] l;

	Main() {
		Scanner in = new Scanner(System.in);
		String[] tokens = in.nextLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		A = Integer.parseInt(tokens[1]);
		B = Integer.parseInt(tokens[2]);
		C = Integer.parseInt(tokens[3]);
		l = new int[N];
		for (int i = 0; i < N; ++i) {
			l[i] = Integer.parseInt(in.nextLine());
		}
		in.close();
		Arrays.sort(l);
	}

	int dfs(int current, int a, int b, int c) {
		if (current == N) {
			if (a > 0 && b > 0 && c > 0) {
				return Math.abs(a - A) + Math.abs(b - B) + Math.abs(c - C) - 30;
			} else {
				return 100000;
			}
		}
		int result = 100000;
		result = Math.min(dfs(current + 1, a, b, c), result);
		result = Math.min(dfs(current + 1, a + l[current], b, c) + 10, result);
		result = Math.min(dfs(current + 1, a, b + l[current], c) + 10, result);
		result = Math.min(dfs(current + 1, a, b, c + l[current]) + 10, result);
		return result;
	}

	public static void main(String[] args) {
		Main ins = new Main();
		System.out.println(ins.dfs(0, 0, 0, 0));
	}
}

Measured memory_bytes: 22996
#include <cstdio>
#include <iostream>
#include <set>
using namespace std;
int main()
{
  int n;
  set<char> s;
  scanf("%d",&n);
  for (int i = 0; i < n; i++){
     char ss[3];
     scanf("%s",ss);
     s.insert(ss[0]);
  }
  if (s.size() == 3)
  {
     printf("Three\n");
  }else 
  {
    printf("Four\n");
  }
}

Measured memory_bytes: 256
package main

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

var sc *bufio.Scanner

const BufferSize = 1024

func nextInt() int {
	if !sc.Scan() {
		panic(nil)
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

type edge struct {
	src    int
	dst    int
	weight int
}

func reachable(g [][]int, start int) []bool {
	n := len(g)
	ok := make([]bool, n)
	var dfs func(int)
	dfs = func(v int) {
		ok[v] = true
		for _, u := range g[v] {
			if !ok[u] {
				dfs(u)
			}
		}
	}
	dfs(start)
	return ok
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, 1e+6)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()
	p := nextInt()
	e := make([]edge, m)
	gn := make([][]int, n)
	gr := make([][]int, n)
	dis := make([]int, n)
	pre := make([]int, n)

	for i := 0; i < m; i++ {
		u := nextInt()
		v := nextInt()
		w := nextInt()
		e[i] = edge{u - 1, v - 1, -(w - p)}
		gn[u-1] = append(gn[u-1], v-1)
		gr[v-1] = append(gr[v-1], u-1)
	}
	okn := reachable(gn, 0)
	okr := reachable(gr, n-1)
	var es []edge
	for i := range e {
		if okn[e[i].src] && okr[e[i].src] && okn[e[i].dst] && okr[e[i].dst] {
			es = append(es, e[i])
		}
	}
	for i := 0; i < n; i++ {
		dis[i] = int(1e8)
		pre[i] = 0
	}

	dis[0] = 0
	count := 0
	update := true
	for update {
		update = false
		for j := range es {
			if dis[es[j].src]+es[j].weight < dis[es[j].dst] {
				dis[es[j].dst] = dis[es[j].src] + es[j].weight
				pre[es[j].dst] = es[j].src
				update = true
			}
		}
		count++
		if count > n {
			break
		}
	}

	ans := 0
	if count > n {
		ans = -1
	} else if dis[n-1] < 0 {
		ans = -dis[n-1]
	} else if dis[n-1] == int(1e8) {
		ans = -1
	}
	/*
		for j := range es {
			if dis[es[j].src]+es[j].weight < dis[es[j].dst] {
				ans = -1
			}
		}
	*/
	_, _ = fmt.Fprintf(writer, "%d", ans)
}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 1920
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
using namespace std;
long long a,b,c;
int main()
{
  scanf("%lld%lld%lld",&a,&b,&c);
  if(a%2==0||b%2==0||c%2==0){printf("0\n");return 0;}
  printf("%lld\n",min(a*b,min(a*c,b*c)));
  return 0;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;


int main(){
	int n,k,p;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>k>>p;
		int a=k%p;
		if(a==0) cout<<p;
		else cout<<a;
		cout<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;
int n;
multiset<double> s;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;
    for(int i=0;i<n;i++)
    {
        double x;
        cin >> x;
        s.insert(x);
    }
    for(int i=1;i<n;i++)
    {
        double x = *s.begin();
        s.erase(s.begin());
        double y = *s.begin();
        s.erase(s.begin());
        s.insert((x+y)/2);
    }
    cout << fixed << setprecision(9) << *s.begin();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll MOD = 998244353;


int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> vp;
    unordered_map<int, vector<int>> mp; 
    rep(i, m) {
        int p, y;
        cin >> p >> y;
        vp.emplace_back(p, y);
        mp[p].push_back(y);
    }
    for (auto& v : mp) sort(all(v.second));
    rep(i, m) {
        auto pi = vp[i];
        int p = pi.first; int y = pi.second;
        int idx = lower_bound(mp[p].begin(), mp[p].end(), y) - mp[p].begin();
        cout << setfill('0') << right << setw(6) << p;
        cout << setfill('0') << right << setw(6) << idx+1;
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 11036
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

const ll N=2e5+10;
mat v(26);
ll n;
string s;
ll dp[N];

ll solve(ll idx) {
  if(idx==n) {
    return 0;
  }
  ll &ret=dp[idx];
  if(ret!=-1) {
    return ret;
  }
  ret=1e9;
  for(ll i=0;i<26;i++) {
    ll idx2=upper_bound(v[i].begin(),v[i].end(),idx)-v[i].begin();
    ret=min(ret,solve(v[i][idx2])+1);
  }
  return ret;
}

void build(ll idx) {
  if(idx==n) {
    return ;
  }
  for(ll i=0;i<26;i++) {
    ll idx2=upper_bound(v[i].begin(),v[i].end(),idx)-v[i].begin();
    if(solve(idx)==solve(v[i][idx2])+1) {
      cout << (char)(i+'a');
      build(v[i][idx2]);
      break;
    }
  }
}

int main() {
  memset(dp,-1,sizeof(dp));
  cin >> s;
  s="#"+s;
  n=s.size();
  for(ll i=1;i<n;i++) {
    v[s[i]-'a'].push_back(i);
  }
  for(ll i=0;i<26;i++) {
    v[i].push_back(n);
  }
  build(0);
}

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

long long gcd(long long a, long long b) {
  if(a < b)
    swap(a, b);
  bool flag = true;
  long long p, q;
  p = a;
  q = b;
  while(flag) {
    long long temp = q;
    q = p % q;
    p = temp;
    if(q == 0)
      flag = false;
  }
  return p;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for(int i=0; i<n; i++)
    cin >> a.at(i);
  
  long long l = a.at(0) / 2;
  bool flag1 = true;
  
  for(int i=1; i<n; i++) {
    l = l / gcd(l, a.at(i) / 2) * a.at(i) / 2;
    if(l > m) {
      flag1 = false;
      break;
    }
  }
  
  int count = 0;
  
  if(flag1) {
    bool flag2 = true;
    for(int i=0; i<n; i++) {
      if((l / (a.at(i) / 2)) % 2 == 0) {
        flag2 = false;
        break;
      }
    }
    if(flag2) {
      int i = 1;
      while((2 * i - 1) * l <= m) {
        count++;
        i++;
      }
    }
  }
  
  cout << count << endl;
}  

Measured memory_bytes: 640