akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using ll = long long int;

const int mod = 1e9+7;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

	int n; cin >> n;
	vector<array<int, 2>> v(n);
	int mx1 = INT_MIN, mx2 = INT_MIN;
	int mn1 = INT_MAX, mn2 = INT_MAX;
	for (auto &[x, y] : v) {
		cin >> x >> y;
		mx1 = max(mx1, x+y);
		mn1 = min(mn1, x+y);
		mx2 = max(mx2, x-y);
		mn2 = min(mn2, x-y);
	}

	// (x, y) and (a, b) with x <= a
	// |x-a| + |y-b| = a-x + |y-b|
	// a-x + y-b -> a-b - (x-y)
	// a-x + b-y -> a+b - (x+y)

	ll ans = max(abs(mx1-mn1), abs(mx2-mn2));
	cout << ans << '\n';
}

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

int main(void){
    int n;
    ll ans = 0;
    cin >> n;
    vector<int> v(n+1, 1);
    for(int i = 2; i <= n; i++){
        for(int j = i; j <= n; j += i){
            v[j]++;
        }
    }
    for(int i = 1; i <= n; i++){
        ans += (ll)i * v[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 42324
#include<bits/stdc++.h>
using namespace std;
int main(void){
	long long n,i,jwa[100001],iwa[100001],mx,sum,x,js,is;
	char s[100001];
	cin>>n>>s;
	for(i=0;i<=n;i++)jwa[i]=0,iwa[i]=0;
	for(i=0;i<n;i++){
		if(i!=0) jwa[i]=jwa[i-1];
		if(s[i]=='J') jwa[i]++;
	}
	for(i=n-1;i>=0;i--){
		if(i!=n-1) iwa[i]=iwa[i+1];
		if(s[i]=='I') iwa[i]++;
	}
	mx=0; sum=0; js=0; is=0;
	for(i=0;i<n;i++){
		x=jwa[i]*iwa[i];
		if(s[i]=='O') js+=iwa[i],is+=jwa[i],sum+=x;
		mx=max(mx,x);
	}
	mx=max(mx,js);
	mx=max(mx,is);
	cout<<sum+mx<<endl;
	return 0;
}


Measured memory_bytes: 4732
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_C() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int A,B,C; cin >> A>>B>>C;
    int X, Y; cin >> X >> Y;

    int ans = INF;
    REP(k,100001) {
        int sum = A * max(X - k, 0) + B * max(Y - k, 0) + C * 2 * k;
        ans = min(ans, sum);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
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;}
constexpr int INF = 1e18;

using T = tuple<int, int, int>;

signed main(){
	int N;
	cin >> N;
	vector<int>x(N), y(N), p(N);
	REP(i, N) {
		cin >> x[i] >> y[i] >> p[i];
	}
	vector<int>cost(1ll << N, INF);
	vector<vector<int>>dp(N + 1, vector<int>(1ll << N, INF));
	REP(i, 1ll << N) {
		REP(j, N) {
			if(!(i & 1ll << j)) continue;
			int xCost = 0, yCost = 0;
			REP(k, N) {
				if(!(i & 1ll << k)) continue;
				xCost += abs(x[j] - x[k]) * p[k];
				yCost += abs(y[j] - y[k]) * p[k];
			}
			CHMIN(cost[i], min(xCost, yCost));
		}
		dp[0][i] = 0;
		REP(j, N) {
			if(i & 1ll << j)dp[0][i] += min(abs(x[j]), abs(y[j])) * p[j];
		}
	}
	REP(i, N) {
		REP(state, 1ll << N) {
			int sub = state;
			do {
				CHMIN(dp[i + 1][state], dp[i][state ^ sub] + cost[sub]);
				sub--;
				sub &= state;
			} while(sub);
		}
	}
	REP(i, N + 1) out(dp[i][(1ll << N) - 1]);
}

Measured memory_bytes: 7948
# include<stdio.h>
int main(void)
{
  	int n,i=0,j,count=0;
        scanf("%d",&n);
int a[n];
for(;i<n;i++){
scanf("%d",&a[i]); 
 for(j=0;j<i;j++)
 {
     if(a[i]<a[j]) break;
 }
if(j==i)  count +=1;
}
  
  printf("%d",count);
	return 0;
}

Measured memory_bytes: 128
n=int(input())
A=0
B=0
C=0
D=0
for i in range(n):
  m=input()
  if m =="AC":
     A +=1
  elif m=="WA":
    B+=1
  elif m=="TLE":
    C +=1
  elif m=="RE":
    D +=1
 
print("AC x ",A)
print("WA x ",B)
print("TLE x ",C)
print("RE x ",D)

Measured memory_bytes: 9060
n, m = gets.chomp.split.map(&:to_i)
ary = gets.chomp.split.map(&:to_i)

if n >= m
    puts 0
else
    ary.sort!
    sabun = []
    (m-1).times do |i|
        sabun << ary[i+1] - ary[i]
    end
    # p sabun
    sabun.sort! {|a, b| b <=> a }
    # p sabun
    (n-1).times do |i|
        sabun.shift
    end
    # p sabun
    ans = sabun.inject(:+)
    puts ans
end

Measured memory_bytes: 10480
#include<iostream>
#include<cstdio>
#include<math.h>
using namespace std;
double dis(double p,double q)
{
	return sqrt(p*p+q*q);
}
int main()
{
	int n,ans=0;
	double d;
	cin>>n>>d;
	double x,y;
	for(int i=1;i<=n;i++)
	{
		cin>>x>>y;
		if(dis(x,y)<=d) ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3840
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
const vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T>void debag(const vector<T> &a){cerr<<"debag :";for(auto v:a)cerr<<v<<" ";cerr<<"\n";}
template<class T>void print(const vector<T> &a){for(auto v:a)cout<<v<<" ";cout<<"\n";}
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
  std::ostream::sentry s(dest);
  if (s) {
    __uint128_t tmp = value < 0 ? -value : value;
    char buffer[128];
    char *d = std::end(buffer);
    do {
      --d;
      *d = "0123456789"[tmp % 10];
      tmp /= 10;
    } while (tmp != 0);
    if (value < 0) {
      --d;
      *d = '-';
    }
    int len = std::end(buffer) - d;
    if (dest.rdbuf()->sputn(d, len) != len) {
      dest.setstate(std::ios_base::badbit);
    }
  }
  return dest;
}
using LL=__int128;
template<class T> 
T extgcd(T a,T b,T &x,T &y){
    if(b==0){
        x=1;y=0;
        return a;
    }
    T d=extgcd(b,a%b,y,x);
    y-=a/b*x;
    return d;
}
template<class T> 
pair<T, T> ChineseRem(const vector<T> &b, const vector<T> &m) {
  T r = 0, M = 1;
  for (int i = 0; i < (int)b.size(); ++i) {
    T p, q;
    T d = extgcd<T>(M, m[i], p, q); // p is inv of M/d (mod. m[i]/d)
    if ((b[i] - r) % d != 0) return make_pair(0, -1);
    T tmp = (b[i] - r) / d * p % (m[i]/d);
    r += M * tmp;
    M *= m[i]/d;
  }
  r=((r%M)+M)%M;
  return make_pair(r, M);
}
vector<ll> divisor(ll n){
	vector<ll> ret;
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			ret.push_back(i);
            if(i*i!=n)ret.push_back(n/i);
		}
	}
	sort(ret.begin(),ret.end());
	return(ret);
}
int main(){
    ll n;
    cin>>n;
    n*=2;
    V<ll> d=divisor(n);
    LL ans=inf;
    for(ll v:d){
        V<LL> r={0,n/v-1},m={v,n/v};
        pair<LL,LL> p=ChineseRem<LL>(r,m);
        if(p.fi!=0){
            if(ans>p.fi){
                ans=p.fi;
            }
        }
    }
    cout<<ans<<"\n";
}


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

template <unsigned M> struct modular {
  using m = modular;
  unsigned v;
  modular(long long a = 0) : v((a %= M) < 0 ? a + M : a) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m r) { if ((v += r.v) >= M) v -= M; return *this; }
  m& operator-=(m r) { if (v < r.v) v += M; v -= r.v; return *this; }
  m& operator*=(m r) { v = (uint64_t)v * r.v % M; return *this; }
  m& operator/=(m r) { return *this *= power(r, M - 2); }
  friend m operator+(m l, m r) { return l += r; }
  friend m operator-(m l, m r) { return l -= r; }
  friend m operator*(m l, m r) { return l *= r; }
  friend m operator/(m l, m r) { return l /= r; }
  friend bool operator==(m l, m r) { return l.v == r.v; }
  friend string to_string(m a) { return to_string(a.v); }
};

constexpr long long mod = 1e9 + 7;
using mint = modular<mod>;

template <class T> struct fenwick {
  const int n;
  vector<T> t;
  fenwick(int _n) : n(_n), t(n + 1) {}
  void add(int i, T a) { for (++i; i <= n; i += i & -i) t[i] += a; }
  T sum(int i) const {
    T s = 0;
    for (; i; i -= i & -i) s += t[i];
    return s;
  }
  T sum(int l, int r) const { return sum(r) - sum(l); }
  int kth(T k) const {
    int i = 0;
    for (int w = 1 << __lg(n); w; w >>= 1)
      if (i + w <= n and t[i + w] <= k) k -= t[i += w];
    return i;
  }
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  deque<int> x(n);
  for (auto&& e : x) {
    cin >> e;
  }
  vector<int> y(m);
  for (auto&& e : y) {
    cin >> e;
  }
  while (not x.empty() and x.front() < y.front()) {
    x.pop_front();
  }
  while (not x.empty() and x.back() > y.back()) {
    x.pop_back();
  }
  n = x.size();
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    a[i] = x[i] - *prev(lower_bound(begin(y), end(y), x[i]));
    b[i] = *upper_bound(begin(y), end(y), x[i]) - x[i];
  }
  auto va = a, vb = b;
  sort(begin(va), end(va));
  va.erase(unique(begin(va), end(va)), end(va));
  sort(begin(vb), end(vb));
  vb.erase(unique(begin(vb), end(vb)), end(vb));
  int na = va.size(), nb = vb.size();
  vector<vector<int>> to(na, {0});
  for (int i = 0; i < n; ++i) {
    int p = lower_bound(begin(va), end(va), a[i]) - begin(va);
    int q = lower_bound(begin(vb), end(vb), b[i]) - begin(vb);
    to[p].push_back(q + 1);
  }
  fenwick<mint> dp(nb + 1);
  dp.add(0, 1);
  for (auto&& e : to) {
    sort(begin(e), end(e));
    e.erase(unique(begin(e), end(e)), end(e));
    vector<pair<int, mint>> qs;
    for (int j : e) {
      qs.emplace_back(j, dp.sum(j));
    }
    for (auto q : qs) {
      dp.add(q.first, q.second);
    }
  }
  mint res = dp.sum(nb + 1);
  cout << res.v << '\n';
}


