akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using P=pair<int,int>;
using lint=long long;
using ll=long long;
const lint inf=1e18+7;
const int MOD=1000000007;
signed main(){
  int n;cin>>n;
  vector<P> a(n);
  rep(i,n)cin>>a[i].first>>a[i].second;
  sort(a.begin(),a.end());
  int res;
  if(n%2==0){
    int mn=a[n/2-1].first;
    int mnp=a[n/2].first;
    //mnp=min(mnp,a[n/2-1].second);
    rep(i,n)swap(a[i].first,a[i].second);
    sort(a.begin(),a.end());
    reverse(ALL(a));
    int mx=a[n/2-1].first;
    int mxp=a[n/2].first;
    //mxp=max(mxp,a[n/2-1].second);
    double s=(mxp+mx)/2.0;
    double m=(mnp+mn)/2.0;
    //printf("s=%lf, m=%lf\n",s,m);
    res=(mxp+mx)-(mnp+mn)+1;
    if(mx==mn)res=1;
  }
  else{
    int mn=a[n/2].first;
    rep(i,n)swap(a[i].first,a[i].second);
    sort(a.begin(),a.end());
    reverse(ALL(a));
    int mx=a[n/2].first;
    res=mx-mn+1;
  }
  cout<<res<<"\n";
  return 0;
}


Measured memory_bytes: 6364
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, n, m = 1e6, ans = 0;
  bool p[m];
  for(i = 0; i < m; ++i) p[i] = true;
  for(i = 2; i < 1000; ++i) if(p[i]) {
    for(j = 2; i * j < m; ++j) p[i * j] = false;
  }
  for(i = 1000; i > 1; --i) if(p[i]) {
    for(j = i; j < m; j *= i) p[j] = true;
  }
  scanf("%lld", &n);
  for(i = 2; i < m; ++i) if(p[i] && !(n % i)) ans++, n /= i;
  if(n > m) ++ans;
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 2684
#include<iostream>
int n,x,a,i,j,k;
main(){
	while(std::cin>>n>>x,n){
		a=0;
		for(i=1;i<=n;i++)for(j=i+1;j<=n;j++)for(k=j+1;k<=n;k++){
			if(i+j+k==x)a++;
		}
		std::cout<<a<<'\n';
	} 
}




Measured memory_bytes: 3092
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int loop=1,weight_max;cin>>weight_max,weight_max;loop++){
		int n;
		cin>>n;
		vi value(n),weight(n);
		rep(i,n)
			scanf("%d,%d",&value[i],&weight[i]);
		
		vi dp(weight_max+1);
		rep(i,n){
			vi dp2=dp;
			repi(j,weight[i],dp.size())
				dp2[j]=max(dp[j],dp[j-weight[i]]+value[i]);
			dp=dp2;
		}
		
		int res_value=0;
		int res_weight=0;
		rep(i,dp.size()){
			if(dp[i]>res_value){
				res_value=dp[i];
				res_weight=i;
			}
		}
		cout<<"Case "<<loop<<":"<<endl;
		cout<<res_value<<endl;
		cout<<res_weight<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
int main(){
int c,i,n,a[101];
scanf("%d\n",&n);
for (c = 0;c < n;c++){scanf("%d ",&a[c]);}
for (i = n - 1; i >= 1; i--){
printf("%d ",a[i]);
}
printf("%d", a[0]);
printf("\n");
return 0;
}

Measured memory_bytes: 604
#include <stdio.h>

 int main()
 {
  int x,y,a,b;
   while(1){
     scanf("%d %d \n",&x,&y);
    if(x == 0 && y == 0) break;

     if (x>y){
        a = y;
        b = x;
     }
     else{
       a = x;
       b = y;
     }
     
    printf("%d %d\n",a,b);

   }

return(0);
}

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];
#define debug(x) cout << #x << "= " << x<< endl;
// template starts
typedef long long int ll;

// template ends here

void solve(){
	// code starts from here
	string a, b;
	cin >> a >> b;
	
	int ans = INT_MAX;
	
	int N = a.size(), M = b.size();
	
	for(int i = 0; i+M <= N; i++){
		string str;
		for(int j = 0; j < M; j++) str.pb(a[j+i]);
		
		int c = 0;
		for(int j = 0; j < M; j++) if(str[j] != b[j]) c++;
		ans = min(ans,c);
		
	}
	cout << ans << endl;
}

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

	int T;
	T = 1;
	while(T--){
		solve();
	}

	return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int p = n / 2;
        if(n % 2 == 1){
            p ++;
        }
        System.out.println(p);
    }
}

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



int main()
{
    int H, W;
    cin >> H >> W;
    char a[H][W];
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            cin >> a[i][j];
        }
    }

    //判定用
    vector<bool> row(H, false);
    vector<bool> col(W, false);

    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            if (a[i][j] == '#'){
                row[i] = true;
                col[j] = true;
            }
        }
    }

    for (int i = 0; i < H; i++){
        if (row[i]){
            for (int j = 0; j < W; j++){
                if (col[j]){
                    cout << a[i][j];
                }
            }
            cout << endl;
        }
    }
}

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

string IsRepeat(string s){
    if(s.at(0)==s.at(1)&&s.at(1)!=s.at(2)&&s.at(2)==s.at(3)){
        return "Yes";
    }
    else if(s.at(0)==s.at(2)&&s.at(2)!=s.at(1)&&s.at(1)==s.at(3)){
        return "Yes";
    }
    else if(s.at(0)==s.at(3)&&s.at(3)!=s.at(1)&&s.at(1)==s.at(2)){
        return "Yes";
    }
    else{
        return "No";
    }
}

