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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int N = 120;
  for (int i = 0; i < N; i++){
    C -= B;
      if (C <= 0){
        cout << "Yes" << endl;
        break;
      }
    A -= D;
      if (A <= 0){
        cout << "No" << endl;
        break;
      }
  }
}

Measured memory_bytes: 3636
res = -10 ** 9
n   = int(input())
a   = int(input())
Min = int(a)

for mak in range(n - 1) :
    tem = 0
    b = int(input())
    Min = min(b, Min)
    
    if   b < a : tem = b - a
    else       : tem = b - Min

    if tem > res : res = int(tem)
    a   = int(b)
print(res)

Measured memory_bytes: 7692
import java.util.Scanner;

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


Measured memory_bytes: 28972
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    long c;
    vector<int>::iterator iter_lower;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end());
    long long sum=0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
                iter_lower=lower_bound(a.begin(),a.end(),a[i]+a[j]);
                c=distance(a.begin(), iter_lower);
                sum+=c-j-1;
        }
    }
    cout<<sum;
}


Measured memory_bytes: 256
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
// cout << "Case #" << index << " :IMPOSSIBLE";
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    char c;
    cin>>c;
    if(c>='a'){
        cout<<"a"<<endl;
    }else{
        cout<<"A"<<endl;
    }
}


Measured memory_bytes: 3660
N, K = map(int, input().split())
P = [None] + list(map(int, input().split()))
C = [None] + list(map(int, input().split()))

R = [False] * (N+1)
S = []

for st in range(1, N+1):
    if R[st]: continue
    loop = []
    x = st
    while not R[x]:
        loop.append(C[x])
        R[x] = True
        x = P[x]

    if max(loop)<=0:
        S.append(max(loop))
        continue

    L = len(loop)
    K0 = K//L
    K1 = K%L

    T = [0]
    for c in loop: T.append(T[-1]+c)
    tot = T[-1]

    smax = smax_l = 0
    for i in range(L):
        for j in range(i, L):
            l = j-i+1
            
            ss = T[j+1]-T[i]
            smax = max(smax, ss)
            smax = max(smax, tot-ss)
            if l  <=K1: smax_l = max(smax_l, ss)
            if L-l<=K1: smax_l = max(smax_l, tot-ss)

    s = smax_l + K0*max(0,tot)
    if K0>0: s = max(s, smax+(K0-1)*max(0,tot))
    S.append(s)

print(max(S))


Measured memory_bytes: 69784
use std::io::Read;

fn read<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut d = vec![0; n];
    for i in 0..n {
        d[i] = read();
    }

    let mut res = 0;
    for i in 0..n {
        for j in i+1..n {
            res += d[i] * d[j];
        }
    }

    println!("{}", res);
}


Measured memory_bytes: 4352
a = list(map(int,input().split()))

a.sort()

if a[0]%2 == a[1]%2 and a[0]%2 == a[2]%2:
    print((a[2]-a[0])//2+(a[2]-a[1])//2)
else:
    if a[0]%2 == a[1]%2:
        a[0]+=1
        a[1]+=1
    elif a[0]%2 == a[2]%2:
        a[0]+=1
        a[2]+=1
    else:
        a[1]+=1
        a[2]+=1
    print(1+(a[2]-a[0])//2+(a[2]-a[1])//2)

Measured memory_bytes: 3064
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<numeric>
#include<limits>
#include <cstdint>
using namespace std;
#define ll long long int
#define rep(N) for(ll i=0;i<N;i++)
#define rep2(N1,N2) for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)for(int k=0;k<N3;k++)
#define For(i,N) for(ll i=0;i<N;i++)

void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int ctoi(char c) {
	return c - '0';
}

ll kai(ll x) {
	ll a = 1;
	if (x <= 0)
		return 1;
	else {
		for(ll i=0;i<x;i++)
			a = a * (i + 1);
		return a;
	}
}

ll rui(ll x, ll y) {
	ll a = 1;
	for (ll i = 0; i < y; i++)
		a = a * x;
	return a;
}
const int nmax = 150;
int cccc[nmax][nmax];
ll comb(ll n, ll k) {
	if (n < k) {
		cout << "error n<k"<<endl;
		return -1;
	}
	if (cccc[n][k] > 0)return cccc[n][k];
	if (k == 0 || n == k)return 1;
	return cccc[n][k] = comb(n - 1, k - 1) + comb(n - 1, k);
}

ll gcd(ll a, ll b)
{
	if (a%b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a%b));
	}
}

ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
int main() {
	//cout.precision(20);
	string S;
	ll N;
	cin >> N >> S;
	string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	ll j = 0;
	rep(S.size()) {
		j = 0;
		while (1) {
			if (S[i] == alpha[j]) {
				S[i] = alpha[(j + N) % 26];
				break;
			}
			j++;
		}
	}
	cout << S;
}

