akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<queue>
#include<stack>
	

int main(){
	int n;

	std::cin>>n;

	if(n==22)
		std::cout<<"Christmas Eve Eve Eve"<<std::endl;
	if(n==23)
		std::cout<<"Christmas Eve Eve"<<std::endl;
	if(n==24)
		std::cout<<"Christmas Eve"<<std::endl;
	if(n==25)
		std::cout<<"Christmas"<<std::endl;


	return 0;	
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
#include <sstream> 
#include <limits>
#include <numeric>
#include<string.h>
using namespace std;
#define ll long long int
#define all(v) begin(v), end(v)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
//typedef vector<int> V;
//typedef vector<V> VV;
//typedef vector<VV> VVV;
using namespace std;

int main() {
	int a, p, b;
	cin >> a >> p;
	b = a * 3 + p;
	cout << b / 2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main (){
ll dp[105][100009],wt[105],pr[105];
ll n,w;
cin>>n>>w;
for(int i=1;i<=n;i++)
cin>>wt[i]>>pr[i];
ll maxx=0;
for(int i=1;i<=n;i++){
  for(ll j=1;j<=100000;j++){
    if(j<pr[i])dp[i][j]=dp[i-1][j];
    else if(j==pr[i]){
    dp[i][j]=wt[i]+dp[i-1][j-pr[i]];
    if(dp[i-1][j])
    dp[i][j]=min(dp[i][j],dp[i-1][j]);
    if(dp[i][j]>w)
    dp[i][j]=dp[i-1][j];
}
else if(dp[i-1][j-pr[i]]){
dp[i][j]=wt[i]+dp[i-1][j-pr[i]];
    if(dp[i-1][j])
    dp[i][j]=min(dp[i][j],dp[i-1][j]);
    if(dp[i][j]>w)
    dp[i][j]=dp[i-1][j];
}
else dp[i][j]=dp[i-1][j];
if(dp[i][j])maxx=max(maxx,j);
  }
 }
 cout<<maxx<<endl; 
}

Measured memory_bytes: 80256
S=input()
N=len(S)
s1=""
s2=""
s3=""
flag=0
keyence="keyence"
for i in range(1,N):
    for j in range(i+1,N):
        for k in range(N):
            if k<i:
                s1="".join((s1,S[k]))
            elif k<j:
                s2="".join((s2,S[k]))
            else:
                s3="".join((s3,S[k]))
        #print(s1,s2,s3,sep="|")
        if ("".join((s1,s2))==keyence)or("".join((s1,s3))==keyence)or("".join((s2,s3))==keyence)or("".join((s1,s2,s3))==keyence):
            flag=1
            break
        s1=""
        s2=""
        s3=""
    if flag==1:
        break
if flag==1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 41964
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int N=2e5+5;
ll p[N];
int pre[N],bk[N],ans[N];
int n;
char s[N];
int get(int x)
{
    int ans=0;
    while(x)
        x=x%__builtin_popcount(x),ans++;
    return ans;
}
void solve(int x,int sum)
{
    if(sum<=0) return;
    p[0]=1;for(int i=1;i<N;i++) p[i]=p[i-1]*2%sum;
    for(int i=1;i<=n;i++)
        pre[i]=(pre[i-1]+(s[i]=='1')*p[i-1])%sum;
    for(int i=n;i>=1;i--)
        bk[i]=(bk[i+1]+(s[i]=='1')*p[i-1])%sum;
    for(int i=1;i<=n;i++)
        if(x==1&&s[i]=='1')
    {
        int res=(pre[i-1]+bk[i+1])%sum;
        ans[i]=1+get(res);
    }
    else if(x==0&&s[i]=='0')
    {
        int res=(pre[i-1]+bk[i+1]+p[i-1])%sum;
        ans[i]=1+get(res);
    }
}
int main()
{
    scanf("%d%s",&n,s+1);
    reverse(s+1,s+1+n);
    int sum=0;
    for(int i=1;i<=n;i++) sum+=s[i]=='1';
    solve(1,sum-1);
    solve(0,sum+1);
    reverse(ans+1,ans+1+n);
    for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
}


Measured memory_bytes: 7804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  string s;
  ll k;
  cin >> s >> k;

  string copy = s;

  ll ans = 0;

  // 繰り返しなしの一文字
  if (s.size() == 1 && k == 1) {
    ans = 0;
    cout << ans << endl;
    return 0;
  }

  // 繰り返しありの一文字
  if (s.size() == 1 && k >= 2) {
    ans = k / 2;
    cout << ans << endl;
    return 0;
  }

  bool same = true;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] != s[i + 1]) {
      same = false;
      break;
    }
  }

  // 全部一緒かつ奇数
  if (same && s.size() % 2 != 0 && k >= 2) {
    ll d2 = 0;
    for (int i = 0; i < s.size() - 1; i++) {
      if (s[i] == 'A' || s[i + 1] == 'A') continue;
      if (s[i] == s[i + 1]) {
        d2++;
        s[i + 1] = 'A';
      }
    }

    ll ANS = 0;
    ll a1 = d2;
    ll a2 = d2 + 1;

    ANS = (a1 + a2) * (k / 2);
    if (k % 2 != 0) ANS += a1;

    cout << ANS << endl;
    return 0;
  }

  // 最初と最後が同じかつ繰り返しあり
  if (s[0] == s[s.size() - 1] && k >= 2) {
    copy += copy;

    ll d1 = 0;
    for (int i = 0; i < copy.size() - 1; i++) {
      if (copy[i] == 'A' || copy[i + 1] == 'A') continue;
      if (copy[i] == copy[i + 1]) {
        d1++;
        copy[i + 1] = 'A';
      }
    }

    ll d2 = 0;
    for (int i = 0; i < s.size() - 1; i++) {
      if (s[i] == 'A' || s[i + 1] == 'A') continue;
      if (s[i] == s[i + 1]) {
        d2++;
        s[i + 1] = 'A';
      }
    }

    ll diff = d1 - d2 * 2;

    ll ANS = d2 * k + (diff * (k - 1));

    //　全部同じで奇数のときは

    cout << ANS << endl;
    return 0;
  }

  // 以下最初と最後が異なる　
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] == 'A' || s[i + 1] == 'A') continue;
    if (s[i] == s[i + 1]) {
      ans++;
      s[i + 1] = 'A';
    }
  }

  cout << ans * k << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cmath>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 10000007

