akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long    ll;
typedef pair<ll,ll>  pll;
typedef pair<ll, pair<int, int> > plll;
typedef vector<long long>  vll;
typedef vector<pll>  vp;
typedef long double ld;
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
#define mp           make_pair
// #define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hell         1000000007
// #define h 998244353
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p)
{
  ll res = 1;
  x = x % p;
  while (y > 0)
  { 
    if (y & 1) 
      res = (res*x) % p;
    y = y>>1;
    x = (x*x) % p;
  } 
  return res; 
} 
const int MAXN = 1e5+7;

// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
// #define trace6(a, n,i;b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

// Constants //
 
/*** Template Ends ***/

void solve()
{
 ll n,m;
 cin>>n>>m;
 ll flag=1,i,a,b,j;
 vector<pll> v(m);
 for(i=0;i<m;i++)
 {
  cin>>a>>b;
  v[i] = {a-1,b}; 
 }
 for(i=0;i<1000;i++)
 {
  ll flag=1;
  string s = to_string(i);
  if(s.length()!=n)
    continue;
  // trace(s);.
  for(j=0;j<m;j++)
  {
    // trace3(v[j].F,v[j].S,s[v[j].F]);
    if(s[v[j].F]-'0'!=v[j].S)
    {
      flag=0;
      break;
    }
  }
  if(flag)
  {
    cout<<s;
    return;
  }
 }
 cout<<-1;
 return ;
}
int main()
{ 
  // ios;
  // fxreopen("inputt.txt", "w", stdout);
  ll t;
  // cin >> t;
  t=1;
  while(t--)
    solve();
  return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<double,LL> P;

int N;
LL L;
int main() {
	cout.precision(17);
	scanf("%d%lld",&N,&L);
	double sum=0;
	LL sumv=0;
	deque<P> q;
	for(int i=0;i<N;i++){
		double t;
		LL v;
		scanf("%lf%lld",&t,&v);
		sum+=t*v;
		sumv+=v;
		while(q.size()&&q.back().first>t&&v<L){
			//cerr << t << ", " << v << endl;
			if(q.back().second+v>=L){
				t=(v*t+(L-v)*q.back().first)/L;
				q.back().second-=L-v;
				v=L;
			}
			else{
				auto v2=v+q.back().second;
				t=(v*t+q.back().second*q.back().first)/v2;
				v=v2;
				q.pop_back();
			}
		}
		//cerr << t << ", " << v << endl;
		q.push_back(P(t,v));
		while(sumv>L){
			if(sumv-q.front().second>=L){
				sumv-=q.front().second;
				sum-=q.front().first*q.front().second;
				q.pop_front();
			}
			else{
				LL d=sumv-L;
				sumv-=d;
				sum-=q.front().first*d;
				q.front().second-=d;
			}
		}
		printf("%.9lf\n",sum/L);
	}

	return 0;
}



Measured memory_bytes: 18192
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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 gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

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

int main()
{
    ll n;
    cin >> n;
    map<ll, ll> rensou;
    ll a;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        rensou[a] = i;
    }
    for (auto f : rensou)
    {
        cout << f.second + 1 << " ";
    }
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> a(n), b(n), ans(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    vector<int> na(n+1), nb(n+1);
    rep(i, n) {
        na[a[i]]++;
        nb[b[i]]++;
    }
    rep(i, n) {
        na[i+1] += na[i];
        nb[i+1] += nb[i];
    }
    int diff = 0;
    rep(i, n+1) {
        if (i==0) continue;
        int z = na[i] - nb[i-1];
        chmax(diff, z);
    }
    rep(i, n) {
        ans[i] = b[(i+n-diff)%n];
        if (a[i]==ans[i]) {
            pr("No");
            return 0;
        }
    }
    pr("Yes");
    rep(i, n) cout << ans[i] << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 7168
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	string s; cin >> s;
    if(s == "ABC") {
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	int n;
	cin >> n;
	ll ans = 1;
	bool over = false;
	bool zero = false;
	rep(i,n){
		ll a;
		cin >> a;
		if(a == 0) zero = true;
		// over flow 検出
		if(a > 1e18 / ans){
			over = true;
		} else {
			ans *= a;
		}
	}
	if(zero) cout << 0 << endl;
	else if(over || ans > 1000000000000000000){
		cout << -1 << endl;
	} else {
		cout << ans << endl;
	}
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a , b , c;
  cin >> a >> b >> c;
  int sum = a + b + c;
 
    int result = 0;
    while (result >= 0) {
        if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1)
            break;
        else if (a == b && b == c) {
            result = -1;
            break;
        }
        a = (sum - a) / 2;
        b = (sum - b) / 2;
        c = (sum - c) / 2;
        result++;
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
peak = int(1e18)
A, B, C, D = 0, 0, 0, 0
memo = {}
def PtW(n):
    if n == 0:
        return 0
    if n == 1:
        return D
    if n in memo:
        return memo[n]
    m = peak
    if n * D < peak:
        m = n * D
    u2, d2 = n // 2 + (n % 2 != 0), n // 2
    u3, d3 = n // 3 + (n % 3 != 0), n // 3
    u5, d5 = n // 5 + (n % 5 != 0), n // 5
    m = min(m, abs(u2*2-n)*D+A+PtW(u2))
    m = min(m, abs(d2*2-n)*D+A+PtW(d2))
    m = min(m, abs(u3*3-n)*D+B+PtW(u3))
    m = min(m, abs(d3*3-n)*D+B+PtW(d3))
    m = min(m, abs(u5*5-n)*D+C+PtW(u5))
    m = min(m, abs(d5*5-n)*D+C+PtW(d5))
    memo[n] = m
    return m
T = int(input())
for _ in range(T):
    N, A, B, C, D = map(int, input().split())
    memo = {}
    print(PtW(N))

Measured memory_bytes: 10888
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll ans = 0;
    ll mx = a[0];
    repSE (i,1,n) {
        if (a[i] < mx) ans += (mx - a[i]);
        else {
            mx = a[i];
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 4776
use proconio::input;
use std::collections::{HashMap, BTreeMap};
use std::fmt::Write;

fn main() {
    input! {
        _n: usize,
        m: usize,
        py: [(usize, usize); m],
    }

    let mut nums = vec![None; m];

    let mut prefectures = HashMap::new();
    
    for (i, (p, y)) in py.into_iter().enumerate() {
        prefectures.entry(p).or_insert_with(|| BTreeMap::new()).insert(y, i);
    }

    for (prefecture, cities) in prefectures {
        for (i, (_year, order)) in cities.into_iter().enumerate() {
            nums[order] = Some(format!("{:06}{:06}", prefecture, i+1));
        }
    }

    let mut ans = String::new();
    for num in nums {
        if let Some(num) = num {
            writeln!(ans, "{}", num).unwrap();
        } else {
            unreachable!();
        }
    }
    print!("{}", ans);
}


Measured memory_bytes: 31860
/** source code by coolreshab **/

#include<bits/stdc++.h>
using namespace std;

#define MAX 100000
#define MAX1 100000
#define inf 1000000000
#define mod 1000000007
#define ll long long

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

    //begin
    int n,k,x;
    cin>>n>>k;
    if(n&1)
    {
        x=n/2;
        x++;
    }
    else
        x=n/2;
    if(x>=k)
        cout<<"YES";
    else
        cout<<"NO";
    //end

    return 0;
}


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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;

    int res = 0;
    int p1, p2, p3;
    cin >> p1 >> p2;

    for(int i = 0; i < n-2; ++i){
        cin >> p3;
        if ((p1-p2) * (p3-p2) < 0) res++;
        p1 = p2;
        p2 = p3;
    }

    
    cout << res << endl;
}

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

int main() {
  int N;

  cin >> N;

  int result = 0;
  for (int i = 0; i < N; i++) {
    int l, r;

    cin >> l >> r;

    result += r - l + 1;
  }

  cout << result << endl;
}


Measured memory_bytes: 3640
d=int(input())
c=list(map(int, input().split()))
s=[]
last=[0]*26
for i in range(d):
  s.append(list(map(int, input().split())))
for day in range(1,d+1):
  man=[]
  for i in range(26):
    man.append(s[day-1][i]+last[i]*c[i])
  con=man.index(max(man))
  last[con]=day
  print(con+1)

Measured memory_bytes: 9416
def ncr(n, r):
    return fact[n] * inv_fact[r] * inv_fact[n - r] % div


def find_duplicated(aa):
    appeared = [-1] * (n + 1)
    for i, a in enumerate(aa):
        if appeared[a] >= 0:
            return appeared[a], i
        appeared[a] = i


div = int(1e9 + 7)
n = int(input())
aa = list(map(int, input().split()))

fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, n + 2):
    fact_tmp *= i
    fact_tmp %= div
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, div - 2, div))

