akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = list(map(int, input().split()))
tmp = 0
count = -1
while  tmp < 1:
  for i in range(N):
    if A[i]%2 == 1:
      tmp = 1
    A[i] =int(A[i]/2)
  count = count+1
print(count)

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

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

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

ll d[10], v[10];

int main()
{
	int n;
	
	while (scanf("%d", &n), n){
		ll m = 1ll;
		rep(i, n){
			scanf("%lld %lld", &d[i], &v[i]);
			ll t = gcd(d[i], v[i]);
			d[i] /= t;
			v[i] /= t;
		}
		ll l = 1;
		rep(i, n){
			l = lcm(l, d[i]);
		}
		rep(i, n){
			v[i] *= (l / d[i]);
		}
		ll g = v[0];
		rep(i, n){
			g = gcd(g, v[i]);
		}
		rep(i, n){
			printf("%lld\n", v[i] / g);
		}
	}
}

Measured memory_bytes: 1188
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
 
        printArray(a, n);
        insertionSort(a, n);
    }
 
    private static void insertionSort(int[] a, int n) {
        for(int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            while(j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            printArray(a, n);
        }
    }
 
    private static void printArray(int[] a, int n) {
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++) {
            if(i != 0) sb.append(" ");
            sb.append(a[i]);
        }
        System.out.println(sb);
    }
}


Measured memory_bytes: 28348
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

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

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

int main()
{
	int N, M;
	string S, T;
	cin >> N >> M >> S >> T;
	ll L = lcm(S.size(), T.size());
	ll up = lcm(L / S.size(), L / T.size());
	//cout << L << " "<<up << endl;
	int s = 0, t = 0;
	for (ll i = 0; i < L; i += up) {
		//cout << S[s] << " " << T[t] << endl;
		if (S[s] != T[t]) {
			cout << "-1" << endl;
			return 0;
		}
		s += L / T.size();
		t += L / S.size();
	}
	cout << L << endl;
}


Measured memory_bytes: 512
import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
MOD = 10**9+7

N,M,P = map(int,(input().split()))
line = []
for i in range(M):
    a,b,c = map(int,(input().split()))
    line.append([a-1,b-1,-c+P])

min_distance = [float("inf")]*N # min_distance[i] は始点から街iまでの最短距離
min_distance[0] = 0 # 始点から始点への最短距離は0とする

def Bellman_Ford(S,V,E,distance):
    update = False
    flag = 0
    for _ in range(V):
        for s,g,d in distance: # [s,g,d] = [道路の始点,道路の終点,道路の長さ] について、すべての道路を見る
            if min_distance[s] != float("inf") and min_distance[s] + d < min_distance[g]: # 最短経路が確立されている街から伸びる道路を通ることで、距離を短くできるならば、
                min_distance[g] = min_distance[s] + d # 最短距離を上書きする
                update = True
        if not update:
            flag = 1
            break
    return min_distance,flag

def Bellman_Ford2(S,V,E,distance):
    for _ in range(V):
        for s,g,d in distance: # [s,g,d] = [道路の始点,道路の終点,道路の長さ] について、すべての道路を見る
            if min_distance[s] != float("inf") and min_distance[s] + d < min_distance[g]: # 最短経路が確立されている街から伸びる道路を通ることで、距離を短くできるならば、
                min_distance[g] = -float("inf")
                if g == N-1:
                    break
        else:
            continue
        break
    return min_distance

min_distance,flag = Bellman_Ford(1,N,M,line)

if flag == 1:
    ans = min_distance[N-1]
    print(max(-ans,0))
else:
    min_distance = Bellman_Ford2(1,N,M,line)
    ans = min_distance[N-1]
    if ans == -float("inf"):
        print(-1)
    else:
        print(max(-ans,0))

#print(min_distance)

Measured memory_bytes: 75880
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
 
#define mem(dp,a)       memset(dp,a,sizeof dp)
#define ninja           ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb(x)           push_back(x)
#define mp(x,y)         make_pair(x,y)
#define all(c)          c.begin(), c.end()
#define int             long long
#define ff              first
#define ss              second
#define nl              '\n'
#define inf             1e9+7

signed main()
{
	ninja
	int t; 
	t=1;
	while(t--)
	{
		int n,m; cin>>n>>m;
		int x,s=0;
		for(int i=0;i<m;i++){
			cin>>x; s+=x;
		}
		if(s>n)
			cout<<"-1";
		else
			cout<<n-s;
	}
}



