akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())

#define pb emplace_back
#define fi first
#define se second

using namespace std;

using ld = long double;
using ll = long long int;

const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ll MOD = 998244353;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> void UNIQUE(vector<T> &a){ a.erase(unique(a.begin(), a.end()), a.end()); }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll in(){long long int x; scanf("%lld", &x); return x;}
ld fin(){double x; scanf("%lf", &x); return x;}
char yuyushiki[1000010]; string stin(){scanf( "%s", yuyushiki ); return yuyushiki;}

// head

vector<int> v, s;
vector<bool> used;
void dfs(int x){
  used[x] = true;
  s.pb(x);
  if(!used[v[x]]){
    dfs(v[x]);
  }
}

const ll N = 100010;

int main(){

  vector<ll> ps(0);
  vector<bool> isp(N, true);
  isp[0] = isp[1] = false;
  FOR(i, 2, N){
    if(isp[i]){
      ps.pb(i);
      for(ll j = i*2; j < N; j += i){
        isp[j] = false;
      }
    }
  }

  ll n = in();
  vector<ll> b(n);
  REP(i, n){
    b[i] = in();
  }

  sort(b.begin(), b.end());
  
  ll res = b[0] % MOD;
  YYS(w, ps){
    ll cur = w;
    ll cnt = 0;
    while(cur <= n - 1){
      cnt += (n - 1) / cur;
      cur *= w;
    }
    for(ll i = w; i < n; i += w){
      ll j = 0;
      cur = b[i];
      while(cur % w == 0){
        cur /= w;
        j++;
      }
      cur = i;
      while(cur % w == 0){
        cur /= w;
        j--;
      }
      if(j < 0){
        cnt += j;
      }
    }
    // cout << w << " " << cnt << endl;
    REP(i, cnt){
      res *= w;
      res %= MOD;
    }
  }

  cout << res << endl;
  
  return 0;
}


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

set <char> ch = {'A', 'C', 'T', 'G'};
int main() {
	string s;
	cin >> s;
	int mx = 0, x = 0;
	for(int i = 0; i < (int)s.size(); i++){
		if(ch.count(s[i])) x++;
		else{
			if(x > mx) mx = x;
			x = 0;
		}
		if(i + 1 == (int)s.size()){
			if(x > mx) mx = x;
			x = 0;
		}
	}
	cout << mx << "\n";
	return 0;
}


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

ll t[200005];

