akhauriyash/Code-Regression huggingface dataset:
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*                                                    
      I ♥ CLARICE STARLING...                                                               
        EXPLAINATION BELOW->
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
const ll INF = (ll)2e18 + 77;
void solve()
{
    ll n,i=0,mul=1;cin>>n;
    ll len=0;
    while(i<n)len++,mul*=26,i+=mul;
    ll start=i-(mul)+1;
    
    
    
    for(i=len;i>=1;i--)
    {
        mul/=26;
        int pos=0;
        while(start<=n)
        {
            start+=mul;
            pos++;
        }
        pos--;
        start-=mul;
        char ch=(pos%26)+'a';
        cout<<ch;
    }
    cout<<"\n";
    
}
int main()
{
   fastio
   //Test_cases
   solve();
  return 0;
}
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
// Syntax to create a min heap for priority queue priority_queue <int, vector<int>, greater<int>>; 
//for modinverse use modularexponention(x,M-2,M);
//for "each" subtraction from ans(ans-k) if(ans<0) do ans+=MOD,ans%=MOD
//vector<vector<int>>dp(201,vector<int>(n+1)); A way to initialize vector of vector
//If wrong on pretest 2 means logically wrong


/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


Measured memory_bytes: 3528
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int[] p=new int[N];
		for(int i=0; i<N; i++) {
			p[i]=sc.nextInt();
		}
		p[0]--;
		if(N==1) {
			p("Yes");
			System.exit(0);
		}
		else {
			for(int i=1; i<N; i++) {
				if(p[i]>p[i-1]) {
					p[i]--;
				}
				else if(p[i]==p[i-1]) {
					//
				}
				else if(p[i]<p[i-1]) {
					p("No");
					System.exit(0);
				}
			}
			p("Yes");
		}


	}
	public static void p(Object o) {
		System.out.println(o);
	}
}

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

int calc(int a, int k) {
    auto group = [&](int i, int j) { return (i+j-1) / j; };
    int n = group(a, k);
    if (a <= 0) return 0;
    if ((n-1) * k + 1 == a) return n;
    if (group(a-n-1, k) != n) return calc(a-n-1, k);
    int m = (a - ((n-1) * k + 1)) % (n+1) + (n-1) * k + 1;
    return calc(m, k);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int a, k;
        cin >> a >> k;
        ans ^= calc(a-k+1, k);
    }
    if (ans) cout << "Takahashi\n";
    else cout << "Aoki\n";
    return 0;
}

Measured memory_bytes: 256
<?php

while ($line = fgets(STDIN)) {
    $temp[] = trim($line);
};

$n = $temp[0] ;
$k = $temp[1] ;
$x = $temp[2] ;
$y = $temp[3] ;



if ($n > $k ) {
    $z = $n - $k;
    $total = $k * $x + $y * $z;
    echo $total;    
} else {
     $total = $n * $x;
    echo $total;   
}

?>


