akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

  string s = S + S;
  for (int i = 0; i < S.size(); i++) {
    bool flag = true;
    for (int j = 0; j < S.size(); j++)
      if (s[i + j] != T[j]) flag = false;
    if (flag) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int A1,A2,A3;
int sum;
scanf("%d %d %d",&A1,&A2,&A3);
sum=A1+A2+A3;
if(sum>=22)
{
    printf("bust\n");
}
else
    {
printf("win\n");
    }
return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N, A, B;

int main()
{
  std::cin >> N >> A >> B;

  ll d = llabs(A-B);

  ll ans = INF;

  if( d % 2 == 0 )
    chmin( ans, d/2 );

  ll b = B-(A-1)-1;

  chmin( ans, (b-1)/2+A );

  ll tb = A+N-B+1;

  if( (N-tb)%2 == 0 )
    chmin( ans, (N-tb)/2+N-B+1 );

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 256
from itertools import combinations_with_replacement
from math import gcd
K = int(input())
memo = {}
ans = 0
for a,b,c in combinations_with_replacement(range(1,K+1),3):
  v = gcd(a, gcd(b,c))
  n = len(set([a,b,c]))
  ans += v if n==1 else (3*v if n==2 else 6*v)
print(ans)

Measured memory_bytes: 9192
#include <iostream>

using namespace std;

int main()
{
	char c;
	cin >> c;

	if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
		cout << "vowel" << endl;
	}
	else{
		cout << "consonant" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#define yorn(f) cout<<((f)?"Yes":"No")<<endl
#define YORN(f) cout<<((f)?"YES":"NO")<<endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main()
{
    int n, k, x, y;
    cin >> n >> k >> x >> y;

    if (n <= k) {
        cout << x * n << endl;
    }
    else {
        cout << (k * x) + (n - k) * y << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3636
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6+100
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

n,k=map(int,input().split())
k=min(n,k)
ans=0
for i in range(k+1):
  ans+=(cmb(n,i,mod)*cmb(n-1 ,i,mod))%mod
ans=ans%mod
print(ans)


Measured memory_bytes: 127700
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        long count = 0;


        count =(b / x) - (a / x);
        if(a % x == 0){
            
                count++;
            }
        System.out.println(count);
    }
}




Measured memory_bytes: 23764
// C - Welcome to AtCoder
#include <bits/stdc++.h>
using namespace std;

int wa_count[100000];

int main(){
	int n,m,p,ac=0,wa=0;
	string s;
	cin>>n>>m;
	while(m--){
		cin>>p>>s; --p;
		if(wa_count[p] < 0) continue;// ac
		else{//not ac
			if(s[0] == 'W') wa_count[p]++;
			else{
				ac++;
				wa += wa_count[p];
				wa_count[p] = -1;// ac flag on
			}
		}
	}
	cout<< ac <<" "<< wa <<endl;
}

Measured memory_bytes: 640
let dbg = Printf.printf "[debug]%s"

let id = fun x -> x
let tuple2 x y = (x,y)

let (++) n m =
  let rec aux i =
    if i = m then [m]
    else i :: aux (i+1) in
  if n > m then [] else aux n

let (++^) n m = n ++ (m-1)

let scanf fmt f = Scanf.sscanf (read_line ()) fmt f

let scanfs n fmt f =
  List.map (fun _ -> scanf fmt f) (0++^n)

let scan_matrix n m e conv =
  let arr = Array.make_matrix n m e in
  Array.iteri (fun i line ->
      let s = Scanf.Scanning.from_string @@ read_line () in
      Array.iteri (fun j _ ->
          arr.(i).(j) <- Scanf.bscanf s " %s" conv;
        ) line) arr; arr

let between n x m = n <= x && x < m

let (n, w) = scanf "%d %d" tuple2
let items = Array.of_list @@ scanfs n "%d %d" tuple2
let memo = Array.make_matrix (n+1) (w+1) (-1)

let () =
  memo.(0).(0) <- 0;
  List.iter (fun i ->
      let (v0, w0) = items.(i-1) in
      List.iter (fun j ->
          memo.(i).(j) <-
            if j - w0 >= 0 then
              let x =
                if memo.(i-1).(j-w0) >= 0 then memo.(i-1).(j-w0) + v0 else -1 in
              let y =
                if memo.(i).(j-w0) >= 0 then memo.(i).(j-w0) +v0 else -1 in
              max memo.(i-1).(j) @@ max x y
            else
              memo.(i-1).(j)
        ) (0++w)
    ) (1++n);
  Array.fold_left max 0 memo.(n)
  |> Printf.printf "%d\n"



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

namespace Util {
#ifdef LOCAL
#define dbg(a) cerr << __LINE__ << '"' << #a << "\": " << a << '\n'
#else
#define dbg(a) 0
#endif

#define all(v) (v).begin(), (v).end()
#define long int64_t
}
using namespace Util;

signed main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    long K; cin >> K;
    if (K % 7 == 0) K /= 7;
    
    vector<long> pw10((size_t) 1e7), sum10((size_t) 1e7);
    pw10[0] = 1; sum10[0] = 1;
    for (int i = 1; i < (int) 1e7; ++i) {
        (pw10[i] = pw10[i - 1] * 10) %= K;
        (sum10[i] = pw10[i] + sum10[i - 1]) %= K;
    }

    for (int i = 1; i <= (int) 1e7; ++i) {
        if (sum10[i - 1] % K == 0) {
            cout << i;
            exit(0);
        }
    }
    
    cout << -1;
    return 0;
}

Measured memory_bytes: 159872
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    float num = 0;
    int i;
    float total = 0;
    for(i=1;i<=n;i++){
      num = (1/(sc.nextFloat()));
      total = total + num;
    }
    System.out.println(1/total);
  }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a;
	cin>>a;
	double s[100]; 
	for(int i=0;i<a;i++)
	{
		cin>>s[i];
	}
	sort(s,s+a);
	for(int i=0;i<a-1;i++)
	{
		s[i+1]=(s[i]+s[i+1])/2.0;
	}
	cout<<s[a-1];
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second
#define bg begin()
#define en end()
#define pb push_back
#define w(x) scanf("%d",&x);while(x--)
#define ws(x) scanf("%d",&x);getchar();while(x--)
#define rep(i,b) for(i=0;i<=b;i++)
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 2*acos(0.0)
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

const int N=1e6+2;
long long  mod=1e9+9;
int t,j,cs=0,n,a,b,i,dxx[]={1,0,0,-1},dyy[]={0,-1,1,0},k,m,inf=1e9;
string s;

int main()
{
    scanf("%d%d",&n,&k);
    vi v(n);
    for(int& it:v)
        scanf("%d",&it);
    vi dp(n,inf);
    dp[0]=0;
    rep(i,n-1){
        for(j=i+1;j<=i+k;j++){
            if(j<n){
               // cout<<dp[j]<<endl;
                dp[j]=min(dp[j],dp[i]+abs(v[i]-v[j]));

            }

        }
    }
    printf("%d\n",dp[n-1]);
}



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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n;
  ll aa, cnt = 0;
  cin >> n;
  for(int i = 1; i <= n; i++) {
    ll x;
    cin >> x;
    while(x % 2 == 0) {
      cnt++;
      x /= 2;
    }
  }
  cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    var (pt, px, py) = listOf(0, 0, 0)
    for (i in 0 until n) {
        val (t, x, y) = readLine()!!.split(" ").map(String::toInt)
        val diff = Math.abs(x - px) + Math.abs(y - py)
        if (t - pt - diff >= 0 && (t - pt - diff)%2 == 0) {
            pt = t
            px = x
            py = y
            continue
        } else {
            println("No")
            return
        }
    }
    println("Yes")
}


