akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
const int N = 103;
int n, m, k, nowx, nowy, ans[N][N];
int main(){
	scanf("%d%d%d", &n, &m, &k); nowx = nowy = 1;
	for(Rint i = 1;i <= k;i ++){
		int x; scanf("%d", &x);
		while(x --){
			ans[nowx][nowy] = i;
			if((nowx & 1) && nowy == m || !(nowx & 1) && nowy == 1) ++ nowx;
			else if(nowx & 1) ++ nowy;
			else -- nowy;
		}
	}
	for(Rint i = 1;i <= n;i ++){
		for(Rint j = 1;j <= m;j ++)
			printf("%d ", ans[i][j]);
		putchar('\n');
	}
}

Measured memory_bytes: 384
package main

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

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

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code ---*/
	n, y := nextInt(), nextInt()
	for i := 0; i <= n; i++ {
		for j := 0; j <= n-i; j++ {
			k := n - (i + j)
			if k < 0 {
				continue
			}
			if 10000*i+5000*j+1000*k == y {
				fmt.Fprint(out, i, j, k)
				return
			}
		}
	}
	fmt.Fprint(out, "-1 -1 -1")
}

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

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

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}


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

int main(void){
  int n; cin >> n;
  int d[n];
  rep(i,n){
    cin >> d[i];
  }
  sort(d,d+n);
  cout << d[n/2] - d[n/2-1] << endl;
  return 0;
}


Measured memory_bytes: 640
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			String S = scan.next();
			
			int[] T = new int[S.length()+1];
			int[] D = new int [S.length()+1];
			
			Map<Integer,Integer>map = new TreeMap<Integer,Integer>();
			//T[S.length()] = "0";
			map.put(T[0], 1);
			COMinit();
			double tenpow = 0.1;
			

			for(int i =0;i<S.length();i++) {
				int a = S.charAt(S.length()-1-i)-'0';
				//System.out.print(a);
				tenpow = ((int)(tenpow*10))%2019;
				T[i+1]= ((a*(int)tenpow)%2019+T[i])%2019;
				
				//T[i] = big.remainder(new BigDecimal("2019")).toString();
				//System.out.print(" ");
				//System.out.println(T[i]);
				if(!map.containsKey(T[i+1])) {
					map.put(T[i+1], 1);
				}else {
					map.put(T[i+1], map.get(T[i+1])+1);
				}
			}
			
			
			long goukei = 0;
			
			for(Integer Key:map.keySet()) {
				//System.out.print(Key);
				//System.out.print(" ");
				//System.out.println(map.get(Key));
				if(map.get(Key)>=2)goukei+=COM(map.get(Key),2);
			}
			//System.out.println();
			System.out.println(goukei);
			
			
			
			
			
			
			
			
			
		}
		
		
	}
	
	//拡張ユークリッドでの逆元の求め方でnCkをつくる、前処理必須。
	
	static  int MAX = 510000;
	static  int MOD = 1000000007;

	 static long[] fac = new long[MAX]; 
	 static long[] finv = new long[MAX]; 
	 static long[] inv = new long[MAX]; 

	// テーブルを作る前処理
	static void COMinit() {
	    fac[0] = fac[1] = 1;
	    finv[0] = finv[1] = 1;
	    inv[1] = 1;
	    for (int i = 2; i < MAX; i++){
	        fac[i] = fac[i - 1] * i % MOD;
	        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
	        finv[i] = finv[i - 1] * inv[i] % MOD;
	    }
	}

	// 二項係数計算
	static long COM(int n, int k){
	    if (n < k) return 0;
	    if (n < 0 || k < 0) return 0;
	    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
	}
		

}


Measured memory_bytes: 69280
#include <bits/stdc++.h>
#define REP(i,n) for (long long i=0;i<(n);i++)
#define FOR(i,a,b) for (long long i=(a);i<(b);i++)
#define RREP(i,n) for(long long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl
#define dump(x)  cerr << #x << " => " << (x) << endl
#define dumpP(p) cerr << "( " << p.first << " , " << p.second << " )" << ends
#define SORT(c) sort((c).begin(),(c).end())
#define MIN(vec) *min_element(vec.begin(), vec.end())
#define MAX(vec) *max_element(vec.begin(), vec.end())
#define UNIQ(vec) vec.erase(unique(vec.begin(), vec.end()),vec.end()) //ソートの必要あり
#define IN(n,m)  (!(m.find(n) == m.end()))
#define ENUM(m) for (auto itr = m.begin(); itr != m.end(); ++itr)
#define dump_MAP(m) for(auto itr = m.begin(); itr != m.end(); ++itr) { cerr << itr->first << " --> "  << itr->second << endl; }
#define FINDL(vec,x) (lower_bound(vec.begin(),vec.end(),x) - vec.begin())
#define FINDU(vec,x) (upper_bound(vec.begin(),vec.end(),x) - vec.begin())
#define ROUND(N) setprecision(N)
#define ROUND_PRINT(N,val) cout << fixed;cout << setprecision(N) << val << endl
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define INARR(h,w,x,y) (0 <= y && y < h && 0 <= x && x < w)
#define EQ(a,b) (abs(a - b) < 1e-10)
using namespace std;

