akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

//public class Begginer05 {
	public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int K = sc.nextInt();
		sc.close();

		int sum = 0;
		
		for (int i = 0; i < K ; i++) {
			if (A != 0) {
				sum += 1;
				A -= 1;
			} else if (A == 0 && B != 0) {
				B -= 1;
			} else {
				sum -= 1;
			}
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 35792
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FUNCTION__ << endl;

#define INF 100000
using namespace std;

int main(){
    int N;
    int nottenmultiplesmallest = INF;
    long long sum = 0;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int s;
        cin >> s;
        if (s % 10 != 0 && nottenmultiplesmallest > s) nottenmultiplesmallest = s;
        sum += s;
    }
    if (sum % 10 != 0){
        cout << sum;
        return 0;
    }
    if (nottenmultiplesmallest == INF)
    {
        cout << "0";
    } else {
        cout << sum - nottenmultiplesmallest;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;
int main(){
    int n;cin >> n;
    ll a[n];
    ll ma = 0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(ma < a[i])ma = a[i];
    }
    ll r = a[0];if(r == ma)r = a[1];
    for(int i=0;i<n;i++){
        if(a[i] !=ma){
            if(min(ma-r,r) <min(ma-a[i],a[i])){
                r = a[i];
            }
        }
    }
    cout << ma <<" "<< r << endl;
}

Measured memory_bytes: 1024
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	argv = input[0].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var A = parseInt(argv[0]);
	var B = parseInt(argv[1]);

  if(A >= 13) {
    console.log(B);
  } else if(A >= 6) {
    console.log(B/2);
  } else {
    console.log(0);
  }

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
#include<cstdio>
#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<stack>
#include<set>
using namespace std;
#define pb push_back
#define POP pop_back()
#define ll long long
#define db double
#define POP pop_back()
#define endl '\n'
#define PII pair<int,int>
#define FI first
#define SE second
#define VI vector<int>
#define QI queue<int>
#define SI stack<int>
#define debug cout<<"debug"<<endl;
#define PLL pair<LL,LL>
#define PDD pair<double,double>
#define ULL unsigned long long
#define fo(i,a,b) for (int i=a;i<=b;++i)
#define fd(i,a,b) for (int i=a;i>=b;--i)
#define mem(x,a) memset(x,a,sizeof(x))
const int maxn = 2e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int a[maxn];
int main(){
	ll n , k;cin >> n >> k;
	if(n%k == 0)cout << "0\n";
	else cout << min(k - n%k , n%k) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

const int MAX_V = 210;

int V;
int match[MAX_V];
bool used[MAX_V];
vector<vector<int>> g(MAX_V);
bool dfs(int v){
    used[v] = true;
    for(int i=0; i<g[v].size(); i++){
        int u = g[v][i], w = match[u];

        if(w < 0 || (!used[w] && dfs(w))){
            match[v] = u;
            match[u] = v;
            return true;
        }
    }
    
    return false;
}

int bipartite_matching(){
    int res = 0;
    memset(match, -1, sizeof(match));

    for(int v=0; v<V; v++){
        if(match[v] < 0){
            memset(used, false, sizeof(used));
            if(dfs(v)){
                res++;
            }
        }
    }

    return res;
}

int main(){
    int x, y, e; cin>>x>>y>>e;
    V = x + y;
    for(int i=0; i<e; i++){
        int s, t; cin>>s>>t;
        g[s].eb(t+100);
        g[t+100].eb(s);
    }

    cout << bipartite_matching() << endl;
}


Measured memory_bytes: 3284
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a,b,d,r;
    double a1,b1,f;
    scanf("%d %d",&a,&b);
    d=a/b;
    r=a%b;
    a1=a;
    b1=b;
    f=a1/b1;
    printf("%d %d %.8lf\n",d,r,f);

        return 0;
}

Measured memory_bytes: 636
S = input()
S = sorted(set(S))
alf =sorted(set("abcdefghijklmnopqrstuvwxyz"))
ans = ""

if len(S) == 26:
    print("None")
else:
    for i in range(len(alf)):
        if alf[i] not in S:
            ans += alf[i]
    ans = sorted(ans)  
    print(ans[0])

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,s;
  cin>>n>>s;
  if(n==s){
    cout<<n+1<<endl;
    return 0;
  }
  for(ll b=2;b*b<=n;b++){
    ll now=0;
    ll t=n;
    while(t){
      now+=t%b;
      t/=b;
    }
    if(now==s){
      cout<<b<<endl;
      return 0;
    }
  }
  ll ans=inf;
  for(ll p=1;p*p<n;p++){//この時, nはb進数で2桁になるb=p*b+q, s=p+q
    ll b=(n-s)/p+1;
    ll t=n;
    ll now=0;
    if(b==1 || b==0) continue;
    while(t){
      now+=t%b;
      t/=b;
    }
    if(now==s) ans=min(ans,b);
  }
  if(ans==inf) cout<<-1<<endl;
  else cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <map>

std::map<std::pair<size_t, int>, intmax_t> memo;

intmax_t dfs(const std::vector<int>& x, size_t i, int sum) {
  if (i == x.size()) return 0;
  std::pair<size_t, int> key(i, sum);
  auto it = memo.lower_bound(key);
  if (it != memo.end() && it->first == key) return it->second;

  intmax_t res = 0;
  res += dfs(x, i+1, sum+x[i]) + ((sum+x[i] == 0)? 1:0);
  res += dfs(x, i+1, sum);
  memo.emplace_hint(it, key, res);
  return res;
}

int main() {
  size_t N;
  int A;
  scanf("%zu %d", &N, &A);

  std::vector<int> x(N);
  for (auto& xi: x) {
    scanf("%d", &xi);
    xi -= A;
  }

  printf("%jd\n", dfs(x, 0, 0));
}


Measured memory_bytes: 1536
n = int(input())
ls = list(map(int,input().split()))
ans = 1000

A = [ls[0]]

for i in range(1,n-1):
  if ls[i-1]<ls[i]<ls[i+1]:
    continue
  if ls[i-1]>ls[i]>ls[i+1]:
    continue
  if ls[i]==ls[i-1]:
    continue
    
  A.append(ls[i])
  
if A[-1] != ls[-1]:
  A.append(ls[-1])

for i in range(1,len(A)):
  if A[i-1]< A[i]:
    ans = ans%A[i-1] + ans//A[i-1]*A[i]
    
print(ans)
  
  

Measured memory_bytes: 9152
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	string s;
	cin >> s;
	int n = s.size();
	vector<int> v(n + 1);
	char c[] = {'<', '>'};
	rep(j,2) {
		rep(i,n) {
			if (s[i] == c[j]) {
				v[i + 1] = max(v[i + 1], v[i] + 1); 
			}
		}
		reverse(ALL(v));
		reverse(ALL(s));
	}
	ll ans = 0;
	rep(i,n + 1) ans += v[i];
	cout << ans << endl;
}

