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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    string s;
    cin >> n >> s;

    vector<set<int>> st(26);
    REP(i, n){
        int c = s[i] - 'a';
        st[c].insert(i+1);
    }

    int q;
    cin >> q;
    REP(i, q){
        int t;
        cin >> t;
        if(t == 2){
            int l, r;
            cin >> l >> r;
            int ans = 0;
            REP(j, 26){
                if(st[j].lower_bound(l) != st[j].lower_bound(r+1)){
                    ans++;
                }
            }
            cout << ans << endl;
        }else{
            int d;
            char c;
            cin >> d >> c;

            int old = s[d-1] - 'a';
            st[old].erase(d);
            st[c - 'a'].insert(d);
            s[d-1] = c;
        }
    }

    return 0;
}


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

#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define MOD2 998244353

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

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

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

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

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

typedef long long ll;

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

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

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

int main(){

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

    int n,m;
    cin>>n;
    map<int,int>dif;
    rep(i,n){
        int di;cin>>di;
        dif[di]++;
    }

    cin>>m;
    rep(i,m){
        int ti;cin>>ti;
        if(dif[ti] == 0){flag=false;break;}
        else{--dif[ti];}
    }

    //cout <<fixed<<setprecision(16)<< << endl;

    if(flag)cout << "YES" <<endl;
    else cout << "NO" <<endl;

    return 0;
}


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

int main(){
  int N;
  cin >> N;
  int min=40;
  int A,count;
  for(int i=0;i<N;i++){
    cin >> A;
    count = 0;
    while(A != 0){
      if(A%2 == 0){
        count++;
        A /= 2;
      }else{
        break;
      }
      
    }
    if(count < min){
      min = count;
    }
  }
  cout << min << endl;
}
      

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll n,k,s,t;
 cin>>n>>k>>s>>t;
 vector<ll> a(n);
 for(ll i=0;i<n;i++)cin>>a[i];
 //map<mp,ll> cnt;//積，和
 vector< map<mp,ll> > cnt(k+1);
 //cnt[0][ mp((1ll<<19)-1, 0 ) ] = 1;
 for(ll i=0;i<n;i++){
  //map<mp,ll> tmp = cnt;
  for(ll j=k;j>=2;j--){
   for(auto it:cnt[j-1]){
    cnt[j][ mp( it.first.first & a[i] , it.first.second | a[i] ) ] += it.second;
   }
  }
  //cnt = tmp;
  cnt[1][ mp( a[i] , a[i] ) ]++;
  //cout<<"i: "<<i<<endl;
  //for(auto it:cnt) cout<<it.first.first<<' '<<it.first.second<<' '<<it.second<<endl;
 }
 //for(auto i:cnt)cout<<i.first.first<<' '<<i.first.second<<' '<<i.second<<endl;
 //cout<<cnt[mp(s,t)]<<endl;
 ll sum = 0;
 for(ll i=0;i<=k;i++)sum+=cnt[i][mp(s,t)];
 cout<<sum<<endl;
 return 0;
}


Measured memory_bytes: 153932
#include<iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	int c[n];
	int v[n];
	
	int i;
	for(i=0;i<n;i++){
		cin >> c[i];
	}
	for(i=0;i<n;i++){
		cin >> v[i];
	}
	int sum = 0;
	for(i=0;i<n;i++){
		if(c[i] - v[i] >0) sum += (c[i] - v[i]);
	}
	cout << sum << endl; 
	return 0;
	
	
} 

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static Scanner;

class Program
{
    static void Main() => new Program().Solve();

    public void Solve()
    {
        long n = ReadLong() - 1;
        var s = new StringBuilder();
        while (true)
        {
            s.Insert(0, (char)('a' + n % 26));
            if (n < 26) break;
            n /= 26;
            n--;
        }
        Console.WriteLine(s);
    }
}


static class Scanner
{
    static Queue<string> que = new Queue<string>();

    public static string Read()
    {
        if (!que.Any()) foreach (var s in Console.ReadLine().Split()) que.Enqueue(s);
        return que.Dequeue();
    }
    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());
    public static decimal ReadDecimal() => decimal.Parse(Read());

    public static IEnumerable<string> Read(long n)
    {
        for (long i = 0; i < n; i++) yield return Read();
    }
    public static IEnumerable<int> ReadInt(long n) => Read(n).Select(int.Parse);
    public static IEnumerable<long> ReadLong(long n) => Read(n).Select(long.Parse);
    public static IEnumerable<double> ReadDouble(long n) => Read(n).Select(double.Parse);
    public static IEnumerable<decimal> ReadDecimal(long n) => Read(n).Select(decimal.Parse);
}

