akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U>
void chmax(T &a, U b) {
    if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
    if (b < a) a = b;
}

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 50);

vector<int> memo(100100, -1);
vector<int> to[100100];

int rec(int v) {
    if (memo[v] >= 0) return memo[v];

    int ret = 0;
    for (auto u : to[v]) {
        chmax(ret, rec(u));
    }
    if (to[v].size() == 0) ret = -1;
    return memo[v] = ret + 1;
}

void solve(long long N, long long M, std::vector<long long> x, std::vector<long long> y) {
    rep(i, M) {
        to[x[i] - 1].emplace_back(y[i] - 1);
    }

    int ans = 0;
    rep(i, N) {
        chmax(ans, rec(i));
    }
    cout << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    std::vector<long long> x(M);
    std::vector<long long> y(M);
    for (int i = 0; i < M; i++) {
        scanf("%lld", &x[i]);
        scanf("%lld", &y[i]);
    }
    solve(N, M, std::move(x), std::move(y));
    return 0;
}


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

typedef struct element{
  long key;
  struct element *next;
  struct element *before;
}Element;

Element *insert(Element *begin, long key, Element **last) {
  Element *p;
  p = (Element*)malloc(sizeof(Element));
  p->key = key;
  p->next = begin;
  p->before = NULL;
  if(begin != NULL) {
    begin->before = p;
  }else{
    *last = p;
  }
  return p;
}

Element *delete(Element *begin, long key, Element **last) {
  Element *p = begin,*temp;
  while(p->key != key && p->next != NULL) p = p->next;
  if(p->next == NULL) {
    if(p->key != key) return begin;
    *last = p->before;
  }
  if(p->before != NULL) p->before->next = p->next;
  if(p->next != NULL) p->next->before = p->before;
  temp = begin;
  if(p == begin) temp = begin->next;
  free(p);

  return temp;
}

Element *deleteFirst(Element *begin, Element **last) {
  Element *p = begin->next;
  if(p != NULL) p->before = NULL;
  free(begin);
  if(p == NULL) *last = NULL;
  return p;
}

Element *deleteLast(Element *begin, Element **last) {
  Element *p = begin,*temp;
  p = (*last)->before;
  if(*last == begin) {
    temp = NULL;
  }else{
    temp = begin;
    (*last)->before->next = NULL;
  }
  free(*last);
  *last = p;

  return temp;
}

int main() {
  long i,n;
  scanf("%ld", &n);
  char command[12];
  long key;
  Element *begin;
  Element *last;
  for(i = 0; i < n; i++) {
    scanf(" %s", command);
    if(strcmp(command,"insert") == 0) {
      scanf("%ld", &key);
      begin = insert(begin, key, &last);
    }
    if(strcmp(command,"delete") == 0) {
      scanf("%ld", &key);
      begin = delete(begin, key, &last);
    }
    if(strcmp(command,"deleteFirst") == 0) begin = deleteFirst(begin, &last);
    if(strcmp(command,"deleteLast") == 0) begin = deleteLast(begin, &last);
  }

  Element *p = begin;
  while(p->next != NULL) {
    printf("%ld ", p->key);
    p = p->next;
  }
  printf("%ld\n", p->key);

  return 0;
}



Measured memory_bytes: 32956
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(L: str):
    dp = [(0,0)] * (len(L)+1)
    dp[0] = (1,0)
    for i in range(1,len(L)+1):
        isOne = L[i-1] == "1"
        if isOne:
            mContinue = dp[i-1][0]*2%MOD
            mDiscontinue = (dp[i-1][0] + dp[i-1][1]*3)%MOD
            dp[i] = (mContinue,mDiscontinue)
        else:
            mContinue = dp[i-1][0]%MOD
            mDiscontinue = (dp[i-1][1]*3)%MOD
            dp[i] = (mContinue,mDiscontinue)
    print((dp[len(L)][0]+dp[len(L)][1])%MOD)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = next(tokens)  # type: int
    solve(L)

if __name__ == '__main__':
    main()


Measured memory_bytes: 16628
#include <iostream>
#include <string>
#include <string_view>
#include <vector>

using namespace std;

int ModAtoi(string_view sv, int d) {
  int r = 0;
  for (char c : sv) {
    r *= 2;
    r %= d;
    r += c - '0';
  }
  return r;
}

inline int popcount(int x) { return __builtin_popcount(x); }

int f(int x) { return x == 0 ? 0 : f(x % popcount(x)) + 1; }

