akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef long long ull;
typedef long double ld;
#define inp_arr(name,size) for(int i = 0;i<size;i++)\
cin >> name[i];
#define cepat cin.tie(0);


int main(){
    cepat

    int a,max;
    cin >> a >> max;
    int d = 0, boun = 1;
    vector<int>data(a);
    inp_arr(data,a);
    for(int i = 0;i<a;i++){
        if(d+data[i]>max)
            break;
        d += data[i];
        boun++;

    }
    cout << boun;


    return 0;
}








Measured memory_bytes: 3616
n,m = map(int, input().split())

# 0~m-1のスポーツに変換
a = []
for i in range(n):
    b = list(map(int, input().split()))
    for j in range(len(b)):
        b[j]-=1
    a.append(b)

# i番目のスポーツを実施するなら1
held_sports = [1 for i in range(m)]

# i番目の人は何番目に好きなスポーツやるか？
join_sports = [0 for i in range(n)]

ans = n
for k in range(m):
    # i番目のスポーツへの参加人数
    total_join_sports = [0 for i in range(m)]
    for i in range(n):
        # i番目の人はjoin_sports[i](x)番目に好きなスポーツに参加する
        x = join_sports[i]
        total_join_sports[a[i][x]]+=1

    # [最大スポーツ, 参加人数]
    sports = [0,0]
    for i in range(m):
        if total_join_sports[i]>sports[1]:
            sports = [i,total_join_sports[i]]

    # 現時点での最小出す
    ans = min(ans, sports[1])

    # 最大スポーツやめる
    held_sports[sports[0]]=0

    # 参加し直し
    for i in range(n):
        # i番目の人はjoin_sports[i](x)番目に好きなスポーツに参加していた
        x = join_sports[i]
        if a[i][x]==sports[0]:
            # x番目以降の好きなスポーツ、かつ、やっているスポーツ探す
            for j in range(x+1,m):
                if held_sports[a[i][j]]==1:
                    join_sports[i]=j
                    break
print(ans)


Measured memory_bytes: 46300
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 404,mo=998244353,lim=400;
int n,a[N],b[N],dp[N][N],res;
inline void add(int &x, int y){x=x+y<mo?x+y:x+y-mo;}
inline int power(int a, int n) {
	int res=1;
	while (n) {
		if (n&1) res=1LL*res*a%mo;
		a=1LL*a*a%mo; n>>=1;
	}
	return res;
}
int fac[N],ifac[N];
void iniC(int n){
	fac[0]=1;rep(i,1,n)fac[i]=1LL*fac[i-1]*i%mo;
	ifac[n]=power(fac[n],mo-2);
	per(i,n-1,0)ifac[i]=1LL*ifac[i+1]*(i+1)%mo;
}
inline int C(int n, int m){return m>=0&&m<=n?1LL*fac[n]*ifac[m]%mo*ifac[n-m]%mo:0;}

int main() {
	read(n);int s=0;rep(i,1,n)read(a[i]),read(b[i]),s+=a[i];
	dp[0][0]=1;int nis=power(s,mo-2);iniC(N-1);
	rep(i,1,n){
		static int dp1[N][N];memset(dp1,0,sizeof(dp1));
		static int xs[N];
		rep(j,0,b[i]-1)xs[j]=mo-1LL*power(1LL*a[i]*nis%mo,j)*ifac[j]%mo;
		rep(p,0,lim)rep(q,0,lim)if(dp[p][q]){
			dp1[p][q+a[i]]=(dp1[p][q+a[i]]+dp[p][q])%mo;
			rep(j,0,b[i]-1)
				dp1[p+j][q]=(dp1[p+j][q]+1LL*dp[p][q]*xs[j])%mo;
		}
		memcpy(dp,dp1,sizeof(dp1));
	}
	rep(i,0,lim)rep(j,0,lim)dp[i][j]=(mo-dp[i][j])%mo;
	rep(p,0,lim)if(dp[p][0])res=(res+1LL*fac[p]*dp[p][0])%mo;
	rep(q,1,s-1){
		static int f[N];f[0]=1LL*s*power(s-q,mo-2)%mo;
		int Q=1LL*q*nis%mo;
		rep(i,1,lim)f[i]=1LL*i*Q%mo*f[i-1]%mo*power(1-Q+mo,mo-2)%mo;
		rep(p,0,lim)if(dp[p][q])
			res=(res+1LL*power(Q,mo-1-p)*f[p]%mo*dp[p][q])%mo;//,cerr<<p<<' '<<q<<endl;
	}
	cout<<res;
	return 0;
}


Measured memory_bytes: 1664
#include <stdio.h>
#include <math.h>