Measured memory_bytes: 28264
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS=1e-10;
const ll INF=1000000000;
int main(){
    int a,d,n;
    int prime[1000010];
    for(int i=0;i<1000001;i++){
        prime[i]=1;
    }
    prime[0]=0;prime[1]=0;
    for(int i=2;i<=500000;i++){
        if(prime[i]==1){
            for(int j=i+i;j<=1000000;j+=i){
                prime[j]=0;
            }
        }
    }
    while(cin>>a>>d>>n,a+d+n){
        int c=0;
        for(int i=a;i<=1000000;i+=d){
            if(prime[i]){
                c++;
                if(c==n){
                    cout<<i<<endl;
                    break;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 7000
#include<bits/stdc++.h>
using namespace std;
long long ans=0;
int main(){
	int n,k;
	cin >> n >> k;
	ans += pow(n/k,3);
	if(k%2==0) ans+=pow((n+(k/2))/k,3);
	cout << ans << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# ここから書き始める
x1, y1, x2, y2 = map(int, input().split())
x3 = x2 + y1 - y2
y3 = y2 + x2 - x1
x4 = x3 - x2 + x1
y4 = y3 + y1 - y2
print(x3, y3, x4, y4)

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

template<typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto &x : v) is >> x;
  return is;
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	long long n, a, b; cin >> n >> a >> b;
	if (a > b) swap(a, b);
	if (a % 2 == b % 2) {
		cout << (b - a) / 2 << '\n';
		return 0;
	}
	cout << min((n - b) + 1 + (n - a), (a - 1) + 1 + (b - 1)) / 2 << '\n';
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <string.h>
 
int main(void)
{
  int N,i,j;
  char temp[11];
 
  scanf("%d", &N);
 
  struct data{
    int n;
    char city[11];
    int p;
  } store[N + 1];
 
 
 
for(i= 0; i < N; i++)
{
  store[i].n = 0;
}
 
  for(i = 0; i < N; i++)
  {
    store[i].n = i + 1;
    scanf("%s", store[i].city);
    scanf("%d", &store[i].p);
  }
 
  for (i = 0; i < N; i++)
  {
    for (j = i + 1; j < N; j++)
    {
      if (strcmp(store[i].city, store[j].city) > 0)
      {
        store[N] = store[i];
        store[i] = store[j];
        store[j] = store[N];
      }
      else if(strcmp(store[i].city, store[j].city) == 0)
      {
        if (store[i].p < store[j].p)
        {
          store[N] = store[i];
          store[i] = store[j];
          store[j] = store[N];
        }
      }
    }
  }
  for (i = 0; i < N; i++)
  {
    printf("%d\n", store[i].n);
  }
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int l,r,mini = 2019;
      cin>>l>>r;
      if(r-l+1 >= 2019)cout<<0<<endl;
      else{
      	for(int i=l;i<r;i++)
          for(int j=i+1;j<=r;j++)
            mini=min(mini,((i%2019)*(j%2019))%2019);

        cout<<mini<<endl;
      }
    }

Measured memory_bytes: 256
#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>;

ll an = 1;
ll pn = 1;
ll bn = 0;
vector<ll> a(51);
vector<ll> p(51);
vector<ll> b(51);
int f(){
    rep(j, 51){
//        cout << j << " k" << an << " p" << pn << " b" << bn << endl;
        a.at(j) = an;
        p.at(j) = pn;
        b.at(j) = bn;
        an = an*2 + 3;
        pn = pn*2 + 1;
        bn = bn*2 + 2;
    }
}
ll ans = 0;

ll sai(ll n, ll x){
//    cout << " ans:" << ans << " n:" << n << " x:" << x << endl;
    if(n == 1){
        if(x >= 2 && x <= 4){
            ans += x - 1;
        }else if(x == 5){
            ans += 3;
        }
        return 0;
    }
    if(x == 1){
        return 0;
    }else if(x == a.at(n)){
        ans += p.at(n);
        return 0;
    }else if(x == (a.at(n)+1)/2){
        ans += p.at(n-1) + 1;
        return 0;
    }else if(x < (a.at(n)+1)/2){
        sai(n-1, x-1);
        return 0;
    }else{
        ans += p.at(n-1) + 1;
        sai(n-1, x - (a.at(n)+1)/2);
        return 0;
    }
}

int main(){
    ll n, x;
    cin >> n >> x;
    f();
    sai(n, x);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(void) {
  string s;
  cin >> s;

  set<char> st;
  for (int i = 0; i < s.size(); i++) {
    st.insert(s[i]);
  }

  char ans = '?';
  for (char i = 'a'; i <= 'z'; i++) {
    if (st.find(i) == st.end()) {
      ans = i;
      break;
    }
  }

  if (ans == '?') {
    cout << "None\n";
  } else {
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std ;
 
// #define int long long
#define endl '\n'

#define IOS ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ;
 
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vp vector<pii>
#define vs vector<string>
#define all(v) v.begin(),v.end()

#define lb  lower_bound
#define ub  upper_bound
#define bs  binary_search
#define ff  first
#define ss  second
#define sz(x) ((int)(x).size())
#define rep(i,l,r) for(int i=(l);i<(r);++i)
 
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
     
#define pi 3.14159265358979323846264338327950L
#define MOD 1000000007

int32_t main(){

    
     IOS
     int x1,x2,x3,x4,x5,ans=0;
     cin>>x1>>x2>>x3>>x4>>x5;
     if(x1+1!=x2&&x2+1==x3)
     	ans=x2-1;
     else if(x2+1!=x3&&x3+1==x4)
     	ans=x3-1;

     else if(x3+1!=x4&&x4+1==x5)
     	ans=x4-1;
     else if(x4+1!=x5&&x4-1!=x3)
     	ans=x5-1;
     else
     	ans=x4+1;
     cout<<ans<<endl;
     

  return 0;
}


Measured memory_bytes: 3644
import math
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
    
  
n = int(input())

t = num_divisors_table(n)

ans = 0
for i, j in enumerate(t):
  ans += i * j
  
print(ans)

Measured memory_bytes: 151492
N=int(raw_input())
T=map(int, raw_input().split())
M=int(raw_input())
for i in xrange(M):
    p, x = map(int, raw_input().split())
    ans = 0
    for j in xrange(N):
        if j+1 == p:
            ans += x
        else:
            ans += T[j]
    print ans


Measured memory_bytes: 2568
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

ans=0

for i in range(N):
  ans+=min(A[i]+A[i+1],B[i])
  A[i+1]=max(0,min(A[i]+A[i+1]-B[i],A[i+1]))

print(ans)

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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			B();
		}

		public static void B()
		{
			Scanner cin = new Scanner();
			int n = cin.NextInt();
			string s = cin.Next();

			int b = 0;
			int r = 0;
			for (int i = 0; i < n; ++i) {
				if (s[i] == 'B') {
					++b;
				} else {
					++r;
				}
			}

			if (r > b) {
				Console.WriteLine("Yes");
			} else {
				Console.WriteLine("No");
			}
		}

		public static void C()
		{
			Scanner cin = new Scanner();
		}
		
		
	}

	public class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int NextInt()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = NextInt() + add;
			}
			return Array;
		}

		public long NextLong()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = NextLong() + add;
			}
			return Array;
		}

		public double NextDouble()
		{
			return double.Parse(Next());
		}


		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = NextDouble() + add;
			}
			return Array;
		}
	}
}


