akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i = (int)(n)-1; i>=0; --i)
#define For(i,a,b) for(auto i=(a);i<=(b);++i)
#define rFor(i,a,b) for(auto i=(b);i>=(a);--i)
#define call(var) cerr<<#var<<"="<<var<<"\n";
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const double pi = acos(-1);
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}


void cerrall(const vector<bool>& a){rep(i,a.size()) cerr << i << " " << (a[i]? "True" : "False") << "\n"; cerr << "\n";}
template<class T> void cerrall(const vector<T>& a){for(auto& t : a) cerr << t << " "; cerr << "\n";}
template<class T> void cerrall(const set<T>& a){for(auto& t : a) cerr << t << " "; cerr << "\n";}
template<class T> void cerrall(const multiset<T>& a){for(auto& t : a) cerr << t << " "; cerr << "\n";}
template<class T, class U> void cerrall(const vector<pair<T,U>>& a){rep(i,a.size()) cerr << i << " : " << a[i].first << " " << a[i].second << "\n";}
template<class T, class U> void cerrall(const map<T,U>& a){for(auto& t : a) cerr << t.first << " " << t.second << "\n";}
template<class T, class U> void cerrall(const unordered_map<T,U>& a){for(auto& t : a) cerr << t.first << " " << t.second << "\n";}

template<class T> istream& operator>>(istream& is, vector<T>& a){rep(i,a.size()) is >> a[i]; return is;}
template<class T> ostream& operator<<(ostream& os, vector<T>& a){rep(i,a.size()) os << a[i] << " "; return os;}

template<class T, class U> istream& operator>>(istream& is, pair<T,U>& p){is >> p.first >> p.second; return is;}
template<class T, class U> ostream& operator<<(ostream& os, const pair<T,U>& p){os << "("<< p.first << "," << p.second << ")"; return os;}
template<class T, class U> ostream& operator<<(ostream& os, const map<T,U>& mp){for(auto& t : mp) os << t.first << " " << t.second << "\n"; return os;}


using bigint = boost::multiprecision::cpp_int;

