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

using ll = long long;

int solve(vector<ll> values)
{
    auto S = *max_element(begin(values), end(values));
    auto small_primes = vector<ll>();
    auto small_prime_limit = static_cast<int>(cbrt(S)) + 1;
    auto large_prime_squares = map<ll, ll>();
    auto large_prime_limit = static_cast<int>(sqrt(S)) + 1;
    auto is_prime = vector<bool>(large_prime_limit+1, true);
    for (auto p = 2LL; p <= large_prime_limit; p++) if (is_prime[p])
    {
        if (p <= small_prime_limit) small_primes.push_back(p);
        else large_prime_squares[p*p] = p;
        for (auto k = 2*p; k <= large_prime_limit; k += p)
            is_prime[k] = false;
    }

    auto normalize = [&](ll x)
    {
        for (auto p : small_primes)
        {
            auto cube = p*p*p;
            while (x % cube == 0) x /= cube;
        }
        return x;
    };

    auto counts = map<ll, int>();
    for (auto x : values)
        counts[normalize(x)]++;

    auto dual = [&](ll x)
    {
        auto y = 1LL;
        for (auto p : small_primes)
        {
            if (x % (p*p) == 0) y *= p;
            else if (x % p == 0) y *= p*p;
            while (x % p == 0) x /= p;
        }
        auto kv = large_prime_squares.find(x);
        if (kv != end(large_prime_squares)) y *= kv->second;
        else y *= x*x;
        return y;
    };

    auto result = 0;
    for (auto kv : counts)
    {
        auto x = kv.first, y = dual(x);
        if (counts.count(y) == 0) result += counts[x];
        else if (x < y) result += max(counts[x], counts[y]);
    }
    if (counts[1]) result++;
    return result;
}

int main()
{
    int N; scanf("%d", &N);

    auto values = vector<ll>(N);
    for (auto& x : values) scanf("%lld", &x);

    printf("%d\n", solve(values));
}


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

class union_find {
public:
    union_find(int n)
        : par_(n, -1)
    {}

    int root(int x) {
        return par_[x] < 0 ? x : par_[x] = root(par_[x]);
    }

    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if(x == y) {
            return false;
        } else {
            if(par_[x] < par_[y]) {
                par_[x] += par_[y];
                par_[y] = x;
            } else {
                par_[y] += par_[x];
                par_[x] = y;
            }
            return true;
        }
    }

    int size(int x) {
        return -par_[root(x)];
    }

private:
    std::vector<int> par_;
};

struct edge {
    int u, v, cost;
    int kind;

    bool operator<(edge const& e) const {
        if(cost == e.cost) {
            return kind > e.kind;
        }
        return cost < e.cost;
    }
};

using result = pair<int, int>;

using edges = vector<edge>;

result kruskal(edges const& ES, int offset, int V) {
    auto es = ES;
    for(auto& e : es) {
        if(e.kind == 0) {
            e.cost += offset;
        }
    }
    sort(es.begin(), es.end());
    result res = make_pair(0, 0);
    union_find uf(V);
    for(auto& e : es) {
        if(uf.unite(e.u, e.v)) {
            res.second += e.kind == 0;
            res.first += e.cost;
        }
    }
    return res;
}


int main() {
    int n, m, k;
    while(cin >> n >> m >> k, n) {
        edges es(m);
        for(int i=0; i<m; ++i) {
            int u, v, w; char l;
            cin >> u >> v >> w >> l;
            u--; v--;
            es[i] = edge{u, v, w, l - 'A'};
        }
        {
            union_find uf(n);
            for(int i=0; i<m; ++i) {
                uf.unite(es[i].u, es[i].v);
            }
            if(uf.size(0) != n) {
                cout << -1 << endl;
                continue;
            }
        }
        int lb = -100000, ub = 100000;
        while(ub - lb > 1) {
            int m = (lb + ub) / 2;
            auto t = kruskal(es, m, n);
            if(t.second < k) {
                ub = m;
            } else {
                lb = m;
            }
        }
        auto l = kruskal(es, lb, n);
        auto r = kruskal(es, ub, n);
        if(r.second <= k && l.second >= k) {
            cout << r.first - ub * k << endl;
        } else {
            cout << -1 << endl;
        }
    }
}


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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	long long N,A,B,C,D,E,m;
  cin >> N >> A >> B >> C >> D >> E;
  m = N - 1;
	cout << max({m / A,m / B,m / C,m / D,m / E}) + 5 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lint long long
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
using namespace std;


int main(){
  //cout << fixed << setprecision(12);
  lint A;
  string B;
  cin >> A >> B;
  
  string C = "";
  C.PB(B[0]);
  C.PB(B[2]);
  C.PB(B[3]);
  lint D = stoi(C);
  

  lint ans = (A * D) / 100;
  cout << ans << endl;
}
  


Measured memory_bytes: 3632
n = input()
ls = list(map(int, input().split()))

count = 0
is_succses = True

while is_succses:
	count += 1
	for i, x in enumerate(ls):
		if x % 2 == 0:
			is_succses = True
			ls[i] = int(x / 2)
		else:
			is_succses = False
			break

print(count - 1)

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

using namespace std;

using ll = long long int;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vs = vector<string>;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	string str;
	cin >> str;

	int n = stoi(str);

	int sum = 0;
	for (int i = 0; i < str.size(); i++) {
		int v = str[i] - '0';
		sum += v;
	}

	cout << (n % sum == 0 ? "Yes" : "No") << endl;
	return 0;
}

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

