akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;//KIHBR
char a[110],b[110];
int pd(int cd)
{
	if(cd!=5)return 0;
	if(b[0]!='K')return 0;
	if(b[1]!='I')return 0;
	if(b[2]!='H')return 0;
	if(b[3]!='B')return 0;
	if(b[4]!='R')return 0;
	return 1;	
}
int main()
{
	int i=0,anm=0,j=0;
	char t;
	scanf("%s",&a);
	int acd=strlen(a);
	for(int k=0;k<acd;k++)
	{
		if(a[k]!='A')
		{
			b[j++]=a[k];
		}
		else
		{
			int qwertyuiop=k-anm;
			if(qwertyuiop!=0&&qwertyuiop!=3&&qwertyuiop!=4&&qwertyuiop!=5)
			{
				printf("NO");
				return 0;
			}
			if(a[k+1]=='A')
			{
				printf("NO");
				return 0;
			}
			anm++;
		}
	}
	if(pd(j)==0||anm>4)
	{
		printf("NO");
		return 0;
	}
	printf("YES");
	return 0;
}

Measured memory_bytes: 256
program colon
implicit none
integer a, b, h, m
double precision p
double precision x2
read *, a, b, h, m
!print *, a
!print *, b
!print *, h
!print *, m
p = 4d0*datan(1d0)
!print *, m/60.
!print *, h/12. + m/720.
x2 = a**2 + b**2 - 2d0 * a * b * dcos((h/12d0-m*11d0/720d0)*2d0*p)
print *, sqrt(x2)
end program

Measured memory_bytes: 3312
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<math.h>
using namespace std;
int a,b,c;
int k;
int main()
{
    int max1;
    scanf("%d%d%d",&a,&b,&c);
    scanf("%d",&k);
    max1=max(max(a,b),c)*pow(2,k);
    max1+=a+b+c-max(max(a,b),c);
    printf("%d",max1);


    //cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <functional>
#include <stack>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <array>
#include <climits>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef long double LD;


const ll MOD = 10e9 + 7;
const ll INF = LLONG_MAX;
const ll MAX_N = 10e5;
const LD EPS = 10e-7;
const LD PI = 3.14159265359;

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



int main() {
	int n;
	string s;
	cin >> n >> s;
	int flag=1;
	while (flag != 0) {
		flag = 0;
		int f=0,p=0;
		for (int i = 0; i < s.size(); i++) {
			if (s[i] == '(') {
				f++;
			}
			else {
				if (f > 0)f--;
				else {
					flag = 1;
					break;
				}
			}
			if (f == 0 && i+1 < s.size() && s[i]!=')')p = i+1;
		}
		if (f > 0)flag = 2;
		if (flag == 1) {
			s.insert(s.begin() + p, '(');
		}
		if (flag == 2) {
			s.push_back(')');
		}
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main()
{
    ll N, K;
    cin >> N >> K;

    ll ans = 0;
    if (N == 0)
    {
        ans = 1;
    }
    while (N > 0)
    {
        ++ans;
        N /= K;
    }

    OUT(ans);
}


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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

int main() {
    int n,m,X,Y;cin>>n>>m>>X>>Y;
    vector<int>x(n+1),y(m+1);
    x[n]=X;
    y[m]=Y;

    rep(i,n){
        cin>>x[i];
    }
    rep(i,m){
        cin>>y[i];
    }

    sort(x.begin(),x.end());
    sort(y.begin(),y.end());

    if(x[n]<y[0]){
        cout<<"No War"<<endl;
        return 0;
    }
    cout<<"War"<<endl;

}


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


int main(){
  int n;
  cin >> n;
  bool f = false;
  for(int i = 0; i < 9; i++){
    for(int j = 0; j < 9; j++){
      if(n == (i+1)*(j+1)){cout << "Yes" << endl; f = true; break;}
    }
    if(f){break;}
  }

  if(!f){cout << "No" << endl;}

  



}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int a = scanner.nextInt();
		int b = scanner.nextInt();

		int height_l =0;
		for(int i=1;i<(b-a);i++) {
			height_l += i;
		}
		System.out.println(height_l-a);

	}

}


Measured memory_bytes: 22740
import sys
p = [r for r in sys.stdin.read().split('\n') if r != '']
n = int(p[0])
a = [int(c) for c in p[1].split()]
a.sort()
x = 1
t = 0
for i in reversed(a[1:]):
    t += i / x
    x *= 2
print(t / 2 + a[0] / x)

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
s = input()
state = -1
a = int(s[0])*10+int(s[1])
c = int(s[2])*10+int(s[3])
state="NA"
if a < 13 and a > 0:
  state = "MMYY"
if c < 13 and c > 0:
  if state == "MMYY":
    state = "AMBIGUOUS"
  else:
    state = "YYMM"
print(state)

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

int main(){
    int N;
    cin >> N;
    int val =  N/ 1.08;
    for (int i = 0;i<3;i++){    
        if( int((val+i)*1.08) == N){
            cout << val+i;
            return 0;
        }
    }
    cout << ":(";
    return 0;
}


Measured memory_bytes: 256
<?php
$n=trim(fgets(STDIN));
$i=0;
while($i<$n){
  $a[]=trim(fgets(STDIN));
  ++$i;
}
$b=array_count_values($a);
$c=count($b);
if($c!=$n){
  echo "No";
}else{
  $j=0;
  while($j<$n-1){
    $k=strlen($a[$j]);
    if($a[$j][$k-1]==$a[$j+1][0]){
      --$i;
    }else{
      echo "No";
      exit;
    }
    ++$j;
  }
  echo "Yes";
}

Measured memory_bytes: 4856
n = int(input())
h = list(map(int, input().split()))
#b = list(map(int, input().split()))
flag = [0]*n
for i in reversed(range(1, n)):
    if h[i] < h[i-1]:
        h[i-1] -= 1

for i in range(n-1):
    if h[i] > h[i+1]:
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 14396
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007
dire4 = [(1,0), (0,1), (-1,0), (0,-1)]
dire8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]

