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

using namespace std;

int dp[100020];

int main()
{
  dp[0] = 0;
  for (int i = 1; i <= 100000; ++i) {
    dp[i] = 1e9;
    int power = 1;
    while (power <= i) {
      dp[i] = min(dp[i], dp[i-power]+1);
      power *= 6;
    }
    power = 1;
    while (power <= i) {
      dp[i] = min(dp[i], dp[i-power]+1);
      power *= 9;
    }
  }

  int N; cin >> N;
  cout << dp[N] << endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <complex>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <functional>
#include <iterator>
#include <unordered_map>

using namespace std;

#define dump(n) cerr<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int a,l;cin>>a>>l,a|l;){
		unordered_map<int,int> m;
		m[a]=0;
		for(int i=1;;i++){
			char buf[10]; sprintf(buf,"%0*d",l,a);
			string s1=buf; sort(all(s1));
			string s2(s1.rbegin(),s1.rend());
			
			a=atoi(s2.c_str())-atoi(s1.c_str());
			if(m.count(a)){
				cout<<m[a]<<' '<<a<<' '<<i-m[a]<<endl;
				break;
			}
			else
				m[a]=i;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1292
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
using namespace std;

char str[200010];
int dep[200010];
int xval[200010];
bool vst[1 << 27];
vector <int> v[200010];
bool vis[1 << 27];
map <int, int> mp;
int ct;

int Get(int arg) {
	int &id = mp[arg];
	if (!id) id = ++ct;
	return id;
}

int main() {
	scanf("%s", str + 1);
	for (int i = 1; str[i]; ++i) {
		xval[i] = xval[i - 1] ^ (1 << (str[i] - 'a'));
		int ind = Get(xval[i]);
		v[ind].push_back(i);
		vst[xval[i]] = 1;
	}
	dep[0] = 0;
	if (xval[strlen(str + 1)] == 0) {
		puts("1");
		return 0;
	}
	queue <int> q;
	q.push(0);
	while (!q.empty()) {
		int fr = q.front(); q.pop();
		for (int i = 0; i < 26; ++i) {
			int tt = xval[fr] ^ (1 << i);
			if (vis[tt] || !vst[tt]) continue;
			int prv = tt;
			tt = Get(tt);	
			for (auto j : v[tt]) {
				if (j > fr) {
					vis[prv] = 1;
					dep[j] = dep[fr] + 1;
					q.push(j);
				}
			}
		}
	}
	printf("%d", dep[strlen(str + 1)]);
	return 0;
}

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

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

long long f(long long n, long long x){
	if(n == -1LL)return 0LL;
	return n / x + 1LL;
}
int main(void){
	long long a, b, x;
	cin >> a >> b >> x;
	printf("%lld\n", f(b, x) - f(a - 1LL, x));
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main ()
{
  int N,tho,hun,ten,one;
  cin >> N;
  tho = N/1000;
    hun = (N%1000)/100;
    ten = (N%100)/10;
    one = N%10;
    if (tho == hun && hun == ten )
    {cout << "Yes" << endl;}
  else if ( hun == ten && ten == one )
    {cout << "Yes" << endl;}
  else
  {cout << "No" << endl;}
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static void Main()
	{
		int N = GetInt();
		int M = GetInt();
		int[] A = new int[N];
		int[] B = new int[N];
		for(int i = 0; i < N; i++)
		{
			A[i] = GetInt();
			B[i] = GetInt();
		}

		var table = Enumerable.Range(0, 100001).Select(_ => new List<int>()).ToArray();
		for(int i = 0; i < N; i++)
			table[A[i]].Add(B[i]);

		int ans = 0;
		var pq = new PriorityQueue<int>(100001, (x, y) => y - x);
		int day = M;
		while(day >= 0)
		{
			if(pq.Size > 0)
				ans += pq.Pop();

			day--;
			if(day < 0)
				break;
			
			foreach(int b in table[M - day])
				pq.Push(b);
		}

		Console.WriteLine(ans);
	}
}


public class PriorityQueue<T>
{
	public long Size { get; private set; } = 0;
	public long MaxSize { get; private set; } = 0;
	private T[] m_heap;
	private Comparison<T> Comp = null;
	
	public PriorityQueue(long maxSize, Comparison<T> comp)
	{
		if(maxSize <= 0)
			throw new Exception();
		MaxSize = maxSize;
		m_heap = new T[maxSize];

		Comp = comp;
	}
	
	public void Push(T x)
	{
		if(Size == MaxSize)
		{
			T[] new_heap = new T[MaxSize << 1];
			Array.Copy(m_heap, new_heap, MaxSize);
			m_heap = new_heap;
			MaxSize <<= 1;
		}
		
		long i = Size++;
		while(i > 0)
		{
			long p = (i - 1)/2;
			if(Comp(m_heap[p], x) <= 0)
				break;
			m_heap[i] = m_heap[p];
			i = p;			
		}
		m_heap[i] = x;		
	}
	
	public T Pop()
	{
		if(Size == MaxSize)
		{
			T[] new_heap = new T[MaxSize << 1];
			Array.Copy(m_heap, new_heap, MaxSize);
			m_heap = new_heap;
			MaxSize <<= 1;
		}
		
		T result = m_heap[0];
		T x = m_heap[--Size];
		long i = 0;
		while(i * 2 + 1 < Size)
		{
			long c1 = i * 2 + 1, c2 = i * 2 + 2;
			if(c2 < Size && Comp(m_heap[c2], m_heap[c1]) < 0)
				c1 = c2;
			if(Comp(m_heap[c1], x) >= 0)
				break;
			m_heap[i] = m_heap[c1];
			i = c1;
		}
		m_heap[i] = x;
		
		return result;		
	}	
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}





Measured memory_bytes: 27408
#include<bits/stdc++.h>
using namespace std;
#define faster_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
#define bug(a)       cerr << #a << " : " << a << endl;
template<class T>void ExEuclid(T n, T m, T &a, T &b, T &gcd){if(m==0){gcd=n;a=1;b=0;return;}ExEuclid(m,n%m,a,b,gcd);T x=a;a=b;b=x-(n/m)*a;}
template<class T>T gcd(T n, T m){if(m==0){return n;}gcd(m,n%m);}
template<class T>T lcm(T n, T m){return (n*m)/gcd(n,m);}
template<class T>string to_string(T n){string s="";while(n)s+=((n%10)+'0'),n/=10;reverse(s.begin(),s.end());return s;}
template<class T>ll to_int(T s){ll num=0,power=0;for(int i=s.size()-1; i>=0; i--)num+=(pow(10.0,power++)*(s[i]-'0'));return num;}
template<class T>bool is_mod(T n, T m){if(n%m==0)return true;return false;}
template<class T>bool is_upper(T s){for(int i=0; i<s.size(); i++)if(s[i]>90 || s[i]<65)return false;return true;}
template<class T>bool is_lower(T s){for(int i=0; i<s.size(); i++)if(s[i]>122 || s[i]<97)return false;return true;}
template<class T>T mod(T n, T m){return ((n%m)+m)%m;}
template<class T>T Big_mod(T base, T power, T MOD){
    if(power==1)return base;
    if(power & 1)return ((base%MOD)*(Big_mod(base,power-1,MOD))%MOD)%MOD;
    else {T temp=(Big_mod(base,power>>1,MOD));return ((temp%MOD)*(temp%MOD))%MOD;}
}



int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    faster_io;
    int n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    int a[n+5];
    a[1]=0;
    for(int i=1; i<n; i++){
        if(s[i-1]=='A' && s[i]=='C'){
            a[i+1]=a[i]+1;
        }
        else a[i+1]=a[i];
    }
    for(int i=1; i<=q; i++){
        int l,r;
        cin>>l>>r;
        cout<<a[r]-a[l]<<endl;
    }
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
ll a[352521];

int main(){
  scanf("%d",&n);
  REP(i,3*n)scanf("%lld",a+i);
  sort(a,a+3*n);
  ll ans = 0;
  REP(i,n)ans += a[3*n-2-2*i];
  cout<<ans<<endl;
  return 0;
}


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

int main() {
    int a[9];
    for (int i=0; i<9; i++) cin >> a[i];

    bool t[9];
    for (int i=0; i<9; i++) t[i] = false;

    int N;
    cin >> N;

    for (int i=0; i<N; i++) {
        int input;
        cin >> input;
        for (int i=0; i<9; i++) {
            if (a[i] == input) t[i] = true;
        }
    }

    if ((t[0] && t[1] && t[2]) || (t[3] && t[4] && t[5]) || (t[6] && t[7] && t[8]) ||
        (t[0] && t[3] && t[6]) || (t[1] && t[4] && t[7]) || (t[2] && t[5] && t[8]) ||
        (t[0] && t[4] && t[8]) || (t[2] && t[4] && t[6])) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int l = sc.nextInt();

        int[][] par = new int[n + 1][3];

        for (int i = 1; i <= n; i++) {
            par[i][0] = par[i][1] = par[i][2] = i;
        }

        for (int i = 0; i < k; i++) {
            int p = sc.nextInt();
            int q = sc.nextInt();
            int a, b;
            if ((a = Find(par, p, 0)) != (b = Find(par, q, 0))) {
                Unite(par, a, b, 0);
            }
        }

        for (int i = 0; i < l; i++) {
            int r = sc.nextInt();
            int s = sc.nextInt();
            int a, b;
            if ( (a = Find(par, r, 1)) != (b = Find(par, s, 1))) {
                Unite(par, a, b, 1);
            }
        }

        for (int i = 1; i <= n; i++) {
            par[i][0] = Find(par, i, 0);
            par[i][1] = Find(par, i, 1);
        }

        Arrays.sort(par, new Comparator<int[]>() {
            @Override
            public int compare(int[] a, int[] b) {
                if (a[0] == b[0]) return a[1] - b[1];
                return a[0] - b[0];
            }
        });

        int[] cnt = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            int tmp = 0, j;
            for (j = i; j <= n; j++) {
                if (par[j][0] == par[i][0] && par[j][1] == par[i][1]) {
                    tmp++;
                } else {
                    break;
                }
            }

            for (; i < j; i++) {
                cnt[par[i][2]] = tmp;
            }
            i--;
        }

        for (int i = 1; i < n; i++) {
            System.out.print(cnt[i] + " ");
        }
        System.out.println(cnt[n]);
    }

    private static int Find(int[][] par, int a, int i) {
        return (a == par[a][i]) ? a : (par[a][i] = Find(par, par[a][i], i));
    }

    private static void Unite(int[][] par, int a, int b, int i) {
        par[b][i] = par[a][i];
    }
}

Measured memory_bytes: 108396
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int K = in.nextInt();
            int[] A = new int[N];
            for (int i = 0; i < A.length; i++) {
                A[i] = in.nextInt();
            }

            int indexOf1 = -1;
            for (int i = 0; i < A.length; i++) {
                if (A[i] == 1) {
                    indexOf1 = i;
                    break;
                }
            }
            Utils.debug("indexOf1", indexOf1);

            int min = (int) 1e9;
            for (int start = Math.max(0, indexOf1 - (K - 1)); start <= indexOf1; start++) {
                if (start <= indexOf1 && indexOf1 < start + K) {
                } else {
                    Utils.debug("@");
                }

                int count = 1;
                for (int i = start; i > 0; count++, i -= K - 1) {
                }
                Utils.debug(start, "count", count);
                for (int i = start + (K - 1); i < N - 1; count++, i += K - 1) {
                }
                Utils.debug(start, "count", count);
                // count += start / K;
                // count += ((N - 1) - (start + (K - 1))) / K;
                min = Math.min(min, count);
            }

            System.out.println(min);
        }
    }

}