Measured memory_bytes: 13140
#include<stdio.h>

int main()
{
    int N,K,h,r,i;
    r=0;

    scanf("%d %d",&N,&K);
    for ( i = 0; i < N; i++)
    {
        scanf("%d",&h);
        if (h>=K)
        {
            r+=1;
        }
        
    }
    printf("%d",r);

    return 0;
    
}

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

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;
#define fastio ios_base::sync_with_stdio(false); \
			cin.tie(0);							     \
			cout.tie(0);
#define sz(arr) ll(arr.size())

using namespace std;

using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 9;
const double PI = 4.0 * atan(1.0);

ll powmod(ll a, ll b, const ll MOD) { ll res = 1; a %= MOD; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % MOD; a = a * a % MOD; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p); }
ll div_floor(ll a, ll b) { return a / b - (((a ^ b) < 0) and a % b); }
ll div_ceil(ll a, ll b) { return a / b + (((a ^ b) >= 0) and a % b); }
ll kCn(ll k, ll n, ll f[]) { return (f[n] * modInverse((f[n - k] * f[k]) % MOD, MOD)) % MOD; }



int main() {
	//#ifndef ONLINE_JUDGE
	//	(void)freopen("input.txt", "r", stdin);
	//	(void)freopen("output.txt", "w", stdout);
	//#endif // !ONLINE_JUDGE
	fastio;
	ll x;
	cin >> x;
	for (ll A = -4000; A <= 4000; ++A) {
		for (ll B = -4000; B <= 4000; ++B) {
			if (A * A * A * A * A - B * B * B * B * B == x) {
				cout << A << " " << B;
				return 0;
			}
		}
	}

	return 0;
}


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

int main() {
	int a,b,c,d;
  cin>>a>>b>>c>>d;
  bool m = true;
  while (a>0 && c>0) {
  	if (m) {
    	c -=b;
    } else {
    	a -=d;
    }
    m = !m;
  }
  if (a<=0) {
  	cout << "No\n";
  } else {
  	cout <<"Yes\n";
  }
}

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

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

#define REPR(i,n) for(int i =n; i >=0; --i)

#define REP_(i,m,n) for(int i =m; i <n; ++i)

#define INF 2e9

#define ll long long

//const ll MOD = 1000000007;

//const  long double PI=(acos(-1));