i1, i2 = find_duplicated(aa)
outside_n = n + 1 - (i2 - i1 + 1)

for part_n in range(1, n + 2):
    sub = ncr(outside_n, part_n - 1) if outside_n >= part_n - 1 else 0
    print((ncr(n + 1, part_n) - sub) % div)


Measured memory_bytes: 19248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
ll power(ll x, ll n, ll mod)
{
  ll res = 1;
  x %= mod;
  while (n)
  {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res%mod;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin>>n;
  if(n==1)
    cout<<"0\n";
  else
  {
    ll ans=power(10,n,MOD)%MOD;
    ll p8=power(8,n,MOD)%MOD;
    ll p9=(2%MOD*power(9,n,MOD)%MOD)%MOD;
    ans=ans-(p9-p8);
    if(ans<0)
      ans=ans+MOD;
    cout<<ans%MOD<<'\n';
  }
  return 0;
}

Measured memory_bytes: 3648
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static int[][] map;
    static int[][] label;


    static ArrayList<String> list;

    static int M;
    static int N;
    static int T;
    static int P;

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

        String s1 = scanner.next();
        String s2 = scanner.next();
        String s3 = scanner.next();

        String s = String.valueOf(s1.charAt(0)) + String.valueOf(s2.charAt(0)) + String.valueOf(s3.charAt(0));
//        + s2.charAt(0) + s3.charAt(0);
        System.out.println(s.toUpperCase());


    }



}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef pair <double,double> dd;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define inf=1000000000
ll ipow(ll base, ll exp)
{
    ll result = 1;
    for (;;)
    {
        if (exp & 1)
            result *= base;
        exp >>= 1;
        if (!exp)
            break;
        base *= base;
    }

    return result;
}
ll p(ll d){
    ull s=1;
    ll cnt{0};
    while(d>s)s=ipow(2,cnt);
    return s-d;

}
vector<vector<int>> a,ans;
void dp(int AJ){
    if(ans[AJ][0]>=0)return ;
    int ma{-10000};

    if(ma>=0)return ;
    dp(AJ-1);
    ans[AJ][0]=max(ans[AJ-1][1],ans[AJ-1][2])+a[AJ][0];
    ans[AJ][1]=max(ans[AJ-1][0],ans[AJ-1][2])+a[AJ][1];
    ans[AJ][2]=max(ans[AJ-1][1],ans[AJ-1][0])+a[AJ][2];
        for(int i=0;i<3;i++)
        if(ans[AJ][i]>ma)
            ma=ans[AJ][i];

}
int main(){
    int n;
    cin>>n;

    vector<int> cop(3,0);
    for(int i=0;i<n;i++)
    {
        cin>>cop[0]>>cop[1]>>cop[2];
        a.push_back(cop);
        vector<int> co(3,-10);
        ans.push_back(co);
    }
    for(int i=0;i<3;i++)
        ans[0][i]=a[0][i];
    dp(n-1);
//    for(int i=0;i<n;i++)
//    {
//        for(int j=0;j<3;j++)cout<<ans[i][j]<<" ";
//        cout<<endl;
//    }
    cout<<max(ans[n-1][0],max(ans[n-1][1],ans[n-1][2]));

return 0;
}


