akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	S := sc.nextStr()
	X, Y := sc.nextInt(), sc.nextInt()
	Ax := []int{}
	Ay := []int{}
	startX, startY := 0, 0
	count := 0
	isX := true
	isFirst := true
	for _, r := range S {
		if r == 'F' {
			count++
		} else {
			if count > 0 {
				if isX {
					if isFirst {
						startX += count
					} else {
						Ax = append(Ax, count)
					}
				} else {
					Ay = append(Ay, count)
				}
			}
			count = 0
			isX = !isX
			isFirst = false
		}
	}
	if count > 0 {
		if isX {
			if isFirst {
				startX += count
			} else {
				Ax = append(Ax, count)
			}
		} else {
			Ay = append(Ay, count)
		}
	}

	if f(X, Ax, startX) && f(Y, Ay, startY) {
		fmt.Fprintln(wtr, "Yes")
	} else {
		fmt.Fprintln(wtr, "No")
	}
}

const MAX = 8000

func f(target int, A []int, start int) bool {
	// 0: -8000, 8000: 0, 16000: 8000
	dp := make([][MAX*2 + 1]bool, len(A)+1)
	dp[0][MAX+start] = true
	for i := 1; i <= len(A); i++ {
		for j := 0; j <= MAX*2; j++ {
			if dp[i-1][j] {
				dp[i][j+A[i-1]] = true
				dp[i][j-A[i-1]] = true
			}
		}
	}
	return dp[len(A)][target+MAX]
}


Measured memory_bytes: 63232
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>
#include <random>
#include <list>
#include <numeric>



#define rep(i,p,q) for(i = p;i < q;i++)
#define ll long long

using namespace std;

int v, e;


int main(void) {
	cin >> v >> e;
	
	int i;
	ll d[100][100];
	int j;
	rep(i, 0, 100) {
		rep(j, 0, 100) {
			d[i][j] = i == j ? 0 : 1e11;
		}
	}
	rep(i, 0, e) {
		int s, t, w;
		cin >> s >> t >> w;
		d[s][t] = w;
	}

	int k;
	bool negative = false;
	rep(i, 0, v) {
		rep(j, 0, v) {
			rep(k, 0, v) {
				if (d[j][i] != 1e11 && d[i][k] != 1e11) {
					d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
				}
				
			}
		}
	}

	rep(i, 0, v) {
		if (d[i][i] < 0) {
			negative = true;
			break;
		}
	}

	if (negative) {
		cout << "NEGATIVE CYCLE" << endl;
	}
	else {
		rep(i, 0, v) {
			rep(j, 0, v - 1) {
				string ans = d[i][j] != 1e11 ? to_string(d[i][j]) : "INF";
				cout << ans << " ";
			}
			string ans = d[i][j] != 1e11 ? to_string(d[i][j]) : "INF";
			cout << ans << endl;
		}
	}
	
}


Measured memory_bytes: 3352
s = input().split()

h1 = int(s[0])
m1 = int(s[1])
h2 = int(s[2])
m2 = int(s[3])
k = int(s[4])

t = (h2 - h1) * 60 + (m2 - m1)

t = t - k

