akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

const int MAX=401;

int main(){
  int sq[MAX][MAX];
  int N;

  while(1){
    int k=0;
    cin>>N;
    if(N==0)break;

    for(int i=0;i<MAX;i++){
      for(int j=0;j<MAX;j++){
	sq[i][j]=-1;
      }
    }

    sq[200][200]=k++;
    for(int i=0;i<N-1;i++){
      int n,d;
      cin>>n>>d;
      for(int i=1;i<MAX;i++){
	for(int j=1;j<MAX;j++){
	  if(sq[i][j]==n){
	    if(d==0) sq[i][j-1]=k++;
	    else if(d==1) sq[i+1][j]=k++;
	    else if(d==2) sq[i][j+1]=k++;
	    else if(d==3) sq[i-1][j]=k++;
	  }
	}
      }
    }
    
    int max_x1,max_y1,max_x2,max_y2;
    bool flag_x,flag_y;
    flag_x=flag_y=0;
    
    for(int i=1;i<MAX;i++){
      for(int j=1;j<MAX;j++){
	if(sq[j][i]!=-1&&flag_x==0){
	  max_x1=i;
	  flag_x=1;
	}
	if(sq[i][j]!=-1&&flag_y==0){
	  max_y1=i;
	  flag_y=1;
	}
	if(sq[j][i]!=-1) max_x2=i;
	if(sq[i][j]!=-1) max_y2=i;
      }
    }
    cout<<(max_x2-max_x1)+1<<" "<<(max_y2-max_y1)+1<<endl;
  }
  return 0;
}

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

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

    map<char, int> m;

    for (auto& e : s) {
        m[e]++;
    }

    cout << (m.size() == 2 && all_of(m.begin(), m.end(), [&](auto a){ return a.second == 2; }) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	S := getStdin()
	T := getStdin()

	flag := true
	for i := 0; i < len(S); i++ {
		if S[i] != T[i] {
			flag = false
			break
		}
	}

	if flag {
		fmt.Printf("Yes\n")
	} else {
		fmt.Printf("No\n")
	}
}

func getStdin() string {
	sc.Scan()
	return sc.Text()
}
func getStdinInt() int {
	sc.Scan()
	rtn, _ := strconv.Atoi(sc.Text())
	return rtn
}
func getStdinInt64() int64 {
	sc.Scan()
	rtn, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return rtn
}
func getStdinIntArr() []int {
	sc.Scan()
	str := sc.Text()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}
func getStdinIntArr64() []int64 {
	sc.Scan()
	str := sc.Text()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}


Measured memory_bytes: 1756
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(0,a+1) :
    for j in range(0,b+1) :
        for k in range(0,c+1) :
            if 500*i + 100*j + 50*k == x :
                count += 1
print(count)


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

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

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

int main(void){

    int k;
    cin >> k;
    string s;
    cin >> s;

    if(s.size() <= k) cout << s << endl;
    else{
        cout << s.substr(0 ,k) << "..." << endl;
    }

    return 0;
}

