akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  int ans=0;
  cin >> n;
  vvi A(n, vi(n,-1));  // N * M の2次元配列
  vi que(n);//更新したい人間id+1がはいる変数
  vi w(n);//先頭id
  vi match(n);//マッチングしたら自分のidが1になる
  vi matchlist(n);//マッチングしたら自分のidが配列にはいる
  int matchlistLength=0;
  

  REP(i,n)
  {
	  REP(j,n-1)
	  {
		  cin>>A[i][j];
		  A[i][j]--;
	  }
  }

//que初期化
REP(i,n){
  que[i]=i+1;
}
int qnum=n;

int cnt=0;


//最初からチェックしていく
REP(ii,n*n){
	if (qnum==0){
		cout<<"-1"<<endl;
		return 0;
	}
	REP(i,qnum){
		int q=que[i]-1;
		if (q==-1){
			break;
		}
		int p1=q;//更新したい人間1
		if (w[p1]==n-1){
			continue;
		}
		int p2=A[p1][w[p1]];//人間1が戦いたい相手
		if (A[p2][w[p2]]==p1){//マッチングしたら
		    if (match[p1]==0){
				match[p1]=1;
				matchlist[matchlistLength]=p1;
				matchlistLength++;
			}
			if (match[p2]==0){
				match[p2]=1;
				matchlist[matchlistLength]=p2;
				matchlistLength++;
			}
		}
	}//queの数ループ終了

	qnum=0;
	REP(i,matchlistLength)
	{
		int p=matchlist[i];
		w[p]++;
		cnt++;
		match[p]=0;
		que[qnum]=p+1;
		qnum++;
		//cout<<p<<" "<<ii<<endl;
	}
	matchlistLength=0;

	if (cnt==(n*(n-1))){
		ans=ii+1;
		break;
	}

}




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

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

