akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, W;
	cin >> N >> W;

	struct item { int w, val; };
	vector<item> item(N);
	for (int i = 0; i < N; i++) cin >> item[i].w >> item[i].val;

	vector<vector<lint>> dp(N + 1, vector<lint>(W + 1));
	for (int i = 1; i <= N; i++) {

		for (int j = 0; j <= W; j++) {
			if (j - item[i - 1].w >= 0) dp[i][j] = max(dp[i - 1][j - item[i - 1].w] + item[i - 1].val, dp[i - 1][j]);
			else dp[i][j] = dp[i - 1][j];
		}
	}

	cout << dp[N][W];

	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  ll N, M, C;
  cin >> N >> M >> C;
  vector<ll> B(M);
  vector<vector<ll>> A(N, vector<ll>(M));
  for (int i = 0; i < M; ++i) {
    cin >> B[i];
  }
  ll ret = 0;
  for (int i = 0; i < N; ++i) {
    ll sum = C;
    for (int j = 0; j < M; ++j) {
      cin >> A[i][j];
      sum += A[i][j]*B[j];
    }
    if(sum>0)
      ret++;
  }
  cout << ret << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  int l = s.length();
  int m = t.length();
  s = ' ' + s;
  t = ' ' + t;
  vector<vector<int>> dp(l + 1, vector<int>(m + 1, 0));
  for (int i = 1; i <= l; i++) {
    for (int j = 1; j <= m; j++) {
      if (s[i] == t[j]) {
        dp[i][j] = dp[i - 1][j - 1] + 1;
      } else {
        dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
      }
    }
  }
  string ans = "";
  int i = l;
  int j = m;
  while (i || j) {
    if (i && dp[i - 1][j] == dp[i][j]) {
      i--;
    } else if (j && dp[i][j - 1] == dp[i][j]) {
      j--;
    } else {
      ans = s[i] + ans;
      i--;
      j--;
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 35584
n=int(input())
a=sorted(list(map(int,input().split())))
s=t=0
i=n-1
while i>=4 and a[i]!=a[i-1]:i-=1
if a[i]==a[i-1]:s=a[i];i-=2
while i>=2 and a[i]!=a[i-1]:i-=1
if a[i]==a[i-1]:t=a[i]
print(s*t)

Measured memory_bytes: 14244
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
#include <numeric>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
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; }

// 
double N, K;
double ans;

int main(){
    cin >> N >> K;
    
    if(K==1){
        ans = 1;
        cout << ans << endl;
        return 0;
    }

    double kouho =0.0;
    rep(i, 0, N+1){
        if(i>=K){
            kouho++;
        }
    }

    rep(i, 1, (long)N-kouho+1){
        long tmp = i;
        double a = 0.0;
        while(tmp<K){
            tmp*=2;
            a++;
        }
        ans += (1.0/N) * 1.0/pow(2.0,a);
    }

    ans += kouho/N;
    cout << setprecision(12) <<  ans << endl;
    return 0;
}




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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    std::cin >> n;
    if(n==2){
        std::cout << 1 << std::endl;
        return 0;
    }
    ll cnt = 0;
    for (ll i = 2; i <= sqrt(n); i++) {
        if(n%i==0){
            set<ll> cand;
            cand.insert(i);
            cand.insert(n/i);
            for (auto e : cand) {
                ll tmp = n;
                while(tmp%e==0)tmp/=e;
                if(tmp%e==1)cnt++;
            }
        }
    }
    cnt++;
    // std::cout << cnt << std::endl;
    // std::cout << n<<" n" << std::endl;
    for (ll i = 2; i <= sqrt(n-1); i++) {
        if((n-1)%i==0){
            cnt++;
            if(i*i!=n-1){
                if((n-1)%((n-1)/i)==0)cnt++;
            }
        }
        // std::cout << i<<" "<<cnt << std::endl;
    }
    cnt++;
    std::cout << cnt << std::endl;
}



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

using namespace std;

