akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <complex>
using namespace std;

int main() {
	int n;
	cin >> n;
	bool ans = false;
	int a, b, c;
	a = n/100;
	b = n/10 % 10;
	c = n%10;
	if (a == 7 || b == 7 || c == 7) {
		ans = true;
	}
	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3624
N = int(input())
s = []
t = []
total = 0
for i in range(N):
    S, T = input().split()
    s.append(S)
    t.append(int(T))
    total += int(T)
X = input()

awake = 0
for i in range(N):
    awake += t[i]
    if s[i] == X:
        break
    
print(total - awake)


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

#define show(x) cerr << #x << " = " << x << endl ;
#define input_from_file freopen("input.txt","r",stdin)
#define output_to_file freopen("output.txt" , "w",stdout)
#define output_to_error freopen("error.txt" , "w" ,stderr)
#define fastio ios_base::sync_with_stdio(0)
#define endl '\n'


int main()
{
    #ifdef LOCAL
        input_from_file;
        output_to_file;
        output_to_error;
    #endif
    fastio;cin.tie(0);cout.tie(0);
    string s ,t ; cin >> s >> t ; 
    int s1 , t1 ; cin >> s1 >> t1 ;
    string u ; cin >> u ;
    if(u == s) cout << s1-1 << " " << t1 ;
    else cout << s1 << " " << t1-1 ;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define DEBUG2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << "\n"
#define DEBUG3(x, y, z)                                                        \
  cerr << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z  \
       << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
#define pint pair< int, int >
#define ld long double
using namespace std;
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 > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, M;
  cin >> N >> M;
  vec< int > a(M);
  vec< int > c(M);
  // vec<int>b()
  REP(i, M) {
    int p;
    cin >> a[i] >> p;
    int index = 0;
    REP(j, p) {
      int q;
      cin >> q;
      q--;
      index += BIT(q);
    }
    c[i] = index;
  }
  // PRINTALL(a);
  // PRINTALL(c);
  int sizeN = BIT(N);
  vec< vec< int > > dp(M + 1, vec< int >(sizeN, INF));
  dp[0][0] = 0;
  REP(i, M) {
    REP(j, sizeN) chmin(dp[i + 1][j], dp[i][j]);
    REP(j, sizeN) { chmin(dp[i + 1][j | c[i]], dp[i][j] + a[i]); }
  }

  if (dp[M][sizeN - 1] == INF) {
    print(-1);
  } else {
    print(dp[M][sizeN - 1]);
  }
}

Measured memory_bytes: 32384
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <tuple>
#include <queue>
#include <string>
#include <map>
#include <utility>
const int maxn = 1e5+1;
typedef long long ll;
using namespace std;
vector<pair<int,int>> g_yen[maxn];
vector<pair<int,int>> g_snu[maxn];
const ll INF=1e17;
ll d_yen[maxn];
ll d_snu[maxn];
ll dp[maxn];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m,s,t;
    cin>>n>>m>>s>>t;
    for(int i=1; i<=m; ++i){
        int u,v,a,b;
        cin>>u>>v>>a>>b;
        g_yen[u].push_back(make_pair(v,a));
        g_yen[v].push_back(make_pair(u,a));
        g_snu[u].push_back(make_pair(v,b));
        g_snu[v].push_back(make_pair(u,b));
    }
    set<pair<ll,int>> s_yen;
    for(int i=1; i<=n; ++i)
        d_yen[i]=INF;
    d_yen[s]=0;
    s_yen.insert(make_pair(d_yen[s],s));
    while(!s_yen.empty()){
        int v=s_yen.begin()->second;
        s_yen.erase(s_yen.begin());
        for(auto ed:g_yen[v]){
            int to=ed.first;
            int w=ed.second;
            if (d_yen[v]+w<d_yen[to]){
                s_yen.erase(make_pair(d_yen[to],to));
                d_yen[to]=d_yen[v]+w;
                s_yen.insert(make_pair(d_yen[to],to));
            }
        }
    }



    set<pair<ll,int>> s_snu;
    for(int i=1; i<=n; ++i)
        d_snu[i]=INF;
    d_snu[t]=0;
    s_snu.insert(make_pair(d_snu[t],t));
    while(!s_snu.empty()){
        int v=s_snu.begin()->second;
        s_snu.erase(s_snu.begin());
        for(auto ed:g_snu[v]){
            int to=ed.first;
            int w=ed.second;
            if (d_snu[v]+w<d_snu[to]){
                s_snu.erase(make_pair(d_snu[to],to));
                d_snu[to]=d_snu[v]+w;
                s_snu.insert(make_pair(d_snu[to],to));
            }
        }
    }
    set<pair<ll,int>> cock;
    for(int  i=1; i<=n; ++i) {
        dp[i] = d_yen[i] + d_snu[i];
      //  cout<<i<<" "<<dp[i]<<endl;
        cock.insert(make_pair(dp[i],i));
    }
    ll mon=1e15;
    cout<<mon-cock.begin()->first<<"\n";
    for(int i=1; i<=n-1; ++i){
        cock.erase(make_pair(dp[i],i));
        cout<<mon-cock.begin()->first<<"\n";
    }

}