N, M = LI()
ab = LIR(M)

ab = sorted(ab, key=lambda x: (x[1], x[0]))

before = 0
ans = 0
for ai, bi in ab:
    if (ai <= before):
        continue
    else:
        ans += 1
        before = bi-1
print(ans)

"""
left = [0]*N
right = [0]*N

for ai, bi in ab:
    left[ai-1] = 1
    right[bi-1] = 1

l = N-1
r = N-1
ans = 0

flag = False
while (l>=0):
    if (left[l]):
        while (r>l):
            if (right[r]):
                flag = True
            r -= 1
        if (flag):
            ans += 1
            flag = False
    l -= 1

print(ans)
"""

Measured memory_bytes: 58032
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
const ll mod=1e9+7;
const ll N = 2e5+10;





void solve(){
    
    ll n=0,k=0,m=0,a=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        if(i%3==0||i%5==0){
            continue;
        }
        else{
            k+=i;
        }

    }
    cout<<k<<"\n";


        
}
        
        

int main(){
        
    
        ios_base::sync_with_stdio(0);
        cin.tie(0);cout.tie(0);
        ll T=1;
        //cin>>T;
        for (ll i = 1; i <=T; i++) {
            //cout<<"Case #"<<i<<": ";
            solve();
        }
            
            
        return 0;
}


Measured memory_bytes: 3652
K=int(input())
A=list(map(int,input().split()))

def g(n):
    for a in A:
        n=n-n%a
    return n

a_max=max(A)
l=1
r=2+K*a_max
while r-l>1:
    m=(l+r)//2
    if g(m)>=2:
        r=m
    else:
        l=m
l0=r

l=1
r=2+K*a_max
while r-l>1:
    m=(l+r)//2
    if g(m)<=2:
        l=m
    else:
        r=m
r0=l

if l0>r0:
    print(-1)
else:
    print(l0,r0)

Measured memory_bytes: 63856
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define Check system("pause")
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)



int main()
{
	ios::sync_with_stdio(false);
	int h1,h2,m1,m2,k,w=0;
	cin>>h1>>m1>>h2>>m2>>k;
	while(h1!=h2||m1!=m2)
	{
		m1++;
		w++;
		if(m1==60)
		h1++,m1=0;
	}
	cout<<w-k;
	return 0;
}