template <typename Value,typename Index>
Value quick_select(vector<Value> &A,Index k) {
	Index sz = A.size();
	if (sz == 1) return A[0];
	vector<Value> medians;
	for (Index i = 0;i < sz;i += 5) {
		Index subStart = i;
		Index subEnd = min(i+5,sz);
		sort((A.begin()+subStart),(A.begin()+subEnd));
		Value median = A[(subStart+subEnd)/2];
		medians.push_back(median);
	}
	Index n = medians.size();
	Value pivot = quick_select(medians,n/2);
	Index pivotIndex = 0,sameIndex = 0;
	vector<Value> small,large;
	for (Index i = 0;i < sz;i++) {
		if (A[i] < pivot) {
			pivotIndex++;
			small.push_back(A[i]);
		}
		else if (A[i] > pivot) large.push_back(A[i]);
		else sameIndex++;
	}
	if (pivotIndex <= k && k <= (pivotIndex+sameIndex-1)) return pivot;
	else if (pivotIndex < k) return quick_select(large,k-(pivotIndex+sameIndex));
	else return quick_select(small,k);
}

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	REP(i,N) { 
		cin >> A[i];
		A[i] -= (i+1);
	}
	int mid,mid2;
	long ans = 0,ans2 = 0;
	if (N % 2) {
		mid = quick_select<int,int>(A,(N/2));
		REP(i,N) ans += abs(A[i] - mid);
		cout << ans << endl;
	}
	else {
		mid = quick_select<int,int>(A,(N/2)-1);
		mid2 = quick_select<int,int>(A,(N/2));
		REP(i,N) {
			ans += abs(A[i] - mid);
			ans2 += abs(A[i] - mid2);
		}
		cout << min(ans,ans2) << endl;
	}
}


Measured memory_bytes: 3184
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑


int ans[105], mon;
int main() {
	int n;
	while (cin >> n) {
		++ans[n];
	}
	for (int i = 0; i < 100; ++i) {
		mon = max(mon, ans[i]);
	}
	for (int i = 0; i < 100; ++i) {
		if (ans[i] == mon) { cout << i << endl; }
	}
}


Measured memory_bytes: 3080
from collections import Counter
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
 
counter = Counter(((b1[0] - b2[0], b1[1] - b2[1])for b1 in xy for b2 in xy if b1 != b2))
print(N - (list(counter.most_common())+[(0,0)])[0][1])

Measured memory_bytes: 3956
#include <stdio.h>

int main(void){
    int coin,a,b;
    
    scanf("%d %d", &a, &b);
    
    if(a > b){
        coin = a;
        a--;
    }else{
        coin = b;
        b--;
    }
    
    if(a > b){
        coin += a;
    }else{
        coin += b;
    }
    
    printf("%d", coin);
    
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

class Main{

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

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

		if(a < b) System.out.println("a < b");
		else if(a == b) System.out.println("a == b");
		else System.out.println("a > b");
		

	}


}

Measured memory_bytes: 26284
import sys
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template #


N = ii()
H = lmi()
cnt = 0
for i in range(N):
    for j in range(i):
        if H[j] > H[i]:
            break
    else:
        cnt += 1

print(cnt)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
# define ll long long int
#define mm 1000000007
#define pb push_back
									//nestedcode



 int main(){
	ios::sync_with_stdio(false);
  	cin.tie(0); cout.tie(0);
  	ll n,i;
  cin>>n;
  ll a[n+5];
  double ans=0;
  for(i=0;i<n;i++){
  	cin>>a[i];
  	
  //	cout<<ans<<endl;
  }
  sort(a,a+n);
  ans=((double)a[0] + a[1]) /2;
  for(i=2;i<n;i++){
  	ans=((double)ans+a[i])/2;
  }
  cout<<fixed<<setprecision(8)<<ans;
}

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

namespace Topic01
{
    class ALDS1_1_A
    {
        static void Main(string[] args)
        {
            int N = int.Parse(ReadLine());
            int[] A = ReadLine().Split()
                .Select(n => int.Parse(n)).ToArray();

            StringBuilder sb = new StringBuilder();
            for (int k = 0; k < N; k++)
            {
                sb.Append(A[k]);
                sb.Append(" ");
            }
            WriteLine(sb.ToString().TrimEnd());

            for (int i = 1; i <= N - 1; i++)
            {
                int v = A[i];
                int j = i - 1;
                while (j >= 0 && A[j] > v)
                {
                    A[j + 1] = A[j];
                    j--;
                    A[j + 1] = v;
                }

                sb.Clear();
                for (int k = 0; k < N; k++)
                {
                    sb.Append(A[k]);
                    sb.Append(" ");
                }
                WriteLine(sb.ToString().TrimEnd());
            }
            ReadKey();
        }
    }
}



Measured memory_bytes: 18248
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <unordered_map>

using namespace std;


int main() {
    

    long n;
    cin >> n;
    long i;
    for (i=1;i*(i+1) <=2*n; i++){
        if(i*(i+1) == 2*n){
            cout << "Yes" << endl;
            cout << i+1 << endl;
            const long I = i;
            long S[I+1][I];
            long mofu = 1;
            for (long j=0; j<I+1;j++ ){
                for (long k=0;k<I;k++){
                    if(k<j){
                        S[j][k] = S[k][j-1];
                    }else{
                        S[j][k] = mofu;
                        mofu += 1;
                    }
                }

            }
            for (long j=0;j<I+1;j++){
                cout << i;
                for (long k=0;k<I;k++){
                    cout << " " << S[j][k];
                }
                cout << endl;
            }
            goto Exit;
        }
    }
    cout << "No" << endl;
    Exit:
    ;


}

