akhauriyash/Code-Regression huggingface dataset:
#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)); }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b; }

int main(){
    ll x;
    cin >> x;
    ll temp = x;
    ll cnt = 1;
    while(temp % 360){
        temp += x;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}


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

import heapq
def dijkstra(adj, n, st=1):
    dj = [2**64] * (n + 1)
    einp = [set() for _ in range(n + 1)]
    dj[st] = 0
    q = []
    heapq.heappush(q, (0, st))
    while q:
        fc, fn = heapq.heappop(q)
        if dj[fn] < fc: continue
        for tn, lc, eid in adj.get(fn, []):
            if dj[fn] + lc < dj[tn]:
                dj[tn] = dj[fn] + lc
                einp[tn] = einp[fn] | set([eid])
                heapq.heappush(q, (dj[tn], tn))
    return einp

adj = {}
for i in range(M):
    a, b, c = map(int, input().split())
    e = adj.setdefault(a, [])
    e.append((b, c, i))
    e = adj.setdefault(b, [])
    e.append((a, c, i))

from functools import reduce
inc = set()
for i in range(N):
    einp = dijkstra(adj, N, i + 1)
    inc = reduce(lambda a, x: a | x, einp, inc)
print(M - len(inc))

Measured memory_bytes: 4044
#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 >= 30)
		cout << "Yes\n";
	else
		cout << "No\n";
}

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: 10688
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;

int main()
{   
    int n;
    cin>>n;
    
    if(n<=111)  cout<<111<<endl;
    else if(n<=222)  cout<<222<<endl;
    else if(n<=333)  cout<<333<<endl;
    else if(n<=444)  cout<<444<<endl;
    else if(n<=555)  cout<<555<<endl;
    else if(n<=666)  cout<<666<<endl;
    else if(n<=777)  cout<<777<<endl;
    else if(n<=888)  cout<<888<<endl;
    else if(n<=999)  cout<<999<<endl;

    
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int X, A, B;
    cin >> X >> A >> B;
    
    if(B - A <= 0){
        cout << "delicious\n";
    }
    else if(B - A <= X){
        cout << "safe\n";
    }
    else{
        cout << "dangerous\n";
    }
}


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