Measured memory_bytes: 3640
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    ll X, Y;
    cin >> X >> Y;
    if(abs(X - Y) <= 1) {
        cout << "Brown" << endl;
    } else {
        cout << "Alice" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
map<string, char> n;
map<char, string> m;
 
void init1()
{
    n["101"] = ' ';
    n["000000"] = '\'';
    n["000011"] = ',';
    n["10010001"] = '-';
    n["010001"] = '.';
    n["000001"] = '?';
    n["100101"] = 'A';
    n["10011010"] = 'B';
    n["0101"] = 'C';
    n["0001"] = 'D';
    n["110"] = 'E';
    n["01001"] = 'F';
    n["10011011"] = 'G';
    n["010000"] = 'H';
    n["0111"] = 'I';
    n["10011000"] = 'J';
    n["0110"] = 'K';
    n["00100"] = 'L';
    n["10011001"] = 'M';
    n["10011110"] = 'N';
    n["00101"] = 'O';
    n["111"] = 'P'; 
    n["10011111"] = 'Q';
    n["1000"] = 'R';
    n["00110"] = 'S'; 
    n["00111"] = 'T';
    n["10011100"] = 'U';
    n["10011101"] = 'V';
    n["000010"] = 'W';
    n["10010010"] = 'X';
    n["10010011"] = 'Y';
    n["10010000"] = 'Z';
}
 
void init2()
{
    m['A'] = "00000";
    m['B'] = "00001";
    m['C'] = "00010";
    m['D'] = "00011";
    m['E'] = "00100";
    m['F'] = "00101";
    m['G'] = "00110";
    m['H'] = "00111";
    m['I'] = "01000";
    m['J'] = "01001";
    m['K'] = "01010";
    m['L'] = "01011";
    m['M'] = "01100";
    m['N'] = "01101";
    m['O'] = "01110";
    m['P'] = "01111";
    m['Q'] = "10000";
    m['R'] = "10001";
    m['S'] = "10010";
    m['T'] = "10011";
    m['U'] = "10100";
    m['V'] = "10101";
    m['W'] = "10110";
    m['X'] = "10111";
    m['Y'] = "11000";
    m['Z'] = "11001";
    m[' '] = "11010";
    m['.'] = "11011";
    m[','] = "11100";
    m['-'] = "11101";
    m['\''] = "11110";
    m['?'] = "11111";
}
 
int main()
{
    string str;
 
    init1();
    init2();
 
    while (getline(cin, str)) {
	string s = "";
	for (int i = 0; i < (int)str.size(); i++) {
	    s += m[str[i]];
	}
     
	string ans = "";
	for (int i = 0; i < (int)s.size(); i++) {
	    for (int j = 3; j <= 8; j++) {
		string ss = s.substr(i, j);
		if (n[ss]) {
		    ans += n[ss];
		    i += j;
		    i--;
		    break;
		}
	    }
	}
	cout << ans << endl;
    } 
    return 0;
}

Measured memory_bytes: 3148
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n, k = nm()
d = nl()
for i in range(n, 100001):
    lis = list(str(i))
    f = 0
    for j in lis:
        if int(j) in d:
            f = 1
    if f == 0:
        print(i)
        exit()


Measured memory_bytes: 3444
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (unsigned int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =  1000000007 ;
const int INF = 2000000000;


    int A,B,C,D;
    string S,T;
int main(){
    cin>>S;
    for(auto x:S){
        if(x=='+')A++;
        else A--;
    }
    cout<<A<<endl;
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    int ans=0;
    cin>>s;
    int n=s.size();
    for(int i=0;i<=n/2-1;i++){
        if(s.at(i)!=s.at(n-1-i)) ans++;
    }
    cout<<ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sz 100002
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define P push
#define PQ priority_queue<double, vector<double>, greater<double> >q
#define _sort(v) sort(v.begin(),v.end())
#define MP map<ll int,ll int>mp
#define MEM(x) memset(x,0,sizeof(x))
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define VEC(n) ll int x; vector<ll int>v;for(int i=0;i<n;i++){cin>>x;v.pb(x);}
#define TEST() int test;cin>>test; while(test--)
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

//Upper_bound   auto x=upper_bound(v[a].begin(),v[a].end(),les);les=*x; if(x==v[a].end())break;
//ll int LCM(ll int a,ll int b) { ll int gcd=__gcd(a,b);ll int lcm=a*b/gcd;return lcm;}
//ll int bigmod(ll int b, ll int p, ll int m){if(p==0)return 1;if(p%2!=0) return b%m*fun(b,p-1,m)%m;if(p%2==0){ ll int res=fun(b,p/2,m);return (res%m*res%m)%m;}}
//ll mod_inverse(ll a, ll mod){return bigmod(a,mod-2,mod);}
//void seive() { prime[np++]=2;for(i=3; i<=sz; i+=2){if(mark[i]==0){ prime[np++]=i;for(j=i*i; j<=sz; j+=i) mark[j]=1; } }}
//string add(string s1,string s2) {string s;int j=s1.size()-1,c=0,m; for(int i=s2.size()-1; i>=0; i--) {if(j>=0)m=s2[i]-'0'+s1[j]-'0'+c;else m=s2[i]-'0'+c; if(m>9) { s+=m%10+'0';c=m/10; } else {  c=0;s+=m+'0'; }j--; } if(c!=0) {s+=c+'0'; }reverse(s.begin(),s.end());return s;}
//int pos;string mul(int n) {string s;for(int i=0; i<pos; i++) { s+="0"; }pos++;int c=0,m; for(int i=s1.size()-1; i>=0; i--) { m=(s1[i]-'0')*n+c;if(m>9) { s+=m%10+'0';c=m/10;} else { c=0; s+=m+'0';} }while(c!=0) { s+=c%10+'0';c=c/10;}    reverse(s.begin(),s.end());return s;}
//string add(string s,int n){ string res; int c=n,x; for(int i=s.size()-1;i>=0;i--)   { x=s[i]-'0'+c;res+=(x%10+'0'); c=x/10; }    while(c)    { res+=(c%10+'0'); c=c/10;} reverse(res.begin(),res.end()); return res;}


int main()
{
    FAST();
   ll int n,k,d,x;
    cin>>n>>k>>d;
    n=abs(n);
    x=n/d;
    if(x>=k)
    {
        cout<<n-k*d<<endl;
    }
    else
    {
       ll mn=n%d;
        k-=x;
        if(k%2)
        {
           mn=d-n%d;
        }
        cout<<mn<<endl;
    }
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
 
int main() {
ll n,k;
cin>>n>>k;
ll ca=10000000000;
ll counter=0;
ll a[n]={};
ll cb=10000000000;
if(k==0){
cout<<n*n<<endl;}
else{
for(ll i=k+1;i<=n;i++){
if(n%i>=k){
counter+=n/i*(i-k)+n%i+1-k;}
else
counter+=n/i*(i-k);}
cout<<counter<<endl;}
}

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

const int MAX = 12800;

int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<int>> A(H, vector<int>(W));
    auto B = A;
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            cin >> A[i][j];
        }
    }
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            cin >> B[i][j];
            A[i][j] = abs(A[i][j] - B[i][j]);
        }
    }
    vector<vector<vector<bool>>> dp(H, vector<vector<bool>>(W, vector<bool>(MAX + 1)));
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            if(i == 0 && j == 0){
                dp[i][j][A[i][j]] = true;
                continue;
            }
            if(0 <= i - 1){
                for(int k = 0;k <= MAX;k++) if(dp[i - 1][j][k]) {
                    dp[i][j][(k + A[i][j])] = true;
                    dp[i][j][abs(k - A[i][j])] = true;
                }
            }
            if(0 <= j - 1){
                for(int k = 0;k <= MAX;k++) if(dp[i][j - 1][k]) {
                    dp[i][j][(k + A[i][j])] = true;
                    dp[i][j][abs(k - A[i][j])] = true;
                }
            }
        }
    }
    int res = INT_MAX;
    for(int i = 0;i <= MAX;i++) if(dp[H - 1][W - 1][i]) {
        res = i;
        break;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 10752
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int L=sc.nextInt();
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		int D=sc.nextInt();
		int kokugoday=A/C;
		int sansuday=B/D;
		if(A%C!=0){
			kokugoday++;
		}
		if(B%D!=0){
			sansuday++;
		}
		if(kokugoday<sansuday){
			System.out.println(L-sansuday);
		}
		else{
			System.out.println(L-kokugoday);
		}
	}
}

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

