akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

struct Stack {
    int pointer;
    int* data;
    Stack(int size) {
        this->data = new int[size];
        this->pointer = -1;
    }
    void push(int val) {
        this->pointer++;
        this->data[pointer] = val;
    }
    int pop() {
        if (pointer < 0) { return -1; }
        int val = this->data[pointer];
        this->pointer--;
        return val;
    }
};

bool isInteger(const string& str) {
    if (str.find_first_not_of("0123456789\t") != string::npos) {
        return false;
    }
    return true;
}

void split_into_vec(const string& buf, vector<string>& str) {
    stringstream ss(buf);
    string tmp;
    char delim = ' ';
    while (getline(ss, tmp, delim)) {
        str.push_back(tmp);
    }
}

int main() {
    Stack stack(100);

    ios::sync_with_stdio(false);
    string buf;
    getline(cin, buf);

    vector<string> str;
    split_into_vec(buf, str);

    for (auto& elm : str) {
        if (isInteger(elm)) {
            auto val = atoi(elm.c_str());
            stack.push(val);
        } else {
            auto op = elm.c_str()[0];
            int v2 = stack.pop();
            int v1 = stack.pop();
            int res;
            if (op == '*') {
                res = v1 * v2;
            } else if (op == '+') {
                res = v1 + v2;
            } else if (op == '-') {
                res = v1 - v2;
            }
            stack.push(res);
        }
    }
    cout << stack.pop() << endl;

    return 0;
}

Measured memory_bytes: 3208
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 262144
#define REP(i,n) for(long long i = 0;i < n;++i)
#define int long long
vector<tuple<int, int, int>> vertexs[200000];
long long dist[2][200000];
int visited[2][200000];
#undef int
int main() {
#define int long long
	int n, m, s, t;
	cin >> n >> m >> s >> t;
	REP(i, n) {
		dist[0][i + 1] = LONG_INF;
		dist[1][i + 1] = LONG_INF;
	}
	REP(i, m) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		vertexs[a].push_back(make_tuple(b, c, d));
		vertexs[b].push_back(make_tuple(a, c, d));
	}
	priority_queue<pair<long long, long long>, vector<pair<long long, long long>>, greater<pair<long long, long long>>> next;
	next.push(make_pair(0, s));
	dist[0][s] = 0;
	while (next.empty() == false) {
		int now = next.top().second;
		next.pop();
		if (visited[0][now] == 1) continue;
		visited[0][now] = 0;
		REP(i, vertexs[now].size()) {
			if (dist[0][get<0>(vertexs[now][i])] > dist[0][now] + get<1>(vertexs[now][i])) {
				dist[0][get<0>(vertexs[now][i])] = dist[0][now] + get<1>(vertexs[now][i]);
				next.push(make_pair(dist[0][get<0>(vertexs[now][i])], get<0>(vertexs[now][i])));
			}
		}
	}
	next.push(make_pair(0, t));
	dist[1][t] = 0;
	while (next.empty() == false) {
		int now = next.top().second;
		next.pop();
		if (visited[1][now] == 1) continue;
		visited[1][now] = 0;
		REP(i, vertexs[now].size()) {
			if (dist[1][get<0>(vertexs[now][i])] > dist[1][now] + get<2>(vertexs[now][i])) {
				dist[1][get<0>(vertexs[now][i])] = dist[1][now] + get<2>(vertexs[now][i]);
				next.push(make_pair(dist[1][get<0>(vertexs[now][i])], get<0>(vertexs[now][i])));
			}
		}
	}
	priority_queue<pair<long long, long long>> answers;
	for (int i = 1; i <= n; ++i) {
		answers.push(make_pair(1e15 - dist[0][i] - dist[1][i], i));
	}
	for (int i = 0; i < n; ++i) {
		while (answers.top().second <= i) {
			answers.pop();
		}
		cout << answers.top().first << endl;
	}
}

Measured memory_bytes: 20724
import numpy as np

H, W = map(int, input().split())
S = []
for h in range(H):
  S.append(list(map(lambda s:0 if s=='#' else 1, input())))
S = np.array(S)
 
l,r,u,d = [np.zeros([H,W], dtype=int) for _ in range(4)]

for w in range(W):
  l[:,w] = (l[:,w-1]+1)*S[:,w]
  r[:,-w-1] = (r[:,-w]+1)*S[:,-w-1]

for h in range(H):
  u[h] = (u[h-1]+1)*S[h]
  d[-h-1] = (d[-h]+1)*S[-h-1]
  
ans = np.max((l+r+u+d-3)*S)

print(ans)
    




Measured memory_bytes: 248404
#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;
const int N = 1e5+5;
typedef long long ll;
ll n,a[N];