int main() {
	string s;
	getline(cin,s);
	for(int i=0;i<s.length();i++)
	{
		if(s[i]>='a'&&s[i]<='z')s[i]-='a'-'A';
		else if(s[i]>='A'&&s[i]<='Z')s[i]+='a'-'A';
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

int n,m,k,a[30][31];
int temp,ans;
int aj[30];
signed main() {
    cin >> n >> m;
    for (int i=0;i<n;i++) {
        cin >> k;
        for (int j=0;j<k;j++) {
            cin >> temp; temp--;
            a[i][temp] = 1;
        }
    }
    for (int i=0;i<m;i++) {
        aj[i] = 1;
        for (int j=0;j<n;j++) {
            aj[i] &= a[j][i];
        }
    }
    for (int i=0;i<m;i++) {
        ans += aj[i];
    }
    cout << ans << endl;
}

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

public class Hello
{
    public static void Main()
    {
        int[] num = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int count = 0;

        for(int i = num[0]; i <= num[1]; i++)
        {
            if(num[2] % i == 0)
            {
                count++;
            }
        }

        Console.WriteLine(count);
    }
}

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N, M;
  cin >> N >> M;

  int l = 1;
  int r = N;
  if (N % 2 == 1) {
    REP(i, M) {
      cout << l << " " << r << endl;
      ++l;
      --r;
    }
  } else {
    set<pair<int, int>> found;

    REP(i, M) {
      cout << l << " " << r << endl;
      // cout << l << " " << r << ":" << abs(r - l) << ":" << abs(l + N - r)
      //  << endl;
      ++l;
      --r;
      if (abs(r - l) == abs(l + N - r) ||
          found.find(make_pair(min(abs(r - l), abs(l + N - r)),
                               max(abs(r - l), abs(l + N - r)))) !=
              found.end()) {
        ++l;
      }
      found.insert(make_pair(min(abs(r - l), abs(l + N - r)),
                             max(abs(r - l), abs(l + N - r))));
    }
  }

  return 0;
}

// #include <bits/stdc++.h>
// using namespace std;
// using ll = long long;
// template <class T, class U> inline bool chmin(T &x, U y) {
//   if (x > y) {
//     x = y;
//     return true;
//   }
//   return false;
// }
// template <class T, class U> inline bool chmax(T &x, U y) {
//   if (x < y) {
//     x = y;
//     return true;
//   }
//   return false;
// }
// #define fr(i, n) for (int i = 0; i < (n); ++i)
// #define Fr(i, n) for (int i = 1; i <= (n); ++i)
// #define ifr(i, n) for (int i = (n)-1; i >= 0; --i)
// #define iFr(i, n) for (int i = (n); i > 0; --i)

// int main() {
//   cin.tie(nullptr);
//   ios::sync_with_stdio(false);
//   int n, m;
//   cin >> n >> m;
//   bool f{true};
//   if (n & 1) {
//     int l = 1, r = n;
//     fr(i, m) {
//       cout << l << " " << r << '\n';
//       ++l, --r;
//     }
//   } else {
//     int l = 1, r = n;
//     fr(i, m) {
//       cout << l << " " << r << '\n';
//       ++l, --r;
//       if (f && 4 * l > n)
//         ++l, f = false;
//     }
//   }
// }


Measured memory_bytes: 6728
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;

#define pi 3.141592653589
#define repeat(i,n) for(int i=0;i<n;i++)

int main(){
	int n, m;
	int **a, *b,*c;
	cin >> n >> m;

	//配列確保
	a = new int*[n];
	repeat(i,n)
	{
		a[i] = new int[m];
	}
	b = new int[m];
	c = new int[n];

	//配列Cの初期化
	repeat(i, n)
	{
		c[i] = 0;
	}
	
	//配列の各要素に値を代入
	repeat(i,n)
	{
		repeat(j,m)
		{
			cin >> a[i][j];
		}
	}

	repeat(i, m)
	{
		cin >> b[i];
	}

	//行列Cの各要素計算
	repeat(i, n)
	{
		repeat(j, m)
		{
			c[i] += (a[i][j] * b[j]);
		}
	}

	//行列Cの要素の表示
	repeat(i, n)
	{
		cout << c[i] << endl;
	}

	//配列の初期化
	repeat(i, n)
	{
		delete[] a[i];
		a[i] = 0;
	}
	delete a;
	a = 0;

	delete b;
	b = 0;

	delete c;
	c = 0;

	return 0;
}

Measured memory_bytes: 1236
#include<iostream>
using namespace std;
int main()
{
int m;
int c;
cin >>c;
m+=c;
cin >>c;
m+=c*5;
cin >>c;
m+=c*10;
cin >>c;
m+=c*50;
cin >>c;
m+=c*100;
cin >>c;
m+=c*500;
if(m>=1000) cout << 1 << endl;
else cout << 0 << endl;
return 0;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int , int> P;
typedef pair<ll, ll> PL;
const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}
 

ll n;
const int SIZE = 1e5+10;
ll v[SIZE],mem[SIZE];

pair<ll,ll> va[SIZE],vb[SIZE];

int main(){
    cin >> n;
    ll vvv;
    for(int i = 0; i < n; i++){
        cin >> vvv;
        if(i%2 == 0){
            va[vvv].first++;
            va[vvv].second = vvv;
        }
        else{
            vb[vvv].first++;
            vb[vvv].second = vvv;
        }
    }

    sort(va,va+SIZE);
    sort(vb,vb+SIZE);

    ll ac = SIZE-1,bc = SIZE-1;
    ll ans = 0;
    ans = va[ac].first+vb[bc].first;
    if(va[ac].second == vb[bc].second){
        ans = max(va[ac].first+vb[bc-1].first,va[ac-1].first+vb[bc].first);
    }

    cout << n-ans << endl;
}

Measured memory_bytes: 4352
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <tr1/unordered_map>
#define mo 1000000007
#define num(x) (x>='0' && x<='9')
typedef unsigned long long ull;
typedef long long ll;
using namespace std::tr1;
using namespace std;
int read(){
    int p=0, q=1;
    char ch=getchar();
    while (!num(ch))
        (ch=='-'?q=-1:0),
        ch=getchar();
    while (num(ch)) p=p*10+ch-'0', ch=getchar();
    return p*q;
}
int power(ll a, int b){
	ll c=1;
	while (b){
		if (b&1) c=c*a%mo;
		a=a*a%mo;
		b>>=1;
	}
	return c;
}
int main(){
	int x=read();
	printf("%d\n", x?0:1); 
    return 0;
}

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

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

    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }

    map<int, int> M;
    for (int i = 0; i < N; i++)
    {
        M[A[i]] += 1;
    }

    int res = 0;
    for (auto i = M.begin(); i != M.end(); i++)
    {
        /* code */
        if (i->second % 2 != 0)
            res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define INF (int)1e9+5
using namespace std;
int main(){
	fast;
	int n;
	cin>>n;
	vector<int> dp[n];
	//cin>>dp[0]>>dp[1]>>dp[2];
	for(int i=0;i<n;i++){
		dp[i].pb(0);
		dp[i].pb(0);
		dp[i].pb(0);
	}
	for(int i=0;i<n;i++){
		int temp[3];
		cin>>temp[0]>>temp[1]>>temp[2];
		if(i ==0){
			dp[0][0] = temp[0];
			dp[0][1] = temp[1];
			dp[0][2] = temp[2];
			continue;
		}
		for(int j=0;j<3;j++){
			for(int k=0;k<3;k++){
				if(j!=k){
					dp[i][j] = max(dp[i-1][k]+temp[j],dp[i][j]); 
				}
			}
		}
	}
	int val = max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	cout<<val;
	
	return 0;
}


Measured memory_bytes: 5760
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){r(1)(r(2).readFileSync("/dev/stdin","UTF-8"))},function(e,t){e.exports=function(e){for(var t=e.split("\n"),r=t[0].split(" "),n=Number(r[0]),o=Number(r[1]),u=[],i=0;i<n;i++){var l={num:i,to:[]};u.push(l)}for(var f=0;f<o;f++){var a=t[f+1].split(" "),c=Number(a[0])-1,s=Number(a[1])-1;u[c].to.push(u[s]),u[s].to.push(u[c])}for(var d=0,p=[{num:0,visited:new Array(n).fill(0),tn:1}];p.length>0;){var v=p.shift();if(v.visited[v.num]=1,v.tn!=n){var m=!0,y=!1,b=void 0;try{for(var h,x=u[v.num].to[Symbol.iterator]();!(m=(h=x.next()).done);m=!0){var g=h.value;if(!v.visited[g.num]){var j={num:g.num};j.visited=v.visited.concat(),j.tn=v.tn+1,p.push(j)}}}catch(e){y=!0,b=e}finally{try{m||null==x.return||x.return()}finally{if(y)throw b}}}else d+=1}console.log(d)}},function(e,t){e.exports=require("fs")}]);

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

