akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define Yes "Yes"
#define No "No"
#define DEFAULT LL ans=solve();\
 	if(ans==NONE){\
 	}else{\
 		cout << ans << endl;\
 	}
#define YESNO three(solve(),(OUT(YES),1),(OUT(NO),0))
#define YesNo three(solve(),OUT(Yes),OUT(No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b-1);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,zero,b)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<pr, Vpr > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5e5 + 1000;
const int SIZE2 = 5010;
const int SIZE3 = 430;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p998 = 998244353;
const LL p107 = 1000000007;
const LL p = p107;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
const LL NONE=-2;
#define endl "\n"
ut N, M,K,  Q, D, H, W;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
//LL A[SIZE],B[SIZE],C[SIZE];
LL solve(){
	cin >> N;
	return N>=30;

	return NONE;
}
 signed main() {
 
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	LL T=1;

	REP(i,T){
		YesNo;

	}
	
//	YesNo;
//	YESNO;
//	three(solve(),OUT("First"),OUT("Second"));
	//cin >> N;
	return 0;
 
}


Measured memory_bytes: 15436
num = int(raw_input())
a = map(int, raw_input().split())
Max = a[0]
Min = a[0]
Sum = 0
for i in range(num):
    if Max < a[i]:
        Max = a[i]
    if Min > a[i]:
        Min = a[i]
    Sum = Sum + a[i]
print "%d %d %d" %(Min, Max, Sum)

Measured memory_bytes: 7084
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
using namespace std;
#define N 1000100
#define inf 100000000
#define ls (rt<<1)
#define rs (rt<<1|1)
#define fi first
#define se second
struct node{int a,b,id;}p[N];
typedef pair<int,int> pa;
bool operator < (node x,node y){if (x.a==y.a) return x.b>y.b;return x.a>y.a;}
priority_queue<node> que;
int n,i,a[N],cnt,pos[N];pa minn[N<<3];
vector<int> e[N],ans;
void cmp(pa &x,pa y) {x.fi=min(x.fi,y.fi),x.se=min(x.se,y.se);}
void build(int rt,int l,int r)
{	
	minn[rt].fi=inf;minn[rt].se=inf;
	if (l==r){if (l&1) minn[rt].fi=a[l];else minn[rt].se=a[l];return ;}
	int mid=(l+r)/2;build(ls,l,mid);build(rs,mid+1,r);
	cmp(minn[rt],minn[ls]),cmp(minn[rt],minn[rs]);
}
pa query(int rt,int l,int r,int x,int y)
{
	if (x<=l&&r<=y) return minn[rt];
	int mid=(l+r)/2;
	pa ret=make_pair(inf,inf);
	if(x<=mid) cmp(ret,query(ls,l,mid,x,y));
	if (y>=mid+1) cmp(ret,query(rs,mid+1,r,x,y));
	return ret;
}
int solve(int l,int r)
{
	int tmpa,tmpb,posa,posb;
	if (l&1)
	{
		tmpa=query(1,1,n,l,r).fi,posa=pos[tmpa];
		tmpb=query(1,1,n,posa+1,r).se,posb=pos[tmpb];
	}else
	{
		tmpa=query(1,1,n,l,r).se,posa=pos[tmpa];
		tmpb=query(1,1,n,posa+1,r).fi,posb=pos[tmpb];
	}
	p[++cnt].a=tmpa,p[cnt].b=tmpb,p[cnt].id=cnt;
	int cntt=cnt;
	if (posa!=l)  e[cntt].push_back(solve(l,posa-1));
	if (posa+1!=posb)  e[cntt].push_back(solve(posa+1,posb-1));
	if (posb!=r)  e[cntt].push_back(solve(posb+1,r));
	return cntt;
}
int main()
{
	scanf("%d",&n);
	for (i=1;i<=n;i++)scanf("%d",&a[i]),pos[a[i]]=i;
	build(1,1,n);
	solve(1,n);
	que.push(p[1]);
	while (!que.empty())
	{
		int x=que.top().id;que.pop();
		printf("%d %d ",p[x].a,p[x].b);
		for (i=0;i<(int)e[x].size();i++)que.push(p[e[x][i]]);
	}
}

Measured memory_bytes: 54912
#include <bits/stdc++.h>
using namespace std;
 
//Made with <3 by MinumCoklatPanas
typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

int n,m,q;
int a[55];
int b[55];
int c[55];
int d[55];

