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

using namespace std;
#define         MAX         1000000
#define         ll          long long
#define         input       freopen("input.txt","r",stdin)
#define         output      freopen("output.txt","w",stdout)

ll sum = 0;

int main() {

    int n;
    cin>>n;

    for(int i=1;i<=n;i++){
        if((i%5==0) || (i%3==0)){
           continue;
        }
         sum += i;
    }

    cout<<sum<<endl;

    return 0;
}


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

int main() {
  string S;
  cin >> S;
  int N = S.size();
  bool b = true;
  for(int i = 0; i < N; i++) {
    if(S.at(i) != S.at(N-i-1)) {
      b = false;
      break;
    }
  }
  for(int i = 0; i <= (N-3)/2; i++) {
    if(S.at(i) != S.at((N-3)/2-i)) {
      b = false;
      break;
    }
  }
  for(int i = (N+3)/2-1; i < N; i++) {
    if(S.at(i) != S.at((3*N-1)/2-i)) {
      b = false;
      break;
    }
  }
  if(b) {
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) 
{
	int N;
	double invasum = 0.0;

	cin >> N;
	
	for (int i = 0; i < N; i++) {
		double A;
		cin >> A;
		invasum += 1.0 / A;
	}

	printf("%.7lf\n", 1.0 / invasum);

	return 0;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
lst1=[1,3,5,7,8,10,12]
lst2=[4,6,9,11]
lst3=[2]
if (a in lst1) and (b in lst1):
    print("Yes")
elif (a in lst2) and (b in lst2):
    print("Yes")
elif (a==2) and (b==2):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == '+':
        print(a+b)
    elif op == '-':
        print(a-b)

solve()

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

int main() {
    int n;
    cin >> n;
    vector<int> B(n);
    rep(i, n-1) cin >> B[i];
    vector<int> A(n);
    A[0] = B[0];
    for (int i = 1; i < n-1; ++i) {
        A[i] = min(B[i-1], B[i]);
    }
    A[n-1] = B[n-2];
    int ans = 0;
    rep(i, n) ans += A[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<limits.h>
#include<set>
#include<map>
#include<string.h>
#include<queue>
#include<math.h>
#include<stdio.h>
using namespace std;
 
int main(){
    int m,n;//lifetime, blocks
    while(cin>>m>>n,m){
        bool o[7368799];
        fill(o,o+7368799,false);
        int count=0;
        for(int i=m;;i++){
            if(!o[i]){
                if(count<n){
                    count++;
                    for(int j=1;j*i<7368799;j++){
                        o[i*j]=true;
                    }
                } else {
                    cout<<i<<endl;
                    break;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 10284
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
char s[1005],t[1005];
int main(){
	int i,j,n,m;
	scanf(" %s %s",s,t);
	n=strlen(s);
	m=strlen(t);
	int ans=1000000;
	for(i=0;i+m-1<n;i++){
		int cnt=0;
		for(j=0;j<m;j++)
			cnt+=(s[i+j]!=t[j]);
		ans=min(ans,cnt);
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 1728
#include <stdio.h>

int puzzle(int height) {
	int cell[10][5] = {0,0};
	int score = 0;
	int i, j, k;
	int row;
	int fall[5] = { 0 };
	int no_change;

	for (i = 0; i < height; i++) {
		row = height - i - 1;
		scanf("%d%d%d%d%d", &cell[row][0], &cell[row][1], &cell[row][2], &cell[row][3], &cell[row][4]);
	}
	do {
		no_change = height;
		for(i=0;i<height;i++){
			k = 2;
			row = height - i - 1;
			for (j = 0; j < 3; j++)
				if ((cell[row][j] == cell[row][j + 1]) && (cell[row][j + 1] == cell[row][j + 2])&&(cell[row][2]!=0)) {
					fall[j] = 1;
					fall[j + 1] = 1;
					fall[j + 2] = 1;
					k += 1;
				}
			if (k != 2)
				score += cell[row][2] * k;
			else
				no_change--;
			if (fall[2] == 1) {
				for (k = row; k < height; k++) {
					if (k == height - 1) {
						for (j = 0; j < 5; j++)
							if (fall[j] == 1) {
								cell[k][j] = 0;
								fall[j] = 0;
							}
					}
					else
						for (j = 0; j < 5; j++)
							if (fall[j] == 1)
								cell[k][j] = cell[k + 1][j];
				}
			}
		}
	} while (no_change != 0);
	return score;
}

int main(void) {
	int height;

	while (1) {
		scanf("%d", &height);
		if (height == 0)
			break;
		printf("%d\n",puzzle(height));
	}
	return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF 2147483647//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    int n;
    cin >> n;
    vector<double> v(n,0);
    rep(i,n)cin >>v[i];
    sort(v.begin(),v.end());
    rep(i,n-1){
        v[i+1] = (v[i]+v[i+1])/2.0;
    }
    cout << v[n-1] << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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

ll mod=1e9+7;
ll v[3000][3000]={};
ll N,K;

void ncr(ll n){
    for(int i=0;i<n+1;i++){
        for(int j=0;j<=i;j++){
            if(j==0||j==i){
                v[i][j]=1;
            }
            else{
                v[i][j]=(v[i-1][j-1]+v[i-1][j])%mod;
            }
        }
    }
}

int main(){
    cin>>N>>K;
    ncr(2500);
    rep(i,K){
        out((v[K-1][i]*v[N-K+1][i+1])%mod);
    }

}


Measured memory_bytes: 57984
import sys,bisect as bs,collections as cl
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n,k = m()

a = list(input())
aa = s(a)

al = []
ppp = [0]
ans = sum(map(lambda x:x[1]-1,aa))
for i in range(len(aa)-1):
    ppp.append(ppp[-1]+aa[i][1])

if len(aa) != 1:
    al.append([aa[0][1],0,1])
    al.append([aa[-1][1],len(aa)-1,1])

for i in range(1,len(aa)-1):
    al.append([aa[i][1],i,2])
al.sort(key = lambda x:x[2],reverse = True)
on = [True for i in range(n)]
oon = [0 for i in range(len(aa))]
al = cl.deque(al)
co = min(len(aa),k)
while co:
    if len(al) == 0:
        break
    an = al.popleft()
    co -= 1
    if an[2] == 1:
        if an[1] == 0:
            if not oon[1] == -1:
                oon[0] = -1
                oon[1] = 1
                ans += 1
            else:
                co += 1
        else:
            if not oon[-2] == -1:
                oon[-1] = -1
                oon[-2] = 1
                ans += 1
            else:
                co += 1
    else:
        if not (oon[an[1]-1] == -1 or oon[an[1]+1]):
            oon[an[1]-1] = 1
            oon[an[1]+1] = 1
            oon[an[1]] = -1
            ans += 2
        else:
            co += 1

print(ans)






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

int main(){
  int x;
  cin >> x;
  int a,b;
  for(a=-120;a<120;a++){
    for(b=-120;b<120;b++){
      if(a*a*a*a*a-b*b*b*b*b==x){
        cout << a << ' ' << b << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3600
#include <iostream>

int main (){
        int a,b;
        std::cin>>a;
        std::cin>>b;
        if((a*b)%2==1)
        {
                std::cout<<"Odd"<<std::endl;
        }else{
                std::cout<<"Even"<<std::endl;
        }
        return 0;
}

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

l = 0
r = 1
num = a[0]
count = n

while r <= n-1:
    if num ^ a[r] == num + a[r]:
        num = num ^ a[r]
        count += r - l
        r += 1
    else:
        num = num & ~a[l]
        l += 1

print(count)

Measured memory_bytes: 24712
#include <stdio.h>

#define MOD 2019

int main () {
	long long L, R;
	scanf ("%lld %lld", &L, &R);
	int min = MOD;
	if (L/2019<R/2019) {
		printf ("0\n");
		return 0;
	}
	L %= MOD;
	R %= MOD;
	for (int i=L; i<R; i++) {
		for (int j=i+1; j<=R; j++) {
			int tmp = i*j;
			tmp %= MOD;
			if (tmp < min)
				min = tmp;
		}
	}
	printf ("%d\n", min);
	return 0;
}

Measured memory_bytes: 128
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = [int(input()) for i in range(n)]
    #a = list(map(int, input().split()))
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    a = [list(input().split()) for i in range(3)]
    n = int(input())
    b = [input() for i in range(n)]

    for i in range(3):
        for j in range(3):
            if a[i][j] in b:
                a[i][j] = "o"

    if (a[0][0]==a[0][1]==a[0][2]
    or a[1][0]==a[1][1]==a[1][2]
    or a[2][0]==a[2][1]==a[2][2]
    or a[0][0]==a[1][0]==a[2][0]
    or a[0][1]==a[1][1]==a[2][1]
    or a[0][2]==a[1][2]==a[2][2]
    or a[0][0]==a[1][1]==a[2][2]
    or a[0][2]==a[1][1]==a[2][0]):
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()


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

int main(){
  int H,W; cin >> H >> W;
  vector<string> s(H);
  for(int i=0; i<H; i++) cin >> s[i];
  
  vector<vector<int>> flip(H,vector<int>(W,1000000));
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(i==0&&j==0){
        if(s[i][j]=='#') flip[i][j]=1;
        else flip[i][j]=0;
      }else if(i==0){
        if(s[i][j]=='#'&&s[i][j-1]=='.'){
          flip[i][j]=flip[i][j-1]+1;
        }else{
          flip[i][j]=flip[i][j-1];
        }
      }else if(j==0){
        if(s[i][j]=='#'&&s[i-1][j]=='.'){
          flip[i][j]=flip[i-1][j]+1;
        }else{
          flip[i][j]=flip[i-1][j];
        }
      }else{
        if(s[i][j]=='#'&&s[i][j-1]=='.'){
          flip[i][j]=flip[i][j-1]+1;
        }else{
          flip[i][j]=flip[i][j-1];
        }
        if(s[i][j]=='#'&&s[i-1][j]=='.'){
          flip[i][j]=min(flip[i][j],flip[i-1][j]+1);
        }else{
          flip[i][j]=min(flip[i][j],flip[i-1][j]);
        }
      }
    }
  }
  cout << flip[H-1][W-1] << endl;
}

Measured memory_bytes: 3720
while True:
    n = int(input())
    if n == 0:
        break
    arr = []
    for i in range(n):
        tmp = list(map(int, input().split()))
        arr.append([tmp[0], tmp[1] + tmp[2]])
    arr.sort(key = lambda x: x[1], reverse=True)
    print("{} {}".format(arr[0][0], arr[0][1]))



Measured memory_bytes: 7356
N=int(input())
A=list(map(int,input().split()))
X=[]
s=sum(A)
for i in range(1,N,2):
  s-=2*A[i]
X.append(s)

for i in range(N-1):
  x=2*A[i]-X[i]
  X.append(x)
print(*X)
  

Measured memory_bytes: 20620
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x, y;
  cin >> n >> x >> y;
  vector<vector<int>> to(n);
  rep(i, n-1) {
    to[i].push_back(i+1);
    to[i+1].push_back(i);
  }
  --x, --y;
  to[x].push_back(y);
  to[y].push_back(x);
  vector<int> ans(n);
  rep(i, n) {
    vector<int> node(n, -1);
    queue<int> que;
    que.push(i);
    node[i] = 0;
    while (!que.empty()) {
      int now = que.front();
      que.pop();
      for (auto next : to[now]) {
        if (node[next] >= 0)
          continue;
        node[next] = node[now]+1;
        ans[node[next]]++;
        que.push(next);
      }
    }
  }
  for (int i = 1; i < n; i++)
    cout << ans[i]/2 << '\n';
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;


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

    int N,K;
    cin >> N >> K;
    int h[N];
    rep(i,N) cin >> h[i];
    int ans=INF;

    sort(h,h+N);
    for(int i=0;i<=N-K;i++){
        ans=min(ans,h[i+K-1]-h[i]);
    }

    cout << ans << endl;


}

Measured memory_bytes: 640
#include <iostream>

int main(){
    char c;
    std::cin >> c;

    bool flg = false;
    switch(c){
        case 'a':
        case 'i':
        case 'u':
        case 'e':
        case 'o':
            flg = true;
            break;
        default:
            break;
    }

    if(flg){
        std::cout << "vowel" << std::endl;
    }else{
        std::cout << "consonant" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 888
import math
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
limit = sum(B) - sum(A)
cnt_A = 0
cnt_B = 0
for i in range(N):
  if A[i] > B[i]:
    cnt_B += A[i] - B[i]
  elif A[i] < B[i]:
    cnt_A += math.ceil((B[i] - A[i]) / 2)
if cnt_A <= limit and cnt_B <= limit:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 4596
a=[]
w=""
while(w!="0 0"):
    w=input()
    a.append(w)
a.pop()
for st in a:
    s=st.split()
    n=int(s[0])
    x=int(s[1])
    count=0
    for a in range(1,x//3+1):
        for b in range(a+1,(x-a)//2+1):
            if (x-a-b)<=n and b<(x-a-b):
                count+=1
    print("{0}".format(count))



Measured memory_bytes: 5596
#include <stdio.h>
#include <stdlib.h>

int main()
{
    long long int a,b,m,n,k;
    scanf("%lld %lld",&a,&b);
    -1000<=a,b<=1000;
    if(a==0&&b==0)
    {
        printf("0\n");
    }
    m=a+b;
    n=a-b;
    k=a*b;
    if(m>n&&m>k)
    {
        printf("%lld\n",m);
    }
    if(n>m&&n>k)
    {
        printf("%lld\n",n);
    }
    if(k>m&&k>n)
    {
        printf("%lld\n",k);
    }
    if(m==k&&m>n)
    {
        printf("%lld\n",k);
    }
    if(m==n&&n>k)
    {
        printf("%lld\n",n);
    }
    if(n==k&&k>m)
    {
        printf("%lld\n",n);
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>

using Graph = std::vector<std::vector<int>>;

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

    Graph g(n);
    for(int i = 0; i < n; ++i){
        int u, k;
        std::cin >> u >> k;
        --u;
        for(int j = 0; j < k; ++j){
            int v;
            std::cin >> v;
            --v;
            g.at(u).push_back(v);            
            //g.at(v).push_back(u); 
        }
    }

    std::vector<int> dist(n, -1);
    std::queue<int> queue;
    dist.at(0) = 0;
    queue.push(0);

    while(!queue.empty()){
        int v = queue.front();
        queue.pop();

        for(auto nextV : g.at(v)){
//            if(-1 != dist.at(nextV)){
//                continue;
//            }
//            queue.push(nextV);
//            dist.at(nextV) = dist.at(v) + 1;
            if(-1 == dist.at(nextV)){
                queue.push(nextV);
                dist.at(nextV) = dist.at(v) + 1;
            }
        }
    }

    for(int i = 0; i < n; ++i){
        std::cout << i + 1 << " " << dist.at(i) << std::endl;
    }

    return 0;
}


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

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) {
      break;
    }
    vector<int> s(n);
    int sum = 0;
    rep(i, n) {
      cin >> s.at(i);
      sum += s.at(i);
    }
    double mean = (double)sum / n;
    double dev = 0;
    rep(i, n) {
      dev += pow(s.at(i) - mean, 2);
    }
    cout << fixed << setprecision(10);
    cout << sqrt(dev / n) << endl;
  }
}


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

int main() {
  int n;
  cin>>n;
  ll max1=-2000000000;
  ll max2=-2000000000;
  ll max3=-2000000000;
  ll max4=-2000000000;
  ll min1=2000000000;
  ll min2=2000000000;
  ll min3=2000000000;
  ll min4=2000000000;
  for(int i=0;i<n;i++){
    ll x,y;
    cin>>x>>y;
    max1 = max(max1,y+x);
    max2 = max(max2,y-x);
    max3 = max(max3,-y+x);
    max4 = max(max4,-x-y);

    min1 = min(min1,y+x);
    min2 = min(min2,y-x);
    min3 = min(min3,-y+x);
    min4 = min(min4,-y-x);
  }
  ll ans=0;
  ans = max(ans,max1 - min1);
  ans = max(ans,max2 - min2);
  ans = max(ans,max3 - min3);
  ans = max(ans,max4 - min4);
  cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    int a,b,c,x,y;
    lli ans=0;
    cin>>a>>b>>c>>x>>y;
    if(a+b>2*c){
        ans+=min(x,y)*2*c;
        if(x>y){
            if(abs(x-y)*a<abs(x-y)*2*c){
                ans+=abs(x-y)*a;
            }
            else{
                ans+=abs(x-y)*2*c;
            }
        }
        else{
            if(abs(x-y)*b<abs(x-y)*2*c){
                ans+=abs(x-y)*b;
            }
            else{
                ans+=abs(x-y)*2*c;
            }
        }
    }
    else{
        ans+=a*x;
        ans+=b*y;
    }
    out(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string debug_string(const string& s) {
	return '"' + s + '"';
}
string debug_string(bool b) {
	return (b ? "true" : "false");
}
string debug_string(const char* s) {
	return debug_string((string)s);
}
template<class T, class U>
string debug_string(const pair<T, U>& p);
template<class U>
struct can_be_string {
	template<typename...>
	static int f(...) {
		return 0;
	}
	template<typename T>
	static char f(decltype(to_string(T()), char())) { 
		return 'a';
	}
	static const bool value = sizeof(f<U>(char())) == sizeof(char);
};
template<class T> 
typename enable_if<can_be_string<T>::value, string>::type debug_string(const T& a) {
	string s = to_string(a);
	return s;
}
template<class T>
typename enable_if<!can_be_string<T>::value, string>::type debug_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += debug_string(x);
	}
	s += "}";
	return s;
}
template<class T, class U>
string debug_string(const pair<T, U>& p) {
	string s = "(";
	s += debug_string(p.first);
	s += ", ";
	s += debug_string(p.second);
	s += ")";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << debug_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 1e18l + 100;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n, k, q;
	cin >> n >> k >> q;
	vector<int> a(n);
	for (int i = 0;i < q;++i) {
		int t;
		cin >> t;
		--t;
		++a[t];
	}
	debug (a);
	for (int i = 0;i < n;++i) {
		if (k - q + a[i] > 0) {
			cout << "Yes\n";
		}
		else {
			cout << "No\n";
		}
	}
	return 0;
}


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

i=0
compare_num = 26
flag = True
while(flag==True):
    if N > compare_num:
        N = N - compare_num
        i = i + 1
        compare_num = compare_num*26
    else:
        flag = False
        i = i + 1
        
tmp_str = []
if(i==1):
    tmp_str.append(chr(N+96))
else:
    for j in range(i-1):
        waru = 26**(i-(j+1))
        tmp_1 = int(N / waru)
        tmp_2 = N % waru
        if tmp_2 == 0:
            tmp_1 = int((N-1) / waru)
            tmp_2 = waru
        N = tmp_2
        tmp_str.append(chr(tmp_1+1+96))
    tmp_str.append(chr(tmp_2+96))
print(''.join(tmp_str))

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using vs=vector<string>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    	((ll)1ll<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.141592653589793

template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
/*
 * 自明
 */

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

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int n,k;
	cin>>n>>k;
	vi ng,ps;
	rep(i,n){
	    int t;cin>>t;
	    if(t<0)ng.push_back(-t);
	    else ps.push_back(t);
	}
	reverse(all(ng));

	int ans=INF;
	rep(i,k+1){
	    if(ps.size()<i)continue;
	    if(ng.size()<k-i)continue;
	    int posi=i>0?ps[i-1]:0;
	    int nega=k-i>0?ng[k-i-1]:0;
	    ans=min(ans,max(posi,nega)+min(posi,nega)*2);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
#define N 4000 + 5
#define M 5
#define rep(i, l, r) for(int i = l; i <= r; ++i)
char s[M];
int n, a, b, top, st[N], ans[N];
int read(){
    char c; int x = 0, f = 1;
    c = getchar();
    while(c > '9' || c < '0'){ if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int main(){
    a = read(), b = read(), n = a + b;
    if(a <= b){ puts("Impossible"); return 0;}
    rep(i, 0, n - 1){
        if(!st[top]) st[++top] = i;
        else{
            printf("? %d %d\n", st[top], i), fflush(stdout);
            scanf("%s", s + 1);
            if(s[1] == 'Y') st[++top] = i;
            else --top;
        }
    }
    rep(i, 0, n - 1){
        printf("? %d %d\n", st[top], i), fflush(stdout);
        scanf("%s", s + 1);
        if(s[1] == 'Y') ans[i] = 1;
    }
    printf("! ");
    rep(i, 0, n - 1) printf("%d", ans[i]);
    return 0;
}

Measured memory_bytes: 3736
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int y = in.nextInt();
            int sum=0;
            if (x==1) sum+=300000;
            if (x==2) sum+=200000;
            if (x==3) sum+=100000;
            if (y==1) sum+=300000;
            if (y==2) sum+=200000;
            if (y==3) sum+=100000;
            if (x==1 && y==1) sum+=400000;
            System.out.println(sum);






        }


    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


Measured memory_bytes: 23508
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;
#define ll long long int
#define gc getchar_unlocked
#define pc putchar_unlocked
const long long int size=1000003;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#ifdef _WIN32
// no getchar_unlocked on Windows so call _getchar_nolock
inline int gc() { return getchar(); }
inline int pc(ll n) { return putchar(n);}
#endif
// //ll f[size];
// vector<bool>isPrime(size,1);
// //bool isPrime[size];
// ll p[size];
// void fact()
// {f[0] = 1;ll i = 1;while(i<size){f[i] = f[i-1]*i;f[i] = f[i]%MOD;i++;}}
// //use when mod is prime no
// ll fast_pow(ll a,ll n)
// {ll result = 1;while(n>0){if(n&1){result = result*a;result = result%MOD;}a = (a*a)   %MOD;n/= 2;}return result;}
// ll inv(ll x)
// {return fast_pow(x,MOD-2);}
// void sieve()
// {//for(ll i = 0; i <= size;++i) {isPrime[i] = true;}
// isPrime[0] = false;isPrime[1] = false;
// for(ll i = 2; i * i <= size; ++i) {if(isPrime[i] == true) {
// for(ll j = i * i; j <= size ;j += i)isPrime[j] = false;}}

//  p[1]=0;p[0]=0;
//     for(ll i=2;i<=size-1;i++)
//     {
//         if(isPrime[i])
//         p[i]=i+p[i-1];
//         else
//         p[i]=p[i-1];
//     }
// }
// vector<ll> factorize(ll n) {vector<ll> res;
// for (ll i = 2; i * i <= n; ++i) {while (n % i == 0) {res.push_back(i);n /= i;}}
// if (n != 1) {res.push_back(n);}return res;}
ll phi(ll n)
{
	ll result = n;
	for (ll p = 2; p * p <= n; ++p) {
		if (n % p == 0) {
			while (n % p == 0)
				n /= p;
			result -= result / p;
		}
	}
	if (n > 1)
		result -= result / n;
	return result;
}
inline void in(ll &x)
{
	register char c = gc();
	while(c<'0' || c>'9')
		c = gc();

	x=0;
	while(c>='0' && c<='9')
	{
		x = 10 * x + c - 48;
		c = gc();
	}

}
inline void out( ll &b)
{
	char snum[20];
	ll i=0;
	do
	{
		snum[i++]=b%10+'0';
		b=b/10;
	}while(b);
	i=i-1;

	while (i>=0)
	{
		pc(snum[i--]);
	}
   pc('\n');
}
map<ll,ll>mp;
void bfs(ll root,vector<ll>v[],ll n)
{
    ll dist[n+1];
    memset(dist,0,sizeof(dist));
    queue<ll>q;
    ll vis[n+1];
    memset(vis,0,sizeof(vis));
    q.push(root);
    vis[root]=1;
    while(!q.empty())
    {
        ll a=q.front();
        q.pop();
        for(ll i=0;i<v[a].size();i++)
        {
            if(vis[v[a][i]]==0)
            {
                vis[v[a][i]]=1;
                dist[v[a][i]]=dist[a]+1;
                q.push(v[a][i]);
            }
        }
    }
    for(ll i=root+1;i<=n;i++)
        mp[dist[i]]++;
}
int main()
{
  ll n,x,y;in(n);in(x);in(y);
  vector<ll>v[n+1];
  for(ll i=1;i<n;i++)
  {
      v[i].push_back(i+1);
      v[i+1].push_back(i);
  }
  v[x].push_back(y);
  v[y].push_back(x);
  for(ll i=1;i<=n;i++)
  {
      bfs(i,v,n);
  }
  for(ll i=1;i<=n-1;i++)
    out(mp[i]);
}


Measured memory_bytes: 512
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	string s;
	cin >> s;
	for(int i=0;i<s.length();i++){
		s[i]-='0';
	}
	int maxn=1000;
	for(int i=2;i<s.length();i++){
		int a=s[i]+s[i-1]*10+s[i-2]*100;
		int f=abs(a-753);
		if(f<maxn) maxn=f;
	}
	cout <<maxn;
	return 0;
}

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

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


int main(){

  ll n,m,c;
  cin >> n >> m >> c;
  vector<ll> b(m);
  rep(i,m) cin >> b[i];

  ll ans = 0;
  rep(i,n){
    ll sum = 0;
    rep(j,m){
      ll a; cin >> a;
      sum += a*b[j];
    }
    sum += c;
    if(sum > 0){
      ans ++;
    }
  }

  cout << ans << endl;

  return 0;
} 

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

using namespace std;

#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int H,W;
char a[105][105];

void solve(){
    rep(i,H+2){
        rep(j,W+2){
            if(i == 0 || i == H+1 || j == 0 || j == W+1) cout << "#";
            else cout << a[i][j];
        }
        cout << endl;
    }
}

int main(){
    cin >> H >> W;

    rep(i,H){
        rep(j,W){
            cin >> a[i+1][j+1];
        }
    }

    solve();
}


Measured memory_bytes: 256
#include <stdio.h>
       int main(void){
	int a, b, c;

	 scanf("%d %d %d", &a, &b, &c);
		int max = a;
		if(b>max) max=b;
		if(c>max) max=c;
		printf("%d\n",a+b+c-max);
		return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <cmath>
#include <cstring>
#include <cstdio>

using namespace std;

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

int N;
int A[200000];
int B[200000];
int I[200000];

int main() {
    scanf("%d", &N);
    rep(i, N) {
        scanf("%d %d", &A[i], &B[i]);
    }
    rep(i, N) {
        I[i] = i;
    }
    sort(I, I + N, [](int i, int j) { return B[i] < B[j]; });
    ll time = 0;
    int i;
    for(i=0;i<N;i++) {
        ll cost = A[I[i]];
        ll deadline = B[I[i]];
        if (time + cost > deadline) break;
        time += cost;
    }
    cout << (i == N ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    bool b=true;
    rep(i,0,n-1){
        if(a[i]%2==0){
            if(a[i]%3!=0 && a[i]%5!=0){
                b=false;
            }
        }
    }
    if(b){
        cout<<"APPROVED"<<endl;
    }else{
        cout<<"DENIED"<<endl;
    }
    
    return 0;
}



Measured memory_bytes: 384
import numpy as np
n,l = map(int,input().split())

apple=np.array(list(range(1,n+1,1))) 
taste = np.array(list(range(1,n+1,1))) + l -1

if n+l > 0:
    ans=np.sum(taste)-min(np.abs(taste))
else:
    ans=np.sum(taste)+min(np.abs(taste))

print(ans)


Measured memory_bytes: 19348
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>

const int inf = 1000000000;

typedef std::pair<int, int> P;
typedef std::pair<P, int> PP;

const int maxN = 100001, maxM = 200001, maxQ = 200001;

P cost[maxN]; //cost, time
std::vector<PP> g[maxN]; //(cost, time), to
int n, m, q;
int u[maxM], v[maxM], t[maxM];
int r[maxQ];
int ans[maxQ];

void dijkstra(int k){
	std::priority_queue < PP, std::vector<PP>, std::greater<PP> > que; //(cost, time), n
	for (int i = 0; i < n; ++i)cost[i] = P(inf, inf);
	cost[k].first = 0;
	que.push(PP(P(0, inf), k));
	while (!que.empty()){
		PP pp = que.top();
		que.pop();
		int v = pp.second;
		if (cost[v].first < pp.first.first)continue;
		for (int i = 0; i < g[v].size(); ++i){
			PP e = g[v][i];
			if (cost[e.second].first > cost[v].first + e.first.first){
				cost[e.second].first = cost[v].first + e.first.first;
				cost[e.second].second = std::min(cost[v].second, e.first.second);
				que.push(PP(cost[e.second], e.second));
			}
			else if(cost[e.second].first == cost[v].first + e.first.first && cost[e.second].second < std::min(cost[v].second, e.first.second)){
				cost[e.second].second = std::min(cost[v].second, e.first.second);
				que.push(PP(cost[e.second], e.second));
			}
		}
	}
}

int main(){
	std::cin >> n >> m >> q;
	for(int i = 0; i < m; ++i){
		std::cin >> u[i] >> v[i];
		--u[i], --v[i];
		t[i] = inf;
	}
	for(int i = 0; i < q; ++i){
		std::cin >> r[i];
		t[r[i] - 1] = i;
	}
	
	for(int i = 0; i < m; ++i){
		g[u[i]].push_back(PP(P(1, t[i]), v[i]));
		g[v[i]].push_back(PP(P(1, t[i]), u[i]));
	}
	
	dijkstra(0);
	for(int i = 0; i < n; ++i){
		if(cost[i].second != inf)++ans[cost[i].second];
	}
	
	for(int i = 1; i < q; ++i){
		ans[i] += ans[i - 1];
	}
	
	for(int i = 0; i < q; ++i){
		std::cout << ans[i] << std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 16400
n=int(input())
a=list(map(lambda x: int(x), input().split()))
last=a[0]
inc=None
ans=1
for i in range(1,len(a)):
    if inc==True and a[i]>=last:
        pass
    elif inc==True and a[i]<last:
        inc=None
        ans+=1
    elif inc==False and a[i]<=last:
        pass
    elif inc==False and a[i]>last:
        inc=None
        ans+=1
    elif inc==None and a[i]>last:
        inc=True
    elif inc==None and a[i]<last:
        inc=False
    elif inc==None and a[i]==last:
        pass
    last=a[i]
print(ans)

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

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string line;
		cin >> line;
		deque<char> t;
		t.push_back(line[0]);
		unsigned index = 0;
		for (unsigned i = 1; i < line.size(); i++) {
			switch (line[i]) {
			case '-':
				i += 2;
				index++;
				if (index == t.size()) {
					t.push_back(line[i]);
				}
				break;
			case '<':
				i += 2;
				if (index == 0) {
					t.push_front(line[i]);
				}
				else index--;
			}
		}
		for (unsigned i = 0; i < t.size(); i++) {
			cout << t[i];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
int main()
{
    int i,j,x;
    double flag=1;
    scanf("%d",&x);
    for(i=1;i<=x/2;i++)
    {
        for(j=2;j<=x/2;j++)
        {
            if(pow(i,j)<=x&&flag<pow(i,j))
            {
                flag=pow(i,j);
            }
        }
    }
    printf("%.0f",flag);

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<set>
#include<algorithm>
using namespace std;
#define REP(i,n) for(int i=0; i <(n); i++)
string rev(string s){
    reverse(s.begin(), s.end());
    return s;
}
int main(){
    int N;
    cin>>N;
    while(N--){
        set<string> ans;
        string s;
        cin>>s;
        REP(i, s.size()-1){
            string b = s.substr(0, i+1);
            string e = s.substr(i+1);
            ans.insert(b + e);
            ans.insert(b + rev(e));
            ans.insert(rev(b) + e);
            ans.insert(rev(b) + rev(e));
            ans.insert(e + b);
            ans.insert(e + rev(b));
            ans.insert(rev(e) + b);
            ans.insert(rev(e) + rev(b));
        }
        cout<<ans.size()<<endl;
    }
    return 0;
}
            

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define max 1000000
#define pb push_back
#define pairs pair<int, int>
#define vi vector<int>
#define vb vector<bool>
#define vii vector<pairs>
#define lb lower_bound
#define ub upper_bound
#define lli long long int
#define endl '\n'
#define FastInput ios_base::sync_with_stdio(false), cin.tie(NULL);
#define Cases  cout << "Case " << ++Case << ": ";
#define __test int tt; int Case=0; cin >> tt; while(tt--)
#define read(x) freopen(x, "r", stdin)
#define write(x) freopen(x, "w", stdout)
#define InputArray(a,n) for(int i=0;i<n;i++) cin >> a[i];
#define CopyArray(a,temp,n) for(int i=0;i<n;i++) temp[i]=a[i];
#define PrintArray(a,n) for(int i=0;i<n;i++) cout << a[i] << " "; cout << endl;
using namespace std;


int main() {
#ifdef Niloy
	read("input.txt");
	write("output.txt");
#endif

	int a, b, c, d;
	cin >> a >> b >> c >> d;

	int check = 0;
	while (a > 0 && c > 0) {
		if(check % 2 == 0) {
			c -= b;
			check++;
		} else {
			a -= d;
			check++;
		}
	}

	if(a <= 0) {
		cout << "No\n";
	} else {
		cout << "Yes\n";
	}

	cerr << "time = " << (clock() / CLOCKS_PER_SEC) << " sec" << '\n';
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<vector<int> > a(N+1,vector<int>(N+1,1));
    if(N%2==0){
        for(int i=1;i<=N/2;i++){
            a[i][N-i+1]=0;
        }
    }else{
        for(int i=1;i<=N/2;i++){
            a[i][N-i]=0;
        }
    }
    cout << (N*(N-1))/2-N/2 << endl;
    for(int i=1;i<N;i++){
        for(int j=i;j<=N;j++){
            if(a[i][j]==1&&i!=j)cout << i << " " << j << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void shuffle(int* fuda,int p,int c,int n){
    int i;
    for (i=0; i<n; i++) {
        if (*(fuda+i)<p+c) {
            if (*(fuda+i)<p) {
                *(fuda+i)+=c;
            } else {
                *(fuda+i)-=(p-1);
            }
        }
    }
};

int main(){
    while (1) {
        int n,r,i,p,c;
        scanf("%d %d",&n,&r);
        if (n==0&&r==0) return 0;
        int fuda[n];
        for (i=0; i<n; i++) {
            fuda[i]=i+1;
        }
        for (i=0; i<r; i++) {
            scanf("%d %d",&p,&c);
            shuffle(fuda, p, c, n);
        }
        for (i=0; i<n; i++) {
            if (fuda[i]==1) {
                printf("%d\n",n-i);
            }
        }
    }
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); i--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, n, 0)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1e9 + 7

using namespace std;

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

int main(void)
{
    string s;
    cin >> s;
    cout << count(all(s), '1') << endl;
    return 0;
}

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

#ifdef ENABLE_LL
#define int long long
#endif

#ifdef ENABLE_LL
#define I "%lld"
#define II "%lld%lld"
#define III "%lld%lld%lld"
#define IIII "%lld%lld%lld%lld"
#define IN "%lld\n"
#define IIN "%lld%lld\n"
#define IIIN "%lld%lld%lld\n"
#define IIIIN "%lld%lld%lld%lld\n"
#else
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define IIII "%d%d%d%d"
#define IN "%d\n"
#define IIN "%d%d\n"
#define IIIN "%d%d%d\n"
#define IIIIN "%d%d%d%d\n"
#endif

#ifdef __LOCALE__
#define see(a) std::cout << #a << "=" << a << std::endl
#define ses(a) std::cout << #a << "=" << a << " " 
#else
#define see(a) //std::cout << #a << "=" << a << std::endl
#define ses(a)
#endif
#define repe(a,b) for (int a=0;a<(int)b.size();a++)
#define rep(i,n) for (int i=0;i<n;i++)
#define repa(i,n) for (int i=1;i<=n;i++)
#define repi(i,a,b) for (int i=a;i<=b;i++) 
#define repb(i,a,b) for (int i=a;i>=b;i--)
typedef pair < int , int > pr;
typedef pair < pr  , int > prr;
#define L first
#define R second
template <class T> inline bool checkMin(T& a , T b) { return (a > b ? a=b,1 : 0); }
template <class T> inline bool checkMax(T& a , T b) { return (a < b ? a=b,1 : 0); }
class Scanner{ private: istream& ist;public: Scanner(istream& in):ist(in){} string next(){ string r; ist >> r; return r; } string nextLine(){ string r; getline(ist,r); return r; } int nextInt(){ int r; ist >> r; return r; } double nextDouble(){ double r; ist >> r; return r; }};
Scanner sc(cin);


void init() {
     
}

void solve() {
    int a, b, c;
    scanf(III,&a,&b,&c);
    puts((a+b+c>=22) ? "bust" : "win");
}


#ifdef ENABLE_LL
#undef int
#endif
int main(){
    init();
    solve();
    return 0;
}


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

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int c = 0;
    for( int i = 0; i < n; i++ )
    {
        if( s[i] != s[n-(1+i)] ){
            c++;
        }
    }
    
    cout << int(c/2) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int len;
    cin >> len;
    vector<int> arr(len);
    for(int i = 0; i < len; i++)
        cin >> arr[i];
    int ans = 0;
    for(int i = 0; i < len; i++) {
        if(arr[arr[i] - 1] - 1 == i)
            ans += 1;
    }
    cout << ans / 2;
}



Measured memory_bytes: 3732
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <unordered_set>

#define REP(i, s, e) for (ll i = s; i < e; ++i)

using namespace std;
using ll = long long;
using ld = long double;

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

    int N;
    cin >> N;
    vector<string> h(N);
    cin >> h[0];
    REP(i, 1, N)
    {
        string s;
        cin >> s;
        if (find(h.begin(), h.end(), s) != h.end() || h[i - 1][h[i - 1].size() - 1] != s[0])
        {
            cout << "No" << endl;
            return 0;
        }
        h[i] = s;
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a = [-1] + a

c = [-1] + [0] * n

for i in range(n // 2 + 1, n + 1):
  c[i] = a[i]

for i in range(n // 2, 0, -1):
  sum = 0
  j = i + i
  while (j <= n):
    sum += c[j]
    j += i
  c[i] = (a[i] - sum) % 2

print(c.count(1))
for i in range(1,n+1):
  if c[i] == 1:
    print(i)


Measured memory_bytes: 8352
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map(String::toInt)
    val foods = IntArray(m)
    (1..n).forEach {
        readLine()!!.split(' ').drop(1).forEach { foods[it.toInt() - 1]++ }
    }
    println(foods.filter { it == n } .count())
}


Measured memory_bytes: 38208
from math import sqrt
N = int(input())
ans = 10**18
for i in range(1, int(sqrt(N))+1):
    if N//i==i and N%i==0:
        ans = (i-1)*2
        break
    else:
        if N%i==0:
            #print((N//i)-1, i-1)
            tmp = ((N//i)-1)+(i-1)
            ans = min(tmp, ans)
print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        for(int i = 0 ; i < n ; i++ ){
            p[i] = sc.nextInt();
        }
        int s = 0;
        int lo = p[0] + 1;
        for(int i = 0 ; i < n ; i++ ){
            if(lo >= p[i]){
                lo = p[i];
                s++;
            }
        }
        System.out.println(s);
        sc.close();
    }
}

Measured memory_bytes: 60380
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
q = gets.chomp.to_i

h = Hash.new(0)
a.each do |num|
  h[num] += 1
end

sum = h.map{|k,v| k*v}.sum
q.times do
  b, c = gets.chomp.split.map(&:to_i)
  h[c] += h[b]
  sum = sum - b * h[b] + c * h[b]
  h.delete b
  puts sum
end


Measured memory_bytes: 28248