void solve(long long H, long long W, std::vector<std::string> S){
    ll neix[8] = {1, 1, 1, 0, 0, -1, -1, -1};
    ll neiy[8] = {1, 0, -1, 1, -1, 1, 0, -1};
    
    for(ll i= 0; i< H; i++){
        for(ll j=0; j< W; j++){
            if(S[i][j] == '#') 
                cout << '#';
            else{
                ll cnt = 0;
                for(ll k=0; k< 8; k++){
                    ll x = i+neix[k], y = j+ neiy[k];
                    if (0<= x && x < H && 0<= y && y< W){
                        if(S[x][y] == '#')
                            cnt ++;
                    }
                }
                cout << cnt;
            }
        }
        cout << endl;
    }
}

int main(){
    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);
    std::vector<std::string> S(H);
    for(int i = 0 ; i < H ; i++){
        std::cin >> S[i];
    }
    solve(H, W, std::move(S));
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
from math import floor
from copy import copy, deepcopy
from operator import itemgetter

from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
#dequeを使うときはpython3を使う、pypyはダメ
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds

#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

#N = int(input())
A, B, N = map(int, input().split())
#L = [int(input()) for i in range(N)]
#A = list(map(int, input().split()))
#S = [list(map(int, input().split())) for i in range(N)]

if floor(N/B)==0:
    print(floor(N*A/B))
    exit()
if B==1:
    print(0)
    exit()

X=min(B-1,N)

print(floor(A*X/B)-A*floor(X/B))

    


Measured memory_bytes: 68220
r,c=(int(x) for x in input().split())
A=[[0 for i in range(c)] for j in range(r)]
b=[0]*r
d=[0]*(c+1)
for i in range(r):
    A[i]=[int(x) for x in input().split()]
for i in range(r):
    for j in range(c):
        b[i]+=A[i][j]
for i in range(c):
    for j in range(r):
        d[i]+=A[j][i]
for i in range(r):
    d[c]+=b[i]
for i in range(r):
    for j in range(c+1):
        if j!=c:
            print(A[i][j],end=" ")
        else:
            print(b[i])
for i in range(c):
    print(d[i],end=" ")
print(d[c])


Measured memory_bytes: 6212
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    if (n < 600) cout << 8 << endl;
    else if (n < 800) cout << 7 << endl;
    else if (n < 1000) cout << 6 << endl;
    else if (n < 1200) cout << 5 << endl;
    else if (n < 1400) cout << 4 << endl;
    else if (n < 1600) cout << 3 << endl;
    else if (n < 1800) cout << 2 << endl;
    else if (n < 2000) cout << 1 << endl;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		long sum = 0;
		for(int i=0; i<m; i++) {
			sum += sc.nextLong();
		}
		if(n<sum) {
			System.out.println(-1);
		}else {
			System.out.println(n-sum);
		}
		sc.close();
	}


}