int main(){
    string s; cin >> s;
    cout << IsRepeat(s) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    //入力を受け取る
    int H,W,h,w;
    cin >> H >> W >> h >>w;
    //計算する
    int ans = (H-h)*(W-w);
    //出力する
    cout << ans <<endl;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#define endl  "\n"
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);
using namespace std;
int main()
{
	ll int a1,a2,a3;
	cin >> a1 >> a2 >> a3;
	if(a1+a2+a3>=22)
	{
		cout << "bust";
	}
	else
	{
		cout << "win";
	}
}


Measured memory_bytes: 256
use itertools::Itertools;
fn main() {
    proconio::input! {
        n: usize,
        m: usize,
        xyzs: [(i64, i64, i64); n],
    }
    let np3_xyzs = [
        xyzs.iter()
            .cloned()
            .sorted_by(|l, r| (-l.0 - l.1 - l.2).cmp(&(-r.0 - r.1 - r.2)))
            .collect_vec(),
        xyzs.iter()
            .cloned()
            .sorted_by(|l, r| (-l.0 - l.1 + l.2).cmp(&(-r.0 - r.1 + r.2)))
            .collect_vec(),
        xyzs.iter()
            .cloned()
            .sorted_by(|l, r| (-l.0 + l.1 - l.2).cmp(&(-r.0 + r.1 - r.2)))
            .collect_vec(),
        xyzs.iter()
            .cloned()
            .sorted_by(|l, r| (-l.0 + l.1 + l.2).cmp(&(-r.0 + r.1 + r.2)))
            .collect_vec(),
        xyzs.iter()
            .cloned()
            .sorted_by(|l, r| (l.0 - l.1 - l.2).cmp(&(r.0 - r.1 - r.2)))
            .collect_vec(),
        xyzs.iter()
            .cloned()
            .sorted_by(|l, r| (l.0 - l.1 + l.2).cmp(&(r.0 - r.1 + r.2)))
            .collect_vec(),
        xyzs.iter()
            .cloned()
            .sorted_by(|l, r| (l.0 + l.1 - l.2).cmp(&(r.0 + r.1 - r.2)))
            .collect_vec(),
        xyzs.iter()
            .cloned()
            .sorted_by(|l, r| (l.0 + l.1 + l.2).cmp(&(r.0 + r.1 + r.2)))
            .collect_vec(),
    ];
    let v = np3_xyzs
        .iter()
        .map(|xyzs| {
            let sumxyz = xyzs.iter().take(m).fold((0, 0, 0), |sum, (x, y, z)| {
                (sum.0 + x, sum.1 + y, sum.2 + z)
            });
            sumxyz.0.abs() + sumxyz.1.abs() + sumxyz.2.abs()
        })
        .collect::<Vec<_>>();
    let ans = v.iter().max().unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 2356
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#define rep(i,c) for(int i=0;i<(int)c;i++)//ループのマクロ
using namespace std;
int main(){
    int N;
    cin>>N;
    int A[N];
    rep(i,N){
        cin>>A[i];
    }
    vector <int>newN();
    int count = 0;
    rep(i,N){
        if (A[i]%2==0){
            count += 1;
            if(A[i]%3==0 || A[i]%5==0){
                count -= 1;
            }
        }
    }
    if(count == 0){
        cout<<"APPROVED"<<endl;
    }
    else{
        cout<<"DENIED"<<endl;
    }
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 11451419194545;

int main(){

    ll N = 0;
    cin >> N;
    //i個おいたものがすでに何個あるかを記憶して掛け合わせる
    map<ll, ll> mp;
    //最初は3色のうちどれかを確実に選べる
    mp[0] = 3;
    
    ll ans = 1;
    for(ll i = 0; i < N; i++){
        ll t = 0; cin >> t;
        ans *= mp[t];
        ans %= MOD;
        mp[t]--;
        mp[t+1]++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = (ll)1e9+7;
ll sum(ll x)
{
    return x*(x-1)/2;
}
int main()
{
    int n,k;
    cin>>n>>k;
    ll ans=0;
    for(int i=k;i<=n;i++)
    {
        ll t1=sum(i);
        ll t2 = sum(n+1)-sum(n-i+1);
        ans+= t2-t1+1;
    }
    ans++;
    ans%=mod;
    cout<<ans<<endl;
}


Measured memory_bytes: 3636
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999

using namespace std;

typedef long long ll;

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

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

	for (int i = str.length() - 1; i >= 0; i--) {
		cout << str[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 3196
import java.util.Scanner;

public class Main { 
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int a = S.charAt(0) - '0';
    int b = S.charAt(1) - '0';
    int c = S.charAt(2) - '0';
    int d = S.charAt(3) - '0';
    if (a -b -c - d ==7) System.out.printf ("%d-%d-%d-%d=7" ,a ,b ,c , d );
    else if (a -b - c + d ==7) System.out.printf ("%d-%d-%d+%d=7" ,a ,b ,c , d );
    else if (a - b +c - d ==7) System.out.printf ("%d-%d+%d-%d=7" ,a ,b ,c , d );
    else if (a - b + c + d ==7) System.out.printf ("%d-%d+%d+%d=7" ,a ,b ,c , d );
    else if ( a +b -c - d ==7) System.out.printf ("%d+%d-%d-%d=7" ,a ,b ,c , d );
    else if ( a +b - c + d ==7) System.out.printf ("%d+%d-%d+%d=7" ,a ,b ,c , d );
    else if ( a + b +c - d ==7) System.out.printf ("%d+%d+%d-%d=7" ,a ,b ,c , d );
    else if ( a + b + c + d ==7) System.out.printf ("%d+%d+%d+%d=7" ,a ,b ,c , d );
  }
}

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


 int main (){
	int n;
	cin >> n;
		for(int i=1;i<=n;++i){
			int x = i;
			if(x%3 == 0){
				cout<< " " << i;
			}
			else {
				while (x!=0){
					if(x%10==3){
						cout << " " << i;
						break;
					}
					else{
						x = x/10;
					};
				}
			}
		}
		cout <<endl;
	
	return 0;
}

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

#define fi first
#define sd second
#define lson (nd<<1)
#define rson (nd<<11)
#define PB push_back
#define mid (l+r>>1)
#define MP make_pair
#define SZ(x) (int)x.size()

using namespace std;

typedef long long LL;

typedef vector<int> VI;

typedef pair<int,int> PII;

inline int read(){
    int res=0, f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){res=res*10+ch-'0';ch=getchar();}
    return res*f;
}

const int MAXN = 15;

const int MAXM = 1'005;

const int MOD = 1000000007;

char s[MAXN][MAXM];

int preSum[MAXN][MAXM];

int N;

int n, m, k;

int get(int x1, int y1, int x2, int y2){
    return preSum[x2][y2]-preSum[x1-1][y2]-preSum[x2][y1-1]+preSum[x1-1][y1-1];
}

int calc(int x){
    int ret=0;
    vector<int> len;
    int cnt=1;

    for(int i=0;i<n-1;++i){
        if(x&(1<<i)){
            len.push_back(cnt);
            cnt=1;
        }else{
            ++cnt;
        }
    }
    len.push_back(cnt);

    int base=1;
    for(auto it:len){
        int ed=base+it-1;
        for(int i=1;i<=m;++i){
            if(get(base,i,ed,i)>k)return -1;
        }
        base=ed+1;
    }

    vector<int>nums(SZ(len),0);
    for(int i=1;i<=m;++i){
        vector<int> t(SZ(len),0);
        int base=1;
        for(int j=0;j<SZ(len);++j){
            int ed=base+len[j]-1;
            t[j]=get(base,i,ed,i);
            base=ed+1;
        }

        int ok=1;
        for(int j=0;j<SZ(len);++j){
            if(t[j]+nums[j]>k){
                ++ret;
                ok=0;
                break;
            }
        }

        if(ok) for(int j=0;j<SZ(len);++j)nums[j]+=t[j];
        else for(int j=0;j<SZ(len);++j)nums[j]=t[j];
    }

    return ret;
}

int main(){
    n=read();m=read();k=read();

    for(int i=1;i<=n;++i)scanf("%s",s[i]+1);

    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j){
            preSum[i][j]=(s[i][j]=='1'?1:0);
        }
    }

    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j){
            preSum[i][j]+=preSum[i][j-1]+preSum[i-1][j]-preSum[i-1][j-1];
        }
    }

    N=(1<<n-1);
    int ans=0x3f3f3f3f;

    for(int i=0;i<N;++i){
        int x=calc(i);
        if(x!=-1)ans=min(ans,x+__builtin_popcount(i));
    }

    cout<<ans;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int n, count = 0;
char s[200010][11];

int main()
{
    scanf("%d", &n);

    for (int i = 0; i < n; i++)
    {
        scanf("%s", s[i]);
    }

    qsort(s, n, 11, strcmp);

    for (int i = 0; i < n; i++)
    {
        if (strcmp(s[i], s[i + 1]) != 0)
            count++;
    }

    printf("%d", count);

    return 0;
}


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

int main(){
  int a, b;
  cin >> a >> b;
  if (a % 2 == 0 || b % 2 == 0) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

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

int main(){
    vector<long long> A(3);
    for (int i = 0; i < 3; i++)
    {
        cin>>A[i];
    }
    bool T=false;
    sort(A.begin(),A.end());
    if(A[0]==A[1]&&A[1]!=A[2])T=true;
    reverse(A.begin(),A.end());
    if(A[0]==A[1]&&A[1]!=A[2])T=true;
    if(T)cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <ctime>
#include <climits>
#include <chrono>
#include <bits/stdc++.h>

#define ll long long
#define f first
#define s second

using namespace std;
using namespace chrono;

mt19937_64 randGen(system_clock().now().time_since_epoch().count());
mt19937 rnd(42);

#ifdef local
  const int N = 1e3+1;
#else
  const int N = 1e5+1;
#endif

struct Solver {
  int n, m;
  vector <int> to[N];
  bool usd[N] = {};
  int res[N] = {};

  void read() {
    int x, y;
    cin >> n >> m;
    for(int i = 0; i < m; i++) {
      cin >> x >> y;
      to[x].push_back(y);
    }  
  }

  int dfs(int v) {
    if(usd[v]) {
      return res[v];
    }
    usd[v] = true;
    res[v] = 0;
    int x = 0;
    for(auto &e : to[v]) {
      x = max(x, dfs(e)+1);
    }
    return res[v] = x;
  }

  void solve() {
    int ans = 0;
    for(int i = 1; i <= n; i++) {
      ans = max(ans, dfs(i));
    }
    cout << ans;
  }
};

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

  #ifdef local
    freopen("input-g.txt", "r", stdin);
  #endif

  Solver sol;
  sol.read();
  sol.solve();

  #ifdef local
    auto tspent = 1.0 * clock() / CLOCKS_PER_SEC;
    cerr << "\nTime elapsed: " << tspent << " s.\n";
  #endif
  return 0;
}


Measured memory_bytes: 7680
#include <stdio.h>
int main(void){
    int n,i,x;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&x);
        if(x%2==0 && (!(x%3==0 || x%5==0))){
            printf("DENIED");
            return 0;
        }
    }
    printf("APPROVED");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll,ll>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;

class UnionFind
{
private:
    vector<ll> p;
    vector<ll> rank;
public:
    UnionFind(ll n){
        p.resize(n,-1);
        rank.resize(n,1);
    }
    ll find(ll x){
        if(p[x]<0)return x;
        return p[x]=find(p[x]);
    }
    void unite(ll x,ll y){
        x=find(x);
        y=find(y);
		if(x==y)return;
        if(rank[x]>rank[y])swap(x,y);
        if(rank[x]==rank[y])rank[y]++;
        p[y]+=p[x];
        p[x]=y;
    }
    ll size(ll x){
        return -p[find(x)];
    }
	bool same(ll a, ll b){
		return find(a) == find(b);
	}
};

signed main(){
	//cout << fixed << setprecision(10);
	ll n,m; cin >> n >> m;
	UnionFind uf(n);
	vl ans(m);
	vector<pl> vec(m);
	rep(i,0,m){
		cin >> vec[i].first >> vec[i].second;
		vec[i].first--;
		vec[i].second--;
	}
	ll ret = 0;
	for(int i = m - 1; i >= 0; i--){
		ans[i] = n * (n - 1) / 2  - ret;
		if(!uf.same(vec[i].first , vec[i].second)){
			ret += uf.size(vec[i].first) * uf.size(vec[i].second);
			uf.unite(vec[i].first , vec[i].second);
		}
	}
	rep(i,0,m)cout << ans[i] << endl;
}


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

int main() {
	int n;cin>>n;
	for(int i=0;i<3;i++){
		if(n%10==7){
			cout<<"Yes"<<endl;
			return 0;
		}
		n/=10;
	}
	cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(4);
  int n,i=0;
  cin >> n;
  while(n){
	a.at(i) = n%10;
    n /= 10;
    i++;
  }
  int c=0,d=0;
  if(a.at(0)== a.at(1) && a.at(1) == a.at(2) || a.at(1) == a.at(2) && a.at(2) == a.at(3)) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){
    int n;
    cin>>n;
    int ans=0;
    while(n){
        ans+=(n%10==2);
        n/=10;
    }
    cout<<ans<<endl;
}



/*

*/

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main( )
{	
    int n;
    
    cin>>n;
    
    int maxProfit = 1-1000000000;
    int Rj, Ri;
    cin>>Ri;
    n--;
    while( n-- ) {
    	cin>>Rj;
    	int t = Rj - Ri;
    	if( maxProfit < t ) {
       		maxProfit = t;
       	}
       	if( Rj < Ri ) {
    		Ri = Rj;
    	}
    }
    cout<<maxProfit<<endl;
	
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n; cin >> n;
	string s; cin >> s;
	vi cnt(26);
	for (auto c : s)
	{
		cnt[c - 'a']++;
	}
	ll ans = 1;
	REP(i, 26)
	{
		ans *= cnt[i] + 1;
		ans %= MOD;
	}
	cout << ans - 1 << endl;
	return 0;
}

Measured memory_bytes: 512
/* https://atcoder.jp/contests/abc078/tasks/arc085_a */

#include <iostream>
#include <vector>
#include <cmath>

/* {{{ Variables */
int N, M;
/* }}} */

int main(int argc, char *argv[])
{
  /* {{{ Input */
  std::cin >> N >> M;
  /* }}} */

  /* {{{ Output */
  int X = (1900*M + 100*(N-M))*pow(2, M);
  std::cout << (int)X << std::endl;
  /* }}} */

  return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
	void execute(){
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();
		int a[][] = new int[n][m];
		int b[] = new int[m];
		for(int i = 0;i < n;i++){
			for(int j = 0;j < m;j++){
				a[i][j] = s.nextInt();
			}
		}
		for(int i = 0;i < m;i++){
			b[i] = s.nextInt();
		}
		for(int i = 0;i < n;i++){
			int ans = 0;
			for(int j = 0;j < m;j++){
				ans+=a[i][j]*b[j];
			}
			System.out.println(ans);
		}
	}
	public static void main(String args[]){
		Main m = new Main();
		m.execute();
	}
}

Measured memory_bytes: 40612
<?php
fscanf(STDIN, "%d", $n);
$x = 1;
while ($n--) {
	fscanf(STDIN, "%d", $t);
	$x = $x / gcd($x, $t) * $t;
}
echo $x;

function gcd($n, $m) {
	return $n % $m ? gcd($m, $n % $m) : $m;
}

Measured memory_bytes: 4728
#include<iostream>
#include<vector>
using namespace std;
#define rep(x,y,z) for(int x=y;x<z;x++)
int main(){
    int H,W,K;
    cin >> H >> W >> K;
    vector<vector<char>> data(H,vector<char>(W));
    rep(i,0,H){
        rep(j,0,W){
            cin >> data[i][j];
        }
    }
    int answer = 0;
    for(int i=0;i<(1 << H+W);i++){
        int sum = 0;
        for(int h=0;h<H;h++){
            if(1 << h & i) continue;
            for(int w=0;w<W;w++){
                if(!(1 << (H + w) & i)){
                    if(data[h][w]=='#')sum ++;
                }
            }
        }
        if(sum == K)answer++;
    }
    cout << answer << endl;
    return 0;
}



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

int main()
{
	long long n;
	cin >> n;
	long long sum=0;
	long long a = 100;
	for (int i = 1;; i++) {
		a += a / 100;
		if (a >= n) {
			cout << i << endl;
			break;
		}
	}
}


Measured memory_bytes: 3624
//AUTHOR:BlackBox Inc.//
#include<bits/stdc++.h>
#include<unordered_map>
#include<tr1/unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define endl "\n"
#define vpii vector<pair<int,int>>
#define vs vector<string>
#define lin1(x) ll int x; x = scan();
#define lin2(x,y) ll int x, y; x = scan(), y = scan();
#define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x,y) make_pair(x,y)
#define mx(a,b) (a)>(b)?(a):(b)
#define mn(a,b) (a)<(b)?(a):(b)
#define fori(s,e) for(i=s;i<=e;i++)
#define forj(s,e) for(j=s;j<=e;j++)
#define fork(s,e) for(k=s;k<=e;k++)
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define cn cin>>
#define co cout<<
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace std::tr1;

int main()
{


long long x;
cin>>x;
std::vector<int> v(x);

for (int i = 0; i < x; ++i)
{
	/* code */
	cin>>v[i];
}

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

int raj=v[x-1]/2;
int sum=0;
for (int i = 0; i < x-1; ++i)
{
	/* code */
	sum+=v[i];
}
 

    			

cout<<sum+raj<<endl;

return 0;
}






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

using namespace std;

typedef long long int lli;

int main(){
  lli resp,n,m,a,b,x=0;

  scanf("%lld %lld", &n,&m);

  vector<long long int> v(n,1);
  vector<long long int> r(n,0);
  r[0]=1;
  while(m--){
    scanf("%lld %lld", &a,&b);
    
    if(v[a-1]>0){
      //cambio
      v[b-1]++;
      v[a-1]--;
      
      if(r[a-1]==1){
        if(v[a-1]==0){
          r[a-1]=0;
        }
        r[b-1]=1;
      }
    }
  }
  x=0;
  for(lli i=0;i<n;i++)
    if(r[i]) x++;
  printf("%lld\n", x);
 
  return 0;      	
}

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

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

    vector<int> a(N, 0);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    vector<int> dp(K + 1, -1);
    for (int i = 0; i < a.front(); i++)
    {
        dp[i] = 0;
    }

    for (int i = a.front(); i <= K; i++)
    {
        dp[i] = 0;
        for (int x : a)
        {
            if (i - x < 0)
            {
                continue;
            }
            if (dp[i - x] == 0)
            {
                dp[i] = 1;
            }
        }
    }

    if (dp.back() == 1)
    {
        cout << "First" << endl;
    }
    else
    {
        cout << "Second" << endl;
    }
}


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