Measured memory_bytes: 3612
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int h = saori.saori_hayami();
		int w = saori.saori_hayami();
		char[][] a = new char[h+2][w+2];
		for(int i = 0;i < h+2;i++){
			for(int j = 0;j < w+2;j++){
				a[i][j] = '#';
			}
		}
		for(int i = 1;i <= h;i++){
			String str = saori.nextHayami();
			for(int j = 0;j < w;j++){
				a[i][j+1] = str.charAt(j);
			}
		}
		for(int i = 0;i < h+2;i++){
			for(int j = 0;j < w+2;j++){
				System.out.print(a[i][j]);
			}
			System.out.println("");
		}
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

int main()
{
	long long int n,k;
	cin >> n >> k;
	long int i;
	long long int a[n];
	for(i=0;i<n;++i){
        cin >> a[i];
	}
	long int vis[n] = {0};
	vis[0] = 1;
	i = 0;
	long long int loop_size = -1;
	long long int curr_pos = 0;
	while(i < k)
    {
        //cout << curr_pos << endl;
        if(vis[a[curr_pos]-1] != 0){
            loop_size = i - vis[a[curr_pos]-1] + 2;
            break;
        }
        else{
            vis[a[curr_pos]-1] = i+2;
            curr_pos = a[curr_pos] - 1;
        }
        i++;
    }
    //cout << i << endl;
    if(loop_size == -1){
        cout << curr_pos+1 << endl;
        return 0;
    }
    curr_pos = a[curr_pos] - 1;
    k = k - i - 1;
    k = k % loop_size;
    //cout << k << " " << curr_pos << endl;
    for(i=0;i<k;++i){
        curr_pos = a[curr_pos]-1;
    }
    cout << curr_pos+1 << endl;
}


Measured memory_bytes: 6760
void main() {
  problem();
}

void problem() {
  const N = scan!int;
  const K = scan!long;
  auto A = scan!long(N).sort().array;

  void solve() {
    binarySearch(1L, A[$-1], (long m) {
      auto cutTimes = A.map!(a => (a + m - 1) / m - 1).sum();
      [m, K, cutTimes].deb;
      return K >= cutTimes;
    }).writeln;
  }

  solve();
}

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

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

T binarySearch(T)(T min, T max, bool delegate(T t) fun) {
  [min, max].deb;
  if (fun(min)) return min;

  if (fun(max)) {
    auto middle = (min + max) / 2;
    if (min == middle) return max;

    if (fun(middle)) {
      return binarySearch(min, middle, fun);
    } else {
      return binarySearch(middle, max, fun);
    }
  }

  throw(new Error("test"));
}

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


Measured memory_bytes: 11668
# その22 B - Toll Gates
# N：N+1個のマス 0~N
# M：料金所の数
# X：最初のマス
# A：料金所の場所

N,M,X = map(int,input().split())
A =list(map(int,input().split()))
p=0
s=0

for i in range(len(A)):
    if X < A[i]:
        p+=1

for j in range(len(A)):
    if X > A[j]:
        s+=1

if p>=s:
    print(s)
else:
    print(p)
    


Measured memory_bytes: 61868
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
Q = int(input())

sm = 0
d = {}
for a in A:
    if a in d:
        d[a] += 1
    else:
        d[a] = 1
    sm += a

for _ in range(Q):
    b, c = map(int, input().split())
    if b in d:
        sm += (c-b) * d[b]
        if c in d:
            d[c] += d[b]
        else:
            d[c] = d[b]
        d.pop(b)
    print(sm)


Measured memory_bytes: 83332
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int x = saori.saori_hayami();
		boolean flg = true;
		int ans = 0;
		int count = 0;
		if(x >= 500){
			count = x/500;
			ans += count * 1000;
			x -= count*500;
		}
		if(x >= 5){
			count = x/5;
			ans += count * 5;
			x -= count*5;
		}
		System.out.println(ans);

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 23252
#include<cstdio>
using namespace std;
int n,cnt[101],dp[10001][10001];//76
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) {
		int now=i;
		while(now!=1) {
			for(int j=2;j<=now;++j) if(!(now%j)) cnt[j]++,now/=j,j=1;
		}
	}
	dp[0][0]=1;
	for(int i=1;i<=100;++i)
		for(int j=0;j<=74;j+=2)
			for(int k=0;k<=cnt[i];k+=2) 
				dp[i][j+(j+1)*k]+=dp[i-1][j];
	printf("%d",dp[100][74]);
	return 0;
}

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


