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

#define INF (1<<31)-1
#define LINF (1LL<<63)-1LL
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    ll n,k;
    cin>>n>>k;
    vector<int> a(n);

    rep(i,n){
        cin>>a[i];
        --a[i];
    }

    map<int,int> vis;
    
    int cur = 0;
    int cyp,cyl;

    int tcnt=0;
    while(1){

        if(vis[cur] == 0){
            vis[cur] = tcnt;
        }else{

            cyl=tcnt-vis[cur];
            cyp=vis[cur];
            break;

        }

        cur = a[cur];
        ++tcnt;
    }


    if(k > cyp){
        k -= cyp;k %= cyl;k += cyp;
    }

    ans = 0;
    rep(i,k){
        ans = a[ans];
    }

    cout<< ans+1<< endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 13060
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false); cin.tie(0);
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const int nmax = 1e5 + 10;
int n;
int f[nmax];
int main() {
    IO;

    cin >> n;
    vector <int> d;
    d.push_back(1);
    int t = 1;
    for (int i = 1; i <= 6; i++) {
        t *= 6;
        d.push_back(t);
    }
    t = 1;
    for (int i = 1; i <= 5; i++) {
        t *= 9;
        d.push_back(t);
    }
    f[0] = 0;
    for (int i = 1; i <= n; i++) {
        f[i] = (int) 1e9;
        for (int j = 0; j < d.size(); j++) 
            if (i >= d[j]) 
                f[i] = min(f[i], f[i - d[j]] + 1);
    }
    cout << f[n];
    return 0;
}


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


//TEMPLATE
#define pb                push_back
#define mp                make_pair
#define ll                long long
#define ld                long double
#define pii               pair <ll, ll>
#define piii              pair <ll, pii>
#define F                 first
#define S                 second

#define newline           printf("\n")
#define minusone          printf("-1\n")
#define zeroo             printf("0\n")
#define scl1(a)           scanf("%lld", &a)
#define scl2(a, b)        scanf("%lld %lld", &a, &b)
#define scl3(a, b, c)     scanf("%lld %lld %lld", &a, &b, &c)
#define prl1(a)           printf("%lld\n", a)
#define prl2(a, b)        printf("%lld %lld\n", a, b)
#define ssl1(s)           scanf(" %[^\n]", s)
#define scd1(a)           scanf("%lf", &a)
#define scd2(a, b)        scanf("%lf %lf", &a, &b)
#define prd(a)            printf("%lf\n", a)
#define prld(a)           printf("%Lf\n", a)
#define prcase(cs)        printf("Case %lld: ", cs)
#define cin1(a)           cin >> a
#define cin2(a, b)        cin >> a >> b
#define cin3(a, b, c)     cin >> a >> b >> c
#define cin4(a, b, c, d)  cin >> a >> b >> c >> d
#define cot1(a)           cout << a << "\n"
#define cot2(a, b)        cout << a << " " << b << "\n"
#define cot3(a, b, c)     cout << a << " " << b << " " << c << "\n"
#define cot4(a, b, c, d)  cout << a << " " << b << " " << c << " " << d << "\n"
#define cotline           cout << "\n"
#define cotminus          cout << "-1\n"
#define cot0              cout << "0\n"
#define cotyes            cout << "YES\n"
#define cotno             cout << "NO\n"
#define cotcase(cs)       cout << "Case " << cs << ": "

#define reversed(s)       reverse(s.begin(), s.end())
#define asort(s)          sort(s.begin(), s.end())
#define dsort(s)          sort(s.rbegin(), s.rend())
#define all(s)            s.begin(), s.end()
#define uniq(s)           s.resize(distance(s.begin(),unique(s.begin(), s.end())))
#define found(s, x)       (s.find(x) != s.end())

#define for0(i, n)        for (i = 0; i < n; i++)
#define for1(i, n)        for (i = 1; i <= n; i++)
#define fora(i, a, b)     for (i = a; i <= b; i++)
#define forb(i, b, a)     for (i = b; i >= a; i--)
#define fori(it, s)       for(auto it = s.begin(); it != s.end(); it++)

#define FR                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ms(a, x)          memset(a, x, sizeof a)
#define bitcount(n)       __builtin_popcountll(n)

//#define pi              3.1415926536
#define pi                acos(-1)

const ll INF = LLONG_MAX;
const ll SZ = 4e5+5;
const ll mod = 1e9+7;


ll n;
ll a[SZ];
//ll b[SZ];



int main() {
    ll cs = 0, tc = 1, x, y, z, i, j, k, g, p, q, ans = 0, sum = 0, c = 0, t = 0;
//    ll a, b, d;
    string s, s1, s2;

    cin1(x);

    (x >= 30) ? cout << "Yes\n" : cout << "No\n";

    return 0;
}



Measured memory_bytes: 3624
N = int(input())

memberlist = []
testinomylist = []


for _ in range(N):

    A = int(input())
    tmpmemberlist = []
    tmptestinomylist = []
    
    for i in range(A):
        x, y = map(int, input().split())
        tmpmemberlist.append(x)
        tmptestinomylist.append(y)

    memberlist.append(tmpmemberlist)      # [[2,3],[1,3],[1]] こんな感じで人が収容
    testinomylist.append(tmptestinomylist) # [[0,1],[1],[0]]
        
