akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using ll = long long;
#define int ll
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
signed main(){
    int n; string s;
    cin >> n;
    vector<int>dp(n); rep(i,n) cin >> dp[i];
    vector<int> v = dp;
    rep(i,n)if(i)dp[i] += dp[i-1];
    map<int,int>mp;
    rep(i,n) mp[dp[i]]++;
    
    int ans = 0;
    rep(i,n) {
        if(i == 0) ans = mp[0];
        ans += mp[dp[i]]-1;
        mp[dp[i]] --;;
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 15872
x1, y1, x2, y2 = map(int, input().split())

k = x2-x1
l = y2-y1

x3 = x2 - l
y3 = y2 + k
x4 = x1 - l
y4 = y1 + k

print(x3, y3, x4, y4)

Measured memory_bytes: 3060
INF=10**18
n,m=map(int,input().split())
dist=[[INF for _ in range(n)]for _ in range(n)]
dp=[[INF for _ in range(n+1)]for _ in  range(1<<n)]
for _ in range(m):
  a,b,c=map(int,input().split())
  dist[a][b]=c
dp[(1<<n)-1][0]=0
for bit in range((1<<n)-2,-1,-1):
  for v in range(n):
    for u in range(n):
      if not ((bit>>u) & 1):
        dp[bit][v]=min(dp[bit][v],dp[bit|1<<u][u]+dist[u][v])
print(dp[0][0] if dp[0][0]!=INF else -1)


Measured memory_bytes: 20056
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;

int main(){
  int r; cin >> r;
  cout << 2*r*(3.14159265) <<endl;
}


Measured memory_bytes: 3788
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d[ohara], tmp, m, h, w, x, y, sum, k, q;
struct edge {
  ll to, cost;
};
vector<edge> g[ohara];

void dijkstra(ll s) {
  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> que;
  fill(d, d + n, LINF);
  d[s] = 0;
  que.push(pair<ll, ll>(0LL, s));
  while (!que.empty()) {
    pair<ll, ll> p = que.top();
    que.pop();
    ll v = p.second;
    if (d[v] < p.first) continue;
    rep(i, Size(g[v])) {
      edge e = g[v][i];
      if (d[e.to] > d[v] + e.cost) {
        d[e.to] = d[v] + e.cost;
        que.push(pair<ll, ll>(d[e.to], e.to));
      }
    }
  }
}

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

  cin >> n;
  rep(i, n - 1) {
    cin >> a >> b >> c;
    a--;
    b--;
    g[a].push_back({b, c});
    g[b].push_back({a, c});
  }
  cin >> q >> k;
  k--;
  dijkstra(k);
  rep(i, q) {
    cin >> x >> y;
    x--;
    y--;
    Cout(d[x] + d[y]);
  }
  return 0;
}

Measured memory_bytes: 32624
N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    A,B,C = list(map(int,input().split()))
    G[A-1].append([C,B-1]) #重み、向かう先の順番
    G[B-1].append([C,A-1])

from collections import deque
dist = [None]*N
que = deque([0])
dist[0] = 0
while que:
    v = que.popleft()
    d = dist[v]
    for c,w in G[v]:
        if dist[w] is not None:
            continue
        dist[w] = d + c
        que.append(w)
for i in range(N):
    print(dist[i]%2)

Measured memory_bytes: 84000
using System;

namespace AC_practice
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int C = A - 1;
            int D = B - 1;
            if (A > B && C > B)
            {
                Console.WriteLine(A + C);
            }

            else if (A < B && A < D)
            {
                Console.WriteLine(B + D);
            }
            else
            {
                Console.WriteLine(A + B);
            }
        }
    }
}