final class Utils {
    private Utils() {
    }

    public static final void debug(Object... o) {
        System.err.println(toString(o));
    }

    public static final String toString(Object... o) {
        return Arrays.deepToString(o);
    }

}


Measured memory_bytes: 69904
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

void solve(long long A, long long B){
	cout << (B-1+A-2)/(A-1) << endl;
}

int main(){	
	long long B;
	long long A;
	scanf("%lld",&A);
	scanf("%lld",&B);
	solve(A, B);
	return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{

    static void Main(string[] args)
    {
        int N = GetInputInt();
        int[] S = GetInputsInt();
        double sum = 0;
        for (int i = 0; i < N; i++)
        {
            sum += 1d / S[i];
        }

        Console.WriteLine(1 / sum);
        Console.ReadKey();
    }

    public static int GetInputInt()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] GetInputsInt()
    {
        return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    }
    public static List<int> GetInputsIntList()
    {
        return Console.ReadLine().Split(' ').Select(int.Parse).ToList();
    }
    public static long GetInputLong()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] GetInputsLong()
    {
        return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
    }

}


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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl "\n"
#define mod 1000000007
#define INF 100000000

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

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x, y;
  while (cin >> x >> y){
    int res = __gcd(x, y);
    cout << res << ' ' << max(x, y) / res * min(x, y) << endl;
  }
}

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