int main(){
    int n;cin >> n;
    vl a(n);
    cin >> a;

    rep(i,n){
        if(a[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }

    bigint num = 1;
    rep(i,n){
        num *= a[i];
        if(num > LINF){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << num << endl;
}

Measured memory_bytes: 4100
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
    long n, m;
    long answer;
    cin >> n >> m;
    if (n == 1 && m == 1){
        answer = 1;
    }
    else if (n == 1 && m > 2){
        answer = max(0, (int)(m-2));
    }
    else if (m == 1 && n > 2){
        answer = max(0, (int)(n-2));
    }
    else if ((n == 2 && m > 2) || (m == 2 && n > 2)){
        answer = 0;
    }
    else { // n >= 3 && m >= 3
        answer = (n-2)*(m-2);
    }
    cout << answer << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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


Measured memory_bytes: 3112
#A1 ~ Aiまでの和 O(logN)
def BIT_query(BIT,idx):
    res_sum = 0
    if idx == 0:
        return 0
    while idx > 0:
        res_sum += BIT[idx]
        idx -= idx&(-idx)
    return res_sum

#Ai += x O(logN)
def BIT_update(BIT,idx,x,n):
    while idx <= n:
        BIT[idx] += x
        idx += idx&(-idx)
    return

def main():
    N, Q = map( int, input().split())
    C = list( map( int, input().split()))
    LRI = []
    for i in range(Q):
        l, r = map( int, input().split())
        LRI.append((r,l, i))
    LRI.sort(key=lambda x:x[0])
    lastAppend = [-1]*(N+1)
    BIT = [0]*(N+1)
    ANS = [0]*Q
    now = 1
    for r, l, i in LRI:
        while now <= r:
            c = C[now-1]
            if lastAppend[c] == -1:
                BIT_update(BIT, now, 1,N)
            else:
                BIT_update(BIT, now, 1,N)
                BIT_update(BIT, lastAppend[c],-1,N)
            lastAppend[c] = now                
            now += 1
        ANS[i] = BIT_query(BIT,r) - BIT_query(BIT,l-1)
    # print( "\n".join( map( str, ANS)))
    for ans in ANS:
        print(ans)
    
if __name__ == '__main__':
    main()


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

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1LL<<62)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  ll N, C, K;
  cin >> N >> C >> K;
  vector<ll> T(N);
  rep(i, N) cin >> T[i];

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

  ll cnt = 0;
  ll diff = 0;
  ll taked = 0;

  REP(i, 0, N - 1) {
    taked++;
    diff += (T[i+1] - T[i]);
    if (diff > K || taked == C) {
      cnt++;
      diff = 0;
      taked = 0;
    }
  }

  cout << cnt + 1 << endl;
  return 0; 
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(){
  unsigned x;
  int count1=0, count2=0;
  scanf("%u", &x);
  while(x>=500){
    x=x-500;
    count1++;
  }
  if(x>0){
    while(x>=5){
      x=x-5;
      count2++;
    }
  }
  printf("%d",count1*1000+count2*5);
  return 0;
}
  

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define ump unordered_map
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define fore(i,a,n) for(int i=a;i<=n;i++)
#define len length()
double doINF = 1.0/0.0 ;
ostream_iterator <int> outp(cout," ");
inline ll modadd(ll n,ll m,ll mod){
    ll sum = ((n+m)%mod+mod)%mod;
    return sum;
} 
inline ll modsub(ll n,ll m, ll mod){
    ll diff = ((n-m+mod)%mod+mod)%mod;
    return diff;
}
inline ll modpro(ll n,ll m,ll mod){
    ll pro = ((n*m)%mod+mod)%mod;
    return pro;
}
inline ll pow(int x,int y){
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x * x;
    }
    return res;
}
inline ll powmod(ll x,ll y,ll mod){
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = modpro(res , x,mod);
        y = y >> 1;
        x = modpro(x , x,mod);
    }
    return res;
}
//ll min(ll a, ll b){
//    if(a>b){
//        return b;
//    }
//    return a;
//}
// 
//ll max(ll a, ll b){
//    if(a>b){
//        return a;
//    }
//    return b;
//}
bool pairdec(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 		if(a.fi!=b.fi)
       	return (a.fi> b.fi);
		else return a.se>b.se;  
} 

ll power(ll x, ll y, ll mod) 
{ 
    ll res = 1; 
    x = x%mod; 
    while (y > 0) { 
        if (y & 1) 
            res = (res * x) % mod; 
  
        y = y >> 1;
        x = (x * x) % mod; 
    } 
    return res; 
} 
ll modInverse(ll a, ll mod) 
{ 
    return  powmod(a, mod - 2, mod); 
} 
ll modFact(ll n, ll mod) 
{ 
    if (n >=mod) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) %mod; 
  
    return result; 
} 
//cout<<setprecision(9)<<fixed<<sum<<endl; --- precision for double numbers
//copy(v.beg,v.en,outp);

int main()
{
	string s;
	cin>>s;
	forl(i,0,s.len) s[i]='x';
	cout<<s<<endl;
}

Measured memory_bytes: 256
#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 mxn (ll)1e5
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#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(){
	int n,i,c=0;ll d;cin>>n>>d;
	for(i=0;i<n;i++){
		ll x,y;cin>>x>>y;
		if(x*x+y*y<=d*d) c++;
	}cout<<c<<endl;
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <vector>
using namespace std;

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")

#define DEBUG(x) cout << ">> " << #x << ": " << x << endl;
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
typedef long long ll;
typedef long double ld;