int main() {
	solve();
	return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int a, b, c;
  cin >> a >> b >> c;
  if (a + b + c <= 21) {
    cout << "win" << endl;
  } else {
    cout << "bust" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
static const int MAX = 100;
static const int INTFY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

int prim(){
    int u, minv;
    int d[MAX], p[MAX], color[MAX];
    
    for(int i=0; i<n; i++){
        d[i]=INTFY;
        p[i]=-1;
        color[i]=WHITE;
    }
    
    d[0]=0;
    
    while(1){
        minv=INTFY;
        u=-1;
        for(int i=0; i<n; i++){
            if(minv > d[i] && color[i] != BLACK){
                u=i;
                minv = d[i];
            }
        }
        if(u==-1)break;
        color[u]=BLACK;
        for(int v=0; v<n; v++){
            if(color[v]!=BLACK && M[u][v] != INTFY){
                if(d[v]>M[u][v]){
                    d[v]=M[u][v];
                    p[v]=u;
                    color[v]=GRAY;
                }
            }
        }
    }
    int sum =0;
    for(int i=0; i<n; i++){
        if(p[i]!=-1)sum += M[i][p[i]];
    }
    return sum;
}
int main(){
    cin >> n;
    
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            int e; cin>> e;
            M[i][j]=(e==-1) ? INTFY : e;
        }
    }
    
    cout << prim() << endl;
    return 0;
}



Measured memory_bytes: 3128
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
  int D;
  cin>>D;
  
  if(D==22)
    cout<<"Christmas Eve Eve Eve"<<endl;
  else if(D==23)
    cout<<"Christmas Eve Eve"<<endl;
  else if(D==24)
    cout<<"Christmas Eve"<<endl;
  else
    cout<<"Christmas"<<endl;
  
}


Measured memory_bytes: 256
#a,b = map(int,input().sprit())
n = int(input())
p = list(map(int,input().split()))
q = sorted(p)
j = 0 # index
count = 0 # swap count
ans = 0
for i in range(len(p)):
    if p[i] != q[i]:
        if count:
            ans = 1
            break
        elif j:
            if p[i] == q[j]:
                count += 1
            else:
                ans = 1
                break
        else:
            j = i
if ans == 1:
    print("NO")
else:
    print("YES")