ans = 0

for i in range(2 ** N):
    honestlist = []
    liarlist = []

    for j in range(N):  
        if ((i >> j) & 1):
            #if true 条件を満たした人を正直物として考える.
            honestlist.append(j+1)
        else:
            # if false の人は嘘つきものだと考える。
            liarlist.append(j+1)

    #正直な人だけを見ればいい。
    Flag = 0

    for honestnumber in honestlist: #bit全探索で得た正直な人の番号

        for X,Y in zip(memberlist[honestnumber-1] , testinomylist[honestnumber-1]): # 正直な人だけの証言
            if (Y == 0):
                if X in liarlist: #正直者の証言が食い違ってないか
                    pass
                else:
                    Flag = 1 
            elif (Y == 1):
                if X in honestlist:
                    pass
                else:
                    Flag = 1


    if Flag == 1:
        pass
    else:
        ans = max(ans,len(honestlist))

print(ans)
        


Measured memory_bytes: 9240
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <ctime>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int unt;
typedef long double db;
typedef pair <int, int> pii;
typedef vector <int> vi;

#define Fi first
#define Se second
#define pb push_back
#define mp make_pair
#define rep(x, a, b) for(int x = (a); x <= (b); ++ x)
#define per(x, a, b) for(int x = (a); x >= (b); -- x)
#define rop(x, a, b) for(int x = (a); x < (b); ++ x)
#define por(x, a, b) for(int x = (a); x > (b); -- x)
#define forE(x, a) for(int x = head[a]; x; x = nxt[x])

#ifdef DEBUG
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define debug(x)
#endif

const db eps = 1e-8;
const int inf = 0x3f3f3f3f;
const int Minf = 0x7f7f7f7f;
const LL INF = 0x3f3f3f3f3f3f3f3fll;
const LL MINF = 0x7f7f7f7f7f7f7f7fll;

int n, m; 

int head[656], to[656 * 656], nxt[656 * 656], tot;

void add(int x, int y) {
	to[++ tot] = y, nxt[tot] = head[x], head[x] = tot;
}

db f[656];

void dp(int k) {
	rep(i, 1, n) f[i] = 1e300;
	f[n] = 0;
	per(i, n - 1, 1) {
		db maxx = 0;
		db ans = 0;
		int cnt = 0;
		for(int j = head[i]; j; j = nxt[j]) {
			if(i == k) maxx = max(maxx, f[to[j]]);
			ans += f[to[j]];
			++ cnt;
		}
		if(i == k && cnt >= 2) ans -= maxx, cnt --;
		f[i] = ans / cnt + 1;
	}
}

int main() {
	scanf("%d%d", &n, &m);
	int u, v;
	rep(i, 1, m) scanf("%d%d", &u, &v), add(u, v);
	dp(0);
	db ans = f[1];
	rep(i, 1, n - 1) {
		dp(i);
		ans = min(ans, f[1]);
	}
	printf("%.10f\n", (double)ans);
}

Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <stack>

using namespace std;