Measured memory_bytes: 13280
#include <stdio.h>

/* 1 チームの記録 */
typedef struct team {
	int no;
    int time;
	int score;
} Team;

/* チームの記録を入れ換える */
void swap(Team *a, Team *b){
	Team c;
	c = *b;
	*b = *a;
	*a = c;
}

/* チームの順位を判定する (sort で使用, 入れ換えるか否かを返す) */
int compare(Team a, Team b){
	if (a.score < b.score){
		return 1;
	}else if (a.score > b.score){
		return 0;
	}

	if (a.time > b.time){
		return 1;
	}else if (a.time < b.time){
		return 0;
	}

	if (a.no < b.no){
		return 1;
	}
	return 0;
}

/* チームの順位を判定し並び替える */
void sort(Team *t, int length){
	int i, j;
	for (i = 0; i < length - 1; i++){
		for (j = 0; j < length - 1 - i; j++){
			if (compare(t[j], t[j+1])){
				swap(&t[j], &t[j+1]);
			}
		}
	}
}

int main(void){
	int M, T, P, R;
	int m, t, p, j;
	Team teams[50];
	int penalty_num[50][10];
	int i, k;

	while (scanf("%d %d %d %d", &M, &T, &P, &R) == 4){
		if (M == 0 && T == 0 && P == 0 && R == 0){
			break;
		}

		/* 初期化 */
		for (i = 0; i < T; i++){
			teams[i].no = i + 1;
			teams[i].time = 0;
			teams[i].score = 0;
			for (k = 0; k < P; k++){
				penalty_num[i][k] = 0;
			}
		}

		/* 解答提出ログを読み込む */
		for (i = 0; i < R; i++){
			scanf("%d %d %d %d", &m, &t, &p, &j);
			t--;
			p--;
			if (j != 0){
				/* 不正解 */
				penalty_num[t][p]++;  /* 誤答回数を記録する */
				continue;
			}

			/* 正解 */
			/* 誤答回数 * 20 分をペナルティとして加算する */
			teams[t].time += m + penalty_num[t][p] * 20;
			teams[t].score++;
		}

		/* 順位の高い順に並び替える */
		sort(teams, T);

		/* 順位の高い順に出力する */
		for (i = 0; i < T; i++){
			printf("%d", teams[i].no);
			/* 区切り文字 */
			if (i < T - 1){
				if (teams[i].score == teams[i+1].score && teams[i].time == teams[i+1].time){
					printf("=");  /* 同順位 */
				}else{
					printf(",");
				}
			}
		}
		printf("\n");
	}

    return 0;
}