signed main() {
    string s;
    cin>>s;
    int sum=0;
    int n=SZ(s);
    REP(i,(1<<(n-1))) {
        int t=s[0]-'0';
        REP(j,n-1) {
            if(i&(1<<j)) {
                sum+=t;    
                t=s[1+j]-'0';
            }
            else {
                t*=10;
                t+=s[1+j]-'0';
            }
        }
        sum+=t;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define M ((ull)1e9+7)
#define ull unsigned long long
using namespace std;


ull fe(ull a, ull b) {
	if (b==0) return 1;
	ull half = fe(a, b/2);
	if (b%2==0) return (half*half)%M;
	else return (((half*half)%M) * a)%M;
}

ull mm, nn, ans;
int x, y;

int main() {
	cin>>x>>y;
	if ((2*y-x)%3||x==0||y==0)cout<<0<<endl;
	else {
		int n = (2*y-x)/3, m = (2*x-y)/3;
		if (n<0 or m<0) {cout<<0<<endl; return 0;}
		mm=nn=ans=1;
		for (ull i=2; i<=n+m; i++) {
			if (i<=n) nn=(nn*i +M)%M; 
			if (i<=m) mm=(mm*i +M)%M;
			ans=(ans*i)%M;
		}
		ans = (ans * fe(nn, M-2) + M) % M;
		ans = (ans * fe(mm, M-2) + M) % M;
		cout<<(long long)ans<<endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;

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

	vector<string> s(h);
	for (int i = 0; i < b;i++) {
		s[i] = string(a, '0');
		s[i] += string(w - a, '1');
		cout << s[i] << endl;
	}
	for (int i = b; i < h;i++) {
		s[i] = string(a, '1');
		s[i] += string(w - a, '0');
		cout << s[i] << endl;
	}

	
}

Measured memory_bytes: 2304
f = lambda x: ord(x)-ord('a')
S = list(map(f, list(input())))
T = list(map(f, list(input())))

def solve():
    to = [None for _ in range(26)] 
    fr = [None for _ in range(26)] 

    for s, t in zip(S, T):
        if to[s] != None and to[s] != t or fr[t] != None and fr[t] != s:
            return False
        to[s] = t
        fr[t] = s

    return True

print(["No","Yes"][solve()])

Measured memory_bytes: 8340
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
int main()
{
    int h,w;
    cin>>h>>w;
    char a[h][w];
    long int dp[h][w];
    rep(i,h)
    {
        rep(j,w)
        {
            cin>>a[i][j];
            dp[i][j]=0;
        }
    }
    rep(i,w)
    {
        if(a[0][i]=='.')
        dp[0][i]=1;
        else
        break;
    }
    rep(i,h)
    {
        if(a[i][0]=='.')
        dp[i][0]=1;
        else
        break;
    }
    for(int i=1;i<h;i++)
    {
        for(int j=1;j<w;j++)
        {
            if(a[i][j]=='.')
           { dp[i][j]=(dp[i-1][j]%mod)+(dp[i][j-1]%mod);
            dp[i][j]=dp[i][j]%mod;}
        }
    }
    cout<<dp[h-1][w-1];
}

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

template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T>> &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}


#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<nl
#define epsilon 0.000000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}



int main() 
{
    fast();
    ll n,m,x;
    cin>>n>>m>>x;

    vv a(n,vi(m));
    vi c(n,0);

    for(ll i=0;i<n;i++)
    {
        cin>>c[i]>>a[i];
    }

    ll min_cost=inf;
    for(ll i=0;i<(1ll<<n);i++)
    {
        ll cost=0;
        vi know(m,0);
        for(ll j=0;j<n;j++)
        {
            if(i&(1ll<<j))
            {
                cost+=c[j];
                for(ll k=0;k<m;k++)
                {
                    know[k]+=a[j][k];
                }
            }
        }
        bool p=true;
        for(ll j=0;j<m;j++)
        {
            if(know[j]<x)
                p=false;
        }
        if(p)
            min_cost=min(cost,min_cost);
    }
    if(min_cost==inf)
        cout<<-1<<nl;
    else
        cout<<min_cost<<nl;
}


Measured memory_bytes: 3680
#include <iostream>
using namespace std;
int main()
{
	long long a1,a2,a3;
	cin>>a1>>a2>>a3;
	a1=a1+a2+a3;
//	cout<<a1;
	if (a1>=22) cout<<"bust"<<endl;
	else cout<<"win"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

string s;
int c[(int)1e5];

void f(int i, int k) {
	if(i == s.size()-1) c[i] = (c[i] + k) % 26;
	else if(c[i] != 0 && k >= 26-c[i]) {
		int t = c[i];
		c[i] = 0;
		f(i+1, k-26+t);
	} else f(i+1, k);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int k;
	cin >> s >> k;
	rep(i, s.size()) c[i] = s[i] - 'a';
	f(0, k);
	rep(i, s.size()) cout << (char)(c[i] + 'a');
	cout << endl;
	return 0;
}


Measured memory_bytes: 976
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int a[n], b[n], c[n];
    for(int i=0;i<n;++i)
    {
        cin >> a[i];
        a[i]--;
    }
    for(int i=0;i<n;++i)
    {
        cin >> b[i];
    }
    for(int i=0;i<n-1;++i)
    {
        cin >> c[i];
    }

    int ret = 0;
    int prev = -1;
    for(int i=0;i<n;++i)
    {
        ret += b[a[i]];
        if (i != 0 && (prev + 1) == a[i])
        {
            ret += c[prev];
        }
        prev = a[i];
    }

    cout << ret << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace::std;
int main(){
        int i, j, l;
        int c = 0;
        int a[1000];
        cin >> l;
        for(i=0; i<l; i++){
                cin >> a[i];
        }
        for(i=0; i<l; i++){
                for(j=l-1; j>i; j--){
                        if(a[j] < a[j-1]){
                                swap(a[j], a[j-1]);
                                c++;
                        }
                }
        }
        for(i=0; i<l-1; i++){
        cout << a[i] << " ";
        }
        cout << a[l-1] << endl;
        cout << c << endl;
}



Measured memory_bytes: 3140
A, B, K = map(int, input().split())

lista, aux, aux1 =[], max(A, B), min(A, B)
for i in range(1, aux1+1):	
	if((aux%i) == 0 and (aux1%i) == 0):
		lista.append(i)		
		lista.sort(reverse=True)

if(len(lista)==1):
	print(lista[0])
else:
	ans = lista[K-1]
	print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  int r = count(all(s), 'R');
  int b = count(all(s), 'B');
  if(r > b) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>
#include <climits>
 
#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;
constexpr auto mod = 1000000007;
constexpr auto INF = ULLONG_MAX;
 
using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }
template <typename T> inline T max_value(vector<T>& x) { return *max_element(x.begin(), x.end()); }
template <typename T> inline T min_value(vector<T>& x) { return *min_element(x.begin(), x.end()); }
template <typename T> inline T sum_value(vector<T>& x) { return accumulate(x.begin(), x.end(), 0); }
 
int main() {
  ull n, k;
  string s;
  cin >> n;
  cin >> s;
  cin >> k;

  string res;
  char c = s[k-1];
  each(i, n) {
    if (s[i] == c) {
      res += c;
    } else {
      res += '*';
    }
  }

  cout << res << endl;

 
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <vector>
#include <cstdio>
#include <cstring>
#include<cmath>
#include <bitset>
typedef long long ll;
const int maxn = 1e5+7;
int c[maxn],v[maxn];
using namespace std;
int main() {
	// freopen("IN4.txt", "r", stdin);
	ll x,y;
	cin>>x>>y;
	if(abs(y-x)<=1)cout<<"Brown"<<endl;
	else cout<<"Alice"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
LL p = 1000000007ll;

int main(void)
{
  int n;
  cin >> n;
  vector<int> a(n),b(n);
  for(int&x:a) cin >> x;
  for(int&x:b) cin >> x;
  vector<int> sa(a),sb(b);
  sort(sa.begin(),sa.end());
  sort(sb.begin(),sb.end());
  vector<pair<int,int>> sba(n);
  REP(i,n) sba[i] = make_pair(b[i],a[i]);
  sort(sba.begin(),sba.end());
  REP(i,n) a[i] = sba[i].second;
  REP(i,n) {
    if(sa[i] > sb[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  FOR(i,1,n) {
    if(sa[i] <= sb[i-1]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  map<int,int> ma;
  REP(i,n) ma[sa[i]] = i;
  int ind = 0;
  int loop = 0;
  do {
    ind = ma[a[ind]];
    ++loop;
  } while(ind);
  if(loop == n) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 7296
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int, int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int a, b;
    cin >> a >> b;
    if(a>b){
        if(a-2*b > 0){
            cout << a - 2*b;
        }
        else cout << 0;
    }
    else{
        cout << 0;
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	if(a == b || b == c || c == a){
		if(a == b && b == c){
			cout << "No";
		}
		else{
			cout << "Yes";		}
	}
	else{
		cout << "No";
	}
	
	return 0;
}

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

#define SYNC ios::sync_with_stdio(0);
#define F first
#define S second
#define endl '\n'


using namespace std;

using ll = long long int;
using ii = pair<int, int>;
using vii = vector<ii>;
using vi = vector<int>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const int MAXN = 58;
const ll mod = 1000000007;



int main() {
    SYNC
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a+b)*h/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
using ll = long long;
//>:(
void solve() {
    int N;
    cin >> N;
    bool is_odd=false;
    if(N&1) {
        is_odd=true;
        N--;
    }
    int k=0;
    stringstream s;
    for(int i=1;i<=N;i++) {    
        int c = 1+N-i;
        // cout << "****" << i << " " << c << " " << N << "\n";
        for(int j=i+1;j<=N;j++) {
            if(j!=c) {
                k++;
                s << i << " " << j << "\n";
            }
        }    
    }

    if(is_odd) {
        for(int i=1;i<=N;i++) {
            k++;
            s << i << " " << N+1 << "\n";
        }
    }

    cout << k << "\n";
    cout << s.str();


}

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

    solve();
    return 0;
}

Measured memory_bytes: 384
import numpy as np
s = list(map(int, input().split()))
n=s[0]
m=s[1]
student=[]
check=[]
for i in range(n):
    s = list(map(int, input().split()))
    student.append(s)
for i in range(m):
    s = list(map(int, input().split()))
    check.append(s)
student=np.array(student)
check=np.array(check)
for i in student:
    c=np.copy(check)
    c=np.abs(c-i)
    c=c[:,0]+c[:,1]
    print(np.argmin(c)+1)

Measured memory_bytes: 12820
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#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,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

struct UnionFind{
	int par[1000];
	int rank[1000];
	UnionFind(int n){
		init(n);
	}
	void init(int n){		REP(i,n){par[i] = i;rank[i] = 0;}}
	int find(int a){
		if(par[a] == a)return a;
		return par[a] = find(par[a]);
	}
	void unite(int x,int y){
		x = find(x);
		y = find(y);
		if(x==y)return;
		if(rank[x]<rank[y])par[x] = y;
		else {
			par[y] = x;
			if(rank[x]==rank[y])rank[x]++;
		}
	}
	bool same(int x,int y){return find(x)==find(y);}
};

struct Edge{
	int u,v,cost;
	Edge(){}
};
bool comp(const Edge& e1,const Edge& e2){
	return e1.cost < e2.cost;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int n,m;
	while(cin>>n>>m,n){
		vector<Edge> edge(m);
		UnionFind uni(n);
		REP(i,m){
			cin >> edge[i].u >>edge[i].v >> edge[i].cost;
			edge[i].u--;edge[i].v--;
		}
		int ans = INF;
		sort(edge.begin(),edge.end(),comp);
		REP(i,m){
			uni.init(n);
			int maxc = -INF,minc = INF,ct = 0;
			FOR(j,i,m){
				Edge e = edge[j];
				if(!uni.same(e.u,e.v)){
					uni.unite(e.u,e.v);
					maxc = max(maxc,e.cost);
					minc = min(minc,e.cost);
					ct++;
				}
			}
			if(ct!=n-1)break;
			ans = min(ans,maxc-minc);
		}
		if(ans == INF)cout << -1 << endl;
		else cout << ans << endl;
	}
  return 0;
}

Measured memory_bytes: 3188
n=int(input())
t=list(map(int,input().split()))
m=int(input())
lis=[]
for i in range(m):
  lis.append(list(map(int,input().split())))

b_time=sum(t)
for i in range(0,m):
  toi=lis[i][0]
  after_time=lis[i][1]
  before_time=t[toi-1]
  sa=before_time-after_time
  print(b_time-sa)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;

	if (a > b)
		cout << "a > b" << endl;
	else if (a < b)
		cout << "a < b" << endl;
	else
		cout << "a == b" << endl;

	return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

ll d[MAXn];
int main(){
    IOS();
    ll n;
    cin >> n;
    REP (i,n) {
        ll x;
        cin >> x;
        d[x]++;
    }

    ll cur = 0, ans = 0;
    REP1 (i,MAXn-1) {
        if (cur == n-cur) ans++;
        cur += d[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
/*
    Created by Rahul Goel.
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/*******************************************************************************/
using namespace std;
using namespace __gnu_pbds;
template < typename T >
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*******************************************************************************/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const int INF = 1e9;
const ll LINF = 1e18;
/*******************************************************************************/
ll mod_sum() { return 0LL; }
template < typename T, typename... Args >
T mod_sum(T a, Args... args) { return ((a + MOD_sum(args...))%MOD + MOD)%MOD; }
/*******************************************************************************/
ll mod_prod() { return 1LL; }
template< typename T, typename... Args >
T mod_prod(T a, Args... args) { return (a*MOD_prod(args...))%MOD; }
/*******************************************************************************/
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(c)          (c).begin(), (c).end()
#define present(c,x)    ((c).find(x) != (c).end())
#define cpresent(c,x)   (find(all(c),x) != (c).end())
#define uniq(c)         (c).resize(distance((c).begin(), unique(all(c))))
#define min_pq(t)       priority_queue < t, vector < t >, greater < t > >
#define max_pq(t)       priority_queue < t >
#define pb              push_back
#define ff              first
#define ss              second
/*******************************************************************************/
using pii = pair < ll, ll >;
using vi = vector < ll >;
using vb = vector < bool >;
using vvi = vector < vector < ll > >;
using vvb = vector < vector < bool > >;
using vpii = vector < pii >;
using vvpii = vector < vector < pii > >;
/*******************************************************************************/
//.-.. . -. -.- .- .. ... .-.. --- ...- .
/*
    Code begins after this.
*/

ll solve() {
    ll n;
    cin >> n;
    string str;
    cin >> str;
    
    ll ans = 0;
    ll l = 0, r = n - 1;
    while (l < r) {
        if (str[l] == 'R') {
            l++;
            continue;
        }
        if (str[r] == 'W') {
            r--;
            continue;
        }
        swap(str[l], str[r]);
        ans++;
    }
    cout << ans << endl;

    return 0;
}

signed main() {
    fastio;

    ll t = 1;
    while (t--) {
        solve();
    }
    return 0;
}


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

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	
	sort(v.begin(), v.end());
	cout << v[n / 2] - v[n / 2 - 1] << endl;

	
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main (void){
    int n,k,i,j,a,b,ans,aa,bb;
    scanf("%d%d",&n,&k);
    for(i=0;i<k;i++){
        scanf("%d%d",&a,&b);
        ans=0,aa=0,bb=0;
        if(n/2+1==a){
            if(b<=n/2+1){
                ans=b%3;
            }
            else if(b>n/2+1){
                b=n-b+1;
                ans=b%3;
            }
        }
        else if(n/2+1==b){
            if(a<=n/2+1){
                ans=a%3;
            }
            else if(a>n/2+1){
                a=n-a+1;
                ans=a%3;
            }
        }
        else if(a<=n/2){
            if(b<=n/2){
                if(a>=b)ans=b%3;
                else if(b>a)ans=a%3;
            }
            else if(b>n/2){
                b=n-b+1;
                if(a>=b)ans=b%3;
                else if(b>a)ans=a%3;
            }
        }
        else if(a>n/2){
            a=n-a+1;
            if(b<=n/2){
                if(a>=b)ans=b%3;
                else if(b>a)ans=a%3;
            }
            else if(b>n/2){
                b=n-b+1;
                if(a>=b)ans=b%3;
                else if(b>a)ans=a%3;
            }
        }
        if(ans==0)ans=3;
        printf("%d\n",ans);
    }
return 0;
}

Measured memory_bytes: 596
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
char x[1007], y[1007];
int dp[1007][1007];
int main() {
    int q;
    scanf("%d", &q);
    while (q--) {
    	scanf("%s%s", x, y);
    	int xlen = strlen(x), ylen = strlen(y);
    	for (int i = 1; i <= xlen; i++) {
    		for (int j = 1; j <= ylen; j++) {
    			if (x[i - 1] == y[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1;
    			else dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			}
		}
		printf("%d\n", dp[xlen][ylen]);
	}
    return 0;
}


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

const int INF = 1e9;

struct UnionFind {
	int n;
	vector<int> r, p;
	UnionFind() {}
	UnionFind(int sz) : n(sz), r(sz, 1), p(sz, 0) { iota(p.begin(), p.end(), 0); }
	int find(int x) {
		return (x == p[x] ? x : p[x] = find(p[x]));
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if ( x == y ) return;
		if( r[x] < r[y] ) swap(x, y);
		r[x] += r[y];
		p[y] = x;
	}
};

struct Edge {
	int to, from, cost;
	bool operator<(const Edge& e) const {
		return cost < e.cost;		
	}
};

int main() {
	int n, m;
	while ( cin >> n >> m, n ) {
		vector<Edge> G;
		for ( int i = 0; i < m; i++ ) {
			int a, b, w;
			cin >> a >> b >> w;
			a--; b--;
			G.push_back({a, b, w});			
		}

		sort(G.begin(), G.end());

		/*for ( int i = 0; i < m; i++ ) {
			cout << G[i].to <<	" " << G[i].from << " "<<			G[i].cost << endl;
			}*/

		int ans = INF;
		for ( int i = 0; i < m; i++ ) {
			int cnt = 0;
			int ma = -1;
			int mi = INF;
			UnionFind uf(n+1);			
			for ( int j = i; j < m; j++ ) {
				Edge e = G[j];
				int a = e.to, b = e.from, w = e.cost;
				//if ( i == 0 ) cout << a << " " << b << endl;
				if ( uf.same(a, b) ) continue;
				cnt++;
				//if ( i == 0 ) cout << cnt << endl;
				ma = max(ma, w);
				mi = min(mi, w);
				if ( cnt >= n-1 ) break;
				uf.unite(a, b);
			}

			if ( cnt >= n-1 ) {
				//cout << 'a' << endl;
				ans = min(ans, ma-mi);
			}
		}

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

	}
	
	return 0;
}



Measured memory_bytes: 3264
//### In The Name Of GOD ###

//%% Remember; (((He))) is The (((Accepter))) %%

// GOD IS GREATER ...

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;
typedef long double ld ;

//#define int ll
#define pb push_back
#define bp pop_back
#define pf push_front
#define fp pop_front
#define X first
#define Y second
#define sz(a) (int)(a.size())
#define sg(a, b) (a + b - 1) / b

const int MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 2000ll * 1000 * 1000 * 1000 * 1000 * 1000 ;
const int MAXN = 1000000 + 2;
const int MLOG = 22;
const int NMAX = 350; // ios_base :: sync_with_stdio(false);

int main() {
	ios_base :: sync_with_stdio(false);
	string s;
	cin >> s;
	int k;
	cin >> k;
	for(int i = 0; i < sz(s); i++){
		if(s[i] == 'a')
			continue;
		if('z' + 1 - s[i] <= k)
			k -= 'z' + 1 - s[i], s[i] = 'a';
	}
	k %= 26;
	while(k--) {
		s[sz(s) - 1]++;
		if(s[sz(s) - 1] == 'z' + 1)
			s[sz(s) - 1] = 'a';
	}
	cout << s;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
int main() {
  char c;
  cin >>  c;
  if (c == 'a'||c == 'i'||c == 'u'||c == 'e'||c == 'o'){
  cout << "vowel" << endl;
}
else { cout << "consonant" << endl; }
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 5e5+100;
const ll mod = 1e9 + 7;

ll fac[maxn], ifac[maxn];

ll modpow(ll, ll);
ll inv(ll);
ll nck(ll, ll);
void build();
void testlib();



int n;
int k;

ll H(ll x, ll y) {
  return nck(x+y-1,x-1);
}

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

  cin>>n>>k;
  int m = min(n-1,k);//upper bound on 0s
  ll ans = 0;

  for (int i=0; i<=m; i++) {
    ans += nck(n,i)*H(n-i,i)%mod;
    ans %= mod;
  }

  ans %= mod;
  ans += mod;
  ans %= mod;
  cout<<ans<<endl;
  return 0;
}

///////////////////////////////////////////////////////////////////////////////////////////////////


ll modpow(ll x, ll y) {
  x %= mod;
  ll res = 1;
  while (y > 0) {
    if (y%2 == 1) {
      res *= x;
      res %= mod;
    }
    x = x * x;
    x %= mod;
    y = y / 2;
  }
  return res;
}

ll inv(ll x) {
  assert(x != 0);
  return modpow(x, mod-2);
}

void build() {
  fac[0] = ifac[0] = 1;
  for (int i=1; i<maxn; i++) {
    fac[i] = fac[i-1] * i;
    fac[i] %= mod;
    ifac[i] = inv(fac[i]);
    ifac[i] %= mod;
  }
}

ll nck(ll n, ll k) {
  assert(n>=0 && k>=0);
  if (k > n) return 0;
  return (((fac[n] * ifac[k]) % mod) * ifac[n-k]) % mod;
}

void testlib() {
  assert(modpow(1,1) == 1);
  assert(modpow(4,2) == 16);
  assert(modpow(2,5) == 32);
  assert(fac[3] == 6);
  assert(nck(4,2) == 6);
  assert(nck(10,2) == 45);
}


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

using namespace std;

int main() {
	string w;
	int check = 0;

	//入力
	cin >> w;

	//小文字が何回出現するかカウントする
	for (int i = 0; i < w.length(); i++) {
		if (count(w.cbegin(), w.cend(), w[i])%2==0) {
			check++;
		}
	}

	//結果表示
	if (w.length() == check) {
		//美しい
		cout << "Yes" << endl;
	}
	else {
		//美しくない
		cout << "No" << endl;
	}

}

Measured memory_bytes: 256
import sys

# sys.stdin = open('d1.in')

n, W = map(int, input().split())
g = {}
w1 = 0
for i in range(n):
    w, v = map(int, input().split())
    if i == 0:
        w1 = w
        for x in range(w, w + 4):
            g[x] = []
    g[w].append(v)
for w, values in g.items():
    values.sort(reverse=True)

sg = {}
sg[w1] = {}
sg[w1 + 1] = {}
sg[w1 + 2] = {}
sg[w1 + 3] = {}
for a in range(len(g[w1]) + 1):
    sg[w1][a] = sum(g[w1][:a])
for b in range(len(g[w1 + 1]) + 1):
    sg[w1 + 1][b] = sum(g[w1 + 1][:b])
for c in range(len(g[w1 + 2]) + 1):
    sg[w1 + 2][c] = sum(g[w1 + 2][:c])
for d in range(len(g[w1 + 3]) + 1):
    sg[w1 + 3][d] = sum(g[w1 + 3][:d])

res = 0
wa = 0
for a in range(len(g[w1]) + 1):
    wa = w1 * a
    if wa > W:
        continue
    for b in range(len(g[w1 + 1]) + 1):
        wb = (w1 + 1) * b
        if wa + wb > W:
            continue
        for c in range(len(g[w1 + 2]) + 1):
            wc = (w1 + 2) * c
            if wa + wb + wc > W:
                continue
            for d in range(len(g[w1 + 3]) + 1):
                wd = (w1 + 3) * d
                if wa + wb + wc + wd > W:
                    continue
                total_w = wa + wb + wc + wd

                total_v = sg[w1][a] + sg[w1 + 1][b] + sg[w1 + 2][c] + sg[w1 + 3][d]
                if total_v > res:
                    res = total_v
print(res)


Measured memory_bytes: 3192
##### 解けた #####

A,B,C,D=list(map(int,input().split(" ")))
wL=A+B # 左の皿
wR=C+D # 右の皿

if wL<wR: # 右に傾く場合
    print("Right")
elif wL>wR: # 左に傾く場合
    print("Left")
elif wL==wR:
    print("Balanced")

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

int main() {
    string S;
    cin >> S;
    if (S[0] != 'A') {
        cout << "WA" << endl;
        return 0;
    }
    if (count(S.begin() + 2, S.end() - 1, 'C') != 1) {
        cout << "WA" << endl;
        return 0;
    }
    for(char c : S) {
        if (c != 'A' && c != 'C' && isupper(c)) {
            cout << "WA" << endl;
            return 0;
        }
    }
    cout << "AC" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <vector>
#include <cmath>
#include <ctime>        // time
#include <cstdlib>      // srand,rand
#include <fstream>
#include <string>
#include <sstream>      //文字ストリーム
#include <iterator>
#include <map>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <limits>
#include <typeinfo>

#include <stdio.h>
#include <string.h>


using namespace std;

int main(int argc, char* argv[])
{
	int H,W;
	char a[100][100],ans[102][102];

	cin >> H >> W;

	for(int y=0;y<H;y++){
		for(int x=0;x<W;x++){
			cin >> a[x][y];
		}
	}

	for(int y=0;y<H+2;y++){
		for(int x=0;x<W+2;x++){
			ans[x][y]='#';
		}
	}

	for(int y=1;y<H+1;y++){
		for(int x=1;x<W+1;x++){
			ans[x][y]=a[x-1][y-1];
		}
	}

	for(int y=0;y<H+2;y++){
		for(int x=0;x<W+2;x++){
			cout << ans[x][y];
		}
		cout << endl;
	}		

	return 0;
}


Measured memory_bytes: 256
K = int(input())
S = len(input())
P = 10**9+7
nn = 2*10**6+1
fa = [1] * (nn+1)
fainv = [1] * (nn+1)
for i in range(nn):
    fa[i+1] = fa[i] * (i+1) % P
fainv[-1] = pow(fa[-1], P-2, P)
for i in range(nn)[::-1]:
    fainv[i] = fainv[i+1] * (i+1) % P
 
C = lambda a, b: fa[a] * fainv[b] % P * fainv[a-b] % P if 0 <= b <= a else 0

inv = [1]*27
for i in range(2,27):
  inv[i]=(-(P//i)*inv[P%i])%P
ans = 0
a = 1
b = pow(26,K,P)
for i in range(K+1):
  ans = (ans + (C(i+S-1,S-1)*a%P*b%P))%P
  a = a*25%P
  b = b*inv[26]%P
print(ans)

Measured memory_bytes: 120060
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a, b, c, d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	if(a > b) printf("%d\n",b * c + (a - b) * d);
	else printf("%d\n",a * c);
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  static long long F[100001];
  memset(F, 0x3f, sizeof(F));
  F[0] = 0;
  auto s = 0;
  while (N--) {
    int a, b;
    cin >> a >> b;
    s += b;
    for (auto i = s; i >= b; --i)
      F[i] = min(F[i], F[i - b] + a);
  }
  while (F[s] > M)
    --s;
  cout << s << endl;
  return 0;
}


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

#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define pb push_back
#define fi first
#define se second

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}
ll LCM(ll x, ll y){
	return x/GCD(x, y)*y;
}

int main() {
	string s; cin >> s;
	int l = int (s.size());
	vector<char> ans;
	rep(i, 0, l){
		if(s[i]!='B') ans.pb(s[i]);
		if(s[i]=='B' && ans.size()!=0) ans.pop_back();
	}
	for(auto c: ans) cout << c;
	cout << endl;
	return 0;
}

Measured memory_bytes: 3572
from bisect import bisect_left
n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
d=[0]
e=[]
for i in range(n):
    d.append(bisect_left(a,b[i])+d[-1])
    e.append(bisect_left(b,c[i]))
ans=0
for i in e:
    ans+=d[i]
print(ans)

Measured memory_bytes: 31160