#define LEN(x) (int)x.size()
#define ALL(x) x.begin(), x.end()

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

const int MOD = 1'000'000'007;
const double EPS = 0.000'000'001;

inline int fcmp(double x, double y)
{ return (x < y + EPS ? (x < y - EPS ? -1 : 0) : 1);}

const int K = 1'000'10;
bool dp[K][2];

int main()
{
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    ios_base::sync_with_stdio(false);
    cout.precision(10);

    int n, k;
    cin >> n >> k;

    vi x(n);

    for(int& i : x) cin >> i;

    sort(ALL(x));

    for(int i = 0; i <= k; i++)
        dp[i][0] = 1, dp[i][1] = 0;

    for(int j = 0; j < k; j++)
    {
        for(int i : x)
        {
            if(i + j > k) break;

            dp[j + i][0] = min(dp[j][1], dp[j + i][0]);
            dp[j + i][1] = max(dp[j + i][1], dp[j][0]);
        }
    }

    string ans = !dp[k][0] ? "First" : "Second";

    cout << ans << endl;

    return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) { cin >> v[i]; }
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      ans += v[i] * v[j];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
from itertools import permutations
"""
どの順番に出てくるかをすべて（6通り）ためす
そこからa,b,cのずれ幅の組み合わせ（2000**2）をためす
判定をO(1)ですると
2000*2*6 = 2.4*10**7
x: aとbのずれ幅
y: aとcのずれ幅
"""
def main():
    ss = sorted([input() for _ in range(3)])
    n = len(max(ss, key=len))
    d = [[[None]*n for _ in range(3)] for _ in range(3)]
    ans = n*3
    for s in permutations(ss):
        for i in range(3):
            li = len(s[i])
            for j in range(i, 3):
                lj = len(s[j])
                for k in range(li):
                    ok = True
                    for ni in range(k, li):
                        nj = ni - k
                        if nj >= lj:
                            break
                        if s[i][ni] == "?" or s[j][nj] == "?":
                            continue
                        if s[i][ni] != s[j][nj]:
                            ok = False
                    d[i][j][k] = ok
        f = lambda i, j, k: True if k>=len(s[i]) else d[i][j][k]
        for x in range(n):
            for y in range(n):
                if not f(0, 1, x):
                    continue
                if not f(1, 2, y):
                    continue
                if not f(0, 2, x+y):
                    continue
                now = max([0, len(s[0]), x+len(s[1]), x+y+len(s[2])])
                ans = min(ans, now)
    print(ans)
                
if __name__ == "__main__":
    main()

Measured memory_bytes: 51292
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000000ll
#define all(x) x.begin(),x.end()
#define fi first
#define se second
using pint = pair<int,int>;
using vec = vector<int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    
    ll ansb, ansa;
    ll cntb1,cntb2,cntb3;
    cntb1 = b/c;
    cntb2 = b/d;
    cntb3 = b/((c*d)/__gcd(c,d)); 
    ansb = b - cntb1 - cntb2 + cntb3;
    ll cnta1 = a/c;
    ll cnta2 = a/d;
    ll cnta3 = a/((c*d)/__gcd(c,d));
    ansa = a - cnta1 - cnta2 + cnta3;
    ll sub=0;
    if(a%c!=0 && a%d!=0) sub=1; 
    cout<<ansb - ansa + sub<<endl;
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll a[6],f;
ll i, j,ans;
int main(){
    fornum(i,0,6){
        scanf("%lld", &a[i]);

    }
    j = 1;
    fornum(i,1,6){
        if(a[i]<a[j]){
            j = i;
        }
    }
    printf("%lld",a[0]/a[j]+(a[0]%a[j]?1:0)+4);
    return 0;
}

Measured memory_bytes: 256
from itertools import combinations_with_replacement as comb_rplc
N,M,Q = map(int,input().split())
array = [ list(map(int,input().split())) for _ in range(Q) ]
ans = 0
for seq in comb_rplc(range(1, M + 1), N):
  score = 0
  for a,b,c,d in array:
    if seq[b-1] - seq [a-1] == c:
      score += d
  ans = max(score,ans)
print(ans)
    


Measured memory_bytes: 9100
def f(n):
    if n % 2 == 0:
        return n /2 
    else:
        return 3 * n + 1

def ans1(s):
    a = list()
    a.append(s)
    a.append(f(s))

    while True:
        x = f(a[-1])
        if x in a:
            return len(a) + 1
        else:
            a.append(x)

s = int(input())
print(ans1(s))


Measured memory_bytes: 2940
class Switch
   def initialize
	  @cars = []
   end
   def input(x)
	  @cars.push(x)
   end
   def output
	  puts @cars[-1]
	  @cars.slice!(-1)
   end
end
s = Switch.new
while line = gets
   num = line.to_i
   if num != 0
	  s.input(num)
   else
	  s.output
   end
end

Measured memory_bytes: 6084
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int a=scanner.nextInt();
        int b=scanner.nextInt();
        int c=scanner.nextInt();
        int i;
        for(i=1;i<=100;i++){
            if((a*i)%b==c){
                break;
            }
        }
        if((a*i)%b==c){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}




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

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define all(x) x.begin(), x.end()

template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 & y) {if (x > y) x = y;}
template <typename T1, typename T2> inline void chkmax(T1 &x, const T2 & y) {if (x < y) x = y;}