const int MOD = 1000000007;

const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    string s;
    cin >> s;
    string t;
    reverse_copy(s.begin(), s.end(), back_inserter(t));

    int ans = 0;
    rep(i, s.size())
    {
        if (s.at(i) != t.at(i)) {
            ans++;
        }
    }

    cout << ans / 2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=20,K=(1<<15)+10,P=1e9+7;
int g[N],num[K];
int dp[K];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		x--;y--;
		g[x]|=(1<<y);
	}
	int k=(1<<n)-1;
	for(int i=0;i<=k;i++)
		num[i]=1<<__builtin_popcount(i);
	dp[0]=1;
	for(int S=1;S<=k;S++){
		if((S&1)^(S>>1&1))continue;
		for(int U=S;U;U=(U-1)&S){//U必然不为空集
			if((U&1)^(U>>1&1))continue;
			int T=S^U,cnt=1;
			for(int p=0;p<n;p++){
				if(!(S>>p&1))continue;
				if(U>>p&1)cnt=1ll*cnt*num[g[p]&T]%P;
				else cnt=1ll*cnt*(num[g[p]&U]-1)%P;
			}
			dp[S]=(dp[S]+1ll*cnt*dp[T])%P;
		}
	}
	int all=1;
	for(int i=1;i<=m;i++)all=all*2%P;
	printf("%d\n",(all-dp[k]+P)%P);
	return 0;
}

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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n; string s; cin >> n >> s;
  if (n&1){
	cout << "No" << "\n";
  }else{
	cout << ((s.substr(0,n/2) == s.substr(n/2)) ? "Yes" : "No") << "\n";
  }
   