Measured memory_bytes: 22272
l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

for i in range(1, min(l) + 1):
    if (a % i) == 0 and (b % i) == 0:
       ans.append(i) 

if len(ans) == 0:
    print(1)
else:
    print(ans[-k])


Measured memory_bytes: 3060
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<set>
#include<vector>
#include<map>
#include<queue>
#define ll long long
using namespace std;
map<ll,ll>M;
ll a[1000000];
int main(){
	int n;
	cin>>n;
	int k=0;
	for(int i=0;i<n-1;i++){
		cin>>a[i];
		M[a[i]]++;
	}
	map<ll,ll>::iterator it;
    for(int i=1;i<=n;i++){
    	if(M.count(i)!=-1){
    		cout<<M[i]<<endl;
		}else{
			cout<<"0\n";
		}
	}
	return 0;
}


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

using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll modinv(ll i, ll mod){
    return modpow(i, mod-2, mod);
}

ll comb(ll n, ll a, ll mod) {
    ll ans = 1, denom = 1;
    for (int i = 0; i < a; i++) {
        ans = ans * (n - i) % mod;
        denom = denom * (i+1) % mod;
    }
    ans = ans * modinv(denom, mod) % mod;
    return ans;
}

int main() {
    int n, a, b; cin >> n >> a >> b;
    ll ans = (modpow(2, n, MOD) - 1) % MOD;
    ans = (ans - comb(n, a, MOD)) % MOD;
    ans = (ans - comb(n, b, MOD)) % MOD;
    if (ans < 0) ans += MOD;

    cout << ans << endl;
}


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

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

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

