akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

int n;ll k;
ll a[200010];

bool check(int x){
  if(x==0) return false;
  ll cnt=0;
  rep(i,n){
    cnt+=a[i]/x-1+(a[i]%x!=0);
  }
  if(cnt<=k) return true;
  else return false;
}

void solve(){
  cin >> n >> k;
  rep(i,n) cin >> a[i];
  int l=0,r=mod;
  while(r-l>1){
    int mid=(l+r)/2;
    if(check(mid)) r=mid;
    else l=mid;
  }
  cout << r << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

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


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

/* vector<int> A(N); 
    vector<pair<int, int> > tasks; ＃ソートした場合、１つ目でソート
　tie(b, a) = p.at(i); #pairを分割
    tasks.emplace_back(b, a)  ＃配列tasksの最後に(b,a)を追加
　xの二乗:  pow(x, 2.0) 
    小さい順: sort(v.begin(), v.end());
    大きい順: reverse(v.begin(), v.end());
    int: -2,147,483,648 ～ 2,147,483,647
    ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807
    // int型の2次元配列(3×4要素の)の宣言
    vector<vector<int>> data(3, vector<int>(4));
*/
 
int main() {
  
  int A, B, C,D, count=0, ans=0;
  string E;
  cin >> A;
  B=A/500;
  count+=B*1000;
  C=A-B*500;
  D=C/5;
  count+=D*5;
  
  cout << count << endl;
}

Measured memory_bytes: 256
while true do
  n = gets.chomp.to_i
  if n==0 then
    break
  end
  s = n.to_s(8)
  for i in 0..s.length-1 do
    b = s[i].to_i
    if b >= 4 then
      if b >= 5 then
        b += 2
      else
        b += 1
      end
    end
    s[i] = b.to_s
  end
  puts s
end

Measured memory_bytes: 6104
#include<stdio.h>
int main()
{
    int A,B;
    scanf("%d%d",&A,&B);
    if(A==1&&B==2){
        printf("3");
    }
    else if(A==1&&B==3){
        printf("2");
    }
    else if(A==2&&B==1){
        printf("3");
    }
     else if(A==2&&B==3){
        printf("1");
    }
    else if(A==3&&B==1){
        printf("2");
    }
     else if(A==3&&B==2){
        printf("1");
     }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int H, A;

	cin >> H >> A;

	cout << (H + A - 1) / A << endl;

	return 0;
}


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

int main()
{
  double n, k;
  cin >> n >> k;

  double ans = 0;

  for (double i = 1; i <= n; i++)
  {
    double p = 1;
    double x = i;
    while (x < k)
    {
      p /= 2;
      x *= 2;
    }
    ans += p / n;
  }
  cout << fixed << setprecision(12);
  cout << ans << endl;
}


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

int main(){
  long long n, a, b;
  cin >> n >> a >> b;
  
  if((b-a)%2==0){
    cout << (b-a)/2 << endl;
  }else{
    long long tmp;
    tmp = min(b-1, n-a);
    tmp = min(tmp, (b-1+a-1+1)/2);
    tmp = min(tmp, (n-a+n-b+1)/2);
    cout << tmp << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<string> v;
 
int main()
{
  	int k = 0; cin >> k; k--;
	v = {"1","2","3","4","5","6","7","8","9"};	
    while((int)v.size() <= k)
    {
		for(int i = 0; (int)v.size() <= k; i++)
        {
			string s = v[i]; char lst = s[s.length() - 1];
          
          	lst-= 1; 
    		if(lst >= '0')
              v.push_back(s + lst);
 
          	lst++;
           	if(lst <= '9')
              v.push_back(s + lst);
          	lst++;
            if(lst <= '9')
				v.push_back(s + lst);
        }
    }
	cout << v[k] << endl;
}

Measured memory_bytes: 6916
#include<stdio.h>
#define MAX  500
#define inf 1e8
#define WHITE  0
#define GRAY  1
#define BLACK  2


int n;
int A[MAX][MAX];

void dijkstra(){
  int mincost,i,u,j;
  int d[MAX],color[MAX];

  for(i=0;i<n;i++){
    d[i] = inf;
    color[i] = WHITE;
  }

  d[0] = 0;
  color[0] = GRAY;
  while(1){
    mincost = inf;
    u = -1;
    for(i = 0;i < n;i++){
      if(mincost > d[i] && color[i] != BLACK){
        mincost = d[i];
		u = i;

      }
    }
    if(u == -1) break;
    color[u] = BLACK;
    for(j=0;j<n;j++){
      if(color[j] != BLACK && A[u][j] != inf){
        if(d[j] > d[u] + A[u][j]){
          d[j] = d[u] + A[u][j];
          color[j] = GRAY;
        }
      }
    }
  }
  for(i=0; i<n; i++){
    if(d[i] != inf) printf("%d %d\n", i, d[i]);
    else printf("%d -1\n", i);
  }
}

int main(){
  int i,j,u,k,v,c;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      A[i][j] = inf;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
      A[u][v] = c;
    }
  }

  dijkstra();
  return 0;
}


Measured memory_bytes: 2112
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String w = sc.next();
        String t;
        int ans = 0;
        while(true) {
            t = sc.next();
            if(t.equals("END_OF_TEXT")) break;
            if(t.equalsIgnoreCase(w)) ans++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 26388
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main() {

    int N; cin >> N;
    int a[N + 1];
    for (int i = 1; i <= N; ++i) cin >> a[i];

    bool flag = false;
    int cnt = 1;
    int num = 1;
    rep(i,N) {
        if (a[num] == 2) {
            flag = true;
            break;
        } 
        else {
            ++cnt;
        }
        num = a[num];
    }
    
    if (flag) {
        out(cnt);
    }
    else out(-1);



    
    return 0;
}






Measured memory_bytes: 1016
#include<bits/stdc++.h>
using namespace std;
typedef int64_t LL;
#define rep(i,N) for(LL i=0;i<(int)N;i++)
constexpr int MOD=1e9+7;
constexpr LL SCORE=1LL<<20,Z=pow(SCORE,2)+SCORE+1;
int main()
{
  int N;
  LL A=0,x,y;
  vector<LL> bit(20,0);
  cin>>N;
  while(cin>>x)rep(i,20)bit.at(i)+=x>>i&Z,x>>1;
  rep(i,20){x=bit.at(i);rep(j,3){y=x&SCORE-1;x/=SCORE;A=fmod(A+fmod(y%MOD*(N-y)%MOD*pow(2,i+20*j),MOD),MOD);}}
  return cout<<A<<endl,0;
}

Measured memory_bytes: 512
W, H, N = map(int, input().split())
w = 0
h = 0
lx = list()
ly = list()
la = list()
for i in range(1, N+1):
    X, Y, A = map(int, input().split())
    lx.append(X)
    ly.append(Y)
    la.append(A)
    if A == 1 and w < X:
        w = X
    elif A == 2 and X < W:
        W = X
    elif A == 3 and h < Y:
        h = Y
    elif A == 4 and Y < H:
        H = Y
S = (W - w)*(H - h)
if H < h or W < w:
    S = 0
print(S)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


ll s,t;
ll p,q,M,y;


int main(){

	scanf("%lld %lld",&s,&t);

	scanf("%lld %lld %lld %lld",&p,&q,&M,&y);

	ll ans = y;
	ll a = 0;

	ans ^= a;

	for(int i = 2; i <= 100000000; i++){

		a = (a*p+q)%M;
		ans ^= a;
	}

	printf("%lld\n",ans);


	return 0;
}



Measured memory_bytes: 3228
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;

// 入力
int N;
long long h[110000];

// DP テーブル
long long dp[110000];

int main() {
    int N, K; cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 110000; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 0; i < N; ++i) {
        for (int j = 1; j <= K; ++j) {
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }

    // 答え
    cout << dp[N-1] << endl;
}

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

#define ll long long
#define endl "\n";
#define mod 1000000007
#define pii pair<int,int>
#define vii vector<pii>
#define mp make_pair
#define all(a) a.begin(), a.end()
#define mk(arr,n,type) type *arr=new type[n];

void fastio() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main() {
    fastio();
    int n, k, d, s;
    cin >> n >> k;

    bool visited[n + 1];
    for (int i=0; i<=n; i++) {
        visited[i] = false;
    }
    for (int i = 0; i < k; i++) {
        cin >> d;
        for (int j = 0; j < d; j++) {
            cin >> s;
            visited[s] = true;
        }
    }

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (visited[i] == false) ans++;
    }

    cout << ans;


    return 0;
}


Measured memory_bytes: 3636
def resolve():
    N, K = map(int, input().split())
    D = []
    A = []
    for _ in range(K):
        d = int(input())
        a = list(map(int, input().split()))
        D.append(d)
        A.append(a)
    ans = 0
    for i in range(N):
        flag = 0
        for j in range(K):
            if i+1 in A[j]:
                flag = 1
        if flag == 0:
            ans += 1
    print(ans)
resolve()

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

int get_num(int n){
	int total = 1;
	for(int i = 0;i < n; i++){
		total += i + 1;
	}
	return total;
}

int main(){
	int n;
	while(cin >> n){
		cout << get_num(n) << endl;
	}
	return 0;
}

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

vector<int> cal(int D, vector<vector<int>> s, vector<int> t, vector<int> c, vector<int> v) {
    vector<int> last(26);
    for(int i = 0; i < D; i++) {
        if(i == 0)
            v[i] = s[i][t[i]-1];
        else
            v[i] = v[i-1] + s[i][t[i]-1];
        
        last[t[i]-1] = i+1;
        rep(j,26) {
            v[i] -= c[j] * (i+1 - last[j]);
        }
    }
    
    return v;
}

int main() {
    int D;
    cin >> D;
    
    vector<int> c(26);
    rep(i,26) {
        cin >> c[i];
    }
    
    vector<vector<int>> s(D, vector<int>(26));
    rep(i,D) {
        rep(j,26) {
            cin >> s[i][j];
        }
    }
    
    
    vector<int> t(D);
    rep(i,D) {
        t[i] = 1 + (int)(rand()*(26-1+1.0)/(1.0+RAND_MAX));
    }

    int m = 0;
    
    vector<int> d(m), q(m);
    rep(i,m) {
        d[i] = 1 + (int)(rand()*(D-1+1.0)/(1.0+RAND_MAX));
        q[i] = 1 + (int)(rand()*(26-1+1.0)/(1.0+RAND_MAX));
    }
    
    //計算開始
    vector<int> v(D);
    v = cal(D,s,t,c,v);
    
    rep(i,m) {
        int old = t[d[i]-1];
        t[d[i]-1] = q[i];
        vector<int> nv = cal(D,s,t,c,v);
        
        //cout << nv.back() << endl;
        if(v.back() > nv.back())
            t[d[i]-1] = old;
        else
            v = nv;
    }

    rep(i,D) {
        cout << t[i] << endl;
    }
    
    
    return 0;
}




Measured memory_bytes: 3732
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<P>> Graph;


int main(){
  
  int a,b,c;
  cin >> a >> b >> c;
  
  if((b*10 + c) % 4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
 


 return 0;
}

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

using namespace std;

const int INF = 1e9;
const int N = 1e5;
const int MOD = 1e9 + 7;

const double PI = acos(-1);


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n, k, s;
    cin >> n >> k >> s;
    int m = (s == int(1e9) ? s - 1 : s + 1);
    for (int i = 0; i < k; i++)
        cout << s << ' ';
    for (int i = 0; i < n - k; i++)
        cout << m << ' ';
}

Measured memory_bytes: 1280
/*@author hussein zayed ;
    ___  ___
   |\  \|\  \
   \ \  \_\  \
    \ \   ___ \USSEIN
     \ \  \\ \ \
      \ \__\\ \_\
       \|__| \|__|
****************************************
*/

#include <bits/stdc++.h>
using namespace std;
#define fr for(int i=0;i<n;++i)
#define fr1 for(int i=1;i<=n;++i)
#define cinA for(int i=0;i<n;++i){cin>>arr[i];}
#define cinA1 for(int i=1;i<=n;++i){cin>>arr[i];}
#define coutA for(int i=0;i<n;++i){cout<<arr[i]<<" ";}
#define ll long long
#define lnarray sizeof(arr)/sizeof(*arr)
#define vi vector<int>
#define vs vector<string>
void Fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
inline int RD()
{
    int i ;
    cin>>i;
    return i;
}

inline float RF()
{
    float i ;
    cin>>i;
    return i;
}

inline double RDO()
{
    double i ;
    cin>>i;
    return i;
}

inline string RS()
{
    string i ;
    cin>>i;
    return i;
}

inline ll RLL()
{
    ll i ;
    cin>>i;
    return i;
}

int cm[200000];

ll sumSet(ll n)
{
    return (1ll*n*(n+1))/2;
}
string s;


bool isPrime(int n)
{
    if(n==1)
        return false;
    for(int i=2; i*i<=n; ++i)
    {
        if(n%i==0)
            return false;
    }
    return true;
}
int sumDigit(int n){
int sum =0;
  while (n != 0)
    {
        sum+= + n % 10;
        n = n / 10;
    }
    return sum;
}

ll power2(int n){
  ll ans=(1<<n);
  return ans;
}

ll sumpow2(ll n){
 ll sum=(n*(n+1)*(2*n-1))/6;
 return sum;
}

int main(){
    Fast();
//freopen("output.txt" , "w" , stdout);
//freopen("wall.in" , "r" , stdin);
string s=RS();
 if(s[0]==s[2])
 cout<<"Yes";
 else
 cout<<"No";
 }




Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#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 FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(s)-1,i##_len=(int)(n);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int p[100000];
int y[100000];
int z[100000];
int ans[100000];

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int  Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}void hSwap(int x[], int i, int j)
{
	int temp;

	temp = x[i];
	x[i] = x[j];
	x[j] = temp;
}