int main(void)
{
    int n=0,count=0;
    long int a[100000]={},max=1e18;
    long Mul=1;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%ld",&a[i]);
        if(a[i]==0){
            count+=1;
            break;
        }
    }
    if(count==1){
        printf("0");
        return 0;
    }
    for(int i=0;i<n;i++){
        if(Mul<=(max/a[i])){
            Mul*=a[i];
        } else {
            Mul=-1;
            break;
        }
    }
    printf("%ld",Mul);
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

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;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
template<class T,class Y>T LCM(T a,Y b){return (a*b)/GCD(a,b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)


int main(){
    int N;
    ll sum=0,asum=0;
    cin>>N;
    vi A(N),X(N);
    rep(i,N){
        cin>>A[i];
        sum+=A[i];
        if(i%2==1)asum+=A[i];
        A[i]*=2;
    }
    X[0]=sum-2*asum;
    rep(i,N-1){
        X[i+1]=A[i]-X[i];
    }
    rep(i,N){
        cout<<X[i]<<" ";
    }
    cout<<endl;
    return 0;
}

//a=97,z=122

Measured memory_bytes: 2048
//atcoder clange
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int i;
    char str[4];
    scanf("%s", str);//文字列取得
  	if(str[0] == '0'){
		if(str[1] != '0'){//both or MMYY
          if(str[2] == '0'){
          	if(str[3] != '0'){
				printf("AMBIGUOUS");
              	return 0;//A->A
            }
          }
          if(str[2] == '1'){
			if(str[3] == '0' || str[3] == '1' || str[3] == '2'){
              printf("AMBIGUOUS");
              	return 0;//A->B
            }
        }
          printf("MMYY");
          return 0;
    }
    }
      
      if(str[0] == '1'){
			if(str[1] == '0' || str[1] == '1' || str[1] == '2'){
              if(str[2] == '0'){
					if(str[3] != '0'){//both or MMYY
                      printf("AMBIGUOUS");
              				return 0;//B->A
                    } 
                }
              if(str[0] == '1'){
				if(str[1] == '0' || str[1] == '1' || str[1] == '2' ){
              			printf("AMBIGUOUS");
              			return 0;//B->B
           		 }
              } 
              printf("MMYY");
              return 0;
            }
        }
  
 			if(str[2] == '0'){
					if(str[3] != '0'){//both or MMYY
                      printf("YYMM");
              				return 0;//YYMM A
                    } 
                }
  
  		 if(str[2] == '1'){
			if(str[3] == '0' || str[3] == '1' || str[3] == '2'){
              printf("YYMM");
              	return 0;//YYMM B
            }
        }
  
	printf("NA");		
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,u,v,k;
    cin>>n;
    vector<vector<int> > lis(n+5);
    vector<bool> flag(n+5,false);
    rep(i,n){
        cin>>u>>k;
        rep(j,k){
            cin>>v;
            lis[u].push_back(v);
        }
    }
    queue<int> que;
    vector<int> time(n+5,-1);
    int now=0;
    que.push(1);
    time[1]=0;
    while(!que.empty()){
        int nowp=que.front();
        que.pop();
        if(flag[nowp]){
        }
        else{
            flag[nowp]=true;
            rep(i,lis[nowp].size()){
                que.push(lis[nowp][i]);
                if(time[lis[nowp][i]]==-1){
                    time[lis[nowp][i]]=time[nowp]+1;      
                }
            }
        }
    }
    REP(i,1,n+1){
        cout<<i<<' '<<time[i]<<'\n';
    }
    return(0);
}


Measured memory_bytes: 3188
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
#include <iomanip>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  //cout<<fixed<<setprecision(10);
  ll h,a,ans=0;
  cin>>h>>a;
  ans=h/a+(h%a==0?0:1);
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int a,b,c,ans;
    cin >> a >> b >> c;
    ans = 0;
    for (; a <= b; a++) {
        if (c % a == 0) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SORT(i) sort((i).begin(),(i).end())
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2000000000;
constexpr int mod = 1000000007;

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;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string s; cin >> s;
	int f = 0;
	rep(i, s.size()) {
		f += s[i] - '0';
	}
	int x = stoi(s);
	cout << (x % f == 0 ? "Yes" : "No") << "\n";

	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;
public class Main {
    public static void main (String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int x =sc.nextInt();
        for(int i=1;i<=x;i++){
            int z =i ;
            if(z%3==0){
            	sb.append(" ").append(i);
            }else{
                while(z != 0){
            	    if(z%10 == 3){
            		    sb.append(" ").append(i);
            		    break;
            	    }else{
            	         z /=10;
            	     }
                }
            }

        }
        System.out.println(sb);
        }

    }

Measured memory_bytes: 27320
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int H,W;
int fie[10][10000];
int logg[10];
int ans=0;
void func(int D){
    if(D==H){
        int karians=0;
        for(int i=0;i<W;i++){
            int a=0,b=0;
            for(int j=0;j<H;j++){
                if(logg[j]==fie[j][i])a++;
                else b++;
            }
            karians+=max(a,b);
        }
        ans=max(karians,ans);
    }
    else{
        logg[D]=0,func(D+1);
        logg[D]=1,func(D+1);
    }
}
int main(){
    while(1){
        ans=0;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++)fie[i][j]=-1;
        }
        cin>>H>>W;
        if(H==0&&W==0)break;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++)cin>>fie[i][j];
        }
        func(0);
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 1548
import math