typedef  long long ll;

using namespace std;

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

ll deg(int i){
  ll ret = 1;
  while(i != 0){
    if(i/10 == 0){
      break;
    }
    i/=10;
  }
  
  return i;
}

void solve(){
  ll a;cin>>a;
  ll b,c;
  b = a/500;
  c = a%500/5;
  cout << b*1000+c*5 << endl;

}


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


Measured memory_bytes: 256
#include <stdio.h>

int isPrime(int n) {
    int i;

    if (n<2) return 0;
    else if (n==2) return 1;
    else if (n%2==0) return 0;
    for (i=3; i<=n/i; i+=2) {
        if (n%i==0) return 0;
    }
    return 1;
}

int main(void) {
    int n, A[30][2], cnt, i=0, j, check=0;

    while (scanf("%d", &n) != EOF) {
        for (j=0;A[j][0]!='\0';j++) {
            if (A[j][0]==n) {
                printf("%d\n", A[j][1]);
                check=1;
            }
        }
        if (check==1) {
            check=0;
            continue;
        }
        A[i][0]=n;
        cnt=0;
        while (n>1) {
            if (isPrime(n)==1) cnt++;
            if (n!=3 && n%2==1) n-=2;
            else n--;
        }
        printf("%d\n", cnt);
        A[i][1]=cnt;
        i++;
    }

    return 0;
}



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

using namespace std;

int main(){
  int n,m;
  while(cin>>n>>m,n){
    int l[1000];
    bool ans[1100];
    for(int i=0;i<n;i++)cin>>l[i];
    bool f=1;
    for(int i=0;f&&i<1<<m;i++){
      int tmp=i;
      if(__builtin_popcount(tmp)!=l[0])continue;
      f=0;
      for(int j=0;j<m;j++)
	ans[j]=(i>>(m-j-1))%2;
      for(int j=1;j<n;j++){
	tmp=(tmp<<1)%(1<<m);
	if(__builtin_popcount(tmp)==l[j])ans[m+j-1]=0;
	else if(__builtin_popcount(tmp)+1==l[j])ans[m+j-1]=1,tmp+=1;
	else f=1;
	}
    }
    if(f)cout<<"Goofy";
    else for(int i=0;i<n+m-1;i++)cout<<ans[i];
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3100
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X))
#define rrep(X, Y) for (int(X) = (Y)-1; (X) >= 0; --(X))
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

void solve(std::string s) {
  ll l = 0;
  ll r = s.length() - 1;
  ll ans = 0;
  while (l < r) {
    if (s[l] == s[r]) {
      l++;
      r--;
    } else if (s[l] == 'x' && s[r] != 'x') {
      l++;
      ans++;
    } else if (s[l] != 'x' && s[r] == 'x') {
      r--;
      ans++;
    } else {
      print(-1);
      return;
    }
  }
  print(ans);
}

int main() {
  std::string s;
  std::cin >> s;
  solve(s);
  return 0;
}


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

using namespace std;