int main() { _
  int n; cin >> n;
  ll ans = 0;
  for (int i = 1; i < n; i++) {
    ans += i;
  }
  cout << ans << 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)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;
ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  for(int i = 0; i < s.size(); ++i){
    if(s[i] != t[i]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main() {
  int64_t N,M;
  cin>>N>>M;
  if(N==1&&M==1){cout<<1<<endl;}
  else if(N==1||M==1){cout<<max(N,M)-2<<endl;}
  else{cout<<max((int64_t)0,N-2)*max((int64_t)0,M-2)<<endl;}
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <sstream>
#include <stdio.h>
//#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;


int main(void)
{
	int H, W; cin >> H >> W;
	vector<string> A(H); rep(i, 0, H)cin >> A[i];
	int cnt = 0;
	rep(i, 0, H) {
		rep(j, 0, W) {
			if (A[i][j] == '#')cnt++;
		}
	}
	if (cnt == H + W - 1)cout << "Possible" << endl;
	else cout << "Impossible" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int A,B,C;
  cin>> A >>B >> C;

  if(A==B && A!=C)cout <<"Yes\n";
  else if(A==C && A!=B)cout <<"Yes\n";
  else if(B==C && A!=B)cout <<"Yes\n";
  else cout<<"No\n";
}

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

#define int             long long int
#define ld              long double
#define ff              first
#define ss              second
#define pb              push_back
#define endl            "\n"

#define vi              vector <int>
#define pii             pair <int, int>
#define vpii            vector <pii>
#define mii             map <int, int>
#define que_max         priority_queue <int>
#define que_min         priority_queue <int, vi, greater<int>>

#define loop(i,s,e)     for(int i=s;i<e;i++)
#define rloop(i,e,s)    for(int i=e;i>=s;i--)
#define mset(a,f)       memset(a,f,sizeof(a))

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

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl


inline int power(int a, int b)
{
	int x = 1;
	while (b)
	{
		if (b & 1) x *= a;

		a *= a;

		b >>= 1;
	}
	return x;
}

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 2e5 + 7;
const long long INF = LLONG_MAX;
int a[N];

int dp[N][3][2];
int n;

int go(int i, int f, int f3)
{
	if (i < 0)
	{
		if (n % 2 == 0) return 0;
		if (f3) return -1e15;
		else return 0;
	}

	int &ans = dp[i][f][f3];
	if (ans != -1e16) return ans;

	int op1 = -1e15;
	int op2 = -1e15;
	int op3 = -1e15;

	if (f3) op1 = go(i - 1, f, 0);


	if (f == 1)
	{
		op2 = a[i] + go(i - 2, f, f3);
	}
	else
	{
		op2 = a[i] + go(i - 2, 0, f3);
		if ( i - 1 >= 0 ) op3 = a[i - 1] + go(i - 3, 1, f3);
	}
	return ans = max({op1, op2, op3});

}

void solve()
{
	cin >> n;
	loop(i, 0, n) cin >> a[i];

	loop(i, 0, n)
	{
		loop(j, 0, 3)
		{
			loop(k, 0, 2) dp[i][j][k] = -1e16;
		}
	}
	int ans;
	int f3 = 1;
	if (n % 2 == 0) f3 = 0;
	ans =  go(n - 1, 0, f3);
	cout << ans << endl;

	return;
}
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);



	cout << setprecision(9) << fixed;

	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}


	return 0;
}



Measured memory_bytes: 22404
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

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


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

using namespace std;

typedef long long ll;
typedef long double ld;

ll a, b;
string s, t;

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

    cin>>a>>b;
    if (a<b)
    {
        for (int i=1; i<=b; i++)
            cout<<a;
    }
    else
    {
        for (int i=1; i<=a; i++)
            cout<<b;
    }

    return 0;
}

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

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

map<int, int > M;
const int N = 100005;
int A[N];

int main() {
  int n;
  S(n);
  rep(i,0,n) {
    int x;
    S(x);
    M[x] = i&1;
    A[i] = x;
  }
  sort(A,A+n);
  int ans = 0;
  for(int i = 0; i < n; i += 2) {
    ans += M[A[i]];
  }
  P(ans);
  return 0;
}

Measured memory_bytes: 5376
def solve():
	from collections import deque
	n,*l=map(int,open(0).read().split())
	con=[[] for _ in range(n)]
	dist=[-1]*n
	dist[0]=0
	for a,b,c in zip(*[iter(l)]*3):
		con[a-1].append((b-1,c%2))
		con[b-1].append((a-1,c%2))
 
	stk=deque([0])
	while stk:
		cur=stk.pop()
		for nxt,d in con[cur]:
			if dist[nxt]<0:
				stk.append(nxt)
				dist[nxt]=(dist[cur]+d)%2

	print(*dist,sep="\n")

if __name__=="__main__":
	solve()

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

int main() {
  int N;
  cin >> N;
  vector<int> s(N);
  int sum=0;
  bool al=true;
  for(int i=0;i<N;i++){
    cin >> s[i];
    sum+=s[i];
    if(s[i]%10!=0)al=false;
  }
  sort(s.begin(),s.end());
  if(al)cout << 0;
  else{
    if(sum%10!=0)cout << sum;
    else{
      for(int i=0;i<N;i++){
        if(s[i]%10!=0){
          cout << sum-s[i];
          break;
        }
      }
    }
  }
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<ctime>
#include<queue>
#include<cmath>
#include<cstdio>
#include<vector>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
int read(){
    int f=1,x=0;char s=getchar();   
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}  
    while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
    return x*f;
}
#define eps 1e-8
#define MAXN 100
#define INF 0x3f3f3f3f
#define Mod int(1e9+7)
int main(){
	int n=read(),m=read(),x=int(sqrt(m)),Ans=0;
	for(int i=x;i>=1;i--){
		if(m%i==0&&m/i>=n)
			Ans=max(Ans,i);
		if(m%i==0&&i>=n)
			Ans=max(Ans,m/i);
	}
	printf("%d\n",Ans);
	return 0;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())