Measured memory_bytes: 4728
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Puzzle
    {
        readonly string target = "01234567";

        Dictionary<string, int> map;

        public Puzzle()
        {
            map = new Dictionary<string, int>();
        }

        public int Count(string path)
        {
            return map[path];
        }

        public void MakeMap()
        {
            Queue<KeyValuePair<string, int>> que = new Queue<KeyValuePair<string, int>>();

            que.Enqueue(new KeyValuePair<string, int>(target, 0));
            map.Add(target, 0);

            while (que.Count > 0)
            {
                KeyValuePair<string, int> cur = que.Dequeue();
                string curPath = cur.Key;
                int curPos = cur.Value;

                for (int i = 0; i < 4; i++)
                {
                    int nextPos = -1;

                    switch (i)
                    {
                        case 0:
                            if (curPos != 3 && curPos != 7) nextPos = curPos + 1;
                            break;
                        case 1:
                            if (curPos != 0 && curPos != 4) nextPos = curPos - 1;
                            break;
                        case 2:
                            if (curPos < 4) nextPos = curPos + 4;
                            break;
                        case 3:
                            if (curPos >= 4) nextPos = curPos - 4;
                            break;
                    }

                    if (nextPos == -1) continue;

                    string nextPath = Swap(curPath, curPos, nextPos);

                    if (!map.ContainsKey(nextPath))
                    {
                        map.Add(nextPath, map[curPath] + 1);
                        que.Enqueue(new KeyValuePair<string, int>(nextPath, nextPos));
                    }
                }
            }
        }

        private string Swap(string source, int s, int t)
        {
            char[] ret = source.ToCharArray();

            char temp = ret[s];
            ret[s] = ret[t];
            ret[t] = temp;

            return new string(ret);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            Puzzle pz = new Puzzle();
            pz.MakeMap();

            string input;

            while (!string.IsNullOrEmpty(input = Console.ReadLine()))
            {
                input = input.Replace(" ", "");

                sb.AppendLine(pz.Count(input).ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 12820
a = input()
b = input()
count = int(a)
num = []

for k in range(count):
    num.append(int(b.split()[k]))

result = 0
division = True
while division:
    div = 0
    for i in range(count):
        if num[i]%2 == 0:
            div += 1
    if div == count:
        for j in range(count):
            num.append(num.pop(0)/2)
        result += 1
    else:
        division = False

print(result)


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

using namespace std;
typedef long long ll;

int main(){

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int ans;
  ans = min(b, d) - max(a, c);
  if (ans <= 0) {
    cout << 0 << endl;
  }
  else {
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 256
/* おまじない　*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD=pow(10,9)+7;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(a%b,b);
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}

int main(){
    init();
	ll N,Q;cin>>N>>Q;
	vector<ll>A(N);
	vector<ll>sum(N+1,0);
	//累積和
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<N;i++){
		sum[i+1]=sum[i]+A[i];
	}

	while(Q--){
		ll x;
		cin>>x;
		ll ans=0;
		for(int left=0;left<N;left++){
			ans+=upper_bound(sum.begin()+left,sum.end(),sum[left]+x)-sum.begin()-left-1;
		}
		cout<<ans<<endl;
	}
}


Measured memory_bytes: 4432
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		
		while(true) {
			int H=in.nextInt(),W=in.nextInt();
			if(H==0)break;
			for(int i=0;i<H;i++) {
				for(int j=0;j<W;j++) {
					if((i!=0 && i!=H-1) && (j!=0 && j!=W-1))out.print(".");
					else out.print("#");
				}
				out.println();
			}
			out.println();
		}
		
		out.flush();
	}

}



Measured memory_bytes: 28212
<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function lineIn(){
		$buf = fgets(STDIN);
		return $this->killNewLine($buf);
	}
	private function killNewLine($buf = null){
		$buf = str_replace("\r\n", "", $buf);
		$buf = str_replace("\n", "", $buf);
		$buf = str_replace("\r", "", $buf);
		return $buf;
	}

	public function main(){
		$n = $this->lineIn();
		$s = $this->lineIn();
		$k = $this->lineIn();

		$ans = "";
		for($i = 0; $i < $n; $i++){
			if($s[$i] == $s[($k - 1)]){
				$ans .= $s[$i];
			} else {
				$ans .= "*";
			}
		}
		
		echo $ans . "\n";

	}
}
?>


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

int main(){
	int A,B;
  cin >> A >> B;
  
  if (A<2*B)
    cout << '0' << endl;
  else{
    A=A-2*B;
    cout << A << endl;
  }
}

Measured memory_bytes: 256
N=int(input())
L=list(map(int,input().split()))
ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i]==L[j] or L[j]==L[k] or L[i]==L[k]:
                continue
            if L[i]<L[j]+L[k] and L[j]<L[i]+L[k] and L[k]<L[j]+L[i]:
                ans+=1
print(ans)

Measured memory_bytes: 9156
#include <stdio.h>


int main()
{
	char retu[100];
	char c;
	int i,j, count = 0;

	for (i= 0; i < 100; i++)
	{
		scanf("%c", &c);
		if (c == '\n')
		{
			break;
		}
		retu[i] = c;
	}
	i--;

	if (i % 2 == 1)
	{
		for (j = 0; j < i / 2 + 1; j++)
		{
			if (retu[j] != retu[i - j])
			{
				count++;
			}
		}
	}
	else
	{
		for (j = 0; j < i / 2; j++)
		{
			if (retu[j] != retu[i - j])
			{
				count++;
			}
		}
	}

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

	
	return 0;

}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cmath>
#include<numeric>
using namespace std;


int main(void) {

  int n;
  cin >> n;
  vector<long long int> t(n);
  vector<long long int> a(n);
  for(int i=0; i<n; i++) cin >> t[i] >> a[i];

  long long int l = t[0];
  long long int r = a[0];
  for(int i=0; i<n; i++){
    if( l <= t[i] && r <= a[i] ){
      l = t[i];
      r = a[i];
    }else{
      long long int tmp = max( (l+t[i]-1)/t[i], (r+a[i]-1)/a[i] );
      l = t[i]*tmp;
      r = a[i]*tmp;
    }
    // cerr << i << " " << l << " " << r << " :" << l+r << endl;
  }
  cout << l+r << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

class Data{
public:
	int mX;
	int mY;
	Data(int _x,int _y){
		mX = _x;
		mY = _y;
	}
	Data():mX(0),mY(0){}
};

Data path[100][100];
bool visited[100][100];

int main(){

	int W;
	while(~scanf("%d",&W)){
		if(W==0) break;

		memset(visited,0,sizeof(visited));
		for(int y=0;y<W;y++){
			for(int x=0;x<W;x++){
				int nx,ny;
				cin >> nx >> ny;
				path[y][x] = Data(nx,ny);
			}
		}

		int res = 0;
		for(int y=0;y<W;y++){
			for(int x=0;x<W;x++){
				if(visited[y][x]) continue;

				bool tmp[100][100];
				memcpy(tmp,visited,sizeof(bool)*100*100);

				int sx = x;
				int sy = y;
				tmp[sy][sx] = true;

				int nx = sx;
				int ny = sy;
				for(int i=0;i<=W*W;i++){
					int prev_x = nx;
					int prev_y = ny;
					nx = path[prev_y][prev_x].mX;
					ny = path[prev_y][prev_x].mY;
					tmp[ny][nx] = true;

					if(nx==sx && ny==sy){
						res++;
						memcpy(visited,tmp,sizeof(bool)*100*100);
						break;
					}
				}
			}
		}

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

Measured memory_bytes: 1344
s=input()
t=input()
n=len(s)-len(t)+1
cnt=0
x=[]
for i in range(n):
  for l in range(len(t)):
    if s[i+l]!=t[l]:
      cnt=cnt+1
    else:
      continue
  x.append(cnt)
  cnt=0
print(min(x))      
      
  

Measured memory_bytes: 9056
using System;
namespace ConsoleApplication1{
    class Program{
        static void Main(string[] args){
            while (true) {
                String str=Console.ReadLine();
                if (str == null) {
                    break;
                }
                String[] strArray = str.Split();
                double[] a = new double[6];
                for (int i = 0; i < 6; i++) {
                    a[i] = double.Parse(strArray[i]);
                }
                double y = (a[2] * a[3] - a[0] * a[5]) / (a[1] * a[3] - a[0] * a[4]);
                double x = (a[2] - a[1] * y) /a[0];
                Console.WriteLine("{0:f3} {1:f3}", x, y);
            }
        }
    }
}

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

using namespace std;

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

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(vi c, vi d){
	return c.S < d.S;
}

int main() {
	int N, x;
	cin >> N >> x;
	int a[N];
	REP(i, 0, N) cin >> a[i];
	sort(a, a+N);
	int c = 0;
	REP(i, 0, N){
		if(a[i] > x) break;
		x -= a[i];
		++c;
	}
	cout << c - (c==N && x > 0? 1:0);
}	


Measured memory_bytes: 256
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <complex>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;

int main() {
  char ch;
  cin >> ch;
  cout << (char)(ch + 1) << endl;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define debug(x) {cerr <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}


using namespace std;

const int max_n = 1e3 + 5;



int main() {
	map<lint, int> cnt;
	make(n);
	cnt[0] = 1;
	lint ans = 0;
	lint sum = 0;
	FOR(i,0,n) {
		make(a);
		sum += a;
		ans += cnt[sum];
		cnt[sum]++;
	}
	printf("%lld\n", ans);
}


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

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

  long long int sum = 0LL;
  for (int i = 0; i < n; ++i) {
    int tmp;
    cin >> tmp;
    sum += tmp;
  }

  cout << sum / n << endl;

  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(){
  int n, c = 0;

  scanf( "%d", &n );
  //scanf( "%d", &b );
  if ( n < 105 ){
    printf( "0\n" );
    return 0;
  }
   if ( n == 105 ){
    printf( "1\n" );
    return 0;
  }
  int i, j;
  c = 1;
  for ( i = n; i > 105; i-- ){
    int num = 0;
    if ( i % 2 == 0 ) continue;
    for ( j = 1; j <= i/* / 2 + 1*/; j += 2 ){
      if ( i % j == 0 ){
        num++;
      }
    }
    if ( num == 8 ){
      c++;
    }
  }
  printf( "%d\n", c );
  return 0;
}

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

int main(){
    long long n,x;
    cin>>n>>x;
    vector<long long> a(n);
    long long ans=0;
    cin>>a[0];
    if(a[0]>x){
        ans+=a[0]-x;
        a[0]=a[0]-ans;
    }
    for(int i=1;i<n;i++){
        cin>>a[i];
        if(a[i]+a[i-1]>x){
            long long tmp=a[i]+a[i-1]-x;
            ans+=tmp;
            a[i]-=tmp;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
int calc_even(int x)
{
	if (x < 0)
		return 0;
	return x / 2 + 1;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin >> s;
	int len = s.size();
	int i = 0;
	vector<int> ans(len);
	while (i < len) {
		int j = i + 1;
		while (s[j] == 'R')
			j++;
		int L_index = j, R_index = j - 1;
		while (s[j] == 'L')
			j++;
		int even_num = calc_even(j - 1) - calc_even(i - 1);
		int odd_num = j - i - even_num;
		if (R_index % 2 == 0) {
			ans[R_index] = even_num;
			ans[L_index] = odd_num; 
		} else {
			ans[R_index] = odd_num;
			ans[L_index] = even_num;
		}
		i = j;
	}
	for (int i = 0; i < len; i++) {
		cout << ans[i] << " ";
	}
	return 0;
}

Measured memory_bytes: 1104
# -*- coding: utf-8 -*-
import sys
import re
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    S=input().replace('?','.')
    T=input()
    ans='z'*100
    for i in range(len(S)-len(T)+1):
        if re.match(S[i:i+len(T)],T):
            tmp=(S[:i]+T+S[i+len(T):]).replace('.','a')
            ans=min(ans,tmp)
    print(ans if ans!='z'*100 else 'UNRESTORABLE')
    

if __name__ == '__main__':
    main()


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

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n, k;
  cin >> n >> k;

  llong ans = 0;
  REP(i,n){
    int t;
    cin >> t;
    ans += min(t, abs(t - k)) * 2;
  }

  cout << ans << "\n";

  return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define MAXN 500010
using namespace std;

int n,L;
int d[MAXN];
int minx[MAXN];
int ans[MAXN];

void gao(){
	minx[n+1]=1;
	for(int i=n;i>=1;i--){
		if(abs(minx[i+1]-d[i])<minx[i+1])
			minx[i]=d[i]+minx[i+1];
		else
			minx[i]=minx[i+1];
		if(minx[i]>L) minx[i]=L+1;
	}
	int now=L;
	for(int i=1;i<=n;i++){
		ans[i]=(minx[i+1]<=now);
		now=min(now,abs(now-d[i]));
	}
}

int main(){
#ifdef DEBUG
	freopen("E.in","r",stdin);
#endif
	scanf("%d%d",&n,&L);
	for(int i=1;i<=n;i++) scanf("%d",d+i);
	gao();
	int q;
	scanf("%d",&q);
	while(q--){
		int x;
		scanf("%d",&x);
		if(ans[x]) puts("YES");
		else puts("NO");
	}
}


Measured memory_bytes: 7680
# frozen_string_literal: true

n, a, b, c, d = gets.split.map(&:to_i)
s = gets.chomp
a -= 1
b -= 1
c -= 1
d -= 1

a.upto(c - 1) do |i|
  if s[i + 1] == '#' && s[i] == '#'
    puts 'No'
    exit
  end
end
b.upto(d - 1) do |i|
  if s[i + 1] == '#' && s[i] == '#'
    puts 'No'
    exit
  end
end
if c < d
  puts 'Yes'
  exit
end

b.upto(d) do |i|
  if s[i - 1] != '#' && s[i] != '#' && s[i + 1] != '#'
    puts 'Yes'
    exit
  end
end
puts 'No'


Measured memory_bytes: 2172
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
const double PI = 3.14159265358979323846;

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

	int a[3];
	for (int i = 0; i < 3; i++) cin >> a[i];
	sort(a, a + 3);
	int K; cin >> K;
	for (int i = 0; i < K; i++) a[2] *= 2;
	cout << a[0] + a[1] + a[2] << endl;


	return 0;
}

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

int main(int argc, const char * argv[]) {



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

    /////////////////////
    // Write code below /
    /////////////////////
    int A[3][3],N,B;
    string flag="No";
    
    rep(i,3){
        rep(j,3){
            cin>>A[i][j];
        }
    }
    cin>>N;
    rep(i,N){
        cin>>B;
        rep(j,3){
            rep(k,3){
                if(A[j][k]==B){
                    A[j][k]=0;
                }
            }
        }
    }
    rep(i,3){
        if(A[i][0]==0&&A[i][1]==0&&A[i][2]==0){
            flag="Yes";
        }
        else if(A[0][i]==0&&A[1][i]==0&&A[2][i]==0){
            flag="Yes";
        }
    }
    if(A[0][0]==0&&A[1][1]==0&&A[2][2]==0){
        flag="Yes";
    }
    else if(A[0][2]==0&&A[1][1]==0&&A[2][0==0]){
        flag="Yes";
    }

    cout<<flag<<endl;

    return 0;
}


Measured memory_bytes: 256
s = list(map(str,input()))
t = list(map(str,input()))
ans = 0
a = 0
for i in range(len(s)):
    if s == t:
        ans = 1
    S = s[0]
    s.pop(0)
    s.append(S)
if ans == 1:
    print("Yes")
else :
    print("No")

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
    char s[11];
    int i;
    scanf("%s\n",s);
    int len,x=0;
    for(len=0;s[len]!='\0';len++);
    if(len%2==1){
	printf("No\n");
	return 0;
	}
    for(i=0;i<len/2;i++){
	if(s[i*2]!='h')x++;
	if(s[i*2+1]!='i')x++;
	}
    if(x==0)printf("Yes\n");
    else printf("No\n");

    return 0;
}




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

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

    int x = (1900 * m + (n - m) * 100);
    int inv_p = 1;
    rep(i, 0, m) inv_p *= 2;
    cout << x * inv_p << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <fstream>
#include <algorithm>
#include <bitset>

using namespace std;
typedef long double ld;

void solve();


int main( void ) {

	solve();

	return 0;
}

void solve() {

	int N;
	cin >> N;
	vector<int> v(2*N);

	for( int i = 0; i < 2*N; i++ ) {
		cin >> v[i];
	}
	sort(v.begin(),v.end());

	int ans = 0;
	for( int i = 0; i < N; i++ ) {
		ans += v[i*2];
	}

	cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define uint unsigned int
#define pb push_back
#define pi 2*acos(0.0)
#define db double
#define mk make_pair

int main()
{
    ll i,j,k,n,tc,q,x,y,z,t,v,d,c,p,m;
    ///////////////////////////////////////////
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ////////////////////////////////////////////

    cin>>n>>m;
    if(n>=3&&m>=3)
    {
        cout<<(n-2)*(m-2)<<endl;
    }
    else
    {
        if(n==1&&m==1)
        {
            cout<<'1'<<endl;
        }
        else if(n==2||m==2)
        {
            cout<<'0'<<endl;
        }
        else if(n==1)
        {
            cout<<m-2<<endl;
        }
        else if(m==1)
        {
            cout<<n-2<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
run (function * (write, gets) {
	var n = parseInt(yield, 10);
	write(Math.floor(n / 3));
});

/**
 * @param {(write: (line: string, end?: string) => void, gets: () => IterableIterator<string|null>) => IterableIterator<any>} main 
 */
function run (main) {
	var istream = process.stdin;
	var ostream = process.stdout;

	/**
	 * @type {[string|null]}
	 */
	var words = [];
	/**
	 * @type {[string]}
	 */
	var lines = [];
	var rest = "";
	var ended = false;
	var INPUT_MODE_LINE = 0;
	var INPUT_MODE_WORD = 1;
	var input_mode = INPUT_MODE_WORD;

	/**
	 * @param {string} line 
	 * @param {string} [end] 
	 */
	function write (line, end) {
		ostream.write(line + (undefined === end ? os.EOL : end));
	}
	function *gets () {
		if (0 < lines.length) {
			return lines.shift();
		} else {
			input_mode = INPUT_MODE_LINE;
			/**
			 * @type {string}
			 */
			var line = yield;
			input_mode = INPUT_MODE_WORD;
			return line;
		}
	}

	var main_itr = main(write, gets);

	/**
	 * @param {string|null} chunk 
	 */
	function get_chunk (chunk) {
		istream.pause();
		if (null === chunk) {
			lines.push(null);
		} else {
			rest += chunk;
			var line_exp = /.*(\r?\n|\r)/g;
			var line_match, lastIndex = 0;
			while (null !== (line_match = line_exp.exec(rest))) {
				lastIndex = line_exp.lastIndex;
				lines.push(line_match[0]);
			}
			rest = rest.substring(lastIndex);
		}
		loop();
	}

	function loop () {
		while (0 < lines.length) {
			switch (input_mode) {
				case INPUT_MODE_LINE:
				{
					words.push(lines.shift());
				}
				break;
				case INPUT_MODE_WORD:
				{
					if (null === lines[0]) {
						words.push(lines.shift());
					} else {
						var word_exp = /[^\s]+/g;
						var line_match;
						if (null !== (line_match = word_exp.exec(lines[0]))) {
							words.push(line_match[0]);
							lines[0] = lines[0].substring(word_exp.lastIndex);
						} else {
							lines.shift();
						}
					}
				}
				break;
			}

			while (0 < words.length) {
				var result = main_itr.next(words.shift());
				if (undefined !== result.value) {
					if ('string' === typeof result.value) {
						write(result.value, "");
					} else {
						write(`${result.value}`, "");
					}
				}
				if (result.done) return;
			}
		}

		ended ? setTimeout(get_chunk, 0, null) : process.stdin.resume();
	}
	istream.on('data', get_chunk);
	istream.on('end', function () {
		ended = true;
		get_chunk(null);
	});

	istream.setEncoding('utf8');
	get_chunk(null);
};

var os = require('os');


Measured memory_bytes: 21192
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

const int N = 100 * 1000 + 5;
vector <int> v[N];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int x, y;
		cin >> x >> y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	queue <int> q;
	vector <int> vis(n + 1);
	q.push(1);
	vis[1] = 1;
	q.push(n);
	vis[n] = 2;
	while(!q.empty()) {
		int x = q.front();
		q.pop();
		for (auto g : v[x]) {
			if (!vis[g]) {
				q.push(g);
				vis[g] = vis[x];
			}
		}
	}
	int a = 0, b = 0;
	for (int i = 1; i <= n; i++) {
		if (vis[i] == 1)
			a++;
		else
			b++;
		assert(vis[i] != 0);
	}
	cout << (a > b ? "Fennec" : "Snuke");
}


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

ll n;
vector<ll> a;
vector<ll> res;

int main() {
    cin >> n; a.resize(n); res.resize(n);
    for (int i = 0; i < n; i++) scanf("%Ld", &a[i]);
    for (int i = 0; i < n; i++) res[0] += (i%2) ? -a[i] : a[i];
    for (int i = 1; i < n; i++) res[i] = -res[i-1] + 2*a[i-1];
    for (int i = 0; i < n; i++) printf("%Ld\n", res[i]);
}

Measured memory_bytes: 2816
from collections import Counter

N = int(input())
D = list(map(int, input().split()))
if D[0] != 0: 
    print(0)
    exit()
    
D = Counter(D)

ans = 1
if D[0] > 1: 
    print(0)
    exit()

for i in range(N):
    ans = (ans * D[i] ** D[i+1]) % 998244353

print(ans)

Measured memory_bytes: 19936
# AtCoder Beginner Contest 088 D - Grid Repainting

import sys
from collections import deque

H, W = map(int, sys.stdin.readline().strip().split())
S = []
start_counter = 0  # 始状態の # をカウントする
for _ in range(H):
    s = list(map(str, sys.stdin.readline()))
    S.append(s)
    for i in s:
        if i == '#':
            start_counter += 1


# 幅優先で最短経路を探索　最短経路で通る白ますの数を求める
fp = [[True] * W for _ in range(H)]  # FootPrint 探索済みか記録する
q = deque()
q.append((0, 0, 1))
fp[0][0] = False

ans_counter = -1
while q:
    ux, uy, counter = q.popleft()
    # print(f'ux: {ux}, uy: {uy}, counter: {counter}')

    if (ux == W - 1) and (uy == H - 1):
        ans_counter = counter
        break

    for i in [[-1, 0], [1, 0], [0, -1], [0, 1]]:
        vx = ux + i[0]
        vy = uy + i[1]

        if (vx < 0) or (vx >= W):
            continue
        if (vy < 0) or (vy >= H):
            continue
        if fp[vy][vx] is False:
            continue
        if S[vy][vx] == '#':
            continue

        q.append((vx, vy, counter + 1))
        fp[vy][vx] = False

if ans_counter == -1:
    print(-1)
else:
    print(H * W - start_counter - ans_counter)


Measured memory_bytes: 3316
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

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

    int n;
    cin >> n;
    int res = 0;
    for( int i = 1; i <= 9; ++i ) {
        if( i <= n ) ++res;

    }

    for( int i = 100; i <= 999; ++i ) {
        if( i <= n ) ++res;

    }

    for( int i = 10000; i <= 99999; ++i ) {
        if( i <= n ) ++res;

    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        
        if( K == 0 ) {
            System.out.println( (long) N * N );
            return;
        }

        long ans = 0;
        for(int b = 1; b <= N; b++ ) {
            ans += Math.max( (long)(N / b) * (b-K), 0) + Math.max(N % b - K + 1, 0);
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 35812
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;

int main(){
    ll n,m,a,b;
    cin>>n>>m;
    vector<bool> isv(n,0);
    vector<ll> sym(n,0);
    vector<vector<ll>> adj(n);
    rep(i,m){
        cin>>a>>b;
        a--; b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    queue<ll> q;
    q.push(0);
    isv[0]=1;
    while(!q.empty()){
        ll now=q.front(); q.pop();
        rep(i,adj[now].size()){
            ll next=adj[now][i];
            if(!isv[next]){
                isv[next]=1;
                q.push(next);
                sym[next]=now+1;
            }
        }
    }
    cout<<"Yes"<<endl;
    rep(i,n-1) cout<<sym[i+1]<<endl;
    return 0;
}

Measured memory_bytes: 13032
#include<iostream>
using namespace std;
int main()
{
  int week,bal=100000,i,flg;
  cin >> week;
  for(i=0;i<week;i++)
  {
    flg = 0;
    bal = bal * 1.05;
    if(bal % 1000 == 0)
    flg = 1;
    bal /= 1000;
    bal *= 1000;
    if(!flg)
    bal += 1000;
  }
  cout << bal << endl;
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N, X,T;
  char x[200010];
  int ans=0;
  scanf("%s",x);
 int len=strlen(x);
  for(int i=0;i<len;i++)
  {
    ans+=x[i]-'0';
  }
  if(ans%9==0)
   cout<<"Yes";
  else cout <<"No";
}

Measured memory_bytes: 3848
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n, m;
    while(cin >> n >> m){
        vector<int> d(m);
        for(auto& t : d) cin >> t;
        vector<int> dp(n+1, n);
        dp[0] = 0;
        for(int i=0;i<n;i++){
            for(auto& t : d){
                if(i+t > n) continue;
                dp[i+t] = min(dp[i+t], dp[i]+1);
            }
        }
        cout << dp.back() << endl;
    }
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,d;
	cin>>n>>d;
	vvd a(n,vd(d,0));
	rep(i,n)cin>>a[i];
	int ans=0;
	rep(i,n)range(j,i+1,n){
		double val=0;
		rep(k,d){val+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);}
		val=sqrt(val);
		if(sgn(val,(int)(val))==0)ans++;
	}
	puta(ans);
	return 0;
}

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

int main(){
  string s;
  int n,m;
  while(cin>>s){
    n=m=0;
    int i=s.find("JOI");
    while(i!=string::npos){
      i=s.find("JOI",i+1);
      ++n;
    }
    i=s.find("IOI");
    while(i!=string::npos){
      i=s.find("IOI",i+1);
      ++m;
    }
    cout<<n<<'\n'<<m<<endl;
  }
  return 0;
}

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

array<string, 4> sub{"dream", "dreamer", "erase", "eraser"};

main() {
  string S; cin >> S;
  int l = S.length();
  while (l > 0) {
    bool flag = false;
    rep(i, sub.size()) {
      int ls = sub[i].length();
      if (l - ls >= 0 && S.rfind(sub[i]) == l - ls) {
        l -= ls;
        S.erase(S.begin() + l, S.end());
        flag = true;
      }
    }
    if (!flag) break;
  }
  cout << (l == 0 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 512
#include<cmath>
#include<iostream>
#include<map>
#include<iterator>
using namespace std;
int main()
{
    int n;
    cin>>n;
    map<string,int>m;
    for(int i=0;i<n;i++){
        string a;
        cin>>a;
        m[a]++;
    }
    int cnt=0;
    map<string,int>::iterator it=m.begin();
    for(;it!=m.end();it++){
        cnt++;
    }
    cout<<cnt;
}


Measured memory_bytes: 19068
#include<stdio.h>
 int main(void)
 {
     int n;
     int s1,s2,s3;

     scanf("%d",&n);

     if(n/100==1) s1=900;
     else s1=100;
     if((n%100)/10==1) s2=90;
     else s2=10;
     if((n%100)%10==1) s3=9;
     else s3=1;

     printf("%d\n",s1+s2+s3);

     return 0;
 }


Measured memory_bytes: 1696
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
#define ll long long
const int N=200005;
ll dp[N],bit[N];
ll h[N];
ll mx(int i)
{
  ll ans=0;
  for(int j=i;j>0;j-=j&(-j))
    ans=max(ans,bit[j]);
  return ans;
}
void update(int x,ll val)
{
  for(int i=x;i<N;i+=i&(-i))
    bit[i]=max(bit[i],val);
}
int main()
{
  fin;
  int n,i;
  cin>>n;
  memset(bit,0,sizeof(bit));
  memset(dp,0,sizeof(dp));
  for(i=0;i<n;i++)
    cin>>h[i];
  ll b[N];
  for(i=0;i<n;i++)
    cin>>b[i];
  for(i=0;i<n;i++)
  {
    ll mxi=mx(h[i]-1);
    //cout<<mxi<<" ";
    dp[h[i]]=max(dp[h[i]],mxi+b[i]);
    //cout<<dp[h[i]]<<"\n";
    update(h[i],dp[h[i]]);
  }
  ll ans=0;
  for(i=0;i<N;i++)
    ans=max(ans,dp[i]);
  cout<<ans;
}


Measured memory_bytes: 6528
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<cmath>
#include<algorithm>
using namespace std;

int n,m;
int ans;
int main()
{
    int i,j,k;
    cin>>n>>m;
    
    ans=(1<<m)*((n-m)*100+m*1900);
    
    cout<<ans<<endl;
    
    return 0;
} 


Measured memory_bytes: 256
using System;
class Program
{
	static void Main(string[] args)
	{
	   string S = Console.ReadLine();
	   int SL = S.Length;
	   string T = "";
	   for(int i = 0; i < SL; i++)
	   {
	      switch( S.Substring(i, 1) )
	      {
	         case "0" :
	            T += "0";
	         break;
	         
	         case "1" :
	            T += "1";
	         break;
	         
	         case "B" :
	            if(T != "")
	            {
	               T = T.Remove( T.Length-1, 1 );
	            }
	         break;
	         
	      }
	   }
	   Console.WriteLine(T);
	}
}

Measured memory_bytes: 13140
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    ll d;
    cin >> d;
    switch (d)
    {
    case 25:
        cout << "Christmas" << endl;
        break;
    case 24:
        cout << "Christmas Eve" << endl;
        break;
    case 23:
        cout << "Christmas Eve Eve" << endl;
        break;
    case 22:
        cout << "Christmas Eve Eve Eve" << endl;
        break;
    default:
        break;
    }

}


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

using namespace std;


int main()
{
	int a, b;
	cin >> a >> b;

	int a_min, a_max;
	a_min = (a * 100 - 1) / 8 + 1;
	a_max = ((a + 1) * 100 - 1) / 8;


	int b_min, b_max;
	b_min = (b * 100 - 1) / 10 + 1;
	b_max = ((b + 1) * 100 - 1) / 10;

	if ((b_min <= a_max) && (a_min < b_max) && (a_min <= b_min)) {
		cout << b_min << endl;
	}
	else if ((a_min <= b_max) && (b_min < a_max) && (b_min <= a_min)) {
		cout << a_min << endl;
	}
	else {
		cout << "-1" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

long long gcd(long long m,long long n){
    if(n==0){
        return m;
    }
    return gcd(n,m%n);
}
 
long long lcm(long long a,long long b){
    long long g=gcd(a,b);
    return a/g*b;
}


int main(){
    ll n,m;
    string s,t;
    cin>>n>>m>>s>>t;
    ll g=gcd(n,m);
    ll ans=lcm(n,m);

    for(ll i=0;i<g;i++){
        if(s[i*n/g]!=t[i*m/g]){
            cout<<-1<<endl;
            return 0;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3760
#include<iostream>
#include<cstdio>
#include<map>
#include<math.h>
#include<queue>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn=1e6+10;
int ans[maxn];
int main (){
    int l,r,x;
    cin>>l>>r>>x;
    printf ("%d\n",r/x-(l-1)/x);




}


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

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        long A = cin.nextLong();
        long B = cin.nextLong();
        long C = cin.nextLong();
        long D = cin.nextLong();

        long ans = B - A + 1 - (calc(B, C, D) - calc(A - 1, C, D));
        Console.WriteLine(ans);
    }

    long calc(long N, long C, long D)
    {
        return N / C + N / D - N / (C * D / gcd(C, D));
    }

    long gcd(long a, long b)
    {
        long tmp;
        if (b > a)
        {
            tmp = a;
            a = b;
            b = tmp;
        }

        if (b == 0)
        {
            return a;
        }

        return gcd(b, a % b);
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}



Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int h[n+1],i,m[n];
	for(i=1;i<=n;i++)
	cin>>h[i];
	m[1]=0;m[0]=100000;
	for(i=2;i<=n;i++)
	{
		m[i]=min(m[i-2]+abs(h[i-2]-h[i]),m[i-1]+abs(h[i-1]-h[i]));
	}
	cout<<m[n]<<endl;
	return 0;
}


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

using namespace std;
// #define int long long
mt19937 rnd(time(0));
typedef long long ll;
typedef long double ld;

// #define _GLIBCXX_DEBUG
#define f first
#define s second
#define pb push_back
#define pii pair<int, int> 
#define vi vector<int>
#define int ll

void solve() {
    string t, s;
    cin >> t >> s;
    cout << s << t << endl;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int t = 1;
    while(t--){
        solve();
    }
    
    return 0;
}


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

N, H = (int(x) for x in input().split())

A = []
B = []
for i in range(N):
    a, b = (int(x) for x in input().split())
    A.append(a)
    B.append(b)

A.sort(reverse=True)
B.sort(reverse=True)

ret = 0
AMax=A[0]
for b in B:
    if b < AMax or H <= 0:
        break
    H -= b
    ret += 1

if (H > 0):
    ret += H // AMax
    if H % AMax != 0:
        ret += 1
print(ret)

Measured memory_bytes: 17060