Measured memory_bytes: 2944
/**
DufauX-XuafuD
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define reset(x) memset(x,-1,sizeof(x))
#define CheckBit(a,b) (a&(1ll<<b))
#define SetBit(a,b) a=(a|(1ll<<b))
#define UnSetBit(a,b) a=(a&(~(1ll<<b)))
#define maxx 10000006
#define PI 2*acos(0.0)
const long long INF = 2000000000000000000LL;	// 2e18
const int inf = 0x3f3f3f3f;	// 1061109567
const long double EPS = 1e-9;
//bitset<maxx/2>vis;
//bitset<maxx>pr;
//int mobi[maxx+10];
//vector<ll>prime;
//void sieve(){
//    ll x=maxx/2, y=sqrt(maxx)/2;
//    for(ll i=1;i<=y;i++){
//        if(vis[i]==0){
//            for(ll j=(i*(i+1)*2);j<x;j+=(2*i)+1)
//                vis[j]=1;
//        }
//    }
//    prime.push_back(2);
//    for(ll i=3;i<maxx;i+=2)
//        if(vis[i/2]==0)
//        prime.push_back(i);
//}
//void generate_mobius()
//{
//    for(int i=0;i<maxx;i++)mobi[i]=1;
//    for(int i=2;i<maxx;i++){
//        if(!pr[i]){
//            mobi[i]*=-1;
//            for(int j=i+i;j<maxx;j+=i){
//                pr[j]=1;
//                mobi[j]*=(j%(i*i)?-1:0);
//            }
//        }
//    }
//}
//bool isprime(ll a)
//{
//    if(a==1)return false;
//    if(a==2)return true;
//    if(a%2==0)return false;
//    for(ll i=0;i<prime.size() && prime[i]*prime[i]<=a;i++)
//        if(a%prime[i]==0)return false;
//    return true;
//}
/* Calculate ( a*b ) %c */
inline ll mulmod(ll a, ll b, ll c) {
    ll ret = 0 , cur = a % c ;
    while(b) { if(b%2) ret=(ret+cur)%c; cur=(cur<<1)%c; b=b>>1; }
    return ret%c;
}
//Calculate (b^p)%m || modular inverse: b^-1 = bigmod(b, m-2, m)
inline ll bigmod(ll b, ll p, ll m){
    ll ret = 1, cur = b % m;
    while(p) { if(p&1) ret=(ret*cur)%m; cur=(cur*cur)%m; p=p>>1; }
    return ret;
}
inline ll modulo(ll a,ll b,ll c) { //Same as big mod, use for numbers over 1e10
    ll ret = 1 , cur = a%c ;
    while(b) { if(b%2) ret=mulmod(ret,cur,c); cur=mulmod(cur,cur,c); b=b>>1; }
    return ret%c ;
}
inline ll power(ll b, ll p){
    ll ret = 1, cur = b;
    while(p) { if(p&1) ret=(ret*cur); cur=(cur*cur); p=p>>1; }
    return ret;
}
ll lcm(ll a,ll b)
{
    return (a/__gcd(a,b))*b;
}
ll gcd(ll a,ll b)
{
    return __gcd(a,b);
}
void Dufaux()
{
    string s;
    ll ans=0;
    ll n;
    cin>>n;
    ll sum=0;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='I')sum++;
        else sum--;
        ans=max(ans,sum);
    }
    cout<<ans<<endl;
}
int main()
{
    FastIO;
	///sieve();
	///generate_mobius();
	int test=1;
	while(test--){
        Dufaux();
	}
	return 0;
}






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

// macros
#define overload_rep(_1, _2 ,_3 ,name, ...) name
#define re_p(i, n) for(int i = 0; i < (n); ++i)
#define r_ep(i, x, y) for(int i = (x); i < (y); ++i)
#define rep(...) overload_rep(__VA_ARGS__, r_ep, re_p,)(__VA_ARGS__)
#define all(a) a.begin(), a.end()
#ifndef STOP_DEBUG
#define debug(...)\
    do{ cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_cerr(__VA_ARGS__); cerr << noboolalpha; } while (0)
#else
#define debug(...)
#endif

// functions
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; }
void debug_cerr(){ cerr << '\n'; }
template<class Head, class... Tail>
void debug_cerr(Head head, Tail... tail){
    cerr << ' ' << head;
    debug_cerr(tail...);
}

// cin/cout setup
struct IoSetup{
    IoSetup(){
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << setprecision(20);
    }
} iosetup;

// AtCoder Grand Contest 039
int N;
int col[200];
int dist[200];
char S[200][200];

bool dfs(int v, int c){
    col[v] = c;
    rep(i, N){
        if(S[v][i] == '1'){
            if(col[i] == c)return false;
            if(col[i] == 0 and !dfs(i, -c))return false;
        }
    }
    return true;
}