int main() {
  int n;
  string s;
  cin >> n >> s;
  int pc0 = 0;
  for (char c : s) pc0 += c - '0';
  vector<int> ans(n);
  for (int b : {0, 1}) {
    const int pc = b == 0 ? pc0 + 1 : pc0 - 1;
    if (pc <= 0) continue;
    const int r0 = ModAtoi(s, pc);  // X0 % popcount(X0)

    int k = 1;
    for (int i = n - 1; i >= 0; --i) {
      const int x = s[i] - '0';
      if (x == b) {
        int r = r0;
        if (b == 0) {
          r = (r + k) % pc;
        } else {
          r = (r - k + pc) % pc;
        }
        ans[i] = f(r) + 1;
      }
      k = (2 * k) % pc;
    }
  }

  for (int i = 0; i < n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}


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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back


int main() {
  ll a,b,c,d; cin>>a>>b>>c>>d;
  cout<<max({a*c,a*d,b*c,b*d})<<endl;
}


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

typedef long long ll;

ll a, b, ans;

ll chk(ll a, ll b, ll c){
    ll mx = max({a, b, c});
    ll mn = min({a, b, c});
    return min(ans, mx-mn);
}

void f(){
    for(int i=0; i<=a/2+1; i++){
        ll x = b*i, y, z;
        ll l = 0, r = b/2+1;
        while(l+3 <= r){
            ll m1 = (l+l+r)/3, m2 = (l+r+r)/3;
            ll r1, r2;
            
            y = m1*(a-i); z = (b-m1)*(a-i);
            if(x && y && z) r1 = chk(x, y, z);
            else r1 = 1e18;
            
            y = m2*(a-i); z = (b-m2)*(a-i);
            if(x && y && z) r2 = chk(x, y, z);
            else r2 = 1e18;
            
            if(r1 < r2) r = m2 - 1;
            else l = m1 + 1;
        }
        for(ll j=l; j<=r; j++){
            y = j*(a-i); z = (b-j)*(a-i);
            if(x && y && z) ans = min(ans, chk(x, y, z));
        }
    }
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> a >> b;
    if(a%3 == 0 || b%3 == 0){ cout << 0; return 0; }
    ans = min(a, b);
    f();
    swap(a, b);
    f();
    cout << ans;
}


Measured memory_bytes: 3572
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=400009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}

int fact[M+7],infact[M+7];

void init()
{
     fact[0]=infact[0]=1;
     f(i,1,M)fact[i]=(fact[i-1]*i)%mod;
     infact[M]=bigmod(fact[M],mod-2)%mod;
     rf(i,M-1,1)infact[i]=((i+1)*infact[i+1])%mod;
}
int ncr(int n,int r)
{
    int ses=fact[n]%mod;
    ses=(ses*infact[n-r])%mod;
    ses=(ses*infact[r])%mod;
    if(ses<0)ses+=mod;ses=ses%mod;
    return ses;
}
 main()

{
    fast
    init();
    int n,k;
    cin>>n>>k;
    int ses=0,val;
    if(k>=n-1)
    {
        ses=(ncr(2*n-1,n))%mod;
        if(ses<0)ses+=mod;ses=ses%mod;
    }
    else
    {
        f(i,0,k)
        {
            val=(ncr(n,i)+mod)%mod;
            val=(val*ncr(n-1,i))%mod;
            if(val<0)val+=mod;val=val%mod;
            ses=(ses+val)%mod;
        }
    }
    cout<<ses<<endl;
    return 0;

}


Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
	string a, b, c;
	cin >> a >> b >> c;
	if(a[a.size()-1] != b[0])cout << "NO";
	else if(b[b.size()-1] != c[0])cout << "NO";
	else cout << "YES";
	cout << endl;
	return 0;
}


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