Measured memory_bytes: 8064
((stdin) => {
	let [a, v, b, w, t] = stdin.split(/\s/);
	[a, v, b, w, t] = [+a, +v, +b, +w, +t];

	let distance = a - b;
	let speed = v - w;
	let move = t * speed;

	if (b > a) {
		if (move + distance >= 0) {
			console.log('YES');
		}
		else {
			console.log('NO');
		}
	}
	else {
		if (move - distance >= 0) {
			console.log('YES');
		}
		else {
			console.log('NO');
		}
	}
})(require("fs").readFileSync("/dev/stdin", "UTF-8"));

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

int main(){

  int n,m;
 
  cin>>n>>m;

  
  if(n==m)cout<<"Yes";
  else cout<<"No";
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int n, x;
  cin >> n >> x;
  int sum = 0, mn = 16384;
  for (int i = 0; i < n; ++i) {
    int m;
    cin >> m;
    sum += m;
    mn = min(mn, m);
  }
  cout << n + (x - sum) / mn << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, m, q;
const int N = 200000;
int dis[N][15], ci[N], inq[N];
vector <int> bi[N];
queue <int> Q;
int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; ++ i)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        bi[a].push_back(b);
        bi[b].push_back(a);
    }
    scanf("%d", &q);
    for (int i = 1; i <= q; ++ i)
    {
        int v, d, c;
        scanf("%d%d%d", &v, &d, &ci[i]);
        dis[v][d] = i;
    }
    for (int i = 1; i <= n; ++ i)
    {
        for (int j = 10; j; -- j)
            if (dis[i][j] > dis[i][j - 1])
                dis[i][j - 1] = dis[i][j];
        Q.push(i); inq[i] = 1;
    }
    while (!Q.empty())
    {
        int t = Q.front(); Q.pop(); inq[t] = 0;
        for (int i = 0; i < bi[t].size(); ++ i)
        {
            int cg = 0;
            for (int j = 10; j; -- j)
                if (max(dis[t][j], dis[bi[t][i]][j]) > dis[bi[t][i]][j - 1])
                {
                    dis[bi[t][i]][j - 1] = max(dis[t][j], dis[bi[t][i]][j]);
                    cg = 1;
                }
            if (cg && !inq[bi[t][i]])
            {
                Q.push(bi[t][i]);
                inq[bi[t][i]] = 1;
            }
        }
    }
    for (int i = 1; i <= n; ++ i) cout << ci[dis[i][0]] << "\n";return 0;
}

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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n;
  while (1) {
    cin >> n;
    if (n == 0) break;
    bool jud = true;
    int ans = 0, a;
    rep(i, 0, n) {
      cin >> a;
      if (a >= 2) jud = false;
      if (a != 0) ++ans;
    }
    if (jud == true)
      cout << "NA\n";
    else
      cout << ans + 1 << '\n';
  }
  return 0;
}