Measured memory_bytes: 608
// 6/28 リアルタイム参加
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int c[26];
int s[365][26];

int main() {
    int D;
    cin >> D;
    
    // 入力
    // vector<int> c(26);
    rep(i, 26) cin >> c[i];
    // vector<vector<int>> s(D, vector<int>(26));
    rep(i, D) rep(j, 26) cin >> s[i][j];
    
    // 出力
    vector<int> t(D);
    rep(i, D) {
        cin >> t[i];
        t[i]--;
    }

    // i番目のコンテストを最後に開催した日
    vector<int> last(26, -1);

    // スコア
    ll score = 0;

    // cout << "here?" << endl;

    // スコア計算
    for (int d = 0; d < D; d++) {
        // t[d]のコンテストが開催される
        int id = t[d];
        last[id] = d;

        // 満足度アップ
        score += s[d][id];  // 日にち・コンテスト

        // 満足度ダウン
        rep(i, 26) {
            score -= c[i] * (d - last[i]);
        }

        cout << score << endl;
    }

}

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

#pragma region  // {{{

#define all(x) std::begin(x), std::end(x)
#define rall(x) std::rbegin(x), std::rend(x)
#define rep(i, begin, end) for (int64_t i{begin}, i##_end{end}; i < i##_end; ++i)
#define repc(i, begin, last) for (int64_t i{begin}, i##_last{last}; i <= i##_last; ++i)
#define repr(i, begin, last) for (int64_t i{begin}, i##_last{last}; i >= i##_last; --i)
#define let const auto
using i64 = std::int64_t;
using u64 = std::uint64_t;

constexpr int32_t INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

void ioSetup() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(11);
    std::cerr << std::fixed << std::setprecision(11);
    std::clog << std::fixed << std::setprecision(11);
}

template <class T>
std::istream& operator,(std::istream& is, T& rhs) {
    return is >> rhs;
}

#define var(type, ...) \
    type __VA_ARGS__;  \
    std::cin >> __VA_ARGS__

inline void println() {
    std::cout << '\n';
}
template <class Head, class... Tail>
inline void println(Head&& head, Tail&&... tail) {
    std::cout << head << " " + (!sizeof...(tail));
    println(std::forward<Tail>(tail)...);
}

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

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

#pragma endregion  // }}}

// constexpr int MOD = int(1e9) + 7;
// constexpr int MOD = 998244353;

signed main() {
    ioSetup();

    var(int, N);
    int ans = 0;
    repc(i, 1, N) {
        var(int, a);
        if (a % 2 == 1 && i % 2 == 1) ++ans;
    }

    println(ans);

    return 0;
}


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

int main(){
  int n;
  string s1, s2;
  int a = 0, b = 0;
  cin >> n;

  for ( int i = 0; i < n; i++ ){
    cin >> s1 >> s2;
    if ( s1 > s2 ) a += 3;
    else if ( s1 < s2) b += 3;
    else {
      a++; b++;
    }
  }

cout << a << " " << b << endl;

return 0;

}

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

