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

using namespace std;

typedef long long ll;

#define FOR(a, b, i) for(int i=a; i<b; i++)
#define RFOR(a, b, i) for(int i=a; i>=b; i--)
#define PB push_back
#define MP make_pair
#define MOD 1e9+7
#define newline cout<<"\n"


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

    int a, b; cin>>a>>b;
    if(a<=8 && b<=8)
    {
        cout<<"Yay!\n";
    }
    else
    {
        cout<<":(\n";
    }
    




    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main() {
    int n;
    scanf("%d", &n);

    unsigned long long a;
    unsigned long long allXor[n+1], sum[n+1];
    allXor[0] = sum[0] = 0;

    for (int i = 1; i < n + 1; i++) {
        scanf("%llu", &a);
        allXor[i] = allXor[i-1] ^ a;
        sum[i] = sum[i-1] + a;
    }

    unsigned long long result = 0;
    int minLeft = 1;
    for (int r = 1; r < n + 1; r++) {
        for (int l = minLeft; l <= r; l++) {
            if ((allXor[r] ^ allXor[l-1]) == (sum[r] - sum[l-1])){
                result += r - l + 1;
                break;
            } else {
                minLeft++;
            }
        }
    }
    printf("%llu\n", result);

    return 0;
}

Measured memory_bytes: 3328
#include <cstdio>
#include <iostream>
using namespace std;
char s[100];
int main() {
  scanf("%s", s);
  if (s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I') puts("Yes");
  else puts("No");
  return 0;
}


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

using namespace std;

int main()
{
	int n = 3;

	vector<int> arr(n);
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
	}

	sort(arr.begin(), arr.end(), greater<int>());

	int cost = 0;
	for (int i = 1; i < n; i++)
	{
		cost += arr[i - 1] - arr[i];
	}

	cout << cost << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    int a,b,c,d,e,f,i,j,k,l;
    cin >> a >> b >> c >> d >> e >> f;
    a *= 100; b *= 100;
    int w = 100, s = 0;

    for(int i = 0; a*i <= f; i++)
    for(int j = 0; a*i + b*j <= f; i++)
    for(int k = 0; a*i + b*j + c*k <= f; k++)
    for(int l = 0; a*i + b*j + c*k + d*l <= f; l++){
        int water = a*i + b*j; 
        int suger = c*k + d*l;
        if((j||i) && (100*suger <= e*water) && (s*water <= w*suger)){
            w = water;
            s = suger;
        }
    }
    cout << w + s << " " << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

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

map<int, bool> check;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (b / a > c) cout << c << endl;
    else cout << b / a << endl;

    return 0;
}

Measured memory_bytes: 384
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


S = input()
T = input()
print('Yes' if T[:-1] == S else 'No')

Measured memory_bytes: 61880
# print('input >>')
N, K = map(int,(input().split()))
As = list(map(int,(input().split())))

for i in range(K, N):
    # next_prod = prod // As[i-K] * As[i]
    if As[i-K] < As[i]:
        print('Yes')
    else:
        print('No')
    # next_prod = prod

# print('-----output-----')

Measured memory_bytes: 31536
input_list = map(int, raw_input().split())
ineq = ""
if input_list[0] < input_list[1]:
    ineq = "<"
elif input_list[0] > input_list[1]:
    ineq = ">"
else:
    ineq = "=="
print "a %s b" % (ineq)

Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false;}

ll N,W;
vector<ll>w,v;
vector<vector<ll>> dp;

/*void solve(ll i,ll j){
    if(dp[i][j]!=-1){
        continue;
    }
    ll res = 0;
    if(i==N){
        res = 0;
    }else if(dp[i][j]+w[i]>W){
        res = solve(i+1,j);
    }else{
        res = min(solve(i+1,j),solve(i+1,j+v[i])+w[i]);
    }
}*/

