akhauriyash/Code-Regression huggingface dataset:
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

	int a;
	cin>>a;
	string s;
	cin>>s;
	if(a>=3200)cout<<s<<endl;
	else cout<<"red"<<endl;
}


Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nya_n "(=^･ω･^=)"
typedef long long ll;
using namespace std;

string s;
int cnta, cntb, cntc;

int main() {
	cin >> s;
	cnta = cntb = cntc = 0;
	lp(s.size())
		if (s[i] == 'a')cnta++;
		else if (s[i] == 'b')cntb++;
		else cntc++;
	if (abs(cnta - cntb) <= 1 && abs(cntb - cntc) <= 1 && abs(cntc - cnta) <= 1)
		cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
int main(void){
  int N,M,ans=0,p=0,j=0;
  cin >> N >> M;
  priority_queue<int> money;
  pint job[N];
  rep(i,N) cin >> job[i].first >> job[i].second;
  rep(i,N) job[i].first--;
  sort(job,job+N);
  while(p<M){
    while(job[j].first<=p && j<N) money.push(job[j].second),j++;
    if(!money.empty()) ans+=money.top(),money.pop();
    p++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1660
N=int(input())
ans=set()
def saiki(A):
    if len(A)>0:
        B="".join(A)
        count=set(A)
        #print(count)
        if eval(B)<=N:
            if len(count)==3:
                ans.add(B)
        else:
            return
    for i in [3,5,7]:
        A.append(str(i))
        saiki(A)
        A.pop()
saiki([])
print(len(ans))


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

int n;
vector<int> c, s, f;

int func(int p, int t){
//	cout << p << " " << t << "\n";
//	cout << c[p] << " " << s[p] << " " << f[p] << "\n";
	if(p == n-1) return t;
	int tmp = 0;
	if(t < s[p]) tmp = s[p];
	else tmp = (t - s[p] + f[p] - 1) / f[p] * f[p] + s[p];
	return func(p+1, tmp + c[p]);
}

int main(){
	cin >> n;
	for(int i=0; i<n-1; ++i){
		int x, y, z;
		cin >> x >> y >> z;
		c.push_back(x);
		s.push_back(y);
		f.push_back(z);
	}
	for(int i=0; i<n; ++i)
		cout << func(i, 0) << "\n";
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int x,y;
  while(1){
    scanf("%d%d",&x,&y);
    if(x==0 && y==0)
      break;
    if(x>y)
      printf("%d %d\n",y,x);
    else
      printf("%d %d\n",x,y);
  }
  return 0;
}

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

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

    map<int, int> cnt;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        for (int i = 0; i <= 2800; i += 400) {
            if (i <= a && a < i + 400) {
                cnt[i]++;
            }
        }
        if (a >= 3200) {
            cnt[3200]++;
        }
    }
    int c = cnt.size();
    if (cnt.find(3200) != cnt.end()) {
        cout << max(c - 1, 1) << " " << c - 1 + cnt[3200] << endl;
    } else {
        cout << cnt.size() << " " << cnt.size() << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string> 
#include <vector> 
#include <set> 
#include <map> 
#include <queue> 
#include <cmath> 
#include <stack> 
#include <iomanip>  
#include <functional> 
#include <array> 
#include <memory> 
#include <bitset> 
#include <unordered_set> 
#include <unordered_map> 
#include <numeric>
#undef NDEBUG
#include <assert.h>
#include <fstream>

using namespace std;
typedef long long ll;

void No() {
	cout << "-1\n";
	exit(0);
}

void print(int u, int v) {
	cout << u << ' ' << v << '\n';
}

int main() {
	ios::sync_with_stdio(0);
	cout.tie(0), cout.tie(0);

	string s;
	cin >> s;
	const int n = s.size();
	s = " " + s;
	if (s[1] == '0' || s[n] == '1') No();
	for (int i = 1; i < n; ++i)
		if (s[i] != s[n - i])
			No();

	int lastID = 1;
	int lastSz = 1;

	int gen = 2;


	for(int i = 2; i <= n; ++i)
		if (s[i] == '1' || i == n) {
			const int curr = gen++;
			print(curr, lastID);
			const int extra = i - lastSz - 1;
			for (int j = 0; j < extra; ++j)
				print(curr, gen++);
			lastID = curr;
			lastSz = i;
		}
	
	return 0;
}

Measured memory_bytes: 1664
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
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
 *
 * @author amotoma3
 */
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) {
            String s = in.nextString();

            out.println((s.charAt(0) == s.charAt(s.length() - 1)) ^ (s.length() % 2 == 1) ? "First" : "Second");
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

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

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 23252
#include <stdio.h>
int main()
{
  int W,H,x,y,r;
  scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
  if(x<=0 || x-r<0 || x+r>W || y<=0 || y-r<0 || y+r>H){
    printf("No\n");
  } else{
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 584
s = str(input())

l = list(s)

info = [1]

for i in range(1,len(l)):
    if l[i] == l[i-1]:
        info[-1] += 1
    else:
        info.append(1)

ans = 0
for j in range(0,len(info)):
    if info[j] % 3 == 0:
        ans += 2*(info[j]//3)
    elif info[j] % 3 == 1:
        ans += 2*(info[j]//3) + 1
    else:
        if j < len(info)-1:
            ans += 2*(info[j]//3) + 2
            info[j+1] -= 1
        else:
            ans += 2*(info[j]//3) + 1

print(ans)

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

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

  int x, y, z;
  cin >> x >> y >> z;

  cout << (x - z) / (y + z) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    ll k[11];
    ll s[11][11];
    rep(i,0,M){
        cin >> k[i];
        rep(j,0,k[i]){
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    ll p[11];
    rep(i,0,M) cin >> p[i];
    ll ans = 0;
    rep(bit,0,(1LL<<N)){
        ll on_num = 0;
        rep(i,0,M){
            ll cnt = 0;
            rep(j,0,k[i]){
                if((bit>>s[i][j]) & 1) cnt++;
            }
            if(cnt % 2 == p[i]) on_num++;
        }
        if(on_num == M) ans++; 
    }
    print(ans);

    
}

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

using namespace std;

typedef long long ll;

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

ll lcm(ll a, ll b){
  return (a/gcd(a, b)) * b;
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N; cin >> N;
  ll T[N];
  for(int i=0;i<N;i++) cin >> T[i];
  ll ans = T[0];
  for(int i=1;i<N;i++){
    // cout << ans << endl;
    ans = lcm(ans, T[i]);
  }
  cout << ans << endl;
}

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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a);i>(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1000000000;
const LL MOD = 1000000007;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

int main() {
  LL N, ans=5;
  cin >> N;
  VLL A(5);
  REP(i,5) {
    cin >> A.at(i);
  }
  SORT(A);
  if(A.at(0) < N) {
    ans += N / A.at(0);
    if(N%A.at(0) == 0) ans--;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>				//written by thidailoc
using namespace std;				//team three wolves
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
#define fu(i,a,b)   for(ll i=a;i<b;i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define ms(a, x) 	memset(a, x, sizeof a)
#define prec(n) 	fixed<<setprecision(n)
#define pb(i)	    push_back(i)
#define popb()    	pop_back()
#define sc(a) 	    scanf("%lld",&a)
#define sc2(a,b)    scanf("%lld%lld",&a,&b)
#define pr(a)	    printf("%lld ",a)
#define pr2(a,b)    printf("%lld %lld",a,b)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)	lower_bound(a.begin(),a.end(),x) -a.begin()
#define all(x) 		(x).begin(), (x).end()
#define sz(a) 		(ll)a.size()
#define le			length()						
#define re 			return 	
#define	mp(a,b)  	make_pair(a,b)
#define se			second
#define fi			first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)

double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17;

ll arr[100005];

ll Solves(){
	//INPUT;
	ll n,k,cnt=0,ans=0,x,y,query,l,r;
	// PROCESSING IN HERE
	sc2(x,y);
	if(x+y>=10)cout<<"error";
	else cout<<y+x;
	re 0;
}


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

Measured memory_bytes: 256
import numpy as np
n = int(input())
arr = np.array(list(map(int, input().split())))

ans = np.zeros(n + 1, dtype=int)
for i, x in enumerate(arr):
    tmp = x * 2 - ans[i]
    ans[i + 1] += tmp

x = ans[-1] // 2
ans = ans[:-1]
ans[0::2] += x
ans[1::2] -= x

print(*ans)

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

using namespace std;

int main() {

	int n;
	cin >> n;
	int d, x;
	cin >> d >> x;
	vector<int> a(n+1, 0);
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}

	int counter = 0;
	for (int i = 1; i <= d; i++) {
		for (int j = 1; j <= n; j++) {
			if ((i-1)%a[j]==0) { counter++; }
		}
	}
	cout << counter + x << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//do {
//    print(v);
//  } while (std::next_permutation(v.begin(), v.end()));


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

	int N;
	cin >> N;
	if (N < 1200)
		cout << "ABC" << endl;
	else if (N >= 1200 && N < 2800)
		cout << "ARC" << endl;
	else
		cout << "AGC" << endl;
	return 0;
}



Measured memory_bytes: 256
S = input()
T = input()
ans_list = []
for i in range(len(S)):
    for j in range(i+1,len(S)+1):
        part = S[i:j]
        if len(part) != len(T):
            continue
        for k in range(len(part)):
            if part[k] != T[k] and part[k] != "?":
                break
            elif k == len(part)-1:
                ans_str = S[:i] + T + S[j:]
                ans_list.append(ans_str)
ans_list = sorted([s.replace("?","a") for s in ans_list])
if ans_list == []:
    print("UNRESTORABLE")
else:
    print(ans_list[0])

Measured memory_bytes: 3064
// In the name of Allah 
#include <bits/stdc++.h>
using namespace std;

const int mod = 1e9+7, MAX = 2e5+5;

int a[28], m, res=10000;
string s;

bool ok (string s) {
	for (int i = 0; i < s.size(); i++)
		if (s[i] != s[0])
			return 0;
	return 1;
}

int f (char c) {
	int ans = 0;
	string t = s, k="";
	while (!ok(t)) {
		k = "";
		for (int i = 0; i < t.size()-1; i++) {
			if (t[i] == c || t[i+1] == c)
				k += c;
			else
				k += t[i];
		}
		t = k;
		ans ++;
	}
	return ans;
}
			
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);	
	cin >> s;
	for (int i = 0; i < 26; i++)
		res = min(res, f('a'+i));
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
l = [input() for _ in range(n)]

if len(set(l)) != len(l):
    print("No")
    exit()

for i in range(len(l)-1):
    if l[i][len(l[i])-1] != l[i+1][0]:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 3060
import Data.List

main = do
    _ <- getLine
    ts <- map read . words <$> getLine
    _ <- getLine
    pxs <- tuplify . map read . words <$> getContents
    let t = sum ts
    mapM_ print $ map (\(p,x) -> t - (ts!!(p-1) - x)) pxs

tuplify [] = []
tuplify (x:y:xs) = (x,y):tuplify xs


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

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

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

void Main() {
    u32 N, M, X;
    cin >> N >> M >> X;
    Vec<u32> C(N);
    Vec<Vec<u32>> A(N, Vec<u32>(M));
    for (int i = 0; i < N; i++) {
        cin >> C[i];
        for (int j = 0; j < M; j++) {
            cin >> A[i][j];
        }
    }
    i32 min = 1e8;
    for (int b = 0; b < (1 << N); b++) {
        Vec<u32> index;
        for (int i = 0; i < N; i++) {
            if (b & (1 << i)) {
                index.push_back(i);
            }
        }
        Vec<u32> p(M, 0);
        i32 cost = 0;
        for (int i = 0; i < index.size(); i++) {
            cost += C[index[i]];
            for (int j = 0; j < M; j++) {
                p[j] += A[index[i]][j];
            }
        }
        bool success = true;
        for (int i = 0; i < M; i++) {
            if (p[i] < X) success = false;
        }
        if (cost < min && success) min = cost;
    }
    if (min > 1e7) min = -1;
    cout << min << endl;
}


Measured memory_bytes: 3668
import math
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def bitlist(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

#a = list(map(int, input().split()))

n,k = list(map(int, input().split()))
r,ss,p = list(map(int, input().split()))
s = input()

hands = [[] for i in range(k)]
for i in range(n):
    hands[i%k].append(s[i])
ans = 0    
for i in hands:
    prev = 't'
    for j in i:
        if(prev==j):
            ans+=0
            prev = 't'
        else:
            if(j=='r'): ans+=p
            if(j=='s'): ans+=r
            if(j=='p'): ans+=ss
            prev = j
print(ans)

Measured memory_bytes: 79484
using System;
using System.Collections.Generic;
using System.Linq;

public class ABC0140_A4v1 {
    private static void Main(string[] args) {
        var inputs = new List<string>() {
            Console.ReadLine().Trim(),
            Console.ReadLine().Trim(),
        };
        Prepare(inputs);
    }

    private static void Prepare(List<string> inputs) {
        var ints = inputs[0].Split().Select(x => int.Parse(x)).ToArray();
        var numOfDirections = ints[0];
        var numOfTrials = ints[1];
        var directions = inputs[1];
        Compute(numOfDirections, numOfTrials, directions);
    }

    private static void Compute(int numOfDirections, int numOfTrials, string directions) {
        var happiness = 0;
        for (var index = 0; index < numOfDirections - 1; index++) {
            if (directions[index] == directions[index + 1])
                happiness++;
        }
        happiness += 2 * numOfTrials;

        var answer = Math.Min(happiness, numOfDirections - 1);
        OutputAnswer(answer.ToString());
    }

    private static void OutputAnswer(string text) => Console.WriteLine(text);
}

Measured memory_bytes: 13536
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

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

int main(void) {
  int i,j;
  int a,b,c,d,e,f;
  cin>>a>>b>>c>>d>>e>>f;

  vi water(3005,0),sugar(3005,0);
  rep(i,3000)rep(j,3000)
    if(100*a*i+100*b*j<=3000)water[100*a*i+100*b*j]++;
  rep(i,3000)rep(j,3000)
    if(c*i+d*j<=3000)sugar[c*i+d*j]++;
  water[0]=0;
  sugar[0]++;

  int x=100*a,y=0;
  rep(i,3005)rep(j,3005)
    if(water[i]>0 && sugar[j]>0 && i+j<=f && e*i>=100*j){
      if(j*(x+y)>y*(i+j)){
	x=i;
	y=j;
      }
    }

  cout<<x+y<<" "<<y<<endl;
}


Measured memory_bytes: 384
program christmas_eve_eve_eve
  implicit none
  integer :: d
  read(*,*) d
  d = 25 - d
  write(*,'(a)',advance='no') 'Christmas'
  do while (d .gt. 0)
     write(*,'(a)',advance='no') ' Eve'
     d = d - 1
  end do
  write(*,'(a)') ''
  stop
end program christmas_eve_eve_eve

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#define all(n) n.begin(),b.end()
#define F first
#define S second
#define INF (1<<27)
using namespace std;
typedef pair<int,int> P;
typedef vector<P> VP;
int n;

bool cmp(const P& a,const P& b)
{
  if(a.S != b.S)
    return a.S < b.S;
  return false;
}

int get_D(P *a,int now)
{
  if(now <= 1)
    return INF;

  int m = now/2;
  int x = a[m].F;
  int d = min(get_D(a,m),get_D(a+m,now-m));
  inplace_merge(a,a+m,a+now,cmp);

  VP b;
  for(int i=0;i<now;i++)
    {
      if(abs(a[i].F-x) >= d)
	continue;

      for(int j=0;j<b.size();j++)
	{
	  int dx = a[i].F-b[b.size()-1-j].F;
	  int dy = a[i].S-b[b.size()-1-j].S;
	  if(dy >= d)
	    break;

	  d = min(d,dx*dx+dy*dy);
	}
      b.push_back(a[i]);

    }
  return d;
}

int main()
{
 
  cin >> n;
  P a[n]; 
  for(int i=0;i<n;i++)
    cin >> a[i].F >> a[i].S;
  sort(a,a+n);
  cout << get_D(a,n) << endl;
  return 0;
}

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

int main(int argc, const char * argv[]) {
    int h,w;
    cin >> h >> w;
    char A[9][9];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> A[i][j];
        }
    }
    
    bool flag = true;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(A[i][j] == '#'){
//                A[i][j] = '.';
//                if(A[i+1][j]=='#' && A[i][j+1]=='#' && i+1<h && j+1 <w){
//                    
//                    flag = false;
//                }
                if(A[i+1][j]=='#' && A[i][j+1]=='#'){
                    
                    flag = false;
                }
//                if( A[i-1][j]=='#' && A[i][j-1]=='#' && A[i][j+1]=='#'){
//                    
//                    flag = false;
//                }
                if(A[i-1][j+1] == '#'){
                    flag = false;
                }

            }
        }
    }
    if(flag) cout << "Possible";
    else cout << "Impossible";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {
	int N; cin >> N;

	int ans = 0;
	for (int i = 0; i < N; i++) {
		int n; cin >> n;

		if ((i+1) % 2 == 1 and n % 2 == 1) {
			ans++;
		}
	}
	cout << ans << endl;


	return 0;
}


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

int main(){
  int a[5];
  int time=0;
  int amari_min= 10;
  rep(i,5){
    cin >> a[i];
    time += (a[i] + 9) / 10;
    int amari;
    amari = a[i] % 10;
    if (amari != 0){
      if (amari < amari_min) amari_min = amari;
    }
  }
  time = (time-1) * 10 + amari_min;
  cout << time;
}
      

Measured memory_bytes: 256
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

struct Node {
	bool visited = false;
	vector<int> neighbors;
};

struct Loc {
	int i;
	int step;
};

int N, X, Y;
Node nodes[2000];
int ans[2000];

int bfs(int start) {
	int result = 0;
	Loc start_loc = {start, 0};
	queue<Loc> search_queue;
	search_queue.push(start_loc);
	for (int i=0; i<N; i++) {
		nodes[i].visited = false;
	}
	nodes[start].visited = true;

	while(!search_queue.empty()) {
		// キューから探索対象のノードを取り出す
		Loc loc = search_queue.front();
		search_queue.pop();

		int i = loc.i;
		int step = loc.step;
		//cout << i << " (" << step << ")" << endl; // **** debug ****

		ans[step]++;

		for (int neighbor : nodes[i].neighbors) {
			if (nodes[neighbor].visited) continue; // 探索済み
			Loc next_loc = {neighbor, step + 1};
			search_queue.push(next_loc);
			nodes[neighbor].visited = true;
		}
	}

	return result;
}

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

	for (int i=0; i<N-1; i++) {
		nodes[i].neighbors.push_back(i+1);
		nodes[i+1].neighbors.push_back(i);
	}

	nodes[X-1].neighbors.push_back(Y-1);
	nodes[Y-1].neighbors.push_back(X-1);

	for (int i=0; i<N; i++) {
		//cout << "start: " << i << endl; // **** debug ****
		bfs(i);
	}

	for (int i=1; i<N; i++) {
		cout << ans[i] / 2 << endl;
	}

	return 0;
}

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

int main(){
	int a,b,c;
  	cin >> a >> b >> c;
  	if(a==b){
    	cout << c;
    }else if(b==c){
    	cout << a;
    }else{
    	cout << b;
    }
  	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define pb(n) push_back(n);
#define maxii 100005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
vector<int> vi[maxii];
vector<int> vi2[maxii];
vector<int> vi3[maxii];
vector<int>:: iterator child;
vector<vector<pair<int, int> > > vii;
//vector<pii> vii;
vector<pll> vll;
//vii.clear();
//vii.resize(n + 1);


int arr[maxii];
int arr2[maxii];
int arr3[maxii];
bool check[maxii];
bool check2[1000][1000];
int n,m,store,county;
stack<int>st;
void dfs(int node)
{
    check[node]=true;
    for(int child=0;child<vi[node].size();child++)
    {
        if(check[vi[node][child]]==false)
        {
            dfs(vi[node][child]);
        }
    }
    st.push(node);
}

void dfs2(int node)
{
    check[node]=true;
    arr2[node]=store;
    county++;
    for(int child=0;child<vi2[node].size();child++)
    {
        if(check[vi2[node][child]]==false)
        {
            dfs2(vi2[node][child]);
        }
    }
}
void dag_count(int node)
{
    check[node]=true;
    arr[node]=1;
    //cout<<node<<" "<<arr[node]<<endl;

    for(int child=0;child<vi3[node].size();child++)
    {
        if(check[vi3[node][child]]==false)
        {

            dag_count(vi3[node][child]);
            //arr[node]+=arr[vi3[node][child]];
        }
        arr[node]=max(arr[node],1+arr[vi3[node][child]]);

    }
   // cout<<node<<" "<<arr[node]<<endl;
}
queue<int>que;

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    sc(n)
    sc(m)
    int a,b;
    for(int i=0;i<m;i++)
    {
        sc(a)
        sc(b)
        vi3[a].pb(b)
    }
    for(int i=1;i<=n;i++)
    {
        if(check[i]==false)
        {
            dag_count(i);
        }
    }
    int maxi=0;
    for(int i=1;i<=n;i++)
    {
        //cout<<i<<" "<<arr[i]<<endl;
        maxi=max(maxi,arr[i]);
    }
    cout<<maxi-1<<endl;

}






Measured memory_bytes: 17100
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	A,B = inputMap()

	tmp = A+B
	tmp2=A-B
	tmp3=A*B
	print(max(tmp,tmp2,tmp3))



if __name__ == "__main__":
	main()


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

using namespace std;

int main() {
  vector<int> abc(3);
  for (int i = 0; i < 3; ++i) cin >> abc[i];
  sort(abc.begin(), abc.end());
  int ans = 0;
  while (abc[2] > abc[1]) {
    abc[1]++;
    abc[0]++;
    ans++;
  }
  while (abc[2] > abc[0]) {
    abc[0] += 2;
    ans++;
  }
  cout << (abc[0] - abc[2] == 0? ans: ans + 1) << endl;
  return 0;
}



Measured memory_bytes: 256
MOD = 10**9 + 7

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

counter = {}
for a in A:
    if a in counter:
        counter[a] += 1
    else:
        counter[a] = 1

possible = True
for num, cnt in counter.items():
    if num == 0:
        possible &= cnt == 1
    else:
        possible &= cnt == 2

if possible:
    ans = 1
    for i in range(N // 2):
        ans = (ans*2) % MOD
    print(ans)
else:
    print(0)

Measured memory_bytes: 14436
import java.util.Scanner;

public class Main {
	static int chocoAmount;

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int price = 700;
		String str = s.next();
		int strLen = str.length();
		char[] c = new char[strLen];

		for (int i = 0; i < strLen; i++) {
			c[i] = str.charAt(i);
			if (c[i] == 'o') {
				price += 100;
			}
		}
		System.out.println(price);
	}
}

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

int main(){
  int n;
  cin >> n;
  int h[n];
  rep(i,n) cin >> h[i];
  
  int max = 0;
  int num = 0;
  rep(i,n){
    if(h[i]>=max){
      max = h[i];
      num++;
    }
  }
  
  cout << num << endl;
  return 0;
}


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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> g[n];
    vector<int> back[n];
    for(int i = 0; i < m; i++){
        int u, v;
        cin >> u >> v;
        u--; v--;
        g[u].push_back(v);
        back[v].push_back(u);
    }
    vector<bool> mark(n, false);
    vector<int> topo;
    function<void(int)> dfs = [&](int v){
        mark[v] = true;
        for(int x : g[v]){
            if(!mark[x]) dfs(x);
        }
        topo.push_back(v);
    };

    for(int i = 0; i < n; i++){
        if(!mark[i]) dfs(i);        
    }
    reverse(topo.begin(), topo.end());
    vector<int> dp(n, 0);
    for(int v: topo){
        for(int u : g[v]) dp[u] = max(dp[u], dp[v]+1);
    }
    int mx = 0;
    for(int i = 0; i < n; i++) mx = max(mx, dp[i]);
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 14204
#include "bits/stdc++.h"
using namespace std;
#define OUT(x)                cout << #x << " = " << x << endl
#define rep(i, n)             for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r)          for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r)          for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define all(x)                (x).begin(), (x).end()
#define rall(x)               (x).rbegin(), (x).rend()
template<typename T> void pv(T a, T b) { for (T i = a; i != b; i ++) cout << *i << " "; cout << endl; }
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }
int in() { int x; scanf("%d", &x); return x; }
long long lin() { long long x; scanf("%lld", &x); return x; }

#define int long long

vector<int> g[101010];
int k;
int ans = 0;

int dfs(int s, int d) {
        int h = 0;
        for (auto ns : g[s]) amax(h, dfs(ns, d + 1) + 1);
        if (d > 1 && h == k - 1) { 
                ans ++;
                return -1;
        }
        return h;
}

signed main() { 
        int n;
        cin >> n >> k;
        int f;
        cin >> f;
        if (f != 1) ans ++;
        reu(i, 1, n) {
                int a;
                cin >> a;
                a --;
                g[a].push_back(i);
        }
        dfs(0, 0);
        cout << ans << endl;
        return 0;
}               


Measured memory_bytes: 10368
PROGRAM-ID.                      ABC_051_B.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP     PIC X(9).
    01 K       PIC 9(4).
    01 S       PIC 9(4).
    01 ans     PIC X(9).

    01 ZS      PIC Z(9)9.
    01 DUMMY   PIC X(1).

    01 i       PIC 9(4) BINARY.
    01 j       PIC 9(4) BINARY.

    01 tmp     PIC 9(9).
    01 cnt     PIC 9(9).

PROCEDURE                        DIVISION.
    ACCEPT INP.

    UNSTRING INP
    DELIMITED BY SPACE
    INTO K S.

    MOVE ZERO TO cnt.

    PERFORM VARYING i FROM 0 BY 1 UNTIL 3 * K < i
        IF K < i THEN
            EXIT PERFORM
        END-IF

        PERFORM VARYING j FROM 0 BY 1 UNTIL 3 * K < j
            IF K < j THEN
                EXIT PERFORM
            END-IF

            ADD i TO j GIVING tmp
            IF tmp <= S AND S - tmp <= K THEN
                ADD 1 TO cnt
            ELSE
                IF S < tmp THEN
                    EXIT PERFORM
                END-IF
            END-IF
        END-PERFORM
    END-PERFORM.

    MOVE cnt TO ZS.

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


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

long long n,k;

int main(){
	scanf("%lld%lld",&n,&k);
	printf("%lld\n",((n+2-k)*(k*n-k*k+k)+(n+2-k)*(n+1-k)*(n+1-2*k)/2-(n-k+1)*(n-k+2)*(2*n-2*k+3)/6+(n+2-k))%1000000007);
	return 0;
}

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
typedef long long lint;
const int mod = 1e9 + 7;

int n, a[100005];

int main(){
	scanf("%d",&n);
	for(int i=1; i<=n; i++) scanf("%d",&a[i]);
	lint ans = 1;
	int cur = 1;
	for(int i=2; i<=n; i++){
		cur = min(cur + 1, (a[i-1] + 3) / 2);
		ans *= cur;
		ans %= mod;
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    
    string S;
    cin >>S;
    vector<int> A(0);
    for(int i = 0;i < S.size();i++){
        if(S[i] == '0') A.push_back(0);
        if(S[i] == '1') A.push_back(1);
        if(S[i] == 'B'){
            if(A.size() > 0) A.pop_back(); 
        } 
        
    }
    for(int i = 0;i < A.size();i++){
        cout << A[i];
    }
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 1100000;
const int mod = 1e9 + 7;
int dp[maxn];
void run_case()
{
    int s;
    cin >> s;
    dp[0] = 1;
    dp[1] = 0;
    dp[2] = 0;
    dp[3] = 0;
    for (int i = 3; i <= s; i++)
    {
        dp[i] = (dp[i - 1] + dp[i - 3]) % mod;
    }
    cout << dp[s] << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    cout.flush();
    return 0;
}

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

#define pb                push_back
#define mp                make_pair
#define all(x)            (x).begin(),(x).end()
#define fi                first
#define se                second
#define vc                vector
#define pii               pair<bint,bint>
#define endl              "\n"
#define rep(i,a,b)        for(bint i=a;i<b;i++)
#define repe(i,a,b)       for(bint i=a;i<=b;i++)
#define bac(i,a,b)        for(bint i=a;i>b;i--)
#define bace(i,a,b)       for(bint i=a;i>=b;i--)
#define fast              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

//CHANGE IF REQ
#define int               long long int
#define bint              int
//-----------------

#define ld                long double
#define mod1              (bint)(1e9 + (bint)7)
#define mod2              (bint)998244353
#define pi                (float)3.14159265358979323846
#define inf               LLONG_MAX
#define ninf              (bint)-1*LLONG_MAX

#define DECIMAL(n)        std::cout << std::fixed << std::setprecision(n)
#define SORT(v)           sort(all(v))
#define RSORT(v)          sort(all(v),greater<bint>())
#define REVERSE(v)        reverse(all(v))

#define trav(a, x)        for(auto& A : x)
#define display(x)        trav(A,x) cout<<A<<endl;
#define pow(i,n)          (bint)pow((bint)i,n)
#define pow2(n)           ((bint)1<<n)
#define sz(x)             (bint)x.size()

typedef std::priority_queue<bint, std::vector<bint>, std::greater<bint> > min_pq;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

inline string inttos(bint a){std::stringstream soso; soso<<a; return soso.str();}
inline bint stoint(const std::string &s) {std::stringstream soso; soso << s; long long x; soso >> x; return x;}
inline std::string inttobin(bint x) {return std::bitset<40>(x).to_string();}
inline void swp(bint &a, bint &b){auto temp=a;a=b;b=temp;}

//pri - 1000000009
//ba  - 937,991,1013,1409,1741

void solve(){
    int n;
    cin>>n;
    map<int,int> m;
    rep(i,0,n-1){
        int x;
        cin>>x;
        m[x]++;
    }
    rep(i,1,n+1){
        cout<<m[i]<<endl;
    }
}


signed main(){
    fast


    int t=1;
    //cin>>t;
    rep(i,0,t){
       solve();
    }
}

Measured memory_bytes: 16164
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
namespace IO{
	cs int Rlen=1<<22|1;
	inline char gc(){
		static char buf[Rlen],*p1,*p2;
		(p1==p2)&&(p2=(p1=buf)+fread(buf,1,Rlen,stdin));
		return (p1==p2)?EOF:*p1++;
	}
	int read(){
		int x=0; bool f=false; char c=gc();
		while(!isdigit(c)) f=(c=='-'), c=gc();
		while(isdigit(c)) x=(((x<<2)+x)<<1)+(c^48), c=gc(); 
		return f?-x:x;
	}
} using namespace IO;
typedef long long ll;
cs int Mod = 998244353;
int add(int a, int b){ return a + b >= Mod ? a + b - Mod : a + b; }
int dec(int a, int b){ return a - b < 0 ? a - b + Mod : a - b; }
int mul(int a, int b){ return 1ll * a * b % Mod; }
void Add(int &a, int b){ a = add(a,b); }
void Mul(int &a, int b){ a = mul(a,b); }
void Dec(int &a, int b){ a = dec(a,b); }
int ksm(int a, int b){ int as=1; for(;b;b>>=1,Mul(a,a)) if(b&1) Mul(as,a); return as; }
int fx(ll a){ return a % Mod; }
cs int N = 1e5 + 50;
int n, a, b, c, up;
vector<int> A[N], B[N], C[N];
int af[N], bf[N], cf[N], SG[3][N];
int clc(int t, cs vector<int> &S){
	vector<int> T;
	for(int c : S) T.pb(SG[t][c]); 
	sort(T.begin(),T.end()); int as=0;
	for(int i=0; i<(int)T.size(); i++)
	if(T[i]==as) ++as; else if(T[i]>as) break;
	return as;
}
void FWT(int *a){
	for(int i=1; i<up; i<<=1)
	for(int j=0; j<up; j+=(i<<1))
	for(int k=0; k<i; k++){
		int x=a[k+j], y=a[k+j+i];
		a[k+j]=add(x,y); a[k+j+i]=dec(x,y);
	}
}
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	n=read(), a=read();
	for(int i=1,x,y; i<=a; i++){
		x=read(), y=read();
		if(x>y) swap(x,y); A[x].pb(y);
	} b=read();
	for(int i=1,x,y; i<=b; i++){
		x=read(), y=read();
		if(x>y) swap(x,y); B[x].pb(y);
	} c=read();
	for(int i=1,x,y; i<=c; i++){
		x=read(), y=read();
		if(x>y) swap(x,y); C[x].pb(y);
	}
	static int pw[N]; pw[0]=1; pw[1]=fx(1e18);
	for(int i=2; i<=n; i++) pw[i]=mul(pw[i-1],pw[1]);
	int mx=0;
	for(int i=n,x; i>=1; i--){
		SG[0][i]=x=clc(0,A[i]); Add(af[x],pw[i]); mx=max(mx,x);
		SG[1][i]=x=clc(1,B[i]); Add(bf[x],pw[i]); mx=max(mx,x);
		SG[2][i]=x=clc(2,C[i]); Add(cf[x],pw[i]); mx=max(mx,x);
	} up=1; while(up<mx+1) up<<=1;
	FWT(af); FWT(bf); FWT(cf);
	for(int i=0; i<up; i++) Mul(af[i],mul(bf[i],cf[i]));
	FWT(af); cout<<mul(ksm(up,Mod-2),af[0]); return 0;
}

Measured memory_bytes: 18048
#include<bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;  
#define ordered_set tree<ll, null_type , less<ll> , rb_tree_tag , tree_order_statistics_Node_update> 
#define ll long long
#define ull unsigned long long
#define pb push_back
#define inf 1e18
#define mk make_pair
#define ld long double
#define fi first
#define se second
#define mod 1000000007
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test ll t; cin>>t; while(t--)
#define setbits __builtin_popcount
#define endl '\n'
#define LOCAL
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i));}
sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
ll power(ll a,ll n)
{
    ll p;
    if(n==0)
    {
        return 1;
    }
    p=power(a,n/2);
    p=(p*p)%mod;
    if(n%2==1)
    {
        p=(p*a)%mod;
    }
    return p;
}
int main()
{
    fastIO; 
    ll n;
    cin>>n;
    ll x,y,val,val1;
    x=power(10,n);
    y=power(8,n);
    x=(x+y)%mod;
    val=(2*power(9,n))%mod;
    val=(x-val+mod)%mod;
    cout<<val<<endl;
}

Measured memory_bytes: 3644
#include <stdio.h>
int main(void){
    int s;
    int yymm=0;
    int mmyy=0;
    
    scanf("%d", &s);

    if(s%100<=12 && s%100>=1) yymm=1;
    if(s/100<=12 && s/100>=1) mmyy=1;

    if(yymm&&!mmyy){
        printf("YYMM\n");
    }
    if(yymm&&mmyy){
        printf("AMBIGUOUS\n");
    }
    if(!yymm&&mmyy){
        printf("MMYY\n");
    }
    if(!yymm&&!mmyy){
        printf("NA\n");
    }
        

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <climits>

using namespace std;



int main(int argc, char *argv[])
{
  int D,N;
  int decimal = 100;

  int counter = 0;
  cin >> D;
  cin >> N;
  int result = N;

  if (N == 100) {
    result++;
  }
  while (D != counter) {
    result = decimal * result;
    counter++;
  } 

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


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, gcd, lcm 
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <vector> // vectors
#include <string> // string
#include <queue> // queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <unordered_map> // hashed by keys
#define _for(i,n) for(int i = 0; i < n; i++)

typedef long long ll; // at least int64 > 9*10^18
typedef unsigned long long ull; // at least uint64

int main() {
  int n,k;
  std::string s;
  std::cin >> n >> k >> s;
  s[k-1] = s[k-1]+('a'-'A');
  std::cout << s << std::endl;
  
  return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
 
int main() {
  string s;
  cin >> s;
  int s_len = s.size();
  cout << s[0] << s_len - 2 << s[s_len - 1] << endl;
  return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAX = 20000 + 10;

int a[MAX], b[MAX];
int r[MAX];

int main(){
  int n;
  scanf("%d", &n);
  for(int i = 0 ; i < n ; i++){
    int t;
    scanf("%d", &t);
    t--;
    r[t] = i;
  }
  a[0] = 0;
  b[0] = r[0];
  int mina = a[0], minb = b[0];
  for(int i = 1 ; i < n ; i++){
    if(r[i] > r[i-1]){
      b[i] = b[i-1] - 1;
      a[i] = r[i] - b[i];
    }else{
      a[i] = a[i-1] + 1;
      b[i] = r[i] - a[i];
    }
    mina = min(mina, a[i]);
    minb = min(minb, b[i]);
  }
  for(int i = 0 ; i < n ; i++){
    if(i != 0) putchar(' ');
    printf("%d", a[i] - mina + 1);
  }
  puts("");
  for(int i = 0 ; i < n ; i++){
    if(i != 0) putchar(' ');
    printf("%d", b[i] - minb + 1);
  }
  puts("");
  return 0;
}


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


int main() {
  double L;
  cin >> L;
  double a;
  a=pow(L/3, 3);
  printf("%lf",a);
}





Measured memory_bytes: 256