Measured memory_bytes: 38256
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
using namespace std;
#define PB push_back
#define all(x) (x).begin(),(x).end()
#define MEM(x,a) memset((x),a,sizeof((x)))
#define F first
#define S second
#define imx INT_MAX
#define inI(x) scanf("%d",&x)
#define inI2(x,y) scanf("%d %d",&x,&y)
#define inI3(x,y,z) scanf("%d %d %d",&x,&y,&z)
const long long MOD = (long long)(1e9+7);
const long long MMX = (long long)(1e18);
typedef long long LL;
int n,x,k[100005],cc;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        k[x]++;
    }
    for(int i=1;i<100005;i++)
    {
        if(k[i]!=0)cc+=(k[i]-1);
    }
    printf("%d",n-cc-(cc%2));
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef pair<int, int> p;
typedef priority_queue<p> pq;
typedef priority_queue<p, vector<p>, greater<p>> gpq;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N, T;
    cin >> N >> T;

    int min_c = INF;

    REP(i, N)
    {
        int c, t; cin >> c >> t;

        if(t <= T)
        {
            chmin(min_c, c);
        }
    }

    if(min_c == INF) cout << "TLE" << endl;
    else
        cout << min_c << endl;

}

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

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

  int ans = 0;
  for (int i = 0; i <= n; i++) {
    int count = 0;
    for (char c = 'a'; c <= 'z'; c++) {
      if(s.rfind(c, i) != -1 && s.find(c, i + 1) != -1) {
        count++;
      }
      if (ans < count) {
        ans = count;
      }
    }
  }
  cout << ans << endl;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll a, b;
	cin >> a >> b;
	cout << (max(a,b) <= 9 ? a*b : -1) << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,ans=0;
    cin>>n;
    string s;
    cin>>s;
    vector<vector<int>> dp(n+1,vector<int>(n+1));
    for(int i=0;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            if(s[i-1]==s[j-1])
            {
                if(j-dp[i-1][j-1]!=i)
                    dp[i][j] = 1 + dp[i-1][j-1];
                else
                {
                    dp[i][j] = dp[i-1][j-1];
                }
            }
            else
            {
                dp[i][j]=0;
            }
            ans=max(ans,dp[i][j]);
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for ( int i=0; i<n; i++ ) cin >> a[i];
  sort(a.rbegin(),a.rend());
  int ans=0;
  for ( int i=0; i<k; i++ ) ans+=a[i];
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include<iostream>
using namespace std;
const int N = 100;
typedef long long LL;
int main(){
	int n,a,b,c,d,i;
	while(cin>>n){
	i=0;
	a=n/1000;
	b=(n/100)%10;
	c=(n%100)/10;
	d=n-1000*a-100*b-10*c;
	
	if(a==b&&b==c){
		i=1;	
	}
	if(b==c&&c==d){
		i=1;
		}
	if(i==1){
	cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}



}


	return 0;
}


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

using namespace std;

int main()
{
  int n, m, c, s, g;
  const int INF = 1 << 25;
  while(cin >> n >> m >> c >> s >> g, n || m || c || s || g){
    s--, g--;
    int p[32], q[32][64], r[32][64], f[32][32768];
    int G[32][128][128], C[128][128];
    for(int i = 0; i < 32; i++){
      for(int j = 0; j < 128; j++){
	for(int k = 0; k < 128; k++){
	  G[i][j][k] = INF;
	}
	G[i][j][j] = 0;
      }
    }
    for(int i = 0; i < m; i++){
      int x, y, d, c;
      cin >> x >> y >> d >> c;
      x--, y--, c--;
      G[c][x][y] = G[c][y][x] = min(d, G[c][x][y]);
    }
    for(int i = 0; i < c; i++){
      for(int j = 0; j < n; j++){
	for(int k = 0; k < n; k++){
	  for(int l = 0; l < n; l++){
	    G[i][k][l] = min(G[i][k][l], G[i][k][j] + G[i][j][l]);
	  }
	}
      }
    }
    for(int i = 0; i < 32; i++){
      f[i][0] = 0;
      for(int j = 1; j < 32768; j++) f[i][j] = INF;
    }
    for(int i = 0; i < c; i++) cin >> p[i];
    for(int i = 0; i < c; i++){
      q[i][0] = 0;
      for(int j = 1; j < p[i]; j++) cin >> q[i][j];
      q[i][p[i]] = 32768-1;
      r[i][0] = 0;
      for(int j = 1; j <= p[i]; j++){
	cin >> r[i][j];
	for(int k = q[i][j-1]+1; k <= q[i][j]; k++) f[i][k] = f[i][k-1] + r[i][j];
      }
    }
    for(int i = 0; i < 128; i++){
      for(int j = 0; j < 128; j++){
	C[i][j] = INF;
      }
      C[i][i] = 0;
    }
    for(int i = 0; i < n; i++){
      for(int j = 0; j < n; j++){
	if(i == j) continue;
	int minDist = INF;
	for(int k = 0; k < c; k++){
	  if(G[k][i][j] >= INF) continue;
	  C[i][j] = min(C[i][j], f[k][G[k][i][j]]);
	}
      }
    }
    for(int i = 0; i < n; i++){
      for(int j = 0; j < n; j++){
	for(int k = 0; k < n; k++){
	  C[j][k] = min(C[j][k], C[j][i] + C[i][k]);
	}
      }
    }
    cout << (C[s][g]>=INF ? -1:C[s][g]) << endl;
  }
  return 0;
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
 
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  int n; cin>>n;
  int a[n]={};
  int b[n]={};
  int c[n-1]={};
  rep(i,n){
    cin>>a[i];
  }
  rep(i,n){
    cin>>b[i];
  }
  rep(i,n-1){
    cin>>c[i];
  }
  
  ll ans=0;
  rep(i,n){
    ans+=b[a[i]-1];
  }
  rep(i,n-1){
    if(a[i]+1==a[i+1]) ans+=c[a[i]-1];
  }
  cout<<ans<<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 5010
#define M 210
ll a[M][N],A[M][N],b[N],B[N],n,m;
int main(){
    cin>>n>>m;
    lol(i,n-1){
	cin>>B[i];
	b[i+2]=B[i];
    }
    lol(i,n)lol(j,m){
	//cin>>a[j][i];
	scanf("%lld",&a[j][i]);
    }
    lol(i,m){
	A[i][0]=0;
	ll maxi=0;
	lol(j,n){
	    maxi=max(maxi,a[i][j]);
	    A[i][j+1]=maxi;
	}
    }
    b[0]=b[1]=0;
    lol(i,n)b[i+1]+=b[i];
    lol(i,n+1){
	b[i]=-b[i];
	lol(j,m)b[i]+=A[j][i];
	//cout<<b[i]<<" ";
    }//cout<<endl;
    ll ans=0;
 
    lol(i,n){
	ll gre=-1;
	for(int j=i+1;j<=n;j++){
	    gre=max(gre,b[j]);
	}
	ans=max(ans,gre);
	//cout<<gre<<endl;
	lol(j,m){
	    ll maxi=-1;
	    for(int k=i+1;k<n;k++){
		if(a[j][k]>=a[j][i])break;
		maxi=max(maxi,a[j][k]);
		b[k+1]-=A[j][k+1];
		A[j][k+1]=maxi;
		b[k+1]+=A[j][k+1];
	    }
	}
	for(int j=i+1;j<=n;j++)b[j]+=B[i];
	
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 16640
#include<stdio.h>
#include<string.h>
int main(void)
{
	int lol=0,joi=0,naga=0,k=0,count[100][500]={0};
	char mozi[10001];
	while(k!=5){
	scanf("%s",mozi);
	naga=strlen(mozi);
	for(int i=0;i<naga;i++){
		if(mozi[i]=='J'){
			if(mozi[i+1]=='O'){
				if(mozi[i+2]=='I'){
					joi++;
				}
			}
		}
		else if(mozi[i]=='I'){
			if(mozi[i+1]=='O'){
				if(mozi[i+2]=='I'){
					lol++;
				}
			}
		}
	}
	count[k][0]=lol;
	count[k][1]=joi;
	lol=0;
	joi=0;
	k++;
	}
	for(int i=0;i<5;i++){
		printf("%d\n%d\n",count[i][1],count[i][0]);
	}
	return 0;
}

Measured memory_bytes: 1180
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

int gcd(int a, int b) 
{
	if (a < b) return gcd(b, a);
	if (b == 0) return a;
	else return gcd(b, a % b);
}

int lcm(int a, int b) {
	return a * b / gcd(a, b);
}
int main()
{
	ll N; cin >> N;
	cout << lcm(2, N) << endl;
}

Measured memory_bytes: 256
import bisect

while(1):
    d=int(raw_input())
    if d==0: break
    n=int(raw_input())
    m=int(raw_input())
    L=[0,d]
    for i in range(n-1):
        a=int(raw_input())
        L+=[a]
    L.sort()
    ans=0
    for j in range(m):
        a=int(raw_input())
        if a!=0:
            ind=bisect.bisect(L,a)
            ans+=min(abs(L[ind]-a),abs(L[ind-1]-a))
    print ans
        

Measured memory_bytes: 12364
#define p(c,n)for(i=0;i++<n;)putchar(c);
y,z,w;i;main(x){scanf("%d%d%d%d",&x,&y,&z,&w);z-=x;w-=y;p(82,z)p(85,w+1)p(76,z+1)p(68,w+1)p(82,1)p(68,1)p(82,z+1)p(85,w+1)p(76,z+1)p(68,w);}

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

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b, a % b);
}

using Graph = vector<vector<int>>;

ll calc(ll a, ll b, ll p){//aのb乗をpで割った余り
  if(b == 0) return 1;

  else if(b%2 == 0){
    ll d = calc(a,b/2,p);
    return (d*d)%p;
  }
  else if(b%2 == 1){
    return (a * calc(a,b-1,p))%p;
  }
}

typedef pair<int,int> P;

bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}
int factorial(int a){
  int res = 1;
  while(a){
    res *= a;
    a--;
  }
  return res;
}

int main(){
  ll N,A,B;
  cin >> N >> A >> B;
  ll k = B-A-1;//最初のA-B間の卓の数
  if(k == 0) cout << min(N-A,B-1) << endl;

  else if(k%2 == 0){
    ll ans = 0;
    ans += min(N-A,B-1) - (B-A);//一方が端に着く
    ans++;//他方が一歩進め、間の卓の数が奇数個になる
    ans += (k-1)/2 + 1;
    cout << ans << endl;
  }
  else cout << (B-A-1)/2 + 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 int f[366],m[366],sum;
ll checkbit(ll n , ll k)
{
    return (n&(1LL<<k));
}
bool comp(string a, string b)
{
  if(a.size()>=b.size())return false;
  else return true;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
      int a,b,c;
      cin>>a>>b>>c;
      int k;
      cin>>k;
      for(int i=1;i<=k;i++)
      {
          if(b<=a){b=(b<<1);}
          else if(c<=b){c=(c<<1);}
           if(a<b && b<c){break;}

      }
      if(a<b && b<c){cout<<"Yes"<<endl;}
      else cout<<"No"<<endl;

}


Measured memory_bytes: 3576
import sys
input=sys.stdin.readline
from random import seed, randint

def calc(d,C,S,T):
    Last=[0]*26
    score=0
    for day,t in enumerate(T):
        t-=1
        Last[t]=day+1
        score+=S[day][t]
        for i,c in enumerate(C):
            score-=c*(day+1-Last[i])
    return score

def main():
    d=int(input())
    C=tuple(map(int,input().split()))
    S=[tuple(map(int,input().split())) for _ in range(d)]
    Ans=[0]*d
    Last=[0]*26
    
    #貪欲法
    for day in range(d):
        ans=0
        score=-float('inf')
        for t in range(26):
            TmpList=Last[:]
            tmp_score=0
            TmpList[t]=day+1
            for i,c in enumerate(C):
                tmp_score-=c*(day+1-TmpList[i])
            if tmp_score>score:
                score=tmp_score
                ans=t+1
        Ans[day]=ans
        Last[ans-1]=day
    
    score=calc(d,C,S,Ans)
    #print(score)
    
    #局所探索法
    T=Ans[:]
    m=8000
    for i in range(m):
        seed(i)
        d_idx=randint(0,d-1)
        q=randint(1,26)
        #print(d_idx,q)
        T[d_idx]=q
        tmp=calc(d,C,S,T)
        if tmp>score:
            score=tmp
            Ans=T[:]
    #print(score)
    
    print(*Ans,sep='\n')
    
if __name__=='__main__':
    main()

Measured memory_bytes: 81044
#include <stdio.h>
#include <math.h>

#define DIGIT 4

int main(void){

	double a[1000], b[1000], c[1000], d[1000], e[1000], f[1000];
	double term;
	int n = 0;
	int i, j, k,m=0;
	
	while (scanf("%lf%lf%lf%lf%lf%lf", &a[n], &b[n], &c[n], &d[n], &e[n], &f[n]) != EOF) {
		if ((-1000 <= (a[n],b[n],c[n],d[n],e[n],f[n]))
			&&((a[n],b[n],c[n],d[n],e[n],f[n])<=1000)) {
			n++;
		}
	}
	
	while (m < n) {
		double A[2][2] = {
			{e[m],-b[m]},
			{-d[m],a[m]}
		};

		double B[2][1] = {
			{c[m]},
			{f[m]}
		};

		double result[2];
		for (i = 0; i < 1; i++) {
			for (j = 0; j < 2; j++) {
				term = 0;
				for (k = 0; k < 2; k++) {
					term = term + A[j][k] * B[k][i];
				} 
				result[j] = term*(1 / (a[m] * e[m] - b[m] * d[m]));
				result[j] = (round(result[j]*(pow(10, DIGIT - 1))))/pow(10,DIGIT-1);
				if (result[j] == 0) {
					result[j] = copysign(0.0, 1.0);
				}
				if (a[m] == b[m] == c[m] == d[m] == e[m] == f[m]) {
					printf("2.000 -1.000\n");
					break;
				}
			}
			printf("%.3lf %.3lf\n", result[0], result[1]);
		}
		m++;
	}

	return 0;
}

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

int main() {
        int n, m;
        scanf("%d%d", &n, &m);
        if (n > m) swap(n, m);
        long long ans = 0;
        if (n == 1) {
                if (m == 1) {
                        ans = 1;
                } else if (m == 2) {
                        ans =  0;
                } else {
                        ans = m - 2;
                }
        } else if (n == 2) {
                ans = 0;
        } else {
                ans = (long long) (n - 2) * (m - 2);
        }
        printf("%lld\n", ans);
        return 0;
}



Measured memory_bytes: 256
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            if l[i] + l[j] > l[k] != l[j] and l[i] != l[j]:
                ans += 1
print(ans)

Measured memory_bytes: 9136
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}
constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
vl primeFactorVec(ll n) {
	vl ret;
	for(ll i=2;i*i<=n;i++){
		if(n%i==0){ret.push_back(i);while(n%i==0){n/=i;}};
	}
	if(n>1) ret.push_back(n);
	return ret;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b;
	cin>>a>>b;
	ll c=gcd(a,b);
	vl aa=primeFactorVec(c);
	cout<<aa.size()+1<<endl;;
}


Measured memory_bytes: 256
/*In the name of ALLAH, Most Gracious, Most Merciful*/
#include<bits/stdc++.h>

#define ll                      long long int
#define ull                     unsigned long long int
#define PI                      2*acos(0.0)
#define sqr(x)                  (x)*(x)
#define EPS                     10E-10
#define MOD                     1000000007
#define longlimit               92233720368547758
#define infinity                (1<<28)
#define setbits                 __builtin_popcount
#define zerobits                __builtin_ctzll
#define parity(n)               __builtin_parity(n)
#define pb(a)                   emplace_back(a)
#define mp                      make_pair
#define ff                      first
#define ss                      second
#define gcd(a, b)               __gcd(a,b)
#define lcm(a, b)               ((a)*(b))/gcd(a,b)
#define watch(x)                cout << (#x) << " is " << (x) << endl
#define TEST_CASES()            ll t;cin>>t;while (t--)
#define PRECISION(a,x)          fixed<<setprecision(x)<<a<<endl;
#define endl                    "\n"
#define all(a)                  (a.begin()),(a.end())
#define UNIQUE(X)               (X).erase(unique(all(X)),(X).end())
#define DELETE(X)               (X).erase (remove (all(X)),(X).end())
#define SORT_UNIQUE(c)          (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define FAST_IO()               ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define FILE_IO()               freopen("output.txt", "w", stdout);freopen("input.txt", "r", stdin)
using namespace std;

ll arr[500000];
void solve()
{
    ll n,sum=1,z=0;
    cin>>n;
    for (int i=0;i<n;i++)
    {
        cin>>arr[i];
        if (arr[i]==0)z=1;
    }
    if (z==1)cout<<0<<endl;
    else
    {
        for (int i=0;i<n;i++)
        {
            if (arr[i]<=((ll)1e18)/sum)
                sum*=arr[i];
            else
            {
                cout<<-1<<endl;
                return;
            }
        }
        cout<<sum<<endl;
    }
    
}

int32_t main()
{
    FAST_IO();
    //TEST_CASES()
        solve();
}




Measured memory_bytes: 4408
#include <cstdio>

int main()
{
  int n, k;
  char s[11];
  scanf("%d%s%d", &n, s, &k);
  for (int i = 0; i < n; ++i)
  {
    putchar(s[i] == s[k - 1] ? s[k - 1] : '*');
  }
  putchar('\n');
  return 0;
}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    S2 = list(input())
    T = list(input())
    N = len(S2)
    unable = "UNRESTORABLE"


    window_size = len(T)
    X = [] # 合致したwindow
    for i in range(N):
        window = S2[i:i+window_size]
        f = True

        if len(window) != window_size: continue
        for j in range(window_size):
            if not (window[j] == T[j] or window[j] == "?"):
                f = False
                break
        
        if f:
            X.append((i,i+window_size))
    
    if len(X) == 0:
        print(unable)
        exit()
    

    i,j = X[-1]
    S2[i:j] = T

    S = []
    for s in S2:
        if s == "?":
            S.append("a")
        else:
            S.append(s)
    
    print("".join(S))



if __name__ == "__main__":
    main()

Measured memory_bytes: 62208
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vint cnt(n+1,0);
    for(int i=2;i<=n;i++){
        int t=i;
        for(int p=2;p<=n;p++){ 

            while(t%p==0){
                cnt[p]++;
                t/=p;
            }
        }
    }
    int ans = 0;
    //2 4 4
    {
        int t1=0,t2=0;
        REP(i,n+1){
            if(cnt[i]>=2&&cnt[i]<=3){
                t1++;
            }else if(cnt[i]>=4){
                t2++;
            }
        }
        ans += t1*t2*(t2-1)/2 + t2*(t2-1)*(t2-2)/2;
    }
   
    
    //4 14
    {
        int t1=0,t2=0;
        REP(i,n+1){
            if(cnt[i]>=4&&cnt[i]<=13){
                t1++;
            }else if(cnt[i]>=14){
                t2++;
            }
        }
        ans += t1*t2 + t2*(t2-1);
    }
    //2 24
    {
        int t1=0,t2=0;
        REP(i,n+1){
            if(cnt[i]>=2&&cnt[i]<=23){
                t1++;
            }else if(cnt[i]>=24){
                t2++;
            }
        }
        ans += t1*t2 + t2*(t2-1);
    }
    //74
    {
        int t1=0;
        REP(i,n+1){
            if(cnt[i]>=74){
                t1++;
            }
        }
        ans += t1;
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

/* エラトステネスの篩 */
const int SIZE = 1000000;
vector<int> primes;
bool isPrime[SIZE];

void make_primes() {
  if (primes.size() > 0) return;
  memset(isPrime, true, sizeof(isPrime));
  isPrime[0] = isPrime[1] = false;
  for (int i = 2; i * i < SIZE; i++) 
    if (isPrime[i])
      for (int j = i * i; j < SIZE; j += i)
        isPrime[j] = false;
  REP(i, SIZE) if (isPrime[i]) primes.push_back(i);
}


int ans[SIZE];

int main2() {
  for (int i = 1; i < SIZE; i++) {
    int x = (i % 2 == 1) && (isPrime[i]) && (isPrime[(i+1)/2]);
    ans[i] = ans[i-1] + x;
  }

  int Q = nextInt();
  REP(i, Q) {
    int l = nextInt();
    int r = nextInt();
    printf("%d\n", ans[r] - ans[l-1]);
  }
  return 0;
}

int main() {
  make_primes();
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 6008
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
int main(){
  int n,k;
  scanf("%d %d",&n,&k);
  map<int,int>mp;
  for(int i=0;i<n;i++){
    int x;
    scanf("%d",&x);
    mp[x]++;
  }
  vector<int>f;
  for(auto p:mp)f.push_back(p.second);
  sort(f.begin(),f.end());
  if((int)f.size()<k){
    puts("0");
    return 0;
  }
  int rem=int(f.size())-k;
  int ans=0;
  for(int i=0;i<rem;i++){
    ans+=f[i];
  }
  cout<<ans<<endl;
  return 0;

}


Measured memory_bytes: 10748
n,m = map(int,input().split())

a = [list(map(int,input().split())) for i in range(n)]

a.sort()

su = 0
co = 0

for i in range(n):
    if co + a[i][1] >= m:
        su += (m - co) * a[i][0]
        break
    else:
        su += a[i][0] * a[i][1]
        co += a[i][1]
print(su)

Measured memory_bytes: 27760
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
int a[9] = {111,222,333,444,555,666,777,888,999};

int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < 9; ++i)
	{
		if (N <= a[i])
		{
			cout << a[i] << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  string s;
  s.push_back(toupper(a.front()));
  s.push_back(toupper(b.front()));
  s.push_back(toupper(c.front()));
  dump(s);
  return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $n, $k);
$a = explode(' ', trim(fgets(STDIN)));
$c = $h = 0;
foreach ($a as $b) {
	if ($h < $b) {
		$c++;
		$h = $b;
	}
}
if ($c >= $k) exit("0\n");
$ps[0][] = [0, $a[0], 1];
$x = PHP_INT_MAX;
for ($i = 1; $i < $n; $i++) {
	foreach ($ps[$i-1] as $p) {
		if ($a[$i] > $p[1]) {
			if ($p[2] + 1 == $k) {
				if ($x > $p[0]) $x = $p[0];
			} else {
				$ps[$i][] = [$p[0], $a[$i], $p[2] + 1];
			}
		} else {
			if ($p[2] + ($n - $i) > $k) $ps[$i][] = $p;
			$cost = $p[0] + $p[1] - $a[$i] + 1;
			if ($p[2] + 1 == $k) {
				if ($x > $cost) $x = $cost;
			} else {
				$ps[$i][] = [$cost, $p[1] + 1, $p[2] + 1];
			}
		}
	}
}
echo $x, "\n";

Measured memory_bytes: 4856
N,A,B,C,D=map(int,input().split())
S=input()

if C<D:
    if "##" in S[A-1:C] or "##" in S[B-1:D]:
        print("No")
    else:
        print("Yes")
else:
    if (not ("##" in S[A-1:C])) and ("..." in S[B-2:D+1]):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 40816
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> x(n), cp(n);
  REP(i,n){
    cin >> x[i];
    cp[i] = x[i];
  }
  sort(ALL(cp));
  int mid1 = cp[n/2-1];
  int mid2 = cp[n/2];
  REP(i,n){
    cout << (x[i] > mid1 ? mid1 : mid2) << '\n';
  }
  return 0;
}

Measured memory_bytes: 3840
# -*- coding: utf-8 -*-

import heapq


class MaxHeap:
    def __init__(self, li):
        self.heap = [-e for e in li]
        heapq.heapify(self.heap)

    def push(self, val):
        heapq.heappush(self.heap, -val)

    def pop(self):
        return -heapq.heappop(self.heap)


n = int(input())
a = list(map(int, input().split()))

fh_sum = 0
fh = []
sh_sum = 0
sh = MaxHeap([])
for i in range(n):
    heapq.heappush(fh, a[i])
    fh_sum += a[i]
    sh.push(a[-(i+1)])
    sh_sum += a[-(i+1)]

fh_sums = [fh_sum]
sh_sums = [sh_sum]
for k in range(n, 2 * n):
    fh_sum += a[k]
    heapq.heappush(fh, a[k])
    fh_sum -= heapq.heappop(fh)
    fh_sums.append(fh_sum)
    sh_sum += a[-(k+1)]
    sh.push(a[-(k+1)])
    sh_sum -= sh.pop()
    sh_sums.append(sh_sum)

sh_sums = sh_sums[::-1]

ans = -float("inf")
for fh_sum, sh_sum in zip(fh_sums, sh_sums):
    score = fh_sum - sh_sum
    ans = max(ans, score)

print(ans)


Measured memory_bytes: 37836
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>

using namespace std;

#define all(x) (x).begin(),(x).end()
#define ll long long
#define sz(x) (int)(x.size())
#define pb push_back
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define endl "\n"
#define int long long

const int N = (int)(1e6) + 322;
const long long inf = (long long)(1e18) + 123;
const int mod = (int)(1e9) + 7;
const double EPS = 1e-9;



signed main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    int x, y, z; cin >> x >> y >> z;
    if (x + y + z >= 22) {
        cout << "bust";
    }else {
        cout << "win";
    }
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v){
    if(v.empty()){
        os<<"{ }";
        return os;
    }
    os<<"{"<<v.front();
    for(auto itr=++v.begin();itr!=v.end();itr++){
        os<<", "<<*itr;
    }
    os<<"}";
    return os;
}

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

    ll power(ll num,ll pw,ll MOD_NTT){
        ll res=1;
        while(pw>0){
            if(pw&1) res=res*num%MOD_NTT;
            num=num*num%MOD_NTT;
            pw>>=1;
        }
        return res;
    }

int main(){
    ll n; cin>>n;
    ll ans=0;
    ans+=power(10,n,MOD);
    ans=(MOD+ans-2*power(9,n,MOD)%MOD);
    ans%=MOD;
    ans=ans+power(8,n,MOD);
    ans%=MOD;
    cout<<(MOD+ans)%MOD<<endl;
}

Measured memory_bytes: 3632
n=int(input())
a=input()
a=a.split(' ')
fu=int(a[0])
ma=a[0]
mi=a[0]
for w in range(n-1):
    if int(ma)<int(a[w+1]):
        ma=int(a[w+1])
        
    if int(mi)>int(a[w+1]):
        mi=int(a[w+1])
    fu+=int(a[w+1])
print(mi,ma,fu)


Measured memory_bytes: 6336
#include <iostream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

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

    int length = s.length();
    vector<int> dp(length, 0);
    stack<int> remain;

    int remove_count = 0;
    for (int i = 0; i < length; ++i) {
        if (remain.empty()) {
            remain.push(s[i]);
            continue;
        }

        char previous = remain.top();
        char current = s[i];
        if (previous != current) {
            remove_count += 2;
            remain.pop();
        } else {
            remain.push(s[i]);
        }
    }

    cout << remove_count << '\n';
}


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