int main(void){
    cin>>N>>W;
    w.resize(N);
    v.resize(N);
    for(ll i=0;i<N;i++){
        cin>>w[i]>>v[i];
    }
    dp=vector<vector<ll>>(N+10,vector<ll>(100010));
    for(int i=0;i<N+10;i++){
        for(int j=0;j<100010;j++){
            dp[i][j]=1LL<<60;
            //cout<<dp[i][j]<<endl;
        }
    }
    dp[0][0]=0;
    for(ll i=0;i<N;i++){
        for(ll j=0;j<100010;j++){
            if(j-v[i]>=0){
                chmin(dp[i+1][j],dp[i][j-v[i]]+w[i]);
            }
        chmin(dp[i+1][j],dp[i][j]);
        }
    }
    ll ans = 0;
    for(ll j=0;j<100010;j++){
        if(dp[N][j]<=W)ans=j;
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 87296
n=int(input())
a=list(map(int,input().split(' ')))
x=0
y=0
a.sort()
a.reverse()
for i in range(len(a)-1):
    if a[i]==a[i+1]:
        x=a[i]
        p=i+1
        break
if x!=0:
    for i in range((p+1),len(a)-1):
        if a[i]==a[i+1]:
            y=a[i]
            break
print(x*y)

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

long long mx=100*1000+7;
 
int main()
{
	ios::sync_with_stdio(false);
	long long dp[mx];
	int a[mx];
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)	cin>>a[i];
	for(int i=2;i<=n;i++)
	{
		dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
		if(i>2)
		{
			dp[i]=min(dp[i],dp[i-2]+abs(a[i]-a[i-2]));
		}
	}
	cout<<dp[n];
	return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<utility>
#include<algorithm>
using namespace std;

pair<int,int> items[100];
int v,w,N,max_w;
int value[101][10100];

int main(){
    cin>>N>>max_w;
    for(int i=0;i<N;++i){
        cin>>v>>w;
        items[i].first=v;
        items[i].second=w;
    }

    for(int i=1;i<=N;++i){
        for(int j=0;j<=max_w;++j){
            if(j>=items[i-1].second){
                value[i][j]=max(value[i-1][j],
                            value[i-1][j-items[i-1].second]+items[i-1].first);
            }
            else{
                value[i][j]=value[i-1][j];
            }
        }
    }
    cout<<value[N][max_w]<<endl;
}


Measured memory_bytes: 7064
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<set>
#include<queue>
#include<cmath>

using namespace std;
#define LL long long

int r;

int main() {
	cin>>r;
	
	if(r<1200)cout<<"ABC";
	else if(r<2800)cout<<"ARC";
	else cout<<"AGC";
	cout<<endl;

	return 0;
}



Measured memory_bytes: 256
n, k = [int(i) for i in input().split()]
p = [(int(i) + 1) * 0.5 for i in input().split()]
m = sum(p[:k])
s = m
for i in range(k, n):
    s = s + p[i] - p[i-k]
    m = max(m, s)
print('{:.7f}'.format(m))


Measured memory_bytes: 23588
import java.util.*;

public class Main{
    static String S, T;
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        S = sc.next();
        T = sc.next();
        char[] c = new char[S.length()];
        for(int i = 0; i < c.length; i++)
            c[i] = S.charAt(i);
        sc.close();

        for(int i = S.length()-1; i >= T.length()-1; i--){
            if(check(i)){
                for(int j = T.length()-1; j >= 0; j--){
                    c[i-j] = T.charAt(T.length()-1-j);
                }
                for(int j = 0; j < c.length; j++){
                    if(c[j] == '?')
                        System.out.print('a');
                    else
                        System.out.print(c[j]);
                }
                return;
            }
        }
        System.out.println("UNRESTORABLE");
    }

    static boolean check(int n){
        int index = T.length()-1;
        for(int i = n; i >= n-T.length()+1; i--){
            if(S.charAt(i) == T.charAt(index) || S.charAt(i) == '?'){
            } else {
                return false;
            }
            index--;
        }
        return true;
    }
}

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

res = {"AC": 0 ,"WA": 0, "TLE": 0, "RE": 0}
keys = ["AC", "WA", "TLE", "RE"]

for _ in range(N):
  res[input()] += 1

for key in keys:
  print(key, "x", int(res[key]))

Measured memory_bytes: 9188
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u * v / gcd(u, v);
}

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

    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    A *= 100; B *= 100;
    double N = -1;
    int M = -1;
    int s = -1;
    for (int a = 0; a <= F; a += A) {
        for (int b = 0; b <= F; b += B) {
            int water = a + b;
            if (water == 0)continue;
            for (int c = 0; c <= F - water; c += C) {
                for (int d = 0; d <= F - water; d += D) {
                    int sugar = c + d;
                    if (water + sugar > F)continue;
                    double e = sugar * 1.0 / (water * 1.0 / 100);
                    if (e > E)continue;
                    double n = 100.0 * sugar / (water + sugar);
                    if (n > E)continue;
                    if (n > N) {
                        N = n;
                        M = water + sugar;
                        s = sugar;
                    }
                }
            }
        }
    }

    cout << M << " " << s << endl;
    return 0;
}

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

n, m = map(int, input().split())
drink = []
for _ in range(n):
    drink.append([int(s) for s in input().split()])
    
drink.sort()

bottle = 0
pay = 0

for i in range(n):
    bottle += drink[i][1]
    pay += drink[i][0]*drink[i][1]
    if bottle > m:
        bottle -= drink[i][1]
        pay -= drink[i][0]*drink[i][1]
        idx = i
        break
    
if bottle != m:
    pay += (m-bottle)*drink[idx][0]

print(pay)
    

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

using namespace std;

int n;
vector <int> a;
vector<long long> p;

long long cost(int l, int r){
	if(l<0) return p[r];
			return p[r] - p[l];	
}