int32_t main() {
	int n, c, ans = 1; cin>>n>>c;
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin>>a[i];
	}
	int now = 0;
	for(int i = 0; i <n; i++){
		now = now + a[i];
		if(now <= c){
			ans++;
		}
	}
	cout<<ans<<endl;
}


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

int main(){
    int a[3] = {1,0,0};
    string s;
    while(cin >> s){
        int i = s[0]-'A', j = s[2]-'A';
        swap(a[i],a[j]);
    }
    for(int i=0;i<3;i++){
        if(a[i]){
            cout << char('A'+i) << endl;
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 3132
h,w=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(h)]

C=[]
for i in range(h):
    flag=1 if i%2==0 else -1
    for j in range(w)[::flag]:
        if A[i][j]%2==1:
            if 0<=j+flag<w:
                C.append([i,j,i,j+flag])
                A[i][j+flag] +=1
            elif 0<=i+1<h:
                C.append([i,j,i+1,j])
                A[i+1][j] +=1

print(len(C))
for i in C:
    print(*list(map(lambda x:x+1,i)))

Measured memory_bytes: 73564
def abc(num):
    c=None
    if(num<=26):
        c = chr(96+num)
    elif(num%26==0):
        c = abc((num//26)-1)+chr(122)
    else:
        c = abc(num//26)+chr(96+(num%26))
    return(c)

input_num = int(input())
print(abc(input_num))


Measured memory_bytes: 9176
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	stdInScanner.Scan()
	i, _ := strconv.Atoi(stdInScanner.Text())
	return i
}

func main() {
	stdInScanner.Split(bufio.ScanWords)

	S := nextInt()
	W := nextInt()

	if S <= W {
		fmt.Println("unsafe")
	} else {
		fmt.Println("safe")
	}
}


Measured memory_bytes: 1752
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string str;
  
  getline(cin, str);
  
  for(int i = 0; i < str.size(); i++){
    if('a' <= str.at(i) && str.at(i) <= 'z'){
      str.at(i) = str.at(i) - 'a' + 'A';
    }
    else if('A' <= str.at(i) && str.at(i) <= 'Z'){
      str.at(i) = str.at(i) - 'A' + 'a';
    }
  }
  cout << str << endl;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int a, b;
    string s;
    cin >> a >> b >> s;
    bool ans = true;
    for(int i = 0; i < a; i++)if(s[i] == '-')ans = false;
    for(int i = a+1; i < a+b+1; i++)if(s[i] == '-')ans = false;
    if(s[a] != '-')ans = false;
    cout << (ans ? "Yes" : "No");
}  

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define int ll

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

  int N,K;
  cin>>N>>K;
  vector<int>a(N-1),b(N-1);
  for(int i=0;i<N-1;i++)cin>>a[i]>>b[i];
  for(int i=0;i<N-1;i++)a[i]--,b[i]--;

  vector<vector<int>>v(N);
  for(int i=0;i<N-1;i++){
    v[a[i]].push_back(b[i]);
    v[b[i]].push_back(a[i]);
  }
  vector<bool>used(N,false);

  queue<int>q;
  int ans=K;
  used[0]=true;
  for(int i=0;i<v[0].size();i++){
    if(K-1-i<1){
      cout<<0<<endl;
      return 0;
    }
    ans=((ans%MOD)*max((K-1)-i,1ll))%MOD;
    used[v[0][i]]=true;
    q.push(v[0][i]);
  }
  while(q.size()>0){
    int x=q.front();
    q.pop();
    used[x]=true;
    int a=0;
    for(int i=0;i<v[x].size();i++){
      if(used[v[x][i]])continue;
      if(K-2-a<1){
        cout<<0<<endl;
        return 0;
      }
      ans=((ans%MOD)*max((K-2)-a,1ll))%MOD;
      q.push(v[x][i]);
      a++;
    }
  }
  cout<<ans%MOD<<endl;
  return 0;
}


Measured memory_bytes: 8948
n, k = map(int, input().split())
arr = list(map(int, input().split()))
i = k
j = 0
nxt = 0
pre = sum(arr[:k])
while i < len(arr):
    nxt = (pre + arr[i]) - arr[j]
    if nxt > pre:
        print('Yes')
    else:
        print('No')
    j += 1
    i += 1
    pre = nxt

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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 2005;
const int   mod = 1e9 + 7;

void add(int &a,int b)  {
    a += b;
    if (a >= mod)
        a -= mod;
}
void sub(int &a,int b)  {
    a -= b;
    if (a <  0)
        a += mod;
}
int mul(int a,int b)    {
    return  1ll * a * b % mod;
}
int Pow(int a,int b)    {
    int ans = 1;
    while (b)   {
        if(b & 1)   ans = mul(ans,a);
        a = mul(a,a);   b >>= 1;
    }
    return  ans;
}

typedef pair<int,int>   ii;

int f[N];
int g[N];

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

    int n;  cin >> n;
    int k;  cin >> k;

    f[n] = 1;

    for(int i = 0 ; i < k ; ++i)    {
        int S = 0;

        for(int j = n - 1 ; j >= 0 ; --j)   {
            add(S,f[j + 1]);
            g[j] = S;

            if (j && j < n - i)
                add(g[j],f[j]);
        }
        for(int j = 0 ; j <= n ; ++j)
            f[j] = g[j];
    }
    cout << mul(f[0],Pow(2,max(0,n - k - 1))) << endl;
}

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

int main(){
    int x,y,ans=0;
    cin>>x>>y;
    if (x==1 && y==1) ans+=400000;
    if (x==1) ans+=300000;
    if (x==2) ans+=200000;
    if (x==3) ans+=100000;
    if (y==1) ans+=300000;
    if (y==2) ans+=200000;
    if (y==3) ans+=100000;
    cout<<ans;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b,c,d;
inline void cmp(ll x,ll y){
    if(x>y)printf("Left\n");
    else if(x<y)printf("Right\n");
    else printf("Balanced\n");
    return;
}
int main(){
    scanf("%lld%lld",&a,&b);
    scanf("%lld%lld",&c,&d);
    a-=c;
    b-=d;
    cmp(a+b,0);
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  vector<vector<int>> vec(2, vector<int>(N));
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < N; j++) {
      cin >> vec.at(i).at(j);
    }
  }

  vector<int> A(N),B(N);
  for (int i = 0; i < N; i++) {
    if(i==0){
      A.at(i)=vec.at(0).at(i);
      B.at(N-1-i)=vec.at(1).at(N-1-i);
    }
    else{
      A.at(i)=A.at(i-1)+vec.at(0).at(i);
      B.at(N-1-i)=B.at(N-i)+vec.at(1).at(N-1-i);
    }
  }

  int count=0;
  for (int i = 0; i < N; i++) {
    count=max(count,A.at(i)+B.at(i));
  }

  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
//LIFE IS NOT A PROBLEM TO BE SOLVED
 
#define rep(i,a,b) for( int i = (int) a; i < (int) b; i++ )
#define F first
#define S second
#define pb push_back
#define debug(a) cout << #a << " = " << a << endl;
#define debug2(a,b) cout << #a << " = " << a << " --- " << #b << " = " << b << endl;
#define debugP(a) cout << a.F << " " << a.S << endl;
#define debugV(v, n) { rep( i, 0, n ) { if(i) printf(" "); printf("%d", v[i]); } printf("\n"); }
#define debugM(mat,n,m) rep( i, 0, n ){ rep( j, 0, m ) { if(j) printf(" "); printf("%d", mat[i][j]); } printf("\n"); }
 
using namespace std;
 
typedef long long int ll;
typedef pair<int,int> ii;
 
 
int N;
ll K;
ll A[200020], F[200020];

int main(){
	
	scanf("%d %lld", &N, &K);
	rep(i, 0, N) scanf("%lld", &A[i]);
	rep(i, 0, N) scanf("%lld", &F[i]);
	
	sort(A, A+N);
	sort(F, F+N);
	reverse(F, F+N);
	
	ll ini = 0, fim = 1e12+2, mid, ans = 1LL << 62;
	while(ini<=fim){
		mid = (ini+fim)/2;
		ll rm = 0, yep = 1;
		rep(i, 0, N){
			ll v = A[i]*F[i];
			if(v<=mid) continue;
			//(A[i]-x)*F[i] <= mid;
			//x >= A[i] - mid/F[i];
			ll x = A[i] - mid/F[i];
			if(rm + x > K){
				yep = 0;
				break;
			}
			rm += x;
		}
		
		if(yep){
			ans = mid;
			fim = mid-1;
		}else{
			ini = mid+1;
		}
	}
	
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>

using namespace std;

const long long p = 1e9 + 7;

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

    int a;
    bool s[n+1];
    for(int i = 0; i < n+1; i++){
        s[i] = true;
    }
    for(int i = 0; i < m; i++){
        cin >> a;
        s[a] = false;

    }



    long long ans[n+1];
    for(int i = 0; i < n+1; i++){
        ans[i] = 0;
    }
    ans[0] = 1;
    
    for(int i = 0; i < n; i++){
        for(int j = i+1; j <= min(n, i + 2); j++){
            if(s[j]){
                ans[j] += ans[i];
                ans[j] %= p;
            }
        }
    }

    cout << ans[n] << endl;

    return 0;
}

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

int main(){
    int x,y,z=100000000;
    cin >> x >> y;
    int a;
    if(y>x){
        a=x;
        x=y;
        y=a;
    }
    if(x/y==0)x=y;
    while(z!=0){
        z=x%y;
        x=y;
        y=z;
    }
    cout << x << endl;
}


Measured memory_bytes: 3092
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/

	coding: utf-8
	lang: C (GCC 5.4.1)
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

int main(int argc, char const *argv[])
{
	int n;
	int i,p = 0;
	char s[103],t[103];
	bool f;

	scanf("%d %s %s", &n, s, t);
	for(i = 0; i < n; ++i){
		f = true;
		for(int j = 0; i + j < n; ++j){
			if(s[i + j] != t[j]){
				f = false;
				break;
			}
		}
		if(f)	break;
	}
	printf("%d\n", n + i);
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> v(n), c(n);
  for (auto&& e : v) cin >> e;
  for (auto&& e : c) cin >> e;
  int ans(0);
  for (int i = 0; i < n; i++) {
    if (v[i] - c[i] > 0) ans += v[i] - c[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAXN 5005
#define INF 1000000000
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,MOD,dp[MAXN][MAXN];
void add(int &a,int b) {a+=b; if(a>=MOD) a-=MOD;}
void dec(int &a,int b) {a-=b; if(a<0) a+=MOD;}
int main()
{
    scanf("%d%d",&n,&MOD);
    dp[1][0]=1;
    for(int i=2;i<=n;i++)
    {
        int mult=(i<=n/2+1?i-2:n+1-i)+1;
        for(int j=0;j<=n;j++)
        {
            dp[i][j]=dp[i-1][j];
            if(j>=mult) add(dp[i][j],dp[i][j-mult]);
        }
    }
    int ans=0;
    for(int j=0;j<=n;j++) add(ans,1LL*dp[n][j]*(n-j)%MOD);
    printf("%d\n",ans);
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    int A[N], B[N];
    for(int i = 0; i < N; i++) {
        B[i+1] = 0;
    }
    for(int i = 2; i <= N; i++) {
        cin >> A[i];
        B[A[i]]++;
    }
    for(int i = 1; i <= N; i++) {
        cout << B[i] << endl;
    }
}


Measured memory_bytes: 5148
n, x, y = map(int, input().split())
ans = [0] * n
a = [n] * n
x -= 1
y -= 1
for i in range(0, n):
    a = [n] * n
    a[i] = 0
    b = [i, x, y, x, y]
    for k in b:
        for j in range(k, 0, -1):
            if j == x:
                a[y] = min(a[y], a[j] + 1)
            if j == y:
                a[x] = min(a[x], a[j] + 1)
            a[j - 1] = min(a[j - 1], a[j] + 1)
        for j in range(k, n - 1):
            if j == x:
                a[y] = min(a[y], a[j] + 1)
            if j == y:
                a[x] = min(a[x], a[j] + 1)
            a[j + 1] = min(a[j + 1], a[j] + 1)
    for k in range(0, n):
        ans[a[k]] += 1
for i in range(1, n):
    print(ans[i] // 2)


Measured memory_bytes: 52572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
//const int Nmax=200010;
 
int main() {
	int N,D,X,A[100],cnt=0;
	cin >> N >> D >> X;
	for(int i=0;i < N;i++){
		cin >> A[i];
		cnt += (D-1)/A[i]+1;
	}
	cout << cnt + X << endl;
	
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc144d()
}

fun abc144d() {
    val (a, b, x) = readLine()!!.split(" ").map { it.toDouble() }

    val answer = if (a * a * b / 2 <= x) {
        // 水の体積が水筒の半分以上のパターン
        val c = (b - (x / a) / a) * 2
        Math.toDegrees(Math.atan(c / a))
    } else {
        // 水の体積が水筒の半分より小さいパターン
        val d = x / (a * b / 2)
        Math.toDegrees(Math.atan(b / d))
    }

    println(answer)
}


Measured memory_bytes: 37936
n = int(raw_input())
arr = map(int, raw_input().split())
freq = [0]*(10**5)
for a in arr:
    freq[a] += 1
count = 0
for i in range(10**5):
    if i == 0:
        count = freq[i] + freq[i+1]
    elif i == 10**5-1:
        count = max(count, freq[i] + freq[i-1])
    else:
        count = max(count, freq[i-1]+freq[i]+freq[i+1])
print count

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

using namespace std;

#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
	IOS;
	string s;
	int sum1=0,sum2=0;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i] == '+'){
			sum1 ++;
		}
		else{
			sum2 ++;
		}
	}
	cout<<sum1-sum2<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)


def main(input, print):
    n = int(input())
    ac = 0
    wa = 0
    tle = 0
    re = 0
    for i in range(n):
        s = input().strip()
        if s == 'AC':
            ac += 1
        if s == 'WA':
            wa += 1
        if s == 'TLE':
            tle += 1
        if s == 'RE':
            re += 1
    print('AC x '+str(ac))
    print('WA x '+str(wa))
    print('TLE x '+str(tle))
    print('RE x '+str(re))


if __name__ == '__main__':
    main(sys.stdin.readline, print)


Measured memory_bytes: 73572
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;

#define MAX 110
#define INF (1<<29)
typedef pair<int, int> P;
typedef pair<int, P> P2;

struct edge{
  int to, cost;
};

vector<edge> G[MAX];
int V[MAX][11];
int ticket, n, m, s, d;

int dijkstra(){
  for(int i = 0 ; i < n ; i++)
    for(int j = 0 ; j < 11 ; j++) V[i][j] = INF;
  
  priority_queue<P2, vector<P2>, greater<P2> > que;
  
  que.push(P2(0, P(s, 0)));
  V[s][0] = 0;
  
  while(!que.empty()){
    P2 q = que.top(); que.pop();
    int v = q.second.first;
    int cnt = q.second.second;
    if(V[v][cnt] < q.first) continue;
    
    for(int i = 0 ; i < G[v].size() ; i++){
      edge e = G[v][i];
      if(V[e.to][cnt] > V[v][cnt] + e.cost){
	V[e.to][cnt] = V[v][cnt] + e.cost;
	que.push(P2(V[e.to][cnt], P(e.to, cnt)));
      }
      if(cnt >= ticket) continue;
      
      if(V[e.to][cnt+1] > V[v][cnt] + e.cost/2){
	V[e.to][cnt+1] = V[v][cnt] + e.cost/2;
	que.push(P2(V[e.to][cnt+1], P(e.to, cnt+1)));
      }
    }
  }
  int ret = INF;
  for(int i = 0 ; i <= ticket ; i++){
    ret = min(ret, V[d][i]);
  }
  return ret;
}

int main(){
  while(cin >> ticket >> n >> m >> s >> d){
    if(!ticket && !n && !m && !s && !d) break;
    s--, d--;    
    for(int i = 0 ; i < n ; i++) G[i].clear();
    int from, to, cost;
    for(int i = 0 ; i < m ; i++){
      cin >> from >> to >> cost;
      from--, to--;
      edge e;
      //無向グラフ
      e.to = to, e.cost = cost;
      G[from].push_back(e);
      e.to = from; 
      G[to].push_back(e);
    }
    cout << dijkstra() << endl;
  }
  return 0;
}

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

int main(){
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if(x < r || y < r || x + r > W || y + r > H) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 3096
import java.util.Scanner;
public class Main {

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

        int n=scan.nextInt();
        int m=scan.nextInt();
        int path[]=new int[n];
        int a=0,b=0;

        for(int i=0;i<m;i++){
            a=scan.nextInt();
            b=scan.nextInt();
            path[a-1]++;
            path[b-1]++;
        }

        for(int i=0;i<n;i++){
            System.out.println(path[i]);
        }
    }
}

Measured memory_bytes: 22728
#include<bits/stdc++.h>
using namespace std;
#define inf 100000000000000000
#define ll long long int
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}