int main(){
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  int dx = tx - sx;
  int dy = ty - sy;
  cout << string(dy,'U') << string(dx,'R');
  cout << string(dy,'D') << string(dx, 'L');
  cout << 'L' << string(dy+1,'U') << string(dx+1,'R');
  cout << 'D' << 'R' << string(dy+1,'D') << string(dx+1,'L') << 'U';
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
struct  Border {
	int position_height{ 0 }, position_width{ 0 };
};

void solve() {
	int width, height, h, k;
	std::cin >> width >> height >> h >> k;
	while (width != 0 && height != 0) {
		std::vector<int> start_pos(width);
		std::vector<int> point(width);
		for (auto i = 0; i < width; ++i) start_pos[i] = i;
		for (auto &p : point) std::cin >> p;
		std::vector<Border> border(height);
		for (auto &b : border) std::cin >> b.position_width >> b.position_height;
		std::sort(border.begin(), border.end(), [](const Border &a, const Border &b) {return a.position_height < b.position_height; });
		int sum{ 0 };
		for (auto b = border.rbegin(); b != border.rend(); ++b) {
			std::swap(point[b->position_width], point[b->position_width - 1]);
		}
		for (auto &b : border) {
			std::swap(start_pos[b.position_width], start_pos[b.position_width - 1]);
			if (start_pos[b.position_width] >= k && start_pos[b.position_width - 1] < k) {
				if (point[start_pos[b.position_width]] - point[start_pos[b.position_width - 1]] < sum) sum = point[start_pos[b.position_width]] - point[start_pos[b.position_width - 1]];
			}
			if (start_pos[b.position_width - 1] >= k && start_pos[b.position_width] < k) {
				if (point[start_pos[b.position_width - 1]] - point[start_pos[b.position_width]] < sum) sum = point[start_pos[b.position_width - 1]] - point[start_pos[b.position_width]];
			}
		}
		for (auto i = 0; i < k; ++i) {
			sum += point[i];
		}
		std::cout << sum << std::endl;
		std::cin >> width >> height >> h >> k;
	}
}
int main() {
	solve();
}


Measured memory_bytes: 3628
#include<stdio.h>

int main(){
  char s[8];
  scanf("%s",s);
  if(s[0]=='R'&&s[1]=='R'&&s[2]=='R'){puts("3");return 0;}
  if(s[0]=='R'&&s[1]=='R'){puts("2");return 0;}
  if(s[1]=='R'&&s[2]=='R'){puts("2");return 0;}
  if(s[0]=='R' || s[1]=='R' || s[2]=='R'){puts("1");return 0;}
  puts("0");
  return 0;
}

Measured memory_bytes: 1656
VMAX = 10000

def minCostSort(A, n):
	global VMAX
	VMIN = min(A)
	ans = 0
	B = A.copy()
	B.sort()
	T = [0] * (VMAX + 1)
	for i in range(n):
		T[B[i]] = i
	V = [False] * n
	for i in range(n):
		if V[i]:
			pass
		else:
			index = i
			minv = VMAX
			count = 0
			cycleweight = 0
			while 1:
				V[index] = True
				count += 1
				value = A[index]
				minv = min(minv, value)
				cycleweight += value
				index = T[value]
				if V[index]:
					break
			ans += min(cycleweight + (count - 2) * minv, cycleweight + minv + (count + 1) * VMIN)
	return ans


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


Measured memory_bytes: 5760
class UnionFind:
    # この時点でそれぞれのノードは自分を親としている
    # 初期化時に問題が0の頂点を認めるかに注意すること
    def __init__(self, n):
        self.N = n
        self.parent = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]

    # xの根を返す関数
    def root(self, x):
        visited_nodes = []
        while True:
            p = self.parent[x]
            if p == x:
                # 縮約
                for node in visited_nodes:
                    self.parent[node] = x
                return x
            else:
                visited_nodes.append(x)
                x = p

    # 木の結合を行う。親の配下に入る
    def unite(self, x, y):
        if not self.root(x) == self.root(y):
            if self.rank[x] > self.rank[y]:
                self.parent[self.root(y)] = self.root(x)
            else:
                self.parent[self.root(x)] = self.root(y)
                if self.rank[x] == self.rank[y]:
                    self.rank[self.root(y)] += 1

    def ifSame(self, x, y):
        return self.root(x) == self.root(y)

    # 木の根に到達すまでにたどるノードの配列を返す
    def printDebugInfo(self):
        print([self.root(i) for i in range(self.N)])


n, q = map(int, input().split())
tree = UnionFind(n)
for i in range(q):
    com, x, y = map(int, input().split())
    if com == 0:
        tree.unite(x, y)
    else:
        if tree.ifSame(x, y):
            print(1)
        else:
            print(0)



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

