akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <cassert>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
// #include <queue>

using namespace std;

namespace atcoder {
namespace {

////////////////////////////////////////////////////////////////
using UUU = unsigned long;
[[gnu::unused]] constexpr auto modP{1000 * 1000 * 1000 + 7};
[[gnu::unused]] UUU pow0(const UUU a, const UUU n, const UUU acc)
{
  if (a >= modP)
    return pow0(a % modP, n, acc);
  if (acc >= modP)
    return pow0(a, n, acc % modP);
  if (n == 0)
    return acc;
  if ((n & 1) == 0)
    return pow0(a * a, n / 2, acc);
  return pow0(a, n - 1, (acc * a) % modP);
}
[[gnu::unused]] UUU pow(const UUU a, const UUU n)
{
  return pow0(a, n, 1);
}
////////////////////////////////////////////////////////////////
// XXX
[[gnu::unused]] long choose(const long n, const long k)
{
  if (k == 0) return 1;
  long numer = 1;
  long denom = 1;
  for (long p = n, q = 1; q <= k; --p, ++q) {
    numer *= p;
    numer %= modP;
    denom *= q;
    denom %= modP;
  }
  const auto denomInv = pow(denom, modP - 2);
  return numer * denomInv % modP;
}

long solve1(const long N, const long K, const long i)
{
  const auto p1 = choose(K - 1, i - 1);
  const auto p2 = choose(N - K - i + 1 + i, i);
  return (p1 * p2) % modP;
}

[[gnu::unused]] vector<unsigned long> solveV(istream& in)
{
  unsigned long N, K;
  in >> N >> K;
  // assert(1 <= K && K <= N && N <= 2000);

  vector<unsigned long> ans(K);
  for (auto i = 0u; i < K; ++i) {
    ans[i] = solve1(N, K, i + 1);
  }
  return ans;
}

} // namespace
} // namespace atcoder

////////////////////////////////////////////////////////////////
int main()
{
  using namespace atcoder;
  const auto ans = solveV(cin);
  for (const auto& x : ans)
    cout << x << '\n';
}


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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
static const int RED = 3;
static const int BLACK2 = 10;
static const int WHITE2 = 8;

static const int N = 100010;

//tt時刻、d[v]vを最初に発見した時刻、f[v]vを調べ終わった時刻
int n, tt=0;
vii M(N, vi());
vi color(N, RED), d(N), f(N), nt(N, 0);

void dfs(int);
int next(int);

void bfs(int r,int c);



void dfs(int r) {
	stack<int> s;
	s.push(r);
	color[r] = GRAY;
	d[r] = ++tt;

	while (!s.empty()) {
		int u = s.top();
		int v = next(u);
		if (v != -1) {
			if (color[v] == RED) {
				color[v] = GRAY;
				d[v] = ++tt;
				s.push(v);
			}
		}
		else {
			s.pop();
			color[u] = BLACK;
			f[u] = ++tt;
		}
	}
}

int next(int u) {
	int i;
	for (i = 0; i < M[u].size(); i++) {
		if (color[M[u][i]] == RED) {
			return M[u][i];
		}
	}
	return -1;
}


void bfs(int r,int c) {
	queue<int> q;
	int i;
	q.push(r);
	while (!q.empty()) {
		int u = q.front();
		for (i = 0; i < M[u].size(); i++) {
			if (color[M[u][i]] == RED || color[M[u][i]] == c) {
				q.push(M[u][i]);
				color[M[u][i]] = GRAY;
			}
		}
		color[u] = c+8;
		q.pop();
	}
}


int main() {
	cin >> n;
	int i;
	for (i = 0; i < n-1; i++) {
		int a, b;
		cin >> a >> b;
		M[a - 1].push_back(b - 1);
		M[b - 1].push_back(a - 1);
	}
	dfs(0);
	int tw = d[n - 1];
	int now = n - 1;
	vi keiro;
	while (1 < tw) {
		for (i = 0; i < M[now].size(); i++) {
			if (d[M[now][i]] < tw) {
				keiro.push_back(now);
				tw = d[M[now][i]];
				now = M[now][i];
			}
		}
	}
	
	
	for (i = 0; i < n; i++) {
		color[i] = RED;
	}
	color[0] = BLACK;
	color[n - 1] = WHITE;
	int right = keiro.size() - 1;
	int left = 1;
	while (left<right) {
		if (color[keiro[right]] == RED) {
			color[keiro[right]] = BLACK;
			right--;
		}
		if (color[keiro[left]] == RED) {
			color[keiro[left]] = WHITE;
			left++;
		}
	}
	bfs(0, BLACK);
	bfs(n - 1, WHITE);
	int b=0, w=0;
	for (i = 0; i < n; i++) {
		if (color[i] == BLACK2) {
			b++;
		}
		else {
			w++;
		}
	}
	if (b > w) {
		cout << "Fennec" << endl;
	}
	else {
		cout << "Snuke" << endl;
	}
}

Measured memory_bytes: 7904
#include <iostream>

using namespace std;

int p[100001];
int l[100000];
int r[100000];
int tmp[100001];

int main()
{
	int Q;
	p[0] = p[1] = 1;
	for (int i = 2; i < 100001; i++) {
		while (p[i]) i++;
		for (int j = i * 2;j < 100001; j += i) p[j] = 1; 
	}
	cin >> Q;
	for (int i = 3, sum = 0; i < 100001; i++) {
		if (p[i] == 0 && p[(i + 1) / 2] == 0) tmp[i] = sum++;
		else tmp[i] = sum;
	}

	for (int i = 0; i < Q; i++) {
		cin >> l[i]; cin >> r[i];
	}
	for (int i = 0; i < Q; i++) {
		cout << tmp[r[i] + 1] - tmp[l[i]]  << endl;
	}

	return 0;
}