Measured memory_bytes: 53384
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;
#define erep(i, x, n) for (auto i = x; i<=(ll)(n); i++)
#define rep(i, x, n) for(auto i = x; i<(ll)(n); i++)
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define mod(n, m) (((n%m) + m)%m)
#define reset(n, m) memset(n, m, sizeof n)
#define endl '\n'



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

	map<string, int> mp;
	set<string> st;

	int n;
	cin >> n;
	int mx = 0;
	rep(i, 0, n)
	{
		string x;
		cin >> x;
		mp[x]++;
		mx = max(mx, mp[x]);
	}

	for(auto x : mp)
	{
		if (x.second == mx)
			st.insert(x.first);
	}

	for(auto i : st)
		cout << i << endl;

	return 0;
}


Measured memory_bytes: 33280
#include <iostream>
#define MAX_N 1000
#define MAX_W 10000

using namespace std;

main(){
  int W, n;
  int v[MAX_N], w[MAX_N];
  int dp[2][MAX_W+1];

  for(int count=1;;count++){
    cin >> W;
    if(W==0) break;

    cin >> n;
    for(int i=0;i<n;i++){
      scanf("%d,%d", &v[i], &w[i]);
    }
    for(int i=0;i<=W;i++){
      dp[0][i]=0;
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<=W;j++){
	if(j<w[i]){
	  dp[(i+1)&1][j]=dp[i&1][j];
	}else{
	  dp[(i+1)&1][j]=max(dp[i&1][j], dp[i&1][j-w[i]]+v[i]);
	}
      }
    }
    int ans;
    for(int i=0;i<=W;i++){
      if(dp[n&1][W]==dp[n&1][i]){
	ans=i;
	break;
      }
    }
    printf("Case %d:\n", count);
    cout << dp[n&1][W] << endl;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
N = int(input())
A_ls=list(map(int, input().split()))

h=0
ans=0

for i in range(N):
	a=A_ls[i]
	h=max(h,a)
	ans+=h-a

print(ans)
# 2darray [[0] * 4 for i in range(3)]
# import itertools

Measured memory_bytes: 32368
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
using namespace std;
int main(){
	int a = 0, b = 0, c, d[100000], e[100000], count = 0;
	char uc[100000];
	for (int i = 0; i < 10; i++) {
		cin >> uc[i];
	}
	uc[3] = '8';
	for (int j = 0; j < 10; j++) {
		cout << uc[j];
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main(){
    int n;
    cin>>n;
    set<int> st;
    rep(i,0,n){
        int d;
        cin>>d;
        st.insert(d);
    }
    cout<<st.size()<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int num;
    int i = 1;
    while(1) {
        scanf("%d", &num);
        if (num != 0) {
            printf("Case %d: %d\n", i, num);
            i++;
        }
        else {
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);
	for(int i=1,x;i<=n;++i)
	{
		scanf("%d",&x);
		if(!(x&1) && x%3 && x%5) {puts("DENIED");return 0;}
	}puts("APPROVED");return 0;
}

Measured memory_bytes: 256
#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 ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set1;
typedef tree<string,null_type,less<string>,rb_tree_tag,tree_order_statistics_node_update> indexed_set2;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main() 
{
	ll n,m,k;
	cin>>n>>m>>k;
	char arr[n][m];
	REP(i,0,n){
		string s;
		cin>>s;
		REP(j,0,m){
			arr[i][j] = s[j];
		}
	}
	ll ans = 0;

	REP(i,0,(1 << n)){
		REP(j,0,(1 << m)){
			map<ll,ll> rows,cols;
			REP(p,0,n){
				if((i >> p) & 1){
					rows[p]++;
				}
			}
			REP(p,0,m){
				if((j >> p) & 1){
					cols[p]++;
				}
			}
			char arr1[n][m];
			REP(p1,0,n){
				REP(p2,0,m){
					arr1[p1][p2] = arr[p1][p2];
					if(rows.count(p1) || cols.count(p2)){
						arr1[p1][p2] = 'a';
					}
				}
			}
			ll ct = 0;
			REP(p1,0,n){
				REP(p2,0,m){
					if(arr1[p1][p2] == '#'){
						ct++;
					}
				}
			}
			if(ct == k){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n;
    cin >> n;
    set< int > st;
    for( int i = 0; i < n; ++i ) {
        int a;
        cin >> a;
        st.insert(a);

    }
    if( st.size() == n ) cout << "YES";
    else cout << "NO";
    cout << endl;
    return 0;
}



Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
int main()
{
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];

  ll r=0;
  rep(i,n){
    r += (a[i]+1)/(n+1);
  }


  if(r==0){
    cout << 0 << "\n";
    return 0;
  }

  vector<ll> b(n+1,0);
  rep(i,n){
    ll x = a[i]%(n+1);
    ll y = (x+2)%(n+1);
    b[(n+1-y)%(n+1)]++;
  }


  ll d=0;
  vector<ll> c(n+1);
  rep(i,n+1){
    c[i] = d+1-b[i];
    d = c[i];
  }


  ll mi=0;
  ll mx=c[0];
  rep(i,n+1){
    if(mx<c[i]){
      mx=c[i];
      mi=i;
    }
    if(r<=c[i]){
      cout << i+1 << "\n";
      return 0;
    }
  }

  cout << (r-mx)*(n+1)+mi+1 << "\n";
  
  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

void main() {
    auto N = readln.chomp.to!int;
    auto D = readln.split.map!(to!int).array;
    auto M = readln.chomp.to!int;
    auto T = readln.split.map!(to!int).array;

    int[int] A;
    foreach (t; T) A[t] += 1;
    foreach (d; D) A[d] -= 1;

    writeln((A.values.map!(a => a <= 0).all) ? "YES" : "NO");
}


Measured memory_bytes: 33764
#define REP(i, t, n)  for (int i = t; i < n; i++)
#define ALL(n)        (n).begin(),(n).end()
#include <limits.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <deque>
#include <functional>
#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <numeric>

using namespace std;

typedef bool               BOOL;
typedef short              WORD;
typedef unsigned short     U_WORD;
typedef long               DWORD;
typedef unsigned long      U_DWORD;
typedef long long          QWORD;
typedef unsigned long long U_QWORD;

#define LEN_MAX (1000)
DWORD dpLCS[LEN_MAX + 1][LEN_MAX + 1];

void initDpTable(DWORD maxI, DWORD maxJ)
{
	REP(i, 0, maxI + 1) {
		REP(j, 0, maxJ + 1) {
			dpLCS[i][j] = 0;
		}
	}

}

void solve_main()
{
	DWORD dwNum;
	string str1, str2;
	cin >> dwNum;
	REP(loop, 0, dwNum) {
		cin >> str1;
		cin >> str2;
		initDpTable(str1.length(), str2.length());

		REP(i, 1, (str1.length() + 1)) {
			REP(j, 1, (str2.length() + 1)) {
				if (str1[i - 1] == str2[j - 1]) {
					dpLCS[i][j] = dpLCS[i - 1] [j - 1] + 1;
				} else {
					dpLCS[i][j] = max(dpLCS[i - 1][j], dpLCS[i][j - 1]);
				}
			}
		}
		cout << dpLCS[str1.length()][str2.length()] << endl;
	}
}

int main()
{
#ifdef FOR_IDE
	ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
#endif

	solve_main();
	return 0;
}



Measured memory_bytes: 10976
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    string s;
    cin >> s;
    if (s[0] == '7' || s[1] == '7' || s[2] == '7') cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main(){
    int n;
    string ans="APPROVED";
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    
   for(int j=0;j<n;j++){
        if(a[j] % 2==0){
            if(a[j]%3!=0 && a[j]%5!=0){
                ans="DENIED";
                break;
            }
        }
    }
    
    
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#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;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define N 200001
#define ll long long
#define int ll 
#define pi pair<int , int>
#define pip pair<pair ,int>
#define mp make_pair 
#define f first
#define s second
#define mod 998244353
ll Mod(ll x, ll y, int p) 
{ll res = 1; x = x % p;
while (y > 0) 
{if(y & 1) res = (res*x) % p; 
y = y>>1;x = (x*x) % p; 
}return res; 
}
int* getlps(string pattern){
 int len = pattern.length();
 int * lps = new int[len];
 lps[0] = 0;
 int i = 1 , j = 0;
 while(i < len){
  if(pattern[i] == pattern[j]){
	  lps[i] = j+1;
   i++;
   j++;
  }
  else{
		if(j != 0){
		 j = lps[j-1];
		}
		else{
		 lps[i] = 0;
		 i++;
		}
  }
 }
 return lps;
}
class Triplet{
 public:
 int x ;
 int y ;
 int gcd;
};
Triplet extendedEuclid(int a , int b){
 if(b == 0){Triplet ans; ans.gcd = a;ans.x = 1;ans.y = 0;return ans;}
 Triplet smallAns = extendedEuclid(b , a%b);
 Triplet ans;
 ans.gcd = smallAns.gcd;
 ans.x = smallAns.y;
 ans.y = smallAns.x - (a/b)*smallAns.y;
 return ans;
}
int mmInverse(int a , int m){
 Triplet ans = extendedEuclid(a , m);
 return ans.x;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// dp[i] represents whoesever turns it is , if there are i-stones does he win (true , otherwise false).
int n , k;
cin>>n>>k;
int arr[n];
for(int i =0 ; i < n;i++){
   cin>>arr[i];
}
bool dp[k+1];
memset(dp , false , sizeof(dp));
for(int i = 0 ; i <= k ; i++){
     // i stones , 
     bool ok = false;
     for(int j = 0 ; j < n ; j++){
			if(i-arr[j] >= 0 && !dp[i-arr[j]]){
			  ok = true;
			}
	 }
	 dp[i] = ok;
}
if(dp[k]){
 cout<<"First"<<endl;
}
else
cout<<"Second"<<endl;
}



Measured memory_bytes: 384
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.math.BigInteger;
 
public class Main implements Runnable {
	
	static int mod = 1000000007;

    public static void main(String[] args) {
    	new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }
    
    public void run() {
        FastScanner sc = new FastScanner();

        int n = sc.nextInt();
        int k = sc.nextInt();
        
        if(k==1){
            System.out.println(0);
        }
        else{
            System.out.println(n-k);
        }

    }
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}
	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}
	public int[] nextIntArray(int n){
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i] = nextInt();
		}
		return a;
	}
	public Integer[] nextIntegerArray(int n){
		Integer[] a = new Integer[n];
		for(int i=0;i<n;i++){
			a[i] = nextInt();
		}
		return a;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

int main() {
    ll n, m;
    cin >> n >> m;

    string ans = "Yes";

    vector<vector<ll>> rooms(n, vector<ll>());
    for (int i=0; i<m; i++) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        rooms.at(a).push_back(b);
        rooms.at(b).push_back(a);
    }

    vector<ll> ansv(n, -1);

    queue<ll> q;
    q.push(0);

    ll now;
    while (!q.empty()) {
        now = q.front();
        q.pop();
        for (int i=0; i<rooms.at(now).size(); i++) {
            if (ansv.at(rooms.at(now).at(i)) == -1) {
                ansv.at(rooms.at(now).at(i)) = now;
                q.push(rooms.at(now).at(i));
            }
        }
    }

    cout << "Yes" << endl;

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

}

Measured memory_bytes: 12944
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n), b;
	for (int& i : a) cin >> i;
	sort(a.begin(), a.end());
	if (1000 < a.size()) a.erase(1000 + a.begin(), a.end());
	for (int i = 0; i < a.size() - 1; ++i) {
		for (int j = 1 + i; j < a.size(); ++j) {
			b.push_back(stoi(to_string(a[i]) + to_string(a[j])));
			b.push_back(stoi(to_string(a[j]) + to_string(a[i])));
		}
	}
	sort(b.begin(), b.end());
	cout << b[2] << endl;
}


Measured memory_bytes: 7036
/*
    Vishal Raj
    IIT Kharagpur
*/

#include <bits/stdc++.h>

using namespace std;

#define li long long int
#define FOR(i,l,r) for( int i = l; i < r; i++ )

li mod = 1e9+7;

void addMod( li & a, li b ) {
    a = (a+b)%mod;
}

int main() {
    int h,w; 
    cin>>h>>w;
    int a[h][w];
    FOR(i,0,h) {
        string s;
        cin>>s;
        FOR(j,0,w) a[i][j] = s[j];
    }
    li dp[h][w];
    FOR(i,0,h) FOR(j,0,w) dp[i][j] = 0;
    dp[0][0] = 1;
    FOR(i,0,h) FOR(j,0,w) {
        if( (!i && !j) || a[i][j] == '#' ) continue;
        if( i-1 >= 0 ) addMod(dp[i][j],dp[i-1][j]);
        if( j-1 >= 0 ) addMod(dp[i][j],dp[i][j-1]);
        // cout<<i<<" "<<j<<" "<<dp[i][j]<<"\n";
    }
    cout<<dp[h-1][w-1]<<"\n";
}

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

int main()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int ans;
    int xa = min(a,k);
    k -= a;
    int xb = min(b,k);
    k -= xb;
    int xc = min(c,k);
    k -= xc;
    ans = xa - xc;
    cout << ans << endl;
    return 0 ;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    string S;cin >> S;
    if(S == "SUN")cout << 7 << endl;
    if(S == "MON")cout << 6 << endl;
    if(S == "TUE")cout << 5 << endl;
    if(S == "WED")cout << 4 << endl;
    if(S == "THU")cout << 3 << endl;
    if(S == "FRI")cout << 2 << endl;
    if(S == "SAT")cout << 1 << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <iterator>
#include <cmath>
#include <map>
using namespace std;

void func160b() {
  long long x, c500 = 0, c5 = 0;
  cin >> x;
  c500 = x / 500;  x = x % 500;
  c5 = x / 5;  x = x % 5;
  cout << c500 * 1000 + c5 * 5 << "\n";

}



int main(void) {
  func160b();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vs = vector<string>;
using vvs = vector<vs>;
using pli = pair<long long, int>;
using vpli = vector<pli>;

int main() {
  ll N;
  string S;
  cin >> N >> S;
  
  string alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

  for (int i = 0; i < S.size(); i++) {
    for (int j = 0; j < 26; j++) {
      if (S.at(i) == alph.at(j)) {
        int t = (j + N) % 26;
        S.at(i) = alph.at(t);
        break;
      }
    }
  }
  
  cout << S << endl;
    
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map> // STL
#include <string> 
#include <vector>
#include <queue>
#include <stack>
#define mpr make_pair
#define debug() puts("okkkkkkkk")

using namespace std;

typedef long long LL;

const int inf = 1 << 26;

string s;

void dfs(int l, int r, int ans){
	if(l==r){cout<<ans<<endl;return ;}
	if(l==r-1){
		if(s[l]==s[r]){cout<<ans<<endl;return ;}
		if(s[l]=='x'||s[r]=='x') {cout<<ans+1<<endl;return ;}
		cout<<-1<<endl; return ;	
	} 
	
	if(s[l]==s[r]){dfs(l+1,r-1,ans); return ;}
	if(s[l]=='x'||s[r]=='x'){
		if(s[l]=='x')l++;
		if(s[r]=='x')r--;
		dfs(l,r,ans+1);return ; 
	}
	cout<<-1<<endl;
}

int main(){
	cin>>s;
	
	dfs(0,s.size()-1,0);

	return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtC
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int H = int.Parse(str[0]);
            int A = int.Parse(str[1]);
            int ans = H / A;
            if (H % A != 0) ans++;
            Console.WriteLine(ans);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11092
import math


def comb(n, r, mod):
    # calculates C(n,r) mod p (assuming mod is prime).
    nc = n
    for rc in range(1, r):
        nc -= 1
        n = n*nc % mod
        r = r*rc % mod

    nCr = n*pow(r, mod - 2, mod)
    return nCr


def solve():
    n, a, b = list(map(int, input().split()))
    mod = int(pow(10, 9) + 7)

    total = pow(2, n, mod) - 1
    ac = comb(n, a, mod)
    bc = comb(n, b, mod)
    ans = int(total - ac - bc) % mod

    print(ans)


# Solve
if __name__ == "__main__":
    solve()


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

//structure definition
typedef struct{
  int top;
  int front;
  int right;
  int left;
  int back;
  int under;
} DICE;

#define TOP   Dice.top
#define FRONT Dice.front
#define RIGHT Dice.right
#define LEFT  Dice.left
#define BACK  Dice.back
#define UNDER Dice.under

//prototype
int main(void);
DICE top_move(DICE, int);
DICE flont_move(DICE, int);
DICE direction_judge(char*, DICE);

//main()
int main(void){
  DICE Dice;
  int q_count = 0;
  int top_num = 0;
  int flont_num = 0;

  scanf("%d %d %d %d %d %d", &TOP, &FRONT, &RIGHT, &LEFT, &BACK, &UNDER);
  scanf("%d", &q_count);

  for (int i = 0; i < q_count; i++) {
    scanf("%d %d", &top_num, &flont_num);

    Dice = top_move(Dice, top_num);
    Dice = flont_move(Dice, flont_num);

    printf("%d\n", RIGHT);
  }
  return 0;
}

//flont_move()
DICE flont_move(DICE Dice, int _search_num){
  int hold = RIGHT;
  if (_search_num == LEFT) {
    RIGHT = FRONT;
    FRONT = LEFT;
    LEFT = BACK;
    BACK = hold;
  }else if (_search_num == RIGHT){
    RIGHT = BACK;
    BACK = LEFT;
    LEFT = FRONT;
    FRONT = hold;
  }else if (_search_num == BACK) {
    RIGHT = LEFT;
    LEFT = hold;
    hold = BACK;
    BACK = FRONT;
    FRONT = hold;
  }else{
    return Dice;
  }
   return Dice;
}

//top_move()
DICE top_move(DICE Dice, int _search_num){
  char direction[3] = {};
  char* d;

  if (_search_num == FRONT) {
    d = "N\0";
  }else if (_search_num == UNDER){
    d = "NN\0";
  }else if (_search_num == LEFT) {
    d = "E\0";
  }else if (_search_num == RIGHT){
    d = "W\0";
  }else if (_search_num == BACK) {
    d = "S\0";
  }else{
    return Dice;
  }

  strcpy(direction, d);
  for (int i = 0; i < strlen(direction); i++) {
    Dice = direction_judge(&direction[i], Dice);
  }

  return Dice;
}

//direction_judge()
DICE direction_judge(char* judge, DICE Dice){
  int save = 0;
  switch (*judge) {
    case 'N':
      save = UNDER;
      UNDER = BACK;
      BACK = TOP;
      TOP = FRONT;
      FRONT = save;
    break;
    case 'E':
      save = UNDER;
      UNDER = RIGHT;
      RIGHT= TOP;
      TOP = LEFT;
      LEFT = save;
    break;
    case 'S':
      save = UNDER;
      UNDER = FRONT;
      FRONT = TOP;
      TOP = BACK;
      BACK = save;
    break;
    case 'W':
    save = UNDER;
    UNDER = LEFT;
    LEFT= TOP;
    TOP = RIGHT;
    RIGHT = save;
    break;
  }
  return Dice;
}



Measured memory_bytes: 2096
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
  long long int N,K;
  cin >> N >> K;
  long long int N2=N;
  if(N>=K){
    N2=N%K;
    if((abs(N2-K))<N2){
      N2=abs(N2-K);
    }
  }
  else{
    if((abs(N2-K))<N2){
      N2=abs(N2-K);
    }
  }
  cout << N2;
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
ll binary_pow(ll a, ll N) {
  ll ans = 1;
  ll tmp = a;
  while(N > 0) {
    if(N % 2 == 1) {
      ans *= tmp;
      ans %= mod;
    }
    N /= 2;
    tmp *= tmp;
    tmp %= mod;
  }
  return ans;
}
int main() {
  int N, K;
  cin >> N >> K;
  ll ans = 0;
  vector<ll> cnt(K+1);
  RREP(i, K, 1) {
    cnt[i] = binary_pow(K/i, N);
    for(ll j=i*2; j<=K; j+=i) cnt[i] -= cnt[j];
    if(cnt[i] < 0) (cnt[i] += (abs(cnt[i])+mod-1)/mod*mod) %= mod;
    (ans += cnt[i]*i%mod) %= mod;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1e9+7
#define sp ' '


using ll = long long;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, k;
    cin >> n >> k;

    vector<ll> a(n), b(n);
    ll mx = 0LL;
    rep(i, n){
        cin >> a[i];
        b[i] = a[i];
        mx = max(mx, a[i]);
    }

    ll x = 0LL;
    ll two = 1LL;
    int digit = static_cast<int>(log2(k));
    string strx = "";

    if(k == 0){
        ppp(accumulate(a.begin(), a.end(), 0LL));
        return 0;
    }

    for(ll d = 0LL; d <= digit; ++d){
        ll cnt = 0LL;
        for(ll i = 0; i < n; ++i){
            cnt += a[i]%2LL;
            a[i] /= 2LL;
        }
        if(cnt <= n / 2LL){
            x += two;
            strx += '1';
        }
        else{
            strx += '0';
        }
        two *= 2;
    }
    reverse(strx.begin(), strx.end());
    cerr << strx << endl;
    ll nx = 0LL;
    for(ll i = 0; i < strx.size(); ++i){
        if(strx[i] == '1' and (pow(2,(strx.size()-i-1))+nx) <= k){
            nx += pow(2,(strx.size()-i-1));
        }
    }

    cerr << nx << endl;

    ll ans = 0LL;
    for(ll i = 0; i < n; ++i){
        ans += nx^b[i];
    }

    ppp(ans);

    return 0;
}


Measured memory_bytes: 1792
N, K = list(map(int,input().split()))
p = list(map(int,input().split()))

a = []
#各サイコロの期待値のリストaを作成
for i in range(N):
  a.append((p[i]+1)/2)
#累積和のリストSの作成
S = [0]
for i in range(N):
  S.append(S[i]+a[i])
#隣接N個のサイコロの期待値の和のリストansの作成
ans = []
for i in range(N-K+1):
  ans.append(S[i+K]-S[i])
  
print(max(ans))

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

bool g[10][10];//隣接行列

int main(){
    ll n,m;cin >>n>>m;
    for (int i = 0; i < m; ++i) {
        ll a,b;cin >>a>>b;
        a--;b--;
        g[a][b]=g[b][a]=true;
    }
    vector<ll>ord(n);
    for (int i = 0; i < n; ++i) {
        ord[i]=i;
    }
    ll res=0;
    do{
        if(ord[0]!=0)break;
        bool ok=true;
        for (int i = 0; i+1 < n; ++i) {
            ll from=ord[i];
            ll to=ord[i+1];
            if(!g[from][to])ok=false;
        }
        if(ok)res++;
    }while(next_permutation(all(ord)));
    cout <<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <stack>
#include <utility>
#include <cmath>
#include <cstdio>

using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;
LL MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    vector<vector<double> > dp(N+1, vector<double>(N+1, 0));
    vector<double> p(N, 0);  
    for(int i=0; i<N; i++) cin >> p[i];
    dp[0][0] = 1.0;
    for(int i=0; i<N; i++)
        for(int j=0; j<=i; j++) {
            double q = dp[i][j];
            dp[i+1][j+1] += q * p[i];
            dp[i+1][j] += q * (1-p[i]);

        }
    double ans = 0;
    for(int i=N/2+1; i<=N; i++) {
        ans += dp[N][i];
    }
    printf("%.10lf\n", ans);
   // cout << ans << endl;
    return 0;
}

Measured memory_bytes: 70784
///Astalavista Code........~CodeSlayer007
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (#x) << " is " << (x) << endl;
#define SPD_emergency ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int M = 998244353;
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " "; cout << endl;}
void PA(int v[], int n) { for (int i = 0 ; i < n ; i++)cout << v[i] << " " ; cout << endl;}
void IN(int a[], int n) {for (int i = 0; i < n; i++)cin >> a[i];}
//continue break deque stack queue sort reverse accumulate  count lower_bound upper_bound
// next_permutation copy_n __builtin_popcount

signed  main() {
  SPD_emergency


  //int t; cin >> t; int tt = 1; while (t--)
  {
   int n;
   cin >> n;
   int a[n+1000] = {0},ans = 0, i = 0;
   for(i=1;i<n;i++){
     int j;
     cin >> j;
     a[j]++;
   }
   for(i=1;i<=n;i++){
     cout<<a[i]<<endl;
   }
   
  }
  return 0;
}

Measured memory_bytes: 5220
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{

    static final FastReader in = new FastReader();
    static final FastWriter out = new FastWriter();


    public static void main(String[] args) throws IOException{
        double d, t, s;
        d = in.nextDouble();
        t = in.nextDouble();
        s = in.nextDouble();
        out.pl(d/s<=t?"Yes":"No");
        out.close();
    }
}
class FastReader{
    BufferedReader br;
    StringTokenizer st;
    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in)); 
    } 
    String next(){ 
        while (st == null || !st.hasMoreElements()) { 
            try{ 
                st = new StringTokenizer(br.readLine()); 
            }catch (IOException  e){ 
                e.printStackTrace(); 
            } 
        } 
        return st.nextToken(); 
    } 
    int nextInt(){ 
        return Integer.parseInt(next()); 
    } 
    long nextLong(){ 
        return Long.parseLong(next()); 
    } 
    double nextDouble(){ 
      return Double.parseDouble(next()); 
    }
    String nextString(){
        return next().trim();
    }
    String nextLine(){ 
        String str = ""; 
        try{ 
            str = br.readLine(); 
        } 
        catch (IOException e){ 
            e.printStackTrace(); 
        } 
        return str; 
    }
}
class FastWriter{
    PrintWriter out;
    FastWriter(){
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	out.flush();
    }
    void pl(Object o){
        out.write(o.toString());
	    out.write("\n");
        out.flush();
    }
    void pl(){
        out.write("\n");
        out.flush();
    }
    void p(Object o){
        out.write(o.toString());
        out.flush();
    }
    void close(){
        out.flush();
        out.close();
    }  
}


Measured memory_bytes: 33088
// AOJ 2480 Blame Game
// 2018.3.9 bal4u

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

#define MAX 1005
short hi[MAX], to[MAX][MAX];
char  seen[MAX];
short match[MAX];

int bpm(int u)
{
	int i, v;

	for (i = 0; i < hi[u]; i++) {
		v = to[u][i];
		if (seen[v]) continue;
		seen[v] = 1;
		if (match[v] < 0 || bpm(match[v])) {
			match[u] = v, match[v] = u;
			return 1;
		}
	}
	return 0;
}

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int main()
{
	int n, m, i, j, k;

	memset(match, -1, sizeof(match));

	n = in(), m = in();
	for (i = 0; i < n; i++) {
		k = in(); for (j = 0; j < k; j++) to[i][hi[i]++] = n+in()-1;
	}

	k = 0; for (i = 0; i < n; i++) {
		memset(seen, 0, n+m);
		if (bpm(i)) k++;
	}
	puts(k == m? "Bob": "Alice");
	return 0;
}



Measured memory_bytes: 2632
N,M,X,Y = map(int,input().split())
xs = list(map(int,input().split()))
ys = list(map(int,input().split()))
mx = max(xs)
my = min(ys)
for z in range(mx+1,my+1):
    if X < z <= Y:
        print('No War')
        exit()
print('War')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main() {
    int n,k;
    cin>>n>>k;
    set<int> s;
    rep(i,k){
        int d;
        cin>>d;
        rep(j,d){
            int a;
            cin>>a;
            s.insert(a);
        }
    }

    cout<<n-s.size()<<endl;
}



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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 1010, M = 35;

int n, m;
int f[M][M];
int c[3][M];

int main()
{
	cin >> n >> m;
	for (int i = 1; i <= m; i ++ )
		for (int j = 1; j <= m; j ++ )
			cin >> f[i][j];
	
	for (int i = 0; i < n; i ++ )
		for (int j = 0; j < n; j ++ )
		{
			int t;
			cin >> t;
			c[(i + j) % 3][t] ++ ;
		}
		
	LL res = 1e18;
	for (int i = 1; i <= m; i ++ )
		for (int j = 1; j <= m; j ++ )
			for (int k = 1; k <= m; k ++ )
			{
				if (i == j || j == k || i == k) continue;
				
				LL sum = 0;
				for (int v = 1; v <= m; v ++ )
				{
					sum += f[v][i] * c[0][v];
					sum += f[v][j] * c[1][v];
					sum += f[v][k] * c[2][v];
				}
				res = min(res, sum);
			}
	
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define fast_io()                \
    ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define mod 998244353
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    fast_io();
    ll x, k, d;
    ll cnt = 0;
    cin >> x >> k >> d;
    x = abs(x);
    cnt = min(k, x / d);
    x -= cnt * d;
    if ((k - cnt) % 2)
        cout << abs(d - x);
    else
        cout << x;
    return 0;
}


Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

int main(){
    int N;
    cin>>N;
    string s[N];
    for(int i=0;i<N;i++)cin>>s[i];

    map<string,long long> mp;
    for(int i=0;i<N;i++){
        sort(s[i].begin(),s[i].end());
        mp[s[i]]++;
    }
    
    long long x=0;
    for(auto itr=mp.begin();itr!=mp.end();++itr){
        x+=itr->second*(itr->second-1)/2;

    }
    cout<<x<<endl;
    return 0;
}

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

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

  vector<int> X(M);
  for (int i = 0; i < M; i++) cin >> X[i];

  sort(X.begin(), X.end());

  vector<int> dis(M - 1);
  for (int i = 0; i < M - 1; i++) dis[i] = X[i+1] - X[i];

  sort(dis.begin(), dis.end());

  int ans = 0;
  for (int i = 0; i < M - N; i++) ans += dis[i];

  cout << ans << endl;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int main(void){
	int32 N;
	vector<long double> a;
	cin >> N;
	a.resize(N);
	REP(i, N) cin >> a[i];
	sort(all(a));
	long double res = a[0];
	REP(i, N-1){
		if(abs(a[N-1]/2-a[i]) < abs(a[N-1]/2-res))
			res = a[i];
	}
	cout << (int64)a[N-1] << " " << (int64)res << endl;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;a++)
#define rl(a,b,c) for(int a=b;a>=c;a--)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB(a) push_back(a)
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
using namespace std;
const int INF=0x3f3f3f3f;
const int MAXN=1e5+10;
const int MOD=1e9+7;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
LL dp[MAXN][2];
struct node{
	vector<int> son;
//	vector<int> grand;
}each_node[MAXN];
int v[MAXN];
LL res(int flag,int now){
	if(dp[now][flag]) return dp[now][flag];
	LL tmpres=1;
	if(v[now]) return 0;
	v[now]=true;
	int sz1=each_node[now].son.size();
	rb(i,0,sz1-1)
	{
		if(v[each_node[now].son[i]]) continue;
		LL chenshu=res(0,each_node[now].son[i]);
		if(flag!=1){
			chenshu+=res(1,each_node[now].son[i]);
		}
		if(chenshu)
		tmpres*=chenshu;
		tmpres%=MOD;
		if(tmpres==0) tmpres+=MOD; 
	}
	v[now]=false;
	dp[now][flag]=tmpres;
	return tmpres;
	
}
int main(){
	ios::sync_with_stdio(false);
	int n;//n<=1e5
	cin>>n;
	rb(i,1,n-1){
		int xi,yi;
		cin>>xi>>yi;
		each_node[xi].son.PB(yi);
		each_node[yi].son.PB(xi);
	}
	cout<<(res(1,1)+res(0,1))%MOD;
	return 0;
}


Measured memory_bytes: 14592
#include<iostream>

using namespace std;

int main(){
    int a[5];
    int k;
    for (int i = 0; i < 5; i++)
    {
        cin >> a[i];
    }
    cin >> k;
    bool ans = true;
    for (int i = 0; i < 5; i++)
    {
        for (int j = 0; j < 5; j++)
        {
            if(abs(a[i]-a[j])>k)
            {
                ans = false;
                break;
            }
        }
    }
    if(ans)
    {
        cout << "Yay!" << endl;
    }
    else
    {
        cout << ":(" << endl;
    }
    return 0;
}

Measured memory_bytes: 256