pair<int, int> read_string() {
	string s;
	cin >> s;
	int bal = 0;
	int min_bal = 0;
	for (auto i : s) {
		if (i == '(') {
			bal++;
		} else {
			bal--;
		}
		chkmin(min_bal, bal);
	}
	return {min_bal, bal};
}

int n;
vector<pair<int,int>> a;

void read() {
	cin >> n;
	a.resize(n);
	for (auto &i : a) {
		i = read_string();
	}
}	

void no() {
	cout << "No\n";
	exit(0);
}

void check() {
	int bal = 0;
	for (auto i : a) {
		if (bal + i.first < 0) return;
		bal += i.second;
	}
	if (bal != 0) return;
	cout << "Yes\n";
	exit(0);
}

int sign(int x) {
	if (x >= 0) return 1;
	return -1;
}

void run() {
	sort(all(a), [&] (pair<int, int> i, pair<int, int> j) {
		if (sign(i.second) != sign(j.second)) return sign(i.second) > sign(j.second);
		if (sign(i.second) >= 0) return i.first > j.first;
		return i.first - i.second < j.first - j.second;
	});
	check();
}

void write() {
	cout << "No\n";
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	write();
	return 0;
}


Measured memory_bytes: 11084
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<queue>
#define _USE_MATH_DEFINES
#include<math.h>
#include<cmath>
#include<ctime>
#include<map>
#define R(i, n) for(int i = 0;i < n;i++)
#define S(a) scanf("%d", &a)
#define S2(a, b) scanf("%d%d", &a, &b)
#define S3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define SL(a) scanf("%lld", &a)
#define SL2(a, b) scanf("%lld%lld", &a, &b)
#define SL3(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)
#define SA(i, n, a) R(i, n) scanf("%d", a + i)
#define SAL(i, n, a) R(i, n) scanf("%lld", a + i)
#define SC(a) scanf("%c", &a);
#define P(a) printf("%d", a)
#define PL(a) printf("%lld", a)
using namespace std;
using ll = long long;
using PR = pair<int, int>;
const ll MOD = 1e+9 + 7;
const int INF = 1e+9;

int N, K;
bool B[100];

int main() {
	S2(N, K);
	R(i, K) {
		int d = 0;
		S(d);
		R(j, d) {
			int a = 0;
			S(a);
			B[a - 1] = true;
		}
	}
	int ans = 0;
	R(i, N) {
		if (!B[i]) ans++;
	}
	P(ans);
}



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

int main(){
	
char s[3];
cin >> s;
int count = 0;

for(int i=0; i<3; i++){
	if(s[i] == 'R') {count++; }
}

if(count == 2){

if(s[0] == 'R' && s[1] == 'R') { cout << '2'; }

if(s[1] == 'R' && s[2] == 'R') { cout << '2'; }


if(s[0] == 'R' && s[2] == 'R') { cout << '1'; }
}

if(count == 1) {cout << '1';}
if(count == 0) {cout << '0';}
if(count == 3) {cout << '3';}



return 0;
	
}


Measured memory_bytes: 3636
#include <algorithm>
#include <math.h>
#include <map>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

void A_Serval_vs_Monster(void) {

	int H, A;
	cin >> H >> A;

	cout << ((H % A == 0) ? H / A : int(H / A) + 1);
	return;
}

void B_Common_Raccoon_vs_Monster(void) {

	int H, N;
	cin >> H >> N;

	int sum = 0;
	int A;
	for (int loop = 0; loop < N; loop++) {
		cin >> A;
		sum += A;
	}

	cout << ((sum >= H) ? "Yes" : "No") << flush;
	return;
}

void C_Fennec_vs_Monster(void) {

	int N, K;
	cin >> N >> K;

	vector<int> H(N);
	for (int& it : H) cin >> it;
	sort(H.begin(), H.end());

	long long sum = 0;
	for (int loop = 0; loop < N - K; loop++) sum += H[loop];

	cout << sum << flush;
	return;
}

int main(void) {

	//A_Serval_vs_Monster();
	//B_Common_Raccoon_vs_Monster();
	C_Fennec_vs_Monster();
	return 0;
}


Measured memory_bytes: 1024
//
// Created by kuroneko on 2019-07-06.
//

using namespace std;

#include <iostream>
#include <vector>
#include <cmath>

typedef long long ll;
int INF = 1000000007;