int main(){
	cin >> n;
	a.resize(n);
	p.resize(n);
	vector<vector<long long> > dp(n,vector<long long>(n,0));
	for(int i = 0; i < n; i++) 
	{
		cin >> a[i];
		if(i==0) p[i] = a[i];
		else     p[i] = p[i-1] + a[i];
	}	
	for(int i = 1; i < n; i++){
		for(int j = 0; j < n-i; j++){
			int a = j;
			int b = j+i;
			long long cst = cost(a-1,b);
			//cout << cst << "\n";
			//cout << a << " " << b << "\n";
			dp[a][b] = 1e18;
			for(int k = 0; k < b-a; k++){
				dp[a][b] = min(dp[a][b],dp[a][a+k] + dp[a+k+1][b] + cst);
			}
		}
	}
	cout << dp[0][n-1] << "\n";
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9+7);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")
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 dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,1,-1};

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b){
    ll ans = 1;
    a %= mod;
    while(b) {
        if(b & 1LL) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}

//modの値の確認をすること
int main(){
    ll n,m;
    cin >> n >> m;
    vector<ll> c(n,0);
    rep0(i, m){
        ll a,b;
        cin >> a >> b;
        --a;--b;
        ++c[a];++c[b];
    }
    bool f = true;
    rep0(i, n)if(c[i] % 2 == 1)f = false;
    pf(f? "YES":"NO");
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

void print_ans(bool flag){
    if(flag){
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }   
}

int main(){
    int a, b;
    cin >> a >> b;
    bool ans = (a % 3 == 0) || (b % 3 == 0) || ((a+b) % 3 == 0);
    print_ans(ans);
    return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

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

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

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

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

const int maxn = 5010;

ll dp[maxn][maxn];
ll pref[maxn][maxn];

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

	dp[1][0] = 1;

	for (int i = 2; i <= N; ++i) {
		int k = min(i-1, N-i+2);
		for (int s = 0; s <= N; ++s) {
			pref[i-1][s] = dp[i-1][s];
			if (s - k >= 0) {
				(pref[i-1][s] += pref[i-1][s-k]) %= M;
			}
			dp[i][s] = pref[i-1][s];
		}
	}

	ll ans = 0;
	for (int s = 0; s <= N; ++s) {
		ans += dp[N][s] * (N-s);
		ans %= M;
	}
	cout << ans << endl;

	return 0;
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amin(T& a,T b){ a=min(a,b);}
template <class T> void amax(T& a,T b){ a=max(a,b);}


int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, a,b,res=0;
	
	cin >> n >>a >>b;
	
	int mn = max(0, a + b-n);
	
	cout << min(a,b)<<" "<< mn << endl; 
	return 0;
}


Measured memory_bytes: 256
function main(input) {
  var N = input[0]-0;
  var a = input[1].split(" ").map(v=>v-0);
  var map = [];
  for(var i=0;i<N;i++){
    map.push({a:i+1, b:a[i]});
  }
  map.sort((a,b)=>a.b-b.b);
  console.log(map.map(v=>v.a).join(" "));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


Measured memory_bytes: 35244
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector> 
using namespace std;
const int M = 1e5 + 50;
int a[M] = {0};
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i = 0; i < n; i++){
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	vector<pair<int,int>> v;
	for(int i = 0; i < m; i++){
		int f,s;
		scanf("%d%d",&s,&f);
		v.push_back({f,s});
	}
	sort(v.begin(),v.end());
	int vs = v.size();
	vs--;
	for(int i = 0;i<n;i++){
		if(a[i]<v[vs].first){
			a[i] = v[vs].first;
			v[vs].second--;
		}
		if(v[vs].second == 0)vs--;
		if(vs<0)break;
	}
	long long sum = 0;
	for(int i = 0; i < n;i++){
		sum+=a[i];
	}
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 1784
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  cin >> s;
  for(int i=0;i<3;i++){
    if(s[i]==s[i+1]){
      cout << "Bad\n";
      return 0;
    }
  }
  cout <<"Good\n";
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(void) {
	int r;

	cin >> r;

	if (r < 1200) {
		cout << "ABC" << endl;
	}
	else if (r < 2800) {
		cout << "ARC" << endl;
	}
	else {
		cout << "AGC" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main (void) {
  int r[200000], n, min, p = -999999999, i;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &r[i]);
  }

  for (i = 0; i < n; i++) {
    if (i > 0) {
      if (r[i] - min > p) {
        p = r[i] - min;
      }
      if (r[i] < min) {
        min = r[i];
      }
    } else {
    min = r[i];
    }
  }
  
  printf("%d\n", p);
  
  return 0;
}

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

using namespace std;

long long n, dp[305][305], h[305], ans;
const long long INF = 1e18;
int k;

long long parabs(long long a, long long b) {
	if (a > b) return (a - b);
	else return 0;
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> k;
	for (int i=1; i<305; i++) {
		for (int j=0; j<305; j++) dp[i][j] = INF;
	}
	h[0] = 0; h[n + 1] = 0;
	for (int i=1; i<=n + 1;i++) {
		if (i != n + 1) cin >> h[i];
		for (int j=0; j<=min(k, i - 1); j++) {
			for (int ii = j; ii <= k; ii++) {
				dp[i][ii - j] = min(dp[i][ii - j], dp[i - 1 - j][ii] + parabs(h[i], h[i - j - 1]));
			}
		}
	}
	ans = INF;
	for (int i=0; i<=k; i++) ans = min(ans, dp[n + 1][i]);
//	for (int i=0; i<=9; i++) {
//		for (int j=0; j<=3; j++) {
//			cout << "The value for dp[" << i << "][" << j << "] is " << dp[i][j] << endl;
//		}
//	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io, flush := NewIO()
	defer flush()

	n := io.ScanInt()
	nums := io.ScanInts(n-1)
	membersMap := map[int]int{}
	for _, n := range nums {
		membersMap[n] = membersMap[n] + 1
	}
	for i := 1; i <= n; i++ {
		io.Println(membersMap[i])
	}
}

type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func NewIO() (*IO, func()) {
	io := &IO{
		scanner: newScanner(),
		writer:  newWriter(),
	}
	return io, func() { io.writer.Flush() }
}

func newScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer(make([]byte, 10000000), 10000000)
	s.Split(bufio.ScanWords)
	return s
}

func newWriter() *bufio.Writer {
	return bufio.NewWriter(os.Stdout)
}

func (io *IO) ScanBytes() []byte {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Bytes()
}

func (io *IO) ScanString() string {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Text()
}

func (io *IO) ScanStrings(n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		strs[i] = io.ScanString()
	}
	return strs
}

func (io *IO) Scan2DStrings(y, x int) [][]string {
	strings := make([][]string, y)
	for i := 0; i < y; i++ {
		strings[i] = io.ScanStrings(x)
	}
	return strings
}

func (io *IO) Scan2DGraph(y int) [][]string {
	strs := make([][]string, y)
	for i := 0; i < y; i++ {
		strs[i] = strings.Split(io.ScanString(), "")
	}
	return strs
}

func (io *IO) ScanInt() int {
	return int(io.ScanInt64())
}

func (io *IO) ScanInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = io.ScanInt()
	}
	return ints
}

