akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int A,B;cin>>A>>B;
  int ans=(B-A>=0?B-A:INF);
  if(-B+A>=0){
    ans=min(ans,-B+A+2);
  }
  if(B+A>=0){
    ans=min(ans,B+A+1);
  }
  if(-B-A>=0){
    ans=min(ans,-B-A+1);
  }
  print(ans);




}


Measured memory_bytes: 256
s=input()
n=len(s)
def p(s):
  return s==s[::-1]
if p(s):
  if p(s[:(n-1)//2]):
    if p(s[(n+1)//2:]):
      print('Yes')
      exit()
    else:
      print('No')
      exit()
print('No')

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

char func(string s,int i){
  return s[i];
}

int main(){
  string A,B,C,ANS="a";
  cin>>A>>B>>C;
  int a=0,b=0,c=0;
  while(1){
    if(ANS=="a"){
      ANS=func(A,a);
      a++;
    }else if(ANS=="b"){
      ANS=func(B,b);
      b++;
    }else if(ANS=="c"){
      ANS=func(C,c);
      c++;
    }
    if(a==A.size()&&ANS=="a"){
      cout<<"A"<<endl;
      break;
    }else if(b==B.size()&&ANS=="b"){
      cout<<"B"<<endl;
      break;
    }else if(c==C.size()&&ANS=="c"){
      cout<<"C"<<endl;
      break;
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;


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

    set<int> st;
    st.insert(s);
    
    for(int i=2;i<=1000000;i++){
        if(s%2==0)
            s/=2;
        else
            s=3*s+1;
        if(st.count(s)==1){
            cout<<i<<endl;
            return 0;
        }
        st.insert(s);
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    for(int i = 1; i <= 100000; i++){
      int x = (int)(i * 0.08);
      int y = (int)(i * 0.1);
      if(x == A && y == B){
        System.out.println(i);
        return;
      }
    }
    System.out.println(-1);
  }
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amin(T& a,T b){ a=min(a,b);}
template <class T> void amax(T& a,T b){ a=max(a,b);}

int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	const int MXZ=100050;
	int k,n;
	cin >> n >>k;
	VI d(n), t(n), dt(MXZ, -1);
	rep(i,n) cin >>t[i] >>d[i];
	{
		vector<pii> vp(n);
		rep(i,n) vp[i] = pii(d[i], t[i]);
		sort(vp.rbegin(), vp.rend());
		rep(i,n){
			tie(d[i], t[i])=vp[i];
			if(dt[t[i]]<0) dt[t[i]]=i;
		}
	}
	vector<bool> usd(MXZ), uss(MXZ);
	priority_queue<pii> pdel, padd;
	ll cnd=0;
	rep(i, k){
		cnd += d[i];
		uss[t[i]] = usd[i] = 1;
		if(dt[t[i]] !=i) pdel.push(pii(-d[i], i));
	}
	ll wz=0;
	rep(i,MXZ) wz += uss[i]==1;
	cnd += wz * wz;
	//dbg("1stcnz",cnd,wz);
	ll ans = cnd;
	for(int q: dt) if(q>=0 && !usd[q]) padd.push(pii(d[q], q));
	
	while(1){
		int dlc=-1, adc=-1;
		while(!pdel.empty() && dlc<0){
			auto p1= pdel.top().second; pdel.pop();
			if(usd[p1]) dlc = p1;
		}
		while(!padd.empty() && adc<0){
			auto p1= padd.top().second; padd.pop();
			if(!usd[p1] && !uss[t[p1]]) adc =p1;
		}
		if(dlc<0 || adc<0) break;
		
		cnd -= d[dlc]; usd[dlc]=0;
		cnd += d[adc]; usd[adc] =uss[t[adc]]=1;
		cnd += (wz+1)*(wz+1) - wz*wz;
		wz++; 
		//dbg(cnd,wz);
		ans = max(ans, cnd);
	}
	cout << ans <<"\n";
	return 0;
}

Measured memory_bytes: 2416
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
using namespace std;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

template<typename ...Ts>
void show(Ts... ts){
  cout<<"#:";
  auto print=[](auto v){cout<<v<<" ";};
  initializer_list<int>{(void(print(ts)),0)...};
  cout<<endl;
}


vector<int> subv(vector<int> s,int n,int d){
    vector<int> rt;
    rep(i,d)rt.push_back(s[n+i]);
    return rt;
}

void solve(vector<int> a){
    int n = a.size();
    vector<int> b=a;
    sort(all(b));
    int m1=b[n/2-1];
    int m2=b[n/2];
    rep(i,n){
        if(a[i]>=m2){
            cout<<m1<<endl;
        }else{
            cout<<m2<<endl;
        }
    }
    return;
}


int main(void){
    int n,ans=0;
    cin>>n;
    vector<int> t(n,0);
    rep(i,n)cin>>t[i];
    solve(t);
}

Measured memory_bytes: 4608
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)

# iの箱にボールが入っているなら1
ball = Array.new(n,0)
# ボールを入れる箱の番号
b = []

# nから順にボールを入れるか決定する
n.step(1,-1) do |i|
    if i > n/2 
        if a[i-1] == 1
            ball[i-1] = 1
            b.push(i)
        end
    else
        cnt = 0
        i.step(n,i) do |j|
            if ball[j-1] == 1
                cnt += 1
            end
        end
        mod = cnt%2
        if a[i-1] != mod
            ball[i-1] = 1
            b.push(i)
        end
    end
end

m = b.size
puts m
if m > 0
    puts b.join(' ')
end

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

int main() {
  int N;
  cin >> N;
  int count=0;
  for (int i=0; i<N; i++){
    int a;
    cin >> a;
    if (i%2==0 && a%2==1) count++;
  }

  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3560
#include <stdio.h>
 
int main()
{
  int a,b;
  scanf("%d %d",&a,&b);
  if (a + b >= a - b && a + b >= a*b)
    printf("%d",a+b);
  else if (a - b >= a + b && a - b >= a*b)
    printf("%d",a-b);
  else
    printf("%d",a*b);
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;

const int Mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007

#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl

#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

void solve()
{
    ll n;
    vector< pll> ev,od;
    map<ll,ll>m;

    cin>>n;

    ll a[n];///main array
    for(ll i=0; i<n; i++)
        cin>>a[i];

    for(ll i=0; i<n; i+=2) ///even index access
        m[a[i]]++;
    for(auto i:m)
    {
        ev.pb({i.S,i.F});///storing frequencies with their numbers
    }

    m.clear();

    for(ll i=1; i<n; i+=2) ///odd indexes access
        m[a[i]]++;
    for(auto i:m)
    {
        od.pb({i.S,i.F});///storing frequencies with their numbers
    }

    sort(rbe(ev));
    sort(rbe(od));

    if(ev[0].S!=od[0].S)///sequentially not both max numbers are same
    {
            cout<<n-(ev[0].F+od[0].F)<<nl;
    }
    else///sequentially both max numbers are same
    {
        ll s1=INT_MAX,s2=INT_MAX;
        
        if(sz(ev)>1)///if 2nd max available on even vector
        {
                s1=n-(ev[1].F+od[0].F);
        }
        
        if(sz(od)>1)///if 2nd max available on odd vector
        {
                s2=n-(ev[0].F+od[1].F);
        }
        
        s1=min(s1,s2);///dutor moddhe min niye
        
        s2=min((n-ev[0].F),(n-od[0].F));///if no 2nd max then taking all even pos or all odd pos and finding the min of them
        
        s1=min(s1,s2);
        
        cout<<s1<<nl;
    }
}

int main()
{
    fio;
    solve();
    return 0;
}


Measured memory_bytes: 9444
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn=1e5+10;
LL L[3*maxn];
LL R[3*maxn];
int a[3*maxn];
int n;
int main()
{
	priority_queue<int,vector<int>,greater<int> > Q;
	scanf("%d",&n);
	LL sum=0;
	for(int i=1;i<=3*n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
	{
		sum+=(LL)a[i];
		Q.push(a[i]);
		L[i]=sum;
	}
	for(int i=n+1;i<=2*n;i++)
	{
		if(a[i]>Q.top())
		{
			sum-=(LL)Q.top();
			Q.pop();
			sum+=(LL)a[i];
			Q.push(a[i]);
		}
		L[i]=sum;
	}

	sum=0;
	priority_queue<int>P;
	for(int i=3*n;i>2*n;i--)
	{
		sum+=(LL)a[i];
		P.push(a[i]);
		R[i]=sum;
	}
	for(int i=2*n;i>n;i--)
	{
		if(a[i]<P.top())
		{
			sum-=(LL)P.top();
			P.pop();
			sum+=(LL)a[i];
			P.push(a[i]);
		}
		R[i]=sum;
	}
	LL ans=-1e20;
	for(int i=n;i<=2*n;i++)
		ans=max(ans,L[i]-R[i+1]);
	printf("%lld",ans);
	return 0;
}


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

#define inf 0x3f3f3f3f
#define pi acos(-1)
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(),a.end()
template<class T> bool mmin(T &a,T b){return (a>b ?(a=b,true):false);};
template<class T> bool mmax(T &a,T b){return (a<b ?(a=b,true):false);};

int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin >> n >> m;
	if(n>=m){
		puts("10");
	}else
		puts("0");
#ifdef LOCAL_DEFINE
	cerr << "\nTime: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}




















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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll d, n;
  cin >> d >> n;

  if(n == 100)
    n++;
  ll ans = n;
  ans *= pow(100, d);
  cout << ans << endl;
  
}


Measured memory_bytes: 512
//According to all known laws of aviation, there is no way that a bee should be able to fly.
//Its wings are too small to get its fat little body off the ground. The bee, of course, flies anyway.
//Because bees don't care what humans think is impossible.
#include <bits/stdc++.h>
#define FAST_IO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define endl "\n"
using namespace std ;
using bigint = long long int ;
using vi = vector<int> ;
bigint arr[300011] ;
int main(){
    int N ; cin >> N ;
    for( int i = 0 ; i < N ; i++ )
        cin >> arr[i] ;
    bigint ans = 0 ;
    bigint two = 1 ;
    for( bigint i = 0 ; i < 61 ; i++ ){
        bigint set = 0 , K = ( 1LL << i ) ;
        for( int j = 0 ; j < N ; j++ ){
           if( arr[j] & K )
               set++ ;
        }
        bigint A = set * ( N - set ) % mod ;
        ans += A * two ;
        ans %= mod ;
        two = two * 2 % mod  ;
    }
    cout << ans << endl ;
    return 0 ;
}


Measured memory_bytes: 5940
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include<set>
#include<queue>
#include <iomanip>

typedef long long ll;

#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h,n, w,m,t; string s;
ll R, C;
ll sy, sx, gy, gx;
char maze[20][20];
ll dis[20][20];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}

ll bfs() {
	queue<P> que;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) dis[i][j] = INF;
	}
	que.push(P(sy - 1, sx - 1));
	dis[sy - 1][sx - 1] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == gy - 1 && p.second == gx - 1) break;
		for (ll i = 0; i < 4; i++) {
			ll ny = p.first + dy[i];
			ll nx = p.second + dx[i];
			if (0 <= ny && ny < R && 0 <= nx && nx < C && maze[ny][nx] == '.' && dis[ny][nx] == INF) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	return dis[gy - 1][gx - 1];
}
ll dp[20500];
int main() {
	ll a, b;
	cin >> a >> b;
	for (double i = 1; i<=2000; i++) {
		if (floor(i * 0.08) == a && floor(i * 0.1) == b) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}



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

enum State {
    NOT,
    VISITING,
    VISITED,
};

int main() {
    int N, M;
    std::cin >> N >> M;

    std::vector<int> v[N];
    int a[M], b[M];
    for (int i = 0; i < M; ++i) {
        std::cin >> a[i] >> b[i];
        a[i] -= 1;
        b[i] -= 1;

        v[a[i]].push_back(b[i]);  
        v[b[i]].push_back(a[i]);  
    } 

    int bridges = 0;
    for (int i = 0; i < M; ++i) {
        int visited[N] = {NOT};

        const std::vector<int>& vv= v[0];
        std::queue<int> que;
        for (int n : vv) {
            if (a[i] == 0 && b[i] == n) {
                continue;
            } 
            que.push(n);
            visited[n] = VISITING;
        }
        
        visited[0] = VISITED;
        while (que.empty() == false) {
            int index = que.front(); que.pop();
            const std::vector<int> vvv = v[index];
            for (int n : vvv) {
                if ((a[i] == index && b[i] == n) || (b[i] == index && a[i] == n) || (visited[n] == VISITED || visited[n] == VISITING)) {
                    continue;
                } 
                que.push(n);
                visited[n] = VISITING;
            }
            
            visited[index] = VISITED;
        }

        bool flag = false;
        for (int j = 0; j < N; ++j) {
            if (visited[j] != VISITED) {
                flag = true;
                break;
            } 
        }

        if (flag) {
            bridges++;
        }
    }
    
    std::cout << bridges << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;

void factor(int n,int arr[]){
	for(int i=2;i<=n;i++){
		if(n%i==0){
			arr[i]+=1;
			factor(n/i,arr);
			break;
		}
		
	}
}

int main() {
	int n;
	cin>>n;
	int arr[n+1]={0};
	for(int i=1;i<=n;i++){
		factor(i,arr);
	}
	long int result=1;
	for(int i=0;i<=n;i++){
		if(arr[i]>0){
			result*=arr[i]+1;
			result=result%(1000000000+7);
		}
   }
   cout<<result;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,x[10],y[10];
double a,b,c;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>x[i]>>y[i];
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(i==j) continue;
			a=abs(x[i]-x[j]);
			b=abs(y[i]-y[j]);
			c+=sqrt(a*a+b*b);
		}
	}
	printf("%5.10f",c/n);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int a,b;
	scanf("%d",&a);
	scanf("%d",&b);
	
	if(a<b)
	{
		printf("a < b\n");
	}
	else if(a>b)
	{
		printf("a > b\n");
	}
	else if(a=b)
	{
		printf("a == b\n");
	}
	
	return 0;
}



Measured memory_bytes: 2120
#include<iostream>
#include<string>
using namespace std;
int main() {

	string s;
	cin >> s;
	int a = stoi(s.substr(0,4));
	int b = stoi(s.substr(5, 2));
	int c = stoi(s.substr(8, 2));
	bool ans = true;
	if (a <= 2019) {
		if (b <= 4)ans = false;
	}
	if (ans)cout << "TBD" << endl;
	else cout << "Heisei" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b >= c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


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

int main(void){
  int n;
  while(cin>>n,n){
    int a,b,t;
    b = t = 0;
    for(int i = 0 ; i < n ; i ++){
      cin >> a;
      if(a >= 1) b ++;
      if(a >= 2)t ++;    
    }
    if(t==0)cout<<"NA"<<endl;
    else cout<<b+1<<endl;
  }
}

Measured memory_bytes: 1164
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    var ans = ""
    next().toList().forEach {
        when(it) {
            '0' -> ans += it
            '1' -> ans += it
            else -> ans = ans.dropLast(1)
        }
    }
    println(ans)
}

fun next() = readLine()!!

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 33704
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e2 + 10;

int main() {
	fast_cin();
	int n; cin >> n;
	vector<pii> edges;
	if (n % 2 == 0) {
		for (int i = 1; i <= n; ++i) {
			for (int j = i + 1; j <= n; ++j) {
				if (i + j != n + 1) {
					edges.pb({i, j});
				}
			}
		}
	} else {
		for (int l = 0, r = n; l < r; ++l, --r) {
			for (int i = l + 1; i < r; ++i) {
				if (l) {
					edges.pb({l, i});
				}
				edges.pb({r, i});
			}
		}
	}
	cout << edges.size() << endl;
	for (auto &p : edges) {
		cout << p.first << ' ' << p.second << endl;
	}
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <functional>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(){
	int n, q, k;
	std::vector<long> a;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

#if INPUT_FROM_FILE
	ifs >> n;
#else
	std::cin >> n;
#endif
	
	a.resize(n);
	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		ifs >> a[i];
#else
		std::cin >> a[i];
#endif
	}

#if INPUT_FROM_FILE
	ifs >> q;
#else
	std::cin >> q;
#endif

	for(int i = 0; i < q; i++){
#if INPUT_FROM_FILE
		ifs >> k;
#else
		std::cin >> k;
#endif
		std::vector<long>::iterator lit = std::lower_bound(a.begin(), a.end(), k);
		std::vector<long>::iterator uit = std::upper_bound(a.begin(), a.end(), k);
		std::cout << (lit - a.begin()) << " " << (uit - a.begin()) << std::endl;
	}
	return 0;
}


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

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

    for(int i=0; y-i*10000 >= 0 && i <= n; i++){
        for(int j=0,k; y-i*10000-j*5000 >= 0 && i+j <= n; j++){
            k = n - i - j;
            if(k*1000 + j*5000 + i*10000 == y){
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll H, W;
    cin >> H >> W;
    vector<string> S(H);
    REP(i,0,H) cin >> S[i];

    mat L(H, vec(W, 0));
    mat R(H, vec(W, 0));
    mat U(H, vec(W, 0));
    mat D(H, vec(W, 0));
    ll c;

    REP(i,0,H) {
        c = 0;
        REP(j,0,W) {
            if(S[i][W-1-j] == '.') ++c;
            else c = 0;
            L[i][W-1-j] = c;
        } 
    }
    REP(i,0,H) {
        c = 0;
        REP(j,0,W) {
            if(S[i][j] == '.') ++c;
            else c = 0;
            R[i][j] = c;
        } 
    }
    REP(j,0,W) {
        c = 0;
        REP(i,0,H) {
            if(S[H-1-i][j] == '.') ++c;
            else c = 0;
            U[H-1-i][j] = c;
        } 
    }
    REP(j,0,W) {
        c = 0;
        REP(i,0,H) {
            if(S[i][j] == '.') ++c;
            else c = 0;
            D[i][j] = c;
        } 
    }

    ll m = 0;
    REP(i,0,H) {
        REP(j,0,W) {
            m = MAX(m,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3);
        }
    }
    PR(m);

    return 0;
}

/*



*/

Measured memory_bytes: 136252
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int x;
  cin >> x;
  int ans = 0;
  while(1){
    if(x >= 500){
      ans += (x / 500) * 1000;
      x -= (x/500) *500;
    }else{
      if(x >= 5){
        ans += (x / 5) * 5;
        x -= (x/5)*5;
      }
    }
    if(x < 5){
      break;
    }
  }
  cout << ans;
}

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

int main() {
	// your code goes here
	int N;
	cin >> N;
	int A[N];
	for(int i = 0; i < N; ++i){
		cin >> A[i];
	}
	
	int cnt = 0;
	bool flag = true;
	while(flag){
		flag = false;
		for(int j = N - 1; j >= 1; --j){
			if(A[j] < A[j - 1]){
				swap(A[j], A[j - 1]);
				++cnt;
				flag = true;
			}
		}
	}
	for(int i = 0; i < N - 1; ++i) cout << A[i] << " ";
	cout << A[N - 1] << endl;
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 1164
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#define RG register

inline int read()
{
	int data = 0, w = 1; char ch = getchar();
	while(ch != '-' && (!isdigit(ch))) ch = getchar();
	if(ch == '-') w = -1, ch = getchar();
	while(isdigit(ch)) data = data * 10 + (ch ^ 48), ch = getchar();
	return data * w;
}

const char s[] = "RGBY";
int n, m, d;

int main()
{
	n = read(), m = read(), d = read();
	for(RG int i = 0; i < n; i++, putchar('\n'))
		for(RG int j = 0, x, y; j < m; j++)
			x = (m + i + j) / d % 2,
			y = (m + i - j) / d % 2,
			putchar(s[2 * x + y]);
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void solve(){
    string s;
    int n;
    cin>>n;
    cin>>s;
    for (int i=0;s[i]!=NULL;i++){
        if (s[i]+n>90)
        {
            cout<<char((s[i]+n)-26);
        }
        else
        cout<<char((s[i]+n));
}
}
int main(){
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//二項係数の計算
int nCr(int A, int B) {
    ll ans = 1;
    for (int i = 0; i < B; i++) {
        ans *= A - i;
    }
    for (int i = 0; i < B; i++) {
        ans /= i + 1;
    }
    return ans;
}
int main() {
    int N;
    cin>>N;
    vector<int>p(N);
    int ans=0;
    rep(i,N){
        cin>>p[i];
    }
    rep(i,N){
        if(i==0||i==N-1){
        }
        else{
            if(p[i]<p[i-1]&&p[i+1]<p[i]){
                ans++;
            }
            else if(p[i]<p[i+1]&&p[i-1]<p[i]){
                ans++;
            }
        }
    }
        cout<<ans<<endl;
    
}


Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <random>
#include <cassert>
#include <numeric>
#define ll long long int
#define LL unsigned long long
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;



int main() {
    int n; cin >> n;
    vector<ll> a(3*n);
    rep(i,3*n) cin >> a[i];
    sort(a.rbegin(),a.rend());

    ll ans = 0, j = 0;
    for(int i = 1; i < 3 * n && j < n; i+=2){
        ans += a[i];
        j++;
    }
    cout << ans << endl;
}


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

int main(){
    int a, b, c, x, cnt=0;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> x;
    for(int i=0; i<a+1; i++){
        for(int j=0; j<b+1; j++){
            for(int k=0; k<c+1; k++){
                if(k*50+j*100+i*500==x) cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque

n = int(input())
path = {}
for i in range(n-1):
    a, b, c = list(map(int, input().split()))
    if not a in path.keys():
        path[a] = [(b, c)]
    else:
        path[a].append((b, c))
    if not b in path.keys():
        path[b] = [(a, c)]
    else:
        path[b].append((a, c))
q, k = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(q)]

dist = [None]*(n+1)
dist[k] = 0
que = deque([(k, 0)])
while len(que) > 0:
    node, d = que.popleft()
    dist[node] = d
    for node_next, d_next in path[node]:
        if dist[node_next] is None:
            que.append((node_next, d+d_next))
# print(dist)

for x, y in xy:
    print(dist[x]+dist[y])

Measured memory_bytes: 78052
#include <bits/stdc++.h>
#define mp std::make_pair

std::string s1,s2;
int memo[3001][3001];
std::pair<int, int> par[3001][3001];

int LCS(int n, int m)
{
	if(!n || !m)
	return 0;
	if(memo[n][m] != -1)
	return memo[n][m];
	int ans = 0;
	if(s1[n-1] == s2[m-1])
	{	
		par[n][m] = mp(n-1, m-1);
		ans = 1 + LCS(n-1, m-1);
	}	
	else if(LCS(n-1, m) > LCS(n, m-1))
	{
		par[n][m] = mp(n-1, m);
		ans = LCS(n-1, m);
	}	
	else
	{
		par[n][m] = mp(n, m-1);
		ans = LCS(n, m-1);
	}
	memo[n][m] = ans;
	return ans;
}

int main(void)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	memset(memo, -1, sizeof(memo));
	std::cin>>s1>>s2;
	int n = (int)s1.size();
	int m = (int)s2.size();
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=m;j++)
		par[i][j] = mp(i, j);	
	}	
	int ans = LCS(n, m);
	int sz1 = n, sz2 = m;
	std::stack<char> Z;
	while(sz1 && sz2)
	{
		int st1 = par[sz1][sz2].first;
		int st2 = par[sz1][sz2].second;
		if(st1 == sz1-1 && st2 == sz2-1)
		Z.push(s1[sz1-1]);
		sz1 = st1;
		sz2	= st2;
	}	
	while(!Z.empty())
	{
		std::cout<<Z.top();
		Z.pop();
	}	
	std::cout<<"\n";
	return 0;
}

Measured memory_bytes: 106240
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int n1,commandNum,b,m,e;
    cin >> n1;
    vector<int>a1(n1),a2(n1);
    for(int i = 0;i < n1;++i){
        cin >> a1[i];
        a2[i] = a1[i];
    }
    cin >> commandNum;
    for(int i = 0;i < commandNum;++i){
        cin >> b >> m >> e;
        // 左側文字列を右側に代入する
        for(int k = b;k < b + (m - b);++k){
            int moveIndex = k + e - m;
            a2[moveIndex] = a1[k];
        }
        // 右側文字列を左側に代入する
        for(int k = m;k < e;++k){
            int moveIndex = k + b - m;
            a2[moveIndex] = a1[k];
        }
        copy(a2.begin(),a2.end(),a1.begin());
    }
    for(int i = 0;i < n1;++i){
        if(i) cout << " ";
        cout << a2[i];
    }
    cout << endl;
}


Measured memory_bytes: 3144
/*
    Author:zzugzx
    Lang:C++
    Blog:blog.csdn.net/qq_43756519
*/
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int mod=1e9+7;
//const int mod=998244353;
const double eps = 1e-10;
const double pi=acos(-1.0);
const int maxn=1e6+10;
const ll inf=0x3f3f3f3f;
const int dir[4][2]={{0,1},{1,0},{0,-1},{-1,0}};

ll a[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    long double a,b;
    cin>>a>>b;
    a=a*b;
    string s=to_string(a);
    for(int i=0;i<s.length();i++){
        if(s[i]=='.')break;
        cout<<s[i];
    }
    return 0;
}


Measured memory_bytes: 3848
def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = 0
    m0 = 10**9+7
    Ar = [0]*N
    sum0 = 0
    for i in reversed(range(N)):
        sum0 = (sum0 + A[i]) % m0
        Ar[i] = sum0

    for i in range(N-1):
        ans = (ans + A[i] * Ar[i+1]) % m0
    print(ans)

if __name__ == '__main__':
    main()

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;
const ll 	N 		= 	2*1e6;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,y,m,q,k,w;
string s,t;
vll a,b,c;
// <------------- Implement Functions Here ----------> //

ll dp[200][200000];

ll solve(ll i, ll wt) {
	if(wt > w) return -INF;
	if(i == n) return 0;

	if(dp[i][wt]!=-1) {
		return dp[i][wt];
	}

	return dp[i][wt] = max({solve(i+1,wt), solve(i+1,wt+a[i]) +b[i]});
}

// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> w;

	a = vll(n);
	b = vll(n);

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

	memset(dp,-1,sizeof(dp));

	cout<<solve(0,0);
}

int main() {
	fastio;randomINT;
	//cin>>T;
	while(T--) {
		MAIN();
	}
	return 0;
}



Measured memory_bytes: 550500
#include <iostream>
#include <algorithm>
#include <functional>

int n;
int a[100005];

int main() {
    std::ios::sync_with_stdio(false), std::cin.tie(nullptr), std::cin.tie(nullptr);
    std::cin >> n;
    for (int i = 1; i <= n; ++i) std::cin >> a[i];
    std::sort(a + 1, a + n + 1, std::greater<int>());
    for (int i = 1; i <= n; ++i)
        if (a[i + 1] < i + 1) {
            int flag = (a[i] - i) & 1;
            for (int j = i; j <= n; ++j)
                if (a[j + 1] < i) {
                    flag |= (j - i) & 1;
                    break;
                }
            std::cout << (flag ? "First" : "Second") << std::endl;
            return 0;
        }
}


Measured memory_bytes: 4060
#include<bits/stdc++.h>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;
#define ps(x,y)         fixed<<setprecision(y)<<x //how much precision is required

#define PI 3.1415926535897932384626


int main()
{

int R;
cin>>R;
double ans;
ans=2*PI*R;  
cout<<ps(ans,25);  
}
 

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

int n;

int tab[1000007];
int x;

int wyn;

int naj(int v)
{
	int ret=0;
	while(v)
	{
		ret++;
		v>>=1;
	}
	return ret;
}

int main()
{
	scanf("%d", &n);
	for (int i=1; i<=n; i++)
	{
		scanf("%d", &tab[i]);
		x^=tab[i];
		tab[i]^=tab[i]-1;
	}
	sort(tab+1, tab+1+n);
	for (int i=n; i; i--)
	{
		if (naj(x)==naj(tab[i]))
		{
			wyn++;
			x^=tab[i];
		}
	}
	if (x)
		printf("-1\n");
	else
		printf("%d\n", wyn);
	return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <deque>
#include <iostream>
#include <vector>

#define FOR(i, b, e) for(int i=(b);i<(e);i++)
#define REP(i, n) FOR(i,0,n)

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;

int N;
VI P;

int main() {
    int max = 1, min = 1000000;
    int ans = 0;
    cin >> N;
    P = VI(N);
    REP(i, N) {
        cin >> P[i];
    }
    REP(i, N) {
        if (min >= P[i]) {
            ans++;
        }
        if (P[i] > max) {
            max = P[i];
        }
        if (P[i] < min) {
            min = P[i];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
    double x1,y1,x2,y2,x3,y3,xp,yp;
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) == 8) {
        double pax = x1 - xp, pay = y1 - yp, pbx = x2 - xp, pby = y2 - yp, pcx = x3 - xp, pcy = y3 - yp;
        double n1 = pax * pby - pay * pbx, n2 = pbx * pcy - pby * pcx, n3 = pcx * pay - pcy * pax;
        if((n1 <= 0.0 && n2 <= 0.0 && n3 <= 0.0) || (n1 > 0.0 && n2 > 0.0 && n3 > 0.0)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 0
n=int(input())
w=list(map(int,input().split()))
S=sum(w)
ans=10000
for i in range(n-1):
    s1=0
    s2=0
    for p in range(i+1):
        s1+=w[p]
    for q in range(i+1,n):
        s2+=w[q]
    if abs(s1-s2)<ans:
        ans=abs(s1-s2)
print(ans)

Measured memory_bytes: 9188
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


int main(void) {
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i, n) cin >> d[i];
  ll ans = 0;
  rep(i, n) {
    for(int j = i+1; j < n; ++j) {
      ans += (d[i] * d[j]);
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n=int(input())
A=list(map(int,input().split()))
m=max(A)+1
B=A[:]
C=[0]*m
for a in A:C[a]+=1
for i in range(1,m):C[i]+=C[i-1]
for j in A[::-1]:B[C[j]-1]=j;C[j]-=1
print(*B)


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

using namespace std;

#define int long long
#define MOD 1000000007

#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 (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int N;

vector<string> fun(char x, string temp)
{
    char maxc = temp[0];

    rep(i, temp.size())
    {
        if (maxc < temp[i + 1])
        {
            maxc = temp[i + 1];
        }
    }

    x = maxc;
    vector<string> ans;

    char y = 'a';

    while (y <= x + 1)
    {
        string b{y};
        ans.pb(temp + b);
        y = y + 1;
    }
    return ans;
}

signed main()
{
    cin >> N;

    vector<string> a;
    a.pb("a");

    vector<vector<string>> ans(N);

    ans[0] = a;

    rep1(i, N)
    {
        for (auto y : ans[i - 1])
        {
            vector<string> b = fun(y[y.size() - 1], y);
            for (auto x : b)
            {
                ans[i].pb(x);
            }
        }
    }
    for (auto x : ans[N - 1])
    {
        cout << x << endl;
    }

    return 0;
}


Measured memory_bytes: 11380
_,_,m = gets.split.map(&:to_i)
list_a = gets.split.map(&:to_i)
list_b = gets.split.map(&:to_i)
min = list_a.min + list_b.min
m.times do
  ia,ib,d = gets.split.map(&:to_i)
  min = [min,list_a[ia-1] + list_b[ib-1] - d].min
end
puts min


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

int main(){
    string s;
    bool flag = false;
    cin >>s;

    if (s.find("hi") == std::string::npos) {
        cout <<"No" <<endl;
        return 0;
    }
    if(s.length()%2){
        cout <<"No" <<endl;
        return 0;
    }


    for(int i=0;i<s.length()/2;i++){
        if(s[i*2] == 'h' && s[i*2+1] == 'i'){
            flag = true;
        } else {
            flag = false;
            break;
        }
    }
    if(flag){
        cout << "Yes" <<endl;
    } else {
        cout <<"No" <<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
using vl= vector<ll>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()
//13:20
int main(){
  int n,ans=0,totu;
  bool tmp;
  cin >> n;
  vi h(n);
  rep(i,0,n){
    cin >> h[i];
  }
  while(1){
    totu=0;
    tmp=false;
    rep(i,0,n){
      if(0<h[i] && !tmp){
        totu++;
        tmp=true;
      }else if(h[i]<=0 && tmp){
        tmp=false;
      }
      h[i]--;
    }
    ans+=totu;
    if(totu==0){
      break;
    }
  }
  cout << ans;
  
  return 0;
}


Measured memory_bytes: 256
def p(k,w,maxP):
    count = 1
    tmpWeight = 0
    for x in w:
        if tmpWeight+x <= maxP:
            tmpWeight += x
        else:
            count += 1
            if count > k :
                return False
            tmpWeight = x
    

    return True




n,k = map(int,input().split())


w = []

for _ in range(n):
    w.append((int)(input()))
rangeMax = sum(w)
rangeMin = max(w)
rangeMid = 0
while rangeMin < rangeMax:
    rangeMid = (rangeMax + rangeMin)//2
    '''print(p(k,w,rangeMid))
    print(p(k,w,rangeMid+1))
    print("---")
    '''
    if p(k,w,rangeMid) == True:
        rangeMax = rangeMid
    else:
        rangeMid += 1
        rangeMin = rangeMid

print(rangeMid)

Measured memory_bytes: 11600
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int x,i,n,m,a,b,c;
    while(~scanf("%d %d %d",&a,&b,&c))
    {

        if(c<=b&&c>=a)
        {
            printf("Yes\n",x);
        }
        else
        {
            printf("No\n");
        }
    }
    return 0;
}


Measured memory_bytes: 128
i,o,t,j,l,s,z = map(int, input().split())
k = o
p = (i//2 + j//2 + l//2)*2
q = 0
if i*j*l:
  q = ((i-1)//2 + (j-1)//2 + (l-1)//2)*2 + 3
print(k + max(p, q)) 


Measured memory_bytes: 2940
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;
using ll = long long;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

int main()
{
	int x, y, z, c = 0;

	cin >> x >> y >> z;

	for (int i = 0; i <= x - z; i += y + z) {
		c++;
	}

	cout << c - 1 << endl;

	return 0;
}

Measured memory_bytes: 256
function Main(input){
  input = input.split("\n");
  inputStr = input[0].split(" ");
  var N = Number.parseInt(inputStr[0]);
  //入力値Lを数値化して配列に放り込む
  inputStr = input[1].split(" ");
  var L_arr = inputStr.map( inputStr => parseInt(inputStr));
  //L_arrをソート
  L_arr.sort(function(a,b){
    if( a < b ) return -1;
    if( a > b ) return 1;
    return 0;
  });
  var flg=true;
  for( i=0 ; i<N-1 ; i++){
    if(L_arr[i]===L_arr[i+1]){
      flg=false;
      break;
    }
  }
  if(flg===true){
    console.log('YES');
  } else {
    console.log('NO');
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 34588
import math
r = 10000
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for j in range(2*i+1,r,i+1)]

while True:
    try:
        n = int(raw_input())
        count = 0
        for i in range(n):
            if p[i]*p[n-i-1] == 1:
                count += 1
        print count
    except:
        break

Measured memory_bytes: 4740
# include <iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n];
	int b[n];
	for(int i=1; i<=n; i++)
	{
		cin>>a[i];
		b[a[i]]=i;
	}
	for(int i=1; i<=n; i++)
	{
		cout<<b[i]<<" ";
	}
}

Measured memory_bytes: 4384
#include<iostream>
//#include<cstdio>
//#include<cmath>
using namespace std;
int main(){
  int a,c;
  char b;
  while(1){
    cin >> a >> b >> c;
    if(b=='+')cout<<a+c<<endl;
    else if(b=='-')cout<<a-c<<endl;
    else if(b=='*')cout<<a*c<<endl;
    else if(b=='/')cout<<a/c<<endl;
    else if(b=='?')break;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> answer;
    vector<int> v(n, 0);
    for (int i = n; i > 1; --i) {
        if (a[i - 1] != v[i - 1]) {
            answer.push_back(i);
            v[i - 1] = 1 - v[i - 1];
            for (int j = 1; j <= sqrt(i); ++j) {
                if (i % j == 0) {
                    v[j - 1] = 1 - v[j - 1];
                    if (j * j != i) {
                        v[i / j - 1] = 1 - v[i / j - 1];
                    }
                }
            }
        }
    }
    if (a[0] != v[0]) answer.push_back(1);

    reverse(answer.begin(), answer.end());
    cout << answer.size() << endl;
    if (!answer.empty()) {
        for (int i = 0, size = answer.size(); i < size; ++i) {
            cout << answer[i];
            if (i < size - 1) cout << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 3064
import queue

K = int(input())

Q = queue.Queue()
for i in range(1, 10):
    Q.put(i)

for i in range(K-1):
    x = Q.get()
    if x%10 != 0:
        Q.put(10*x+x%10-1)
    Q.put(10*x+x%10)
    if x%10 != 9:
        Q.put(10*x+x%10+1)
print(Q.get())

Measured memory_bytes: 12452
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  int N, K;
  cin >> N >> K;
  long double result = 0, f = (long double)1.0 / N;
  F0R(i, N) {
    int a = i + 1, b = 1;
    while (a < K) {
      a <<= 1;
      b <<= 1;
    }
    result += f / b;
  }
  cout << result;
}
#endif


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

using namespace std;

typedef long long ll;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  string a, b, c;
  int d;
  cin >> a >> b >> c;
  istringstream iss(a + b + c);
  iss >> d;
  cout << (d % 4 == 0 ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256