int main(){
    long long int n,r=0,g=0,b=0,ans=0;
    string s;
    cin>>n>>s;
   for(int i=0; i<n; i++){
       if(s[i]=='R'){
           r++;
       }
       else if(s[i]=='G'){
           g++;
       }
       else{
           b++;
           }
           
       
   } 
   ans=r*g*b;
   for(int i=0;i<n;i++){
       for(int j=1;i+2*j<n;j++){
           if(s[i]!=s[i+j]&&s[i+2*j]!=s[i]&&s[i+2*j]!=s[i+j]){
               ans=ans-1;
           }
       }
   }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3584
#include <stdio.h>




int main(void){
    int NUM[3000];
    int n,m,i;
    int a = 0;

    scanf("%d",&n);


    //スキャン
    for(i = 0; i<n; i=i+1){
        scanf("%d",&NUM[i]);
        a = a + NUM[i];
    }

    a = a-n;



printf("%d",a);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    string s; cin>>s;
    ll cnt=0;
    rep(i,4) cnt+=s[i]=='2';
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3576
/* ＵＴＦ－８ */
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

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

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	double R;
	std::cin >> R;
	
	std::cout << (R * 3.141592 * 2) << "\n";
}


Measured memory_bytes: 3828
#include <iostream>
#include <vector>
using namespace std;
int main() {
  long long int N, M, count = 0;
  cin >> N >> M;
  if (N > 1 && M > 1) {
    count = (N - 2) * (M - 2);
  }
  if (M == 1 && N == 1) {
    cout << 1;
    return 0;
  }
  if (N == 1)
    count = M - 2;
  if (M == 1)
    count = N - 2;
  cout << count;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    ll a,b,c; cin >> a >> b >> c;
    if (c-a-b > 0){
        if ( 4*a*b < (c - a - b)*(c-a-b)) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    else cout << "No" << endl;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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



int main(void) {

	string s;
	bool flag = false;


	cin >> s;


	if (s[0] == 'k') {
		if (s[1] == 'e') {
			if (s[2] == 'y') {
				if (s[3] == 'e') {
					if (s[4] == 'n') {
						if (s[5] == 'c') {
							if (s[6] == 'e') {
								flag = true;
							}
							if (s.rfind("e") == s.size() - 1) {
								flag = true;
							}
						}
						else {
							if (s.rfind("ce") == s.size() - 2) {
								flag = true;
							}
						}
					}
					else {
						if (s.rfind("nce") == s.size() - 3) {
							flag = true;
						}
					}
				}
				else {
					if (s.rfind("ence") == s.size() - 4) {
						flag = true;
					}
				}
			}
			else {
				if (s.rfind("yence") == s.size() - 5) {
					flag = true;
				}
			}
		}
		else {
			if (s.rfind("eyence") == s.size() - 6) {
				flag = true;
			}
		}
	}
	else {
		if (s.rfind("keyence") == s.size() - 7) {
			cout << s.rfind("keyence") << endl;
			flag = true;
		}
	}


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


	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    ll n,x,m;
    cin>>n>>x>>m;
    vector<ll> res(m,-1);//余りrが出た最小のインデックスを持つ
    res[x]=0;
    int ind=1;
    vector<ll> sum;
    sum.emplace_back(x);
    ll ans=0;
    ll ps=-1,len=-1;
    int ofs=0;
    while(ind<n) {
        x=x*x;
        x%=m;
        sum.emplace_back(sum.back()+x);
//assert(sum.size()-1==ind);
        if(res[x]==-1)res[x]=ind;
        else {
            if(res[x]!=0) {
                ans+=sum[res[x]-1];
                ofs=res[x];

                len=ind-res[x];
                ps=sum[ind-1]-sum[res[x]-1];
                ans+=ps*((n-ofs)/len);
                int rem=(n-ofs)%len;
                ans+=sum[res[x]+rem-1]-sum[res[x]-1];
            }
            else {
                len=ind;
                ps=sum[ind-1];
                ans+=ps*(n/len);
                int rem=n%len;
                if(rem!=0)ans+=sum[rem-1];
            }
            break;
        }
        ++ind;
    }
    if(ind==n)cout<<sum[n-1]<<endl;
    else cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4700
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,K;
	string s;
	while(cin>>N>>K>>s) {
		ll ans = 0;
		REP(i, N-1) {
			if(s[i]==s[i+1]) ans++;
		}
		ans = min(N-1, ans+2*K);
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){
    string S;
    cin>>S;
    
    int n=0;
    for(int i=0;i<S.size();i++){
        if(S[i]=='7')
            n++;
    }
    if(n==0)
        cout<<"No";
    else
        cout<<"Yes";
}


Measured memory_bytes: 3628
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new A().doIt();
		new B().doIt();
//		new C().doIt();
//		new D().doIt();
	}
	class A{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt();
			int X = sc.nextInt();
			int Y = sc.nextInt();
			
			int ans = 0;
			if(N <= K)ans = X*N;
			else ans = X*K + Y*(N - K);
			System.out.println(ans);
		}
	}
	class B{
		void doIt() {
			String str = sc.next();
			char ctr[] = str.toCharArray();
			int alf[] = new int [256];
			for(int i = 0;i < str.length();i++) {
				alf[ctr[i]]++;
			}
			System.out.println(check(alf));
		}
		String check(int alf[]) {
			for(char c = 'a';c <= 'z';c++) {
				if(alf[c] % 2 == 1)return "No";
			}
			return "Yes";
		}
	}
	class C{
		
	}
	class D{
		
	}
}


Measured memory_bytes: 21460
n = int(input())

reds = [tuple(map(int, input().split())) for _ in range(n)]
blues = [tuple(map(int, input().split())) for _ in range(n)]

blues.sort(key=lambda x:x[0])
reds.sort(key=lambda x:x[1])

count = 0
for b in blues:
    bx, by = b
    for r in reds[::-1]:
        rx, ry = r
        if bx > rx and by > ry:
            count += 1
            reds.remove(r)
            break

print(count)


Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	ll m, a[100001], s[100001];
	s[0]=0;
	cin>>n>>m;
	for(int i=1; i<=n; i++){
		cin>>a[i];
		s[i]=s[i-1]+a[i];
		s[i]%=m;
	}
	sort(s, s+n+1);
	ll ans=0;
	ll p=0;
	ll c=0;
	for(int i=0; i<=n; i++){
		if(p!=s[i]){
			p=s[i];
			ans+=(c*(c-1)/2);
			c=1;
		}else{
			c++;
		}
	}
	ans+=(c*(c-1)/2);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
// https://atcoder.jp/contests/abc072/tasks/abc072_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i += 2) {
        cout << s[i];
    }
    cout << "\n";
    return 0;
}