int main(void)
{
	//入力文字列
	char str_input[8][9] = {NULL};

	//出力配列
	int h_outint[3] = {90 , 180 , 270};

	//よくわからないので出力用
	char str_output[3][8][9] = {NULL};

	for (int i = 0; i < 8; i++)
	{
		cin >> str_input[i];
	}

	//カウント変数
	int count1 = 0;

	for (int i = 0; i < 8; i++)
	{
		int count2 = 0;
		for (int j = 7; j >= 0; j--)
		{
			//cout << str_input[j][i];
			str_output[0][count1][count2++] = str_input[j][i];
		}
		count1++;
		//cout << endl;
	}

	count1 = 0;
	for (int i = 7; i >= 0; i--)
	{
		int count2 = 0;
		for (int j = 7; j >= 0; j--)
		{
			//cout << str_input[i][j];
			str_output[1][count1][count2++] = str_input[i][j];
		}
		count1++;
		//cout << endl;
	}

	count1 = 0;
	for (int i = 7; i >= 0; i--)
	{
		int count2 = 0;
		for (int j = 0; j < 8; j++)
		{
			//cout << str_input[j][i];
			str_output[2][count1][count2++] = str_input[j][i];
		}
		count1++;
		//cout << endl;
	}

	for (int i = 0; i < 3; i++)
	{
		//出力
		cout << h_outint[i] << endl;
		for (int j = 0; j < 8; j++)
		{
			cout << str_output[i][j] << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1144
#include <cstdio>
#include <cstring>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;

char buf[100000+10];

int main(void) {
  scanf("%s", buf);
  int n = strlen(buf);
  int res = n;
  REP(i, n-1) {
    if(buf[i] != buf[i+1]) {
      res = min(res, max(i+1, n-i-1));
    }
  }
  printf("%d\n", res);
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
double pi=3.141592653; 
int main(){
   long double  a,b,h,m;
cin>>a>>b>>h>>m;
 
long double x=(h+m/60.0)*30.0;
long double y=m*6.0;
x=abs(x-y);
x=x*pi/180.0;
long double ans;
ans=sqrt(a*a+b*b-2*a*b*cos(x));
 
    
    cout<<fixed<<setprecision(20)<<ans;
    
    
    return 0;
}

Measured memory_bytes: 4164
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

int main(int argc, char const *argv[])
{
	int a,b,k;
	int v[100],p = 0;
	scanf("%d%d%d",&a,&b,&k);
	for (int i = 1; i <= ((a < b) ? a : b); ++i){
		if(!(a % i) && !(b % i))	v[p++] = i;
	}
	printf("%d\n",v[p - k]);
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

constexpr ll NOT_SPECIFIED_VALUE_MIN = INT64_MIN;
constexpr ll NOT_SPECIFIED_VALUE_MAX = INT64_MAX;

template <typename T>
vector<bool> eratosthenes(T n) {
	vector <bool> IsPrime;
	if (n + 1 > IsPrime.size()) {
		IsPrime.resize(n + 1, true);
	}
	IsPrime[0] = false;
	IsPrime[1] = false;

	for (T i = 2; i*i <= n; i++) {
		if (IsPrime[i]) {
			for (T j = 2; i*j <= n; j++) {
				IsPrime[i*j] = false;
			}
		}
	}
	return IsPrime;
}

int main() {
	vector<bool> isPrime = eratosthenes(1LL << 20);
	vector<ll> numPrime((1LL << 20) + 1, 0);
	ll now = 0;
	for (ll i = 1; i <= (1LL << 20); i++) {
		if (isPrime[i] == true) {
			now++;
		}
		numPrime[i] = now;
	}

	ll n;
	n = -1;
	while (true) {
		cin >> n;
		if (n == -1)break;
		cout << numPrime[n] << endl;
		n = -1;
	}


}



Measured memory_bytes: 11204
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n;
ll a[20][20];
ll d[65540];
ll ad[65540];
int main()
{
	cin >>n;
	for (int i=0;i<n;i++)
		for (int j=0;j<n;j++)
			cin >>a[i][j];
	for (int i=1;i<(1<<n);i++)
	{
		vector<int> v;
		for (int j=0;j<n;j++) if (i & (1<<j)) v.push_back(j);
		for (int j=0;j<v.size();j++)
			for (int k=j+1;k<v.size();k++)
				ad[i]+=a[v[j]][v[k]];
	}
	fill(d,d+(1<<n),-1e18);
	d[0]=0;
	for (int i=1;i<(1<<n);i++)
	{
		vector<int> v;
		for (int j=0;j<n;j++) if (i & (1<<j)) v.push_back(j);
		for (int j=1;j<(1<<(int)v.size());j++)
		{
			int t=0;
			for (int k=0;k<v.size();k++) if (j & (1<<k)) t|=(1<<v[k]);
			d[i]=max(d[i],ad[t]+d[i^t]);
		}
	}
	cout <<d[(1<<n)-1];
	return 0;
} 

Measured memory_bytes: 1280
function Main(input) {
	lines = input.split("\n");
	words = lines[0].split(" ");
	var a = Number(words[0]);
	var b = Number(words[1]);
	var k = Number(words[2]);
	if(a <= k) {
		b = b - (k - a)
		a = 0;
		console.log(a, b >= 0 ? b : 0)
	} else {
		console.log(a-k, b)
	}

}


Main(require("fs").readFileSync("/dev/stdin", "utf8"))

Measured memory_bytes: 7372
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
 
class Program
{
    static void Main(string[] args)
    {
        while (true)
        {
            var line = Console.ReadLine();
            if (string.IsNullOrEmpty(line))
            {
                break;
            }
            var vs = line.Split(' ').Select(double.Parse).ToArray();
            var v1 = vs.Take(3).Select(x => x * vs[4]).ToArray();
            var v2 = vs.Skip(3).Select(x => x * vs[1]).ToArray();
            //var xs = v1.Zip(v2, (x, y) => x - y).ToArray();
            //var xResult = xs[2] / xs[0];
            var xResult = (v1[2] - v2[2]) / (v1[0] - v2[0]);
            var yResult = (vs[2] - vs[0] * xResult) / vs[1];
            Console.WriteLine("{0:0.000} {1:0.000}", Math.Floor(xResult * 1000) / 1000, Math.Floor(yResult * 1000) / 1000);
        }
    }
}

Measured memory_bytes: 6180
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int X; cin >> X;
	int ans = 0;
	int now = 100;
	while (now < X) {
		ans++;
		now += now * 0.01;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3656
#!/snap/bin/pypy3

import math

def main():
    N = int(input())
    ps = list(map(float, input().split()))

    dp = [[0.0 for _ in range(N+1)] for _ in range(N+1)]
    dp[0][0] = 1.0

    for i, pr in enumerate(ps, start=1):
        for j in range(N+1):
            dp[i][j] = dp[i-1][j] * (1 - pr)
            if j:
                dp[i][j] += dp[i-1][j-1] * pr

    print(sum(dp[-1][math.ceil(N/2):]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 120028
#include <bits/stdc++.h>
using namespace std;
queue<int> q;
bool check[200001];
int n, m, ma;
int main(){
    cin >> n >> m;
    vector<vector<int>> adj(n + 1);
    for(int i = 0; i < m; i++){
        int x, y; cin >> x >> y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    for(int i = 1; i <= n; i++){
        if(check[i]) continue;
        check[i] = true;
        q.push(i);
        int ans = 1;
        while(!q.empty()){
            int x = q.front();
            q.pop();
            for(int u : adj[x]){
                if(check[u]) continue;
                q.push(u);
                check[u] = true, ans++;
            }
        }
        ma = max(ma, ans);
    }
    cout << ma;
    return 0;
}

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

/**
 * Copyright (c)
 * author        :   Sujeet Kumar 
 * question name :   
 * link          :   
 */



#define ull long long
#define ll unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define repA(i,v) for(auto i:v)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define vi vector<int>
#define vll vector<ll>
#define vi2(n,m) vector<vector<int> > v(n,vector<int>(m));

ll modulo = 1e9+7;
ll findProductSum(vector<ll>&v, ll n){
	// cout<<modulo<<endl;
    ll sum = 0; 
    for (ll i = 0; i < n; i++) 
        sum = ((sum%modulo) + (v[i]%modulo))%modulo; 
    sum = sum%modulo;
    ll squareSum = ((sum % modulo)*(sum%modulo))%modulo; 
    squareSum = squareSum % modulo;
    ll newSum = 0; 
    for (ll i = 0; i < n; i++) 
        newSum += ((v[i]%modulo)*(v[i]%modulo))%modulo; 
    newSum = newSum % modulo;
    return ((squareSum - newSum+modulo)*500000004)%modulo;
} 

void solve(){
	ll n;cin>>n;
	vll v(n);
	rep(i,0,n)	cin>>v[i];
	// rep(i,0,n)	cout<<v[i]<<' ';
	// cout<<endl;
	cout<<findProductSum(v,n);
	// cout<<modulo;
	return ;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    clock_t start=clock();

	ll test = 1;
	// cin>>test;
	while(test--)	solve();

	clock_t end=clock();
	cerr<<fixed<<setprecision(15)<<((double)(end-start))/CLOCKS_PER_SEC<<endl;
	return 0;
}
/**
 * Test Cases:-
 */


Measured memory_bytes: 4780
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;

int N, A, B, C, D;
ll DP[1001], E869120[1001];

ll pw(ll x, int y) {
	ll a = 1;
	while (y) {
		if (y & 1)
			a = a * x%mod;
		x = x * x%mod;
		y >>= 1;
	}
	return a;
}
ll modinv(ll x) {
	return pw(x, mod - 2);
}

int main() {
	cin >> N >> A >> B >> C >> D;
	DP[0] = 1;
	E869120[0] = 1;
	for (int i = 1; i != N + 1; ++i)
		E869120[i] = E869120[i - 1] * i%mod;
	for (int i = A; i != B + 1; ++i) {
		for (int j = N; j != -1; --j) {		
			for (int k = C; k != D + 1 && j + i * k <= N; ++k) {
				DP[j + i * k] = (DP[j + i * k] + DP[j] * E869120[N - j] % mod*modinv(E869120[i*k] * E869120[N - j - i * k] % mod*pw(E869120[i], k) % mod*E869120[k] % mod) % mod*E869120[i*k]) % mod;
			}
		}
	}
	cout << DP[N] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

template <class T>
struct Find {
    Find(const T &s, const T &t) : m(t.size()), o(m * 2), a(o + s.size()) {
        int j = a[0] = -1;
        for (int i = 0; i < m; a[++i] = ++j) {
            while (j >= 0 && t[i] != t[j]) j = a[j];
        }
        int n = s.size(), l = a.size() - 1, h = 0;
        for (int i = m; i < l; a[++i] = ++j) {
            while (j >= 0 && (j == m || s[h] != t[j])) j = a[j];
            if (++h == n) h -= n;
        }
    }
    int operator[](int i) const {
        return a[o + i] == m;
    }
    const int m, o;
    vector<int> a;
};

struct Graph {
    struct Vertex { int n, k, d; };
    struct Edge { int i, n; };
    Graph(int n, int m) : v(n, { -1, 0, 0 }), e(m), n(n), m(0) {}
    void add_edge(int i, int j) {
        e[m] = { j, v[i].n };
        v[i].n = m;
        v[j].k++;
        m++;
    }
    void tsort() {
        vector<int> q(n);
        int i0 = 0, i1 = 0;
        for (int i = 0; i < n; i++) {
            if (v[i].k == 0) q[i1++] = i, v[i].d = 0;
        }
        while (i0 < i1) {
            int i = q[i0++];
            for (int j = v[i].n; j >= 0; j = e[j].n) {
                Edge &o = e[j];
                if (--v[o.i].k == 0) q[i1++] = o.i, v[o.i].d = v[i].d + 1;
            }
        }
        if (i1 < n) {
            cout << -1 << endl;
        } else {
            cout << v[q.back()].d << endl;
        }
    }
    vector<Vertex> v;
    vector<Edge> e;
    int n, m;
};

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

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

    int n = s.size();
    int m = t.size();

    Find<string> u(s, t);

    Graph g(n, n);

    for (int i = 0; i < n; i++) {
        if (u[i]) g.add_edge(i, (i + m) % n);
    }

    g.tsort();

    return 0;
}

Measured memory_bytes: 19356
#include <iostream>
#include <vector>
#include <cstdio>
#include <utility>
using namespace std;

int main(void){
    int x,y;
    vector<int> vx,vy;
    scanf("%d %d",&x,&y);
    vx.push_back(x);
    vy.push_back(y);
    for (int i=0;vx[i]+vy[i];i++){
        scanf("%d %d",&x,&y);
        if(x > y)
        swap(x,y);
        vx.push_back(x);
        vy.push_back(y);
    }
    for(int i=0;vx[i] + vy[i];i++)
        cout << vx[i] << " " << vy[i] << endl;
}



Measured memory_bytes: 3264
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

// 別の書き方を使ってみる

// constexpr inline ll mod = 1'000'000'007;
constexpr int max_n = 200'000 + 5;

int n, q;
int cnts[max_n];

int hd[max_n]; // n : 頂点数
int nxt[2*max_n], to[2*max_n]; // 2*(n-1)+1 : 辺の個数+1
int edge_cnt;
inline void add_edge(int u, int v) { // u to v
    edge_cnt++; // 辺が1つ増える
    to[edge_cnt] = v; // edge_cnt本目の辺の行き先はv
    nxt[edge_cnt] = hd[u]; // edge_cnt本目の辺の次に見る(uから出る)辺は、はじめに見ていた(uから出る)辺であるhd[u]本目の辺
    hd[u] = edge_cnt; // 新しくはじめに見る(uから出る)辺はedge_cnt本目の辺
}

void dfs(const int cur = 0, const int parent = -1)
{
    for (int e = hd[cur]; e > 0; e = nxt[e]) {
       int child = to[e];
       if (child == parent) { continue; }
       cnts[child] += cnts[cur];
       dfs(child, cur);
   }
}

int main()
{
    // 入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // cout << setprecision(10); // 浮動小数の表示の精度

    cin >> n >> q;
    rep(i, n - 1)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        add_edge(a,b);
        add_edge(b,a);
    }
    rep(j, q)
    {
        int p,x;
        cin >> p >> x;
        p--;
        cnts[p] += x;
    }

    // 集計
    dfs();

    rep(i, n)
    {
        cout << cnts[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 23932
import sys
input = sys.stdin.readline
mod = 10**9+7
def main():
    N,K = map(int,input().split())
    ans = 1
    for k in range(K,N+1):
        upper = k*(N+N-k+1)//2
        lower = k*(k-1)//2
        ans += (upper-lower+1)%mod
        ans %= mod
    print(ans)
if __name__ == "__main__":
    main()

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

typedef long long int in;

in n,k,l=1000000007;

struct mat
{
    in a[55][55];
};

mat e,d;

mat mul(mat r,mat y)
{
    in i,h,j;
    
    mat z;
    
    for(i=0;i<n;++i)
    for(j=0;j<n;++j)
    z.a[i][j]=0;
    
    for(i=0;i<n;++i)
    {
        for(h=0;h<n;++h)
        {
            for(j=0;j<n;++j)
            {
                z.a[i][j]=((z.a[i][j]%l)+(((r.a[i][h]%l)*(y.a[h][j]%l))%l))%l;
            }
        }
    }
    
    return z;
}

mat matrix(mat f,in k)
{
    if(k==0)
    return d;
    
    if(k%2==0)
    return matrix(mul(f,f),k/2);
    else
    return mul(f,matrix(mul(f,f),(k-1)/2));
}

int main() 
{
	in i,j,sum=0;
	cin>>n>>k;
	
	for(i=0;i<n;++i)
	d.a[i][i]=1;
	
	for(i=0;i<n;++i)
	for(j=0;j<n;++j)
	cin>>e.a[i][j];
	
	mat ans=matrix(e,k);
	
	for(i=0;i<n;++i)
	for(j=0;j<n;++j)
	sum=(sum+ans.a[i][j])%l;
	
	cout<<sum;
	
	return 0;
}


Measured memory_bytes: 10496
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {

	vector<int>airplane;

	int P, Q, R;
	cin >> P >> Q >> R;

	airplane.push_back(P);
	airplane.push_back(Q);
	airplane.push_back(R);

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

	cout << airplane[0] + airplane[1] << endl;

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define alll(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}cout<<endl;}

int main() {
    ll h,w,n;

    cin>>h>>w>>n;
    ll sr,sc;
    cin>>sr>>sc;
    string s,t;
    cin >>s>>t;    
    // 5 6 11
    // 2 1
    // RLDRRUDDLRL
    // URRDRLLDLRD
    bool b = false;
    {
        auto tmp = sr;
        rep(i, s.size()){
            if(s[i] == 'U') tmp--;
            if(tmp == 0) b = true;
            if(t[i] == 'D') tmp = min(tmp+1, h - 1);
        }
    }
    {
        auto tmp = sc;
        rep(i, s.size()){
            if(s[i] == 'L') tmp--;
            if(tmp == 0) b = true;
            if(t[i] == 'R') tmp = min(tmp+1, w - 1);
        }
    }
        {
        auto tmp = h - sr + 1;
        rep(i, s.size()){
            if(s[i] == 'D') tmp--;
            if(tmp == 0) b = true;
            if(t[i] == 'U') tmp = min(tmp+1, h - 1);
        }
    }
    {
        auto tmp = w - sc + 1;
        rep(i, s.size()){
            if(s[i] == 'R') tmp--;
            if(tmp == 0) b = true;
            if(t[i] == 'L') tmp = min(tmp+1, w - 1);
        }
    }

    if(b) pr("NO");
    else pr("YES");
    
    return 0;
}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(a, b);
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

Measured memory_bytes: 1020
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int h, w, a, b;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> h >> w >> a >> b;
  REP(i, h) {
    REP(j, w) {
      if((i < b) ^ (j < a)) cout << 1;
      else cout << 0;
    }
    cout << endl;
  }
}


Measured memory_bytes: 1280
n = gets.to_i

a1 = 0
a2 = 0
a3 = 0
a4 = 0

n.times do 
    s = gets.chomp
    next if s.size > 3
    a1 += 1 if s == "AC"
    a2 += 1 if s == "WA"
    a3 += 1 if s == "TLE"
    a4 += 1 if s == "RE"
end

puts "AC x " + a1.to_s
puts "WA x " + a2.to_s
puts "TLE x " + a3.to_s
puts "RE x " + a4.to_s

Measured memory_bytes: 14400
#include<iostream>
using namespace std;
typedef long long ll;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll ans = 0;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i != 0) continue;
        ll m = N / i - 1;
        if (m > 0 && i < m) {
            ans += m;
        }
        if (i * i != N) {
            ll ii = N / i;
            m = N / ii - 1;
            if (m > 0 && i < m) {
                ans += m;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#define pq priority_queue
#define Pi acos(-1.0)
using namespace std;
#define MOD 1000000007
int num[1005];
long long ans=1;
int n;
void ok(int x)
{
    for(int i=2;i<=n;i++)
    {
        while(x%i==0)
        {
            num[i]++;
            x/=i;
        }
    }
}
int main()
{
    cin>>n;
    for(int i=2;i<=n;i++)
    {
        ok(i);
    }
    for(int i=2;i<=n;i++)
        ans=(ans*(num[i]+1))%MOD;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <sstream>

using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> P2;


int main(){
	
	while(true){
		
		int n, m, a;
		
		cin >> n >> m >> a;
		
		if(n == 0 && m == 0 && a == 0){
			break;
		}
		
		vector<P2> v;
		
		for(int i = 0; i < m; i++){
			P2 p2;
			cin >> p2.first >> p2.second.first >> p2.second.second;
			p2.first = -p2.first;
			v.push_back(p2);
		}
		
		sort(v.begin(), v.end());
		
		for(int i = 0; i < m; i++){
			if(a == v[i].second.first){
				a = v[i].second.second;
			}else if(a == v[i].second.second){
				a = v[i].second.first;
			}
		}
		cout << a << endl;
	}
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// DON'T USE THESE MACROS DURING ICPC PRACTICE
#define For(i,n) for (int i=0; i<n; i++)
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define Down(i,n) for (int i=n-1; i>=0; i--)
#define DOWN(i,a,b) for (int i=b; i>=a; i--)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef complex<ld> pt;
typedef vector<pt> pol;
typedef vector<int> vi;

const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e-10;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());



int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(10);

	int n, w;
	cin >> n >> w;

	ll dp[w+1];
	memset(dp, 0, sizeof dp);
	For(i,n) {
		int we, v;
		cin >> we >> v;
		for (int j=w; j-we>=0; j--) {
			dp[j] = max(dp[j], dp[j-we] + v);
		}
	}

	ll ans = 0;
	For(i,w+1) {
		ans = max(ans, dp[i]);
	}
	cout << ans << nl;

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
//#define ivorysi
#define MAXN 200005
#define eps 1e-7
#define mo 974711
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
const int64 MOD = 998244353;
int N;
char s[MAXN];
int64 dp[MAXN][3][3][2];
void inc(int64 &x,int64 y) {
    x = x + y;
    while(x >= MOD) x -= MOD;
}
     
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    scanf("%s",s + 1);
    N = strlen(s + 1);
    bool all_same = 1;
    for(int i = 1 ; i <= N ; ++i) {
    	if(s[i] != s[1]) all_same = 0;
    }
    if(all_same) {puts("1");return 0;}
    if(N > 3) {
    	for(int i = 0 ; i <= 2 ; ++i) dp[1][i][i][0] = 1;
    	for(int i = 2 ; i <= N ; ++i) {
    	    for(int s = 0 ; s <= 2 ; ++s) {
    		for(int j = 0 ; j <= 2 ; ++j) {
    		    for(int h = 0 ; h <= 2 ; ++h) {
    			for(int l = 0 ; l <= 1 ; ++l) {
    			    inc(dp[i][(s + h) % 3][h][l || h == j],dp[i - 1][s][j][l]);
    			}
    		    }
    		}
    	    }
    	}
    	bool flag = 1;
    	int c = 0;
    	for(int i = 1 ; i <= N ; ++i) {
    	    c = (c + s[i] - 'a') % 3;
    	}
    	for(int i = 2 ; i <= N ; ++i) {
    	    if(s[i] == s[i - 1]) {flag = 0;break;}
    	}
    	int64 ans = flag;
    	for(int i = 0 ; i <= 2 ; ++i) ans += dp[N][c][i][1];
    	ans %= MOD;
    	printf("%lld\n",ans);
    }
    else {
    	if(N == 3) {
    	    if(s[1] != s[2] && s[2] != s[3] && s[1] != s[3]) puts("3");
    	    else if(s[1] == s[2] || s[2] == s[3]) puts("6");
    	    else puts("7");
    	}
    	else if(N == 2) {
    	    puts("2");
    	}
    }
    return 0;
}

Measured memory_bytes: 32140
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef double D;
typedef complex<D> P;
typedef pair<P,P> L;
int N;
D acc;
D pi=acos(-1);
L ls[40000];
D rs[40000];
D ths[40000];
D ub[40000];
D cro(P a,P b){return imag(conj(a)*b);}
inline P vec(L l){
	return l.sc-l.fs;
}
inline D verlen(L l,P p){
	return cro(vec(l),p-l.sc)/abs(vec(l));
}
inline P intLL(L a,L b){
	D t=cro(vec(a),a.sc-b.fs)/cro(vec(a),vec(b));
	return b.fs+t*vec(b);
}
inline bool ispal(L a,L b){
	return abs(cro(vec(a),vec(b)))<1e-9;
}
int main(){
	cin>>N>>acc;
	rep(i,N){
		int d,e,f,g;
		cin>>d>>e>>f>>g;
		ls[i]=L(P(d,e),P(f,g));
	}
	rep(i,N-1){
		L a=L(ls[i].sc,ls[i].sc+vec(ls[i])*P(0,1));
		L b=L(ls[i+1].fs,ls[i+1].fs+vec(ls[i+1])*P(0,1));
		P p;
		if(ispal(a,b)) p=(ls[i].sc+ls[i+1].fs)/2.0;
		else p=intLL(a,b);
		rs[i]=verlen(ls[i],p);
		ths[i]=arg(vec(ls[i+1])/vec(ls[i]));
		if(rs[i]<0){
			rs[i]=-rs[i];
			ths[i]=-ths[i];
		}
		if(ths[i]<0) ths[i]+=2*pi;
		assert(0<ths[i]&&ths[i]<2*pi);
	}
	ub[N-1]=0;
	for(int i=N-1;i>0;i--){
		D len=abs(vec(ls[i]));
		ub[i-1]=min(sqrt(ub[i]*ub[i]+2*acc*len),sqrt(rs[i-1]*acc));
	}
	D ans=0,v=0;
	rep(i,N){
		D len=abs(vec(ls[i]));
		D mx=sqrt(v*v+2*acc*len);
		if(mx<=ub[i]){
			ans+=(mx-v)/acc;
			v=mx;
		}else{
			if(ub[i]>v){
				ans+=(ub[i]-v)/acc;
				len=(len-(ub[i]*ub[i]-v*v)/2/acc)/2;
				v=ub[i];
				mx=sqrt(v*v+2*acc*len);
				ans+=2*(mx-v)/acc;
			}else{
				ans+=(v-ub[i])/acc;
				len=(len-(v*v-ub[i]*ub[i])/2/acc)/2;
				mx=sqrt(v*v+2*acc*len);
				ans+=2*(mx-v)/acc;
				v=ub[i];
			}
		}
		if(i==N-1) break;
		ans+=ths[i]*rs[i]/v;
	}
	printf("%.12f\n",ans);
}

Measured memory_bytes: 3456
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>
#include<queue>

using namespace std;

#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(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;

template<class T>
struct Edge {
    int to;
    T cost;
    Edge() {};
    Edge(int to, T cost) : to(to), cost(cost) {};
};

template<class T>
class Graph {
    int n;
    bool directed;
    vector<vector<Edge<T>>> edges;
public:

    Graph(int n, bool directed) :n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)){};
    Graph() {};

    void add(int to, T cost) {
        emplace_back(to, cost);
    }

    int size() {
        return n;
    }
};


int main() {

    int N;

    cin >> N;

    set<int> S;

    REP(i,N){
        int a;
        cin >>a;
        S.insert(a);
    }

    cout << ((S.size() == N)?"YES":"NO") << endl;

    return 0;
}

Measured memory_bytes: 9600
/*
 _ _ _   _    _   _    _   _ _ _   _    _   _ __ _   __       __
|  _ _| | |  | | | |  | | |  _  | | |  | | |  __  | |   \   /   |
| |_ _  | |__| | | |  | | | |_| | | |__| | | |__| | | |\ \_/ /| |
|_ _  | |  __  | | |  | | |  _ <  |  __  | |  __  | | | \   / | |
 _ _| | | |  | | | |__| | | |_| | | |  | | | |  | | | |  \_/  | |  _   _   _
|_ _ _| |_|  |_| |_ __ _| |_ _ _| |_|  |_| |_|  |_| |_|       |_| |_| |_| |_|

*/

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

#define ll long long int
#define fi first
#define se second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(a) cout << #a << " = " << a << " ";
#define endl "\n"
const int  MOD=1000000007;

void solve() {
    ll a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>=22){
        cout<<"bust\n";
    } else {
        cout<<"win\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int t = 1;
    // cin>>t;
    for (long int tt = 1; tt <= t; tt++) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3612
n = int(input())
a = list(map(int, input().split()))
a.sort()
m = a.pop()
r = m/2

def isOK(index, key):
    return a[index] >= key

def bsearch(key):
    left = -1
    right = n-1

    while right-left > 1:
        mid = left+(right-left)//2
        if isOK(mid, key):
            right = mid
        else:
            left = mid

    if right == n-1:
        return -1
    else:
        return right

index = bsearch(r)

if index > 0 and 2*r < a[index-1]+a[index]:
    index -= 1

print(m, a[index])

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

int c[15][15];
int cost[15];
int visited[15];

void dfs(int num, int start, int now=0){
  if(num==1){
    cost[start]=min(cost[start],now);
    return;
  }
  for(int i = 0; i <= 9; i++){
    visited[num]=1;
    if(visited[i]) continue;
    now+=c[num][i];
    dfs(i,start,now);
    now-=c[num][i];
    visited[i]=0;
  }
}

int main(){
  int h,w;
  cin>>h>>w;
  rep(i,10)rep(j,10){
    cin>>c[i][j];
  }
  map<int,int> mp;
  rep(i,h)rep(j,w){
    int a;
    cin>>a;
    if(a!=-1)mp[a]++;
  }
  rep(i,10) cost[i]=c[i][1];
  for(int i = 0; i <= 9; i++){
    if(i==1) continue;
    rep(j,10)visited[j]=0;
    dfs(i,i);
  }
  int ans=0;
  for(auto x : mp){
    ans += cost[x.first] * x.second;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{	
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			int n = cin.Int();
			int x = cin.Int();
			int[] l = new int[n];
			for (int i = 0; i < n; i++) {
				l[i] = cin.Int();
			}

			int ans = 1;
			int d = 0;
			for (int i = 0; i < n; i++) {
				d = d + l[i];
				if (d <= x) {
					++ans;
				}
			}

			Console.WriteLine(ans);
		}
		
		
	}

	public class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}


		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <map>
std::map<std::string,int> t;
int main(){
    int n;std::cin>>n;
    while(n--){
        std::string s;std::cin>>s;
        ++t[s];
    }
    std::cout<<"AC x "<<t["AC"]<<'\n'<<"WA x "<<t["WA"]<<'\n'<<"TLE x "<<t["TLE"]<<'\n'<<"RE x "<<t["RE"]<<'\n';
    return 0;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
int main(){
    int m,n;
    string a;
    cin>>m>>n;
    cin>>a;
    for(int i=0;i<m;++i){
        if(a[i]<'0'||a[i]>'9'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(a[m]!='-'){
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=m+1;i<=m+n;++i){
        if(a[i]<'0'||a[i]>'9'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
//write：Sakura 桜 
//id：
//problem：
//note：

#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

typedef long long ll;

const int MAXN=1e5+5;

int n,m,s,t;
struct Node{
    int a,b;
    int v;
    Node(int _v,int _a,int _b){v=_v,a=_a,b=_b;}
};
vector <Node> E[MAXN];

ll ans[MAXN];
ll d1[MAXN],d2[MAXN];
bool vis[MAXN];
queue <int> q;

void spfa1(){
    memset(vis,0,sizeof vis);
    memset(d1,-1,sizeof d1);
    while(!q.empty()) q.pop();
    int u=s; 
    vis[u]=1; d1[u]=0;
    q.push(u);
    while(!q.empty()){
        u=q.front(); q.pop(); vis[u]=0;
        for(int i=0;i<(int)E[u].size();i++){
            int v=E[u][i].v,val=E[u][i].a;
            if(d1[v]==-1 || d1[v]>d1[u]+val){
                d1[v]=d1[u]+val;
                if(!vis[v]){
                    vis[v]=1;
                    q.push(v);
                }
            }
        }
    }
}

void spfa2(){
    memset(vis,0,sizeof vis);
    memset(d2,-1,sizeof d2);
    while(!q.empty()) q.pop();
    int u=t;
    vis[u]=1; d2[u]=0;
    q.push(u);
    while(!q.empty()){
        u=q.front(); q.pop(); vis[u]=0;
        for(int i=0;i<(int)E[u].size();i++){
            int v=E[u][i].v,val=E[u][i].b;
            if(d2[v]==-1 || d2[v]>d2[u]+val){
                d2[v]=d2[u]+val;
                if(!vis[v]){
                    vis[v]=1;
                    q.push(v);
                }
            }
        }
    }
}

int main(){
    scanf("%d %d %d %d",&n,&m,&s,&t);
    for(int i=1;i<=m;i++){
        int u,v,a,b;
        scanf("%d %d %d %d",&u,&v,&a,&b);
        E[u].push_back(Node(v,a,b));
        E[v].push_back(Node(u,a,b));
    }
    spfa1();
    spfa2();
    ll mine=1e15;
    for(int i=n;i>=1;i--){
        ans[i]=min(mine,d1[i]+d2[i]);
        mine=min(mine,d1[i]+d2[i]);
    }
    for(int i=1;i<=n;i++)
        printf("%lld\n",ll(1e15)-ans[i]);
    return 0;
}


Measured memory_bytes: 10880
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    cin >> N >> K;
    double ans = 0;
    for(int i=1;i<=N;i++){
        double now = 1.0/N;
        int p = i;
        while(p<K){
            now *= 0.5;
            p *= 2;
        }
        ans += now;
    }
    cout << fixed << setprecision(10) << ans << "\n";
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def main():
    N = int(input())
    A = [list(map(int, input().split())) for _ in range(N)]

    """
    まず三角不等式が任意の３頂点に対して成り立つことを確認する。
    なりたってなければグラフは存在しない。

    なりたっている場合は与えられた最短距離と同じ長さの辺を各頂点のペアごとに張れば
    一応条件を満たすグラフは構成できている。

    あとはここから余分な辺をどう削除するかだが、これは三角不等式で統合が成り立っているもの
    として判別できる。
    """

    # 三角不等式チェック
    triangle = True
    used_path = [[0] * N for _ in range(N)]
    for i in range(N):
        for j in range(i + 1, N):
            minimal_dist = 10**18
            for k in range(N):
                if k == i or k == j: continue
                if A[i][k] + A[k][j] < A[i][j]:
                    triangle = False
                    break
                else:
                    minimal_dist = min(minimal_dist, A[i][k] + A[k][j])
            if A[i][j] < minimal_dist: used_path[i][j] = 1
    if not triangle:
        print(-1)
        return
    
    # 辺の削除
    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            ans += A[i][j] * used_path[i][j]
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 75704
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+7;
vector<int> G[N];
int a[N];
int main()
{
    int m,k,n,x;
    scanf("%d %d",&n,&m);
    for(int i=0;i<n;i++){
        scanf("%d",&x);
        a[x%m]++;
        G[x%m].push_back(x);
    }
    int ans=a[0]/2;
    for(int i=1;i<=m/2;i++){
        if(i != m-i)
        {
            x = min(a[i], a[m-i]);
            ans += x;
            a[i] -= x;
            a[m-i] -= x;
        }
        else {
            ans+=a[i]/2;
            a[i]=0;
        }
    }
    //cout<<ans<<endl;
    int l,tmp;
    for(int i=1;i<m;i++){
        if(a[i] > 1){
            tmp = 0;
            sort(G[i].begin(), G[i].end());
            l = G[i].size();
            for(int j=0;j<l-1;j++){
                if(G[i][j] == G[i][j+1]){
                    tmp ++;
                    j++;
                }
            }
            ans += min(a[i]/2, tmp);
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 6144