if a == 1 and b == 2:
    print(3)
elif a == 1 and b == 3:
    print(2)
elif a == 2 and b == 1 :
    print(3)
elif a == 2 and b == 3 :
    print(1)
elif a == 3 and b == 1 :
    print(2)
elif a == 3 and b == 2 :
    print(1)

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

const int maxn = 2e5 + 10;
typedef long long int ll;
int a[maxn],cnt[maxn];
void solved(){
    int n;cin>>n;
    for(int i = 2; i <= n; i++){
        cin>>a[i];
        cnt[a[i]]++;
    }
    for(int i = 1; i <= n; i++){
        cout<<cnt[i]<<endl;
    }
}
int main(){
    solved();
    return 0;
}

Measured memory_bytes: 5128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  string s;
  cin >> s;
  map<char,ll> count;
  for(ll i=0;i<s.size();i++) {
    count[s[i]]++;
  }
  map<ll,ll> cn; 
  for(auto p:count) {
    cn[p.second]++;
  }
  for(auto p:cn) {
    if(p.first>(s.size()+2)/3) {
      cout << "NO" << endl;
      return 0;
    }
    if(p.first==(s.size()+2)/3) {
      ll n=s.size()%3;
      if(n==0) n+=3;
      if(p.second>n) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	for(int x=0;x<=n;x++){
		for(int y=0;x+y<=n;y++){
			int z = n-x-y;
			if(x*10000+y*5000+z*1000==m){
				cout<<x<<" "<<y<<" "<<z<<endl;
				return 0; 
			}
		}
	}
	cout<<"-1 -1 -1"<<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 P = pair<int, int>;
typedef long long ll;

int main() {
  int x, y;
  cin >> x >> y;
  if(x == 0){
    if(y <0){
      cout << abs(y) + 1 << endl;
      return 0;
    }else{
      cout << y << endl;
      return 0;
    }
  }
  if(y == 0){
    if(x < 0){
      cout << abs(x) << endl;
      return 0;
    }else{
      cout << x + 1 << endl;
      return 0;
    }
  }
  if(x >= 0 && y >= 0){
    if(y >x){
      cout << y - x << endl;
      return 0;
    }else{
      cout << x + y << endl;
      return 0;
    }
  }
  if(x <= 0 && y >= 0){
    if(abs(x) <= abs(y)){
      cout << 1 + abs(y) - abs(x) << endl;
      return 0;
    }else{
      cout << abs(x) - abs(y) + 1 << endl;
      return 0;
    }
  }
  if(x >= 0 && y <= 0){
    if (abs(x) <= abs(y)){
      cout << abs(y) - abs(x) + 1 << endl;
      return 0;
    }else{
      cout << abs(x) - abs(y) + 1 << endl;
      return 0;
    }
  }
  if(x <= 0 && y <= 0){
    if (abs(x) <= abs(y)){
      cout << abs(y) - abs(x) + 2 << endl;
      return 0;
    }else{
      cout << abs(x) - abs(y) << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cctype>
#include<stdio.h>
using namespace std;
int main() {
    char ch;
    int sum=0;
    while(1){
        while(1){
            scanf("%c", &ch);
            if (ch == '\n') break;
            sum += (int)(ch - '0');
        }
        if (sum == 0) break;
        cout << sum << endl;
        sum = 0;
    }
    return 0;
}


Measured memory_bytes: 3132
n = int(input())
m = int( n ** 0.5) + 1
a,b = 1, 0
for i in range(2, m):
    if n % i == 0:
        a = n // i
        b = i
if b !=0:
    print(a + b - 2)
else:
    print(n - 1)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
using namespace std;
//using namespace __gnu_pbds;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX (1000*1000*1000+7)
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >
//#define endl "\n"
 
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
const int mod=1e10+7;
int power(int a,int b)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return ans;
}

int32_t main()
{
    fast;

    int n,val,ans=0;
    cin>>n;
    map<int,int> add,sub;

    repa(i,1,n)
    {
        cin>>val;
        add[val+i]++;
        sub[val-i]++;
    }

    trav(i,add)
    {
        ans+=(i.ss*sub[i.ff*-1]);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 37896
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define X first
#define Y second
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define All(x) x.begin() , x.end()
#define mem(aa,x) memset(aa,x,sizeof aa)
#define pb push_back
typedef long long ll;
typedef pair<int,int> ii;
const int maxn=4e5+5;

main(){IOS
	int N,sum=0;
	cin>>N;
	bool a[N+1],b[N+1]={};
	vector<int> ans;
	
	rep(i,1,N) cin>>a[i];
	for(int i=N;i>=1;i--){
		int temp=0;
		for(int j=i;j<=N;j+=i) temp+=b[j];
		if(temp%2!=a[i]){
			b[i]=1;
			sum++;
			ans.pb(i);
		}
	}
	
	cout<<sum<<"\n";
	for(auto i:ans) cout<<i<<" ";
	cout<<"\n";
}

Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this

void solve(){
    ll N; cin>>N;

    ll e_A = 0,s_B = 0;
    ll BA = 0;
    ll ans = 0;
    FOR(i,1,N){
        string x; cin>>x;
        for(ll j=0;j<x.length()-1;j++){
            if(x[j] == 'A' && x[j+1] == 'B') ans++;
        }

        if(x[0] == 'B' && *x.rbegin() == 'A'){
            BA++;
            continue;
        }

        if(x[0] == 'B') s_B++;
        if(*x.rbegin() == 'A') e_A++; 
    }

    if(BA > 0) ans += BA - 1;
    if(BA > 0 && e_A > 0){
        ans++;
        e_A--;
    }
    if(BA > 0 && s_B > 0){
        ans++;
        s_B--;
    }

    ans += min(s_B,e_A);
    cout<<ans<<endl;
}  

signed main(){

   FastRead;    



    ll t;
    t = 1; 
    // cin>>t;
    FOR(i,1,t){
        solve();
    }
}




Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define D7K_ICPC ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef long double ld;
using namespace std;
ll n,x,z,a,k,b,c,d,m,y,t;
int main() {
    D7K_ICPC
    cin>>a;
    for(int i=1 ; i<=a; i++){
        cin>>c;
        if(i%2==1 && c%2==1)x++;
    }
    cout<<x;

    return 0;
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
#define ll long long
#define loop(n) for(ll i = 0; i<n; i++)
#define sort(a) sort(a.begin(), a.end())
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    pair<string, int> a, b;
    cin>>a.first>>b.first;
    cin>>a.second>>b.second;
    string s; 
    cin>>s;

    if(a.first == s) a.second--;
    else b.second--;
    cout<<a.second<<" "<<b.second<<"\n";

    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            String s = in.next();
            if (s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5))
            {
                out.print("Yes");
            } else
                out.print("No");
        }

    }
}



Measured memory_bytes: 23124
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


#include <set>
void solve() {
  int a, b, c;
  cin >> a >> b >> c;
  int x = a + b + c;
  cout << max(x + a * 9, max(x + b * 9, x + c * 9)) << endl;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/s8pc-4/tasks/s8pc_4_b

#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>

using namespace std;


int main(int argc, const char* argv[])
{
    int n, k;
    cin >> n >> k;

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

    uint64_t minCost = numeric_limits<uint64_t>::max();
    for(int i = 0; i < (1 << n); ++i)
    {
        if(bitset<32>(i).count() < k)
        {
            continue;
        }
        uint64_t cost = 0;
        int maxHeight = 0;
        for(int j = 0; j < n; ++j)
        {
            if(((i >> j) & 1) == 1)
            {
                if(maxHeight < a[j])
                {
                    maxHeight = a[j];
                }
                else
                {
                    cost += maxHeight - a[j] + 1;
                    maxHeight++;
                }
            }
            else
            {
                maxHeight = max(maxHeight, a[j]);
            }
            
        }
        minCost = min(minCost, cost);
    }

    cout << minCost << endl;
}


Measured memory_bytes: 256
function Main(input){

    var inputList = input.split(" ");
    var x = 0;
    var y = 0;
    
    for(i = 0; i < inputList.length; i++){
        inputList[i] = parseInt(inputList[i], 10);
    }

    for(i = 0; i < inputList.length; i++){
        if(inputList[i] === 5){
            x = x + 1;
        } else if(inputList[i] === 7){
            y = y + 1;
        }
    }

    if(x === 2 && y === 1){
        console.log("YES");
    }else{
        console.log("NO");
    }

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

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

    vector<string> a(n);
    vector<string> b(m);

    rep(i, n){
        cin >> a[i];
    }

    rep(i, m){
        cin >> b[i];
    }

    bool ans = false;

    [&](){
        for(int i = 0; i + m - 1 < n; i++){
            for(int j = 0; j + m - 1 < n; j++){
                bool tmp = true;

                [&](){
                    rep(k, m){
                        rep(l, m){
                            if(b[k][l] != a[i + k][j + l]){
                                tmp = false;
                                return;
                            }
                        }
                    }
                }();

                if(tmp){
                    ans = true;
                    return;
                }
            }
        }
    }();

    cout << (ans ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args)
	{
		//変数
		int count=0;
		boolean sw=false;
		//int answer=0;
		//long answer=0;
		//double answer=0;
		String answer="Heisei";
		//List<Integer> h=new ArrayList<Integer>();
		//int af=Integer.MAX_VALUE;
		//int sub=0;
		int y=0;
		int m=0;
		int d=0;
		String s="";
		int max=0;
		int min=Integer.MAX_VALUE;
		//int t[]=new int[(int)Math.pow(10,5)];
		
		//入力
		Scanner sc = new Scanner(System.in);
		//N=sc.nextInt();
		//X=sc.nextDouble();
		//int A[]=new int[N];
		//List<Integer> A=new ArrayList<Integer>();
		//for(int i=0;i<N;i++)
		//{
		//	A.add(sc.nextInt());
		//}
		String S=sc.next();
		
		//処理
		s=S.substring(0,4);
		y=Integer.parseInt(s);
		//System.out.println(y);
		if(y>2019)
		{
			answer="TBD";
			System.out.println(answer);
			System.exit(0);
		}
		s=S.substring(5,7);
		m=Integer.parseInt(s);
		//System.out.println(m);
		if(m>4)
		{
			answer="TBD";
			System.out.println(answer);
			System.exit(0);
		}
		s=S.substring(8,10);
		d=Integer.parseInt(s);
		//System.out.println(d);
		if(d>30)
		{
			answer="TBD";
			System.out.println(answer);
			System.exit(0);
		}
			
		// 出力
		//System.out.println(Arrays.toString(X));
		//System.out.println(Arrays.deepToString(a));
		//System.out.println(Arrays.toString(A.toArray()));
		//System.out.println(1000000000%13);
		System.out.println(answer);
	}
}

Measured memory_bytes: 22740
//============================
// ABC135a Harmony
//
// 2019/08/13
//============================

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main(int argc, char* argv[])
{
  long a, b;
  cin >> a >> b;

  if((a+b)%2 == 0) cout << (a+b)/2 << endl;
  else cout << "IMPOSSIBLE" << endl;

  return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
hito = [list(map(int, input().split())) for i in range(n)]
point = [list(map(int, input().split())) for j in range(m)]
kekka = []
for k in range(n):
    min_ten = abs(point[0][0]-hito[k][0])+abs(point[0][1]-hito[k][1])
    min_num = 1
    for p in range(1, m):
        kyori = abs(point[p][0]-hito[k][0])+abs(point[p][1]-hito[k][1])
        if kyori < min_ten:
            min_ten = kyori
            min_num = p+1
    kekka.append(min_num)
for r in kekka:
    print(r)

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

int main(){
    int n;cin>>n;
    int A[n];
    rep(i,n)scanf("%d",&A[i]);
    int sum=0;
    rep(i,n)rep(j,n)rep(k,n){
        if(i<j&&j<k){
            if(A[i]==A[j]||A[j]==A[k]||A[i]==A[k])continue;
            if((long long)A[i]+A[j]+A[k]>2*max(A[i],max(A[j],A[k])))sum++;
        }
    }
    cout<<sum<<endl;
}

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

int main() {
  int N ;
  cin >> N ;
  
  long long sum=0;
  for(int i=1;i<=N; i++){
    if(i%3==0||i%5==0){
      continue;
    }
    else{
    sum+=i;
    }
    
    
    
    
    
   
  }
  
  cout << sum << endl;
}
    

Measured memory_bytes: 3624
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

# n = int(input())
# 
# s = input()

N, A, B = list(map(int, input().split()))
ans = (N // (A+B)) * A + min(A, N % (A+B))
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

int main() {
    string s, t; cin >> s >> t;
    int ans = INF;
    rep(i, sz(s)-sz(t)+1) {
        int tot = 0;
        rep(j, sz(t)) {
            if (t[j]!=s[i+j]) tot++;
        }
        debug(i, tot);
        chmin(ans, tot);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
/**
 *    author:  RM07
 *    created: August 22, 2020 9:03 PM
 *    motto: Knowledge is Power, Strive for Excellence
**/
#include<bits/stdc++.h>
using namespace std;
#define int long long 
signed main(){
    int n, x, t;
    cin >> n  >> x >> t;
    if(n%x) {
        int ans = n / x + 1;
        cout << ans * t << endl;
    } else {
        int ans = n / x;
        cout << ans * t  << endl;
    }
}

Measured memory_bytes: 3600
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

s=SI()
t=SI()
count=0
for i in range(len(s)):
    if s[i]!=t[i]:
        count+=1
print(count)

    
    
    

    
    


    
    

        
        
    


    

Measured memory_bytes: 9680
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

template <typename T>
inline T gi()
{
	T f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int INF = 0x3f3f3f3f, N = 100003, M = N << 2;

int n, v[N];
int tot, head[N], ver[M], nxt[M];
bool vis[N];
priority_queue <PII> q;

inline void add(int u, int v)
{
	ver[++tot] = v, nxt[tot] = head[u], head[u] = tot;
}

int main()
{
	//File("");
	n = gi <int> ();
	for (int i = 1; i < n; i+=1)
	{
		int u = gi <int> (), vv = gi <int> ();
		add(u, vv), add(vv, u);
	}
	int k = gi <int> ();
	for (int i = 1; i <= k; i+=1)
	{
		int u = gi <int> (), w = gi <int> ();
		vis[u] = true, v[u] = w;
		q.push(make_pair(-v[u], u));
	}
	while (!q.empty())
	{
		auto x = q.top(); q.pop();
		int u = x.second, w = -x.first;
		for (int i = head[u]; i; i = nxt[i])
		{
			int vv = ver[i];
			if (vis[vv] && (abs(v[vv] - w) != 1)) {puts("No"); return 0;}
			if (!vis[vv]) vis[vv] = true, v[vv] = w + 1, q.push(make_pair(-v[vv], vv));
		}
	}
	puts("Yes");
	for (int i = 1; i <= n; i+=1) printf("%d\n", v[i]);
	return 0;
}


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

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

const int MAX = 1e5 + 10;
const int INF = 1e9;
const int MOD = 1e9 + 7;

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

    vector<vector<int>> A(N, vector<int>(N));
    rep(i, N)rep(j, N) cin >> A[i][j];

    vector<vector<int>> D(N, vector<int>(N, 0));
    rep(i, N)rep(j, N) D[i][j] = A[i][j];

    rep(k, N)rep(i, N)rep(j, N) {
        D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
    }

    if (A != D) {
        puts("-1");
        return 0;
    }

    ll ans = 0;
    rep(i, N)rep(j, N) ans += D[i][j];

    rep(i, N)rep(j, N) {
        rep(k, N) {
            if (k == i || k == j) continue;
            if (D[i][j] == D[i][k] + D[k][j]) {
                ans -= D[i][j];
                break;
            }
        }
    }

    cout << ans / 2 << endl;
}

Measured memory_bytes: 1024
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;


void solve(long long N, long long K, long long S){
	const LL M=1e9;
	auto sp="";
	for(int i=0;i<N;i++){
		if(i<K){
			cout << sp << S;
		}
		else if(S==M){
			cout << sp << 1;
		}
		else{
			cout << sp << S+1;
		}
		sp = " ";
	}
	cout << endl;

}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    long long S;
    scanf("%lld",&S);
    solve(N, K, S);
    return 0;
}


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

int main()
{
	//freopen("/home/zz7/CFInput","r",stdin);
	int a,b,c;scanf("%d%d%d",&a,&b,&c);
	int ans=min(a,c);
	a-=ans,c-=ans;
	int u=min(b,c);b-=u,c-=u;ans+=2*u;
	if(c==0)ans+=b;
	else ans++;
	cout<<ans<<'\n';
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

ans=B[A[0]-1]
mae=A[0]
for i in range(1,N):
    ans+=B[A[i]-1]
    if A[i]-mae==1:
        ans+=C[mae-1]
    mae=A[i]

print(ans)

Measured memory_bytes: 9100
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        v: [i32; n],
        c: [i32; n],
    }
    let mut sum = 0;
    for i in 0..n{
        let dif = v[i] - c[i];
        if dif > 0 {
            sum += dif;
        }
    }
    println!("{}", sum);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

double dp[301][301][301];

double sushi(int x,int y,int z,int &n) {
    if(x<0 || y<0 || z<0) 
        return 0;
    if(x==0 && y==0 && z==0)
        return 0;
    if(dp[x][y][z] > -0.9)
        return dp[x][y][z];
    
    double exp = n + x*sushi(x-1,y,z,n) + y*sushi(x+1,y-1,z,n) + z*sushi(x,y+1,z-1,n);
    return dp[x][y][z] = exp/(x+y+z);

}

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

    int one=0;
    int two=0;
    int three=0;

    for (int i = 0; i < n; ++i)
    {
        int x;
        cin>>x;
        if(x==1)
            one++;
        else if(x==2)
            two++;
        else
            three++;
    }

    memset(dp,-1,sizeof dp);

    cout << fixed << setprecision(10) << sushi(one,two,three,n) << "\n";

    return 0;
}

Measured memory_bytes: 213376
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() { cin.tie(nullptr); ios_base::sync_with_stdio(false); }
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr> void dump(Itr begin, Itr end) { for (;begin != end; ++begin) clog << *begin << LF; }

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

  int ans = 0;
  for (int e : {25, 10, 5, 1}) {
    ans += n / e;
    n -= e * (n/e);
  }

  cout << ans << LF;

  return 0;
}




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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<float> a(n,0);
    for(int i=0; i<n; ++i) cin>>a[i];
    sort(a.begin(), a.end());
    float s=a[0];
    for(int i=1; i<n; ++i){
        s=(s+a[i])/2;
    }
    cout<<s;
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll       = long long;
const int MOD  = (int)(1e9 + 7);
const int MOD2 = 2019;
const int INF  = (int)(1e13 + 7);

template <class T = int>
int in() {
  T x;
  cin >> x;
  return x;
}
int bpm(int x, int y) {
  if (x == 0)
    return 0;
  else if (y == 0) {
    return 1;
  }
  int ans = 1;
  x %= MOD2;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) {
      ans *= x;
      ans %= MOD2;
    }
    x = x * x;
    x %= MOD2;
  }
  return ans;
}
#define MAX_ 500000
int inv_list[MAX_]; //inv_list[i-1] = inverse of i
int fac[MAX_];
int finv[MAX_];
void nCk_init() {
  inv_list[0] = fac[0] = finv[0] = 1;
  for (int i = 0; i < MAX_ - 1; i++) {
    inv_list[i + 1] = MOD - ((inv_list[(MOD % (i + 2)) - 1] * (MOD / (i + 2))) % MOD);
    fac[i + 1]      = (fac[i] * (i + 2)) % MOD;
    finv[i + 1]     = (finv[i] * inv_list[i + 1]) % MOD;
  }
}
int nCk(int n, int k) {
  if (n == k || k == 0) return 1;
  if (n < k) return 0;
  return (fac[n - 1] * ((finv[k - 1] * finv[n - k - 1]) % MOD)) % MOD;
}
class DMultipleOf2019 {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    string S;
    cin >> S;
    vector<int> T(S.size() + 1, 0);
    rep(i, S.size()) {
      T[S.size() - (i + 1)] = (T[S.size() - i] + bpm(10, i) * (S[S.size() - (i + 1)] - '0')) % MOD2;
    }
    vector<int> check(2019, 0);
    rep(i, T.size()) {
      check[T[i]]++;
    }
    int ans = 0;
    nCk_init();
    rep(i, 2019) {
      ans += nCk(check[i], 2);
    }
    cout << ans << endl;
  }
};


signed main() {
  DMultipleOf2019 solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 16916
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  int n;
  cin>>n;
  vector<int> a(n);
  REP(i,n) cin>>a[i];

  sort(ALL(a),greater<int>());

  int x=a[0],y;
  if(n==2) y=a[1];
  else{
    REP2(i,1,n){
      if(a[i]<x/2.0){
        if(i==1){
          y=a[i];
          break;
        }
        y=(a[i-1]-x/2.0>x/2.0-a[i])? a[i]:a[i-1];
        break;
      }
      if(i==n-1) y=a[n-1];
    }
  }
  cout<<x<<" "<<y<<endl;

  return 0;
}

Measured memory_bytes: 640