int main(){
	cin>>n;
	for(ll i=0;i<n;i++) cin>>a[i];
	ll t=0,num=0;
	while(1){
		sort(a+t,a+n);
		t=t+num;
		if(t==n-1) break;
		num=0;
		for(int i=t+1;i<n;i++){
			a[i]%=a[t];
			if(a[i]==0) num++;
		}
	}
	cout<<a[n-1]<<endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
   int n;cin>>n;
   vector<ll> v(n),ans(n,1);
   for(int i=0;i<n;i++)cin>>v[i];
   for(int i=1;i<n;i++){
       if(v[i]<=v[i-1])ans[i]+=ans[i-1];
   }
   //for(ll i:ans)cout<<i<<endl;
   cout<<*max_element(ans.begin(),ans.end())-1;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
// using cd = complex<double>;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
typedef long long int ll;
typedef long double ld;
const ll N = 2*1e5+9;
// const ll m = 1e9 + 7;
const ll inf= 1e14;
const ll mod =1e9+7;
const double PI = acos(-1);
// #define x first
// #define y second
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define pld pair<ld,ld>
ll powm(ll a, ll b) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt","w",stderr); 
    #endif
    ll t = 1;
    // cin>>t;
    while(t--){
        ll x;cin>>x;
        ll val = 7%x;
        ll ct = 1;
        set<ll> a;
        while(1){
            if(val == 0){
                cout<<ct<<'\n';
                return 0;
            }
            val*= 10;
            val+=7;
            val%=x;
            if(!a.count(val)){
                a.insert(val);
            }
            else{
                cout<<-1<<'\n';
                return 0;
            }
            ct++;
        }
        

    }

        
}