Measured memory_bytes: 46252
import sys
input = lambda: sys.stdin.readline().rstrip()

def calc():
    def mex(i):
        D = {}
        for j in X[i]:
            D[G[j]] = 1
        for g in range(N + 1):
            if g not in D:
                return g
    M = int(input())
    X = [[] for _ in range(N)]
    for _ in range(M):
        a, b = map(int, input().split())
        X[N - min(a, b)].append(N - max(a, b))
    G = [0] * N
    for i in range(N):
        G[i] = mex(i)
    H = [0] * 1024
    a = 1
    for i in range(N)[::-1]:
        a = a * A % P
        H[G[i]] = (H[G[i]] + a) % P
    return H

P = 998244353
A = pow(10, 18, P)
N = int(input())
H1, H2, H3 = calc(), calc(), calc()
ans = 0
for i in range(1024):
    if H1[i] == 0: continue
    for j in range(1024):
        if H2[j] == 0: continue
        ans = (ans + H1[i] * H2[j] * H3[i^j]) % P

print(ans)

Measured memory_bytes: 72240
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef pair<pl, ll> ppl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, k, n) for(ll i = ll(k); i <= ll(n); i++)
#define rep3(i, n, k) for(ll i = ll(n); i >= ll(k); i--)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {if(b == 0) return 0; return (a % b + b) % b;}
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n, d1, d2, cnt=0;
  cin >> n;

  rep(_, n) {
     cin >> d1 >> d2;
     if(d1 == d2) cnt++;
     else cnt = 0;
    if(cnt==3) {cout << "Yes" << newl; return 0;} 
  }

  cout << "No" << newl;
  return 0;
}

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

