akhauriyash/Code-Regression huggingface dataset:
#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;
#pragma endregion

void solve() {
    int h, a;
    cin >> h >> a;
    cout << h / a + (h%a != 0) << '\n';
}

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

    solve();

    return 0;
}


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

int check(map<int,bool>&sumi,int n,vector<vector<int>>&a){
  int ans=1;
  sumi[n]=true;
  for(int i=0,l=a.at(n).size();i<l;i++){
    if(!sumi[a.at(n).at(i)]){
      ans+=check(sumi,a.at(n).at(i),a);
    }
  }
  return ans;
}

int main(){
  int n,m,x,y;
  cin >> n >> m;
  vector<vector<int>>a(n);
  for(int i=0;i<m;i++){
    cin >> x >> y;
    a.at(x-1).push_back(y-1);
    a.at(y-1).push_back(x-1);
  }
  int ans=1;
  map<int,bool>sumi;
  for(int i=0;i<n;i++){
    if(!sumi[i])
      ans=max(ans,check(sumi,i,a));
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
  int n;cin>>n;
  string s;cin>>s;
  int k=0;
  int ans=0;
  int i;
  for(k=0;k<1000;k++)
  {
    int k1=k%10;
    int k2=k/10%10;
    int k3=k/100;
    int count=3;
    for(i=0;i<n;i++)
    {
      if(count==1&&s.at(i)-'0'==k1)count--;
      if(count==2&&s.at(i)-'0'==k2)count--;
      if(count==3&&s.at(i)-'0'==k3)count--;
    }
    if(count==0)ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
//#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pai acos(-1)
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x,s) for(i=x;i>=s;i--)
#define fit(itr,s) for(itr=s.begin();itr!=s.end();itr++)
#define W while
#define pp pair<ll,ll>
#define ppi pair<int,int>
#define vl vector<ll>
#define vll vector<pp >
#define vi vector<int>
#define vii vector<ppi>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define debug(x) cerr<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#define boost  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const ll MAX=1e7;
const ll MM=2e6;
const ll mod=1e9+7;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

ll expo(ll x,ll n,ll M=mod)
{
    ll ans=1;
    while(n>0)
    {
        if(n&1){ans=(ans*x)%M;}
                x=(x*x)%M;
                n>>=1;
    }
    return ans;
}
bool pri[MAX];
void sieve()
{
    ll i,j;
    fn(i,MAX)pri[i]=1;
    pri[1]=0;
    for(i=2;i*i<MAX;i++)
    {
        if(pri[i])
        {
            for(j=i*i;j<MAX;j+=i)
            {
                pri[j]=0;
            }
        }
    }
}
void solve()
{
  ll n,i,j;
  cin>>n;
  vl tt;
  fs(i,1,MM)
  {
      if(pri[i])
      tt.pb(i);
  }
  map<ll,ll> mp;
  fn(i,tt.size())
  {
      if(n%tt[i]==0)
      {
          mp[tt[i]]++;
          n/=tt[i];
          i--;
      }
  }
  //debug(n);
  if(n>2)mp[n]++;
  map<ll,ll>::iterator itr;
  ll ans=0;
  for(itr=mp.begin();itr!=mp.end();itr++)
  {
     //debug2(itr->fi,itr->se);
      for(j=1;j<10000;j++)
      {
          if((j*(j+1))/2>itr->se)
            break;
      }
     //debug2(itr->se,j);
      ans+=(j-1);
  }
  cout<<ans;
}


int main()
{
  boost;
  ll t=1;
  //cin>>t;
  sieve();
  while(t--)
  {
      solve();
  }
}


Measured memory_bytes: 15092
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>

int main(){

    size_t n, m;
    std::cin >> n >> m;

    std::vector<std::vector<size_t>> v(n);
    std::vector<std::pair<size_t, size_t>> index;

    for(size_t i = 0; i < m; i++){
        size_t p, y;
        std::cin >> p >> y;
        v.at(p - 1).emplace_back(y);
        index.emplace_back(p - 1, y);
    }

    for(auto&& e : v){
        std::sort(e.begin(), e.end());
    }

    for(size_t i = 0; i < index.size(); i++){
        size_t p = index[i].first;
        size_t y = index[i].second;

        std::printf("%06zd%06zd\n", p + 1, std::lower_bound(v.at(p).begin(), v.at(p).end(), y) - v.at(p).begin() + 1);
    }

    return 0;
}


Measured memory_bytes: 8560
package main

import (
	"fmt"
)

func main() {
	var s string

	fmt.Scan(&s)
	slen := len(s)
	res := make([]rune, slen)
	for i := 0; i < slen; i++ {
		res[i] = 'x'
	}

	fmt.Println(string(res))
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    long long n,num,q,b,c,sum=0;
    cin>>n;
    vector <long long> cnt(100001);
    for(long long i =0;i<n;i++)
    {
        cin>>num;
        cnt[num]++;
        sum+=num;
    }
    cin>>q;
    for(long long i =0;i<q;i++)
    {
        cin>>b>>c;
        sum+=cnt[b]*(c-b);
        cnt[c]+=cnt[b];
        cnt[b]=0;
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 4012
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    vector<int> comb; comb.push_back(0), comb.push_back(1), comb.push_back(2);
    int n, c;
    cin >> n >> c;
    vector<vector<int>> d(c, vector<int>(c));
    vector<vector<int>> g(n, vector<int>(n));
    vector<vector<int>> e(3, vector<int>(30));
    REP(i,c) REP(j,c) cin >> d[i][j];
    REP(i,n) REP(j,n) cin >> g[i][j], --g[i][j];
    REP(i,c-3) comb.push_back(3);
    sort(comb.begin(), comb.end());
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if ((i+j)%3==0) ++e[0][g[i][j]];
            else if ((i+j)%3==1) ++e[1][g[i][j]];
            else if ((i+j)%3==2) ++e[2][g[i][j]];
        }
    }
    
    int ans = INF;

    do 
    {
        int tmp = 0;
        int yo[3];
        REP(i,comb.size()) {
            if (comb[i] == 0) yo[0] = i;
            if (comb[i] == 1) yo[1] = i;
            if (comb[i] == 2) yo[2] = i;
        }
        REP(i,3) {
            REP(j,c) {
                tmp += (d[j][yo[i]])*e[i][j];
            }
        }
        ans = min(ans, tmp);
    } while (next_permutation(comb.begin(), comb.end()));
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int l,r,d;
  int co=0;
  cin>>l>>r>>d;
  for(int i=l;i<=r;i++)
  {
    if(i%d==0)
      co++;
  }
  cout<<co<<endl;
}

Measured memory_bytes: 3544
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val N = in.nextInt
  val As = List.fill(N)(in.nextInt)

  def op(ps: List[(Int, Int)], money: Long, stocks: Long): Long = ps match {
    case Nil => money
    case (now, next) :: xs =>
      if (now <= next) op(xs, money % now, stocks + money / now)
      else op(xs, money + stocks * now, 0)
  }

  println(op(As.zipAll(As.tail, 0, 0), 1000, 0))
}

