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

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

    char prev[2] = {'0', '1'};
    int ans[2] = {0, 0};
    for(int i=0;i<s.size();++i){
        if(s[i] == prev[0]) ++ans[0];
        prev[0] = (prev[0] == '0') ? '1' : '0';
        if(s[i] == prev[1]) ++ans[1];
        prev[1] = (prev[1] == '0') ? '1' : '0';
    }
    
    cout << min(ans[0], ans[1]) << endl;
    return 0;
}

Measured memory_bytes: 512
while 1:
	n3=mn=input()**3
	if n3==0:break
	i=0
	while 1:
		i+=1
		i3=i**3
		j3=int((n3-i3)**(1/3.0))**3
		if j3<i3:break
		m=n3-i3-j3
		if m<mn:mn=m
	print mn

Measured memory_bytes: 4292
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int[] a=new int[3];
    for(int i=0;i<3;i++){
      a[i]=sc.nextInt();
    }
    Arrays.sort(a);
    if(a[1]+a[0]==a[2]){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 22612
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#include<queue>
#include<functional>
#include<cassert>
#include<set>
#define rep(a,b) for(int a=0;a<b;++a)
#define REP(a,b,c,d) for(int a=b;a<c;a+=d)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
using p_i = pair<int, int>;
int main() {
	int X, Y;	cin >> X >> Y;
	if (X%Y == 0) cout << -1 << endl;
	else cout << X << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{

    int i_characterCount;
    int matchCount = 0;
    scanf("%d", &i_characterCount);

    char c_inputString[i_characterCount];
    scanf("%s", c_inputString);

    int index = 0;
    while (index < i_characterCount - 2)
    {
        if (c_inputString[index] == 65)
        {
            index++;
            if (c_inputString[index] == 66)
            {
                index++;
                if (c_inputString[index] == 67)
                {
                    matchCount++;
                }
            }
            else if (c_inputString[index] == 65)
            {
                continue;
            }
        }
        index++;
    }

    printf("%d", matchCount);

}

Measured memory_bytes: 128
def main():
    sx,sy,tx,ty = map(int,input().split())
    path =''
    ly,lx = abs(ty-sy),abs(tx-sx)
    #s->t:上から出て左から入る
    path += 'U' * ly
    path += 'R' * lx
    #t->s:下から出て右から入る
    path += 'D' * ly
    path += 'L' * lx
    #s->t:左から出て上から入る
    path += 'L' + 'U' * (ly+1)
    path += 'R' * (lx+1) + 'D'
    #t->s:右から出て下から入る
    path += 'R' +'D'*(ly+1)
    path += 'L'*(lx+1) +'U'
    print(path)
if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin, (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
	  fac[i] = fac[i-1] * i % MOD;
	  inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
	  finv[i] = finv[i-1] * inv[i] % MOD;
	}
}
//組み合わせ
long long COM (int n, int k) {
	if(n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
void solve() {
	int64 n; cin >> n;
	string s; cin >> s;
	int64 rc = 0;
	int64 gc = 0;
	int64 bc = 0;
	rep (i, n) {
		if (s[i] == 'R') rc++;
		else if (s[i] == 'G') gc++;
		else bc++;
	}
	int64 ans = rc * gc * bc;
	for (int64 i = 1; i < n; ++i) {
		for (int64 j = 0; (i + i + j) < n; ++j) {
			//j -i != k - jとなるパターンを弾く(差分が等しい、等間隔で文字を指している物はNG)
			if (s[j] != s[i + j] && s[i + j] != s[i + i + j] && s[i + i + j] != s[j]) ans--;
		}
	}
	cout << ans << endl;
	return;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 3616
#include<math.h>
#include<time.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
int a[110],n,sw;
void swaping(int x,int y)
{
	int t;
	t=a[x];
	a[x]=a[y];
	a[y]=t;
	return;
}
void bubblesort()
{
	int i,j;
	for(i=1;i<=n-1;i++)
		for(j=n;j>=i+1;j--)
			if(a[j]<a[j-1])
			{
				swaping(j-1,j);
				sw++;
			}
	return;
}
int main()
{
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	bubblesort();
	for(i=1;i<=n-1;i++)
		printf("%d ",a[i]);
	printf("%d\n%d\n",a[n],sw);
	return 0;
}


Measured memory_bytes: 2120
'use strict'
function main(inp) {
  inp = inp.trim().split('\n');
  const N = inp[0].split(' ')[0];
  const K = inp[0].split(' ')[1];
  const P = inp[1].split(' ').map(x => x*1).sort((a,b) => {return a-b});
  let ans = 0;
  for(let i = 0; i < K; i++){
  	ans += P[i];
  }
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29748
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int l, r;
    int output = 0;
    for( int i = 0; i < N; ++i ) {
        cin >> l >> r;
        output += r - l + 1;
    }
    cout << output << endl;
    return 0;
}


Measured memory_bytes: 888
N,T = list(map(int,input().split()))
CT = []
for i in range(N):
    CT.append(list(map(int,input().split())))
out = 10**5
ind = N
for i in range(N):
    if CT[i][1]<=T and CT[i][0]<out:
        out = CT[i][0]
        ind = i
if ind==N:
    print("TLE")
else:
    print(out)


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

int main(){
    int n,k,x,y;
    cin >> n >> k;
    while(k--){
        cin >> x >> y;
        cout << (min(min(n-x,x-1),min(n-y,y-1))%3+1) << endl;
    }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define repp(i, l, r) for (long long i = (l); i < (r); i++)
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define per(i, n) for (long long i = (n); i >= 0; --i)
#define all(v) v.begin(), v.end()
const int INF = 2147483647;  // int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//ミョ(-ω- ?)
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//解説
    ll n, m;
    static string s, t;
    cin >> n >> m >> s >> t;
    ll g = gcd(n, m);
    ll l = lcm(n, m);
    ll a = n / g;
    ll b = m / g;
    bool can = true;
    rep(i, g) {
        if (s[a*i] != t[b*i]) can = false;
    }
    if (can)
        cout << l << "\n";
    else
        cout << -1 << "\n";
    return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
	int n;
	scanf("%d", &n);
	string s;
	cin >> s;
	rep(i, s.size()) {
		int x = s[i] - 'A'; //'A'=65、'B'=66...、'Z'=90。'A' = 0, 'B' = 1... 'Z' = 26 とするため、s[i] - 'A'。
		x = (x + n) % 26; //26を超えた数値になっても、またAからになるように
		char ans = x + 'A'; //元々は'A'=65、'B'=66...、'Z'=90 であるため、+ 'A' つまり、+65 をして文字の置き換え
		cout << ans;
	}
	cout << endl;
}

Measured memory_bytes: 3708
(defun f(a b c)
  (let ((r (- c (- a b))))
	(if (< r 0)
	  0
	  r)))

(defun splitat (c line)
  (labels ((rec (line acc)
				(let ((pos (position-if (lambda(cc) (char= c cc)) line)))
				  (if pos
					  (rec (subseq line (1+ pos)) (cons (subseq line 0 pos) acc))
					(nreverse (cons line acc))))))
	(rec line nil)))
(defun g()
  (let* ((line (read-line nil nil))
		 (splited (mapcar #'parse-integer (splitat #\space line))))
  (format t "~A~%" (f (car splited) (cadr splited) (caddr splited)))))
(g)


Measured memory_bytes: 13024
def get_answer(ki):
    """
    めも
    配列コピーはしない
    入力テキスト配列から数値配列の変換は行わない（配列サイズが大きくなる）
    for,if,dictは使わない
    """
    k0 = ki[0].split(" ")
    n = int(k0[0])
    q = int(k0[1])
    q_index = [0] * n
    for k in ki[-q:]:
        k = k.split(" ")
        q0 = int(k[0])
        q1 = int(k[1])
        q_index[q0 - 1] += q1

    score = [0] * n

    t_index = []
    for i in range(0, n + 1):
        t_index.append([])
    for ki_n in ki[1:-q]:
        k = ki_n.split(" ")
        n0 = int(k[0])
        n1 = int(k[1])
        t_index[n0].append(n1)
        t_index[n1].append(n0)

    t_stack = [1]
    s_stack = [0]
    r_flag = [0] * n
    while len(t_stack) > 0:
        i = t_stack.pop()
        s = s_stack.pop()
        if r_flag[i - 1]:
            continue
        r_flag[i - 1] = 1
        s += q_index[i - 1]
        score[i - 1] += s
        t_stack += t_index[i]
        s_stack += [s] * len(t_index[i])

    ss = [str(s) for s in score]
    return " ".join(ss)


if __name__ == "__main__":
    input_ki = []
    while True:
        try:
            input1 = input()
            if not input1:
                break
            if len(input1) == 0:
                break
            input_ki.append(input1)
        except EOFError:
            break
    print(get_answer(input_ki))


Measured memory_bytes: 107536
n = int(input())
guidebook = []
for i in range(n):
    a = list(input().split())
    a.append(i+1)
    a[1] = int(a[1])
    guidebook.append(a)

guidebook = sorted(guidebook,key=lambda x:x[1],reverse=True)
guidebook = sorted(guidebook,key=lambda x:x[0])
for i in range(n):
    print(guidebook[i][2])

Measured memory_bytes: 3064
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
struct SegmentTree{
  int n_, n = 1;
  int MAX = 2147483647;
  vector<int> v;
  SegmentTree(int n_):n_(n_){
    while(n < n_) n *= 2; // 2の冪乗が扱いやすい
    v.resize(2*n, MAX);
  }
  // k番目の要素をaに変更
  void update(int k, int a){
    k += n - 1; // ノード番号にする
    v[k] = a;
    while(k > 0){
      k = (k - 1) / 2;
      v[k] = min(v[2 * k + 1], v[2 * k + 2]);
    }
  }
  // [a, b)の最小値,kはノード番号
  // query(a,b,0,0,n)を呼ぶ
  int query_(int a, int b, int k, int l, int r){
    if(b <= l || r <= a) return MAX;
    if(a <= l && r <= b) return v[k];
    int vl = query_(a, b, 2 * k + 1, l, (l + r) / 2);
    int vr = query_(a, b, 2 * k + 2, (l + r) / 2, r);
    return min(vl, vr);
  }

  int query(int a, int b){
    return query_(a, b, 0, 0, n);
  }

};
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin>>n>>q;
  SegmentTree seg(n);
  FOR(i,0,q){
      int com;
      int x, y;
      cin>>com>>x>>y;
      if(com == 0){
          seg.update(x, y);
      } else {
          cout<<seg.query(x, y + 1)<<endl;
      }
  }
  return 0;
}


Measured memory_bytes: 3796
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		long ans=1;
		long mod=1000000007;
		for(int i=0; i<n; i++){
			a[i]=sc.nextInt();
		}
		int[] pp=new int[3];
		for(int i=0; i<n; i++){
			long count=0;
			int k=0;
			for(int j=0; j<3; j++){
				if(pp[j]==a[i]){
					k=j;
					count++;
				}
			}
			pp[k]++;
			ans=(ans*count)%mod;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 53340
#include<bits/stdc++.h>
#define fo(i, x, y) for(int i = x, B = y; i <= B; i ++)
#define ff(i, x, y) for(int i = x, B = y; i <  B; i ++)
#define fd(i, x, y) for(int i = x, B = y; i >= B; i --)
#define ll long long
#define pp printf
#define hh pp("\n")
using namespace std;

const int N = 3005;

int n, mo;

ll s[N][N], c[N][N];

ll ksm(ll x, ll y, ll mo) {
	ll s = 1;
	for(; y; y /= 2, x = x * x % mo)
		if(y & 1) s = s * x % mo;
	return s;
}

int main() {
	scanf("%d %d", &n, &mo);
	fo(i, 0, n + 1) {
		if(i == 0) s[i][0] = 1;
		fo(j, 1, i) s[i][j] = (s[i - 1][j] * j + s[i - 1][j - 1]) % mo;
		c[i][0] = 1;
		fo(j, 1, i) c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mo;
	}
	ll ans = 0;
	fo(i, 0, n) {
		ll xs = (i & 1 ? mo - 1 : 1) * c[n][i] % mo;
		xs = xs * ksm(2, ksm(2, n - i, mo - 1), mo) % mo;
		ll x = ksm(2, n - i, mo), t = 1;
		fo(j, 0, i) {
			ans = (ans + xs * t % mo * s[i + 1][j + 1]) % mo;
			t = t * x % mo;
		}
	}
	pp("%lld\n", ans);
}


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

#ifdef MYDEBUG
#define dbp(x) cout<<#x<<": "<<x<<endl
#define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl
#define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl
#else
#define dbp(x)
#define dbp2(x,y)
#define dbp3(x,y,z)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define all(x) x.begin(), x.end()
#define rep(i, from, to) for(int i=from; i<to; ++i)

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last)
      out << ",";
  }
  out << "]";
  return out;
}
struct edge {
  ll from, to, cost;
  edge(ll f, ll t, ll c) {
    from = f;
    to = t;
    cost = c;
  }
};

typedef struct edge edge;
const long long maxn = 1010;
int n, m;
const ll INF = 1e18 * -1;
vector<edge> g;
ll dist[maxn];
void solve() {
  cin >> n >> m;
  for (long long i = 0; i < m; ++i) {
    ll a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    g.push_back(edge(a, b, c));
  }
  //start is 0
  fill(dist, dist + maxn, INF);
  dist[0] = 0;
  int i = 0;
  bool chang = true;
  int last = 0;
  while (chang) {
    chang = false;
    for (size_t k = 0; k < g.size(); ++k) {
      edge e = g[k];
      if (dist[e.from] != INF && e.cost + dist[e.from] > dist[e.to]) {
        dist[e.to] = e.cost + dist[e.from];
        if (e.to == n - 1) {
          last = i;
        }
        chang = true;
        if (i == n + (int) 11.4514) {
          if (last >= n - 1) {
            cout << "inf" << endl;
          } else {
            cout << dist[n - 1] << endl;
          }
          return;
        }
      }
    }
    i++;
  }
  cout << dist[n - 1] << endl;
}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

int main() {

	int n;
	cin >> n;

	map<char, bool> m;

	for (int i = 0; i < n; ++i)
	{
		char c;
		cin >> c;
		m[c] = true;
	}

	if (m.size() == 4)
		cout << "Four" << endl;
	else
		cout << "Three" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define ios() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
//constexpr int MOD = 10e9+7;
//constexpr int INF = 1LL << 60;
inline int in() {int x; cin >> x; return x;}
template <typename T> inline void out(const T& x) {cout << x << endl;}
template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}
template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
  if (a < b)
    gcd(b, a);
  int r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}
void eratos(bool * isPrime,int max){
  fill(isPrime,isPrime + max,true);
  isPrime[0] = false; 
  isPrime[1] = false; 
  for(int i=2; i<=max/i; ++i) 
      if(isPrime[i]) 
          for(int j=2; j<=max/i; ++j) 
              isPrime[i*j] = false;    
}
//

signed main()
{
  ios();
  int A = in();
  int B = in();
  out((A-1)*(B-1));
}


Measured memory_bytes: 256
import heapq

N, M = tuple(map(int, input().split()))
A = list(map(lambda a: -1*int(a), input().split()))
heapq.heapify(A)

for _ in range(M):
    x = heapq.heappop(A)
    heapq.heappush(A, -(-x//2))

print(-1*sum(A))

Measured memory_bytes: 14180
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll int, ll int>
#define ff first
#define ss second
#define debug(n) cout << "DEBUG1 " << n << "\n";
#define debug2(n, m) cout << "DEBUG2 " << n << ' ' << m << "\n";
#define debug3(n, m, x) cout << "DEBUG3 " << n << ' ' << m << ' ' << x << "\n";
#define debug4(n, m, x, y) cout << "DEBUG4 " << n << ' ' << m << ' ' << x << ' ' << y << "\n";
#define ss_def stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) rrn < 0) n = 0
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
using namespace std;
void yes() {
    cout << "Yes\n";
    return;
}
void no() {
    cout << "No\n";
    return;
}
int hamm_dist(string str, string tar) {
	int cnt = 0;
	for (int i = 0;i < str.length();i++) {
		if (str[i] != tar[i]) cnt++;
	}
	return cnt;
}
const ll int MOD = 1e9 + 7;
const int mxN = 2e5 + 1;
vector<int> adjlist[mxN];
bool ck[mxN];
int cnt = 0;
int dfs(int u) {
	ck[u] = true;
	cnt++;
	for (int v : adjlist[u]) {
		if (!ck[v]) dfs(v);
	}
	return cnt;
}
void solve(int case_no) {
    // implementation
    int n, m;
    cin >> n >> m;
    for (int i = 0;i < m;i++) {
    	int u, v;
    	cin >> u >> v;
    	adjlist[u].push_back(v);
    	adjlist[v].push_back(u);
	}
	int best = 0;
	for (int i = 1;i <= n;i++) {
		if (!ck[i]) {
			cnt = 0;
			best = max(best, dfs(i));
		}
	}
	cout << best << endl;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    srand(time(NULL));
    int t = 1;
//    cin >> t;
    for (int i = 1;i <= t;i++) solve(i);
}
/*

*/

Measured memory_bytes: 20968
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <map>
#include <time.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  string s;
  cin >> s;
  string ans = "";
  rep(i, 0, s.length()) {
    if(s[i] == 'B') {
      if(ans.length()) ans.erase(ans.length() - 1, 1);
    }else {
      ans += s[i];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
N, M = map(int,input().split())
tp = [0,0,0,""]
L = []
for i in range(M):
    tp = [i] +list(map(int,input().split())) +[0]
    L.append(tp)
#print(L)
L.sort(key=lambda x:(x[1],x[2]))
c = 1
d = 0
for i in range(M):
    if d == L[i][1]:
        c += 1
        L[i][3] = c
    else:
        L[i][3] = 1
        c = 1
        d = L[i][1]

#print(L)

L.sort()
#print(L)
for i in range(M):
    print(str(L[i][1]).zfill(6)+str(L[i][3]).zfill(6))


Measured memory_bytes: 39928
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    N = int(input())
    A = list(map(int, input().split()))
    A = collections.deque(A)

    count = 0
    dai = 0
    mae = 0
    while len(A) > 0:
        a = A.popleft()
        if a >= mae + dai:
            mae = a
            dai = 0
        else:
            dai = mae + dai - a
            mae = a
            count += dai
    print(count)





if __name__ == '__main__':
    solve()

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

using namespace std;

#define all(x) begin(x), end(x)

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

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

    int n, m;
    cin >> n >> m;

    vi a(n + 1, 0);
    vi b(n + 1, 0);
    for (int i = 0; i < m; ++i) {
        int x;
        cin >> x;

        b[x] = 1;
    }

    constexpr int MOD = 1e9 + 7;
    a[0] = 1;
    for (int i = 0; i < n; ++i) {
        if (b[i]) continue;
        for (int j = 1; j <= 2; ++j) {
            if (i + j <= n) {
                a[i + j] += a[i];
                a[i + j] %= MOD;
            }
        }
    }

    cout << a[n] << '\n';
    
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repA(i,n) for(int i=n; i>=0; i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (ll)(a.size())
typedef long long ll;
typedef long double ld;
const ll mod = 998244353;//1e9+7

void solve() {
  int x;
  rep(i,5) {
    cin>>x;
    if(x == 0)  cout<<(i+1);
  }
}


int main() {
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  #endif
  ll t = 1;
//  cin>>t;
  rep(i,t)  {
    solve();
    cout<<'\n';
  }
  return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<map>
#include<cmath>
#include<cstdio>
#define ll long long
#define lson (rt<< 1)
#define rson (rt<< 1 | 1)
#define gmid ((l+r)>> 1 )
using namespace std;

const int maxn=20000050;
int main()
{
	ll n,ans=0,d; 
	cin>>n>>d;
	for(int i=1;i<=n;++i)
	  {
	  	  ll x,y;
	  	  cin>>x>>y;
	  	  if((x*x+y*y)<=(d*d)) ans++;
	  	  //cout<<" "<<x*x+y*y<<" "<<d*d<<endl;
	  } 
	cout<<ans<<endl;  
}


Measured memory_bytes: 3624
//============================================================================
// Name        : AOJ.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>

using namespace std;

int main() {

	int a,b;
	cin>>a>>b;
	int n;
	cin>>n;
	int s,f;
	int flg=0;
	for(int i=0;i<n;++i){
		cin>>s>>f;
		if(((a>=s&&a<f)||((b-1>=s)&&(b-1<f)))||(a<s&&b>f))flg=1;
	}
	cout<<flg<<endl;
	return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int MOD = 1000000007;
const ll INF = 1LL << 60;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    ll sum = 0;
    sort(a.rbegin(), a.rend());
    vector<ll> store;
    store.push_back(a[0]);
    ll pin = -1;
    for (ll i = 1; i < n; i++)
    {
        if (pin == a[i])
        {
            store.push_back(a[i]);
        }
        else
        {
            store.push_back(a[i]);
            store.push_back(a[i]);
            ll pin = a[i];
        }
    }
    for (int i = 0; i < n-1; i++)
    {
        sum += store[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 8996
#include<bits/stdc++.h>
#define mod 1000000009
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n,a,ans=0;
    cin>>n;
    for (int i=0;i<n;i++) {
        cin>>a;
        ans += a-1;
    }
    cout<<ans<<"\n";
}


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

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        int k = Integer.parseInt(f.readLine());
        String str = f.readLine();
        if(str.length() <= k) out.println(str);
        else out.println(str.substring(0, k)+"...");


        out.close();
    }
}


Measured memory_bytes: 36284
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	var f [3]bool
	for _, c := range s {
		f[c-'a'] = true
	}

	if f[0] && f[1] && f[2] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1768
<?php
fscanf(STDIN, "%s", $a);
$cs = count_chars($a, 1);
$ln = strlen($a);
$x = 1;
for ($i = 0; $i < $ln; $i++) {
	$c = ord($a[$i]);
	$x += $ln - $i - $cs[$c];
	$cs[$c]--;
}
echo $x;

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

#define MAX 1024

int LCS[MAX][MAX];

int solve(string s1,string s2){
  for(int i=1;i<=s1.length();i++){
    for(int j=1;j<=s2.length();j++){
      if(s1[i-1]==s2[j-1])
	LCS[i][j]=LCS[i-1][j-1]+1;
      else
	LCS[i][j]=max(LCS[i][j-1],LCS[i-1][j]);
    }
  }
  return LCS[s1.length()][s2.length()];
}


int main(){
  string s1, s2;
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    for(int i=0;i<MAX;i++){
      for(int j=0;j<MAX;j++){
        LCS[i][j] = 0;
      }
    }
    cin>>s1>>s2;
    cout<<solve(s1,s2)<<endl;
    /*
    for(int i=0;i<=s1.length();i++){
      for(int j=0;j<=s2.length();j++){
	cout << LCS[i][j] << "  " ;
      }
      cout << endl;
    }*/
  }

}

Measured memory_bytes: 5312
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#define fi first
#define se second
#define pb(i) push_back(i)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define mes(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e6+10;
const int INF = 0x3f3f3f3f;
const int inf = - INF;
const int mod = 1e9+7;
const double pi = acos(-1.0);

int a[205];
int main(){
    int n;
    cin>>n;
    rep(i,0,n-1)
        cin>>a[i];
    ll ans=INF;
    rep(i,-100,100){
        ll t=0;  
        rep(j,0,n-1){
            t+=(a[j]-i)*(a[j]-i);
        }
        ans=min(ans,t);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define MAX (int)1e5
#define NIL -1
int flag = 0;
vector<int> G[MAX];
queue<int> qu;
int vis[MAX];
int n;
int ind, tmp;

void bfs(int u,int k) {
	qu.push(u);
	vis[u] = k;
	while (not qu.empty()) {
		int u = qu.front(); qu.pop();
		for (int j = 0; j < G[u].size(); j++) {
			int v = G[u][j];
			if (vis[v] == NIL) {
				vis[v] = k;
				qu.push(v);
			}
		}
	}
}

void calc() {
	int id = 1;
	for (int i = 0; i < n; i++) vis[i] = NIL;
	for (int i = 0; i < n; i++) {
		if (vis[i] == NIL) bfs(i, id++);
	}
}

int main() {
	int m, q;
	cin >> n >> m;
	bool flag = 0;
	for (int i = 0; i < m; i++) {
		cin >> ind >> tmp;
		G[ind].push_back(tmp);
		G[tmp].push_back(ind);
	}
	calc();
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> ind >> tmp;
		if (vis[ind] == vis[tmp])
		cout << "yes" << endl;
		else cout << "no" << endl;
	}
}

Measured memory_bytes: 9016
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int n,m;
    cin >> n >> m;
    ll a;
    priority_queue<ll> q;
    REP(i,n){
        cin >> a;
        q.push(a);
    }
    REP(i,m){
        ll tmp = q.top();
        q.pop();
        q.push(tmp / 2);
    }
    ll ans = 0;
    REP(i,n){
        ans += q.top();
        q.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 1400
import sys
read = sys.stdin.buffer.read
N, *AB = map(int, read().split())
A,B=AB[::2],AB[1::2]
A.sort()
B.sort(reverse=True)
pos=(N+1)//2-1
if N%2==1:
    ans = B[pos]-A[pos]+1
else:
    ans = (B[pos]+B[pos+1])-(A[pos]+A[pos+1])+1
print(ans)

Measured memory_bytes: 122040
using System.Text;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = int.Parse(line[1]);
        var q = int.Parse(line[2]);
        var a = new int[n + 1];
        for (int i = 0; i < q; i++)
        {
            var t = int.Parse(Console.ReadLine().Trim()) - 1;
            if (t == 0) { a[1]++; a[n]--; }
            else if (t == n - 1) { a[0]++; a[n - 1]--; }
            else
            {
                a[0]++; a[t]--;
                a[t + 1]++; a[n]--;
            }
        }
        getAns(a, n, k);
    }
    static void getAns(int[] a, int n, int k)
    {
        var sb = new StringBuilder();
        var w = 0;
        for (int i = 0; i < n; i++)
        {
            w += a[i];
            sb.Append(k - w > 0 ? "Yes\n" : "No\n");
        }
        Console.WriteLine(sb);
    }
}


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

int main()
{
	int n, x, t;
	cin >> n >> x >> t;

	if (n % x == 0) {
		cout << n / x * t << endl;
	}
	else {
		cout << (n / x + 1) * t << endl;
 	}

	return 0;
}

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

using namespace std;

namespace {
    class Dice {
    private:
        int n1;
        int n2;
        int n3;
        int n4;
        int n5;
        int n6;
    public:
        Dice(int _n1, int _n2, int _n3, int _n4, int _n5, int _n6):
            n1(_n1), n2(_n2), n3(_n3), n4(_n4), n5(_n5), n6(_n6) {}
        ~Dice() = default;

        int right(int top, int front) const {
            vector<int> f = {top, front};
            vector<int> r = {front, top};

            vector<int> v1{n1, n2, n6, n5, n1};
            if (v1.end() != search(v1.begin(), v1.end(), f.begin(), f.end())) {
                return n3;
            }
            if (v1.end() != search(v1.begin(), v1.end(), r.begin(), r.end())) {
                return n4;
            }


            vector<int> v2{n1, n3, n6, n4, n1};
            if (v2.end() != search(v2.begin(), v2.end(), f.begin(), f.end())) {
                return n5;
            }
            if (v2.end() != search(v2.begin(), v2.end(), r.begin(), r.end())) {
                return n2;
            }

            vector<int> v3{n2, n3, n5, n4, n2};
            if (v3.end() != search(v3.begin(), v3.end(), f.begin(), f.end())) {
                return n1;
            }
            if (v3.end() != search(v3.begin(), v3.end(), r.begin(), r.end())) {
                return n6;
            }
            return -1;
        }
    };
}

int main() {
    int n1,n2,n3,n4,n5,n6;
    cin >> n1 >> n2 >> n3 >> n4 >> n5 >> n6;

    Dice d(n1,n2,n3,n4,n5,n6);

    int n;
    cin >> n;

    for (int i = 0; i < n; i++) {
        int top, front;
        cin >> top >> front;

        cout << d.right(top, front) << endl;
    }

    return 0;
}

Measured memory_bytes: 1212
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
double ans=0,x;
int main(){
	cin>>n;
	while (n--){
		cin>>x>>s;
		if (s[0]=='J') ans+=x;
		else ans+=x*380000.0;
	}
	cout<<ans;
}

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

#define MAX 100

int N;
int a[MAX];

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

	sort( a, a + N );
	int ans = a[N - 1] - a[0];

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int A[1000000], n;

int binarySearch(int key) {
	int left = 0;
	int right = n;
	int mid;
	while(left <= right) {
		mid = (left + right) / 2;
		if(A[mid] == key) return 1;
		if(key < A[mid]) right = mid-1;
		else if(key > A[mid]) left = mid+1; 
	}
	return 0;	
}

int main() {
	int i, q, key, sum = 0;
	
	scanf("%d", &n);
    for(int i = 0; i < n; i++) { 
        scanf("%d", &A[i]);
    }
    
    scanf("%d", &q);
    for(int i = 0; i < q; i++) {
	    scanf("%d", &key);
		if( binarySearch(key)) sum++; 
	}
	printf("%d\n", sum);
	
	return 0;    
}

Measured memory_bytes: 2948
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

bool check_yymm(string s) {
    int i = stoi(s.substr(2, 2));
    return 1 <= i && i <= 12;
}

bool check_mmyy(string s) {
    int i = stoi(s.substr(0, 2));
    return 1 <= i && i <= 12;
}

int main(void) {
    string S;
    cin >> S;
    auto yymm = check_yymm(S);
    auto mmyy = check_mmyy(S);
    if (yymm && mmyy) cout << "AMBIGUOUS" << endl;
    else if (yymm) cout << "YYMM" << endl;
    else if (mmyy) cout << "MMYY" << endl;
    else cout << "NA" << endl;
}


Measured memory_bytes: 256
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int p;
  cin >> p;
  cout << p/500*500 << endl;
}


Measured memory_bytes: 3184
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V<V<T>>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(){cout << -1 << '\n'; exit(0);}
inline void fin(){cout << 0 << '\n'; exit(0);}
const int INF = 1e18;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s; cin >> s;
    int res = SZ(s);
    REP(i,SZ(s)-1){
        if(s[i] != s[i+1]) chmin(res,max(i+1,SZ(s)-i-1));
    }
    cout << res << '\n';
}

Measured memory_bytes: 3772
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
    int n, k;
    double n2;
    scanf("%d %d",&n,&k);
    n2 = n;
    int bit[n], b[k];
    int selection[n];
    for(int i=0;i<k;i++)
        scanf("%d",&b[i]);
    for(int i=0;i<n;i++)
    {
        bit[i]=i;
        selection[i]=0;
    }
    for(int i=0;i<pow(2,n2);i++)
    {
        int x=i;
        int j=0;
        while(x>1)
        {
            selection[j]=x%2;
            j++;
            x=x/2;
        }
        selection[j]=x;
        bool judge=true;
        for(int t= 0;t<k;t++)
            if(selection[b[t]]==0)
                judge=false;     

        if(judge==true)
        {
            printf("%d:",i);
            for(int t=0;t<n;t++)
                if(selection[t]==1)
                    printf(" %d",bit[t]);
            printf("\n");
        }
    }
    return 0;
}



Measured memory_bytes: 2928
h, w, k = map(int,input().split())
C = [input() for i in range(h)]
ans = 0


for i in range(2**h):
    for j in range(2**w):
        A = [[0] * w for i in range(h)]
        for ii in range(h):
            for jj in range(w):
                if C[ii][jj] == "#":
                    A[ii][jj] = 1

        # print(A)
        
        ib = format(i,"b").zfill(h)
        jb = format(j,"b").zfill(w)
        # print(ib,jb)

        for ii in range(h):
            for jj in range(w):
                if ib[ii] == "1" or jb[jj] == "1":
                    A[ii][jj] = 0

        ans0 = sum([sum(A[ii]) for ii in range(h)])
        if ans0 == k:
            ans += 1
print(ans)


Measured memory_bytes: 69600
#include"bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
#define int long long int
#define pb push_back
#define mp make_pair
#define loop(i,x,n) for(int i=x;i<=n;i++)
#define rloop(i,x,n) for(int i=x;i>=n;i--)
#define ff first
#define ss second
#define N4RUTO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 
typedef tree<int, null_type, less<int>, rb_tree_tag,  
// typedef tree<int, null_type, less_equal<int>, rb_tree_tag,  
tree_order_statistics_node_update>
ordered_set;
 
int32_t main(){
	N4RUTO;
	int t;
	t=1;
	// cin>>t;
	while(t--){
		int n;
		cin>>n;
		string ans = "";
		while(n>0){
			int x = n%26;
			if(x==0) x=26, n--;
			ans+=char(x+'a'-1);
			if(n==26) break;
			n/=26;
		}
		reverse(ans.begin(),ans.end());
		cout<<ans;
	}
	return 0;
}

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

int n, s, ans, a[100005];
int main()
{
	int i;
	cin >> n;
	for (i = 0; i < n; i++) {
		scanf ("%d", &a[i]);
	}
	sort(a, a + n);
	s = 1;
	for (i = 1; i < n; i++) {
		if (a[i - 1] != a[i]) {
			if (a[i - 1] <= s) ans += a[i -1];
			s = 1;
		} else s++;
	}
	if (a[i - 1] <= s) ans += a[i - 1];
	cout << n - ans;
    return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<iostream>
using namespace std;
string a;
int main()
{
	cin>>a;
	if(a=="Sunny") printf("Cloudy\n");
	if(a=="Cloudy") printf("Rainy\n");
	if(a=="Rainy") printf("Sunny\n");
	return 0;
}

Measured memory_bytes: 256
module Main where

import           Control.Monad
import           Debug.Trace
import qualified Data.Vector.Unboxed           as VU
import           Data.List
import qualified Data.ByteString               as BS
import qualified Data.ByteString.Char8         as BSC8
import           Data.Char
import           Data.Maybe

tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined

getVUIntFromInputLineAtBSC8 :: IO (VU.Vector Int)
getVUIntFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
getVUListIntFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine

readInt = fst . fromJust . BSC8.readInt
readIntTuple = tuplify2 . map readInt . BSC8.words
readIntList = map readInt . BSC8.words

getInt = readInt <$> BSC8.getLine
getIntList = readIntList <$> BSC8.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BSC8.getLine
getIntMatrix = map readIntList . BSC8.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BSC8.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BSC8.getLine
getIntTuples = map readIntTuple . BSC8.lines <$> BSC8.getContents

main :: IO [()]
main = do

    aN <- getInt
    aA <- getIntList

    let aAP    = map (\x -> (x - 1, 1)) aA

    let cntAP  =  VU.accum (+) (VU.replicate aN 0) aAP
    let combiCntAp = VU.map (con2) cntAP
    let sum = VU.sum combiCntAp
    let cntSum = map (\x -> sum - (combiCntAp VU.! (x-1)) + (con2 (cntAP VU.! (x-1) - 1 ))) aA
    mapM (putStrLn . show) cntSum

con2 :: Int -> Int
con2 0 = 0
con2 1 = 0
con2 x = div (x * (x - 1)) 2



Measured memory_bytes: 29820
D,G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]
ans = 10**9
from math import ceil
for i in range(2**D):
    now = 0
    score = 0
    for j in range(D):
        if i>>j & 1:
            now += pc[j][0]
            score += pc[j][0]*100*(j+1) + pc[j][1]

    if score >= G:
        ans = min(ans,now)
    else:
        for j in reversed(range(D)):
            if i>>j & 1 == 0:
                if ceil((G-score)/(100*(j+1))) < pc[j][0]:
                    now += ceil((G-score)/(100*(j+1)))
                    break
        else:
            continue

        if now==0:
            continue
        ans = min(ans,now)

print(ans)
                



Measured memory_bytes: 41072
a, b, c = map(int, input().split())
tmp = 0
if b > c:
    tmp = b
    b = c 
    c = tmp 

if a > b:
    tmp = a
    a = b
    b = tmp

if b > c:
    tmp = b
    b = c 
    c = tmp 

print(a, b, c)


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

int main() {
    li n;
    cin >> n;
    string a, b;
    cin >> a >> b;

    for (li overlap = n; overlap >= 0; --overlap) {
        string aa = a.substr(n - overlap);
        string bb = b.substr(0, overlap);
        if (aa == bb) {
            cout << n * 2 - overlap << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
/*************************************************************************
	> File Name: 1.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Blog: https://blog.csdn.net/Pig_cfbsl 
	> Created Time: 2020/5/2 20:44:09
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
int num[2020];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	int n=read(),k=read(),x,y;
	For(i,1,k){
		x=read();
		For(i,1,x){
			y=read();
			num[y]++;
		}
	}
	int ans=0;
	For(i,1,n)
		if(num[i]==0) ans++;
	printf("%d\n",ans);

	
	return 0;
}


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

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }


int main() {
  lint n; cin >> n;
  vector< vector<char> > c(n,vector<char>(10));
  for(lint i=0;i<n;i++) {
    for(lint j=0;j<10;j++) {
      cin >> c[i][j];
    }
  }

  lint ans=0;
  map<vector<char>,int> mp;
  for(lint i=0;i<n;i++) {
    sort(c[i].begin(),c[i].end());

    if(mp.find(c[i]) != mp.end()) { ans += mp.at(c[i]); }
    mp[c[i]]++;
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 16640
MAXV = 10000

if __name__ == '__main__':
    n = int(raw_input())

    # input, 1-origin, range [1, n]
    A = [0] + map(int, raw_input().split())

    # output, 1-origin
    B = A[:]

    # counter, 0-origin: range [0, MAXV]
    C = [0 for i in range(MAXV + 1)]

    for i in range(1, n + 1):
        C[A[i]] += 1

    # let the number of elements that are <= x be f(x)
    # then f(x) = x + f(x-1)
    for i in range(1, MAXV + 1):
        C[i] += C[i - 1]

    for i in range(n, 0, -1):
        B[C[A[i]]] = A[i]
        C[A[i]] -= 1

    for i in range(1, n + 1):
        print B[i],
    print 


Measured memory_bytes: 175360