akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll H, W; cin >> H >> W;
  char c[H][W];
  for (ll i = 0; i < H; i++) {
    for (ll j = 0; j < W; j++) {
      cin >> c[i][j];
    }
  }
  ll h0[H], w0[W];
  fill(h0,h0+H,0);
  fill(w0,w0+W,0);
  for (ll i = 0; i < H; i++) {
    for (ll j = 0; j < W; j++) {
      if (c[i][j] == '#') h0[i] = 1;
    }
  }
  for (ll j = 0; j < W; j++) {
    for (ll i = 0; i < H; i++) {
      if (c[i][j] == '#') w0[j] = 1;
    }
  }
  for (ll i = 0; i < H; i++) {
    for (ll j = 0; j < W; j++) {
      if (h0[i] == 1 && w0[j] == 1) {cout << c[i][j];}
    }
    if (h0[i] == 1) {cout << endl;}
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    a, b = input_to_int_map()
    return a * b


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 9176
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

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;
const long long MOD = 1e9+7;

int main() { 
    int n, m;
    cin >> n >> m;
    cout << (n == m ? "Yes" : "No") << endl;
}   

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import *

c = [list(map(int, input().split())) for _ in range(3)]
flag = True

for i in range(3):
    if c[i][1]-c[i][0]!=c[0][1]-c[0][0]:
        flag = False

for i in range(3):
    if c[i][2]-c[i][1]!=c[0][2]-c[0][1]:
        flag = False

for i in range(3):
    if c[1][i]-c[0][i]!=c[1][0]-c[0][0]:
        flag = False

for i in range(3):
    if c[2][i]-c[1][i]!=c[2][0]-c[1][0]:
        flag = False

if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    ll ma=max(b,c);
    ll mi=min(b,c);
    ll d=a-ma;
    ll e=mi-1;
    ll k=ma-mi;
    if(k%2==0)cout<<k/2<<endl;
    else
    {
        if(d>e)
        {
            ma=ma-e;
            ll f=ma-1;
            if(f%2==0)cout<<f/2+e<<endl;
            else cout<<f/2+1+e<<endl;
        }
        else
        {
            mi=mi+d;
            ll f=a-mi;
            if(f%2==0)cout<<f/2+d<<endl;
            else cout<<f/2+1+d<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>){
    val initialInput = readLine()!!.split(' ')
                                   .map { it.toInt() }
    val quantity = initialInput[0]
    val length = initialInput[1]

    val textArray = Array(quantity){""}

    val array = toArrayfromInput(quantity, textArray)
    println(array.toList().sorted().joinToString(""))
}
tailrec fun toArrayfromInput(maxCount: Int, array: Array<String>, count: Int = 0): Array<String>{
    array[count] = readLine()!!
    return if (count < maxCount-1) toArrayfromInput(maxCount, array, count+1)
           else                   array
}

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

set<string> se;

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

Measured memory_bytes: 19260
N = int(input())
num_divs = [0] * N
ans = 0
for i in range(1, N+1):
    n = 0
    for j in range(i, N+1, i):
        num_divs[j-1] += 1
        n += 1
    ans += num_divs[i - 1] * i
print(ans)

Measured memory_bytes: 145876
#include<bits/stdc++.h>
using namespace std;
#define ll         long long
#define mod        1000000007
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define inf        1e18
#define ps(x,y)    fixed<<setprecision(y)<<x

int main() {

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

	ll n;
	cin >> n;
	ll a[n + 1];
	ll total = 0;
	for (ll i = 1; i <= n; ++i)
	{
		cin >> a[i];
	}
	std::vector<ll> sum(n + 1, 0);
	std::vector<ll> diff(n + 1, 0);
	for (ll i = 1; i <= n; ++i)
	{
		sum[i] = i + a[i];
	}
	for (ll i = 1; i <= n ; ++i)
	{
		diff[i] = i - a[i];
	}
	sort(sum.begin() + 1, sum.end());
	sort(diff.begin() + 1, diff.end());

	for (ll i = 1, j = 1; i <= n && j <= n ; )
	{
		if (sum[i] == diff[j])
		{
			total++;
			ll a1 = 0;
			ll a2 = 0;
			while ((i + 1 <= n) && (sum[i + 1] == sum[i]))
			{
				a1++;
				i++;

			}
			while ((j + 1 <= n ) && ( diff[j + 1] == diff[j]))
			{
				a2++;
				j++;
			}
			i++, j++;
			total = total + (a1 + 1) * (a2 + 1) - 1;


		}
		else if (sum[i] < diff[j])
		{
			i++;
		}
		else
			j++;
	}

	cout << total;
}

Measured memory_bytes: 7996
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)

#define INF 1000000001
#define MOD 1000000007
#define INF64 1000000000000000001

#define F first
#define S second

#define Pii pair<SINT32,SINT32>
#define Pll pair<SINT64,SINT64>


using namespace std;

int main() {

	string s;
	cin >> s;
	
	rep(i,0,s.length()) {
		if ((i % 2) == 0) {
			cout << s[i];
		}
	}
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());	//ソート後に使用

//	DATA.insert(DATA.begin() + X, 0);	//X番目の要素に0を挿入


//	vector<vector<SINT32>> DP(N,vector<SINT32>(3));	//2次元配列

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

// 	vector<pair<int,pair<int,int>>> DATA(M);
//	cin >> DATA[i].first;
//	cin >> DATA[i].second.first;
//	cin >> DATA[i].second.second;


//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();	//key以上を探す
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();


/* 文字列回転
	string N;
	cin >> N;
	N = N[N.length()-1] + N.substr(0,N.length()-1);
*/
/* 文字列合成
	string N,M;
	cin >> N >> M;
	SINT64 ans = 0;
	ans = stoi(N+M);
*/

/*
//ワーシャルフロイド
vector<vector<SINT32>> dist(N,vector<SINT32>(N));
rep(i,0,N) {
	rep(j,0,N) {
		if (i != j) {
			dist[i][j] = INF;
		}
	}
}
rep(k,0,N) {
	rep(i,0,N) {
		rep(j,0,N) {
			dist[i][j] = MIN(dist[i][j], dist[i][k]+dist[k][j]);
		}
	}
}
*/



/* SET コンテナ
	set<SINT32> DATA;
	for (SINT32 i = 0; i < N; i++) {
		SINT32 buf;
		cin >> buf;
		DATA.insert(buf);
	}

	//全表示
    set<string>::iterator it; //  イテレータを用意
    for(it = DATA.begin(); it != DATA.end(); it++) {
        cout << *it << endl;
    }

	//N番目を一部表示
	set<string>::iterator it; //  イテレータを用意
	it = DATA.begin();
	rep (i,0,N) {
		it++;
	}
	cout << *it << endl;
*/

/* map
	map<string,SINT32> mp;
	SINT32 N = 0;
	SINT32 mx = 0;

	cin >> N;
	for (SINT32 i = 0; i < N; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	for(auto it=mp.begin();it!=mp.end();it++) {
		mx=max(mx,it->second);
	}
*/

/*
	//順列全表示
	//sortしてからでないと全列挙にならない
	sort(DATA.begin(),DATA.end());
	do {
		cout << buf << endl;
		rep(i,0,R) {
			cout << DATA[i] << " ";
		}
		cout << endl;

    } while (next_permutation(DATA.begin(),DATA.end()));
*/

Measured memory_bytes: 512
// abc116_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int s;
    cin >> s;

    set<int> st{s};
    int a = s;
    REP(i, 1000001){
        if (a & 1){
            a = 3 * a + 1;
        } else {
            a = a / 2;
        }

        if (st.find(a) != st.end()){
            print(i+2);
            return 0;
        }
        st.insert(a);
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
const int maxn = 100500;


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int ab = 0, ba = 0, b = 0, a = 0;
    int ans = 0, n;
    cin >> n;
    for(int i = 0 ; i < n ; ++i){
        string s;
        cin >> s;
        for(int j = 0 ; j < (int)s.length() - 1 ; ++j)
            if(s[j] == 'A' && s[j + 1] == 'B')
                ans++;
        if(s[0] == 'B' && s[(int)s.length() - 1] == 'A') ba++;
        else if(s[0] == 'B') b++;
        else if(s[(int)s.length() - 1] == 'A') a++;
    }
    if(ba > 0){
        if(b) ans++, b--;
        if(a) ans++, a--;
    }
    ans += max(0, ba - 1) + min(a, b);
    cout << ans << '\n';
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e17;
 
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
 
template<typename T>vector<T>
make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}



signed main()
{
	IOS();
	string s;
	cin>>s;
	int K = s.size();
	int cnt = 0;
	rep(i,0,K)if(s[i]=='o')cnt++;
	if(cnt+(15-K)>=8)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define fo(i, n) for(int i = 1; i <= n; ++i)
#define rep(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
 
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
 
const int N = 200200;
const int mod = 1e9 + 7;
const ll INF = 1e18;
 
 
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	ll n;
	cin>>n;
	if(n==1)
	{
		cout<<"2\n1 1";
		return 0;
	}
	ll nc=n;
	ll step=0;
	while(nc)
	{
		nc>>=1;
		step++;
	}	
	step--;
	vector<int> a;
	for(int i=1;i<=step;++i)
		a.pb(i);
	for(int i=1;i<=step;++i)
		a.pb(i);
	a.pb(step+1);
	a.pb(step+1);
	int sz=step+1;
	for(int i=step-1;i>=1;--i)
	{
		vector<int>b;
		if((n >> i)&1)
		{
			sz++;
			int f=1;
			for(int j=0;j<a.size();++j)
			{
				b.pb(a[j]);
				if(a[j]==i&&f)
					f--,b.pb(sz);
			}
			b.pb(sz);
			a=b;
			b.clear();
			b.shrink_to_fit();
		}
	}
	if(n%2==1)
		a.pb(sz+1),a.pb(sz+1);
	cout<<a.size()<<"\n";
	for(int x:a)
		cout<<x<<' ';
	return 0;	
}

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

using namespace std;

int main()
{
    string s;
    bool ans = true;
    cin >> s;
    for(int i = 0;i < s.length();i++)
    {
        if(i == 1 && s[i] == 'L' || s[i] == 'U' || s[i] == 'D')
        {
        }
        else if(i == 0 && s[i] == 'R' || s[i] == 'U' || s[i] == 'D')
        {
        }
        else if(i % 2 == 1 && s[i] == 'L' || s[i] == 'U' || s[i] == 'D')
        {
        }
        else if (i % 2 == 0 && s[i] == 'R' || s[i] == 'U' || s[i] == 'D')
        {
        }
        else
        {
            ans = false;
            break;
        }
        
    }
    if(ans == true)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
#define M 200020
using namespace std;
int read(){
	int nm=0,fh=1; char cw=getchar();
	for(;!isdigit(cw);cw=getchar()) if(cw=='-') fh=-fh;
	for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
	return nm*fh;
}
int n,m,p[M],maxn,minn,t1,t2;
void fad(){puts("No");exit(0);}
int main(){
	n=read(),minn=n;
	for(int i=1;i<=n;i++) p[i]=read(),maxn=max(maxn,p[i]),minn=min(minn,p[i]);
	if(maxn-minn>1||maxn>=n||minn<=0) fad();
	if(maxn==minn){if(maxn!=n-1&&(maxn<<1)>n) fad();}
	else{
		for(int i=1;i<=n;i++) if(p[i]==maxn) t2++; else t1++;
		if(t1+(t2>>1)<maxn||t1+1>maxn) fad();
	}
	puts("Yes"); return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define MAXN 200002

int n, k, c;
string s;
stack <int> sta;

int main () {
	cin >> n >> k >> c >> s;
	for (int i = n - 1, j = 0; i >= 0 && j < k; i --) {
		if (s[i] == 'o') {
			sta.push (i);
			j ++; i -= c;
		}
	}
	for (int i = 0, j = 0; i < n && j < k; i ++) {
		if (s[i] == 'o') {
			if (sta.top () == i) cout << (i + 1) << endl;
			sta.pop ();
			j ++; i += c;
		}
	}
	return 0;
}


Measured memory_bytes: 2336
s = str(input())
slist = list(s)
slr = slist[::-1]
slen = len(s)
ans1 = 0
ans2 = 0
for i in range(0,slen+1):
    if slist[i] == 'A':
        ans1 = i
        break
    else:
        pass
for j in range(0,slen+1):
    if slr[j] == 'Z':
        ans2 = slen - j
        break
    else:
        pass
print(ans2 - ans1)


Measured memory_bytes: 6504
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static long Solve(int N, int K, long[] V)
        {
            long max = 0;
            for (int i = 0; i <= Math.Min(K, N); ++i)
            {
                for (int j = 0; i + j <= Math.Min(K, N); ++j)
                {
                    var values = Enumerable.Concat(V.Take(i), V.Skip(N - j)).OrderBy(value => value).ToArray();
                    long sum = values.Sum();
                    for (int k = 0; i + j + k < K && k < values.Length; ++k)
                    {
                        if (values[k] < 0) { sum -= values[k]; }
                    }
                    max = Math.Max(sum, max);
                }
            }
            return max;
        }

        static void Main(string[] args)
        {
            int[] values = ReadInts();
            var V = ReadLongs();
            Console.WriteLine(Solve(values[0], values[1], V));
        }
    }
}


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

Measured memory_bytes: 256
from collections import defaultdict
import math

N = int(input())

d = defaultdict(int)
for i in range(2, int(math.sqrt(N)) + 1):
    while N % i == 0:
        d[i] += 1
        N //= i
if N > 1:
    d[N] = 1

ans = 0
for v in d.values():
    k = 1
    while k <= v:
        ans += 1
        v -= k
        k += 1
print(ans)


Measured memory_bytes: 9472
import numpy as np

K, N = map(int, input().split())
A = np.array(list(map(int, input().split())))
tmp = K - A[-1]

for i in range(N-1, 0, -1):
    A[i] = A[i] - A[i-1]

A[0] += tmp

A = np.sort(A)
print(np.sum(A[:-1]))


Measured memory_bytes: 34152
#include <bits/stdc++.h>
#include <fstream>
#include <iostream>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define maxim INT_MAX
#define fi first
#define se second
#define INF 1e16
/* 1. If you can't keep solution in mind, then visualize it on a paper.
 * 2. Try to identify the type of problem - DP, Greedy, Graph, Constructive,
 * 	  Prefix/Suffix, Difference Array, BIT/Segment Tree, etc.
 * 3. Look at the problems from different perspectives - reverse the problem,
 * 	  add instead of delete (maybe?)
 * 4. Divide difficult solutions into cases and/or sequences.
 * 5. Use math rules to solve Nested Summation.
 * 6. Optimisation problems are generally solved with DP, greedy, binary search or brute-force.
 * 7. Try fixing a solution then proving we can't do better or worse than that.
 * ------------------------------------------------------------------
 */

int main()
{
    string s1,s2;
    cin>>s1>>s2;
    ll n=s1.length();
    ll m=s2.length();
    ll dp[n+1][m+1];
    memset(dp,0,sizeof(dp));
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<m;j++)
        {
            if(s1[i]==s2[j])
            {
                dp[i+1][j+1]=dp[i][j]+1;
            }
            else
            {
                dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
            }
        }
    }
    string ans="";
    ll i=n,j=m;
    while(i>0&&j>0)
    {
        if(dp[i][j]>dp[i-1][j]&&dp[i][j]>dp[i][j-1])
        {
            ans=ans+s1[i-1];
            i--;
            j--;

        }
        else
        {
            if(dp[i-1][j]>dp[i][j-1])
            {
                i--;
            }
            else
            {
                j--;
            }
        }
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;

}


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