#define RPE(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LTE(double a,double b) { return equals(a,b) || a < b; }

int main() {
  int R0, W0, C, R;
  while( cin >> R0 >> W0 >> C >> R, R0|W0|C|R ) {
    for(int X=0;;++X) {
      double Y = ( R0 + X * R - C * W0 ) / (double)C;
      if( LTE(0,Y) ) {
	cout << X << endl;
	break;
      }
    }
  }
  return 0;
}

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

int main(){
  int n; cin >> n;
  
  double p = 0;
  if(n%2==0) p = 0.5;
  else {
    double x = n;
    p = (x+1)/(2 * x);
  }
  cout << p << endl;
}


Measured memory_bytes: 3744
#include<stdio.h>
#include<string.h>
using namespace std;
char s[5];
int main()
{
    scanf("%s",s);
    int cnt=0;
    for(int i=0;i<3;i++)
        if(s[i]=='A') cnt++;
    if(cnt==0||cnt==3) printf("No\n");
    else printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
Apparently, the tree supports the same operations as the set 
(at least I haven't any problems with them before), but also there are two new features — 
find_by_order() — The first returns an iterator to the k-th largest element (counting from zero)
order_of_key() — the number of items in a set that are strictly smaller than our item. 
https://codeforces.com/blog/entry/11080
using namespace __gnu_pbds; */
using namespace std;
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define int long long
#define MOD 1000000007
#define pb push_back 
#define ins insert
#define fast(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ld long double
#define endl '\n'
int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int p(int a, int b) {
    int res = 1;
    while(b > 0){
        if(b&1) res = m(m(res)*m(a));
        a = m(m(a)*m(a));
        b >>= 1;
    }
    return res;
}
signed main(){
    fast();
    int n;
    cin >> n;
    map<string, int> ma;
    while(n--){
        string s;
        cin >> s;
        ma[s]++;
    }
    string a[4] = {"AC", "WA", "TLE", "RE"};
    for(auto i: a){
        cout << i << " x " << ma[i] << endl;
    }
    cerr << "\nTime elapsed : " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n";
}

Measured memory_bytes: 3624
def ij2str(i, j):
    return str(i) + '+' + str(j)

n = int(input())
tree = [[] for _ in range(n)]
dis = [0 for _ in range(n)]
c_list = {}
visited = set()
for i in range(n-1):
    a, b, c = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
    c_list[ij2str(a-1, b-1)] = c
    c_list[ij2str(b-1, a-1)] = c

from collections import deque

q, k = map(int, input().split())
visited.add(k-1)
next = deque()
next.append(k-1)

while len(next):
    i = next.popleft()
    for j in tree[i]:
        if not j in visited:
            dis[j] = dis[i] + c_list[ij2str(i, j)]
            next.append(j)
            visited.add(j)

for i in range(q):
    x, y = map(int, input().split())
    print(dis[x-1] + dis[y-1])


Measured memory_bytes: 160028
pub fn read_parameters<T>() -> Result<Vec<T>, String>
where
    T: std::str::FromStr,
{
    let mut line = String::new();
    std::io::stdin()
        .read_line(&mut line)
        .map_err(|err| format!("{:?}", err))?;

    let xs = line.trim().split_whitespace();
    let mut result = Vec::new();

    for x in xs {
        let ans = x.parse::<T>().map_err(|_| format!("{}", "parse error"))?;
        result.push(ans);
    }
    Ok(result)
}

fn main() {
    let (a, b) = read_parameters::<isize>().map(|xs| (xs[0], xs[1])).unwrap();

    if a < b {
        println!("a < b");
    } else if a > b {
        println!("a > b");
    } else {
        println!("a == b");
    }
}



Measured memory_bytes: 5032
#include <bits/stdc++.h>
 
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define pb push_back
#define MOD 1000000007
#define ull unsigned long long
#define all(x) (x).begin(), (x).end()
#define read(a, n) for(ll i = 0;i<n;i++) cin>>a[i];
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define FileIO freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
const int INF = 1e9 + 5;

void solve() {
	ll n;
	cin>>n;
	
	ll dp[n][3];
	memset(dp, 0, sizeof(dp));
	
	ll a, b, c;
	cin>>a>>b>>c;
	dp[0][0] = a;
	dp[0][1] = b;
	dp[0][2] = c;
	
	for(ll i = 1;i<n;i++) {
		cin>>a>>b>>c;
		dp[i][0] = a + max(dp[i-1][1], dp[i-1][2]);
		dp[i][1] = b + max(dp[i-1][0], dp[i-1][2]);
		dp[i][2] = c + max(dp[i-1][0], dp[i-1][1]);
	}
	
	//for(int i = 0;i<n;i++) {
		//debug3(dp[i][0], dp[i][1], dp[i][2]);
	//}
	
	cout<<max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]))<<"\n";
}