int rec(int ix,int lastDigit,vector< int > &tab)
{
	int ret = 0;
	if (ix == n)
	{
		for (int i = 1 ; i <= q ; i++)
		{
			if (tab[b[i]] - tab[a[i]] == c[i])
				ret += d[i];
		}
		// for (auto it : tab)
		// 	cout << it << " ";
		// cout << ": " << ret;
		// cout << endl;
		return ret;
	}
	for (int i = lastDigit ; i <= m ; i++)
	{
		tab[ix] = i;
		ret = max(ret,rec(ix + 1,i,tab));
	}
	return ret;
}	

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m >> q;
	for (int i = 1 ; i <= q ; i++)
	{
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		--b[i]; --a[i];
	}
	vector< int > tab(n,0);
	int ans = rec(0,1,tab);
	cout << ans << endl;
	return 0;
}

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

using namespace std;

const int size = 2e5 + 7;
long long int dp[2][size];
int mod = 1e9 + 7;  	
vector<int> graph[size];

long long int solve(int flag, int parent, int u){
	if(dp[flag][u] != -1) return dp[flag][u];
	long long int ans = 1, l =1, r = 1;
	bool hasChild = false;
	for(int v: graph[u]){
		if(v == parent) continue;
		hasChild = true;
		if(flag == 0){
			ans *= (solve(1, u, v) + solve(0, u, v))%mod;
		}
		else{
			ans *= solve(0, u, v)%mod;
		}
		ans %= mod;
	}
	if(!hasChild) return 1;
	// if(flag == 0) ans += r;
	dp[flag][u] = ans;
	return ans;
}

int main(){
	int n;
	cin>>n;
	for(int x=0;x<n-1;x++){
		int u, v;
		cin>>u>>v;
		graph[u].push_back(v);
		graph[v].push_back(u);
	}
	int  root = 1;
	for(int x=1;x<n;x++){
		if(graph[x].size() == 1) root = x;
	}
	for(int x=0;x<size;x++) dp[0][x] = dp[1][x] = -1;
	// cout<<root<<"\n";
	cout<<(solve(0,-1,root) + solve(1,-1,root))%mod;
	// cout<<<<"\n";
	return 0;
}

Measured memory_bytes: 20608
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
	static final int MAX = 2_147_483_646; // intMax 
	static final int INF = 1_000_000_000; // 10^9  
	public static void main(String[] args) throws Exception{
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int[] ans = new int[n];
		
		int num = 0;
		for(int i =1;i <=100;i++ ){
			for(int j = 1;j <= 100;j++){
				for(int k = 1;k <=100;k++){
					num = i*i+j*j+k*k+i*j+i*k+j*k;
					if(num > n){
						break;
					}
					ans[num-1]++;
				}
			}
		}
		for(int i = 0;i < n;i++){
			System.out.println(ans[i]);
		}


		saori.close();
	}
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}


Measured memory_bytes: 35568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
int main() {
	int n,k;
	scanf("%d%d",&n,&k);
	vector<ll>a(n);
	for(int i=0;i<n;i++) scanf("%lld",&a[i]);
	sort(a.begin(),a.end());
	ll ans=1,sign=1;
	int l=0,r=n-1;
	if(k%2){
        ans=a[r--];
        --k;
        if(ans<0) sign=-1;
	}
	while(k){
        ll x=a[l]*a[l+1],y=a[r]*a[r-1];
        if(x*sign>y*sign){
            ans=x%mod*ans%mod;
            l+=2;
        }else{
            ans=y%mod*ans%mod;
            r-=2;
        }
        k-=2;
	}
	printf("%lld",(ans+mod)%mod);
	return 0;
}

Measured memory_bytes: 4796
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  ll n,k,a[111111];
  cin>>n>>k;
  ll sum_a[111111]={};
  ll sum_p[111111]={};
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(i==0){
	 sum_a[0]=a[0];
	 sum_p[0]=max(0LL,a[0]);
	 continue;
    }
    sum_a[i]=sum_a[i-1]+a[i];
    sum_p[i]=sum_p[i-1]+max(0LL,a[i]);
  }

  ll ans=0;
  for(int i=0;i+k-1<n;i++){
    ll l=sum_p[i]-max(0LL,a[i]);
    ll r=sum_p[n-1]-sum_p[i+k-1];
    ll tmp=max(0LL,sum_a[i+k-1]-sum_a[i]+a[i])+r+l;
    ans=max(ans,tmp);
  } 
  
  cout<<ans<<endl;
  return 0;
}


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

typedef long long ll;

using vi = vector<int>;
using vl = vector<long long int>;
using vii = vector<vector<int>>;
using vll = vector<vector<long long int>>;



