akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
# define PI  3.14159265358979323846
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		long double sum;
		cin >> sum;
		cout << fixed << setprecision(10);
		cout << (sum*sum*sum) / 27.0 << endl;
	
	
	}
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
		#include <bitset>
		using namespace std;
		#define ll long long int 
		#define MOD 1000000007
		#define mod9 1000000009
		#define fast ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
		#define mp make_pair
		#define pb push_back
		#define ct ll t;cin>>t;while(t--)
		#define bi begin()
		#define ei end()
		#define fi first 
		#define se second
	
bool isPrime(ll n) 
{ 
    // Corner case 
    if (n <= 1) 
        return false; 
  
    // Check from 2 to n-1 
    for (ll i = 2; i*i <= n; i++) 
        if (n % i == 0) 
            return false; 
  
    return true; 
}
  ll fact[1000007]={0};
  ll expo(ll x, ll y) {ll res=1;x=x%MOD;while(y>0){if(y&1)res=(1ll*res*x)%MOD;
    y=y>>1;x=(1ll*x*x)%MOD;} return res;}
void facto() {fact[0]=1;fact[1]=1;for(ll i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%MOD;}
  ll npr(ll n,ll r) {facto(); ll res=1; res=fact[n]; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res; }
  
		 int main()
		 {
		 	fast
		 	
		 	// ct
			 {
				 ll a,b,c,d;
				 cin>>a>>b>>c>>d;
				 ll f=0,f1=0;
				 while(a>0&&c>0)
				 {
					 if(f==0)
					 {
						 c=c-b;
						 f=1;
						//  cout<<c<<" ";
					 }
					 else
					 {
						 a=a-d;
						 f=0;
						//  cout<<a<<" ";
					 }
					 if(a<=0)
					 {
						 cout<<"No\n";
						 exit(0);
					 }
					 else if(c<=0)
					 {
						 cout<<"Yes\n";
						 exit(0);
					 }
					 
				 }
			 }			 
}	


Measured memory_bytes: 3612
S = input()
if S[0] == 'A':
    if S[2:-1].count('C') == 1:
        for c in S[1:]:
            if c.isupper() and c != 'C':
                print('WA')
                exit(0)
        else:
            print('AC')
            exit(0)
print('WA')

Measured memory_bytes: 3060
#include <stdio.h>

int main()
{

    int H,W,c=0,i,j;
    for (; ; )
    {
        scanf("%d %d",&H,&W);
        if(H==0&&W==0)
            return 0;

         for (i=0; i<H; i++)
         {
            for (j=0; j<W; j++)
            {
                c=i+j;
                if (c%2==0)
                    printf("#");
                else if (c%2==1)
                printf(".");
            }
             printf("\n");

         }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

vector<int> init(int size){
  vector<int> par(size,-1);
  return par;
}

int root(int x, vector<int>& par){
  if(par[x] < 0){
    return x;
  }else{
    return par[x] = root(par[x],par);
  }
}

bool same(int x, int y, vector<int>& par){
  return root(x, par) == root(y, par);
}

void unite(int x, int y, vector<int>& par){
  x = root(x, par), y = root(y, par);
  if(same(x,y, par))return;
  par[x] += par[y];
  par[y] = x;
}

int size(int x, vector<int>& par){
  return -par[root(x, par)];
}

int pow(int x, int n){
  if(n == 0)return 1;
  if(n % 2 == 0)return pow(x * x % MOD, n/2);
  else return x * pow(x, n-1) % MOD;
}

vector< int > divisor(int n) {
  vector< int > ret;
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret),greater<int>());
  return (ret);
}

signed main(){
  int a,b;cin>>a>>b;
  int now = 1;
  int ans = 0;
  while(now < b){
    now--;now += a;ans++;
  }
  cout << ans << endl;
}


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


int main() {
  int a,b,c;
  cin >> a>>b>>c;
  
    cout<<c<<" "<<a<<" "<<b<<endl;
  
}




Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define LINT long long
 
struct four{
  int xy[4];
};
 
int main(){
  int H, W;
  cin >> H >> W;
  int a[H][W];
  vector<four> ans;
  REP(i, H){
    REP(j, W){
      cin >> a[i][j];
    }
  }
  four work;
  int sousa=0;
 
  if(H==1){
    REP(j, W-1){
      if(a[0][j]%2){
        ++sousa;
        work.xy[0]=1;
        work.xy[1]=j+1;
        work.xy[2]=1;
        work.xy[3]=j+2;
        ans.push_back(work);
        --a[0][j];
        ++a[0][j+1];
      }
    }
    goto end;
  }
 
  if(W==1){
    REP(i, H){
      if(a[i][0]%2){
        ++sousa;
        work.xy[0]=i+1;
        work.xy[1]=1;
        work.xy[2]=i+2;
        work.xy[3]=1;
        ans.push_back(work);
        --a[i][0];
        ++a[i+1][0];
      }
    }
    goto end;
  }
 
  REP(i, H){
    REP(j, W-1){
      if(a[i][j]%2){
        ++sousa;
        work.xy[0]=i+1;
        work.xy[1]=j+1;
        work.xy[2]=i+1;
        work.xy[3]=j+2;
        ans.push_back(work);
        --a[i][j];
        ++a[i][j+1];
      }
    }
  }
  REP(i, H-1){
    int j = W-1;
      if(a[i][j]%2){
        ++sousa;
        work.xy[0]=i+1;
        work.xy[1]=j+1;
        work.xy[2]=i+2;
        work.xy[3]=j+1;
        ans.push_back(work);
        --a[i][j];
        ++a[i+1][j];
      }
  }
 
  end:
  cout << sousa << endl;
  REP(i, ans.size()){
    REP(j, 3){
      cout << ans[i].xy[j] << " ";
    }
    cout << ans[i].xy[3];
    cout << endl;
  }
 
 
 
  return 0;
}

Measured memory_bytes: 5104
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var a = cin.ReadInt;

            var b = cin.ReadInt;

            var c = (a * b)%2;

            if (c == 0)
            {
                WriteLine("Even");
            }
            else
            {
                WriteLine("Odd");
            }

        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 27792
s = input()
k = int(input())
n = len(s)

def f(S):
    res = 0
    count = 1
    length = len(S)
    for i in range(1,length):
        if S[i] == S[i-1]:
            count += 1
        else:
            res += count // 2
            count = 1
    res += count // 2
    return res

res1 = f(s)
res2 = f(s+s)
res3 = f(s+s+s)

if res2 - res1 == res3 - res2:
    print(res1 + (res2-res1) * (k-1))
else:
    print(n * k // 2)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int n; cin >> n;
	VI x(n); REP(i, n)cin >> x[i];
	ll sum = 0;
	REP(i, n)sum += x[i];
	ll a = sum / n;
	ll ans1 = 0, ans2 = 0;
	REP(i, n) {
		ans1 += pow(a - x[i], 2);
	}
	REP(i, n) {
		ans2 += pow(a - x[i] + 1, 2);
	}
	cout << min(ans1,ans2) << endl;
	return 0;
}

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

int main()
{
    int t,i,j,k,l,m,n,ans=1e9,fin=0;

    string s;

    cin>>s;
    n = s.size();
    s = '*' + s;
    for(i=1;i<=n;i++)
    {
        if(s[i]!=s[i+1])
        {
            fin = max(i,n-i);
            ans = min(ans,fin);
        }
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<ll,ll>

using namespace :: std;

const ll maxn=3100;
const ll mod=1e9+7;
const ll inf=1e9+500;

ll a[maxn];
vector<ll> out[maxn];
vector<ll> in[maxn];
bool ans[maxn];
bool vis[maxn];
vector<ll> topol;

void dfs(ll a){
    vis[a]=1;
    for(auto v:in[a]){
        if(vis[v]==0){
            dfs(v);
        }
    }
    topol.pb(a);
}
char ansyal[maxn][maxn];

int main(){
    ll n;
    cin>>n;
    for(ll i=1;i<=n;i++){
        cin>>a[i];
    }
    for(ll i=1;i<n;i++){
        ll v,u;
        cin>>v>>u;
        if(a[v]!=a[u]){
            if(a[v]>a[u]){
                swap(v,u);
            }
            out[u].pb(v);
            in[v].pb(u);
        }
    }
    for(ll i=1;i<=n;i++){
        if(vis[i]==0){
            dfs(i);
        }
    }
    vector<ll> anss;
    for(ll i=n-1;i>=0;i--){
        ll v=topol[i];
        bool win=0;
        for(auto u:out[v]){
            // javab v-->u
            ansyal[v][u]='w';
            for(auto z:out[u]){
                if(ansyal[u][z]=='w'){
                    ansyal[v][u]='l';
                }
            }
            if(ansyal[v][u]=='w'){
                win=1;
            }
        }
        if(win){
            anss.pb(v);
        }
    }
    sort(anss.begin(),anss.end());
    for(auto v:anss){
        cout<<v<<' ';
    }
}


Measured memory_bytes: 9344
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Apolloliu
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

void get() {

}

typedef long long ll;
ll a[123456];
unordered_map<ll, ll>mp;
// Returns value of Binomial Coefficient C(n, k) O(n)时间, O(1)空间
ll binomialCoeff(int n, int k)
{
	ll res = 1;

	// Since C(n, k) = C(n, n-k)
	if ( k > n - k )
		k = n - k;

	// Calculate value of [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]
	for (int i = 0; i < k; ++i)
	{
		res *= ll(n - i);
		res /= ll(i + 1);
	}

	return res;
}
class DCandyDistribution {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n, m;
		in >> n >> m;
		mp.clear();
                mp[0] ++;
		memset(a, 0, sizeof(a));
		ll sum = 0;
		for (int i = 1; i <= n; ++i) {
			in >> a[i];
			a[i] += a[i-1];
			a[i] %= m;
			mp[a[i]]++;
		}
		for (auto it = mp.begin(); it != mp.end(); ++it) {
			sum += (it->second)*(it->second - 1) / 2;
			
		}
		out << sum << '\n';
	}
};


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


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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

const char lf = '\n';

namespace ae86
{
	const int bufl = 1<<15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 100007 , mo = 1000000007;

inline lint powa(lint a,lint t)
{
	lint b=1;
	while(t){if(t&1)b=b*a%mo;a=a*a%mo,t>>=1;}
	return b;
}

inline lint inva(lint a)
{
	return powa(a,mo-2);
}

lint jc[_],rjc[_];

inline void fuck(int n=_-1)
{
	jc[0]=jc[1]=rjc[0]=1;
	for(int i=2;i<=n;i++)jc[i]=jc[i-1]*i%mo;
	rjc[n]=inva(jc[n]);
	for(int i=n-1;i>=1;i--)rjc[i]=rjc[i+1]*(1ll+i)%mo;
}

inline lint C(int n,int m)
{
	if(n<m || n<0 || m<0)return 0;
	return jc[n]*rjc[m]%mo*rjc[n-m]%mo;
}

int n;
lint loc[_];

int main()
{
	ios::sync_with_stdio(0),cout.tie(nullptr);

	fuck();
	
	n=ty();
	for(int i=1;i<=n;i++)loc[i]=ty();

	lint ans=0,coef=0;
	for(int i=1;i<n;i++)
	{
		lint dis=loc[i+1]-loc[i];
		coef=(coef+jc[i-1]*rjc[i]%mo)%mo;
		ans=(ans+coef*dis%mo)%mo;
	}

	cout<<ans*jc[n-1]%mo<<lf;
	
	return 0;
}


Measured memory_bytes: 2688
#include<stdio.h>
#include<stdlib.h>

int main(){
    long long n,m,d[100000],a,b=0,p=1;
    scanf("%lld %lld",&n,&m);
    d[0]=1;
    d[1]=1;
    for(int i=2;i<=n;i++){
        d[i]=d[i-1]+d[i-2];
        d[i]%=1000000007;
    }
    for(int i=0;i<m;i++){
        scanf("%lld",&a);
        if(a==b){
            printf("0\n");
            exit(0);
        }
        a=a-1;
        p*=d[a-b];
        p%=1000000007;
        b=a+2;
    }
    p*=d[n-b];
    p%=1000000007;
    printf("%lld\n",p);
    return 0;
}



Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef pair<long long, long long> pLL;
typedef long long ll;
int MOD = 1000000007;

ll a[60];
ll p[60];

ll f(int N, ll X){
  if(N <= 0){
    if(X <= 0){
      return 0;
    }else{
      return 1;
    }
  }else if(X <= a[N-1] + 1){
    return f(N-1,X-1);
  }else{
    return p[N-1] + 1 + f(N-1,X-a[N-1]-2);
  }
}

int main(){
  int N;
  ll X;
  cin >> N >> X;
  
  a[0] = 1;
  p[0] = 1;
  for(int i=0; i<N; i++){
    a[i+1] = 2*a[i] + 3;
    p[i+1] = 2*p[i] + 1;
  }
  cout << f(N,X) << endl;
    
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,x;
  cin >>a>>b>>c>>x;
  int i,j,k,count=0;
  for(i=0;i<a+1;i++){
    for(j=0;j<b+1;j++){
      for(k=0;k<c+1;k++){
        if(500*i+100*j+50*k==x){
          count++;
          break;
        }
      }
    }
  }
  cout << count;
}

Measured memory_bytes: 256
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

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

// utility of stdin,stdout
#define INPS cin >>
#define OUT cout << 
#define BR << endl
#define RET return 0
#define TLong long long

int main(int argc, char const *argv[]){
	int x,a;
	int c;
	cin >> x >> a;
	c = (x < a) ? 0 : 10;
	OUT(c) BR;
	RET;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#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 int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 998244353;
const int N = 3005;

int i,j,a,b,c,d,dp[N][N];

void solve()
{
    cin>>a>>b>>c>>d;
    dp[a][b]=1;
    for(i=1;i<=c;++i)
    {
        for(j=1;j<=d;++j)
        {
            dp[i][j]+=(dp[i-1][j]*j)%mod;
            dp[i][j]+=(dp[i][j-1]*i)%mod;
            dp[i][j]-=(dp[i-1][j-1]*(i-1)*(j-1))%mod;
            dp[i][j]+=mod;
            dp[i][j]%=mod;
        }
    }
    cout<<dp[c][d];
}

signed main()
{
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 74000
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int MAX = 1e9;
const ll LLMAX = 1e18;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

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

    ll ans = 1;
    rrep(i, 1, N) {
        ans *= i;
        ans %= MOD;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  
int main() {
  int N;
  cin >> N;
  
  vector<int> p(N);
  vector<int> asc(N);

  for (int i = 0; i < N; i++) {
    cin >> p[i];
    asc[i] = p[i];
  }
  sort(asc.begin(), asc.end());

  int count = 0;
  for (int i = 0; i < N; i++) {
    if (p[i] != asc[i]) count++;
  }
  
  cout << ((count == 2 || count == 0) ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
use proconio::{input, fastout, marker::Usize1};
use std::collections::{VecDeque, HashMap};

#[fastout]
fn main() {
    input! {
        n: usize, m: usize,
        arr: [(Usize1, Usize1); m],
    }

    let mut map: Vec<Vec<usize>> = vec![vec![]; n];
    for (a, b) in arr {
        map[a].push(b);
        map[b].push(a);
    }

    let mut hm: HashMap<usize, usize> = HashMap::new();
    let mut queue: VecDeque<usize> = VecDeque::new();
    hm.insert(0, 0);
    queue.push_back(0);
    loop {
        match queue.pop_front() {
            None => break,
            Some(r) => {
                for i in &map[r] {
                    if !hm.contains_key(i) {
                        hm.insert(*i, r);
                        queue.push_back(*i);
                    }
                }
            }
        }
    }

    if hm.len() == n {
        println!("Yes");
        for i in 1..hm.len() {
            println!("{}", hm.get(&i).unwrap()+1);
        }
    } else {
        println!("No");
    }
}


Measured memory_bytes: 17468
#!/usr/bin/env python3
import sys
import numpy as np


def solve(N: int, A: "List[int]"):
    npA = np.array(A)
    std = np.argsort(npA)+1
    std = std.tolist()
    n = [str(n) for n in std]
    print(' '.join(n))




def main():
    
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)



if __name__ == '__main__':
    main()


Measured memory_bytes: 36136
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順

signed main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  double ans = 1.0 * a * b / 2;
  cout << fixed << setprecision(10) << ans;
  cout << " ";
  if(a == c*2 && b == d*2) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#include <random>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string S;
  cin >> S;
  int N = S.size();
  int ans = N;
  for(int i=1; i<N; i++){
    if(S[i-1] != S[i]){
      chmin(ans,max(i,N-i));
    }
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3708
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 105005
#define PI 	3.14159265358979323846

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,x,y;
    cin >> n >> x >> y;
    int a[50],b[50],v[50];
    REP(i,n)cin >> a[i] >> b[i] >> v[i];
    static int dp_i[45][411][411];//<v,used> dp[num][a][b]
    Fill(dp_i,SIZE);
    static bool dp_b[45][411][411];
    REP(i,n){
        if(!i){
            dp_i[0][0][0] = 0;
            dp_b[0][0][0] = true;
            dp_i[0][a[0]][b[0]] = v[0];
            dp_b[0][a[0]][b[0]] = true;
        }else{
            REP(j,400)REP(k,400)if(dp_b[i-1][j][k]){
                dp_i[i][j][k] = min(dp_i[i-1][j][k],dp_i[i][j][k]);
                dp_b[i][j][k] = true;
                dp_i[i][j+a[i]][k+b[i]] = min(dp_i[i-1][j][k]+v[i],dp_i[i][j+a[i]][k+b[i]]);
                dp_b[i][j+a[i]][k+b[i]] = true;
            }
        }
    }
    int ans = SIZE;
    FOR(j,1,402)FOR(k,1,402)if(dp_b[n-1][j][k] && (k*x==j*y))ans = min(ans,dp_i[n-1][j][k]);
    if(ans==SIZE)ans = -1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 35712
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(n):
    sm = c
    for j in range(m):
        sm += a[i][j]*b[j]

    if sm > 0:
        ans += 1
print(ans)


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

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

  ll n;
  cin >> n;

  vector<char> v;
  vector<char> vc = {
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
  };

  ll r = (n-1) / 26;
  ll q = (n-1) % 26;

  v.push_back(vc.at(q));

  while (r > 0)
  {
    q = (r-1) % 26;
    r = (r-1) / 26;
    v.push_back(vc.at(q));
  }
  reverse(v.begin(), v.end());

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

  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef pair<ll,ll> pll;

#define reps(i,f,n) for(int i = int(f); i <= int(n); i++)
#define rep(i,n) reps(i,0,int(n)-1)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)

#define all(x) (x).begin(),(x).end()
#define X first
#define Y second

#define sz size()
#define eb emplace_back
#define pb push_back

int main(void){
  int r;
  cin >> r; 
  cout << r * r  * 3 << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    int resultCount = 0;
	    while (true) {
		    String[] line = br.readLine().split(" ");

		    int n = Integer.parseInt(line[0]);
		    int x = Integer.parseInt(line[1]);

		    if (n == 0 && x == 0) break;

		    for (int i = 1; i <= n; i++) {
		    	for (int j = i + 1; j <= n; j++) {
		    		for (int k = j + 1; k <= n; k++) {

		    			if (i + j + k == x) {
		    				resultCount++;
		    			}
		    		}
		    	}
		    }
		    System.out.println(resultCount);
		    resultCount= 0;
	    }
	}
}

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

typedef long long ll;

#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)

const int N=3e5+5;
int a[N];

int main()
{
	//freopen("1.in","r",stdin);
	int k,n;
	cin>>k>>n;
	if(k%2==0)
	{
		printf("%d ",k/2);
		rep(i,2,n)printf("%d ",k);
		puts("");
		return 0;
	}
	rep(i,1,n)a[i]=(k+1)/2;
	int top=n;
	per(tmp,n/2,1)
	{
		if(a[top]==1)--top;
		else
		{
			--a[top];
			while(top<n)a[++top]=k;
		}
	}
	rep(i,1,top)printf("%d ",a[i]);
}

Measured memory_bytes: 3456
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        var list = Console.ReadLine().Split(' ').ToList();

        var T = list[0];

        var X = list[1];

        Console.Write(int.Parse(T) / double.Parse(X));
    }
}

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

int main() {
  int n;
  cin >> n;
  int a[3 * n];
  for (int i = 0; i < 3 * n; i++) {
    cin >> a[i];
  }
  sort(a, a + 3 * n);

  // 低い順にN人並べる -> 各チームの最下点
  // 残りのうち最高点の人は、どのチームに入っても得点にならない
  // -> どこかのチームに入れる
  // -> 残りのうち最高点の人は上のチームに入ったときだけ得点になる。
  // -> 上のチームに入れる。
  // これを繰り返すと、結果的に、上から2,4,..,2N番目に高い人が得点になっている。

  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += a[3 * n - 2 * i];
  }

  cout << ans << endl;
}


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

using namespace std;

int main() {
  string s, t;
  cin >> s;
  cin >> t;

  int mindiff = 1000;
  for (int i = 0; i <= (int) (s.size() - t.size()); i++) {
    int diff = 0;
    for (int j = 0; j < (int) t.size(); j++) {
      if (s[i + j] != t[j]) diff++;
    }
    mindiff = min(mindiff, diff);
  }

  cout << mindiff << '\n';

  return 0;
}


Measured memory_bytes: 3208
N = gets.to_i
D = Array.new(N)
N.times do |i|
  D[i] = gets.split.map(&:to_i)
end

count = 0
D.each do |a,b|
  count += 1 if a == b
  if count == 3
    puts "Yes"
    exit
  end
  count = 0 if a != b
end

puts "No"


Measured memory_bytes: 14348
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<vector<int>> dp(n, vector<int>(3, __INT32_MAX__));
    for (int i = 0; i < n; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        if (i == 0) {
            dp[i][0] = a;
            dp[i][1] = b;
            dp[i][2] = c;
        } else {
            dp[i][0] = max(dp[i - 1][1] + a, dp[i - 1][2] + a);
            dp[i][1] = max(dp[i - 1][2] + b, dp[i - 1][0] + b);
            dp[i][2] = max(dp[i - 1][0] + c, dp[i - 1][1] + c);
        }
    }
    cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << endl;
    return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <vector>
#include <functional>
using namespace std;

template <typename T, typename E> class SegTree {
    using F = function<T(T, T)>;
    using G = function<T(T, E)>;
    using H = function<E(E, E)>;
    using W = function<E(E, int)>;

    int N;
    F f;
    G g;
    H h;
    W w;
    T ti;
    E ei;
    vector<T> data;
    vector<E> lazy;

    void eval(int k, int len) {
        if (lazy[k] == ei) return;
        if (k < N-1) {
            lazy[2*k+1] = h(lazy[2*k+1], lazy[k]);
            lazy[2*k+2] = h(lazy[2*k+2], lazy[k]);
        }
        data[k] = g(data[k], w(lazy[k], len));
        lazy[k] = ei;
    }

    void _update(int a, int b, E x, int k, int l, int r) {
        eval(k, r-l);
        if (a <= l && r <= b) {
            lazy[k] = h(lazy[k], x);
            eval(k, r-l);
        } else if (a < r && l < b) {
            _update(a, b, x, 2*k+1, l, (l+r)/2);
            _update(a, b, x, 2*k+2, (l+r)/2, r);
            data[k] = f(data[2*k+1], data[2*k+2]);
        }
    }

    T _query(int a, int b, int k, int l, int r) {
        eval(k, r-l);
        if (r <= a || b <= l) {
            return ti;
        } else if (a <= l && r <= b) {
            return data[k];
        } else {
            T left = _query(a, b, 2*k+1, l, (l+r)/2);
            T right = _query(a, b, 2*k+2, (l+r)/2, r);
            return f(left, right);
        }
    }
public:
    SegTree(F f, G g, H h, W w, T ti, E ei) : f(f), g(g), h(h), w(w), ti(ti), ei(ei) {}

    void init(int n) {
        N = 1;
        while (N < n) N *= 2;
        data.resize(2*N-1, ti);
        lazy.resize(2*N-1, ei);
    }

    void build(const vector<T> &v) {
        int n = v.size();
        init(n);
        for (int i = 0; i < n; i++) data[i+n-1] = v[i];
        for (int i = n-2; i >= 0; i--) {
            data[i] = f(data[2*i+1], data[2*i+2]);
        }
    }

    void update(int a, int b, E x) {
        _update(a, b, x, 0, 0, N);
    }

    T query(int a, int b) {
        return _query(a, b, 0, 0, N);
    }
};

// AOJ RSQ and RAQ
int main() {
    int N, Q;
    cin >> N >> Q;

    using T = long long;
    using E = long long;
    auto f = [](T t1, T t2) -> T { return t1 + t2; };
    auto g = [](T t, E e) -> T { return t + e; };
    auto h = [](E e1, E e2) -> E { return e1 + e2; };
    auto w = [](E e1, int len) -> E { return e1 * len; };
    T ti = 0;
    E ei = 0;
    auto seg = new SegTree<T, E>(f, g, h, w, ti, ei);
    seg->init(N);

    for (int q = 0; q < Q; q++) {
        int c;
        cin >> c;
        if (c) {
            int s, t;
            cin >> s >> t;
            s--; t--;
            cout << seg->query(s, t+1) << endl;
        } else {
            int s, t, x;
            cin >> s >> t >> x;
            s--; t--;
            seg->update(s, t+1, x);
        }
    }
}


Measured memory_bytes: 7224
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int w = 0;

        while (w != 7) {
            int a = scan.nextInt();
            int b = scan.nextInt();
            System.out.println(a - b);
            w++;
        }

    }
}



Measured memory_bytes: 26200
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

void nosol(){puts("No");exit(0);}
int n,a[3][100111],rev[2],ord[2][100111];
int bit[100111];
void add(int x){for(;x<100111;x+=x&-x)bit[x]^=1;}
int query(int x){int ret=0;for(;x;x-=x&-x)ret^=bit[x];return ret;}
int getinv(int a[],int n)
{
	memset(bit,0,sizeof(bit));
	int ret=0;
	for(int i=0;i<n;i++)
	{
		ret^=(i&1)^query(a[i]);
		add(a[i]+1);
	}
	return ret;
}
int main()
{
	get1(n);
	for(int i=0;i<3;i++)for(int j=0;j<n;j++){get1(a[i][j]);a[i][j]--;}
	for(int i=0;i<n;i++)
	{
		if(a[0][i]/3!=a[1][i]/3||a[0][i]/3!=a[2][i]/3)nosol();
		if(a[0][i]/3%2!=i%2)nosol();
		if(a[1][i]*2!=a[0][i]+a[2][i])nosol();
		rev[i&1]^=(a[0][i]>a[1][i]);
		ord[i&1][i>>1]=a[0][i]/3;
	}
	if(getinv(ord[0],n+1>>1)!=rev[1])nosol();
	if(getinv(ord[1],n>>1)!=rev[0])nosol();
	puts("Yes");
	return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll A,B;
    cin >>A>>B;
    ll ans;
    if(A==B){
        ans = A+B;
    }else{
        ans = max(A,B)*2-1;
    }
    
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 3588
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
using namespace std;
int main() {

	//C
	int n, m;
	cin >> n >> m;
	int k,s ;
	int i, j;
	int comb[11][11];
	for (i = 0; i < 11; i++) {
		for (j = 0; j < 11; j++) {
			comb[i][j] = 0;
		}
	}
	for (i = 1; i <= m; i++) {
		cin >> k;
		for (j = 0; j < k; j++) {
			cin >> s;
			comb[i][s] = 1;
		}
	}
	int p[11];
	for (i = 1; i <= m; i++) {
		cin >> p[i];
	}
	int bin[11] = { 0,1,2,4,8,16,32,64,128,256,512 };
	int ii;
	int counter = 0;
	int bcheck;
	int bflag;
	for (i = 0; i < bin[n]*2; i++) {
		bflag = 0;
		for (ii = 1; ii <= m; ii++) {
			bcheck = 0;
			for (j = 1; j <= n; j++) {
				if ((i ^ bin[j]) != i + bin[j]) {
					bcheck = bcheck + comb[ii][j];
				}
			}
			if (bcheck % 2 != p[ii]) {
				bflag = 1;
			}

		}
		if (bflag == 0) {
			counter++;
		}
	}
	cout << counter << endl;
	return 0;





	//B
	/*string  s[100];
	//cin >> s >> t;
	int n;
	int p[100];
	cin >> n;
	int i;
	int num[100];
	for (i = 0; i < n; i++) {
		cin >> s[i] >> p[i];
		num[i] = i + 1;
	}

	string ss;
	int pp;
	int j;
	for (i = n-1; i > 0; i--) {
		for (j = 0; j < i; j++) {
			if (s[j] > s[j + 1]) {
				ss = s[j];
				s[j] = s[j + 1];
				s[j + 1] = ss;
				pp = p[j];
				p[j] = p[j + 1];
				p[j + 1] = pp;
				pp = num[j];
				num[j] = num[j + 1];
				num[j + 1] = pp;
			}
			else if((s[j] == s[j+1]) && (p[j] < p[j+1])){
				pp = p[j];
				p[j] = p[j + 1];
				p[j + 1] = pp;
				pp = num[j];
				num[j] = num[j + 1];
				num[j + 1] = pp;
			}
		}
	}
	for (i = 0; i < n; i++) {
		cout << num[i] << endl;
	}
	return 0;
	//if (s < t) {
	//	cout << s;
	//}
	//else {
	//	cout << t;
	//}
	return 0;
	*/

	//A

	/*int a, p;
	cin >> a >> p;
	p = p + a * 3;
	cout << (p - (p % 2)) / 2 << endl;
	return 0;*/



}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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










int main(){
    ll n;
    cin >> n;
    vector<ll> a(n + 1);
    REP(i, n){
        cin >> a[i + 1];
    }
    a[0] = a.back();
    vector<ll> t = a;
    vector<ll> v(n);
    v[0] = min(a[0], a[1]) * 2;
    t[0] -= v[0] / 2;
    t[t.size() - 1] -= v[0] / 2;
    t[1] -= v[0] / 2;
    ll sum = 0;
    for(ll i = 1; i < n; i++){
        v[i] = min(t[i], t[i + 1]) * 2;
        t[i] -= v[i] / 2;
        t[i + 1] -= v[i] / 2;
        sum += t[i];
    }
    vector<ll> t2 = a;
    v[0] -= sum;
    t2[0] = v[0] / 2;
    t2[t2.size() - 1] -= v[0] / 2;
    t2[1] -= v[0] / 2;
    for(ll i = 1; i < n; i++){
        v[i] = min(t2[i], t2[i + 1]) * 2;
        t2[i + 1] -= v[i] / 2;
    }
    REP(i, n){
        cout << v[i] << " \n"[i == n - 1];
    }
}


Measured memory_bytes: 4480
// VSCF.cpp : Defines the entry point for the console application.
//
#include <list>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <iomanip>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define FOR(v,p,k) for(int v=p;v<=k;++v)
#define FORD(v,p,k) for(int v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define VAR(v,i) __typeof(i) v=(i)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
#define PB push_back
#define ST first
#define ND second
#define SIZE(x) (int)x.size()
#define ALL(c) c.begin(),c.end()
#define int long long
#define MAXN 1000010
typedef long double LD;

#undef int
int main() {
#define int long long
	ios_base::sync_with_stdio(0);
	int a, b;
	cin >> a >> b;
	if (a > b) {
		swap(a, b);
	}
	if (a > 0) {
		cout << "Positive";
	} else if (b < 0) {
		if (abs(b - a) & 1) {
			cout << "Positive";
		} else {
			cout << "Negative";
		}
	} else {
		cout << "Zero";
	}
	return 0;
}

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

int main()
{
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if (A + B > C + D)
  {
    cout << "Left" << endl;
  }
  if (A + B == C + D)
  {
    cout << "Balanced" << endl;
  } 
  if (A + B < C + D)
  {
    cout << "Right" << endl;
  }
}

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

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

Measured memory_bytes: 256
<?php 
  $array = explode(" ", trim(fgets(STDIN)));

  $x0 = $array[0];
  $y0 = $array[1];
  $x1 = $array[2];
  $y1 = $array[3];

  $vx = $x1 - $x0;
  $vy = $y1 - $y0;

  $x2 = $x1 - $vy;
  $y2 = $y1 + $vx;
  $x3 = $x2 - $vx;
  $y3 = $y2 - $vy;
  echo "$x2 $y2 $x3 $y3"; 
 ?>

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

int main() {
    int n;
    cin >> n;
    vector<long long int> h(n);
    for(int i = 0; i < n; i++) cin >> h[i];
    int ans = 0;
    int tmp = 0;
    for(int i = n - 1; i >= 1; i--) {
        if(h[i] <= h[i - 1]) {
            tmp++;
        } else {
            if(ans < tmp) ans = tmp;
            tmp = 0;
        }
    }
    if(ans < tmp) ans = tmp;
    cout << ans << endl;
    return 0;
}

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

int main(){
  string s,t,u;
  cin >> s >> t;
  int a,b;
  cin >> a >> b;
  cin >> u;
  if(s==u){
      cout << a-1 << endl;
      cout << b << endl;
  }else{
      cout << a << endl;
      cout << b-1 << endl;
  }
      
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define   ll          long long int
#define   sz          200010
#define   sc(a)       scanf("%lld",&a)
#define   sc2(a,b)    scanf("%lld %lld",&a,&b)
#define   py          printf("Yes\n")
#define   pn          printf("No\n")
using namespace std;

int main()
{


    ll a,b;
    cin>>a>>b;

    if(b*2>=a)cout<<0<<endl;
    else
        cout<<a-(b*2)<<endl;

    return 0;
}


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

int main()
{
    string s;
    cin >> s;
    string hitachi = "";

    for (int i = 1; i <= 5; i++)
    {
        hitachi += "hi";
        if(hitachi == s){
            cout << "Yes" << endl;
            return 0;
         }
    }
    cout << "No" << endl;
    return 0;
    


}



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

bool operator<(pair<char,int> p1,pair<char,int> p2){
    return p1.second < p2.second;
}

int main() {

    while(1){

        int n;

        cin >> n;

        if(n==0) break;

        char c[n+1];

        for(int i=1; i<=n; i++){
            cin >> c[i];
        }

        map<char,int> candidates;

        bool find_c = false;

        priority_queue<pair<int,char> > q;

        for(int i=1; i<=n; i++){

            candidates[c[i]]++;

            if(!q.empty() && q.top().second == c[i]){
                q.pop();
            }

            q.push(make_pair(candidates[c[i]], c[i]));

            int firstpoint = q.top().first;
            int secondpoint = 0;

            if(q.size() >= 2) {
                pair<char, int> firster = q.top();
                q.pop();
                secondpoint = q.top().first;
                q.push(firster);
            }

            if(firstpoint > secondpoint + n-i){
                cout << q.top().second << " " << i << endl;
                find_c = true;
                break;
            }

        }

        if(!find_c){

            pair<int,char> p = q.top();
            q.pop();
            if(!q.empty()){
                if(q.top().first == p.first){
                    cout << "TIE" << endl;
                }
                else{
                    cout << p.second << " " << n << endl;
                }
            }
            else{
                cout << p.second << " " << n << endl;
            }

        }



    }

    return 0;
}

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

#define int long long
#define ALL(x) x.begin(),x.end()
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb(x) push_back(x)
#define eb emplace_back
#define SORT(ls) sort(ls.begin(), ls.end())
#define DESC(ls) sort(ls.rbegin(), ls.rend()) 
#define mp(x, y) make_pair(x, y)
#define INF 1000000000
#define MOD 1000000007
#define F(i, a, n) for(i=a;i<n;i++)
#define B(i, a, n) for(i=n-1;i>=0;i--)
#define SI(x) cin>>x
#define DI(x, y) cin>>x>>y
#define TI(x, y, z) cin>>x>>y>>z
#define FI(w, x, y, z) cin>>w>>x>>y>>z
#define SO(x) cout<<x<<"\n"
#define DO(x, y) cout<<x<<" "<<y<<"\n"
#define TO(x, y, z) cout<<x<<" "<<y<<" "<<z<< "\n"
#define FO(w, x, y, z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<"\n"
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)



int32_t main(void)
{
    FASTER;
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int i, j;
    int n;
    SI(n);
    int a[2*n];
    F(i, 0, 2*n)
        SI(a[i]);
    sort(a, a + 2*n);
    int ans = 0;
    for(int i = 0; i < 2*n; i+=2)
        ans += a[i];
    SO(ans);
    return 0;
}


Measured memory_bytes: 256