Measured memory_bytes: 3184
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int R[2][200010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    pair<int, int> p[200010];
    rep(i, N) cin >> p[i].first >> p[i].second;
    sort(p, p + N);
    R[0][N - 1] = p[N - 1].second;
    RREP(i, N - 2, 0) {
        R[0][i] = min(R[0][i + 1], p[i].second);
    }
    R[1][0] = p[0].second;
    rep(i, N - 1) {
        R[1][i + 1] = min(R[1][i], p[i + 1].second); 
    }
    int ans = 0;
    rep(i, N - 1) {
        int contest1 = max(0, R[1][i] - p[i].first + 1);
        int contest2 = max(0, R[0][i + 1] - p[N - 1].first + 1);
        //cout<< contest1 << " " << contest2 << endl;
        ans = max(0, max(ans, contest1 + contest2));
    }
    REP(i, 1, N - 2) {
        int contest1 = max(0, p[i].second - p[i].first + 1);
        int contest2 = max(0, R[0][0] - p[N - 1].first + 1);
        //cout<< contest1 << " " << contest2 << endl;
        ans = max(0, max(ans, contest1 + contest2));
    }
    cout << ans << endl;



    return 0;
}


Measured memory_bytes: 2560
# n, m, l = map(int, input().split())

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

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

N = int(input())
P = list(map(int, input().split()))
Pmin = [2*10**5 for i in range(N)]
Pmin[0] = P[0]
for i in range(1, N):
    Pmin[i] = min(Pmin[i-1], P[i])