N, M, L = list(map(int, input().split()))
graph = [[math.inf]*N for _ in range(N)]

for i in range(M):
    a, b, c = list(map(int, input().split()))
    graph[a - 1][b - 1] = c
    graph[b - 1][a - 1] = c

Q = int(input())
query = [(0, 0) for _ in range(Q)]

for i in range(Q):
    query[i] = tuple(map(int, input().split()))

# Warshall-Floyd
for i in range(N):
    for j in range(N):
        for k in range(N):
            graph[j][k] = min(graph[j][k], graph[j][i] + graph[i][k])

fuel_cost = [[math.inf]*N for _ in range(N)]

for i in range(N):
    for j in range(N):
        if graph[i][j] <= L:
            fuel_cost[i][j] = 1

# Warshall-Floyd
for i in range(N):
    for j in range(N):
        for k in range(N):
            fuel_cost[j][k] = min(fuel_cost[j][k], fuel_cost[j][i] + fuel_cost[i][k])

for i in range(Q):
    if fuel_cost[query[i][0] - 1][query[i][1] - 1] == math.inf:
        print(-1)
    else:
        print(fuel_cost[query[i][0] - 1][query[i][1] - 1] - 1)

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

int main(){
    string s, t;
    cin >> s >> t;

    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());

    //cout << s << endl;
    //cout << t << endl;
    if (s < t){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
def s(x):
    ans=0
    while True:
        ans+=x%10
        x=(x-x%10)/10
        if x==0:
            break
        
    return int(ans)

n,a,b=map(int,input().split())
    
count=0
    
for i in range(n):
    
    c=s(i+1)

    if a<=c<=b:
        count+=i+1
        
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define PI 3.141592653589793238
#define int long long
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht; // while using, comment #define int long long  */

void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in2.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T = 1;
	//cin >> T;
	FOR1(tp, T)
	{
		//cout << "Case #" << tp << ": ";
		int n, m;
		cin >> n >> m;
		int s = 0;
		FOR1(i, m){
			int x; cin >> x;
			s += x;
		}
		if(s > n) cout << -1;
		else cout << n-s;

		cout << '\n';
	}
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#include <math.h>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int x,y,z;
	cin >> x>> y>> z;
    string ans;
    if(x<=z&&z<=y)ans="Yes";
    else ans = "No";
      cout << ans << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}


int main(void){
  ll N, M, A, B, C, D, W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> A >> B >> C >> D;
  ans = 0;
  if (A >= B) ans+=B;
  else ans += A;
  if (C >= D) ans+=D;
  else ans += C;

  cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
map<int,int>vis,vis1;
int num[n];
for(int i=0; i<n; ++i)
num[i]=0;
int fn(0);
for(int i=0; i<m; ++i)
{
int a,b;
cin>>a>>b;
if(a>n)
fn=1;
if(vis1[a]&&vis[a]!=b)
fn=1;
if(a==1&&b==0&&n>1)
fn=1;
vis[a]=b;
vis1[a]=1;
num[a-1]=b;
}
if(fn==1)
cout<<-1;
else
{
if(m==0&&n>1)
num[0]=1;
if(num[0]==0&&n>1)
num[0]=1;
for(int i=0; i<n; ++i)
cout<<num[i];
}
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		char[] r = new char[4];
		char[] a = new char[4];
		while (in.hasNext()) {
			r = in.next().toCharArray();
			a = in.next().toCharArray();
			if (r.length == 1) {
				break;
			}
			int hit = 0, brow = 0;
			for (int i = 0; i < 4; i++) {
				for (int j = 0; j < 4; j++) {
					if (r[i] == a[j]) {
						if (i == j) {
							hit++;
						} else {
							brow++;
						}
						break;
					}
				}
			}
			System.out.println(hit + " " + brow);
		}

	}
}

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<int> e(N), w(N);
  for (int i = 0; i < N; i++) if (S[i] == 'E') e[i]++; else w[i]++;
  for (int i = 1; i < N; i++) e[i] += e[i - 1], w[i] += w[i - 1];
  int ans = 1000000000;
  for (int i = 0; i < N; i++) {
    int change = 0;
    if (i != 0) change += w[i - 1];
    if (i != N - 1) change += e[N - 1] - e[i];
    ans = min(change, ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3076
#include<stdio.h>
#include<string.h>

#define LEN 100005


typedef struct pp{
  char name[100];
  int p;
} P;


P Q[LEN];

int h,t,n;

void enqueue(P x)
{
  Q[t] = x;
  t = (t + 1) % LEN;
}

P dequeue()
{
  P x = Q[h];
  h = (h + 1) % LEN;
  return x;
}

int min(int a, int b)
{
  return a < b ? a: b;
}

int main(void)
{
  int e = 0, a;
  int i, b;
  P c;
  
  scanf("%d %d", &n, &b);

  for ( i = 1; i <= n; i++ ){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].p);
  }
  
  h = 1; t = n + 1;

  while ( h != t ){
    c = dequeue();
    a = min(b, c.p);
    c.p -= a;
    e += a;
    if ( c.p > 0 ) enqueue(c);
    else {
      printf("%s %d\n", c.name, e);
    }
  }
  
  return 0;
}



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