return 0;
}


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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 1e4+5;

int ans[N];

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        for(int x=1;x<=100;x++)for(int y=1;y<=100;y++)for(int z=1;z<=100;z++)
        {
            int sum = (x*x) + (y*y) + (z*z) + (x*y) + (y*z) + (x*z);
            if(sum < N)ans[sum]++;

        }
        int n;
        cin>>n;
        for(int i=1;i<=n;i++)cout<<ans[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3724
// Code for B - Bite Eating
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, L;
  cin >> N >> L;
  
  vector<int> A(N);
  for (int i = 1;i <= N; i++) {
    A.at(i - 1) = L + i - 1;
  }

  int sum = 0;
  int amin = 10000000;
  int original = 0;
  vector<int>::iterator itr = A.begin();
  for (; itr != A.end(); itr++) {
    sum += *itr;
    if (abs(*itr) < amin) {
      amin = abs(*itr);
      original = *itr;
    }
  }

  cout << sum - original;

	return 0;
}


Measured memory_bytes: 256
/* 
 * Project: AtCoder Beginners Contest 139 A - Tenki
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/08/24
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cstdint>
using namespace std;

char s[3];
char t[3];

void solve() {

    uint16_t cnt = 0;
    for (int i=0;i<3;i++) {
        cnt += (s[i] == t[i]);
    }
    printf("%d\n", cnt);

}

int main() {

    scanf("%s", s);
    scanf("%s", t);

    solve();

}

Measured memory_bytes: 3176
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define llint long long int

int main(void){

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

  std::sort(d.begin(), d.end());

  std::cout << d[n/2]-d[n/2-1] << std::endl;


  return 0;
}


Measured memory_bytes: 640
//
//  main.c
//  King's Inspection
//
//  Created by x15071xx on 2016/06/17.
//  Copyright ?? 2016??´ AIT. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, const char * argv[]) {
    
    while (1) {
        
        int n,i,j,k,x,sa_keka;
        int key[100];
        char abc[101];
        char st[53];
        int len = 0,b=0;
        for (i=0; i<26; i++) {
            st[i] = 97 + i;
            st[i+26] = 65 + i;
        }
        
        for (i=0; i<26; i++) {
            st[i] = 97 + i;
            st[i+26] = 65 + i;
        }
        
        for (i=0; i< 52; i++) {
            key[i] = 0;
        }
        for (i=0; i<101; i++) {
            abc[i] = 0;
        }
        
        
        
        scanf("%d",&n);
        
        if (n==0) {
            break;
        }
        
        for (i=0; i<n; i++) {
            scanf("%d",&key[i]);
        }
        
        scanf("%s",abc);
        
        len = strlen(abc);
        for (i=0; i < len; i+=n) {
            
            for (j=0; j<n; j++) {
                if (i+j >= len) {
                    b=1;
                    break;
                }
                if (abc[i+j] >= 65 && abc[i+j] <=90) {
                    x = abc[i+j] - 65+26;
                    sa_keka = x - key[j];
                } else {
                    x = abc[i+j] - 97;
                    sa_keka = x - key[j];
                }
                
                if (sa_keka < 0) {
                    sa_keka +=52;
                }
                
                if (sa_keka > 52) {
                    sa_keka -= 52;
                }
                
                abc[i+j] = st[sa_keka];
            }
            if (b==1) {
                break;
            }
        }
        
        printf("%s\n",abc);
        
    }
    return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b;
	if ((a*b)%2) cout<<"Yes";
	else cout<<"No";
	return 0;
}

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

int main()
{
  string n;
  cin >> n;
  if(n.at(0) == '9' || n.at(1) == '9')
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
using namespace std;
int main(){
  long long int n,x=0,ans=0;
  cin>>n;
  for(int i=1;ans<1000000000;i++){
    x+=i;
    ans++;
    if(x>=n)
      break;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
use std::io;

fn main() {
    let n: u32 = getline().trim().parse().expect("");
    let a: u32 = getline().trim().parse().expect("");
    println!("{}", n*n - a);
}

fn getline() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line);

    return line;
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
int cnt[100000];
int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		cnt[a]++;
		cnt[b]++;
	}
	for (int i = 0; i < N; i++) {
		if (cnt[i] % 2) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    vector<vector<int>> a(3,vector<int>(3));
    rep(i,3)rep(j,3) cin >> a.at(i).at(j);
    int n;
    cin >> n;
    vector<int>b(n);
    rep(i,n){
        cin >> b.at(i);
        rep(j,3)rep(k,3){
            if(b.at(i)==a.at(j).at(k))a.at(j).at(k)=0;
        }
    }
    bool flag=false;
    rep(i,3){
        int count=0;        
        rep(j,3){
            count+=a.at(i).at(j);            
        }        
        if(count==0){
            flag=true;
            break;
        }
    }
    rep(i,3){
        int count=0;
        rep(j,3){
            count+=a.at(j).at(i);
        }
        if(count==0){
            flag=true;
            break;
        }
    }
    int count1=0;
    rep(i,3){
        count1+=a.at(i).at(i);
    }
    if(count1==0)flag=true;
    count1=0;
    rep(i,3){
        count1+=a.at(i).at(2-i);
    }
    if(count1==0)flag=true;
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define p_yes() p("YES")
#define p_no() p("NO")
#define SZ(x) ((int)(x).size())

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N; 
    cin >> N;

    VI A(N);
    rep(i, N){
        ll a; cin >> a;
        if(a%2==1){
          p("first");
          return 0;
        }
    }
    p("second");
    
    return 0;
}

Measured memory_bytes: 1024
n = int(input())
if n % 2 == 0:
	n = n - 1
count = 0
for j in range(1, n + 1, 2):
	ans = 0
	for i in range(1, j + 1, 2):
		if j % i == 0:
			ans += 1
	if ans == 8:
		count += 1
print(count)

Measured memory_bytes: 3060
//kruskal tree
#include <iostream>
#include <algorithm>
using namespace std;
#define M 9999
int parent[M],a[M],b[M];
pair<int,int>node[M];
int root(int a){return parent[a]==a?a:parent[a]=root(parent[a]);}
int unite(int a,int b){
	int x=root(a),y=root(b);
	if(x==y)return 0;
	parent[x]=y;
	return 1;
}
int main(){
	int i,j,s,n,m,x;
	cin>>n;
	for(m=i=0;i<n;i++)for(j=0;j<n;j++)if(cin>>x,~x)a[m]=i,b[m]=j,node[m].first=x,node[m].second=m++;
	sort(node,node+m);
	for(i=0;i<n;i++)parent[i]=i;
	for(s=i=0;i<m;i++)if(unite(a[node[i].second],b[node[i].second]))s+=node[i].first;
	cout<<s<<endl;
}

Measured memory_bytes: 1304
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(6) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;

signed main(){
    cin >> n;
    vec(a,n);
    int sum=0;
    REP(i,n){
        cin >> a[i];
        sum += a[i];
    }
    Sort(a);
    cout << a[0] << " " << a[n-1] << " " << sum << endl;

    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}



Measured memory_bytes: 3160
import java.util.Scanner;


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

Measured memory_bytes: 24212
A=int(input())
B=int(input())
C=int(input())
X=int(input())
cnt=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k==X:
                cnt+=1
print(cnt)

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <math.h>
#define PI 3.1415926535
using namespace std;

int main(int argc, char *argv[])
{
    double a, b;
    double angle;
    scanf("%lf %lf %lf", &a, &b, &angle);

    double S = 0.5 * (a * b *sin(angle / 180 * PI));
    double c = sqrt(a * a + b * b - 2 * a * b *cos(angle / 180 * PI));
    double C = a + b + c;
    double h = 2 * S / a;
    printf("%lf %lf %lf", S, C, h);

    return 0;
}



Measured memory_bytes: 3412
#include<stdio.h>

#define N 100000
#define NIL -1

int depth(int);
void degree(int);

struct Node{
    int parent;
    int left;
    int right;
};

struct Node T[N];
int count=0;

int main(){

    int n,i,j,id,k,child,tmp;

    scanf("%d",&n);

    for(i=0;i<n;i++) T[i].parent=T[i].left=T[i].right=NIL;
    
    for(i=0;i<n;i++){

        scanf("%d%d",&id,&k);

        for(j=0;j<k;j++){

            scanf("%d",&child);

            T[child].parent=id;

            if(j==0) T[id].left=child;

            else T[tmp].right=child;

            tmp=child;

        }

    }

    for(i=0;i<n;i++){

        count=0;

        printf("node %d: parent = %d, depth = %d, ",i,T[i].parent,depth(i));

        if(T[i].parent==NIL) printf("root, [");

        else if(T[i].left==NIL) printf("leaf, [");

        else printf("internal node, [");

        count=0;

        degree(T[i].left);

        printf("]\n");

    }

    return 0;

}

int depth(int x){

    if(T[x].parent==NIL) return count;

    else{

    count++;

    return depth(T[x].parent);

    }

}

void degree(int x){

    if(x != NIL){

        if(count != 0) printf(", ");

        printf("%d",x);

        count++;

        degree(T[x].right);

    }

}

Measured memory_bytes: 1784
N = int(input())
list = [input(), input(), input()]
c = 0
for n in range(N):
    if list[0][n] == list[1][n]:
        if list[0][n] != list[2][n]:
            c += 1
        continue
    if list[0][n] == list[2][n]:
        if list[0][n] != list[1][n]:
            c += 1
        continue
    if list[1][n] == list[2][n]:
        if list[0][n] != list[1][n]:
            c += 1
        continue
    c += 2

print(c)

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

int main() {
	typedef pair<int, int>P;

	int a;
	while (cin >> a, a) {
		vector<int>rv;
		vector<int>sv;
		vector<int>pv;

		if (a == 1)rv.push_back(1);
		else if (a == 2)sv.push_back(1);
		else pv.push_back(1);

		for (int i = 2;i <= 5;i++) {
			int b;
			cin >> b;
			if (b == 1)rv.push_back(i);
			else if (b == 2)sv.push_back(i);
			else pv.push_back(i);
		}

		int r = 0,p = 0,s = 0;

		if (rv.empty() && !sv.empty() && !pv.empty()) {
			s = 1;
			p = -1;
		}
		else if (!rv.empty() && sv.empty() && !pv.empty()) {
			r = -1;
			p = 1;
		}
		else if (!rv.empty() && !sv.empty() && pv.empty()) {
			r = 1;
			s = -1;
		}

		int k[5];
		int a = rv.size();
		for (int i = 0;i < a;i++) {
			if (r == 1) k[rv[i] - 1] = 1;
			else if (r == -1) k[rv[i] - 1] = 2;
			else k[rv[i] - 1] = 3;
		}

		int b = sv.size();
		for (int i = 0;i < b;i++) {
			if (s == 1)k[sv[i] - 1] = 1;
			else if (s == -1)k[sv[i] - 1] = 2;
			else k[sv[i] - 1] = 3;
		}

		int c = pv.size();
		for (int i = 0;i < c;i++) {
			if (p == 1)k[pv[i] - 1] = 1;
			else if (p == -1)k[pv[i] - 1] = 2;
			else k[pv[i] - 1] = 3;
		}

		for (int i = 0;i < 5;i++) {
			cout << k[i] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3060
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	h, w, d := nextInt(), nextInt(), nextInt()
	// point[x]: xが書かれているマスの座標(y,x)
	point := make([][2]int, h*w+1)
	for i := 0; i < h; i++ {
		a := nextInts(w)
		for j := 0; j < w; j++ {
			point[a[j]] = [2]int{i, j}
		}
	}

	cost := make([]int, h*w+1)
	for i := d + 1; i <= h*w; i++ {
		cost[i] = cost[i-d] + abs(point[i][0]-point[i-d][0]) + abs(point[i][1]-point[i-d][1])
	}

	q := nextInt()
	for i := 0; i < q; i++ {
		l, r := nextInt(), nextInt()
		puts(cost[r] - cost[l])
	}
}


Measured memory_bytes: 5632
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <functional>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <string>

using namespace std;

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)

ll const INF = 1000000000000000000;
int const I_MAX = 2147483647;
ll const MOD = 1e9 + 7;
int const POW_MAX = 1e5;

// nCr
ll po[POW_MAX + 2];
ll mod_pow(ll x, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
ll mod_inv (ll x) {
  return mod_pow(x, MOD - 2) % MOD;
}
ll comb(int n, int r) {
  return (((po[n] * mod_inv(po[r])) % MOD) * mod_inv(po[n - r])) % MOD;
}
// greatest common divisor
ll gcd(ll a, ll b) {
  while (a % b != 0) {
    ll tmp = a;
    a = b;
    b = tmp % b;
  }
  return b;
}

int const N_MAX = 2 * 1e5;

int N;
ll A[N_MAX + 1];
ll sums[N_MAX + 1];
int f[N_MAX + 1], g[N_MAX + 1];

ll get_d(int right, int center, int left) {
  ll r = sums[right];
  ll c = sums[center];
  ll l = left == -1 ? 0 : sums[left];
  return abs((r - c) - (c - l));
}

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

  rep(i, N) {
    scanf("%lld", &A[i]);
    sums[i] = sums[i - 1] + A[i];
  }

  FOR(l, 1, N - 2) {
    int i = f[l - 1];
    while (i < l - 1 && get_d(l, i, -1) > get_d(l, i + 1, -1)) {
      i++;
    }
    f[l] = i;

    int j = max(l + 1, g[l - 1]);
    while (j < N - 2 && get_d(N - 1, j, l) > get_d(N - 1, j + 1, l)) {
      j++;
    }
    g[l] = j;
  }
  ll d = INF;
  FOR(l, 1, N - 2) {
    ll p = sums[f[l]];
    ll q = sums[l] - sums[f[l]];
    ll r = sums[g[l]] - sums[l];
    ll s = sums[N - 1] - sums[g[l]];
    d = min(d, max({p, q, r, s}) - min({p, q, r, s}));
  }
  printf("%lld\n", d);
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 10000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}
int n,a[100010],b[100010],ans;
signed main(){
	cin>>n;
	rep(i,n+1)cin>>a[i];
	rep(i,n)cin>>b[i];
	rep(i,n){
		if(b[i]<a[i]){
			ans+=b[i];
		}
		else{
			ans+=a[i];
			int x=b[i]-a[i];
			if(x<a[i+1]){
				ans+=x;
				a[i+1]-=x;
			}
			else{
				ans+=a[i+1];
				a[i+1]=0;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2")
#pragma GCC optimize ("trapv")

#include <bits/stdc++.h>
using namespace std;

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (x).size()
#define what_is(x) cerr << #x << " is " << x << endl;
#define wis cout<<endl<<"I already speak english, bitch"<<endl<<endl;
 
typedef long long int lli;
typedef vector<lli> vi;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef pair<ii,lli> iii;
typedef long double C; 

#define trace(args...) { string  _s =#args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
void err(istream_iterator<string> it){}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args){
    cerr <<  *it  << " : " << a << endl;
    err(++it, args...);
}

int main(){
	fastio;
	string s; cin>>s;
	//trace(s);
	vector<char> v;
	rep(i,0,sz(s)){
		if(s[i]=='1') v.pb('1');
		else if(s[i]=='0') v.pb('0');
		else if(sz(v)>0) v.erase(v.begin()+sz(v)-1);
	}
	for(auto x : v) cout<<x;
	return 0;
}


/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do smth instead of nothing and stay organized
*/