void ShowData(int x[], int left, int right)
{
	int i;
	for (i = left; i <= right; i++)printf("%d  ", x[i]);
	printf("\n");
}
void QSort(int x[], int left, int right, int n) {
	int i, j;	//左端,右端
	int pivot;	//軸

	i = left;
	j = right;
	pivot = x[(left + right) / 2];

	while (1) {
		if (n > 0) {				//n>0なら昇順、n<=0なら降順
			while ((x[i] < pivot) && (i <= right))i++;	//軸値より大きい要素
			while ((pivot < x[j]) && (i <= right))j--;	//軸値より小さい要素
		}
		else {
			while ((x[i] > pivot) && (i <= right))i++;	//軸値より小さい要素
			while ((pivot > x[j]) && (i <= right))j--;	//軸値より大きい要素
		}
		if (i >= j)	break;
		hSwap(x, i, j);
		i++; j--;
	}
	//ShowData(x, left, right);

	if (left < i - 1)QSort(x, left, i - 1, n);
	if (j + 1 <  right)QSort(x, j + 1, right, n);
}

int gcd(int a, int b) {
	if (b == 0)return a;
	int tmp = a%b;
	a = b;
	b = tmp;
	return gcd(a, b);
}

int main() {
	char s[11];
	scanf("%s", s);

	int len = strlen(s);
	REP(i, len) {
		s[i] -= '0';
	}
	int ans = INF;
	REP(i, len - 2) {
		int tmp = abs(s[i] * 100 + s[i + 1] * 10 + s[i+2]-753);
		ans = Min(ans, tmp);
	}
	PRINTD(ans);
}