int main()
{
	fastio;
	
	int T = 1;
	//cin>>T;
	//int tc = 1; 
	while(T--) {
		//cout<<"Case #"<<tc<<": ";
		solve();
		//tc++;
	}	
	return 0;
}


Measured memory_bytes: 5908
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int l,r,d;
    cin>>l>>r>>d;
    int cnt=0;
    for(int i=l;i<=r;i++){
        if(i%d==0) cnt ++;
    }
    cout<<cnt<<endl;
}/*
./problem.exe
*/

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

#define pb push_back
#define ppp pop_back
#define pii pair<int, int>
#define fi first
#define se second

const int N = 3e3 + 5;
const int p = 1e9 + 7;

int dp[N][N];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	int n;
	string s;
	cin >> n >> s;
	s = '$' + s;
	dp[1][1] = 1;
	for (int i=2; i<=n; i++) {
		for (int j=1; j<=i; j++) {
			if (s[i-1] == '<') dp[i][j] = dp[i-1][j-1];
			else dp[i][j] = (dp[i-1][i-1] - dp[i-1][j-1] + p) % p;
			dp[i][j] = (dp[i][j] + dp[i][j-1]) % p;
		}
	}
	cout << dp[n][n] << "\n";
    return 0;
}


Measured memory_bytes: 34176