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

using namespace std;
#define prev prev55

long long n, m, a[500000], b[500000], ans;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) cin >> b[i];
    sort(a, a + n), sort(b, b + m);
    a[n] = 1e9, b[m] = 1e9;
    for (int i = 0, j = 0; i < n || j < m;)
    {
        if (a[i] < b[j])
        {
            ans += a[i] * (m + 1 - j);
            //cout << a[i] * (m + 1 - j) << " " << m + 1 - i << " A \n";
            i++;
        }
        else
        {
            ans += b[j] * (n + 1 - i);
            //cout << b[j] * (n + 1 - i) << " " << n + 1 - i << " B \n";
            j++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 5120
#include <vector>
//#define DEBUG
#define MAXN 10000000
#define ll long long int
#include <bits/stdc++.h>
using namespace std;


int main() {
#ifdef DEBUG
    freopen("in.in", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);


    int t;
    cin >> t;
    switch (t%10) {
        case 0:
        case 1:
        case 6:
        case 8:
            cout << "pon" << endl;
            break;
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout << "hon" << endl;
            break;
        case 3:
            cout << "bon" << endl;
            break;
    }

    return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
      int hour = sc.nextInt();
      int minute = sc.nextInt();
      int H = sc.nextInt();
      int M = sc.nextInt();
      double Hrad = (30 * H) + (0.5 * M) ;
//      System.out.println(Hrad);
      double Mrad = 6 * M ;
//      System.out.println(Mrad);
      double cos;
      if(Hrad >= Mrad) {
        cos = Math.cos(Math.toRadians(Hrad - Mrad));
      } else {
        cos = Math.cos(Math.toRadians(Mrad - Hrad));
      }
      double a2 = (hour * hour) + (minute * minute) -(2 * hour * minute * cos);
      double ans = Math.sqrt(a2);
      System.out.println(ans);
    } 
}

Measured memory_bytes: 35820
unittest
{
	assert( [ "2", "10 30" ].parse.expand.solve == "7.50000" );
	assert( [ "3", "200 200 200" ].parse.expand.solve == "66.66667" );
	assert( [ "1", "1000" ].parse.expand.solve == "1000.00000" );
}



import std.conv;
import std.format;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	auto t = 0.0;
	foreach( a; as )
	{
		t += 1.0 / a;
	}
	return format( "%0.5f", 1.0 / t );
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve() {
  ll n,q;
  string s;
  cin>>n>>q>>s;
  vi l(q),r(q);
  rep(i,q) cin>>l[i]>>r[i];
  rep(i,q){
    l[i]--; r[i]--;
  }
  vi foo(n,0);
  set<ll> a,b;
  REP(i,1,n){
    if(s[i-1]=='A'&&s[i]=='C'){
      foo[i]=foo[i-1]+1;
      a.insert(i-1);
      b.insert(i);
    }
    else foo[i]=foo[i-1];
  }
  //outv(foo);
  rep(i,q){
    if(l[i]==0) out(foo[r[i]]);
    else{
      ll x=foo[r[i]]-foo[l[i]-1];
      if(b.count(l[i])) x--;
      out(x);
    }
  }
}

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


Measured memory_bytes: 8016
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;

struct Edge{int to,from,cost;};

#define debug cout

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repnd(i,m,n) for(int i=(n);i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn0(i,m,n) for(i=(m);i<=(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define SS stringstream
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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



int main() {
	int t=in();
	double mx=0;
	rep(i,t){
		int n,m,v;
		double r,rr=0,s=0;
		cin>>n>>m;
		rep(j,m){
			cin>>v>>r;
			rr+=v*r;
			s+=r;
		}
		rr/=s;
		chmax(mx,rr);
	}
	int p,q,v;
	double r,rrr=0,s=0;
	cin>>p>>q;
	rep(i,q){
		cin>>v>>r;
		rrr+=v*r;
		s+=r;
	}
	rrr/=s;
//debug<<mx<<" "<<rrr<<endl;
	if(mx-0.0000001>rrr)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

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

#define mx 200005
#define ll long long 

int ar[mx];
char ch[mx];

int m,n,k,ii;

bool func(int tar)
{
	int val=0;
	for(int i=1;i<=n;i++)
	{
		if(ar[i]>tar)
		{
            int tem=ar[i]/tar;
            if(ar[i]%tar!=0)tem++;
            val+=tem-1;
		}
	}
	//cout<<val<<" "<<tar<<endl;
	if(val>k)return false;
	return true;
}


void solve()
{
	scanf("%d%d",&n,&k);
	int re=0;
	for(int i=1;i<=n;i++)
	{
       scanf("%d",&ar[i]);
       re=max(re,ar[i]);
	}
	int be=1,en=re;
	while(be<=en)
	{
		int mid=(be+en)/2;
		if(func(mid))
		{
			re=mid;
			en=mid-1;
		}
		else be=mid+1;
	}
printf("%d\n", re);
}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif

	int t=1;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 4528
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

long long Gcd(int x, int y){
	return y == 0 ? x : Gcd(y, x%y);
}


int main(){
	int n;
	scanf("%d", &n);
	printf("%lld\n", (long long)2*n/Gcd(2, n));
return 0;
}

Measured memory_bytes: 256
package main

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

var (
	reader io.Reader = os.Stdin
	writer io.Writer = os.Stdout
)

func main() {
	reader = os.Stdin
	writer = os.Stdout
	run()
}

func run() {
	nums := readIntsFromStdin()[0]
	a, b, c := nums[0], nums[1], nums[2]
	var count int

	for i := a; i <= b; i++ {
		if c%i == 0 {
			count++
		}
	}

	fmt.Fprintln(writer, strconv.Itoa(count))
}

// readIntsFromStdin parses lines of inputs into 2D int array.
func readIntsFromStdin() [][]int {
	out := [][]int{}
	scanner := bufio.NewScanner(reader)

	for scanner.Scan() {
		var ints []int

		for _, s := range strings.Split(scanner.Text(), " ") {
			i, err := strconv.Atoi(s)

			if err != nil {
				fmt.Fprintln(os.Stderr, "Failed to parse string into int.", err)
				os.Exit(1)
			}

			ints = append(ints, i)
		}

		out = append(out, ints)
	}

	return out
}



Measured memory_bytes: 1140
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>

#define ll long long int

using namespace std;

const ll INF = (1<<30) - 1;

const ll MAX_M = 100000;

vector<ll> sieve(ll n){
    vector<ll> primes;
    
    vector<bool> is_prime(n, true);
    is_prime[0] = false;
    
    for(ll i=0; i<n; i++){
        if(is_prime[i]){
            primes.push_back(i+1);
            for(ll j=2*i+1; j<n; j+=i+1)
                is_prime[j] = false;
        }
    }
    return primes;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    vector<ll> primes = sieve(MAX_M/2);
    vector<pair<ll, ll>> table(MAX_M);
    
    for(ll i=0; i<primes.size(); i++){
        for(ll j=i; j<primes.size(); j++){
            // i < j, primes[i] < primes[j]
            ll pi = primes[i];
            ll pj = primes[j];
            if(pi * pj < MAX_M){
                pair<ll, ll> &p = table[pi*pj];
                if(p.first == 0 || p.first*pj < p.second*pi){
                    p.first = pi;
                    p.second = pj;
                }
                
            }else{
                break;
            }
        }
    }
    
    ll M, A, B;
    while(cin>>M>>A>>B, M|A|B){
        while(1){
            pair<ll, ll> &p = table[M--];
            if(p.first == 0)
                continue;
            
            if(p.second*A <= p.first*B){
                cout << p.first << " " << p.second << endl;
                break;
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 2844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int, int> P;

int n;
int cnt = 0;

void dfs(ll x, bool f3, bool f5, bool f7) {
    if (x > n) return;
    if (f3&&f5&&f7) cnt++;
    dfs(10*x+3, true, f5, f7);
    dfs(10*x+5, f3, true, f7);
    dfs(10*x+7, f3, f5, true);
}

int main() {
    cin >> n;
    dfs(0, false, false, false);
    cout << cnt << endl;
}

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

using namespace std;

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    YES(b-a==c-b);
    return 0;
}

Measured memory_bytes: 256
using System;

namespace A___500_Yen_Coins
{
    class Program
    {
        static void Main (string[] args)
        {
            var input = Console.ReadLine ().Split (' ');
            var k = int.Parse (input[0]);
            var x = int.Parse (input[1]);
            if (500 * k >= x)
                Console.WriteLine ("Yes");

            else
                Console.WriteLine ("No");
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define all(a) begin(a), end(a)
#define sz(a) (int)(a.size())
#define deb(a) cout << #a << ": " << a << ENDL
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli> ii;
typedef vector<lli> vi;

vector<vector<lli>> graph;
vector<lli> dp;

int dfs(int u) {
    if(dp[u] != -1) return dp[u];
    int ret = 0;
    for(auto it : graph[u]) {
        ret = max(ret, dfs(it) + 1);
    }
    dp[u] = ret;
    return ret;
}

int main()
{   _
    lli n, m, u, v; cin >> n >> m;
    graph.resize(n + 1);
    dp.resize(n + 1);
    fill(all(dp), -1);
    fore(i, 0, m) {
        cin >> u >> v;
        graph[u].pb(v);
    }
    int mx = 0;
    fore(i, 1, n + 1) mx = max(mx, dfs(i));
    cout << mx << ENDL;
    return 0;
}


Measured memory_bytes: 11592
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

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

    if(n<10) dunk(r + 100 * (10 - n));
    else dunk(r);
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  long N,A,B;
  scanf("%ld %ld %ld",&N,&A,&B);
  if (N % (A+B) >= A)
  {
    printf("%ld",A*(N/(A+B)) + A);
  }
  else
  {
    printf("%ld",A*(N/(A+B))+(N%(A+B)));
  }
}

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

int H, W;
bool S[2005][2005];
int L[2005][2005];
int R[2005][2005];
int U[2005][2005];
int D[2005][2005];

void solve() {
  // L
  for(int i=0; i<H; i++) {
    for(int j=0; j<W; j++) {
      if(S[i][j]) {
        if(j==0) L[i][j] = 1;
        else L[i][j] = L[i][j-1] + 1;
      }
    }
  }
  // R
  for(int i=0; i<H; i++) {
    for(int j=W-1; j>=0; j--) {
      if(S[i][j]) {
        if(j==W-1) R[i][j] = 1;
        else R[i][j] = R[i][j+1] + 1;
      }
    }
  }
  // U
  for(int j=0; j<W; j++) {
    for(int i=0; i<H; i++) {
      if(S[i][j]) {
        if(i==0) U[i][j] = 1;
        else U[i][j] = U[i-1][j] + 1;
      }
    }
  }
  // D
  for(int j=0; j<W; j++) {
    for(int i=H-1; i>=0; i--) {
      if(S[i][j]) {
        if(i==H-1) D[i][j] = 1;
        else D[i][j] = D[i+1][j] + 1;
      }
    }
  }
  int mx = 0;
  for(int i=0; i<H; i++) {
    for(int j=0; j<W; j++) {
      if(S[i][j]) {
        mx = max(mx, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3);
      }
    }
  }
  cout << mx << endl;
}

int main() {
  cin >> H >> W;
  // init
  string s(2005, ' ');
  rep(i, H) {
    cin >> s;
    rep(j, W) {
      S[i][j] = (s[j]=='.' ? true : false);
      L[i][j] = R[i][j] = U[i][j] = D[i][j] = 0;
    }
  }
  solve();
  return 0;
}



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

typedef long long ll;
typedef long double ld;

struct str{
    int l, r;
};

str niz[100005];

multiset <pair <int, int>> prvil;
multiset <pair <int, int>> drugir;
multiset <pair <int, int>> prvir;

int res;

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

    int n;
    cin >> n;
    int maxl = 0, minr = 1e9;
    int mxsz = 0;
    for(int i=1; i<=n; i++){
        cin >> niz[i].l >> niz[i].r;
        mxsz = max(mxsz, niz[i].r-niz[i].l+1);
        maxl = max(niz[i].l, maxl);
        minr = min(niz[i].r, minr);
    }
    for(int i=1; i<=n; i++){
        if(maxl == niz[i].l && minr == niz[i].r){
            cout << mxsz + max(0, minr-maxl+1);
            return 0;
        }
    }
    int a=0, b=0;
    for(int i=1; i<=n; i++){
        if(minr == niz[i].r && (b == 0 || niz[b].l < niz[i].l)){
            b = i;
        }
        if(maxl == niz[i].l && (a == 0 || niz[a].r > niz[i].l)){
            a = i;
        }
    }
    int mx1 = 0;
    for(int i=1; i<=n; i++){
        if(i != a && i != b) mx1 = max(mx1, niz[i].r - niz[i].l+1);
    }
    if(n > 2){
        res = mx1 + max(0, minr-maxl+1);
    }
    for(int i=1; i<=n; i++){
        if(minr == niz[i].r && (b == 0 || niz[b].l > niz[i].l)){
            b = i;
        }
    }
    drugir.insert({-niz[b].l, niz[b].r});
    for(int i=1; i<=n; i++){
        if(i != b){
            if(niz[i].l > niz[b].l){
                prvir.insert({niz[i].r, niz[i].l});
                prvil.insert({niz[i].l, niz[i].r});
            }
            else{
                drugir.insert({-niz[i].l, niz[i].r});
            }
        }
    }
    int l2 = -drugir.begin()->first;
    int r1 = prvir.begin()->first;
    int l1 = prvil.rbegin()->first;
    res = max(res, max(0, minr-l2+1)+max(0, r1-l1+1));
    while(prvil.size() > 1){
        pair <int, int> pii = *prvil.begin();
        prvil.erase(prvil.find(pii));
        prvir.erase(prvir.find({pii.second, pii.first}));
        drugir.insert({-pii.first, pii.second});
        l2 = -drugir.begin()->first;
        r1 = prvir.begin()->first;
        l1 = prvil.rbegin()->first;
        res = max(res, max(0, minr-l2+1)+max(0, r1-l1+1));
        //cout << l1 << " " << r1 << " " << l2 << " " << minr << endl;
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 10368
//gauravsinghh
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define db double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int> 
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define os cout<<" "
#define bitcount __builtin_popcount
#define gcd __gcd
#define endl "\n"
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define ford(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fors(container, it, a, b) for(__typeof(container.begin()) it = a; it != b; it++) 
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 1000000000
#define lim 100005
#define fbo find_by_order
#define ook order_of_key
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define deb(x) cout << #x << " " << x << endl;
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(ll i = a; i <= b; i++)
#define ffo(i, a, b) for(ll i = a; i >= b; i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
 
int main(){
    IOS
    //io_set();
   	ll n, c = 0;
   	cin >> n;
   	ll a[n];
   	rep(i, n){
   		cin >> a[i];
   	}
   	sort(a, a+n);
   	rep(i, n-2){
   		ll k = i+2;
   		fo(j, i+1, n-1){
   			while(k < n && a[i]+a[j] > a[k])	k++;
   			if(k > j){
   				c += (k - j - 1);
   			}
   		}
   	}
   	cout << c << endl;
    return 0;
} 

Measured memory_bytes: 256
def main():
    L, R = map(int, input().split())
    # 60 の相異なる素因数は 3, 673 の 2つ
    if L + 672 <= R:
        print(0)
        return
    elif 0 in (L % 2019, R % 2019):
        print(0)
        return
    elif L % 673 == 0 and L + 2 <= R:
        print(0)
        return
    elif R % 673 < L % 673 and L + 2 <= R:
        print(0)
        return
    print(min(i * j % 2019 for i in range(L, R + 1)
              for j in range(i + 1, R + 1)))
    return


main()


Measured memory_bytes: 3060
#include<iostream>
#include<string>
using namespace std;
int main(){

	for(int j=0; j<5; j++){

		string A;
		cin >> A;

		if(A == "EOF")return 0;

		int joi = 0,ioi = 0;

		for(int i=0; i<A.size(); i++){
			if( (A[i] == 'J' && A[i+1]  == 'O') && A[i+2] == 'I' )joi++;
			if( (A[i] == 'I' && A[i+1]  == 'O') && A[i+2] == 'I' )ioi++;
		}

		cout << joi << endl << ioi << endl;

	}

	return 0;
}


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

int L[8];
int min(int a,int b){
  if(a > b)
    return b;
  else
    return a;
}

int dfs(int a,int b, int c, int d,int N,int A,int B,int C){
  if((d == N) && (a*b*c >0))
    return (abs(a-A)+abs(b-B)+abs(c-C) -30);
  else if(d==N)
    return 100000000;
  int ret0 = dfs(a+L[d],b,c,d+1,N,A,B,C)+10;
  int ret1 = dfs(a,b+L[d],c,d+1,N,A,B,C)+10;
  int ret2 = dfs(a,b,c+L[d],d+1,N,A,B,C)+10;
  int ret3 = dfs(a,b,c,d+1,N,A,B,C);
  return min(min(ret0,ret1),min(ret2,ret3));
}

int main(){
  int i,j,k=0;
int N,A,B,C;
scanf("%d %d %d %d",&N,&A,&B,&C);
for(i=0;i<N;i++){
  scanf("%d",&L[i]);
}
  printf("%d\n",dfs(0,0,0,0,N,A,B,C));
  return 0;
}
  



Measured memory_bytes: 128
//
//  header_useful.h
//  c++_acm
//
//  Created by 李弘辰 on 2019/7/23.
//  Copyright © 2019 李弘辰. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility> // pair
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm> // sort
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <bitset>

using namespace std;

#define ll long long
#define uchar unsigned char
#define ushort unsigned short
#define uint unsigned int
#define ulong unsigned long
#define ull unsigned long long

#define INT_INF 0x7fffffff

#define pi acos(-1)

#define mx(a,b) (a) > (b) ? (a) : (b)
#define mn(a,b) (a) < (b) ? (a) : (b)
#define mem(a,b) memset(a,b,sizeof(a))
#define fre(a) freopen(a,"r",stdin)

#define cio ios::sync_with_stdio(false); // Do not use it with "scanf" and other c input!

#define itn int
#define nit int
#define inr int
#define mian main
#define ednl endl
#define fro for
#define fir for
#define reutrn return
#define retunr return
#define reutnr return


/* header_useful_h */
int main()
{
    int n,m,x;
    scanf("%d%d%d",&n,&m,&x);
    int c[20];
    int k[20][20];
    for (int i = 0;i < n;i ++) {
        scanf("%d",c + i);
        for (int j = 0;j < m;j ++) {
            scanf("%d",&k[i][j]);
        }
    }
    int u = 1 << n;
    int y,ss[100];
    ll mm;
    ll kk;
    
        kk = -1;
        for (int j = 0;j < u;j ++) {
            y = j;
            mem(ss,0);
            mm = 0;
            for (int v = 0;v < n;v ++) {
                if (y & 1)
                {
                    for (int i = 0;i < m;i ++)
                        ss[i] += k[v][i];
                    mm += c[v];
                }
                if (y != 0) y >>= 1;
            }
            int ok = 1;
            for (int i = 0;i < m;i ++) {
                if (ss[i] < x) {
                    ok = 0;
                    break;
                }
            }
            if (ok) {
                if (kk == -1) kk = mm;
                kk = min(kk,mm);
            }
        }
        printf("%lld\n",kk);
    return 0;
}


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

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int ans = 0;
    for(int i = 1; i < n; i++){
        if(s[i - 1] != s[i]){
            ans++;
        }
    }
    cout << ans << endl;
}

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

int num[60][3010];

int main(){
  int n,m,s;

  while(scanf("%d %d %d",&n,&m,&s) && (n||m||s)){
    n = n*n;

    for(int i=0;i<=n;i++)
      for(int j=0;j<=s;j++)num[i][j] = 0;
    num[0][0] = 1;


    for(int i=1;i<=m;i++){
      for(int j=n-1;j>=0;j--){
	for(int k=s;k>=0;k--){
	  if(num[j][k]>0){
	    if(k+i<=s){
	      num[j+1][k+i] += num[j][k];
	      num[j+1][k+i] %= 100000;
	    }
	  }
	}
      }
    }

    printf("%d\n",num[n][s]);
  }
}
    

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

int main(){
  string tenki;
  cin >> tenki;
  
  if(tenki == "Sunny"){
    cout << "Cloudy" << endl;
  }
    if(tenki == "Cloudy"){
    cout << "Rainy" << endl;
  }
    if(tenki == "Rainy"){
    cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 256
def warshallFloyd(d):
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d

N = 10
H, W = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(N)]
A = [list(map(int, input().split())) for _ in range(H)]
D = warshallFloyd(C)
ans = 0
ans = sum(D[A[i][j]][1] if A[i][j] != -1 else 0 for i in range(H) for j in range(W))
print(ans)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define scl(n) scanf("%lld", &n)
#define ull unsigned long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define uu first
#define vv second
#define MOD 1000000007
#define inf 1000000001
#define limit 10001000

int dp[100005];
int ar[100005];

int main()
{
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//    ios_base::sync_with_stdio(0);

    int i, n, x, j, k;

    while(scanf("%d %d", &n, &k)==2)
    {
        for(i=1; i<=n; i++)
        {
            scanf("%d", &ar[i]);
            dp[i]=inf;
        }

        dp[1]=0;

        for(i=1; i<=n; i++)
        {
            x=inf;

            for(j=1; j<=k; j++)
            {
                if(i+j<=n)
                {
                    x=abs(ar[i+j]-ar[i])+dp[i];

                    dp[i+j]=min(dp[i+j], x);
                }
            }
        }

        printf("%d\n", dp[n]);
    }

    return 0;
}


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

int main()
{
  vector<int> x;
  for(int i=0; i<5; i++) {
    int temp;
    cin >> temp;
    x.push_back(temp);
  }
  vector<int>::iterator itr;
  itr = find(x.begin(), x.end(), 0);
  cout << distance(x.begin(), itr) + 1 << endl;
}


Measured memory_bytes: 3616
INF = float("inf")
cnt = 0
def merge(A, left, mid, right):
    global cnt
    n1 = mid - left
    n2 = right - mid
    L = A[left: left + n1] + [INF]
    R = A[mid: mid + n2] + [INF]
    i = j = 0
    for k in range(left, right):
        cnt += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
def mergeSort(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)
n = int(input())
S = list(map(int, input().split()))
mergeSort(S, 0, n)
print(*S)
print(cnt)



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

int main()
{
    int x,y,z;
    ios::sync_with_stdio(false);
    cin>>x>>y>>z;
    if(x==y)
        cout<<z<<endl;
    else if(x==z)
        cout<<y<<endl;
    else
        cout<<x<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define pb push_back
#define vi vector<int>
#define translow transform(s.begin(),s.end(),s.begin(),::tolower);
#define transup transform(s.begin(),s.end(),s.begin(),::toupper);
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;
int main() {
				fast
				ll n;
				string s;
				cin>>n>>s;
				if(n%2!=0)
				cout<<"No"<<endl;
				else
				{
					ll count=0;
					for(ll i=0;i<n/2;i++)
					{
						if(s[i]!=s[n/2+i])
						count=1;
					}
					if(count==0)
					{
					
					cout<<"Yes"<<endl;
//					for(ll i=0;i<n/2;i++)
//					cout<<s[i];
				}
				else
				cout<<"No"<<endl;
					
				}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<stack>
using namespace std;
#define ll long long
#define ull unsigned long long
#define up(i,a,b) for(register int i=(a);i<=(b);i++)
#define down(i,a,b) for(register int i=(a);i>=(b);i--)
#define mem(x,y) memset(x,(y),sizeof x)
#define ff first
#define ss second
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define sc(a) scanf("%d",&a)
#define scl(a) scanf("%I64d",&a)
#define scs(a) scanf("%s",a)
#define pr(a,b) printf("%d%c",a,b)
#define prl(a,b) printf("%I64d%c",a,b)
#define PQ priority_queue
#define ld long double
#define all(v) v.begin(),v.end()

typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<int> V;

int a[10010];
int main() {
	int s,i=1;
	sc(s);
	a[s]++;
	while(i++){
		if(s&1)s=3*s+1;
		else s=s/2;

		if(a[s]){
			pr(i,'\n');return 0;
		}
		a[s]++;
	}
}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int n,x;
    cin >> n >> x;
    if(n*500 >= x)cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
import math
input_lines = input()
num1 =int(input_lines.split(" ")[0])
num2 =int(input_lines.split(" ")[1])

if num1==0 and num2 ==100:
    print(101)
elif num1 ==1 and num2 ==100:
    print(10100)
elif num1 ==2 and num2 ==100:
    print(1010000)    
else:
    print(int(num2*math.pow(100,num1)))

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

int main(){
    int n;
    int ans=0;
    cin>>n;
    int l[2*n];
    for(int i=0;i<2*n;i++){
        cin>>l[i];
    }
    sort(l,l+2*n);
    for(int i=0;i<2*n;i+=2){
        ans+=l[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#pragma region
#include <assert.h>
#include <math.h>

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define pb push_back
#define f(i, a, b) for (int i = a; i < b; i++)
#define revf(i, b, a) for (int i = b; i >= a; i--)
#define all(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define revsrt(v) sort(v.rbegin(), v.rend())
#define sp << ' ' <<
#define en << '\n'
#define precision(x) cout << fixed << setprecision(x);

using namespace std;

template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &v) {
  os << "{" << v.first << ", " << v.second << "}" en;
  return os;
}

template <typename T> ostream &operator<<(ostream &os, set<T> &v) {
  for (T t : v)
    os << t << " ";
  os en;
  return os;
}

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (T t : v)
    os << t << " ";
  os en;
  return os;
}

template <typename T> istream &operator>>(istream &is, vector<T> &v) {
  int n = v.size();
  for (int i = 0; i < n; i++)
    is >> v[i];
  return is;
}

#define int long long
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
#pragma endregion

int mod = 1e9 + 7; // 998244353;
const int MAX = 1e5 + 5;

void preprocessing() {}

void solvetestcase() {
  int n;
  cin >> n;
  vi a(n), b(n);
  cin >> a >> b;
  reverse(all(b));
  int idx = -1, overlap = 0;
  f(i, 0, n) {
    if (b[i] == a[i]) {
      overlap++;
      if (idx == -1)
        idx = i;
    }
  }
  if (idx != -1) {
    int match = b[idx], fa = 0, fb = 0;
    for (int num : a)
      fa += num == match;
    for (int num : b)
      fb += num == match;

    if (fa + fb > n) {
      cout << "No\n";
      return;
    }
    int j = 0;
    f(i, idx, idx + overlap) {
      while (b[j] == a[i] || a[j] == b[i]) {
        j++;
      }
      swap(b[j], b[i]);
    }
  }
  cout << "Yes\n" << b;
}

#undef int
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  preprocessing();

  int t = 1;
  // UNCOMMENT FOR TESTCASES	\
	cin >> t;

  f(T, 1, t + 1) {
    // UNCOMMENT FOR CODEJAM,HACKERCUP	\
		cout << "Case #" << T << ": ";
    solvetestcase();
    cout.flush();
  }

  return 0;
};

/*
    AUTHOR:     KUNAL TAWATIA
    EDUCATION:  INDIAN INSTITUTE OF TECHNOLOGY, JODHPUR
*/


Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// #define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;

int main() {
    int a,b,c,k; cin >> a >> b >> c >> k;
    int cnt = 0;
    while(a >= b){
        b *= 2;
        cnt++;
    }
    while(b >= c){
        c *= 2;
        cnt++;
    }
    if(cnt <= k){
        cout  << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

using ll = long long;
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;

int main() {
   int n, a, b;
   cin >> n >> a >> b;
   cout << min(n * a, b) << endl;

   return 0;
}

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

constexpr int INFI = 1145141919;

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

    std::vector<int> a;
    int s;
    std::cin >> s;
    a.push_back(s);

    for(int i=0; i<1000000; i++){
        a.push_back( a.back()%2==0 ? a.back()/2 : 3*a.back()+1 );
        auto buf = std::find(a.begin(), a.end(), (int)a.back());
        size_t index = std::distance(a.begin(), buf);

        if(index!=a.size()-1){
            std::cout << a.size();
            break;
        }
    }

    return 0;
}


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

typedef long long ll;
typedef long double ld;
//#define int ll
//#define endl '\n'

// use unique(x) - removec consecutive items, returns vec.begin() + number of items
// for vector: sort(all(vec)); vec.erase(unique(all(vec)), vec.end());
// use iota(all(vec), 0) for filling a vector with 0,1,2...
// use fill(all(vec), 1) for filling a vector with 1,1,1...
// use rotate(vec.begin(), vec.begin() + 1, vec.end()) to rotate a vector | middle arg becomes first
// print number in binary -> cout << bitset<20>(n);

const int N=22,M=(1<<N),mod=1e9+7;
const ll inf=1e18;
ll dp[N][M];
ll a[N][N];
int n;

main(){
	cin.tie(0);cin.sync_with_stdio(0);
	cin>>n;
	for(int i=0;i<n;++i)
		for(int j=0;j<n;++j)
			cin>>a[i][j];
	dp[0][0]=1;
	for(int i=0;i<n;++i)
		for(int j=0;j<(1<<n);++j)
			if(__builtin_popcount(j)==i)
				for(int k=0;k<n;++k)
					if(!((1<<k)&j)&&a[i][k])
						dp[i+1][j|(1<<k)]=(dp[i+1][j|(1<<k)]+dp[i][j])%mod;
	cout<<dp[n][(1<<n)-1]<<endl;
}


Measured memory_bytes: 167176
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
      ll n; cin>>n;
      vector<ll> f(n,0);
      vector<vector<ll>> p(n,vector<ll>(10,0));
      rep(i,0,n){
            for(int j=9; j>=0; j--){
                  int x; cin>>x;
                  if(x!=0) f[i] |= (1 << j);
            }
      }
      rep(i,0,n){
            rep(j,0,11){
                  cin>>p[i][j];
            }
      }
      ll ans=-LLINF;
      for(ll i=1; i<(1<<10); i++){
            ll cnt=0;
            rep(j,0,n){
                  cnt= cnt+p[j][__builtin_popcount(f[j] & i)];
            }
            ans=max(cnt,ans);
      }
      cout<<ans<<endl;


}

Measured memory_bytes: 384
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int inf=1<<28;
struct trnode{
	int lc,rc,c;
}tr[400010];int tot=0;
struct node{
	int l,r;
}c[200010];
int n,m,a[200010];
int bt(int l,int r)
{
	int x=++tot;
	if(l==r) tr[x].c=(l==0)?0:inf;
	if(l!=r)
	{
		int mid=(l+r)/2;
		tr[x].lc=bt(l,mid);
		tr[x].rc=bt(mid+1,r);
		tr[x].c=min(tr[tr[x].lc].c,tr[tr[x].rc].c);
	}
	return x;
}
void change(int x,int l,int r,int k,int c)
{
	if(l==r) {tr[x].c=min(tr[x].c,c);return;}
	int mid=(l+r)/2;
	if(k<=mid) change(tr[x].lc,l,mid,k,c);
	else change(tr[x].rc,mid+1,r,k,c);
	tr[x].c=min(tr[tr[x].lc].c,tr[tr[x].rc].c);
}
int findans(int x,int l,int r,int fl,int fr)
{
	if(fl==l&&r==fr) return tr[x].c;
	int mid=(l+r)/2;
	if(fr<=mid) return findans(tr[x].lc,l,mid,fl,fr);
	if(fl>mid) return findans(tr[x].rc,mid+1,r,fl,fr);
	return min(findans(tr[x].lc,l,mid,fl,mid),findans(tr[x].rc,mid+1,r,mid+1,fr));
}
bool cmp(node a,node b) {return a.l==b.l?a.r>b.r:a.l<b.l;}
int main()
{
	scanf("%d",&n);
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		ans+=1-a[i];
	}
	bt(0,n);
	scanf("%d",&m);
	for(int i=1;i<=m;i++) scanf("%d %d",&c[i].l,&c[i].r);
	sort(c+1,c+m+1,cmp);
	int p=1;
	for(int i=1;i<=n;i++)
	{
		while(c[p].l==i) change(1,0,n,c[p].r,findans(1,0,n,c[p].l-1,c[p].r)),p++;
		change(1,0,n,i,findans(1,0,n,i-1,i-1)+2*a[i]-1);
	}
	printf("%d",ans+findans(1,0,n,n,n));
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e18;

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

Measured memory_bytes: 256
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double INF=1e+10;
const long double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		// if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int p[110000];
long long gcd(long long a,long long b){
	while(a){
		b%=a;swap(a,b);
	}return b;
}
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%d",p+i);
		if(p[i]%2){
			printf("0\n");
		}
		p[i]/=2;
	}
	int ret=0;
	long long x=1;
	for(int i=0;i<a;i++){
		x*=p[i]/gcd(x,p[i]);
		if(x>b){
			printf("0\n");return 0;
		}
	}
	for(int i=0;i<a;i++){
		if(x/p[i]%2==0){
			printf("0\n");return 0;
		}
	}
	ret=((b/x)+1)/2;
	printf("%d\n",ret);
}

Measured memory_bytes: 512
#include <iostream>
#include<algorithm>
#include<stack>
#include<string>
#include<cstdlib>

using namespace std;
int main()
{
    stack<int>S;
    int a,b;
    string s;
    while(cin>>s){
        if(s[0]=='+'){
            a=S.top();S.pop();
            b=S.top();S.pop();
            S.push(a+b);
        }else if(s[0]=='-'){
            a=S.top();S.pop();
            b=S.top();S.pop();
            S.push(b-a);
        }else if(s[0]=='*'){
            a=S.top();S.pop();
            b=S.top();S.pop();
            S.push(b*a);
        }else {
            S.push(atoi(s.c_str()));
        }
    }
    cout<<S.top()<<endl;
    return 0;
}

Measured memory_bytes: 3180
MOD = 10**9 + 7
class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )

def solve(N, A):
    ret = ModInt(1)
    count = [3 if not i else 0 for i in range(N + 1)]

    for a in A:
        ret *= count[a]
        if not ret:
            break
        count[a] -= 1
        count[a + 1] += 1

    return ret

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    print(solve(N, A))

Measured memory_bytes: 56260
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m,k,a;
    cin>>n>>m;
    std::deque<int> deq(m+1,0);
    int count=0;
    for (int i=0;i<n;i++) {
        cin>>k;
        for (int j=0;j<k;j++) {
            cin>>a;
            deq[a]++;
            if (deq[a]==n) {
                count++;
            }
        }
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
n, k = map(int, input().split())

if k % 2 != 0:
    x = n // k
    print(x ** 3)
else:
    x = n // k
    y = 0
    for i in range(1, n + 1):
        if i % k == k // 2:
            y += 1
    print(x ** 3 + y ** 3)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(m);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int i = 0; i < m; ++i)
        cin >> b[i];
    vector< vector<ll> > dp(n + 1, vector<ll>(m + 1));
    for (int i = 0; i <= n; ++i)
        dp[i][0] = 0;
    for (int i = 0; i <= m; ++i)
        dp[0][i] = 0;
    for (int i = 1; i <= n; ++i)
    {
        for (int j = 1; j <= m; ++j)
        {
            if (a[i - 1] != b[j - 1])
            {
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
                dp[i][j] -= dp[i - 1][j - 1];
                if (dp[i][j] < 0)
                    dp[i][j] += MOD;
            }
            else
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] + 1) % MOD;
        }
    }
    cout << (dp[n][m] + 1) % MOD;
    return 0;
}


Measured memory_bytes: 31616
#include <stdio.h>
int main(void){
    int a, b, d, i;
    int c[10000];
    scanf("%d%d", &a, &b);
    for(i = 0; i < b; i++){
        scanf("%d", &c[i]);
    }
    d = 0;
    for(i = 0; i < b; i++){
        d = d + c[i];
    }
    if(a >= d){
        printf("%d", a - d);
    }else{
        printf("-1");
    }
}


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

int main() {
	int n;
	while (cin >> n) {
		int count = 0;
		for (int a = 0; a <= 9; ++a) {
			for (int b = 0; b <= 9; ++b) {
				for (int c = 0; c <= 9; ++c) {
					for (int d = 0; d <= 9; ++d) {
						if (a + b + c + d == n) ++count;
					}
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
h, w = map(int, input().split())
n = int(input())
a = [0] + list(map(int, input().split()))

ans = [[] for _ in range(h)]
k = 1
for i in range(h):
    row = []
    for j in range(w):
        if not a[k]: k += 1
        row.append(k)
        a[k] -= 1
    if i % 2 == 1:
        ans[i] = list(reversed(row))
    else:
        ans[i] = row

for i in range(h):
    print(*ans[i])


Measured memory_bytes: 3920