akhauriyash/Code-Regression huggingface dataset:
using System.Collections.Generic;
using System.Linq;
using System;
 
class p{
  static void Main(){
    
    int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int A = n[0]; int B = n[1]; int C = n[2]; int X = n[3]; int Y = n[4];
    
    int ans = 0;
    if (2 * C <= A + B) {
      ans += C * 2 * Math.Min(X, Y);
      if (X >= Y) ans += 2 * C <= A ? 2 * C * (X - Y) : A * (X - Y);
      else ans += 2 * C <= B ? 2 * C * (Y - X) : B * (Y - X);
    } else ans += A * X + B * Y;
      
    Console.WriteLine(ans);
  }
}

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

using namespace std;

vector<string> split(const string& s, char c) {
    vector<string> v; stringstream ss(s); string x;
    while (getline(ss, x, c)) v.emplace_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
    stringstream s; s << "[";
    for(int i = 0; i < n - 1; i++) s << arr[i] << ",";
    s << arr[n - 1] << "]";
    return s.str();
}

#define ANTHRO(args...) {__anthro_begin(__LINE__); __anthro(split(#args, ',').begin(), args);}

inline void __anthro_begin(int line) { cerr << "#" << line << ": "; }
template<typename T> inline void __anthro_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
template<typename T> inline void __anthro_out_var(T* val) { cerr << arrStr(val,2); } //Change the values in case you want to debug something
template<typename T> inline void __anthro_out_var(T val) { cerr << val; }
inline void __anthro(vector<string>::iterator it) { cerr << endl; }

template<typename T, typename... Args>
inline void __anthro(vector<string>::iterator it, T a, Args... args) {
    cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
    __anthro_out_var(a);
    cerr << "; ";
    __anthro(++it, args...);
}
//Simple Debugger

#define ll long long
#define MOD 1000000007
#define EPS 1e-9
int const INF = (int)1e9 + 1e3;
ll const INFL = (ll)1e18 + 1e6;
/*
    This is C.Rally
    ABC 156
*/
ll sqr(ll x){
    return x*x;
}
int main(){
    ll n; cin>>n;
    vector<ll> x(n);
    ll mx=-INF;
    for(ll i=0;i<n;i++){
        cin>>x[i];
        mx=max(mx,x[i]);
    }
    ll mi=INF;
    for(ll i=1;i<=mx;i++){
        ll t=0;
        for(ll j=0;j<n;j++){
            t+=sqr(x[j]-i);
        }
        mi=min(mi,t);
    }
    cout<<mi;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	float a , b , c , d , e , f;
	while((scanf("%f %f %f %f %f %f" , &a , &b , &c , &d , &e , &f))!=EOF){
		printf("%.3f %.3f\n" , (c*e-b*f)/(a*e-b*d)+0.0 , (a*f-c*d)/(a*e-b*d)+0.0);
	}		
	return 0;
}

Measured memory_bytes: 0
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
q = int(input())
C = Counter(a)
s = sum(a)
for i in range(q):
    b, c = map(int, input().split())
    print(s + (c - b) * C[b])
    s += (c - b) * C[b]
    C[c] += C[b]
    C[b] = 0

Measured memory_bytes: 88044
#include <stdio.h>
#include <string.h>

int
main(int argc, char *argv[])
{
  char s[101];
  scanf("%s", s);
  
  int flag = 0; int n = strlen(s);
  
  for(int i = 0; i < n; i++){
    if(s[i] == 'C' && i < n - 1){
      for(int j = i + 1; j < n; j++){
        if(s[j] == 'F'){
          flag = 1;
          break;
        }
      }
    }
    if(flag == 1) break;
  }
  
  if(flag == 1) printf("Yes\n");
  else printf("No\n");
  
  return 0;
}
  

Measured memory_bytes: 128
n,q = map(int,input().split())
s = list(input())
ac = [0] * (n-1)
for i in range(n-1):
         if s[i] == "A" and s[i+1] == "C":
                  ac[i] = 1
sumac = [0]
for i in range(len(ac)):
         sumac.append(sumac[i] + ac[i])
for i in range(q):
         l,r = map(int,input().split())
         print(sumac[r-1] - sumac[l-1])


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

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

    if(N[0] == N[1] && N[1] == N[2]) 
        cout << "Yes" << endl;
    else if(N[1] == N[2] && N[2] == N[3])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