using namespace std;
typedef long long ll;
#define int ll

template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

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

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

    int cur = 1;
    int ans = 1;
    while(1) {
        cur *= K;
        if(N < cur) {
            printf("%lld\n", ans);
            return 0;
        }
        ans++;
    }

    return 0;
}


Measured memory_bytes: 256
L=int(input())
n=len(str(bin(L)))-3
e=[]
for i in range(n):
    e.append((i+1, i+2, 0))
    e.append((i+1, i+2, 2**(n-i-1)))
h=2**n
for i, c in enumerate(str(bin((L)))[2:]):
    if c=="1"and i:
        e.append((1,i+1,h))
        h+=2**(n-i)
print(n+1,len(e))
for i in e:print(*i)

Measured memory_bytes: 3188
import math

N,D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]

ans = 0

for i in range(N-1):
    for j in range(i+1, N):
        d = 0
        for k in range(D):
            d += (X[i][k] - X[j][k])**2
        ans += math.sqrt(d).is_integer()

print(ans)

Measured memory_bytes: 9056
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void) {
    ll n;
    cin >> n;
    ll h[n];
    for(ll i = 0; i < n; i++)
        cin >> h[i];
    ll ans = h[0];
    for(ll i = 1; i < n; i++){
        if(h[i]>h[i-1]) ans+=h[i]-h[i-1];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char S[110];
char T[110];
int main()
{
	int a;
	scanf("%d",&a);
	scanf("%s%s",S,T);
	for(int i=0;i<a;i++)printf("%c%c",S[i],T[i]);printf("\n");
 } 

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

using namespace std;

int main(){

    int N = 0;
    cin >> N;
    //vector<vector<string> > nameList;
    //nameList.assign(1, vector<string>(N, ""));

    long countTop[5] = {0, 0, 0, 0, 0};

    for(int i = 0; i < N; i++){
        string s;
        cin >> s;
        string f;
        f = s.substr(0, 1);
        if(f == "M") countTop[0]++;
        if(f == "A") countTop[1]++;
        if(f == "R") countTop[2]++;
        if(f == "C") countTop[3]++;
        if(f == "H") countTop[4]++;      
    }

    long total = 0;
    for(int i = 0; i < 5; i++){
        for(int j = i  + 1; j < 5; j++){
            for(int q = j + 1; q < 5; q++){
                total += countTop[i] * countTop[j] * countTop[q];
            }
        }        
    }
    cout << total;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define x first
#define y second
#define mp make_pair
#define pb push_back
template <typename TYPE> inline void chkmax(TYPE &x,TYPE y){x<y?x=y:TYPE();}
template <typename TYPE> inline void chkmin(TYPE &x,TYPE y){y<x?x=y:TYPE();}
template <typename TYPE> void readint(TYPE &x)
{
    x=0;int f=1;char c;
    for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
    for(;isdigit(c);c=getchar())x=x*10+c-'0';
    x*=f;
}
const int MAXN=1000005;

int n;
char str[MAXN];
int a[MAXN];

int main()
{
	bool h1=0;
	int res=0;
	readint(n);
	scanf("%s",str+1);
	for(int i=1;i<=n;++i)
	{
		a[i]=str[i]-'0'-1;
		if(a[i]==1)h1=1;
		bool flag=1;
		for(int j=0;(1<<j)<=n;++j)
			if(!((n-1)&(1<<j)) && ((i-1)&(1<<j)))
				{flag=0;break;}
		if(flag)res^=a[i];
	}
	if(res&1)printf("1\n");
	else if(h1)printf("0\n");
	else printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 5120
import std.stdio;
import std.string;
import std.format;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.concurrency;
import std.traits;
import std.uni;
import std.regex;
import core.bitop : popcnt;
alias Generator = std.concurrency.Generator;

enum long INF = long.max/5;

void main() {
  long N;
  scanln(N);
  char[] xs;
  scanln(xs);
  xs.map!(x => to!char((x - 'A' + N)%26 + 'A')).writeln;
}

// ----------------------------------------------


void times(alias fun)(long n) {
  // n.iota.each!(i => fun());
  foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(long n) {
  // return n.iota.map!(i => fun()).array;
  T[] res = new T[n];
  foreach(ref e; res) e = fun();
  return res;
}

T ceil(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  // `(x+y-1)/y` will only work for positive numbers ...
  T t = x / y;
  if (y > 0 && t * y < x) t++;
  if (y < 0 && t * y > x) t++;
  return t;
}

T floor(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  T t = x / y;
  if (y > 0 && t * y > x) t--;
  if (y < 0 && t * y < x) t--;
  return t;
}

ref T ch(alias fun, T, S...)(ref T lhs, S rhs) {
  return lhs = fun(lhs, rhs);
}
unittest {
  long x = 1000;
  x.ch!min(2000);
  assert(x == 1000);
  x.ch!min(3, 2, 1);
  assert(x == 1);
  x.ch!max(100).ch!min(1000); // clamp
  assert(x == 100);
  x.ch!max(0).ch!min(10); // clamp
  assert(x == 10);
}

mixin template Constructor() {
  import std.traits : FieldNameTuple;
  this(Args...)(Args args) {
    // static foreach(i, v; args) {
    foreach(i, v; args) {
      mixin("this." ~ FieldNameTuple!(typeof(this))[i]) = v;
    }
  }
}

void scanln(Args...)(auto ref Args args) {
  enum sep = " ";
  enum n = Args.length;
  enum fmt = n.rep!(()=>"%s").join(sep);

  string line = readln.chomp;
  static if (__VERSION__ >= 2074) {
    line.formattedRead!fmt(args);
  } else {
    enum argsTemp = n.iota.map!(
      i => "&args[%d]".format(i)
    ).join(", ");
    mixin(
      "line.formattedRead(fmt, " ~ argsTemp ~ ");"
    );
  }
}

// fold was added in D 2.071.0
static if (__VERSION__ < 2071) {
  template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
      static if (S.length < 2) {
        return reduce!fun(seed, r);
      } else {
        return reduce!fun(tuple(seed), r);
      }
    }
  }
}

// popcnt with ulongs was added in D 2.071.0
static if (__VERSION__ < 2071) {
  ulong popcnt(ulong x) {
    x = (x & 0x5555555555555555L) + (x>> 1 & 0x5555555555555555L);
    x = (x & 0x3333333333333333L) + (x>> 2 & 0x3333333333333333L);
    x = (x & 0x0f0f0f0f0f0f0f0fL) + (x>> 4 & 0x0f0f0f0f0f0f0f0fL);
    x = (x & 0x00ff00ff00ff00ffL) + (x>> 8 & 0x00ff00ff00ff00ffL);
    x = (x & 0x0000ffff0000ffffL) + (x>>16 & 0x0000ffff0000ffffL);
    x = (x & 0x00000000ffffffffL) + (x>>32 & 0x00000000ffffffffL);
    return x;
  }
}


Measured memory_bytes: 380
import sys
sys.setrecursionlimit(10**7)

def root(x):
    if rank[x] < 0: return x
    rank[x] = root(rank[x])
    return rank[x]

def unite(x, y):
    x, y = root(x), root(y)
    if x == y: return False
    if rank[x] > rank[y]: x, y = y, x
    rank[x] += rank[y]
    rank[y] = x
    return True

def size(x):
    return -rank[root(x)]


n, m = map(int, input().split())
rank = [-1 for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    unite(a, b)

ans = 0
for i in range(n):
    ans = max(ans, size(i))
print(ans)

Measured memory_bytes: 14980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int k;
    cin>>k;
    queue<string> q;
    for(int i=1;i<=9;++i)
    {
        string temp=to_string(i);
        q.push(temp);
    }
    
    string str;
    for(int i=1;i<=k;++i)
    {
        //cout<<str<<" ";
        str=q.front();
        q.pop();
        int p=str.size();
        int temp=str[p-1]-'0';
        for(int i=0;i<=9;++i)
        {
            if(abs(temp-i)<=1)
            {
                string h=to_string(i);
                string temp=str+h;
                q.push(temp);
            }
        }
        
    }
    cout<<str<<endl;
}


Measured memory_bytes: 13824
'use strict'

function main(input) {
  input = input
    .trim()
    .split('\n')
    .map(Number)
  const n = input[0] % 500
  const ans = n <= input[1] ? 'Yes' : 'No'
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 21064
#include<iostream>
#include<cmath>
#include<iomanip>

using namespace std;

int main(){

  int N,K;
  int x[200000]={0};

  cin >> N >> K;

  for(int i=1; i<=N; i++){
     for(int j=i; j<K ; j=2*j){
        x[i]++;
     }
  }

  double p = 0;
  for(int i=1; i<=N; i++){
       p += pow(2,-x[i])/N;
  }

  cout << fixed << setprecision(12) << p << endl;

  return 0;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
//const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

int N;
vector<vector<int>> G;
vector<vector<int>> VSET;
map<pii, int> EMAP;

void dfs(int root,int idx, int par)
{
	if (par != -1)
	{
		VSET[root][idx] = VSET[root][par];
		VSET[root][idx] |= (1LL << EMAP[mp(min(par, idx), max(par, idx))]);
	}

	for (auto e : G[idx])
	{
		if (e == par)continue;
		dfs(root, e, idx);
	}
}

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

	cin >> N;
	G.resize(N);
	VSET.resize(N);
	int x, y;
	rep(i, 0, N - 1)
	{
		cin >> x >> y;
		x--, y--;
		EMAP[mp(min(x, y),max(x,y))] = i;
		G[x].push_back(y);
		G[y].push_back(x);
	}

	rep(i, 0, N)
	{
		VSET[i].resize(N);
		VSET[i][i] = 0;
		dfs(i, i, -1);
	}

	int M;
	cin >> M;
	vector<pii> Q(M);
	rep(i, 0, M)
	{
		cin >> Q[i].first >> Q[i].second;
		Q[i].first--, Q[i].second--;
	}

	int ans = 0;
	rep(i, 0, 1LL << M)
	{
		int s = 0;
		int cnt = 0;
		rep(j, 0, M)
		{
			if ((i >> j) & 1)
			{
				cnt++;
				s |= VSET[Q[j].first][Q[j].second];
			}
		}
		int res = 0;
		rep(j, 0, 60)
		{
			if ((s >> j) & 1)
			{
				res++;
			}
		}
		res = (int)pow(2LL, N - 1 - res);
		if (cnt % 2 == 0)
		{
			ans += res;
		}
		else
		{
			ans -= res;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e2 + 5;
const int INF = 1e9 + 7;

string s;

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> s;
	cout << (s == "ABC" ? "ARC" : "ABC");
	return 0;
}
//11-09-2020 17:11:31

Measured memory_bytes: 3632
#include<stdio.h>

int main(void) {

  long long int n;
  long long int ans;
  int tmp;
  int s = 0;
  
  scanf("%lld",&n);

  tmp = n;

  while (1) {
    s += tmp % 10;
    tmp /= 10;
    if (tmp <= 0) {break;}
  }
  
  if (n % s == 0) {
    printf("Yes");
  } else {
    printf("No");
  }
      
  return 0;
}


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


class Program {

	static long mod = 998244353;
	static int[] ans;
	static void Main(string[] args) {

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

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);
		

		int res = 0;
		int[] vals = parseAry(Console.ReadLine().Split(cs));
		int n = vals[0];
		int m = vals[1];

		int[] app = new int[n];
		int low = 9999;
		int cnt = -1;

		for ( int i = 0; i < n; i++ ) {
			app[i] = m + i;
			if ( Math.Abs(app[i]) < low ) { low = Math.Abs(app[i]); cnt = i; }
		}
		app[cnt] = 0;
		res = app.Sum();


			Console.WriteLine(res);
				return;

	}




	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}


}

Measured memory_bytes: 13268
def solver(arr):
    stool = 0
    for i in range(1, len(arr)):
        
        if arr[i]<arr[i-1]:
            stool += -arr[i]+arr[i-1]
            arr[i] = arr[i-1]
    return stool


if __name__=='__main__':
    n = int(input())
    arr = list(map(int,input().split()))
    print(solver(arr))

Measured memory_bytes: 32200
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int N;
    long long ans=1;
    cin >>N;
    for(int i=0;i<N;i++){
        long long x;
        cin>>x;
        ans=ans/__gcd(ans,x)*x;
    }
    cout<<ans<<endl;
   }

Measured memory_bytes: 256
lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end
#p lines
n = lines[0][0]
d = lines[0][1]
i = 1
cnt = 0
while i < lines.length
	if d >= Math.sqrt(lines[i][0]**2 + lines[i][1]**2) then
		cnt += 1
	end
	i+= 1
end
p cnt


Measured memory_bytes: 28780
n = int(input())
s = list(map(int,input().split()))

a = s[0]
b = sum(s)-a
ans = abs(a-b)

for i in range(1,n-1):
    a += s[i]
    b -= s[i]
    ans = min(ans,abs(a-b))
    
print(ans)

Measured memory_bytes: 31620
<?php
fscanf(STDIN, "%d", $N);

$n3 = intdiv($N, 3);
$n5 = intdiv($N, 5);
$n15 = intdiv($N, 15);

$ans = (1 + $N) * $N / 2;
$ans -= (1 + $n3) * $n3 / 2 * 3;
$ans -= (1 + $n5) * $n5 / 2 * 5;
$ans += (1 + $n15) * $n15 / 2 * 15;

printf("%d", $ans);


Measured memory_bytes: 16184
#include <bits/stdc++.h>
using namespace std;
#define mid ((s + e) / 2)
#define makefast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define comp(x) (lower_bound(vec.begin(), vec.end(), x) - vec.begin())
#define lc (v * 2)
#define rc (v * 2 + 1)
long long M = 1e9 + 7;
//>>>>>>>>>>>>>>>>>>>

const int N = 1e5 + 7;

vector <int> ad[N];
int n;
int cnt[N][30];
int res = 0;
void solve(int v, int p = 0) {
	if (ad[v].size() == 1 && ad[v].back() == p) {
		cnt[v][0] = 1;
		return;
	}
	for (auto u: ad[v])
		if (u != p) {
			solve(u, v);
			for (int i = 0; i < 30; i++)
			   cnt[v][i] += cnt[u][i];	
		}
	int lst = 29;
	for (int i = 28; i >= 0; i--)
		if (cnt[v][i] > 1)
			break;
		else if (!cnt[v][i])
			lst = i;
	for (int i = 0; i < lst; i++)
		cnt[v][i] = 0;
	cnt[v][lst] = 1;
	res = max(res, lst);
}
int main() {
	cin >> n;
	for (int i = 1; i < n; i++) {
		int v, u;
		cin >> v >> u;
		ad[v].push_back(u);
		ad[u].push_back(v);
	}
	solve(1);
	cout << res;

	return 0;
}



Measured memory_bytes: 23168
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
//#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
//#define EXIST(s, e) ((s).find(e)!=(s).end())
//#define SORT(c) sort(begin(c),end(c))
//#define pb emplace_back
//#define MP make_pair
//#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007

//ここから編集する
vector<pair<int, int> > rotate(vector<pair<int, int> > moto) {
    vector<pair<int, int> > ret;
    for (int i = 0; i < moto.size(); i++) {
        int x = moto[i].first;
        int y = moto[i].second;
        ret.emplace_back(-y, x);
    }
    return ret;
}

bool isSame(vector<pair<int, int> > vector1, vector<pair<int, int> > vector2) {
    for (int i = 0; i < 4; i++) {
        if (vector1 == vector2) return true;
        vector2 = rotate(vector2);
    }

    reverse(all(vector2));
    for (int i = 0; i < 4; i++) {
        if (vector1 == vector2) return true;
        vector2 = rotate(vector2);
    }
    return false;

}

bool solve() {
    int N;
    cin >> N;
    if (N == 0)return false;
    vector<vector<pair<int, int> > > points(N + 1);
    vector<vector<pair<int, int> > > vectors(N + 1);
    for (int i = 0; i < N + 1; i++) {
        int M;
        cin >> M;
        for (int j = 0; j < M; j++) {
            int x, y;
            cin >> x >> y;
            points[i].emplace_back(x, y);
        }
    }

    for (int i = 0; i < N + 1; i++) {
        for (int j = 1; j < points[i].size(); j++) {
            int dx = points[i][j].first - points[i][j - 1].first;
            int dy = points[i][j].second - points[i][j - 1].second;
            vectors[i].emplace_back(dx, dy);
        }
    }

    vector<int> ans;
    for (int i = 1; i <= N; i++) {
        if (isSame(vectors[0], vectors[i])) {
            ans.push_back(i);
        }
    }

    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i] << endl;
    }
    cout << "+++++" << endl;
    return true;
}

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

    while (solve());


    return 0;
}



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

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    int sumA = 0, sumB = 0;
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
        sumA += a[i];
    }
    for(int i = 0; i < n; ++i) {
        cin >> b[i];
        sumB += b[i];
    }
    if(a == b) {
        cout << "Yes\n";
        return 0;
    }
    if(sumA > sumB) {
        cout << "No\n";
        return 0;
    }
    int operations = sumB - sumA;
    int currOps = 0;
    for(int i = 0; i < n; ++i) {
        if(a[i] == b[i]) {
            continue;
        }
        if(a[i] < b[i]) {
            currOps += (b[i]-a[i]+1)/2;
            if((b[i]-a[i])%2 == 0) a[i] = b[i];
            else a[i] = b[i]+1;
        }
    }
    if(currOps > operations) {
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";
}


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