int modd(int a)
{
return a>=0?a:-a;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    const int m=1e9+7;
      ll n,k;
      cin>>n>>k;
ll min_sum=k*(k-1)/2,max_sum;

min_sum;
max_sum=((n*k)-min_sum);



      ll ans=0;

    ans=(ans+(max_sum-min_sum)+1)%m;


      for(ll i=k;i<=n;i++)
      {
              min_sum+=i;
              max_sum+=n-i;
             
              ans=(ans+(max_sum-min_sum)+1);
      }


cout<<ans%m<<endl;

return 0;

}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair < ll, ll > PLL;
#define rep(i,n) for (int i = 0; i < (n); ++i)
ll MOD = 1e9+7;
int main() {
    int n, m;
    cin >> n >> m;
    vector<int> s(m);
    vector<int> c(m);
    rep(i, m) cin >> s[i] >> c[i];
    vector<int> keta;
    rep(i, 1000) {
        int tmp_num = i;
        keta.clear();
        if ( tmp_num == 0 ) keta.push_back(0);
        while ( tmp_num > 0 ) {
            keta.push_back(tmp_num % 10);
            tmp_num /= 10;
        }
        if ( keta.size() != n ) continue;
        reverse(keta.begin(), keta.end());
        bool ok = true;
        rep(j, m) {
            rep(k, keta.size()){
                if ( s[j] == ( k + 1 ) ) {
                    if ( keta[k] != c[j] ) {
                        ok = false;
                        break;
                    }
                }
            }
            if ( !ok ) break;
        }
        if ( ok ) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}
ll llpow(ll n,ll i){ll cnt=n;  for(ll j=0;j<i-1;j++){n*=cnt;}return n;}

int main(){
  int a,b;
  cin>>a>>b;
  ll cnt=0;
  if(a<=b){
    cout<<min(abs(abs(a)-abs(b))+1,b-a)<<endl;
    return 0;
  }
  if(a>b){
    if(a>0&&b>0){
      cout<<a-b+2<<endl;
      return 0;
    }
    if(a<0&&b<0){
      cout<<a-b+2<<endl;
      return 0;
    }
    else{
      cout<<abs(abs(a)-abs(b))+1<<endl;
      return 0;
    }
  }
}

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

long long N;
long long A;
long long B;

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

    if ((B-A)%2==0)
    {
        cout<<(B-A)/2<<endl;
    }

    else 
    {
        if ((N-B)<(A-1)) //B is closer//
        {
            long long x=B-A;
            cout<<(long long)(N-B+1+((x-1)/2))<<endl;
        }
        
        else
        {
            long long y=B-A;
            cout<<(long long)(A-1+1+((y-1)/2))<<endl;
        }
    }
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lld;
ll MOD = (1e9)+7;
const int dr[] = {+1, -1, +0, +0, +1, -1, +1, -1};
const int dc[] = {+0, +0, +1, -1, +1, -1, -1, +1};
const int kx[] = {+1, +2, -1, -2, +1, +2, -1, -2};
const int ky[] = {+2, +1, +2, +1, -2, -1, -2, -1};
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
inline void fastIO(){
  ios_base::sync_with_stdio(0);cin.tie(0);
}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void debug_out() { cerr << endl; }
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "(" << #__VA_ARGS__ << "):", debug_out(__VA_ARGS__)
#else
#define debug(...) 47
#endif
int main(){
  fastIO();
  int n;
  cin>>n;
  vector<ll>a(n);
  ll tot=0,ans=0;
  ll DP[n];
  memset(DP,0,sizeof(DP));
  for(int i=0;i<n;i++){
    cin>>a[i];
    tot+=a[i];
    DP[i]=tot;
  }
  for(int i=0;i<n;i++){
    ll ope=DP[n-1]-DP[i];
    ans+=((a[i]%MOD)*(ope%MOD))%MOD;
    ans%=MOD;
  }
  cout<<ans%MOD<<endl;
  return 0;
}

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

namespace ARC069
{
    public class E
    {
        private void Run()
        {
            var N = int.Parse(Console.ReadLine().Trim());
            var A = Console.ReadLine().Trim().Split()
                .Select((s, i) => new { index = i, value = long.Parse(s) })
                .OrderByDescending(x => x.value)
                .ThenByDescending(x => x.index)
                .ToArray();

            var results = new long[N];
            int index = 0;
            while (index + 1 < A.Length && A[index].value == A[index + 1].value)
            {
                index++;
            }

            int minIndex = A[index].index;
            long count = index + 1;
            while (index + 1 < A.Length)
            {
                int prevMinIndex = minIndex;
                int sameValueLastIndex = index + 1;
                minIndex = Math.Min(minIndex, A[sameValueLastIndex].index);
                while (sameValueLastIndex + 1 < A.Length &&
                    A[sameValueLastIndex].value == A[sameValueLastIndex + 1].value)
                {
                    sameValueLastIndex += 1;
                    minIndex = Math.Min(minIndex, A[sameValueLastIndex].index);
                }
                long nextValue = A[sameValueLastIndex].value;
                results[prevMinIndex] += (A[index].value - nextValue) * count;

                count += sameValueLastIndex - index;

                index = sameValueLastIndex;
            }
            results[minIndex] += A.Last().value * count;

            foreach (var result in results)
            {
                Console.WriteLine(result);
            }
        }

        public static void Main()
        {
            var old = Console.Out;
            using (var writer = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })
            {
                Console.SetOut(writer);
                new E().Run();
                Console.Out.Flush();
                Console.SetOut(old);
            }
        }
    }
}