Measured memory_bytes: 55336
/*
author: Apoorv Singh
*/
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
 
typedef vector <int> vi;
typedef pair <int, int> pii;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
#define pb push_back   
#define all(c) c.begin(), c.end()
#define For(i, a, b) for (long long i = a; i < b; ++i)
#define Forr(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define ll long long 
#define endl "\n"
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << endl;  
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

template <class X>
void printarr(X arr[], int n) 
{
	for (int i = 0; i < n; ++i)
		cout << arr[i] << ' ';
	cout << endl;
}
 
template <class T, class cmp = less<T>> using ordered_set = tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
 
ll modulo = 1e9 + 7;

ll fpow(ll a, ll n) 
{
	ll ans = 1;
	while (n) 
	{
		if (n&1) ans = (ans*a)%modulo;
		a = (a*a)%modulo; n = n >> 1;
	}
	return ans;
}

void solve() 
{
	ll k;
	cin >> k;
	if (k%2 == 0 or k%5 == 0) 
	{
		cout << -1 << endl;
		return;
	}	
	ll curr = 7%k;		
	For(i,1,k+1)
	{
		if (curr == 0)
		{
			cout << i << endl;
			return;
		}
		curr *= 10;
		curr %= k;
		curr += 7;
		curr %= k;
	}	
}

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

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
//{
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
};
//{
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
#define jeb() fflush(stdout);
//}


char s[200005];

int main() {
	scanf("%s", s);
	int n = strlen(s);
	FOR(i,0,n) if (s[i] == '?') s[i] = 'D';
	printf("%s\n", s);

}