int main()
{
    ll n, T;
    ll ans;

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

    ans = T;
    for (ll i = 1; i < n; i++) {
        if (t[i] - t[i - 1] >= T) {
            ans += T;
        } else {
            ans += t[i] - t[i - 1];
        }
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	int n , k; 
	cin >> n >> k ; 
	vi a(n) ; re(a);
	sort(all(a));
	int ans = 0 ;
	rep(i,0,k) ans+=a[i];
	cout << ans << endl; 
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3644
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
//#define hacks
#ifdef hacks
    #include <boost/math_fwd.hpp>
    #include <boost/multiprecision/cpp_int.hpp>
#endif
//#define dbg
#define p std::pair
#define vec std::vector
#define umap std::unordered_map
#define mp std::make_pair
#define all(cont) (cont).begin(), (cont).end()
#define ll long long
#define pi (acos(-1))
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);

int main()
{
	unsigned ll k,n;
	cin>>k>>n;
	vector<unsigned ll>v(n);
	rep(i,n){
		cin>>v[i];
	}

	 unsigned ll a=0;
	 for(unsigned ll i=n;i!=1;--i){
a=max(a,v[i-1]-v[i-2]);
#ifdef dbg 
cout<<i<<' '<<v[i]<<' '<<v[i-1]<<endl;
#endif
	 }
	 a=max(a,k-v[v.size()-1]+v[0]);
	 cout<<k-a<<endl;
return 0;
}

ll extgcd(ll a, ll b, ll& x, ll& y)
{
    if (b == 0) {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) {
        is_prime[i] = true;
    }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++) {
        if (is_prime[i]) {
            for (unsigned ll j = 2 * i; j <= N; j += i) {
                is_prime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}


Measured memory_bytes: 4796
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e9+7;

int main(){
    ll x;
    cin >> x;
    ll sum=0;
    for(ll i=1;i<=100000;i++){
        sum+=i;
        if(sum>=x){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
int main(void){
int N;
  scanf("%d",&N);
  int A[N+1],x[N+1][211][2],y[N+1][211][2],mujunn=0,flag=0,max=0;
  for(int i=0;i<N;i++){
scanf("%d",&A[i]);
    for(int j=0;j<A[i];j++){
  scanf("%d %d",&x[i][j][0],&y[i][j][0]);
    }
  }
  int honest[N+1],c;
  for(int i=0;i<(1<<N);i++){///333
    c=0;
    mujunn=0;
    //printf("%dパターン目",i+1);
    for(int j=0;j<N;j++){
      if(i&(1<<j)){
      honest[c]=j+1;
        c++;
      //  printf("%dさん\t",j+1);
      }
    }
   // printf("合計%d人\n",c);
    for(int l=0;l<c;l++){  //正直者候補のうち誰に注目するか222
      if(mujunn==1){
        break;
      }
		for(int j=0;j<A[honest[l]-1];j++){  //証言を一つ一つ注目111
          if(mujunn==1)break;
          for(int k=0;k<c;k++){
            if(x[honest[l]-1][j][0]==honest[k]) {   //証言された人が正直者か否か
             										//for回し終えた時点でflag=0ならピエロ
              flag=1;}
          
        }
      
      if(!flag){
        if(y[honest[l]-1][j][0]==1){
          		mujunn=1;
              // printf("%dさんはピエロだが、%d(正直)と証言しているので矛盾\n",x[honest[l]-1][j][0],
                //        y[honest[l]-1][j][0]);
                                   }
      }
      else {
        if(y[honest[l]-1][j][0]==0){
          mujunn=1;
          // printf("%dさんは正直者だが、%d(ピエロ)と証言しているので矛盾\n",x[honest[l]-1][j][0],
            //            y[honest[l]-1][j][0]);
        }
      }
                flag=0;
       }//証言1つに関するfor文閉じ111
	  }//222   
      if(mujunn==0){          //矛盾テストクリアの時
        if(c>max){max=c;
        //printf("更新\n");
                 }
      }

      			
  }	///333
printf("%d",max);

  return 0;
}
       

    

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

int main(void) {
	int d[4][4] = { 0 };
	for (int i = 1; i < 4;i++) {
		for (int j = 1;j < 4;j++) {
			cin >> d[i][j];
		}
	}
	for (int j = 1;j < 3;j++) {
		int sa = d[j][1] - d[j + 1][1];
		for (int i = 2;i < 4;i++) {
			if (sa != d[j][i] - d[j + 1][i]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	for (int j = 1;j < 3;j++) {
		int sa = d[1][j] - d[1][j + 1];
		for (int i = 2;i < 4;i++) {
			if (sa != d[i][j] - d[i][j+1]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}


	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

inline ll read(){
    ll Hashimoto=0;
	bool Kanna=1;
    char I_Love=getchar();
    while(I_Love<'0'||I_Love>'9'){
        if(I_Love=='-')Kanna=0;
        I_Love=getchar();
    }
    while(I_Love>='0'&&I_Love<='9'){
        Hashimoto=Hashimoto*10+I_Love-'0';
        I_Love=getchar();
    }
    return (Kanna?Hashimoto:-Hashimoto);
}
template<typename T1,typename T2> inline void Umax(T1 &a,T2 b){
	if(a<b)a=b;
}
template<typename T1,typename T2> inline void Umin(T1 &a,T2 b){
	if(a>b)a=b;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<(Kanna);++I_Love)cout<<Hashimoto[I_Love]<<(I_Love==(Kanna)-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<(Kanna);++I_Love)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define UNIQUE(Kanna) Kanna.erase(unique(Kanna.begin(),Kanna.end()),Kanna.end());
#define inf (1000000000)
#define linf (1000000000000000000ll)
#define mod (1000000007)

int k,x;

int I_Love_Hashimoto_Kanna() {
	//完全想清楚了再开始写。
	//写不顺、不知道怎么写、很乱的时候，停下来好好想想。
	//做得慢总比做不出好。
	fastio;
	cin>>k>>x;
	vi a;
	FOR(i,x-k+1,x+k){
		if(i>=-1000000&&i<=1000000){
			a.push_back(i);
		}
	}
	Tall(a,a.size());
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

ll a[100001] = {};
int main() {
	ll n; cin >> n;
	ll maxV = 0;
	rep(i, 0, n) {
		cin >> a[i];
		maxV = max(maxV, a[i]);
	}

	ll minV = 1e18;

	ll center = 0;
	rep(i, 0, n) {
		if (a[i] != maxV) {
			if (abs(2 * a[i] - maxV) <= minV) {
				minV = abs(2 * a[i] - maxV);
				center = a[i];
			}
		}
	}

	cout << maxV << " " << center << endl;
	return 0;
}

Measured memory_bytes: 1024
using System;
class Program
 {
   	static void Main(string[] args)
        {
    　　	string a = Console.ReadLine(); //標準入力
		string[] aa = a.Split(' ');
		
	       	int X = int.Parse(aa[0]);
       		int N = int.Parse(aa[1]);
      if(N== 0){
     		Console.WriteLine("{0}", X);
        return;
      }
		string b = Console.ReadLine(); //標準入力
		string[] bb = b.Split(' ');
		
		int[] cc = new int[bb.Length];
		for(int i = 0; i< cc.Length; i++){
      			cc[i]= int.Parse(bb[i]);
      	}	
		
		
  		int count = 101;
      	int bob = -2;
		for(int i = -2; i < 102; i++){
          bool test = false;
          for(int j = 0; j< cc.Length; j++){
      		test = test || i == cc[j];
 	     }
        	if(!test){
      			int abs = (int) (Math.Abs(i-X));
               	if(count>abs){
                    count = abs;
                    bob = i;
                 }
               }
   		}
     		Console.WriteLine("{0}", bob);
        }
 
  	
	static void changev(int h){
    
  	}
 }

Measured memory_bytes: 27516
#include <bits/stdc++.h>
#define ll long long
ll mod = 1e9+7;
using namespace std;
int main() {
    ll n,k;cin>>n>>k;

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

    ll rights[n],lefts[n];
    rights[n-1] = 0;
    lefts[0] = 0;
    for(int i = 0; i < n-1; i++)
    {
        ll ans = 0;
        for(int j = i+1; j < n; j++)
            if(a[j] < a[i])
                ans++;
        rights[i] = ans;
    }   

    for(int i = 1; i <n ; i++)
    {   int ans = 0;
        for(int j = 0; j < i; j++)
            if(a[j] < a[i])
                ans++;

        lefts[i] = ans;
    }

    ll ans = 0;
    ll prod = k*(k+1)/2;
    prod%=mod;
    for(int i = 0; i < n; i++)
    {
        // cout<<rights[i]<<" ";
        ans = (ans%mod + (rights[i]*prod)%mod)%mod;
    }
    ll prod2 = k*(k-1)/2;
    prod2%=mod;
    for(int i = 0; i < n; i++)
    {
        ans = (ans%mod + (lefts[i]*prod2)%mod)%mod;
    }
    // ll sum = 0;
    // for(int i = 0; i < )
    cout<<ans<<"\n";

    return 0;
}


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

int main(void){
	char str[1000000];
	scanf("%s",str);

	int i;
	int count0 = 0,count1 = 0;

	for(i=0;str[i]!='\0';i++){
		if(str[i] == '0')count0++;
		if(str[i] == '1')count1++;
	}
	printf("%d\n",(count0>count1)?(count1 * 2):(count0 * 2));

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	
	int n,max,k,sum;
	int L[11];
	
	scanf("%d", &n);

	for (int k = 1; k <= n; k++) {
		if (k != n) {
			scanf("%d ", &L[k]);
		}
		else {
			scanf("%d", &L[k]);
		}
		
	}

	max = 0;
	sum = 0;

	for (k = 1; k <= n;k++) {
		sum += L[k];

		if (L[k] >= max) {
			sum += max;
			max = L[k];
			sum -= L[k];
		}
		
		
	}

	if (max < sum) {

		printf("Yes");
	}
	else {

		printf("No");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>
#include <bitset>

#define for0(i, N)    for (int i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (int i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (int i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (int i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (int i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (int i = (x), a = 0; a < (N);  \
                              i = (i + 1) % (N), ++a)

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b, int){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b + 1;
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b++;
    return temp;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b, int){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b - 1;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b--;
    return temp;
}

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef set<ll> sll;
typedef unordered_set<ll> usll;

ll fact(int n, int i = 1){
    return n == 0 ? i : fact(n - 1, i * n);
}

ll calc(vector<int> const &v, int n){
    ll result = 1;
    set<int> s;

    for0(i, n) s.insert(i + 1);

    for0(i, n){
        int y = distance(s.begin(), find(s.begin(), s.end(), v[i]));

        result += fact(n - i - 1) * y;
        s.erase(v[i]);
    }

    return result;
}

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

    vector<int> p(n), q(n);

    for0(i, n){
        cin >> p[i];
    }

    for0(i, n){
        cin >> q[i];
    }

    // cout << calc(p, n) << "  " << calc(q, n) << "\n";

    cout << abs(calc(p, n) - calc(q, n));

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    int N;
    cin >> N;
    vector<int> a(N);
    for (auto &&i : a) {
        cin >> i;
    }

    SORT(a);
    int ans, mn = INF32;
    for (auto &&i : a) {
        int mid = abs(a[a.size() - 1] - 2 * i);
        if (chmin(mn, mid)) {
            ans = i;
        }
    }
    std::cout << a[a.size() - 1] << " " << ans << '\n';

    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
void maxHeapify(int *,int,int);
void BUILD(int *,int);
int parent(int);
int left(int);
int right(int);
int main(){
  int i,n;
  scanf("%d",&n);
  n++;
  int H[n];
  for(i=1;i<n;i++){
    scanf("%d",&H[i]);
  }
  BUILD(H,n);
  for(i=1;i<n;i++){
    printf(" %d",H[i]);
    
  }
  printf("\n");
  return 0;
}
void maxHeapify(int *H,int i,int n){
  int l;
  l = left(i);
  int r;
  r = right(i);
  int com,largest;
  // 左の子、自分、右の子で値が最大のノードを選ぶ
  if(l <= n && H[l] > H[i]) largest = l;
  else largest = i;
  if(r <= n && H[r] > H[largest]) largest = r;
  if(largest != i){
    com = H[i];
    H[i] = H[largest];
    H[largest] = com;
    maxHeapify(H, largest,n); // 再帰的に呼び出し
  }
}
void BUILD(int *H,int n){
  int i;
  for(i=n/2;i>0;i--){
    maxHeapify(H,i,n);
  }
}
int parent(int k){
  return (int)((double)k/(double)2);
}
int left(int k){
  return 2*k;
}
int right(int k){
  return 2*k+1;
}


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

int main(){
	int money[6]={1,5,10,50,100,500};
	long sum=0;
	for(int i=0; i<6; ++i){
		int a;
		scanf(" %d", &a);
		sum+=a*money[i];	
	}
	
	printf("%d\n", sum>=1000);
	return 0;
}

Measured memory_bytes: 1192
# AOJ 0158: Collatz's Problem
# Python3 2018.6.18 bal4u

while True:
	n = int(input())
	if n == 0: break
	k = 0
	while n > 1:
		if n & 1:
			n = n + ((n+1)>>1)
			k += 2
		else:
			n >>= 1
			k += 1
	print(k)


Measured memory_bytes: 5584
#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 ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
//typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
const ll MOD = 1e9 + 7;
//ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll x, ll y){return x / gcd(x, y) * y;};


int main(void){
  ll N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  vector<ll> B = A;
  sort(B.begin(), B.end());
  reverse(B.begin(), B.end());
  ll a = B[0];
  ll b = B[1];
  if(a == b){
    rep(i, N) cout << a << endl;
    return 0;
  }else{
    rep(i, N){
      if(A[i] == a) cout << b << endl;
      else cout << a << endl;
    }
  }


}


Measured memory_bytes: 4736
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

int main(void) {
  long long X, K, D;
  long long answer;
  
  // get input
  cin >> X >> K >> D;
  X = abs(X);
  
  // calculate
  if(K > X/D) {
    K -= X/D;
    answer = X%D;
    if(K%2 == 1) {
      answer = abs(answer - D);
    }
  } else {
    answer = X - K*D;
  }
  
  // disp answer
  cout << answer << endl;
  
  return 0;
}


Measured memory_bytes: 3532
N,K=map(int,input().split())
A=list(map(int,input().split()))

dp=[[0 for i in range(0,2)] for i in range(0,K+1)]

dp[0][0]='Second'
dp[0][1]='First'

for i in range(1,K+1):
    ans='Second'
    for j in A:
        if i>=j and dp[i-j][1]=='First':
            ans='First'
    dp[i][0]=ans

    ans='First'
    for j in A:
        if i>=j and dp[i-j][0]=='Second':
            ans='Second'
    dp[i][1]=ans

print(dp[K][0])

Measured memory_bytes: 59740
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>
#include <map>
#include<cmath>
#include<queue>

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

int main(void){
  int n;cin >> n;
  vector<int>a(n);
  vector<int>c(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
    c[i]=0;
  }
  for(int i=0;i<n;i++){
    while(a[i]%2==0){
      a[i]/=2;
      c[i]++;
    }
  }
  int sum=0;
  for(int i=0;i<n;i++){
    sum+=c[i];
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 384
#![allow(unused)]
use std::io::{self, Read};

fn get_stdin() -> String {
    let mut buf = String::new();
    let mut stdin = io::stdin();
    stdin.read_to_string(&mut buf);
    return buf
}

fn main() {
    let input = get_stdin();
    let n = input.trim().parse::<i32>().unwrap();
    println!("{}", n.pow(3));
}



Measured memory_bytes: 5024
from collections import deque

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

def bfs(tree, idx, mx_color, n):
    queue = deque([])
    queue.append([idx, n, color+1])
    edge_color = {}
    visit = [False] * (n)
    visit[idx] = True

    while queue:
        parent,p,cc = queue.popleft()
#         print(parent, cc, '-', tree[parent])
        res_color =  my_index(tree[parent], p, -1)+1
        for i, child in enumerate(tree[parent]):
            if visit[child]:
                continue
            child_color = res_color if i+1 == cc else (i+1)
            edge_color[str(min(parent,child))+','+str(max(parent,child))] = child_color
#             print([child, child_color])
            queue.append([child, parent, child_color])
            visit[child] = True
    return edge_color

n = int(input())
tree = [[] for _ in range(n)]
edge = []
for _ in range(n-1):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    tree[a].append(b)
    tree[b].append(a)
    edge.append(str(min(a,b))+','+str(max(a,b)))
color = max(len(i) for i in tree)

edge_color = bfs(tree, 0, color, n)
print(color)
#print(edge_color)
[print(edge_color[c]) for c in edge]


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

vector<UL> E[100];
UL ans[100][2]={};
UL tp=0;
bool F[100]={};

void DFS(UL p){
 F[p]=true;
 tp++; ans[p][0]=tp;
 for(UL e:E[p]){
  if(F[e]) continue;
  DFS(e);
 }
 tp++; ans[p][1]=tp;
}

int main() {
 UL N; scanf("%u",&N);
 rep(i,N){
  UL v; scanf("%u",&v); v--;
  UL c; scanf("%u",&c);
  rep(i,c){
   UL e; scanf("%u",&e); e--;
   E[v].push_back(e);
  }
 }
 rep(i,N) if(!F[i]) DFS(i);
 rep(i,N) printf("%u %u %u\n",i+1,ans[i][0],ans[i][1]);
 return 0;
}



Measured memory_bytes: 3280
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
//ノート　isupperで大文字の判定　islowerで小文字の判定
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
    std::vector<int> a(3);
    rep(i,3)std::cin >> a[i];
    int k;
    std::cin >> k;
    sort(all(a));
    a[2]*=pow(2,k);
    std::cout << sum(all(a),0) << std::endl;
}

Measured memory_bytes: 256
// sala saste wale 2 q chut gaye contest ke dauran :/
#include<bits/stdc++.h> 
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#define mod 1000000007
#define mod2 998244353
#define int long long
#define endl "\n"
#define p_b push_back
#define m_p make_pair
#define fastIO ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
using namespace __gnu_pbds;
template <class T> 
using _ost = tree<
		T, 
		null_type, 
		less<T>, 
		rb_tree_tag, 
        tree_order_statistics_node_update>;

// char alphabet[26] = {'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'};

int32_t main(){
 	fastIO;
 	int n;cin>>n;
 	int k;cin>>k;
 	int p[n+1];for(int i=1;i<=n;i++)cin>>p[i];
 	vector<int> v;
 	int cur=p[1];
 	map<int,int> vis;
 	int st=cur;
 	while(!vis[cur]){
 		v.p_b(cur);
 		vis[cur]++;
 		cur=p[cur];
 		if(vis[cur]){
 			st=cur;
 		}
 	}
 	// cout<<st<<" $$ ";
 	int f=0,s=0;
 	for(int i=0;i<v.size();i++){
 		if(v[i]==st){
 			s=v.size()-f;
 			break;
 		}
 		else f++;
 	}
 	if(k<=f){
 		cout<<v[k-1]<<endl;
 	}
 	else{
 		k-=f;
 		int to=k%s;
 		if(to==0)to=s;
 		to--;
 		cout<<v[(f+to)]<<endl;
 	}
} 			



Measured memory_bytes: 18592
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;


vector<pair<ll, ll> > prime_factorize(ll N) {
    vector<pair<ll, ll> > res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}


void Main()
{
    ll n;
    cin >> n;

    auto primes = prime_factorize(n);

    ll res = 0;
    for (auto pr: primes) {
        ll p = pr.first;
        ll e = pr.second;
        ll m = 0;
        while ((1 + m) * m / 2 <= e) {
            m++;
        }
        m--;
        res += m;
    }

    put(res);
}
signed main(){ Main();return 0;}

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

int main(){
  int T, D, L;
  while(cin >> T >> D >> L, T){
    vector<int> X(T), A(T+D+1,0);
    for(int i = 0; i < T; ++i) cin >> X[i];
    for(int i = 0; i < T; ++i){
      if(X[i] >= L){
        ++A[i];
        --A[i+D];
      }
    }
    int ans = 0;
    for(int i = 0; i < T-1; ++i){
      A[i+1] += A[i];
      if(A[i] > 0){
        //cerr << "#" << i << endl;
        ++ans;
      }
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 4604
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C;
  cin >> A >> B >> C;
  A += B + C;
  if(A > 21){
   cout << "bust" << endl; 
  }
  else{
   cout << "win" << endl; 
  }
}

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

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

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

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

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

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

  ll d=c-(a+b);

  ll l=4*a*b;
  ll r=pow(c-(a+b), 2);
  if((!(d<=0)) && l<d*d)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;


}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program {
  static void Main(string[] args) {
    var Dic = new Dictionary<string, int>();
    int N = int.Parse(Console.ReadLine());
    for (int i = 0; i < N; ++i) {
      string s = Console.ReadLine();
      if (!Dic.ContainsKey(s)) Dic[s] = 0;
      ++Dic[s];
    }

    int M = int.Parse(Console.ReadLine());
    for (int i = 0; i < M; ++i) {
      string t = Console.ReadLine();
      if (!Dic.ContainsKey(t)) Dic[t] = 0;
      --Dic[t];
    }

    int ans = -(1 << 10);
    foreach (int val in Dic.Values) {
      ans = Math.Max(ans, val);
    }
    ans = Math.Max(ans, 0);
    
    Console.WriteLine(ans);
  }
}


Measured memory_bytes: 13152
//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>

typedef long long ll;
using namespace std;
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define out(s) cout << s << endl


int main(){
    int a,b;cin >> a >> b;
    int x=(b-a)*(b-a+1)/2-b;
    out(x);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll mod=1e9+7;
ll dp[1007][10009];
vector<vector<ll>> box;
vector<ll> v;
ll solve(int i,int w)
{
  if(i==0)
    return (w<=box[i][1])?box[i][2]:0;//w<=s[i]
  if(dp[i][w]!=-1)
    return dp[i][w];
  ll ans=solve(i-1,w);
  if(box[i][1]>=w)
    ans=max(ans,box[i][2]+((w+box[i][0]<=10000)?(solve(i-1,w+box[i][0])):0));
  return dp[i][w]=ans;
}
bool cmp(vector<ll>& a,vector<ll>& b)
{
  return (a[0]+a[1])>(b[0]+b[1]);
}
int main()
{
  memset(dp,-1,sizeof(dp));
  int n;
  cin>>n;
  box.resize(n,vector<ll>(3));// w and s
  for(int i=0;i<n;i++)
    cin>>box[i][0]>>box[i][1]>>box[i][2];
  sort(box.begin(),box.end(),cmp);
  cout<<solve(n-1,0)<<endl;
  return 0;
}


Measured memory_bytes: 82480
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;

int main()
{
    ll N, Ma, Mb;
    cin >> N >> Ma >> Mb;
    vector<ll> a(N), b(N), c(N);
    rep(i, N) cin >> a[i] >> b[i] >> c[i];

    vector<vector<vector<ll>>> dp(N + 1, vector<vector<ll>>(N * 10 + 1, vector<ll>(N * 10 + 1, INF)));

    dp[0][0][0] = 0;
    rep(i, N) {
        rep(j, N * 10 + 1) {
            rep(k, N * 10 + 1) {
                dp[i + 1][j][k] = dp[i][j][k];
                if (j < a[i] || k < b[i]) continue;
                if (dp[i][j - a[i]][k - b[i]] == INF) continue;
                chmin(dp[i + 1][j][k], dp[i][j - a[i]][k - b[i]] + c[i]);
            }
        }
    }

    ll ans = INF;
    repd(i, 1, N * 10 + 1) {
        if (i * Ma >= N * 10 + 1 || i * Mb >= N * 10 + 1) break;
        chmin(ans, dp[N][i * Ma][i * Mb]);
    }

    cout << (ans == INF ? -1 : ans) << endl;
    return 0;
}

Measured memory_bytes: 53504
#include <stdio.h>
#include <string.h>

#define LENGTH 256

int main(void) {
  char card[LENGTH];
  char *n;
  int a, b;

  fgets(card, LENGTH - 1, stdin);
  n = strtok(card, " ");
  sscanf(n, "%d", &a);
  if(n != NULL){
    n = strtok(NULL, " ");
    sscanf(n, "%d", &b);
  }

  if(a == 1) a = 14;
  if(b == 1) b = 14;

  if(a == b){
    printf("Draw\n");
  }else if(a > b){
    printf("Alice\n");
  }else{
    printf("Bob\n");
  }
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    ll N,A,B;
    cin >> N >> A >> B;

    if(abs(A-B)%2 == 0) cout << abs(A-B)/2 << endl;
    else{
        ll C = N-B+1, D = N-A+1;
        cout << min((A+B-1)/2,(C+D-1)/2) << endl;
    }

    return 0;

}

Measured memory_bytes: 256
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect

INF = 10**9+7

if __name__ == "__main__":
    n = int(input())
    edge = [[] for i in range(n)]
    side = []
    for i in range(n-1):
        a,b = map(int,input().split())
        a-=1
        b-=1
        edge[a].append(b)
        edge[b].append(a)
        side.append([a,b])
    I = collections.defaultdict(lambda : 0)
    k = 0
    for i in edge:
        k = max(k,len(i))
    print(k)
    color = [INF]*(n)
    d = [INF]*(n)
    d[0] = 0
    q = collections.deque([0])
    while q:
        p = q.popleft()
        color_num = 1
        for v in edge[p]:
            if d[v] == INF:
                q.append(v)
                d[v] = d[p] + 1
                if color_num == color[p]:
                    color_num+=1
                color[v] = color_num
                I[(p,v)] = color_num
                I[(v,p)] = color_num
                color_num+=1
    for i,j in side:
        print(I[(i,j)])

Measured memory_bytes: 135720
import sys
import heapq

N, M = map(int, sys.stdin.readline().split())
A = list(map(lambda x: int(x) * -1, sys.stdin.readline().split()))

heapq.heapify(A)

for _ in range(M):
    tmp = heapq.heappop(A)
    heapq.heappush(A, -1 *  (-1 * tmp // 2))

print(-sum(A))

Measured memory_bytes: 14204
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c,k;
  cin>>a>>b>>c>>k;
  if(a>b){
    swap(a,b);
  }
  if(b>c){
    swap(b,c);
  }
  if(a>b){
    swap(a,b);
  }
  for(int i=0;i<k;i++){
    c*=2;
  }
  cout<<a+b+c<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	double w;
	while(scanf("%lf",&w)!=EOF){
		if(w<=48){printf("light fly");}
		else if(48<w&&w<=51){printf("fly");}
		else if(51<w&&w<=54){printf("bantam");}
		else if(54<w&&w<=57){printf("feather");}
		else if(57<w&&w<=60){printf("light");}
		else if(60<w&&w<=64){printf("light welter");}
		else if(64<w&&w<=69){printf("welter");}
		else if(69<w&&w<=75){printf("light middle");}
		else if(75<w&&w<=81){printf("middle");}
		else if(81<w&&w<=91){printf("light heavy");}
		else {printf("heavy");}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 0
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 N = cin.ReadInt;
            var a = cin.ReadIntArray(N);

            Array.Sort(a);
            Array.Reverse(a);

            var Alice = 0;
            var Bob = 0; 

            for (int i = 0; i < N; i++)
            {
                if (i % 2 == 0) Alice += a[i];
                else Bob += a[i];
            }

            WriteLine(Alice - Bob);
        }
    }

    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: 13268
from bisect import bisect_left
def inpl(): return list(map(int, input().split()))
N = int(input())

U = [0]*32
L = [0]*32
U[0] = 1
for i in range(1, 32):
    if i%2:
        U[i] = U[i-1]*1
        L[i] = L[i-1] + 2**i
    else:
        U[i] = U[i-1] + 2**i
        L[i] = L[i-1] * 1

searched = [0]*32
while N:
    if N < 0:
        d = bisect_left(L, -N)
        assert searched[d] != 1
        searched[d] = 1
        N += 2**d
    else:
        d = bisect_left(U, N)
        assert searched[d] != 1
        searched[d] = 1
        N -= 2**d
print("0"*(sum(searched) == 0) + "".join(map(str, searched)).rstrip("0")[::-1])

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

#define PB          push_back
#define PF          push_front
#define MP          make_pair
#define FI          first
#define SE          second
#define SIZE( A )   int( ( A ).size( ) )
#define ALL( A )    ( A ).begin( ), ( A ).end( )
#define ALLR( A )   ( A ).rbegin( ), ( A ).rend( )

using namespace std;

typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         lf;
typedef pair< int, int >    pii;
typedef pair< ll, ll >      pll;
typedef vector< bool >      vb;
typedef vector< lf >        vd;
typedef vector< ll >        vll;
typedef vector< int >       vi;
typedef vector< pii >       vpii;

const int MAXN = int( 1e5 )+10;
const int MOD  = int( 360 );
const int oo   = INT_MAX;

int n, odd, even, cnt;
int arr[ MAXN ];

bool reduce() {
  if( odd != 1 || even%2 ) return false;
  int gcd = 0;
  for( int i = 0; i < n; ++i ) {
    if( arr[i] == 1 ) return false;
    if( arr[i]%2 ) --arr[i];
    gcd = __gcd( gcd, arr[i] );
  }
  odd = even = 0;
  for( int i = 0; i < n; ++i ) {
    arr[i] /= gcd;
    if( arr[i]%2 ) ++odd;
    else ++even;
  }
  return true;
}

int main( ) {

  #ifdef LOCAL
    freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
  #else
    //freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
    ios_base::sync_with_stdio( 0 );
    cin.tie( 0 );
  #endif

  while( cin >> n ) {
    even = odd = cnt = 0;
    for( int i = 0; i < n; ++i ) {
      cin >> arr[ i ];
      if( arr[i]%2 ) ++odd;
      else ++even;
    }
    while( reduce() ){ ++cnt; }
    even += cnt;
    if( even%2 ) {
      cout << "First\n";
    }
    else {
      cout << "Second\n";
    }
  }
  return 0;
}


Measured memory_bytes: 640
n=int(input())
h=list(map(int, input().split()))
h.append(0)
count=0
for i in range(10000):
    count+=1
    if max(h)==0:
        break
    for j in range(len(h)-1):
        if h[j]>0:
            h[j]-=1
            if h[j+1]==0:
                break
        
            
print(count-1)

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#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;
using ll = long long;
using u64 = uint_fast64_t;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int x,y; cin >> x >> y;
    bool ok = false;
    if (x*2 <= y and y <= x*4) ok = true;
    if (y%2==1) ok = false;
    cout << (ok ? "Yes" : "No") << ln;
}

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

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

    bool flag = false;
    if(n >= 90){
        flag = true;
    }
    else{
        if(n % 10 == 9){
            flag = true;
        }
    }

    if(flag){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

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

int main() {
  int N, A;
  cin >> N >> A;//参考回答
  int L = A; //リンゴ１の味。最小。
  int R = A+N-1; //リンゴNの味。最大。
  // 絶対値が0に近いリンゴを食べる。味は1ずつ単調増加することに注意
  int eat;
  
  if (R <= 0) eat = R;//最大値がマイナスなら食べるべきは最大値
  else if (L >= 0) eat = L;//最小値がプラスなら食べるべきは最小値
  else eat = 0; // 最小値がマイナスで、最大値がプラスで、1ずつ増加していき、NもAも整数なので、かならず味が0のリンゴが存在する
  int sum = (L+R)*N/2-eat; // L+R=2L+N-1なので(L+R)*Nは必ず偶数になっていることに注意
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
N, M, K = map(int, input().split())
INF = int(1e18)
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = A[:]
B = B[:]
i, j = 0, 0
mcnt = 0
tmp = M+1
ccnt = 0
while tmp != 0:
  ccnt += 1
  tmp //= 2
LA = [0 for _ in range(N+1)]
LB = [0 for _ in range(M+1)]
for i in range(N):
  LA[i+1] = LA[i] + A[i]
for i in range(M):
  LB[i+1] = LB[i] + B[i]
for i in range(N+1):
  l, r = 0, M+1
  d = (l + r) // 2
  if LA[i] <= K:
    if LB[M] + LA[i] <= K:
      mcnt = max(i + M, mcnt)
    else:
      for j in range(ccnt + 1):
        if LB[d] + LA[i] <= K:
          l = d
          d = (l + r) // 2
        else:
          r = d
          d = (l + r) // 2
      mcnt = max(i + d, mcnt)
  else:
    break
print(mcnt)

Measured memory_bytes: 48292
#include <cstdio>
using namespace std ;
#define INF (1 << 29)
int N ,M , R ;
int d [201][201];
int r [9];
int A ,B , C ;
int res ;
bool used [9];
void dfs ( int c , int las , int dist )
{
    if ( c == R +1)
    {
        if ( res > dist ) res = dist ;
        return ;
    }
    for ( int i =1; i <= R ; i ++) if (! used [ i ])
    {
        used [ i ]= true ;
        if ( las == -1) dfs ( c +1 ,i ,0);
        else dfs ( c +1 ,i , dist + d [ r [ las ]][ r [ i ]]);
        used [ i ]= false ;
    }
}
int main ()
{
    scanf ( " %d %d %d " ,&N ,& M ,& R );
    for ( int i =1; i <= N ; i ++) for ( int j =1; j <= N ; j ++) if ( i != j ) d [ i ][ j ]= INF ;
    for ( int i =1; i <= R ; i ++) scanf ( " %d " ,& r [ i ]);
    for ( int i =1; i <= M ; i ++)
    {
        scanf ( " %d %d %d " ,&A ,& B ,& C );
        if ( d [ A ][ B ] > C ) d [ A ][ B ]= d [ B ][ A ]= C ;
    }
    for ( int k =1; k <= N ; k ++)
        for ( int i =1; i <= N ; i ++)
            for ( int j =1; j <= N ; j ++)
                if ( d [ i ][ j ] > d [ i ][ k ]+ d [ k ][ j ])
                    d[ i ][ j ]= d [ i ][ k ]+ d [ k ][ j ];
    res = INF ;
    dfs (1 , -1 ,0);
    printf ( " %d \n " , res );
}


Measured memory_bytes: 384