Measured memory_bytes: 128
#include <cstdio>
    #include <cmath>
     
    int main(){
        int X,n,i,j,max=1;
        scanf("%d",&X);
        for(n=1;n<=X;n++){
            for(i=2;i<X;i++){
                j=pow(n,i);
                if(j<=X){
                    if(max<j){
                        max=j;
                    }
                }
                else{
                    break;
                }
            }
        }
        printf("%d\n",max);
     
        return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
    string s;
    cin >> s;
    if((s[0]=='7')||(s[1]=='7')||(s[2]=='7')){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
bitset <4000105> dp;
int n, ara[2005];
int main(){
    scanf("%d", &n);
    for(int i=0; i<n; i++) scanf("%d", &ara[i]);
    dp[0]=1;
    for(int i=0; i<n; i++){
        dp|=(dp<<ara[i]);
    }
    int sum=0;
    for(int i=0; i<n; i++) sum+=ara[i];
    double half=sum/2.0;
    int cur=-40000000;
    for(int i=1; i<=sum; i++){
        if(dp[i]==1){
            if(abs(cur-half)>=(abs(i-half))) cur=i;
        }
    }
    printf("%d\n", cur);
    return 0;
}


Measured memory_bytes: 1664
#include<stdio.h>
int A[1000000],n;
int binarySearch(int key){
  int left = 0, right = n, mid;
  while(left < right){
    mid = (left + right)/2;
    if(key == A[mid]) return 1;
    else if(key > A[mid]) left = mid + 1;
    else right = mid;
  }
  return 0;
}
int main(){
  int i,q,num,C = 0;
  
  scanf("%d",&n);
  for(i = 0 ; i < n ; i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i = 0 ; i < q ; i++){
    scanf("%d",&num);
    if(binarySearch(num))C++;
  }
  printf("%d\n",C);
  
  return 0;
}



Measured memory_bytes: 2108
#include <cstdio>
#include <algorithm>
using namespace std;

int main() {
	bool ball[3] = {true, false, false};
	char c1, c2;

	while (scanf("%c, %c", &c1, &c2) != EOF) {
		getchar();
		swap(ball[c1 - 65], ball[c2 - 65]);
	}

	for (int i = 0; i < 3; i++) {
		if (ball[i] == true) {
			printf("%c\n", i + 65);
		}
	}

	return 0;
}

Measured memory_bytes: 976
import java.util.Scanner

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    val input_data = scan.nextInt()
    val hours = input_data / 3600
    val minites = (input_data % 3600) / 60
    val seconds = (input_data % 3600) % 60
    println("${hours}:${minites}:${seconds}")
}



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

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

    long long n = N;
    long long i = 1;
    long long ans = 0;
    while (true)
    {
        if ( n < i or n <=1)
            break;
        if (N % i == 0 and N/(n-1) == N % ( n -1))
        {
            ans += n - 1;
            // cout << n - i << endl;
        }

        i++;
        n = N/i;
        // cout << ans << ' ' << n << ' ' << i << endl;

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

Measured memory_bytes: 256
S=input()

if S[0]=="0":
    a=int(S[1])
else:
    a=int(S[:2])
if S[2]=="0":
    b=int(S[3])
else:
    b=int(S[2:])

if (a>0 and a<=12) and (b>0 and b<=12):
    print("AMBIGUOUS")
elif a>0 and a<=12:
    print("MMYY")
elif b>0 and b<=12:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3064
#include <stdio.h>
#define N 2000002
 
void MaxHeapify(int *, int);
void Insert(int *, int);
void Extract(int *);
 
int h = 0;
 
int main(){
  int a[N], key;
  int i = 0, j;
  char order[8];
 
  while( 1 ){
      scanf("%s", order);
      if(order[2] == 'd') break;
      else if(order[0] == 'i'){
    scanf("%d", &key);
    Insert(a, key);
      }
      else Extract(a);
  }
 
 
  return 0;
}
 
void MaxHeapify(int *a, int i){
  int left, right, large, change;
 
  if(i * 2 <= h) left = i * 2;
  else left = i;
  if(i * 2 + 1 <= h) right = i * 2 + 1;
  else right = i;
 
 
  if(left < h + 1 && a[left] > a[i]) large = left;
  else large = i;
  if(right < h + 1 && a[right] > a[large]) large = right;
   
  if(large != i){
    change = a[i];
    a[i] = a[large];
    a[large] = change;
    MaxHeapify(a, large);
  }
}
 
void Insert(int *a, int key){
  int i, change;
 
  h++;
  i = h;
  a[i] = key;
  while(i > 1 && a[i / 2] < a[i]){
    change = a[i];
    a[i] = a[i / 2];
    a[i / 2] = change;
    i /= 2;
  }
}
 
void Extract(int *a){
  int max;
 
  max = a[1];
  a[1] = a[h];
  h--;
  MaxHeapify(a, 1);
 
  printf("%d\n", max);
}

Measured memory_bytes: 5276
# The question itself is not diffifult, but the website only 
# tested my code with two cases, so I am not sure whether the 
# "accepted" is trustworthy.

# Note: math.inf > math.inf -> False

import math
V = int(input())
E = int(input())
fees = [[math.inf] * V for i in range(V)]
for i in range(V): 
	fees[i][i] = 0
for i in range(E):
	a, b, c, d = map(int, input().split(','))
	fees[a-1][b-1] = c
	fees[b-1][a-1] = d
start, end, funding, cost = map(int, input().split(','))
for i in range(V):
	for j in range(V):
		for k in range(V):
			if (fees[j][k] > fees[j][i] + fees[i][k]):
				fees[j][k] = fees[j][i] + fees[i][k]
if (fees[start-1][end-1]==math.inf or fees[end-1][start-1]==math.inf):
	print(0)
else:
	print(funding-cost-fees[start-1][end-1]-fees[end-1][start-1])

Measured memory_bytes: 5676
H,W=map(int,input().split())
C=[]
for h in range(H):
    S=input()
    C.append([0 if s=='.' else s for s in S])
#print(C)
for h in range(H):
    for w in range(W):
        if C[h][w]=='#':
            down=False if h+1>=H else True
            up=False if h-1<0 else True
            left=False if w-1<0 else True
            right=False if w+1>=W else True
            if up:
                if C[h-1][w]!="#":
                    C[h-1][w]+=1
                if left:
                    if C[h-1][w-1]!="#":
                        C[h-1][w-1]+=1
                if right:
                    if C[h-1][w+1]!="#":
                        C[h-1][w+1]+=1
            if down:
                if C[h+1][w]!="#":
                    C[h+1][w]+=1
                if left:
                    if C[h+1][w-1]!="#":
                        C[h+1][w-1]+=1
                if right:
                    if C[h+1][w+1]!="#":
                        C[h+1][w+1]+=1
            if left:
                if C[h][w-1]!="#":
                    C[h][w-1]+=1
            if right:
                if C[h][w+1]!="#":
                    C[h][w+1]+=1
        else:
            continue
#print(C)
for c in C:
    for n in c:
        print(n,end="")
    print()


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int main(){
	int d;
	cin>>d;
	if(d==25)
		cout<<"Christmas";
	else if(d==24)
		cout<<"Christmas Eve";
	else if(d==23)
		cout<<"Christmas Eve Eve";
	else
		cout<<"Christmas Eve Eve Eve";
	return 0;
}

Measured memory_bytes: 256
s = input()

for i in range(len(s)):
  if ((i+1) % 2 == 0) and (s[i] == "R"):
    print("No")
    break
  elif ((i+1) % 2 == 1) and (s[i] == "L"):
    print("No")
    break
  
  if i == len(s)-1:
    print("Yes")
    break

Measured memory_bytes: 38384
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	long long int n=0,m,a,b,c,d,e;
	long double z,w;
	string str,str2,str3;
	char ch;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>a>>b>>c;
	cout<<min(a*b,c);







	cout<<endl;
} 


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

typedef long long ll;

const int maxn = 1e5 + 10;

int n, m, a, b, q, cor[maxn][14], qwq[maxn], qaq[maxn], c[maxn];

std::vector <int> pb[maxn];

void Work(int st, int deep, int cl)
{
    if(deep == -1) return;
    if(cor[st][deep]) return;
    cor[st][deep] = cl;
    for(int i = 0; i < pb[st].size(); ++ i) Work(pb[st][i], deep-1, cl);
}

int read()
{
	int x=0, ch= getchar(), f=1;
	while(!isdigit(ch)) if(ch == '-')f = -1, ch = getchar();
	while(isdigit(ch)) x = x *10 + ch-'0', ch = getchar();
	return x * f;
} 

int main()
{
    n=read(), m=read();
    for(int i=1;i<=m;i++) a=read(), b=read(), pb[a].push_back(b), pb[b].push_back(a);
    for(int i=1;i<=n;i++) pb[i].push_back(i);
    q=read();
    for(int i=1;i<=q;i++) qwq[i]=read(), qaq[i] = read(), c[i] = read();
    for(int i=q;i>=1;i--) Work(qwq[i], qaq[i], c[i]);
    for(int i=1;i<=n;i++) std::cout<<cor[i][0]<<std::endl;
    return 0;
}

Measured memory_bytes: 13176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int s[200];
int main()
{
 
    ios::sync_with_stdio(false);
    int i,j,k,m,n;
    int ans=0,cnt=0;
    int flag=0;
    int flag1=0;
    cin>>n;
    for(i=1; i<=n; i++) cin>>s[i];
    sort(s+1,s+n+1);
    int gen=s[n],num=0;
    for(i=1; i<=n; i++)
        if(s[i]==gen) num++;
    if(num==1) cout<<"Impossible"<<endl;
    else
    {
        if(gen%2!=0)
        {
 
            k=(gen+1)/2;
            m=k;
            for(i=1;i<=n;i++)
            {
                if(s[i]==k)
                {
                    cnt++;
                }
                if(cnt>2)
                {
                    cout<<"Impossible"<<endl;
                    return 0;
                }
            }
            for(i=1; i<=n; i++)
            {
                if(s[i]<k)
                {
                    cout<<"Impossible"<<endl;
                    return 0;
                }
                if(m==s[i])
                {
                    ans++;
                }
                if(ans==2)
                {
                    ans=0;
                    m++;
                }
                if(m==(gen+1))
                {
                    cout<<"Possible"<<endl;
                    return 0;
                }
            }
            cout<<"Impossible"<<endl;
        }
        else
        {
            k=gen/2;
            m=k;
             for(i=1;i<=n;i++)
            {
                if(s[i]==k)
                {
                    cnt++;
                }
                if(cnt>1)
                {
                    cout<<"Impossible"<<endl;
                    return 0;
                }
            }
            for(i=1; i<=n; i++)
            {
                if(s[i]<k)
                {
                    cout<<"Impossible"<<endl;
                    return 0;
                }
 
                if(m==s[i])
                {
                    ans++;
                }
                if(ans==2&&flag)
                {
                    ans=0;
                    m++;
                }
                else if(ans==1&&!flag)
                {
                    ans=0;
                    m++;
                    flag=1;
                }
                if(m==gen+1)
                {
                    cout<<"Possible"<<endl;
                    return 0;
                }
            }
            cout<<"Impossible"<<endl;
        }
    }
 
    return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define M 1000000007

int main() {

    int n;
    cin >> n;
    vector<ll> a(n, 0);

    ll out = 0;
    ll total = 0;

    rep(i, n) {
        cin >> a[i];
        total += a[i];
        total %= M;
    }

    rep(i, n) {
        total -= a[i];
        if (total < 0) total += M;
        out += ((a[i] * total) % M);
        out %= M;
    }

    cout << out;

    return 0;
}

Measured memory_bytes: 4724
// Created by Nandu Vinodan
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN
#define TC 0 

using namespace std;
using ll = long long;

void testcase() {
    string s; cin >> s;
    cout << s[0] << s[1] << s[2];
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    if (TC)
        cin>>t;
    while(t--) {
        testcase();
    }
    return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		s = s.replaceAll("eraser", "").replaceAll("erase", "").replaceAll("dreamer", "").replaceAll("dream", "");
		if(s.equals("")) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 28672
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

var INF int = 1 << 31

type pair struct {
	total int
	next  int
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
}

type PriorityQueue []pair

func (pq PriorityQueue) Len() int { return len(pq) }

func (pq PriorityQueue) Less(i, j int) bool {
	return pq[i].total <= pq[j].total
}

func (pq *PriorityQueue) Push(x interface{}) {
	item := x.(pair)
	*pq = append(*pq, item)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	*pq = old[0 : n-1]
	return item
}

type edge struct {
	to   int
	cost int
}

var sc = bufio.NewScanner(os.Stdin)

func next() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i

}

func main() {
	sc.Split(bufio.ScanWords)

	var V, E, r int
	fmt.Scanf("%d %d %d", &V, &E, &r)

	edges := make([][]*edge, V)
	dist := make([]int, V)
	done := make([]bool, V)
	queue := make(PriorityQueue, 0, V)

	for i := 0; i < E; i++ {
		var s, t, cost int
		s, t, cost = next(), next(), next()
		edges[s] = append(edges[s], &edge{to: t, cost: cost})

	}

	for i := 0; i < V; i++ {
		dist[i] = INF
	}

	heap.Push(&queue, pair{total: 0, next: r})

	for queue.Len() > 0 {
		item := heap.Pop(&queue).(pair)
		if done[item.next] {
			continue
		}
		done[item.next] = true
		dist[item.next] = item.total

		for _, edge := range edges[item.next] {
			heap.Push(&queue, pair{
				total: edge.cost + item.total,
				next:  edge.to,
			})

		}

	}

	for _, node := range dist {
		if node >= INF {
			fmt.Printf("INF\n")
		} else {
			fmt.Printf("%d\n", node)
		}
	}

}



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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    ll N;
    std::cin >> N;
    for(ll hi = 1; hi <= 3500; hi++) {
        for(ll ni = 1; ni <= 3500; ni++) {
            auto a = N * hi * ni;
            auto b = 4 * hi * ni - N * ni - N * hi;
            if(0 < b && a % b == 0) {
                std::cout << hi << " ";
                std::cout << ni << " ";
                std::cout << a / b << std::endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
S = input()
T = input()
flag = False

def irekae(s):
  List = list(s)
  a = List.pop(0)
  List.append(a)
  res = ""
  for i in range(len(s)):
    res += List[i]
  return res

if S == T:
  flag = True
else:
  for i in range(len(S)):
    S = irekae(S)
    if S == T:
      flag = True
      break
if flag:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9136
#include<bits/stdc++.h>
using namespace std;
int n;
int a[200005];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int c=1;
    for(int i=0;i<n;i++)
	{
        cin>>a[i];
        if(a[i]==c)
		{
            c++;
        }
    }
    cout<<(n-c+1==n?-1:n-c+1)<<endl;
    return 0;
}


Measured memory_bytes: 1024
n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=min(0,min(x)*n)
M=max(0,max(x)*n)
dp=[1]+[0]*(M-m)
dp[x[0]]+=1
for i in range(n-1):
    l=range(m-x[i+1],M+1) if x[i+1]<0 else range(M-x[i+1],m-1,-1)
    for j in l:dp[j+x[i+1]]+=dp[j]
print(dp[0]-1)

Measured memory_bytes: 3064
#include<iostream>

using namespace std;
  
int main(){

  int N,M;
  int A[1000];
  int B;
  int cnt[1000]={0};

  cin>>N>>M;
  for(int i=0;i<N;i++){
    cin>>A[i];
  }

  for(int i=0;i<M;i++){
    cin>>B;
    for(int j=0;j<N;j++){
      if(A[j]<=B){
	cnt[j]++;
	break;
      }
    }
  }

  int maxn=cnt[0];
  int maxi=0;
  for(int i=1;i<N;i++){
    if(maxn<cnt[i]){
      maxn=cnt[i];
      maxi=i;
    }
  }

  cout<<maxi+1<<endl;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int cnt=0;
	string A;
	cin>>A;
	for(int i=0;i<A.size();i++)
	{
		if(A[i]=='R')
			cnt++;
	}
	if(cnt==3)
	{
		cout<<3;
	}
	else if(cnt==2)
	{
		if(A[1]=='S')
		{
			cout<<1;
		}
		else
		{
			cout<<2;
		}
	}
	else if(cnt==1)
	{
		cout<<1;
	}
	else
	{
		cout<<0;
	}


	return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>

int main(void){
    int n,k,x,y;
    scanf("%d",&n);
    scanf("%d",&k);
    scanf("%d",&x);
    scanf("%d",&y);
    if(k <= n){
        printf("%d\n",k*x+(n-k)*y);
    }else{
        printf("%d\n",n*x);
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    vector<string> str(h);
    for(int i=0;i<h;i++){
        cin>>str[i];
    }
    for(int i=0;i<w+2;i++){
        cout<<"#";
    }
    cout<<endl;
    for(int i=0;i<h;i++){
        cout<<"#";
        cout<<str[i];
        cout<<"#"<<endl;
    }
    for(int i=0;i<w+2;i++){
        cout<<"#";
    }
    cout<<endl;
    return 0;
}



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

using namespace std;
int main() {
	int n, m, ans = 0;
	scanf("%d %d", &n, &m);
	vector<int> v(n);
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &v[i]);
		sum += 1LL * v[i];
	}
	double x = (1.0 / (4.0 * m)) * sum;
	for (int i = 0; i < n; i++) {
		if (v[i] >= x)
			ans++;
	}
	if (ans >= m)
		puts("Yes");
	else
		puts("No");
}


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

#define pb          push_back
#define F           first
#define S           second
#define rep(i,a,b)  for(int i=a; i<b; i++)
#define all(a)      (a).begin(),(a).end()
#define wa(x)       cout << (#x) << " -------- " << (x) << endl
#define line1	    printf("---------------------------\n")

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

void pvi(auto v){
	for(auto it:v) cout << it << " ";
	cout << endl;
}

void solve();
signed main() {
	//ios_base::sync_with_stdio(false); cin.tie(NULL);

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

//___________________________________________________________________________________________________________

void solve() {

	vi v(5,0);
	rep(i,0,5) cin>>v[i];
	
	int k;
	cin>>k;

	rep(i,0,5){
		rep(j,0,5){
			if(v[i]-v[j] > k) {
				cout << ":(" << endl;
				return;
			}
		}
		
	}

	cout << "Yay!" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define Next( i, x ) for( register int i = head[x]; i; i = e[i].next )
#define rep( i, s, t ) for( register int i = (s); i <= (t); ++ i )
#define drep( i, s, t ) for( register int i = (t); i >= (s); -- i )
#define re register
#define pb push_back
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 3000 + 5 ; 
int n, A[N], f[N] ;
vector<int> G[N] ; 
void add(int x, int y) { G[x].pb(y), G[y].pb(x) ; }
void dfs(int x, int fa) {
	int mi = A[x] + 1 ; 
	for(int v : G[x]) 
		if(v ^ fa) {
			dfs(v, x) ;
			if( !f[v] ) mi = min( mi, A[v] ) ;
		}
	f[x] = (mi < A[x]) ; 
}
bool check(int x) {
	memset( f, 0, sizeof(f) ) ;
	dfs(x, x) ;
	return f[x] ; 
}
signed main()
{
	n = gi() ; int x, y ; 
	rep( i, 1, n ) A[i] = gi() ; 
	rep( i, 2, n ) x = gi(), y = gi(), add(x, y) ;
	rep( i, 1, n ) {
		if( check(i) ) printf("%d ", i ) ; 
	}
	return 0 ;
}

Measured memory_bytes: 4136
// #include <bits/stdc++.h>
#include <map>
#include <set>
#include <ctime>
#include <cstring>
#include <queue>
#include <iostream>
#include <algorithm>
using namespace std;
 
#define mod 1000000007
#define INF 1000000000

#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
#define len(x) ((int)(x).size())
#define contains(a, x) (a.find(x) != end(a))
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define F(i,a,b) for(int i = (int)(a); i < (int)(b); ++i)
#define RF(i,a,b)for(int i = (int)(a); i >= (int)(b); --i)

typedef double dbl;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef pair<int,int> pi;

#define fast() {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
#define log(x) cout << (x) << endl;


#define exp(x) dbl((6*x)+(5*x))


int main() {
	fast();

	ll a, x;
	cin >> x;

	a = (x / 11) * 2;
	x %= 11;

	a += (x > 6)?2:(x > 0)?1:0;
	log(a)

	return 0;
}





Measured memory_bytes: 256
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (a); i < (int)(b); i++)
#define MAX(a, b) ((ll)(a) > (ll)(b)) ? (a) : (b)
#define MIN(a, b) ((ll)(a) > (ll)(b)) ? (b) : (a)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll mod = 1000000007;
pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1}};




ll a[6];
ll k;

ll m = inf;
ll vis[5];

int dfs(int num, int jun, stack<ll> s, int ans) {
	

	vis[num] = 1;

	if (jun == 4) {
		for (int i = 0; i < 5; i++) {

			if (ans % 10 != 0) {
				if (vis[i] == 0 && m > ans + (10 - ans % 10) + a[i]) {
					m = ans + (10 - ans % 10) + a[i];

				}

			}
			else {
				if (vis[i] == 0 && m > ans + a[i]) {
					m = ans + a[i];

				}



			}
		}

		return 0;
	}



	for (int i = 0; i < 5; i++) {
		if (vis[i] == 0) {
			if (ans % 10 != 0) {
				s.push(i);
				dfs(i, jun + 1, s, ans + (10 - (ans % 10)) + a[i]);
				s.pop();
			}
			else {
				s.push(i);
				dfs(i, jun + 1, s, ans + a[i]);
				s.pop();
			}
			vis[i] = 0;
		}

	}

}


int main() {
	
	stack<ll> s;
	rep(i, 5)
		cin >> a[i];


	rep(i, 5) {

		s.push(i);
		dfs(i, 1, s, a[i]);
		s.pop();
		vis[i] = 0;

	}
	

	cout << m << endl;
	return 0;
}

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

int main(int argc,char* argv[]){
  double v,time,high,floor;
  
  while(scanf("%lf",&v) != EOF){
    time = v/9.8;
    high = 4.9 * time * time;
    floor = ceil((high + 5.0)/(5.0));

    printf("%d\n",(int)floor);
    
  }
  

  return 0;
  
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;


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

    ll n;
    cin >> n;
    ll ans=1;
    for(int i = 1;i <= n;++i){
        ans = ans * i % mod;
    }
    cout << ans << endl;
    
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	string s;
	cin>>n>>s;
	string t,l;
	if(n%2!=0){
		cout << "No";
		return 0;
	}
	for(ll i=0;i<n/2;i++){
		t+=s[i];
	}
	for(ll i=n/2;i<n;i++){
		l+=s[i];
	}
	if(t==l){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	// your code goes here
	return 0;
}

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

int input() {
  int x;
  cin >> x;
  return x;
}

vector<int> vecinput(int x) {
  vector<int> vec(x);
  for (int i = 0; i < x; i++)
    cin >> vec[i];
  return vec;
}
 
int main() {
    vector<int> ABC = vecinput(3);
    vector<int> tanka = {5,5,7};
    sort(ABC.begin(), ABC.end());
    if (ABC==tanka){
        cout << "YES" <<endl;
    }
    else{
        cout << "NO" <<endl;
    }
}

Measured memory_bytes: 3560
n, m = list(map(int, input().split()))
nn = min(n, m)
mm = max(n, m)

if nn == mm:
  if nn == 1:
    print(1)

  else:
    print(max(nn-2, 0) * max(mm-2, 0))
  
else:
  if n != 2:
    print(max(nn-2, 1) * max(mm-2, 1))
  else:
    print(0)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    
    vector<bool> used(N + 1);
    vector<int> v(M);
    for (int i = 0; i < M; i++) {
        cin >> v[i];
    }
    
    for (int i = M - 1; i >= 0; i--) {
        if (used[v[i]]) continue;
        used[v[i]] = 1;
        cout << v[i] << endl;
    }

    for (int i = 1; i <= N; i++) {
        if (!used[i]) {
            cout << i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3324
# -*- coding: utf-8 -*-

import sys
import math

debug = False

def log(text):
    if debug:
        print(text)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
    

    n = int(lines[0])

    return (n, )


def solve(n):

    if n == 1:
        return 0

    factors = factorization(n) 

    result = 0
    for f in factors:
        p = f[0]
        e = f[1]

        m = 0 
        for i in range(1, 1000):

            s = i * (i + 1) // 2
            if s > e:
                m = i - 1
                break

        if debug:
            log("p=%d, e=%d, m=%d" % (p, e, m))

        result = result + m
       

    return result

def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':
  
    main()


Measured memory_bytes: 63820
#include <bits/stdc++.h>
using namespace std;
int X[8]={0,-1,0,1,-1,1,-1,1},Y[8]={-1,0,1,0,-1,1,1,-1};
	int m,n;
string s[100];
inline int validpos(int a,int b){
	return ((a>=0)&&(a<n))&&((b>=0)&&(b<m));
}
int main(){
  	cin >> n >> m;
  int ans[n][m];
  	for(int i=0;i<n;++i)cin >> s[i];
  for(int i=0;i<n;++i){
  	for(int j=0;j<s[i].size();++j){
      ans[i][j] = 0;
      for(int k=0;k<8;++k){
      	int p = i +X[k],q=j+Y[k];
        if(validpos(p,q)){
        	if(s[p][q] == '#')
              ans[i][j]++;
        }
      }
    }
  }
  for(int i=0;i<n;++i){
  	for(int j=0;j<m;++j){
     if(s[i][j]!='#') cout << ans[i][j] ;
     else cout << '#';
    }
    cout << endl;
  }
  
}

Measured memory_bytes: 256