int main() {
    int N, M; cin >> N >> M;
    int a[N], dp[N+1];
    for (int i = 0; i < N; i++) a[i] = 1;
    for (int i = 0; i < M; i++) {
        int c;
        cin >> c;
        a[c] = 0;
    }

    if (N == 1) {
        cout << 1 << endl;
        return 0;
    }

    dp[0] = 1;
    dp[1] = a[1];
    for (int i = 2; i < N+1; i++) {
        dp[i] = ((dp[i-1] * a[i-1]) % INF + (dp[i-2] * a[i-2]) % INF) % INF;
    }

    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <complex>

using namespace std;
using pii = pair<int, int>;
using ll = long long;

ll gcd(ll a, ll b)
{
	return (b == 0) ? a : gcd(b, a % b);
}

bool isp(ll n)
{
	if (n % 2 == 0) return false;
	ll sqn = sqrt(n);
	for (ll i = 3; i <= sqn; i += 2) if (n % i == 0) return false;
	return true;
}

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

	vector<int> era(1000001);
	era[1] = era[2] = 1;
	for (int i = 3; i <= 1000000; i += 2) {
		if (era[i] == 0) {
			era[i] = 1;
			for (int j = i + i; j <= 1000000; j += i) era[j] = -1;
		}
	}

	ll a, b;
	cin >> a >> b;
	ll g = gcd(a, b);

	ll sqg = sqrt(g);
	int answer = 0;
	for (ll i = 1; i <= sqg; i++) {
		if (g % i == 0) {
			if (era[i] == 1) answer += 1;
			if (i != g / i && isp(g / i)) answer += 1;
		}
	}
	cout << answer;
	
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll k, a, b, c, ans = 0;
  cin >> a >> b >> c >> k;
  while (a >= b) b *= 2, ans++;
  while (b >= c) c *= 2, ans++;
  cout << (k >= ans ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3632
N, X= gets.split(" ").map(&:to_i)

def F(n, x) 
    return 1 if n == 0
    return 0 if x == 1
    pcnt = 2**(n + 1) - 1 #レベルｎのバーガーのうちパディの個数
    return 2**n if x == pcnt #xがバーガーの真ん中までだった場合
    return 2**(n + 1) - 1 if x == 2 * pcnt - 1 #xがバーガー全体だった場合
    if pcnt < x 
        2**n + F(n - 1, x - pcnt) #後半部分だけで数える
    else # pcnt > x 再帰的に求める
        F(n - 1, x - 1) 
    end
end

puts F(N, X)


Measured memory_bytes: 1788
import math

a, b, h,m = map(int,input().split())

h_deg = (60 * h + m) * (360 / (60*12))
m_deg = m * (360 / 60)
deg = abs(h_deg-m_deg)
rad = math.radians(deg)

c = a ** 2 + b ** 2 - 2 * a * b  * math.cos(rad)

print(math.sqrt(c))



Measured memory_bytes: 9556
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e6,mod=1e9+7;
int n,ans,now,inv[maxn];
int qpow(int x,int i){
	int res=1;
	while(i){
		if(i&1){res=1ll*res*x%mod;}
		x=1ll*x*x%mod;i/=2;
	}
	return res;
}
int main(){
	scanf("%d",&n);
	inv[1]=1;
	for(int i=2;i<=n;i++){inv[i]=1ll*inv[mod%i]*(mod-mod/i)%mod;}
	ans=0;now=1;
	for(int i=1;i<=n;i++){
		now=(1ll*now*(1+mod)/3)%mod;
		ans=(ans+1ll*now*inv[n-i+1])%mod;
	}
	printf("%lld\n",(1ll*ans*qpow(n,mod-2))%mod);
	return 0;
}

Measured memory_bytes: 4352
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/04/04.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC128
//
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;
//#define __DBG__

void solve(void){
  
  int A, B;
  
  cin >> A >> B;
  
  int ans=0;
  
  if(A>=13){
    ans = B;
  }
  else if(A>=6){
    ans = B/2;
  }
  
  cout << ans << endl;
  
  return;
   
}

#define TESTCASES 1

int main(int argc, const char * argv[]) {

    cin.tie(0);
    ios::sync_with_stdio(false);

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}




Measured memory_bytes: 256
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N=one_int()
S=one_str()

maxs=0
for i in range(1,N-1):
    temp = len(set(S[:i]) & set(S[i:]))
    if maxs < temp:
        maxs = temp

print(maxs)

Measured memory_bytes: 3064
#include <cstdio>
#include <vector>
#include <map>
#include <set>

using namespace std;

const int MAXN = 1e5+5;

int n, a[MAXN], b[MAXN];
vector <int> G[MAXN];
int sol;

map <int,int> ind;
multiset <int> s;
int cnt;

int sz;
bool bio[MAXN];

int dfs(int x) {
	sz++;
	bio[x] = 1;
	int ret = 1;
	for (int i: G[x]) {
		if (bio[i]) continue;
		ret &= dfs(i);
	}

	return ret & (x != a[n]);
}

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", a+i);
		if (ind[a[i]] == 0) ind[a[i]] = ++cnt;
		a[n] ^= a[i];
		a[i] = ind[a[i]];
		s.insert(a[i]);
	}
	if (ind[a[n]] == 0) ind[a[n]] = ++cnt;
	a[n] = ind[a[n]];
	s.insert(a[n]);
	for (int i = 0; i < n; ++i) {
		scanf("%d", b+i);
		if (ind[b[i]] == 0) ind[b[i]] = ++cnt;
		b[n] ^= b[i];
		b[i] = ind[b[i]];
		if (s.find(b[i]) == s.end()) sol = -1;
		else s.erase(s.find(b[i]));
	}
	if (ind[b[n]] == 0) ind[b[n]] = ++cnt;
	b[n] = ind[b[n]];
	if (s.find(b[n]) == s.end()) sol = -1;
/*
	for (int i = 0; i <= n; ++i) {
		printf("%d ", a[i]);
	}
	printf("\n");
	for (int i = 0; i <= n; ++i) {
		printf("%d ", b[i]);
	}
	printf("\n");
*/
	if (sol == -1) {
		printf("-1\n");
		return 0;
	}


	for (int i = 0; i <= n; ++i) {
		if (a[i] != b[i]) {
			G[a[i]].push_back(b[i]);
			G[b[i]].push_back(a[i]);
			sol++;
		}
	}

	for (int i = 1; i <= cnt; ++i) {
		if (bio[i]) continue;
		sz = 0;
		bool t = dfs(i);
		if (sz > 1) sol += t;
	}
	if (a[n] != b[n]) sol--;

	printf("%d\n", sol);
	return 0;
}