Measured memory_bytes: 3876
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int sum = 0;
		while (true) {
			n = n / k;
			sum++;
			if (n == 0) {
				break;
			}
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
#include <cstring>
#include <sstream>
#include <vector>
using namespace std;
const int N = 200000;
int n, a[N];
vector<int> dp[20];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int j = 0; j < 20; j++) {
		dp[j].push_back(0);
		if ((a[0] >> j) & 1)dp[j][0]++;
	}
	for (int i = 1; i < n; i++) {
		for (int j = 0; j < 20; j++) {
			dp[j].push_back(dp[j][i-1]);
			if ((a[i] >> j) & 1)dp[j][i]++;
		}
	}
	long long int ans = 0;
	for (int i = 0; i < n; i++) {
		long long int cv = n + 2;
		for (int j = 0; j < 20; j++) {
			long long int cv2;
			if (((a[i] >> j) & 1)==0) {
				cv2 = lower_bound(dp[j].begin() + i, dp[j].end(), dp[j][i] + 2) - (dp[j].begin() + i);
			}
			else cv2 = lower_bound(dp[j].begin() + i, dp[j].end(), dp[j][i] + 1) - (dp[j].begin() + i);

			cv = min(cv, cv2);
		}
		ans += cv;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 16784
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

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

    double edgeLength = ((double)L) / 3.0;
    double maxVolume = pow(edgeLength, 3l);
    cout << setprecision(15) << maxVolume << endl;

    return 0;
}


Measured memory_bytes: 256
// Problem : D - Transit Tree Path
// Contest : AtCoder - AtCoder Beginner Contest 070
// URL : https://atcoder.jp/contests/abc070/tasks/abc070_d
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
int n;cin>>n;
vp v[n+1];
for(int i=0;i<n-1;i++)
{
	int x,y,z;cin>>x>>y>>z;
	v[x].pb({y,z});
	v[y].pb({x,z});
}
int q,k;cin>>q>>k;
vi dis(n+1,INF);
dis[k]=0;
set<pii> s;
s.insert({0,k});
while(!s.empty())
{
	pii x=*s.begin();
	s.erase(s.begin());
	dis[x.se]=x.f;
	for(pii i:v[x.se])
	{
		if(dis[i.f]>dis[x.se]+i.se)
		{
			dis[i.f]=dis[x.se]+i.se;
			s.insert({dis[i.f],i.f});
		}
	}
}
while(q--)
{
	int x,y;cin>>x>>y;
	cout<<dis[x]+dis[y]<<"\n";
}
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 17208
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a, b, c, k; cin >> a >> b >> c >> k;
    (k&1) ? cout << b-a << endl : cout << a-b << endl;
    return 0;
}

Measured memory_bytes: 256
//
//  ALDS1_7_B.cpp
//  AizuOnlineJudge
//
//  Created by jiji on 2019/09/04.
//  Copyright © 2019 jiji4000. All rights reserved.
//

#include<iostream>

using namespace std;

// node最大量
#define MAX 100005
#define NIL -1

struct Node {
    int parent;
    int left;
    int right;
};

// 配列で保持する
Node gNode[MAX];
int gDepth[MAX];
int gHeight[MAX];
int n;

/**
 兄弟の番号を返す
 */
int getSibling(int u){
    int parent = gNode[u].parent;
    if(parent != NIL){
        // 自分と同じ番号でない、もしくはnil出ない場合兄弟になる
        if(gNode[parent].left != u && gNode[parent].left != NIL){
            return gNode[parent].left;
        }
        else if(gNode[parent].right != u && gNode[parent].right != NIL){
            return gNode[parent].right;
        }
    }
    return NIL;
}

/**
  子の数を返す
*/
int getDegree(int u){
    int degreeNum = 0;
    if(gNode[u].left != NIL){
        degreeNum++;
    }
    if(gNode[u].right != NIL){
        degreeNum++;
    }
    return degreeNum;
}

void print(int node){
    cout << "node " << node << ": ";
    cout << "parent = " << gNode[node].parent << ", ";
    cout << "sibling = " << getSibling(node) << ", ";
    cout << "degree = " << getDegree(node) << ", ";
    cout << "depth = " << gDepth[node] << ", ";
    cout << "height = " << gHeight[node] << ", ";
    
    if(gNode[node].parent == NIL) {
        cout << "root" << endl;
    }
    else if(gNode[node].left == NIL && gNode[node].right == NIL){
        cout << "leaf" << endl;
    }
    else cout << "internal node" << endl;
}

/**
    再帰的に高さを求める
*/
int setHeight(int u){
    int leftHeight = 0,rightHeight = 0;
    if(gNode[u].left != NIL){
        leftHeight = setHeight(gNode[u].left) + 1;
    }
    if(gNode[u].right != NIL){
        rightHeight = setHeight(gNode[u].right) + 1;
    }
    return gHeight[u] = max(leftHeight,rightHeight);
}

