akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define lint long long
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define vl vector<long long>
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mod 1000000007
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define F first
#define S second
int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
long long INF = 1e9;
int main(){
    int p,q,r;cin>>p>>q>>r;
    cout << p + q + r - max(p,max(q,r)) << endl;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
if n<10:
    print(n)
elif n<100:
    print("9")
elif n<1000:
    print(9+n-99)
elif n<10000:
    print("909")
elif n<100000:
    print(909+n-9999)
elif n==100000:
    print("90909")


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
int n, m, BACK[100005];
queue<int> q;
vector<int> v[100005];
int main() {
    int x, y;
    cin >> n >> m;
    memset(BACK, -1, sizeof BACK);
    for(int i = 1; i <= m; i++)
        cin >> x >> y, v[x].push_back(y), v[y].push_back(x);
    q.push(1);
    while(!q.empty()) {
        int TOP = q.front();
        q.pop();
        for(int i = 0; i < v[TOP].size(); i++)
            if(BACK[v[TOP][i]] == -1)
                BACK[v[TOP][i]] = TOP, q.push(v[TOP][i]);
    }
    cout << "Yes" << endl;
    for(int i = 2; i <= n; i++)
        cout << BACK[i] << endl;
    return 0;
}


Measured memory_bytes: 10412
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);

		str = br.readLine().split("");

		int tsu = 0;

		for (int i = 0; i < n - 1; i++) {
			if (!str[i].equals(str[i + 1])) {
				tsu++;
			}
		}
		System.out.println(n - 1 - Math.max(tsu - k * 2, 0));
	}
}

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

int main() {
  int n, ans = 1, x = 0;
  cin >> n >> x;
  for (int i = 1; i < n; i++) {
    int y;
    cin >> y;
    if (x > y) {
      ans++;
      x = y;
    }
  }
  cout << ans;
}

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll H, W, K;
vector<VL> dp;

bool judge(ll k) {
    REP(i, W - 2) {
        if((k >> i & 1) && (k >> (i + 1) & 1)) return false;
    }
    return true;
}

int main() {
    cin >> H >> W >> K;
    dp.assign(H + 1, VL(W, 0));
    dp[0][0] = 1;
    REP(i, H) REP(j, W) REP(k, 1 << (W - 1)) {
        if(judge(k)) {
            if(j >= 1 && (k >> (j - 1) & 1)) {
                dp[i + 1][j - 1] += dp[i][j];
                dp[i + 1][j - 1] %= MOD;
            } else if(j <= W - 2 && (k >> j & 1)) {
                dp[i + 1][j + 1] += dp[i][j];
                dp[i + 1][j + 1] %= MOD;
            } else {
                dp[i + 1][j] += dp[i][j];
                dp[i + 1][j] %= MOD;
            }
        }
    }
    cout << dp[H][K - 1] << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#define llint long long
#define mod 1000000007

using namespace std;

llint k, q;
llint d[5005], dd[5005];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> k >> q;
	for(int i = 0; i < k; i++) cin >> d[i];
	
	llint n, x, m;
	for(int z = 0; z < q; z++){
		cin >> n >> x >> m;
		n--, x %= m;
		
		for(int i = 0; i < k; i++){
			dd[i] = d[i] % m;
			if(dd[i] == 0) dd[i] = m;
		}
		llint sum = 0;
		for(int i = 0; i < k; i++) sum += dd[i];
		
		llint a = sum/m, b = sum%m;
		llint ans = a * (n/k);
		llint pro = b * (n/k);
		//cout << a << " " << b << endl;
		ans += pro / m, pro %= m;
		x += pro;
		if(x >= m) ans++, x -= m;
		
		//cout << ans << endl;
		
		llint N = n%k;
		for(int i = 0; i < N; i++){
			x += dd[i];
			if(x >= m) x -= m, ans++;
		}
		cout << n - ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
	int N, X, T;

	cin >> N >> X >> T;
	
	/*
	N = 20;
	X = 12;
	T = 6;
	*/

	cout << (N / X + (N % X ? 1 : 0)) * T << endl;

	return (0);
}


Measured memory_bytes: 3188
# -*- coding: utf-8 -*-
# 文字列の入力
import math
k = input()
k = k.split()
N = int(k[0])
K = int(k[1])
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
print(combinations_count(N+K-1, N)%(10**9+7))



Measured memory_bytes: 5676
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,W;

	cin>>n>>W;

	int w[n+1],i;
	long long v[n+1];

	for(i=1;i<=n;i++)
		cin>>w[i]>>v[i];


	long long dp[n+1][W+1]={0};
	for(i=0;i<=n;i++)
		dp[i][0] = 0;
	for(i=0;i<=W;i++)
		dp[0][i] = 0;
	
	for(int j=1;j<=W;j++)
	{
		for(i=1;i<=n;i++)
		{
			if(j-w[i]>=0)
			{
				dp[i][j] = max(dp[i-1][j], v[i] + dp[i-1][j-w[i]]);
			}
			else
				dp[i][j] = dp[i-1][j];
			//cout<<"dp["<<i<<"]["<<j<<"]:"<<dp[i][j]<<endl;
		}
	}

	cout<<dp[n][W];

	
}