int main()
{
	int n, l;
	cin >> n >> l;
	string s[100];
	for (int i = 0; i < n; i++)
		cin >> s[i];
	sort(s, s + n);
	string ans;
	for (int i = 0; i < n; i++)
		cout << s[i];
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main {
    static String[] word = {"dream", "dreamer", "erase", "eraser"};
    static int[] wordlen = {5,7,5,6};
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        String s = sc.next();
        int nowIndex = s.length();
        while(nowIndex > 0){
            boolean flg = false;
            for(int i = 0; i < 4; i++){
                if(nowIndex >= wordlen[i] && s.substring(nowIndex-wordlen[i],nowIndex).equals(word[i])){
                    nowIndex -= wordlen[i];
                    flg = true;
                    break;
                }
            }
            if(!flg){
                break;
            }
        }
        System.out.println(nowIndex == 0 ? "YES" : "NO");
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

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


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

int main(){
	int a[4];
	char s[4] ;
	char flag='1';
	int i;
	cin>>s;
	
	for (i=0;i<=2;i++){
		if (s[i]==flag) cout<<9;
		else cout<<1;
	} 
}

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

using namespace std;
#define REP(i,a,n) for(int i = a; i < n; ++i)
#define REPM(i,n,a) for(int i = n - 1; i >= a; --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFD 1.0e+308
typedef long long LL;
typedef unsigned long long ULL;

LL a, b, x;

LL max_mul(LL lim, LL factor) {
	return lim - lim % factor;
}
int main() {
	cin >> a >> b >> x;
	cout << (max_mul(b, x) - max_mul(a, x)) / x + (a % x == 0) << endl;
	return 0;
}

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

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

signed main(){
  int H,W;
  cin>>H>>W;
  vector<vector<char>> A(H,vector<char>(W));
  rep(i,H){
    rep(j,W){
      cin>>A[i][j];
      if(A[i][j]!='#')A[i][j]='0';
    }
  }
  rep(i,H){
    rep(j,W){
      rep(k,8){
        int Nh=i+dy[k];
        int Nw=j+dx[k];
        if(Nh<0||Nh>=H||Nw<0||Nw>=W)continue;
        if(A[i][j]!='#'&&A[Nh][Nw]=='#')A[i][j]+=1;
      }
    }
  }
  rep(i,H){
    rep(j,W){
      cout<<A[i][j];
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define go(i,a,n) for(ll i=a;i<n;i++)
ll expo(ll a,ll b){
    if(b==0) return 1;
    if(b&1) return ((a % mod) * (expo((a * a) % mod , b >> 1) % mod)) % mod;
    return expo((a*a)%mod,b>>1)%mod;
}
ll mul(ll a , ll b){
    if(b==0) return 0;
    if(b&1) return ((a % mod) + (mul((a + a) % mod , b >> 1) % mod)) % mod;
    return mul((a+a)%mod,b>>1)%mod;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll a[n];
    go(i,0,n) cin>>a[i];
    ll dp[n];
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    go(i,2,n)
    {
        dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]) , dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Jun 21 21:00:12 JST 2020
 **/

signed main() {
    char c;
    std::cin >> c;
    std::cout << (c <= 'Z' ? 'A' : 'a') << std::endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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;}

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl


int main(){
    string S;
    int s=0,t=0;
    cin>>S;
    REPARR(i,S){
        if(S[i]=='S'){
            s++;
        }else{
            if(s){
                s--;
            }else{
                t++;
            }
        }
    }
    cout<<s+t<<endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#define MAX_N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;

int n, u, k, v;
int Adj[MAX_N][MAX_N];
int d[MAX_N], f[MAX_N], color[MAX_N];
int tt;

void initialize(){
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			Adj[i][j] = 0;
		}
	}
}

void check_adj(){
	Adj[u][v] = 1;
}

void dfs_visit(int u){
	color[u] = GRAY;
	d[u] = ++tt;
	for(int v = 0; v < n; v++){
		if(Adj[u][v] == 0) continue;
		if(color[v] == WHITE){
			dfs_visit(v);
		}
	}
	color[u] = BLACK;
	f[u] = ++tt;
}

void dfs(){
	tt = 0;
	for(int i = 0; i < n; i++) color[i] = WHITE;
	for(int i = 0; i < n; i++){
		if(color[i] == WHITE) dfs_visit(i);
	}
	for(int i = 0; i < n; i++){
		printf("%d %d %d\n", i + 1, d[i], f[i]);
	}
}

/* void print_adj(){
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			cout << Adj[i][j];
			if(j == n - 1) cout << endl;
			else cout << " ";
		}
	}
} */

int main(void){
	cin >> n;
	initialize();
	for(int i = 0; i < n; i++){
		cin >> u;
		u--;
		cin >> k;
		for(int j = 0; j < k; j++){
			cin >> v;
			v--;
			check_adj();
		}
	}
	dfs();
	//print_adj();

	return 0;
}

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

using namespace std;

long long CEIL;

int dfs(string s) {
  int seven = 0, five = 0, three = 0;
  if (CEIL < stoll(s))
    return 0;
  for (auto c : s) {
    if (c == '7')
      seven = 1;
    else if (c == '5')
      five = 1;
    else if (c == '3')
      three = 1;
  }
  auto ret = dfs(s + '7') + dfs(s + '5') + dfs(s + '3');
  if (seven + five + three != 3) {
    return ret;
  } else {
    return 1 + ret;
  }
}

int main() {
  cin >> CEIL;
  cout << dfs("0") << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    boolean[] b = new boolean[26];

    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (b[c - 'a']) {
        System.out.println("no");
        return;
      } else {
        b[c - 'a'] = true;
      }
    }

    System.out.println("yes");

  }
}

Measured memory_bytes: 35636
N,L = map(int,input().split())

sum1 = 0
absMin = 101
for i in range(N):
	taste = L + (i+1) -1
	#print(taste)
	sum1 += taste
	if abs(taste) < abs(absMin):
		absMin = taste
	
#print("min",absMin)
print(sum1-absMin)

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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

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

ll inf = 10000000;
ll mod = 1000000007;

int main() {
    int n, p[25];
    cin >> n;
    REP(i, n) { cin >> p[i]; }
    int ans = 0;
    for (int i = 1; i < n-1; i++) {
        if (p[i] < p[i - 1] && p[i] > p[i + 1]) { ans++; }
        if (p[i] > p[i - 1] && p[i] < p[i + 1]) { ans++; }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{   
    int W,a,b; cin>>W>>a>>b;
    if(a>b) swap(a,b);
    if(a+W<b) cout<<b-(a+W)<<endl;
    else cout<<0<<endl;
}


Measured memory_bytes: 256
#include <bitset>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <math.h>


using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef vector<vector<ll>> vvll;

typedef pair<int, int> Pair;
#define mp(x, y) make_pair(x, y)

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define repm(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える

//nが素数かをO(√n)で判断
bool is_prime(int n) {
    bool res = true;

    if (n == 1) return false;
    else if (n == 2) return true;

    else {
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0) {
                res = false;
                break;
            }
        }
    }

    return res;
}



int perm(int n, int r) {
    if (r == 1) return n;
    return n * perm(n - 1, r - 1);
}

int fact(int n) {
    if (n == 1) return 1;
    return fact(n - 1) * n;
}

int comb(int n, int r) {
    int a = min(n, r), b = max(n, r);
    return perm(a, b) / fact(a);
}



/*
ll pow_mod(ll a, ll n, ll mod) {
    ll res = 1;

    ll base = a;
    while (n) {
        if (n & 1) res = res * base % mod;
        base = base * base % mod;
        n >>= 1;
    }
    return res;
}
*/

//aの逆元　（a^(-1)）を求める
ll inv_mod(ll a, ll mod) {
    ll b = mod, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}

/*
ll fact_mod(ll n, ll mod) {
    if (n == 1) return 1;
    return n * fact_mod(n - 1, mod) * mod;
}
*/

// 階乗 (mod とりバージョン)
ll fact_mod(ll n, ll mod) {
    ll f = 1; for (int i = 2; i <= n; i++) f = f * (i % mod) % mod;
    return f;
}

ll pow_mod(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % mod;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

// 組み合わせ nCr を求める (modあり)
ll comb_mod(ll n, ll r, ll mod) {
    if (r > n - r) r = n - r;
    if (r == 0) return 1;
    ll a = 1;
    for (int i = 0; i < r; i++) a = a * ((n - i) % mod) % mod;
    ll b = pow_mod(fact_mod(r, mod), mod - 2, mod);
    return (a % mod) * (b % mod) % mod;
}

int main() {
    string s; cin >> s;
    int n = s.size();

    if (s[n - 1] == 's') s += "es";
    else s += 's';

    cout << s << endl;
}

Measured memory_bytes: 3600
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>
#include <sstream>
#include <bitset>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
#define MOD ((int)1e9+7)
//static const long double pi = 3.1415926535897932;

using namespace std;
using ll = long long int;
using ull = unsigned long long;

char toSmall(char c) { // 大文字を小文字へ
	return (c + 0x20);
}

char toLarge(char c) { // 小文字を大文字へ
	return (c - 0x20);
}

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

struct Combination {
	const int num=51e4;			//要素数
	const int mod=1e9+7;
	vector<ll> fact,inv,finv; //階乗,逆元,逆元の階乗.
	
	Combination():fact(num),inv(num),finv(num){
		fact[0]=fact[1]=1;
		inv[1]=1;
		finv[0]=finv[1]=1;
		for(int i=2;i<num;++i){
			fact[i]=fact[i-1]*i%mod;
			inv[i]=mod-inv[mod%i]*(mod/i)%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	
	int nCk(int n,int k){
		if(n<k) return 0;
		if(n<0 or k<0) return 0;
		return fact[n]*(finv[k]*finv[n-k]%mod)%mod;
	}
	int big_nCk(int n,int k){ //nが大きいとき
		ll res=1LL;
		for (int i = 0; i < k; i++) {
			res=res*(n-i)%mod;
		}
		res = res*finv[k]%mod;
		return res;
	}
	int nHk(int n,int k){return nCk(n+k-1,n-1);}//重複組み合わせ.
};

vector<string> split(const string& src, const char* delim = ",") { //カンマ区切り
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

bool check_int(string str)
{
	if (all_of(str.cbegin(), str.cend(), [](char ch) { return isdigit(ch);}))
	{
		return true;
	}
	return false;
}

struct rest {
	string s;
	int p;
	int num;

	/* -------------------------------------
	sort関数を使用したときのソートの定義をする。
	まずは文字列sでソートする。
	文字列sが同じだった場合、pでソートする。
	この条件を参考演算子で表現(ifでもOK)
	-------------------------------------*/
	bool operator<(const rest& right) const {
		return s == right.s ? p > right.p : s < right.s;
	}
};

ll pow_mod(ll n, ll k, ll p) { // n^k(mod p)
	if (k == 0) {
		return 1;
	}
	ll res = pow_mod(n * n % p, k / 2, p);
	if (k & 1) {
		res = res * n % p;
	}
	return res;
}

bool vector_finder(std::vector<int> vec, int number) { // vector 内にnumberがあるかどうか
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance( vec.begin(), itr );
	if (index != vec.size()) { // 発見できたとき
		return true;
	}
	else { // 発見できなかったとき
		return false;
	}
}

int main() {
	int a, b;
	cin >> a >> b;
	if (a + b == 15) {
		return cout << "+\n" , 0;
	} else if (a * b == 15) {
		return cout << "*\n" , 0;
	} else {
		return cout << "x\n", 0;
	}
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main() {
ll N, A;cin >> N;
deque<ll> B;

rep(i, 0, N){

cin >> A;

if(i%2 == 0)B.push_back(A);

else B.push_front(A);
}

if(N%2 != 0)reverse(ALL(B));

rep(i, 0, B.size())cout << B[i] << " ";
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<P> ab(m);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        ab[i] = make_pair(a, b);
    }
    sort(ab.begin(), ab.end());
    int ans = 0;
    int minb = 0;
    int tmp = -1;
    rep(i, m){
        chmin(minb, ab[i].second);
        if (minb <= ab[i].first){
            if (tmp != ab[i].second){
                minb = ab[i].second;
                ans++;
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int n;
    cin >> n;
    vector<int> h(n, 0);
    repi(i, n, 0)
    {
        cin >> h[i];
    }
    int ans = 0;
    repi(left, n - 1, 0)
    {
        int s = 0;
        while (left < n - 1)
        {
            if(h[left] >= h[++left]){
                s++;
            }else{
                left--;
                break;
            }
        }
        ans = max(ans,s);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#[allow(unused)]
use std::cmp::{max, min};

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

fn main() {
    input! {
        // usize
        // n: usize,
        // vec
        // v: [i64; n],
        n: usize,
        d: usize,
        x: [[f64; d]; n],
    }

    let mut count = 0;

    for i in 0..n {
        for j in i + 1..n {
            if check_integer(&x[i], &x[j]) {
                count += 1;
            }
        }
    }
    println!("{}", count);
}

fn check_integer(a: &Vec<f64>, b: &Vec<f64>) -> bool {
    let len = a.len();
    let mut tmp = 0.0;
    for i in 0..len {
        tmp += (a[i] - b[i]).powi(2);
    }

    let sqrt = tmp.sqrt() as i64;
    tmp as i64 == sqrt * sqrt
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include<vector>
#include<string>
using namespace std;
#define l long long
#define pb push_back
#define mem(a,n) memset(a,n,sizeof(a))
#define find(v,n) find(v.begin(),v.end(),n)
#define sort1(v) sort(v.begin(),v.end())
#define lb(v,n) lower_bound(v.begin(),v.end(),n)-v.begin()
#define ub(v,n) upper_bound(v.begin(),v.end(),n)-v.begin()
#define mod 1000000007
#define reverse(s) reverse(s.begin(),s.end())
//#define pi pair<l,l> 
const double pi=3.141592653589793;
bool isprime(l n)
{
	for(l i=2;i*i<=n;i++)
	{
		if(n%i==0)
			return false;
	}
	return true;
}
/*bool fact(l n)
{
	vector<l> v;
	for(l i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			if(i%2==1||(n/i)%2==1)
			{
				return true;
			}
		}
	}
	return false;
}*/
l power(l a,l b)
{
	l ans=1;
	while(b>0)
	{
		if(b&1)
		{
			ans=(ans*a);
		}
		b>>=1;
		a=(a*a);
	}
	return ans;
}//prefixsums
void frooty()
{
	l n;
	cin>>n;
	if(n<=599)
	{
		cout<<8<<"\n";
	}
	else if(n<=799)
	{
		cout<<7<<"\n";
	}
	else if(n<=999)
	{
		cout<<6<<"\n";
	}
	else if(n<=1199)
	{
		cout<<5<<"\n";
	}
	else if(n<=1399)
	{
		cout<<4<<"\n";
	}
	else if(n<=1599)
	{
		cout<<3<<"\n";
	}
	else if(n<=1799)
	{
		cout<<2<<"\n";
	}
	else
	{
		cout<<1<<"\n";
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int q=1;
	//cin>>q;
	while(q--)
	{
		frooty();
	}
}

Measured memory_bytes: 3608
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>	
#define inf INT_MAX
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
double dmax(double a,double b){
	return a>b?a:b;
}

int main(void){
	long long n=llin(),a=llin(),b=llin(),sa=a*(n-1)+b,sb=a+b*(n-1);
	if(a>b||n==1&&a!=b){
		puts("0");
	}
	else if(n==1&&a==b){
		puts("1");
	}
	else{
		llprint(sb-sa+1);
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> al = new ArrayList<>();
		for(int p =0; p<5; p++) {
			int num = sc.nextInt();
			al.add(num);
		}
		for(int p=0; p<al.size(); p++) {
			if(al.get(p)==0) {
				System.out.println(p + 1);
			}
		}
	}
}


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

int main() {
    while(true) {
        int x, y;
        cin >> x >> y;
        if (x == 0 && y == 0) break;
        if (x < y) {
            cout << x << " " << y << endl;
        } else {
            cout << y << " " << x << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3116
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner console = new Scanner(System.in);
		int n = console.nextInt();
		int ac = 0;
		int wa = 0;
		int tle = 0;
		int re = 0;
		for(int i = 0; i < n; i ++)
		{
			String temp = console.next();
			if(temp.equals("AC"))
			{
				ac ++;
			}
			else if(temp.equals("WA"))
			{
				wa ++;
			}
			else if(temp.equals("TLE"))
			{
				tle ++;
			}
			else
			{
				re ++;
			}
		}
		System.out.println("AC x " + ac);
		System.out.println("WA x " + wa);
		System.out.println("TLE x " + tle);
		System.out.print("RE x " + re);		
	}
}


Measured memory_bytes: 59624
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define MAX 100000
#define INF 2140000000
#define MOD 1000000007

int main() {
	int n;
	cin >> n;
	vector<int> v(n);

	for (int i = 0; i < n; ++i) {
		cin >> v[i];
	}

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

	bool same = 0;

	for (int i = 1; i < n; ++i) {
		if (v[i] == v[i - 1]) {
			same = 1;
		}	
	}

	if (same) {
		cout << "NO" << endl;
	}
	else {
		cout << "YES" << endl;
	}

	return 0;
}

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

bool has_key(map<int, int>& m, int key) {
    return m.count(key) != 0;
}

int main(void) {

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

    map<int, int> m; //身長+番号のリスト。ただし、0番は除く。
    for (int i = 0; i < n; i++) {
        int diffNumAndHeight = (i + 1) - a[i];
        if (has_key(m, diffNumAndHeight)) {
            m[diffNumAndHeight]++;
        }
        else {
            m[diffNumAndHeight] = 1;
        }
    }

    ll result = 0;
    for (int i = 0; i < n - 1; i++) {
        int diff = (i + 1) - a[i];
        m[diff]--; // 自分の登録分を取り除く。
        int addition = (i + 1) + a[i];
        result += m[addition]; // 自分以降のj番目の人で、j - a[j-1] がadditionに等しい人の人数を足す。
    }

    cout << result << endl;

    return 0;

}


Measured memory_bytes: 21112
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i = (ll)(a); i < (ll)(b); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
typedef pair<int,int> P;
int main(){
    int n; cin >> n;
    vector<P> p(n);
    rep(i,n) cin >> p[i].first >> p[i].second;

    int tot=1;
    for(int i=1; i<=n; i++) tot*=i;
    double dist = 0;
    rep(i,n)rep(j,n){
        if(i==j)continue;
        int dx=p[i].first-p[j].first;
        int dy=p[i].second-p[j].second;
        dist+= sqrt(dx*dx + dy*dy);
    }
    dist /= n;
    printf("%.10f\n",dist);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ms(x, a) memset(x, a, sizeof(x))
#define oo 100000000
#define ll long long int
#define MOD 1000000007
using namespace std;
ll rec(ll x){
    if(x<=1)return 1;
    return 2*rec(x/2)+1;
}
int main()
{
    ll h;
    cin>>h;
    cout<<rec(h);

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>

using namespace std;

int main(){
  int n, l;
  cin >> n >> l;

  vector<int> taste(n);
  for(int i = 0; i < n; i++){
    taste[i] = l + i;
  }

  int eat_index = 0;
  int min_taste = 100;  
  for(int k = 0; k < n; k++){
    if(min_taste  > abs(taste[k])){
      min_taste = abs(taste[k]);
      eat_index = k;
    }
  }

  taste.erase(taste.begin() + eat_index);

  int ans = 0;;
  for(int j = 0; j < n-1 ; j++) ans += taste[j];

  cout << ans;
}

Measured memory_bytes: 256
/*
        HELLO WORLD
        -----------
        SHUBHAM
        -----------
        :) CODING
*/
#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 ff                                         first
#define ss                                         second
#define pb                                         push_back
#define int                                        long long
#define mp                                         make_pair
#define pii                                        pair<int,int>
#define vi                                         vector<int>
#define mii                                        map<int,int>
#define umii                                       unordered_map<int,int>
#define pqb                                        priority_queue<int>
#define pqs                                        priority_queue<int,vi,greater<int>>
#define setbits(x)                                 __builtin_popcountll(x)
#define zerobits(x)                                 __builtin_ctzll(x)
#define mod                                        1000000007
#define inf                                        1e18
#define ps(x,y)                                    fixed<<setprecision(y)<<x
#define mk(arr,n,type)                             type *arr=new type[n]
#define test(t)                                    int t;cin>>t;while(t--)
#define rep(i,n)                                   for(int i=0;i<n;i++)
#define rep1(i,n)                                  for(int i=1;i<=n;i++)
#define fio                                        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SIZE                                       100005
#define all(x)                                     (x).begin(),(x).end()
#define sclk()                                     auto start_time = Clock::now()
#define eclk()                                     auto end_time = Clock::now();  cout << "\nTime Taken : " << chrono::duration_cast<chrono::milliseconds>(end_time    - start_time).count() << " ms"
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef std::chrono::high_resolution_clock Clock;

int powmod(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int a,int b) { return b?gcd(b,a%b):a;}

void f_io()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif // ONLINE_JUDGE
}
int dp[405][405];
int arr[405];
int pre[405];
int solve(int s,int e)
{
    if(s==e)
    return 0;
    if(dp[s][e]==-1)
    {
        int ans=inf;
        for(int i=s;i<e;i++)
        {
            ans=min(ans,solve(s,i)+solve(i+1,e)+pre[e]-pre[s-1]);
        }
        dp[s][e]=ans;
    }
    return dp[s][e];
}
int32_t main()
{
    memset(dp,-1,sizeof dp);
    int n;
    cin>>n;
    pre[0]=0;
    rep(i,n)
    {
        cin>>arr[i+1];
        pre[i+1]=pre[i]+arr[i+1];
    }
    cout<<solve(1,n);
    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define int long long 
using namespace std;
int cnt[200005];
int32_t main(){  
    int n;
    cin >> n;
    for(int i = 0 ; i < n-1 ; i++) {
      int tmp;
      cin >> tmp;
      cnt[tmp]++;
    }
    for(int i = 1 ; i <=n ;i++) cout << cnt[i] << "\n";
    return  0;
}

Measured memory_bytes: 5184
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<string>

using namespace std;

	long long height[100090];
	long long dp[100090];

int main(){

	memset(dp,63,sizeof dp);

	int n; cin >> n;
	int k; cin >> k;
	for(int i = 1; i <= n; i++) cin >> height[i];
	
	dp[1] = 0;
	for(int i = 2; i <= n; i++){
		
		for(int j = 1; j <= k && i - j > 0; j++){
			dp[i] = min(dp[i],dp[i-j] + abs(height[i] - height[i - j]));
		}
	//	cout << dp[i] << endl;
		
	} cout << dp[n];


	return 0;
}


Measured memory_bytes: 1792
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cctype>


using namespace std;
#define modd 1000000007



typedef pair<long long, long long> pl;


typedef string::const_iterator State;
class ParseError {};




#define ll long long




class UnionFind {
public:
	vector <ll> par;
	vector <ll> siz;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL){
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};


class SegmentTree {
private:
	int n;
	vector <ll> node;

public:
	// 元の配列　v をセグメントツリーで表現する。
	SegmentTree(vector<ll> v) {
		//最下段のノード数は元配列のサイズ以上になる最小の2冪->これをnとおく。
		//セグ木全体で必要なノード数は2n-1個である。
		int sz = v.size();
		n = 1; 
		while (n < sz)n *= 2;

	}

};




long long N, M, K, a, b, c, d, e, H, W, L;
ll A[300005] = {};
ll B[300005] = {};
ll C[300005] = {};
bool f, ff;
string S;
set <long long>sll;
pl bufpl;
vector <long long>vl[100005];
vector <long long>vll;
vector <pl>vpl;
vector <string> vs;
set<ll> llset;
multiset<ll> llmset;


struct ST
{
	int kaisuu;
	int dan;
	int score;
	char situ[52][2][2];
	

	bool operator<(const ST& another) const
	{
		return dan < another.dan;//比較
	};

};



/*vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/


long long modinv(long long aa, long long mm) {
	long long bb = mm, uu = 1, vv = 0;
	while (bb) {
		long long tt = aa / bb;
		aa -= tt * bb; swap(aa, bb);
		uu -= tt * vv; swap(uu, vv);
	}
	uu %= mm;
	if (uu < 0) uu += mm;
	return uu;
}


ll minn, maxx;
double ansa;
bool fl[2] = {};






int main() {

	cin >> N >> S;

	for (int i = 0; i < S.size(); i++) {
		A[S[i] - 'a']++;
	}

	e = 0;

	for (int i = 0; i < S.size(); i++) {
		A[S[i] - 'a']--;
		B[S[i] - 'a']++;
		d = 0;
		for (int j = 0; j < 26; j++) {
			if (A[j] > 0 && B[j] > 0) {
				d++;
			}
		}

		if (d > e) {
			e = d;
		}

	}


	cout << e << endl;

	return 0;

}


Measured memory_bytes: 8448
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<50);
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}


ll bn[105][105];
void bin_prep(){int i,j;for(i=0;i<105;i++){for(j=0;j<=i;j++){if(j==0)bn[i][j]=1LL;else bn[i][j]=bn[i-1][j-1]+bn[i-1][j];}}}

int main() {
    int n,a,b;cin>>n>>a>>b;
    vector<double> v(n);cin>>v;
    sort(all(v),greater<double>());
    double av=0;
    rep(i,a)av+=v[i];
    av/=a;
    
    /// 最大値の個数
    int c = 0;
    rep(i,n){
        if(v[i]==v[0])c++;
        else break;
    }
    
    bin_prep();
    if(c>=a){ //a番目まで全て同じ
        double ans = 0;
        repsg(i,a,min(b+1,c+1)){
            ans += bn[c][i];
        }
        printf("%.10lf\n",av);
        cout<<(long long)ans<<endl;
        return 0;
    }

    int st = (int)(upper_bound(all(v),v[a-1],[](double x, double y){return x>y;})-lower_bound(all(v),v[a-1],[](double x, double y){return x>y;}));
    
    int cur = a-1;
    while(v[cur]==v[a-1])cur--;
    cur++;
    ll ans = bn[st][a-cur];
    printf("%.10lf\n",av);
    cout<<(long long)ans<<endl;//少なく選んだとき最大
    

    
    return 0;
}










Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>

typedef long long ll;
ll A,B,N,ans;
int main(){
    scanf("%lld %lld %lld",&A,&B,&N);
    ll x = N-N%B-1;
    ll ans1 = (ll)((A*x)/B) - A*(ll)(x/B);
    ll ans2 = (ll)((A*N)/B) - A*(ll)(N/B);
    ll ans = ans1 > ans2 ? ans1 : ans2;
    printf("%lld",ans);
}


Measured memory_bytes: 1684
#include <bits/stdc++.h>
#define itn int
#define rep(i, n) for(int i = 0; i < n; i++)
#define irep(i,n) for(int i = n-1; i>=0; i--)
#define FOR(a,b) for(int i=a; i<b+1; i++)
using namespace std;
typedef long long ll;

bool f[100001];
int m[100001];
int main() {
    int q;
    cin >> q;
    f[1]=true;
    for(int i=2;i<100001;i++){
        if(!f[i]){
            for(int j=i+i;j<100001;j+=i){
                f[j]=true;
            }
        }
    }
    for(int i=3;i<100001;i+=2){
        if(!f[i]&&f[(i+1)/2]==false){
            m[i]++;
        }
    }
    for(int i=3;i<100001;i++){
        m[i]=m[i-1]+m[i];
    }
    while(q--){
        int l,r;
        cin >> l >> r;
        cout << m[r]-m[l-1] << endl;
    }
}

Measured memory_bytes: 1152