// 再帰的に深さを求める
void rec(int node ,int parent){
    gDepth[node] = parent;
    
    if(gNode[node].left != NIL){
        // 最も左の子に自分の深さ+1を設定
        rec(gNode[node].left,parent + 1);
    }
    if(gNode[node].right != NIL){
        rec(gNode[node].right,parent + 1);
    }
}

int main(){
    int leftIndex,rightIndex,nodeIndex,node,root,left = 0;
    
    cin >> n;
    // 1.初期化
    for(int i = 0;i < n;++i){
        gNode[i].parent = gNode[i].left = gNode[i].right = NIL;
    }
    // 2.nodeに代入していく
    for(int i = 0;i < n;++i){
        cin >> nodeIndex >> leftIndex >> rightIndex;
        gNode[nodeIndex].left = leftIndex;
        gNode[nodeIndex].right = rightIndex;
        
        if(leftIndex != NIL){
            gNode[leftIndex].parent = nodeIndex;
        }
        if(rightIndex != NIL){
            gNode[rightIndex].parent = nodeIndex;
        }
    }
    
    // 3.rootを探す
    for(int i = 0;i < n;++i){
        if(gNode[i].parent == NIL){
            root = i;
            break;
        }
    }
    // 根からはじめて深さを代入する
    rec(root,0);
    // 高さ代入
    setHeight(root);
    
    // 4.nodeのindexごとに出力する
    for(int i = 0;i < n;++i){
        print(i);
    }
    return 0;
}



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