Measured memory_bytes: 37596
#include <iostream>
#include <string>

using namespace std;

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if((abs(a-b) <= d && abs(b-c) <= d)) {
    cout << "Yes" << endl;
  } else if(abs(a-c) <= d) {
    cout << "Yes" << endl;
  } else  {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 14 16:45:05 2020

@author: NEC-PCuser
"""

from collections import deque

N, M = map(int, input().split())

g = [[] for _ in range(N)] # 隣接リスト

for i in range(M):
    a_tmp, b_tmp = map(int, input().split())
    g[a_tmp - 1].append(b_tmp - 1)
    g[b_tmp - 1].append(a_tmp - 1)
    
queue = deque([0])

d = [-1] * N
d[0] = 0

while queue:
    v = queue.popleft()
    for i in g[v]:
        if d[i] == -1:
            d[i] = v
            queue.append(i)

out_flg = True
for i in d:
    if i == -1:
        out_flg = False
        break

if out_flg is False:
    print("No")
else:
    print("Yes")
    for i in range(1, len(d)):
        print(d[i] + 1)

        
    

Measured memory_bytes: 33952
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (size_t i = 0; i < size_t(n); i++)
#define forn1(i,n) for (size_t i = 1; i <= size_t(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_N = 100000;
int n, x;
int a[MAX_N];

int main() {
    fastio();

    cin >> n >> x;
    forn(i, n) cin >> a[i];

    ll ans = 0;
    for (int i = 1; i < n; i++) {
        int d = min(a[i], max(0, a[i - 1] + a[i] - x));
        a[i] -= d;
        ans += d;
    }

    for (int i = n - 2; i >= 0; i--) {
        int d = min(a[i], max(0, a[i + 1] + a[i] - x));
        a[i] -= d;
        ans += d;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int par[100000],size[100000];
void init(int n){
  for(int i=0;i<n+1;i++){
    par[i]=i;
    size[i]=1;
  }
}
int root(int x){
  return par[x]==x?x:par[x]=root(par[x]);
}
int siz(int x){
  return x==root(x)?size[x]:size[x]=siz(root(x));
}
bool same(int x,int y){
  return root(x)==root(y);
}
void unite(int x,int y){
  x=root(x);
  y=root(y);
  if(x==y)return;
  size[y]+=size[x];
  par[x]=y;
}
int main(){
  int n,m;cin>>n>>m;
  init(n);
  vector<pair<int,int>>ab(m);
  for(int i=m-1;i>=0;i--)cin>>ab.at(i).first>>ab.at(i).second;
  long long h=(long long)n*(n-1)/2;
  vector<long long> huben(m);
  for(int i=0;i<m;i++){
    huben[i]=h;
    if(!same(ab.at(i).first,ab.at(i).second)){
      h-=(long long)(siz(ab.at(i).first)*siz(ab.at(i).second));
      unite(ab.at(i).first,ab.at(i).second);
    }
  }
  for(int i=m-1;i>=0;i--)cout<<huben[i]<<endl;
}


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

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

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int func(int serching,vector<vector<int>>&path,vector<pair<int,int>>&data,int no,vector<bool>&has){
    has[serching]=true;
    chmin(data[serching].F,no);
  
  // clog<<serching<<" in : "<<no<<endl;
    no++;
    for(auto itr=path[serching].begin();itr!=path[serching].end();itr++){
        if(has[*itr]==false){
       no= func(*itr,path,data,no,has);
        }
    }
    chmax(data[serching].S, no);
  //  clog << serching <<  " out : " << no << endl;
    return no+1;
}
int main(){
    int n;
    cin >>n;
    vector<vector<int>>path(n);
    vector<bool>has(n,false);
    vector<pair<int,int>>data(n,mp(INF,0));
    queue<int>q;
    q.push(0);
    int at;
    int u,k;
    int bef;
    rep(i,n){
        cin>>u>>k;
        u--;
        rep(j,k){
            cin>>bef;
            bef--;
            path[u].push_back(bef);
         //   clog<<u<< " -> "<<bef<<endl;
        }
    }
    rep(i,u){
        sort(all(path[i]));
    }
    int no=1;
    rep(i,n){
        if(has[i]==false){
       no= func(i,path,data,no,has);
        }
    }
    rep(i,n){
        printf("%d %d %d\n",i+1,data[i].F,data[i].S);
    }
}


Measured memory_bytes: 3312
#pragma GCC target ("bmi,popcnt")
#include <cstdio>
#include <vector>
#include <utility>
#include <map>

/*
\cap_{u,v} \cup_{i\in (u,v) path} E_i

g(N) = |{E | {u,v\in M | \cup_{i\in (u,v) path} E_i} = N}|
G(N) = |{E | {u,v\in M | \cup_{i\in (u,v) path} E_i} \subseteq N}|
     = |{E | {u,v\in M-N | \cap_{i\in (u,v) path} !E_i}}|
*/

int n, m;
std::vector<int> E[50];

long long int M[20];
long long int A[1<<20];
std::map<std::pair<int, int>, int> edges;

long long int dfs(int u, int v, int p){
  if(u == v) return 0;
  for(int x: E[u]){
    if(x == p) continue;
    long long int b = dfs(x, v, u);
    if(b != -1) return (1LL << edges[{u, x}]) | b;
  }
  return -1;
}

int main(){
  scanf("%d", &n);
  for(int i = 0; i < n-1; i++){
    int a, b;
    scanf("%d%d", &a, &b);
    E[a-1].push_back(b-1);
    E[b-1].push_back(a-1);
    edges[{a-1,b-1}] = i;
    edges[{b-1,a-1}] = i;
  }
  scanf("%d", &m);
  for(int i = 0; i < m; i++){
    int a, b;
    scanf("%d%d", &a, &b);
    M[i] = dfs(a-1, b-1, -1);   
  }
  long long int ans = 1LL << (n-1);
  for(int i = 1; i < (1<<m); i++){
    A[i] = A[i&(i-1)] | M[__builtin_ctzll(i)];
    long long int x = 1LL << (n-1-__builtin_popcountll(A[i]));
    ans += (1-2*__builtin_parity(i))*x;
  }

  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 8448
import sys
read = sys.stdin.buffer.read
input=lambda :sys.stdin.readline().rstrip()
inputs= sys.stdin.buffer.readlines
INF=float("inf")
MOD=10**9+7
#input = sys.stdin.buffer.readline
sys.setrecursionlimit(2147483647)
#rstrip().decode('utf-8')
#import math
#import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#from scipy.sparse import csr_matrix
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#map(int,input().split())
#from scipy.special import comb

def framod(n, mod, a=1):
	for i in range(1, n + 1):
		a = a * i % mod
	return a


def power(n, r, mod):
	if r == 0: return 1
	if r % 2 == 0:
		return power(n * n % mod, r // 2, mod) % mod
	if r % 2 == 1:
		return n * power(n, r - 1, mod) % mod


def comb(n, k, mod):
	a = framod(n, mod)
	b = framod(k, mod)
	c = framod(n - k, mod)
	return (a * power(b, mod - 2, mod) * power(c, mod - 2, mod)) % mod


def main():
	X,Y=map(int,input().split())
	
	a=max(X,Y)
	b=min(X,Y)
	
	ans=0
	
	t=2*a-b
	
	
	if t%3==0 and t>0 and a<=b*2:
		c1=t//3
		c2=a-2*t//3
		ans=comb(c1+c2,c1,MOD)
		
	print(ans)
		
	
	
	
	
if __name__ == '__main__':
	main()

Measured memory_bytes: 3316
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
#include<cstring>
#include<set>
using namespace std;
using ll = long long;
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
const ll mod = 1e9+7;
const int INF = 1e9;
const ll INFLONG = 1e18;
ll sum;
ll x;
int main(){
  string s;
  ll tmp;
  cin >> s;
  ll length = s.length();
  ll minimum = 1000;
  for(int i=0;i<length-2;i++){
    ll j=i+1,k=j+1;
    tmp = (s[i]-'0')*100 + (s[j]-'0')*10+(s[k]-'0');
    chmin(minimum,abs(753-tmp));
  }
  cout << minimum;
}


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

int main(){
  int64_t N,A,B;
  cin>>N>>A>>B;
  if(N%(A+B)<A)
    cout<<N/(A+B)*A+N%(A+B)<<endl;
  else
    cout<<N/(A+B)*A+A;
}

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

using namespace std;

int main() {
   int N,X;
   cin>>X>>N;
   
   int A[N],i,j;
   map<int,int>P;
   for(i=0;i<N;++i)
   {
       cin>>A[i];
       P[A[i]]++;
       
   }
   
   int temp1=X,temp2=X;
   if(P[X]==0)
   {
       cout<<X<<endl;
   }
   else
   {
       while(1)
       {
           temp1--;
           if(P[temp1]==0)
           {
               cout<<temp1<<endl;
               break;
           }
           temp2++;
           if(P[temp2]==0)
           {
               cout<<temp2<<endl;
               break;
           }
       }
   }
   
   
   
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
	int n;
	cin >> n;
	vi a(n);
	rep(i, n) cin >> a[i];
	int b = 0, c = 0;
	rep(i, n) {
		if(a[i] % 4 == 0) b++;
		else if(a[i] % 2 == 0) c++;
	}
	if(c == 0 && b*2+1 >= n) cout << "Yes" << endl;
	else if(b*2 + c >= n) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 640
n, m = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i).sort

if n >= m
  puts 0
  exit
end
diffs = (xs.size - 1).times.map { |i| xs[i + 1] - xs[i] }.sort
puts diffs[0..-n].inject(&:+)


Measured memory_bytes: 11248
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める

int main(){
    char a;
    cin >> a;
    if(a >= 'a' && a <= 'z'){
        cout << 'a' << endl;
    }else{
        cout << 'A' << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include<cstdio>
#include<algorithm>
using namespace std;
int n,k,x,y;
int main()
{
	scanf("%d%d%d%d",&n,&k,&x,&y);
	if(n<=k)printf("%d",n*x);
	else printf("%d",k*x+(n-k)*y);
} 

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

int main() {
  int H, W, h, w; cin >> H >> W >> h >> w;
  cout << (H - h) * (W - w) << endl;
  return 0;
}

Measured memory_bytes: 256
import math
n = int(input())
a = list(map(int, input().split()))
mod = 10**9 + 7

def lcm(a, b):
    return (a * b) // math.gcd(a, b)

a_lcm = 1
for ai in a:
    a_lcm = lcm(a_lcm, ai)

b_sum = 0
for ai in a:
    b_sum += a_lcm // ai

print(b_sum%mod)


Measured memory_bytes: 74700
import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer a = Integer.parseInt(scanner.next());
        Integer b = Integer.parseInt(scanner.next());
        int result = 0;


        if (b*2 < a) {
            result = a - b * 2;
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 23892
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int W, H, x, y, r;

    cin >> W >> H >> x >> y >> r;
    if ((0 <= x - r && x + r <= W) &&
        (0 <= y - r && y + r <= H)){
            cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


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

int n,h,a[100010],b[100010],mx,ans;

int main()
{
	cin>>n>>h;
	for(int i=0;i<n;i++) cin>>a[i]>>b[i];
	
	sort(a,a+n,greater<int>());
	mx=a[0];
	
	sort(b,b+n,greater<int>());
	for(int i=0;i<n;i++) if(b[i]>mx&&h>0) {h-=b[i];ans++;}
	
	if(h>0) ans+=(h+mx-1)/mx;
	
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 1024
//Twitter@KonoLv1 2020年春からエンジニア見習いデビュー！
 
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
 
int main(void){
    int i,j;            //  ループ文に使用
    int x,y,z;
    int n;
    int count1,count2,count;   //  カウント用に使用
    int boxa[1024] = {};
    int boxb[1024] = {};
    int boxaa[1024] = {};
    int boxbb[1024] = {};
    int a,b,c,h,w;
    a = b = c = i = 0;
    int mode = 0;
    int n2 = 0;
    count = count1 = count2 = 0;
    int end = 0;
 
    //  入力処理
    scanf("%d",&n);
    
    // メイン処理
    if (n % 2 == 0){
        count = n / 2 - 1;
    }else{
        count = n / 2;
    }
    // 出力処理
    
    printf("%d",count);
        
  
}

Measured memory_bytes: 128
#include <stdio.h>
int main(void){
   int a, b;
   char op;
   while(1){
   scanf("%d %c %d", &a, &op, &b);
   if (op == '?')
 
   break;
   
   0 <= a,b <= 20000;
   
   if(op == '+'){
       printf("%d\n", a + b);
   }
   else if(op == '-'){
       printf("%d\n", a - b);
   }
   else if(op == '*'){
       printf("%d\n", a * b);
   }
   else if(op == '/'){
       printf("%d\n", a / b);
   }
   }
    return (0);
    
}



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

int main(){
  string s; cin >> s;
  ll K; cin >> K;
  int ans = 1, index;
  bool ok = true;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '1') continue;
    else{
      ans = s[i] - '0';
      index = i;
      break;
    }
  }
  if(index < K) cout << ans << endl;
  else cout << 1 << endl;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

class Dice {
public:
    vector<int> eye;
    int t, e, w, s, n, d;
    Dice(vector<int> v) {
        eye = v;
        t = eye[0];
        s = eye[1];
        e = eye[2];
        w = eye[3];
        n = eye[4];
        d = eye[5];
    }
    void rotate(char dist);
};

void Dice::rotate(char dist) {
    char temp;
    switch (dist) {
    case 'E':
        temp = t;
        t = w; w = d; d = e; e = temp;
        break;
    case 'N':
        temp = t;
        t = s; s = d; d = n; n = temp;
        break;
    case 'S':
        temp = t;
        t = n; n = d; d = s; s = temp;
        break;
    case 'W':
        temp = t;
        t = e; e = d; d = w; w = temp;
        break;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vi d(6); for (int i = 0; i < 6; i++) cin >> d[i];
    auto dice = Dice(d);
    string s; cin >> s;
    for (int i = 0; i < s.size(); i++) {
        dice.rotate(s[i]);
    }
    cout << dice.t << endl;
    return 0;
}


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

void solve()
{
    long long int k;
    cin >> k;
    queue<long long int> q;
    long long int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    for(auto i : arr)
        q.push(i);
    long long int x = 0;
    while(k--)
    {
        x = q.front();
        q.pop();
        if(x % 10 != 0)
            q.push(10*x + (x % 10) - 1);
        q.push(10*x + (x % 10));
        if(x % 10 != 9)
            q.push(x*10 + (x % 10) + 1);
    }
    cout << x;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
}

Measured memory_bytes: 1792
/*
Author : N_o_o_B
Created : March 14 2020 17:54:39 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;
int n;
vector<string> ans;
void gen(int ind,int foo,string s){
    if(ind==n){
        ans.pb(s);
        return;
    }
    fori(i,foo){
        gen(ind+1,foo,s + char('a'+i));
    }
    if(foo < 25) gen(ind+1,foo + 1,s + char('a'+foo));
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;
    cin >> n;
    gen(0,0,"");
    sort(all(ans));
    for(auto s:ans){
        cout << s << endl; 
    }

    time_taken();
    return 0;
}

Measured memory_bytes: 7796
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
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; }

int main()
{
    int X,Y,Z;
    cin >> X >> Y >> Z;

    cout << Z  << " " << X << " " << Y << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb=new StringBuilder();
		char p='#',n='\n';
		while(true){
			String s=br.readLine();
			if(s.equals("0 0")) break;
			String[] a=s.split(" ");
			int H=Integer.parseInt(a[0]);
	        int W=Integer.parseInt(a[1]);
			for(int i=0;i<H;i++){
				for(int j=0;j<W;j++){
					sb.append(p);
				}
				sb.append(n);
			}
			sb.append(n);
		}
		System.out.print(sb);
	}
}

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

string s;
int k;
vector <string> V;

int main()
{
	cin >> s;
	cin >> k;
	for (int i = 0; i < s.length(); i++) {
		string cur;
		for (int j = i; j < s.length() && j < i + k; j++) {
			cur += s[j];
			V.push_back(cur);
		}
	}
	sort(V.begin(), V.end()); V.erase(unique(V.begin(), V.end()), V.end());
	cout << V[k - 1] << endl;
	return 0;
}

Measured memory_bytes: 1660
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>

#define roop(i, n) for(int i=0;i<n;i++)

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

constexpr ull mod = 1e9+7;
constexpr int N = 13;
ull dp[100010][N];

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

int main() {
	int n;
	cin >> n;
	ll T = 1, A = 1;
	for (int i = 0; i < n; i++) {
		int t, a;
		cin >> t >> a;
		ll s = max( (T + t - 1)/t, (A + a - 1)/a);
		T = s * t;
		A = s * a;
	}
	cout << T + A << endl;
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    int N, M; cin >> N >> M;
    int now = 0;
    vector<int> num(N, 1);
    vector<int> can(N, 0);
    can[0] = 1;
    rep(i, M) {
        int x, y; cin >> x >> y;
        x--, y--;
        num[x]--, num[y]++;
        if(can[x]) {
            can[y] = 1;
            if(num[x] == 0) can[x] = 0;
        }
    }
    int ans = 0;
    rep(i, N) if(can[i]) ans++;
    cout << ans << '\n';
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
	int A, B, C, D, E, F; cin >> A >> B >> C >> D >> E >> F;
	ll M_mother = inf, M_child = 0;
	int mt_ans = 0, ms_ans = 0;
	for(int i = 0; i <= 30; i++) {
		for(int j = 0; j <= 30; j++) {
			if(i == 0 && j == 0) continue;
			int mw = 100 * (i * A + j * B);
			if(mw > F) break;
			for(int u = 0; u <= (mw * E / 100); u++) {
				for(int v = 0; v <= (mw * E / 100); v++) {
					int ms = u * C + v * D;
					if(mw + ms > F) break;
					if(ms > mw * E / 100) break;
					ll moist_mother = mw + ms, moist_child = 100 * ms;
					if(moist_child * M_mother >= M_child * moist_mother) {
						M_mother = moist_mother; M_child = moist_child;
						mt_ans = mw + ms;
						ms_ans = ms;
					}
				}
			}
		}
	}
	cout << mt_ans << " " << ms_ans << endl;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
  llvec a(N, 0);
  rep(i, N){
    cin >> a[i];
  }
  sort(ALL(a));
  cout << a[N-1]-a[0];
  
  return 0;
}


Measured memory_bytes: 256
n=int(input())
import numpy as np
a=np.sort(np.array(input().split(),dtype=int))
DIV=10**9+7
if n%2==1:
  if a[0]!=0:
    print(0)
    exit(0)
  a=a[1:]
  a-=1    
for i in range(len(a)):
  if a[i]!=i+(i%2==0):
    print(0)
    exit(0)
print((2**(len(a)//2))%DIV)


Measured memory_bytes: 22612
N = gets.to_i
a = gets.split(" ").map(&:to_i)
ans = 0
flag = false
while true
  a.each do |n|
    flag = true if n.odd?
  end
  break if flag == true

  for i in 0..(N-1) do
    a[i] = a[i] / 2
  end
  ans += 1
end
puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>

using namespace std;

#define ll long long
#define db double
#define clr(a, b) memset(a, b, sizeof(a))

const int maxn = 5e5 + 10;
const int inf = 0x7ffffff;
const db pi = acos(-1.0);
void solve()
{
    int r;
    cin >> r;
    cout.precision(10);
    cout << (db)pi * r * 2 << "\n";

}

int main()
{
    //freopen("out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T = 1;
    //cin >> T;
    while(T-- > 0)
        solve();

}

Measured memory_bytes: 3784
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//大小比較(大)
long long int big(long long int a, long long int b) {
	if (a >= b) {
		return a;
	}
	else {
		return b;
	}
}

//大小比較(小)
long long int small(long long int a, long long int b) {
	if (a >= b) {
		return b;
	}
	else {
		return a;
	}
}

main() {
	long long int a=0,b=0,c=0,n, m, k = 0;
	char str[5],str2[5];
	
	scanf("%lld%lld",&a,&b);
	
	 printf("%lld", a*a-b); 
}

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

vector< vector< int > > g;
vector< int > state;

int rec(int v){
	int found = 0;
	state[v] = 0;
	
	for(vector< int >::iterator it = g[v].begin(); it != g[v].end(); ++it){
		if(state[*it] == -1){
			found = max(found, rec(*it));
		}else if(state[*it] == 0){
			found = 1;
		}
	}
	
	state[v] = 1;
	return found;
}

int main(){
	int v, e, s, t, f = 0;
	
	cin >> v >> e;
	
	g.resize(v);
	state.resize(v);
	
	for(int i = 0; i < e; ++i){
		cin >> s >> t;
		g[s].push_back(t);
	}
	
	for(int i = 0; i < v; ++i){
		state[i] = -1;
	}
	
	
	for(int i = 0; i < v; ++i){
		if(state[i] == -1){
			if(f = rec(i)){
				break;
			}
		}
	}
	
	cout << f << endl;
	return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 3e5 + 7;
const LL Mod = 1e9 + 7;
int n;
LL a[maxx];
LL ans;

int main() {
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int bit = 0; bit <= 60; bit++) {
		LL cnt1 = 0, cnt0 = 0;
		LL x = 1LL << bit;
		for(int i = 1; i <= n; i++) {
			if(a[i] & x) cnt1++;
			else cnt0++;
		}
		//0的个数*1的个数 = 第bit位异或产生1的总数
		x %= Mod, cnt0 %= Mod, cnt1 %= Mod;
		ans = (ans + (x * (cnt0 * cnt1 % Mod) % Mod)) % Mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
    string N;
    int K;
    cin >> N >> K;
    int n = N.size();

    vector<vector<vector<int>>> dp(105, vector<vector<int>>(4, vector<int>(2, 0)));
    dp[0][0][0] = 1;
    rep(i, n) rep(j, 4) rep(k, 2)
    {
        int nd = N[i] - '0';
        rep(d, 10)
        {
            int ni = i + 1, nj = j, nk = k;
            if (d != 0)
                nj++;
            if (nj > K)
                continue;
            if (k == 0)
            {
                if (d > nd)
                    continue;
                else if (d < nd)
                    nk = 1;
            }
            dp[ni][nj][nk] += dp[i][j][k];
        }
    }
    cout << dp[n][K][0] + dp[n][K][1] << endl;
    return 0;
}

Measured memory_bytes: 256