int main(void)
{
    long long N;
    cin >> N;
    vector<long long> D1(N);
    vector<long long> D2(N);
    for(long long i = 0; i < N; i++)
    {
        cin >> D1[i] >> D2[i];
    }
    long long count = 0;
    string ans = "No";
    for (long long i = 0; i < N; i++)
    {
        if (D1[i] == D2[i])
        {
            count++;
        }
        else
        {
            count = 0;
        }

        if (count == 3)
        {
            ans = "Yes";
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
n = int(input())

if n % 2 == 1:
  print(0)

else:
  cnt = 0
  ans = 0
  for i in range(n):
    if n>= 2*(5**(i+1)):
      cnt += 1
    else:
      break
  
  for j in range(cnt):
    ans += n//(2*(5**(j+1)))
  print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long ll;

int main() {

	vector < ll > a(3);
	REP(i,3) cin >> a[i];

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

	int ans = 0;
	while (abs(a[2] - a[0]) > 1) {
		a[0] += 2;
		ans++;
		sort(a.begin(), a.end());
	}

	if (a[0] == a[1] && a[1] == a[2]) {
		cout << ans << endl;
		return 0;
	}

	if (a[0] == a[1]) {
		cout << ans + 1 << endl;
		return 0;
	}

	if (a[1] == a[2]) {
		cout << ans + 2 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using stkll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    cin >> n;
    vll v = {-1, -1, -1};
    ll ans = 1;
    rep(i, n) {
        ll a;
        cin >> a;
        a--;
        ll cnt = upper_bound(v.begin(), v.end(), a) - lower_bound(v.begin(), v.end(), a);
        ans *= cnt;
        ans %= MOD;
        sort(v.begin(), v.end());
        if(lower_bound(v.begin(), v.end(), a) == v.end()) {
            cout << 0 << endl;
            return 0;
        }
        *lower_bound(v.begin(), v.end(), a) = a + 1;
        sort(v.begin(), v.end());
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n=sc.nextInt();
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		int d=sc.nextInt();
		int ans1=100000,ans2=1000000;
		for(int i=1;i<=n;i++) {
			if(a*i>=n) {
				ans1=i*b; break;
			}
		}
		for(int i=1;i<=n;i++) {
			if(c*i>=n) {
				ans2=i*d; break;
			}
		}
		System.out.println(Math.min(ans2, ans1));
		}
	}


Measured memory_bytes: 26368
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int ans = 0;
    for(int i = 0; i < s.length() - 1; i++) {
      if(s.charAt(i) != s.charAt(i + 1)) ans++;
    }
    System.out.println(ans);
  }
}

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

int n,k;

int dis[111];

int main()
{
    while(cin>>n>>k)
    {
        int sum=1;
        memset(dis,0,sizeof(dis));
        for(int i=0;i<n;i++)
        {
            int a,b;
            a=sum*2;
            b=sum+k;
            if(a<b)
                sum=a;
            else
                sum=b;
        }
        printf("%d\n",sum);
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<algorithm>
#include <vector>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<map>
#include<numeric>
#include<regex>
using namespace std;

typedef long long ll;
#define modulo 1000000007 // 10^9 + 7
#define MAX 1000000000 // 10^9

void f(int n, bool a[]) {
	for (int i = 0; i < 10; i++) {
		a[i] = n % 2;
		n /= 2;
	}
}

int main() {
	int N; cin >> N;
	bool F[10][100];
	int P[11][100];
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> F[j][i];
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 11; j++) {
			cin >> P[j][i];
		}
	}

	// i[j]==0 : j番目の時間帯に営業する
	int ans = -1 * MAX;

	for (int i = 1; i < 1024; i++) {
		bool a[10];
		f(i, a);
		int overlap[N]; // 店kと営業時間が何回かぶっているか
		for (int j = 0; j < N; j++) {
			overlap[j] = 0;
			for (int k = 0; k < 10; k++) {
				overlap[j] += a[k] * F[k][j];
			}
		}

		int temp_profit = 0;
		for (int j = 0; j < N; j++) temp_profit += P[overlap[j]][j];
		ans = max(ans, temp_profit);
	}

	cout << ans << endl;


	return 0;
}

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

using namespace std;

long long a,b,q;
long long s[100002];
long long t[100002];
long long x[100000];
long long slow, sup;
long long tlow, tup;

int main(){
  cin >> a >> b >> q;
  s[0] = -1e18;
  t[0] = -1e18;
  s[b+1] = 1e18;
  t[b+1] = 1e18;
  for(int i = 1 ; i <= a; i++){
    cin >> s[i];
  }
  for(int i = 1 ; i <= b; i++){
    cin >> t[i];
  }
  for(int i = 0; i < q; i++){
    cin >> x[i];
  }

  for(int i = 0; i < q; i++){
    slow = lower_bound(s , s + a+1 ,x[i]) - s -1;
    sup = slow+1;
    tlow = lower_bound(t, t + b+1, x[i]) - t - 1;
    tup = tlow+1;
//    cout << x[i] << " " <<  s[slow] <<  " " << s[sup] << " " << t[tlow] << " " << t[tup] <<endl;
    long long ans = min(
      {
        abs(s[slow]-x[i])+abs(t[tup]-s[slow]),
        abs(s[slow]-x[i])+abs(t[tlow]-s[slow]),
        abs(s[sup]-x[i])+abs(t[tup]-s[sup]),
        abs(s[sup]-x[i])+abs(t[tlow]-s[sup]),
        abs(t[tlow]-x[i])+abs(s[slow]-t[tlow]),
        abs(t[tlow]-x[i])+abs(s[sup]-t[tlow]),
        abs(t[tup]-x[i])+abs(s[slow]-t[tup]),
        abs(t[tup]-x[i])+abs(s[sup]-t[tup]),
      }
    );
    cout << ans << endl;
  }
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,x,d,mx,k;
int siz[55],fa[55],a[55];
ll ans,c[55],f[55*55*55];
int main(){
	cin>>n>>x>>d>>c[1]; mx=n*n*n,k=min(n,d); memset(f,0x3f,sizeof(f)); f[0]=0;
	for(int i=2;i<=n;++i) cin>>c[i]>>fa[i];
	for(int i=n;i>=1;--i) siz[i]++,siz[fa[i]]+=siz[i],c[fa[i]]+=c[i];
	for(int i=1;i<=n;++i) for(int j=1;j<=k;++j) for(int s=mx;s>=siz[i];--s) f[s]=min(f[s],f[s-siz[i]]+c[i]);
	for(int i=1;i<=n;++i) a[i]=i;
	sort(a+1,a+n+1,[](int x,int y){return c[x]*siz[y]<c[y]*siz[x];});
	for(int i=0;i<=mx;++i) if(f[i]<=x){
		ll tmp=i,las=x-f[i];
		for(int j=1;j<=n&&a[j]>1;++j){
			ll now=min(d-k+0ll,las/c[a[j]]);
			las-=c[a[j]]*now,tmp+=now*siz[a[j]]; 
		}
		tmp+=las/c[1]*siz[1];
		ans=max(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4920
using System;

namespace ABC148C
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] str = Console.ReadLine().Split(' ');
			long a = long.Parse(str[0]);
			long b = long.Parse(str[1]);
			long temp;
			long m, n;
			m = a;
			n = b;

			while(m % n != 0)
			{
				temp = n;
				n = m % n;
				m = temp;
			}
			Console.WriteLine(a * b / n);
		}
	}
}


Measured memory_bytes: 11092
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	set<int> st;
	REP(i, n) {
		int a;
		cin >> a;
		if (st.count(a))st.erase(a);
		else st.insert(a);
	}
	cout << st.size() << endl;
}


Measured memory_bytes: 4992
#include<iostream>
#include<math.h>
#include<stdlib.h>

#define INF -99999999999;
using namespace std;

void findcloss(int* A, int low, int high, int mid, int* maxleft, int* maxright, int* val)
{
    int leftsum = INF;
    int rightsum = INF;
    int sum = 0;
    
    for (int i = mid; i >= low; i--) {
        sum += A[i];
        if (sum > leftsum) {
            leftsum = sum;
            int* p = &i;
            *maxleft = *p;
        }
    }

    sum = 0;
    for (int i = mid+1; i <= high; i++) {
        sum += A[i];
        if (sum > rightsum) {
            rightsum = sum;
            int* p = &i;
            *maxright = *p;
        }
    }
    sum = leftsum + rightsum;
    int *p = &sum;
    *val = *p;
}

void findmax(int* A, int low, int high, int* anslow, int* anshigh, int* ansval)
{
    if (high == low) {
        int* p = &low;
        int* q = &high;
        int* r = &A[low];
        *anslow = *p;
        *anshigh = *q;
        *ansval = *r;
    }
    else {
        int mid = (int)floor((low + high) / 2);
        int leftlow = INF;
        int lefthigh = INF;
        int leftsum = INF;
        findmax(A, low, mid, &leftlow, &lefthigh, &leftsum);
        int rightlow = INF;
        int righthigh = INF;
        int  rightsum = INF;
        findmax(A, mid+1, high, &rightlow, &righthigh, &rightsum);
        int crosslow = INF;
        int crosshigh = INF;
        int crosssum = INF;
        findcloss(A, low,high,mid, &crosslow, &crosshigh, &crosssum);

        if (leftsum >= rightsum&&leftsum >= crosssum) {
            int* a = &leftlow;
            int* b = &lefthigh;
            int* c = &leftsum;
            *anslow = *a;
            *anshigh = *b;
            *ansval = *c;
        }
        else if (rightsum >= leftsum&&rightsum >= crosssum) {
            int* a = &rightlow;
            int* b = &righthigh;
            int* c = &rightsum;
            *anslow = *a;
            *anshigh = *b;
            *ansval = *c;
        }
        else {
            int* a = &crosslow;
            int* b = &crosshigh;
            int* c = &crosssum;
            *anslow = *a;
            *anshigh = *b;
            *ansval = *c;
        }
    }
}
int main()
{
    int N;
    cin >> N;
    int* A = (int*)malloc(sizeof(int)*(N + 1));
    int* B = (int*)malloc(sizeof(int)*(N + 1));
    A[0] = 0;
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
        B[i] = A[i]-A[i-1];
    }
    //B[i]?????????????????§??¨??????????????????????????°??????.
    int anslow = INF;
    int anshigh = INF;
    int ansval = INF;
    findmax(B, 2, N, &anslow, &anshigh, &ansval);
    cout << ansval << "\n";

    return 0;
}

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