int main(void){
    //////////////////////////

    int D, G;
    cin >> D >> G;
    vector<int> p(D), c(D);
    for (int i = 0; i < D; i++){
        cin >> p.at(i) >> c.at(i);
    }
    int ans = 1000000000;
    for (int i = 0; i < pow(2, D); i++){
        int now_score = 0;
        int cnt = 0;
        vector<bool> check(D);
        for (int j = 0; j < D; j++){
            if (i & (1 << j)){
                now_score += 100 * (j+1) * p[j] + c[j];
                cnt += p[j];
                check[j] = true;
            }
        }
        if (now_score < G){
            for (int j = D-1; j >= 0; j--){
                if (!check[j]){
                    int z = (G - now_score + 100 * (j+1) - 1) / (100 * (j+1));
                    if (z > p[j]){
                        now_score += 100 * (j+1) * (p[j] - 1);
                        cnt += p[j] - 1;
                    }else{
                        now_score += 100 * (j+1) * z;
                        cnt += z;
                    }
                }
                if (now_score >= G){
                    break;
                }
            }
        }
        if (now_score >= G){
            ans = min(ans, cnt);
        }   
    }

    cout << ans << endl;

    //////////////////////////
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
    #define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #include <algorithm>
    #include <bits/stdc++.h>
    #define MOD 1000000007
    #define ll long long
    #define mm(arr) memset(arr, 1, sizeof(arr))
    #define scanArray(a,n) for(int i = 0; i < n; i++){cin >> a[i];}
    using namespace std;

    int main(){
        FAST
        ll n; cin >> n;
        ll a[n];
        mm(a);
        ll sum=0;
        for(ll i=1; i<n+1; i++){
            a[i] = i;
        }
        for(ll i=1; i<n+1; i++){
        if(i%3 != 0 && i%5 != 0 && a[i] %3 != 0 && a[i] % 5 !=0){
            sum+=a[i];

        }
        else{

            continue;
        }
        }
        cout << sum << endl;

        return 0;
    }


Measured memory_bytes: 11388
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
using namespace std;

int main(void)
{
    char s;
    for(int i = 1;i <= 12;i++)
    {
        cin >> s;
        if(i == 5){cout << " ";}
        cout << s;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
s = input()
t = input()
sList = sorted(s)
tList = sorted(t, reverse=True)
num = min(len(s), len(t))
for i in range(num):    
    if sList[i] == tList[i]:
        continue
    if sList[i] < tList[i]:
        flag = True
        break
    if sList[i] > tList[i]:
        flag = False
        break
try: 
    if flag:
        print("Yes")
    else:
        print("No")
except NameError as flag:
    if len(s) < len(t):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	x, y, z := -1, -1, -1
	for i := 1; i <= 3500; i++ {
		for j := 1; j <= 3500; j++ {
			a := n * i * j
			b := 4*i*j - n*i - n*j
			if b > 0 {
				if a%b == 0 {
					x, y, z = i, j, a/b
				}
			}
		}
	}
	fmt.Println(x, y, z)
}


Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(void){
	int n;
	char s[100001];
	int i;
	char b;
	int x;

	scanf("%d",&n);
	scanf("%s",s);

	x = n;
	b = s[0];
	for(i=1;i<n;i++){
		if(s[i] == b){
			x--;
		}else{
			b = s[i];
		}
	}
	printf("%d\n",x);


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;
#define PI 3.141592653589793


int main(){
    int S, W; cin >> S >> W;
    if(W>=S) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

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

int main(){
	int a,b,c,d,num[110],ans=-1;

	cin>>a>>b>>c>>d;
	
	for(int i=0;i<110;i++)num[i]=0;
	for(int i=0;i<110;i++){
		if(a<=i&&i<=b)num[i]++;
		if(c<=i&&i<=d)num[i]++;
	}
	for(int i=0;i<110;i++)
			if(num[i]>1)ans++;
	if(ans==-1)ans=0;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <cmath>
using ll=long long;
using namespace std;
int main(){
    double W,H,x,y;
    cin >> W >> H >> x >> y;
    double S=W*H/2.000;
    cout << fixed;
    cout << setprecision(20) << S ;
    cout <<" ";
    double av_W=W/2;
    double av_H=H/2;
    bool hantei=0;
    if(x==av_W&&y==av_H){
        hantei=1;
    }
    cout << hantei << endl;
}


Measured memory_bytes: 256
h = int(input())
w = int(input())
n = int(input())
black = 0
ooicnt = 0
skncnt = 0
for i in range(n):
    if ooicnt < n:
        ooicnt+=1
        black += max(h,w)
        if black >= n:
            break
    else:
        skncnt+= 1
        black += min(h,w)
        if black >= n:
            break
print(ooicnt+skncnt)

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> W(N);
    for_each(begin(W), end(W), [](int &e) { cin >> e; });

    int ans = 1e9;
    int sum = accumulate(begin(W), end(W), 0);
    int tmp = 0;
    for (int i = 1; i < N; i++) {
        tmp += W[i - 1];
        sum -= W[i - 1];
        ans = min(ans, abs(tmp - sum));
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int l[3];
    char s[3][11];
    
    rep(i, 3){
        scanf("%s", s[i]);
        l[i]=strlen(s[i]);
    }
    
    if (s[0][l[0]-1]==s[1][0]&&s[1][l[1]-1]==s[2][0]) {
        printf("YES");
    } else {
        printf("NO");
    }
    
    
    
    return 0;
}



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

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define INF 1e9


int main(){
    int N = 1e6+1;
    vector<bool> isPrime(N, true);
    isPrime[0] = isPrime[1] = false;
    for (int i = 2; i*i < N; i++) {
        if (!isPrime[i]) continue;
        for (int j = i*i; j < N; j += i) isPrime[j] = false;
    }

    while(true){
        int n,x;
        cin >> n >> x ;
        if(n == 0 && x == 0){
            break;
        }

        vector<int> dishes(n,0);

        FOR(i,0,n){
            cin >> dishes[i];
        }
        vector<bool> dp(x+1,false);
        dp[0] = true;

        int ans = 0;
        for(auto dish:dishes){
            FOR(i,0,x+1){
                if((i+dish < x+1) && dp[i]){
                    if(isPrime[i+dish])
                       ans = max(ans,i + dish);
                    dp[i+dish] = true;
                }
            }
        }

        if(ans == 0)
            cout << "NA" << endl;
        else
            cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1324
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
const int dx[] = {0, 1, -1, 0};
const int dy[] = {1, 0, 0, -1};
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;
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;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //////////////////////////////////////
  int n, ans = 0;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  for (int i = 0; i < n; i += 2) {
    if (a[i] % 2 == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3648
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

char S[101010];

int main()
{
	scanf("%s", S);
	int ret = 0;
	for (int i = 1; S[i]; ++i) if (S[i] != S[i - 1]) ++ret;
	printf("%d\n", ret);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
	#define hell                         1000000007 
	#define M                            1000000007
	#define Maxi                      10000000000000000
	#define lcm(a,b)                     (a*b)/__gcd(a,b)
	#define ll                           long long
 
	#define vll                          vector<ll>
	#define vi                           vector<long long>
	#define pll                          vector< pair<ll,ll> >
	#define pb                           push_back
	//#define mp                           make_pair
	#define all(v)                       v.begin(),v.end()
	#define lbnd                         lower_bound
	#define ubnd                         upper_bound
	#define bs                           binary_search
	#define F                            first
	#define S                            second
	#define rep(i,a,b)                   for(i=a;i<b;i++)
	#define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
	#define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
	#define ret(x)                       return cout<<x,0;
	#define dbg(x)                       cout << #x << " is " << x << endl;
	//#define endl                           '\n'
 
 
	// Debug //
 
	#define trace(x)                 cerr << #x << ": " << x << endl;
	#define trace1(x)                cerr << #x << ": " << x << endl;
	#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
	#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
	#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
	#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
	#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
 
 
	using namespace std;
 	
	int main()
	{
 
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);cout.tie(NULL);
		

	 	ll n;
	 	cin>>n;
	 	vll v;
	 	ll i;
	 	for(i=0;i<n-1;i++)
	 	{
	 		ll x;
	 		cin>>x;
	 		v.pb(x);
	 	}
	 	ll sum;
	 	sum+=v[0];
	 	for(i=1;i<v.size();i++)
	 	{
	 		sum+=min(v[i],v[i-1]);
	 	}
	 	sum+=v[v.size()-1];
	 	cout<<sum<<endl;
 
		return 0;
		}
	 	


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

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define vecst   vector<string>
#define vecb    vector<bool>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt((ok ? "Yes" : "No"));}
//----------------------------------------------------------------

int main(void) {
  int n;
  cin >> n;
  arrll(a,n);

  ll ans=1e14;
  REP(i,-100,101){
    ll tmp=0;
    rep(j,n){
      tmp+=(a[j]-i)*(a[j]-i);
    }
    chmin(ans, tmp);
  }

  prt(ans);
}


Measured memory_bytes: 256
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        D: i64,
        mut N: i64,
    }
    let mut ans = 1;
    for _i in 0..D{
        ans *= 100
    }
    if N==100{
        N = 101;
    }
    println!("{}",ans*N);
}

Measured memory_bytes: 4352
h={};gets=~/ /;h[K=$'.to_i]=0;1.upto(29){|i|h[K&(t=1<<i)>0?K|t-1^t:0]=0};p$<.map{|s|a,b=s.split.map &:to_i;h.map{|k,_|h[k]+=a|k>k ?0:b}.max}.max

Measured memory_bytes: 2744
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

typedef long long ll;


const int NMAX = 1e5 + 1, MOD = 1e9 + 7;
int n, k, bin[NMAX], dp_fact[NMAX];
pair<int, int> val[NMAX];
ll a[NMAX];

ll fast_exp(ll x,int pow){
	if(pow == 0) return 1;
	
	ll partiel = x * x % MOD;
	if(pow % 2 == 0){
		return fast_exp(partiel, pow/2);
	}
	return fast_exp(partiel, pow/2) * x % MOD;
}
 
ll fact(int l){
	if(l == 0) return 1;
	
	if(dp_fact[l] != 0)
		return dp_fact[l];
		
	ll ans, prec = fact(l-1);
	ans = ((ll)l * prec) % MOD;
	dp_fact[l] = ans;
	return ans;
}

ll mod_inv(ll x){
	return fast_exp(x, MOD-2);
}

ll ncr(ll i, ll m){
	
	if(i < 0 || i > m || i != k-1){
		return 0;
	}
	
	if( bin[m] != 0 ){
		return bin[m];
	}
	ll ans = 1;
	ans *= fact(m);
	ans = ans * mod_inv( fact(i) ) % MOD;
	ans = ans *  mod_inv( fact(m-i) ) % MOD ;
	
	bin[m] = ans;
 
	//cout << i << ' ' << m << ' ' << ans << '\n';
	return ans;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
	
	cin >> n >> k;
	
	for(int i = 0; i < n; i ++){
		cin >> a[i];
	}
	
	sort(a, a + n);
	
	ll ans = 0;
	
	for(int i = 0; i < n; i ++){
		ans += (a[i] * ncr(k-1, i)) % MOD;
		ans %= MOD; 
		ans -= (a[i] * ncr(k-1, n-i-1)) % MOD;
		if(ans < 0) ans += MOD;
		ans %= MOD;
	}
	
	cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
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 (a>b) { a=b; return true; } return false; }

int main(){
    int n;
    string s;
    cin >> n >> s;
    int num = n/2;
    rep(i, num){
        if (s[i] != s[i+num]){
            cout << "No" << endl;
            return 0;
        }
    }
    if (n % 2 != 0) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
using namespace std;

int a[20], x[20][20], y[20][20];

int main() {
    int n;
    cin >> n;
    rep(i, n) {
        cin >> a[i];
        rep(j, a[i]) {
            cin >> x[i][j] >> y[i][j];
            x[i][j]--;
        }
    }

    int ans = 0;
    rep(bit, (1 << n)) {
        bool ok = true;
        rep(i, n) {
            if (!(bit & (1 << i))) continue;
            rep(j, a[i]) if (((bit >> x[i][j]) & 1) ^ y[i][j]) ok = false;
        }
        if (ok) ans = max(ans, __builtin_popcount(bit));
    }

    cout << ans << endl;

    return 0;
}



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

int main() {
    int N, M; cin >> N >> M;
    vector<int> cnt(M, 0);
    for (int i = 0; i < N; i++) {
        int K; cin >> K;
        for (int j = 0; j < K; j++) {
            int A; cin >> A; A--;
            cnt[A]++;
        }
    }

    int ans = 0;
    for (int i = 0; i < M; i++) {
        if (cnt[i] == N) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3588
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

int main(){
    int N;
    cin >> N;
    int A[N];
    int B[N];
    map<int,int>mp;
    map<int,int>mp_2;
    for(int i=0;i<N-1;++i){
        cin >> A[i];
        mp[A[i]]++;
    }
    for(int i=1;i<=N;++i){
        cout << mp[i] << endl;
    }
}

Measured memory_bytes: 13788
#include <iostream>
#include <vector>
#include <string>
#include <cstdio>
#include <algorithm>

using namespace std;

static const string ROOT = "root";
static const string INTERNAL_NODE = "internal node";
static const string LEAF = "leaf";

struct Node {
  int id;
  int parent;
  int depth;
  int height;
  int left;
  int right;

  Node() : id(), parent(-1), depth(0), height(0), left(-1), right(-1) {}

  bool hasChild() const {
    return left != -1 || right != -1; 
  }

  int getDegree() const {
    if (hasChild()) {
      if (left != -1 && right != -1) {
       return 2;
      } else {
        return 1;
      }
    } else {
      return 0;
    }
  }

  const string& getType() const {
    if (parent == -1) {
      return ROOT;
    } else if (hasChild()) {
    return INTERNAL_NODE;
    } else {
      return LEAF;
    }
  }
};

static vector<Node> TREE(25);

static void inputNode(Node& node, int id) {
  node.id = id;
  cin >> node.left >> node.right;
}

static void setDepth(vector<Node>& tree, Node& node) {
  if (node.left != -1) {
    tree[node.left].depth = node.depth + 1;
    setDepth(tree, tree[node.left]);
  }
  
  if (node.right != -1) {
    tree[node.right].depth = node.depth + 1;
    setDepth(tree, tree[node.right]);
  }
}

static int getHeight(const vector<Node>& tree, const Node& node) {
  int height = 0, leftHeight = 0, rightHeight = 0;
  if (node.hasChild()) {
    if (node.left != -1) {
      leftHeight = getHeight(tree, tree[node.left]) + 1;
    }
    if (node.right != -1) {
      rightHeight = getHeight(tree, tree[node.right]) + 1;
    }
    height = max(leftHeight, rightHeight);
  }
  return height;
}

static int getSibling(const vector<Node>& tree, const Node& node) {
  if (node.parent == -1) {
    return -1;
  } else {
    const Node& parentNode = tree[node.parent];
    if (parentNode.left == node.id) {
      return parentNode.right;
    } else {
      return parentNode.left;
    }
  }
}

static void setupTree(vector<Node>& tree, int num) {
  for (int i = 0; i < num; i++) {
    Node& node = tree[i];
    if (node.left != -1) {
      tree[node.left].parent = node.id;
      tree[node.left].depth = node.depth + 1;
      setDepth(tree, tree[node.left]);
    }
    if (node.right != -1) {
      tree[node.right].parent = node.id;
      tree[node.right].depth = node.depth + 1;
      setDepth(tree, tree[node.right]);
    }
    node.height = getHeight(tree, node);
  }
}

static void printTree(const vector<Node>& tree, int num) {
  int depth = 0, sibling = 0;
  for (int i = 0; i < num; i++) {
    sibling = getSibling(tree, tree[i]);
    const string& type = tree[i].getType();
    printf("node %d: parent = %d, sibling = %d, degree = %d", i, tree[i].parent, sibling, tree[i].getDegree());
    printf(", depth = %d, height = %d, %s\n", tree[i].depth, tree[i].height, type.c_str());
  }
}

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

  int id;
  for (int i = 0; i < n; i++) {
    cin >> id;
    inputNode(TREE[id], id);
  }
  
  setupTree(TREE, n);
  printTree(TREE, n);

  return 0;
}



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

struct Node {
	int key;
	Node *parent, *left, *right;
};

Node *root, *nil;

void insert(int& a) {
	Node *b = (Node*)malloc(sizeof(Node)), *c = root, *d = nil;
	b->key = a;
	b->left = nil;
	b->right = nil;
	while (c != nil) {
		d = c;
		if (b->key < c->key) c = c->left;
		else c = c->right;
	}
	b->parent = d;
	if (b->parent == nil) root = b;
	else if (b->key < b->parent->key) b->parent->left = b;
	else b->parent->right = b;
}

void inorderTreeWalk(Node* a = root) {
	if (a != nil) {
		inorderTreeWalk(a->left);
		cout << ' ' << a->key;
		inorderTreeWalk(a->right);
	}
}

void preorderTreeWalk(Node* a = root) {
	if (a != nil) {
		cout << ' ' << a->key;
		preorderTreeWalk(a->left);
		preorderTreeWalk(a->right);
	}
}

int main() {
	int m, k;
	cin >> m;
	for (int i = 0; i < m; i++) {
		string a;
		cin >> a;
		if (a == "insert") {
			cin >> k;
			insert(k);
		}
		else {
			inorderTreeWalk();
			cout << endl;
			preorderTreeWalk();
			cout << endl;
		}
	}
}


Measured memory_bytes: 26580
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define test() ull t;cin>>t;while(t--)
#define pll pair<ll,ll>
#define puu pair<ull,ull>
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define Vint vector<int>
#define Vll vector<ll>
#define Vull vector<ull>
#define nl cout<<endl
#define sp cout<<" "
#define MOD 1000000007
#define all(x) x.begin(),x.end()

int main() 
{
	// ios::sync_with_stdio(0);
	// cin.tie(0);
	// cout.tie(0);
	string s;
	cin>>s;
	ll n = s.length();
	ull sum = 0;
	loop(i,0,n){
		sum+=(ll)(s[i] - '0');
	}

	if(sum%9==0)
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 3732
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

signed main(){
  int n;
  cin>>n;
  map<string,int> a;
  REP(i,n){
    string s;
    cin>>s;
    a[s]++;
  }
  int m;
  cin>>m;
  map<string,int> b;
  REP(i,m){
    string t;
    cin>>t;
    b[t]++;
  }
  int ans=0;
  for(auto x:a){
    int tmp=x.S;
    if(b.find(x.F)!=b.end()){
      tmp-=b[x.F];
    }
    ans=max(ans,tmp);
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    var (H, N) = readLine()!!.split(" ").map { it.toInt() }
    val A = readLine()!!.split(" ").map { it.toInt() }
    A.forEach {
        H-= it
    }
    if (H<=0) {
        println("Yes")
    } else {
        println("No")
    }
}


Measured memory_bytes: 48348
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

class Graph{
	private:
	int n;
	vvp g;
	public:
	int DIJ(int s,int t){
		priority_queue<P> q;
		vi d(n,inf);
		d[s]=0;
		q.push({0,s});
		while(!q.empty()){
			P p=q.top();
			q.pop();
			int v=p.second;
			if(d[v]<-p.first) continue;
			for(auto i:g[v]){
				int u=i.first,D=d[v]+i.second;
				if(d[u]>D){
					d[u]=D;
					q.push({-D,u});
				}
			}
		}
		return d[t];
	}
	Graph(int v){
		n=v;
		g=vvp(v);
	}
	void add_edge(int s,int t,int c){
		g[s].push_back({t,c});
		g[t].push_back({s,c});
	}
};

bool isPrime(ll n){
	if(n<=1) return 0;
	for(ll k=2;k*k<=n;k++) if(n%k==0) return 0;
	return 1;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int q;
	cin>>q;
	for(int i=0;i<q;i++){
		vl a(9);
		for(int j=0;j<9;j++) cin>>hex>>a[j];
		ll x=0,s=0;
		for(int j=0;j<32;j++){
			int t=0;
			for(int k=0;k<9;k++) if((a[k]^(k<8?0:s))&1LL<<j) t++;
			if(t%2==1) x+=1LL<<j;
			ll cnt=0;
			for(int k=0;k<8;k++) if((t%2==0)^(!(a[k]&1LL<<j))){
				cnt++;
			}
			s+=cnt*(1LL<<j);
		}
		cout<<hex<<x<<endl;
	}
}


Measured memory_bytes: 3116