Measured memory_bytes: 256
import heapq
n,m=map(int,input().split())
a=list(map(lambda x:int(x)*-1,input().split()))
heapq.heapify(a) 
for i in range(m):
    mx=heapq.heappop(a)*-1
    heapq.heappush(a,mx//2*-1)
print(sum(a)*-1)

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

using namespace std;
using ll = long long;

#pragma region Macros
#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

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

template <class T> string join(const T &v, const string delim = ",")
{
    if (v.empty())
        return "";

    ostringstream res;
    res << v[0];
    for (int i = 1; i < v.size(); i++)
    {
        res << delim << v[i];
    }
    return res.str();
}

#pragma endregion Macros
template <long long Mod>
struct modint {
    ll n;
    modint(ll x = 0) : n((x + Mod) % Mod) {
    }

    modint operator+(const modint &r) const { return modint(*this) += r; }
    modint operator-(const modint &r) const { return modint(*this) -= r; }
    modint operator*(const modint &r) const { return modint(*this) *= r; }
    modint operator/(const modint &r) const { return modint(*this) /= r; }
    modint operator+=(const modint &r) {
        n += r.n;
        n %= Mod;
        return *this;
    }
    modint operator-=(const modint &r) {
        n -= r.n;
        n += Mod;
        n %= Mod;
        return *this;
    }
    modint operator*=(const modint &r) {
        n *= r.n;
        n %= Mod;
        return *this;
    }
    modint operator/=(const modint &r) {
        *this *= modint(r).inv();
        return *this;
    }

    modint operator=(const modint &r) { return n = r.n; }
    modint operator==(const modint &r) const { return n == r.n; }
    modint operator!=(const modint &r) const { return n != r.n; }

    modint inv() const { return pow(Mod - 2); }

    modint pow(const ll x) const {
        if (n == 0) return modint(0);
        if (x == 0) return modint(1);
        if (x == 1) return modint(n);

        modint a = modint(*this);
        a = (a * a).pow(x / 2);

        if(x % 2 == 1){
            a *= n;
        }
        return a;

    }

    friend ostream &operator<<(ostream &os, const modint &x) { return os << x.n; }
    friend istream &operator>>(istream &is, modint &x) { return is >> x.n; }
};
int main()
{
    ll N;
    cin >> N;
    
    vector<ll> D(N);
    rep(i, N) cin >> D[i];


    ll dmax = 0;
    vector<ll> dc(N);
    rep(i, N) {
        dc[D[i]] ++;
        chmax(dmax, D[i]);
    }


    if(dc[0] != 1 || D[0] != 0){
        cout << 0 << endl;
    }else if(dmax == 1){
        cout << 1 << endl;
    } else {
        modint<998244353> ans(1);
        for (int i = 2; i<=dmax;i++){
            modint<998244353> x;
            x = dc[i-1];
            x = x.pow(dc[i]);
            ans *= x;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 4820
/*
Stay away from
               ,----..                                                         ,---.-,
  ,----..     /   /   \                 ,---,    ,---,                 ,---,  '   ,'  '.
 /   /   \   /   .     :        ,---.,`--.' |  .'  .' `\            ,`--.' | /   /      \
|   :     : .   /   ;.  \      /__./||   :  :,---.'     \          /    /  :.   ;  ,/.  :
.   |  ;. /.   ;   /  ` ; ,---.;  ; |:   |  '|   |  .`\  |        :    |.' ''   |  | :  ;
.   ; /--` ;   |  ; \ ; |/___/ \  | ||   :  |:   : |  '  |        `----':  |'   |  ./   :
;   | ;    |   :  | ; | '\   ;  \ ' |'   '  ;|   ' '  ;  :           '   ' ;|   :       ,
|   : |    .   |  ' ' ' : \   \  \: ||   |  |'   | ;  .  |  ---      |   | | \   \      |
.   | '___ '   ;  \; /  |  ;   \  ' .'   :  ;|   | :  |  '           '   : ;  `---`---  ;
'   ; : .'| \   \  ',  /    \   \   '|   |  ''   : | /  ;            |   | '     |   |  |
'   | '/  :  ;   :    /      \   `  ;'   :  ||   | '` ,/             '   : |     '   :  ;
|   :    /    \   \ .'        :   \ |;   |.' ;   :  .'               ;   |.'     |   |  '
 \   \ .'      `---`           '---" '---'   |   ,.'                 '---'       ;   |.'
  `---`                                      '---'                               '---'

to save your life.
*/
#define   ll                long long
#define   pb                push_back
#define   ff                first
#define   ss                second
#define   srt(v)            sort(v.begin(),v.end())
#define   inf               2000000000000000000
#define   mxn               3009
#define   pi                acos(-1)
#define   MOD               1000000007
#define   db(x)             printf("### VALUE: (%lld) ###\n",(ll)x)
#include  <bits/stdc++.h>
using namespace std;

string s,t;
int n,m;
int dp[mxn][mxn];
string ans;
void pint(int i,int j)
{
    //cout << i <<" " << j << endl;
    //cout << s[i-1] <<" " << t[j-1] << endl;
    if(i == 0 || j == 0) return;
    if(s[i-1] == t[j-1]){
       ans += s[i-1];
       i--;j--;
       pint(i,j);
    }
    else{
        int keep = dp[i][j-1];
        int peek = dp[i-1][j];
        if(keep > peek){
            j--;
            pint(i,j);
        }
        else if(peek > keep){
            i--;
            pint(i,j);
        }
        else{
            i--;
            pint(i,j);
        }
    }
}
int main()
{

    cin >> s >> t;
    n = s.size(); m = t.size();
    for(int i = 0;i < n;i++){
        for(int j = 0;j < m;j++){
            if(s[i] == t[j]){
                dp[i+1][j+1] = dp[i][j] + 1;
            }
            else{
                dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1]);
            }
        }
    }

//    for(int i = 1;i <= n;i++){
//        for(int j = 1;j <= m;j++){
//            cout << dp[i][j] <<" ";
//        }
//        cout << endl;
//    }

    pint(n,m);
    reverse(ans.begin(),ans.end());
    cout << ans << endl;
    return 0;
}
/*
".....but the truth is that you can increase it slightly."
Day 16.
*/




Measured memory_bytes: 35584
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using pii = pair<Int,Int>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

Int LCM(Int a, Int b){
    return a*b/GCD(a,b);
}

int main() {
    Int N;
    cin >> N;

    Int ans=1;

    Int init = N;
    Int diff = -2;
    Int count;

    if(N%2==1){
        cout << "0" << endl;
        return 0;
    }

    Int five=N/10;
    Int o = N/10;

    while(o>=5){
        five+=o/5;
        o/=5;
    }

    cout << five << endl;


    return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  
  int count = 0;
  int i = 0;
  while(A + i <= B){
    if (A + i < 10000) {
      int x, dig1, dig10, dig100, dig1000;
      x = A + i;
      dig1 = x % 10;
      x /= 10;
      dig10 = x % 10;
      x /= 10;
      dig100 = x % 10;
      x /= 10;
      dig1000 = x % 10;
      
      if (dig1 == dig1000 && dig10 == dig100) {
        count++;
      }
    } else {
      int x, dig1, dig10, dig100, dig1000, dig10000;
      x = A + i;
      dig1 = x % 10;
      x /= 10;
      dig10 = x % 10;
      x /= 10;
      dig100 = x % 10;
      x /= 10;
      dig1000 = x % 10;
      x /= 10;
      dig10000 = x % 10;
      
      if (dig1 == dig10000 && dig10 == dig1000) {
        count++;
      }
    }
    i++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    int n;
    foreach (c; readln.chomp) {
        if (c == '+') {
            ++n;
        } else {
            --n;
        }
    }
    writeln(n);
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n,a,b;
  cin>>n>>a>>b;
  if((b-a+1)%2==0) {
    cout << "Borys" << endl;
  } else
    cout<<"Alice"<<endl;
  return 0;
}


Measured memory_bytes: 256
import math
n, p = map(int, input().split())
s = input()

def nCr(n, r):
    if n < r:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
ans = 0
if p == 2 or p == 5:
    for i in range(n):
        if int(s[i]) % p == 0:
            ans += i + 1
else:
    # dp = [0] * p
    # dp[0] = 1
    # tmp = 0
    # for i in range(n)[::-1]:
    #     tmp = (int(s[i]) * pow(10, n - i - 1, p) + tmp) % p
    #     print(tmp)
    #     ans += dp[tmp]
    #     dp[tmp] += 1
    # print(dp)

    # ベースの考え方。https://drken1215.hatenablog.com/entry/2020/03/08/020200
    # 素数pで割ったあまりは、0, 1, 2, ... p - 1になる。
    # 例えば、s=152467, p=3とする
    # 0 mod 3 = 0 (単独でも1つになるので、便宜上加える)
    # 7 mod 3 = 1
    # 67 mod 3 = 1
    # 467 mod 3 = 2
    # 2467 mod 3 = 1
    # 52467 mod 3 = 0
    # 152467 mod 3 = 1
    # となる。
    # 例えば、x mod 3 = 1について、考える。これは、7, 67, 2467, 152467の4つある。
    # これから、67 - 7 = 60で、3で割り切れる。2467 - 7 = 2560で、3で割り切れる。
    # このように、4つのうち2つを組み合わせれば、あまりの数が同じなので、p(3)で割り切れる組み合わせ
    # を作ることができる。
    # 467 mod 3 = 2については、あまりが2はコレしかないので、組み合わせることはできず、0となる。
    # また、あまりが2のものと、あまりが1のもの2個で組み合わせることはできない。なぜなら、
    # 467-67-7で組み合わせたところで、67と7が互いに相殺してしまうし、結果も393という、sの中に存在しない文字になるからである。
    # 基本はこれであり、下記のようになるが、これでは遅い（調べたところ、(int(s[i:])) % pが）。
    # dp = [0] * p
    # dp[0] = 1
    # tmp = 0
    # for i in range(n)[::-1]:
    #     tmp = (int(s[i:])) % p
    #     dp[tmp] += 1
    # for i in dp:
    #     ans += nCr(i, 2)
    dp = [0] * p
    dp[0] = 1
    tmp = 0
    for i in range(n)[::-1]:
        tmp = (int(s[i]) * pow(10, n - i - 1, p) + tmp) % p
        dp[tmp] += 1
    for i in dp:
        ans += nCr(i, 2)
print(ans)

Measured memory_bytes: 58700
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << endl
#define prtd(n, var)     cout << fixed << setprecision(n) << var << endl
#define prt2(v1, v2)     cout << v1 << " " << v2 << endl
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << endl
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << endl

//----------------------------------------------------------------

int main(void) {
  ll n, a, b;
  cin >> n >> a >> b;

  ll ans=0;
  ans = (n/(a+b))*a;
  if(n%(a+b)>a){
    ans+=a;
  } else {
    ans+=n%(a+b);
  }

  prt(ans);
}


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

using namespace std;

typedef long long ll;

int main () {
    ll N,K,Q; cin>>N>>K>>Q;

    vector<ll> A(Q+1);
    for (int q=1;q<=Q;q++) {
        cin>>A[q];
    }

    vector<ll> P(N+1,0);
    for (int q=1;q<=Q;q++) {
        P[A[q]]++;
    }

    for (int n=1;n<=N;n++) {
        int score = K - Q + P[n];
        if (score > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 2176
#include<stdio.h>

int main(){
  int A[100],i,j,n,tmp;
  int minj,count=0;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);

  for(i=0;i<n-1;i++){
    minj = i;
    for(j=i;j<n;j++){
      if(A[j] < A[minj])
        minj = j;
    }
    if(i != minj){
    count++;
  }
    tmp = A[i];
    A[i] = A[minj];
    A[minj] = tmp;
  }
  for(i=0;i<n-1;i++)
    printf("%d ",A[i]);
  printf("%d\n%d\n",A[n-1],count);

  return 0;
}



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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> nums(N);
    int sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> nums[i];
        sum = sum ^ nums[i];
    }
    // cout << sum << endl;
    for (int i = 0; i < N; i++) {
        cout << (nums[i] ^ sum) << ' ';
    }
    return 0;

}

Measured memory_bytes: 4044
#include <cstdio>
const int maxn = 1e5+5;
int n,col[maxn];
int head[maxn],tot;
struct Edge{
	int next,to,val;
}e[maxn<<1];
inline void add_edge(int x,int y,int z){
	e[++tot].next = head[x];
	e[tot].to = y,e[tot].val = z,head[x] = tot;
}
inline void dfs(int u,int F,int c){
	col[u] = c;
	for(int i=head[u],v;v=e[i].to,i;i=e[i].next)
		if(v != F){
			if(e[i].val&1)dfs(v,u,c^1);
			else dfs(v,u,c);
		}
}
int main(){
	scanf("%d",&n);
	for(int i=1,x,y,z;i<n;++i){
		scanf("%d %d %d",&x,&y,&z);
		add_edge(x,y,z),add_edge(y,x,z);
	}
	dfs(1,0,1);
	for(int i=1;i<=n;++i)printf("%d\n",col[i]);
	return 0;
}

Measured memory_bytes: 7636
m=1001
A=range(9)
d=[[0]*m for i in A]
for i in range(101):
  for j in A[::-1]:
    if j==0: d[j][i]=1
    else:
      for k in range(m-i): d[j][k+i]+=d[j-1][k]
while 1:
  n,s=map(int,raw_input().split())
  if n==s==0: break
  print d[n-1][s]

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

namespace past10.Abc
{
    public class Question2
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            string str = Console.ReadLine();
            int ans = 0;
            for(int i=0;i<str.Length;++i){
              if(str[i]=='1') ++ans;
            }
            
            Console.WriteLine(ans);

            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 25712
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,m,k;cin>>n>>m>>k;
    vector<ll> a(n), b(m);
    rep(i,n)cin>>a[i];
    rep(i,m)cin>>b[i];
    vector<ll> sa(n+1), sb(m+1);
    sa[0]=0; sb[0]=0;
    rep(i,n){
        sa[i+1]=sa[i]+a[i];
    }
    rep(i,m){
        sb[i+1]=sb[i]+b[i];
    }
    ll ans = 0;//0冊は絶対読める
    //Aから読む冊数を全探索
    for(int i=0; i<=n; i++){
        ll anss = 0;
        ll rem = k - sa[i];
        if(rem<0)continue;
        anss = i + (upper_bound(ALL(sb),rem)-sb.begin()-1);
        ans = max(ans, anss);
    }
    cout<<ans<<endl;
    return 0;
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;

const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

ll gcd(ll x, ll y){ return y==0? x: gcd(y, x%y); }

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

	ll x,y;
	cin >>x >>y;
	cout << gcd(x,y) <<"\n";
	return 0;
}



Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
bool comp(int a,int b)
  {
    return(a<b);
  }
  int main()
  {
  int c,d;
  cin>>c>>d;
  cout<<std::max({c+d,c-d,c*d},comp);
  return 0;
  }
  
  


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

using namespace std;
using ll=long long;

ll f(ll x) {
    return x*x*x*x*x;
}

void solve() {
    ll n; cin >> n;
    for (int i = -200; i < 200; i++) {
        for (int j = -200; j < 200; j++) {
            if (f(i)-f(j) == n) {
                cout << i << ' ' << j; return;
            }
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a=sc.nextInt();
		int b=sc.nextInt();
		if((b-a)%2==0)	System.out.println("Alice");
		else	System.out.println("Borys");
	}
}


Measured memory_bytes: 23764
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e8;
using namespace std;

#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")

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

	int a, b, c;
	cin >> a >> b >> c;

	if (a == b&& a== c)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

//重みある時
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;

int main() {
    char c;
    cin >> c;
    cout << (char)(c+1) << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int64_t l[n];
  l[0] = 2, l[1] = 1;
  for (int i = 2; i <= n; i++){
    l[i] = l[i-1] + l[i-2];  
  }
  cout << l[n] << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
unsigned long long int LCM(unsigned long long int a,unsigned long long int b);
unsigned long long int GCD(unsigned long long int a,unsigned long long int b);
int main(){
  int N;
  std::cin >> N;
  std::vector<unsigned long long int> T(N);
  std::cin >> T[0];
  for(int i = 1; i < N; ++i){
    std::cin >> T[i];
    T[i] = LCM(T[i-1],T[i]);
  }
  std::cout << T[N-1] << std::endl;
  return 0;
}

unsigned long long int GCD(unsigned long long int a,unsigned long long int b){
  while(a > 0 && b > 0){
    ((a>b)?a:b) = ((a>b)?a%b:b%a);
  }
  return (a>b)?a:b;
}

unsigned long long int LCM(unsigned long long int a, unsigned long long int b){
  unsigned long long int lcm = GCD(a,b);
  a /= lcm;
  return a*b;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 998244353;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
  ll n,k;
  cin >> n >> k;
  vector<ll> vec(n);
  rep(i,n){
    cin >> vec[i];
  }
  sort(all(vec));
  ll sum = 0;
  rep(i,k){
    sum += vec[i];
  }
  cout << sum << endl;
}

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

#define all(x) x.begin(), x.end()
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A(N), cnt1(100001), cnt2(100001);
    set<int> S;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        S.insert(A[i]);
        if (i & 1) {
            cnt2[A[i]]++;
        } else {
            cnt1[A[i]]++;
        }
    }
    if (S.size() == 1) {
        cout << N / 2 << endl;
        return 0;
    }
    if (max_element(all(cnt1)) - cnt1.begin() == max_element(all(cnt2)) - cnt2.begin()) {
        sort(all(cnt1), greater<int>());
        sort(all(cnt2), greater<int>());
        cout << min(N - (cnt1[0] + cnt2[1]), N - (cnt1[1] + cnt2[0])) << endl;
        return 0;
    }
    cout << N - (*max_element(all(cnt1)) + *max_element(all(cnt2))) << endl;

}

Measured memory_bytes: 6144
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define vvi vector<vector<int>>;
#define mi  map<int,int>
#define mii map<pii,int>
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define sz(x) (int)x.size()
#define all(v) (v).begin(), (v).end()
#define ret(x) return cout<<x,0;
#define rety return cout<<"YES",0;
#define retn return cout<<"NO",0;
#define fl fflush(stdout)   
#define hell 1000000007  
#define hell2 998244353 
#define pi 3.14159265358979323846
vi g[100005],vis(100005),dp(100005);

void dfs(int v,int p){
    vis[v]=1;
    for(auto u:g[v]){
        if(!vis[u])dfs(u,v);
        dp[v]=max(dp[v],dp[u]+1);
    }
}


int solve(){
    int n,m,u,v;
    cin>>n>>m;
    rep(i,0,m){
        cin>>u>>v;u--;v--;
        g[u].pb(v);
    }
    int ans=0;
    rep(i,0,n){
        if(!vis[i])dfs(i,i);
        ans=max(ans,dp[i]);
      //  cout<<dp[i]<<' ';
    }
    cout<<ans;
    return 0;
}

signed main(){
    IOS;
    int t=1;
  
    //cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
} 

Measured memory_bytes: 12884
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin >> n;
	int a[105];
	for (int i = 1; i <= n; i++){
		cin >> a[i];
	}
	sort(a + 1, a + n +1);
	int total = 1000000000;
	for (int i = 1; i <= 100; i++){
		int res = 0;
		for (int j = 1; j <= n; j++){
			res += (a[j] - i) * (a[j] - i);
		}
		total = min(total, res);
	}
	cout << total << endl;
	return 0;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,fac=0,ans=0,now,num;
    while(cin>>n&&n!=0){
        for(int i=1;;i++){
            num=5*i;
            if(num>n)break;
            for(int j=1;num%5==0;j++){
                num/=5;
                now=j;
            }
                ans+=now;
        }
        cout<<ans<<endl;
        ans=0;
    }
}

Measured memory_bytes: 1160
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        """
        親が同じか判別する
        """
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        """
        yをxの根に繋ぐ
        """
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        """
        xとyが同じ連結成分か判別する
        """
        return self.find(x) == self.find(y)

    def size(self, x):
        """
        xの連結成分の大きさを返す
        """
        return -self.parents[self.find(x)]

    def kruskal(self, edge):
        """
        :param edge: edge = [(コスト, 頂点1, 頂点2),...]の形で重み付き隣接リストを渡して下さい
        :return: 最小全域木のコストの和
        """
        edge.sort()
        cost_sum = 0
        for cost, node1, node2 in edge:
            if not self.same(node1, node2):
                cost_sum += cost
                self.union(node1, node2)
        return cost_sum


def resolve():
    n = int(input())
    X, Y = [], []
    for i in range(n):
        x, y = map(int, input().split())
        X.append([x, i])
        Y.append([y, i])
    X.sort()
    Y.sort()
    edge = []
    for i in range(1, n):
        cost1 = X[i][0] - X[i - 1][0]
        edge.append([cost1, X[i - 1][1], X[i][1]])
        cost2 = Y[i][0] - Y[i - 1][0]
        edge.append([cost2, Y[i - 1][1], Y[i][1]])

    uf = UnionFind(n)
    res = uf.kruskal(edge)
    print(res)


if __name__ == '__main__':
    resolve()


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

int InsertionSort(int n, int a[]) {
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int min_j = i;
        bool f = false;
        for (int j = i; j < n; j++) {
            if (a[j] < a[min_j]) {
                min_j = j;
                f = true;
            }
        }
        swap(a[i], a[min_j]);
        if (f) ans++;
    }
    
    return ans;
}

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

    int ans = InsertionSort(n, a);
    for (int i = 0; i < n; i++) {
        if (i == n - 1) cout << a[i];
        else cout << a[i] << " ";
    }
    cout << endl;

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


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
    


  int main(){
    lint n,q;
    cin>>n;
    lint x=n;
    lint ans=1;
    while(n%360!=0){
        n+=x;
        ans++;
    }
    cout<<ans<<endl;
     }
     

  
 
  
      
      
    
 
  
          
  

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
#define vi vector<int>
#define vl vector<long long>
#define vii vector<int,vector<int>>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;



int main()
{
    string S;
    cin >> S;
    int ans = 700;
    rep(i,3){
        if(S[i] == 'o') ans += 100;
    }
    out(ans);



    return 0;
}


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

const int INF = 1001001001;

int main(){
  string s;
  cin >> s;
  int n = s.size();
  bool NG = 0;
  for(int i=0;i<n;){
    string word = "";
    bool flag = 0;
    for(int j=i;j<i+7;j++){
      word.push_back(s.at(j));
      if(j == n - 1){
        flag = 1;
        break;
      } 
    }
    if(flag == 0){
      i += 7;
      if(word == "dreamer"){
        if(s.at(i) == 'a') i-=2;
      }else if(word == "dreamdr" || word == "erasedr" || word == "eraseer"){
        i-=2;
      }else if(word =="eraserd" || word == "erasere"){
        i--;
      }else{
        NG = 1; break;
      }
    }else{
      if(word != "erase" && word != "dream" && word!="eraser" && word!="dreamer"){
      NG = 1; break;
      }
      break;
    }
  }
  if(NG == 1){
    cout << "NO";
  }else{
    cout << "YES";
  }
}

Measured memory_bytes: 512
def answer(n, y)
  (0..n).each do |i|
    a = i
    (0..(n-i)).each do |j|
      b = j
      c = n - i - j
      if (a * 10 + b * 5 + c * 1) == (y / 1000)
        return "#{a} #{b} #{c}"
      end
    end
  end
  "#{-1} #{-1} #{-1}"
end

input = gets.split(' ').map(&:to_i)
puts answer(input[0], input[1])


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

int main(){ 
  Int H, N, Sum = 0;
  cin >> H >> N;
  rep (i,N){
    Int A;
    cin >> A;
    Sum += A;
  }
  
  if (H <= Sum) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    N, Q = LI()
    s = SI()
    TD = []
    for _ in range(Q):
        TD.append(LS())
    rev = TD[::-1]
    l, r = -1, N
    for t, d in rev:
        if t == s[l + 1] and d == 'L':
            l += 1
        elif t == s[r - 1] and d == 'R':
            r -= 1
        if l > -1 and t == s[l] and d == 'R':
            l -= 1
        elif r < N and t == s[r] and d == 'L':
            r += 1
        if r == 0 or l == N - 1:
            break
    ans = max(0, r - l - 1)
    return ans

print(main())

Measured memory_bytes: 40904
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;


int main(){
int N,count=0,K;
cin>>N>>K;
int list[N];
rep(i,N){
    list[i]=0;
}
rep(i,N){
    int A;
    cin>>A;
    if(list[A-1]==0){
        count++;
        
    }
    list[A-1]++;
}

if(count<=K){
    cout<<0<<endl;
}
else{
    sort(list,list+N);
    int res=count-K;
    int ans=0;
    rep(i,N){
        if((res>0)&&(list[i]!=0)){
            res--;
            ans+=list[i];

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

Measured memory_bytes: 4380
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
const double eps = 1e-7;
int N, M, K, Q, T;
int cnt[30];

int main()
{
	int i, j;
	scanf("%d", &N);
	queue<string> q;
	q.push("a");
	for (i = 2; i <= N; ++i) {
		int sz = q.size();
		while(sz--) {
			string s = q.front();
			q.pop();
			for (j = 0; j < s.size(); ++j) cnt[s[j] - 'a'] = 0;
			int ucc = 0;
			for (j = 0; j < s.size(); ++j) {
				if (cnt[s[j] - 'a'] == 0) {
					++ucc;
					cnt[s[j] - 'a']++;
				}
			}
			for (j = 0; j <= ucc; ++j) {
				char c = 'a' + j;
				string t = s + c;
				q.push(t);
			}
		}
	}
	while (!q.empty()) {
		string s = q.front();
		q.pop();
		cout << s << "\n";
	}
}

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

#define ll long long
#define debug(x) cerr << fixed << #x << " is " << x << endl;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	int k;
	cin >> s >> k;
	set<string> m;
	int n = s.size();

	for(int i = 0; i < n; i++)
		for(int j = 1; j <= min(5, n-i); j++)
			m.insert(s.substr(i, j));
	for(auto i : m)
	{
		k--;
		if(k == 0)
		{
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 1664
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

int main()
{
	int a, b;
	cin >> a >> b;
	if(b * 2 > a) cout << 0 << endl;
	else cout << a - b * 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi 3.1415  
#define ll long long
#define pii pair<int,int>
#define debug(a) cout<<a<<'\n'
#define maxn 1009
#define MOD 1000000007
#define INF (int)300000009
using namespace std;
int n,m;
int c[maxn];
vector<int> adj[maxn];
int dp[1009][1<<12];
int solve(int id,int bitmask){
    if(bitmask==(1<<n)-1)return 0;
    if(id>=m && bitmask!=(1<<n)-1)return INF;
    if(dp[id][bitmask]!=-1)return dp[id][bitmask];
    int bitmask2=bitmask;
    for(auto e: adj[id]){
        if(!(bitmask2&(1<<(e-1))))bitmask2+=(1<<(e-1));
    }
    return dp[id][bitmask]=min(solve(id+1,bitmask2)+c[id],solve(id+1,bitmask));
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    memset(dp,-1,sizeof dp);
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int qtd;
        cin>>c[i]>>qtd;
        for(int j=0;j<qtd;j++){
            int d;
            cin>>d;
            adj[i].push_back(d);
        }
    }
    int ans=solve(0,0);
    if(ans==INF)cout<<-1<<'\n';
    else cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 16512
# import bisect
# import copy
# import fractions
#import math
#import decimal
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    a,b,c=map(int,input().split())
    if 4*a*b<(c-a-b)**2 and c-a-b>0:
        print('Yes')
    else:
        print('No')

resolve()

Measured memory_bytes: 2940
#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(){
    string n;
    cin >> n;
    int ans = 0;
    REP(i,n.size()){
        if(n[i] == '2'){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

class Program
{
    int a, b, c, d, e, f;
    void Run()
    {
        var sc = new Scanner();
        a = sc.NextInt();
        b = sc.NextInt();
        c = sc.NextInt();
        d = sc.NextInt();
        e = sc.NextInt();
        f = sc.NextInt();

        int maxw = 0;
        int maxs = 0;
        double maxd = -1;
        for (int i = 0; i <= 30; i++)
        {
            for (int j = 0; j <= 30; j++)
            {
                int w = i * a * 100 + j * b * 100;
                if (i + j == 0 || w > f) continue;
                int lims = w / 100 * e;
                int s = 0;
                int cc = 0;
                while (cc <= Math.Min(lims, f - w))
                {
                    s = Math.Max(cc + (Math.Min(lims, f - w) - cc) / d * d, s);
                    cc += c;
                }
                double dd = (double)s / (w + s);
                if (w + s <= f && dd > maxd)
                {
                    maxd = dd;
                    maxw = w;
                    maxs = s;
                }
            }
        }
        Console.WriteLine("{0} {1}", maxw + maxs, maxs);
    }

    static void Main(string[] args)
    {
        new Program().Run();
    }

    static long Gcd(long a, long b)
    {
        if (a < b) return Gcd(b, a);
        if (b == 0) return a;
        return Gcd(b, a % b);
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }

    public long NextLong()
    {
        CheckNext();
        return long.Parse(buf[index++]);
    }

    public double NextDouble()
    {
        CheckNext();
        return double.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}


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

#define FOR(i,start,end) for(int i=start; i<(int)(end); i++)
#define REP(i,n) FOR(i,0,n)
#define SIZE_OF_ARRAY(array)  (sizeof(array)/sizeof((array)[0]))

template<class T> void print(const T& value) { cout << value << "\n"; }

int main() {

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

    int x;
    scanf("%d", &x);
    printf("%d\n", x * x * x);


    return 0;
}



Measured memory_bytes: 3220
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int n = sc.nextInt();
			if(n == 0) break;
			int a[] = new int[n];
			for(int i=0;i<n;i++) {
				a[i] = sc.nextInt();
			}
			int s = sc.nextInt();
			System.out.println(binarySearch(a, s));
		}
	}
	int binarySearch(int[] a, int x) {
		int cnt = 0;
		int left = 0;
		int right = a.length-1;
		int center = (left + right) / 2;
		for(;left <= right;) {
			cnt++;
			if(a[center] == x) break;
			else if(a[center] > x) right = center-1;
			else left = center + 1;
			center = (left + right) / 2;
		}
		
		return cnt;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cii(n);
    cii(k);
    auto ans = (n % k == 0)
            ?0
            :1;
    co(ans);
    return 0;
}

Measured memory_bytes: 256