int main(){
  long long N,D,count=0;
  cin >> N >> D;
  for(long long i=0;i<N;i++){
    long long X,Y;
    cin >> X >> Y;
    if(X*X+Y*Y<=D*D){
      count++;
    }
  }
  cout << count << endl;
}
      
    

Measured memory_bytes: 3572
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    S1 = input()
    S2 = input()
    # 縦
    if S1[0] == S2[0]:
        ans = 3

        # 1は縦，0は横
        prev = 1
    else:
        ans = 3 * 2
        prev = 0

    for i in range(1, N):
        # 1つ前が横
        if prev == 0:
            # 縦
            if S1[i] == S2[i]:
                prev = 1
                continue
            else:
                # 同じドミノ
                if S1[i - 1] == S1[i]:
                    continue
                # 違うドミノ
                else:
                    ans *= 3
                    ans %= MOD
        else:
            # 一つ前が縦
            # 縦
            if S1[i] == S2[i]:
                ans *= 2
                ans %= MOD
            else:
                prev = 0
                ans *= 2
                ans %= MOD

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <unordered_map>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

ll n, a, b;
int main() {
	cin >> n >> a >> b;
	vector<ll> cnt(n);
	vector<vector<ll>> s(n, vector<ll>(n, INF));
	REP(i, n)s[i][i] = 0;
	a--;
	b--;
	s[a][b] = 1;
	s[b][a] = 1;
	REP(i, n - 1) {
		FOR(j, i + 1, n) {
			s[i][j] = j - i;
			s[j][i] = j - i;
		}
	}
	REP(i, n)REP(j, n)s[i][j] = min(s[i][j], s[i][a] + s[b][j] + 1);
	REP(i, n)REP(j, n)s[i][j] = min(s[i][j], s[i][b] + s[a][j] + 1);
	REP(i, n - 1) FOR(j, i + 1, n) cnt[s[i][j]]++;
	REPO(i, n - 1) cout << cnt[i] << endl;
}