//const  long double EPS=0.0000000001;

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

    int  x = n/1.08;

    if(int(x*1.08) == n  )cout << x << endl;
    else{
        if(int((x+1)*1.08) == n)cout << x+1 << endl;
        else cout <<":(" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	string s;
	cin>>n;
	cin>>s;
	int cnt=0;
	for(int i=0;i<n;i++){
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var c = int.Parse(line[2]);
        line = Console.ReadLine().Trim().Split(' ');
        var b = Array.ConvertAll(line, int.Parse);
        getAns(n, m, c, b);
    }
    static void getAns (int n, int m, int c, int[] b)
    {
        var ans = 0;
        for (int i = 0; i < n; i++)
        {
            var w = c;
            string[] line = Console.ReadLine().Trim().Split(' ');
            for (int j = 0; j < m; j++)
                w += int.Parse(line[j]) * b[j];
            if (w > 0) ans++;
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
#include <stdio.h>
int main() {
    int n, x, t,ans;
    scanf("%d", &n);
    scanf("%d", &x);
    scanf("%d", &t);
    if (n % x == 0) {
        ans = n / x * t;
        printf("%d",ans);
    }
    else {
        ans = n / x * t + t;
        printf("%d", ans);
    }
    return 0;
}

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

int main(){
  string s,t;
  cin>>s>>t;
  int count=0;
  
  for(int i=0;i<3;i++){
   if(s.at(i)==t.at(i)){
    count++;
   }
  }
  cout<<count<<endl;
}

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






int main(){
  


  long long n;
  cin>>n;
  

  vector<long long> data(5);
  
  for (long long i=0;i<n;i++){
    string tmp;
    cin>>tmp;
    
    if (tmp.at(0)=='M'){
      data.at(0)++;
    }
    if (tmp.at(0)=='A'){
      data.at(1)++;
    }
    if (tmp.at(0)=='R'){
      data.at(2)++;
    }
    if (tmp.at(0)=='C'){
      data.at(3)++;
    }
    if (tmp.at(0)=='H'){
      data.at(4)++;
    }
    
  }
  
  
  long long answer=0;
  

  vector<long long> v={0,0,1,1,1};
  do{  
    long long tmp=1;
    for (long long i=0;i<5;i++){
      if (v.at(i)){
        tmp*=data.at(i);
      }
    }
  answer+=tmp;

  }while(next_permutation(v.begin(),v.end()));
  

  cout<<answer<<endl;

  


    
  
  
  
}

Measured memory_bytes: 256
#!/usr/bin/env ruby

X, K, D = gets.chomp.split.map(&:to_i)

x = X.abs

d, m = x.divmod(D)

r = K - d

case
when r >= 0 && r.even?
  puts m
when r >= 0 && r.odd?
  puts [m - D, m + D].map(&:abs).min
when r < 0
  puts x - (D * K)
end


Measured memory_bytes: 14352
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

bool dpl[5100][5100];
bool dpr[5100][5100];
int dpsum[5100][5100];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,k;
    cin >> n >> k;
    vi a(n);
    cin >> a;
    rep(i,5100) rep(j,5100) dpl[i][j] = dpr[i][j] = false;
    dpl[0][0] = true;
    rep(i,n) rep(j,k+1) {
        if(!dpl[i][j]) continue;
        dpl[i+1][j] = true;
        if(j+a[i] <= k) dpl[i+1][j+a[i]] = true;
    }
    reverse(all(a));
    dpr[0][0] = true;
    rep(i,n) rep(j,k+1) {
        if(!dpr[i][j]) continue;
        dpr[i+1][j] = true;
        if(j+a[i] <= k) dpr[i+1][j+a[i]] = true;
    }
    reverse(all(a));
    rep(i,n+1) rep(j,k+1) dpsum[i][j+1] = dpsum[i][j]+dpr[i][j];
    int ans = 0;
    rep(i,n) {
        bool ok = true;
        rep(j,k+1) {
            if(!dpl[i][j]) continue;
            // [l,r)
            int l = k-a[i]-j,r = k-j;
            if(r <= 0 or l > k) continue;
            chmax(l,0);
            chmin(r,k+1);
            if(dpsum[n-1-i][r] > dpsum[n-1-i][l]) ok = false;
        }
        if(ok) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 152704
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
using namespace std;

int r, g, b;

int main(){
    cin >> r >> g >> b;
    int val = r*100 + g*10 + b;

    if(val % 4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}   


Measured memory_bytes: 256
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()
d = [1]
for i in range(n-1):
    if a[i] != a[i+1]:
        d.append(1)
    else:
        d[-1] += 1
ans = 0
for i in d:
    ans += i%2
print(ans)

Measured memory_bytes: 8012
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
ll x[200005],y[200005];
ll p[200005];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lld%lld",&x[i],&y[i]);
	}
	ll ans=0;
	for(int i=0;i<n;i++){
		p[i]=x[i]+y[i];
	}
	sort(p,p+n);
	ans=max(ans,p[n-1]-p[0]);

	for(int i=0;i<n;i++){
		p[i]=x[i]-y[i];
	}
	sort(p,p+n);
	ans=max(ans,p[n-1]-p[0]);

	for(int i=0;i<n;i++){
		p[i]=-x[i]+y[i];
	}
	sort(p,p+n);
	ans=max(ans,p[n-1]-p[0]);

	for(int i=0;i<n;i++){
		p[i]=-x[i]-y[i];
	}
	sort(p,p+n);
	ans=max(ans,p[n-1]-p[0]);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 8444
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int C = Integer.parseInt(sc.next());
		sc.close();
		if(A + B >= C) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> d(k);
  vector<int> ans(n);
  for(int i=0;i<k;i++){
    cin>>d.at(i);
    vector<int> a(d.at(i));
    for(int j=0;j<d.at(i);j++){
      cin>>a.at(j);
      a.at(j)--;
      ans.at(a.at(j))++;
    }
  }
  int cnt=0;
  for(auto x:ans){
    if(x==0){
      cnt++;
    }
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3604
import sys, math
from collections import defaultdict
from itertools import product
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def f(K, A, B, C):
    if K == 0:
        return False
    return (2*A < B < C) or f(K-1, 2*A, B, C) \
        or (A < 2*B < C) or f(K-1, A, 2*B, C) \
        or (A < B < 2*C) or f(K-1, A, B, 2*C)

def main():
    A, B, C = list(mi())
    K = ii()

    print('Yes' if f(K, A, B, C) else 'No')



if __name__ == '__main__':
    main()

Measured memory_bytes: 65368
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
s=int(input())
ans=0
if s<=2:
  pass

else:
  mass=s//3
  for i in range(mass):
    k=i+1
    ans+=cmb(s-2*k-1,k-1)%(10**9+7)

ans%=(10**9+7)    
print(int(ans))
    
    

Measured memory_bytes: 9608
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll r,d,x;cin>>r>>d>>x;
  rep(i,10){
    x=r*x-d;
    cout<<x<<endl;
  }

  return 0;

}


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

vector<vector<int> > rot = {
	{0,1,2,3,4,5}, {0,2,4,1,3,5}, {0,4,3,2,1,5}, {0,3,1,4,2,5},
	{1,5,2,3,0,4}, {1,2,0,5,3,4}, {1,0,3,2,5,4}, {1,3,5,0,2,4},
	{2,5,4,1,0,3}, {2,4,0,5,1,3}, {2,0,1,4,5,3}, {2,1,5,0,4,3},
	{3,4,5,0,1,2}, {3,5,1,4,0,2}, {3,1,0,5,4,2}, {3,0,4,1,5,2},
	{4,0,2,3,5,1}, {4,2,5,0,3,1}, {4,5,3,2,0,1}, {4,3,0,5,2,1},
	{5,4,2,3,1,0}, {5,2,1,4,3,0}, {5,1,3,2,4,0}, {5,3,4,1,2,0}
};

vector<vector<vector<int> > > cond = {
	{},
	{{3,0,2}},
	{{1,1,4}},
	{{1,0,4},{2,2,3}},
	{{0,3,5}},
	{{0,2,5},{3,4,2}},
	{{0,1,5},{4,5,1}},
	{{0,0,5},{2,6,3},{4,4,1}}
};

struct State { int id, r; };
State pz[8];

string dice[8];
bool used[8];

inline char toggleCase(char c) {
	if (islower(c)) return toupper(c);
	return tolower(c);
}

string solve(int x) {
	if (x == 8) return "YES";
	for (int i=1; i<8; ++i) {
		if (used[i]) continue;
		for (int j=0; j<24; ++j) {
			pz[x].id = i;
			pz[x].r = j;
			bool ok = true;
			for (int k=0; k<(int)cond[x].size(); ++k) {
				int bloc1 = x;
				int face1 = rot[pz[bloc1].r][cond[x][k][0]];
				int bloc2 = cond[x][k][1];
				int face2 = rot[pz[bloc2].r][cond[x][k][2]];
				if (toggleCase(dice[pz[bloc1].id][face1]) != dice[pz[bloc2].id][face2]) {
					ok = false; break;
				}
			}
			if (ok) {
				used[i] = true;
				if (solve(x+1) == "YES") return "YES";
				used[i] = false;
			}
		}
	}
	return "NO";
}

int main() {
	while (cin >> dice[0], dice[0] != "0") {
		for (int i=1; i<8; ++i) cin >> dice[i];
		sort(dice, dice+8);
		memset(used, false, sizeof used);
		used[0] = true;
		pz[0].id = 0;
		string res = "NO";
		for (int i=0; i<24; ++i) {
			pz[0].r = i;
			if (solve(1) == "YES") {
				res = "YES"; break;
			}
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll h, w;
  cin >> h >> w;
  vector<vl> g(h, vl(w));
  rep(i, h) rep(j, w) cin >> g[i][j];
  vl y, x, yd, xd;
  rep(i, h) rep(j, w) {
    if(g[i][j] % 2 == 0) continue;
    if(i == h - 1 && j == w - 1) continue;
    ll c = i, d = j;
    if(j == w - 1)
      c++;
    else
      d++;
    g[c][d]++;
    y.push_back(i + 1);
    x.push_back(j + 1);
    yd.push_back(c + 1);
    xd.push_back(d + 1);
  }
  cout << y.size() << '\n';
  rep(i, y.size()) cout << y[i] << ' ' << x[i] << ' ' << yd[i] << ' ' << xd[i]
                        << '\n';
}

Measured memory_bytes: 9344
A, B, N = map(int, input().split())
La =list(map(int, input().split())) 
Lb =list(map(int, input().split()))
ans = min(La)+min(Lb)
for i in range (N):
  W = list(map(int, input().split())) 
  x = W[0]-1
  y = W[1]-1
  c = W[2]
  price = La[x] + Lb[y] -c
  if price < ans:
    ans = price
print(ans)


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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

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

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n;
	string s;
	cin>>n>>s;
	int ans=0;
	rep(i,n-2){
		if(s.substr(i,3)=="ABC")ans++;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

int main(void){
    int n;
    cin >> n;
    int A[n];
    bool frag = true;
    for(int i = 0; i < n; i++){
        cin >> A[i];
        if(A[i] % 2 == 0){
            if(A[i] % 3 == 0 || A[i] % 5 == 0){
            }else{
                frag = false;
            }
        }
    }
    if(frag){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }
    return 0;
}

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

using namespace std;

#define ll long long
#define ii pair<int ,int>
#define iii tuple<int ,int, int>
#define vi vector<int>
#define vii vector<int, int>
#define fo(i,a,n) for(int i = (a); i < (n); i++)
#define pb push_back
#define newl cout<<"\n"
#define mp make_pair
#define mt make_tuple
#define f first
#define s second
#define N1 100000

//int visited[N1]={};
//int st[4*N1 + 10]={};
const ll MAXN=1e+3+7;
ll n;
long double a[MAXN];

int main(){
	cin>>n;
	//long double res=0;
	fo(i,0,n){cin>>a[i];}
	sort(a,a+n);
	fo(i,0,n-1){
		a[i+1]=((long double)(a[i+1]+a[i]))/2.0;
	}

	cout<<a[n-1];




}

Measured memory_bytes: 256
a, b, k = list(map(int, input().split()))
i = 0
while(True):
    if i == k:
        break
    i += 1
    if a % 2 != 0:
        a -= 1
    b +=  a / 2
    a //= 2

    if i == k:
        break
    i += 1
    if b % 2 != 0:
        b -= 1
    a += b / 2
    b //= 2
print(int(a), int(b))

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

int main()
{
    int N;

    cin >> N;
    int count = 100;
    rep(i,N)
    {
        int tmp = 0;
        int x;
        cin >> x;
        for(int i = 1; i<=count; i++)
        {
            if (x % 2 != 0)break;
            x /= 2;
            tmp++;
        }
        count = tmp; 
    }
    cout << count << endl;
}



/*
キャスト
int => string
    to_string(num)
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int s;
  	cin >> s;
  	int a, b, c;
  	a = s /100;
    b = (s-a*100)/10;
    c = s-a*100-b*10;
  	cout << a+b+c << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
  
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
        
const int  N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
int n, a[N];
int cnt[N]; 
void solve(){
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i]; 
    }
    int cnt = 0;
    for(int i = 1; i <= n; ++i) {
        if(a[i] == i){
            swap(a[i], a[i + 1]);
            cnt ++;
        }
    }
    cout << cnt;
}
 
int main(){
    speed();
    int t = 1;
    // cin >> t;
    while(t--)solve();
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std ;
 
int main(){
    int N;
    cin >> N;

    // Make number cards
    vector<int> vec(N);
    for(int i=0; i<N; i++){
        cin >> vec.at(i);
    }

    // Pick up cards
    int alice = 0;
    int bob = 0 ;
    int math = 0;


    for(int i=0; i<N; i++){
        math = vec.at(i);

        for(int j=0; j<N; j++){
            if(math < vec.at(j)){
                math = vec.at(j);
            }
        }

        for(int j=0; j<N; j++){
            if(math == vec.at(j)){
                vec.at(j) = 0;
                break;
            }
        }
        if(0 == i % 2){
            alice += math;
        }
        if(1 == i% 2){
            bob += math;
        }
    }
    cout << alice - bob << endl;
} 

Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {h: usize, n: usize, a: [usize; n]};

    let r = a.iter().sum::<usize>();
    if r >= h {
        println!("Yes")
    } else {
        println!("No")
    }
}


Measured memory_bytes: 3256
#include<bits/stdc++.h>
#define rep(i,k,n) for(ll i= (ll) k;i< (ll) n;i++)
#define all(v) (v).begin(), (v).end()
#define SZ(v) (int)((v).size())
#define pb push_back
#define ft first
#define sd second
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const long long INF = 4e18L + 1;
const int IINF = 2e9 + 1;

using namespace std;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define DBG(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define DBG(...) ;
#define cerr if(0)cout
#endif

int main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    ll n, p; cin >> n >> p;
    vector<ll>nums(n);
    for(auto& a : nums){
        cin >> a;
    }
    if(any_of(all(nums), [](ll a){return (a & 1);})){
        cout << (1ll << (n - 1)) << "\n";
    } else {
        if(p & 1){
            cout << "0\n";
        } else {
            cout << (1ll << n) << "\n";
        }
    }
    return 0;
}

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  int n; cin>>n;
  if (n==1) {
    cout << "Hello World" << endl;
  } else {
    int a,b; cin>>a>>b;
    cout << a+b << endl;
  }
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a, b = [int(_) for _ in input().split(' ')]
p = [int(_) for _ in input().split(' ')]
c1 = len([i for i in p if i <= a])
c2 = len([i for i in p if a + 1 <= i and i <= b])
c3 = len([i for i in p if b + 1 <= i])
print(min(c1, c2, c3))


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

int main() {
    long long A;
    long long B;
    long long C;
    cin >> A >> B >> C;
    long long sum = (A + B + C);
    if (sum < 22) {
        cout << "win" << endl;
    }
    else {
        cout << "bust" << endl;
    }
    return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long ll;

int main(){
  int n,k; cin >> n >> k;
  vector<int> h(n); rep(i,n) cin >> h[i];

  int ans = 0;
  rep(i,n){
    if(h[i] >= k) ans++;
  }

  cout << ans << endl;
}


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

int main(){
  vector<vector<int>> C(3, vector<int>(3));
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> C.at(i).at(j);
    }
  }
  for(int i=0; i<=100; i++){
    for(int j=0; j<=100; j++){
      for(int k=0; k<=100; k++){
        vector<int> J={i, j, k};
        vector<int> P={C.at(0).at(0)-i, C.at(1).at(1)-j, C.at(2).at(2)-k};
        int p=1;
        for(int m=0; m<3; m++){
          for(int n=0; n<3; n++){
            if(C.at(m).at(n)!=J.at(m)+P.at(n)){
              p=0;
              break;
            }
          }
        }
        if(p==1){
          cout << "Yes" << endl;
          goto finish;
        }
      }
    }
  }
  cout << "No" << endl;

finish: int q=0;
  
}

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

int  n , m  , Max=0;

vector<int > a[100010];

int  dp[100005];

void dfs(int  x , int  root , int  i)
{
    if(dp[x]!=0){return;}
    for(auto v: a[x])
    {
        if(v!=root&&v!=i)
        {
            dfs(v , x , i);
            dp[x]=max(dp[v]+1 , dp[x]);
           // dp[v]=0;
        }
    }
}

main()
{
    cin >> n >> m ;
    for(int  i=1 ; i<=n ; i++){
        dp[i]=0;
    }
    for(int  i=1 ; i<=m ; i++){
        int  u , v;
        cin >> u >> v;
        a[u].push_back(v);
    }
    for(int  i=1 ; i<=n ; i++)
    {
        dfs(i , -1 , i);
        Max=max(dp[i] , Max);
    }
    cout << Max<<endl;
    
}



Measured memory_bytes: 12392
#include<iostream>
#include <vector>
#include <math.h>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
using namespace std;

int main() {
    long long a, b, c;
    cin >> a >> b >> c;
    if (c >= b) c = b - 1;
    cout << (long long)((1.0 * c / b) * a) << endl;
}

Measured memory_bytes: 3192
import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*
import kotlin.math.min

fun main() {
    val jin = BufferedReader(InputStreamReader(System.`in`))
    val n = jin.readLine().toInt()
    val freqA = IntArray(n + 1)
    val freqB = IntArray(n + 1)
    var tokenizer = StringTokenizer(jin.readLine())
    for (j in 1..n) {
        freqA[tokenizer.nextToken().toInt()]++
    }
    tokenizer = StringTokenizer(jin.readLine())
    for (j in 1..n) {
        freqB[tokenizer.nextToken().toInt()]++
    }
    val xs = (1..n).sortedByDescending { freqA[it] + freqB[it] }
    if (freqA[xs[0]] + freqB[xs[0]] > n) {
        println("No")
    } else {
        val startA = mutableListOf<Int>()
        val startB = mutableListOf<Int>()
        val endA = mutableListOf<Int>()
        val endB = mutableListOf<Int>()
        for (x in xs) {
            if (startA.size + endB.size < n && startA.size + endB.size + freqA[x] + freqB[x] > n) {
                val k = startA.size + endB.size + freqA[x] + freqB[x] - n
                val r = minOf(k, freqA[x], endB.size)
                freqA[x] -= r
                for (j in 1..r) {
                    endA.add(x)
                }
                freqB[x] -= k - r
                for (j in 1..k - r) {
                    startB.add(x)
                }
            }
            for (j in 1..freqA[x]) {
                startA.add(x)
            }
            for (j in 1..freqB[x]) {
                endB.add(x)
            }
        }
        val allA = startA + endA.reversed()
        val allB = startB + endB.reversed()
        println("Yes")
        println((0 until n).sortedBy { allA[it] }.map { allB[it] }.joinToString(" "))
    }
}

Measured memory_bytes: 87264
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <tuple>
#include <sstream>
#include <set>

struct Node
{
  int data;
  Node* parent;
  int rank;
  Node() : data(-1), parent(this), rank(0){}
  Node& operator=(int data){ this->data = data; return *this; }
  Node* Find(){
    if (this == this->parent){
      return this;
    } else {
      auto root = this->parent->Find();
      this->parent = root;
      return root;
    }
  }
  static void Union(Node& lhs, Node& rhs){
    Node* lhs_root = lhs.Find();
    Node* rhs_root = rhs.Find();
    if (lhs_root->rank > rhs_root->rank){
      rhs_root->parent = lhs_root;
    } else if (rhs_root->rank > lhs_root->rank){
      lhs_root->parent = rhs_root;
    } else if (rhs_root != lhs_root){
      lhs_root->parent = rhs_root;
      rhs_root->rank += 1;
    }
    return;
  }
};

bool is_not_space(int c){ return c != ' '; }
std::string& ltrim(std::string& str){
  str.erase(str.begin(), std::find_if(str.begin(), str.end(), is_not_space));
  return str;
}
std::string& rtrim(std::string& str){
  str.erase(std::find_if(str.rbegin(), str.rend(), is_not_space).base(), str.end());
  return str;
}
std::string trim(std::string& str){ return ltrim(rtrim(str)); }
std::vector<std::pair<int, int>> const delta = {{-1,1}, {0,1}, {1,1}, {1,0}};

int main(void)
{
  std::string buff;
  while(true){
    std::getline(std::cin, buff);
    int w, h;
    {
      std::stringstream ss(buff);
      ss >> w;
      ss >> h;
    }
    if(w == 0 && h == 0){ break; }
    std::vector<Node> V((w+2)*(h+2));
    auto to_index = [=](int i, int j) -> size_t { return i*(w+2) + j; };
    std::vector<std::vector<int>> C(h+2, std::vector<int>(w+2, 0));
    for(int i=1; i<=h; ++i){
      std::getline(std::cin, buff);
      std::stringstream ss(buff);
      for(int j=1; j<=w; ++j){
        ss >> C[i][j];
        if(C[i][j] == 1){ V[to_index(i,j)].data = to_index(i,j); }
      }
    }
    for(int i=1; i<=h; ++i){
      for(int j=1; j<=w; ++j){
        if(C[i][j] == 0){ continue; }
        for(auto& d: delta){
          int di = d.first, dj = d.second;
          if(C[i+di][j+dj] == 1){ Node::Union(V[to_index(i,j)], V[to_index(i+di, j+dj)]); }
        }
      }
    }
    std::set<int> cluster;
    for(int i=1; i<=h; ++i){
      for(int j=1; j<=w; ++j){
        cluster.insert(V[to_index(i,j)].Find()->data);
      }
    }
    cluster.erase(-1);
    std::cout << cluster.size() << std::endl;

  }

  return 0;
}



Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
typedef long long               ll;
const int mod = 1e9+7;
#ifndef M_PI
const double M_PI = acos(-1.0);
#endif
int cnt[3];

int main(){
  int n, a, b;
  cin>>n>>a>>b;
  for(int i=0; i<n; ++i){
    int p;
    cin>>p;
    if(p<=a)
      ++cnt[0];
    else if(p<=b)
      ++cnt[1];
    else
      ++cnt[2];
  }
  cout<<min(cnt[0], min(cnt[1], cnt[2]));
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
using namespace std;

const double PI=acos(-1);

bool hoge(const long* array, int size){
    for(int i = 0; i < size; i++){
        if(array[i]%2 == 1) return false;
    }
    return true;
}

int main(){
    int n;
    long t;
    cin >> n;
    long a[200];
    fill(a, a, 0);
    for(int i = 0; i < n; i++){
        cin >> t;
        a[i] = t;
    }
    int c = 0;
    while(hoge(a, n)){
        for(int i = 0; i < n; i++){
            a[i] /= 2;
        }
        c++;
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int main(){
    string s;
    cin >> s;
    int ans=(int)s.size();
    ans/=2;

    for(int i=0; i<(int)s.size(); i++){
        if(s[i]=='p'){
            ans--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, ans=0;
	cin >> n;
	int a[n+1];
	for(int i=1;i<=n;i++)
	{	
		cin >>a[i];
		ans+=a[i]-1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N = read()
A = reads()

print(sum(a-1 for a in A))


Measured memory_bytes: 39792