int bfs(int v){
    queue<int> que;
    rep(i, N)dist[i] = 400;
    dist[v] = 1;
    que.push(v);
    while(que.size()){
        int x = que.front(); que.pop();
        rep(i, N){
            if(S[x][i] == '1' and chmin(dist[i], dist[x] + 1)){
                que.push(i);
            }
        }
    }
    int res = 0;
    rep(i, N)chmax(res, dist[i]);
    return res;
}

int main(){

    cin >> N;
    rep(i, N)rep(j, N){
        cin >> S[i][j];
    }

    if(!dfs(0, 1)){
        cout << -1 << endl;
        return 0;
    }

    int ans = 0;
    rep(i, N)chmax(ans, bfs(i));
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int m,n,l,i,s,p;
  while(1){
    scanf("%d",&l);
    if(l==0){
      break;
    }
    i=s=p=0;
    while(i<12){
      i++;
      scanf("%d %d",&m,&n);
      s+=(m-n);
      if(s>=l && p==0){
	p=i;
      }
    }
    if(p!=0){
      printf("%d\n",p);
    }
    else{
      printf("NA\n");
    }
  }
  return 0;
}

Measured memory_bytes: 612
#include <set>
#include <algorithm>
#include <deque>
#include <iostream>
using namespace std;

class SegTree {
    using T = int;
    static const T& op(const T& lhs, const T& rhs) { // binary operator
        return max(lhs, rhs);
    }
    constexpr static T unit = -1; // unit element
    const int N;
    T *data;
    static int calc_size(int sz) {
        int n = 1;
        while (sz > n) n *= 2;
        return n;
    }
public:
    explicit SegTree(int sz) : N(calc_size(sz)) {
        data = new T[2*N-1];
    }
    ~SegTree() { delete[] data; }
    T query(int a, int b, int i = -1, int l = -1, int r = -1) const {
        if (i == -1) { i = 0; l = 0; r = N; }
        if (r <= a || b <= l) return unit; // need this if a query can be empty
        if (a <= l && r <= b) return data[i];
        int m = (l+r)/2;
        if (b <= m) return query(a, b, 2*i+1, l, m);
        if (m <= a) return query(a, b, 2*i+2, m, r);
        T v1 = query(a, b, 2*i+1, l, m),
          v2 = query(a, b, 2*i+2, m, r);
        return op(v1, v2);
    }
    void update(int i, T v) {
        int x = i + N - 1;
        data[x] = v;
        while (x > 0) {
            x = (x-1)/2;
            data[x] = op(data[2*x+1], data[2*x+2]);
        }
    }
};
int main() {
    int n, k; cin >> n >> k;
    int p[n]; for (int i = 0; i < n; i++) cin >> p[i];
    SegTree st_max(n+1), st_min(n+1);
    for (int i = 0; i < n; i++) { st_max.update(i, p[i]); st_min.update(i, -p[i]); }
    int ans = 1;
    for (int i = 0; i+k < n; i++) {
        if (p[i] > -st_min.query(i+1, i+k) || p[i+k] < st_max.query(i+1, i+k)) ans++;
    }
    int cnt = 0, c = 0;
    for (int i = 1; i < n; i++) {
        if (p[i-1] < p[i]) c++; else c = 0;
        if (c == k-1) cnt++;
        // cerr << i << ' ' << c << ' ' << cnt << endl;
    }
    cout << (cnt ? ans - cnt + 1 : ans) << endl;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
	cin>>s;
	int pos=0;
	pos--;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='C')
		{
			pos=i;
			break;
		}
	}
	if(pos<0)
	{
		puts("No");
	}
	else
	{
		for(int i=pos+1;i<s.size();i++)
		{
			if(s[i]=='F')
			{
				puts("Yes");
				return 0;
			}
		}
		puts("No");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main(){
    ll N, A, B, C, D, E; cin >> N >> A >> B >> C >> D >> E;
    vector<ll> X = {A, B, C, D, E};
    ll Min = min(A, min(B, min(C, min(D, E))));

    cout << (ll)ceil((double)N/Min)+4 << endl;

}


Measured memory_bytes: 256
import java.util.*;
public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        int[] a=new int[3*N] ;
        for(int i=0;i<3*N;i++){
            a[i]=sc.nextInt();
        }
        Arrays.sort(a);
        long result=0;
        for(int i=3*N;i>N;i--){
            result+=a[i-2];
            i--;
        }
        System.out.println(result);
    }

}

Measured memory_bytes: 92360
package main

import (
	"fmt"
)

func times(hp int64) int64 {
	if hp == 1 {
		return 1
	} else if hp == 2 || hp == 3 {
		return 3
	} else {
		return times(hp/2)*2 + 1
	}
}