print(t)

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

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

	vector<vector<int>> vec(M);

	for (int i = 0; i < M; ++i) {
		int k; 
		cin >> k;
		vec[i].resize(k);
		for (int j = 0; j < k; ++j) {
			cin >> vec[i][j];
			--vec[i][j];
		}
	}

	vector<int> p(M);
	for (int i = 0; i < M; ++i) cin >> p[i];

	int ans = 0;
	for (int i = 0; i < (1 << N); ++i) {
		bool ok = true;
		for (int j = 0; j < M; ++j) {
			int c = 0;
			for (int id : vec[j]) {
				if ((i >> id) & 1) {
					++c;
				}
			}
			c %= 2;
			if (c != p[j]) {
				ok = false;
			}
		}
		if (ok) {
			++ans;
		}
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
class BIT:
    def __init__(self,len_A, mod):
        self.N = len_A + 10
        self.bit = [0]*(len_A+10)
        self.mod = mod
        
    def query(self,i):
        res = 0
        idx = i+1
        while idx:
            res += self.bit[idx]
            idx -= idx&(-idx)
        return res

    def update(self,i,x):
        idx = i+1
        while idx < self.N:
            self.bit[idx] += x
            self.bit[idx] %= self.mod
            idx += idx&(-idx)

n, k = map(int, input().split())
mod = 998244353
bit = BIT(n,mod)
dp = [0]*(n+3)
lr = []
for i in range(k):
    l, r = map(int, input().split())
    lr.append((l, r))
    if l != r:
        for g in range(l, r+1):
            dp[g] = 1
            bit.update(g, 1)
    else:
        dp[l] = 1
        bit.update(l, 1)
lr.sort()

for i in range(1, n+1):
    ssum = 0
    for g in range(k):
        if i > lr[g][1]:
            ssum += bit.query(i-lr[g][0]) - bit.query(i-lr[g][1]-1)
        else:
            if lr[g][0] < i:
                ssum += bit.query(i-lr[g][0]) 
            break
    dp[i] += ssum
    dp[i] %= mod
    bit.update(i, ssum)
print(dp[n-1])

Measured memory_bytes: 78948
/*
 * A.cpp
 *
 *  Created on: 2020/06/27
 *      Author: 17k1028
 */



#include <iostream>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))


using namespace std;

int main(){
	int a;
	cin >> a;
	cout << a+a*a + a*a*a<< endl;
}


Measured memory_bytes: 3588
s=input()
N=len(s)+1
up=[0]*N
down=[0]*N
for i in range(N-1):
    if s[i]=='<':
        up[i+1]=up[i]+1
for i in range(N-2,-1,-1):
    if s[i]=='>':
        down[i]=down[i+1]+1
#print(up)
#print(down)
res=[max(u,d) for u,d in zip(up,down)]
#print(res)
print(sum(res))



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

int BinarySearch(const vector<int> &A, int key, int min, int max){
    if(min > max)
        return 0;
    else{
        int mid = min + (max - min) / 2;
        if(A[mid] > key){
            return BinarySearch(A, key, min, mid - 1);
        }
        else if(A[mid] < key){
            return BinarySearch(A, key, mid + 1, max);
        }
        else
            return 1;
    }
}

int main(void){
    int n, q, key;
    cin >> n;
    vector<int> S(n, 0);
    for(int i = 0; i < n; ++i)
        cin >> S[i];
    cin >> q;
    int sum = 0;
    for(int i = 0; i < q; ++i){
        cin >> key;
        sum += BinarySearch(S, key, 0, n);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
bool dp[101][100001];
int main(){
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    memset(dp,0,sizeof dp);
    for(int j=1;j<=k;j++){
        if(j<a[0])
        dp[0][j]=0;
        else dp[0][j]=!(dp[0][j-a[0]]);
    }
    for(int i=1;i<n;i++){
        for(int j=1;j<=k;j++){
            if(j<a[i])
            dp[i][j]=dp[i-1][j];
            else{ int b=i;
                for(int b=i;b>=0;b--){
                    if(dp[i][j-a[b]]==0){
                    dp[i][j]=1;
                    }
                }
            }
        }
    }
    if(dp[n-1][k])
    cout<<"First";
    else cout<<"Second";
}

Measured memory_bytes: 13512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll N;
    string S;
    cin >> N >> S;
    ll ans = 0;
    rep(i, 1, N-1){
        VL X(26,0), Y(26,0);
        rep(j, 0, i){   
            X[S[j]-'a']++;
        }
        rep(j, i, N){
            Y[S[j]-'a']++;
        }
        ll c = 0;
        rep(j, 0, 26){
            if(X[j] > 0 && Y[j] > 0) c++;
        }
        ans = max(ans, c);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

vector<int> g[200005];
int ans[200005];

void dfs(int now, int from) {
    for (int to : g[now]) {
        if (to == from) continue;
        ans[to] += ans[now];
        dfs(to, now);
    }
}

int main() {
    int n, q;
    cin >> n >> q;
    rep(i, 0, n - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    rep(i, 0, q) {
        int p, x;
        cin >> p >> x;
        p--;
        ans[p] += x;
    }

    dfs(0, -1);
    rep(i, 0, n) cout << ans[i] << " ";
    cout << endl;
    return 0;
}


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

int main(){
	int n;
	cin >> n;
	vector<int> h(n);
	for(int i=0;i<n;i++) {
		cin >> h[i];
	}
	vector<int> p(n,0);
	p[0] = 0;
	for(int i=1;i<n;i++) {
		if(h[i-1] >= h[i]) {
			p[i] = p[i-1] + 1;
		}else {
			p[i] = 0;
		}
	}
	int ans = 0;
	for(int i=0;i<n;i++)
		if(p[i] > ans)
			ans = p[i];

	cout << ans << endl;
}

Measured memory_bytes: 1024
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//スペルミスに注意
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//関係性は隣接行列で記録
//過半数：N/2.0で判定
//ある量からある量を引く系の問題：端から定義してやる
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1)) % MOD;
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

int main() {
	ll N, M; cin >> N >> M;
	vector<ll> a(M); rep(i, M) cin >> a[i];

	if (M >= 2) {
		rep(i, M - 1) {
			if (a[i] + 1 == a[i + 1]) {
				cout << 0 << endl;
				return 0;
			}
		}
	}

	vector<ll> dp(100001);
	for (int i = 0; i <= 100000; i++) {
		if (i == 0) dp[i] = 1;
		else if (i == 1) dp[i] = 1;
		else {
			dp[i] = dp[i - 1] + dp[i - 2];
			dp[i] %= MOD;
		}
	}

	if (M == 0) {
		cout << dp[N] << endl;
		return 0;
	}

	ll ans = 1;
	rep(i, M) {
		if (i == 0) {
			ans *= dp[a[i] - 1];
			ans %= MOD;
		}
		else {
			ans *= dp[a[i] - a[i - 1] - 2];
			ans %= MOD;
		}
	}

	ans *= dp[N - a[M-1] - 1];

	cout << ans%MOD << endl;
}

Measured memory_bytes: 9216
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod=1000000007;
int fpow(int x,long long y)
{
	if(y==0)
		return 1;
	int ret=fpow(x,y>>1);
	ret=(long long)ret*ret%mod;
	if(y&1)
		ret=(long long)ret*x%mod;
	return ret;
}
int inv(int x)
{
	return fpow(x,mod-2);
}
char s[1010][1010];
int main()
{
	int n,m;
	int cnt,cnt1,cnt2,cnt11,cnt22;
	long long k;
	long long ans,q;
	scanf("%d%d%lld",&n,&m,&k);
	for(int i=1;i<=n;i++)
		scanf("%s",s[i]+1);
	if(k<=1)
	{
		printf("1");
		return 0;
	}
	k--;
	cnt=cnt1=cnt2=0;
	cnt11=cnt22=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(s[i][j]=='#')
				cnt++;
	if(m>1)
	{
		for(int i=1;i<=n;i++)
			if(s[i][1]=='#'&&s[i][m]=='#')
				cnt1++;
		for(int i=1;i<=n;i++)
			for(int j=2;j<=m;j++)
				if(s[i][j]=='#'&&s[i][j-1]=='#')
					cnt11++;
	}
	if(n>1)
	{
		for(int j=1;j<=m;j++)
			if(s[1][j]=='#'&&s[n][j]=='#')
				cnt2++;
		for(int i=2;i<=n;i++)
			for(int j=1;j<=m;j++)
				if(s[i-1][j]=='#'&&s[i][j]=='#')
					cnt22++;
	}
	if(cnt1&&cnt2)
	{
		printf("1");
		return 0;
	}
	else if(cnt1==0&&cnt2==0)
	{
		printf("%d",fpow(cnt,k));
		return 0;
	}
	if(cnt2)
	{
		cnt1=cnt2;
		cnt11=cnt22;
	}
	q=(long long)cnt1*inv(cnt)%mod;
	ans=fpow(cnt,k)-(long long)fpow(cnt,k-1)*cnt11%mod*(mod+1-fpow(q,k))%mod*inv(mod+1-q)%mod;
	(ans+=mod)%=mod;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <utility>
using namespace std;

int main() {
  int N; cin >> N;
  int n = N;
  int f = 0;
  while (n > 0) {
    f += n % 10;
    n /= 10;
  }
  if (N % f == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
using namespace std;
int main() {
	int N, K;
	scanf("%d %d", &N, &K);
	long long A[N];
	for (int i = 0; i < N; ++i) scanf("%lld", &A[i]);
	vector<long long> pive, nive;
	for (int i = 0; i < N; ++i) {
		if (A[i] > 0) pive.push_back(A[i]);
		else nive.push_back(-A[i]);
	}
	if (pive.size() != 0) {
		sort(pive.begin(), pive.end(), greater<long long>());
		sort(nive.begin(), nive.end(), greater<long long>());
		int pptr = 0, nptr = 0;
		while (pptr + nptr != K) {
			if (pptr == pive.size()) ++nptr;
			else if (nptr == nive.size()) ++pptr;
			else if (pive[pptr] > nive[nptr]) ++pptr;
			else ++nptr;
		}
		if (nptr % 2 && nive[nptr - 1] != 0 && K != N) {
			if (pptr == pive.size()) --pptr, ++nptr;
			else if (nptr == nive.size() || pptr == 0) --nptr, ++pptr;
			else if (pive[pptr] * pive[pptr - 1] > nive[nptr] * nive[nptr - 1]) ++pptr, --nptr;
			else --pptr, ++nptr;
		}
		long long ans = 1;
		for (int i = 0; i < pptr; ++i) ans = ans * pive[i] % 1000000007;
		for (int i = 0; i < nptr; ++i) ans = ans * -nive[i] % 1000000007;
		printf("%lld", (ans + 1000000007) % 1000000007);
	} else {
		sort(nive.begin(), nive.end());
		long long ans = 1;
		if (K % 2) {
			for (int i = 0; i < K; ++i) ans = ans * -nive[i] % 1000000007;
		} else {
			for (int i = N - 1; i >= N - K; --i) ans = ans * -nive[i] % 1000000007;
		}
		printf("%lld", (ans + 1000000007) % 1000000007);
	}
	return 0;
}


Measured memory_bytes: 6440
#include<bits/stdc++.h>
using namespace std;
int fun(int h,int a)
{
  if( h <= a)
    return 1;
  if(a==0)
     return INT_MAX;
  int ans=h/a;
  if(h%a==0)
     return ans;
  else
     return ans+1;
}
int main()
{
int h;cin>>h;
int a;cin>>a;
 cout<<fun(h,a);
  return 0;
}

Measured memory_bytes: 256
n = input()
count=0
nums = list(map(int, input().split()))
for i in range(1,int(n)-1):
    if((nums[i]>nums[i-1] and nums[i]<nums[i+1]) or (nums[i]<nums[i-1] and nums[i]>nums[i+1])):
        count+=1
print(count)


Measured memory_bytes: 3060
fn solve(a: usize, b: usize, c: usize) -> bool {
    a + b + c <= 21
}

#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

fn main() {
    let (a, b, c) = parse_line!(usize, usize, usize);
    println!("{}", if solve(a, b, c,) { "win" } else { "bust" });
}


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


long long int Exp(long long int exp_n,long long int exp_e, long long exp_mod);


int main(){
  int H,W,M,h,w,O=1;
  cin >> H >> W >> M;
  int Bh[H],Bw[W];
  map<pair<int,int>, int> m;
  for(int i=0;i<H;i++){
    Bh[i]=0;
  }
  for(int i=0;i<W;i++){
    Bw[i]=0;
  }
  for(int i=0;i<M;i++){
    cin >> h >> w;
    Bh[h-1]++;
    Bw[w-1]++;
    m[make_pair(h-1,w-1)]=1;
  }
  vector<int> vh,vw;
  int mh=0,mw=0;
  for(int i=0;i<H;i++){
    if(mh<Bh[i]){
      mh=Bh[i];
      vh.clear();
      vh.push_back(i);
    }else  if(mh==Bh[i]){
      vh.push_back(i);
    }
  }
  for(int i=0;i<W;i++){
    if(mw<Bw[i]){
      mw=Bw[i];
      vw.clear();
      vw.push_back(i);
    }else if(mw==Bw[i]){
      vw.push_back(i);
    }
  }
  
  for(int i=0;i<vh.size();i++){
    for(int j=0;j<vw.size();j++){
      if(m[make_pair(vh[i],vw[j])]==0){
        O=0;
        break;
      }
    }
    if(O==0){
      break;
    }
  }
  
  
  
  cout << mh+mw-O <<endl;
}


long long int Exp(long long int exp_n,long long int exp_e, long long int exp_mod){
  long long int exp_o = 1;
  long long int exp_x=exp_n;
  long long int exp_tmp;
  
  while(0<exp_e){
    exp_tmp = exp_e/2;
    if(exp_e - exp_tmp*2 == 1){
      exp_o = exp_o*exp_x;
      if(exp_o>exp_mod){
        exp_o=exp_o%exp_mod;
      }
    }
    
    exp_x = exp_x*exp_x;
    if(exp_x>exp_mod){
      exp_x=exp_x%exp_mod;
    }
    exp_e = exp_tmp;
  }
  return exp_o;
}


Measured memory_bytes: 28532
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int n;cin>>n;
    int ans=0;
    //因为k>=2,所以从2开始枚举
    for(int i=2;i*i<=n-1;i++){//找n-1的约数
        if((n-1)%i==0){
            ans++;
            if((n-1)/i!=i)ans++;
        }
    }
    if(n-1>=2)ans++;//n-1本身也算
    for(int i=2;i*i<=n;i++){//找n的约数
        if(n%i==0){
            int t=n;
            while(t%i==0)t/=i;
            if(t%i==1)ans++;
            if(n/i!=i){
                int t=n,tt=n/i;
                while(t%tt==0)t/=tt;
                if(t%tt==1)ans++;
            }
        }
    }
    if(n>=2)ans++;//n除以n等于1
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = (1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-4;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int n,c[9];
bool skip[9][9];
int nx, ny;
void next(int x, int y) {
	nx = x; ny = y + 1;
	if (ny == nx) {
		nx++; ny = 0;
	}
}
int key;
bool valid() {
	rep(i, n) {
		if (c[i] > key)return false;
	}
	return true;
}
int dfs(int x, int y) {
	if (!valid())return 0;
	if (x == n)return 1;
	next(x, y);
	int tx = nx, ty = ny;
	if (skip[x][y])return dfs(tx, ty);
	int res = 0;
	c[x]++; res += dfs(tx, ty);
	c[x]--; c[y]++; res+=dfs(tx, ty);
	c[y]--;
	return res;
}
int main() {
	while (cin >> n, n) {
		rep(i, n) {
			c[i] = 0;
			rep(j, n) {
				skip[i][j] = false;
			}
		}
		int m; cin >> m; key = (n - 1) / 2;
		rep(i, m) {
			int x, y; cin >> x >> y; x--; y--;
			c[x]++;
			if (x < y)swap(x, y);
			skip[x][y] = true;
		}
		//cout << "ans" << endl;
		cout << dfs(1, 0) << endl;
	}
	//stop
	return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                           \
    (upper_bound((V).begin(), (V).end(), X) - \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                             \
    {                                        \
        cerr << #v << ':';                   \
        for (auto xv : v) cerr << xv << ' '; \
        cerr << endl;                        \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return a > b;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* library */

/* main */

signed main() {
    ld a, b, x;
    cin >> a >> b >> x;
    x /= a;
    if (x >= (a * b / 2)) {
        cout << atanl((2.0L * b - 2.0L * x / a) / a) / acosl(-1) * 180.0L << endl;
        return 0;
    }
    cout << atanl(b * b / (2.0L * x)) / acosl(-1) * 180.0L << endl;
}

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

int main(){
	int size;
	while(1){
		cin>>size;
		if(size==0)break;
		int s[size];
		int c[size];
		for(int i=0;i<size;i++){
			cin>>s[i];
			c[i]=0;
		}
		int watch=0;
		while(1){
			for(int i=0;i<size;i++){
				for(int j=0;j<size;j++){
					if(s[i]==s[j])c[i]++;
				}
			}
			watch++;
			int cnt=0;
			for(int i=0;i<size;i++){
				if(s[i]==c[i])cnt++;
			}
			if(cnt==size)break;
			for(int i=0;i<size;i++){
				s[i]=c[i];
				c[i]=0;
			}
		}
		cout<<watch-1<<endl;
		for(int i=0;i<size-1;i++){
			cout<<c[i]<<" ";
		}
		cout<<c[size-1]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
using namespace std;
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <functional> //sort(A,A.end(),greater<int>());???????????????
#include <queue>
#include <stack>
#include <vector>

#define INF 10 << 10

int main() {

	int n, a, b, c;
	cin >> n >> a >> b >> c;
	int d[128];
	for (int i = 0; i < n; ++i) {
		cin >> d[i];
	}

	sort(d, d + n, greater<int>());

	int c1 = c; int cnt = 0;
	int sum = c1 / (a + b * cnt);
	for (int i = 0; i < n; ++i) {
		c1 += d[i]; cnt++;
		sum = max(sum, c1 / (a + b * cnt));
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 3108
// C - Otoshidama
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	int N,Y; cin>>N>>Y;
	Y /= 1000;
	rpz(x, min(N+1, Y/10+1)){
		int y = max(0, (Y-N-x*9)/4);
		int z = max(0, N - x - y);
		if(x + y + z != N) continue;
		if(x*10 + y*5 + z != Y) continue;
		printf("%d %d %d\n", x, y, z);
		return 0;
	}
	puts("-1 -1 -1");
}

Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>

using namespace std;

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const db PI = acos(-1);
const db ERR = 1e-12;

const int MX = 2005;
const int MM = 1000000007;

int main()
{
	int A, B, C;
	multiset<string> L;
	scanf("%d%d%d", &A, &B, &C);
	for(int i = 1; i <= A; i++) L.insert((string)"a");
	for(int i = 1; i <= B; i++) L.insert((string)"b");
	for(int i = 1; i <= C; i++) L.insert((string)"c");

	while(L.size() > 1){
		string P = *L.begin();
		while(*L.begin() == P){
			L.erase(L.begin());
			auto it = L.end(); --it;
			string tmp = P + *it;
			L.erase(it);
			L.insert(tmp);
		}
	}
	cout << *L.begin() << "\n";
}


Measured memory_bytes: 256
N, M = map(int, input().split())

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

def temp(var):
    return var[0]

AB = sorted(AB, key=temp)
# https://www.programiz.com/python-programming/methods/built-in/sorted

num = 0
amount = 0

for i in range(N):
    if M > num + AB[i][1]:
        num += AB[i][1]
        amount += AB[i][0] * AB[i][1]
        #  print(num)
    else:
        amount += AB[i][0] * (M - num)
        break

print(amount)


Measured memory_bytes: 29792
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

VI u, v;

int main() {
    string s;
    cin >> s;
    int n = s.length();
    VI a(n+1);
    REP(i,n) a[i+1] = s[i] - '0';

    if (a[1] == 0 || a[n] == 1){
        cout << -1 << endl;
        return 0;
    }
    FOR(i,1,n){
        if (a[i] != a[n-i]){
            cout << -1 << endl;
            return 0;
        }
    }

    int x = 1;
    FOR(i,2,n){
        if (a[i]){
            FOR(j,x,i-1){
                u.push_back(i);
                v.push_back(j);
            }
            x = i;
        }
    }
    u.push_back(n);
    v.push_back(x);

    REP(i,n-1){
        printf("%d %d\n", u[i], v[i]);
    }

    return 0;
}


Measured memory_bytes: 2932
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
 
   
int main(){
    ll a,b,k;
    cin >> a >> b >> k;
    
    rep(i,k/2){
        if(a%2==1)a--;
        b+=a/2;
        a/=2;
        if(b%2==1)b--;
        a+=b/2;
        b/=2;
    }
    if(k%2==1){
        if(a%2==1)a--;
        b+=a/2;
        a/=2;
    }
    cout << a <<" "<< b << endl;
} 

    

Measured memory_bytes: 3632
#!/usr/bin/env python3

a,b,c,x,y = list(map(int,input().split()))

if c*2 < a:#cがaよりお得な場合
    if c*2 < b:#cがbよりお得な場合
        ans = c*2*min(x,y) + (max(x,y) - min(x,y))*c*2
    else:#cがaよろお得かつbよりお得でない
        if x >= y:#aのほうが買う量が多い
            ans = c*2*x
        else:#bの方が買う量が多い
            ans = c*2*x + b*(y-x)
elif c*2 < b:#cがbよりお得な場合
    if c*2 > a:#cがaよりお得でない場合
        if x <= y:#bの方が買う量が多い
            ans = c*2*y
        else:#aの方が買う量が多い
            ans = a*(x-y) + c*2*y
else:
    ans1 = a*x + b*y
    if x <= y:
        ans2 = c*2*x + b*(y-x)
    elif y < x:
        ans2 = c*2*y + a*(x-y)
    ans = min(ans1,ans2)

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#define MAX 500001

 struct Node{
           int key;
           int parent,left,right;
           };

 struct Node T[MAX+1];
 int NIL=-1;
 int root;
 int ix=0;

 int insert(int k){
               int x,y,z;
               x=root;
               y=NIL;
               z=ix++;

               T[z].key=k;
               T[z].right=NIL;
               T[z].left=NIL;

               while(x != NIL){
                           y=x;
                           if(T[z].key<T[y].key){x=T[y].left;}
                           else {x=T[y].right;}
                           }
               T[z].parent=y;
               if(y==NIL){root=z;}
               else {
                     if(T[z].key<T[y].key){T[y].left=z;}
                     else {T[y].right=z;}
                     }
               }

 int preorder(int u){
               if(u==NIL)return;
               printf(" %d",T[u]);
               preorder(T[u].left);
               preorder(T[u].right);
               }

 int inorder(int u){
               if(u==NIL)return;
               inorder(T[u].left);
               printf(" %d",T[u]);
               inorder(T[u].right);
               }


 int main(){
       int i,m,k;
       root=NIL;
       char com[10];
       scanf("%d",&m);
       for(i=0;i<m;i++){
                  scanf("%s",&com);
                  if(com[0]=='i'){
                                 scanf("%d",&k);
                                 insert(k);
                                 }
                  else if(com[0]=='p'){
                                inorder(root);
                                printf("\n");
                                preorder(root);
                                printf("\n");
                                }
                  }
       return 0;
       }


Measured memory_bytes: 9556
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
typedef long long ll;
typedef pair<int,int> pi;

//#define cerr if(0) cout	

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string x;
	cin >> x;
	for (int i = 0; i < x.size(); ++i) cout << 'x';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i = 0;i < (n); ++i)
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    if(a%2 == 0 || b%2 == 0 || c%2 == 0){
        cout << '0' << endl;
        return 0;
    }
    if(a%2 == 1 && b%2 == 1 && c%2 == 1){
        cout << min(a*b, min(b*c, c*a)) << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  string s;
  cin >> s;
  int N = s.size();

  /*int ans = N;
  for(int i = 1; i < N; i++){
    if(s[i] == s[i-1]){
      ans--;
      if(i < N - 1){
        s[i+1] = '0';
      }
    }
  }*/

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

  cout << N - cnt << endl;
  return 0;
}


Measured memory_bytes: 640
N = int(input())
residents = [[["0" for rooms in range(10)]for floor in range(3)]for builds in range(4)]

for i in range(N):
    b,f,r,v = list(map(int, input().split()))
    new_number = int(residents[b-1][f-1][r-1])+ v
    residents[b-1][f-1][r-1] = str(new_number)

for buils_num in range(4):
    for floor_num in range(3):
        print(' '+' '.join(residents[buils_num][floor_num]))
    if buils_num < 3:
        print('#'*20)

Measured memory_bytes: 7732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vc vector
#define a first
#define b second
#define pb push_back
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)

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

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

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

void Main(){
  int N; cin >> N;
  map<string, int> ma;
  rep(i, 0, N){
    string tmp; cin >> tmp;
    ma[tmp]++;
  }
  int max = 0;
  for(pair<string, int> x : ma){
    chmax(max, x.second);
  }
  vc<string> v;
  for(pair<string, int> x : ma){
    if(x.second == max) v.push_back(x.first);
  }
  sort(all(v));
  for(string s : v){
    cout << s << endl;
  }
}

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

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();

  return 0;
}


Measured memory_bytes: 25584
# 2020/04/23
# AtCoder Beginner Contest 095 - C

# Input
a, b, c, x, y = map(int,input().split())

# Calc
case1 = a * x + b * y
case2 = x * 2 * c + max(0, (y - x) * b)
case3 = max(0, (x - y) * a) +  y * 2 * c
case4 = max(x, y) * 2 * c

ans = min(case1, case2, case3, case4)

# Output
print(ans)


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

int main(){
    int n, q, A[20] = {}, dp[20][2001] = {};
    
    cin >> n;
    rep(i, n) cin >> A[i];
    
    rep(i, n){
        
        if(!i){
            dp[i][0] = 1;
            dp[i][A[i]] = 1;
            continue;
        }
        
        rep(j, 2001){
            if(j < A[i]) dp[i][j] = dp[i - 1][j];
            else dp[i][j] = dp[i - 1][j] || dp[i - 1][j - A[i]];
        }
        
    }
    
    cin >> q;
    rep(i, q){
        int m;
        cin >> m;
        if(dp[n - 1][m]) cout << "yes" << endl;
        else cout << "no" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int lli;
 
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
    lli a,b,k;
    cin>>a>>b>>k;
    if(k>=a+b) cout<<"0 0\n";
    else if(k>a) cout<<"0 "<<b-(k-a)<<'\n';
    else cout<<a-k<<' '<<b<<'\n';
}

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

long long Q, H, S, D, N;

long long goodOneLiter(){
	long long MAX = 0;
	MAX = min(Q*4,H*2);
	MAX = min(MAX,S);
	MAX = min(MAX,Q*2+H);
	return MAX;
}

long long goodTwoLiter(){
	long long MAX = 0;
	MAX = min(Q*8,H*4);
	MAX = min(MAX,S*2);
	MAX = min(MAX,D);
	MAX = min(MAX,Q*4+S);
	MAX = min(MAX,Q*4+H*2);
	MAX = min(MAX,Q*2+H*3);
	MAX = min(MAX,Q*2+H+S);
	MAX = min(MAX,H*2+S);
	return MAX;
}

int main() {
	cin>>Q>>H>>S>>D>>N;
	if(N%2 == 0){
		if(goodTwoLiter() > 2*goodOneLiter()){
			cout<<N*goodOneLiter();
		}
		else cout<<(N*goodTwoLiter())/2;
	}
	else{
		if(N>1){
			if(goodTwoLiter() > 2*goodOneLiter()){
				cout<<N*goodOneLiter();
			}
			else{
				cout<<((N/2)*goodTwoLiter()) + goodOneLiter();
			}
		}
		else cout<<goodOneLiter();
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>

using namespace std;

int main(){

    string s;
    cin>>s;

    int q;
    cin>>q;

    int count=0;
    int check=1;

    for(int i=0;i<q;i++){
        int t;
        cin>>t;
        if(t==1){
            count++;
            check*=-1;
        }
        else{
            int f;
            cin>>f;
            string c;
            cin>>c;
            if(check==1){
                if(f==1){
                    s.insert(0,c);
                }
                else{
                    s.append(c);
                }
            }
            else{
                if(f==2){
                    s.insert(0,c);
                }
                else{
                    s.append(c);
                }
            }
        }
    }

    if(count%2==1){
        for(int j=0,k=s.size()-1;j<s.size()/2;j++,k--){
                int tmp = s[j];
		        s[j] = s[k];
		        s[k] = tmp;
        }
    }
    cout<<s<<endl;

    return 0;
}


Measured memory_bytes: 900
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
//________
#define pb push_back
#define fi first
#define se second
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define reps(i,f,n) for(int i=(f); i<=(n); ++i)
#define err(...) fprintf(stderr, __VA_ARGS__ )
#define show(x) cerr << #x << ':' << (x) << endl
#define outl(x) cout << (x) << '\n'
#define FAST() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, B b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, B b){return b<a ? a=b,1 : 0;}
inline bool inside(int y, int x, int H, int W){return(y>=0 && x>=0 && y<H && x<W);}
const int dx[] = {1, 0, -1, 0,  1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1,  -1, 1, 1, -1};
#define INF  0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define NIL -1
//________

int A, B, C;
int X;

signed main()
{
   FAST();
   cin >> A >> B >> C;
   cin >> X;

   // int sum = C;
   // sum += 2 * B + 10 * A;

   int cnt = 0;
   X /= 50;

   reps(i, 0, A){
      reps(j, 0, B){
         reps(k, 0, C){
            if(i*10 + j*2 + k == X)++cnt;
         }
      }
   }

   outl(cnt);
}



Measured memory_bytes: 256
#include <array>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

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

LL lcm(LL a, LL b)
{
    return (b / gcd(a, b)) * a;
}

int main()
{
    LL N;
    cin >> N;
    LL T[N];
    REP(i, N)
    {
        cin >> T[i];
    }
    LL ans = T[0];
    REP(i, N)
    {
        ans = lcm(ans, T[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
sum_a = sum(a)
b = list(map(int, input().split()))
for i in range(n):
    if b[i] >= a[i]:
        b[i] -= a[i]
        a[i] = 0
    else:
        a[i] -= b[i]
        continue
    a[i + 1] -= b[i]
    if a[i + 1] < 0:
        a[i + 1] = 0

if a[-1] < 0:
    a[-1] = 0
print(sum_a - sum(a))

Measured memory_bytes: 97596
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cfloat>
#include <climits>
#include <cassert>
#include <random>
#include <fstream>


int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}
struct Rational {
	Rational(int num, int den) : numerator{ num }, denominator{ den } {
		const auto g = gcd(num, den);
		numerator /= g;
		denominator /= g;
	}
	Rational(int value) : numerator{ value }, denominator{ 1 }{}
	int numerator, denominator;
	Rational operator+(const Rational that) const {
		return Rational(numerator * that.denominator + that.numerator * denominator, denominator * that.denominator);
	}
	bool operator<(const Rational that) const {
		return numerator * that.denominator < denominator * that.numerator;
	}
};
std::ostream& operator<<(std::ostream& os, const Rational& that) {
	return os << that.numerator << '/' << that.denominator;
}
int main(){
	while (true) {
		int prime, n; std::cin >> prime >> n; if (prime == 0) break;
		Rational lower(1), upper(n);
		double sqrt = std::sqrt(prime);
		for (auto i = 1; i <= n; ++i) {
			const int l = sqrt * i;
			if (l <= n && lower < Rational(l, i)) {
				lower = Rational(l, i);
			}
			if (l + 1 <= n && Rational(l + 1, i) < upper) {
				upper = Rational(l + 1, i);
			}
		}
		std::cout << upper << ' ' << lower << '\n';
	}
}



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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, x;
  cin >> n >> x;
  
  int mini = 100001;
  
  vector<int> m(n);
  rep(i, 0, n) {
    cin >> m.at(i);
    mini = min(mini, m.at(i));
    x -= m.at(i);
  }
  
  cout << n + x/mini << "\n";
  
}


Measured memory_bytes: 256
import collections
n=int(input())
name = [input()[0] for x in range(n)]
c = collections.Counter(name)
march = [c['M'],c['A'],c['R'],c['C'],c['H']]
# ((a+b+c+d+e)^3-3(a^2+b^2+c^2+d^2+e^2)*(a+b+c+d+e)+2(a^3+b^3+c^3+d^3+e^3))//6
s = sum(march)
s2 = sum([x**2 for x in march])
s3 = sum([x**3 for x in march])
print((s**3-3*s2*s+2*s3)//6)

Measured memory_bytes: 4216
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <cmath>
#include <math.h>

using namespace std;
const long long INF = (long long) (1e18)+1;
int x,y;

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

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

using namespace std;

void printCurrent(vector<int> a) {
    for (int i = 0; i < a.size(); i++) {
        if (i != 0) {
            cout << " ";
        }
        cout << a[i];
    }
    cout << endl;
}

vector<int> insertionSort(vector<int> a) {
    for (int i = 1; i < a.size(); i++) {
        int v = a[i];
        int j = i - 1;
        while (j >=0 && a[j] > v) {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
        printCurrent(a);
    }
    return a;
}

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

    return 0;
}


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

int main() {
  int h,w,n;
  cin>>h>>w>>n;
  int c[10005];
  int now=0;
  for (int i=1; i<=n; i++) {
    int x;
    cin>>x;
    for (int j=0; j<x; j++) {
      c[now]=i;
      now++;
    }
  }
  for (int i=1; i<h; i+=2) {
    reverse(c+i*w,c+(i+1)*w);
  }
  for (int i=0; i<h*w; i++) {
    cout<<c[i];
    if ((i+1)%w==0) cout<<endl;
    else cout<<' ';
  }
  return 0;
}

Measured memory_bytes: 384
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: isize,
        s: [String; n]
    }

    let mut ans = vec![0; 4];
    for i in s {
        if i == "AC" { ans[0] += 1 }
        if i == "WA" { ans[1] += 1 }
        if i == "TLE" { ans[2] += 1 }
        if i == "RE" { ans[3] += 1 }
    }

    println!("AC x {}", ans[0]);
    println!("WA x {}", ans[1]);
    println!("TLE x {}", ans[2]);
    println!("RE x {}", ans[3]);
}


Measured memory_bytes: 7792