func (io *IO) Scan2DInts(y, x int) [][]int {
	ints := make([][]int, y)
	for i := 0; i < y; i++ {
		ints[i] = io.ScanInts(x)
	}
	return ints
}

func (io *IO) ScanInt64() int64 {
	i, err := strconv.ParseInt(io.ScanString(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *IO) ScanFloat64() float64 {
	i, _ := strconv.ParseFloat(io.ScanString(), 64)
	return i
}

func (io *IO) ScanFloat64s(n int) []float64 {
	floats := make([]float64, n)
	for i := 0; i < n; i++ {
		floats[i] = io.ScanFloat64()
	}
	return floats
}

func (io *IO) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int ab=a+b;
  int cd=c+d;
  if(ab>cd){
    cout << "Left";
  }else if(ab<cd){
    cout << "Right";
  }else if(ab==cd){
    cout << "Balanced";
  }
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = vector<T>;
using vvi = vector<vector<int>>;

void svtr(vector<int> &a){
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
}

int main() {
  int n,a,b;
  cin >> n >> a >> b;
  cout << min(n*a,b);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <cstdlib> 
#include <string.h>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <ctime>
#include <algorithm>
#include <cmath>
#define PI 3.1415926535897932384626433832795l
#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define deci(n) cout<<fixed<<setprecision(n);
#define F first
#define S second
#define mk make_pair
#define pb push_back
#define ALPHA 27
#define ll long long int
#define ld long double
#define mmset(arr, n) memset(arr, n, sizeof arr)
#define debug(x) cerr << '#' << ' ' << x << '\n'
#define len(s) s.length()
#define ForA(i,a,b) for(int i = a; i < b; i++)
#define ForA1(i,a,b) for(int i = b - 1; i >= a; i--)
#define ForB1(i,a,b) for(int i = b; i > a; i--)
#define ForB(i,a,b) for(int i = a; i <= b; i++)
#define INT_SIZE 18 
#define maxn 100010
#define Maxn 100010

using namespace std;

const ll INF = (ll)(8e18);
const ll MOD = 1000000007;

int dp[maxn];
vector <int> G[maxn];
bool vis[maxn] = {false};

int dfs(int v){
    if(dp[v] > 0) return dp[v];
    vis[v] = true;
    for(int i = 0; i < (int)G[v].size(); i++){
        dp[v] = max(1 + dfs(G[v][i]), dp[v]);
    }
    return dp[v];
}

int main()
{
    IOS;       
    int n,m; cin >> n >> m;
    ForB(i,1,m){
        int u,v; cin >> u >> v;
        G[u].pb(v);
    }
    ForB(i,1,n){
        if(vis[i] == false){
            dp[i] = dfs(i);
        }
    }
    int ans = 0;
    ForB(i,1,n) ans = max(ans, dp[i]);
    cout << ans << '\n';
    #ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0 ;
}


Measured memory_bytes: 8320
o=input()
e=input()
ans=[]

for i in range(len(o)):
  ans.append(o[i])
  if i==(len(o)-1):
    if len(o)==len(e):
      ans.append(e[i])
  else:
    ans.append(e[i])

ans="".join(ans)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <math.h>
#include <stdbool.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <chrono>
using namespace std;

int main(){
    #if 0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
    #endif

    int N, K, Q;
    cin >> N >> K >> Q;

    vector<int> A(N);

    for(int q=0; q<Q; ++q){
        int i = 0;
        cin >> i;
        A[i-1] += 1;
    }

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

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
signed main()
{
    int n;
    scanf("%d",&n);
    vector<ll> c(n,0);
    vector<ll> d(n+1,0);
    for(int i=0;i<n;i++)
    {
        int a;scanf("%d",&a);--a;
        c[a]++;
        d[c[a]]++;
    }    
    vector<ll> s(n+1,0),s2(n+1,0);
    for(int i=1;i<=n;i++)s[i]=s[i-1]+d[i],s2[i]=s[i]/i;

    ll itr=n;
    for(ll k=1;k<=n;k++)
    {
        while(itr>0&&k>s2[itr])--itr;
        printf("%lld\n",itr);
    }
    return 0;
}

Measured memory_bytes: 10240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define re register
#define ls (o<<1)
#define m (l+r)/2
#define rs (o<<1|1)
#define pb push_back
const double PI= acos(-1.0);
const int M = 1e6+7;
/*
int head[M],cnt=1;
void init(int n){cnt=1;for(int i=0;i<=n;i++)head[i]=0;}
struct EDGE{int to,nxt,w;}ee[M*2];
void add(int x,int y,int w){ee[++cnt].nxt=head[x],ee[cnt].w=w,ee[cnt].to=y,head[x]=cnt;}
*/
const int mod=998244353;
struct node{
	ll val,len;
};
ll s[M],qp[M];
ll sm[M<<2];//区间数字组成的数的值。
ll tg[M<<2]; 
void bd(int o,int l,int r){
	if(l==r){
		sm[o]=1;
		return ;
	}
	bd(ls,l,m);
	bd(rs,m+1,r);
	sm[o]=(sm[ls]*qp[r-m]%mod+sm[rs])%mod;
}
void pd(int o,int l,int r){
	if(tg[o]==0)return ;
	sm[ls]=s[m-l+1]*tg[o]%mod;
	sm[rs]=s[r-m]*tg[o]%mod;
	tg[ls]=tg[rs]=tg[o];
	tg[o]=0;
}
void up(int o,int l,int r,int x,int y,ll d)// 区间覆盖
{
	if(x<=l&&r<=y){
		sm[o]=s[r-l+1]*d%mod;
		tg[o]=d;
		return ;
	}
	pd(o,l,r);
	if(x<=m)up(ls,l,m,x,y,d);
	if(y>m)up(rs,m+1,r,x,y,d);
	
	sm[o]=(sm[ls]*qp[r-m]%mod+sm[rs])%mod;
	//cout<<" = = "<<l<<"  "<<r<<" "<<sm[ls]<<" "<<sm[rs]<<"  "<<sm[o]<<endl;
} 
node qu(int o,int l,int r,int x,int y){
	if(x<=l&&r<=y){
		return node{sm[o],r-l+1};
	}
	pd(o,l,r);
	node a=node{0,0},b=node{0,0};
	if(x<=m)a=qu(ls,l,m,x,y);
	if(y>m)b=qu(rs,m+1,r,x,y);
//	cout<<l<<"   "<<r<<"   =  "<<a.val<<" "<<a.len<<"  b: "<<b.val<<" " <<b.len<<endl;
	return node{a.val*qp[b.len]%mod+b.val,a.len+b.len};
}
int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	int n,q;
  	cin>>n>>q;
  	s[1]=qp[0]=1;qp[1]=10;
  	for(int i=2;i<=n;i++)s[i]=(s[i-1]+qp[i-1])%mod,qp[i]=qp[i-1]*10%mod;
  	bd(1,1,n);
  	while(q--){
  		int l,r,opt;ll d;
  		cin>>l>>r>>d;
  			up(1,1,n,l,r,d);
  		cout<<qu(1,1,n,1,n).val<<endl;
	}
	return 0;
}

Measured memory_bytes: 14976
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
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;
}
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << "\n"; }
 
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

void solve(){
  ll h,n;
  cin>>h>>n;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  ll sum=0;
  rep(i,n)sum+=a[i];
  if(sum>=h)cout<<"Yes\n";
  else cout<<"No\n";
}

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


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

void output(int n,int *p)
{
    for(int i=0;i<n-1;i++)    cout<<*(p+i)<<" ";
    cout<<*(p+n-1)<<endl;
}

void insertSort(int n,int *p)
{
    int temp,i,j;
    if(n==1)
        output(n,p);
    else
    {
        for( i=0;i<n;i++)
        {
            temp=*(p+i);
            for(j=0;j<i;j++)
            {
                if(*(p+j)>temp)
                {
                    for(int k=i-1;k>=j;k--)   *(p+k+1)=*(p+k);
                    *(p+j)=temp;
                    break; 
                }
            }
            output(n,p);
        } 
    }

}

int main(int argc, char const *argv[])
{
    int N,*p;
    cin>>N;
    p=new int[N];
    for (int i=0;i<N;i++)   cin>>*(p+i);//input array
    insertSort(N,p);
    return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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 ll  LINF = 1LL << 60;
const int iINF = 1 << 29;

int main(void){
  int  a,b,c;
  cin >> a >> b >> c;
  cout << ((b - a) == (c - b) ? "YES" : "NO") << endl;
  return 0;
} 

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

struct Edge {
  int to, id;
};

vector<vector<Edge>> g;
vector<int> ans;

void dfs(int v, int p = -1, int c = -1) {
  int k = 1;
  rep(i, g[v].size()) {
    int u = g[v][i].to;
    int id = g[v][i].id;
    if (u == p)
      continue;
    if (k == c)
      k++;
    ans[id] = k;
    k++;

    dfs(u, v, ans[id]);
  }
}

int main() {
  int n;
  cin >> n;
  ans = vector<int>(n - 1);
  g.resize(n);

  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back((Edge{b, i}));
    g[b].push_back((Edge{a, i}));
  }

  dfs(0);
  int mx = 0;
  rep(i, n) { mx = max(mx, int(g[i].size())); }

  cout << mx << endl;
  rep(i, n - 1) { cout << ans[i] << endl; }
  return 0;
}

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

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)