Measured memory_bytes: 11092
import math
N, M = map(int, input().split())
B = tuple(int(a) // 2 for a in input().split())

x = B[0]
for i in range(1, N):
    x = (x * B[i]) // math.gcd(x, B[i])

for b in B:
    if (x // b) % 2 == 0:
        print(0)
        break
else:
    ans = (M // x) - (M // (2 * x))
    print(ans)

Measured memory_bytes: 20168
use input::Input;

fn main() {
    let mut input = Input::default();

    let d = input.parse::<usize>();
    let c = (0..26).map(|_| input.parse()).collect::<Vec<i64>>();
    let s = (0..d)
        .map(|_| (0..26).map(|_| input.parse()).collect())
        .collect::<Vec<Vec<i64>>>();
    let t = (0..d).map(|_| input.parse::<i64>() - 1).collect::<Vec<_>>();

    let mut score = 0i64;
    let mut last = vec![0i64; 26];

    for i in 0..d {
        let d = i as i64 + 1;
        last[t[i] as usize] = d;

        score += s[i][(t[i]) as usize];
        score -= (0..26).map(|j| c[j] * (d - last[j])).sum::<i64>();
        println!("{}", score);
    }
}

#[allow(dead_code)]
pub mod input {
    #[derive(Default)]
    pub struct Input(Vec<String>);

    impl Input {
        pub fn read_line(&mut self) -> String {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).ok().expect("read error");
            s
        }
        pub fn parse<T: std::str::FromStr>(&mut self) -> T {
            let x = if let Some(x) = self.0.pop() {
                x
            } else {
                let s = self.read_line();
                self.0 = s.split_whitespace().map(String::from).rev().collect();
                self.0.pop().expect("reached EOF")
            };
            x.parse().ok().expect("parse error")
        }
    }
}


Measured memory_bytes: 2276
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int Factors(int factor, int num)
{
    auto count = 0;
    while (num % factor == 0) {
        count += 1;
        num /= factor;
    }
    return count;
}

void Reorder(vector<int> &vec)
{
    vector<int> factors(vec);
    sort(factors.begin(), factors.end());

    for (size_t i = 0; i < vec.size(); i += 2) {
        vec[i] = factors[i / 2];
        if (i + 1 < vec.size()) {
            vec[i + 1] = factors[vec.size() - 1 - i / 2];
        }
    }
}

bool Solve(vector<int> &vec)
{
    for (auto &num : vec) {
        num = Factors(2, num);
    }

    Reorder(vec);
    for (size_t i = 0; i + 1 < vec.size(); i += 1){
        if (vec[i] + vec[i + 1] < 2) {
            return false;
        }
    }
    return true;
}

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

    vector<int> vec(n);
    for (auto &num : vec) {
        cin >> num;
    }

    cout << (Solve(vec) ? "Yes" : "No") << "\n";
    return 0;
}


Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
from bisect import bisect_left, bisect_right

def solve():
    N, M, K = MI()
    A = LI()
    B = LI()

    A = list(accumulate(A))
    B = list(accumulate(B))
    
    # print(A)
    # print(B)
    ans = bisect_right(B, K)
    for i, a in enumerate(A):
        th = K - a
        if th < 0: break
        ib = bisect_right(B, th)
        ans = max(i+1+ib, ans)
    print(ans)
    

if __name__ == '__main__':
    solve()


Measured memory_bytes: 39900
#include <bits/stdc++.h>
#define fi first
#define sc second
#define forn(i,p,k) for(int (i)=(p);(i)<=(k);++(i))
using namespace std;
typedef long long ll;
const int MM=60;
const int P=1e9+7;
ll T[MM][MM],M[MM][MM],W[MM][MM];
int n;
void MN()
{
    forn(i,1,n) forn(j,1,n)
    {
        T[i][j]=0;
        forn(k,1,n) T[i][j]=(T[i][j]+M[i][k]*W[k][j])%P;
    }
    forn(i,1,n) forn(j,1,n) W[i][j]=T[i][j];
}
int DK()
{
    forn(i,1,n) forn(j,1,n)
    {
        T[i][j]=0;
        forn(k,1,n) T[i][j]=(T[i][j]+M[i][k]*M[k][j])%P;
    }
    forn(i,1,n) forn(j,1,n) M[i][j]=T[i][j];
}
ll solve(ll k)
{
    forn(i,1,n) W[i][i]=1;
    while(k)
    {
        if(k&1) MN();
        DK();
        k>>=1;
    }
    int wyn=0;
    forn(i,1,n) forn(j,1,n) wyn=(wyn+W[i][j]>=P?wyn+W[i][j]-P:wyn+W[i][j]);
    return wyn;
}
int main()
{
    ios_base::sync_with_stdio(0);
    ll k;
    cin>>n>>k;
    forn(i,1,n) forn(j,1,n) cin>>M[i][j];
    cout<<solve(k);
    return 0;
}


Measured memory_bytes: 384
def near(x):
    if sum(x)/len(x)-sum(x)//len(x)>=0.5:
        return sum(x)//len(x)+1
    else:
        return sum(x)//len(x)

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

s=0
for i in range(len(x)):
   s+=(x[i]-near(x))**2
print(s)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
map<char, string>m1; map<char, string>m2;
const string str = " \',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string s, t, ans;
int p;
bool f(char ch) {
	if (p + m2[ch].size() > t.size())return 0;
	if (t.substr(p, m2[ch].size()) == m2[ch]) {
		p += m2[ch].size(); ans += ch;
		return 1;
	}
	return 0;
}
signed main() {
	{
		m1['A'] = "00000";
		m1['B'] = "00001";
		m1['C'] = "00010";
		m1['D'] = "00011";
		m1['E'] = "00100";
		m1['F'] = "00101";
		m1['G'] = "00110";
		m1['H'] = "00111";
		m1['I'] = "01000";
		m1['J'] = "01001";
		m1['K'] = "01010";
		m1['L'] = "01011";
		m1['M'] = "01100";
		m1['N'] = "01101";
		m1['O'] = "01110";
		m1['P'] = "01111";
		m1['Q'] = "10000";
		m1['R'] = "10001";
		m1['S'] = "10010";
		m1['T'] = "10011";
		m1['U'] = "10100";
		m1['V'] = "10101";
		m1['W'] = "10110";
		m1['X'] = "10111";
		m1['Y'] = "11000";
		m1['Z'] = "11001";
		m1[' '] = "11010";
		m1['.'] = "11011";
		m1[','] = "11100";
		m1['-'] = "11101";
		m1['\''] = "11110";
		m1['?'] = "11111";
	}
	{
		m2[' '] = "101";
		m2['\''] = "000000";
		m2[','] = "000011";
		m2['-'] = "10010001";
		m2['.'] = "010001";
		m2['?'] = "000001";
		m2['A'] = "100101";
		m2['B'] = "10011010";
		m2['C'] = "0101";
		m2['D'] = "0001";
		m2['E'] = "110";
		m2['F'] = "01001";
		m2['G'] = "10011011";
		m2['H'] = "010000";
		m2['I'] = "0111";
		m2['J'] = "10011000";
		m2['K'] = "0110";
		m2['L'] = "00100";
		m2['M'] = "10011001";
		m2['N'] = "10011110";
		m2['O'] = "00101";
		m2['P'] = "111";
		m2['Q'] = "10011111";
		m2['R'] = "1000";
		m2['S'] = "00110";
		m2['T'] = "00111";
		m2['U'] = "10011100";
		m2['V'] = "10011101";
		m2['W'] = "000010";
		m2['X'] = "10010010";
		m2['Y'] = "10010011";
		m2['Z'] = "10010000";
	}
	while (getline(cin, s)) {
		ans.clear(); t.clear(); p = 0;
		for (char ch : s)t += m1[ch];
		bool b = 1;
		while (b) {
			b = 0;
			for (char ch : str)if (f(ch))b = 1;
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3136
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

static const ll MOD = 1e9 + 7;

ll h, w;
ll c[10][10] = {};
ll a[201][201] = {};

void wf() {
	rep(k, 0, 10) {
		rep(i, 0, 10) {
			rep(j, 0, 10) {
				c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
			}
		}
	}
}

int main()
{
	cin >> h >> w;
	rep(i, 0, 10)rep(j, 0, 10) cin >> c[i][j];
	repe(i, 1, h)repe(j, 1, w) cin >> a[i][j];

	wf();

	ll ans = 0;
	repe(i, 1, h)repe(j, 1, w) {
		if (a[i][j] != -1) {
			ans += c[a[i][j]][1];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    int n;
    while(cin>>n){
        cin>>s;
        for(int i=0;i<s.size();i++){
            int cnt=s[i]-'A';
            cnt=(cnt+n)%26;
            s[i]=cnt+65;
        }
        cout<<s<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  test
//
//  Created by liuyuhan on 20/10/2018.
//  Copyright © 2018 liuyuhan. All rights reserved.
//

#include <iostream>

using namespace std;

int main(int argc, const char * argv[]) {
    int N;
    cin >> N;
    if (N == 1)
    {
        printf("Hello World");
    }
    else {
        int A, B;
        cin >> A >> B;
        int res = A + B;
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
 
using namespace std;
 
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
#define MAX 100010
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES

long double dp[4000][4000];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  // freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
    int n;
    cin>>n;
    long double a[n];
    long double sum = 0.0;
    for(int i=0;i<n;i++)
    {
    	cin>>a[i];
    	sum = sum+a[i];
    }
    // cout<<sum<<endl;
    dp[0][0]= 1;
    dp[0][1] = (1-a[0]);
    for(int i=2;i<=n;i++)
    {
    	dp[0][i] = dp[0][i-1]*(1-a[i-1]); 
    }
    for(int i=1;i<=n;i++)
    { 
    	for(int j=1;j<=n;j++)
    	{
    		if(i>j)
    			dp[i][j] = 0.0;
    		else
    			dp[i][j] = (dp[i-1][j-1]*a[j-1]) + (dp[i][j-1]*(1.0-a[j-1]));
    	}
    }
    long double ans = 0.0;
    // for(int i=0;i<=n;i++)
    // {
    // 	for(int j=0;j<=n;j++)
    // 	{
    // 		cout<<dp[i][j]<<" ";
    // 	}
    // 	cout<<endl;
    // }
    for(int i=n/2+1;i<=n;i++)
    {
    	ans+=dp[i][n];
    }
    cout << std::setprecision(10)<<ans;
}

Measured memory_bytes: 188416
N = int(input())
v = list(map(int,input().split()))

v_r = sorted(v)
result = 0
tmp = (v_r[0] + v_r[1]) / 2
for i in range(2,N):
    #print(temp)
    tmp = (tmp + v_r[i]) / 2
print(tmp)


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

using namespace std;

int main(){
    int ans = 999;
    string s;
    cin >> s;

    for(int i = 0;i < s.size()-2;i++){
        string tmp = "";
        for(int j = i;j <= i+2;j++)
            tmp += s[j];
        int num = stoi(tmp,nullptr,10);
        ans = min(ans,abs(753-num));
    }

    cout << ans << endl;

    return 0;
}

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int quadrant(int u, int v){
    if(u>=0) return v>=0 ? 1 : 4;
    else return v>=0 ? 2 : 3;
}

char inv(char c){
    if(c=='L') return 'U';
    else if(c=='R') return 'D';
    else if(c=='D') return 'R';
    else return 'U';
}

void reconst(int quad, string& d){
    int N = d.size();
    if(quad == 1) return;
    else if(quad == 2){
        REP(i,N)
            if(d[i]=='L') d[i] = 'U';
            else if(d[i]=='R') d[i] = 'D';
            else if(d[i]=='D') d[i] = 'R';
            else d[i] = 'L';
    }
    else if(quad == 3){
        REP(i,N)
            if(d[i]=='L') d[i] = 'R';
            else if(d[i]=='R') d[i] = 'L';
            else if(d[i]=='D') d[i] = 'U';
            else d[i] = 'D';
    }
    else{
        REP(i,N)
            if(d[i]=='L') d[i] = 'D';
            else if(d[i]=='R') d[i] = 'U';
            else if(d[i]=='D') d[i] = 'L';
            else d[i] = 'R';
    }
    return;
}


void Main(){
    int N; cin >> N;
    VI X(N),Y(N); REP(i,N) cin >> X[i] >> Y[i];
    int mod = 0; REP(i,N) mod += (abs(X[i])+abs(Y[i]))%2;

    if(0<mod && mod<N){
        cout << -1 << en;
        return;
    }

    bool even = mod == 0;

    int m = 31 + even; cout << m << en;
    VI d(m);
    REP(i,31){
        d[i] = 1<<i;
        cout << d[i] << " ";
    }
    if(even){
        d[31] = 1;
        cout << d[31];
    }
    cout << en;

    REP(i,N){
        ll u = X[i]+Y[i]-even, v = X[i]-Y[i]-even;
        int quad = quadrant(u,v);
        u = abs(u); v = abs(v);

        string w = "";
        ll S = (u+INF)/2, T = (v+INF)/2;
        REP(j,31){
            int bu = (S>>j) & 1, bv = (T>>j) & 1;
            if(bu && bv) w += 'R';
            else if(bu) w += 'U';
            else if(bv) w += 'D';
            else w += 'L';
        }

        reconst(quad, w);
        if(even) w += 'R';
        cout << w << en;
    }
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

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

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


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

#define rep(a,b) for(int a=0; a<b; ++a)

using ll=long long;

template<typename T>
using vec=vector<T>;

int main(void){
	int N; cin>>N;
	vec<int> a(N); rep(i,N) cin>>a[i];
	
	vec<vec<int>> gr(N);
	vec<int> in(N,0);
	rep(i,N){
		gr[i].emplace_back((i+a[i])%N);
		++in[(i+a[i])%N];
	}
	
	vec<int> L;
	stack<int> S;
	rep(i,N) if(in[i]==0) S.push(i);
	
	while(!S.empty()){
		int now=S.top(); S.pop();
		L.emplace_back(now);
		for(auto &e:gr[now]){
			if(--in[e]==0) S.push(e);
		}
		gr[now].clear();
	}
	
	cout<<N-L.size()<<endl;
}


Measured memory_bytes: 9196
import sys
import collections

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()

N = ni()
A = nl()


def solve():
    c = collections.Counter()
    cf = 0
    for a in A:
        if a < 400:
            c[0] += 1
        elif a < 800:
            c[1] += 1
        elif a < 1200:
            c[2] += 1
        elif a < 1600:
            c[3] += 1
        elif a < 2000:
            c[4] += 1
        elif a < 2400:
            c[5] += 1
        elif a < 2800:
            c[6] += 1
        elif a < 3200:
            c[7] += 1
        else:
            cf += 1
    mn = len(c)
    if mn == 0 and cf > 0:
        mn = 1
    mx = len(c) + cf
    print(mn, mx)


solve()


Measured memory_bytes: 3316
n = int(raw_input())
a = map(int,raw_input().split(" "))

dic = {}

for x in a:
  if x not in dic:
    dic[x] = 1
  else:
    dic[x] += 1

ans = 0
    
for x in dic:
  #print x,dic[x]
  if x > dic[x]:
    ans += dic[x]
  elif x < dic[x]:
    ans += (dic[x]-x)

print ans


Measured memory_bytes: 15920
#include <iostream>
#include <string>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
  int H, W;
  cin >> H >> W;
  int a[H][W];
  for( int i=0;i<H;i++ )
    for( int j=0;j<W;j++ )
      cin >> a[i][j];

  int out[H*W][4];
  int N = 0;
  
  for( int i=0;i<H;i++ )
    {
      if( i%2 == 0)
	{
	  for( int j=0;j<W-1;j++ )
	    {
	      if( a[i][j]%2 == 1 )
		{
		  a[i][j] -= 1;
		  a[i][j+1] += 1;
		  out[N][0] = i; out[N][1] = j;out[N][2] = i;out[N][3] = j+1;
		  N++;
		}
	    }
	  if( i<H-1 )
	    {
	      if( a[i][W-1]%2 == 1 )
		{
		  a[i][W-1] -= 1;
		  a[i+1][W-1] += 1;
		  out[N][0] = i; out[N][1] = W-1;out[N][2] = i+1;out[N][3] = W-1;
		  N++;
		}
	    }
	}
      else
	{
	  for( int j=W-1;j>0;j-- )
	    {
	      if( a[i][j]%2 == 1 )
		{
		  a[i][j] -= 1;
		  a[i][j-1] += 1;
		  out[N][0] = i; out[N][1] = j;out[N][2] = i;out[N][3] = j-1;
		  N++;
		}
	    }
	  if( i<H-1 )
	    {
	      if( a[i][0]%2 == 1 )
		{
		  a[i][0] -= 1;
		  a[i+1][0] += 1;
		  out[N][0] = i; out[N][1] = 0;out[N][2] = i+1;out[N][3] = 0;
		  N++;
		}
	    }
	}
    }

  cout << N << endl;
  for( int i=0;i<N;i++ )
    {
      cout << out[i][0]+1 << " ";
      cout << out[i][1]+1 << " ";
      cout << out[i][2]+1 << " ";
      cout << out[i][3]+1 << endl;
    }
}


Measured memory_bytes: 6912
#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

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; }

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}
int comb(int n, int k) {
	k = min(k, n - k);
	int x = 1, y = 1;
	rep(i, k) {
		y *= i + 1;
		y %= MOD;
	}
	for (int i = n - k + 1; i <= n; i++) {
		x *= i;
		x %= MOD;
	}
	return x * modinv(y, MOD) % MOD;
}

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

	int n, m;
	vector<int>g[100005];
	int cnt[100005];

	stack<int>sta;
	vector<int>topo;
	int ans[100005];
	int ma = 0;

	cin >> n >> m;
	rep(i, n) cnt[i] = 0;
	rep(i, m) {
		int x, y;
		cin >> x >> y;
		x--, y--;
		g[x].push_back(y);
		cnt[y]++;
	}

	rep(i, n) {
		if (cnt[i] == 0) sta.push(i);
	}
	while (!sta.empty()) {
		int now = sta.top(); sta.pop();
		topo.push_back(now);
		rep(i, g[now].size()) {
			cnt[g[now][i]]--;
			if (cnt[g[now][i]] == 0) sta.push(g[now][i]);
		}
	}

	rep(i, n) ans[i] = 0;
	rep(i, n) {
		int now = topo[i];
		rep(i, g[now].size()) {
			chmax(ans[g[now][i]], ans[now] + 1);
		}
	}
	rep(i, n) chmax(ma, ans[i]);
	cout << ma << endl;
	
	return 0;
}


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

int main(){
	while(1){
		int W, H, x[30][30] = {};
		char str[30][30];
		cin>>W>>H;
		if(W==0 && H==0) break;
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				cin>>str[i][j];
				if(str[i][j] == '@') x[i][j] = 1;
			}
		}
	
		int q = 0;
		while(1){
			int z = 0;
			for(int i = 0; i < H; i++){
				for(int j = 0; j < W; j++){
					if(x[i][j] == 1){
						if(i > 0 && str[i - 1][j] == '.') x[i - 1][j] = 1;
						if(i < H - 1  && str[i + 1][j] == '.') x[i + 1][j] = 1;
						if(j > 0 && str[i][j - 1] == '.') x[i][j - 1] = 1;
						if(j < W - 1&& str[i][j + 1] == '.') x[i][j + 1] = 1;
					}
				}
			}
			for(int i = 0; i < H; i++){
				for(int j = 0; j < W; j++){
					if(x[i][j] == 1){
						z++;
					}
				}
			}
			if(z == q) break;
			q = z;
		}

		
		cout<<q<<endl;
	}
	return 0;
}



Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int A,H; cin>>H>>A;
  cout<<(A+H-1)/A<<endl;
  }



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,ra,re) for((i)=ra;(i)<(re);(i)++)
#define rep_(i,ra,re) for((i)=ra;(i)<=(re);(i)++)
#define put(n) cout << n << " "; 
#define puts(n) cout << n << endl;
#define pu(n) cout << n;
#define inf 10e9
int i,j,k,l;
static const int MAX_N=10e5;
int a,b,ans=inf,res;
int main(void){
		cin >> a >> b;
	rep(i,0,a){
		int j=b+i;
		if(abs(ans)>abs(j))
			ans=j;
		res+=j;
	}
	put(res-ans);
	return 0;
	
}

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

def total (x:int):
    total = 0
    while True:
        if x == 0:
            return total
        else:
            total += x%10
            x = x//10

ans = 0
for i in range(0,n+1):
    t = total(i)
    if a <= t and t <= b:
        ans += i

print (ans)


Measured memory_bytes: 3060
a, b, c, d = map(int, input().split())

turn = 'T'
while True:
    if turn == 'T':
        c = c - b
        turn = 'A'
        if c <= 0:
            print("Yes")
            break
    elif turn == 'A':
        a = a - d
        turn = 'T'
        if a <= 0:
            print("No")
            break


Measured memory_bytes: 61788
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1e+9 + 5;
const int MAX = 205;
/* global variables */
vector<vector<ll> > d(MAX, vector<ll>(MAX, INF));
/* function */
void floyd() {
    for (int k = 0; k < MAX; k++) {
        for (int i = 0; i < MAX; i++) {
            //if (d[i][k] == INF) continue;
            for (int j = 0; j < MAX; j++) {
                //if (d[k][j] == INF) continue;
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}
/* main */
int main(){
    ll N, M, R, a, b, c;
    cin >> N >> M >> R;
    vector<ll> r(R);
    for (int i = 0; i < R; i++) {cin >> r[i]; r[i]--;}
    for (int i = 0; i < M; i++) {
        cin >> a >> b >> c;
        a--, b--;
        d[a][b] = c; d[b][a] = c;
    }

    floyd();
    sort(r.begin(), r.end());

    ll ans = INF;
    do {
        ll tmp = 0;
        for (int i = 0; i < R - 1; i++) { tmp += d[r[i]][r[i+1]]; }
        ans = min(ans, tmp);
    } while(next_permutation(r.begin(), r.end()));

    cout << ans << '\n';
}


Measured memory_bytes: 640
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;

double A, B;
int A_top, A_bottom, B_top, B_bottom;

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

	A_top    = floor((A + 1) * 100 / 8 - 0.001);
	A_bottom = ceil(A * 100 / 8);
	B_top    = (B + 1) * 10 - 1;
	B_bottom = B * 10;

	int p = max(A_bottom, B_bottom);
	int q = min(A_top, B_top);

	if (p <= q)
	{
		cout << p << endl;
	}
	else
	{
		cout << -1 << endl;
	}

	return 0;
}

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

int h, w;

int memo[1010][1010];
char mas[1010][1010];

#define MOD 1000000007

int dp(int i, int j){
  if(i == h-1 && j == w-1) return 1;
  if(mas[i][j] == '#') return 0;
  if(memo[i][j] != -1) return memo[i][j];
  if(i == h-1) return memo[i][j] = dp(i, j+1) % MOD;
  if(j == w-1) return memo[i][j] = dp(i+1, j) % MOD;
  return memo[i][j] = (dp(i+1, j) + dp(i, j+1)) % MOD;
}

int main(){
  cin >> h >> w;

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

  memset(memo, -1, sizeof(memo));

  cout << dp(0, 0) << endl;

  return 0;
}

Measured memory_bytes: 5248
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
int main(void){
	ll f=0,n,i,j,sum=0,cn=0,t=0,k=0;
	cin>>n;
	ll a[n],sa[n],c=0,d[n];
	for(i=0;i<n;i++)cin>>a[i];
	for(i=0;i<n;i++){
		sa[i]=a[i]-(i+1);
	}
	sort(sa,sa+n);
	t=sa[n/2];
	for(i=0;i<n;i++)sum+=abs(sa[i]-t);
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 3328
n,*a=`dd`.split.map &:to_i;1.upto(n-a[c=0]=r=1){|i|d=a[i-1];a[i]=a[i]>=d+2?d+2:(r*=i+2-c+=1;d)};1.upto(n-c){|i|r=r*i%(10**9+7)};p r

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

int main()
{
    int n;
    long sum{0};
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        long j = n / i;
        sum += i * ( j + 1 ) * j / 2;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3644
a = input()
b = input()
c = input()
A, B, C = len(a), len(b), len(c)
ab, bc, ac = [1] * 16000, [1] * 16000, [1] * 16000

for i in range(A):
    if a[i] == '?':
        continue
    for j in range(B):
        if b[j] != '?' and a[i] != b[j]:
            ab[i-j+8000]= 0
for i in range(B):
    if b[i] == '?':
        continue
    for j in range(C):
        if c[j] != '?' and b[i] != c[j]:
            bc[i-j+8000]= 0
for i in range(A):
    if a[i] == '?':
        continue
    for j in range(C):
        if c[j] != '?' and a[i] != c[j]:
            ac[i-j+8000]= 0
ans = 6000

for i in range(-4000, 4000):
    for j in range(-4000, 4000):
        if ab[i+8000] and bc[j-i+8000] and ac[j+8000]:
            L = min(0, min(i, j))
            R = max(A, max(B+i, C+j))
            ans = min(ans, R-L)
print(ans)

Measured memory_bytes: 49884
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::setprecision(15);}}fIO;
template<typename T> using V = std::vector<T>;
template<typename T> void fill(V<T>&v) { for(T&e:v) std::cin >> e; }
/*-*/

constexpr lnt MOD = 1e9+7;
struct mint
{
	lnt v;
	mint():v(0){}
	mint(lnt v):v((v+MOD)%MOD){}
	mint operator-()const{ return mint(0) - *this; }
	mint& operator+=(const mint& a){ if((v+=a.v)>=MOD) v-=MOD; return *this; }
	mint& operator-=(const mint& a){ if((v+=MOD-a.v)>=MOD) v-=MOD; return *this; }
	mint& operator*=(const mint& a){ (v*=a.v)%=MOD; return *this; }
	mint& operator/=(const mint& a){ (*this) *= a.inv(); return *this; }
	mint operator+(const mint& a)const{ return mint(*this) += a; }
	mint operator-(const mint& a)const{ return mint(*this) -= a; }
	mint operator*(const mint& a)const{ return mint(*this) *= a; }
	mint operator/(const mint& a)const{ return mint(*this) /= a; }
	bool operator<(const mint& a)const{ return v < a.v; }
	bool operator==(const mint& a)const{ return v == a.v; }
	mint pow(lnt k)const{ mint r(1),t(v); while(k){ if(k&1) r*=t; t*=t; k>>=1; } return r; }
	mint inv()const{ return pow(MOD-2); }
	static mint comb(lnt n, lnt k) { if(n-k<k) k=n-k; mint num(1), dom(1); for(int i=0;i<k;i++) { num*=n-i; dom*=i+1; } return num/dom; }
	static std::vector<mint> construct_comb(int n) {
		std::vector<mint> c(n+1); mint a = 1; c[0] = a; for(int i=1;i<=n;i++) { a = a*mint(n+1-i)/i; c[i] = a; } return c;
	}
	static std::vector<mint> construct_fact(int n) { std::vector<mint> f(n+1,1); for(int i=2;i<=n;i++) f[i]=f[i-1]*i; return f; }
};
std::istream& operator>>(std::istream&i,mint&a){ lnt t; i>>t; a=mint(t); return i; }
std::ostream& operator<<(std::ostream&o,const mint&a){ o<<a.v; return o; }


int main() {
	int s;
	std::cin >> s;
	// up to s/3
	mint ans=0;
	for(int i=1;i<=s/3;i++) {
		int x=s-i*3;
		// x+i-1Ci
		ans+=mint::comb(x+i-1,i-1);
	}
	print(ans);
}


Measured memory_bytes: 3640
S = gets.strip.to_i.times.map { gets.strip }
T = gets.strip.to_i.times.map { gets.strip }

sum = Hash.new(0)

S.each { |s| sum[s] += 1 }
T.each { |s| sum[s] -= 1 }

a = sum.map { |s| s.last }.max 
puts a > 0 ? a : 0


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 100
 
 
#define PI 3.14159265358979323846264338327950
 
#define ll   long long int
ll mod = 1000000007;
ll a[MAXX], b[MAXX];
char str[MAXX];
 
int main()
{
	FAST;
	for(ll i = 97; i < 122; i++){
		str[i-96] = i;
	}
	str[0] = 'z';
	ll n, t , h = 0, ans= 0;;
	cin >> n ;
	string s = "";
	t = n;
	while(t ){
		t /= 26;
		h ++;
	}
	if(n <= 26){
		cout << str[n%26];
	}
	
	else{
		while(n > 0 ){
		ll ops = n % 26;
		if(ops == 0){
			n -= 26;
		}
		else{
			n -= ops;
		}
		s += str[ops];
		n /= 26;
		h --;
	}
	reverse(s.begin(), s.end());
	cout << s;
	}
	
	
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(x) cout<<#x<<"="<<x<<endl;
#define endl '\n'
#define M 1000000007
#define int long long
#define INF 1e18
#define max_n 1000000

using namespace std;

void solve()
{
	ll n,m,k;
	cin>>n>>m>>k;
	vector<ll> a(n),b(m);
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		if(i>0)a[i]+=(a[i-1]);
	}
	for (int i = 0; i < m; ++i)
	{
		cin>>b[i];
		if(i>0)b[i]+=(b[i-1]);
	}
	ll ans=0;
	for (int i = 0; i < n; ++i)
	{
		if(a[i]>k)break;
		ll temp=(i+1);
		auto it=lower_bound(b.begin(), b.end(),k-a[i]);
		if(it==b.end())
		{
			temp+=(b.size());
		}
		else
		{
			if(it==b.begin() && *it>k-a[i])temp+=0;
			else
			{
				if(*it>k-a[i])it--;
				temp+=(it-b.begin());
				temp+=1;
			}
		}
		ans=max(ans,temp);
	}
	
	for (int i = 0; i < m; ++i)
	{
		if(b[i]>k)break;
		ll temp=(i+1);
		auto it=lower_bound(a.begin(), a.end(),k-b[i]);
		if(it==a.end())
		{
			temp+=(a.size());
		}
		else
		{
			if(it==a.begin() && *it>k-b[i])temp+=0;
			else
			{
				if(*it>k-b[i])it--;
				temp+=(it-a.begin());
				temp+=1;
			}
		}
		ans=max(ans,temp);
	}
	cout<<ans<<endl;
}

int32_t main()
{
	IOS
	ll T = 1;
	// cin>>T;
	for (ll i = 1; i <= T; ++i)
	{
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 6364
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N;cin >> N;
    vector<int> a(N);
    rep(i,N)cin >> a[i];
    int b=0,c=0,d=0;    
    rep(i,N){
        if(a[i]%4==0)b++;
        else if(a[i]%2==0)c++;
        else d++;
    }
    if((c!=0&&b>=d)||(c==0&&b>=d-1))cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

ll dp[100][11][11][11][11];
ll W0;
ll W_max;

bool ok(int w1, int w2, int w3, int w4)
{
    return (((W0 + 0) * w1 + (W0 + 1) * w2 + (W0 + 2) * w3 + (W0 + 3) * w4) <= W_max);
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N >> W_max;

    vector<ll> W(N), V(N);
    rep(i, N) cin >> W[i] >> V[i];
    W0 = W[0];

    vector<vector<ll>> VS(4);
    rep(i, N) {
        ll w = W[i] - W0;
        VS[w].push_back(V[i]);
    }

    rep(i, 4) sort(VS[i].begin(), VS[i].end(), greater<ll>());

    vector<vector<ll>> sum(4, vector<ll>(N+1));
    rep(i, 4) {
        rep(n, N) {
            if (n < VS[i].size()) {
                sum[i][n+1] = sum[i][n] + VS[i][n];
            }
        }
    }

    ll ans = 0LL;
    rep(i, 101) rep(j, 101) rep(k, 101) rep(l, 101) {
        if (i + j + k + l <= N) {
            if (i > VS[0].size() || j > VS[1].size() || k > VS[2].size() || l > VS[3].size()) continue;
            if (!ok(i, j, k, l)) continue;

            ll tmp = sum[0][i] + sum[1][j] + sum[2][k] + sum[3][l];
            ans = max(ans, tmp);
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
using namespace std;

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

    vector<long long> A(N);
    vector<long long> B(N);
    vector<pair<long long, long long>> sum(N);

    for (int i = 0; i < N; i++)
    {
        cin >> A[i] >> B[i];
        sum[i] = pair<long long, long long>(A[i] + B[i], i);
    }

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

    long long ans = 0;
    int i = N - 1;
    while (0 <= i)
    {
        ans += A[sum[i].second];
        i--;
        if (i < 0)
            break;

        ans -= B[sum[i].second];
        i--;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#include <climits>

#define DEBUG if(false)

using namespace std;

int main(){

  string S, T;
  cin >> S;
  cin >> T;
  bool boolean;
  int len = S.length();
  for(int i = 0; i < len; i++){
    boolean = true;
    for(int j = 0; j < len; j++){
      if(S[j] != T[(i+j)%len]){
        boolean = false;
        break;
      }
    }
    if(boolean){
      break;
    }
  }
  if(boolean){
    printf("Yes\n");
  }else{
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();

		int length = s.length();
		int i;
		for(i = 0; i < length; i++) {
			System.out.print("x");
		}
	}
}

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

int main() {
  ll a,b,c,k=0;
  cin>>a>>b>>c>>k;
  ll sum=0;
  
  if(k>a){
    sum+=a;
    k-=a;
  }else{
    sum+=k;
    k=0;
  }
  
  
  if(k>b){
    sum+=0;
    k-=b;
  }else{
    sum+=0;
    k=0;
  }
  
  
  if(k>c){
    sum-=c;
  }else{
    sum-=k;
  }
  cout<<sum;
}

Measured memory_bytes: 3600
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
int N;
ll A[10001], B[10001];

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

  cin >> N;
  ll sm1 = 0ll;
  ll sm2 = 0ll;
  rep(i, N){
    cin >> A[i];
    sm1+=A[i];
  }
  rep(i, N){
    cin >> B[i];
    sm2+=B[i];
  }
  ll cnt = sm2-sm1;
  if (cnt <0){
    cout << "No" << "\n";
    return 0;
  }
  ll cnt1 = cnt;
  ll cnt2 = cnt;

  rep(i, N){
    ll diff = B[i] - A[i];
    if (diff > 0 && diff%2==0){
      cnt1-=diff/2;
      A[i] = B[i];
      continue;
    }
    if (diff > 0 && diff%2==1){
      cnt1-=(diff/2+1);
      cnt2-=1;
      A[i] = B[i];
      continue;
    }
    if (diff < 0){
      cnt2+=diff; // 負であることに注意
      A[i] = B[i];
    }
  }
  if (cnt1 < 0 || cnt2 < 0){
    cout << "No" << "\n";
    return 0;
  }
  if (cnt2 == 2*cnt1){
    cout << "Yes" << "\n";
    return 0;
  }

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

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i=1; i < (int)(n); i++)
#define rrep(i, n) for (int i=((int)(n)-1); i>=0; i--)
#define rreps(i, n) for (int i=((int)(n)-1); i>0; i--)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using lint = long long;
using p = pair<int, int>;
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; }

int main() {
  lint x; cin >> x;
  lint dep = 100;
  lint ans = 0;
  while (dep < x) {
    dep *= 1.01;
    ans ++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" << endl;
#define dump(v) cerr<<#v":[ ";for (auto macro_vi:v){cerr<<macro_vi<< " ";}cerr<<"]"<<endl;
#define ddump(v) cerr<<#v":"<<endl;for(auto macro_row:v) {cerr<<"["; for (auto macro__vi:macro_row){cerr<<macro__vi<< " ";}cerr<<"]"<<endl;}
#define damp(m) for(auto macro_pair:m){cerr<< macro_pair.first<<":"<<macro_pair.second<<endl;}
#define dpair(p) cerr << #p":"<<"(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;

using namespace std;

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

    map<string, ll> mp;
    rep(i,n){
        string tmp;
        cin >> tmp;
        sort(tmp.begin(), tmp.end());
        mp[tmp]+=1LL;
    }
    damp(mp)
    ll ans=0LL;
    for(auto p : mp){
        ans+= (p.second-1LL)*(p.second)/2LL;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11264
using System;
using System.Linq;

namespace Aisingcontest2020
{
    class Program
    {
        static void Main(string[] args)
        {
            b();
        }

        public static void b()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int sum = 0;
            for(int i = 0; i < n; i++)
            {
                if(i % 2 == 0 && a[i] % 2 == 1)
                { sum++; }
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 28280
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <map>
#include <numeric>
#include <set>
using namespace std;
typedef long long int ll;

constexpr ll mod=1e9+7;

struct UnionFind{
    vector<int> par,num;
    vector<bool> done;
    UnionFind(int n):par(n),num(n,1),done(n,false){
        iota(par.begin(),par.end(),0);  //include<numeric>
    }
    int find(int v){
        return (par[v]==v)?v:(par[v]=find(par[v]));
    }
    void unite(int u,int v){
        u=find(u),v=find(v);
        if(u==v)return;
        if(num[u]<num[v])swap(u,v);
        num[u]+=num[v];
        par[v]=u;
        done[u]=done[u]|done[v];
    }
    bool same(int u,int v){
        return find(u) == find(v);
    }
    bool ispar(int v){
        return v=find(v);
    }
    int size(int v){
        return num[find(v)];
    }
};

bool is_not_prime[1000100];

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    is_not_prime[1]=is_not_prime[0]=1;
    vector<int> p;
    for(int i=2;i<1000100;i++){
        if(!is_not_prime[i]){
            p.push_back(i);
            for(int j=i+i;j<1000100;j+=i){
                is_not_prime[j]=1;
            }
        }
    }
    int n; cin >> n;
    vector<ll> a(n);
    ll g=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        g=__gcd(g,a[i]);
    }
    int pp=p.size();
    vector<bool> used(pp,false);
    reverse(a.begin(), a.end());
    set<int> st;
    for(int i=0;i<n;i++){
        for(int j=0;j<p.size();j++){
            if(a[i]==1)break;
            if(!is_not_prime[a[i]]){
                if(st.find(a[i])==st.end()){
                    st.insert(a[i]);
                    break;
                }
                else{
                    if(g==1){
                        //cout << i << " " << a[i] << endl;
                        printf("setwise coprime\n");
                    }
                    else{
                        printf("not coprime\n");
                    }
                    return 0;
                }
            }
            if(a[i]%p[j]==0){
                if(used[j]){
                    if(g==1){
                        //cout << i << " " << p[j] << endl;
                        printf("setwise coprime\n");
                    }
                    else{
                        printf("not coprime\n");
                    }
                    return 0;
                }
                else{
                    used[j]=1;
                    while(a[i]%p[j]==0){
                        a[i]/=p[j];
                    }
                }
            }
        }
    }
    printf("pairwise coprime\n");
}


Measured memory_bytes: 12308