ans = 0
for i in range(N):
    if Pmin[i] >= P[i]:
        ans += 1

print(ans)


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

using namespace std;

int main(){

	int n ;
	cin >> n;

	int taro = 0,hanako = 0;

	for(int i=0; i<n;i++){
//		taro
		string t;
		cin >> t;
//		hanako
		string h;
		cin >> h;

		if(t.compare(h) == 0){
			taro++;
			hanako++;
		}else if(t.compare(h) > 0){
			taro += 3;
		}else{
			hanako += 3;
		}
	}
	cout << taro << " " << hanako << endl;
	return 0;
}



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

using lint = int64_t;
const lint MOD = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    vector<lint> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] *= 2;
    }

    lint lb = 0, ub = 2e9 + 10; 
    lint ans;
    while (true) {
        lint mid = (lb + ub) / 2;
        lint tes = a[0] - mid;
        for (int i = 1; i < n; i++) {
            tes = a[i] - tes;
        }
        if (mid == tes) {
            ans = mid;
            break;
        } else if (mid < tes) {
            ans = lb;
            lb = mid;
        } else {
            ans = lb;
            ub = mid;
        }
    }
    cout << ans;
    for (int i = 0; i < n - 1; i++) {
        ans = a[i] - ans;
        cout << ' ' << ans;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 2048
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class BCraneAndTurtle {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int x, y; cin >> x >> y;
      if (y%2 == 1) {
        cout << "No" << endl;
        return;
      }
      int low = 2*x;
      int high = 4*x;
      if (low <= y && y <= high) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
};

signed main() {
  BCraneAndTurtle solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 3644
import java.util.*;
import java.lang.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int a = scan.nextInt();
      	int counter = 0;
      	
      	double x = Math.log(a) / Math.log(2);
      	int num = (int)x;
      
      	System.out.print((int)Math.pow(2, num));
      	
    }
}

Measured memory_bytes: 23124
import numpy as np
x = input().split()
y = np.empty(2)
y[0] = int(x[0])
y[1] = int(x[1])
max = 0
if y[0] >= y[1]:
    max += y[0]
    y[0] = y[0] - 1
else:
    max += y[1]
    y[1] = y[1] -1

if y[0] >= y[1]:
    max += y[0]
else:
    max += y[1]
print(int(max))

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

int main() {
    
    int N,M;
    cin>>N>>M;
    if(N<M) cout<<"a < b"<<endl;
    if(N>M) cout<<"a > b"<<endl;
    if(N==M) cout<<"a == b"<<endl;
}



Measured memory_bytes: 3088
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>

using namespace std;

int main(){
	int a,b,c;
	bool ans=false;
	
	scanf("%d %d %d",&a,&b,&c);
	if(a<b){
		if(a<c){
			if(b<c){
				printf("Yes\n");
				ans=true;
			}
		}
	}
	if(ans==false)
	printf("No\n");
}


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

import sys

sum = [0]*37
for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                sum[a+b+c+d] += 1
for line in sys.stdin:
    n = int(line)
    if n >= 0 and n <= 36:
        print sum[n]
    else:
        print "0"

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

int main() {
	using pt = complex<int>;
	int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
	pt a(x1, y1);
	pt b(x2, y2);
	pt c = b + (b - a) * pt(0, 1);
	pt d = c + (c - b) * pt(0, 1);
	cout << c.real() << ' ' << c.imag() << ' ' << d.real() << ' ' << d.imag() << '\n';

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
int main() {
    std::string s;
    std::vector<long> v;
    while (std::cin >> s) {
        long x, y;
        if (s == "+") {
            x = v.back();
            v.pop_back();
            y = v.back();
            v.pop_back();
            v.push_back(x + y);
        } else if (s == "-") {
            x = v.back();
            v.pop_back();
            y = v.back();
            v.pop_back();
            v.push_back(y - x);
        } else if (s == "*") {
            x = v.back();
            v.pop_back();
            y = v.back();
            v.pop_back();
            v.push_back(x * y);
        } else {
            x = std::stol(s);
            v.push_back(x);
        }
    }
    std::cout << v.back() << std::endl;
}



Measured memory_bytes: 3204
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double ld;

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


int main() {
    ll N,K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i,N){
        cin >> A[i];
    }

    ll x = N-K;

    for(ll i=K;i<N;i++){
        ll ans = A[i]-A[i-K];
        if(ans > 0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }




    // vector<ll> result(x);
    // rep(i,x+1){
    //     result[i] = 1;
    // }

    // ll j=0;
    // for(ll i =(K-1);i<N;i++){
    //     ll n=i;
    //     for(ll k=0;k<K;k++){
    //         result[j] *= A[n];
    //         n--;
    //     }
    //     // result[j] = A[i]*A[i-1]*A[i-2];
    //     j++;
    // }

    // // rep(i,x+1){
    // //     cout << result[i] << endl;
    // // }

    // rep(i,x){
    //     ll ans = result[i+1] - result[i];
    //     if(ans > 0){
    //         cout << "Yes" << endl;
    //     }else{
    //         cout << "No" << endl;
    //     }
    // }


}




Measured memory_bytes: 4788
#include <algorithm>
#include <cstdio>
#include <vector>
#define pb push_back
std::vector<int> adj[100005];
int app[100005][25];
int dfs(int u, int fa = -1)
{
	int ans = 0;
	for (int v : adj[u])
	{
		if (v == fa)
			continue;
		ans = std::max(ans, dfs(v, u));
		for (int j = 0; j < 20; j++)
			app[u][j] += app[v][j];
	}
	int res = 0;
	for (int i = 19; i >= 0; i--)
	{
		if (app[u][i] > 1)
		{
			res = i + 1;
			break;
		}
	}
	while (app[u][res])
		res++;
	for (int j = 0; j < res; j++)
		app[u][j] = 0;
	app[u][res] = 1;
	return std::max(ans, res);
}
int main()
{
	// freopen("AGC009-D.in", "r", stdin);
	int n;
	scanf("%d", &n);
	for (int i = 1; i < n; i++)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		adj[--u].pb(--v);
		adj[v].pb(u);
	}
	printf("%d\n", dfs(0));
	return 0;
}