Measured memory_bytes: 3656
#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.at(i);
    }
    vector<int> B(N);
    for(int i=0;i<N;i++){
        cin>>B.at(i);
    }
    vector<int> C(N);
    for(int i=0;i<N-1;i++){
        cin>>C.at(i);
    }
    int ans=0;
    for(int i=0;i<N;i++){
        ans+=B.at(i);
    }
    for(int i=0;i<N-1;i++){
        if(A.at(i)==A.at(i+1)-1){
            ans+=C.at(A.at(i)-1);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

/*
　　　　　　　　　　　　　　　　　　　　　__,.二ﾆ==-　　ﾆ．、_.　　　　　　　　　　　　　　　　　　　　　
　　　　　　　　　　　　　　　　.,.．‐　⌒　　　　　　　　　　　　｀`'ァ-ﾆ、.　　　　　　　　　　　　　　　
　　　　　　　　　　　　　　ィ'´.　　　　　　　　　　　　　　　　　　　　　　´丶.、　　　　　　　　　　　　
　　　　　　　　　　　.,ィ'´　　　　　　　　　　　　　　　　　　　　　　　　　　　　`.ｘ、..　　　　　　　　　
　..　　　　　　　　／.　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　､＼.　　　　　　　　
　　　　　　　　.ﾝ′.　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　￢`""冖ｰミト．
　　　　　　　,ｒ′.　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　.ﾍ、　　　　`
　　　　　　ﾂ　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`、....　　　
　　　　　./´　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　ﾍ　　　　
　.....　　/.　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　.〉.　　　
　　　´/..　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　.ｌ　　　
　　　ｨ　　　　　　　　　　　　　　　　　　　　　　　　　．　　　　　　　　　　　　　　　　　　　　　ｆ..　　
　..　.ｆ　,d.　　　　　　　　　　　　　　　　　l　　　′　」　　,.　　　　　　　　　　　　　ﾄ　　　　　！　　
　.　〕../.ｆ..　　　　　　　　　　　　　　　　　′　．.　　|　　.｝　　　　　　　　　　　　　|　　　　　　|.　　
　　.!./..f..　　　　　　　　　　　　　　　　　/　　!－　ナ丶п冖т　　　　ﾉｰ-　．　〕　　　　　　|.　　
　　|ﾒ　|　　　　　　　　　　　　　　　｜　j　　　　　　,　　┌．　|〈.　　　л`.　　　/|..　　　　　┤,..　
　...「...｜.　　　　　　|　　´　　　　　　l.　|　　j.Ｌ......ｭ.Ｌ＿└ヽ_｜Y.　　ﾒムｗ　ょ　|　　j.:　　　|　￣
　.　　｜.　　　　　　　　　　　　　　　т〕＜.ィ冖T冖..　г‐　`､　`,　/┴￢..г￣|..　.′　　｜　　
　...　　|　　　　　　　　．..　　　　　　　),|..　｀　　ﾘ　「_ﾉ.||　　　　`　V　　|!｛,｢ll　´.」.　　　　　卜　　
　.　　｜.」　　　　　　′　　　　　　　　ヽ　　　　└++〃..　　　　　　　　ﾙｗｆ　　ｶz′.　　　｜.　　
　　　　|..〕　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　｢　　　　　．|　　　
　　　　.ｌ.|.　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　′.　　　　　|　　　
　.　　　.〕..　　　　　　　　　　　　　　　`!　　　　　　　　_...．.ｰ：''　　　　　　　　　｣　´　　　　λ.　　
　　　　_｢.　　　　,　　　　　　　　　　　　┐_,、｀~‐''"´　　　　　　　　　　　　　　　　ィ　　　.､　ﾍ、　
　　　　ｆ　　　　　　:_＿..,二ュ．-i―'''^~´　　　　　　　　　　　　　　　　　　　　　　　､＼イ　ヘ．`ｘ
　.　　/　　　　　　｛　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　j　　　　.~^
　　､/　　　　　　　'ｔ..　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　丿..　　　　　
　.../.　　　　　　　,x┐..　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　∠∫　　　　　
　:^.　　　　　　　/　　￣冖ー=zzｭ┌ｰ―--　　　∟,二...＿.　　　　　　　_,､．-ｰ.'l+~.　.l｀．　　　　
　.　　　　　　　У.　　　　　　　　　⌒冖‐-=．_..　l｢.｢　　　　　　´￣｣了　　.,､-''＾　　　〉　ヽ_　　　
　　　　　　　_/.　　　　　　　　　　　　　　　　　　￣~'.ー-=．、＿,..usｧ.ｰ''"　　　　　　｛　　　＼´　
　　　　　　_ヰl'￢―-　､_　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　（　　　　.＼
*/

using namespace std;

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

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n,ll mod = MOD){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%mod;
        }
        x = (x*x)%mod;
        n >>= 1;
    }
    return ret;
}

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