func main() {
	var h int64
	fmt.Scan(&h)

	if h == 1 {
		fmt.Println(1)
	} else if h == 2 || h == 3 {
		fmt.Println(3)
	} else {
		// 1 -> 0 ans:1
		// 2 -> 1 1 -> 0 1 -> 0 0 ans:3
		// 3 -> 1 1 -> 0 1 -> 0 0 ans:3
		// 4 -> 2 2 -> ... -> ans:6
		var ans int64 = times(h)

		fmt.Println(ans)
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
    char a[10001],b[10001];
    int len,i;
    cin>>a;
	cin>>b;
    len=strlen(b);
    for(i=0;i<len;i++){
	cout<<a[i]<<b[i];
	}
    if(strlen(a)>strlen(b)){
	cout<<a[len];
	}
	cout<<endl;
    return 0;
}

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

int main() {
	string a;
	int i;
	cin >> a;
	for(i = 0;i < 2;i++){
		if(a[i] == a[i + 1]){
			if(a[i] == a[i + 2]){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No"  << endl;
 	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    // Your code here!
    val (h,w) = readLine()!!.split(" ").map{it.toLong()}
    
    if(h == 1L || w == 1L ){
        print(1)
    }else{
        if(h % 2L == 0L && w % 2L == 0L){
            print(w / 2 * h)
        }else if(h % 2L == 0L && w % 2L != 0L){
            print(h / 2L * w)
        }else if(h % 2L != 0L && w % 2L == 0L){
            print(w / 2L * h)
        }else{
            print(w * (h/2L) + (w/2L+1L))
        }        
    }
}

Measured memory_bytes: 35976
package main

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

// Monster .
type Monster struct {
	x int
	h int
}

// Monsters .
type Monsters []Monster

func (m Monsters) Len() int {
	return len(m)
}

func (m Monsters) Less(i, j int) bool {
	return m[i].x < m[j].x
}

func (m Monsters) Swap(i, j int) {
	m[i], m[j] = m[j], m[i]
}

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	return a
}

func main() {
	sc.Split(bufio.ScanWords)
	var n, d, a int
	fmt.Scan(&n, &d, &a)

	monsters := make([]Monster, n)
	for i := 0; i < n; i++ {
		x, h := nextInt(), nextInt()
		monsters[i] = Monster{x, h}
	}
	sort.Sort(Monsters(monsters))

	q := make([][2]int, 0)
	total := 0
	ans := 0
	for i := 0; i < n; i++ {
		m := monsters[i]

		for len(q) > 0 && q[0][1] < m.x {
			total -= q[0][0]
			q = q[1:]
		}

		m.h -= total
		if m.h > 0 {
			count := (m.h + a - 1) / a
			ans += count
			total += count * a
			q = append(q, [2]int{count * a, m.x + d*2})
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 11776
#include <stdio.h>
 
int main(void)
{
    int r, c;
    int i, j;
    int num;
    int a[101][101]={};
    scanf("%d%d", &r, &c);
    for(i=0; i<r; i++) {
        for(j=0; j<c; j++) {
            scanf("%d", &num);
            a[i][j]+=num;
        }
    }
     
    for(i=0; i<r; i++) {
        for(j=0; j<c; j++)
            a[i][c]+=a[i][j];
    }
     
    for(j=0; j<c+1; j++) {
        for(i=0; i<r; i++)
            a[r][j]+=a[i][j];
    }
     
    for(i=0; i<r+1; i++) {
        for(j=0; j<c+1; j++) {
            printf("%d", a[i][j]);
            if(j<c) putchar(' ');
            if(j==c) putchar('\n');
        }
    }
    return 0;
}


Measured memory_bytes: 2140
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>

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

using namespace std;

int main(){
	/****input****/
	int n,m;
	cin >> n >> m;
	vector<int> p(101000);
	vector<string> s(101000);
	vector<bool> ac(101000);
	vector<int> pn(101000);

	rep(i,m){
		cin >> p[i] >> s[i];
		ac[i] = false;
	}

	/****calc****/
	int ans=0;
	int pena=0;

	rep(i,m){
		if(ac[p[i]]) continue;
		if(s[i] == "AC") {
			ac[p[i]] = true;
			ans++;
			pena += pn[p[i]];
		}
		else if(s[i] == "WA"){
			pn[p[i]]++;
		}
	}
	/****output****/
	cout << ans << " " << pena << endl;
    return 0;
}


Measured memory_bytes: 6528
#include <stdio.h>
char s[2000001];
int wn[200001]={};
int bn[200001]={};
int main(void){
	int n,i,white=0,black=0,ans=0;
	int temp;
	scanf("%d",&n);
	scanf("%s",s);
	if(s[0]=='.'){
		white++;
		wn[0]=1;
	}else{
		black++;
		bn[0]=1;
	}
	for(i=1;i<n;i++){
		if(s[i]=='.'){
			white++;
			wn[i]=wn[i-1]+1;
			bn[i]=bn[i-1];
		}else{
			black++;
			wn[i]=wn[i-1];
			bn[i]=bn[i-1]+1;
		}
	}
	ans = white;
	for(i=0;i<n;i++){
		temp = bn[i];
		temp += (white-wn[i]);
		if(ans>temp)ans=temp;
	}
	printf("%d",ans);
}

Measured memory_bytes: 1920
using System;
using System.Collections.Generic;
class Program
    {
    	static void Main(string[] args)
    	{
            string[] s1 = Console.ReadLine().Split(' ');
            int r = int.Parse(s1[0]), g = int.Parse(s1[1]), b = int.Parse(s1[2]), n = int.Parse(s1[3]);
            int ans = 0;
            for (int i=0; ; i++)
            {
                if (i * r > n) break;
                for (int j=0; ; j++)
                {
                    int balls = i * r + j * g;
                    if (balls > n) break;
                    if ((n - balls) % b == 0) ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }
    //mcs Main.cs
    //mono Main.exe

Measured memory_bytes: 11092
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
//////////////
int cal(pair<int, int>A, pair<int, int>B) {
	return abs(A.first - B.first) + abs(A.second - B.second);
}
void solve() {
	int N, M;
	cin >> N >> M;
	vector<pair<int, int> > A(N), B(M);
	for (int i = 0; i < N; ++i) {
		cin >> A[i].first >> A[i].second;
	}
	for (int i = 0; i < M; ++i) {
		cin >> B[i].first >> B[i].second;
	}
	for (int i = 0; i < N; ++i) {
		int ans;
		int len = INF;
		for (int j = 0; j < M; ++j) {
			int res = cal(A[i], B[j]);
			if (len > res) {
				len = res;
				ans = j + 1;
			}
		}
		cout << ans << endl;
	}
	
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<random>
#include<math.h>
#include<limits.h>
#include<iterator>
#include<queue>
#include<functional>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define ll long long
#define vl vector<ll> 
#define vvl vector<vector<ll> > 
#define vb vector<bool> 
#define vvb vector<vector<bool> > 
#define INF 11234567890123456789
using namespace std;

int main(){
	vb isAppearanceMap(26,false);
	string s; cin >> s;
	for (char c : s) isAppearanceMap[c - 'a'] = true;
	rep(i, 26) if (!isAppearanceMap[i]){
		cout << (char)(i + 'a') << endl;
		return 0;
	}cout << "None" << endl;
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>

double a,b,c,d,e;

double f(double a,double b,double c,double d){
e = sqrt((c-a)*(c-a) + (d-b)*(d-b));
return e;
}

int main(void){


scanf("%lf %lf %lf %lf",&a,&b,&c,&d);

printf("%.8lf\n",f(a,b,c,d));
}


Measured memory_bytes: 2084
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    rep(i, s.size())
    {
        ans += s[i] - '0';
        ans %= 9;
    }
    if (ans == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3756
use std::io::stdin;
use std::io::BufRead;

fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock();

    loop {
        let mut buf = String::new();

        stdin.read_line(&mut buf).unwrap();

        let mut buf = buf.trim().split(" ");

        let h = buf.next().unwrap().parse::<i64>().unwrap();
        let w = buf.next().unwrap().parse::<i64>().unwrap();

        if h == 0 && w == 0 { break; }

        for _ in 0..h {
            for _ in 0..w {
                print!("#");
            }
            println!();
        }
        println!();
    }
}


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

int main(){
  int N,X,Y;
  cin >> N >> X >> Y;
  X--; Y--; // 1-indexed -> 0-indexed

  vector<vector<int>> data(N, vector<int>(N));
  vector<int> distpair(N);
  for(int i=0; i<N; i++){
    for(int j=i+1; j<N; j++){
      int d_ij;
      if(i >= Y){ 
        d_ij= j-i;
      }
      else if(i <= X){
        if     (j <= X){ d_ij= j-i; }
        else if(j >= Y){ d_ij= (X-i)+ (j-Y+1); }
        else           { d_ij= (X-i)+ min(j-X, Y-j+1); }
      }
      else{
        if (j <= Y){ d_ij= min(j-i, (i-X)+(Y-j)+1); }
        else       { d_ij= min(Y-i, i-X+1)+ (j-Y); }
      }

      distpair.at(d_ij)++;
    }
  }


  for(int i=1; i<N; i++){
    cout << distpair.at(i) << endl;
  }
}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    int n;
    cin>>n;
    bool flg[10001]={};
    flg[0]=true;
    rep(i,n){
        int tmp;cin>>tmp;
        for(int j=10000;j-tmp>=0;j--){
            flg[j]|=flg[j-tmp];
        }
    }
    for(int i=10000;i>=0;i--){
        if(flg[i]&&i%10!=0){
            cout << i << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	int n;
	cin >> n;
	cout << n*n*n << endl;
}

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
#define ford(i, n) for (int i = int(n)-1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define endl '\n'
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
//template<typename... Args>
//void write(Args... args) { ((cout << args << " "), ...); cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int x,y,A,B,C;
    cin>>x>>y>>A>>B>>C;
    vector<int> a(A),b(B),c(C);
    for(auto& it:a) cin>>it;
    for(auto& it:b) cin>>it;
    for(auto& it:c) cin>>it;
    vector<int> all;
    sort(all(a),greater<int>());
    sort(all(b),greater<int>());
    forn(i,x) all.pb(a[i]);
    forn(i,y) all.pb(b[i]);
    for(auto it:c) all.pb(it);
    sort(all(all),greater<int>());
    ll ans=0;
    forn(i,x+y) ans+=all[i];
    cout<<ans;
    return 0;
}



Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			Scanner sc = new Scanner(System.in);
			int N = sc.nextInt();
			int[] X = new int[N];
			for(int i = 0; i < N; i++) {
				X[i] = sc.nextInt();
			}
			boolean flag = true;
			for(int i = N - 2 ; i >= 0; i--) {
				if(X[i] > X[i + 1]) {
					if(X[i] - X[i + 1] == 1)X[i]--;
					else{
						flag = false;
						break;
					}
				}
			}
	 
			System.out.println((flag)?"Yes":"No");
	 
		}
			
			
			
	}
}



Measured memory_bytes: 49812
#include <iostream>

using namespace std;

int main()
{
    int64_t a,b,c,k;
    cin >> a >> b >> c >> k;

    int64_t ans = min(k, a);
    k -= ans;
    k -= b;

    if (k > 0)
    {
        ans -= k;
    }

    cout << ans << "\n";
    return 0;
}


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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void pre(){


}

void solve(){


}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	pre();
	int n,k;cin>>n>>k;
	if(k+n/2<=n){
		if(n%2==0){
			int cur = 2*n-1;
			int rq =  2*n-1+n/2;
			repD(i,n-1,0){
				int gg = rq-cur;
				cout<<k+gg<<' '<<k+cur<<' '<<k+2*n+i<<'\n';
				cur-=2;
				rq--;
				if(cur<n) cur = 2*n-2,rq=2*n-2;
			}
		}
		else{
			int cur = 2*n-1;
			int rq =  2*n-1+n/2;
			repD(i,n-1,0){
				int gg = rq-cur;
				cout<<k+gg<<' '<<k+cur<<' '<<k+2*n+i<<'\n';
				cur-=2;
				rq--;
				if(cur<n) cur = 2*n-2;
			}
		}
	}
	else cout<<-1;
	return 0;
}



Measured memory_bytes: 2304
class Stack:
    def __init__(self, size=200):
        self.size = size
        self.data = []
        self.pointer = -1
    
    def push(self, x):
        self.pointer += 1
        self.data.insert(self.pointer, x)
    
    def pop(self):
        ret = self.data[self.pointer]
        self.pointer -= 1
        return ret
    
    def isEmpty(self):
        return len(self.data[:self.pointer + 1]) == 0
    
    def isFull(self):
        return len(self.data) == self.size

def isNumber(s):
    return s.isdigit()

def calc(arg1, arg2, op):
    if (op == '+'):
        return arg1 + arg2
    elif (op == '-'):
        return arg1 - arg2
    elif (op == '*'):
        return arg1 * arg2

IN = input().split()
stack = Stack()
for input_str in IN:
    if isNumber(input_str):
        stack.push(int(input_str))
    else:
        op = input_str
        arg2 = stack.pop()
        arg1 = stack.pop()
        stack.push(calc(arg1, arg2, op))

print(stack.pop())




Measured memory_bytes: 5604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int flag=0;
    string s1,s2;
    cin >> s1 >> s2;
    rep(i,s1.length()){
        if(s1==s2){
            flag=1;
            break;
        }
        else{
            s1=s1[s1.length()-1]+s1.substr(0,s1.length()-1);
        }
    }
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

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

    string result = "No";
    for (int i = 1; i <= 9; i++) {
        if (N % i == 0 && N / i < 10) {
            result = "Yes";
        }
    }
    cout << result << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stack>
using namespace std;
int main()
{
	int n,q,opt,t,x;
	cin >> n;
	stack<int> a[n];
	cin >> q;
	while (q--)
	{
		cin >> opt;
		if (opt == 0)
		{
			cin >> t >> x;
			a[t].push(x); 
		}
		if (opt == 1)
		{
			cin >> t;
			if (!a[t].empty())
			cout << a[t].top() << endl;
		}
		if (opt == 2)
		{
			cin >> t;
			if (!a[t].empty())
			a[t].pop();
		}
	}
	return 0;
}


Measured memory_bytes: 4420
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define F first
#define S second
#define MP make_pair
#define PB push_back

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define mod 1000000007
#define maxn 100009
#define maxr 100009
vector<vector<pair<int,ll>>> adlist(100005);
multiset<pair<int,long long>> adlist1[100005];
int ans[100005];
void dfs(int now)
{
	for(auto i=adlist[now].begin();i!=adlist[now].end();++i)
	{
		auto p=*i;
		if(ans[p.F]==-1)
		{
			ans[p.F]=ans[now];
			if(p.S%2LL==1)
			{
				++ans[p.F];
				ans[p.F]%=2;
			}
			dfs(p.F);
		}
	}
}
int main(){
	
	int u,v,n;
	cin>>n;
	ll w;
	fr(i,0,n-1){
		cin>>u>>v>>w;
		u--,v--;
		adlist[u].PB(MP(v,w));
		adlist[v].PB(MP(u,w));
	}
	fr(i,0,n)
		ans[i]=-1;
	ans[0]=0;
	dfs(0);
	fr(i,0,n)
		cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 13696
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1000000007;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 2020; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j]);
//       }
//     }
//   }
//   return 0;
// }


// int factorial(int n){
//   if(n == 0) return 1;
//   return n*factorial(n-1);
// }

// int divisor(int a){
//   int cnt = 0;
//   for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
//   return cnt;
// }

// int comb(int n, int k){
//   return fact(n) / (fact(n-k)*fact(k));
// }

// int answer(bool f){
//   if(f) cout << "Yes" << endl;
//   else cout << "No" << endl;
//   return 0;
// }






int main(){
  int a,b;
  cin >> a >> b;
  if(a < 10 && b < 10) cout << a*b << endl;
  else cout << -1 << endl;
  

  return 0;
}







Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y,z;
  cin >> x >> y >> z;
  for(int i=0;i<100000;i++){
    if(y*i+z*(i+1)>x){
      cout << i-1 << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

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

  map<ll, ll> mp;
  for (ll i = 0; i < N; i++)
  {
    ll A;
    cin >> A;
    mp[A]++;
  }

  ll ans = 0;
  while (!mp.empty())
  {
    auto ax = *mp.rbegin();
    ll a = ax.first, x = ax.second;
    ll b = ((1 << (ll)log2(a)) * 2) - a;

    mp[a]--;
    if (mp[a] == 0)
      mp.erase(a);
    if (mp.count(b) > 0)
    {
      ans++;
      mp[b]--;
      if (mp[b] == 0)
        mp.erase(b);
    }

    //cerr << a << " " << b << endl;
    //cerr << mp.size() << endl;
  }

  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()

const int maxn = 1e5 + 100;
const ll inf = 2e18, mod = 1e9 + 7;

int n, a[maxn], deg[maxn], dp[maxn];
vector<int> adj[maxn];
set<pair<int, int> > st;

bool cmp(int a, int b)
{
	return (dp[a] < dp[b]);
}

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

	cin >> n;
	a[0] = -1;
	for (int i = 1; i < n; i++)
	{
		cin >> a[i];
		deg[--a[i]]++;
		adj[a[i]].pb(i);
	}
	for (int i = 0; i < n; i++)
		st.insert(mp(deg[i], i));

	while (!st.empty())
	{
		int now = st.begin()->ss;
		st.erase(st.begin());

		sort(all(adj[now]), cmp);
		for (int i = adj[now].size() - 1; i >= 0; i--)
			dp[now] = max(dp[now], dp[adj[now][i]] + ((int)adj[now].size() - i));

		if (a[now] != -1)
		{
			st.erase(mp(deg[a[now]], a[now]));
			st.insert(mp(--deg[a[now]], a[now]));
		}
	}

	cout << dp[0] << endl;
}



Measured memory_bytes: 11648
#include<stdio.h>
#include<math.h>
#include <stdlib.h>
#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int N=100010;
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
int main(){
	int k=10, ans=0;
	int b[5], anss;
	cin>>b[0]>>b[1]>>b[2]>>b[3]>>b[4]>>k;
//	for(int i=0;i<5;i++){
//		cin>>b[i];
//	}
	rep(i, 5){
		if((b[i]-1)%10<k){
			k=b[i]%10;
		}
		ans=ans+(b[i]+9)/10;
	}
	anss=ans*10+k-10;
	if(k==0){
		anss=anss+10;
	}
	cout<<anss<<endl;




/*	qsort(b, 5, sizeof(int), compare_int);
	if(b[4]-b[0]>k){
		printf(":(\n");
	}
	else{
		printf("Yay!\n");
	}
		rep(i, n){
		ans=c;
		rep(j, m){
			cin>>imp;
			ans=ans+imp*b[j];
		}
		if(ans>0){
			anss++;
		}
	}
	cout<<anss<<endl;
}*/
}

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

int n, k, x, y, ans;
char c;
int b[1010][1010][2];

inline int get_num()
{
	int now = 0;
	char ch = getchar();
	while(!isdigit(ch)) ch = getchar();
	while(isdigit(ch)){
		now = (now << 1) + (now << 3) + ch - '0';
		ch = getchar();
	}
	return now;
}

inline char get_char()
{
	char ch = getchar();
	while(ch != 'B' && ch != 'W') ch = getchar();
	return ch;
}

int main()
{
	n = get_num(), k = get_num();
	for(int i = 1; i <= n; ++i){
		x = get_num(), y = get_num(), c = get_char();
		int sx = x, sy = y;
		x = x % k, y = y % k;
		if(x == 0) x = k;
		if(y == 0) y = k;
		if((sx - x + sy - y) / k % 2 == 1){
			if(c == 'W') c = 'B';
			else c = 'W';
		}
		if(c == 'W') b[x][y][0]++;
		else if(c == 'B') b[x][y][1]++;
	}
	for(int i = 1; i <= k; ++i){
		for(int j = 1; j <= k; ++j){
			b[i][j][0] += b[i - 1][j][0] + b[i][j - 1][0] - b[i - 1][j - 1][0];
			b[i][j][1] += b[i - 1][j][1] + b[i][j - 1][1] - b[i - 1][j - 1][1];
		}
	}
	for(int i = 0; i <= k; ++i){
		for(int j = 0; j <= k; ++j){
			ans = max(ans, b[k][k][0] - b[i][k][0] - b[k][j][0] + 2 * b[i][j][0]
					 + b[i][k][1] + b[k][j][1] - 2 * b[i][j][1]);
			ans = max(ans, b[k][k][1] - b[i][k][1] - b[k][j][1] + 2 * b[i][j][1]
					 + b[i][k][0] + b[k][j][0] - 2 * b[i][j][0]);
		}
	}
	if(ans == 5) ans = 4;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 8192
#include <iostream>

using namespace std;

int f(int a)
{
    int s = 0;
    for (int i = 1000000000; i > 0; i /=10)
    {
        s+=a/i;
        a%=i;
    }
    return s;
}

int main()
{
   int n;
   cin>>n;
   if (n % f(n) == 0)
    cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256