struct Card{
  int value,num;
  Card(int a, int b){value=a;num=b;};
};

int main()
{
  int m;
  int a,b;
  int g;
  int n;

  while(cin>>m,m){
    vector<Card>card;
    vector<int>dp(7000,0),dp2(7000,0);

    for(int i=0;i<m;i++){
      cin>>a>>b;
      card.push_back(Card(a,b));
    }

    dp[0]=1;
    for(int i=0;i<m;i++){
      dp2=dp;
      for(int j=0;j<=1000;j++){
	for(int k=1;k<=card[i].num;k++){
	  dp[j + card[i].value * k]+=dp2[j];
	}
      }
    }

    cin>>g;
    for(int i=0;i<g;i++){
      cin>>n;
      cout<<dp[n]<<endl;
    }
  }
}

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

using namespace std;

typedef long long ll;

#define INF 1LL<<60

ll n;
ll s;

ll f(ll b, ll n) {
    if (n < b) {
        return n;
    } else {
        ll nn = floor((double) n / b);
        return f(b, nn) + (n % b);
    }
}

int main(int argc, char* argv[]) {
    //cin >> n >> s;
    scanf("%lld", &n);
    scanf("%lld", &s);

    if (n == s) {
        cout << n + 1 << endl;
        return 0;
    }

    ll ans = INF;

    for (ll b = 2; b < sqrt(n) + 1; ++b) {
        if (f(b, n) == s) {
            ans = min(ans, b);
        }
    }

    ll d = n-s;

    for (ll i = 1; i < sqrt(d) + 1; ++i) {
        ll b = (n-s)/i + 1;

        if (f(b, n) == s) {
            ans = min(ans, b);
        }
    }

    if (ans == INF) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ls(x) (x)<<1
#define rs(x) (x)<<1|1
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define ll rt<<1
#define rr rt<<1|1
#define PI acos(-1)
#define MM int m=(l+r)>>1;
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
#define lcm(a,b) (a*b)/__gcd(a,b)
#define Case(i,ans) cout<<"Case "<<i<<": "<<ans<<endl;
#define cp(i,ans) printf("%.if",ans);
#define cpp(i,ans) cout<<setprecision(i)<<fixed<<ans<<endl;
#define ppb pop_back
#define ppf pop_front
#define pb push_back
#define pf push_front
#define pq priority_queue
#define lowbit(x) (x)&(-x)
#define all(V) V.begin(),V.end()
#define ms multiset
#define mod(x) (x)%mo_num
#define vc vector
#define vct vector<int>
#define fa(i,V) for(auto i:V)
#define out(i) cout<<(i)<<endl;
#define fi first
#define sc second
#define fun(i) fu(i,1,n)
#define fut(i) fu(i,1,t)
#define fum(i) fu(i,1,m)
#define ld long double
//#define P pair<int,int>
using namespace std;
const int INF=LLONG_MAX;
const int maxn=1e6+5;
const int mo_num=1e9+7;
int n,m,a[maxn],b[maxn],ans;
int jc[3000];
int ext_gcd(int a,int b,int &x,int &y){ if(b==0){x=1;y=0;return a;}int q=a/b, g=ext_gcd(b,a-q*b,x,y), z=x-q*y;x=y; y=z;return g; }
int inv(int a){ int x,y;ext_gcd(a,mo_num,x,y);return (x+mo_num)%mo_num; }
void init(int *x, int len){ x[0]=1;for(int i=1;i<len;i++)x[i]=(x[i-1]*i)%mo_num; }
int C(int r,int n){ if(n<0 or n<r or r<0)return 0;return (jc[n]*inv(jc[r])%mo_num)*inv(jc[n-r])%mo_num; }
int32_t main(){
    cin>>n>>m;
    init(jc,3000);
    fum(i)out(C(i,n-m+1)*C(i-1,m-1)%mo_num)
    return 0;
}


Measured memory_bytes: 256
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n
# def zeros(n): return np.zeros(n, dtype=np.longlong)
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替

INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                w = cmt + ': ' + str(x)
            else:
                w = str(x)
            print(w)
        return x

def prob():
    d = Debug()
    d.off()
    N = int(input())
    xport = zeros(5)
    for i in range(5):
        xport[i] = int(input())
    d.dmp((xport),'xport')
    minCapa = INF
    for i in range(5):
        minCapa = min(minCapa, xport[i])
    d.dmp((minCapa),'minCapa')
    minutes = 4
    minutes += (N+minCapa-1)//minCapa
    d.dmp((minutes),'minutes')
    return minutes
    

ans = prob()
print(ans)


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

int main()
{
    int menu_time[5];
    for (int i = 0; i < 5; i++) {
        cin >> menu_time[i];
    }

    int min = 9, idx = 0;
    for (int i = 0; i < 5; i++) {
        if (!(menu_time[i] % 10)) {
            continue;
        }

        if ((menu_time[i] % 10) < min) {
            min = menu_time[i] % 10;
            idx = i;
        }
    }

    if (idx != 4) {
        int tmp = menu_time[4];
        menu_time[4] = menu_time[idx];
        menu_time[idx] = tmp;
    }

    int cur_time = 0;
    for (int i = 0; i < 5; i++) {
        if (cur_time % 10) {
            cur_time += 10 - cur_time % 10;
        }

        int elapse_time = menu_time[i];
        cur_time += elapse_time;
    }

    cout << cur_time << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

using namespace std;

int main(){
	double a,b,c,degree,S;
	scanf("%lf %lf %lf",&a,&b,&degree);
	S = (0.5)*a*b*sin(M_PI*degree/180);
	c = sqrt(a*a+b*b-2*a*b*cos(M_PI*degree/180));
	printf("%.8lf\n",S);
	printf("%.8lf\n",a+b+c);
	printf("%.8lf\n",2*S/a);
}



Measured memory_bytes: 2968
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream cin("in.txt");
#endif
  int N, A, B, C;
  while (cin >> N >> A >> B >> C) {
    vector<int> l(N);
    for (int i = 0; i < N; i++) cin >> l[i];
    int all = 1;
    for (int i = 0; i < N; i++) all *= 4;
    int res = 1ll << 25;
    for (int m = 0; m < all; m++) {
      int a = 0, b = 0, c = 0;
      int na = 0, nb = 0, nc = 0;
      for (int i = 0, n = m; i < N; i++, n /= 4) {
        if (n % 4 == 0) {
          a += l[i];
          ++na;
        } else if (n % 4 == 1) {
          b += l[i];
          ++nb;
        } else if (n % 4 == 2) {
          c += l[i];
          ++nc;
        }
      }
      if (na > 0 && nb > 0 && nc > 0) {
        int cost = abs(A - a) + abs(B - b) + abs(C - c) + (na + nb + nc - 3) * 10;
        res = min(res, cost);
      }
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    if(n == 0){
        cout << 0 << endl;
        return 0;
    }
    vector<int> ans;
    while(n != 0){
        int mod = n % -2;
        if(mod < 0){
            mod *= -1;
            n -= 2;
        }
        n /= -2;
        ans.push_back(mod);
    }
    reverse(ans.begin(), ans.end());
    rep(i, ans.size())cout << ans[i];
    cout << endl;
}

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

#define SIZE_FLOOR (10)
#define SIZE_BUILDING (3)
#define SIZE_COLLEGEOFFICE (4)

struct Floor {
	int room[10];
};

struct Building {
	struct Floor floor[3];
};

struct Que {
	int b, f, r, v;
};

void manOfficialHouse(struct Building* offices, const struct Que* query);
void echoOfficialHouse(struct Building* offices, int count);

int main()
{
	struct Building AcollegeOffice[SIZE_COLLEGEOFFICE];
	int i, n;
	struct Que query;
	
	memset(AcollegeOffice, 0, sizeof(struct Building) * SIZE_COLLEGEOFFICE);
	scanf("%d", &n);
	
	for (i = 0; i < n; ++i) {
		scanf("%d %d %d %d", &query.b, &query.f, &query.r, &query.v);
		manOfficialHouse(AcollegeOffice, &query);
	}
	echoOfficialHouse(AcollegeOffice, SIZE_COLLEGEOFFICE);
	
	return 0;
}

void manOfficialHouse(struct Building* offices, const struct Que* query)
{
	offices[query->b - 1].floor[query->f - 1].room[query->r- 1] += query->v;
}
void echoOfficialHouse(struct Building* offices, int count)
{
	int size_floor = SIZE_FLOOR;
	int size_building = SIZE_BUILDING;
	int ro, fl, bu;
	
	for (bu = 0; bu < count; ++bu) {
		for(fl = 0; fl < size_building; ++fl) {
			for (ro = 0; ro < size_floor; ++ro) {
				printf(" %d", offices[bu].floor[fl].room[ro]);
			}
			printf("\n");
		}
		if (bu != count - 1) printf("####################\n");
	}
}

Measured memory_bytes: 612
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

bool checkNA(int num){
  return num == 0;
}

bool checkMonth(int num){
  return num < 13;
}

int main(void){
  int S;
  cin >> S;
  int a = S / 100;
  int b = S % 100;
  bool af, bf, an, bn;
  an = checkNA(a);
  bn = checkNA(b);
  af = checkMonth(a);
  bf = checkMonth(b);
  if((!af && !bf) || (an && bn) || (an && !bf) || (!af && bn)){
    cout << "NA" << endl;
  }else if((af && !bf) || (af && bn)){
    cout << "MMYY" << endl;
  }else if((!af && bf) || (an && bf)){
    cout << "YYMM" << endl;
  }else if(af && bf){
    cout << "AMBIGUOUS" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <limits>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define fi(i, n) for( int i=0 ; i<n ; i++ )
#define f(i, a, b) for( int i=a ; i<b ; i++ )
#define vi vector<int>
#define pb push_back
#define MOD 1000000007
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
ll fact(ll n)
{
    ll ans = 1e14;
    for(ll i = 1; i<=sqrt(n); i++)
    {
        if(n%i==0)
        {
            ll sol = (i - 1) + (n/i - 1);
            ans = min(ans,sol);
        }
    }
    return ans;
}
int visited[200000] = {0};
vector<vector<int> > v(200000);
int dfs(int x)
{
    int ans = 0;
    if(visited[x]==0)
    {
        visited[x] = 1;
        ans++;
        int a = v[x].size();
        for(int j = 0;j<a;j++)
        {
            int data = v[x][j];
            ans = ans + dfs(data);
        }
    }
    return ans;
}
void primefactors(int n)
{
    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        // While i divides n, print i and divide n
        while (n % i == 0)
        {
            cout << i << " ";
            n = n/i;
        }
    }

    // This condition is to handle the case when n
    // is a prime number greater than 2
    if (n > 2)
        cout << n << " ";

}
double fib(int n)
{
    double sol1,sol2;
    sol1 = (1 + sqrt(5))/2;
    sol2 = (1 - sqrt(5))/2;
    sol1 = pow(sol1,n);
    sol2 = pow(sol2,n);
    double ans = sol1 - sol2;
    ans = ans/sqrt(5);
    //ans = int(ans);
    return ans;
}

ll digits(ll n)
{
    return floor(log10(double(n))) + 1;
}


int main()
{
    ll n;
    cin>>n;
    if(n%2==1)
    {
        cout<<"0";
    }
    else
    {
        ll count = 0;

        for(ll i = 10;i<=n;i *= 5)
        {
            count = count + n/i;
        }
        cout<<count;

    }
}


Measured memory_bytes: 7768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

struct Node {
  ll key;
  Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(ll k) {
  Node *y = NIL;
  Node *x = root;
  Node *z;
  
  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while (x != NIL) {
    y = x;
    if (z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  z->parent = y;
  if (y == NIL) {
    root = z;
  } else {
    if (z->key < y->key) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
  return;
}

void inorder(Node *u) {
  if (u == NIL) return;
  inorder(u->left);
  cout << ' ' << u->key;
  inorder(u->right);
}

void preorder(Node *u) {
  if (u == NIL) return;
  cout << ' ' << u->key;
  preorder(u->left);
  preorder(u->right);
}

int main() {
  ll n, m;
  string s;
  cin >> n;
  rep(i, n) {
    cin >> s;
    if (s.at(0) == 'i') {
      cin >> m;
      insert(m);
    } else {
      inorder(root);
      cout << endl;
      preorder(root);
      cout << endl;
    }
  }
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

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

  int n;
  cin >> n;
  int st = 0, sx = 0, sy = 0;
  bool flag = true;
  rep(i, n) {
    int t, x, y;
    cin >> t >> x >> y;
    int d = abs(x-sx)+abs(y-sy);
    if((t-st)%2 == d%2 && t-st >= d) ;
    else flag = false;
  }
  cout << (flag ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
S = int(input())

if 13<=S//100<=99 or S//100==0:
  if 1<=S%100<=12:
    print("YYMM")
  else:
    print("NA")
else:
  if 13<=S%100<=99 or S%100==0:
    print("MMYY")
  else:
    print("AMBIGUOUS")

Measured memory_bytes: 38384
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>

#define INF 1e9
#define LINF 1e19
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
     
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
     
const ll MOD = 1e9 + 7;
const ll zer = 0;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n)cin >> a[i];
    sort(ALL(a));
    a.push_back(INF);
    ll r = 0, res = 0;
    rep(l, n){
      while(a[r + 1] <= a[l] + 2 && r < n)r++;
      //cout << r - l << endl;
      chmax(res, r - l + 1);
      if(l == r)r++;
    }
    cout << res << endl;
}





Measured memory_bytes: 3996
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define F .first
#define S .second 
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;

main(){
  ll n,a,b,ans=0;
  cin>>n>>a>>b;
  ll x=b-a;
  if(x%2==0)ans=x/2;
  else {
    ans=min(n-a,b-1);
    ll f=a+n-b,g=n;
    ll f2=1,g2=b-a+1;
    if(f+1<=g)ans=min(ans,(g-f-1)/2+1+n-b);
    if(f2<=g2-1)ans=min(ans,(g2-f2-1)/2+a-1+1);
  }
  cout<<ans;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int n=0;
		for(int i=0; i<s.length();i++) {
			if(s.charAt(i)=='+')n++;
			if(s.charAt(i)=='-')n--;

			}
		// 出力
		System.out.println(n);
	}
}

Measured memory_bytes: 21844
#include<stdio.h>
#include<string.h>
int main()
{
    char s1[4];
    int max=0,min=0;
    gets(s1);
    int len=strlen(s1);
    for(int i=0;i<len;i++)
    {
        if(s1[i]=='+')
        {
            max++;
        }
        else if(s1[i]=='-')
        {
            min++;
        }
    }
    printf("%d\n",max-min);
    return 0;
}


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

const ll INF = 1001001001;

const double PI=3.141592653;

const ll sosu = 1000000007;//大きい素数

//提出のときに言語がc＋＋似合っていることを確認する

//絶対値の関数
int z(int a,int b){
  if(a>b) return a-b;
  else return b-a;
}



int main(){
  int a;
  cin>>a;
  cout<<a+a*a+a*a*a<<endl;
  return 0;
  
  
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long res = 0;
		long[] A = new long[N];
		int count = 0;
		A[0] = sc.nextLong();
      	if(A[0]<0)count++;
		long sum = Math.abs(A[0]);
		long min = Math.abs(A[0]);
		for(int i = 1;i<N;i++) {
			A[i] = sc.nextLong();
			sum += Math.abs(A[i]);
			if(Math.abs(A[i])<min) {
				min = Math.abs(A[i]);
			}
			if(A[i]<0)count++;
          //System.out.println(sum);
          //System.out.println(count);
		}
		if(count%2==1) {
			res = sum - 2*min;
		}else {
			res = sum;
		}


		System.out.println(res);


	}

}

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

int search(int A[],int n,int key) {
  int i=0;
  A[n]=key;
  while (A[i]!=key) {
    i++;
  }
  return i!=n;
}
int main() {
  int n;
  cin>>n;
  int A[n+1];
  for (int i=0; i<n; i++) {
    cin>>A[i];
  }
  int q;
  cin>>q;
  int key;
  int ans=0;
  for (int i=0; i<q; i++) {
    cin>>key;
    if (search(A,n,key)) {
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3088
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7
N = ir()
X = np.array(lr()) - 1
robot = np.arange(N)
square = X - robot
answer = 1
block = 0
for i in range(N):
    answer *= (i+1-block)
    if robot[i]-(2*block) > square[i]:
        block += 1
    answer %= MOD

print(answer)
# 26

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

#define ll long long
#define fast_in_out  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main()
{
    fast_in_out;
    int x,a;
    cin >> x >> a;
    if(x < a)
    {
        cout << "0";
    }
    else
    {
        cout << "10";
    }
}


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

int main() {
    string s;
    cin >> s;
    int sum = 700;
    if(s[0] == 'o') sum += 100;
    if(s[1] == 'o') sum += 100;
    if(s[2] == 'o') sum += 100;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int i = 1;
		do{
			int x = i;
			if(x%3 == 0){
				System.out.print(" " + i);
			}else{
				do{
					if(x % 10 ==3){
						System.out.print(" " + i);
						break;
					}
				}while((x /= 10) != 0);
			}
		}while(++i <= n);
		System.out.println("");
	}
}

Measured memory_bytes: 28668
#include<bits/stdc++.h>
using namespace std;
#define int long  long
#define double long double
int t,ans;
string S,T;
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    t=1;
  //  cin>>t;
    while(t--)
    {
        ans=0;
        cin>>S;
        cin>>T;
        for(int i=0;i<S.size();i++)
        {
            if(S[i]!=T[i]) ans++;
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 3812
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) < (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
 
 
#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[8] = { //移動
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};
 
//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
 
struct Edge {
	ll from, to;
	ll w;
};
typedef vector<vector<Edge>> Graph;
 
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}

int memo[1 << 19][20] = {};
string s;
int n,N;
int p[1 << 19];

int rec(int l, int k){
  if(memo[l][k] == 0){ 
    if(k == 0){
      return memo[l][k] = p[l % N];
    }
    else{
      int a = max(rec(l,k-1), rec(l + (1 << k-1), k-1));
      int b = min(rec(l,k-1), rec(l + (1 << k-1), k-1));
      memo[l][k] = (s[a-b - 1] == '1' ? a : b);
    }
  }
  //printf("%d %d = %d\n",l,k,memo[l][k]);
  return memo[l][k];
}

int main(){
  cin >> n >> s;
  N = 1 << n;
  REP(i,N) scanf("%d",&p[i]);
  REP(i,N){
    printf("%d\n", rec(i, n));
  }
}


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

int main() {
	long long n,a,b;
	cin >> n >> a >> b;
	long long c = n / (a + b);
	// c * a ao sono1
	long long d = n % (a + b);
	// min(d,a) ao amari
	cout << c * a + min(d,a) <<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

import numpy as np

N,M = map(int,readline().split())
LR = np.array(read().split(),np.int32)

L = LR[::2]; R = LR[1::2]

x = R.min() - L.max() + 1
if x < 0: x = 0
print(x)


Measured memory_bytes: 22656
h, w = map(int, input().split())
s = [input() for _ in range(h)]
idx = [[-1, 0], [0, -1], [0, 1], [1, 0]]
a = "Yes"
for i in range(h):
    for j in range(w):
        if s[i][j] != "#": continue
        else:
            t = False
            for h_, w_ in idx:
                i_, j_ = i + h_, j + w_
                if (i_ == -1 or i_ == h) or (j_ == -1 or j_ == w): continue
                elif s[i_][j_] == "#":
                    t = True
                    break
            if t == False: a = "No"
    if a == "No": break
print(a)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
void push(int);
int pop();
int s2top(int);
void s2push(int,int);
int s1[20000],s2[20000][2],t1=0,t2=0;
int main(){
  int i,sum=0,j,a,ans[20000];
  char A[20000];
  scanf("%s",A);
  for(i=0;i<strlen(A);i++){
    if(A[i]=='\\'){
      push(i);
    }
    else if(A[i]=='/' && t1>0){
      j=pop();
      sum+=i-j;
      a=i-j;
      while(t2>0 && s2top(0)>j){
	a+=s2top(1);
	t2--;
      }
      s2push(j,a);
    }
  }
  printf("%d\n%d",sum,t2);
  for(j=0;j<t2;j++){
    if(j==0)printf(" ");
    printf("%d",s2[j][1]);
    if(j!=t2-1)printf(" ");
    
  }
  printf("\n");
  return 0;
}
void push(int x){
  s1[t1]=x;
  t1++;
}
int pop(){
  t1--;
  return s1[t1];
}
void s2push(int x,int y){
  s2[t2][0]=x;
  s2[t2][1]=y;
  t2++;
}
int s2top(int x){
  return s2[t2-1][x];
}



Measured memory_bytes: 2144
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
int main(){
  int n, l, i, j, sum=0;
  cin >> n >> l;
  for(i=0; i<n; i++)
    sum+=(l+i);

  if(l>0) cout << sum-l;
  else if(l+n-1>0) cout << sum;
  else cout << sum-(l+n-1);

  return 0;
}


Measured memory_bytes: 256
x = int(input(''))
N = int(repr(x)[-1])
if N == 2 or N == 4 or N == 5 or N == 7 or N == 9:
    print('hon')
elif N == 0 or N == 1 or N == 6 or N == 8:
    print('pon')
elif N == 3:
    print('bon')

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;


int main() {
    int64_t N, K, ans = 0;
    cin >> N >> K;
    vector<int64_t> A(N + 1);
    map<int64_t, int64_t> B;
    for (int i = 0; i < N; i++) {
        int64_t a;
        cin >> a;
        if (i == 0) {
            A.at(i + 1) = a - 1;
            continue;
        }
        A.at(i + 1) = A.at(i) + a - 1;
    }
    if (K == 1){
        cout << 0 << endl;
        return 0;
    }   
    for (int i = 0; i < N + 1; i++) {
        B[A.at(i) % K]++;
        if (i - K >= 0) {
            B[A.at(i - K) % K]--;
        }
        ans += B[A.at(i) % K] - 1;

    }
    cout << ans << endl;
}


Measured memory_bytes: 14336
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;

int main(){
  int N, C;cin>>N>>C;
  vector<pair<P, int>> program(N);
  rep(i, N){
  	int s, t, c;cin>>s>>t>>c;
    program[i]=make_pair(P(t, s), --c);
  }
  sort(program.begin(), program.end());
  rep(i, C){
    int j_=-1;
  	rep(j, N){
      if(program[j].second!=i)continue;
      if(j_==-1){j_=j;continue;}
      if(program[j_].first.first==program[j].first.second){
      	program[j]=make_pair(
          P(program[j].first.first, program[j_].first.second), i
        );
        program[j_]=make_pair(P(-1, -1), -1);
      }
      j_=j;
    }
  }
  int MAX_T = 100002;
  vector<int> r(MAX_T, 0), rr(MAX_T);
  rep(i, N){
    if(program[i].second==-1)continue;
    r[program[i].first.first]--;
    r[program[i].first.second-1]++;
    // cout<<program[i].first.second-1<<" "<<program[i].first.first<<endl;
  }
  rr[0]=r[0];
  int ans=-1;
  repb(t, 1, MAX_T){
    rr[t] = rr[t-1]+r[t];
    ans=max(ans, rr[t]);
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 2176
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long ll;
const ll M=998244353;
int ans,n,i;
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		int t=i,s=0;
		while(t>0)
		{
			t/=10;
			s^=1;
		}
		if(s)
			ans++;
	}
	cout<<ans;
}


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

int main() {
  string s;
  int ans = 0;
  cin >> s;
  if (s[0] == '1' )ans++;
  if (s[1] == '1' )ans++;
  if (s[2] == '1' )ans++;
  cout << ans << endl;
}

Measured memory_bytes: 256