int main(){
	//mahakal();fast;

	ll n , m ;
	cin>>n>>m;
	puts(n==m ? "Yes":"No");

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
#define MAX_N 110
#define MAX_V 100100
const ll INF = 1LL << 60;
int N, W;
int w[MAX_N], v[MAX_N];
ll dp[MAX_N][MAX_V];

int main() {
    cin >> N >> W;
    for (int i = 0; i < N; i++) cin >> w[i] >> v[i];
    for (int i = 0; i < MAX_N; i++) {
        for (int j = 0; j < MAX_V; j++) dp[i][j] = INF;
    }
    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < MAX_V; j++) {
            if (j < v[i]) {
                dp[i + 1][j] = dp[i][j];
            } else {
                dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
            }
        }
    }
    ll ans = 0;
    for (int j = 0; j < MAX_V; j++) {
        if (dp[N][j] <= W) ans = j;
    }
    cout << ans << endl;
}

Measured memory_bytes: 86400
#include<iostream>
using namespace std;
int main()
{
int x,y;
cin >> x >> y;
if(x==1)
x=14;
if(y==1)
y=14;
if(x==y)
cout << "Draw" << endl;
else if(x>y)
cout << "Alice" << endl;
else
cout << "Bob" << endl;
return 0;
}

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

int main(){
  int N;
  string S;
  cin >> N >> S;
  
  for(int i = 0; i < S.size(); i++){
    S.at(i) = (S.at(i) + N - 'A') % 26 + 'A';
  }
  
  cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX
#define eps LDBL_EPSILON
#define moder 100000
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
using namespace std;
int n,m,a[10];
int b[]={INF,2,5,5,4,5,6,3,7,6};
int dp[10010];
signed main() {
	cin>>n>>m;
	rep(i,m)cin>>a[i];
	for(int i=1;i<=n;i++){
		dp[i]=-INF;
		rep(j,m){
			if(i-b[a[j]]>=0)dp[i]=max(dp[i],dp[i-b[a[j]]]+1);
		}
	}
	sort(a,a+m,greater<int>());
	string ans;
	for(int i=n;dp[i];){
		rep(j,m){
			if(i-b[a[j]]>=0&&dp[i]==dp[i-b[a[j]]]+1){
				ans+=a[j]+'0';
				i-=b[a[j]];
				break;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
n, k = map(int, input().split())
a = list(map(int, input().split()))

num = [0] * 200005
kind = 0
for i in a:
    if num[i] == 0:
        kind += 1
    num[i] += 1
num.sort()
ans = 0
for i in range(200005):
    if kind <= k:
        break
    if num[i] == 0:
        continue
    ans += num[i]
    kind -= 1
print(ans)


Measured memory_bytes: 25748
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int main()
{
	int dice[6];
	for(int n=0; n<6; n++)
		cin >> dice[n];

	int mae, ue;
	int k_mae, k_ue;
	int q;
	cin >> q;

	for(int n=0; n<q; n++){
		cin >> ue >> mae;
		for(int num=0; num<6;num++)
		{
			if(dice[num]==ue)
				k_ue = num;
			if(dice[num]==mae)
				k_mae = num;
		}

		if (k_ue==0)
		{
			if(k_mae==1)
				cout << dice[2] << endl;
			if(k_mae==2)
				cout << dice[4] << endl;
			if(k_mae==4)
				cout << dice[3] << endl;
			if(k_mae==3)
				cout << dice[1] << endl;
		}

		if (k_ue==1)
		{	
			if(k_mae==0)
				cout << dice[3] << endl;
			if(k_mae==3)
				cout << dice[5] << endl;
			if(k_mae==5)
				cout << dice[2] << endl;
			if(k_mae==2)
				cout << dice[0] << endl;
		}

		if (k_ue==2)
		{
			if(k_mae==0)
				cout << dice[1] << endl;
			if(k_mae==1)
				cout << dice[5] << endl;
			if(k_mae==5)
				cout << dice[4] << endl;
			if(k_mae==4)
				cout << dice[0] << endl;
		}

		if (k_ue==3)
		{
			if(k_mae==1)
				cout << dice[0] << endl;
			if(k_mae==0)
				cout << dice[4] << endl;
			if(k_mae==4)
				cout << dice[5] << endl;
			if(k_mae==5)
				cout << dice[1] << endl;
		}

		if (k_ue==4)
		{
			if(k_mae==0)
				cout << dice[2] << endl;
			if(k_mae==2)
				cout << dice[5] << endl;
			if(k_mae==5)
				cout << dice[3] << endl;
			if(k_mae==3)
				cout << dice[0] << endl;
		}

		if (k_ue==5)
		{
			if(k_mae==3)
				cout << dice[4] << endl;
			if(k_mae==4)
				cout << dice[2] << endl;
			if(k_mae==2)
				cout << dice[1] << endl;
			if(k_mae==1)
				cout << dice[3] << endl;
		}
	}
}

Measured memory_bytes: 3080