Measured memory_bytes: 17664
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
		for(int j=i+1;j<s.size();j++)
			if(s[i]=='C'&&s[j]=='F')
			{
				cout<<"Yes";
				return 0;
			}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include<iostream> 
#include <cstdlib>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++) 

int main() {
    int N;
    cin >> N;
    
    int a = N;
    int total = 0;
    while (a > 0) {
        total += a % 10;
        a = a / 10;
    }

    if (N % total == 0) {
        cout << "Yes" << endl;
    } else cout << "No" << endl;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(int)(a); i++)
typedef long long ll;
const ll mod = 1000000007;

int main()
{
  ll k; cin >> k;

  ll n = 50;
  cout << n << endl;

  ll x = k%n;
  ll y = k/n;
  for (int i=0; i<n; i++) {
    if (i > 0) cout << " ";
    if (i < x) cout << 2*n-1+y-x;
    else cout << n-1+y-x;
  }

  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void)
{
	int a,b,c,d,e,f,g;
	cin>>c;
	for (a=0;a<2;a++)
	{
		cin>>b;
		if (c>b)
		{
			c=b;
		}
	}
	cin>>d>>e;
	if (d<=e)
	{
		f=d+c-50;
		cout<<f<<endl;
	}
	else if (d>=e)
	{
		f=e+c-50;
		cout<<f<<endl;
	}
	return 0;
}
        

Measured memory_bytes: 3080
import java.util.*;
import java.awt.Point;

public class Main{
	public static int[] c;
	public static int[][] m;
	
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int v = s.nextInt();
		
		c = new int[n];
		m = new int[n][n];
		Point[] pp = new Point[v];
		for(int x=0;x<v;x++) {
			int one = s.nextInt()-1;
			int two = s.nextInt()-1;
			m[one][c[one]] = two;
			m[two][c[two]] = one;
			pp[x] = new Point(one, two);
			c[one]++;
			c[two]++;
		}
		
		int count = 0;
		for(Point p : pp) {
			int x = p.x;
			int y = p.y;
			
			boolean bridge = false;
			if(c[x]==1 || c[y]==1)
				bridge = true;
			else {
				Set<Integer> side = new HashSet<Integer>();
				side.add(p.y);
				pop(p, side);
				side.remove(p.y);
				Set<Integer> temp = new HashSet<Integer>();
				bridge = pop(p.y, p.x, side, temp);
			}
			
			
			if(bridge)
				count++;
		}
		