int main(){
    int n;
    cin >> n;
    int k;
    cin >> k;
    int h;
    int ans = 0;
    for(int i = 0; i < n; i++){
        cin >> h;
        if(h >= k) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n, m, x = [int(x) for x in input().split()]
c = []
a = []
count = 0

for i in range(n):
    tmp = [int(x) for x in input().split()]
    c.append(tmp.pop(0))
    a.append(tmp)

min = sum(c)+1

for i in range(1<<n):
    cost = 0
    skill = [0]*m
    for j in range(n):
        s = []
        if(i>>j&1):
            cost += c[j]
            for k in range(m):
                skill[k] += a[j][k]
    for s in skill:
        if(s < x):
            break
    else:
        if(cost < min):
            min = cost

if(min == sum(c)+1):
    print('-1')
else:
    print(min)


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


int main(){
	string input;
	cin >> input;
	for(int i=0;i<input.size()-2;i++){
		if(input[i] == input[i+1] || input[i] == input[i+2] || input[i+1] == input[i+2]){
			cout << i+1 << " " << i+2+1 << endl;
			return 0;
		}
	}
	if(input[0] == input[1]){
		cout << "1 2" << endl;
	}else{
		cout << "-1 -1" << endl;
	}
	return 0;
}


Measured memory_bytes: 512
N = int(input())
A = list(map(int,input().split()))
cur = 0
cnt = 0
cum = A[0]
for i in range(1,N):
    if A[i]&cum==0:
        cum = cum^A[i]
    else:
        cnt += i-cur
        cum = cum^A[cur]
        cur += 1
        while cur<i:
            if cum&A[i]==0:break
            else:
                cnt += i-cur
                cum = cum^A[cur]
                cur += 1
        cum = cum^A[i]
cnt += ((N-cur)*(N-cur+1))//2
print(cnt)

Measured memory_bytes: 23560
#include <stdio.h>
#include <algorithm>
using namespace std;
int seg[262144];
void add(int id,int il,int ir,int l,int r,int val)
{
	if (l>=r)
		return;
	if (il>=l&&ir<=r)
		seg[id]+=val;
	else if ((l>=il&&l<ir)||(r>il&&r<=ir))
	{
		add(id<<1,il,(il+ir)>>1,l,r,val);
		add((id<<1)^1,(il+ir)>>1,ir,l,r,val);
	}
}
int query(int id)
{
	id+=131072;
	int ret=0;
	while (id>0)
	{
		ret+=seg[id];
		id>>=1;
	}
	return ret;
}
int n,m,a[100001];
long long ttl[100001];
int dist(int a,int b)
{
	return (b+m-a)%m;
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;++i)
		scanf("%d",a+i);
	for (int i=1;i<n;++i)
	{
		if (a[i+1]>a[i])
		{
			add(1,0,131072,a[i]+2,a[i+1]+1,1);
			ttl[a[i+1]%m+1]-=a[i+1]-a[i]-1;
		}
		else
		{
			add(1,0,131072,a[i]+2,m+1,1);
			ttl[1]+=m-a[i+1]-1;
			add(1,0,131072,1,a[i+1]+1,1);
			ttl[a[i+1]+1]-=m-a[i]+a[i+1]-1;
		}
	}
	long long mx=0,cur=0,idx;
	for (int i=1;i<=m;++i)
	{
		cur+=query(i)+ttl[i];
		if (cur>mx)
		{
			mx=cur;
			idx=i;
		}
	}
	long long ans=0;
	for (int i=1;i<n;++i)
		ans+=min(dist(a[i],a[i+1]),dist(idx,a[i+1])+1);
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 2176
/* 
我的思路：直接按样例一的方法构造，若$h \times w$完全被$N \times M$包含显然无解

emm，wa了一发之后发现有反例：1 4 1 3 

我的会输出[1 1 -3 1]

好吧，题解的操作确实骚，考虑我们为什么会wa。因为总和相加为正数这个条件没有被满足

现在我们要保证每个数都满足要求的基础上增大每个子矩阵对答案的贡献

直接让每个数扩大1000倍即可

对于1 4 1 3来说，[1000 1000 -2001 1000]显然合法。

*/
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10, INF = 1e9 + 10;
inline int read() {
	char c = getchar(); int x = 0, f = 1;
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * f;
}
int N, M, h, w;
int ans[501][501];
main() {
	N = read(); M = read(); h = read(); w = read();
	if(N % h == 0 && M % w == 0) {puts("No"); return 0;}

	int sum = 0;
	for(int i = 1; i <= N; i++)
		for(int j = 1; j <= M; j++) {
			if(i % h == 0 && j % w == 0) ans[i][j] =  - h * w * 1000 + 999;
			else ans[i][j] = 1000;			
			sum += ans[i][j];
		}
	if(sum <= 0) {puts("No"); return 0;}
	puts("Yes");
	for(int i = 1; i <= N; i++, puts(""))
		for(int j = 1; j <= M; j++)
			printf("%d ", ans[i][j]);
	return 0;
}
/*

*/


Measured memory_bytes: 2560
n, m = map(int,input().split())
a = list(map(int,input().split()))
c = 0
a.sort(reverse=True)
for i in range(m):
    if a[i] < ((1/(4*m))*sum(a)):
        c += 1

if c == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9088
//In the name of Allah
//In the name of the compassionate of the merciful
//Ya Ali!
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<typename Type>
using ordered_multiset = tree<Type, null_type, less_equal<Type>, rb_tree_tag, tree_order_statistics_node_update> ;

typedef long long ll ;
typedef long double ld ;

const ll maxn = 2000 * 101 ;
const ll INF = 3e18 ;

#define f first
#define s second
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define endll "\n"
#define sortt(v) sort(v.begin() , v.end())
#define reversee(v) reverse(v.begin() , v.end())

// for sqrt on interval and array , always sq = maxn/80 ;
// cout << *ss.find_by_order(index) ; -> return the value that indexed in index position
// cout << ss.order_of_key(value) ; -> lower_bound in ordered_set
//ifstream fin("input.txt");
//ofstream fout("output.txt");

ll mod = 1e9 + 7 , p1 = 999999929 , p2 = 999999937 ;

ll n , a[maxn] , v , p , m ;

bool f(ll x)
{
  ll va = a[x] , sum = 0 ;

  if(x <= p)return true ;

  bool ok = true ;
  for(int i = p ; i < x ; i ++){
    if(a[i] > va+m){
        ok = false ;
        break ;
    }
    sum += va+m-a[i] ;
  }

  if(!ok)return false ;

  if(sum < max(v-n+x-p , 0ll)*m)return false ;
  else return true ;
}

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

cin >> n >> m >> v >> p ;
for(int i = 1 ; i <= n ; i ++)cin >> a[i] ;

sort(a+1 , a+n+1) ;
reverse(a+1 , a+n+1) ;

ll l = 1 , r = n+1 ;
ll mid = (r+l)/2 ;

while(r-l>1){
  mid = (r+l)/2 ;
  if(f(mid))l = mid ;
  else r = mid ;
}

//cout << f(2) << endl ;

cout << l ;

 return 0;
}
/*
                  _     _   __
            /_\  (_    (_)  __)
           /   \  _) . (_) (__
*/


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr <<__LINE__<< ": " << #x << " -> " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" -> ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n;
    cin >> n;
    ll ans = 0;
    int maxi = 0;
    rep(i, n) {
        int a;
        cin >> a;
        if (a <= maxi) {
            ans += maxi - a;
        } else {
            maxi = a;
        }
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3656
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
struct edge { int to, cost; };
int V;
vector<edge> G[100000];
int d[100000];
int dy[9] = { 1,1,1,1,1,2,2,2,3 };
int dx[9] = { -2,-1,0,1,2,-1,0,1,0 };
void init(int v) {
	rep(i, v) {
		G[i].clear();
	}
}
void dijkstra(int s) {
	priority_queue<P, vector<P>, greater<P>>que;
	fill(d, d + V, (int)MOD);
	d[s] = 0;
	que.push(P(0, s));
	while (!que.empty()) {
		P p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.first)continue;
		for (int i = 0; i < (int)G[v].size(); i++) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}
int w, h;
bool onboard(P x) {
	if (x.first >= 0 && x.first < h&&x.second >= 0 && x.second < w)return true;
	return false;
}
int main() {
	while (cin >> w >> h, w) {
		V = w * h * 2; init(w*h * 2);
		char cliff[60][30];
		vector<int> sta; vector<int> las;
		rep(i, h) {
			rep(j, w) {
				cin >> cliff[i][j];
				if (cliff[i][j] == 'T')las.push_back(i*w + j);
				else if (cliff[i][j] == 'S')sta.push_back(i*w + j);
			}
		}
		rep(i, h) {
			rep(j, w) {
				rep(k, 9) {
					int nx = i + dx[k]; int ny1 = j + dy[k]; int ny2 = j - dy[k];
					int cost = 0;
					if (onboard({ nx,ny1 }) && cliff[nx][ny1] != 'X') {
						if ('1' <= cliff[nx][ny1] && cliff[nx][ny1] <= '9') {
							cost = cliff[nx][ny1] - '0';
						}
						G[i*w + j].push_back({ nx*w + ny1 + h * w,cost });
					}
					cost = 0;
					if (onboard({ nx,ny2 }) && cliff[nx][ny2] != 'X') {
						if ('1' <= cliff[nx][ny2] && cliff[nx][ny2] <= '9') {
							cost = cliff[nx][ny2] - '0';
						}
						G[i*w + j+w*h].push_back({ nx*w + ny2,cost });
					}
				}
			}
		}
		int mi = (int)MOD;
		rep(i, (int)sta.size()) {
			dijkstra(sta[i]);
			rep(j, (int)las.size()) {
				mi = min(mi, d[las[j]]);
				mi = min(mi, d[las[j] + h * w]);
			}
			dijkstra(sta[i] + h * w);
			rep(j, (int)las.size()) {
				mi = min(mi, d[las[j]]);
				mi = min(mi, d[las[j] + h * w]);
			}
		}
		if (mi == (int)MOD) {
			cout << -1 << endl;
		}
		else {
			cout << mi << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 5772
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define REP1(i,n) for(int i=1;i<=(int)(n);i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;

int main(){
  int a,b,c;
  int k;
  cin >> a >> b >> c >> k;
  int used=0;
  while(a>=b){
    b*=2;
    used++;
  }
  while(b>=c){
    c*=2;
    used++;
  }
  if(used<=k)cout << "Yes" << endl;
  else cout <<"No" << endl;
}


Measured memory_bytes: 3632
/*
 * 宇宙ヤシガニ（枝狩り問題）
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2012
 */
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#include<sstream>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define ALL(c) (c).begin(), (c).end()
#define dump(a) cerr << #a << "=" << (a) << endl
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; } //t=min
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } //t=max
using namespace std;

int main() {
	// x=1,000,000
	// y=1,000
	// z=100

	int E;
	while(cin >> E, E) {
		int min_m = E;
		for(int z=0; z*z*z<=E; z++) {
			for(int y=0; y*y<=E-z*z*z; y++) {
				int x = E - y*y - z*z*z;
				if (x + y + z < min_m) { min_m = x + y + z; }
			}
		}
		cout << min_m << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
int main(void)
{
    int S,K,a = 0;
    cin >> K >>S;
    rep(i,K+1)
    {
        rep(j,K+1)
        {
            int u = S-i-j;
            if(0<=u && u <=K) a++;
        }
    }
    cout << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
using namespace std;
using ll = long long;

int main()
{
  int N;
  ll A,S[200010];
  S[0] = 0l;

  cin >> N;
  rep(i,N){
    cin >> A;
    S[i+1] = S[i]+A;
  }

  ll MIN = 500000000000000;

  rep(i,N+1)
    MIN = min(MIN,abs(S[N]-2*S[i]));

  cout << MIN << "\n";
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
using namespace std;
int dp[3001][3001];
int main()
{
    char s[3001],s1[3001];
    cin>>s>>s1;
    int len=strlen(s),len1=strlen(s1);
    for(int i=1;i<=len;i++){
        for(int j=1;j<=len1;j++){
            if(s[i-1]==s1[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
            }
            else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    vector<char>s2;
    int i=len,j=len1;
    while(i>0 && j>0){
        if(dp[i][j]==dp[i-1][j])i--;
        else if(dp[i][j]==dp[i][j-1])j--;
        else{
            s2.push_back(s[i-1]);
            i--,j--;
        }
    }
    reverse(s2.begin(),s2.end());
    for(char c:s2)cout<<c;
}


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

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

string t = "RGB";

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<ll> r(n);
	vector<ll> g(n);
	vector<ll> b(n);
	vector<ll> rf(n, 0);
	vector<ll> gf(n, 0);
	vector<ll> bf(n, 0);
	rep(i, n) {
		if (s[i] == 'R') {
			r[i]++;
			rf[i] = 1;
		}
		if (s[i] == 'G') {
			g[i]++;
			gf[i]++;
		}
		if (s[i] == 'B') {
			b[i]++;
			bf[i]++;
		}
	}
	rep(i, n) {
		if (i > 0) {
			r[i] += r[i - 1];
			g[i] += g[i - 1];
			b[i] += b[i - 1];
		}
	}
	
	ll ans = 0;
	for (ll i = 0; i < n; ++i) {
		for (ll j = i + 1; j < n; ++j) {
			if (s[i] == s[j]) continue;
			ll id;
			ll sa = j - i;
			rep(temp, 3) if (t[temp] != s[i] && t[temp] != s[j]) id = temp;
			//jより大きいところにidが何個あるか
			if (id == 0) {
				ans += r[n - 1] - r[j];
				if (sa + j < n && rf[sa + j] == 1) ans--;
			}
			if (id == 1) {
				ans += g[n - 1] - g[j];
				if (sa + j < n && gf[sa + j] == 1) ans--;
			}
			if (id == 2) {
				ans += b[n - 1] - b[j];
				if (sa + j < n && bf[sa + j] == 1) ans--;
			}
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;



int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	int n;
	cin>>n;
	vector<int> a(n);
	int s=0;
	rep(i,0,n) {
		cin>>a[i];
		s+=a[i];
	}
	
	int res=s,ss=0;
	rep(i,0,n-1) {
		ss+=a[i];
		res=min(res,abs(2*ss-s));
	}
	cout<<res<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int a[3];
  rep(i,3) cin >> a[i];

  int five = 0;
  int seven = 0;
  rep(i,3){
    if (a[i] == 5) five ++;
    if (a[i] == 7) seven ++;
  }

  if (five == 2 && seven == 1){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


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

int main()
{
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s.at(0) == s.at(1) && s.at(1) != s.at(2) && s.at(2) == s.at(3))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
fun main(args :Array<String>) {
    val (x, y, z, k) = readLongList()
    val aList = readLongList().sortedDescending()
    val bList = readLongList().sortedDescending()
    val cList = readLongList().sortedDescending()

    val tmpList = arrayListOf<Long>()
    for (i in 0 until x) {
        for (j in 0 until y) {
            for (l in 0 until z) {
                if ((i + 1) * (j +1) * (l + 1) <= k) {
                    tmpList += aList[i.toInt()] + bList[j.toInt()] + cList[l.toInt()]
                } else {
                    break
                }
            }
        }
    }

    tmpList.sortDescending()
    for (ans in tmpList.subList(0, Math.min(k.toInt(), tmpList.size))) {
        println(ans)
    }
}

fun readInteger() = readLine()!!.toInt()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


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

using namespace std;

int main(void){
  int N;
  double ans;

  cin >> N;

  int count = 0;
  for(int i = 1; i <= N ; i++){
    if(i%2 == 1){
      count++;
    }
  }

  ans = (double)count / N;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

#define SQUARE_NUM  2019

using namespace std;

int main(void){
    int numPiece;
    cin >> numPiece;
    int piecePosition[numPiece];
    for(int i = 0; i < numPiece; i++){
        cin >> piecePosition[i];
    }
    int numAction;
    cin >> numAction;
    int whichPiece[numAction];
    for(int i = 0; i < numAction; i++){
        cin >> whichPiece[i];
    }
    
    //指定されたピースの位置が2019ならそれ以上進まない
    //指定されたピースの一つ前のマスにピースがあるなら進まない
    for(int i = 0; i < numAction; i++){
        if(whichPiece[i] < numPiece){
            if((piecePosition[whichPiece[i] - 1] + 1) == piecePosition[whichPiece[i]])    continue;
        }
        else if(piecePosition[whichPiece[i] - 1] == SQUARE_NUM)   continue;
        
        //進むための条件を達している場合
        piecePosition[whichPiece[i] - 1] += 1;
    }
    
    for(int i = 0; i < numPiece; i++){
        cout << piecePosition[i] << '\n';
    }
    
    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++)
    {
        if (a[i] != i)
        {
            swap(a[i], a[a[i]]);
            break;
        }
    }
    for (int i = 1; i <= n; i++)
    {
        if (a[i] != i)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it = (c).begin(); it != (c).end(); it++)
#define X first
#define Y second

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

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

    while(n--){
        string in; cin >> in;
        set<string> s;

        rep(i, in.size()){
            string f, b, r_f, r_b;

            r_f = f = in.substr(0, i);
            r_b = b = in.substr(i);

            reverse(ALL(r_f));
            reverse(ALL(r_b));

            s.insert(f + b);
            s.insert(f + r_b);
            s.insert(b + f);
            s.insert(b + r_f);
            s.insert(r_f + b);
            s.insert(r_f + r_b);
            s.insert(r_b + f);
            s.insert(r_b + r_f);
        }

        cout << s.size() << endl;
    }

    return 0;
}

Measured memory_bytes: 1292
import java.util.Scanner;
import java.util.Map;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long M = sc.nextLong();
	
		Map<Long, Long> shop = new TreeMap<>();
		for(int i = 0; i < N; i++) {
			long a = sc.nextLong();
			long b = sc.nextLong();
			shop.put(a, shop.getOrDefault(a, 0L) + b);
		}
		
		long sum = 0;
		long money = 0;
		
		for(Long price : shop.keySet()) {
			long amount = shop.get(price);
			sum += amount;
			money += price * amount;
			if(sum >= M) {
				money -= price * (sum - M); 
				System.out.println(money);
				break;
			}
		}
	}
}


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

using namespace std;

int main() {
    int n ; cin>>n;
    vector<int>v(n);
    for(int& i : v){
        cin>>i;
    }
    vector<int>dp(n , INT_MAX);
    dp[0] = 0;
    for(int i = 0 ; i < n ; ++i){
        for(int j : {i + 1 , i + 2}){
            if(j < n){
                dp[j] = min(dp[j] , dp[i] + abs(v[i] - v[j]));
            }
        }
    }
    cout<<dp[n - 1]<<endl;

}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
#include <deque>
using namespace std;
typedef long long int ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s,p; cin >> s >> p;
    s+=s;
    bool ok=0;
    for(int i=0;i<s.size();i++){
        if(s.substr(i,p.size())==p)ok=1;
    }
    if(ok){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    vector<ll> a(n+1), b(n+1), c(n);
    for(ll i=1;i<n+1;i++)
        cin>>a[i];
    for(ll i=1;i<=n;i++)
        cin>>b[i];
    for(ll i=1;i<n;i++)
        cin>>c[i];
    ll sum = 0;
    for(ll i=1;i<=n;i++)
    {
        if(i == 1)
            sum += b[a[i]];
        else
        {
            if(a[i] == a[i-1]+1)
                sum += (b[a[i]]+c[a[i-1]]);
            else
                sum += b[a[i]];
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
const int N=200;
const int W=1000000000;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x,y;
	cin >> x >> y;
	cout << 2*y - x << endl;


	return 0;
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

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, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int n, m;
  std::cin >> n >> m;
  int prob = (1 << m), x = (1900 * m) + (100 * (n - m));
  print(x * prob);
}


Measured memory_bytes: 256
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N,M=get_i
ab=array(M)
M.times do|i|
    ab[i]=get_i
    ab[i][0]-=1
    ab[i][1]-=1
end
ab.sort!{|x,y| x[1]<=>y[1]}
ans=0
prev=-1
M.times do|i|
  unless ab[i][0]<prev and prev<=ab[i][1]
      ans+=1
      prev=ab[i][1]
  end
end
puts ans

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

/*
  REMEMBER:
  1.Think TWICE, code ONCE!
  Are there any counterexamples to your algo?
	
  2.Be careful about the BOUNDARIES in your algo!
  N=1? P=1? Is P a prime? Something about 0?
	
  3.Never make STUPID MISTAKES!
  Integer overflow? Array size? Time complexity? Memory usage? Precition error?
*/

char str[200003];

int main(){
	scanf("%s" , str + 1); int cnt = 0 , pos = 1; long long ans = 0;
	while(str[pos])
		if(str[pos] == 'A'){++cnt; ++pos;}
		else if(str[pos] == 'B' && str[pos + 1] == 'C'){ans += cnt; pos += 2;}
		else{cnt = 0; ++pos;}
	cout << ans; return 0;
}


Measured memory_bytes: 384
import sys
s = int(input())

a = [s]

ans = 1
while(True):
  ans += 1
  if a[-1]%2 == 0:
    num = a[-1]//2
  else:
    num = a[-1]*3+1
  for i in range(len(a)):
    if a[i] ==num:
      print(ans)
      sys.exit()

  a.append(num)


Measured memory_bytes: 9028
import java.io.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {

    static class Task {

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < 3; i++) {
                set.add(in.nextInt());
            }

            out.println(set.size());
        }
    }

    private static void sort(double[] arr) {
        Double[] objArr = Arrays.stream(arr).boxed().toArray(Double[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(int[] arr) {
        Integer[] objArr = Arrays.stream(arr).boxed().toArray(Integer[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(long[] arr) {
        Long[] objArr = Arrays.stream(arr).boxed().toArray(Long[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task task = new Task();
        task.solve(1, in, out);
        out.close();
    }

    public static void main(String[] args) {
        new Thread(null, () -> solve(), "1", 1 << 26).start();
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

    }

}

Measured memory_bytes: 28372
#include <stdio.h>
int y,c,a,n;
int main()
{
    scanf("%d",&y);
    for(int i = 0; i < y; i++)
    {
        int mem1 = 10000,mem2 = 0,mem3 = 0,ans = 0;
        scanf("%d%d%d",&c,&a,&n);
        if(c < a)mem1 = c;
        else mem1 = a;
        if(mem1 > n)mem1 = n;
        ans += mem1;
        c -= mem1;
        a -= mem1;
        n -= mem1;
        if(c / 2 < a)mem2 = c / 2;
        else mem2 = a;
        ans += mem2;
        c -= mem2 * 2;
        a -= mem2;
        mem3 = c / 3;
        ans += mem3;
        printf("%d\n",ans);
    }
}

Measured memory_bytes: 1028
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <vector>
#include <algorithm>
#include <map>


int main(){
  char C;
  scanf("%c",&C);
  printf("%c\n", C+1);
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000


int main(){
	int N;
	cin>>N;
	long long K;
	cin>>K;
	int num = 50;
	vector<long long> beki(num,1);
	for(int i=1;i<num;i++){
		beki[i] = beki[i-1]*2;
	}
	
	vector<long long> cnt(num,N);
	
	for(int i=0;i<N;i++){
		long long a;
		cin>>a;
		for(int j=0;j<num;j++){
			if(a%2){
				cnt[j]--;
			}
			a/=2;
		}
	}
	
	vector<bool> B(num,false);
	for(int i=0;i<num;i++){
		if(K%2)B[i]=true;
		K/=2;
	}
	
	reverse(beki.begin(),beki.end());
	reverse(cnt.begin(),cnt.end());
	reverse(B.begin(),B.end());
	
	vector<vector<long long>> dp(num,vector<long long>(2,0));
	dp[0][1] = -1;
	for(int i=1;i<num;i++){
		if(B[i]){
			dp[i][0] = dp[i-1][0] + cnt[i] * beki[i];
			dp[i][1] = dp[i-1][0] + (N-cnt[i]) * beki[i];
			if(dp[i-1][1]!=-1)dp[i][1] = max(dp[i][1] , dp[i-1][1] + max(cnt[i],N-cnt[i])*beki[i]);
		}
		else{
			dp[i][0] = dp[i-1][0] + (N-cnt[i])*beki[i];
			if(dp[i-1][1]!=-1){
				dp[i][1] = dp[i-1][1] + max(cnt[i],N-cnt[i])*beki[i];
			}
			else{
				dp[i][1] = -1;
			}
		}
	}
	/*
	for(int i=0;i<num;i++){
		cout<<dp[i][0]<<"  "<<dp[i][1]<<endl;
	}
	*/
	cout<<max(dp[num-1][0],dp[num-1][1])<<endl;
	
	
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
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 P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB(x) push_back(x)
#define MP make_pair
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<'Y'<<'e'<<'s'<<endl
#define coutn cout<<'N'<<'o'<<endl
#define coutY cout<<'Y'<<'E'<<'S'<<endl
#define coutN cout<<'N'<<'O'<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;
//cout<<fixed<<setprecision(15);

signed main(){
    int a,b; cin >> a >> b;
    cout<<max(a-b*2,0LL)<<endl;
}

Measured memory_bytes: 256
# C - たくさんの数式
from itertools import product
S = input()
n = len(S)-1
total =0
for i in list(product(["","+"],repeat=n)):
    bag=""
    for ind,val in enumerate(S):
        if ind ==0:
            bag+=val
        else:
            bag+=i[ind-1]+val
    total +=eval(bag)        
print(total)

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main()
{
    long long n;
    cin>>n;
    long long arr[n+1];
    for(long long i=0;i<n;i++) cin>>arr[i];
    long long ans=1;
    long long mn=arr[0];
    for(long long i=1;i<n;i++){
        if(arr[i]<=arr[i-1]){
                if(mn>=arr[i]){
                    ans++;
                    mn=arr[i];
                }
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    int ret=0;
    vector<int> a;
    vector<int> b;
        for(size_t i = 1; i <= N; i++)
        {
            for(size_t j = i+1; j <= N; j++)
            {
                if (N%2 == 0){
                    if (i+j==N+1)
                        continue;
                }
                else{
                    if (i+j==N)
                        continue;
                }
                a.push_back(i);
                b.push_back(j);
                ret++;
            }  
        }
    cout << ret << endl;
    for(size_t i = 0; i < ret; i++)
    {
        cout << a[i] << " " << b[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 384
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n;
  cin >> n;
  ll num = 1;
  for(int i=1;i<=n;i++){
    num = num * i;
    num = num % 1000000007;
  }
  cout << num << endl;
}


Measured memory_bytes: 256
/*
  AUTHOR:SOURABH
  CREATED:29:11:19
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pll , null_type, less< pll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll n,x,i,k;
    cin>>n;
    x=(1.0*n)/1.08;
    for(i=x;;i++)
    {
        k=1.08*i;
        if(k==n)
        {cout<<i;return 0;}
        else if(k>n)
        {cout<<":(";return 0;}
    }
    return 0;
}















Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<random>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int acc = 0;
    int i = 1;
    for(; ; i++){
        acc += i;
        if(acc == n){
            cout << "Yes" << '\n';
            cout << i + 1 << '\n';
            break;
        }else if(acc > n){
            cout << "No" << '\n';
            return 0;
        }
    }
    vector<vector<int>> anss(i + 1, vector<int>(i));
    iota(anss[0].begin(), anss[0].end(), 1);
    int num = i + 1;
    for(int j = 1; j < i + 1; j++){
        for(int k = 0; k < j; k++){
            anss[j][k] = anss[k][j - 1];
        }
        for(int k = j; k < i; k++){
            anss[j][k] = num++;
        }
    }
    printde(anss);
    for(int j = 0; j < i + 1; j++){
        cout << i << ' ';
        for(int k = 0; k < i; k++){
            cout << anss[j][k] << ' ';
        }
        cout << '\n';
    }
}
// 1 2 3, 3 4 5, 5 6 7, 7 1 2, 2 3 4, 4 5 6, 6 7 1
// 1 2 3 4, 3 4 5 6, 5 6 7 8, 7 8 1 2
// 01 10, 10 11, 11 01
// 1, 1
// 1 2, 1 3, 2 3
// 1 2 3, 1 4 5, 2 4 6, 3 5 6
// 1 2 3 4, 1 5 6 7, 2 5 8 9, 3 6 8 10, 4 7 9 10


Measured memory_bytes: 2176
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string, copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7
ans = 0 ; count = 0; pro = 1

n=int(input())
A=list(map(int,input().split()))
for i in range(n):A[i]-=i+1
A.sort()
B=A[n//2]
for ai in A:
    ans+=abs(ai-B)
print(ans)

Measured memory_bytes: 81264
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <numeric>
#include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define ALL(x)   (x).begin(),(x).end()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define mp       make_pair
#define eb       emplace_back


const int MAX_V = 100000;
struct edge { int to, cost; };
int V;
vector<edge> G[MAX_V];
int d[MAX_V];
void bfs01(int s) {
	deque<pair<int, int>> que;
	fill(d, d + V, INF);
	d[s] = 0;
	que.push_back(mp(0, s));
	while (!que.empty()) {
		pair<int, int> p = que.front(); que.pop_front();
		int v = p.second;
		if (d[v] < p.first)continue;
		for (int i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				if (e.cost == 0)que.push_front(mp(d[e.to], e.to));
				else que.push_back(mp(d[e.to], e.to));
			}
		}
	}
}
int main() {
	cin >> V;
	for (int i = 0; i < V; i++) {
		edge t;
		t.to = (i + 1) % V;
		t.cost = 1;
		G[i].eb(t);
	}
	for (int i = 0; i < V; i++) {
		edge t;
		t.to = (i * 10) % V;
		t.cost = 0;
		G[i].eb(t);
	}
	bfs01(1);
	cout << d[0] + 1 << endl;
}

Measured memory_bytes: 6528