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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(string s;cin>>s;){
		bool res=false;
		for(int i=0;i<=7;i++){
			string t=s.substr(0,i)+s.substr(s.size()-(7-i));
			res|=t=="keyence";
		}
		cout<<(res?"YES":"NO")<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

class Main {
    int n;
    vector<int> a;

public:
    Main() {
        cin >> n;
        a.resize(n);
        REP(i, n) { cin >> a[i]; }
        ll left = *max_element(a.begin(), a.end());
        ll right = 0;
        REP(i, n) {
            if (abs(left - 2 * a[i]) < abs(left - 2 * right)) { right = a[i]; }
        }
        cout << left << " " << right << endl;
    }
};

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

    Main ans;

    return 0;
}


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

// int/long:            -2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:      -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define MOD 1000000007

#define Rep0(i, n)      for (auto i=0; i<n; i++)
#define Rep1(i, n)      for (auto i=1; i<=n; i++)
#define Sort(P) sort(P.begin(), P.end())
#define Rev(P)  reverse(P.begin(), P.end())

int     main() {
        int D, T, S;
        cin >>D >>T >>S;
        if (S*T>=D)
                cout <<"Yes" <<endl;
        else
                cout <<"No" <<endl;
        return 0;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>v(N); rep(i, 0, N) { cin >> v[i]; }
	int ans = INF;
	int sum = accumulate(all(v), 0ll);
	int a = 0;
	rep(i, 0, N - 1) {
		a += v[i];
		chmin(ans, abs(a - (sum - a)));
	}
	cout << ans << endl;

	return 0;
}


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

int main(void){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i, n) cin>>a[i];
    int c=1;
    int ans=0;
    rep(i, n){
        if(a[i]==c){
            c++;
            ans++;
        }
    }

    if(ans==0) cout<<-1<<endl;
    else cout<<n-ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

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

    int H, W, K, sx, sy, tx, ty;
    cin >> H >> W >> K >> sx >> sy >> tx >> ty;
    --sx, --sy, --tx, --ty;
    vector<string> s(H);
    for(int i = 0; i < H; ++i)  cin >> s[i];

    vector<vector<int>> dist(H, vector<int>(W, INF));
    using Data = tuple<int, int, int>;
    priority_queue<Data, vector<Data>, greater<Data>> que;
    dist[sx][sy] = 0;
    que.emplace(0, sx, sy);
    while(!que.empty()){
        int d, x, y;
        tie(d, x, y) = que.top();
        que.pop();
        if(d > dist[x][y])  continue;
        for(int i = 0; i < 4; ++i){
            int nx = x, ny = y;
            for(int j = 0; j < K; ++j){
                nx += dx[i], ny += dy[i];
                if(nx < 0 || nx >= H || ny < 0 || ny >= W)  break;
                if(s[nx][ny] == '@')    break;
                if(d + 1 > dist[nx][ny])    break;
                if(chmin(dist[nx][ny], d + 1))  que.emplace(dist[nx][ny], nx, ny);
            }
        }
    }
    if(dist[tx][ty] == INF) dist[tx][ty] = -1;
    cout << dist[tx][ty] << endl;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#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++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N, X; cin >> N >> X;
    int now = 0;
    int res = 1;
    rep(i, N){
        int l; cin >> l;
        now += l;
        if(now <= X) res++;
    }
    cout << res << endl;
}

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


Measured memory_bytes: 7752
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;

int main(){
  map<char, char> dictionary = {
  {'A', 'T'},
  {'T', 'A'},
  {'C', 'G'},
  {'G', 'C'},
  };

  char c;
  cin >> c;
  cout << dictionary[c] << endl;

}




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

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