Measured memory_bytes: 592
#include <iostream>
using namespace std;
int main(void){
  int N, M, X;
  cin >> N >> M >> X;
  int A[M];
  for(int i = 0; i < M ; i++){
    cin >> A[i];
  }
  int l = 0, r;
  int i = 0;
  while(A[i] < X){l++; i++;}
  r = M - l;
  if(l<r){cout<<l<<endl;}else{cout<<r<<endl;}
  return 0;
}

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

int N;

int main()
{
    cin>> N;
    int t=N,sum=0;
    while (t>0){
        sum+= t%10;
        t/= 10;
    }
    if (N%sum) cout<< "No"<< endl;
    else cout<< "Yes"<< endl;

    return 0;
}

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

using namespace std;

int main() {
  int h, w;
  cin >> h >> w;
  for (int i = 0; i < w + 2; i++) cout << "#"; cout << endl;
  for (int i = 0; i < h; i++) {
    string s;
    cin >> s;
    cout << "#" << s << "#" << endl;
  }
  for (int i = 0; i < w + 2; i++) cout << "#"; cout << endl;
  return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())

DP = [[10**5 for _ in range(n)] for _ in range(n)]
for i in range(n):
    DP[i][i] = 0

Edge = []
for _ in range(m):
    a, b, c = map(int, input().split())
    DP[a-1][b-1] = c
    DP[b-1][a-1] = c
    Edge.append((a,b,c))

for k in range(n):
    for i in range(n):
        for j in range(n):
            DP[i][j] = min(DP[i][j], DP[i][k] + DP[k][j])

Edge_check = [0 for _ in range(len(Edge))]
for e in range(len(Edge)):
    for s in range(n):
        for t in range(n):
            if s == t:
                continue
            i = Edge[e][0] -1
            j = Edge[e][1] -1
            cost = Edge[e][2]
            if DP[s][i] + cost + DP[j][t] == DP[s][t]:
                Edge_check[e] = 1

ans = len(Edge_check) - sum(Edge_check)
print(ans)