typedef long long ll;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    ll cnt = 0;
    ll test = 0;
    for(int i = 0; i < n; i++) {
        if (s[i]=='W'){
            cnt = cnt + (i - test);
            test++;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int A,B;
    char op;
    cin >> A >> op >> B;
    int out=0;
    if(op=='+') out = A+B;
    else out = A-B;
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 3572
NM = [int(i) for i in input().split()]
a = [0] * NM[0]
for _ in range(NM[1]):
    a[int(input()) - 1] = -1

for i in range(NM[0]):
    if (i == 0):
        if(a[i] != -1):
            a[i] = 1
        else:
            a[i] = 0
    elif(i == 1):
        if(a[i] != -1):
            a[i] = a[i - 1] + 1
        else:
            a[i] = 0
    else:
        if(a[i] != -1):
            a[i] = a[i-1] + a[i - 2]
        else:
            a[i] = 0

print(a[NM[0]-1] % (10**9 + 7))

Measured memory_bytes: 460020
import itertools
n, m, x = map(int, input().split())
ca_list = [list(map(int, input().split())) for i in range(n)]
money = []
for j in range(1, n + 1):
    ca_comb = itertools.combinations(ca_list, j)
    for ca_tuple in ca_comb:
        if all([sum([ca[i] for ca in ca_tuple]) >= x for i in range(1, m+1)]):
            money.append(sum([ca[0] for ca in ca_tuple]))
if money:
    print(min(money))
else:
    print(-1)

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

int main(void)
{
    int i, j = 0, n, s, q, t, cnt = 0;
    int *s_array;

    scanf("%d", &n);
    s_array = malloc(sizeof(int) * (n + 1));
    for(i = 0; i < n; i++){
        scanf("%d", &s);
        s_array[i] = s;
    }
    scanf("%d", &q);
    for(i = 0; i < q; i++) {
        scanf("%d", &t);
        s_array[n] = t;
        while(s_array[j] != t) j++;
        if(j < n) cnt++;
        j = 0;
    }

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

    return 0;
}

Measured memory_bytes: 636
S = input()

SLEN = (len(S))

A = list(S)



small = 0

for i in range(SLEN):
    if A[i].islower() == True:
        small = small + 1

big = (SLEN - small) 

Check= S[2:SLEN-1]
CNUM=Check.count("C")

if A[0] == "A" and  big == 2 and CNUM == 1 and A[-1] != "C":  
    print("AC")
else:
    print("WA")

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




int main(){
    int n;
    cin>>n;
    if(n==0) return 0;
  
    if(n==1) { cin>>n; return n;}
    
    int a[n];
    int i=0;
  	int c=n;
  
    while(c--){
        cin>>a[i++];
        
    }
    
    int dist[n];
    
    dist[0]=0;
    dist[1]=abs(a[1]-a[0]);
    
    for(int i=2;i<n;i++){
        dist[i]=min(dist[i-1]+abs(a[i]-a[i-1]),dist[i-2]+abs(a[i]-a[i-2]));
    }
    
   cout<<dist[n-1];
  
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
int m,d;
int ans;
int main(){
	scanf("%d %d",&m,&d);
	for(int i=1;i<=m;i++){
		for(int j=10;j<=d;j++){
			if((j/10)>1&&(j%10)>1&&(j/10)*(j%10)==i){
				ans++;
			}
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

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

    int N;
    cin >> N;

    int ans = 0;
    FOR (i, 1, N + 1) {
        if (i % 3 != 0 && i % 5 != 0) ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3652
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 N, Q;
  std::cin >> N >> Q;
  std::vector<std::vector<i64>> edges(N);
  for (i64 i = 0; i < N - 1; ++i) {
    i64 a_i, b_i;
    std::cin >> a_i >> b_i;
    --a_i;
    --b_i;
    edges[a_i].push_back(b_i);
    edges[b_i].push_back(a_i);
  }
  std::vector<i64> base(N, 0);
  for (i64 i = 0; i < Q; ++i) {
    i64 p_i, x_i;
    std::cin >> p_i >> x_i;
    --p_i;
    base[p_i] += x_i;
  }

  std::vector<bool> visited(N, false);
  std::vector<i64> scores(N);
  std::function<void(i64, i64)> dfs;
  dfs = [&](const i64 root, const i64 sum) {
    visited[root] = true;
    scores[root] = base[root] + sum;
    for (const i64& to : edges[root]) {
      if (!visited[to]) {
        dfs(to, scores[root]);
      }
    }
    visited[root] = false;
  };
  dfs(0, 0);

  std::string delimiter = "";
  for (const i64& score : scores) {
    std::cout << delimiter << score;
    delimiter = " ";
  }
  std::cout << std::endl;
  return 0;
}

Measured memory_bytes: 35200
from collections import deque

h, w = map(int, input().split())
a = ''.join(input() + '#' for _ in range(h))
n = len(a)
b = ['#'] * w
q = deque()
r = 0
for i in range(n):
  if a[i] == '.':
    b[:-w] = a
    b[i] = 0
    q.append(i)
    while(q):
      i = q.popleft()
      r = max(r, b[i])
      for j in (-1, 1, -w - 1, w + 1):
        j += i
        if b[j] == '.':
          b[j] = b[i] + 1
          q.append(j)
print(r)


Measured memory_bytes: 3316
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N;
i64 X, A[101010];

int main()
{
	scanf("%d%lld", &N, &X);
	for (int i = 0; i < N; ++i) scanf("%lld", A + i);

	i64 ret = 0;
	for (int i = 1; i < N; ++i) {
		if (A[i - 1] >= X) {
			ret += A[i - 1] - X;
			A[i - 1] = X;
		}
		if (A[i - 1] + A[i] > X) {
			i64 app = A[i - 1] + A[i] - X;
			ret += app;
			A[i] -= app;
		}
	}
	printf("%lld\n", ret);
	return 0;
}


Measured memory_bytes: 1024
n, m = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)

logand, logxor = [], []
until a.empty? || b.empty?
    if a[0] == b[0]
        logand << a.shift
        b.shift
    elsif a[0] > b[0]
        logxor << b.shift
    else
        logxor << a.shift
    end
end
a.each{|x| logxor << x}
b.each{|x| logxor << x}
puts "#{logand.length} #{logand.length + logxor.length}"

logand.each{|x| puts x}
until logand.empty? || logxor.empty?
    if logand[0] < logxor[0]
        puts logand.shift
    else
        puts logxor.shift
    end
end
logand.each{|x| puts x}
logxor.each{|x| puts x}


Measured memory_bytes: 31356
n,k = map(int, input().split())
p = list(map(int, input().split()))
new_p=[]
for num in p:
    new_p.append((num+1)/2)

sm=0
for i in range(k):
    sm+=new_p[i]
mx=sm

for i in range(1,n-k+1):
    sm-= new_p[i-1]
    sm+= new_p[i+k-1]
    if mx < sm:
        mx=sm

print(mx)

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

using namespace std;
using ll = long long;


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

    ll ans = 0;
    ll sum = 0;
    int rig = 0;

    for(int lef = 0; lef < n;) {
        for(; rig < n && (a[rig] xor sum) == (a[rig] + sum); sum += a[rig++]);
        ans += rig - lef;
        if(rig == lef)rig++,lef++;
        else sum -= a[lef++];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;       //     ____   _   _  __   __
#define ll long long       //    / ___| | |_| |   / /
const ll INF = 0x3f3f3f3f; //   | |     |  _  |   V /
const ll N   = 1e5 + 5;    //   | |___  | | | |   | |
const ll MOD = 1e9 + 7;    //    ____| |_| |_|   |_|
ll read() {
  ll   x = 0, f = 1;
  char ch = getchar();

  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1; ch = getchar();
  }

  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0'; ch = getchar();
  }
  return x * f;
}

ll n, k, ans1, ans2;
string s, s1, s2;

int main() {
  n = read(), k = read();
  cin >> s;
  s1 = s2 = s;
  int t = k;

  for (int i = 0; i < s1.size(); i++) {
    if ((t > 0) && (s1[i] == 'R')) {
      for (int j = i; j < s1.size(); j++) {
        if (s1[j] == 'R') s1[j] = 'L';
        else {
          i = j;
          t--;
          break;
        }
      }
    }
  }

  for (int i = 1; i < s1.size(); i++) {
    if (s1[i] == s1[i - 1]) ans1++;
  }
  t = k;

  for (int i = 0; i < s2.size(); i++) {
    if ((t > 0) && (s2[i] == 'L')) {
      for (int j = i; j < s2.size(); j++) {
        if (s2[j] == 'L') s2[j] = 'R';
        else {
          i = j;
          t--;
          break;
        }
      }
    }
  }

  for (int i = 1; i < s2.size(); i++) {
    if (s2[i] == s2[i - 1]) ans2++;
  }

  // cout << s1 << endl;
  // cout << s2 << endl;
  cout << max(ans1, ans2) << endl;
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
#include<vector>
#include<set>
#include<cmath>
#define int long long int
int32_t main()
{
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 cout.tie(NULL);
	 int h,w;
	 cin>>h>>w;
	 int answer=1000000000000000;
	 int i,j;
	 int p1=(min(1LL,h%3))*w;
	 answer=min(answer,p1);
	 int p2=h*(min(1LL,w%3));
	 answer=min(answer,p2);
	 for(j=1;j<w;j++)
	 {
		 int val1=h*j;
		 int val2=(h/2)*(w-j);
		 int val3=(h-h/2)*(w-j);
		 int maxval=max(val1,max(val2,val3));
		 int minval=min(val1,min(val2,val3));
		 int here=maxval-minval;
		 answer=min(answer,here);
	 }
	 for(i=1;i<h;i++)
	 {
		 int val1=i*w;
		 int val2=(h-i)*(w/2);
		 int val3=(h-i)*(w-w/2);
		 int maxval=max(val1,max(val2,val3));
		 int minval=min(val1,min(val2,val3));
		 int here=maxval-minval;
		 answer=min(answer,here);
	 }
	 cout<<answer<<endl;
}


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

int main() {
  int S;
  int s_1;
  int s_2;
  int s_3;
  cin >> S;
  s_1 = S%10;
  s_2 = (S-s_1)%100;
  s_3 = S-s_1-s_2;
  cout << s_1+s_2/10+s_3/100 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <random>

using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
long DP[1000001];
long S[1000001];
void Calc(){
	int N = rei();
	long H = rei();
	long D = rei();
	S[1] = 1;
	for(int i=2;i<=N;i++){
		S[i] = S[i-1]*i % mod;
	}
	long sumS = 0;
	for(int i=1;i<=N;i++){
		sumS += S[i];
	}
	sumS %= mod;
	long sum = 1;
	DP[0] = sum;
	for(int i=1;i<H;i++){
		if(i > D){
			sum += mod - DP[i-D-1];
			sum %= mod;
		}
		DP[i] = sum * sumS % mod;
		sum += DP[i];
		sum %= mod;
	}
	if(H > D){
		sum += mod - DP[H-D-1];
		sum %= mod;
	}
	cout << sum * S[N] % mod << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 15872
#include<bits/stdc++.h> 
using namespace std; 
int main() 
{
    int a,b;
    char fh,l;
    cin>>a>>fh>>b; 
    if(fh=='+')
        cout<<a+b<<endl; 
    else
        cout<<a-b<<endl; 
    return 0; 
}


Measured memory_bytes: 256
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-04-09 16:09:54
*/

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

#define all(x) (x).begin(),(x).end()
#define rev(x) greater<x>()
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

LL modpower(LL n, LL m, LL mod)
{
    if (m == 0) {
        return 1;
    } else if (m % 2 == 0) {
        LL p = modpower(n, m/2, mod);
        return p*p % mod;
    } else {
        return n*modpower(n, m-1, mod) % mod;
    }
}

LL modinv(LL n, LL mod)
{
    return modpower(n, mod-2, mod);
}

LL modcombination(LL n, LL r, LL mod)
{
    LL ret = 1;

    for (int i = 0; i < r; i++) {
        ret *= (n-i);
        ret %= mod;
        ret *= modinv(i+1, mod);
        ret % mod;
    }

    return ret % mod;
}

int gcd(int k, int l)
{
    if (l > 0) return gcd(l, k%l);
    else return k;
}

struct UnionFind
{
    vector<int> par;

    UnionFind(int n) : par(n) {
        for (int i = 0; i < n; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main()
{
    string s;
    cin >> s;

    int cnt[3] = {0};
    for (int i = 0; i < 3; i++)
        cnt[s[i]-'a']++;
    
    int ok = 1;
    for (int i = 0; i < 3; i++)
        if (cnt[i] != 1) ok = 0;

    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
const Int MAX = 111;
Int dp[MAX*2][MAX];

Int dfs(Int w,Int b){
  Int &res=dp[w][b];
  if(~res) return res;
  res=0;
  set<Int> g;
  if(w) g.emplace(dfs(w-1,b));
  for(Int i=1;i<=min(w,b);i++) g.emplace(dfs(w,b-i));
  if(b) g.emplace(dfs(w+1,b-1));
  while(g.count(res)) res++;
  return res;
}

signed main(){
  Int n;
  cin>>n;
  vector<Int> w(n),b(n);
  for(Int i=0;i<n;i++) cin>>w[i]>>b[i];  
  
  memset(dp,-1,sizeof(dp));
  Int ans=0;
  for(Int i=0;i<n;i++) ans^=dfs(w[i],b[i]);

  cout<<(ans?0:1)<<endl;
  return 0;
}



Measured memory_bytes: 3564
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1000000000100000000;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int a, b, c; cin >> a >> b >> c;
    if(c>=a && c<=b)cout << "Yes" << ln;
    else cout << "No" << ln;
}

Measured memory_bytes: 3604
#include <stdio.h>
#define H 500000

int A[H],l;

void maxHeapify(int i){
  int left,right,largest,x;
  left = 2*i;
  right = 2*i+1;
  if(left<=l && A[left]>A[i]){
    largest = left;
  }
  else{
    largest = i;
  }
  if(right<=l && A[right]>A[largest]){
    largest = right;
  }
  if(largest != i){
    x = A[i];
    A[i] = A[largest];
    A[largest] = x;
    maxHeapify(largest);
  }
}

int main(){
  int i;

  scanf("%d",&l);

  for(i=1 ; i<l+1 ; i++){
    scanf("%d",&A[i]);
  }

  for(i=l/2 ; i>=1 ; i--){
    maxHeapify(i);
  }

  for (i=1 ; i<l+1 ; i++){
    printf(" %d",A[i]);
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 3644
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using static System.Math;

class Program
{
    static int n;
    static long l;
    static long[] a;

    static void Main()
    {
        long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
        n = (int)input[0];
        l = input[1];
        a = Console.ReadLine().Split().Select(long.Parse).ToArray();

        int last = -1;
        for (int i = 0; i < n - 1; i++)
        {
            if (a[i] + a[i + 1] >= l)
            {
                last = i + 1;
                break;
            }
        }

        if (last == -1)
        {
            Console.WriteLine("Impossible");
            return;
        }
        Console.WriteLine("Possible");
        for (int i = 1; i < last; i++)
            Console.WriteLine("{0}", i);
        for (int i = n - 1; i > last; i--)
            Console.WriteLine("{0}", i);
        Console.WriteLine(last);
    }
}

Measured memory_bytes: 32468
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <iomanip>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define RANGE(i,min,max) for(int i=(min), i##_len=((max)+1); i<i##_len; ++i)
constexpr int m_max=1e5;
vector<pair<int,int>> wl(m_max);
int N,M;
constexpr int INF = 1e6; 

int main(){
    cin >> N >> M;
    wl.resize(M);
    for(auto & w: wl) cin >> w.second >> w.first;
    sort(wl.begin(), wl.end());
    int leftSec = -INF, count = 0;
    REP(i, M) if(leftSec < wl.at(i).second) count++, leftSec=wl.at(i).first-1;
    cout << count << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define F first
#define S second
#define eb emplace_back
int main()
{
    //freopen("input.txt","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    lli t,q,n,m,i,j,a,b,h,k;
    cin>>n>>k;
    lli ar[100001],cost[100001];
    for(i=1;i<=n;i++)
        cin>>ar[i];
    cost[1]=0;
    for(i=2;i<=n;i++)
    {
        cost[i]=INT_MAX;
        for(j=i-1;j>=i-k && j>=1 ;j--)
            cost[i]=min(cost[i],cost[j]+abs(ar[i]-ar[j]));
    }
    cout<<cost[n];
    return 0;
}

Measured memory_bytes: 1792
using System;

namespace AtCoderPractice {
	public class Program {
		public static void Main() {
			string[] args = Console.ReadLine().Split(' ');
			int[] Lngs = new int[11];
			foreach (var str in args) {
				int Lng;
				if (Int32.TryParse(str,out Lng)) {
					Lngs[Lng]++;
				}
			}
			if ((Lngs[5] == 2) && (Lngs[7] == 1)) {
				Console.WriteLine("YES");
			} else {
				Console.WriteLine("NO");
			}
//			Console.ReadLine();
		}
	}
}


Measured memory_bytes: 11092
// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*-
// ALDS1_7_A: Rooted Trees

#include <cstdio>

class RootedTree {
  static const int NIL = -1;

  struct Node {
    // id is index of nodes_
    int parent = NIL;
    int sibling = NIL;
    int first_child = NIL;
    unsigned int depth = 0u;
  };

private:
  unsigned int n_;
  Node* nodes_;

public:
  RootedTree(unsigned int n) : n_(n), nodes_(new Node[n]) { }

  ~RootedTree() { delete[] nodes_; }

  Node& operator[](unsigned int id) { return nodes_[id]; }

  void set_depth()
  {
    set_depth_internal(root(), 0u);
  }

  void print_nodes() const
  {
    for (auto id = 0u; id < n_; ++id) {
      print_node(id);
    }
  }

private:
  void set_depth_internal(int id, unsigned int depth)
  {
    if (id == NIL) {
      return;
    }
    auto& node = nodes_[id];
    node.depth = depth;
    set_depth_internal(node.sibling, depth);
    set_depth_internal(node.first_child, depth + 1);
  }

  int root() const
  {
    for (auto id = 0u; id < n_; ++id) {
      const auto& node = nodes_[id];
      if (node.parent == NIL) {
        return id;
      }
    }
    return NIL;
  }

  void print_node(unsigned int id) const
  {
    const auto& node = nodes_[id];
    std::printf("node %u: parent = %d, depth = %u, ", id, node.parent, node.depth);
    std::printf("%s, [", type(id));
    int next_c = node.first_child;
    auto sep = "";
    while (next_c != NIL) {
      std::printf("%s%d", sep, next_c);
      sep = ", ";
      next_c = nodes_[next_c].sibling;
    }
    std::printf("]\n");
  }

  const char* type(unsigned int id) const
  {
    const auto& node = nodes_[id];
    auto type =
      node.parent == NIL ? "root" :
      node.first_child == NIL ? "leaf" :
      "internal node";
    return type;
  }    
};

int main()
{
  unsigned int n;
  std::scanf("%u", &n);
  RootedTree tree(n);

  for (auto i = 0u; i < n; ++i) {
    unsigned int id, k, c;
    std::scanf("%u %u", &id, &k);

    int* next_p = &tree[id].first_child;
    for (auto j = 0u; j < k; ++j) {
      std::scanf("%u", &c);
      tree[c].parent = id;
      *next_p = c;
      next_p = &tree[c].sibling;
    }
  }
  tree.set_depth();

  tree.print_nodes();
}

// eof

Measured memory_bytes: 5512
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>

using namespace std;
int main() {
	long long int p[100000], k, q, a, n;
	cin >> n >> k >> q;
	for (int i = 0; i < n; i++) {
		p[i] = 0;
	}
	for (int i = 0; i < q; i++) {
		cin >> a;
		p[a - 1]++;
	}
	for (int i = 0; i < n; i++) {
		if (q - p[i] >= k)cout << "No" << endl;
		else cout << "Yes" << endl;

	}


	return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  string s;
  getline(cin,s);
  rep(i,s.size()){
    if(isupper(s[i]))s[i]=tolower(s[i]);
    else if(islower(s[i]))s[i]=toupper(s[i]);
  }
  cout<<s<<endl;
}

Measured memory_bytes: 1180
n=gets.to_i
ss=n.times.map{gets.chomp.to_s}
ac,wa,tle,re=0,0,0,0
ss.each do |s|
  if s=="AC"
    ac+=1
  elsif s=="WA"
    wa+=1
  elsif s=="TLE"
    tle+=1
  elsif s=="RE"
    re+=1
  end
end
puts "AC x #{ac}"
puts "WA x #{wa}"
puts "TLE x #{tle}"
puts "RE x #{re}"

Measured memory_bytes: 21540
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main(){
    int A,B,H,M;
    cin >> A >> B >> H >> M;
    double ans;
    double pi = 3.141592653589793;
    double A2 = pow(A, 2);
    double B2 = pow(B, 2);
    double H2 = H+M/60.0;

    ans = pow(A2+B2-2*A*B*cos((5*H2-M)*pi/30), 0.5);
    cout << fixed << setprecision(20) << ans << endl;
}

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

int main(){
    int n,l;
    cin >> n >> l;
    vector<string> s(n);
    for (int i = 0;i < n;i++){
        cin >> s.at(i);
    }
    sort(s.begin(),s.end());
    for (int i = 0;i < n;i++){
        cout << s.at(i);
    }
    cout << endl;
    
}

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

using namespace std;

int main()
{
    int n,i,r,s,c=0;

    cin>>n;

    for(i=0;i<3;i++)
    {
        r=n%10;
        if(r==7)
        {
            c=1;
            //break;
        }
        n=n/10;

    }
    if(c)
        cout<<"Yes\n";

    else
        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 100000000;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
const ll MAX = 200010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
vector<vector<ll>> ans;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h,w;
    cin >> h >> w;
    vector<vector<ll>> a(h,vector<ll>(w));
    rep(i,h){
        rep(j,w){
            cin >> a[i][j];
        }
    }
    int flag = 0;
    int x = 0,y = 0,cnt = 1;
    while(cnt < h*w){
        int nx = x,ny = y;
        if (x%2 == 0){
            if (y < w-1) ny = y+1;
            else nx = x+1;
        }
        else{
            if (y > 0) ny = y-1;
            else nx = x+1;
        }
        if (a[x][y]%2){
            flag = 1-flag;
        }
        if (flag){
            ans.push_back(vector<ll>{x+1,y+1,nx+1,ny+1});
        }
        x = nx;
        y = ny;
        cnt++;
    }
    PRINT(ans.size());
    rep(i,ans.size()) array_output(all(ans[i]));
}


Measured memory_bytes: 12976
#include <stdio.h>
int main(void)
{
	int a;
	int b;
	

	scanf("%d %d", &a, &b);
	if(a < b)
	{
		printf("a < b\n");
	}
	else if(a > b)
	{
		printf("a > b\n");
	}
	else
	{
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
n = int(input())
points = []
for i in range(n):
    points.append(list(map(int, input().split(" "))))

t_pre, x_pre, y_pre = 0, 0, 0
reachable = True
for point in points:
    t, x, y = map(int, point)
    diff_t = t - t_pre
    p = x + y
    p_pre = x_pre + y_pre
    move = 0
    for _ in range(diff_t):
        move += 1 if p > (p_pre + move) else -1

    if p - p_pre != move:
        reachable = False
        break

    t_pre, x_pre, y_pre = t, x, y

print("Yes" if reachable == True else "No")

Measured memory_bytes: 27324
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
    int N;
    cin >> N;

    int n = N % 10;

    if (n == 3) {
        cout << "bon" << endl;
    } else if (n == 0 || n == 1 || n == 6 || n == 8) {
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }

    return 0;
}


Measured memory_bytes: 3056
//  Copyright © 2019 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
using namespace std;
typedef long long i64;

int N, a[MAX], vl[MAX];
int head[MAX], prv[MAX];
int ans[MAX];
vector < int > ady[MAX];

void dfs( int x , int p , int lst ) {

    if( vl[x] < vl[head[1]] ) {
        ans[x] = lst;
        int tmp = head[1];
        head[1] = x;
        for( auto v : ady[x] ) 
            if( v != p )
                dfs( v , x , lst );
        head[1] = tmp;
        return;
    }
    else if( vl[x] > vl[head[lst]] ) {
        head[++lst] = x;
        ans[x] = lst;
        for( auto v : ady[x] ) 
            if( v != p )
                dfs( v , x , lst );
        return;
    }
    else {
        int l = 0;
        int r = lst;
        while( l < r ) {
            int m = ( l + r + 1 ) / 2;
            if( vl[head[m]] < vl[x] )
                l = m;
            else
                r = m - 1;
        }
        int pp = l + 1;
        int tmp = head[pp];
        head[pp] = x;
        ans[x] = lst;
        for( auto v : ady[x] ) 
            if( v != p )
                dfs( v , x , lst );
        head[pp] = tmp;
        return;
    }
}
/* 
int lis() 
{ 
    int lst = 1;
    head[1] = 1;
    for( int i = 2; i <= N; i ++ ) {
        if( a[i] < a[head[1]] ) 
            head[1] = i;
        else if( a[i] > a[head[lst]] ) {
            head[++lst] = i;
        }
        else  {
            int l = 0;
            int r = lst;
            while( l < r ) {
                int m = ( l + r + 1 ) / 2;
                if( a[head[m]] < a[i] )
                    l = m;
                else
                    r = m - 1;
            }
            int p = l + 1;
            head[p] = i;
        }
    }
    return lst;
} 
  
  */

int main()
{
    // optimiza_io
    cin >> N;
    for( int i = 1; i <= N; i ++ )
        cin >> vl[i];
    
    for( int i = 1; i < N; i ++ ) {
        int u, v;
        cin >> u >> v;
        ady[u].push_back( v );
        ady[v].push_back( u );
    }
    
    ans[1] = 1;
    head[1] = 1;
    
    for( auto v : ady[1] )
        dfs( v , 1 , 1 );
        
    for( int i = 1; i <= N; i ++ ) 
        cout << ans[i] << "\n";
    
    return 0;
}

Measured memory_bytes: 30412
n = int(input())
cost = [list(map(int, input().split())) for _ in range(n)]
#table A = 0, B = 1, C = 2
dp = [[0] * (3) for i in range(n+1)]

def choice_max(a, b):
    if a > b:
        return a
    else:
        return b


for i in range(n):
    for j in range(3):
        dp[i+1][j] = choice_max(
                        dp[i][(j+1)%3],
                        dp[i][(j+2)%3]
                        ) + cost[i][j]
#[print(i) for i in dp]
print(max(dp[n]))


Measured memory_bytes: 74584
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
char c[257];
char d[257];
bool use[26];
int gcd(int a,int b){
	while(a){
		b%=a;
		int val=b;
		b=a;
		a=val;
	}
	return b;
}
int main(){
	int a;
	scanf("%d ",&a);
	while(a--){
		cin.getline(c,257);
		int t=strlen(c);
		for(int i=1;i<26;i++){
			for(int j=0;j<26;j++){
				bool ok=false;
//				if(gcd(i,26)>1)goto dame;
				for(int k=0;k<26;k++)use[k]=false;
				for(int k=0;k<26;k++){
					if(use[(i*k+j)%26])goto dame;
					else use[(i*k+j)%26]=true;
				}
				for(int k=0;k<t;k++){
					if(c[k]<='z'&&c[k]>='a'){
						d[k]=(i*(c[k]-'a')+j)%26+'a';
					}else{
						d[k]=c[k];
					}
				}
				d[t]=NULL;
				for(int k=0;k<t-3;k++){
					if(d[k]=='t'&&d[k+1]=='h'){
						if(d[k+2]=='a'&&d[k+3]=='t')ok=true;
						if(d[k+2]=='i'&&d[k+3]=='s')ok=true;
					}
				}
				if(ok){
					printf("%s\n",d);
					goto owari;
				}
				dame:;
			}
		}
		owari:;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<(n);i++)
#define REP1(i,n) for(long long i=1;i<=(n);i++)
#define REP2D(i,j,h,w) for(long long i=0;i<(h);i++) for(long long j=0;j<(w);j++)
#define REP2D1(i,j,h,w) for(long long i=1;i<=(h);i++) for(long long j=1;j<=(w);j++)
#define PER(i,n) for(long long i=((n)-1);i>=0;i--)
#define PER1(i,n) for(long long i=(n);i>0;i--)
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define FORE(i,a,b) for(long long i=(a);i<=(b);i++)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();++ite)
#define ALL(a) ((a).begin()),((a).end())
#define RANGE(a) (a),((a)+sizeof(a))
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define YNPRT(b) cout<<((b)?"Yes":"No")<<endl
#define ENTER printf("\n")
#define REV(arr) reverse(ALL(arr))
#define PRT(a) cout<<(a)<<endl
#ifdef DEBUG
#define DBPRT(a) cout << "[Debug] - " << #a << " : " << (a) << endl
#define DBSTART if(1){
#define DBEND }
#else
#define DBPRT(a) do{}while(0)
#define DBSTART if(0){
#define DBEND }
#endif
#define PRTLST(arr,num) REP(_i,num) cout<<_i<<" - "<<arr[_i]<<endl;
#define PRTLST2(arr2,d1,d2) REP(_i,d1) REP(_j,d2) cout<<_i<<","<<_j<<" : "<<arr2[_i][_j]<<endl;
#define PRTLST2D(arr2,d1,d2) do{cout<<"L\t";REP(_i,d2) cout<<_i<<"\t"; cout<<endl; REP(_i,d1){cout<<_i<<"\t";REP(_j,d2){cout<<arr2[_i][_j]<<"\t";}cout<<endl;}}while(0);

#define TOSUM(arr,sum,n) {sum[0]=arr[0];REP1(i,n-1) sum[i]=sum[i-1]+arr[i];}

#define MIN(target,v1) (target)=min(target,v1)
#define MAX(target,v1) (target)=max(target,v1) 
#define P1 first
#define P2 second
#define PB push_back
#define UB upper_bound
#define LB lower_bound
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;
const int Move[4][2] = {-1,0,0,1,1,0,0,-1};
const int Move_[8][2] = {-1,0,-1,-1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p) {os<<"( "<<p.P1<<" , "<<p.P2<<" )";return os;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {ITE(v) os << (ite-v.begin()) << " : " << *ite <<endl;return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v) {os<<" { ";ITE(v) {os<<*ite;if(ite!=--v.end()){os<<" , ";}} os<<" } ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& m) {ITE(m) {os<<ite->P1<<"\t\t|->\t\t"<<ite->P2<<endl;} return os;}

//---------------------
#define MAXN 100000
//---------------------

ll a,b,c;

int main(){
	cin >> a >> b >> c;
	if(a+b+c>=22) PRT("bust");
	else PRT("win");
	return 0;
}









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

int a[100001];

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

    for (int i = 0; i < n * 3; i += 3) {
        int b;
        cin >> b;
        a[b - 1]++, a[b]++, a[b + 1]++;
    }

    cout << *max_element(a, a + 100001) << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,f[108];
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a;
    for(b=1; b<=a; b++) cin>>f[b];
    for(b=1; b<=a; b++){
        if(f[b]%2==0){
            if(f[b]%3!=0&&f[b]%5!=0){
                cout<<"DENIED";
                return 0;
            }
        }
    }
    cout<<"APPROVED";
    return 0;
}

Measured memory_bytes: 256
use v5.18;
use warnings;
sub read_line { chomp(my $str = <STDIN>); $str }
sub splited_read_line { split / /, read_line }

sub is_int {
  my $n = shift;
  $n =~ /^[0-9]+$/;
}

my $x = read_line;
my $max_num = 1;
for my $base (1 .. $x) {
  my $exponent = 2;
  while (1) {
    my $result = $base ** $exponent;
    last if $result > $x || $exponent > $x;
    $max_num = $result if $result > $max_num;
    $exponent++;
  }
}
say $max_num;


Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;
NodePointer nil;

void delete(NodePointer);
void insert(int);
void deleteFirst(void);
void deleteLast(void);
void init(void);
void listPrint(void);
NodePointer search(int);

int main()
{
  int n,i,k;
  char com[20];

  scanf("%d",&n);
  init();
  
  for(i = 0; i < n; i++){
    scanf("%s",com);
    if(strcmp(com, "delete") == 0){
      scanf("%d",&k);
      delete(search(k));
    }
    else if(strcmp(com, "insert") == 0){
      scanf("%d",&k);
      insert(k);
    }
    else if(strcmp(com, "deleteFirst") == 0)
      deleteFirst();
    else if(strcmp(com, "deleteLast") == 0)
      deleteLast();
  }
  listPrint();

  return 0;
}

void insert(int key)
{
  NodePointer x;

  x = (NodePointer)malloc(sizeof(struct node));
  
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

NodePointer search(int key)
{
  NodePointer i;

  for(i = nil->next; i->key != key; i = i->next){
    if(i == nil)break;
  }
  return i;
}

void delete(NodePointer x)
{ 
  if(x == nil)return;
  x->prev->next = x->next;
  x->next->prev = x->prev;
  free(x);
}

void deleteFirst(void)
{
  delete(nil->next);
}

void deleteLast(void)
{
  delete(nil->prev);
}

void init(void)
{
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void listPrint(void)
{
  NodePointer t = nil->next;
  int a = 0;

  while(1){
    if(t == nil)break;
    if(a++ > 0)printf(" ");
    printf("%d",t->key);
    t = t->next;
  }
  printf("\n");
}



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

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  
  if((A == B && B == C) || (A != B && B != C && C != A)){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
#define N 310
string s[N];
bool t[N][N][N];
ll n;
int main(){
    cin>>n;
    lol(i,n)cin>>s[i];
    lol(i,n)lol(j,n)t[0][i][j]=1;
    for(ll k=1;k<n;k++){
	lol(i,n)lol(j,n){
	    bool ok=t[k-1][i][j]&t[k-1][(i+1)%n][(j+1)%n];
	    ok&=s[(i+k)%n][j]==s[i][(j+k)%n];
	    t[k][i][j]=ok;
	}
    }
    ll ans=0;
    lol(i,n)lol(j,n)ans+=t[n-1][i][j];
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 29056
import java.util.*;

public class Main{
	public static void main(String args[]){
    	Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
      
        int[] A = new int[N];
        for(int i = 0; i < N; i++){
            A[i] = scanner.nextInt();
        }
		
        int max_first = 0;
        int max_second = 0;
        int count_max_first = 0;
      
        for(int i = 0; i < N; i++){
            if(A[i] > max_first){
                max_first = A[i];
            }
        } 
      
        for(int i = 0; i < N; i++){
            if(A[i] > max_second && A[i] != max_first){
                max_second = A[i];
            } else if(A[i] == max_first) {
                count_max_first++;
            }
        } 
      
        if(count_max_first > 1){
            max_second = max_first;
        }
      
        for(int i = 0; i < N; i++){
            if(A[i] == max_first){
                System.out.println(max_second);
            } else {
                System.out.println(max_first);
            }
        } 
    }
}

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


int main(){
  int N;
  cin >> N;
  vector<vector<int>>VC(2,vector<int>(N));
  for(int i=0;i<2;i++){
    for(int j=0;j<N;j++){
      cin >>VC[i][j];
    }
  }
  int ans=0;
  for(int i=0;i<N;i++){
    if((VC[0][i]-VC[1][i])>0){
      ans+=(VC[0][i]-VC[1][i]);
    }
  }
  cout << ans << endl;
}
      


Measured memory_bytes: 256
use std::cmp::{max, min};

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let a: i32 = read(&mut stdin_lock, &mut buf, b' ');
    let b: i32 = read(&mut stdin_lock, &mut buf, b' ');
    let k: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    let l = max(a, min(a + k - 1, b));
    for i in a..l + 1 {
        println!("{}", i);
    }
    for i in min(max(l + 1, b - k + 1), b + 1)..(b + 1) {
        println!("{}", i);
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define loop(i,x,z) for (int i=x;i<z;i++)
using ll = long long;
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
typedef pair<int, int> pii;
const ll M = 1000000007;
int t,n;
string s;
int main()
{
    cin>>s;
    if(s.back()=='s')s+="es";
    else s+='s';
    cout<<s;
}

Measured memory_bytes: 3636
S = gets.chomp
Q = gets.to_i
reverse = false
prefix = []
postfix = []
Q.times{
    t, f, c = gets.split
    case t
    when "1"
        reverse = !reverse
    when "2"
        case f
        when "1"
            if reverse
                postfix << c
            else
                prefix << c
            end
        when "2"
            if reverse
                prefix << c
            else
                postfix << c
            end
        end
    end
}
if reverse
    puts (postfix.reverse.join + S.reverse + prefix.join)
else
    puts (prefix.reverse.join + S + postfix.join)
end


Measured memory_bytes: 18556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, begin, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int X, A;
    cin >> X >> A;
    if (X < A)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 10 << endl;
    }
}

Measured memory_bytes: 256
import fractions
n,x = map(int,input().split())
list_x = list(map(int,input().split()))
ans = list_x[0]
for i in range(n):
  if i == 0:
    ans = abs(x - list_x[i])
  else:
    ans = fractions.gcd(ans,abs(x - list_x[i]))
print(ans)  
         

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


int main(){
  int n,m;
  cin >> n >> m;
  if(n == m) puts("Yes");
  else puts("No");
  return 0;
}


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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B) {
        cout << C << endl;
    }
    else if (B == C) {
        cout << A << endl;
    }
    else {
        cout << B << endl;
    }
}

Measured memory_bytes: 256