int main(int argc, char const* argv[])
{
  string s;
  cin >> s;
  for(int i = 0; i + 1 < s.size(); i++){
    if(s[i] == 'A' && s[i + 1] == 'C'){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int W,H,x,y,r;
	
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	
	if(y <= 0 || x <= 0){
		printf("No\n");
	}
	if(y >= 1 && x >= 1){
		if(H-y < r || W - x < r){
			printf("No\n");
		}
		else {
			printf("Yes\n");
		}
	}
	
	return(0);
}

Measured memory_bytes: 2616
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <fstream>
#define rep(i,a,b) for (long long i = a; i < b; i++)
using namespace std;
long long n;
vector <long long> dp;
long long bf(long long p, long long pp , long long sum, vector <long long>& fec){
    
    if(dp[p]!=-1){
        return dp[p];
    }
    if (pp==n-1){
        //cout << sum  << endl;
        return sum;
    } else if(pp>=n){
        return 1000000000;
    }
    //cout << abs(fec[pp]-fec[p]) << "  " << p << "   " << pp << endl;
    return dp[p]= min(bf(p+1, p, sum + abs(fec[pp]-fec[p]), fec) , bf(p+2, p, sum + abs(fec[pp]-fec[p]), fec));
}

int main(){
    
    cin >> n;
    dp.assign(n,10000000000000);
    
    vector <long long> fector(n);
    rep(i,0,n){
        cin >> fector[i];
    }
    dp[0]=0;
    rep(i,0,n){
        if(i<n-2){
            dp[i+1] = min(dp[i+1], dp[i]+abs(fector[i]-fector[i+1]));
            dp[i+2] = min(dp[i+2], dp[i]+abs(fector[i]-fector[i+2]));
        } else if (i==n-2){
            dp[i+1] = min(dp[i+1], dp[i]+abs(fector[i]-fector[i+1]));
        }
    }
    cout << dp[n-1] << "\n";
    //cout << bf(0, 0, 0, fector) << endl;

}

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

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //string[] str = Console.ReadLine().Split(' ');
            //int n = int.Parse(Console.ReadLine());
            int n = int.Parse(Console.ReadLine());

            double s = (double)n / 3;

            Console.WriteLine(s * s * s);


            //ここまで
        }



    }

}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
typedef long long ll;
using namespace std;
int main() {
    ll s; cin >> s;
    vector<ll> a;
    a.push_back(s);
    ll ans = 2;
    while (true) {
        ll _a;
        ll last = a[a.size() - 1];
        if (last%2 == 0) {
            _a = last/2;
        } else {
            _a = 3*last + 1;
        }
        if (find(a.begin(), a.end(), _a) != a.end()) {
            break;
        }
        a.push_back(_a);
        ans++ ;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,t,ans=0,n,i;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        //printf("%d\n",i);
        c=0;
        int p=i;
        while(p)
        {
            p=p/10;
            c++;
        }
        if(c%2)
        ans++;
    }
    printf("%d",ans);
}

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

int main() {
  int n;
  string s;
  cin >>n>>s;
  vector<int> kazuW(n),kazuE(n);
  for(int i=0;i<n;i++){
    kazuW[i]=0;
    kazuE[i]=0;
  }
  if(s[0]=='W'){
    kazuW[0]=1;
  }else{
    kazuE[0]=1;
  }
  for(int i=1;i<n;i++){
    if(s[i]=='W'){
      kazuW[i]=kazuW[i-1]+1;
      kazuE[i]=kazuE[i-1];
    }else{
      kazuW[i]=kazuW[i-1];
      kazuE[i]=kazuE[i-1]+1;
    }
  }
  int kotae=kazuE[n-1]-kazuE[0];
  for(int i=1;i<n;i++){
    kotae=min(kotae,kazuE[n-1]-kazuE[i]+kazuW[i-1]);
  }
  cout<<kotae<<endl;
  return 0;
}
  