Measured memory_bytes: 31744
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define All(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef double db;
typedef vector<int> VI;
typedef pair<int,int> PII;
const db PI=acos(-1.0);
const db eps=1e-6;
const ll mod=1e9+7;
const int inf=2147483647;
const int maxn=100005;
ll qpow(ll x,ll y) {ll ans=1,base=x; while(y){if(y&1)ans=(ans*base)%mod;base=(base*base)%mod;y>>=1;} return ans;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}

int n,a[10105];
int vis[2000015];
int main(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",&a[i]);
	rep(i,1,n){
		int t=a[i];
		for(int j=2;j*j<=t;j++){
			if(t%j==0){
				int ge=0;
				while(t%j==0) t/=j,ge++;
				vis[j]=max(vis[j],ge);
			}
		}
		if(t!=1) if(!vis[t]) vis[t]=1;
	}
	// exit(0);
	ll ans=1;
	rep(i,1,2000005){
		rep(j,1,vis[i]) ans=(ans*i)%mod;
	}
	// exit(0);
	ll Ans=0;
	rep(i,1,n){
		Ans=(Ans+ans*qpow(a[i],mod-2)%mod)%mod;
	}
	printf("%lld\n",Ans);
	return 0;
}

Measured memory_bytes: 4096
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    x, y, z = gets.split.map(&:to_i)

    ans = (x - z) / (y + z)
    puts ans
  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 2172
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
           if(s=="SUN")
        cout<<"7";
            if(s=="MON")
        cout<<"6";
            if(s=="TUE")
        cout<<"5";
            if(s=="WED")
        cout<<"4";
            if(s=="THU")
        cout<<"3";
            if(s=="FRI")
        cout<<"2";
            if(s=="SAT")
        cout<<"1";
    return 0;



}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long a,b,c,t,r;
int main()
{
    cin>>a>>b>>c;
    if(a<0) a=-a;
    t=a/c;
    r=b-t;
    if(t>=b) cout<<a-b*c;
    else if(r%2==0) cout<<a%c;
    else cout<<c-a%c;
    system("pause");
}


Measured memory_bytes: 3692
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int a[100];
int b[100];

int main() {
  string s;
  int cnt =0;
  cin >> s;
  rep(i,3){
    if(s[i] == 'o') cnt++;
  }
  cout << 700 + cnt * 100 << endl;
}


Measured memory_bytes: 256
from collections import deque
N,M = map(int, input().split())
AB_s = [list(map(int, input().split())) for _ in range(M)]

MAP = [[] for _ in range(N)]
for AB in AB_s:
    A, B = map(int, AB)
    MAP[A-1].append(B)
    MAP[B-1].append(A)
answer = [0] * N
queue = deque([1])
answer[0] = N
while len(queue) > 0:
    P = queue.popleft()
    if True:
        for Q in MAP[P-1]:
            if answer[Q-1] == 0:
                answer[Q-1] = P
                queue.append(Q)
if min(answer) == 0:
    print("No")
else:
    print("Yes")
    for i in range(1,N):
        print(answer[i])