const int N = 1e5 + 10;
int a[N],b[N];

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

  int n; cin >> n;
  for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = 0; i < n; i++) cin >> b[i];

  int cnt = 0;
  int sum = 0;
  vector<int> v;
  for(int i = 0; i < n; i++){
    if(a[i]-b[i] == 0) continue;
    if(a[i]-b[i] < 0){
      cnt++;
      sum += a[i]-b[i];
    }
    else v.push_back(a[i]-b[i]);
  }
  sort(v.begin(),v.end());
  int k = 0;
  int vsize = v.size()-1;
  while(sum < 0){
    if(k > vsize){
      cout << -1 << endl;
      return 0;
    }
    sum += v[vsize-k];
    k++;
  }
  cout << cnt + k << endl;

  return 0;
}


Measured memory_bytes: 2428
#include <bits/stdc++.h>
using namespace std;
//配列に全部入れる
//ソートしてat(0)が0なら0を出力してreturn 0;する
//そうじゃないならループ回して結果がオーバーフローしない限りat(i)を答えにかける
//オーバーフローしたらその時点で-1を出してreturn 0;する
int main(){
  //配列に入れてソートする
  int n;
  cin >> n;
  vector<long long int> list(n);
  for (int i=0; i<n; i++) {
    cin >> list.at(i);
  }
  sort(list.begin(),list.end());
  //もし0があればソートで一番前に来てるので判定
  if (list.at(0) == 0) {
    cout << 0 << endl;
    return 0;
  }
  long long int a=1;
  //n回のループを回す
  for (int i=0; i<n; i++) {
    //オーバーフローしてたら-1出してreturn 0;する処理
    if (list.at(i) > 1000000000000000000/a) {
      cout << -1 << endl;
      return 0;
    //そうじゃなかったら.at(i)を答えにかけていく
    } else {
      a *= list.at(i);
    }
  }
  cout << a << endl;
}

Measured memory_bytes: 4020
#include <stdio.h>

int main()
{

int a[10000], min, max, n, i;
long long sum = 0;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &a[i]);
sum += a[i];
}
max = min = a[0];
for(i = 1; i < n; i++){
if(a[i] > max)max = a[i];
if(a[i] < min)min = a[i];
}
printf("%d %d %lld\n", min, max, sum);

return 0;
}


Measured memory_bytes: 2124
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            long[][] x = in.nextLongArrayArray(n, 3);

            long ans = 0;
            for (int i = 0; i < 8; i++) {
                long[] a = new long[n];
                for (int j = 0; j < n; j++) {
                    long sum = 0;
                    for (int k = 0; k < 3; k++) {
                        if ((i >> k & 1) == 1) {
                            sum += x[j][k];
                        } else {
                            sum -= x[j][k];
                        }
                    }
                    a[j] = sum;
                }
                Arrays.sort(a);

                long s = 0;
                for (int j = 0; j < m; j++) {
                    s += a[n - 1 - j];
                }

                ans = Math.max(ans, s);
            }

            out.println(ans);
        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public long nextLong() {
            return Long.parseLong(nextString());
        }

        public long[] nextLongArray(int n) {
            long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long[][] nextLongArrayArray(int n, int m) {
            long[][] res = new long[n][m];
            for (int i = 0; i < n; i++) {
                res[i] = nextLongArray(m);
            }
            return res;
        }

    }
}