int main(){
  while(1){
    int h; cin >> h; if(h == 0) break;
    
    vector<deque<int>> stone(5, deque<int>(h));
    rep(j, h) rep(i, 5) cin >> stone[i][j]; // j = 0が天井, h-1が底
    
    int ans = 0;
    while(1){
      int tmp = ans;
      rep(j, h){ // 上から見る
	int l = 0, r = 1; // [l, r) : 同じ数字が並ぶ区間
	rep(i,4){
	  if(stone[i][j] == stone[i+1][j]){
	    r++;
	  }else{
	    if(r - l >= 3) break;
	    l = i + 1;
	    r = i + 2;
	  }
	}
	
	if(stone[l][j] != -1 and r - l >= 3){
	  FOR(i, l, r){
	    ans += stone[i][j];
	    stone[i].erase(stone[i].begin() + j); // 消して
	    stone[i].push_front(-1); // 上に詰める
	  }
	}
      }
      if(tmp == ans) break;
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long A , B , K;
    cin >> A >> B >> K;

    if(A >= K){
        cout << A - K <<" "<< B << endl;
    }

    if(A < K && B >= (K - A)){
        cout << 0 <<" "<< A + B - K << endl;
    }

    if(A < K && B < (K - A)){
        cout << 0 <<" "<< 0 << endl;
    }
}

Measured memory_bytes: 256
//設定言語check
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;

int main(){
  int N,  check = 0, Allxor = 0 ;
  cin >> N ;
  int A[N] ;
  for(int i=0;i<N;i++){
    cin >> A[i] ;
    Allxor = Allxor ^ A[i] ;
  }
  for(int i=0;i<N;i++){
    cout << (Allxor ^ A[i]) << " " ;
  }
  cout << endl ;
  return 0 ;
}  

Measured memory_bytes: 4308
//PLUS ULTRA

#include<bits/stdc++.h>
using namespace std;
     
     
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
/*
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define pld(x) printf("%lld\n",x)
#define pd(x) printf("%d\n",x)
*/
#define moder 1000000007
#define forn(i,st,n) for(int i = st; i < n ; i++)
#define nfor(i,st,n) for(int i = st; i >= n ; i--)
#define pb push_back 
#define mp make_pair


ll moding( ll x , ll y ){
    ll ans = x % y;
    if(ans < 0)ans = ans + y ;
    return ans ;
}


bool isprime(ll n){
    if(n==2) return true;
    if(n==3) return true;
    if(n%2 == 0) return false;
    if(n%3 == 0) return false;

    ll i = 5,w=2;

    while(i*i <= n){
        if(n%i == 0)return false;
        i += w;
        w = 6 - w;
    }
    return true;
}

ll cmp(string s1 , string s2){
    // 1 for diff , 0 for same 
    int n = s1.size();
    int m = s2.size();
    if(n!=m)return 1;
    for(int i = 0 ; i < n ; i++)
        if(s1[i] != s2[i])return 1;
    return 0; // SAME
}

ll hcf(ll n1, ll n2) {
    if (n2 != 0)
        return hcf(n2, n1 % n2);
    else
        return n1;
}


int main(){

    SPEED;

    int n , inp; cin >> n;
    bool flag = true;

    forn(i,0,n){
        cin >> inp;

        if(inp % 2 == 0){
            if(inp % 5 == 0 || inp % 3 == 0){
                continue;
            }else{
                flag = false;
            
                break;
            }
        }

    }

    if(flag)  cout << "APPROVED";
    else cout <<  "DENIED";


    cout << endl;
     
     
        
    return 0;
}
      
       

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int dp[101][101];
int r[100],c[100];
int solv(int a,int b){//a??????b-1?????§?????????????????????????????????????????°???????°???¨?????????????????????????????????
    if(dp[a][b]==-1){
        if(a == b-1){
            dp[a][b]=0;
        }else if(a==b-2){
            dp[a][b]=r[a]*c[a]*c[a+1];
        }else{
            int Pmin=999999999;
            for(int j=a+1;j<b;j++){
                int tmp=solv(a,j)+solv(j,b)+r[a]*r[j]*c[b-1];
                Pmin=min(Pmin,tmp);
            }
            dp[a][b]=Pmin;
        }
    }
    return dp[a][b];
}
int main(){
    for(int i=0;i<101;i++){
        for(int j=0;j<101;j++){
            dp[i][j]=-1;
        }
    }
    int N;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>r[i]>>c[i];
    }
    int ans=solv(0,N);
    cout<<ans<<endl;
    return 0;
}

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

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e9;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second


int main(){
    //freopen("input00.txt","r",stdin);
    ll T = 1;
    //cin>>T;
    while(T--){
        string s;
        ll  n ,p;
        cin>>n>>p;
        cin>>s;

        if(p==2){
            ll ANS=0;
            for(ll i=0;i<s.size();i++){
                if((s[i]-'0')%2==0 )
                    ANS += i+1;
            }
            cout << ANS;
            continue;
        }

        if(p==5){
            ll ANS=0;
            for(ll i=0;i<s.size();i++){
                if((s[i]-'0')%5==0){
                    ANS += i+1;
                }
            }
            cout << ANS ;
            continue;
        }
        ll ANS=0;
        ll N = 0;
        map<ll,ll> MAP;
        MAP[0]++;
        ll mf=1;
        for(ll i=n-1;i>=0;i--){    
            N = (N + (s[i] - '0')*mf )%p;
            ANS += MAP[N];
            MAP[N]++;
            mf  = (mf*10)%p;
        }
        cout << ANS;
    }

    return 0;
}

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

int main() {
  
  string s;
  cin >> s;
  
  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 3580
import java.util.Scanner;

/**
 * Table Tennis Training
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            long N = sc.nextLong();
            long A = sc.nextLong();
            long B = sc.nextLong();

            long ans;

            if ((B - A) % 2 == 0) {
                ans = (B - A) / 2;
            } else {
                ans = Math.min(A - 1, N - B) + 1 + (B - A - 1) / 2;
            }

            System.out.println(ans);
        }
    }

}


Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;
const int mod = 1000000007;

int main(){
int n,y;
int k=0,amari=0;
bool flg=false;
cin>>n>>y;
for(int i=0;i<=n;i++){
    if(flg){break;}
    for(int j=0;j<=n;j++){
        k=(y-i*10000-j*5000)/1000;
        amari=(y-i*10000-j*5000)%1000;
        if(k==n-i-j&&k>=0&&amari==0){
            cout<<i<<" "<<j<<" "<<k<<endl;
            flg=true;
            break;
        }
    }
}
if(flg==false){
    cout<<"-1 -1 -1"<<endl;
}
}








Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int ac = n - m;
    int acTime = ac * 100;
    int waTime = m * 1900;

    int b = 1 << m;

    int ans = acTime * b + waTime * b;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int money = 100000;
	int week, i;
	char input[100];
	fgets(input, 100, stdin);
	sscanf(input, "%d", &week);
	for(i = 1; i <= week; i++)
	{
		money = money / 20 * 21;
		if(money % 1000 != 0)
		{
			money = money - (money % 1000) + 1000;
		}
	}
	
	printf("%d\n", money);
	
	return 0;
}

Measured memory_bytes: 600
#include <stdio.h>

int sum_digits(int n) {
    int sum = 0;
    
    while (n > 0) {
        sum += n % 10;
        n  /= 10;
    }

    return sum;
}

int main(void) {
    int n;
    int min = 1e6;

    scanf("%d", &n);
    
    for (int i = 1; i < n; i++) {
        int sum = sum_digits(i) + sum_digits(n - i);
        if (sum < min) min = sum;
    }

    printf("%d\n", min);

    return 0;
}


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

struct IND{string str,int page;};
int main()
{

struct IND N1[101]={};
string R;
int x,i=0;
while(scanf("%s %d",&R,&x)!=EOF){
N1[i].str=R;N1[i].page=x;i++;
}
for(int j=0;j<i;j++)
{
	for(int k=i;k>=j;k--)
	{
	*/
#include<stdio.h>
#include<iostream>
using namespace std;
void TR(double x,double y,int K,int H)
{

double t;
t=x*100;
if(t<3550)K=0;
else if(t<3550)K=0;
else if(t<3750)K=1;
else if(t<4000)K=2;
else if(t<4300)K=3;
else if(t<5000)K=4;
else if(t<5500)K=5;
else if(t<7000)K=6;
else if(t>=7000)K=7;

t=y*100;
if(t<3550)K=0;
else if(t<7100)H=0;
else if(t<7700)H=1;
else if(t<8300)H=2;
else if(t<8900)H=3;
else if(t<10500)H=4;
else if(t<11600)H=5;
else if(t<14800)H=6;
else if(t>=14800)H=7;
cout<<t;
}



int main(){
int K=0,H=0;
double x,y;
while(scanf("%lf %lf",&x,&y)!=EOF)
{K=0,H=0;

//TR(x,y,K,H);cout<<H<<K;
double t=0;
double X;
t=x*100;//t=(int)X;

if(t<3550)K=0;
else if(t<3550)K=0;
else if(t<3750)K=1;
else if(t<4000)K=2;
else if(t<4300)K=3;
else if(t<5000)K=4;
else if(t<5500)K=5;
else if(t<7000)K=6;
else if(t>=7000)K=7;

t=y*100;//t=(int)X;
if(t<3550)K=0;
else if(t<7100)H=0;
else if(t<7700)H=1;
else if(t<8300)H=2;
else if(t<8900)H=3;
else if(t<10500)H=4;
else if(t<11600)H=5;
else if(t<14800)H=6;
else if(t>=14800)H=7;


if(H<K)H=K;

switch(H){
case 0:
cout<<"AAA"<<endl;break;
case 1:
cout<<"AA"<<endl;break;
case 2:
cout<<"A"<<endl;break;
case 3:
cout<<"B"<<endl;break;
case 4:
cout<<"C"<<endl;break;
case 5:
cout<<"D"<<endl;break;
case 6:
cout<<"E"<<endl;break;
case 7:
cout<<"NA"<<endl;break;

}
}
return 0;
}

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

int main()
{
    int n, r;
    cin >> n >> r;
    if (n < 10)
        cout << r + 100 * (10 - n) << endl;
    else
        cout << r << endl;
    return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":"\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int n;
    cin>>n;
    int ans=0;
    REP(i,n) {
        int l,r;
        cin>>l>>r;
        ans+=r-l+1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;

public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
		String str[] = br.readLine().split(" ");
 
		int h = Integer.parseInt(str[0]);
		int a = Integer.parseInt(str[1]);
        br.close();

        System.out.println((h + a - 1) / a);
    }
}

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

int keta(int n) {
    int res;
    for(int i = 0; i < 100; i++) {
        n = n / 10;

        if(n == 0) {
            res = i + 1;
            break;
        }
    }
    return res;
}

int main() {
    int d,t,s;
    cin>>d>>t>>s;
    if(s*t>=d) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

signed main(void)
{
	int k, t, ans;
	vector<int> v;

	cin >> k >> t;
	rep(i, t)
	{
		int a;
		cin >> a;
		v.push_back(a);
	}
	sort(v.rbegin(), v.rend());	
	ans = v[0] - 1;
	for(int i = 1; i < t; i++)
	{
		ans -= v[i];
		if (ans <= 0)
		{
			ans = 0;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>


int main(void){

 

int a,b,c,i,n;


scanf("%d %d %d",&a,&b,&c);


n=0;


for(i=a;i<=b;i++){

  if(c%i==0){

   n++;

 }

 }

 

 printf("%d\n",n);

 

 return 0;

}

Measured memory_bytes: 596
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <string>
#include <functional>

using namespace std;


int main() {
	int N, K, count = 0;
	cin >> N >> K;
	count++;
	if (N > K) {
		//なんかceil関数が使えないんです
		count += (N - K) / (K - 1);
		count += ((N - K) % (K - 1) != 0) ? 1 : 0;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long A; long long B; long long C; long long D;
  cin>>A>>B>>C>>D;
  if(A>=0&&C>=0)
    cout<<B*D<<endl;
  else if(A>=0&&C<0){
    if(D>=0)
      cout<<B*D<<endl;
    else cout<<A*D<<endl;
  }
  else if(A<0&&C>=0){
    if(B>=0)
      cout<<B*D<<endl;
    else cout<<B*C<<endl;
  }
  else {
    if(B>=0&&D>=0)
      cout<<max(A*C,B*D)<<endl;
    else cout<<A*C<<endl;
  }
}


Measured memory_bytes: 3628
use proconio::{fastout, input, marker::Chars};

#[allow(unused_mut)]
#[fastout]
fn main() {
    input! {
        s: Chars,
        k: usize
    }
    let first = s.iter().find(|&&s| s != '1');
    let first_pos = s.iter().position(|&s| s != '1');
    match first {
        Some(n) => {
            let first_pos = first_pos.unwrap();
            if k - 1 < first_pos {
                println!("1");
            } else {
                println!("{}", n);
            }
        }
        None => {
            println!("1");
        }
    }
}


Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll s; cin >> s;
    ll a[2000];
    a[0] = 0; a[1] = 0; a[2] = 0; a[3] = 1;
    a[4] = 1; a[5] = 1;
    for (int i = 6; i <= s; ++i) {
        a[i] = 1;
        for (int j = 3; j <= i - 3; j++) {
            a[i] += a[i - j];
            a[i] %= MOD;
        }
        a[i] %= MOD;
    }
    cout << a[s] << endl;
}

Measured memory_bytes: 3608