vector<ll> enum_divisors(ll N) {
    vector<ll> res;
    for (ll i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}

signed main(){
  int n; cin >> n;
  int ans = 0;
  vector<ll> a(n), data(1000010, 0);
  for(int i = 0; i < n; i++) cin >> a[i], data[a[i]]++;
  for(int i = 0; i < n; i++){
    bool ok = true;
    vector<ll> vec = enum_divisors(a[i]);
    for(int j = 0; j < vec.size(); j++){
      if(data[vec[j]] != 0 && vec[j] != a[i]) ok = false; 
      if(data[a[i]] >= 2) ok = false;
    }
    if(ok) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 12760
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

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

  int x, y;
  cin >> x >> y;

  if (x % y == 0) {
    cout << -1 << endl;
  } else {
    cout << x << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>

using namespace std;

const int MX = 150500;

vector<int> e[MX];
int ans[MX];

int main()
{
    //freopen("in.txt","r", stdin);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++)
            ans[i] = -MX;
    for(int i = 0; i < n - 1; i++){
        int u, v;
        cin >> u >> v;
        e[u].push_back(v);
        e[v].push_back(u);
        //ans[i + 1] = -MX;
    }
    priority_queue<pair<int,int> > q;
    int k;
    cin >> k;
    while(k--){
        int u, w;
        cin >> u >> w;
        ans[u] = w;
        q.push({w, u});
    }
    while(!q.empty()){
        int u = q.top().second;
        int w = q.top().first;
        q.pop();
        for(int i = 0; i < e[u].size(); i++){
            int v = e[u][i];
            //cerr << v << endl;
            if(ans[v] == ans[u] + 1) continue;
            if(ans[v] == ans[u] - 1) continue;
            if(ans[v] != -MX) {puts("No"); return 0;}
            ans[v] = ans[u] - 1;
            cerr << v << ' ' << ans[v] << endl;
            q.push({ans[v],v});
        }
    }
    cout << "Yes\n";
    for(int i = 1; i <= n; i++){
        //if(ans[i] < 0) ans[i] *= -1;
        cout << ans[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 9076
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;
const int mod = 1e9 + 7;
const int MX = 2010000;
int inv[MX], f[MX], invf[MX];
void calc(){
	inv[0] = inv[1] = f[0] = f[1] = invf[0] = invf[1] = 1;
	for (int i = 2; i < MX; i++){
		inv[i] = mod - mod / i * (ll)inv[mod % i] % mod;
		f[i] = (ll)f[i - 1] * i % mod;
		invf[i] = (ll)invf[i - 1] * inv[i] % mod;
	}
}
inline ll comb(ll n, ll k){
	if(n < k || k < 0) return 0;
	return f[n] * (ll)invf[k] % mod * invf[n - k] % mod;
}
int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	calc();
	
	int r, c, R, C; cin >> r >> c >> R >> C;
	ll ans = 0, prev = 0;
	for(int s = r + c, lo = -1, hi = -1; s <= R + C; s++){
		int nl = s - c <= R ? c : c + (s - c - R);
		int nr = s - r <= C ? s - r : C;
		
		if(lo < 0){
			for(int i = nl; i <= nr; i++) ans += comb(s, i);
			lo = nl; hi = nr;
			prev = ans %= mod;
		}
		else{
			prev = prev * 2 % mod;
			if(nl > lo) prev = (prev + mod - comb(s - 1, lo)) % mod;
			else prev = (prev + comb(s - 1, lo - 1)) % mod;
			
			if(nr > hi) prev = (prev + comb(s - 1, hi + 1)) % mod;
			else prev = (prev + mod - comb(s - 1, hi)) % mod;
			
			lo = nl; hi = nr;
			ans += prev;
		}
	}
	cout << ans % mod << endl;
	return 0;
}

Measured memory_bytes: 23808
#include<stdio.h>
int main() {
    int n, i, v, ans, a[111111],b [111111];
    for (i = 0; i < 111111; i++) {
        a[i] = 0;
        b[i] = 0;
    }
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &v);
        if (i % 2 == 0)
            a[v]++;
        else
            b[v]++;
    }
    int max;
    ans = n;
    max = 0;
    int max2 = 0,keep1;
    for (i = 0; i < 111111; i++) {
        if (max < a[i]) {
            max = a[i];
            keep1 = i;
        }
    }
    a[keep1] = 0;
    for (i = 0; i < 111111; i++) {
        if (max2 < a[i]) {
            max2 = a[i];
        }
    }
    int max3 = 0, max4 = 0, keep2;
    for (i = 0; i < 111111; i++) {
        if (max3 < b[i]) {
            max3 = b[i];
            keep2 = i;
        }
    }
    b[keep2] = 0;
    for (i = 0; i < 111111; i++) {
        if (max4 < b[i]) {
            max4 = b[i];
        }
    }
    if (keep1 == keep2) {
        if (max + max4 > max2 + max3)
            ans -= max + max4;
        else
            ans -= max2 + max3;
    }
    else
        ans -= max + max3;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define MAX_N 1005
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
int par[MAX_N];
int rank[MAX_N];

void init(int n){
  for(int i=0;i<n;i++){
    par[i]=i;
    rank[i]=0;
  }
}

int find(int x){
  if(par[x]==x)return x;
  return par[x]=find(par[x]);
}

void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y)return;
  if(rank[x]<rank[y])par[x]=y;
  else{
    par[y]=x;
    if(rank[x]==rank[y])rank[x]++;
  }
}

bool same(int x,int y){
  return find(x)==find(y);
}

vector<P1> G;

double solve(){
  sort(G.begin(),G.end());
  vector<int> ans;
  for(int i=0;i<G.size();i++){
    int cost=G[i].first;
    int x=G[i].second.first;
    int y=G[i].second.second;
    if(same(x,y))continue;
    unite(x,y);
    ans.push_back(cost);
  }
  if(ans.size()%2)return ans[ans.size()/2];
  return (ans[ans.size()/2]+ans[ans.size()/2+1])/2.0;
}

int main(){
  int n,m,s,t,c;
  while(1){
    cin>>n>>m;
    if(!n&&!m)break;
    G.clear();
    for(int i =0;i<m;i++){
      cin>>s>>t>>c;
      s--,t--;
      G.push_back(P1(c,P(s,t)));
    }
    init(n);
    cout<<solve()<<endl;
  }
  return 0;
}

Measured memory_bytes: 3316
#include <stdio.h>

int main(void){
    // ((ΣN)² - ΣN²) / 2 を計算する
    int a, N;
    int i = 0, nSum = 0, squareSum = 0;
    scanf("%d", &N);
    while(i < N){
        scanf("%d", &a);
        nSum += a;
        squareSum += a * a;
        i++;
    }
    printf("%d\n", (nSum * nSum - squareSum) / 2);
}

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

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

    int n;
    cin >> n;
    if (n / 100 == 7 || (n % 100) / 10 == 7 || n % 10 == 7)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3648
#include<stdio.h>
#define W 0
#define G 1
#define B 2

int n,M[100][100];

void dijkstra(){
  int i,u,v,minv;
  int d[100],color[100];

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

  d[0] = 0;
  color[0] = G;
  while(1){
    minv = 1000000;
    u = -1;
    for(i=0;i<n;i++){
      if(minv > d[i] && color[i] != B){
	u = i;
	minv = d[i];
      }
    }
    if(u == -1){
      break;
    }
    color[u] = B;
    for(v=0;v<n;v++){
      if(color[v] != B && M[u][v] != 1000000){
	if(d[v] > d[u] + M[u][v]){
	  d[v] = d[u] + M[u][v];
	  color[v] = G;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d %d\n",i,(d[i] == 1000000 ? -1 : d[i]));
  }
}

int main(){
  int i,j,k,c,u,v;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j] = 1000000;
    }
  }

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

  dijkstra();

  return 0;
}

Measured memory_bytes: 636
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;


int main(){
    long long int a,b,c,k,ans=0;
    cin>>a>>b>>c>>k;
    if(a>k){
        ans+=k;
    }
    else{
        ans+=a;
        if(k-a<b){

        }
        else{
            ans-=(k-a-b);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
# list(map(int, input().split()))

n = int(input())
A = list(map(int, input().split()))

ans = [0] * n

# l = [0] * (n + 1)
# for i in range(1, n + 1):
#     l[i] = l[i - 1] ^ A[i - 1] 

total = 0
for a in A:
    total ^= a

for i in range(n):
    ans[i] = total ^ A[i]
print(*ans)

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

int main(int argc, char *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll n;
    cin >> n;
    ll odd = 0, twice = 0, four = 0;

    rep(i, n)
    {
        int a;
        cin >> a;
        int count = 0;
        while (a % 2 == 0)
        {
            count++;
            a /= 2;
        }
        switch (count)
        {
        case 0:
            odd++;
            break;
        case 1:
            twice++;
            break;
        default:
            four++;
            break;
        }
    }

    if (odd - four < 1 || (odd == four+1 && twice == 0))
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n,0);
    for (int i = 1; i < n ; i++){
        int m;
        cin >> m;
        a[m-1] += 1;
    }
    for (int i = 0; i < n ; i++){
        cout << a[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 4056
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) begin(x), end(x)
#define SZ(x) (int)(x).size()
#define cps(x) sort(all(x)), (x).erase(unique(all(x)), end(x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	int n, x, t;
	cin >> n >> x >> t;
	cout << ((n + x - 1) / x) * t;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string N, a, b, c, d;
    cin >> N;
    a = N.at(0);
    b = N.at(1);
    c = N.at(2);
    d = N.at(3);
    if ((a == b && a == c) || (b == c && b == d) || (a == b && a == c && a == d)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#Coding:Utf-1

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for i in range(N):
    if A[i]-B[i]>=0:
        count+=B[i]
    else:
        if A[i+1]-abs(A[i]-B[i])>=0:
            count+=A[i]+abs(A[i]-B[i])
            A[i+1]=A[i+1]-abs(A[i]-B[i])
        else:
            count+=A[i]+A[i+1]
            A[i+1]=0

print(count)


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

const int MAX_N = 1010;

int main() {
  int dp[MAX_N][MAX_N];
  char A[MAX_N];
  char B[MAX_N];
  int a, b, i, j, del_act, add_act, alt_act;

  cin >> A >> B;

  a = strnlen(A, MAX_N);
  b = strnlen(B, MAX_N);

  for (i = 0; i <= a; ++i) {
    dp[i][0] = i;
  }
  for (i = 0; i <= b; ++i) {
    dp[0][i] = i;
  }

  for (i = 1; i <= a; ++i) {
    for (j = 1; j <= b; ++j) {
      del_act = dp[i - 1][j] + 1;
      add_act = dp[i][j - 1] + 1;
      alt_act = dp[i - 1][j - 1];
      if (A[i-1] != B[j-1]) {
        ++alt_act;
      }
      dp[i][j] = min(alt_act,min(del_act,add_act));
    }
  }

  cout << dp[a][b] << endl;
  
  return 0;
}



Measured memory_bytes: 7060
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

int main(){
    int M, T, P, R;
    while(scanf("%d%d%d%d", &M, &T, &P, &R) && M){
        int time[T][P], sum[T], num[T];
        rep(i, T){
            sum[i] = num[i] = 0;
            rep(j, P) time[i][j] = 0;
        }
        rep(_, R){
            int m, t, p, j;
            scanf("%d%d%d%d", &m, &t, &p, &j);
            --t; --p;
            if(!j){
                sum[t] += time[t][p] + m;
                ++num[t];
            }
            else time[t][p] += 20;
        }
        int ans[T];
        rep(i, T) ans[i] = i;
        auto cmp = [&](const int &a, const int &b){
            if(num[a] == num[b]) return sum[a] == sum[b] ? a > b : sum[a] < sum[b];
            return num[a] > num[b];
        };
        sort(ans, ans+T, cmp);
        string s;
        int l = 0;
        while(l < T){
            int r = l;
            if(!s.empty()) s += ",";
            while(r < T && num[ans[l]]==num[ans[r]] && sum[ans[l]]==sum[ans[r]]){
                if(l != r) s += "=";
                s += to_string(ans[r]+1);
                ++r;
            }
            l = r;
        }
        cout << s << "\n";
    }
}


Measured memory_bytes: 3236
import java.lang.reflect.Array;
import java.util.*;

/**
 * Created by Santa.
 */
public class Main {

  static int N;
  static int K;
  static long Q;
  static int A;
  static long B;
  static long C;
  // static int[][] map;
  static double min = 9999999;
  static long ans = 0;

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int W = scanner.nextInt();

    long[][] map = new long[N][W + 1];


    int tempw = scanner.nextInt();
    int tempv = scanner.nextInt();
    for (int i = tempw; i <= W; i++) {
      map[0][i] = tempv;
    }
    for (int i = 1; i < N; i++) {
      int w = scanner.nextInt();
      long v = scanner.nextLong();
      for (int j = 0; j <= W; j++) {
//        if(map[i - 1][j] == 0)continue;
        if(j - w < 0)map[i][j] = map[i - 1][j];
        else
        map[i][j] = Math.max(map[i - 1][j - w] + v, map[i - 1][j]);
      }
    }
//    for (int i = 0; i < N; i++) {
//      for (int j = 0; j < W; j++) {
//        System.out.print(map[i][j] + " ");
//      }
//      System.out.println();
//    }

    System.out.println(map[N - 1][W]);


  }
}


Measured memory_bytes: 127568
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>

using namespace std;

int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    cout<<a+b+c+max({a, b, c})*(pow(2,k)-1)<<endl;
    return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int count=0;
  rep(i,3) {
    if(S[i]=='o') count++;
  }
  cout << 700+count*100 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  vector<ll> v(n);
  rep(i, n) cin >> v[i];
  sort(v.begin(), v.end());
  bool flag = true;
  rep(i, n - 1) {
    if (v[i] == v[i + 1]) {
      flag = false;
      break;
    }
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

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

bool check(string &a,string &b){
	for(int i=0;i<a.size();i++){
		if(a[i]!=b[i]&&a[i]!='?')return false;
	}
	return true;
}

int main(){
	string S,T;
	cin>>S>>T;
	bool flag = false;
	for(int i=0;i<S.size()-T.size()+1;i++){
		string k = S.substr(S.size()-T.size()-i,T.size());
		
		if(check(k,T)){
			flag=true;
			for(int j=0;j<T.size();j++){
				S[S.size()-T.size()-i+j]=T[j];
			}
			break;
		}
		
	}
	if(!flag){
		cout<<"UNRESTORABLE"<<endl;
		return 0;
	}
	for(int i=0;i<S.size();i++){
		if(S[i]=='?')cout<<'a';
		else cout<<S[i];
	}
	cout<<endl;
	return 0;
}


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

int main(){
  int N, A[110];
  cin>>N;
  for(int i=0; i<N; i++) cin>>A[i];
  for(int i=0; i<N; i++){
    int j = i - 1, v = A[i];
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    for(int k=0;k<N-1;k++) cout<<A[k]<<" ";
    cout<<A[N-1]<<endl;
  }
  return 0;
}




Measured memory_bytes: 3080
X = int(input())
kyu = [8, 7, 6, 5, 4, 3, 2]
rate = [600, 800, 1000, 1200, 1400, 1600, 1800]

flag = True
for k, r in zip(kyu, rate):
    if X < r:
        print(k)
        flag = False
        break
if flag:
    print(1)


Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

ll n;

void	dfs(ll tmp, char use, ll *cnt)
{
	if (tmp > n)
		return ;
	if (use == 7)
		++(*cnt);
	dfs(tmp * 10 + 7, use | 0b001, cnt);
	dfs(tmp * 10 + 5, use | 0b010, cnt);
	dfs(tmp * 10 + 3, use | 0b100, cnt);
}

int		main(void)
{
	cin >> n;
	ll ans = 0;
	dfs(0, 0, &ans);
	cout << ans << endl;
}



Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define N 200050

int a[N];

int main(){
	int n, k;
	scanf("%d%d", &n, &k);
	for(int i = 0; i < n; i ++) scanf("%d", &a[i]);

	for(int i = k; i < n; i ++){
		if(a[i] > a[i - k]) puts("Yes");
		else puts("No");
	}
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    pll s, t;
    cin >> s.first >> s.second;
    cin >> t.first >> t.second;
    string S = "", T = "";
    t.first -= s.first;
    t.second -= s.second;
    REP(i, abs(t.first)) {
        S.push_back('R');
        T.push_back('L');
    }
    REP(i, abs(t.second)) {
        S.push_back('U');
        T.push_back('D');
    }

    cout << S << T;
    cout << "DR" << S << "UL" << "UL" << T << "DR" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main(void){
	int H, W;
	
	while(1){
		std::cin >> H >> W;
		
		if (H == 0 && W ==0) break;
		
		for (int i = 1; i <= H; i++) {
			for (int j = 1; j <= W;  j++) {
				std::cout << '#';
			}
			std::cout << std::endl;
		}
		std::cout << std::endl;
	}
	
	return 0;
}

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

int main(){
  string s;
  string t;
  cin>>s>>t;
  int count=0;
  for(int i=0;i<s.size();i++){
    if(s[i]==t[i])count++;
  }
  if(count==s.size() && t.size()==s.size()+1){
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
}

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

using namespace std;

int getScore(int n) {
	string str = to_string(n);
	int res = 0;
	for (auto&& i : str) {
		res += i - '0';
	}
	return res;
}

void hawawa()
{
	int n;
	cin >> n;
	int ans = numeric_limits<int>::max();
	for (int a = 1; a <= n / 2; a++) {
		ans = min(ans, getScore(a) + getScore(n - a));
	}
	cout << ans << "\n";
}

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


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

void call(int n){
    for(int i=1; i<=n; i++){
        int x = i;
        if(x % 3 == 0){
            cout << " " << i;
            continue;
        }
        while(x){
            if ( x % 10 == 3 ){
                cout << " " << i;
                break;
            }
            x /= 10;
        }
    }
    cout << endl;
}



int main(){
    int n;
    cin >> n;
    call(n);
    return 0;
}

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

set<string> res;

void rec(string s, int p = 0) {
  if (p == (int) s.size()) {
    //cerr << s << '\n';
    res.insert(s);
    return;
  }
  rec(s, p + 1);
  if (s[p] == 'A') {
    s.erase(s.begin() + p);
    rec(s, p);
  }
}

signed main() {
#ifdef LOCAL
  assert(freopen("a.in", "r", stdin));
#endif
  string s = "AKIHABARA";
  rec(s);
  string t;
  cin >> t;
  if (res.count(t)) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <string>
using namespace std;
#define FL(i,a,b) for(int i = a;i<b;i++)
typedef vector<int> vi;
typedef long long int lli;
const int inf = numeric_limits<int>::max();
lli a;
bool fifth_root_int(long long int n){
    lli l = 0;
    lli r = n;
    while(l<=r){
        lli m = l + (r-l)/2;
        if(pow(m,5)==n){
            a = m;
            return true;
        }
        else if(pow(m,5)<n){
            l = m+1;
        }
        else{
            r = m-1;
        }
    } 
    return false;
}



int main(){
   lli X;
   cin>>X;
   lli B = 0;
   for(lli i = -32768;i<32768;i++){
       if(fifth_root_int(X+pow(i,5))){
           cout<<a<<" "<<i;
           break;
       }

   } 
   return 0;

   /*
   if(fifth_root_int(32)){
       cout<<a;
   }
   else{
       cout<<"NO";
   }
   */
    
}




Measured memory_bytes: 4140
using System;

public class Program
{
    private long N;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextLong();

        if (N % 2 == 1)
        {
            Console.WriteLine("0");
            return;
        }

        long ans = 0;

        // 偶数かつ5の倍数がいくつあるか

        long l = 1;
        while (true)
        {
            l *= 5;
            if (l * 2 > N) break;
            ans += N / (l * 2);
        }


        Console.WriteLine(ans);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 11092
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <queue>
#include <unordered_map>
using namespace std;
typedef long long ll;
int main(){
    char c;
    while(scanf("%c", &c)==1){
       if(c=='7'){
            printf("Yes\n");
            return 0;
        }


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

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h, m, s;
  cin >> s;
  h = s / 3600;
  s = s % 3600;
  m = s / 60;
  s = s % 60;
  cout << h << ":" << m << ":" << s << endl;
}



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

int main()
{
    int N;
    cin >> N;
    int cnt = 0;
    for (int i = 1; i < N; i++)
    {
        int k = 1;
        while (i * k < N)
        {
            ++cnt;
            ++k;
        }
    }
    cout << cnt << endl;
}

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

int main() {
    double a, b;
    cin >> a >> b;
    double f=a/b;
    int d=a/b;

    int c=a, e=b;
    int r=c%e;
    
    printf("%d %d %lf", d, r, f);
    return 0;
}



Measured memory_bytes: 3200