ll twoPow(ll shiftNum){
    return (1LL << (shiftNum - 1));
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    ll l,r,d;
    cin >> l >> r >> d;

    ll ans = 0;
    for(int i = l; i <= r; i++){
        if(i%d == 0){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3608
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <time.h>
#include <unordered_map>
#include <cstdio>
#include <math.h>
#include <queue>
#include <deque>
#include <string>
#include <set>
#include <algorithm>

using namespace std;

typedef double dl;
typedef long long ll;

vector<ll> get(ll val)
{
	vector<ll> x;

	while (val > 0)
	{
		x.push_back(val % 2);
		val /= 2;
	}

	while ((ll)x.size() < 6)
		x.push_back(0);

	reverse(x.begin(), x.end());
	return x;
}

int main()
{
	//freopen("input.txt", "r", stdin);

	//ios_base::sync_with_stdio(false);

	string str;
	cin >> str;

	ll sum = 0;
	vector<ll> cnt(str.size());

	for (int i = (ll)str.size() - 1; i >= 0; --i)
	{
		if (str[i] == 'W')
			cnt[i] += 1;

		if(i + 1 < (ll)str.size())
			cnt[i] += cnt[i + 1];
	}

	ll ans = 0;
	for (int i = 0; i < (ll)str.size(); ++i)
	{
		if (str[i] == 'B')
		{
			ans += cnt[i];
		}
	}

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


Measured memory_bytes: 2180
//Bismillahir Rahmanir Rahim
// AtCoder-gacha
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  set<string>st;
  int n; cin>>n;
  while(n--){
  	string s;  cin>>s;
//	getline(cin,s);
  	st.insert(s);
  }
  cout<<st.size()<<endl;
  return 0;
}

Measured memory_bytes: 19120
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            int MAX = 104729;
            int sqrtMAX = (int)Math.Sqrt(MAX);

            int[] isPrime = Enumerable.Range(0, MAX + 1).ToArray();
            isPrime[0] = isPrime[1] = -1;

            for (int i = 0; i < sqrtMAX; i++)
            {
                if (isPrime[i] != -1)
                {
                    for (int j = i * i; j <= MAX; j += i)
                    {
                        isPrime[j] = -1;
                    }
                }
            }

            var primes = isPrime.Where(p => p != -1).ToArray();

            while (true)
            {
                int n = int.Parse(Console.ReadLine());

                if (n == 0) break;

                int sum = primes.Take(n).Sum();
                sb.AppendLine(sum.ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 10636
#include<stdio.h>
#include<stdlib.h>
int main(void){
  int a,b,c;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  if(a>=b && a>=c)
    printf("%d",10*a+b+c);
  else if(b>=a && b>=c)
    printf("%d",10*b+a+c);
  else if(c>=a && c>=b)
    printf("%d",10*c+a+b);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  if(n==1)
  {
    if(k>0) cout<<-1<<'\n';
    else cout<<0<<' '<<0<<' '<<1<<' '<<1<<'\n';
    return 0;
  }
  int all=(1<<n);
  if(k<all)
  {
    if(k==0)
    {
      for(int i=0;i<all;i++) cout<<i<<' '<<i<<' ';
      return 0;
    }
    for(int i=1;i<all;i++)
    {
      if(i==k) continue;
      cout<<i<<' ';
    }
    cout<<k<<' ';
    for(int i=all-1;i>=1;i--)
    {
      if(i==k) continue;
      cout<<i<<' ';
    }
    cout<<0<<' '<<k<<' '<<0<<'\n';
    return 0;
  }
  else cout<<-1<<'\n';
  return 0;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<(int)(n);i++)
#define N 200000


int main() {
	int a[N];
	f(i, N)a[i] = 0;
	long long b[N];
	f(i, N)b[i] = 0;
	int n, k;
	int x, y, z;
	long long s, ans;
	bool v = true;
	scanf("%d", &n);
	ans = 1;
	f(i, n) {
		scanf("%d", &a[i]);
		if (a[i] == 0) {
				ans = ans * (3 - b[0]);
				ans = ans % MOD;
		}
		else if (b[a[i]] >= b[a[i]-1])ans = 0;
		else {
			ans = ans * (b[a[i]-1] - b[a[i]]);
			ans = ans % MOD;
		}
		b[a[i]]++;
	}

	printf("%lld\n", ans);


	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

int main()
{
    int N;
    cin >> N;
    cout << "ABC" <<N;
    return 0;
}

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

using namespace std;

#define ll long long

const ll mod  = 1e9 + 7;
const ll INF = 1e14;


void solve(){

    string s; cin >> s;
    if(s == "ABC") cout << "ARC";
    else cout << "ABC";

}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    

    //cout << setprecision(10);
    //int test; cin >> test;
    //for(int t = 1; t <= test; ++t){
        solve();    
    //}

	return 0;
}



Measured memory_bytes: 3612
#include <stdio.h>
int main(){
    int n,x,i,count=1,d=0;
    scanf("%d %d", &n, &x);
    int l[n+1];
    for(i=1; i<=n; i++){
        scanf("%d", &l[i]);
    }
    while(d<=x){
        d += l[count];
        count++;
    }
    printf("%d\n", count-1);
}

Measured memory_bytes: 128
//C - Daydream: 
//Assunto: 
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define loop(i, a, b) for(int i = a; i < b; i++)
#define loopBack(i, a, b) for(int i = a; i >= b; i--)
#define INF INT_MAX
#define LINF LLONG_MAX
#define DINF DBL_MAX
#define MAX 100050
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

bool ans = false;

void solve(string s) {
    size_t found1, found2, found3, found4;
    reverse(all(s));
    int i = 0;
    found1 = s.find("resare"); found2 = s.find("esare"); found3 = s.find("remaerd"); found4 = s.find("maerd");
    while(i < s.size()) {
        if(found1 != string::npos and found1 == i) i += 6;
        else if(found2 != string::npos and found2 == i) i += 5;
        else if(found3 != string::npos and found3 == i) i += 7; 
        else if(found4 != string::npos and found4 == i) i += 5;
        else return;
        if(found1 < i) found1 = s.find("resare", found1+1);
        if(found2 < i) found2 = s.find("esare", found2+1);
        if(found3 < i) found3 = s.find("remaerd", found3+1);
        if(found4 < i) found4 = s.find("maerd", found4+1);
    }
    ans = true;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    string s;
    cin >> s;
    solve(s);
    if(ans) cout << "YES\n";
    else cout << "NO\n";
}

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

typedef long long ll;

#define F for(int i = 0; i < N; i++)

int main() {

    int N;
    cin >> N;
    int count = 0;
    int flag = 0;

    vector<int> D1(N);
    vector<int> D2(N);

    F{
        cin >> D1.at(i) >> D2.at(i);
    }

    F{
        if(D1.at(i) == D2.at(i)){
            count++;
            if(count == 3){
                flag = 1;
                break;
            }
        }else{
            count = 0;
        }
    }

    if(flag == 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


}

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

int main() {
  int W,H,N;
  cin >> W >> H >> N;
  
  int max_x=W, max_y=H, min_x=0, min_y=0;
  
  for(int i=0; i<N; ++i) {
    int x,y,a;
    cin >> x >> y >> a;
    
    if(a == 1) {
      if (x > min_x){
                min_x = x;
            }
    }
    else if(a == 2) {
       if (x < max_x){
                max_x = x;
            }
    }
    else if(a == 3) {
       if (y > min_y){
                min_y = y;
            }
    }
    else if(a == 4) {
        if (y < max_y){
                max_y = y;
            }
    }
    }
    if (min_x < max_x && min_y < max_y){
        cout << (max_x - min_x)*(max_y - min_y) << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
use proconio::input;
use std::cmp;

#[allow(non_snake_case)]
fn main() {
    input! {
        N: usize,
        xy: [(i64, i64); N]
    }

    let mut zmin = std::i64::MAX;
    let mut zmax = std::i64::MIN;
    let mut wmin = std::i64::MAX;
    let mut wmax = std::i64::MIN;

    for (x, y) in xy {
        let z = x + y;
        let w = x - y;

        zmin = cmp::min(z, zmin);
        zmax = cmp::max(z, zmax);
        wmin = cmp::min(w, wmin);
        wmax = cmp::max(w, wmax);
    }

    let ans = cmp::max(zmax - zmin, wmax - wmin);
    println!("{}", ans);
}


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

const int ac = 1e6 + 6;
int A[ac];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	for (int i = 0; i < n; i++) cin >> A[i];
	int c = 0;
	for (int i = 0; i < n; i++)
		if (A[i] != i + 1) c++;
	if (c == 2 || c == 0) cout << "YES\n";
	else cout << "NO\n";
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC088_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int Bob = 0;
            int Alice = 0;
            array = array.OrderByDescending(x=> x).ToArray();

            for (int i = 0; i < N; i++)
            {
                if (i % 2 == 0)
                {
                    Alice += array[i];
                }
                else
                {
                    Bob += array[i];
                }
            }

            Console.WriteLine(Alice - Bob);
        }
    }
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    unordered_set<string> s;
    for(int i=0; i<n; i++){
        string str;
        cin >> str;
        s.insert(str);
    }
    cout << s.size() << endl;
	return 0;
}


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

using namespace std;
using ll = long long;

template <typename T> void chmin(T &a, T b) { a = min(a, b); }

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

  int h, n;
  cin >> h >> n;
  vector<ll> a(n);
  vector<ll> b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }

  const ll inf = 1e18;
  vector<ll> m(h + 1, inf);
  m[0] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < h; j++) {
      chmin(m[min(1ll * h, j + a[i])], m[j] + b[i]);
    }
  }

  cout << m[h] << endl;

  return 0;
}


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

int main() {
  long x,y,a,b,c,ans=0;
  cin >> x >> y >> a >> b >> c;
  priority_queue<long> p;
  priority_queue<long> q;
  priority_queue<long> r;
  for(int i=0;i<a;i++) {
    long aaa;
    cin >> aaa;
    p.push(aaa);
  }
  for(int i=0;i<b;i++) {
    long aaa;
    cin >> aaa;
    q.push(aaa);
  }
  for(int i=0;i<c;i++) {
    long aaa;
    cin >> aaa;
    r.push(aaa);
  }

  for(int i=0;i<x;i++) {
    r.push(p.top());
    p.pop();
  }
  for(int i=0;i<y;i++) {
    r.push(q.top());
    q.pop();
  }
  for(int i=0;i<x+y;i++) {
    ans+=r.top();
    r.pop();
  }

  cout << ans << endl;
}

Measured memory_bytes: 7536
# フェルマーの小定理
def mcomb(n, k):
    a = 1
    b = 1
    for i in range(k):
        a *= n - i
        a %= m
        b *= i + 1
        b %= m
    return a * pow(b, m - 2, m) % m


n, a, b = map(int, input().split())

m = 1000000007

result = pow(2, n, m) - 1
result -= mcomb(n, a)
result %= m
result -= mcomb(n, b)
result %= m
print(result)


Measured memory_bytes: 9116
#include<stdio.h>
int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	if (a < b){
		printf("a < b\n");
	}
	else{
		if (a > b){
			printf("a > b\n");
		}
		else{
			printf("a == b\n");
		}
	}
	return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
void rd(long long &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1,
    x=-x;
  }
  while(x){
    f[s++]=x%10,
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int main(){
  int ans=0;
  long long x, y;
  rd(x);
  rd(y);
  while (x <= y){
    ans++;
    x <<= 1;
  }
  wt_L(ans);
  putchar_unlocked('\n');
  return 0;
}
// cLay varsion 20170910-1

// --- original code ---
// {
//   ll x, y;
//   rd(x, y);
//   int ans = 0;
//   while (x <= y) {
//     ans++;
//     x <<= 1;
//   }
//   wt(ans);
// }

Measured memory_bytes: 256
s = list(input())
t = list(input())
n = len(s)
atoz = [chr(i) for i in range(97, 97+26)]
rs = [-1]*26
rt = [-1]*26
for i in range(n):
  if rs[atoz.index(s[i])] != -1 or rt[atoz.index(t[i])] != -1:
    if rs[atoz.index(s[i])] != t[i] or rt[atoz.index(t[i])] != s[i]:
      print("No")
      break
  else:
    rs[atoz.index(s[i])] = t[i]
    rt[atoz.index(t[i])] = s[i]
else:
  print("Yes")

Measured memory_bytes: 70476
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz 100005
#define all(x) x.begin(),x.end()
#define l_b lower_bound
#define u_b upper_bound
#define pb push_back
#define MOD 1000000007
void fastio(void);

int main(){
    fastio();
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll n,la,lb;
    cin>>n;
    string st;
    while(n!=0){
        ll rem=n%26;
        if(rem==0){
            rem=26;
            n--;
        }
        st.pb('a'+rem-1);
        n/=26;
        // cout<<rem<<' '<<n<<endl;
    }
    reverse(all(st));
    cout<<st<<endl;

    return 0;
}

void fastio(void){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
using namespace std;

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


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

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

  vector<int> attacks(n);
  rep(i, n) { 
      cin >> attacks.at(i);
  }
  rep (i, n) {
      /* code */
      h -= attacks.at(i);
      if (h <= 0)
      {
          /* code */
          cout << "Yes" << endl;
          return 0;
      }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 640
s = str(input())
if s[0] == s[1]:
    if s[2] == s[3] and s[0] != s[3]:
         print("Yes")
    else:
        print("No")

else:
    if s[0] == s[2] and s[1] == s[3]:
        print("Yes")
    elif s[0] == s[3] and s[1] == s[2]:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 3060
#include <stdio.h>

int main() {
	int i, j, k, n, v;
	int a[100];

	scanf("%d", &n);

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

	for (i = 0; i < n; i++) {
		v = a[i];
		j = i - 1;

		while (j >= 0 && a[j] > v) {
			a[j+1] = a[j];
			a[j] = v;
			j--;
		}
		a[j+1] = v;

		for (j = 0; j < n - 1; j++) {
			printf("%d ", a[j]);
		}

		printf("%d\n", a[n - 1]);
	}

	return 0;
}



Measured memory_bytes: 1848
import sys
for line in sys.stdin:
    cols = map(int, line.rstrip('\n').split(' '))
    a, b = cols[0], cols[1]
    if a < b:
        print 'a < b'
    elif a > b:
        print 'a > b'
    elif a == b:
        print 'a == b'

Measured memory_bytes: 4200
#include <iostream>
using namespace std;
int main(void){
    //1~n, 3つ選び、合計がX
    int n,x,i,k,j,cnt;
    
    
    while(scanf("%d %d", &n, &x)!=EOF && x+n){
        cnt = 0;
        
        for(i=1; i<=n; i++){
            for(k=i+1; k<=n; k++){
                for(j=k+1; j<=n;j++){
                    if(i+k+j==x){
                        cnt++;
                    }   
                }
            }
        }
        printf("%d\n", cnt);
    }
}



Measured memory_bytes: 3204
package main
import "fmt"
func main() {
  var n,x,y,lb,rw int
  var s string
  fmt.Scan(&n)
  fmt.Scan(&s)
  for i:=0;i<n;i++ {
    if s[i:i+1] == "." {
      rw++
    }
  }
  x = 2*n
  for i:=0;i<n+1;i++ {
    y = lb+rw
    if x > y { x = y }
    if i == n { break }
    if s[i:i+1] == "." {
      rw--
    } else {
      lb++
    }
  }
  fmt.Println(x)
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define ld long double
#define LL long long
#define Accel ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Re(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
#define REP(I, N) for (int I = 0; I < (N); I++)
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define SZ(a) ((int)a.size())
#define endl "\n" 
//#pragma GCC optimize(2)
using namespace std;
//typedef complex<double>C;
//const double PI(acos(-1.0));
//const double eps(1e-8);
//for(int mask=i;mask>0;mask=(mask-1)&i)
//int a[25]= { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };
//__gcd, atan2(y,x)=y/x , __int128
//c(n,k)=c(n-1,k-1)+c(n-1,k)
//c(i,r),i for r to n =c(n+1,r+1)
//void add(int x){while(x<N)BIT[x]++,x+=x&-x;}
//int sum(int x){int s=0;while(x){s+=BIT[x];x-=x&-x;}return s;}
//int find(int x){return x==p[x]?x:p[x]=find(p[x]);}
//LL pw(LL a,LL b){LL t=1;for(;b;b>>=1,a=a*a%M)b&1?t=t*a%M:0;return t;}
//log() = ln() , log(x)/log(y)=log(y)-base-x
//INT_MAX 127,INT_MIN 128
//int dw[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
//int dw[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
//cout<<fixed<<setprecision(12)<<ans<<endl;
//__builtin_popcount(mask)
const int N=2e5+10;
const int M=1e9+7;
int n;
int a[N];
int main(){Accel
	cin>>n;
	FOR(i,1,n){
		cin>>a[i];
		if(a[i]-a[i-1]>1){
			cout<<-1<<endl;return 0;
		}
	}
	if(a[1]){
		cout<<-1<<endl;return 0;
	}
	LL ans=0,i,tmp;
	for(i=n;i>=1;i--){
		if(a[i]==tmp){
			if(tmp>0)tmp--;
		}
		else{
			if(a[i]>i+1){
				cout<<-1<<endl;return 0;
			}
			ans+=a[i];
			tmp=a[i]-1;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <fstream>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = (1 << 30);
const ll inf = (1LL << 60LL);
const int maxn = 3e5 + 10;

int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    if(n == 1){
        return 0 * printf("Hello World");
    }
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int a1,a2,a3;
	scanf("%d %d %d",&a1,&a2,&a3);
	getchar();
	if (a1+a2+a3>=22)
	{
		printf("bust");
	}
	else
	{
		printf("win");
	}
	
	return 0;
}

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

typedef long long int ll;
ll h, w, k, row[7], col[7], ans, black;
char grid[7][7];

int main() {
    scanf("%lld %lld %lld", &h, &w, &k);
    for(ll i = 0; i < h; ++i) {
        for(ll j = 0; j < w; ++j) {
            cin >> grid[i][j];
            if(grid[i][j] == '#') {
                row[i]++;
                col[j]++;
                black++;
            }
        }
    }

    for(ll r = 0; r <= (1 << h) - 1; ++r) {
        ll sum = 0;
        for(ll i = 0; i < h; ++i) {
            if(r & (1 << i)) {
                sum += row[i];
                //cout << i << ' ';
            }
        }

        //cout << endl;

        for(ll c = 0; c <= (1 << w) - 1; ++c) {
            ll sum2 = 0;
            for(ll i = 0; i < w; ++i) {
                if(c & (1 << i)) {
                    //cout << i << ' ';
                    sum2 += col[i];
                }
            }

            //cout << endl;

           for(ll i = 0; i < w; ++i) {
                for(ll j = 0; j < h; ++j) {
                    if((r & (1 << j)) && (c & (1 << i)) && grid[j][i] == '#') sum2--;
                }
            }

            if(black - (sum + sum2) == k) ans++;
        }


    }

    printf("%lld\n", ans);
    return 0;
}

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

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

signed main()
{ 
  ios::sync_with_stdio(false); 
 cin.tie(0);
  int k; 
  cin>>k; 
  string s; 
  cin>>s; 
  if(s.size() <= k) 
    cout<<s<<'\n'; 
  else 
  cout<<s.substr(0,k)+"..."<<'\n';
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define ll long long int
#define Y printf("YES\n")
#define N printf("NO\n")
#define pb push_back
#define tp make_tuple
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define sc(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld%lld",&a,&b)
#define sc3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define pr(a) printf("%lld\n",a)
#define r0 return 0
#define pi acos(-1)
using namespace std;

int main()
{
    ll n,m,i,j,k,x,y,z,t;

     //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    cin>>n>>x>>t;

    k=(n+x-1)/x;

    cout<<k*t<<endl;


}


Measured memory_bytes: 3592
#include<stdio.h>
int main(void)
{
  int N;
  int x, y;
  int answer;
  scanf("%d", &N);
  if(0 <= N && N <= 14){
      x = 800 * N;
      y = 0;
  }
  if(15 <= N && N <= 29){
      x = 800 * N;
      y = 200;
  }
  if(30 <= N && N <= 44){
      x = 800 * N;
      y = 400;
  }
    if(45 <= N && N <= 59){
      x = 800 * N;
      y = 600;
  }
    if(60 <= N && N <= 74){
      x = 800 * N;
      y = 800;
  }
    if(75 <= N && N <= 89){
      x = 800 * N;
      y = 1000;
  }
    if(90 <= N && N <= 100){
      x = 800 * N;
      y = 1200;
  }
  answer = x - y;
  printf("%d\n", answer);
  return 0;
}


Measured memory_bytes: 128
h,w = map(int,input().split())
aij = [input() for i in range(h)]

def moji_num(s):
    return ord(s) - ord('a')

if h % 2 == 0:
    if w % 2 == 0:
        pat = 1
    else:
        pat = 2
else:
    if w % 2 == 0:
        pat = 3
    else:
        pat = 4

moji = [0]*(26)

for i in range(h):
    for j in range(w):
        moji[moji_num(aij[i][j])] += 1
        
#print(moji)

b1 = 0
b2 = 0

for i in range(26):
    if moji[i] % 2 == 1:
        tmp = moji[i]
        if tmp % 4 == 3:
            b2 += 1
        #b1_li.append(moji_num(moji[i]))
        b1 += 1
        #print(i)
    elif moji[i] % 2 == 0 and moji[i] % 4 != 0:
        b2 += 1


#print(pat,b1,b2)        
        
if b1 > 1:
    print('No')
    exit()
elif pat == 1:
    if b2 > 0:
        print('No')
        exit()
elif pat == 2:
    if b2 > h//2:
        print('No')
        exit()
elif pat == 3:
    if b2 > w//2:
        print('No')
        exit()
elif pat == 4:
    if b2 > (h+w-2)//2:
        print('No')
        exit()

print('Yes')

Measured memory_bytes: 3064
X,Y =[int(i) for i in input().split()]
mod = 10**9+7
if (X+Y)%3!=0:
    print("0")
    exit()
newX = X-(X+Y)//3
newY = Y-(X+Y)//3
X=newX
Y=newY
if X<0 or Y<0:
    print("0")
    exit()
#print("modefied X,Y  "+str(X)+" "+str(Y))
mod=10**9+7 
def nCr(n, r, mod):#mod=10**9+7 
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
print(nCr(X+Y,Y,mod))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define endl        "\n"
#define si(a)       scanf("%d",&a)
#define si2(a,b)    scanf("%d%d",&a,&b)
#define sl(a)       scanf("%lld",&a)
#define sl2(a,b)    scanf("%lld%lld",&a,&b)
#define pb          push_back
#define mk          make_pair
#define loop(n)     for(int i=0; i<n; i++)
#define FOR(a,b)    for(int i=a; i<=b; i++)
#define sz          size()
#define ff          first
#define ss          second
#define mem(a,val)  memset(a, val, sizeof(a))
#define md          1000000007
#define pi          acos(-1.0)

ll a[200010], b[200010];
map<ll,ll>ma, mb;
vector<ll>v;
string s,q;

int main()
{
   ll t,n,i,j,k,mn=0, mx=0;

       sl(n);
       for(int i=0; i<n; i++)
       {
           sl(a[i]);
           ma[a[i]]++;
       }
       for(int i=0; i<n; i++)
       {
           sl(b[i]);
           mb[b[i]]++;
       }
       for(int i=0; i<n; i++)
        {
            if(ma[a[i]]+mb[a[i]]>n)
            {
                cout<<"No"<<endl;
                return 0;
            }
        }

        //sort(b, b+n);
        reverse(b, b+n);

        int l=0, r=n-1;

        for(int i=0; i<n; i++)
        {
            if(a[i]==b[i])
            {
                if(b[l]!=b[i] && b[i]!=a[l])
                    swap(b[i], b[l]), l++;
                else if(b[r]!=b[i] && b[i]!=a[r])
                    swap(b[r], b[i]), r--;
            }
        }

        cout<<"Yes"<<endl;
        for(int i=0; i<n; i++)
            cout<<b[i]<<" ";

}




Measured memory_bytes: 31884
class ModCombination():
    def __init__(self, n, mod=998244353):
        self.mod = mod
        self.N = n
        fact = [1, 1] # 元テーブル
        ifact = [1, 1] #逆元テーブル
        inverse = [0, 1] #逆元テーブル計算用テーブル

        for i in range( 2, n + 1 ):
            fact.append( ( fact[-1] * i ) % mod )
            inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
            ifact.append( (ifact[-1] * inverse[-1]) % mod )
        
        self.fact = fact
        self.ifact = ifact
        self.inverse = inverse

    def nCr(self, n, r):
        if r < 0 or r > n:
            return 0
        return self.fact[n] * self.ifact[r] * self.ifact[n-r] % self.mod

    def nPr(self, n, r):
        if r < 0 or r > n:
            return 0
        return self.fact[n] * self.ifact[n-r] % self.mod

def main():
    N, M, K = map(int, input().split())
    MOD = 998244353
    mc = ModCombination(N, MOD)

    ans = 0
    for i in range(0, K + 1):
        # N-i個のボールを隣り合う色が必ず異なるようにする並べ方
        # 最初はM通り、それ以降は前の色とは違うM-1通り
        # = M * (M - 1) * (M - 1) * ... = M * (M - 1)^(N - i - 1)
        base = M * pow(M - 1, N - i - 1, MOD)
        # 同じ色のボールを追加する場所をi箇所選ぶ
        # = 最初以外の N - 1箇所から、「前の色と同じ」を設定する場所をi箇所選ぶ
        # = nCr(N - 1, i)
        patterns = base * mc.nCr(N - 1, i)
        # print(i, base, mc.nCr(N - 1, i, mod), patterns)
        
        ans = (ans + patterns) % MOD
    
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 32836
#![allow(unused)]

use std::{cell, cmp, collections, convert, fmt, io, iter, ops, str};

use cell::{Cell, RefCell};
use cmp::Ordering::{Equal, Greater, Less};
use collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use io::{Read, Write};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($($args: tt)*) => { eprint!($($args)*) };
}

#[cfg(feature = "debug")]
macro_rules! debugln {
    ($($args: tt)*) => { eprintln!($($args)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($($args:tt)*) => {};
}

#[cfg(not(feature = "debug"))]
macro_rules! debugln {
    ($($args:tt)*) => {};
}

macro_rules! vmax {
    ($x: expr, $y: expr) => { cmp::max($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::max($x, vmax!($($args),*)) };
}

macro_rules! vmin {
    ($x: expr, $y: expr) => { cmp::min($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::min($x, vmin!($($args),*)) };
}

fn main() {
    let n = parse_line::<usize>();
    let a = parse_vec::<u32>();

    let pow2_cnt_sum = a.iter().map(|&e| pow2_cnt(e)).sum::<u32>();
    println!("{}", pow2_cnt_sum);
}

fn pow2_cnt(mut x: u32) -> u32 {
    let mut cnt = 0;

    while x != 0 && x % 2 == 0 {
        cnt += 1;
        x /= 2;
    }

    cnt
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        assert_eq!(pow2_cnt(0), 0);
        assert_eq!(pow2_cnt(2), 1);
        assert_eq!(pow2_cnt(5), 0);
        assert_eq!(pow2_cnt(12), 2);
        assert_eq!(pow2_cnt(65535), 0);
        assert_eq!(pow2_cnt(65536), 16);
    }
}

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_owned()
}

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if !buf.is_empty() {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn next_prime(x: i32) -> i32 {
    for i in (x + 1).. {
        if is_prime(i) {
            return i;
        }
    }

    panic!("attempt to add with overflow");
}

fn is_prime(x: i32) -> bool {
    let ceil = f64::from(x).sqrt().ceil() as i32;
    x == 2 || (2..(ceil + 1)).all(|i| x % i != 0)
}


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

using namespace std;

#define ll long long

void solve() {
	int n;
	cin >> n;
	vector<int> v;
	bool t = true;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		v.push_back(a);
		if (a%2) {
			t = false;
		}
	}
	int cnt = 0;
	while(t) {
		for (int i = 0; i < n; i++) {
			v[i] /= 2;
		}
		cnt++;
		for (int i = 0; i < n; i++) {
			if (v[i]%2){
				t = false;
			}
		}
	}
	cout << cnt << "\n";
}

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

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}



Measured memory_bytes: 3584
#include <cstdio>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

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

	int out = 0;
	int s[N];
	REP(N){
		cin >> s[i];
		out += s[i];
	}

	sort(s,s+N);
	
	if(out %10 != 0){
		cout << out << endl;
		return 0;
	}
	else{
		REP(N){
			if(s[i]%10 != 0){
				out -= s[i];
				break;
			}
			if(i == N-1){
				out = 0;
			}
		}

		cout << out << endl;
		return 0;
	}


}

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

int main() {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    cout << (char)(s1[0] - 32) << (char)(s2[0] - 32) << (char)(s3[0] - 32) << endl;
}


Measured memory_bytes: 256
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    for i in range (H):
        for j in range (W):
            if (i+j)%2==0:
                print('#',end='')
            else:
                print('.',end='')
        print()
    print()


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

typedef long long int ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    //ll a, c, i, j, k;
    long double a;
    long double b;

    cin >> a >> b;
    cout << (ll)floor(a*b) << '\n';
    
    return 0;
}


Measured memory_bytes: 3748
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	
	int k = sc.nextInt();
    int n = sc.nextInt();
    int[] a = new int[n];
    int[] x = new int[n];
    for(int i = 0; i<n; i++){
      a[i] = sc.nextInt();
    }
    
    x[0] = a[0]+k-a[n-1];
    int max = 0;
    for(int i=1; i<n; i++){
      x[i] = a[i]-a[i-1];
      if(x[max] < x[i]){
        max = i;
      }
    }
    
    int ans = 0;
    for(int i=0; i<n; i++){
      if(max!=i){
        ans += x[i];
      }
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 86908
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int a, b;
  cin >> a >> b;
   cout << a*b << endl;

  return 0;
}

Measured memory_bytes: 3648
get_string(String) :-
  current_input(Input),
  read_string(Input, ' \n', '', _, String).
 
get_number(Number) :-
  get_string(String),
  number_string(Number, String).

fizbuz(N) :- 0 is N mod 3,!,fail.
fizbuz(N) :- 0 is N mod 5,!,fail.
fizbuz(_).

solve(N,N,N) :- fizbuz(N),!.
solve(N,N,0) :- !.
solve(I,N,Sum) :- fizbuz(I),!,Next is I + 1,solve(Next,N,M),Sum is M + I.
solve(I,N,Sum) :- Next is I + 1,solve(Next,N,Sum).

main :-
  get_number(N),
  solve(1,N,Ans),
  writeln(Ans).

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

const int maxN = 1e5+5;
long long n, t[maxN], s[maxN];

main(){
			//freopen("input.inp", "r", stdin);
			cin>>n;
			for(int i=1; i<=n; i++) cin>>t[i]>>s[i];
			sort(t+1, t+n+1);
			sort(s+1, s+n+1);
			long long res = t[1]-1;
			for(int i=1; i<=n-1; i++)
				res += t[i+1]-t[i]-1;
			res += n+s[1];
			cout<<res;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <stack>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>

#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, nuint_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define int long long
#define MOD 1000000007
#define what_is(x) cerr << #x << " is " << x << endl;
#define loop(i,a,n) for(int i=a;i<n;i++)

#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, szof(x))
#define sortall(x) sort(aint(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int, int> pt;

signed main() {
	
	//fastio();
	//#define LOCAL_DEFINE
	#ifdef LOCAL_DEFINE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	//https://codeforces.com/contest/1084/problem/D
	// https://codeforces.com/contest/1155/problem/E
	//https://www.spoj.com/problems/MON2012/
	//https://codeforces.com/blog/entry/52726	
	
	int n;
	cin>>n;
	int res=0,res1=0,res2=0,ans=0;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		if(s[0]=='B' && s[s.length()-1]=='A')
		{
			res++;
		}else if(s[0]=='B')
		{
			res1++;
		}else if(s[s.length()-1]=='A')
		{
			res2++;
		}
		for(int i=1;i<s.length();i++)
		{
			if(s[i]=='B' && s[i-1]=='A')
				ans++;
		}
	}

	if(res>0)
	{
		ans+=(res-1);
		if(res1>0)
			res1--,ans++;
		if(res2>0)
			res2--,ans++;
	}
	ans+=min(res1,res2);
	cout<<ans;
	return 0;



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;



int main() {
    int n,m,a; cin >> n >> m;
    int total = 0;
    for(int i = 0;i < m;i++){
        cin >> a; total+=a;
    }
    if(n - total >= 0){
        cout << n-total;
    }else{
        cout << -1;
    }
}


Measured memory_bytes: 3536
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;

int main(){
  int c[3][3];
  rep(i,3) rep(j,3) cin >> c[i][j];
  int x[3],y[3];
  x[0]=0;
  rep(i,3) y[i]=c[0][i];
  rep(i,3) x[i]=c[i][0]-y[0];
  rep(i,3){
    rep(j,3){
      if(x[i]+y[j]!=c[i][j]){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 384
import java.util.*;
import java.io.*;

class Main {

	void solve () {

		int r = in.nextInt();
		out.println(3*r*r);
		
	}

	public static PrintWriter out = new PrintWriter(System.out);
	public static Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

}

Measured memory_bytes: 23252
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		int max = 0, maxPoint = 0;
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt(), b = sc.nextInt();
			if (a > max) {
				max = a;
				maxPoint = b;
			}
		}
		System.out.println(max + maxPoint);
	}
}

Measured memory_bytes: 63480
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
using ll = long long;

ll n,m,k;
string s,t;

int main() {
  cin >> n >> m;
  cout << (m>=n ? "unsafe" : "safe") << endl;
}

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

int n;
const int MAXN = 2e5+10;
vector<int> adj[MAXN];

pair<int,int> dfs(int u, int p=-1) {
  //cerr << u << " " << p <<endl;
  pair<int, int> ans = {0,u};
  for(int v:adj[u]) {
    if (v==p) continue;
    ans = max(dfs(v, u), ans);
  }
  ans.first++;
  return ans;
}

int main(){
  cin.tie(0); ios_base::sync_with_stdio(0);
  cin >> n;
  for(int i=0;i<n-1;i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  auto v = dfs(1);
  auto rv = dfs(v.second);
  int dia = rv.first;
  //cerr << dia <<endl;
  if (dia>1 && dia%3==2) cout << "Second" <<endl;
  else cout << "First" <<endl;
}


Measured memory_bytes: 26880
open System

[<EntryPoint>]
let main argv =
    let N = stdin.ReadLine() |> int
    let S = stdin.ReadLine().ToCharArray()

    let mutable count = 0

    let rec found (start : int, stop: int, index: char) =
        if (start >= stop) then
            -1
         else if S.[start] = index then
            start
         else
            found(start + 1, stop, index)

    let found2 (i : int, j : int, k : int) =
        let f1 = found(0, N, '0' + char i)
        if (f1 >= 0) then
            let f2 = found(f1 + 1, N, '0' + char j)
            if (f2 >= 0) then
                let f3 = found(f2 + 1, N, '0' + char k)
                if (f3 >= 0) then
                    1
                else
                    0
            else
                0
        else
            0

    for i = 0 to 9 do
        for j = 0 to 9 do
            for k = 0 to 9 do
                count <- count + found2(i, j, k)

    printfn "%d" count

    0

Measured memory_bytes: 14172