Measured memory_bytes: 82396
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created: 日 10/22 21:08:14 2017

# Usage
#
"""
from functools import reduce
from itertools import repeat


def multipler(x, y):
    return x*y

def hundred_or_one(l: list):
    return [True if x == 100 else False for x in l]
    # return [True if x == 1 or x == 100 else False for x in l]

def check_odds(l :list):
    return [True if x % 2 == 0 else False for x in l]

def check_hun(l: list):
    return [True if x == 100 else False for x in l]

def main(num, data:list):
    """
    >>> main(1, [2])
    1
    >>> main(1, [3])
    2
    >>> main(10, [90,52,56,71,44,8,13,30,57,84])
    58921
    >>> main(2, [2,3])
    7
    >>> main(2, [100,100])
    3
    >>> main(1, [100])
    1
    >>> main(2, [1,1])
    8
    >>> main(1, [1])
    2
    >>> main(2, [1,2])
    7
    >>> main(2, [1,3])
    8
    >>> main(2, [1,100])
    5
    >>> main(3, [1,1,100])

    >>> main(3, [1,100,100])
    """
    hun_one = hundred_or_one(data)
    odds = check_odds(data)  # 偶数の数
    huns = check_hun(data)

    basis = [3 for t in hun_one]

    # basis = [2 if t else 3 for t in hun_one]
    remover = [2 if o else 1 for o in odds]

    remover_num = int(reduce(multipler, remover))
    # if sum(huns) > 0:
    #     remover_num = int(remover_num / 2 ** sum(huns))

    basic_answer = reduce(multipler, basis)
    # print(basic_answer)
    # print(remover_num)
    return basic_answer - remover_num

if __name__ == '__main__':
    # import doctest
    # doctest.testmod()
    num = int(input())
    data = input().split(" ")
    data = [int(i) for i in data]

    print(main(num, data))


Measured memory_bytes: 3700
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {

    /** 入力される山の数 */
    private static final int NUMBER_OF_INPUT_MOUNTAIN = 10;

    /** 出力する山の数 */
    private static final int NUMBER_OF_OUTPUT_MOUNTAIN = 3;

    /**
     * 入力された山の高さから一番高い山を取得する。
     * 山の高さは 0 <= height <= 10000、データの数は 10 個。
     *
     * @param args
     */
    public static void main(String[] args) throws IOException {
        // 入力値を整数リストとして取得する
        List<Integer> heightList = readHeight();

        // 昇順でソートし、逆順にする
        Collections.sort(heightList);
        Collections.reverse(heightList);

        // 指定件数だけ表示する
        printHeight(heightList);
    }

    /**
     * 既定の回数だけ、標準入力から数字を読み、数値のリストにして返却する。
     *
     * @return 入力された山の高さを表す数値のリスト
     */
    protected static List<Integer> readHeight() throws IOException {

        List<Integer> heightList = new ArrayList<Integer>();
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        // 既定の回数だけ山の高さを読み込む
        for (int i = 0; i < NUMBER_OF_INPUT_MOUNTAIN; i++) {
            String line = reader.readLine();
            heightList.add(Integer.parseInt(line));
        }
        // ストリームをクローズする
        if (reader != null) {
            reader.close();
        }

        return heightList;
    }

    /**
     * 既定の回数だけ、ソート済みの山の高さを表す整数リストを出力する。
     *
     * @param heightList ソート済みの山の高さを表す整数リスト
     */
    protected static void printHeight(List<Integer> heightList) {
        for (int i = 0; i < NUMBER_OF_OUTPUT_MOUNTAIN; i++) {
            System.out.println(heightList.get(i));
        }
    }

}

Measured memory_bytes: 17036
N, M = map(int, input().split())
H = list(map(int, input().split()))

sm = []
for i in range(M):
    A, B = map(int, input().split())
    if H[A-1] <= H[B-1] :
      sm.append(A)
    if H[B-1] <= H[A-1] :
      sm.append(B)
print(N - len(set(sm)))

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

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  vector<int> C(0);
  
  for (int i = 1; i <= A; i++) {
    if (A % i ==0 && B % i == 0) {
      C.push_back(i);
    }
  }
  reverse(C.begin(), C.end());
  cout << C.at(K-1) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n;
    cin>>n;
    vector<pair<ll,ll>> p(n);
    rep(i,n) cin>>p[i].second>>p[i].first;
    sort(all(p));
    ll now=0;
    rep(i,n){
        now+=p[i].second;
        if(now>p[i].first){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3328
// AOJ 1320: City Merger
// 2017.12.31 bal4u@uu

#include <stdio.h>
#include <string.h>

#define INF 0x70707070
char *city[16]; int csz[16];
char name[16][22]; int nsz[16]; char f[16];
int cost[16][16];
int dp[65536][16];

int naiveMatch(char *text, int len, char *pattern, int patlen)
{
    char c;
    char *tp, *pp;
    char *textEnd, *patEnd;

    if (len < patlen) return 0;

    textEnd = text + len - patlen + 1;
    patEnd  = pattern + patlen;

    c = *pattern++;
    while (text != textEnd) {
        if (*text++ == c) {
            tp = text;
            pp = pattern;
            do if (pp == patEnd) return 1;
            while (*tp++ == *pp++);
        }
    }
    return 0;
}

int calc(char *a, int alen, char *b, int blen)
{
	int i, k, ans = INF;

	for(i = alen-1, k = 1; i >= 0 && k <= blen; i--, k++) {
		if (memcmp(a+i, b, k) == 0) ans = k;
	}
	return ans;
}

int main()
{
	int n, i, j, k, s, lim, ans;

	while (scanf("%d", &n) && n > 0) {
		for (i = 0; i < n; i++) {
			scanf("%s", name[i]), nsz[i] = strlen(name[i]);
		}

		memset(f, 0, sizeof(f));
		for (i = 0; i < n; i++) {
			if (f[i]) continue;
			for (j = 0; j < n; j++) if (j != i) {
				if (naiveMatch(name[i], nsz[i], name[j], nsz[j])) f[j] = 1;
			}
		}

		k = 0;
		for (i = 0; i < n; i++) {
			if (f[i]) continue;
			city[k] = name[i], csz[k++] = nsz[i];
		}
		n = k;

		for (i = 0; i < n; i++) for (j = 0; j < n; j++) {
			if (j == i) cost[i][j] = csz[i];
			else {
				k = calc(city[i], csz[i], city[j], csz[j]);
				if (k == INF) cost[i][j] = csz[j];
				else          cost[i][j] = csz[j]-k;
			}
		}

		memset(dp, INF, sizeof(dp));
		for (i = 0; i < n; i++) dp[1<<i][i] = csz[i];

		lim = (1<<n) - 1;
		for (s = 0; s <= lim; s++) {
			for (i = 0; i < n; i++) if ((s >> i) & 1) {
				for (j = 0; j < n; j++) {
					if ((s >> j) & 1) continue;
					k = dp[s][i] + cost[i][j];
					if (k < dp[s|(1<<j)][j]) dp[s|(1<<j)][j] = k;
				}
			}
		}

		ans = INF;
		for (i = 0; i < n; i++) {
			k = dp[lim][i];
			if (k < ans) ans = k;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 5864
package main

import (
	"fmt"
	"sort"
)

func main() {
	var sx, sy, tx, ty int
	fmt.Scan(&sx, &sy, &tx, &ty)
	start := []int{1, 1}
	target := []int{tx - sx + start[0], ty - sy + start[1]}

	visited := make([][]bool, tx-sx+3)
	for i := range visited {
		visited[i] = make([]bool, ty-sy+3)
	}

	now := start
	dic := map[rune][]int{}
	ans := ""

	dic['U'] = []int{0, 1}
	dic['D'] = []int{0, -1}
	dic['L'] = []int{-1, 0}
	dic['R'] = []int{1, 0}

	for i := 0; i < 4; i++ {
		var goal []int
		if i%2 == 0 {
			goal = target
		} else {
			goal = start
		}

		for now[0] != goal[0] || now[1] != goal[1] {
			cnddt := []int{}
			for _, k := range "UDLR" {
				next := []int{now[0] + dic[k][0], now[1] + dic[k][1]}
				if next[0] < 0 || target[0]+1 < next[0] {
				} else if next[1] < 0 || target[1]+1 < next[1] {
				} else if (next[0] == goal[0] && next[1] == goal[1]) || !visited[next[0]][next[1]] {
					cnddt = append(cnddt, (diff(next, goal)-diff(now, goal)+1)*1000+int(k))
				}
			}
			sort.Ints(cnddt)
			k := rune(cnddt[0] % 1000)
			ans += string(k)
			next := []int{now[0] + dic[k][0], now[1] + dic[k][1]}
			visited[next[0]][next[1]] = true
			now = next
		}
	}
	fmt.Println(ans)
}

func diff(a, b []int) int {
	return abs(a[0]-b[0]) + abs(a[1]-b[1])
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 11008
/*
Author : N_o_o_B
Created : January 21 2020 13:05:57 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n;
    cin >> n;
    vi p(n);
    int mn = mod;
    int ans = 0;
    fori(i,n){
        cin >> p[i];
        mn = min(mn,p[i]);
        if(mn >= p[i]) ans++;
    }

    cout << ans << endl;

    time_taken();
    return 0;
}

Measured memory_bytes: 1152
//#include <bits/stdc++.h>
#include <stack>
#include <iostream>
#include <vector>
using namespace std;
int main() {
	//入力
	double x[10],ans;
	string u[10];
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> u[i];
		if (u[i] == "JPY") ans += x[i];
		else ans += x[i] * 380000.0;
	}
	//処理
	//出力
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

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

      int a = Integer.parseInt(sc.next());
      int b = Integer.parseInt(sc.next());

      int ans = 0;

for(int i=1;i<=2;i++){
      if(a>=b){
       ans += a;
       a = a-1;
      }
      else{
       ans += b;
       b = b-1;
     }
}


      System.out.println(ans);

    }
}


Measured memory_bytes: 23764
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(998244353)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
int main()
{
	int n;	
	cin>>n;
	bool ok = 0;
	vector<ll>a(n),b(n);
	for(int i=0;i<n;i++)cin>>a[i]>>b[i];
	for(int i=0;i<n;i++){
		int j = i;
		if(a[i] == b[i]){
			while(j+1<n && a[j+1] == b[j+1])j++;
			if(j-i+1 >= 3)ok = 1;
			//cout<<i<<" "<<j<<'\n';
			i = j;
		}
	}
	if(ok)cout<<"Yes";
	else cout<<"No";
}


Measured memory_bytes: 3552
N = int(input())
mod10 = N % 10
hon_list = [2, 4, 5, 7, 9]
pon_list = [0, 1, 6, 8]
bon_list = [3]

if mod10 in hon_list:
    print('hon')
elif mod10 in pon_list:
    print('pon')
elif mod10 in bon_list:
    print('bon')



Measured memory_bytes: 9068
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    i32 X;
    cin >> X;
    if (X >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main(){
    int n;
    cin>>n;
    ll ans=0;
    bool ok=true;
    while(ok){
        ans+=1000;
        if(ans>=n)ok=false;
    }
    cout<<ans-n<<endl;

}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main() {
  long observatory_number,road_number;
  cin >> observatory_number >> road_number;
  vector<long long> elevation(observatory_number);
  vector<int> elevation_top(observatory_number,0);
  int observatory_count=0;
  for (int i=0; i < observatory_number; i++){
    int elevation_height;
    cin >> elevation_height;
    elevation[i] = elevation_height;
  }
  for (int j=0;j < road_number; j++){
    int road_A,road_B;
    cin >> road_A >> road_B;
    if (elevation[road_A-1] == elevation[road_B-1]){
    	elevation_top[road_A-1] = 1;
      	elevation_top[road_B-1] = 1;
      }
    if (elevation[road_A-1] < elevation[road_B-1]){
    	elevation_top[road_A-1] = 1;
      }
    else if (elevation[road_A-1] > elevation[road_B-1]){
      elevation_top[road_B-1] = 1;
    }
    }
  for (int k=0;k < observatory_number ; k++){
    if (elevation_top[k] == 0){
      observatory_count++;
    }
  }
  cout << observatory_count<< endl;
}

Measured memory_bytes: 4576
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val n, m, d = in.next().toLong

  val oneBlock = {
    if(d > (n/2)) {
      if(d % 2 == 0) {
        val zero = (d - (n/2)) * 2
        val one = n - zero

        one / (n*n)
      }
      else{
        val zero = (d - (n/2)) * 2 - 1
        val one = n - zero

        one / (n*n)
      }
    }
    else if(d == 0) {
      n.toDouble / (n*n)
    }
    else {
      (d*2 + (n - 2*d)*2L).toDouble / (n*n)
    }
  }


  println(oneBlock * (m-1))
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}



Measured memory_bytes: 25412
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    string input, longest, many;
    int len = 0, count = 0;;
    map<string, int> wordCount;
    while(cin >> input){
        if(len < input.size()){
            len = input.size();
            longest = input;
        }
        wordCount[input]++;
        if(count < wordCount[input]){
            count = wordCount[input];
            many = input;
        }
    }
    cout << many << ' ' << longest << endl;
}

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

int main() {
	string A, B; cin >> A >> B;
	int a = A.size(), b = B.size();
	if( a < b ){
		cout << "LESS" << endl;
		return 0;
	}
	if( a > b ){
		cout << "GREATER" << endl;
		return 0;
	}
	for( int i = 0; i < a; i++ ){
		if(A[i] < B[i]){
			cout << "LESS" << endl;
			return 0;
		}
		if(A[i] > B[i]){
			cout << "GREATER" << endl;
			return 0;
		}
	}
	cout << "EQUAL" << endl;
}

Measured memory_bytes: 256
/***
**   AUTHOR::ASHUTOSH MOUDGIL
***/


#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second
#define int long long
//#define ll long long
#define all(x) x.begin(),x.end()
#define rsort(x) sort(all(x)); reverse(all(x));
#define endl '\n'
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define vi vector<int>
#define vlli vector<long long>
#define pii pair<int,int>
#define mod 1000000007
#define LMAX 1e18
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define PI 3.141592654
//#define rz(x) resize(x)
//#define rz(x,y) resize(x,y)



void mymain(){
   int n;
   cin >> n;
   set<int> a;
   for(int i=0;i<n;i++){
    int x;
    cin >> x;
    a.insert(x);
   }
   if(a.size() == n)
    cout <<"YES" <<endl;
   else
    cout << "NO" <<endl;

}

signed main(){
//IOS;
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);
int t=1;
//cin>>t;
for(int tt=0;tt<t;tt++){
   ///cout << "Case #" << tt+1 <<": ";
   mymain();
   }
return 0;
}
/*

*/


Measured memory_bytes: 9600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[] sides = new int[6];
		String[] str = br.readLine().split(" ");
		for (int i = 0; i < 6; i++) {
			sides[i] = Integer.parseInt(str[i]);
		}
		int su1 = 0;
		int su2 = 0;
		int num = Integer.parseInt(br.readLine());
		int[] result = new int[num];

		for(int i = 0; i < num; i++){
			str = br.readLine().split(" ");
			su1 = Integer.parseInt(str[0]);
			su2 = Integer.parseInt(str[1]);
			if(sides[0] == su1){//1
				if(sides[1] == su2){
					result[i] = sides[2];
				}else if(sides[2] == su2){
					result[i] = sides[4];
				}else if(sides[3] == su2){
					result[i] = sides[1];
				}else if(sides[4] == su2){
					result[i] = sides[3];
				}
			}
			if(sides[1] == su1){
				if(sides[0] == su2){
					result[i] = sides[3];
				}else if(sides[2] == su2){
					result[i] = sides[0];
				}else if(sides[3] == su2){
					result[i] = sides[5];
				}else if(sides[5] == su2){
					result[i] = sides[2];
				}
			}
			if(sides[2] == su1){
				if(sides[1] == su2){
					result[i] = sides[5];
				}else if(sides[0] == su2){
					result[i] = sides[1];
				}else if(sides[4] == su2){
					result[i] = sides[0];
				}else if(sides[5] == su2){
					result[i] = sides[4];
				}
			}
			if(sides[3] == su1){
				if(sides[1] == su2){
					result[i] = sides[0];
				}else if(sides[0] == su2){
					result[i] = sides[4];
				}else if(sides[4] == su2){
					result[i] = sides[5];
				}else if(sides[5] == su2){
					result[i] = sides[1];
				}
			}
			if(sides[4] == su1){
				if(sides[0] == su2){
					result[i] = sides[2];
				}else if(sides[2] == su2){
					result[i] = sides[5];
				}else if(sides[3] == su2){
					result[i] = sides[0];
				}else if(sides[5] == su2){
					result[i] = sides[3];
				}
			}
			if(sides[5] == su1){
				if(sides[1] == su2){
					result[i] = sides[3];
				}else if(sides[2] == su2){
					result[i] = sides[1];
				}else if(sides[3] == su2){
					result[i] = sides[4];
				}else if(sides[4] == su2){
					result[i] = sides[2];
				}
			}
		}
		for(int i = 0; i < num; i++){
			System.out.println(result[i]);
		}
	}
}

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

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#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 ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int)(x).size())

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

i64 n, r;

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFIN
    freopen("input.txt", "r", stdin);
#endif

    cin >> n >> r;
    if (n >= 10) {
        cout << r << '\n';
        return 0;
    }
    n = 10 - n;
    r += 100 * n;
    cout << r << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include "queue"
#include <deque>
#include <stack>
#include <numeric>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#define MOD1 1000000007

inline void inp( long long int  &n ){n=0;int ch=getchar();int sign=1;while( ch < '0' || ch > '9' ){if(ch=='-')sign=-1; ch=getchar();}while( ch >= '0' && ch <= '9' )n = (n<<3)+(n<<1) + ch-'0', ch=getchar();n=n*sign;}
#define pi acos(-1)
#define pii pair<int,int>
#define vii vector<pii>
#define ll  long long int
#define loop(i,n) for(ll i=0;i<n;i++)
#define ll  long long int
#define LL long long int
#define loop2(i,n) for(ll i=1;i<=n;i++)
#define MIN(a,b) (a) < (b) ? (a) : (b)
#define MAX(a,b) (a) > (b) ? (a) : (b)
#define ABS(a) (a) > 0 ? (a) : -(a)
#define rep1(i,a,n) for(i=a;i<(n);i++)
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define OUT_RT cerr << (float(clock()) / CLOCKS_PER_SEC) << endl
#define EPS 1e-9
#define ld long double
using namespace std;
//JAI SHREE KRISHNA
// Find the holy grail in an  adventure frought with danger
// The bigger the occasion, the better the response.
// Never giving in, fighting to the end
// Look at  the limits
// Check if it is binary search
// Code till the end of contest

int main(){
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    ll n;
    cin>>n;
    ll ans = (ll)1e18;
    ll array[n];
    loop(i, n)
    {
        cin>>array[i];
    }
    for(ll j =-500;j<=500;j+=1)
    {
        ll sum  = 0 ;
        for(ll  i = 0 ;i<n;i+=1)
        {
            sum+=(pow(array[i]-j, 2));
        }
        ans = min(ans,sum);
    }
    
    
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define rt return
#define dll(x) scanf("%I64d",&x)
#define xll(x) printf("%I64d\n",x)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;
using namespace std;
typedef long long ll;
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;}
ll powmod(ll a,ll b,ll MOD){ll ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
int bj[maxn];
int main()
{
    int n,m;
    int k;
    int x;
    cin>>n>>m;
    int ans=0;
    repd(i,1,n)
    {
    	cin>>k;
    	while(k--)
    	{
    		cin>>x;
    		bj[x]++;
    	}
    	
    }
    repd(i,1,m)
    {
    	if(bj[i]>=n)
    	{
    		ans++;
    	}
    }
    printf("%d\n",ans );
    return 0;
}

inline void getInt(int* p) {
    char ch;
    do {
        ch = getchar();
    } while (ch == ' ' || ch == '\n');
    if (ch == '-') {
        *p = -(getchar() - '0');
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 - ch + '0';
        }
    }
    else {
        *p = ch - '0';
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 + ch - '0';
        }
    }
}



Measured memory_bytes: 256
import java.util.Scanner;
import java.util.HashMap;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		final long MOD = 1000000007;
		HashMap<Integer, Integer> primes = new HashMap<Integer, Integer>();

		for (int i = 2; i <= N; i++) {
			if (isPrime(i)) {
				primes.put(i, 0);
			}
		}
		for (int i=1; i<=N; i++) {
			int n = i;
			while (n>1) {
				for (Integer p: primes.keySet()) {
					if (n%p ==0) {
						primes.put(p, primes.get(p)+1);
						n /= p;
					}
				}
			}
		}
		
		long count = 1;
		for (Integer p: primes.keySet()) {
			count = (count * (1+primes.get(p))) % MOD;
		}
		System.out.println(count);
		sc.close();
	}

	private static boolean isPrime(int n) {
		if (n == 1 || n == 2) {
			return true;
		} else {
			for (int i = 2; i < Math.sqrt(n) + 1; i++) {
				if (n % i == 0)
					return false;
			}
		}
		return true;
	}
}


Measured memory_bytes: 23560
N, W = map(int, input().split())

w = [0]
v = [0]

for _ in range(N):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)

dp = [[float('inf') for a in range(110000)] for b in range(N+1)]
dp[0][0] = 0

ans = 0

for i in range(1, N+1):
    for j in range(110000):
        if j - v[i] >= 0:
            dp[i][j] = min(dp[i][j], dp[i-1][j-v[i]] + w[i])

        dp[i][j] = min(dp[i][j], dp[i-1][j])

        if dp[i][j] <= W and j > ans:
            ans = j

print(ans)

Measured memory_bytes: 376868
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.stream.IntStream;


class Main {
    public static void main(String[] args) throws java.lang.Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int[] NAB = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

        final long sum = IntStream.rangeClosed(0, NAB[0]).filter(i -> {
            int digitSum = Arrays.stream(String.valueOf(i).split("")).mapToInt(Integer::parseInt).sum();
            return NAB[1] <= digitSum && digitSum <= NAB[2];
        })
        .sum();

        System.out.println(sum);

    }
}

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

int main()
{
    int count = 0;
    vector<char> S(4);

    for (int i = 0; i < 4; i++)
    {
        cin >> S.at(i);

    }

    if(S.at(0)==S.at(1))
        count++;
    if (S.at(0) == S.at(2))
        count++;
    if (S.at(0) == S.at(3))
        count++;
    if (S.at(1) == S.at(2))
        count++;
    if (S.at(1) == S.at(3))
        count++;
    if (S.at(2) == S.at(3))
        count++;

    if(count==2)
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
    
}

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

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

Measured memory_bytes: 256
a, b, c, d = map(int, input().split())

p, q = c, d
while q:
  p, q = q, p % q
e = c * d // p

div_c = b // c - (a-1) // c
div_d = b // d - (a-1) // d
div_e = b // e - (a-1) // e

print(b - a + 1 - div_c - div_d + div_e)

Measured memory_bytes: 3060
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

const int N_MAX = 200000;
const int A_MAX = 1000001;

int main(){
    int N;
    int A[N_MAX];
    int X[A_MAX] = {0};
    int Y[A_MAX] = {0};
    int ans = 0;

    cin >> N;
    for(int i = 0;i < N;i++){
        cin >> A[i];
        Y[A[i]]++;
    }

    sort(A,A+N);

    for(int i = 0;i < N;i++){
        if(X[A[i]] == 0){
            if(Y[A[i]] == 1){
                ans++;
            }
            for(int j = A[i];j < A_MAX;j += A[i]){
                X[j] = 1;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 11752
#include<iostream>
#include<cstdio>
using namespace std;
 
int main(void){
        int S;
        int h;
        int m;
        int s;
        cin>>S;
        h=S/60/60;
        m=(S-60*h*60)/60;
        s=S-h*60*60-m*60;
        cout<<h;
        cout<<":";
        cout<<m;
        cout<<":";
        cout<<s;
        cout<<endl;
}


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

int main() {
    ll mod = 998244353;
    int N, S;
    cin >> N >> S;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    
    vector<vector<ll>> dp(N+1, vector<ll>(S+1, 0));
    dp[0][0] = 1;
    for (int i = 1; i <= N; i++) {
        if (S >= A[i-1]) dp[i][A[i-1]] += i;
        for (int j = 1; j <= S; j++) {
            dp[i][j] += dp[i-1][j];
            dp[i][j] %= mod;
            if (j+A[i-1] <= S) {
                dp[i][j+A[i-1]] += dp[i-1][j];
                dp[i][j+A[i-1]] %= mod;
            }
        }
    }
    
    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        ans += (dp[i][S] - dp[i-1][S] + mod) * (N+1-i);
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 70784
s=input()
k=int(input())
if len(s)>=k:
  for i in range(k):
    if s[i]!="1":
      print(s[i])
      break
  else:
    print(1)
    
else:
  for i in range(len(s)):
    if s[i]!="1":
      print(s[i])
      break

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,a,b;cin>>n;
  vector<lvector> G(n);
  lvector c(n),ans(n),deg(n);
  lque deg1;
  rep(i,n-1) {
    cin>>a>>b;a--,b--;
    G[a].emplace_back(b);G[b].emplace_back(a);
  }
  rep(i,n) {
    deg[i]=G[i].size();
    if(deg[i]==1) deg1.push(i);
  }
  rep(i,n) cin>>c[i];sort(RALL(c));
  print(accumulate(ALL(c),0)-c[0]);
  ll v,w,cpos=0;
  while(deg1.size()) {
    v=deg1.front();deg1.pop();
    if(!deg1.size()) {ans[v]=c.back();break;}
    w=G[v][0];G[v].erase(G[v].begin());
    rep(i,G[w].size()) if(G[w][i]==v) G[w].erase(G[w].begin()+i);
    deg[w]--;
    if(deg[w]==1) deg1.push(w);
    ans[v]=c.back();c.erase(c.end()-1);
  }
  rep(i,n-1) cout<<ans[i]<<' ';print(ans[n-1]);
  return 0;
}

Measured memory_bytes: 1280
void main() {
	auto N = ri;
	auto ip = readAs!(int[]), A = ip[0], B = ip[1];
	auto P = readAs!(int[]);
	P.sort();
	ulong res;
	ulong a = P.filter!(i => i <= A).array.length;
	ulong b = P.filter!(i => A+1 <= i && i <= B).array.length;
	ulong c = P.filter!(i => i >= B + 1).array.length;
	writeln(min(a, b, c));
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

int dfs(int num, int rest, int before) {
    // return?????¶
    if(num==0) {
        if (rest==0) return 1;
        return 0;
    }
    int res = 0;
    for(int i=0; i<=rest && i <= before; ++i)
        res += dfs(num-1, rest-i, i-1);

    return res;
}

int main()
{
    int n, s;
    while(cin>>n>>s && (n!=0 || s!=0))
        P(dfs(n, s, 9));
    return 0;
}

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

#define min(a, b) ((a) > (b) ? (b) : (a))

int main(void) {
  int i;
  std::string S;
  long Q;
  int T, F;
  int reversed = 0;
  std::string c;
  std::cin >> S;
  scanf("%ld", &Q);
  for(i = 0;i < Q;i++) {
    scanf("%d", &T);
    if(T == 1) {
      reversed = !reversed;
    } else {
      std::cin >> F >> c;
      if(F == 1) {
        if(reversed) S += c;
        else S.insert(0, c);
      } else {
        if(reversed) S.insert(0, c);
        else S += c;
      }
    }
  }
  if(reversed) std::reverse(S.begin(), S.end());
  std::cout << S << std::endl;
  return 0;
}


Measured memory_bytes: 900
#include <iostream>

using namespace std;

int main()
{
	int r, g, b;
	cin >> r >> g >> b;
	
	if(((r*100 + g*10 + b) % 4) == 0)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define M 1000000007
using namespace std;
const int inf=4e18;
const double pi=3.14159265358979;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int n;cin>>n;
	if(n&1)
		cout<<n/2<<endl;
	else
		cout<<n/2-1<<endl;
}

Measured memory_bytes: 256
use proconio::{input, marker::Usize1};

fn main() {
    input!(n: usize, k: usize, p: [Usize1; n], c: [i64; n]);

    let ans = (0..n)
        .map(|start| {
            let mut cycle_len = 0;
            let mut cycle_score = 0;

            let mut now = start;
            let mut visited = vec![false; n];
            while !visited[now] {
                visited[now] = true;
                cycle_score += c[now];
                cycle_len += 1;
                now = p[now];
            }

            let mut acc = 0;
            let rest = if cycle_score > 0 {
                let turn = (k - 1) / cycle_len;
                acc += turn as i64 * cycle_score;
                k - turn * cycle_len
            } else {
                k.min(cycle_len)
            };

            let mut now = start;
            (0..rest)
                .map(|_| {
                    acc += c[now];
                    now = p[now];
                    acc
                })
                .max()
                .unwrap()
        })
        .max()
        .unwrap();

    println!("{}", ans);
}


Measured memory_bytes: 2348
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define FOR(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	stack<int> st;
	for(int i;cin>>i;){
		if(i)st.push(i);
		else{cout<<st.top()<<endl;st.pop();}
	}
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	ll a, b, n;
	cin >> a >> b >> n;

	if(n >= b - 1) {
		cout << (static_cast<ll>((a * (b - 1)) / b) -
				 a * static_cast<ll>((b - 1) / b))
			 << endl;
	} else {
		cout << (static_cast<ll>((a * n) / b) - a * static_cast<ll>(n / b))
			 << endl;
	}
	return 0;
}


Measured memory_bytes: 3676