Measured memory_bytes: 22272
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

template <typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n = 0) : n(n), d(n + 1) {}
  void add(int i, T x = 1) {
    for(i++; i <= n; i += i & -i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for(i++; i; i -= i & -i) {
      x += d[i];
    }
    return x;
  }
};

int main() {
  ll n, k;
  cin >> n >> k;
  vl s(n + 1, 0);
  rep(i, n) {
    ll a;
    cin >> a;
    s[i + 1] = s[i] + a - k;
  }
  BIT<ll> b(n + 5);
  vl so = s;
  sort(all(so));
  so.erase(unique(all(so)), so.end());
  ll ans = 0;
  rep(i, n + 1) {
    ll in = lower_bound(all(so), s[i]) - so.begin();
    ans += b.sum(in);
    b.add(in);
  }
  cout << ans << endl;
}

Measured memory_bytes: 4992
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N,M = inpl()
lines = defaultdict(set)

for _ in range(M):
	a,b,c = inpl()
	a,b = a-1,b-1
	lines[a].add((b,-c))

#ベルマンフォード(始点と終点が決まってる時)
def BellmanFord(Start,Goal):
	Costs=[INF]*N
	Costs[Start] = 0
	upd8s = [True]*N
	for i in range(2*N): #2N回ループ(負回路の検出までみる)
		will_upd8s = [False]*N
		upd8 = False
		for s in range(N):
			if not upd8s[s]: continue	#前回更新してないので見ない
			for t,c in lines[s]:
				if c + Costs[s] < Costs[t]:
					Costs[t] = Costs[s]+c
					upd8 = True
					will_upd8s[t] = True #更新した点だけ次に見る

		if not upd8: #なにも更新しなかったら終わり
			return Costs[Goal]

		if i == N-1: #Nループ目のGoalのCostを記録
			tmp = Costs[Goal]

		upd8s = will_upd8s[:]

	if tmp != Costs[Goal]:
		return -INF
	else:
		return Costs[Goal]

print(-BellmanFord(0,N-1))


Measured memory_bytes: 4712
import Control.Applicative
import Data.List

m = 998244353
modm n = mod n m

mul' x y = modm $ modm x * modm y

power' x 0 = 1
power' x 1 = modm x
power' x n
  | (n `mod` 2) == 0 = let i = power' x (n `div` 2) in mul' i i
  | otherwise = mul' x $ power' x (n - 1)

div' x y = mul' x $ power' y (m - 2)