int main() {
  int H, W;
  cin >> H >> W;
  string s, tmp1, tmp2;
  tmp1 = "##";
  
  for (int i=0; i<W; i++){
    tmp1 += '#';
  }
  cout << tmp1 << endl;
  
  for (int i=0; i<H; i++){
    cin >> s;
    tmp2 = "#";
    tmp2 += s;
    tmp2 += '#';
    cout << tmp2 << endl;
  }
  cout << tmp1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

// 最大公約数
ll gcd(ll a, ll b){
    ll c;
    if (a < b) {
        a+=b; b=a-b; a-=b;
    }
    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

// 最小公倍数
ll lcm( ll m, ll n ){
    // 引数に０がある場合は０を返す
    if ( ( 0 == m ) || ( 0 == n ) ) return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}


int main(void){
    ll a, b; cin >> a >> b;
    cout << lcm(a, b) << endl;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;

const int MOD = 1000000007;

long long dp[200000][5];

void add(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

int main() {
    string S;
    cin >> S;

    dp[0][0] = 1;

    rep(i, S.size()) {
        char c = S[i];

        for (int j = 0; j < 4; ++j) {
            if (S[i] != '?') add(dp[i + 1][j], dp[i][j]);
            else add(dp[i + 1][j], dp[i][j] * 3 % MOD);
        }

        if (S[i] == 'A' || S[i] == '?') add(dp[i + 1][1], dp[i][0]);
        if (S[i] == 'B' || S[i] == '?') add(dp[i + 1][2], dp[i][1]);
        if (S[i] == 'C' || S[i] == '?') add(dp[i + 1][3], dp[i][2]);
    }

    cout << dp[S.size()][3];
}

Measured memory_bytes: 4608
#include<iostream>
#include<string>
using namespace std;
string x;
int c,f;
int main()
{
    cin >> x;
	for (int i = 0; i < x.length(); i++)
		{
			if (x[i] == 'C')
				{
					for (int j = i + 1;j < x.length(); j++)
						{
							if (x[j] == 'F')
								{
									cout << "Yes\n";
									return 0;
								}
						}
				 } 
				  }          
	cout << "No\n";			  
    return 0;
}    

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,a,b;
  cin >> n >> a >> b;
  if((b-a)%2==0) {
    cout << "Alice" << endl;
  }
  else {
    cout << "Borys" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
template<class F, class S> istream& operator >> (istream& s, pair<F, S>& p)
{ cin >> p.first >> p.second; return s;}

template <typename T> T gcd(T a, T b) {
	if (b == 0) return abs(a);
	T r; while ((r = a % b) != 0) a = b, b = r;
	return abs(b);
}

template<class T> vector<pair<T,T>> factorize(T n)
{
    vector<pair<T,T>> factors;

    T lim = sqrt(n) + 0.1;
    
    T c = 0;
    while (n % 2 == 0) {
        n /= 2;
        c++;
    }
    if (c != 0)
        factors.push_back(make_pair(2, c));

    for (T p = 3; p <= lim; p += 2) { //cout << "p:" << p << " n:" << n <<" lim:" << lim << endl;
        T c = 0;
        while (n % p == 0) {
            n /= p;
            c++;
        }
        if (c != 0)
            factors.push_back(make_pair(p, c));
    }
    if (n != 1) {
        factors.push_back(make_pair(n, 1));
    }
    
    return factors;
}

int main()
{
    ll A, B; cin >>A>>B;
    ll G = gcd(A, B);

    vpll factors = factorize(G);

    int ans = factors.size() + 1;

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define FORN(i, x, y) for (int i = x; i <= y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define scan1(X) scanf("%d", &X)
#define scan2(X, Y) scanf("%d%d", &X, &Y)
#define scan3(X, Y, Z) scanf("%d%d%d", &X, &Y, &Z)
#define scan4(X, Y, Z, W) scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define scanl1(X) scanf("%lld", &X);
#define scanl2(X, Y) scanf("%lld%lld", &X, &Y)
#define scanl3(X, Y, Z) scanf("%lld%lld%lld", &X, &Y, &Z)
#define scanl4(X, Y, Z, W) scanf("%lld%lld%lld%lld", &X, &Y, &Z, &W)
#define print1(X) printf("%d\n", X);
#define print2(X, Y) printf("%d %d\n", X, Y);
#define print3(X, Y, Z) printf("%d %d %d\n", X, Y, Z);
#define print4(X, Y, Z, W) printf("%d %d %d %d\n", X, Y, Z, W);
#define printl1(X) printf("%lld\n", X);
#define printl2(X, Y) printf("%lld %lld\n", X, Y);
#define printl3(X, Y, Z) printf("%lld %lld %lld\n", X, Y, Z);
#define printl4(X, Y, Z, W) printf("%lld %lld %lld %lld\n", X, Y, Z, W);
#define max3(X, Y, Z) max(X, max(Y, Z))
#define max4(X, Y, Z, W) max(max(X, Y), max(Z, W))
#define min3(X, Y, Z) min(X, min(Y, Z))
#define min4(X, Y, Z, W) min(min(X, Y), min(Z, W))
#define popcount(X) __builtin_popcount(X)
#define all(x) x.begin(), x.end()
#define size(X) (int)X.size()
#define mp make_pair
#define pb push_back
#define fr first
#define sc second
#define lc(x) 2 * x
#define rc(x) 2 * x + 1
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pldld;
const long long l_inf = numeric_limits<long long>::max();
const long long l_ninf = numeric_limits<long long>::min();
const int inf = numeric_limits<int>::max();
const int ninf = numeric_limits<int>::min();
const double pi = 1.00 * acos(-1.00);
const double eps = 1e-8;
void cio(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
ll gcd(ll a, ll b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
int sq( int x ) {return x * x;}
////////////////////////////////////////////////////////////////////Header
const int maxn = 305;
double dp[maxn][maxn][maxn];
int n;
int a[4];


double getdp ( int p, int q, int r ) {
    if ( p==0 && q==0 && r==0 ) return 0;
    double &ret = dp[p][q][r];
    if ( ret > -0.9 ) return dp[p][q][r];
    ret = 0;
    ret += (double)( n - p - q - r ) / ( p + q + r);
    if ( p ) ret += (getdp(p-1, q, r) + 1) * (double) p/(p+q+r);
    if ( q ) ret += (getdp(p+1, q-1, r) + 1) * (double) q/(p+q+r);
    if ( r ) ret += (getdp(p, q+1, r-1) + 1) * (double) r/(p+q+r);
    return ret;
}

int main () {
    scan1(n);
    FORN(i, 1, n) {
        int x; scan1(x);
        a[x]++;
    }
    memset(dp, -1, sizeof(dp));
    printf("%.12lf\n", getdp(a[1], a[2], a[3]));
}

Measured memory_bytes: 225480
S = input()
slist = []

for i in range(4):
    slist.append(S[i])
    
slist.sort()
    
if slist[0] == slist[1] and slist[2] == slist[3] and slist[1] != slist[2]:
    print("Yes")
else:
    print("No")
    

Measured memory_bytes: 2940
'use strict'

const main = input => {
	const args = input.trim().split('\n')
	const x = []
	let cnt = 0

	for (let i = 1; i < args.length; i++) {
		x.push(args[i].split(' ').map(Number))
	}

	for (let i = 0; i < x.length; i++) {
		for (let j = 0; j < x.length; j++) {
			if (i >= j) continue

			let sum = 0

			for (let k = 0; k < x[i].length; k++) {
				sum += Math.pow(x[i][k] - x[j][k], 2)
			}

			if (Math.sqrt(sum) % 1 === 0) cnt++
		}
	}

	console.log(cnt)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define PI 2*acos(0.0)
#define boost ios::sync_with_stdio(false);cin.tie(0)
/*ll arr[1000000];void seive(){memset(arr,1,sizeof(arr));arr[0]=arr[1]=0;for(ll i=2;i<=(sqrt(1000000));i++){if(arr[i]){for(ll j=(i+i);j<=1000000;j+=i){arr[j]=0;}}}}*/
int main()
{
 boost;
 string str;
 cin>>str;
 ll mx=0;
 for(ll i=0;i<str.size();i++){
     mx+=(str[i]-48);
 }
 if(mx%9==0) cout<<"Yes"<<endl;
 else cout<<"No"<<endl;
    
}

Measured memory_bytes: 3740
N = int(input())
list_a = list(map(int, input().split())) 

sort_list = sorted(list_a)

for i in range(N-1):
    
    if i == 0:
        tmp = 1/2 * (sort_list[i] + sort_list[i+1])
    else:
        tmp = 1/2 * (tmp + sort_list[i+1])

print(tmp)

Measured memory_bytes: 3060
n = int(input())
v = list(map(int, input().split()))

e = []
o = []
for i in range(n):
  if i % 2 == 0:
    e.append(v[i])
  else:
    o.append(v[i])

freq_e = {}
freq_o = {}
for j in range(int(n / 2)):
  if (str(e[j]) in freq_e):
    freq_e[str(e[j])] += 1
  elif not(str(e[j]) in freq_e):
    freq_e[str(e[j])] = 1
  if (str(o[j]) in freq_o):
    freq_o[str(o[j])] += 1
  elif not(str(o[j]) in freq_o):
    freq_o[str(o[j])] = 1

freq_e_sorted = sorted(freq_e.items(), key = lambda x: -x[1])
freq_o_sorted = sorted(freq_o.items(), key = lambda x: -x[1])
if freq_e_sorted[0][0] != freq_o_sorted[0][0]:
  ans = n - freq_e_sorted[0][1] - freq_o_sorted[0][1]
elif len(freq_e_sorted) == 1 and len(freq_o_sorted) == 1:
  ans = freq_e_sorted[0][1]
elif len(freq_e_sorted) == 1 or freq_e_sorted[0][1] + freq_o_sorted[1][1] > freq_e_sorted[1][1] + freq_o_sorted[0][1]:
  ans = n - freq_e_sorted[0][1] - freq_o_sorted[1][1]
else:
  ans = n - freq_e_sorted[1][1] - freq_o_sorted[0][1]
print(ans)

Measured memory_bytes: 27140
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

class Main
{
	public static void main(String[] args) throws Exception
	{
		invoke(System.in);
//		invoke(new FileInputStream("/tmp/test.txt"));
	}

	public static void	invoke(InputStream is) throws IOException
	{
		// input
		BufferedReader	reader = new BufferedReader(new InputStreamReader(is));
		String	line = reader.readLine();

		String[]	va = line.split(" ");
		int	lsum = Integer.parseInt(va[0]) + Integer.parseInt(va[1]);
		int	rsum = Integer.parseInt(va[2]) + Integer.parseInt(va[3]);

		String	result;
		result =  ((lsum > rsum) ? "Left" : (lsum == rsum) ? "Balanced" : "Right");
		System.out.println(result);

	}

}

Measured memory_bytes: 22484
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  double a,b,c,d,e,f;
  while(cin>>a){
    cin>>b>>c>>d>>e>>f;
    double x=(c*e-b*f)/(a*e-b*d);
    double y=(a*f-c*d)/(a*e-b*d);
    if(x==0)x=0;
    if(y==0)y=0;
    printf("%.3f %.3f\n",x,y);
  }
}

    
    /*
      ey=f-dx
      y=(f-dx)/e
      ax+b(f-dx)/e=c
      aex+df-bdx=ce
      (ae-bd)x=ce-df
      x=(ce-df)/(ae-bd)

  y=(f-dx)/e
  y=(f



a b  x  c
d e  y  f

x  c  e -b
y  f  -d a  /(ae-bd)*/

Measured memory_bytes: 1236
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
using namespace std;
#define ll long long
#include <cstdint>

int main() {
	int ans = 0;
	int a, b;
	cin >> a >> b;
	for (int i = 1; i < a; i++) {
		ans++;
	}
	if (a <= b)ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var rdr = bufio.NewReaderSize(os.Stdin, 1024)

func readLine() string {
	buf := make([]byte, 0, 1024)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func atoi(s string) int {
	i, e := strconv.Atoi(s)
	if e != nil {
		panic(e)
	}
	return i
}

func readStringArray() []string {
	return strings.Split(strings.TrimSpace(readLine()), " ")
}

func readInt() int {
	return atoi(readLine())
}

func readIntArray() []int {
	var a []int
	sa := readStringArray()
	for _, s := range sa {
		a = append(a, atoi(s))
	}
	return a
}

func main() {
	n := readInt()
	for i := 1; i <= 9; i++ {
		if n/i <= 9 && n%i == 0 {
			fmt.Println("Yes")
			os.Exit(0)
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int read()
{
	char s;
	int k=0,base=1;
	while((s=getchar())!='-'&&s!=EOF&&!(s>='0'&&s<='9'));
	if(s==EOF)exit(0);
	if(s=='-')base=-1,s=getchar();
	while(s>='0'&&s<='9')
	{
		k=k*10+(s-'0');
		s=getchar();
	}
	return k*base;
}
void write(int x)
{
	if(x<0)
	{
		putchar('-');
		write(-x);
	}
	else
	{
		if(x/10)write(x/10);
		putchar(x%10+'0');
	}
}
const int maxn=2e3+100;
int n,X;
int to[maxn<<1],ne[maxn<<1],po[maxn],id;
int dp[2][6000],d[maxn];
int a[maxn],b[maxn];
inline void add(int x,int y)
{
	id++;
	to[id]=y;ne[id]=po[x];po[x]=id;
}
bool dfs(int x,int fa)
{
	int y;
//	cout<<x<<" ";
	if (d[x]==1&&x!=1) return true;
//	cout<<x<<" ";
	for (int i=po[x];i;i=ne[i])
	{
		y=to[i];
		if (y==fa) continue;
		if (!dfs(to[i],x)) return false;
	}
//	printf("%d\n",x);
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	int cur=0,sum=0;
	for (int i=po[x];i;i=ne[i])
	{
		y=to[i];
		if (y==fa) continue;
		cur^=1;
		memset(dp[cur],0,sizeof(dp[cur]));
		sum+=a[y]+b[y];
		for (int j=a[x];j>=a[y];j--)
		{
			dp[cur][j]|=dp[cur^1][j-a[y]];
		}
		for (int j=a[x];j>=b[y];j--)
		{
			dp[cur][j]|=dp[cur^1][j-b[y]];
		}
	}
	for (int j=a[x];j>=0;j--)
	{
//		printf("%d ",j);
		if (dp[cur][j])
		{
			b[x]=sum-j;
//			printf("===%d\n",b[x]);
			return true;
		}
	}
	return false;
}
int main()
{
	n=read();
	for (int i=2;i<=n;i++)
	{
		X=read();add(X,i);add(i,X);d[i]++;d[X]++;
	}
	if (n==1) 
	{
		printf("POSSIBLE\n");
		return 0;
	}
	for (int i=1;i<=n;i++) a[i]=read();
	if (dfs(1,0))
		printf("POSSIBLE"); else printf("IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,s;
  cin >> n;
  set<ll> st;
  vector<ll> v;
  if(n==3){
    cout<<"2 5 63\n";
  }else if(n==4){
    cout <<"2 5 20 63\n";
  }else if(n==5){
    cout <<"2 5 20 30 63\n";
  }else{
    st.insert(2);
    st.insert(3);
    for(int i=1;i<=30000;i++){
      if(i%6==0||i%6==2||i%6==3||i%6==4){
        v.push_back(i);
      }
    }
    for(int i=0;i<n;i++){
      st.insert(v[i]);
      s+=v[i];
    }
    ll j=n;
    if(s%6==2){
      st.erase(8);
      while(v[j]%6!=0) j++;
      st.insert(v[j]);

    }else if(s%6==3){
      st.erase(9);
      while(v[j]%6!=0) j++;
      st.insert(v[j]);

    }else if(s%6==5){
      st.erase(9);
      while(v[j]%6!=4) j++;
      st.insert(v[j]);
    }
    for(auto i:st){
      cout << i<<" ";
    }
    cout << endl;
  }
}


Measured memory_bytes: 1404
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;

int main(void){
    ll a, b, c, d;
    cin>>a>>b>>c>>d;
    cout<<((abs(c-a)<=d || (abs(a-b)<=d && abs(c-b)<=d)) ? "Yes" : "No")<<endl;
    return 0;
}


Measured memory_bytes: 3572
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
from itertools import combinations, product
#import bisect# lower_bound etc
#import numpy as np
def run():
    N,K = read().split()

    N = list(map(int,N))
    K = int(K)
    max_i = len(N)
    dp2 = [0] * max_i
    r = 0
    for i, v in enumerate(N):
        if v != 0:
            r += 1
        dp2[i] = r

    dp1 = [[0] * (K+1) for _ in range(max_i)]

    dp1[0][1] = int(N[0]-1)
    dp1[0][0] = 1
    for i in range(1, max_i):
        for j in range(0, K+1):
            if j == 0:
                dp1[i][j] += dp1[i - 1][j]
            else:
                dp1[i][j] += dp1[i - 1][j] + dp1[i - 1][j - 1] * 9
        if N[i] == 0:continue
        if dp2[i-1] <= K:
            dp1[i][dp2[i-1]] += 1
        if dp2[i-1] < K:
            dp1[i][dp2[i-1]+1] += N[i] - 1
    plus = 0
    if dp2[-1] == K:
        plus = 1
    print(dp1[max_i-1][K] + plus)




if __name__ == "__main__":
    run()

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()
	b := nextInts(n)

	ans := make([]int, n)
	for i := 0; i < n; i++ {
		for j := len(b) - 1; j >= 0; j-- {
			if b[j] == j+1 {
				ans[n-1-i] = j + 1
				b = delete(b, j)
				break
			}
		}
		if ans[n-1-i] == 0 {
			break
		}
	}

	if ans[0] == 0 {
		puts(-1)
	} else {
		for i := range ans {
			puts(ans[i])
		}
	}
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func delete(a []int, i int) []int {
	a = append(a[:i], a[i+1:]...)
	res := make([]int, len(a))
	copy(res, a)
	return res
}


Measured memory_bytes: 768
#include <cstdio>
#include <algorithm>
using namespace std;
int n, a, MAX = 0, MIN = 1000000001;
int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a);
		MAX = max(MAX, a);
		MIN = min(MIN, a);
	}
	printf("%d", MAX - MIN);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;

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

    string s;
    cin >> s;
    s.push_back('X');
    int ans = 0, cnt = 0;
    rep(i, s.size())
    {
        if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C')
            cnt++;
        else
            ans = max(ans, cnt), cnt = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
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; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<60;
 
int main() {
	ll n,m,k;
  	cin >> n >> m;
  	vector<ll> tab(m, 0);
  	ll ans = 0;
  	rep(i,n){
      cin >> k;
      vector<ll> a(k);
      rep(j,k) {
        cin >> a[j];
        ++tab[a[j] - 1];
      }
    }
  
  	for(auto itr = tab.begin(); itr != tab.end(); ++itr){
      if(*itr == n){
        ++ans;
      }
    }
  	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll =long long;
using P = pair<int,int>;

int main(int argc, const char * argv[]) {
    
    int N, M;
    map<string, int> blue;
    map<string, int> red;
    
    cin >> N;
    for(int i=0; i<N; i++){
        string s;
        cin >> s;
        
        blue[s]++;
    }
    
    cin >> M;
    for(int i=0; i<M; i++){
        string s;
        cin >> s;
        
        red[s]++;
    }
    
    int m=0;
    for( auto i = blue.begin(); i != blue.end() ; ++i ) {
        int d=0;
        if(red.count(i->first) > 0) d=red[i->first];
        m = max(i->second-d, m);
    }
    
    cout << m << endl;
    
    return 0;
}


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

int main() {
  int s;
  cin >> s;
  vector<ll> dp(s+1);
  dp[0] = 1;
  ll x = 0;
  for(int i = 1;i <= s;i++) {
    if((i - 3) >= 0) {
      x += dp[i-3];
      x %= mod;
    }
    dp[i] = x;
  }
  cout << dp[s] << endl;
}

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

int main(){
	string a;
	int b = 0, j, k;
	getline(cin, a);
	for(int i = 0; i < a.length(); i++){
		if(a[i] == 'C'){
			for(int j = i; j < a.length(); j++){
				if(a[j] == 'F'){
					cout << "Yes" <<endl;
					return 0;
				}
			}
		}
	}
	cout << "No" <<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    string s[n];
    map<string,ll> m;
    m.clear();
    for(ll i=0;i<n;i++)
    {
        cin>>s[i];
        m[s[i]]++;
    }
    cout<<m.size()<<endl;
    return 0;
}


Measured memory_bytes: 25500
#include<iostream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>

using namespace std;
int main(){

  string str;

  while(true){
    getline(cin , str); 

    if(str.size()==1 && ((int)str[0] - 48) == 0 ) break;

    int sum = 0;
    for(int i=0;i<str.size();i++){
      sum += (int)str[i] - 48;
    }
    cout << sum << endl;
  }

}


Measured memory_bytes: 3196
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cmath> 
#include <cctype>

using namespace std;

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    
    for (int i = A; i < A + K && i <= B; i++) {
        cout << i << endl;
    }
    for (int i = max(B - K + 1, A + K); i <= B; i++) {
        cout << i << endl;
    }

    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a.at(i);
    }
    int all = 1, bad = 1;
    for(int i = 0; i < n; i++){
        all *= 3;
        if (a.at(i) % 2 == 0)
            bad *= 2;
    }
    cout << all - bad << endl;
}


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

int main() {
	string s;
	cin >> s;
	string ans;
	ans = "Yes";
	for (unsigned int i = 0; i < s.length(); i++) {
		if (i % 2 == 0) {
			if (s[i] != 'R' && s[i] != 'U' && s[i] != 'D') {
				ans = "No";
			}
		}
		else {
			if (s[i] != 'L' && s[i] != 'U' && s[i] != 'D') {
				ans = "No";
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int, int>> adj[100001];
vector<int> ans(100001);

void dfs(int now, int prev, int col){
	ans[now]=col;
	for(auto u:adj[now])
        if(u.first!=prev) dfs(u.first,now,col^(u.second&1));
}

int main(){
	cin>>n;
    int i,u,v,w;
	for(i=1;i<n;i++){
		cin>>u>>v>>w;
		adj[u].emplace_back(v,w);
		adj[v].emplace_back(u,w);
	}
	dfs(1,0,0);
	for(i=1;i<=n;i++) cout<<ans[i]<<endl;
}

Measured memory_bytes: 8448
#include<bits/stdc++.h>
#define asd ios :: sync_with_stdio(0),cin.tie(0),cout.tie(0)

using namespace std;

typedef long long ll;

const int maxn = 1e5 + 11;

int n, k,mx;
bool m[maxn];

int main(){

asd;

cin >> n >> k;

    for (int i = 1; i <= k; i ++ ){
        int x;
        cin >> x;
        m[x] = 1;
    }

    for(int i=n;;i++){
        int s = i;
        bool ok = 1;
        while(s != 0){
            int last = s % 10;
            if(m[last])ok = 0;
            s /= 10;
        }
        if(ok){
            cout << i;
           break;
        }
    }

return 0;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
const ll MOD=1e9+7;

void solve(vector<ll> &a,vector<ll> &b,vector<ll> &re){
  priority_queue<ll,vector<ll>,greater<ll>> q(all(a));
  ll sum=accumulate(all(a),0ll);
  int n=a.size();
  re.resize(n+1);
  re[0]=sum;
  rep(i,n){
    sum+=b[i]; q.push(b[i]);
    sum-=q.top(); q.pop();
    re[i+1]=sum;
  }
  //out(a,b,re,1);
}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n;
  cin>>n;
  vector<ll> a[3];
  rep(j,3){
    a[j].resize(n);
    rep(i,n) cin>>a[j][i];
  }
  vector<ll> l,r;
  solve(a[0],a[1],l);
  reverse(all(a[1]));
  reps(i,1,3)rep(j,n) a[i][j]*=-1;
  solve(a[2],a[1],r);
  reverse(all(r));
  ll re=-1e15;
  rep(i,n+1) MX(re,l[i]+r[i]);
  cout<<re<<endl;
  return 0;
}


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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 10000000000000007ll;

const double eps = 1e-10;

// #include "segtree_push.h"

// del

i64 a, b, c, d;

i64 gcd(i64 a, i64 b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

i64 solve(i64 x) {
    return b / x - (a - 1) / x;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> a >> b >> c >> d;

    i64 g = gcd(c, d);

    i64 R = (b - a + 1) - (solve(c) + solve(d) - solve(c * d / g));
    cout << R << endl;

    return 0;
}

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n; cin >> n;
	vector<int> a(n), b(n), c(n + 1);
	for (int i = 0; i < n; i++) cin >> a[i], b[i] = a[i];
	sort(b.begin(), b.end());
	b.resize(unique(b.begin(), b.end()) - b.begin());
	long long tot = (long long)n * (n + 1) / 2;
	long long idx = (tot + 2) / 2;
	int l = -1, r = b.size() - 1;
	auto possible = [&](int x) {
		vector<vector<int>> C(2, vector<int>(n * 2 + 1, 0));
		auto get = [&](int id, int x) {
			int ret = 0;
			for (; x > 0; x -= x & -x) ret += C[id][x];
			return ret;
		};
		auto update = [&](int id, int x) {
			for (; x <= n * 2; x += x & -x) C[id][x]++;
		};
		for (int i = 0; i <= n; i++) c[i] = 0;
		long long cnt = 0;
		int addv = n / 2 + 1;
		update(0, addv);
		for (int i = 1; i <= n; i++) {
			c[i] = c[i - 1];
			if (a[i - 1] <= x) c[i]++;
			if (i & 1) {
				int v = c[i] - i / 2 + addv;
				cnt += get(0, v - 1) + get(1, v - 1);
			} else {
				int v1 = c[i] - (i - 1) / 2 + addv, v2 = c[i] - i / 2 + addv;
				cnt += get(1, v1 - 1) + get(0, v2 - 1);
			}
			int nv = c[i] - i / 2 + addv;
			update(i & 1, nv);
		}
		return cnt >= idx;
	};
	while (r - l > 1) {
		int m = r + l >> 1;
		if (possible(b[m])) r = m;
		else l = m;
	}
	cout << b[r] << endl;
	return 0;
}


Measured memory_bytes: 6712
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int idx = 0;
		int[][] ans = new int[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				ans[i][j] = idx + 1;
				a[idx]--;
				if (a[idx] == 0) {
					idx++;
				}
			}
		}
		for (int i = 0; i < h; i++) {
			if (i % 2 == 1) {
				reverse(ans[i]);
			}
		}
		for (int i = 0; i < h; i++) {
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < w; j++) {
				sb.append(ans[i][j]).append(' ');
			}
			sb.deleteCharAt(sb.length() - 1);
			System.out.println(sb.toString());
		}
	}

	static void reverse(int[] a) {
		for (int i = 0; i < a.length / 2; i++) {
			int tmp = a[i];
			a[i] = a[a.length - 1 - i];
			a[a.length - 1 - i] = tmp;
		}
	}
}


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

int main()
{
  string o, e;
  cin >> o >> e;
  int i;
  for(i = 0; i < e.size(); i++)
  {
    cout << o.at(i) << e.at(i);
  }
  if(e.size() == o.size())
  {
    cout << endl;
  }
  else
  {
    cout << o.at(o.size()-1) << endl;
  }
}

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

typedef long long ll;

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

//--------------------
#define MAX_N 200000

vector<int> V(MAX_N+1);

int main() {

  int n, k, m;
  cin >> n >> k;
  rep(i, n) {
    cin >> m;
    ++V[m-1];
  }

  sort(V.begin(), V.end(), greater<int>());
  ll ans = 0;
  rep(i, k) {
    ans += V[i];
  }

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


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
int INF = INT_MAX / 2;
double EPS = 1e-10;

int main() {
	double golden = (1 + sqrt(5)) / 2;
	vector<double> x(10), y(10);
	for (int i = 0; i < 10; i++) {
		double r = (i % 2 ? 1 : golden * golden);
		x[i] = r * cos(i * M_PI/5);
		y[i] = r * sin(i * M_PI/5);
	}
	double S = 0;
	for (int i = 0; i < 10; i++) {
		double x1 = x[i], y1 = y[i], x2 = x[(i + 1) % 10], y2 = y[(i + 1) % 10];
		S += (x1 * y2 - x2 * y1) / 2;
	}
	int n; cin >> n;
	for (int k = 0; k < n; k++) {
		double s; cin >> s; s += 0.5;
		double x0 = -3600 + k%10 * 800, y0 = -3600 + k/10 * 800, r = sqrt(s / S);
		cout << k + 1 << endl;
		for (int i = 0; i < 10; i++)
			printf("%.9f %.9f\n", x0 + r * x[i], y0 + r * y[i]);
	}
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REPE(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void chmax(T& a, T b) { if(a > b) a = b; }
template<class T> void chmin(T& a, T b) { if(a < b) b = a; }
typedef long long ll;

int main() {
    int a, b, c, k; cin >> a >> b >> c >> k;
    int m = max({a, b, c});
    int sum = a + b + c;
    sum -= m;
    while(k > 0){
        m *= 2;
        k--;
    }
    cout << m + sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;
typedef std::vector<long long> vl;
typedef std::vector<std::vector<long long>> vvl;
#define out(x) cout<<x<<"\n";
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}
 
ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}

using namespace std;

void solve()
{
	int n, m;
	cin >> n >> m;
	vector<ll> x(n), y(n), z(n);
	rep(i,n){
		cin >> x[i] >> y[i] >> z[i];
	}
	ll ans = 0;
	for (int bit = 0; bit < (1 << 3); ++bit)
	{
		vector<ll> v(n);
		if (bit & (1 << 2)){
			rep(i,n)v[i] += x[i];
		}
		else
			rep(i, n) v[i] -= x[i];
		if(bit&(1<<1)){
			rep(i, n) v[i] += y[i];
		}
		else
			rep(i, n) v[i] -= y[i];
		if(bit&(1<<0)){
			rep(i, n) v[i] += z[i];
		}
		else
			rep(i, n) v[i] -= z[i];
		sort(rall(v));
		ll sum = 0;
		rep(i, m)
		{
			sum += v[i];
		}
		chmax(ans, sum);
	}
	cout << ans;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);
    solve();
    return 0;
}


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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int ans = 0;
    if (a%2 != b%2) {
        if (a%2 != c%2) b++,c++,ans++;
        else a++,c++,ans++;
    } else if (a%2 != c%2) a++,b++,ans++;
    int m = max({a,b,c});
    ans += (m-a)/2+(m-b)/2+(m-c)/2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 1000000000000
#define int long long int
#define hell (int)(1e9+7)

using namespace std;

void solve(){
    int x;
    cin>>x;
    int res=100;
    for(int ans=1;;ans++){
        if(res>=x){
            cout<<ans-1;
            return;
        }
        res=res+res/100;
    }
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main(){
  int N, L;
  cin >> N >> L;
  int s=0, m=0;
  for(int i=1; i<N; i++){
    int t = L + i;
    if(abs(t) < abs(L+m)){
      s += L+m;
      m = i;
    }else{
      s += L+i;
    }
  }
  cout << s << endl;
  return 0;
}

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

using namespace std;
typedef long long ll;
const int MAXN = 200010;

int n, a[MAXN];

int main() {
	scanf( "%d", &n );
	for( int i = 0; i < n; ++i ) scanf( "%d", a+i );
	ll sum = 0;
	for( int i = 0; i < n; ++i ) sum += a[i];
	ll ans = 1e18, now = 0;
	for( int i = 0; i < n-1; ++i ) {
		now += a[i];
		ans = min( ans, abs(now - (sum - now)) );
	}
	printf( "%d\n", ans );
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue> 
 
using namespace std;
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	int N;
 
	cin >> N;
 
	vector<int> P(N);
	vector<bool> w(N);

	int count = 1;

	int min;

	cin >> min;

 
	for(int i = 1; i < N; i++) {
		int x;
		cin >> x;
		if(x <= min) {
			min = x;
			count++;
		}
	}
 
	cout << count << endl;
}

Measured memory_bytes: 1024
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define inf 1e10
#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(int i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define veci vector<int>
#define vecl vector<long long>
#define FORI(a,b,c) for(int a=b;a<c;a++)
#define FORD(a,b,c) for(int a=b;a>c;a--)
#define adj(N) vector<vector<int>> ADJ(N+1)
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

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


    cout<<fixed<<setprecision(11);
	READV(W);
	READV(H);
	READV(x);
	READV(y);
	ld A=(((ld)W)*((ld)H))/2;
	cout<<A<<" ";
	if(((ld)W)/2==(ld)x && ((ld)H)/2==(ld)y)
	{
		cout<<1<<endl;
	}
	else
	{
		cout<<0<<endl;
	}

	return 0;
}

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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    for (int i = 1; i < n; i++) {
        if (a[i] < a[i-1]) {
            ans += a[i-1]-a[i];
            a[i] = a[i-1];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4044
#include<bits/stdc++.h>
using namespace std;
int main()
{
    vector<string>s;
    string a;
    int n;
    cin >> n;
    for(int i=0; i<n; i++)
    {
        cin >> a;
        s.push_back(a);
    }
    sort(s.begin(),s.end());
    auto last=unique(s.begin(),s.end());
    s.erase(last,s.end());
    cout << s.size() << endl;
    return 0;
}


Measured memory_bytes: 11648
N,M,X = map(int,input().split())
item = []
result=[]
for x in range(N):
    C = list(map(int,input().split()))
    item.append(C)
n = len(item)
for i in range(2**n):
    A = [0]*M
    total = 0
    xx = 0
    for j in range(n):
        if ((i >> j) & 1):
            for m in range(M):
                A[m]+=item[j][m+1]
            total += item[j][0]
    for mm in range(M):
        if A[mm]>=X:
            xx+=1
    if xx==M:
        result.append(total)
if result==[]:
    print(-1)
    exit()
else:
    print(min(result))


Measured memory_bytes: 9300
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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


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

template<class Monoid> struct SegTree {
    using Func = function<Monoid(Monoid, Monoid)>;
    const Func F;
    const Monoid UNITY;
    int SIZE_R;
    vector<Monoid> dat;
    
    SegTree(int n, const Func f, const Monoid &unity): F(f), UNITY(unity) { init(n); }
    void init(int n) {
        SIZE_R = 1;
        while (SIZE_R < n) SIZE_R *= 2;
        dat.assign(SIZE_R * 2, UNITY);
    }
    
    /* set, a is 0-indexed */
    void set(int a, const Monoid &v) { dat[a + SIZE_R] = v; }
    void build() {
        for (int k = SIZE_R - 1; k > 0; --k)
            dat[k] = F(dat[k*2], dat[k*2+1]);
    }
    
    /* update a, a is 0-indexed */
    void update(int a, const Monoid &v) {
        int k = a + SIZE_R;
        dat[k] = v;
        while (k >>= 1) dat[k] = F(dat[k*2], dat[k*2+1]);
    }
    
    /* get [a, b), a and b are 0-indexed */
    Monoid get(int a, int b) {
        Monoid vleft = UNITY, vright = UNITY;
        for (int left = a + SIZE_R, right = b + SIZE_R; left < right; left >>= 1, right >>= 1) {
            if (left & 1) vleft = F(vleft, dat[left++]);
            if (right & 1) vright = F(dat[--right], vright);
        }
        return F(vleft, vright);
    }
    inline Monoid operator [] (int a) { return dat[a + SIZE_R]; }
    
    /* debug */
    void print() {
        for (int i = 0; i < SIZE_R; ++i) {
            cout << (*this)[i];
            if (i != SIZE_R-1) cout << ",";
        }
        cout << endl;
    }
};

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

    ll place[N+1];
    for(int i=1;i<=N;i++){
        ll a;
        cin>>a;
        place[a]=i;
    }

    ll ans=0;
    set<ll> used={0,N+1};
    for(int i=1;i<=N;i++){
        ll r,l;
        auto itr = used.lower_bound(place[i]);
        r = *itr;
        l = *(--itr);
        ans+=i*(place[i]-l)*(r-place[i]);
        used.insert(place[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 11264
#include <stdio.h>

int main(void){
    int x0, y0, x1, y1;
    int xl, yl;
    scanf("%d %d %d %d", &x0, &y0, &x1, &y1);

    xl = x1 - x0;
    yl = y1 - y0;

    for(int i = 0; i < yl; i++) printf("%c", 'U');
    for(int i = 0; i < xl; i++) printf("%c", 'R');
    for(int i = 0; i < yl; i++) printf("%c", 'D');
    for(int i = 0; i < xl; i++) printf("%c", 'L');

    printf("%c", 'L');
    for(int i = 0; i < yl + 1; i++) printf("%c", 'U');
    for(int i = 0; i < xl + 1; i++) printf("%c", 'R');
    printf("%c", 'D');

    printf("%c", 'R');
    for(int i = 0; i < yl + 1; i++) printf("%c", 'D');
    for(int i = 0; i < xl + 1; i++) printf("%c", 'L');
    printf("%c\n", 'U');

    return 0;
}


Measured memory_bytes: 1700
// package app;

import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);

        // final String N = sc.next();

        final int A = sc.nextInt();
        final int B = sc.nextInt();
        // final int N = sc.nextInt();
        // final int D = sc.nextInt();
        // System.out.println();

        boolean result = (A % 3 == 0) || (B % 3 == 0) || (( A + B ) % 3 == 0);

        System.out.println(result ? "Possible" : "Impossible");

        // System.out.println(A <= X && A + B >= X ? "YES" : "NO");

    }
}

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

using namespace std;

const int N=271199;

int main(){
	#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	#endif
	ios::sync_with_stdio(false);cin.tie(0);
	/*Input*/
	int n;
	cin >> n;
	vector<int> a(n),b(n),c(n);
	for (int i=0;i<n;i++)
		cin >> a[i] >> b[i] >> c[i];
	vector<int> dp(3,0);
	for (int i=0;i<n;i++){
		int aa=dp[0],bb=dp[1],cc=dp[2];
		dp[0]=max(bb+a[i],cc+a[i]);
		dp[1]=max(aa+b[i],cc+b[i]);
		dp[2]=max(aa+c[i],bb+c[i]);
	}
	cout << max(max(dp[0],dp[1]),dp[2]) << '\n';
	/*Process*/
	//Ideas:
	/*Out*/
	return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>
#define INF 1000000
#define W 0
#define G 1
#define B 2
int Prim(void);
int n,A[100][100];
 
int main()
{
  int i,j;
 
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&A[i][j]);
      if(A[i][j]==-1) A[i][j]=INF;      
    }
  }
 
  printf("%d\n",Prim());
  return 0;
}
 
int Prim(void)
{
  int i,k,kv,min,sum=0;
  int dp[100],pr[100],col[100];
 
  for(i=0;i<n;i++){
    dp[i]=INF;
    pr[i]=-1;
    col[i]=W;
  }
   
  dp[0]=0;
  while(1){
    min=INF;
    k=-1;
    for(i=0;i<n;i++){
      if(dp[i]<min && col[i]!=B){
    k=i;
    min=dp[i];
      }
    }
     
    if(k==-1) break;
    col[k]=B;
    for(kv=0;kv<n;kv++){
      if(col[kv]!=B && A[k][kv]!=INF){
    if(A[k][kv]<dp[kv]){
      dp[kv]=A[k][kv];
      pr[kv]=k;
      col[kv]=G;
    }
      }
    }
  }
   
  for(i=0;i<n;i++){
    if(pr[i]!=-1) sum+=A[i][pr[i]];
  }
  return sum;
}

Measured memory_bytes: 636