Measured memory_bytes: 43996
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	
	int n;
	cin>>n;
	int a[n];
	a[0]=0;
	int b[n]={0};
	for(int i=1; i<n; i++) {
		cin>>a[i];
		b[a[i]-1]++;
	}
	for(int i=0; i<n; i++) {
		cout<<b[i]<<endl;
	}
	
	
    return 0;
}

Measured memory_bytes: 5228
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')

s = I()
vs = set()
vs.add(s)
now = 0 + s
i = 1
while True:
    i += 1
    now = now / 2 if now % 2 == 0 else 3*now + 1
    if now in vs:
        break
    else:
        vs.add(now)

print(i)


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

#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pf push_front
#define pb2 pop_back
#define pf2 pop_front
#define line printf("\n")
#define pq priority_queue
#define rep(k,i,j) for(int k = (int)i;k<(int)j;k++)
#define repd(k,i,j) for(int k = (int)i;k>=(int)j;k--)
#define ll long long
#define ALL(a) a.begin(),a.end()
#define vi vector<int>

using namespace std;

double EPS = 1e-9;
int INF = 1e9+7;;
long long INFLL = 1e17;
double pi = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};

clock_t first_attempt = clock();
inline void cek_time(){
	clock_t cur = clock()- first_attempt;
	cerr<<"TIME : "<<(double) cur/CLOCKS_PER_SEC<<endl;
}
inline void OPEN (string s) {
  freopen ((s + ".in").c_str (), "r", stdin);
  freopen ((s + ".out").c_str (), "w", stdout);
}

//end of template

int n;

int main(){
	scanf("%d",&n);
	
	map<int,int> ada;
	
	vector<int> arr;
	rep(k,0,n){
		int a;
		cin>>a;
		ada[a]++;
		
		if(ada[a]>1)arr.pb(a),ada[a]-=2;
	}
	
	sort(arr.begin(),arr.end());
	
	ll ret = 0;
	if(arr.size()<2)ret = 0;
	else ret = (ll)arr.back()*arr[arr.size()-2];
	
	cout<<ret<<endl;
	
	return 0;
}


Measured memory_bytes: 4992
package main

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

const mod = 1000000007

func solve() {
	_ = getInt()
	s := []rune(getString())

	m := make(map[rune]int, 26)
	for _, r := range s {
		m[r]++
	}

	ans := 0
	for _, r := range s {
		cnt := 1
		for k, v := range m {
			if r == k {
				continue
			}

			cnt = (cnt * (v + 1)) % mod
		}

		m[r]--
		ans = (ans + cnt) % mod
	}

	fmt.Fprintln(wr, ans)
}

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

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	buf := 200001
	sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define maxn 200100