Measured memory_bytes: 3076
#include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
#define ALL(a) a.begin(), a.end()
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
set<int> s;
int main(){
    int n;
    cin >> n;
    vec a(n),b(n);
    rep(i,n){
        cin >> a[i];
        b[i]=a[i];
    }
    sort(ALL(b));
    rep(i,n){
        if(i%2==0){
            s.insert(b[i]);
        }
    }
    int ans=0;
    rep(i,n){
        if(i%2==0){
            if(s.find(a[i])==s.end()){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 7196
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>



using namespace std;


int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int d = min(a, b);
	int cnt = 0;
	for (int i = d; i > 0; i--) {
		if (a % i == 0 && b % i == 0) {
			cnt++;
			if (cnt == c) {
				cout << i << endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1000000;

int main() {
	int A,B,C,D;
	cin >> A >> B >> C >> D;
	int t = C/B;
  	if(C%B==0) t--;
  	int u = A/D;
  	if(A%D==0) u--;
  	if(u>=t) cout << "Yes" <<endl;
  	else cout << "No" << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <math.h> 
#include <iomanip>
#include <string.h>
#include<sstream>
#include <vector>
#include <set>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define PI 3.14159265358979323846264338327950L

#define INF 0x3f3f3f3f
const int N = 2e5 + 5;

 
  
 
int32_t  main() {

	IOS;
  
	int n;

	cin >> n; 

	vector<int> v(1000001);
	vector<int> cnt(n);
	for (int i = 0; i < n; i++) {
		int tmp;
		cin >> tmp;

		v[tmp]++;
		cnt[i] = tmp;
	}
	sort(cnt.begin(), cnt.end());
	vector<int> vis(1000001);
	int ans = 0;
	for (int i = 0; i <n; i++) {

		if (vis[cnt[i]]  ) {
			continue;
		}

		if (v[cnt[i]] == 1 && !vis[cnt[i]] ) {
			ans++;
		
		}

		for (int j = cnt[i]; j <= 1000000; j += cnt[i]) {
			vis[j] = 1;
		}

	}

	cout << ans << endl;
}

Measured memory_bytes: 19928
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

int H,A,i,j,k;

int main()
{
  cin>>H>>A;
  
  i=H/A;
  
  if(H%A!=0)
  {
    i++;
  }
  
  cout << i;
  
}

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

int main()
{
	int n,sum=0;
	cin>>n;
	int arr[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>arr[i];
	}
	for (int i = 0; i < n; ++i)
	{
		while(arr[i]%2==0)
		{
			arr[i]=arr[i]/2;
			sum++;
		}
	}
	cout<<sum;
	return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B;
    cin >> A >> B;
    if(A>=13){
        cout << B<<"\n";
    }else if(A>=6){
        cout << B/2<<"\n";
    }else{
        cout << 0 <<"\n";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define pb push_back
#define bp __builtin_popcount
#define sz size()
#define ff first
#define ss second
#define vll vector<ll>
#define vbool vector<bool>
#define vpll vector<pair<ll,ll>>
#define pll pair<ll,ll>
#define vllv vector<vector<ll>>
#define setpri(x) cout<<setprecision(x)<<fixed;
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){if(n%x==0)return n/x; else return (n/x)+1;}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;
}
ll modinv(ll A,ll M){return pow1(A,M-2,M);}
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
ll factmod(ll n,ll mod){ll s=1; for(ll i=1;i<=n;i++){s*=i;s%=mod;} return s;}
vll fact1tonmod(ll n,ll mod){vll  ans(n+1);ans[0]=ans[1]=1;
    for(ll i=2;i<=n;i++)ans[i]=(ans[i-1]*i)%mod;
    return ans;
}
ll ncrmod(ll n,ll r,ll mod){
    ll ans=((((factmod(n,mod)%mod)*(modinv(factmod(r,mod),mod)%mod))%mod)*(modinv(factmod(n-r,mod),mod)))%mod;
    return ans;
}
ll ncr(ll n,ll r){if(n==1 || r==0)return 1;if(r>n/2)r=n-r;
    ll ans=1;for(ll i=1;i<=r;i++){ans=((ans * n )/i);n--;}return ans;
}
bool isprime(ll n){if(n==1 || (n!=2 && n%2==0))return false; if(n==2)return true; 
        for(ll i=3;i<=sqrt(n);i+=2)if(n%i==0)return false; return true; }
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
    if(a.ff != b.ff)return a.ff < b.ff;
    return a.ss > b.ss;
}
void solve(){
    ll i,j,k,n,l,m,x,y,z,r;
    cin>>n;
    vll a(n+1);
    for(i=0;i<n-1;i++){
    	cin>>x;
    	a[x]++;
    	
    }
    for(i=1;i<=n;i++){
    	cout<<a[i]<<endl;
    }
    
    
}
int main(){
    // FS;
    ll i,j,k,n,m,x,y,z,q;
    q=1;
	// cin>>q;
    while(q--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 4844
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--)
#define Rep(i,a) for(int i = 0; i < a; i++)
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
#define x first
#define y second
#define pb(a) push_back(a)
const int mod = 924844033, N = 2010;
int n, k, f[N][N][4], F[N][N], fac[N], g[N];
int main() {
	scanf("%d%d",&n,&k);

	f[0][0][3] = 1;
	rep(i,1,n / k + 1) rep(j,0,i) Rep(s,4) Rep(s1,4) {
		if ((s & 1) && (s1 & 2)) continue;
		if ((s & 2) && (s1 & 1)) continue;
		(f[i][j + (s1 & 1) + (s1 >> 1 & 1)][s1] += f[i - 1][j][s]) %= mod;
	}

	fac[0] = 1; rep(i,1,n) fac[i] = 1LL * fac[i - 1] * i % mod;

	rep(i,0,n / k + 1) rep(j,0,i) {
		F[i][j] = 0;
		Rep(s,4) (F[i][j] += f[i][j][s]) %= mod;
	}

	g[0] = 1;
	Rep(r,k) {
		int c = (n - 1 - r) / k + 1;
		dep(i,n,0) {
			int s = 0;
			rep(j,0,min(i, c)) if (F[c][j]) 
				s = (s + 1LL * F[c][j] * g[i - j]) % mod;
			g[i] = s;
		}
	}

	int cof = 1, ans = 0;
	rep(i,0,n) {
		ans = (ans + 1LL * cof * fac[n - i] % mod * g[i]) % mod;
		cof = -cof;
	}
	if (ans < 0) ans += mod;
	printf("%d\n",ans);
	return 0;
}

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

#define      ll      long long int

vector<int> v1, v2;
int cnt[27];

int main( )
{
    int i, j, k, x;
    string s, t;
    int n;
    cin >> s >> t;
    int l = (int) s.size();
    for (i = 0; i < l; i++) {
        x = s[i] - 'a';
        cnt[x]++;
    }
    for (i = 0; i < 26; i++) {
        if (cnt[i] != 0) {
            v1.push_back(cnt[i]);
        }
    }
    memset(cnt, 0, sizeof cnt);
    for (i = 0; i < l; i++) {
        x = t[i] - 'a';
        cnt[x]++;
    }
    for (i = 0; i < 26; i++) {
        if (cnt[i] != 0) {
            v2.push_back(cnt[i]);
        }
    }
    if ((int) v1.size() != (int) v2.size()) {
        cout << "No\n";
        return 0;
    }
    sort(v1.begin(), v1.end());
    sort(v2.begin(), v2.end());
    for (i = 0; i < (int) v1.size(); i++) {
        if (v1[i] != v2[i]) {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}



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

int n;
int a[10005];

int main(){
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    int cc = 0;
    
    for(int i = 1; i <= n;){
        int j = 1;
        while(i+j <= n && a[i] == a[i+j])
             j++;
        cc += j/2;
        i += j;
    }
    printf("%d\n", cc);
    return 0;
}

Measured memory_bytes: 256
import numpy as np
N = int(input())
A1 = np.array(list(map(int, input().split())))
A2 = np.array(list(map(int, input().split())))

A = np.zeros([2, N+1], dtype=int)

A[0][:-1] = A1
A[1][1:] = A2

A[0] = A[0][::-1].cumsum()
A[1] = A[1][::-1].cumsum()

tmp = A[1] - A[0]

under = N - tmp.argmax()

print(A1[:under].sum() + A2[under-1:].sum())

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

int n;

bool does(){
    while(n--){
        int ai; cin>>ai;
        if(ai % 2) continue;
        if((ai % 3) && (ai % 5)) return false;
    }
    return true;
}

int main()
{
    cin>>n;
    if(does()) puts("APPROVED");
    else puts("DENIED");
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a,b,c,x,s,z;
    z=0;
    scanf("%d%d%d",&a,&b,&c);
    for(x=a;x<=b;x++){
        s=c/x;
        if(x*s==c){
            z=z+1;
        }
    }
        printf("%d\n",z);
    return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int n,m;
int a[101],sum;
int main(){
	ios::sync_with_stdio(0);
	cin>>n>>m;
	rep(i,n){
		cin>>a[i];
		sum+=a[i];
	}
	sort(a,a+n);
	reverse(a,a+n);
	int s=sum/4/m;
	rep(i,m){
		if(a[i]<s||(a[i]==s&&sum%s)){
			cout<<"No";
			re 0;
		}
	}
	cout<<"Yes";
	re 0;
}

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


using namespace std;

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())


//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	int n, a, b; cin >> n >> a >> b;

	int x = 0;
	int y = 0;
	int z = 0;

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

		if (buf <= a) {
			x++;
		}
		else if (buf >= a + 1 && buf <= b) {
			y++;
		}
		else if (buf >= b + 1) {
			z++;
		}
	}

	int ans = min(x, min(y, z));

	cout << ans << endl;

	return 0;
}

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

#define MAXN (500010)

int n, q;
int d[MAXN], a[MAXN], b[MAXN];

int main(){
	scanf("%d%d", &n, a);
	for(int i = 1; i <= n; ++ i){
		scanf("%d", d + i);
		a[i] = std::min(a[i - 1], std::abs(a[i - 1] - d[i]));
	}
	b[n] = 1;
	for(int i = n - 1; i; -- i){
		if(b[i + 1] <= d[i + 1] / 2){
			b[i] = b[i + 1];
		}
		else{
			b[i] = b[i + 1] + d[i + 1];
		}
	}
	scanf("%d", &q);
	while(q --){
		int i;
		scanf("%d", &i);
		printf(b[i] <= a[i - 1] ? "YES\n" : "NO\n");
	}
	return 0;
}

Measured memory_bytes: 7808
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String sa = scanner.next();
		String sb = scanner.next();
		String sc = scanner.next();
		scanner.close();
		
		int aidx = 0, bidx = 0, cidx = 0;
		char next = 'a';
		char ans = 0;
		while(ans == 0) {
			switch(next) {
			case 'a':
				if(aidx == sa.length()) {
					ans = 'A';
					break;
				}
				next = sa.charAt(aidx);
				aidx++;
				break;
			case 'b':
				if(bidx == sb.length()) {
					ans = 'B';
					break;
				}
				next = sb.charAt(bidx);
				bidx++;
				break;
			case 'c':
				if(cidx == sc.length()) {
					ans = 'C';
					break;
				}
				next = sc.charAt(cidx);
				cidx++;
				break;
			}
		}
		System.out.println(ans);
	}
}


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

int main(){
    string s;
    cin >> s;
    map<char, bool> cnt;
    for(auto& i : s) cnt[i] = 1;
    if(cnt['N'] ^ cnt['S']) return puts("No") & 0;
    if(cnt['W'] ^ cnt['E']) return puts("No") & 0;
    puts("Yes");
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <queue>
#include <climits>
#include<cmath>
#include <sstream>
#include <iomanip>

const int64_t cc = pow( 10, 9 );

int main()
{
    std::string a;
    int64_t b,c,d;
    std::cin>> a;

    b = 0;
    c = 1;
    d = 0;

    while( 1 )
    {
        if( b + c >= a.size() )
        {
            break;
        }
        
        if( a[b] != a[a.size()-c] )
        {
            d += 1;
        }

        b += 1;
        c += 1;
    }

std::cout<< d;
}


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

int main() {
    using vi = vector<int>;
    
    int a1,a2,a3;
    cin >> a1 >> a2 >> a3;
    if(a1+a2+a3>=22) {
        cout << "bust" << endl;
    }else{
        cout << "win" << endl;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    for(ll i = m/n; i >= 1; --i){
        ll rest = m - i * n;
        if(rest < 0) continue;
        if(rest%i == 0){
            cout << i << endl;
            return 0;
        }
    }
    cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 3660
#include<cstdio>
#include<iostream>
using namespace std;
const int MAXN=505;
int n,m,q,l,r;
int mp[MAXN][MAXN],dp[MAXN][MAXN];
int read(){
	int x=0,f=1;char c=getchar();
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=(x<<3)+(x<<1)+c-'0';
	return x*f;
}
int main(){
	n=read();m=read();q=read();
	while(m--) ++mp[l=read()][r=read()];
	for(int i=1;i<=n;++i) dp[i][i]=mp[i][i];
	for(int i=n-1;i>=1;--i) dp[i][i+1]=dp[i][i]+dp[i+1][i+1]+mp[i][i+1];
	for(int k=2;k<=n;++k){
		for(int i=n-k;i>=1;--i){
			int j=i+k;
			dp[i][j]=dp[i+1][j]+dp[i][j-1]-dp[i+1][j-1]+mp[i][j];
		}
	}
	while(q--){
		l=read();r=read();
		printf("%d\n",dp[l][r]);
	}
	return 0;
}

Measured memory_bytes: 2944
from collections import Counter
N, P = map(int, input().split())
S = list(map(int, list(input())))
ans = 0
if P in (2, 5):
    cnt = 0
    for i, s in enumerate(S):
        if s % P == 0:
            ans += i+1
else:
    S.reverse()
    now = 0
    d = [0] * (N+1)
    for i in range(N):
        now += S[i] * pow(10, i, P)
        now %= P
        d[i] = now % P
    c = Counter(d)
    for i, v in c.items():
        ans += v*(v-1)//2
    #print(d)

print(ans)
 

Measured memory_bytes: 61680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};
#define LOCAL

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    cout << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string T; cin >> T;
    int n=T.size();
    vector<vector<int>> dp(n+1,vector<int>(2,-INF))
                        ,pre(n+1,vector<int>(2));
    dp[0][1]=0;
    for (int i=0;i<n;++i){
        if (T[i]!='P'){
            if (chmax(dp[i+1][1],dp[i][0]+2)) pre[i+1][1]=0;
            if (chmax(dp[i+1][1],dp[i][1]+1)) pre[i+1][1]=1;
        }
        if (T[i]!='D'){
            if (chmax(dp[i+1][0],dp[i][0])) pre[i+1][0]=0;
            if (chmax(dp[i+1][0],dp[i][1])) pre[i+1][0]=1;
        }
    }
    int now=(dp[n][0]>dp[n][1]?0:1);
    string ans="",S="PD";
    for (int i=n;i>0;--i){
        ans+=S[now];
        now=pre[i][now];
    }
    reverse(ALL(ans));
    cout << ans << '\n';
}

Measured memory_bytes: 25696
#include <stdio.h>

#define N 1000000

int insertionSort(int *A, int n, int g) {
	int i,j;
	int v;
	int cnt = 0;

	for (i = g; i < n; i++) {
		v = A[i];
		j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j+g] = A[j];
			j = j - g;
			cnt++;
		}
		A[j+g] = v;
	}

	return cnt;
}

void shellSort(int *A, int n) {
	int i;
	int cnt = 0;
	int m;
	int G[n];

	G[0] = 1;
	for (m = 1; m < 100; m++) {
		G[m] = G[m-1] * 2;
		if (G[m] > n) break;
	}

	for (i = m-1; i >= 0; i--)
		cnt += insertionSort(A, n, G[i]);

	printf("%d\n", m);
	for (i = m-1; i >= 0; i--) {
		printf("%d", G[i]);
		if (i != 0) printf(" ");
	}
	printf("\n%d\n", cnt);
}

int main () {
	int i,n;
	int A[N];

	scanf("%d", &n);

	for (i = 0; i < n; i++)
		scanf("%d", &A[i]);

	shellSort(A, n);

	for (i = 0; i < n; i++)
		printf("%d\n", A[i]);

	return 0;
}

Measured memory_bytes: 4516
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<utility>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<cctype>
using namespace std;

int main(){
	char line[105];
	while(scanf("%s",line) != EOF){
		int b = 0;
		while(line[b] != 0){
			if( line[b] == '@'){
				b+=2;
				for(int x=0;x<line[b-1]-48;++x){
					printf("%c",line[b]);
				}
			}else{
				printf("%c",line[b]);
			}
			b++;
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1108
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from collections import deque

def main():
    h,w = map(int,input().split())
    grid = [input() for _ in range(h)]
    cnt_white = sum(row.count('.') for row in grid)
    
    dist = [[-1] * w for _ in range(h)]
    q = deque([(0,0)])
    dist[0][0] = 1
    while q:
        i,j = q.popleft()
        for k in range(4):
            y = i + dy[k]
            x = j + dx[k]
            if y < 0 or y >= h:
                continue
            if x < 0 or x >= w:
                continue
            if dist[y][x] < 0 and grid[y][x] == '.':
                dist[y][x] = dist[i][j] + 1
                q.append((y,x))
    
    ans = cnt_white - dist[-1][-1]
    print(ans if dist[-1][-1] >= 0 else -1)          
if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> ans(N);
    Rep (i, N) {
        ll a;
        cin >> a;
        a--;
        ans[a] = i;
    }

    Rep (i, N) {
        if (i != 0) cout << " ";
        cout << ans[i] + 1;
    }
    cout << endl;

}

Measured memory_bytes: 2432
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <iostream>

using namespace std;

#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 rep(i, n)      for(int i = 0; i < (n); ++i)
#define all(c)         begin(c), end(c)
#define rall(c)        rbegin(c), rend(c)
#define SZ(a)          ((ll) a.size())

typedef long long ll;
typedef unsigned long long ull;


int main(){
	ll N,K;
	cin >> N >> K;
	vector<ll> A(N);
	rep(i,N) cin >> A[i];
	vector<ll> count(N+1,0);
	rep(i,N) count[A[i]]++;
	ll tmp=0;
	rep(i,N+1){
		if(count[i]>0) tmp++;
	}
	sort(all(count));
	ll ans=0;
	ll i=0;
	while(tmp>K){
		if(count[i]>0){
			ans+=count[i];
			tmp--;
		}
		i++;
	}
	printf("%lld",ans);
  return 0;
}


Measured memory_bytes: 3328
# PDF参考
# スタックS1
S1 = []
# スタックS2
S2 = []
tmp_total = 0
counter = 0
upper = 0
# 総面積
total_layer = 0

for i,symbol in enumerate(input()):
    if (symbol == '\\'):
        S1.append(i)
    elif (symbol == '/') and S1:
        i_p = S1.pop()
        total_layer = i - i_p
        if S2 :
            while S2 and S2[-1][0] > i_p:
                cal = S2.pop()
                total_layer += cal[1]
        S2.append((i, total_layer))
print(sum([j[1] for j in S2]))
if (len(S2) != 0):
    print(str(len(S2)) + ' ' + ' '.join([str(i[1]) for i in S2]))
else:
    print(str(len(S2)))
        



Measured memory_bytes: 6184
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
  #define dbg(x) cout << #x << " : " << x << endl;
#else 
  #define dbg(x)
#endif

#define int long long
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

map<int, int> cnt;

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

    int n;
    cin >> n;
    int ans = 0;
    fi(0, n) {
        int x;
        cin >> x;
        ans += cnt[i - x];
        cnt[i + x]++;
    }
    cout << ans;
}

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

namespace ABC174
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] inputLongArrayCond = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long[][] inputLongArrayPrms = new long[inputLongArrayCond[0]][];
            for (int j = 0; j < inputLongArrayCond[0]; j++)
            {
                inputLongArrayPrms[j] = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray() ;
            }
            int Ans = 0;
            for (int j = 0; j < inputLongArrayCond[0]; j++)
            {
                if (inputLongArrayCond[1] >= Math.Sqrt(Math.Pow(inputLongArrayPrms[j][0], 2) + Math.Pow(inputLongArrayPrms[j][1], 2)))
                {
                    Ans++;
                }
            }
            Console.WriteLine(Ans);
        }
    }
}


Measured memory_bytes: 49048
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define Pll pair<llint,llint>
#define keta(a)  fixed << setprecision(a)
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
const ll INF = (1LL << 63);


int main() {
	string s;
	cin >> s;
	int ans = 0;
	rep(i, 0, s.size())ans += s[i] - '0';
	Yes(ans%9==0);
	return 0;
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define D(x) cerr << #x << " is " << (x) << "\n";

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a){os << '{';for(int i=0;i<sz(a);i++){if(i>0&&i<sz(a))os << ", ";os << a[i];}os<<'}';return os;}
template<class T> ostream& operator<<(ostream& os, const set<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
template<class T> ostream& operator<<(ostream& os, const multiset<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
template<class T1,class T2> ostream& operator<<(ostream& os, const map<T1,T2>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}

int main()
{
    ll s;
    scanf("%lld",&s);
    int lim=1e9;
    int a=s%lim;
    int b=s/lim;
    if(a!=0)
        b++,a=lim-a;
    printf("0 0 %i 1 %lld %lld\n",lim,a,b);
}


Measured memory_bytes: 256