Measured memory_bytes: 50492
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    for (int i = 0; i <= N; i++)
    {
        if (i * i <= N && (i + 1) * (i + 1) > N)
        {
            cout << i * i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

ll power(ll x, ll y)
{
    ll ans = 1;
    while (y)
    {
        if (y & 1)
            ans = (ans * x) % MOD;
        x = (x * x) % MOD;
        y >>= 1;
    }
    return ans;
}

ll mod_comb(ll n, ll k)
{
    ll ans = 1;

    if (n < k || n < 0 || k < 0)
    {
        return 0;
    }

    for (long long i = 0; i < k; i++)
    {
        ans *= n - i;
        ans %= MOD;
        ans *= power(i + 1, MOD - 2);
        ans %= MOD;
    }

    return ans;
}

int main(void)
{
    ll s;
    cin >> s;

    ll ans = 0;

    for (int i = 1; i <= s / 3; i++)
    {
        ll m = s - i * 3;

        ans += mod_comb(m + i - 1, m);
        ans %= MOD;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3608
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	ll i,n,j;cin>>n;vi v(3),d(3,0),a(3,0);
	for(i=0;i<n;i++){
		for(j=0;j<3;j++) cin>>v[j];
		if(!i) a=d=v;
		else d[0]=v[0]+max(a[1],a[2]),d[1]=v[1]+max(a[0],a[2]),d[2]=v[2]+max(a[0],a[1]),a=d;
	}cout<<max(d[0],max(d[1],d[2]))<<endl;
}



Measured memory_bytes: 256
#pragma comment(linker,"/STACK:102400000,102400000")
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <cctype>
#include <climits>
#include <cmath>
#include <set>
#include <map>
#include <sstream>
#include <queue>
#include <stack>

using namespace std;

int main(){
	int n;
	scanf("%d",&n);
	char name[20];
	map<char,long long> arr;
	set<char> st;
	vector<char> letter;
	for(int i=0;i<n;i++){
		scanf("%s",name);
		switch(name[0]){
			case 'M':
				st.insert(name[0]);
				arr['M']++;
				break;
			case 'A':
				st.insert(name[0]);
				arr['A']++;
				break;
			case 'R':
				st.insert(name[0]);
				arr['R']++;
				break;
			case 'C':
				st.insert(name[0]);
				arr['C']++;
				break;
			case 'H':
				st.insert(name[0]);
				arr['H']++;
				break;
		}
	}
	for(auto it=st.begin();it!=st.end();it++)
		letter.push_back(*it);
	long long ans;
	if(st.size()<3) ans=0;
	else if(st.size()==3){
		ans=arr[letter[0]]*arr[letter[1]]*arr[letter[2]];
	}
	else if(letter.size()==4){
		ans=arr[letter[0]]*arr[letter[1]]*arr[letter[2]];
		ans+=arr[letter[0]]*arr[letter[1]]*arr[letter[3]];
		ans+=arr[letter[0]]*arr[letter[2]]*arr[letter[3]];
		ans+=arr[letter[1]]*arr[letter[2]]*arr[letter[3]];
	}
	else if(letter.size()==5){
		ans=arr[letter[0]]*arr[letter[1]]*arr[letter[2]];
		ans+=arr[letter[0]]*arr[letter[1]]*arr[letter[3]];
		ans+=arr[letter[0]]*arr[letter[2]]*arr[letter[3]];
		ans+=arr[letter[1]]*arr[letter[2]]*arr[letter[3]];
		ans+=arr[letter[0]]*arr[letter[1]]*arr[letter[4]];
		ans+=arr[letter[0]]*arr[letter[2]]*arr[letter[4]];
		ans+=arr[letter[0]]*arr[letter[3]]*arr[letter[4]];
		ans+=arr[letter[1]]*arr[letter[2]]*arr[letter[4]];
		ans+=arr[letter[1]]*arr[letter[3]]*arr[letter[4]];
		ans+=arr[letter[2]]*arr[letter[3]]*arr[letter[4]];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

typedef long long LL;

LL n, a, b;

int main() {
    scanf("%lld%lld%lld", &n, &a, &b);
    if (n < a + b - 1 || n > a * b) {
        puts("-1");
        return 0;
    }
    int tot = 0;
    for (int i = 1; i <= a; ++i) {
        int k = min(n - tot - a + i, b);
        for (int j = k; j; --j)
            printf("%d ", tot + j);
        tot += k;
    }
    puts("");
    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
  
int main()
{
  int n,k;
  cin >>n >>k;
  int arr[n],dp[n];
  for(int i=0;i<n;i++)
    cin >>arr[i];
  dp[0]=0;
  for(int i=1;i<n;i++)
  {
    dp[i]=INT_MAX;
    for(int j=i-1;j>=i-k&&j>=0;j--)
      dp[i]=min(dp[i],dp[j]+abs(arr[i]-arr[j]));
  }
  cout <<dp[n-1] <<endl;
}

Measured memory_bytes: 1152
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
using namespace std;
int main() {
  int i,j;
  long long a,b,x;
  cin>>a>>b>>x;
  if(x==1){
    cout<<(b-a+1)<<endl;
    return 0;
  }
  long long ans=b/x;
  if(a)
    ans-=(a-1)/x;
  else ans++;
  cout<<ans<<endl;
}

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

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}


int main() {
  int64_t x = 1000000007;  
  int N;
  cin >> N;
  vector<int64_t> A(N);

  for (int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  int64_t S;
/*  
  for (int i = 0; i < N-1; i++){
    for (int j = i+1; j < N; j++){
      S += (A[i] * A[j])%x;
    }
  }
*/
  
  int64_t Sum=0;
  int64_t SquareSum=0;
  for (int i = 0; i < N; i++){
    Sum += A[i];
    Sum = Sum%x;
    SquareSum += (A[i]*A[i]);
    SquareSum = SquareSum%x;
  }
  
  
  S = ((Sum * Sum) - SquareSum)%x;
  //cout << S << endl;
  if (S < 0) { S += x; }
  //cout << modinv(2,x) << endl;
  S = S * modinv(2,x);
  
  int64_t ans = S%x;
  
  cout << ans;  
}


Measured memory_bytes: 4836
<?php
fscanf(STDIN, "%s", $w);

if (1 > strlen($w) || 100 < strlen($w)) {
    exit;
}

$text = array();
for ($i =0; $i < strlen($w); $i++) {
    if (isset($text[$w[$i]])) {
        $text[$w[$i]]++;
    } else {
        $text[$w[$i]] = 1;
    }
}

foreach ($text as $target) {
    if ($target % 2 != 0) {
        echo 'No';
        exit;
    }
}
echo 'Yes';

exit;

?>

Measured memory_bytes: 3576
#include <iostream>
#include <string>
using namespace std;
int main(){
    string a,b;
    cin >> a >> b;
    if(a.size() < b.size()) puts("LESS");
    else if(b.size() < a.size()) puts("GREATER");
    else {
        for(int i = 0; i < a.size(); i++) {
            if(a[i] - '0' < b[i] - '0') {
                puts("LESS");
                return 0;
            }
            else if (b[i] - '0' < a[i] - '0') {
                puts("GREATER");
                return 0;
            }
        }
        puts("EQUAL");
    }
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
h=[0]+list(map(int,input().split()))
good=[1]*(n+1)
good[0]=0
for i in range(m):
  a,b=map(int,input().split())
  if h[a]<h[b]:
    good[a]=0
  elif h[a]>h[b]:
    good[b]=0
  else:
    good[a]=0
    good[b]=0
print(sum(good))

Measured memory_bytes: 20116
#include <iostream>

using namespace std;

int main(){
    string s; cin >> s;
    for(int i=0; i<1<<3; ++i){
        int e=s[0]-'0';
        for(int j=0; j<3; ++j){
            if((i >> j) & 1) e+=s[j+1]-'0';
            else e-=s[j+1]-'0';
        }
        if(e==7){
            cout << s[0];
            for(int j=0; j<3; ++j){
                if((i >> j) & 1) cout << '+' << s[j+1];
                else cout << '-' << s[j+1];
            }
            cout << "=7" << endl;
            return 0;
        }
    }
    return 0;
}


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

const int maxn = 2e3 + 5;
LL a[maxn];
LL b[maxn][maxn];//b[i][k] : 当整个过程使用了【k】次魔法，获得【color i】时的最少花费的时间。(不包括【k * x】).

int main(){
    int n;
    LL x,sum = 1LL << 60LL;
    cin >> n >> x;
    for(int i = 1;i <= n;i++) cin >> a[i];
    for(int i = 1;i <= n;i++){
        b[i][0] = a[i];
        for(int k = 1;k <= n - 1;k++){
            int pos = i - k;
            if(pos <= 0) pos = n - abs(pos);
            b[i][k] = min(b[i][k - 1],a[pos]);//【b[i][k]】的转移方程.
        }
    }
    for(int k = 0;k <= n - 1;k++){
        LL ans = 0;
        for(int i = 1;i <= n;i++){
            ans += b[i][k];
        }
        sum = min(sum,ans + x * k);//取最小值.
    }
    cout << sum << endl;
}



Measured memory_bytes: 31616
c = [[0]*3]*3

for i in range(3):
    c[i] = [int(x) for x in input().split()]

ans = False

if c[0][0] - c[0][1] == c[1][0] - c[1][1] == c[2][0] - c[2][1] and\
    c[0][0] - c[0][2] == c[1][0] - c[1][2] == c[2][0] - c[2][2]:
    ans = True

if ans == True:
    print('Yes')
else: # ans == False:
    print('No')

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long

  bool GREATER = false;
  bool LESS    = false ;

bool  comparision( string s1, string s2){
 if(s1.size() > s2.size()){
    cout << "GREATER" ;
    return false;
  }
  
  if(s1.size() < s2.size()){
    cout << "LESS";
    return false;
  }
}

int main() {
  string s1 , s2 ;
  cin >> s1 >> s2 ;
  bool GREATER = false;
  bool LESS    = false ;
  
  if(comparision(s1,s2)){
 
  
  rep(i,s1.size()){
    if(s1.at(i) > s2.at(i)){
       GREATER = true ;
       break ;
    }
    
    if(s1.at(i) < s2.at(i)){
       LESS    = true ;
       break;
    }
    
  }
  
  
  if( GREATER )
    cout << "GREATER" ;
  if(LESS)
    cout << "LESS";
  if( !GREATER && !LESS)
    cout << "EQUAL" ;

  }
    
    

}


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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define INF 1000000007
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int

ll POW(ll a, ll b){
	if(b == 0) return 1LL;
	if(b == 1) return a;
	if(b %2 == 1) return (a*POW(a, b-1))%INF;
	return POW(a*a%INF, b/2);
}

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

int main(){
	string s;
	cin >> s;
	int a, b;
	a = (s[0]-'0')*10+(s[1]-'0');
	b = (s[2]-'0')*10+(s[3]-'0');
	int f1 = 0, f2 = 0;
	if(0 < a && a <= 12) f1 = 1;
	if(0 < b && b <= 12) f2 = 1;
	if(f1 == 1){
		if(f2 == 1) cout << "AMBIGUOUS" << endl;
		else cout << "MMYY" << endl;
	} 
	else{
		if(f2 == 1) cout << "YYMM" << endl;
		else cout << "NA" << endl;
	}
	return 0;
} 


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお


ll keta(int a){
    ll ans = 0;
    while(a){
        ans++;
        a/=10;
    }
    return ans;
}
int main() {
    ll n; cin >> n;
    ll ans = 1e12;
    for(int i = 1; i <= sqrt(n)+1; i++){
        if(n%i==0){
            ans = min(ans,max(keta(i),keta(n/i)));
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)
// #define int long long
#define debug(var) cout << "[" << #var << "] " << var << endl
//using ll = long long;

const int INF = 1<<29;
const double EPS=1e-9;
const int MOD=998244353;

signed main() {
    int A, B;
    cin >> A >> B;
    cout << A * B;
}


Measured memory_bytes: 3632
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz");
char s[10][10];
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  rep(i, 2) rep(j, 3) cin >> s[i][j];
  rep(j, 3) {
    if (s[0][j] == s[1][2 - j]) continue;
    Cout("NO");
    return 0;
  }
  Cout("YES");
  return 0;
}

Measured memory_bytes: 3640
#include<iostream>
    #include<string>
    #include<vector>
    #include<math.h>
    #include<cmath>
    #include<stack>
    //#include<stdlib.h>
    using namespace std;
    int main() {
      short a,b,c;
      cin>>a>>c>>b;
      if((a>b&&b>c)||(a<b&&b<c)){cout<<"Yes";}else{cout<<"No";}
      return 0;
    }

Measured memory_bytes: 768
/**
 *  author: andychen
 *  created: 09.20.2020 14:20:33
**/

#include <bits/stdc++.h>

using namespace std;

struct SegTree{
    int NN;
    int dval;
    vector<int> seg;
    vector<int> lazy;

    void init(int n, int val){
        NN = 1;
        while (NN < n)
            NN <<= 1;
        
        dval = val;
        seg = vector<int>(NN * 2, val);
        lazy = vector<int>(NN * 2, 0x3f3f3f3f);
    }

    int func(int a, int b){
        return min(a, b);
    }

    void push(int u, int l, int r){
        if (lazy[u] != 0x3f3f3f3f){
            int mid = (l + r) / 2;

            seg[u * 2 + 1] = func(seg[u * 2 + 1], lazy[u]);
            seg[u * 2 + 2] = func(seg[u * 2 + 2],  lazy[u]);

            lazy[u * 2 + 1] = func(lazy[u * 2 + 1], lazy[u]);
            lazy[u * 2 + 2] = func(lazy[u * 2 + 2], lazy[u]);

            lazy[u] = 0x3f3f3f3f;
        }
    }

    void gather(int u){
        seg[u] = func(seg[u * 2 + 1], seg[u * 2 + 2]);
    }

    void update(int u, int a, int b, int l, int r, int x){
        if (b <= l || r <= a)
            return ;
        if (a <= l && r <= b){
            seg[u] = func(seg[u], x);
            lazy[u] = func(lazy[u], x);
            return ;
        }

        int mid = (l + r) / 2;
        push(u, l, r);
        update(u * 2 + 1, a, b, l, mid, x);
        update(u * 2 + 2, a, b, mid, r, x);
        gather(u);
    }

    int query(int u, int a, int b, int l, int r){
        if (b <= l || r <= a)
            return dval;
        if (a <= l && r <= b){
            return seg[u];
        }

        int mid = (l + r) / 2;
        push(u, l, r);
        int res1 = query(u * 2 + 1, a, b, l, mid);
        int res2 = query(u * 2 + 2, a, b, mid, r);
        gather(u);

        return func(res1, res2);
    }
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    long long n, q;
    cin >> n >> q;

    SegTree col, row;
    col.init(n, n);
    row.init(n, n);
    long long ans = (n - 2) * (n - 2);
    while (q--){
        int t, x;
        cin >> t >> x;

        if (t == 1){
            int cnt = col.query(0, x - 1, x, 0, col.NN);
            ans -= cnt - 2;
            row.update(0, 0, cnt, 0, col.NN, x);
        }
        else{
            int cnt = row.query(0, x - 1, x, 0, row.NN);
            ans -= cnt - 2;
            col.update(0, 0, cnt, 0, col.NN, x);
        }
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 11276
def main():

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

    if N == 0:
        if A[0] == 1: return 1
        return -1

    z, w = 1, 1
    B1 = [[1-A[0], 1-A[0]]]
    for i in range(1, N+1):
        if 2*B1[-1][1] < A[i]: return -1
        x, y = max(B1[-1][0]-A[i], 0), 2*B1[-1][1] - A[i]
        B1.append([x, y])
        z = x+A[i]
        w = y + A[i]
    if A[N] < z or A[N] > w:
        return -1
    # print(C1)

    v = A[N]
    ans = v
    for i in range(N-1, 0, -1):
        x, y = (v + 1) // 2, v
        z = 0
        if y < B1[i][0] or x > B1[i][1]: return -1
        if B1[i][0] <= y < B1[i][1]:
            z = y
        else:
            z = B1[i][1]
        v = z + A[i]
        ans += v
    # print(C2)

    return ans + 1

    # return ans

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 713788
;; -*- coding:utf-8 -*-

(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 1))
    #-swank '(optimize (speed 3) (safety 0) (debug 0))))

(defmacro println (obj &optional (stream '*standard-output*))
  `(prog1 (princ ,obj ,stream) (terpri ,stream)))


;; Hauptteil

(deftype uint nil `(integer 0 ,(expt 10 9)))
(defun main ()
  (let* ((height (read))
         (width (read))
         (plan (make-array (list height width) :element-type 'bit :initial-element 0))
         (plan-deletable (make-array (list height width) :element-type 'bit :initial-element 0)))
    (labels ((row-white-p (row)
               (loop for j below width
                     do (when (eql 1 (aref plan row j))
                          (return-from row-white-p nil))
                     finally (return t)))
             (col-white-p (col)
               (loop for i below height
                     do (when (eql 1 (aref plan i col))
                          (return-from col-white-p nil))
                     finally (return t))))
      (dotimes (i height)
        (let ((line (read-line)))
          (dotimes (j width)
            (setf (aref plan i j) (if (char= #\# (aref line j)) 1 0)))))
      (dotimes (row height)
        (when (row-white-p row)
          (dotimes (j width)
            (setf (aref plan-deletable row j) 1))))
      (dotimes (col width)
        (when (col-white-p col)
          (dotimes (i height)
            (setf (aref plan-deletable i col) 1))))
      (dotimes (i height)
        (dotimes (j width (fresh-line))
          (when (eql 0 (aref plan-deletable i j))
            (write-char (if (eql (aref plan i j) 0)
                            #\. #\#))))))))

#-swank(main)


Measured memory_bytes: 21480
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = b-1; i >= a; i--)
// #define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

////////////////////////////////////////////////////////

int main() {
    ll n; cin >> n;
    Vl a(n), b(n);
    rep(i, 0, n) cin >> a[i] >> b[i];

    ll mi = 0;
    rep(i, 0, n) mi += b[i];

    Vl v;
    rep(i, 0, n) v.push_back(a[i]+b[i]);
    sort(ALL(v), greater<ll>());

    ll ans = 0;
    for(int i = 0; i < n; i += 2) ans += v[i];

    co(ans - mi);

    return 0;
}
 
 


Measured memory_bytes: 5856
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

const int Maxn = 100010;
const int MOD = (int) 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = (int) s.size();
    for (int i = 0; i < n; ++i) {
        if (i + 1 < n && s[i] == s[i + 1]) {
            cout << i + 1 << " " << i + 2 << endl;
            return 0;
        }
        if (i + 2 && s[i] == s[i + 2]) {
            cout << i + 1 << " " << i + 3 << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << endl;
}


Measured memory_bytes: 512
import Control.Monad
import Control.Applicative
import Data.List

toTuple :: [Int] -> (Int, Int)
toTuple [x,l] = (x+l, x-l)

solve :: [(Int,Int)] -> Int
solve xs = fst $ foldl' (\(res, curr) (l,s) -> if curr <= s then (res+1, l) else (res, curr)) (0, negate $ 10^10) xs

main = do
  n <- readLn :: IO Int
  arms <- replicateM n (toTuple . map read . words <$> getLine) :: IO [(Int, Int)]
  print $ solve $ sort arms

Measured memory_bytes: 126204
#include<vector>
#include<iostream>
#include<algorithm>
#include<chrono>
#include<set>
#include<cstdio>
#include<string>
#include<unordered_map>

using namespace std;


int main()
{
    int n;
    cin >> n;
    vector<int> ans(n);
    vector<int> re(n);
    int acc = 0;
    for(int i = 0; i < n; i++)
    { 
        scanf("%d",&re[i]);
        acc ^= re[i];
    }
    for(int i = 0; i < n; i++){
        ans[i] = acc ^ re[i];
    }
    for(auto&& item:ans) cout << item << endl;
}

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

int main() {
	int N, K, h;
	cin >> N >> K;
	vector<int> vec(N);
	int min;
	int check;
	for (int i = 0; i < N; i++) {
		cin >> h;
		vec.at(i) = h;
	}
	sort(vec.begin(), vec.end());
	min = vec.at(K - 1) - vec.at(0);
	for (int j = 1; j < N - K + 1; j++) {
		check = vec.at(K - 1 + j) - vec.at(j);
		if (check < min) {
			min = check;
		}
	}
	cout << min << endl;
}

Measured memory_bytes: 3704
class BIT:
    """
    https://tjkendev.github.io/procon-library/python/range_query/bit.html
    """
    def __init__(self, n):
        self.n = n
        self.data = [0] * (n + 1)
        self.el = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    def add(self, i, x):
        assert i > 0
        self.el[i] += x
        while i <= self.n:
            self.data[i] += x
            i += i & -i

    def get(self, i, j=None):
        if j is None:
            return self.el[i]
        return self.sum(j) - self.sum(i)


def solve(n, q, c_list, lr_list):
    lri_list = [[lr_list[i][0], lr_list[i][1], i] for i in range(q)]
    # sort by r
    lri_list_s = sorted(lri_list, key=lambda x: x[1])
    # color_index
    color_index = [0] * (n + 1)
    # bit
    bit = BIT(n)

    res = [0] * q

    r_temp = 0
    for l, r, i in lri_list_s:
        while r > r_temp:
            r_temp += 1
            c = c_list[r_temp - 1]
            c_ind = color_index[c]
            if c_ind > 0:
                bit.add(c_ind, -1)
            color_index[c] = r_temp
            bit.add(r_temp, 1)
        # print(r, [bit.get(i) for i in range(n + 1)])
        res[i] = bit.get(l - 1, r)
    # print(res)
    return res


def main():
    n, q = map(int, input().split())
    c_list = list(map(int, input().split()))
    lr_list = [list(map(int, input().split())) for _ in range(q)]
    res = solve(n, q, c_list, lr_list)
    for r in res:
        print(r)


def test():
    assert solve(4, 3, [1, 2, 1, 3], [[1, 3], [2, 4], [3, 3]]) == [2, 3, 1]
    assert solve(10, 10, [2, 5, 6, 5, 2, 1, 7, 9, 7, 2], [
        [5, 5], [2, 4], [6, 7], [2, 2], [7, 8], [7, 9], [1, 8], [6, 9], [8, 10], [6, 8]
    ]) == [1, 2, 2, 1, 2, 2, 6, 3, 3, 3]


if __name__ == "__main__":
    test()
    main()


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

struct pos{
  int x;
  int y;
};

int main(){
  int h,w,d;
  cin >> h >> w >> d;
  vector<struct pos> a(h*w+1);
  int A;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> A;
      A--;
      a[A]={j,i};
    }
  }
  int c;
  vector<vector<int>> maryoku(d,vector<int>(h*w/d+2));
  for(int i=0;i<d;i++){
    maryoku[i][0]=0;
    c=i+d;
    for(int j=1;c<h*w;j++,c+=d){
      maryoku[i][j]=abs(a[c-d].x-a[c].x)+abs(a[c-d].y-a[c].y);
      maryoku[i][j]+=maryoku[i][j-1];
    }
  }
  int q,l,r;
  cin >> q;
  for(int t=0;t<q;t++){
    cin >> l >> r;
    l--,r--;
    cout << maryoku[l%d][r/d]-maryoku[l%d][l/d] << endl;
  }
  return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
  string S,T; cin>>S>>T;
  int res = 0;
  rep(i,3)if(S.at(i)==T.at(i))res++;
  cout<<res<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define ll long long
using namespace std;

int main(){
    int ans=0;
    int ac=0,wa=0,tle=0,re=0;
    int N;
    string S;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> S;
        if(S=="AC") ac++;
        else if(S=="WA") wa++;
        else if(S=="TLE") tle++;
        else if(S=="RE") re++;
    } 
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
}

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

int main() {
  string a,b;
  cin>>a>>b;
  int c=a.size();
  int d=0;
  for(int i=0;i<c;i++){
    if(!(a.at(i)==b.at(i)))d++;
  }
  cout<<d<<endl;
}

Measured memory_bytes: 3912
/*
ポゾソート
	ポゾソートはポゴソートと並んで極めて効率の悪い整列アルゴリズム
	ポゾソートは乱数に基づくアルゴリズムで、以下の手順で数列の要素を整列する
	1.2つの要素をランダムに選び、交換する。
	2.すべての要素が昇順に整列されているか確認する
	3.整列されていれば終了。そうでなければ1.へもどる。
	あなたはポゾソートを解析するために、あらかじめいくつか用意された2つの要素に位置に従って、シミュレーションすることにした.
	整列の数列に対して2つの要素を交換する命令がいくつか与えられる。何回目の命令で数列が昇順になるかを求めなさい。
	上限値
*/
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iostream>
using namespace std;

long long a[100000010];
long long a1[100000010];
bool b[1000000010];
int q;
long long er=0;
int x,y;
int sw=0;
long long work;
int main(void){
	long long N=0;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>a[i];
		a1[i]=a[i];
	}
	sort(a1,a1+N);
	for(int i=0;i<N;i++){
		if(a1[i]==a[i]){
			b[i]=true;
		}
		else{
			b[i]=false;
			er++;
		}
	}
	if(er==0&&sw==0){cout<<0<<endl;sw=1;}
	cin>>q;
	for(int j=0;j<q;j++){
		cin>>x>>y;
		work=a[x-1];
		a[x-1]=a[y-1];
		a[y-1]=work;
		if(a[y-1]==a1[y-1]&&b[y-1]==false){
			er--;
			b[y-1]=true;
		}
		if(a[y-1]!=a1[y-1]&&b[y-1]==true){
			er++;
			b[y-1]=false;
		}
		if(a[x-1]==a1[x-1]&&b[x-1]==false){
			er--;
			b[x-1]=true;
		}
		if(a[x-1]!=a1[x-1]&&b[x-1]==true){
			er++;
			b[x-1]=false;
		}
		if(er==0&&sw==0){cout<<j+1<<endl;sw=1;}
	}	
	if(sw==0){
		cout<<-1<<endl;
	}
	return 0;
}


Measured memory_bytes: 8152
n, m, q = map(int, input().split())
abcd = [tuple(map(int, input().split())) for _ in range(q)]

import sys
sys.setrecursionlimit(10**6)
ans = [0]
def dfs(idx, now):
    if idx == n:
        #print(now)
        sumd = 0
        for j in abcd:
            if now[j[1]-1] - now[j[0]-1] == j[2]:
                sumd += j[3]
        ans[0] = max(ans[0], sumd)
        return
    if len(now) > 0:
        start = now[-1]
    else:
        start = 1
    for i in range(start, m+1):
        now.append(i)
        dfs(idx + 1, now)
        now.pop()

dfs(0, [])
print(ans[0])

Measured memory_bytes: 9248
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
typedef long long int ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

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

void Main() {
  Cin(int, n);
  Cins(int, n, h);

  int ans = 0, cnt = 0;
  rep(i, n - 1) {
    if (h[i] >= h[i + 1])
      cnt++;
    else
      cnt = 0;
    ans = max(ans, cnt);
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
n = gets.to_i
acti = Array.new(n).map{Array.new(3,0)}
for i in 0..n-1
  acti[i] = gets.chomp.split(" ").map(&:to_i)
end
dp = Array.new(n).map{Array.new(3,0)}
for i in 0..2
  dp[0][i] = acti[0][i]
end
for i in 1..n-1
  for j in 0..2
    if (dp[i-1][(j-1)%3]+acti[i][j]) < (dp[i-1][(j+1)%3]+acti[i][j])
      dp[i][j] = (dp[i-1][(j+1)%3]+acti[i][j])
    else
      dp[i][j] = (dp[i-1][(j-1)%3]+acti[i][j])
    end
  end
end
ans = 0
for i in 0..2
  if ans < dp[-1][i]
    ans = dp[-1][i]
  end
end
puts ans


Measured memory_bytes: 17532
import math

a,b,h,m=map(float,input().split())
hs=(h*60+m)*360/(12*60)
ms=m*360/60
angle=hs-ms
if angle>=180:
    angle=360-angle
ans=a**2+b**2-2*a*b*math.cos(math.radians(angle))
ans=math.sqrt(ans)
print("{:.10f}".format(ans))

Measured memory_bytes: 9448
h, w, m = list(map(int, input().split()))
ms = []
hs = [0 for i in range(h)]
ws = [0 for i in range(w)]

for i in range(m):
    hi, wi = list(map(int, input().split()))
    ms.append((hi - 1, wi - 1))
    hs[hi - 1] += 1
    ws[wi - 1] += 1

maxh = max(hs)
maxw = max(ws)
cnt_h = sum([hs[i] == maxh for i in range(h)])
cnt_w = sum([ws[i] == maxw for i in range(w)])
cnt = cnt_h * cnt_w

for x, y in ms:
    if hs[x] == maxh and ws[y] == maxw:
        cnt -= 1

if cnt <= 0:
    print(maxh + maxw - 1)
else:
    print(maxh + maxw)

Measured memory_bytes: 56432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353

int main(){
	ll n;
	ll a;
	vector<ll> buka(220000);
	vector<ll> joshi(220000);
	cin >> n;
	FOR(i,2,n){
		cin >> a;
		joshi[i]++;
		buka[a]++;
	}
	FOR(i,1,n){
		cout << buka[i] << endl;
	}
}

Measured memory_bytes: 6512
#include<iostream>
#include<algorithm>
#include<set>
#include<string>
#include<cstring>
using namespace std;

int main()
{
	int n;
	int a[10];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	int m = a[n - 1];
	int s = 0;
	for (int i = 0; i < n - 1; i++)
		s += a[i];
	if (s > m)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>

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

using namespace std;

#define PI 3.1415926535



int x,two=0,ans=0,mod=0;

int main() {
	cin >> x;
	two = x % 100;
	for (int i = 5; i > 0; i--) {
		if (two < i) continue;
		ans += int(two / i);
		two %= i;
	}
	if (ans <= int(x / 100)) cout << 1 << endl;
	else cout << 0 << 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;
using ll = long long;

int main() {
  ll H, W;
  cin >> H >> W;
  if (H == 1 || W == 1)
    cout << 1 << endl;
  else
    cout << H * W / 2 + H * W % 2 << endl;
  return 0;
}

Measured memory_bytes: 3620
n,m = map(int, input().split())
p = [0]*m 

for i in range(m):
    p[i] = input().split()
AC=[[0,-1] for j in range(n)]
k=0
WA=0
for i in range(m):
    if p[i][1]=="AC" and AC[int(p[i][0])-1][0]==0 :
        AC[int(p[i][0])-1][0]=1
        AC[int(p[i][0])-1][1]=i
        k=k+1
for i in range(m):
    if p[i][1]=="WA" and AC[int(p[i][0])-1][0]==1 and AC[int(p[i][0])-1][1]>i:
        WA=WA+1

print(k,WA)

Measured memory_bytes: 45568
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <functional>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <ctime>
#include <complex>

#define enp 	printf("**Entry Point**\n")
#define A		first
#define B		second
#define MP		make_pair

using namespace std;

typedef long long ll;

const int INF = 0x6fffffff;
const int MINF = 0x80000000;
const ll mod = 1000000007;
const int cons = 100001;
const double pi = 3.141592653589793;



int main()
{
	int n;
	string s;
	string t;

	cin >> n >> s >> t;

	if (s.length() + t.length() > n)
	{
		int ans = s.length() + t.length();

		for (int i = 0; i < s.length(); i++)
		{
			int tmp = 0;
			bool flag = true;
			for (int j = 0; i + j < s.length() && j < t.length(); j++)
			{
				if (s[i + j] != t[j])
				{
					flag = false;
					break;
				}
			}

			if (flag)
			{
				if (s.length() + t.length() - (s.length() - i) >= n)
				{
					ans = s.length() + t.length() - (s.length() - i);
					break;
				}
			}
		}

		printf("%d\n", ans);
	}
	else
	{
		printf("%d\n", n);
	}

	return 0;
}

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

alp = set("abcdefghijklmnopqrstuvwxyz")
s = set(s)
#print(s & alp)

if len(s & alp)==26:
    ans = "None"
else:
    lis = list(alp-s)
    lis.sort()
    ans = lis[0]

print(ans)


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

int main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }

  vector<int> A_sort(N);
  for (int i = 0; i < N; i++) {
    A_sort.at(A.at(i)-1) = i+1;
  }

  for (int i = 0; i < N; i++) {
  cout << A_sort.at(i) << endl;
  }
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	char s;
	cin >> s;
	cout << (char)(s+1) << endl;

}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 256
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n,m;
  cin >> n >> m;

  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  priority_queue<int> que;
  REP(i,n) que.push(a[i]);

  REP(_,m){
    int x = que.top();
    que.pop();
    que.push(x/2);
  }

  int ans = 0;
  REP(i,n) ans += que.top(),que.pop();

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2168
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static int ans;
    static int count;

    public static void main(String[] args) {
        int times = sc.nextInt();
        for (int i = 0; i < times; i++) {
            count = 0;
            int num = sc.nextInt();
            // ?????°???????????????????????????
            KAKESAN(num, false);
            System.out.println(count);
        }
    }

    static void KAKESAN(int num, boolean endFlg) {
        ans = 0;
        int disit = String.valueOf(num).length();
        if (disit == 1) {endFlg = true;}
        if (!endFlg) {
            for (int j = 0; j < disit-1; j++) {
                String numStringA = String.valueOf(num).substring(0, j+1);
                String numStringB = String.valueOf(num).substring(j+1, disit);
                int tmp = Integer.parseInt(numStringA)* Integer.parseInt(numStringB);
                if (tmp > ans) {ans = tmp;}
            }
            count++;
            KAKESAN(ans, false);
        }
    }

}

Measured memory_bytes: 31656