Measured memory_bytes: 2176
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        if (4*h*n-N*n-N*h) == 0:
            continue
        w = N*h*n // (4*h*n-N*n-N*h)
        if w < 1:
            continue
        if w*(4*h*n-N*n-N*h) == N*h*n:
            print(h, n, w)
            exit()


Measured memory_bytes: 67532
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; 
	for(auto v:V)os << v << " "; return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; 
	for(auto s:S) os<<s<<" ";  return os<<"}"; 
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
	return os<<"("<<P.first<<","<< P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
	os<<"{ ";for(auto m:M)os<<"("<<m.F<<":"<<m.S<<")";
	return os<<"}";
}
#define cerr cout
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define For(i,n) for(int i=0;i<(int)n;++i)
#define Rev(i,n) for(int i=(int)n-1;i>=0;--i)
#define Rep(i,n) for(int i=1;i<=(int)n;++i)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpii;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


int main(){
	fio; cout<<fixed<<setprecision(25);	
	int h1 , m1 , h2 , m2;
	cin >> h1 >> m1 >> h2 >> m2;
	int a = 60*h1 + m1;
	int b = 60*h2 + m2;
	int diff = b-a;
	int k;
	cin >> k;
	cout << diff-k << endl;








	return 0;
}







Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define nes ios_base :: sync_with_stdio(0); cin.tie(0);
using namespace std;
ll des=1e3;
int main(){
	nes;
	ll a;
	string b;
	cin>>a>>b;
	string s="";
	for(int i=0;i<b.size();++i) if(b[i]=='.') continue;else s+=b[i];
	ll c=stoll(s,nullptr,10);
	cout<<(ll)(c*a)/100;
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using pic = pair<int,char>;

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

    vector<int> x(n),y(n);
    vector<char> d(n);

    vector<int> ux,uy;
    rep(i,n){
        cin >>x[i] >>y[i] >>d[i];
        ux.pb(x[i]);
        uy.pb(y[i]);
    }

    sort(all(ux));
    ux.erase(unique(all(ux)), ux.end());
    sort(all(uy));
    uy.erase(unique(all(uy)), uy.end());

    int X = ux.size(), Y = uy.size();

    rep(i,n){
        x[i] = lower_bound(all(ux), x[i]) - ux.begin();
        y[i] = lower_bound(all(uy), y[i]) - uy.begin();
    }

    // initialize
    vector<set<pic>> SX(X), SY(Y);
    rep(i,n){
        SX[x[i]].insert({y[i],d[i]});
        SY[y[i]].insert({x[i],d[i]});
    }

    int ans = 0;
    rep(i,n){
        vector<set<pic>> sx(SX), sy(SY);

        int tmp = 0;
        int cx = x[i], cy = y[i];
        char cd = d[i];
        while(1){
            // remove current position
            sx[cx].erase({cy,cd});
            sy[cy].erase({cx,cd});
            ++tmp;

            if(cd == '>'){
                auto itr = sy[cy].lower_bound({cx,cd});
                if(itr == sy[cy].end()) break;

                cx = itr->fi;
                cd = itr->se;
            }
            else if(cd == '<'){
                auto itr = sy[cy].lower_bound({cx,cd});
                if(itr == sy[cy].begin()) break;
                --itr;
                cx = itr->fi;
                cd = itr->se;

            }
            else if(cd == 'v'){
                auto itr = sx[cx].lower_bound({cy,cd});
                if(itr == sx[cx].end()) break;

                cy = itr->fi;
                cd = itr->se;
            }
            else if(cd == '^'){
                auto itr = sx[cx].lower_bound({cy,cd});
                if(itr == sx[cx].begin()) break;
                --itr;
                cy = itr->fi;
                cd = itr->se;
            }
            else assert(false);
        }

        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3900
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
l = [0]*100
for i in range(n):
    ans = 0
    for j in range(n):
        if s[i] == s[j]:
            ans += 1
    for k in range(m):
        if s[i] == t[k]:
            ans -= 1
    l[i] = ans
print(max(max(l), 0))

Measured memory_bytes: 39024
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int n, i, j, k, ans, x, maxx;
	cin >> n;
	ans = 0; maxx = 0;
	while (n--) {
		cin >> x;
		ans += x;
		maxx = max(maxx, x);
	}
	ans -= maxx / 2;
	cout << ans << "\n";

	return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  string ans;
  if(N % 2 != 0) {
    ans = "No";
  }
  else {
    int s = S.size();
    string s1 = S.substr(0,s/2);
    string s2 = S.substr(s/2,s/2);
    if(s1 == s2) ans = "Yes";
    else ans = "No";
  } 
  cout << ans << endl;
} 

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

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;
template <typename Val>
Val gcd(Val a, Val b) {
//use ll or int for gcd
    if (b==0) return a;
    else return gcd(b, a%b);
}
template <typename Val>
Val vec_max(vector<Val> v){
  return *max_element(v.begin(),v.end());
}
template <typename Val>
Val vec_min(vector<Val> v){
  return *min_element(v.begin(),v.end());
}



//---------------------------------------------------------------

int main(){
  ll N,M;
   cin>>N>>M;
   ll ans=1;
   ll V=1000000007;
   if(abs(N-M)>1){
     ans = 0;
   }else if(N==M){
     ans = 2;
     while(N>1){
       ans*=N;
       ans%=V;
       N--;
     }

     while(M>1){
       ans*=M;
       ans%=V;
       M--;
     }
   }else{

     while(N>1){
       ans*=N;
       ans%=V;
       N--;
     }

     while(M>1){
       ans*=M;
       ans%=V;
       M--;
     }
   }

  ans = ans%V;
   cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
	char s[100000];
	int i,ans=0;
	scanf("%s",s);
	for(i=0;s[i];i++)
	if(s[i]!=s[i+1]){
		ans++;
	}
	printf("%d\n",ans-1);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
constexpr int DISPLAY[] = { 0b0111111, 0b0000110, 0b1011011, 0b1001111, 0b1100110, 0b1101101, 0b1111101, 0b0100111, 0b1111111, 0b1101111, 0 };
void show(int n) {
	for (int i = 6; i >= 0; --i) {
		std::cout << ((((1 << i) & n) == 0) ? 0 : 1);
	}
	std::cout << std::endl;
}
int main() {
	int n;
	int prev_state, d;
	std::cin >> n;
	while (n != -1) {
		prev_state = 10;
		for (auto i = 0; i < n; ++i) {
			std::cin >> d;
			show(DISPLAY[prev_state] ^ DISPLAY[d]);
			prev_state = d;
		}
		std::cin >> n;
	}

}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

void permutation(int pos, int num);

int n;
vector<P> pos(10);
vector<int> pmt(10);
vector<vector<int>> pvec;
vector<int> used(10);

int main(){

    cin >> n;
    int i;
    for (i = 1; i <= n; i++){
        int x, y;
        cin >> x >> y;
        pos.at(i) = P(x, y);
    }

    permutation(0, n);
    
    /*
    cout << "--- permutation ---" << endl;
    for (i=0; i<pvec.size(); i++){
        for (int j=0; i<10; j++){
            cout << pvec.at(i).at(j) << " ";
        }
        cout << endl;
    }
    */
    
    int x_diff_tmp = 0, y_diff_tmp = 0;
    double x_diff = 0, y_diff = 0, diff = 0;
    int j;
    for (i=0; i<pvec.size(); i++){
        for (j=1; j<n; j++){
            x_diff_tmp = pos.at(pvec.at(i).at(j)).first - pos.at(pvec.at(i).at(j-1)).first;
            x_diff = x_diff_tmp*x_diff_tmp;
            y_diff_tmp = pos.at(pvec.at(i).at(j)).second - pos.at(pvec.at(i).at(j-1)).second; 
            y_diff = y_diff_tmp*y_diff_tmp;
            diff += sqrt(x_diff + y_diff);

            /*
            cout << "x = " << pos.at(pvec.at(i).at(j-1)).first << "\ty = " << pos.at(pvec.at(i).at(j-1)).second << endl;
            cout << "x = " << pos.at(pvec.at(i).at(j)).first << "\ty = " << pos.at(pvec.at(i).at(j)).second << endl;
            cout << "i: " << i << "\tdiff = " << diff << endl;
            */

        }
    }

    double ave;
    ave = diff/pvec.size();
    
//    cout << "pvec.size() = " << pvec.size() << endl;        //  debug
    cout << fixed << setprecision(15);
    cout << ave << endl;
    return 0;
}

void permutation(int pos, int num){

    if (num == pos){
        pvec.push_back(pmt);
        return;
    }

    int i;
    for (i = 0; i < num; i++){
        if (used.at(i) == 0){
            pmt.at(pos) = i+1;
            used.at(i) = 1;
            permutation(pos + 1, num);
            used.at(i) = 0;
        }
    }
}

Measured memory_bytes: 3256
#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>;
using G = vector<vector<int>>;
    
int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll l = 0, r = 1e9;
    ll mid = 0;
    while(r-l > 1){
        mid = (l+r)/2;
        auto f = [&](int x){
            ll count = 0;
            rep(i,n){
                count += ceil((double)a[i] / x) - 1;
                if(count>k) return false;
            }
            return true;
        };
        if(f(mid)) r = mid;
        else l = mid;
    }
    cout << r << endl;
    return 0;
}

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

template <class T>
T GCD(T a, T b) { return b == 0 ? a : GCD(b, a%b); }

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

  ll ans = 1;
  for (int i = 0; i < N; ++i) {
    ll T; cin >> T;
    ans = ans/GCD(ans, T)*T;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define INF 120000000

using namespace std;

typedef pair<int, int> P;
typedef long long int LL;

int main() {
    int n, k;
    cin >> n >> k;
    if ((n + 1) / 2 >= k) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
A, B = map(int, input().split())

K = 50
a = '.'
b = '#'
grid = [[a] * (2 * K) for _ in range(K)] + [[b] * (2 * K) for _ in range(K)]

B -= 1
for i in range(1, K - 1, 2):
    for j in range(1, 2 * K - 1):
        if (i + j) % 2:
            grid[i][j] = b
            B -= 1
        if B == 0:
            break
    else:
        continue
    break

A -= 1
for i in range(K + 1, 2 * K - 1, 2):
    for j in range(1, 2 * K - 1):
        if (i + j) % 2:
            grid[i][j] = a
            A -= 1
        if A == 0:
            break
    else:
        continue
    break

print(2 * K, 2 * K)
for r in grid:
    print(*r, sep='')


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

const int maxn = 1e5 + 10;

struct node
{
	int id,cnt,ac;
}nodes[maxn];

int n,m;

int main()
{
	
	std::ios::sync_with_stdio(false);cin.tie(0);
	cin >> n >> m;
	for(int i = 1; i <= m; i++) {
		int p; string s;
		cin >> p >> s;
		if(nodes[p].ac) continue;
		if(s == "WA") nodes[p].cnt++;
		else nodes[p].ac = 1;
	}			
	int ca = 0, pen = 0;
	for(int i = 1; i <= n; i++){
		if(nodes[i].ac) ca++,pen += nodes[i].cnt;
	}
	cout << ca << " " << pen << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file 
//#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define pb push_back
#define ff first
#define ss second
#define ii insert
#define ld long double
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define ppb pop_back
#define nuenxfiu ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define TT int testcases;cin>>testcases;while(testcases--)
#define mk make_pair
#define MAX ((int)2e9+17)
#define N 200005
#define mod ((int)1e9+7)
#define MOD 1000003
//int fact[1000007]={0};
int fpow(int n, int k, int p = mod) {int r = 1; while(k > 0) {if (k & 1) r = r * n%p; n = n * n%p; k = k >> 1;} return r;}
int expo(int x,int y){ int res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
int sub(int a, int b) {return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b) {return ((a%mod)*(b%mod) + mod)%mod;}
int inv(int x) {return expo(x, mod-2);}
using namespace std;





void solve()
{
	int n,m,k;
	cin>>n>>m>>k;
	
	vector<int>v1(n+1,0);
	vector<int>v2(m+1,0);
	
	
	for(int i=1;i<=n;i++)
	{
		cin>>v1[i];
		v1[i]+=v1[i-1];
	}
	
	for(int i=1;i<=m;i++)
	{
		cin>>v2[i];
		v2[i]+=v2[i-1];
	}

	int ans=0;
	
	int id=m;
	
	for(int i=0;i<=n;i++)
	{
		if(v1[i]>k)
		break;
		
		while(v1[i]+v2[id]>k)
		id--;
		
		ans=max(ans,i+id);
	}
	
	cout<<ans<<endl;
	
	
}
signed main()
{
    
	nuenxfiu
	//TT
	solve();
     return 0;
}

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

#define DEBUG

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;

const int MOD = 1000000007;
const double PI=acos(-1.0);

// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;

// 繰り返し
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep_(i,n) for(int i=0;i<(int)(n-1);i++)
#define rep__(i,n) for(int i=n-1;i>=0;i--)

int main(void) {
    int n;
    cin >> n;
    if(n%2==0) cout << n / 2;
    else cout << n / 2 + 1;
    return 0;
}


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

int main() {
  int p,q,r; cin >> p >> q >> r;
  int ans = p+q+r - max(p, max(q, r));
  cout << ans << endl;
}


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

int main(void){
    long long int n, m, i, j, cnt=0;
    scanf("%lld %lld", &n, &m);
    long long int a[m+1], s[n+1];
    for(i=0; i<m; i++) scanf("%lld", &a[i]);
    s[0] = 1;
    a[m] = 0;
    for(i=1; i<=n; i++){
        if(i == a[cnt]){
            s[i] = 0;
            cnt++;
        }else{
            if(i==1) s[i] = 1;
            else{
                s[i] = (s[i-1] + s[i-2])%1000000007;
            }
        }
    }
    printf("%lld ", s[n]);

    
}

Measured memory_bytes: 1664
import qualified Data.ByteString.Char8 as B
import Control.Monad
import Data.Maybe
import Data.List
import qualified Data.Map.Lazy as M

main = do
    [n,m] <- map read . words <$> getLine :: IO [Int]
    ns <- replicateM n ((\[a,b,c]->(a,b,c)) . map (fst . fromJust . B.readInt) . B.words <$> B.getLine) :: IO [(Int,Int,Int)]

    let as = sum . take m . reverse . sort $ map (\(a,b,c)->sum [a , b , c]) ns
    let bs = sum . take m . reverse . sort $ map (\(a,b,c)->sum [a , b ,-c]) ns
    let cs = sum . take m . reverse . sort $ map (\(a,b,c)->sum [a ,-b , c]) ns
    let ds = sum . take m . reverse . sort $ map (\(a,b,c)->sum [a ,-b ,-c]) ns
    let es = sum . take m . reverse . sort $ map (\(a,b,c)->sum [-a, b , c]) ns
    let fs = sum . take m . reverse . sort $ map (\(a,b,c)->sum [-a, b ,-c]) ns
    let gs = sum . take m . reverse . sort $ map (\(a,b,c)->sum [-a,-b , c]) ns
    let hs = sum . take m . reverse . sort $ map (\(a,b,c)->sum [-a,-b ,-c]) ns
    print $ maximum [as,bs,cs,ds,es,fs,gs,hs]


Measured memory_bytes: 1404
#include<bits/stdc++.h>
using namespace std;
//define
#define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define str string
#define vint vector<int>
#define vvint vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vool vector<bool>
#define vtr vector<str>
#define vvtr vector<vector<str>>
#define qint queue<int>
//pairdefine
#define pint pair<int,int>
#define pic pair<int,char>
#define pci pair<char,int>
#define pis pair<int,str>
#define psi pair<str,int>
#define pcc pair<char,char>
#define pss pair<str,str>
#define mp make_pair
//mapdefine
#define mint map<int,int>
#define mic map<int,char>
#define mci map<char,int>
#define mis map<int,str>
#define msi map<str,int>
#define pb() push_back()
#define all(x) x.begin(),x.end()
#define elif else if
//function
int W=30;
str Dir;
bool shizuku(double Dir);
//UnionFind
struct UnionFind{
  vint par;
  UnionFind(int N):par(N){
    rep(0,N)par[i]=i;
  }
  int root(int x){
    if(par[x]==x)return x;
    return par[x]=root(par[x]);
  }
  void unite(int x,int y){
    int rx=root(x);
    int ry=root(y);
    if(rx==ry)return;
    par[rx]=ry;
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
};

signed main(){
    int pow,N,M,X,count=0,count2=0,Deg;
    double Dis;
    int C='A'-'a';
    char op;
    str S,T;
    cin>>N;
    cout<<180*(N-2)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c;
  cin >> a >> b >> c;
  for(int i=1;i<=a*b;i++){
    if((a*i)%b==c){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

const ll MOD = 998244353;
const int MN = 200010;

// 1-indexed, [1, n]
template<class T>
class BIT {
	T bit[MN];
	int n;

public:
	BIT() {
		n = MN;
		memset(bit, 0, sizeof(bit));
	}

	T sum(int i) {
		++i;
		T s = 0;
		while (i > 0) {
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}

	void add(int i, T x) {
		++i;
		while (i < n) {
			bit[i] += x;
			i += i & -i;
		}
	}
};

int num[MN][4];
ll p2[MN];

void init() {
	p2[0] = 1;
	for (int i = 1; i < MN; ++i) {
		p2[i] = p2[i-1] * 2 % MOD;
	}
}

int main() {
	init();

	int N; cin >> N;
	vector<pii> vec(N);
	vi xs, ys;

	rep(i, N) {
		int x, y; cin >> x >> y;
		vec[i] = mp(x, y);
		xs.pb(x); ys.pb(y);
	}

	sort(ALL(xs)); sort(ALL(ys));
	rep(i, N) {
		int x = vec[i].fi, y = vec[i].se;
		x = lower_bound(ALL(xs), x) - xs.begin();
		y = lower_bound(ALL(ys), y) - ys.begin();
		vec[i] = mp(x, y);
	}

	sort(ALL(vec));

	rep(t, 2) {
		BIT<int> T;

		rep(i, N) {
			int a = T.sum(vec[i].se - 1), b = i - T.sum(vec[i].se);
			if (t == 0) {
				num[i][0] = a;
				num[i][1] = b;				
			} else {
				num[N-1-i][2] = a;
				num[N-1-i][3] = b;
			}
			T.add(vec[i].se, 1);
		}	

		reverse(ALL(vec));
	}

	ll ans = 0;

	rep(i, N) {
		ll a = (p2[num[i][0]] + p2[num[i][3]] - 1) % MOD;
		ll b = (p2[num[i][1]] + p2[num[i][2]] - 1) % MOD;

		ll v = (p2[N] - a * b) % MOD;
		if (v < 0) v += MOD;
		ans = (ans + v) % MOD;
	}

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

Measured memory_bytes: 9068
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0
for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			money = 500 * i + 100 * j + 50 * k
			if money == x:
				cnt += 1
print(cnt)

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

int main(){
  int N,K; cin>>N>>K;
  vector<int> C(N);
  int x=N-1;
  for(int i=0;i<N;i++){
    cin>>C[i];
    if(x==N-1&&C[i]>0)
      x=i;
  }
  set<int> ans;
  for(int i=0;i<K+1;i++){
    if(x-1+i<N&&x-1+i>-1&&x-K+i<N&&x-K+i>-1){
      int a=max(0,C[x-1+i]);
      int b=min(0,C[x-K+i]);
      ans.insert(min(a,0-b)+a-b);
    }
  }
  auto it=ans.begin();
  cout<<*it<<endl;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
	ll t;
	//cin>>t;
	t=1;
	while(t--)
	{
	  ll n,q;
	  cin>>n>>q;
	  ll a[n];
	  for(ll i=0;i<n;i++)
	  cin>>a[i];
	  vector<ll>v[n];
	  while(q--)
	  {
	      ll x,y;
	      cin>>x>>y;
	      x--;y--;
	      v[x].push_back(a[y]);
	      v[y].push_back(a[x]);
	  }
	  ll c=0;
	  for(ll i=0;i<n;i++)
	  {
	      if(v[i].size()==0)
	      {
	          c++;
	          continue;
	      }
	      else
	      {
	          if(*max_element(v[i].begin(),v[i].end())<a[i])
	          c++;
	      }
	  }
	  cout<<c;
	}
	return 0;
}

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

using namespace std;
	
	
class Hoge{
			int N;
			int* pyama;
			int imax,imaxn;
			int iryokann;
			
		public:
			Hoge(int hoge){
			
			pyama=new int[100];
			imax=0;
			iryokann=0;
			
			}
			
			
		void input();
		void checkmax();			
		
		
	int getiryokann(){return iryokann;}

			

									
		virtual ~Hoge(){	
					delete[] pyama;
					//cout<<"pyama is erased."<<endl;
						}
};



void Hoge::input(){
		
					cin>>N;
					for (int icount=0;icount<N;icount++)
					cin>>pyama[icount];
					}
					
					
void Hoge::checkmax(){
	
				for (int icount=0;icount<N;icount++){
					
							if(pyama[icount]>=imax){
							
													imaxn=icount;
													imax=pyama[icount];
													iryokann++;
							}
									
									
								}//end for
						}//end function

int main()
{
	int iryokann;
	Hoge* ph0=new Hoge(0);
	ph0->input();
	ph0->checkmax();
	iryokann=ph0->getiryokann();
	cout<<iryokann<<endl;
	delete ph0;
	
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 * https://abc052.contest.atcoder.jp/tasks/abc052_b
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		sc.nextInt();
		char[] s = sc.next().toCharArray();
		sc.close();
		
		int ans = 0;
		int x = 0;
		for(char c:s){
			if(c=='I'){
				x++;
				ans = Math.max(ans, x);
			}else{
				x--;
			}
		}
		
		System.out.println(ans);

	}

}

Measured memory_bytes: 23636
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		boolean[][] g = new boolean[n][n];
		for (int i = 0; i < n; i++) {
			int u = scan.nextInt();
			int k = scan.nextInt();
			for (int j = 0; j < k; j++) {
				int v = scan.nextInt();
				g[u - 1][v - 1] = true;
			}
		}
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				System.out.print((g[i][j] ? 1 : 0) + (j == n - 1 ? "\n" : " "));
	}
	public static void main(String[] args) {
		new Main().run();
	}
}



Measured memory_bytes: 31616
import itertools

N, M, Q = map(int, input().split())
Arr = [list((map(int, input().split()))) for i in range(Q)]
Alist = list(itertools.combinations_with_replacement(range(1, M+1), N))
result = 0

for A in Alist:
    score = 0
    for q in range(Q):
        if A[Arr[q][1]-1] - A[Arr[q][0]-1] == Arr[q][2]:
            score += Arr[q][3]
    result = max(result, score)

print(result)


Measured memory_bytes: 21448
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        string S = Console.ReadLine();
        var list = new List<char>();
        var retValue = "Yes";

        foreach(var s in S)
        {
            list.Add(s);
        }

        foreach (var rec in list)
        {
            if (list.Where(w => w.Equals(rec)).Count() != 2)
            {
                retValue = "No";
                break;
            }
        }

        //出力
        Console.WriteLine(retValue);
    }
}

Measured memory_bytes: 13396
MOD = 10 ** 9 + 7


def prepare(n):
    global MOD
    modFacts = [0] * (n + 1)
    modFacts[0] = 1
    for i in range(n):
        modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD

    invs = [1] * (n + 1)
    invs[n] = pow(modFacts[n], MOD - 2, MOD)
    for i in range(n, 1, -1):
        invs[i - 1] = (invs[i] * i) % MOD

    return modFacts, invs


N = int(input())
place = [0] * N
A = list(map(int, input().split()))
for i, s in enumerate(A):
    if place[s - 1] == 0:
        place[s - 1] = i + 1
    else:
        a = place[s - 1]
        b = i + 1
        break

modFacts, invs = prepare(N + 1)
cnt = pow(2, N + 1, MOD) - 1
cnt -= pow(2, a - 1, MOD) * pow(2, N + 1 - b, MOD)

la = a - 1
rb = N + 1 - b
t = la + rb
for k in range(1, N + 2):
    cnt = (modFacts[N + 1] * invs[k] * invs[N + 1 - k]) % MOD
    if t >= k - 1:
        cnt -= (modFacts[t] * invs[k - 1] * invs[t - (k - 1)])
    print(cnt % MOD)


Measured memory_bytes: 20456
#include <iostream>

using namespace std;

int main()
{
	int h, w;
	while (1) {
		cin >> h >> w;
		if (h == 0 && w == 0)break;
		for (int q = 0; q < h; q++) {
			for (int e = 0; e < w; e++) {
				if ((q % 2 == 0 && e % 2 == 0) || (q % 2 != 0 && e % 2 != 0)) cout << '#';
				else cout << '.';
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3136
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  string s;
  cin >> s;
  cout << s.stlice(0, 3) << ' ' << s.stlice(4, s.size() - 1) << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

# In[20]:


X = int(input())


# In[22]:


for i in range(X+1)[::-1]:
    for j in range(2,i):
        p = 2
        flag = False
        while flag == False:
            if j**p == i:
                print(i)
                flag = True
                break
            elif j**p > i:
                break
            else:
                p += 1
        if flag:
            break
    else:
        continue
    break
else:
    print(1)


# In[ ]:






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

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<int> length(n);
    for (size_t i = 0; i < n; i++) cin >> length[i];

    int ans = 0;
    for (size_t i = 0; i < n; i++) {
        for (size_t j = i+1; j < n; j++) {
            for (size_t k = j+1; k < n; k++) {
                if (length[i] == length[j] || length[j] == length[k] || length[k] == length[i]) continue;
                if (length[i] + length[j] > length[k] && length[j] + length[k] > length[i] && length[k] + length[i] > length[j]) ++ans;
            }
        }
    }

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


Measured memory_bytes: 3608
#!/usr/bin/env python3
import sys

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
A = list(map(int, readlines()))
assert len(A) == M

MOD = 10 ** 9 + 7


def solve():
    broken = [False] * (N + 1)
    for a in A:
        broken[a] = True

    dp = [0] * (N + 1)
    dp[0] = 1
    for i in range(1, N + 1):
        if broken[i]:
            dp[i] = 0
        elif i == 1:
            dp[i] = dp[i - 1]
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % MOD
    return dp[N]


if __name__ == "__main__":
    print(solve())


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

int main() {
  int N,K,X,Y;
  cin >> N >> K >> X >> Y;

  int ans = 0;
  if (N > K) {
    ans += K * X;
    ans += (N - K) * Y;
  } else {
    ans += N * X;
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  if(n%2 ==0) {
    bool a = true;
    for(int i = 0; i < n/2; i++) {
      if(s.at(i) != s.at(i + n/2)) a = false;
    }
    if(a) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

ll aa[110];

int main() {
	int N;
	cin >> N;
	for(int i=1; i<=N; ++i){
		int t=i%10, u=i;
		while(u>=10){
			u /= 10;
		}
		t += u*10;
		++aa[t];
	}
	ll ans=0;
	for(int i=1; i<100; ++i){
		int j=(i%10)*10+i/10;
		ans += aa[i]*aa[j];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int f(int x){
  if (x % 2 == 0) return x / 2;
  return 3 * x + 1;
}
int main() {
  int s;
  cin >> s;
  map<int, int> A{};
  A[s] = 1;
  int i = 1;
  while(true){
    i++;
    int news=f(s);
    if(A[news]==1){
      cout << i << endl;
      return 0;
    }
    s = news;
    A[news] = 1;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

int main()
{
    int N;
    std::cin >> N;
    std::vector<int> xs;
    std::vector<int> ys;
    std::vector<int> hs;
    for (int i = 0; i < N; i++) {
        int x, y, h;
        std::cin >> x >> y >> h;
        xs.emplace_back(x);
        ys.emplace_back(y);
        hs.emplace_back(h);
    }
    for (int cx = 0; cx <= 100; cx++) {
        for (int cy = 0; cy <= 100; cy++) {
            int p = 0;
            bool tmp = false;
            while (true) {
                if (p > N - 1) {
                    tmp = true;
                    break;
                }
                if (hs.at(p) > 0) {
                    break;
                }
                p++;
            }
            if (tmp) {
                continue;
            }
            int H = hs.at(p) + std::abs(xs.at(p) - cx) + std::abs(ys.at(p) - cy);
            bool flag = true;
            for (int i = 0; i < N; i++) {
                if (std::max({H - std::abs(xs.at(i) - cx) - std::abs(ys.at(i) - cy), 0}) != hs.at(i)) {
                    flag = false;
                }
            }
            if (flag) {
                std::cout << cx << " " << cy << " " << H << std::endl;
            }
        }
    }
    return 0;
}

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

int main(){
  string s,t,u;
  u="";
  ll i,j;
  cin >> s;
  j=s.size();
  for(i=0;i<j;i++){
    t=s.substr(i,1);
    if(t=="P"){
      u+="P";
    }
    else{
      u+="D";
    }
  }
  cout << u;
}

Measured memory_bytes: 3924
#45b
A = input()
B = input()
C = input()

s= 'a'
a = 0
b = 0
c = 0

while True:
    if s =='a':
        if a ==len(A):
            print('A')
            break
        s = A[a]
        a+=1
    elif s == 'b':
        if b ==len(B):
            print('B')
            break
        s = B[b]
        b+=1
    elif s == 'c':
        if c == len(C):
            print('C')
            break
        s = C[c]
        c += 1

Measured memory_bytes: 3064
N,M=list(map(int,input().split()))

ad={} #近接リスト
for n in range(N):
    ad[n+1]=set([])
    
depth={} #深さ
for n in range(N):
    depth[n+1]=0
    
parent={}
for n in range(N):
    parent[n+1]=0
    
visit_dict={} #発見しているか保持（-1:未発見、0:発見、1:訪問済）
for n in range(N):
    visit_dict[n+1]=-1
    
for m in range(M):
    a,b=list(map(int,input().split()))
    ad[a].add(b)
    ad[b].add(a)

# 幅優先探索
from collections import deque

que = deque([1])
visit = deque([])
depth[1]=1
visit_dict[1]=0

i=0
while len(que) > 0:
    i+=1
    start=que[0]
    for _ in ad[start]:
        if visit_dict[_] != -1:
            continue
        else:
            depth[_]=depth[start]+1
            parent[_]=start
            visit_dict[_]=0
            que.append(_)  
            
    visit_dict[start]=1
    visit.appendleft(que.popleft())
            

print('Yes')
for p in list(parent.keys())[1:]:
    print(parent[p])

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

typedef unsigned uint;
typedef long long INT;
typedef unsigned long long UINT;
const int INF = 1001001001;
const INT INFLL = 1001001001001001001LL;

 int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
INT lin() { INT x; scanf("%lld", &x); return x; }
UINT luin() { UINT x; scanf("%llu", &x); return x;}

int main(){
    int a, b, c;
    double fa, fb, fc;
    char S[128], sa[128], sb[128], sc[128];
    // int N = in();
    // int K = in();
    // scanf("%s", S);

    UINT X = luin();

    UINT ulYear = 0;
    UINT nMoney = 100;

    while(nMoney < X) {
        ++ulYear;
        nMoney = (UINT)(nMoney * 1.01);
    }



    printf("%llu", ulYear);


    return 0;
}







Measured memory_bytes: 3816
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main(){
  int N,i,count;
  scanf("%d",&N);
  char S[N][11];
  count=1;
  for(i=0;i<N;i++) scanf("%s",S[i]);
  qsort(S, N, sizeof(char[11]), strcmp);//文字列ソート
  for(i=0;i<N-1;i++){
    if(strcmp(S[i],S[i+1])!=0) count++;
  }
  printf("%d",count);
  return 0;
}

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

using namespace std;

int main(void) {
	int x, a, b;
	cin >> x>>a>>b;
	if (b - a <= 0) {
		cout << "delicious" << endl;
	}
	else if (b - a <= x) {
		cout << "safe" << endl;
	}
	else {
		cout << "dangerous" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#define ll long long
#define oku7 1000000007
#define MAXRANGE (int)1e+5 + 2
using namespace std;

int isPrime[MAXRANGE];
int wa[MAXRANGE];


int main() {
	//エラトステネスの篩をする
	for (int i = 0; i < MAXRANGE; i++) {
		isPrime[i] = 1;
	}
	isPrime[0] = isPrime[1] = 0;
	for (int i = 2; i < sqrt(MAXRANGE); i++) {
		if (isPrime[i]) {
			for (int j = 2; i*j < MAXRANGE; j++) {
				isPrime[i*j] = 0;
			}
		}
	}
	//2017 like numberの数の累積和を作る
	int sum = 0;
	for (int i = 1; i < MAXRANGE; i++) {
		if (i%2==1 && isPrime[i] && isPrime[(i + 1) / 2]) sum++;
		wa[i] = sum;
	}

	int Q;
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		int l, r;
		cin >> l >> r;
		cout << wa[r] - wa[l - 1] << "\n";
	}

	return 0;
}

//

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; n>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;
#define fastio cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define endl '\n'
template <class T> bool updmax(T& a, T b) { if (b > a) { a = b; return true;} return false;}
template <class T> bool updmin(T& a, T b) { if (b < a) { a = b; return true;} return false;}

int main() {
    fastio;
    ll a, b;
    cin >> a >> b;
    int ua = ceil((a+1)/0.08);
    int da = floor((a-1)/0.08);
    int ub = ceil((b+1)/0.1);
    int db = floor((b-1)/0.1);
    for (int i=da; i<=ua; ++i) {
        for (int j=db; j<=ub; ++j) {
            if (i == j && i*8 - (i*8)%100 == a*100 && i - i%10 == b*10) {
                cout << i << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
constexpr int P = 1E9 + 7;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    
    vector<vector<int>> binom(n + 1);
    for (int i = 0; i <= n; ++i)
        binom[i].resize(n + 1);
    for (int i = 0; i <= n; ++i) {
        binom[i][0] = 1;
        for (int j = 1; j <= i; ++j)
            binom[i][j] = (binom[i - 1][j] + binom[i - 1][j - 1]) % P;
    }
    
    vector<vector<int>> dp(n + 1);
    for (int i = 1; i <= n; ++i)
        dp[i].resize(i + 1);
    dp[1][0] = dp[1][1] = 1;
    for (int i = 1; i < n; ++i) {
        for (int j = 0; j <= i; ++j) {
            if (dp[i][j] == 0)
                continue;
            for (int x = 0; x + i <= n; ++x) {
                for (int y = 0; x + y + i <= n; ++y) {
                    int v = i / 2 - j;
                    if (x + y == 0 || (v - x + y) % 2 != 0 || v - x - y > 0 || v + x + y < 0)
                        continue;
                    v = (v - x + y) / 2;
                    dp[i + x + y][(i + x + y) / 2 - v] = (dp[i + x + y][(i + x + y) / 2 - v] + 1LL * dp[i][j] * binom[i + x + y][i] % P * binom[x + y][x]) % P;
                }
            }
        }
    }
    
    cout << dp[n][n / 2] << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int T, dp[3005][3005];
VEC(int) A, B;

int f(int t, int i)
{
    if (i == A.size() || t >= T)
        return 0;

    int& ans = dp[t][i];
    if (ans >= 0)
        return ans;

    ans = f(t, i + 1);
    ans = max(ans, B[i] + f(t + A[i], i + 1));
    return ans;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N;
    cin >> N >> T;
    A.resize(N);
    B.resize(N);
    VEC(Pii) dishes(N);
    FOR(i, 0, N)
        cin >> dishes[i].first >> dishes[i].second;
    sort(ALL(dishes));

    FOR(i, 0, N) {
        A[i] = dishes[i].first;
        B[i] = dishes[i].second;
    }

    memset(dp, -1, sizeof dp);
    cout << f(0, 0) << endl;
    return 0;
};

Measured memory_bytes: 35712
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	long long t1,t2,a1,a2,b1,b2;
	cin>>t1>>t2>>a1>>a2>>b1>>b2;
	long long d1=(b1-a1)*t1,d2=(b2-a2)*t2;
	if(d1+d2==0){
		cout<<"infinity";
		return 0;
	}
	if(d1<0){
		d1*=-1;
		d2*=-1;
	}
	if(d1+d2>0){
		cout<<0;return 0;
	}
	long long x=-(d1+d2);
	if(d1%x){
		cout<<2*(d1/x)+1 ;
	}
	else cout<<2*(d1/x);

}

Measured memory_bytes: 888
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void* a, const void* b) {
		return *(int*)a - *(int*)b;
}


int main() {
	int n, l[2020], i, j, k;
	long long ans = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &l[i]);
	}
	qsort(l, n, sizeof(int), compare_int);

	for (i = 0; i < n - 2; i++) {
		for (j = i + 1; j < n - 1; j++) {
			for (k = j + 1; k < n; k++) {
				if (l[k] >= l[i] + l[j]) { break; }
				ans++;
			}
		}
	}
	printf("%lld", ans);
}

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

using namespace std;
const int N = 18;
int a[(1 << N) + 10], b[(1 << N) + 10], mark[(1 << N) + 10];

int main()
{
    int n; cin >> n;
    for (int i = 0; i < (1 << n); i ++) cin >> a[i];
    sort(a, a + (1 << n));
    reverse(a, a + (1 << n));
    int l = 1;
    b[0] = a[0];
    mark[0] = 1;
    for(int i = 0; i < n; i ++) {
        sort(b, b + l);
        reverse(b, b + l);
        int pnt = 0;
        for (int j = 0; j < (1 << i); j ++) {
           while (pnt < (1 << n) && (b[j] == a[pnt] || mark[pnt])) pnt++;
           if (pnt == (1 << n)) return cout << "No\n", 0;
           b[l++] = a[pnt];
           mark[pnt] = 1;
           pnt++;
        }
        if (l != (1 << (i + 1))) return cout << "No\n", 0;
    }
    cout << "Yes\n";
}
/*
testcase
3
4 3 3 2 2 2 2 1
*/


Measured memory_bytes: 3328