		System.out.println(count);
	}
	
	public static void pop(Point p, Set<Integer> set) {
		set.add(p.x);
		for(int x=0;x<c[p.x];x++) {
			int y = m[p.x][x];
			if(!set.contains(y) && y!=p.y)
				pop(new Point(y, p.x), set);
		}
	}
	
	public static boolean pop(int px, int prev, Set<Integer> set, Set<Integer> side) {
		side.add(px);
		for(int x=0;x<c[px];x++) {
			int y = m[px][x];
			if(set.contains(y) && y!=prev)
				return false;
			if(!side.contains(y) && y!=prev)
				pop(y, px, set, side);
		}
		
		return true;
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VS = vector<string>;
using graph = vector<vector<int>>;
int main()
{
ll n,k;
cin>>n>>k;
if (n>k)
{
    n%=k;
}

if (k==1||k==0)
{
    cout<<0<<endl;
    exit(0);
}

while (1)
{
    ll x=n;
    n=abs(n-k);
    if (n>x)
    {
       cout<<x<<endl;
       exit(0);
    }
    
}

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

int n;

string i2s(int a) {
  stringstream ss;
  ss << a;
  return ss.str();
}

int main() {
  scanf("%d", &n);
  rep (loop,n) {
    printf("Case %d:\n", loop + 1);
    int a;
    scanf("%d", &a);
    rep (i,10) {
      a *= a;
      string temp = i2s(a);
      while (temp.size() != 8) { temp.insert(0, 1, '0'); }
      string next = temp.substr(2, 4);
      a = atoi(next.c_str());
      printf("%d\n", a);
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(n); ++i)
#define REP(i, d, n) for(long long i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {//言語変えろ言語変えろ言語変えろ言語変えろ言語変えろ
            
ll a; cin>>a;
  ll k=100;
  ll c=0;
  while(k<a){k=k+k/100;c++;}
  
  cout<<c<<endl;
  
}

Measured memory_bytes: 3624
from collections import Counter

n, *a = map(int, open(0).read().split())
n += 1


def cmb(n, r, mod=10 ** 9 + 7):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n - r] % mod


def make_table(n, mod=10 ** 9 + 7):
    mod = mod
    N = n
    # 元テーブル
    g1 = [0] * (N + 1)
    g1[0] = 1
    g1[1] = 1

    # 逆元テーブル
    g2 = [0] * (N + 1)
    g2[0] = 1
    g2[1] = 1

    # 逆元テーブル計算用テーブル
    inverse = [0] * (N + 1)
    inverse[0] = 0
    inverse[1] = 1

    for i in range(2, N + 1):
        g1[i] = (g1[i - 1] * i) % mod
        inverse[i] = (-inverse[mod % i] * (mod // i)) % mod
        g2[i] = (g2[i - 1] * inverse[i]) % mod

    return g1, g2, inverse


d = Counter(a).most_common(1)[0][0]
lr = [i for i, e in enumerate(a) if e == d]
l = lr[1] - lr[0] + 1
g1, g2, inverse = make_table(n)
MOD = 10 ** 9 + 7

answer = [(cmb(n, i) - cmb(n - l, i - 1)) % MOD for i in range(1, n + 1)]
print('\n'.join(map(str, answer)))

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

using namespace std;

const int INF = 1000000000;

int dp(int curr, int n, const vector<int>& c, vector<vector<int>>& memo) {
    if (curr >= c.size()) {
        if (n == 0) {
            return 0;
        }
        else {
            return INF;
        }
    }
    if (memo[curr][n] >= 0) {
        return memo[curr][n];
    }

    int ret;
    if (c[curr] > n) {
        ret = dp(curr + 1, n, c, memo);
    }
    else {
        int takeThisAndStay = dp(curr, n - c[curr], c, memo) + 1;
        int takeThisAndNext = dp(curr + 1, n - c[curr], c, memo) + 1;
        int skipThis = dp(curr + 1, n, c, memo);
        ret = min(min(takeThisAndNext, takeThisAndStay), skipThis);
    }
    memo[curr][n] = ret;
    return ret;
}

void Main() {
    int n, m;
    cin >> n >> m;
    vector<int> c(m, 0);
    for (int i = 0; i < m; ++i) {
        cin >> c[i];
    }

    sort(c.begin(), c.end(), greater<int>());
    vector<vector<int>> memo(m + 10, vector<int>(n + 10, -1));
    int ans = dp(0, n, c, memo);
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}



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

typedef long long ll;
using namespace std;

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

	int w,h;
	char c;

	cin >> w >> h >> c;

	for (int i = 0;i < h;i++){
		for (int j = 0;j < w;j++){
			if(i == 0){
				if(j == 0 || j == w-1) cout << "+";
				else cout << "-";
			}else if(i == h-1){
				if(j == 0 || j == w-1) cout << "+";
				else cout << "-";
			}else if(j == 0 || j == w-1) cout << "|";
			else if(i == h/2 && j == w/2) cout << c;
			else cout << ".";
		}
		cout << endl;
	}	

	return 0;

}



Measured memory_bytes: 3164
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define fo(i,j,k) for(int i=j;i<=k;++i)
#define fd(i,j,k) for(int i=j;i>=k;--i)
using namespace std;
const int N=1<<17;
int a[N];
void wap(int &t,int x,int y){
	int t1=(t&(1<<x))>0,t2=(t&(1<<y))>0;
	t=t^(t1<<x)^(t2<<y)^(t2<<x)^(t1<<y);
}
int count(int k,int t){
	int cnt=0;
	fo(i,0,k-1) if(t>>i&1) ++cnt;
	return cnt;
}
int cut(int k,int t){
	return t^(t&(1<<k));
}
void solve(int k,int A,int B,int l,int r){
	if(k==1){
		a[l]=A,a[r]=B;
		return;
	}
	int p;
	fd(i,k-1,0)
	if((A>>i&1)!=(B>>i&1)) {p=i;break;}
	wap(A,p,k-1),wap(B,p,k-1);
	int num=count(k-1,A),mid=(l+r)>>1;
	int t=num&1?0:1,P=A&(1<<(k-1)),Q=B&(1<<(k-1));
	solve(k-1,cut(k-1,A),t,l,mid);
	solve(k-1,t,cut(k-1,B),mid+1,r);
	fo(i,l,mid) a[i]^=P;
	fo(i,mid+1,r) a[i]^=Q;
	fo(i,l,r) wap(a[i],p,k-1);
}
int main()
{
	int n,S,T;
	scanf("%d %d %d",&n,&S,&T);
	int cnt=0;
	fo(i,0,n-1) if((S>>i&1)!=(T>>i&1)) ++cnt;
	if(!(cnt&1)) return printf("NO"),0;
	solve(n,S,T,0,(1<<n)-1);
	printf("YES\n");
	fo(i,0,(1<<n)-1) printf("%d ",a[i]); 
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define fo(i,n)         for(i=0;i<n;i++)
#define Fo(i,k,n)       for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x, y)      cout << #x << "=" << x << "," << #y << "=" << y << endl
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const int N = 3e5, M = N;
//=======================

vi g[N];

void solve() {
	int i, j, n, m;
	cin >> n;
	if (n < 2) {
		cout << 0 << "\n";
		return ;
	}
	int ans = 1;
	// int ans = 1;
	fo(i, n) {
		ans = ((ans % mod) * 10) % mod;
	}
	int x = 1;
	int y = 1;
	fo(i, n) {
		x = ((x % mod) * (9)) % mod;
		y = ((y % mod) * (8)) % mod;
	}
	// deb(x);
	ans = (ans % mod - (2 * x) % mod + y % mod + mod) % mod;
	cout << ans;
}

int32_t main()
{
	FIO;
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	solve();
	return 0;
}

void ipgraph(int n, int m) {
	int i, u, v;
	while (m--) {
		cin >> u >> v;
		u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par) {
	for (int v : g[u]) {
		if (v == par) continue;
		dfs(v, u);
	}
}

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

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <class T>
vector<T> make_v(size_t size, const T& init){ return vector<T>(size, init); }

template<class... Ts>
auto make_v(size_t size, Ts... rest) {
    return vector<decltype(make_v(rest...))>(size, make_v(rest...));
}
int main() {
    string s;
    int x, y;
    cin >> s >> x >> y;
    vector<int> vx;
    vector<int> vy;
    int p = 0, q = 0;
    auto mx = make_v(2, 20000, 0);
    auto my = make_v(2, 20000, 0);
    mx[0][10000] = 1, my[0][10000] = 1;
    for (auto &&i : s) {
        if (i == 'T') {
            if (q == 0) {
                p++;
                continue;
            }
            if (p % 2) {
                vy.emplace_back(q);
            } else {
                if(p == 0) mx[0][10000]--, mx[0][10000+q]++;
                else vx.emplace_back(q);
            }
            q = 0;
            p++;
        } else {
            q++;
        }
    }
    if (q != 0) {
        if (p % 2) {
            vy.emplace_back(q);
        } else {
            if(p == 0) mx[0][10000]--, mx[0][10000+q]++;
            else vx.emplace_back(q);
        }
    }

    for (int i = 0; i < vx.size(); ++i) {
        int now = i&1, nxt = now^1;
        fill(mx[nxt].begin(), mx[nxt].end(), 0);
        for (int j = 0; j < 20000; ++j) {
            if(mx[now][j]){
                mx[nxt][j+vx[i]] = 1;
                mx[nxt][j-vx[i]]= 1;
            }
        }
    }
    for (int i = 0; i < vy.size(); ++i) {
        int now = i&1, nxt = now^1;
        fill(my[nxt].begin(), my[nxt].end(), 0);
        for (int j = 0; j < 20000; ++j) {
            if(my[now][j]){
                my[nxt][j+vy[i]] = 1;
                my[nxt][j-vy[i]]= 1;
            }
        }
    }
    if(mx[vx.size()%2][x+10000] && my[vy.size()%2][y+10000]) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 640
# 初期入力
S =input()

youbi =[ "MON","TUE","WED","THU","FRI","SAT","SUN" ]
nanitigo =youbi.index(S)
kotae =0
if S == "SUN":
    kotae = 7
else:
    kotae =6-nanitigo
print(kotae)

Measured memory_bytes: 2940
#include <iostream>
#include <cstdio> 
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

#ifndef typeof
#define typeof __typeof__
#endif // typeof
 
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(typeof((c).rbegin()) i = (c).rbegin(); i != (c).rend(); i++)
#define repby(i, a, b, step) for(typeof(b) i = (a); i < (b); i += (step))
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

bool judge(vi &v)
{
  sort(rall(v));

  return v[0]*v[0] == v[1]*v[1] + v[2]*v[2];
}

int main(int argc, char **argv)
{
  int n, x, y, z;
  vi v;

  cin >> n;
  while (n--) {
    cin >> x >> y >> z; 
    v.pb(x);
    v.pb(y);
    v.pb(z);
    cout << (judge(v) ? "YES" : "NO") << endl;
    v.clear();
  }

  return 0;
}

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

const int maxn = 1e5+5;
int a[maxn][3],dp[maxn][3];

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	
	for(int i=0;i<3;i++)
		dp[0][i]=a[0][i];
	for(int i=1;i<n;i++)
		for(int j=0;j<3;j++)
			dp[i][j]=max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+a[i][j];
		
	int mx=dp[n-1][0];
	for(int k=1;k<3;k++)
		mx=max(mx,dp[n-1][k]);
	cout<<mx<<endl;		
	return 0;
}

Measured memory_bytes: 2560
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 200001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}


int main(){
  ll a,b,n; cin >> a >> b >> n;
  
  if(b > n) cout << a*n/b << endl;
  else cout << a*(b-1)/b << endl;
  
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1'000'000'000'000'007ll;
const llong mod = 1e9+7;

int main() {
	llong N, K;
	vector<llong> h;

	cin >> N >> K;
	h.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> h[i];
	sort(ALL(h));

	llong cnt = 0;
	for (auto a : h)
		cnt += a >= K;

	cout << cnt << endl;


	return 0;
}

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

using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class T> ostream& operator<<(ostream &os, set<T> S){os << "{ "; for(auto s:S) os<<s<<" "; return os<<"}";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {os << "{ "; for(auto m:M) os<<"("<<m.first<<":"<<m.second<<") "; return os<<"}";}
#ifdef np
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>void __f(const char *name, Arg1 &&arg1) { cout<<name<<" : "<<arg1<<endl;}
template<typename Arg1, typename ... Args>void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma=strchr(names+1,','); cout.write(names,comma-names)<<" : "<<arg1<<" | ";
    __f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif


int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
	

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

#ifdef np
    cerr <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif  
 return 0; 
 }


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

s = input()

o = 0
z = 0
ans = 0
for i in range(len(s) - 1):
    if s[i] == '0':
        o += 1
    else:
        z += 1
    if s[i] != s[i + 1]:
        mi = min(o, z)
        ans += mi * 2
        o -= mi
        z -= mi

print(ans)


Measured memory_bytes: 9072
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef string str;

int main(){
  str s;
  cin >> s;
  for(ll i = 0; i < s.length(); i+=2){
    cout << s[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main()
{
    int n, m, a[10010];

    scanf("%d %d", &n, &m);
    for (int i = 0; i < m; i++)
        scanf("%d", &a[i]);

    for (int i = 0; i < m; i++)
    {
        n -= a[i];
        if (n < 0)
        {
            n = -1;
            break;
        }
    }

    printf("%d", n);
    return 0;
}

Measured memory_bytes: 1712
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n , ans = 0;
vector<ll> v;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
    cin>> n;
	for(int i=0 ; i<n ; i++){
		ll a; cin>>a;
		v.push_back(a);
	}
	for(int i=0 ; i<n ; i++){
		for(int j=(i+1) ; j<n ; j++){
			for(int k=(j+1) ; k<n ; k++){
				if(v[i] == v[j]) continue;
				if(v[i] == v[k]) continue;
				if(v[k] == v[j]) continue;
				ll m = max(v[i],v[j]);
				m = max(m,v[k]);
				if( (2*m) < (v[i]+v[j]+v[k]) ){
				    ans++;	
				}
			}
		}
	}
	cout<< ans << '\n';
	return 0;
}

Measured memory_bytes: 3660
def binary_search_loop(data,target):
    left, right = 0, len(data)

    while left <= right:
        mid = (left + right) // 2
        if data[mid] == target:
            return True
        elif data[mid] < target:
            left = mid + 1
        else:
            right = mid - 1

    return False

n = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))

ans = 0
for t in T:
    if binary_search_loop(S,t):
        ans +=1
    
print(ans)


Measured memory_bytes: 16712
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dif = sum(b) - sum(a)

numa, numb = 0, 0
for i in range(n):
    if a[i] > b[i]:
        numb += a[i] - b[i]
    elif a[i] < b[i]:
        numa += (b[i] - a[i] + 1) // 2

# if numa <= dif and numb <= dif:
if numa <= dif:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 4596
#! python3

def main():
    n, k = map(int, input().split())
    nset = set()
    for i in range(k):
        d = int(input())
        have = list(map(int, input().split()))
        have_set = set(have)
        nset |= have_set

    ans = n - len(nset)

    print(ans)

main()

Measured memory_bytes: 9180
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int fanc(int x,int a){
    int count = 0;

    while(1){
        if(x%a != 0){
            count = 0;
            break;
        }
        x /= a;
        count++;
        if(x == 1)break;
    }

    return count;
}


int main(){
    int n,ans = 1;
    cin >> n;

    if(n <= 3)cout << ans << endl;
    else{

        for(int i = 4;i <= n;i++){
            for(int j = 2;j <= i;j++){
                if(i % j == 0){
                    if(fanc(i,j) >= 2){
                        ans = max(ans,i);
                    }
                }
            }
        }

        cout << ans << endl;

    }

    return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> llVEC;
typedef vector<P> PVEC;
typedef priority_queue<P,PVEC,greater<P> > PPQ;
typedef priority_queue<ll, llVEC, greater<ll> > llPQ;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue;
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> &vec){ return (ll)vec.size(); }
ll sz(string &s){ return (ll)s.size(); }

ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }

bool check(ll k,string &s,string &ans){
    bool flag;
    if(ans[k] == 'S'){
        if(s[k] == 'o'){
            flag = (ans[k-1] == ans[k+1]);
        }
        else{
            flag = (ans[k-1] != ans[k+1]);
        }
    }
    else{
        if(s[k] == 'x'){
            flag = (ans[k-1] == ans[k+1]);
        }
        else{
            flag = (ans[k-1] != ans[k+1]);
        }
    }

    return flag;
}

bool func(ll &n, string &s, string &ans){
    rep(i,3,sz(s)){
        if(ans[i-1] == 'S'){
            if(s[i-1] == 'o') ans[i] = ans[i-2];
            else ans[i] = (ans[i-2] == 'S'?'W':'S');
        }
        else{
            if(s[i-1] == 'o') ans[i] = ((ans[i-2] == 'S')?'W':'S');
            else ans[i] = ans[i-2];
        }
    }


    string tmp1 = s[n-1] + s + s[0];
    string tmp2 = ans[n-1] + ans + ans[0]; 
    return (check(1,tmp1,tmp2) && check(n,tmp1,tmp2));
}

int main(){
    ll n;
    string s;
    cin >> n >> s;
    
    string ans(sz(s),' ');
    rep(i,0,8){
        rep(j,0,3){
            ans[j] = (((i >> j) & 1)?'S':'W');
        }
        if(s[1] == 'o'){
            if(ans[1] == 'W' && ans[0] == ans[2]) continue;
            if(ans[1] == 'S' && ans[0] != ans[2]) continue;
        }
        else{
            if(ans[1] == 'S' && ans[0] == ans[2]) continue;
            if(ans[1] == 'W' && ans[0] != ans[2]) continue;
        }
        if(func(n,s,ans)){
            cout << ans << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3956
from heapq import heappop , heappush

X , Y , Z , K = map(int,input().split())

A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

# それぞれソート
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

# 処理済みフラグ
confilm = []

q = [(-(A[0] + B[0] + C[0]) , 0,0,0)]

for _ in range(K) :
    val , i , j , k = heappop(q)

    print(-val)

    t = (i+1,j,k)
    if i + 1 < X and not t in confilm :
        heappush(q,(-(A[i+1] + B[j] + C[k]),) + t)
        confilm.append(t)

    t = (i,j+1,k)
    if j + 1 < Y and not t in confilm :
        heappush(q,(-(A[i] + B[j+1] + C[k]),) + t)
        confilm.append(t)

    t = (i,j,k+1)
    if k + 1 < Z and not t in confilm :
        heappush(q,(-(A[i] + B[j] + C[k+1]),) + t)
        confilm.append(t)




Measured memory_bytes: 4468