main = do
  [n] <- map read <$> words <$> getLine :: IO [Int]
  xs <- map read <$> words <$> getLine :: IO [Int]
  --let n = 7
  --let xs = [0,3,2,1,2,2,1]
  let xs' = group $ sort xs
  let ls = map length $ xs'
  if (head xs /= 0) || (head ls /= 1) then
    print 0
  else if and (zipWith (==) (map head xs') [0..n]) then
    print $ foldl1' mul' $ zipWith power' (init ls) (tail ls)
  else
    print 0



Measured memory_bytes: 29052
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
int main() {
  int n, m; cin >> n >> m;
  vector<int> a(n), b(n); REP(i, n) cin >> a[i] >> b[i];
  vector<int> ans(n, 0), dist(n, INF);
  REP(i, m) {
    int c, d; cin >> c >> d;
    REP(j, n) {
      int tmp = abs(a[j] - c) + abs(b[j] - d);
      if (tmp < dist[j]) {
        ans[j] = i;
        dist[j] = tmp;
      }
    }
  }
  REP(i, n) cout << ans[i] + 1 << '\n';
  return 0;
}


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

// one-based numbering
struct union_find {
    vector<int> rank, par;
    union_find(int n) {
      rank.resize(n+1);
      par.resize(n+1);
      for(int i = 1; i <= n; i++) rank[i] = 1, par[i] = i;
    }
    int find(int x) {
        if(x == par[x]) return x;
        else 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[y] = x;
        else{
            par[x] = y;
            if(rank[x] == rank[y]) rank[y]++;
        }
    }
    bool same(int x, int y) {
        x = find(x); y = find(y);
        return x == y;
    }
};

struct edge {
  int a, b; long long cost;
  bool operator< (struct edge &e) {
    return cost < e.cost;
  }
};

long long kruskal(int n, vector<edge> &v) {
  sort(v.begin(), v.end());
  union_find u = union_find(n);
  long long mincost = 0;
  for (int i = 0; i < v.size(); i++) {
    if (!u.same(v[i].a, v[i].b)){
      mincost += v[i].cost;
      u.unite(v[i].a, v[i].b);
    }
  }
  return mincost;
}


int main(){
  int n;
  cin >> n;
  vector<pair<long long, int> > x, y;
  for (int i = 0; i < n; i++) {
    long long p, q;
    cin >> p >> q;
    x.push_back(make_pair(p, i+1));
    y.push_back(make_pair(q, i+1));
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  vector<edge> v;
  for (int i = 0; i < n-1; i++) {
    edge ex, ey;
    ex.a = x[i].second; ex.b = x[i+1].second; ex.cost = x[i+1].first-x[i].first;
    ey.a = y[i].second; ey.b = y[i+1].second; ey.cost = y[i+1].first-y[i].first;
    v.push_back(ex); v.push_back(ey);
  }
  cout << kruskal(n, v) << endl;
  return 0;
}


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

void swap(int& a, int& b) {
	int tmp = a;
	a = b;
	b = tmp;
}

int selectionSort(vector<int>& A, int N) {
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		int minj = i;
		for (int j = i; j < N; j++) {
			if (A[j] < A[minj])
				swap(minj, j);
		}
		if (A[i] != A[minj]) {
			swap(A[i], A[minj]);
			cnt++;
		}
	}
	return cnt;
}

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

	int cnt = selectionSort(A, N);
	for (int i = 0; i < N; i++) {
		cout << A[i];
		if (i < N-1) cout << ' ';
		else cout << endl;
	}
	cout << cnt << endl;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int dp[5005][5005];

int main () {
  int n;
  string s;
  cin >> n >> s;
  
  for (int i = n-1; i >= 0; --i) {
    for (int j = n-1; j >= 0; --j) {
      if (s[i] != s[j]) dp[i][j] = 0;
      else dp[i][j] = dp[i+1][j+1]+1;
    }
  }

  int ans = 0;
  rep(i,n)rep(j,n) {
    if (i >= j) continue; // i < j;
    int now = min(dp[i][j], j-i);
    ans = max(ans, now);
  }

  cout << ans << endl;
}

Measured memory_bytes: 98048
#include<bits/stdc++.h>
using namespace std;
int main(){
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    int n, req = 0;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a, a+n);
    req = a[n-1] - a[0];
    cout << req << endl;
return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define forn(i, a, n) for(ll i = a; i < n; i++)

#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
const ll mod = 1e9;

string s;
ll co;
vector<pll> res;

int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	/*
	freopen("input.txt", "r", stdin);
	freopen ("output.txt", "w", stdout);
	*/


	cin >> s;
	if (s.back() == '1' || s[0] == '0')
	{
		cout << -1 << endl;
		return 0;
	}
	forn(i, 0, s.size() - 1)
	{
		ll j = s.size() - 2 - i;
		if (i == j)
			break;
		if (s[i] != s[j])
		{
			cout << -1 << endl;
			return 0;
		}
	}

	ll cur = 1;
	co++;
	forn(i, 0, s.size()/2)
	{
		res.push_back(make_pair(cur, ++co));
		if (s[i] == '1')
			cur = co;
	}
	forn(i, s.size() / 2, s.size()-1)
		res.push_back(make_pair(cur, ++co));

	while (res.size())
	{
		cout << res.back().first << ' ' << res.back().second << endl;
		res.pop_back();
	}

	return 0;
}

Measured memory_bytes: 3264
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            int pocketMoney = Integer.parseInt(br.readLine()) - Integer.parseInt(br.readLine());
            int donutsFee = Integer.parseInt(br.readLine());
            int remainingMoney = 0;
            
            while (pocketMoney >= donutsFee){
                pocketMoney -= donutsFee;
            }

            System.out.println(pocketMoney);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 21204
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
flag=True
for i in range(0,n-4+1):
    if a[i]==a[i+1]:
        for j in range(i+2,n-1+1):
            if a[j]==a[j+1]:
                print(a[i]*a[j])
                flag=False
                break
        break
if flag:
    print(0)


Measured memory_bytes: 14244
#include <stdio.h>

int main(){
  int X,Y,Z;
  scanf("%d %d %d",&X,&Y,&Z);
  int T;
  T=X;
  X=Y;
  Y=T;
  T=X;
  X=Z;
  Z=T;
  printf("%d %d %d\n",X,Y,Z);
  return 0;
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, Q;
string s;
int dp[101010];
void solve(){
	cin >> n >> Q;
	cin >> s;
	for(int i = 0; i < n; i++){
		dp[i+1] = dp[i];
		if(s[i] == 'A' && s[i+1] == 'C') dp[i+1]++;
	}
	for(int i = 0; i < Q; i++){
		int a,b;
		cin >> a >> b;
		cout << dp[b-1]-dp[a-1] << endl;
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 1488
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const double EPS = 1e-10;
const int INF = 2147483647;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int main()
{
	int n, k;
	string s;

	cin >> s;
	for (int i = 0;i < s.size();i++) {
		if (s[i] == '1') cout << '9';
		else if (s[i] == '9') cout << '1';
		else cout << s[i];
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int r,c,i,j;
  static int s[101][101];
  scanf("%d%d",&r,&c);
  for(i=0;i<=r;i++){
    for(j=0;j<c;j++){
      scanf("%d", &s[i][j]);
      printf("%d ", s[i][j]);
      s[i][c] += s[i][j];
      s[r][j] += s[i][j];
    }
    printf("%d\n",s[i][c]);
  }
  return 0;
}



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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(3e3 + 5);
const int MAX_M = (int)(5e3 + 5);

int n, m;
ll p;

vector<tuple<int, int, ll>> edges;

vector<int> graph[MAX_N];
vector<int> graph_rev[MAX_N];

bool reachable_from_begin[MAX_N];
bool reachable_to_end[MAX_N];

ll d[MAX_N];

void dfs_from(int node) {
  if (reachable_from_begin[node]) return;

  reachable_from_begin[node] = true;

  for (auto &e : graph[node]) {
    dfs_from(e);
  }
}

void dfs_to(int node) {
  if (reachable_to_end[node]) return;

  reachable_to_end[node] = true;

  for (auto &e : graph_rev[node]) {
    dfs_to(e);
  }
}

void check_reachability() {
  for (int i = 0; i < n; ++i) {
    reachable_from_begin[i] = false;
    reachable_to_end[i] = false;
  }

  dfs_from(0);
  dfs_to(n - 1);
}

bool ok(int node) {
  return (reachable_from_begin[node] && reachable_to_end[node]);
}

bool check_negative_loop() {
  ll td[MAX_N];

  fill(td, td + n + 3, 0);

  for (int i = 0; i < n; ++i) {
    for (auto &e : edges) {
      if (!ok(get<0>(e)) || !ok(get<1>(e))) continue;

      if (td[get<1>(e)] > td[get<0>(e)] + get<2>(e)) {
        td[get<1>(e)] = td[get<0>(e)] + get<2>(e);

        if (i == n - 1) return true;
      }
    }
  }

  return false;
}

void bellman_ford() {
  for (int i = 0; i < n; ++i) d[i] = INF;

  d[0] = 0;

  while (true) {
    bool update = false;

    for (auto &e : edges) {
      if (!ok(get<0>(e)) || !ok(get<1>(e))) continue;

      // printf("%d %d\n", get<0>(e), get<1>(e));

      if (d[get<1>(e)] > d[get<0>(e)] + get<2>(e)) {
        d[get<1>(e)] = d[get<0>(e)] + get<2>(e);

        update = true;
      }
    }

    if (!update) break;
  }
}

int main(void) {
  // Here your code !
  scanf("%d %d %lld", &n, &m, &p);

  for (int i = 0; i < m; ++i) {
    int a, b;
    ll c;
    scanf("%d %d %lld", &a, &b, &c);

    // 1-index to 0-index
    a -= 1;
    b -= 1;

    // maximize plus => minimize minus
    edges.emplace_back(a, b, -1LL * (c - p));

    graph[a].push_back(b);
    graph_rev[b].push_back(a);
  }

  check_reachability();

  if (check_negative_loop()) {
    printf("%d\n", -1);
    return 0;
  }

  bellman_ford();

  // for (int i = 0; i < n; ++i) {
  //   printf("%d: %lld, %d\n", i, d[i], ok(i));
  // }

  ll ans = -1LL * min(d[n - 1], 0LL);

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

  return 0;
}


Measured memory_bytes: 768
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    x = II()
    k = 100
    i = 0
    while k < x:
        k *= 1.01
        k = int(k)
        i += 1
    print(i)
    return


#main
if __name__ == '__main__':
    solve()


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

#define int long long

signed main() {
    int n;
    cin >> n;
    string s;
    for(int i=0; i<n; ++i) {
        cin >> s;
        if(s=="Y") {
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 100100
using namespace std;
vector<int>v[maxn];
int n,dp[maxn];
int comp(int a,int b){return dp[a]>dp[b];}
void dfs(int u){
	for(int i=0;i<v[u].size();++i)dfs(v[u][i]);
	sort(v[u].begin(),v[u].end(),comp);
	for(int i=0,tp=0;i<v[u].size();++i)
		dp[u]=max(dp[u],dp[v[u][i]]+(++tp));
}
int main(){
	scanf("%d",&n);
	for(int i=2,f;i<=n;++i)
		scanf("%d",&f),v[f].push_back(i);
	dfs(1),printf("%d",dp[1]);
}

Measured memory_bytes: 10752
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;


void main() {
    int n, k;
    scan(n, k);
    auto h = iota(n).map!(i => readln.chomp.to!int).array;

    h.sort();

    int ans = 10^^9 + 7;

    foreach (i ; 0 .. n - k + 1) {
        ans = min(ans, h[i + k - 1] - h[i]);
    }

    writeln(ans);
}


















void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	multiset<int> m;
	for(int i = 0 ;i<n; i++)
	{
		int j;
		cin>>j;
		if(m.count(j))
			m.erase(j);
		else
			m.insert(j);
	}
	cout<<m.size()<<endl;
	return 0;
}

Measured memory_bytes: 4992
# C
import itertools
n, m, x = map(int, input().split())
ca = [list(map(int, input().split()))for i in range(n)]
l = []
ans = 1e10
for i in range(1, n+1):
    for j in itertools.combinations(range(n), i):#ｎまでの組み合わせ
        # print(j)
        tmp = 0 #金額zc
        li = [0] * m#理解度li
        for k in j:#k番目の参考書
            # print(k)
            tmp += ca[k][0]#金額を加える
            for o in range(m):#場合jの時のkの参考書を読んだときの理解度を足す
                # print(o)
                li[o] += ca[k][o + 1]#理解度を足す
        # print(li)
        count = 0  #理解度カウンターm-1 まで
        for p in li:
            # print(count)
            if p >= x:#全ての理解度がx以上
                count += 1
            else:
                break
        # print(count,m)
        if count == m:#理解度カウンターがmになる
            # print(count,m,j)
            ans = min(ans, tmp)#金額が低い
if ans != 1e10:# 合計金額としては高すぎる>ならば一度も理解が追いついていない>-1
    print(ans)
else:
    print(-1)


Measured memory_bytes: 9180
import sys

def gcd(x, y):
    x, y = sorted([x, y])
    while y % x:
        y, x = x, y % x
    return x

t = int(sys.stdin.readline())
for _ in range(t):
    a, b, c, d = map(int, sys.stdin.readline().split())
    if a < b:
        print("No")
    elif d < b:
        print("No")
    elif c >= b:
        print("Yes")
    else:
        g = gcd(b, d)
        if b - g + (a % g) > c:
            print("No")
        else:
            print("Yes")

Measured memory_bytes: 3064
#coding=UTF-8

'''
27 0 0 0 0 0 0 ->(3)
6 3 3 3 3 3 3
'''

N=int(input())

mozir=input()
hyo=mozir.split(' ')
a=[int(mono) for mono in hyo]

ans=0
tgt=0
while True:
    dist=a[tgt]-(N-1)
    kai=dist//N + (1 if dist%N != 0 else 0)
    ans+=kai

    for idx in range(0,N,1):
        if idx != tgt:
            a[idx]+=kai
        else:
            a[idx]=a[idx]%N

    if tgt==N-1:
        turuturup=True
        for idx in range(0,N,1):
            if a[idx]>=N:
                turuturup=False
                break

        if turuturup:
            break
    tgt=(tgt+1)%N

print(ans)


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

int n, d;

int main() {
    std::cin >> n;
    std::cin >> d;
    int ans = 0;
    int x = 1;
    while (x <= n) {
        x += (d*2);
        x += 1;
        ans++;

    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
def divisor(n):
    d = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            d.append(i)
            if i != n//i:
                d.append(n//i)
    #d.sort()
    return d

n,k = ma()
A = lma()
s = sum(A)
ds = divisor(s);ds.sort(reverse=True)
for d in ds:
    ls = []
    cost=0
    for a in A:
        p,r = divmod(a,d)
        ls.append(r)
    ls.sort(reverse=True)
    s0 = sum(ls)
    cost=s0
    #print("d",d,"s0",s0,"ls",ls)
    for r in ls:
        if s0==0:
            break
        s0 -=d
        cost-=r
    if cost<=k:
        print(d)
        exit()


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

using i64 = int64_t;

int main(){
    i64 n, x;
    cin >> n >> x;
    vector<i64> v;
    for(int i=0;i<n;++i){
        i64 a;
        cin >> a;
        v.push_back(a);
    }
    i64 ans = 0;
    if(v[0] > x){
        ans += v[0] - x;
        v[0] -= (v[0]-x);
    }
    for(int i=1;i<n;++i){
        if(v[i]+v[i-1] > x){
            ans += (v[i]+v[i-1]) - x;
            v[i] -= (v[i]+v[i-1]) - x;
            v[i] = max((i64)0, v[i]);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1400
s = list(input())
con = 0
if (len(s)%2 == 0):
    for i in range(0,len(s),2):
        if (s[int(i)] == 'h'):
            if(s[int(i)+1] =='i'):
                con += 2
            else:
                print('No')
                exit()
        else:
            print('No')
            exit()
    if (con == len(s)):
        print('Yes')
        exit()
print('No')
exit()

Measured memory_bytes: 3060