#define inf 1000000007
using namespace std;
struct edge{
	int r,nxt;
}e[maxn*20];
typedef pair<int,int> par;
par A[2][maxn];
int rhead[maxn],low[maxn],n,L[maxn],val[maxn],R[maxn],tp,dfn[maxn];
int bel[maxn],insta[maxn],sta[maxn],tim,idL[maxn],idR[maxn],lc[maxn],rc[maxn],resz,head[maxn],esz,ptr,rt[2];
void addedge(int u,int v){
//	printf("[%d->%d]\n",u,v);
	e[++esz].r=v;e[esz].nxt=head[u];head[u]=esz;
}
void tarjan(int u){
	low[u]=dfn[u]=++tim,sta[++tp]=u,insta[u]=1;
	for(int t=head[u];t;t=e[t].nxt)
		if(!dfn[e[t].r])tarjan(e[t].r),low[u]=min(low[u],low[e[t].r]);
		else if(insta[e[t].r])low[u]=min(low[u],dfn[e[t].r]);
	if(low[u]==dfn[u]){
		int v;
		do{
			v=sta[tp--];
			insta[v]=0;
			bel[v]=u;
		}while(u!=v);
	}
}
int build(int d,int l,int r){
	if(l==r)return A[d][l].second;
	int mid=l+r>>1,rt=++ptr;
	lc[rt]=build(d,l,mid);
	rc[rt]=build(d,mid+1,r);
	addedge(rt,lc[rt]);
	addedge(rt,rc[rt]);
	return rt;
}
void qry(int o,int l,int r,int ql,int qr,int fr){
	if(ql>qr)return ;
	if(ql<=l&&r<=qr){
		addedge(fr,o);
		return ;
	}
	int mid=l+r>>1;
	if(ql<=mid)qry(lc[o],l,mid,ql,qr,fr);
	if(qr>mid)qry(rc[o],mid+1,r,ql,qr,fr);
}
bool chk(int d){
	for(int i=1;i<=ptr;++i)dfn[i]=low[i]=0,head[i]=rhead[i];
	esz=resz,tim=0;
	for(int i=1;i<=n;++i){
		int x=lower_bound(A[0]+1,A[0]+n+1,par(L[i]-d,-inf))-A[0];
		int y=upper_bound(A[0]+1,A[0]+n+1,par(L[i]+d,inf))-A[0]-1;
		if(idL[i]<x||y<idL[i])qry(rt[0],1,n,x,y,i<<1);
		else {	
			if(x<idL[i])qry(rt[0],1,n,x,idL[i]-1,i<<1);
			if(idL[i]<y)qry(rt[0],1,n,idL[i]+1,y,i<<1);
		}
		
		x=lower_bound(A[0]+1,A[0]+n+1,par(R[i]-d,-inf))-A[0];
		y=upper_bound(A[0]+1,A[0]+n+1,par(R[i]+d,inf))-A[0]-1;
		if(idL[i]<x||y<idL[i])qry(rt[0],1,n,x,y,i<<1|1);
		else {	
			if(x<idL[i])qry(rt[0],1,n,x,idL[i]-1,i<<1|1);
			if(idL[i]<y)qry(rt[0],1,n,idL[i]+1,y,i<<1|1);
		}
		
		x=lower_bound(A[1]+1,A[1]+n+1,par(R[i]-d,-inf))-A[1];
		y=upper_bound(A[1]+1,A[1]+n+1,par(R[i]+d,inf))-A[1]-1;
		if(idR[i]<x||y<idR[i])qry(rt[1],1,n,x,y,i<<1|1);
		else {	
			if(x<idR[i])qry(rt[1],1,n,x,idR[i]-1,i<<1|1);
			if(idR[i]<y)qry(rt[1],1,n,idR[i]+1,y,i<<1|1);
		}
		
		x=lower_bound(A[1]+1,A[1]+n+1,par(L[i]-d,-inf))-A[1];
		y=upper_bound(A[1]+1,A[1]+n+1,par(L[i]+d,inf))-A[1]-1;
		if(idR[i]<x||y<idR[i])qry(rt[1],1,n,x,y,i<<1);
		else {	
			if(x<idR[i])qry(rt[1],1,n,x,idR[i]-1,i<<1);
			if(idR[i]<y)qry(rt[1],1,n,idR[i]+1,y,i<<1);
		}
	}
	for(int i=1;i<=ptr;++i)if(!dfn[i])tarjan(i);
	for(int i=1;i<=n;++i)if(bel[i<<1]==bel[i<<1|1])return false;
	return true;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d%d",&L[i],&R[i]);
		if(L[i]>R[i])swap(L[i],R[i]);
		A[0][i]=par(L[i],i<<1|1);
		A[1][i]=par(R[i],i<<1);
		val[i<<1]=L[i],val[i<<1|1]=R[i];
	}
	ptr=2*n+1;
	sort(A[0]+1,A[0]+n+1);
	sort(A[1]+1,A[1]+n+1);
	for(int i=1;i<=n;++i)idL[A[0][i].second>>1]=i;
	for(int i=1;i<=n;++i)idR[A[1][i].second>>1]=i;
	rt[0]=build(0,1,n);
	rt[1]=build(1,1,n);
	for(int i=1;i<=ptr;++i)rhead[i]=head[i];
	resz=esz;
//	printf("[%d]",chk(3));
//	return 0;
	int l=1,r=1000000007,ans=0;
	while(l<=r){
		int mid=l+r>>1;
		if(chk(mid-1))ans=mid,l=mid+1;
		else r=mid-1;
	}
	printf("%d",ans);
}

Measured memory_bytes: 22272
import java.util.Scanner;

public class Main {

 
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            long X = scanner.nextLong();
            long Y = scanner.nextLong();
            double Lim = Math.pow(10, 18);
            boolean find=false;
            if ((X%Y)!=0){
                for (long z=X; z <=Lim; z=z+X){
                    if ((z % Y) != 0){
                        System.out.println(z);
                        find=true;
                        break;
                    }
                }
            }
            if (!find) System.out.println(-1);
        }
}

Measured memory_bytes: 20948