Measured memory_bytes: 22996
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i, MAT.size()){
    REP(j, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(void){
      return;
    };
    HOGE(CLASS1 key, CLASS2 value){
      this->key = key;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  string S;
  cin >> S;
  ll ans = 1000;
  REP(i, S.size()-2){
    ll tmp = (S[i]-'0')*100 + (S[i+1]-'0')*10 + (S[i+2]-'0');
    ans = min(ans, abs(tmp-753));
  }

  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    int64_t x;
    mint(int64_t x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(int64_t t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    //for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) {return mint(*this) /= a;}
};

istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];

    int mi = 0;
    vi num(n);
    rep(i, n) {
        num[i] = i+mi+1;
        int j = (a[i]+1)>>1;
        chmin(mi, j-i-1);
    }
    mint ans = 1;
    rep(i, n) ans *= num[i];

    cout << ans << endl;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int H=in(),W=in();
	vector<vector<int>> M(H,vector<int>(W,0)),D(H,vector<int>(W,1<<30));
	int white=0;
	REP(i,H){
		string S=in<string>();
		REP(j,W){
			if(S[j]=='#') M[i][j]=1;
			else white++;
		}
	}

	D[0][0]=0;
	queue<int> Q;
	Q.push(0);
	while(!Q.empty()){
		auto V=Q.front();
		Q.pop();
		int u=V%W,v=V/W;

		if(u<W-1 && !M[v][u+1] && D[v][u+1]>D[v][u]+1){
			D[v][u+1]=D[v][u]+1;
			Q.push(u+1+v*W);
		}
		if(u>0 && !M[v][u-1] && D[v][u-1]>D[v][u]+1){
			D[v][u-1]=D[v][u]+1;
			Q.push(u-1+v*W);
		}
		if(v<H-1 && !M[v+1][u] && D[v+1][u]>D[v][u]+1){
			D[v+1][u]=D[v][u]+1;
			Q.push(u+(v+1)*W);
		}
		if(v>0 && !M[v-1][u] && D[v-1][u]>D[v][u]+1){
			D[v-1][u]=D[v][u]+1;
			Q.push(u+(v-1)*W);
		}
	}

	if(D[H-1][W-1]>=1<<30) out(-1);
	else out(white-D[H-1][W-1]-1);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  int n,k; cin>>n>>k;
  string s; cin >> s;
  rep(i,n) {
    if (i == k-1) {
      putchar(tolower(s[i]));
    }
    else {
      cout << s[i];
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] a = sc.next().split("");
        int cnt = 0;
        for (String operand : a) {
            switch (operand) {
                case "+": cnt++;
                    break;
                case "-": cnt--;
                    break;
            }
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 19796
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
const long long mod=998244353;
long long C[5005][5005];
int n,k;
long long calc(int n, int k)
{
    if (n<0 || k<0 || k>n) return 0;
    return C[n][k];
}
int main()
{
	scanf("%d%d",&k,&n);
	for (int i=0;i<=5001;i++)
	{
		C[i][0]=C[i][i]=1;
		for (int j=1;j<i;j++)
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
	for (int i=2;i<=k+k;i++)
	{
		int u=i/2,v=max(1,i-k);
		long long ans=0;
		for (int j=0;j<=u-v+1;j++)
			ans=(ans+calc(u-v+1,j)*calc(n+k-j-j-1,n-j-j)*((j%2==0)?1:-1)%mod)%mod;
		printf("%lld\n",(ans+mod)%mod);
	}
	return 0;
}

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

constexpr char NL = '\n';
constexpr int MOD = 1e9 + 7;

struct safe_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

void solve()
{
    int n, x, t; cin >> n >> x >> t;
    cout << (n + x - 1) / x * t << NL;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <limits>

using namespace std;

typedef int ll;

ll mix_player_id(ll l, ll r) {
	if (l > r) {
		swap(l, r);
	}
	return l * 1000 + r;
}

int main (int argc, char* argv[]) {
	ll n;
	cin >> n;
	vector<queue<ll>> players(n);
	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j < n - 1; j++) {
			ll opp;
			cin >> opp;
			opp--;
			players[i].push(mix_player_id(i, opp));
		}
	}

	vector<ll> found(2000000, -1);

	int days = 0;
	vector<ll> update;
	vector<ll> next_update;
	for (ll i = 0; i < players.size(); i++) {
		update.push_back(i);
	}
	while (true) {
		next_update.clear();
		bool is_finished = true;
		bool progressed = false;
		vector<bool> fought(1000);
		for (ll i : update) {
			if (fought[i]) continue;
			auto& q = players[i];
			if (q.empty()) continue;

			auto current_idx = q.front();
			is_finished = false;
			if (found[current_idx] >= 0 && found[current_idx] != i) {
				players[found[current_idx]].pop();
				q.pop();
				progressed = true;
				fought[i] = true;
				fought[found[current_idx]] = true;
				next_update.push_back(i);
				next_update.push_back(found[current_idx]);
				found.at(current_idx) = -1;
			} else {
				found.at(current_idx) = i;
			}
		}
		if (is_finished) {
			break;
		}
		if (!progressed) {
			cout << -1 << endl;
			return 0;
		}
		days++;
		swap(update, next_update); 
	}
	cout << days << endl;
}


Measured memory_bytes: 12544
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int N,K; R(N,K);
    W((N-1+K-2)/(K-1));
    return 0;
}


Measured memory_bytes: 256
a = list(map(int,input().split()))
A = a[0]
B = a[1]
K = a[2]
for i in range(K):
    num = A+i
    if num <= B:
        print(str(num))
for i in range(K):
    num = B - K + i + 1
    if num < A+K:
        pass
    else:
        print(str(num))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int A = sc.nextInt();
            int B = sc.nextInt();

            int ans = 0;
            int tap = 1;
            while (true) {
                if (tap >= B) {
                    break;
                }

                tap += A - 1;
                ans++;
            }

            System.out.println(ans);
        }
    }

}


Measured memory_bytes: 23764
# coding: utf-8
class Case02

  def initialize
  end

  def show
    p self.instance_variables
        .map{ |sym| [sym, self.instance_variable_get(sym)] }
        .to_h
  end
  
  # 実行する
  def execute
    read
    solve
    output
  end

  # 読込
  def read
    @n, @m = gets.chomp.split.map(&:to_i)
    @k = []
    @a = []
    @n.times do
      t = gets.chomp.split.map(&:to_i)
      @k << t[0]
      @a << t[1..-1]
    end
  end

  # 回答
  def solve
    @result = []
    1.upto(@m) do |i|
      count = 0
      1.upto(@n) do |j|
        if @a[j-1].include?(i) then
          count += 1
        end
      end
      if count == @n then
        @result << i
      end
    end
  end
  
  # 出力
  def output
    puts @result.count
  end

end

# 
Case02.new.execute if $0 == __FILE__



Measured memory_bytes: 3836
#include <stdio.h>

int main(void){

  int r, c;
  int i, j;

  scanf("\n%d %d", &r, &c);
  int a[r+1][c+1]; 

  //initialize
  for(i=0; i<r+1; i++){
    for(j=0; j<c+1; j++){
      a[i][j]=0;
    }
  }

  //input
  for(i=0; i<r; i++){
    for(j=0; j<c; j++){
      if(j==c-1){
	scanf("%d\n", &a[i][j]);
      }else{
	scanf("%d ", &a[i][j]);
      }
    }
  }

  //calc
  for(i=0; i<r+1; i++){
    for(j=0; j<c; j++){
      a[i][c]=a[i][c]+a[i][j];
    }
  }

  for(j=0; j<c+1; j++){
    for(i=0; i<r; i++){
      a[r][j]=a[r][j]+a[i][j];
    }
  }

  //output
  for(i=0; i<r+1; i++){
    for(j=0; j<c+1; j++){
      if(j==c){
	printf("%d\n", a[i][j]);
      }else{
	printf("%d ", a[i][j]);
      }
    }
  }

  return 0;

}

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define LL long long;
#define REP(i,s,N) for (int i=s; i<N; i++)

int main() {
	vi a(3,0);
	int ans = 1;
	REP(i,0,3) cin >> a[i];
	sort(a.begin(), a.end());
	if(a[0]+a[1]==a[2]) cout << "Yes" <<endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int r,g,b,n;
    cin >> r >> g >> b >> n;
    int ans = 0;
    for(int i = 0; i <= n; ++i){
        for(int j = 0; j <= n; ++j){
            ans += ((n - i * r - j * g) >= 0 and (n - i * r - j * g) % b == 0);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
#define MOD 1000000007

vector<int> seg(262144);
int imos[100010];
vector<int> X[100010];
map<int, int> Y[100010];

int rsq(vector<int>&V, int s, int t, int k = 1, int l = 0, int r = 131071) {
	if (t < l || r < s)return 0;
	if (s <= l && r <= t)return V[k];

	int lv = rsq(V, s, t, k * 2, l, (l + r) / 2);
	int rv = rsq(V, s, t, k * 2 + 1, (l + r) / 2 + 1, r);
	return lv + rv;
}

void upd(int x) {
	x += 131072;
	seg[x]++;
	while (x) {
		x /= 2;
		seg[x] = seg[x * 2] + seg[x * 2 + 1];
	}
	return;
}

int main() {
	for (int i = 0;i < 262144;i++)seg[i] = 0;
	for (int i = 0;i < 100010;i++)imos[i] = 0;
	int N, M, l, r, s, t;
	cin >> N >> M;
	for (int i = 0;i < N;i++) {
		cin >> l >> r;
		X[l].push_back(r);
		imos[l]++;imos[r + 1]--;
	}
	for (int i = 1;i <= M;i++) {
		imos[i] += imos[i - 1];
	}


	for (int i = 1;i <= M;i++) {
		for (int j : X[i]) {
			upd(j);
		}

		for (int j = 1;j * j <= i;j++) {
			if (i % j)continue;
			t = i / j;
			Y[i].insert({ i + j,rsq(seg, i + j,M) });
			if (j != t)Y[i].insert({ i + t,rsq(seg, i + t,M) });
		}
	}
	
	ll ans;
	for (int i = 1;i <= M;i++) {
		ans = imos[i];
		s = i;
		while (s + i <= M) {
			ans += imos[s + i] - Y[s][s + i];
			s += i;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 67608
//vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int a,b,k;
  cin >> a>>b>>k;
  int count=0;
  for(int i=max(a,b);i>=1;i--){
    if(a%i==0 && b%i==0){
      count++;
      if(count==k){
        cout << i << endl;
      break;
      }
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <utility>
#include <vector>
#include <array>

using std::cout;
using std::cin;
using std::string;


int main()
{
  int a, b, t;
  cin >> a >> b >> t;

  int num = t / a * b;
  cout << num << "\n";
  
  return 0;
}


Measured memory_bytes: 256
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let n = read::<usize>();
    let mut v = vec![0i32; n];
    for i in 0..n {
        v[i] = read::<i32>();
    }

    let inf = 1000000000;
    let mut min = inf;
    let mut diff_max = -inf;
    for i in 0..n {
        if i != 0 {
            diff_max = std::cmp::max(diff_max, v[i] - min);
        }
        min = std::cmp::min(min, v[i]);
    }
    println!("{}", diff_max);
}



Measured memory_bytes: 5040
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

struct Brock{
	int w,s,v;
	bool operator<(Brock &a){
		return w+s<a.w+a.s;
	}
};
int N;
Brock A[1005];
int dp[1005][10005];
signed main(){
	cin>>N;
	rep(i,N)cin>>A[i].w>>A[i].s>>A[i].v;
	sort(A,A+N);
	rep(i,N){
		rep(j,10002){
			chmax(dp[i][j+1],dp[i][j]);
			chmax(dp[i+1][j],dp[i][j]);
			if(j<=A[i].s)
				chmax(dp[i+1][min(j+A[i].w,10001ll)],dp[i][j]+A[i].v);
		}
	}
	int ans=0;
	rep(i,10002)chmax(ans,dp[N][i]);
	cout<<ans<<endl;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
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;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

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

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

    ll n;
    cin >>n;
    vll l(n);
    REP(i,n){
        cin >> l[i];
    }
    sort(ALL(l));
    ll ans = 0;
    REP(i,n-2){
        FOR(j,i+1,n-1){
            ll lef = j;
            ll rig = n;
            while(rig-lef>1){
                ll mid = (lef+rig) /2;
                if(l[i]+l[j]>l[mid]){
                    lef = mid;
                }
                else{
                    rig = mid;
                }
            }
            ans += (lef-j);
        }
    }
    cout << ans <<endl;

    
    return 0;
}



Measured memory_bytes: 3668
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    ll A[N]; F0R(i, N) cin >> A[i];
    F0R(i, N) {
        if (A[i] == 0) {
            cout << 0 << nl; return 0;
        }
    }
    ld L = 0;
    F0R(i, N) {
        L += log10(A[i]);
    }
    if (L > 18.1) {
        cout << -1 << nl; return 0;
    }
    ll ans = 1; F0R(i, N) ans *= A[i];
    if (ans > 1000000000000000000) {
        cout << -1 << nl; return 0;
    }
    cout << ans << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343
 

Measured memory_bytes: 4572
N, M = map(int, input().split())

num = [1 for _ in range(N)]
red = [False for _ in range(N)]
red[0] = True

for i in range(M):
    x, y = map(int, input().split())
    x, y = x - 1, y - 1
    if red[x]:
        red[y] = True

    num[x] -= 1
    num[y] += 1

    if num[x] == 0:
        red[x] = False

print(sum(red))

Measured memory_bytes: 4656
#include<stdio.h>
#define min(a,b) a<b?a:b
int main()
{
    int a,b,c,mn;
    scanf("%d%d%d",&a,&b,&c);
    mn=min(a+b,b+c);
    mn=min(mn,a+c);
    printf("%d\n",mn);
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define SREP(s,i,m) for(unsigned int i = s; i < m; ++i)
#define REP(i,m) SREP(0,i,m)
using namespace std;

#ifdef _MSC_VER
using LONG = __int64;
using ULONG = unsigned __int64;
#else
using LONG = long long int;
using ULONG = unsigned long long int;
#endif

const LONG Mod = 1'000'000'007;

int n, m;
vector<LONG> xs, ys;

int main(void) {
	cin >> n >> m;
	xs.resize(n); ys.resize(m);
	REP(i, n) cin >> xs[i];
	REP(i, m) cin >> ys[i];
	REP(i, n) xs[i] = (2 * Mod + xs[i]) % Mod;
	REP(i, m) ys[i] = (2 * Mod + ys[i]) % Mod;
	LONG xsum = 0;
	for (int k = 1; k <= n; k++) {
		xsum = (xsum + ((Mod - n + 2 * k - 1) * xs[k - 1]) % Mod) % Mod;
	}
	LONG ysum = 0;
	for (int k = 1; k <= m; k++) {
		ysum = (ysum + ((Mod - m + 2 * k - 1) * ys[k - 1]) % Mod) % Mod;
	}
	cout << ((xsum * ysum) % Mod) << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
typedef long long ll;
struct node{
	int x;
	node *nxt;	
}edge[MAXN*4];
node *head[MAXN],*ncnt=edge;
void add_edge(int u,int v){
	++ncnt;
	ncnt->x=v;
	ncnt->nxt=head[u];
	head[u]=ncnt;	
}
int fa[MAXN],n,m,tag[MAXN],dep[MAXN],siz[MAXN],tot;
int get_fa(int x){
	if(fa[x]==0)
		return x;
	fa[x]=get_fa(fa[x]);
	return fa[x];	
}
pair<int,int> l[MAXN*2];
void dfs(int x,int f){
	dep[x]=dep[f]^1;
	for(node *v=head[x];v!=NULL;v=v->nxt){
		int u=v->x;
		if(u==f)
			continue;
		dfs(u,x);
	}
}
ll cnt[2];
int main(){
	int u,v;
	SF("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		siz[i]=1;
	for(int i=1;i<=m;i++){
		SF("%d%d",&u,&v);
		if(get_fa(u)!=get_fa(v)){	
			add_edge(u,v);
			add_edge(v,u);
			u=get_fa(u);
			v=get_fa(v);
			fa[u]=v;
			siz[v]+=siz[u];
		}
		else
			l[++tot]=make_pair(u,v);
	}
	for(int i=1;i<=n;i++)
		if(fa[i]==0)
			dfs(i,0);
	for(int i=1;i<=tot;i++)
		if(dep[l[i].first]==dep[l[i].second])
			tag[get_fa(l[i].first)]=1;	
	ll ans=0,poi=0;
	for(int i=1;i<=n;i++)
		if(fa[i]==0){
			if(siz[i]==1){
				ans+=n;
				poi++;
			}
			else
				cnt[tag[i]]++;
		}
	ans+=(n-poi)*poi;
	ans+=cnt[1]*(cnt[1]+cnt[0]*2ll);
	ans+=cnt[0]*cnt[0]*2ll;
	PF("%lld",ans);
		
}

Measured memory_bytes: 7552
#include <bits/stdc++.h>
#define ms(x) memset(x, 0, sizeof(x))
using namespace std;
const int N = 20;
struct node{
    int x, y;
}q[N];
int vis[N], n, top, ans = 0;
vector<pair<int, int> >que;
bool check(){
    int tp = 0;
    for(int i=0;i<que.size();i++){
        int dx = q[que[i].first].x - q[que[i].second].x;
        int dy = q[que[i].first].y - q[que[i].second].y;
        for(int j=0;j<que.size();j++){
            if(i==j) continue;
            int tx = q[que[j].first].x - q[que[j].second].x;
            int ty = q[que[j].first].y - q[que[j].second].y;
            if(ty*dx == dy*tx) tp++;
        }
    }
    ans = max(tp, ans);
}
void dfs(int now){
    if(now == n+1){
        check();
        return ;
    }
    if(vis[now]) dfs(now+1);
    else{
        for(int i=1;i<=n;i++) {
            if(vis[i]||i==now) continue;
            que.push_back(make_pair(now, i));
            vis[i] = vis[now] = 1;
            dfs(now+1);
            que.pop_back();
            vis[now] = vis[i] = 0;
        }
    }
}
int main(){
    while(scanf("%d", &n)!=EOF){
        ms(vis);
        ans = 0;
        for(int i=1;i<=n;i++){
            scanf("%d%d",&q[i].x,&q[i].y);
        }
        dfs(1);
        printf("%d\n",ans/2);
    }
    return 0;
}
 


Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
    
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define ST first
#define ND second
#define MP make_pair
#define PB push_back
    
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef set<int> SI;
typedef long long LL;
    
#ifdef DEBUG
const bool debug = true;
#else
const bool debug = false;
#endif

// #define MULTI_TASK true

const int inf = 1000 * 1000 * 1000;
const int MAKSN = 1000 * 1000 + 13;
const LL MOD = 123456789LL;
int n, m, k, l, x, y, a, b;
string s;
vector<int> v;


void zeruj() {
    v.clear();
}

void readIn() {
    cin >> s;
    if (s[2]==s[3] && s[4] == s[5]) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }

}
        
void solve() {
    
}

int main() {
    ios_base::sync_with_stdio(0);
#ifdef MULTI_TASK
    int test;
    cin >> test;
    while (test--) {
#endif
        zeruj();
        readIn();
        solve();
#ifdef MULTI_TASK
    }
#endif 
    return 0;
}


Measured memory_bytes: 256
//verma_ankit484

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

typedef long long ll;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
const ll mod = (ll) 1e9+7;

using namespace std;
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>


int main() {
  IOS
  #ifdef AV
  freopen("int.txt", "r", stdin);
  #endif
  ll n;
  cin >> n;
  vector<ll> vc(n);
  for (ll i = 0; i < n; i++) {
    cin >> vc[i];
  }
  ll c1, c2, c3;
  c1 = c2 = c3 = 0;
  ll p = 1;
  for (ll i = 0; i < n; i++) {
    ll c = 0;
    if (c1 == vc[i]) c++;
    if (c2 == vc[i]) c++;
    if (c3 == vc[i]) c++;
    p *= c;
    p %= mod;
    if (c1 == vc[i]) {
      c1++;
    } else if (c2 == vc[i]) {
      c2++;
    } else {
      c3++;
    }
  }
  cout << p << endl;
  return 0;
}

Measured memory_bytes: 1024
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n):
  ans += (p:=min(a[i],b[i]))
  ans += (q:=min(a[i+1],b[i]-p))
  a[i+1] -= q
print(ans)

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

int main() {
  int n=0;
  cin>>n;
  int kari=0;
  vector<int> count(n);
  rep(i,n-1){
    cin>>kari;
    count.at(kari-1)++;
  }
  
  rep(i,n){
    cout<<count.at(i)<<endl;
  }
}

Measured memory_bytes: 4000
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

// 051c

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    tx -= sx, ty -= sy;
    sx = sy = 0;
    
    // 1回目
    rep(i, tx) cout << 'R';
    rep(i, ty) cout << 'U';
    rep(i, tx) cout << 'L';
    rep(i, ty) cout << 'D' ;

    //2回目
    cout << 'D';
    rep(i, tx+1) cout << 'R';
    rep(i, ty+1) cout << 'U';
    cout << 'L';
    cout << 'U';
    rep(i, tx+1) cout << 'L';
    rep(i, ty+1) cout << 'D';
    cout << 'R';
    
    return 0;
}


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

int N, K;
vector<int> arr;

int gcd(int a, int b) {
    return b? gcd(b, a % b) : a;
}

int main() {
    scanf("%d %d", &N, &K);
    arr.resize(N);
    int g = arr[0];
    for(int i = 0; i < N; i++) {
        scanf("%d", &arr[i]);
        g = gcd(g, arr[i]);
    }
    sort(arr.begin(), arr.end());

    if((K % g) || arr.back() < K) printf("IMPOSSIBLE");
    else printf("POSSIBLE");
}


Measured memory_bytes: 640
#include<stdio.h>
using namespace std;
int main()
{
    int a=0,b=0,c=0;//a奇数，b能被4整除，c被2整除
    int n;
    while(~scanf("%d",&n)){
            a=0,b=0,c=0;
    int s;
    while(n--)
    {
        scanf("%d",&s);
        if(s%2==1)
            a++;
        else
        {
            if(s%4==0)
                b++;
            else
                c++;
        }
    }
    if(a>b+1||(a==b+1&&c!=0))
        printf("No\n");
    else
         printf("Yes\n");
    }
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int N;
    cin >> N;
    int A;
    set<int> st;
    REP( i, N )
    {
        cin >> A;
        st.emplace( A );
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long x,a=100;
	int i=0;
	cin>>x;
	for (;;)
	{
		i++;
		a*=1.01;
		if (a>=x)
		{
			cout<<i;
			return 0;
		}
	}
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int N, K; cin >> N >> K;
    int ans = 0;
    while (N) {
        ans++;
        N/=K;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define io std :: ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define M 1000000007
#define int long long
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define nl "\n"
#define yy "YES\n"
#define nn "NO\n"
using namespace std;
signed main()
{
    io;
    int n;
    cin>>n;
    double tmp=(double(n)/3);
    printf("%.12f",tmp*tmp*tmp);
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#include <string>
#include <sstream>
#define ll long long
#define F first
#define S second
#define pb push_back
#define ld long double
#define pll pair<long long,long long>
#define pld pair<long double,long double>
#define ios     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll mod=1000000007;
ll INF=1e18;
ll gcd (ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll fastexp(ll x ,ll n)
{
    ll result =1;
    while(n>0)
    {
        if(n%2==1)
            result*=x;
        x*=x;
        n=n/2;
    }
    return result;
}

ll modularExp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(result*x)%mod;
        x=((x%mod)*(x%mod))%mod;
        n=n/2;
    }
    return (result)%mod;
}
bool isPrime(ll n)
{
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
            return false;
    return true;
}
bool mycomp(pll &a,pll &b)
{
    if(a.F!=b.F)
        return a.F < b.F;
    else
        return a.S < b.S;
}



void solve()
{
     ll n,x,t;
     cin>>n>>x>>t;
     ll y =(n+x-1)/x;
     cout<<y*t;
}

     
     


int main()
{
    ios;
    ll t;
//    cin>>t;
   t=1;
    while(t--)
        solve();
}

Measured memory_bytes: 3648
#define TST 0
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cctype>
#include <bits/stdc++.h>
#include <queue>

using namespace std;
// for loop
#define F(i, L, R) for(long i = L; i < R; i++)
#define FE(i, L, R) for(long i = L; i <= R; i++)
// for (reversed)
#define FR(i, L, R) for(long i = L; i > R; i--)
#define FRE(i, L, R) for(long i = L; i >= R; i--)

// data types
#define Int long
#define ul unsigned long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned shoft

// vectors
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define ALL(c) (c).begin(),(c).end()
#define last(vec) vec.size()-1
#define lastEle(vec) vec[last(vec)]
#define pb push_back
#define InputV(a, n) F(i,0,n){long l; cin >> l; a.pb(l);}

// debug
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a, L, R) FE(i, L, R) cout << a[i] << (i==R?'\n':' ')
#define printAF(a, L) printA(a, 0, L-1)
#define printV(a) printA(a, 0, a.size()-1)

// utils
#define char2int(c) (c-'0')
#define bit(x, i) (x&(1<<i))
#define space ' '
#define PI 3.14159265358979323

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

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

void printM(vector<vector<int> > &vec, long height, long width){
    F(i, 0, height){
        F(j, 0, width){
            cout << vec[i][j] << space;
        }
    cout << endl;
    }
}

vector<int> seen;
vector<int> done;
int timestamp;

// Graph: グラフを表した隣接リスト
// v: 何番目のノードを訪問するのか
void dfs(vector<vector<int> > &Graph, int v){
    timestamp++;
    seen[v] = timestamp; //訪問済みにする

    // 隣接するノードを再帰的に訪問
    for(int next_v = 0; next_v < Graph[v].size();next_v++) {
        if(seen[Graph[v][next_v]] != -1) continue;
        dfs(Graph, Graph[v][next_v]);
    }
    // 出るときの時間が増える
    timestamp++;
    done[v] = timestamp; // 隣接ノードを全て調べ終えた
}

int main() {
#if TST==1
    ifstream in ("input.txt");
    cin.rdbuf(in.rdbuf());
#endif

    int u;
    int k;
    vector<vector<int> > Graph;
    cin >> u;
    int id;
    F(i, 0, u){
        cin >> id;
        cin >> k;
        vector<int> list = vector<int>(k);
        F(j, 0, k){
            cin >> list[j];
            list[j]--;
        }
        Graph.pb(list);
    }
    seen.assign(u, -1);
    done.assign(u, -1);
    timestamp = 0;

    F(i, 0, u){
        if(seen[i] == -1)dfs(Graph, i);
    }
    F(i, 0, u){
        cout << i+1 << space << seen[i] << space << done[i] << endl;
    }
#if TST==1
#endif
}



Measured memory_bytes: 3176
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
//or the end of the sequence.。。。
int dfs(int * a,int& n,int lastNumber,int maxNumber,int currentLength,int lastIndex);
int main(){
	int n;
	cin>>n;
	int* a=new int[n];
	memset(a,0,sizeof(int)*n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int *length=new int[n+1];
	memset(length,0,sizeof(int)*(n+1));
	int maxLength=0;
	for(int i=0;i<n;i++){
		if(length[a[i]-1]==0){
			length[a[i]]=1;
		}else{
			length[a[i]]=length[a[i]-1]+1;
		}
	}
	for(int i=0;i<n;i++){
		maxLength=max(maxLength,length[i+1]);
	}
	cout<<n-maxLength<<endl;
	return 0;
}
				

/*
int main(){
	int n;
	cin>>n;
	int * a=new int[n];
	memset(a,0,sizeof(int)*n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int start=n;
	//反向循环生 
	for(int i=n-1;i>=0;i--){
		if(a[i]==start){
			start--;
		}
	}
	cout<<n-(n-start)<<endl;
	return 0;
}*/

Measured memory_bytes: 1792