int main(){
  string strN[100] , strM[100];
  int N,M,fin=0;
  cin >> N;
  for(int i=0 ; i < N ; i++){
    cin >> strN[i];
  }
  cin >> M;
  for(int i=0 ; i < M ; i++){
    cin >> strM[i];
  }

  for(int i=0; i < N ; i++){
    int count=0;
    for(int j=0; j < N ; j++){
      if(strN[i] == strN[j]) count++;
    }
    for(int j=0; j < M; j++){
      if(strN[i] == strM[j]) count--;
    }
    if(fin < count) fin = count;
  }

  cout << fin;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define show(x) cout<<#x" = "<<x<<endl;
#define INF 0x3f3f3f3f
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> iipair;
typedef pair<unsigned,unsigned> uupair;
typedef vector<int> vec;
typedef vector<unsigned> uvec;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    long double h,a;
    cin>>h>>a;
    cout<<ceil(h/a);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=100010;
const ll mod=1e9+7;

vector<int> ip(mx,0);
 
ll gcd(ll a, ll b){ return b ? gcd(b,a%b):a; }

bool isprime(int x){
  if(x==2 || x==3){ return true; }
  if(x<2 || x%2==0){ return false; }
  
  int sqrtx = ceil(sqrt(x));
  for(int i=3; i<=sqrtx; i+=2){ if(x%i==0){ return false; } }
  return true;
}
 
void ipset(int x){                                        //x miman prime set
  for(int i=2; i<x; i++){ ip[i]=(int)isprime(i);}
}



int main(){
  ipset(200);
  int a;
  cin >> a;
  if(a<105){cout << 0 << endl;}
  if(105<=a&&a<135){cout << 1 << endl;}
  if(135<=a&&a<165){cout << 2 << endl;}
  if(165<=a&&a<189){cout << 3 << endl;}
  if(189<=a&&a<195){cout << 4 << endl;}
  if(195<=a){cout << 5 << endl;}

  return 0;
}

Measured memory_bytes: 640
package main

import (
	"fmt"
	"sort"
)

func nextInt() int {
	var x int
	fmt.Scan(&x)
	return x
}

func main() {
	n := nextInt()
	k := nextInt()

	dic := map[int]int{}
	for range make([]struct{}, n) {
		a := nextInt()
		dic[a]++
	}
	seq := []int{}
	for _, v := range dic {
		seq = append(seq, v)
	}
	sort.Ints(seq)

	cnt := 0
	for i := 0; i < len(seq)-k; i++ {
		cnt += seq[i]
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 16896
#include <iostream>
using namespace std;
int main(){
  string s;
  cin>>s;

  int n1,n2;
  n1 = (s[0]-'0')*10+s[1]-'0';
  n2 = (s[2]-'0')*10+s[3]-'0';

  bool fym=false,fmy=false;
  if(0 <n2 && n2 <13) fym = true;
  if(0 < n1 && n1 <13) fmy = true;

  if(fym){
    if(fmy) cout << "AMBIGUOUS" << endl;
    else cout << "YYMM" << endl;
  }else{
    if(fmy) cout << "MMYY" << endl;
    else cout << "NA" << endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void reverse(int b[], int a[]) {
		int k = (a.length + 1) / 2;
		int n = a.length;
		for(int i = 0; i < k; ++i) {
			int tmp = n - 2 * i - 1;
			b[i] = a[tmp];
			tmp -= 1;
			if(tmp >= 0)
			b[n - i - 1] = a[tmp];
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n, a[];
		
		n = sc.nextInt();
		a = new int[n];
		
		for(int i = 0; i < n; ++i)a[i] = sc.nextInt();
		
		sc.close();
		
		int b[];
		b = new int[n];
		
		reverse(b, a);
		
		for(int i : b)
		System.out.print(i + " ");
		System.out.println();
	}

}


Measured memory_bytes: 94112
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
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 < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

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

ll a[110];
ll a1[110][12];

int getidx[110];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    //cout << fixed << setprecision(15);

    ll N, A, B;
    cin >> N >> A >> B;

    if (N == 1)
    {
        if (A == B)
        {
            cout << 1 << endl;
        }
        else
        {
            cout << 0 << endl;
        }
    }
    else
    {
        ll lb = (N - 1) * A + B, ub = A + (N - 1) * B;

        cout << max(0LL, ub - lb + 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
main = interact proc

proc :: String -> String
proc = unlines . map step . lines
    
step :: String -> String
step line = show $ calcDigitNumber (a+b)
    where
    a = read (ws !! 0) :: Int
    b = read (ws !! 1) :: Int
    ws = words line

calcDigitNumber :: Int -> Int
calcDigitNumber n
    | n < 10 = 1
    | otherwise = 1 + calcDigitNumber (n `div` 10)

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

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string S;
cin>>S;
int year,month,day;
year=stoi(S.substr(0,4));
month=stoi(S.substr(5,2));
day=stoi(S.substr(8,2));
if(year>2019||month>4)cout<<"TBD"<<endl;
else cout<<"Heisei"<<endl;

//system("pause");
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define FOR(i, b, n) for (ll i = b; i < n; ++i)

using namespace std;
using ll = long long;
using P = pair<int, int>;
const string YES = "Yes";
const string NO = "No";

void solve(ll X) {
  cout << (X >= 30 ? YES : NO) << endl;
}

int main(){
  // int 3E4  long 2E9  ll 9E18
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll X;
  cin >> X;

  solve(X);

  return 0;
}


Measured memory_bytes: 3688
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let a: usize = sc.read();
    let b: usize = sc.read();
    let x = sc.read();
    for i in 0..b + 1 {
        let sum = a + i;
        if sum == x {
            println!("YES");
            return;
        }
    }
    println!("NO");
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352