int main(){
    int n; cin>>n;
    set<string> set[5];
    for(int i=0;i<n;i++){
        string s; cin>>s;
        if(s[0]=='M')set[0].insert(s);
        else if(s[0]=='A')set[1].insert(s);
        else if(s[0]=='R')set[2].insert(s);
        else if(s[0]=='C')set[3].insert(s);
        else if(s[0]=='H')set[4].insert(s);
    }
    long long ans=0;
    for(int i=0;i<=2;i++){
        for(int j=i+1;j<=3;j++){
            for(int k=j+1;k<=4;k++){
                ans+=set[i].size()*set[j].size()*set[k].size();
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 9600
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {
        var N = Console.ReadLine().ToInt32();

        var an = Console.ReadLine().SplittedStringToInt32List();

        // 0 is even, 1 is odd
        var dp = new int[N + 1,2];

        dp[0, 0] = an[0] % 2 == 0 ? 1 : 2;
        dp[0, 1] = an[0] % 2 == 1 ? 1 : 2;
        for (int i = 1; i < N; i++)
        {
            if (an[i] % 2 == 0)
            {
                dp[i, 0] = dp[i - 1, 0] * 3 + dp[i - 1, 1];
                dp[i, 1] = dp[i - 1, 1] * 2;
            }
            else
            {
                dp[i, 0] = dp[i - 1, 0] * 3 + dp[i - 1, 1] * 2;
                dp[i, 1] = dp[i - 1, 1];

            }
        }
        Console.WriteLine(dp[N - 1, 0]);
        Console.ReadLine();
    }


    
   

    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<long> SplittedStringToInt64List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;

    public static int Max(params int[] values)
    {
        var maxes = -1;
        for (int i = 0; i < values.Length; i++)
        {
            maxes = Math.Max(values[i], maxes);
        }
        return maxes;
    }

    #endregion
}



Measured memory_bytes: 13268
/* ALDS1_4_A: Linear Search */
/* 20181115 AOJ */

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

#define N 10000
#define Q 500
int main(void){
	int n, S[N], q, T[Q], i = 0, j = 0, C = 0;

	scanf("%d", &n);
	while(i < n){
		scanf("%d", &S[i++]);
	}

	scanf("%d", &q);
	i = 0;
	while(i < q){
		scanf("%d", &T[i++]);
	}

	for(i = 0; i < q; i++ ){
		for(j = 0; j < n; j++){
			if(S[j] == T[i]){
				C++;
				break;
			}
		}
	}

	printf("%d\n", C);

	return 0;
}


Measured memory_bytes: 1988
#include<iostream>
using namespace std; // 575

int main() {
	int A, B;
	cin >> A >> B;
	cout << (A == B ? A + B : max(A, B) * 2 - 1);
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

はい
*/

Measured memory_bytes: 256
use std::io::*;

fn main() {
    let input = {
        let mut buf = vec![];
        stdin().read_to_end(&mut buf);
        buf.pop();
        unsafe { String::from_utf8_unchecked(buf) }
    };

    let (a, b, c) = {
        let mut iter = input.split(' ').map(|s| s.parse::<u32>().unwrap());
        (
            iter.next().unwrap(),
            iter.next().unwrap(),
            iter.next().unwrap(),
        )
    };

    let w = a * 7 + b;
    let p = (c + a + b - 1) / w;
    let q = (c.saturating_sub(p * w) as f64 / a as f64).ceil() as u32;

    println!("{}", p * 7 + q);
}



Measured memory_bytes: 5096
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int gcd(int x, int y){
	if (x < y) swap(x, y);
	if (x % y) return gcd(y, x%y);
	return y;
}


int main(){
	int kk;
	ll sum = 0;
	cin >> kk;
	for (int i = 1; i <= kk; i++){
		for (int j = 1; j<= kk; j++){
			for (int k = 1; k <= kk; k++){
				sum += gcd(i, gcd(j,k));
			}
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3632
N, A = map(int, input().split())
x = [int(i) for i in input().split()]

table = [[[0]*(N*A+1) for i in range(N+1)] for j in range(N+1)]
table[0][0][0] = 1

for j in range(1,N+1):
  for k in range(N+1):
    for s in range(N*A+1):
      c = x[j-1]
      if s-c<0:
        table[j][k][s] = table[j-1][k][s]
      elif s-c>=0 and k>=1:
        table[j][k][s] = table[j-1][k][s] + table[j-1][k-1][s-c]
      
ans = 0
for i in range(1,N+1):
  ans += table[N][i][i*A]
print(ans)

Measured memory_bytes: 93276
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

template<typename T>
struct BIT {
	int n;
	vector<T>dat;
	BIT(int n = 0) {
		initialize(n);
	}
	void initialize(int temp) {
		n = temp;
		dat.resize(n);
		rep(i, 0, n)dat[i] = 0;
	}
	T sum(int i) {
		T s = 0;
		while (i >= 0) {
			s += dat[i];
			i = (i & (i + 1)) - 1;
		}
		return s;
	}
	T sum_between(int i, int j) {
		if (i > j)return 0;
		return sum(j) - sum(i - 1);
	}
	void plus(int i, T x) {
		while (i < n) {
			dat[i] += x;
			i |= i + 1;
		}
	}
	int lower_bound(T x) {
		if (sum(n - 1) < x)return -1;
		else if (sum(0) >= x)return 0;
		int ng = 0, ok = n - 1;
		while (ok - ng > 1) {
			int mid = (ok + ng) / 2;
			if (sum(mid) >= x)ok = mid;
			else ng = mid;
		}
		return ok;
	}
};

ll N, K, P;
vector<int>a;

int check(ll mid) {
	vector<ll>sum(N + 1);
	for (int i = 0; i < N; i++)sum[i + 1] = sum[i] + ((a[i] <= mid) ? 1 : -1);
	vector<ll>dic;
	for (int i = 0; i <= N; i++)dic.pb(sum[i]);
	sort(all(dic));
	dic.erase(unique(all(dic)), dic.end());
	int sz = dic.size();
	BIT<ll> bit(sz);
	for (int i = 0; i <= N; i++) {
		int idx = lower_bound(all(dic),sum[i])-dic.begin();
		bit.plus(idx, 1);
	}
	ll temp = 0;
	for (int i = 0; i < N;i++) {
		int idx = lower_bound(all(dic),sum[i]) - dic.begin();
		bit.plus(idx,-1);
		temp += bit.sum_between(idx+1,sz-1);
	}
	return temp >= P;
}

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

	cin >> N;
	a.resize(N);
	for (int i = 0; i < N; i++)cin >> a[i];
	K = N * (N + 1LL) / 2LL;
	P = (K / 2LL) + 1LL;
	
	ll ng = 0, ok = inf;
	while (ok - ng > 1) {
		ll mid = (ng + ok) / 2;
		if (check(mid))ok = mid;
		else ng = mid;
	}
	puts(ok);
	return 0;
}

Measured memory_bytes: 3300
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
#include <cstdio>
#include <time.h>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <math.h>
//#include <bits/stdc++.h>
#define ll long long
#define int64 long long
#define mem(x,y) memset(x,y,sizeof(x))
#define ull unsigned long long
#define pb push_back
#define INF 0x3f3f3f3f
#define lson l, mid, rt<<1
#define rson mid+1, r, rt<<1|1
#define pi 3.141592653589793238462
#define stdio std::ios::sync_with_stdio(false)

using namespace std;

inline bool nextDouble(double &num) {
    char in;
    double Dec = 0.1;
    bool IsN = false, IsD = false;
    in = getchar();
    if (in == EOF) return false;
    while (in != '-' && in != '.' && (in < '0' || in > '9'))
        in = getchar();
    if (in == '-') {
        IsN = true;
        num = 0;
    } else if (in == '.') {
        IsD = true;
        num = 0;
    } else num = in - '0';
    if (!IsD) {
        while (in = getchar(), in >= '0' && in <= '9') {
            num *= 10;
            num += in - '0';
        }
    }
    if (in != '.') {
        if (IsN) num = -num;
        return true;
    } else {
        while (in = getchar(), in >= '0' && in <= '9') {
            num += Dec * (in - '0');
            Dec *= 0.1;
        }
    }
    if (IsN) num = -num;
    return true;
}
inline bool nextInt(int &num) {
    char in;
    bool IsN = false;
    in = getchar();
    if (in == EOF) return false;
    while (in != '-' && (in < '0' || in > '9')) in = getchar();
    if (in == '-') {
        IsN = true;
        num = 0;
    } else num = in - '0';
    while (in = getchar(), in >= '0' && in <= '9') {
        num *= 10, num += in - '0';
    }
    if (IsN) num = -num;
    return true;
}
inline bool nextLong(ll &num) {
    char in;
    bool IsN = false;
    in = getchar();
    if (in == EOF) return false;
    while (in != '-' && (in < '0' || in > '9')) in = getchar();
    if (in == '-') {
        IsN = true;
        num = 0;
    } else num = in - '0';
    while (in = getchar(), in >= '0' && in <= '9') {
        num *= 10, num += in - '0';
    }
    if (IsN) num = -num;
    return true;
}
inline void Out(int a) {
    if (a < 0) {
        putchar('-');
        a = -a;
    }
    if (a >= 10) {
        Out(a / 10);
    }
    putchar(a % 10 + '0');
}
const int maxn = 1e5 + 5;
const int maxm = 1e3 + 5;
const int mod = 1e9 + 7;
const int seed = 10007;
const double eps = 1e-6;
string s;
bool vis[26];

int main() {
    stdio;
    cin >> s;
    mem(vis, 0);
    for (int i = 0; i < s.length(); i++) {
        int cur = s[i] - 'a';
        if (!vis[cur]) vis[cur] = 1;
    }
    bool ans = false;
    for (int i = 0; i < 26; i++) {
        if (!vis[i]) {
            ans = true;
            putchar(i + 'a');
            break;
        }
    }
    if (!ans) puts("None");
    return 0;
}


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

x, y = 1, 1
for _ in range(n):
    t, a = map(int, input().split())
    r = (x + t - 1) // t
    s = (y + a - 1) // a
    x = max(r, s) * t
    y = max(r, s) * a
print(x+y)

Measured memory_bytes: 3060
X = int(input())
if X >= 1800:
    print(1)
elif X >= 1600:
    print(2)
elif X >= 1400:
    print(3)
elif X >= 1200:
    print(4)
elif X >= 1000:
    print(5)
elif X >= 800:
    print(6)
elif X >= 600:
    print(7)
else:
    print(8)






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

int main(void){
    int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;

    cin >> k;

    cout << a[k - 1] << endl;

}

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

int main(){
	std::vector<int> aList(6);

	for(int i=0; i<6; i++)
		std::cin>>aList[i];

	if(aList[4]- aList[0] > aList[5])
		std::cout<<":("<<std::endl;
	else
		std::cout<<"Yay!"<<std::endl;

	return 0;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
xyh = []

bes = -1
for i in range(n):
    xyh.append(na())
    if xyh[-1][2] > 0:
        bes = len(xyh)-1

bx = -1
by = -1
bh = -1
for x in range(101):
    for y in range(101):
        if bh >= 0: continue
        h = abs(xyh[bes][0] - x) + abs(xyh[bes][1] - y) + xyh[bes][2]
        ok = True
        for u in xyh:
            if max(h-abs(u[0]-x)-abs(u[1]-y), 0) != u[2]:
                ok = False
                break
        if ok:
            bx, by, bh = x, y, h

print(bx, by, bh)


Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <functional>
#include <list>
#include <utility>
#include<map>
#include<vector>
using namespace std;

typedef long long ll;
typedef long double ld;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)

#define get_arsize(a) (sizeof(a)/sizeof(a[0]))
const ll mod = 1000000007;
const double eps = 1e-10;
const int MAX = 200000;

int main() {
	int n; vector<int> v;
	cin >> n;
  rep(i,n) {
    int t;
    cin >> t;
    v.push_back(t);
  }
  std::sort(v.begin(), v.end());
  cout << v.back() - v.front() << endl;

  return 0;
}

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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int i,j,k;
  i = b - a;
  j = c - b;
  k = c - a;

  if(abs(i) <= d && abs(j) <= d){
    cout << "Yes" << endl;
  }else if(abs(k) <= d){
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
}

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

int main(){
  int N;
  cin >> N;
  int A[N];
  int p;
  for(int i=0;i<N;i++){
    cin >> p;
    A[p-1]=i;
  }
  for(int k=0;k<N;k++){
    cout << A[k]+1;
    if(k<N-1){
      cout << " ";
    }
  }
}

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

int main() {
	string s;
	cin >> s;
	sort(s.begin(),s.end());

	if (s.size() == 1) {
		cout << "No" << endl;
		return 0;
	}
	rep(i, s.size()) {
		if (s.at(i) != s.at(i + 1)) {
			cout << "No" << endl;
			return 0;
		}
		i++;
	}
			cout << "Yes" << endl;
			return 0;
}

Measured memory_bytes: 256
def main():
    S = input()
    ans_can = {"AKIHABARA", "KIHABARA", "AKIHBARA", "AKIHABRA", "AKIHABAR",
               "KIHABAR", "AKIHABR", "AKIHBAR", "AKIHBRA", "KIHABRA", "KIHBR",
               "AKIHBR", "KIHABR", "KIHBAR", "KIHBRA", "KIHBARA"}
    if S in ans_can:
        print("YES")
    else:
        print("NO")


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {

	private static int top3[];

	public static void main(String args[]) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		top3 = new int[3];

		for(int i=0;i<10;i++){
			
			int h = Integer.parseInt(br.readLine());
			if(top3[0]<h){
				top3[2] = top3[1];
				top3[1] = top3[0];
				top3[0] = h;
			}
			else if(top3[1]<h){
				top3[2] = top3[1];
				top3[1] = h;
			}else if(top3[2]<h){
				top3[2] =h;
			}
		}
		for(int j=0;j<3;j++){
		 System.out.println(top3[j]);
		}
	}
}

Measured memory_bytes: 16860
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <deque>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> istream& operator>>(istream &is, pair<S, T> &p){ return is >> p.first >> p.second; }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ return os << "[" << p.first << ", " << p.second << "]"; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define For1(i, n) for(int i = 1; i <= (n); i ++)
#define Rof(i, n) for(int i = (n)-1; i >= 0; i --)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)
#define Return(x) { Cout(x); return 0; }

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    vc<vc<char>> s(n, vc<char>(n));
    For(i, n) For(j, n) cin >> s[i][j];
    
    int ans = 0;
    For(k, n){
        For(i, n) For(j, n){
            if(s[i][(j+k)%n] != s[j][(i+k)%n]) goto next;
        }
        ans += n;
        next:;
    }
    Cout(ans);
}
 


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <numeric>


using std::cout;
using std::cin;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


ll gcd(ll a, ll b) {
    while (b != 0) {
        auto tmp = a;
        a = b;
        b = tmp % a;
    }
    return a;
}



void oneCase () {
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22) {
        cout << "bust" << "\n";
    } else {
        cout << "win" << "\n";
    }
}




int main() {
    int k = 1;
//    cin >> k;
    for (int i = 0; i < k; ++i) {
        oneCase();
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        
        for (int i = 0; i < n; i++) {
            double[] x = new double[2];
            double[] y = new double[2];
            double[] r = new double[2];
            for (int j = 0; j < 2; j++) {
                x[j] = scanner.nextDouble();
                y[j] = scanner.nextDouble();
                r[j] = scanner.nextDouble();
            }
            
            double xy = Math.sqrt( Math.pow(x[1]-x[0], 2)+Math.pow(y[1]-y[0], 2) );
            double rsum = r[0] + r[1];
           
            if (xy > rsum) {
                System.out.println("0");
            } else if (Math.abs(r[0]-r[1]) <= xy && xy <= rsum) {
                System.out.println("1");
            } else if (r[0] > r[1]) {
                System.out.println("2");
            } else {
                System.out.println("-2");
            }
        }
    }
}

Measured memory_bytes: 20524
use std::ops::{Index, IndexMut};
use std::cmp::{Ordering};
use std::collections::BinaryHeap;
// use std::clone::Clone;

fn getline() -> String{
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

macro_rules! split {
    ($x: expr) => {
        ($x).trim().split(' ').collect()
    }
}

macro_rules! parse {
    ($x: expr) => {
        ($x).parse().unwrap()
    }
}

macro_rules! debug {
    ($x: expr) => {
        println!("{}: {}", stringify!($x), $x)
    }
}

fn printvec<T>(v: &Vec<T>) where T: std::fmt::Display {
    for (i,e) in v.into_iter().enumerate() {
        if i != 0 {
            print!(" ");
        }
        print!("{}", e);
    }
    println!();
}

fn main() {
    let s = getline();
    let iv: Vec<_> = split!(s);
    let k: i64 = parse!(iv[0]);
    
    let x = (k+49)/50;
    let y = k%50;
    let mut ans = vec![49+x; 50];
    if y != 0 {
        for i in 0..(50-y) {
            ans[i as usize] -= y+1;
        }
    }
    println!("{}",50);
    printvec(&ans);
}



Measured memory_bytes: 4352
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

m = int(input())
lis = list(map(int,input().split()))

start = gcd(lis[0],lis[1])

for i in range(2,m):
  start = gcd(start,lis[i])
  if start == 1:
    break
print(start)

Measured memory_bytes: 14252
#include <stdio.h>
#include <string.h>
#define MAX 100
int main(void) {
    int N, i, j, cnt, ans=0;
    
    char S[MAX];
    
    scanf("%d %s", &N, S);
    
    for(i=0; i<N; i++) {
        int alp[2][26]={0};
        for(j=0; j<=i; j++)
            alp[0][S[j]-'a']++;
        
        for(j=i+1; j<N; j++)
            alp[1][S[j]-'a']++;
        
        cnt = 0;
        for(j=0; j<26; j++) {
            if(alp[0][j]>0 && alp[1][j]>0)
                cnt++;
        }
        
        if(ans<cnt)
            ans = cnt;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

//#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	bitset<64> bs(0);
	vector<bitset<64>> b(n);

	for (ll i = 0; i < n; i++)
	{
		ll m;
		cin >> m;

		for (ll j = 0; j < m; j++)
		{
			ll x;
			cin >> x;

			b[i].set(x);
		}
	}

	ll a;
	cin >> a;

	for (ll i = 0; i < a; i++)
	{
		ll q, p, x;
		cin >> q >> p;

		switch (q)
		{
			case 0:
				println(bs.test(p));
				break;

			case 1:
				bs |= b[p];
				break;

			case 2:
				bs &= ~b[p];
				break;

			case 3:
				bs ^= b[p];
				break;

			case 4:
				println(((bs & b[p]) == b[p]));
				break;

			case 5:
				println(((bs & b[p]).to_ullong() != 0 ? 1 : 0));
				break;

			case 6:
				println(((bs & b[p]).to_ullong() == 0 ? 1 : 0));
				break;

			case 7:
				println((bs & b[p]).count());
				break;

			case 8:
				println((bs & b[p]).to_ullong());
				break;
		}

	}
}



Measured memory_bytes: 3108
import sys
input = sys.stdin.readline

N = int(input())

A = []
A_append = A.append
for i in range(1, N + 1):
    a = int(input())
    A_append([a, i])

A.sort(key = lambda x: x[0])

count = 0
for i in range(N):
    if A[i][1] % 2 == (i + 1) % 2:
        pass
    else:
        count += 1

print (count // 2)

Measured memory_bytes: 21280
#include <bits/stdc++.h>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cout << #x << " " << x << endl;

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}
template<typename... T>
void write(T... a){
    ((cout << a << "\n"),...);
}
template<typename... T>
void write_space(T... a){
    ((cout << a << " "),...);
}
void solve(){
    ll x, y;
    read(x,y);
    int count = 1;
    while( x <= y / 2){
        count++;
        x *= 2;
    }
    cout << count << endl;
} 

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 2;
    while(TEST_CASES--){
    #endif // DEBBUG

    solve();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}

//Thanks to CSES problemset
// I am trained with this kind of problem

Measured memory_bytes: 3616
import java.io.*;
import java.util.*;
public class Main
{
	int n,a[];
	private void solve()throws IOException
	{
		n=nextInt();
		a=new int[n+1];
		int sum=0;
		for(int i=1;i<=n;i++)
		{
			a[i]=nextInt();
			sum+=a[i];
		}
		int maxn=4000000;
		BitSet dp=new BitSet(maxn+1);
		dp.set(maxn);
		for(int i=1;i<=n;i++)
			dp.or(dp.get(a[i],maxn+1));
		for(int i=(sum+1)/2;i<=maxn;i++)
			if(dp.get(maxn-i))
			{
				out.println(i);
				return;
			}
	}

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

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 270460