Measured memory_bytes: 119556
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<ctime>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<bitset>
#define ll long long 
#define ull unsigned long long 
#define mem(a) memset(a,0,sizeof(a))
#define rint register int 
#define rll register long long 
#define rull register unsigned long long 
#define rchar register char
#define rstring register string 
#define rfloat register float
#define rdouble register double 
#define fio ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define For(i,a,b) for(int i=a;i<b;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define cFor(i,a,b) for(int i=a;i>b;i--)
#define cFOR(i,a,b) for(int i=a;i>=b;i--)
#define lFor(i,a,b) for(ll i=a;i<b;i++)
#define lFOR(i,a,b) for(ll i=a;i<=b;i++)
#define lcFor(i,a,b) for(ll i=a;i>b;i--)
#define lcFOR(i,a,b) for(ll i=a;i>=b;i--)
#define watch(a) cout<<#a<<"="<<a<<endl
using namespace std;
const int maxn=5+2e5;
int h[maxn];
int main(){
	int n,k;
	cin>>n>>k;
	FOR(i,1,n)
		cin>>h[i];
	sort(h+1,h+1+n);
	ll ans=0;
	FOR(i,1,n-k)
		ans+=h[i];
	cout<<ans<<endl;		
} 

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main(){
    int x,a,b;
    cin >> x >> a >> b;
    if(b - a <= 0) cout << "delicious\n";
    else if(x - (b - a) >= 0) cout << "safe\n";
    else cout << "dangerous\n"; 
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h> 
int main()
{
	int a,b,d[1000],i=0;
	char c;
	scanf("%d %c %d",&a,&c,&b);
	while(c!='?')
	{
		i++;
		if(c=='+')
			d[i]=a+b;
		if(c=='-')
			d[i]=a-b;
		if(c=='*')
			d[i]=a*b;
		if(c=='/')
			d[i]=a/b;
		scanf("%d %c %d",&a,&c,&b);
	}
	for(a=1;a<=i;a++)
		printf("%d\n",d[a]);

	return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<stdio.h>
using namespace std;
int main() {
	int x,y,a,b;
	double z,l,m;
	cin>>a>>b;
	x=a/b;
	y=a%b;
	z=(double)a/(double)b;
	cout<<x<<" "<<y<<" ";
	printf("%8.5f",z);
	return 0;
}


Measured memory_bytes: 3228
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long int ll;

int main() {
  int R;
  cin>>R;
  
  double ans=(double)2*R*3.1415;
  
  cout<<ans<<endl;
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#ifdef LOCAL
	#define debug(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define debug(...) 42
#endif

#define sf scanf
#define pf printf
#define nl printf("\n")
#define ps(s) printf("%s",s.c_str())
#define mem(x,val) memset(x,val,sizeof x)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend() 
#define sz(x) (int)(x).size()
#define test_case int ___t;scanf("%d", &___t);for(int cs=1;cs<=___t;cs++)

inline string getString(int n){char ch[n+5];sf(" %s",ch);return string(ch);}
inline string getLine(int n)
{char ch[n+5];fgets(ch,n+5,stdin);string s=string(ch);s.pop_back();return s;}

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
typedef long long ll;
typedef pair<int,int>pii;

const int S=100100;
int main()
{
	int row,col,m;
	while(~sf("%d %d %d",&row,&col,&m))
	{
		int rf[row+5],cf[col+5];
		mem(rf,0);
		mem(cf,0);
		map<pii,bool>mp;
		for(int i=0;i<m;i++)
		{
			int r,c;
			sf("%d %d",&r,&c);
			rf[r]++;
			cf[c]++;
			mp[pii(r,c)]=true;
		}

		int mxr=*max_element(rf+1,rf+1+row);
		vector<int>mxvr;
		for(int i=1;i<=row;i++)
		{
			if(rf[i]==mxr)
			{	
				mxvr.push_back(i);
			}
		}

		int mxc=*max_element(cf+1,cf+1+col);
		vector<int>mxvc;
		for(int i=1;i<=col;i++)
		{
			if(cf[i]==mxc)
			{	
				mxvc.push_back(i);
			}
		}

		bool f=false;
		for(int r:mxvr)
		{
			for(int c:mxvc)
			{
				if(!mp[pii(r,c)])
				{
					f=true;
					break;
				}
			}
			if(f)break;
		}
		int ans=mxr+mxc;
		if(!f)ans--;
		pf("%d\n",ans);
	}	
    return 0;
}



































Measured memory_bytes: 28556
/*BISMILLAH*/
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    string s;
    cin>>s;
    ll m=0,i,cnt=0;
    for(i=0; i<3; i++)
    {
        if(s[i]=='R')
        {
            cnt++;

            m=max(m,cnt);
        }
        else
        {
            m=max(m,cnt);
            cnt=0;
        }
    }
    cout<<m;


}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	int X, N;
	cin >> X >> N;
	vector<int> p(N);
	rep(i, N) {
		cin >> p[i];
	}
	for (int diff = 0; ; diff++) {
		int search_plus = X + diff;
		int search_minus = X - diff;

		if(find(p.begin(), p.end(), search_minus) == p.end()) {
			cout << search_minus << endl;
			break;
		}
		if (find(p.begin(), p.end(), search_plus) == p.end()) {
			cout << search_plus << endl;
			break;
		}
	}

EndPoint:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG

	return 0;
}




Measured memory_bytes: 3196
a, b, c = list(map(int,input().split()))

max_num = max(a,b,c)
diff = max_num * 3 - sum([a,b,c])

if diff % 2 == 0:
    count = diff/2
else:
    count = 1 + (diff+1)//2
    
print(int(count))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

string board[6];
int h, w, k;

int check (int H, int W) {
    int cnt = 0;
    rep(i, h) rep(j, w) {
        if ((H >> i) & 1 || (W >> j) & 1 || board[i][j] != '#') continue;
        cnt++;
    }
    return cnt;
}

void solve() {
    cin >> h >> w >> k;
    rep(i, h) cin >> board[i];
    int ans = 0;
    rep(H, 1 << h) rep(W, 1 << w) {
        if (check(H, W) == k) ans++;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3644
import sys
input = sys.stdin.readline
import collections

n = int(input())
bit = []
for i in range(2 ** n):
    bit.append(format(i, '0{}b'.format(n)))
bit = sorted(bit, key=lambda a: -collections.Counter(a)['1'])

say = [[] for _ in range(n)]
for i in range(n):
    a = int(input())
    for _ in range(a):
        say[i].append([int(i) for i in input().split()])

answer = 0
for b in bit:
    failed = False
    for i, v in enumerate(b):
        if failed:
            break
        if v == '1':
            for s in say[i]:
                if int(b[s[0] - 1]) != s[1]:
                    failed = True
                    break
    if not failed:
        answer = b
        break

print(collections.Counter(b)['1'])


Measured memory_bytes: 52572
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Map;
import java.util.HashMap;

public class Main
{
    int n;
    int t[] = new int[101];
    int m;
    int p[] = new int[101];
    int x[] = new int[101];
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	for(int i = 0; i < m; i++) {
	    out(t[n] + x[i] - (t[p[i]] - t[p[i] - 1]));
	}
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	n = sc.nextInt();
	for(int i = 1; i <= n; i++) {
	    int tt = sc.nextInt();
	    t[i] = tt + t[i - 1];
	}
	m = sc.nextInt();
	for(int i = 0; i < m; i++) {
	    p[i] = sc.nextInt();
	    x[i] = sc.nextInt();
	}
    }

    void out()
    {
	
    }
    
    void out(int n)
    {
	System.out.println(n);
    }

    void out(char c)
    {
	System.out.print(c);
    }
    
    void out(String s)
    {
	System.out.println(s);
    }
}


Measured memory_bytes: 23636
// BEGINNING WITH THE NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b+c >= 22)
    cout<<"bust";
  else
    cout<<"win";
  return 0
;}


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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const ll INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

vi G[100010];
vl dp[2];

void dfs(int v, int p){
    dp[0][v] = dp[1][v] = 1;
    for(auto u : G[v]){
        if(u == p) continue;
        dfs(u, v);
        dp[0][v] *= dp[0][u] + dp[1][u];
        dp[1][v] *= dp[0][u];
        dp[0][v] %= mod;
        dp[1][v] %= mod;
    }
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");

    int n; cin >> n;
    rep(i,n-1){
        int x,y; cin >> x >> y;
        x--; y--;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    dp[0] = vl(n);
    dp[1] = vl(n);

    dfs(0, -1);
    cout << (dp[0][0] + dp[1][0]) % mod << endl;
    return 0;
}

Measured memory_bytes: 14208
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    int n,a,ans=0;
    cin>>n;
    vector<pair<int,int>> A;
    rep(i,n) cin>>a,A.push_back(make_pair(a,i+1));
    sort(A.begin(),A.end());
    rep(i,n) A[i].first=i+1;
    rep(i,n) ans+=abs(A[i].first-A[i].second)%2;
    cout<<ans/2;
}

Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <list>
#include <map>
#include <memory>
#include <queue>
using namespace std;

int main()
{
	int n, ans = 0;

	cin >> n;

	vector<int> gemVal(n), gemCost(n);
	//map<int, int> arr;

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

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

	/*for (int i = 0; i < n; i++)
	{
		arr[gemVal[i] - gemCost[i]] = i;
	}*/

	for (int i = 0; i < n; i++)
	{
		int minus = gemVal[i] - gemCost[i];
		if (minus > 0)
			ans += minus;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const int MOD = 1000000007;
const int MOD1 = 998244353;
ll gcd(ll x, ll y){
  if(y==0)return x;
  else return gcd(y,x%y);
}
int main() {
  ll n , a , b , c , d , e;
  cin >> n >> a >> b >> c >> d >> e;
  ll m = min({a,b,c,d,e});
  cout << ((n+m-1)/m)+4 << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,k;cin>>a>>b>>k;
  ll tak=max(0ll,a-k),aok=max(0ll,b+min(0ll,a-k));
  printf("%lld %lld\n",tak,aok);
  return 0;
}

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

using namespace std;

using ll = long long;

ll Solve() {
    ll n, k;
    cin >> n >> k;

    int max_t = 0;
    vector<pair<int, int>> dt(n);
    for (auto &&x: dt) {
        cin >> x.second >> x.first;
        max_t = max(max_t, x.second);
    }

    sort(dt.begin(), dt.end(), greater<pair<int, int>>());

    vector<int> num(max_t + 1);
    ll sum = 0, type = 0;
    for (int i = 0; i < k; ++i) {
        sum += dt[i].first;
        if (num[dt[i].second] == 0) ++type;
        ++num[dt[i].second];
    }

    ll max_score = sum + type * type;
    if (type == k) return max_score;


    int l = k - 1, r = k;
    while (0 <= l && r < n) {
        while (0 <= l && num[dt[l].second] == 1) --l;
        if (l < 0) break;
        while (r < n && num[dt[r].second] != 0) ++r;
        if (r == n) break;

        ll tmp_score = (sum - dt[l].first + dt[r].first) + (type + 1) * (type + 1);
        if (max_score < tmp_score) max_score = tmp_score;

        sum = sum - dt[l].first + dt[r].first;
        ++type;
        --num[dt[l--].second];
        ++num[dt[r++].second];
    }

    return max_score;
}

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

    cout << Solve() << endl;

    return 0;
}


Measured memory_bytes: 1408
#include <vector>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

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

    int A, B, C;
    cin >> A >> B >> C;

    cout << min(C, B /A) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define pb push_back
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define FILEIO freopen("C:/Users/Aman/Desktop/kachda/input.txt", "r", stdin); freopen("C:/Users/Aman/Desktop/kachda/output.txt", "w", stdout);

using namespace std;

signed main()
{
	//FILEIO
 	FAST
	
	string s;
	cin>>s;
	if(s == "keyence") return cout<<"YES\n", 0;
	int l = s.size();
	fr(i,0,l)
	{
		int j;
		fr(j,i,l)
		{
			int k;
			string temp;

			fr(k,0,l)
			{
				if( k < i || k > j) temp += s[k];
			}
			if(temp == "keyence") return cout<<"YES\n", 0;
		}
	}

	cout<<"NO\n";

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int A,B,C,D;
int main()
{
	scanf("%1d%1d%1d%1d",&A,&B,&C,&D);
	for(int i=1;i>(-2);i-=2)
		for(int j=1;j>(-2);j-=2)
			for(int k=1;k>(-2);k-=2)
				if(i*B+j*C+k*D+A==7)
				{
					printf("%d%c%d%c%d%c%d=7\n",A,(i==1?'+':'-'),B,(j==1?'+':'-'),C,(k==1?'+':'-'),D);
					return 0;
				}
	return 0;
}

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

using namespace std;

int main(){
	string s;
	cin>>s;
	for(int i=0;i<3;i++){
		if(s[i]==s[i+1]){
			printf("Bad\n");
			return 0;
		}
	}
	printf("Good\n");
	return 0;
}

Measured memory_bytes: 256