/*
tip:
 crtl+B to find errors in the code  
*/


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

typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define sz(v) ll(v.size())
int main(){
    int N,W;
    cin>>N>>W;
    vector<ll> w(N);
    vector<ll> v(N);
    rep(i,N){
        cin>>w[i]>>v[i];
    }
    vector<vector<ll> > dp(N+1,vector<ll>(W+1));
    rep(j,W+1){
        dp[0][j]=0;
    }
    rep(i,N){
        rep(j,W+1){
            if (j<w[i]){
                dp[i+1][j]=dp[i][j];
            }else{
                dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i]);
            }
        }
    }
    cout<<dp[N][W]<<' ';
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
int ans[100000],check[100000];
int main(){
  int n,max;
  cin>>n>>max;
  int v[100],w[100];
  pair<int,int> x[100];
  for(int i=0;i<n;i++){
    cin>>v[i]>>w[i];
  }
  ans[0]=0;
  check[0]=1;
  for(int i=0;i<n;i++){
    for(int j=max;j>=0;j--){
      if(check[j]=1){
	if(ans[j+w[i]]<ans[j]+v[i]){
	  ans[j+w[i]]=ans[j]+v[i];
	  check[j+w[i]]=1;
	}
      }
    }
  }
  int answer;
  for(int i=max;i>0;i--){
    if(i==max) answer=ans[i];
    else if(answer<ans[i]) answer=ans[i];
  }
  cout<<answer<<endl;
      
  return 0;
}



Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
 
ll lmin(ll x,ll y){
  if(x<y) return x;
  else return y;
}
 
int main(){
  ll n;
  cin >>n;
  ll a[n];
  ll ans=922337203685477580;
  rep(i,n){
    cin >> a[i];
    a[i]-=i+1;
  }
  sort(a,a+n);
  ll b[3]={};
  b[0]=a[n/2];
 
  rep(i,n){
    if(a[n/2]!=a[(n+i)/2]){
      b[1]=a[(n+i)/2];
      break;
    }
  }
  rep(i,n){
    if(a[n/2]!=a[(n-i)/2]){
      b[2]=a[(n-i)/2];
      break;
    }
  }
 
 
  rep(h,3){
    ll res =0;
    rep(j,n)res+=abs(a[j]-b[h]);
    ans=lmin(res,ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        s = s + t.charAt(t.length() - 1);
        if (s.equals(t)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 39024
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;
const int INF = 1e9;
const int MXN = 0;
const int MXV = 0;
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define FOR(i, L, R) for (int i = L; i != (int)R; ++i)
#define FORD(i, L, R) for (int i = L; i != (int)R; --i)
#define IOS                                                                    \
    cin.tie(nullptr);                                                          \
    cout.tie(nullptr);                                                         \
    ios_base::sync_with_stdio(false);

int main()
{
    IOS;
    string s;
    cin >> s;
    if (s[0] != s[1] || s[1] != s[2])
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
}


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

using namespace std;
int main(){

    int n;
    cin >> n;
    vector<int> w(n);
    int sum=0;
    int mini = 1000;
    for (int i = 0; i < n; i++){
        cin >> w.at(i);
        sum += w.at(i);
    }
    int div1 = 0,div2=0, log;
    for (int i = 0; i < n; i++){
        div1 += w.at(i);
        log = abs(div1 - (sum - div1));
        if(log < mini)
            mini = log;
    }

    cout << mini << endl;

    return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define INT_MAX 2147483647
#define LLINT_MAX 9223372036854775807
#define mod 1000000007
#define ll long long int
using namespace std;

int main() {
	int x, ans;
	int i = 0;
	cin >> x;
	while (true) {
		if ((i - 1)*i / 2 < x && x <= i*(i + 1) / 2) {
			ans = i;
			break;
		}
		i++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<string>
#include<map>
#define INF 1000000000
#define all(c) c.begin(),c.end()
#define uni(c) c.erase(unique(all(c)),c.end())
#define pb push_back
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> PP;
typedef pair<int,PP> PPP;
int w,h;
int dx[]={0,1,0,-1},dy[]={-1,0,1,0};
bool inf(int y,int x){
	if(x>=0&&x<w&&y>=0&&y<h)
		return true;
	return false;
}
int dij(vector<vector<int> > f, vector<int> op){
	priority_queue<PPP,vector<PPP> , greater<PPP> > que;
	int d[40][40][5];
	for(int i=0;i<h;i++)
	for(int j=0;j<w;j++)
	for(int k=0;k<4;k++)
	d[i][j][k]=INF;
	que.push(PPP(0,PP(1,P(0,0))));
	d[0][0][1]=0;
	while(!que.empty()){
		PPP p=que.top();
		int dit=p.second.first;
		P now=p.second.second;
		int nc=p.first;
		que.pop();
		if(d[now.first][now.second][dit]<nc){
			continue;
		}
		if(now.first==h-1&&now.second==w-1){
			return nc;
		}
		d[now.first][now.second][dit]=nc;
		for(int i=0;i<4;i++){
			int nx=dx[(i+dit)%4]+now.second,ny=dy[(i+dit)%4]+now.first;
			if(!inf(ny,nx))
				continue;
			if(f[now.first][now.second]==i&&nc<d[ny][nx][(i+dit)%4]){
				que.push(PPP(nc,PP((i+dit)%4,P(ny,nx))));
				continue;
			}
			if(nc+op[i]<d[ny][nx][(i+dit)%4]){
				que.push(PPP(nc+op[i],PP((i+dit)%4,P(ny,nx))));
			}
		}
		
		
	}
	
	
	//return d[h-1][w-1][(i+dit)%4];
}
int main(){
	while(cin>>w>>h,w||h){
		vector<vector<int> > f(h,vector<int>(w));
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cin>>f[i][j];
			}
		}
		vector<int> op(4);
		for(int i=0;i<4;i++)
			cin>>op[i];
		cout<<dij(f,op)<<endl;
		
	}
	return 0;
}

Measured memory_bytes: 1064