akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
//#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
//#include <string>
//#include <time.h>
//#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
//#include <string.h>
#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define LL long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
using namespace std;
const LL MOD=1e9+7;
LL n,a,b,mx,h[100010];
bool check(LL mid)
{
	LL sum=0;
	rep(i,n)
	{
		if(h[i]-mid*b>0) 
			sum+=(h[i]-mid*b+(a-b-1))/(a-b);
	}
	return sum<=mid;
}
int main()
{
	cin>>n>>a>>b;
	LL mid;
	rep(i,n)
	{
		cin>>h[i];
		mx=max(h[i],mx);
	}
	LL lb=(mx+a-1)/a,ub=(mx+b-1)/b;
	while(lb<ub)
	{
		mid=(lb+ub)/2;
		if(check(mid)) ub=mid;
		else lb=mid+1;
	}
	cout<<lb<<endl;
  rt0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b;
	while(true){
	cin>>a>>b;
	if(a==0&&b==0)
		break;
	int ans=0;
	int x,y;
	x=max(a,b),y=min(a,b);
	while(true){
		if(y==0)
			break;
		ans++;
		x%=y;
		a=x,b=y;
		x=max(a,b),y=min(a,b);
	}
	cout<<x<<" "<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j] << "   ";
		}
		cout << endl;
	}
}


const int dy[4] = {-1, 0, 1, 0};
const int dx[4] = {0, -1, 0, 1};
typedef pair<int, int> P;
const int INF = 100100100;
int main(){//
    int H, W;
    cin >> H >> W;
    vector<string> s(H);
    for(int i=0; i<s.size(); i++) cin >> s[i]; //コンパイルエラーでた
    //for(int i=0; i<H; i++) cin >> s[i];
    //BFSして最短経路を見つけ，　
    //そのあと，黒く塗れるマスを数える
    vector<vector<int>> grid(H, vector<int>(W, INF));
    grid[0][0] = 0;
    queue<P> q;
    q.push(P(0, 0));
    while(!q.empty()){
        int y = q.front().first;
        int x = q.front().second;
        q.pop();

        for(int dir=0; dir<4; dir++){
            int next_y = y + dy[dir];
            int next_x = x + dx[dir];
            if(next_y < 0 || H <= next_y) continue;
            if(next_x < 0 || W <= next_x) continue;
            if(s[next_y][next_x] == '#') continue;
            if(grid[next_y][next_x] != INF) continue;
            grid[next_y][next_x] = grid[y][x] + 1;
            q.push(P(next_y, next_x));
        }
    }

    //cout << " BFS is completed ! " << endl;
    int ans = 0;
    if(grid[H-1][W-1] == INF){
        ans = -1;
        cout << ans << endl;
        return 0;
    }
    int min_step = grid[H-1][W-1];
    //gridの中に同じ値が入っていたら数える為のフラグ
    vector<bool> is_double(min_step+5, false); 
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(grid[i][j] > min_step && s[i][j] == '.'){
                ans++;
                continue;
            }
            if(s[i][j] == '#') continue;
            if(is_double[grid[i][j]] == true){
                ans++;
                continue;
            }
            is_double[grid[i][j]] = true;

        }
    }

    cout << ans << endl;



}


Measured memory_bytes: 3632
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  int key;
  struct node *l;
  struct node *r;
  struct node *p;
};

typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMaximum(Node);
Node treeMinimum(Node);
Node treeSearch(Node, int);
Node treeSuccessor(Node);
void treeDelete(Node);
void insert(int);
void inorder(Node);
void preorder(Node);


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Node treeMaximum(Node x){
  while(x->r != NIL)x = x->r;
  return x;

}

Node treeMinimum(Node x){
  while(x->l != NIL)x = x->l;
  return x;
}

Node treeSearch(Node u, int k){
  while(u != NIL && k != u->key){
    if(k < u->key ) u = u->l;
    else u = u->r;
  }
  return u;
}

Node treeSuccessor(Node x){
  if(x->r != NIL) return treeMinimum(x->r);
  Node y = x->p;
  while(y != NIL && x == y->r){
    x = y;
    y = y->p;
  }
  return y;
}

void treeDelete(Node z){
  Node y;
  Node x;

  if(z->l == NIL || z->r == NIL) y = z;
  else y = treeSuccessor(z);

  if(y->l != NIL){
    x = y->l;
  }
  else{
    x = y->r;
  }

  if(x != NIL){
    x->p = y->p;
  }

  if(y->p == NIL){
    root = x;
  }
  else{
    if(y == y->p->l){
      y->p->l = x;
    }
    else{
      y->p->r = x;
    }
  }

  if(y != z){
    z->key = y->key;
  }

  free(y);
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->l = NIL;
  z->r = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->l;
    }
    else{
      x = x->r;
    }
  }

  z->p = y;
  if(y == NIL){
    root = z;
  }
  else{
    if(z->key < y->key){
      y->l = z;
    }
    else{
      y->r = z;
    }
  }
}

void inorder(Node u){
  if(u == NIL) return ;
  inorder(u->l);
  printf(" %d",u->key);
  inorder(u->r);
}

void preorder(Node u){
  if(u == NIL) return ;
  printf(" %d",u->key);
  preorder(u->l);
  preorder(u->r);
}



Measured memory_bytes: 20460
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FIR first
#define SEC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

signed main(){
  int x,y,z;
  cin>>x>>y>>z;
  int ans=0;
  int tmp=0;
  LOOP(i,1,100000){
    if(i*y+(i+1)*z<=x){
      ans=max(ans,i);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

string d;
int n;
int sumD = 0;
ll prodD = 1;

const int SUM=130;
// unknown, small, large
unordered_map<ll,ll> dp[15][SUM][3];
ll dfs(int x, int sum, int sl, ll prod){
    if(x==n){
        if(sum<sumD) return 1;
        else if(sum==sumD){
            if(prod<prodD) return 1;
            else if(prod==prodD){
                if(sl == 1) return 1;
            }
        }
        return 0;
    }

    if(dp[x][sum][sl].count(prod)) return dp[x][sum][sl][prod];

    ll ret = 0;
    rep(i,10){
        int nsl = sl;
        if(sl==0){
            int v = d[x]-'0';
            if(i<v) nsl = 1;
            if(i>v) nsl = 2;
        }

        ret += dfs(x+1, sum+i, nsl, prod*(i+1));
    }
    return dp[x][sum][sl][prod] = ret;
}

int main(){
    cin >>d;
    n = d.size();

    rep(i,n){
        int v = d[i]-'0';
        sumD += v;
        prodD *= (v+1);
    }

    cout << dfs(0,0,0,1) << endl;
    return 0;
}



Measured memory_bytes: 35708
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

vector<ld>rs;
ld memo[13][1 << 12];
ld getans(const int from, bitset<12>&bs) {
	if (memo[from][bs.to_ulong()] < -1) {
		if (bs.count() == 0)return 0;
		ld ans = 1e18;
		for (int i = 0; i < rs.size(); ++i) {
			if (bs[i]) {
				ld plus;
				ld a = rs[i];
				if (from == 12) {
					plus = 2 * a;
				}
				else {
					ld b = rs[from];
					plus=sqrt((a + b)*(a + b) - (a - b)*(a - b))-b+a;
				} 
				bs[i] = false;
				ans = min(ans,plus+ getans(i, bs));
				bs[i] = true;
			}
		}
		memo[from][bs.to_ulong()] = ans;
	}
	return memo[from][bs.to_ulong()];
}
vector<string> split(const string &str, char delim) {
	vector<string> res;
	size_t current = 0, found;
	while ((found = str.find_first_of(delim, current)) != string::npos) {
		res.push_back(string(str, current, found - current));
		current = found + 1;
	}
	res.push_back(string(str, current, str.size() - current));
	return res;
}
int main() {
	string st;
	while (getline(cin,st)) {
		vector<string>sts = split(st, ' ');
		int W = stoi(sts[0]);
		rs.clear();
		for (int i = 1; i < sts.size(); ++i) {
			rs.push_back(stold(sts[i]));
		}
		for (int i = 0; i < 13; ++i) {
			for (int j = 0; j < (1 << 12); ++j) {
				memo[i][j] = -2;
			}
		}
		
		
		bitset<12>bs((1 << rs.size()) - 1);
		ld sum = getans(12, bs);
		if (sum > W)cout << "NA" << endl;
		else cout << "OK" << endl;
		
	}
	return 0;
}

Measured memory_bytes: 3976
#include <iostream>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s.at(0) == '7' or s.at(1) == '7' or s.at(2) == '7') {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rp(i,n){
        cin >> a.at(i);
    }
    sort(a.begin(),a.end());
    
    int i=0,ans=0;
    while(i<n){
        int cnt=1;
        while(i<n-1&&a.at(i)==a.at(i+1)){
            i++;
            cnt++;
        }
        ans += (cnt-a.at(i)>=0?cnt-a.at(i):cnt);
        i++;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
<?php
error_reporting(0);
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (strlen($l)==0) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->N = $a[0];
    $fi++;
    continue;
  }
  if ($fi > 0) {
    $a = explode(" ",$l);
    $key->A[]=$a[0];
  }
}
$t = min($key->N,$key->A[0]);
$x = $t * $key->A[1];
if ($key->N > $key->A[0]) {
  $x += $key->A[2] * ($key->N - $key->A[0]);
}
printf("%d\n",$x);


Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    // Write Your Code Below
    int n,W;cin >> n >> W;
    vector<ll> v(n), w(n);
    vector<vector<ll>> dp(n+1, vector<ll>(W+1));
    for(int i=0;i<n;i++){
        cin >> v[i] >> w[i];
    }
    for(int i=0;i<=n;i++) dp[i][0] = 0;
    for(int i=0;i<=W;i++) dp[0][i] = 0;
    
    for(int i=1;i<=n;i++){
        for(int j=1;j<=W;j++){
            if(j-w[i-1]<0) dp[i][j] = dp[i-1][j];
            else dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
        }
    }
    
    cout << dp[n][W] << endl;
}



Measured memory_bytes: 10808
//task scheduling problem
#include<bits/stdc++.h>
using namespace std;
int main(){
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2);
    sort(vec.begin(), vec.end());
    int count = 0;
    for(int i = 0;i <2 ; i++){
        count += vec.at(i + 1) - vec.at(i);
    }
    cout << count << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> num(1e6+5,0);
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  sort(A.begin(),A.end());
  for(int i=0;i<N;i++){
    int a=A[i];
    if(num[a]>=2){
      continue;;
    }
    while(a<=1e6+3){
      num[a]++;
      a+=A[i];
    }
  }
  int ans=0;
  for(int i=0;i<N;i++){
    if(num[A[i]]==1){
      ans++;
    }
  }
  cout << ans << endl;
}

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

class LazySegmentTree
{
  public:
    LazySegmentTree(ll n)
    {
        ll c = 1;
        while (c < n)
            c <<= 1;
        REP(i, 2 * c - 1)
        {
            node.push_back(0);
            lazy.push_back(0);
        }
        mN = c - 1;
    }

    //! 0-index 区間加算
    void add(ll value, int left, int right, int k = 0, int l = 0, int r = -1)
    {
        if (r < 0)
        {
            r = mN;
            value = value * (mN + 1);
        }
        LazyProgation(k);
        if (r < left || right < l)
            return;
        if (left <= l && r <= right)
        {
            //! 区間を完全被覆しているのでlazyに区間和を入れる
            lazy[k] += value;
            LazyProgation(k);
        }
        else
        {
            add(value / 2, left, right, 2 * k + 1, l, (l + r) / 2);
            add(value / 2, left, right, 2 * k + 2, (l + r) / 2 + 1, r);
            node[k] = node[2 * k + 1] + node[2 * k + 2];
        }
    }

    //! 0-index 区間和
    ll sum(ll left, ll right, int k = 0, int l = 0, int r = -1)
    {
        if (r < 0)
            r = mN;
        if (r < left || right < l)
            return 0;

        LazyProgation(k);
        if (left <= l && r <= right)
            return node[k];
        return sum(left, right, 2 * k + 1, l, (l + r) / 2) + sum(left, right, 2 * k + 2, (l + r) / 2 + 1, r);
    }

    void dev()
    {
        FOR(i, node.size(), 0)
        {
            cout << node[i] << ";" << lazy[i] << " ";
        }
        cout << endl;
    }

  private:
    //! index番目のnodeの遅延評価
    void LazyProgation(int index)
    {
        if (lazy[index] == 0)
            return;
        node[index] += lazy[index];
        if (2 * index + 1 < node.size())
        {
            lazy[2 * index + 1] += lazy[index] / 2;
            lazy[2 * index + 2] += lazy[index] / 2;
        }
        lazy[index] = 0;
    }

    ll mN;
    vector<ll> node;
    //! 遅延評価配列
    vector<ll> lazy;
};

int main()
{
    ll N, Q;
    cin >> N >> Q;
    LazySegmentTree seg(N);
    REP(i, Q)
    {
        int c;
        cin >> c;
        if (c == 0)
        {
            ll s, t, x;
            cin >> s >> t >> x;
            s--;
            t--;
            seg.add(x, s, t);
        }
        else
        {
            ll s, t;
            cin >> s >> t;
            s--;
            t--;
            cout << seg.sum(s, t) << endl;
        }
        //seg.dev();
    }
    return 0;
}


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

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ull unsigned long long int
#define ll long long int
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define MOD (ull)(double)(1e9 + 7)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vb vector<bool>
#define vd vector<double>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vs vector<string>
#define pull pair<ull, ull>
#define F first
#define S second
#define m_p make_pair
#define debug(x) cout << #x << " " << x << endl
#define printArr(a, start, end)for(int i=start ; i<end ; ++i)cout << a[i] << " ";cout << '\n';
#define readArr(a, start, end)for(int i=start ; i<end ; ++i)cin >> a[i];
#define read2D(mat, n, m)for(int i=0 ; i<n ; ++i)for(int j=0 ; j<m ; ++j)cin >> mat[i][j];

const long double PI = 3.141592653589793238462643383279502884197169399;

// Find Set LSB = (x&(-x)), isPowerOfTwo = (x & (x-1))

void solve(){
	int n;
	cin >> n;
	
	vll a(n);
	for(ll& x : a)cin >> x;
	
	vll suf(n);
	suf[n-1] = 0;suf[n-2] = a[n-1];
	for(int i=n-3 ; i>=0 ; --i)suf[i] = suf[i+1] + a[i+1], suf[i] %= MOD;
	
	ll ans=0;
	for(int i=0 ; i<n ; ++i){
		ans += ((a[i] * suf[i]) % MOD);
		ans %= MOD;
	}
	
	cout << ans;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cout << fixed << setprecision(10);
	
	int tt=1;
	//cin >> tt;
	
	while(tt--){
		solve();
	}
}


Measured memory_bytes: 6368
L, R = map(int, input().split())
ans = 2018
for i in range(L, R):
    for j in range(L+1, R+1):
        if ans > (i*j) % 2019:
            ans = (i*j) % 2019
            if ans==0:
                break
    if ans == 0:
        break
print(ans)


Measured memory_bytes: 9172
I=9**9
h,a,*m=open(0)
h,w,k,a,b,f,g=map(int,(h+a).split())
d=[I]*h*w
a=~w+a*w+b
d[a]=1
q=[a]
for s in q:
 for y,x in(1,0),(-1,0),(0,1),(0,-1):
  for z in range(k):
   i,j=s//w+y*~z,s%w+x*~z;t=i*w+j
   if(h>i>-1<j<w)-1or'.'<m[i][j]or d[t]<=d[s]:break
   if d[t]==I:q+=t,;d[t]=d[s]+1
print(d[~w+f*w+g]%I-1)

Measured memory_bytes: 132264
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Objects;
import java.util.StringTokenizer;
import java.util.stream.Collectors;

public class Main{ // Main

	public static void main(String args[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	static long now() {
		return System.currentTimeMillis();
	}

	static void trace(Object... objects) {
		assert null != System.out.format("trace:%s\n", Arrays.deepToString(objects));
	}

	private static void solve(ConsoleScanner cin, PrintWriter cout) {
		// assert solve(1) == 1;

		int h = cin.nextInt();
		int w = cin.nextInt();
		int n = cin.nextInt();

		int[] a = new int[n];
		for (int i = 0; i < a.length; i++)
			a[i] = cin.nextInt();

		long start = now();

		int[][] ans = solve(h, w, n, a);
		String ansstr = Arrays.stream(ans)
				.map(row -> Arrays.stream(row).mapToObj(Objects::toString).collect(Collectors.joining(" ")))
				.collect(Collectors.joining(System.lineSeparator()));
		cout.println(ansstr);

		trace("elapsed", now() - start);
	}

	private static int[][] solve(int h, int w, int n, int[] a) {
		int[][] ans = new int[h][w];
		int c = 0;
		for (int y = 0; y < h; y++) {
			int s, d;
			if (y % 2 == 0) {
				s = 0;
				d = 1;
			} else {
				s = w - 1;
				d = -1;
			}
			for (int i = 0, x = s; i < w; i++, x += d) {
				ans[y][x] = c + 1;
				a[c] -= 1;
				if (a[c] == 0)
					c += 1;
			}
		}
		return ans;
	}

	static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


Measured memory_bytes: 28884
package main

import "fmt"

func main() {
	var b string
	fmt.Scan(&b)
	switch b {
	case "A":
		fmt.Println("T")
	case "C":
		fmt.Println("G")
	case "G":
		fmt.Println("C")
	case "T":
		fmt.Println("A")
	}
}


Measured memory_bytes: 512
h,w,kk = map(int,input().split())
arr = []
for i in range(h):
    arr.append(list(map(int,list(input()))))

h_loop = 2**(h-1)
ans = 100000000
for i in range(h_loop):
    sep = format(i,'b').zfill(h-1)
    ups = sum(map(int,list(sep)))
    slash = ups
    buf = [0 for j in range(ups+1)]
    temp_buf = [0 for j in range(ups+1)]
    is_sep = False
    # print(sep)
    # print("########")
    # print(slash)
    for j in range(w):
        # print("#####")
        # print(j)
        b_ind = 0
        is_sep = False
        for k in range(h):
            if k == 0:
                temp_buf[b_ind] += arr[k][j]
            else:
                if sep[k-1] == "1":
                    b_ind += 1
                    temp_buf[b_ind] += arr[k][j]
                else:
                    temp_buf[b_ind] += arr[k][j]

        for k in range(ups+1):
            if temp_buf[k] + buf[k] > kk :
                is_sep = True
        for k in range(ups+1):
            if buf[k] > kk :
                slash = 1000000000
        # print(buf)
        # print(temp_buf)
        # print(is_sep)
        if is_sep:
            slash += 1
            buf = temp_buf
        else:
            for k in range(ups+1):
                buf[k] += temp_buf[k]

        temp_buf = [0 for j in range(ups + 1)]


    # print(slash)
    if ans > slash:
        ans = slash

print(ans)




Measured memory_bytes: 50652
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto H = RD;
	auto W = RD;
	auto A = new string[](H);
	foreach (i; 0..H)
	{
		A[i] = RD!string;
	}
	
	long[3][] open;
	auto used = new long[][](H, W);
	foreach (i; 0..H)
	{
		fill(used[i], long.max);
		foreach (j; 0..W)
		{
			if (A[i][j] == '#')
			{
				open ~= [i, j, 0];
				used[i][j] = 0;
			}
		}
	}

	long ans;
	void f(long y, long x, long c)
	{
		if (c < used[y][x])
		{
			used[y][x] = c;
			open ~= [y, x, c];
			ans = max(ans, c);
		}
	}
	while (!open.empty)
	{
		auto n = open.front; open.popFront;
		auto y = n[0];
		auto x = n[1];
		auto c = n[2] + 1;
		if (inside(y-1, 0, H))
		{
			f(y-1, x, c);
		}
		if (inside(y+1, 0, H))
		{
			f(y+1, x, c);
		}
		if (inside(x-1, 0, W))
		{
			f(y, x-1, c);
		}
		if (inside(x+1, 0, W))
		{
			f(y, x+1, c);
		}
	}

	writeln(ans);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 59596
/*
 * Author:  heyuhhh
 * Created Time:  2020/5/5 18:32:48
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <assert.h>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << std::endl; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
  template <template<typename...> class T, typename t, typename... A> 
  void err(const T <t> &arg, const A&... args) {
  for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
  #define dbg(...)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e5 + 5;

string s1 = "ABC", s2 = "ARC";

void run() {
    string s; cin >> s;
    if (s == s1) {
        cout << s2 << '\n';   
    } else {
        cout << s1 << '\n';   
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    run();
    return 0;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int H,W;

		Scanner sc = new Scanner(System.in);

		while(true) {
			H = sc.nextInt();
			W = sc.nextInt();

			if(H==0 && W==0) break;

			for ( int i = 0; i < H; i++ ){
			    for ( int j = 0; j < W; j++ ){
			        if((i+j)%2 == 0){
			            System.out.print("#");
			        } else {
			            System.out.print(".");
			        }
			    }
			    System.out.println();
			}
			System.out.println();
		}
	}

}


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

int main () {
	int n, a, cnt, max = 0, ans = 1;
	cin >> n;

	for (int i = 1; i <= n; i++) {
		a = i;
		cnt = 0;
		while (a / 2 != 0) {
			a /= 2;
			cnt++;
		}
		if (max < cnt) {
			max = cnt;
			ans = i;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = nextInt();
        int[] A = new int[N];
        int[] B = new int[N -1];
        for(int i=0; i<N - 1; i++){
            B[i] = nextInt();
        }

        int Answer = B[0];
        A[0] = B[0];

        for(int i=1; i<N - 1; i++){
            if (B[i] > B[i - 1]) {
            	A[i] = B[i - 1];
            } else {
            	A[i] = B[i];
            }
            Answer += A[i];
        }

        if (N > 1) {
            Answer += B[N - 2];
        }

        println(Answer);
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}

Measured memory_bytes: 21588
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sparsh Sanchorawala
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BBattle solver = new BBattle();
        solver.solve(1, in, out);
        out.close();
    }

    static class BBattle {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            int a = s.nextInt(), b = s.nextInt(), c = s.nextInt(), d = s.nextInt();
            int t = 0;
            while (a > 0 && c > 0) {
                if (t == 0) {
                    c -= b;
                } else {
                    a -= d;
                }
                t ^= 1;
            }
            if (a > 0)
                w.println("Yes");
            else
                w.println("No");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 32532
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/
int n,u,v;
vi to[100010];
vi ao(100100,100100),taka(100100,100100);

void aoki(int vv,int pp){
	for(int u:to[vv]){
		if(u==pp) continue;
		ao[u]=ao[vv]+1;
		aoki(u,vv);
	}

}
void takahashi(int vv,int pp){
	for(int u:to[vv]){
		if(u==pp) continue;
		taka[u]=taka[vv]+1;
		takahashi(u,vv);
	}

}

signed main(){
	cin>>n>>u>>v;
	u--;v--;
	rep(i,n-1){
		int a,b;
		cin>>a>>b;
		a--;b--;
		to[a].pb(b);
		to[b].pb(a);
	}
	ao[v]=0;
	taka[u]=0;
	aoki(v,-1);
	takahashi(u,-1);

	vi leaf;
	rep(i,n){
		if(to[i].size()==1){
			if(taka[i]<ao[i]){
				leaf.pb(i);
			}
		}
	}
	int ans=0;
	for(int k:leaf){
		chmax(ans,ao[k]-1);
	}
	cout<<ans<<endl;

	




	return 0;
}



Measured memory_bytes: 14592
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
using namespace std;
int main(){
  string s;
  cin >>s;
  for(int i=0;i<19;i++){
    if(s[i]==',')cout<<' ';
    else cout <<s[i];
  }
  cout<<endl;
}


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

int main()
{
  string s;
  cin >> s;
  string ans = "No";
  rep(i, s.size() - 1)
    if (s[i] != s[i+1])
    {
        ans = "Yes";
        break;
    }
  cout << ans << endl;
}

Measured memory_bytes: 256
S = list(input().strip())

p1 = ['1' if i%2==0 else '0' for i in range(len(S))]
p2 = ['0' if i%2==0 else '1' for i in range(len(S))]

d1 = len([1 for s,p in zip(S,p1) if not s == p])
d2 = len([1 for s,p in zip(S,p2) if not s == p])

print(min(d1,d2))

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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


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

	int mx = 55556;
	bool isprime[mx];

	for (int i = 0; i < mx; i++) {
		isprime[i] = true;
	}

	for (int i = 2; i < mx; i++) {
		for (int j = i*2; j < mx; j+=i) {
			isprime[j] = false;
		}
	}

	bool ans[mx];

	int num = 0;
	for (int i = 2; i < mx; ++i) {
		if (i % 5 == 1 && isprime[i]) {
			if (num == n-1) {
				cout << i << "\n";
				break;
			} else {
				cout << i << " ";
				num++;
			}
		}
	}
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int H, W;
  while(1){
    cin >> H >> W;
    if(H == 0 && W == 0)break;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        cout << "#";
      }
      cout << "\n";
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3080
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <unordered_map>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

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

    vector<ll> L(N);
    for (ll i = 0; i < N; i++)
    {
        scanf("%lld", &L[i]);
    }

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

    ll ans = 0;
    for (ll i = 0; i < N; i++)
    {
        for (ll j = i; j < N; j++)
        {
            for (ll k = j; k < N; k++)
            {
                if (L[i] + L[j] > L[k])
                {
                    if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i])
                        ans++;
                }
                else
                {
                    break;
                }
            }
        }
    }

    printf("%lld\n", ans);
}


Measured memory_bytes: 3792
#include<bits/stdc++.h>
using namespace std;
char c[2][2]={'R','Y','G','B'};
char ma[2001][2001];
int d,f=0;

void dfs(int x,int y,int cn1,int cn2){
  //cout<<x<<" "<<y<<endl;
  cn1%=2;
  cn2%=2;
  if(x<0||y<0||x>=2000||y>=2000)return;
  if(ma[x][y]!='#')return;
    
  for(int i=-d/2;i<=d/2;i++)
    for(int j=-d/2;j<=d/2;j++){
      if(x+i<0||y+j<0||x+i>=2000||y+j>=2000)continue;
      if(abs(i)+abs(j)>d/2)continue;
      ma[x+i][y+j]=c[cn1][cn2];
    }

  dfs(x+d/2,y+d/2+1+f,cn1,cn2+1);
  dfs(x-d/2,y-d/2-1-f,cn1,cn2+1);
  dfs(x-d/2-1,y+d/2+f,cn1+1,cn2);
  dfs(x+d/2+1,y-d/2-f,cn1+1,cn2);
    
}

int main(){
  int h,w;
  cin>>h>>w>>d;
  if(d==1){
    char g[4]={'R','Y','G','B'};
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cout<<g[(j+i)%4];
      }
      cout<<endl;
    }
  }else if(d==2){
     char g[4]={'R','Y','G','B'};
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cout<<g[(j+(i/2)*2)%4];
      }
      cout<<endl;
    }
    
  }else{
    if(d%2==0)d--,f=1;
    for(int i=0;i<2000;i++)
      for(int j=0;j<2000;j++)
	ma[i][j]='#';
    dfs(0,0,0,0);
    for(int i=d;i<h+d;i++){
      for(int j=d;j<w+d;j++){
	if(ma[i][j]=='#')cout<<ma[i][j-1];
	else cout<<ma[i][j];
      }
      cout<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 60416
#include<stdio.h>
#include<stdlib.h>
int calc(int x, int y, int z)
{
  switch (z){
  case 0: return (x + y);
  case 1: return (x - y);
  case 2: return (x * y);
  }
}
int hantei(int a, int b, int c, int d){
  int i,j,k;
  char en[3]={'+','-','*'};
    for(i=0;i<3;i++){
      for(j=0;j<3;j++){
	for(k=0;k<3;k++){
	  if (calc(calc(a, b, i), calc(c, d, j), k) == 10){
	    return printf("(%d%c%d)%c(%d%c%d)\n", a, en[i], b, en[k], c, en[j], d);
	  }
	  if (calc(calc(calc(a, b, i), c, j), d, k) == 10){
	      return printf("((%d%c%d)%c%d)%c%d\n", a, en[i], b, en[j], c, en[k], d);
	  }
	}
      }
    }
    return 0;
}
int main(void){
  int a, b, c, d;
  while (scanf("%d %d %d %d", &a, &b, &c, &d)&&a!=0&&b!=0&&c!=0&&d!=0){
    if(hantei(a, b, c, d)) continue;//??¨??????????????´?????????
    else if(hantei(a, b, d, c)) continue;
    else if(hantei(a, c, b, d)) continue;
    else if(hantei(a, c, d, b)) continue;
    else if(hantei(a, d, b, c)) continue;
    else if(hantei(a, d, c, b)) continue;
    else if(hantei(b, a, d, c)) continue;
    else if(hantei(b, a, c, d)) continue;
    else if(hantei(b, c, a, d)) continue;
    else if(hantei(b, c, d, a)) continue;
    else if(hantei(b, d, a, c)) continue;
    else if(hantei(b, d, c, a)) continue;
    else if(hantei(c, a, b, d)) continue;
    else if(hantei(c, a, d, b)) continue;
    else if(hantei(c, b, a, d)) continue;
    else if(hantei(c, b, d, a)) continue;
    else if(hantei(c, d, a, b)) continue;
    else if(hantei(c, d, b, a)) continue;
    else if(hantei(d, a, b, c)) continue;
    else if(hantei(d, a, c, b)) continue;
    else if(hantei(d, b, a, c)) continue;
    else if(hantei(d, b, c, a)) continue;
    else if(hantei(d, c, a, b)) continue;
    else if(hantei(d, c, b, a)) continue;
    printf("0\n");
  }
  return 0;
}
 

Measured memory_bytes: 1752
from sys import stdin

# 1<=N<=2000
# 1000< Y < 2*10^7
# N枚の整数のお札の数で、Y円になる組み合わせは存在するか
# 存在しないときには-1 -1 -1
# 存在するときには x y zの形で出力する

[N, Y] = [int(x) for x in stdin.readline().rstrip().split()]

def func1(N,Y):
    for i in range(N+1):
        price_man = i*10000
        price_rest = Y-price_man
        if price_rest<0:
            break
        if price_rest>5000*(N-i):
            continue
        for j in range(N-i+1):
            if price_rest== 5000*j + 1000*(N-i-j):
                return [i, j, N-j-i]
    return [-1, -1, -1]

output = func1(N,Y)
print(output[0],output[1],output[2])



Measured memory_bytes: 3064
n = int(input())
x = int(n / 1.08)

if int(x * 1.08) == n:
    print(x)
elif int((x-1) * 1.08) == n:
    print(x-1)
elif int((x+1) * 1.08) == n:
    print(x+1)
else:
    print(':(')

Measured memory_bytes: 9108
def read():
    N = int(input().strip())
    H = list(map(int, input().strip().split()))
    return N, H

def solve(N, H, INF=10**9):
    dp = [INF for i in range(N)]
    dp[0] = 0
    for i in range(1, N):
        left, right = INF, INF
        if i >= 1:
            left = dp[i-1] + abs(H[i-1] - H[i])
        if i >= 2:
            right = dp[i-2] + abs(H[i-2] - H[i])
        dp[i] = min(left, right)
    return dp[N-1]

if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))


Measured memory_bytes: 13924
import java.util.Scanner;

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

	    int hour = second / (60*60);
		int minutes = (second % 3600) / 60;
		int sec = second % 60;

		System.out.printf("%d:%d:%d\n", hour, minutes, sec);

	}

}

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

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Integer N = input.nextInt();
        Integer M = input.nextInt();
        Integer[] A = new Integer[N];
        int sum = 0;
        for (int i = 0; i < N; i++) {
            A[i] = input.nextInt();
            sum += A[i];
        }
        Arrays.sort(A, Comparator.reverseOrder());
        if ((A[M-1] * 4 * M) >= sum){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

namespace prac1
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i > 0; i++)
            {
                string[] str = Console.ReadLine().Split(' ');//H,Wを配列に読み込む
                int H = int.Parse(str[0]);
                int W = int.Parse(str[1]);

                if (H == 0 && W == 0) break;//H=W=0の時、何も起こらない
                else
                {
                    for (int s = 0; s < H; s++)//H個の#をH行書く
                    {
                        for (int m = 0; m < W; m++)//#を1行にW個かく処理を書きたい
                        {
                            Console.Write("#");
                        }
                        Console.Write("\n");
                    }
                    Console.WriteLine();
                }
            }
        }
    }
}




Measured memory_bytes: 17996
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  string s;
  cin >> s;
  int bb = 0, pass = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'c') cout << "No" << endl;
    if (s[i] == 'a') {
      if (pass < a + b) {
        cout << "Yes" << endl;
        pass++;
      } else {
        cout << "No" << endl;
      }
    }
    if (s[i] == 'b') {
      if (pass < a + b && bb < b) {
        cout << "Yes" << endl;
        pass++;
        bb++;
      } else {
        cout << "No" << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 848
#include<bits/stdc++.h>   
using namespace std;
int main(){
    long long n,min,max=0;      
    cin>>n;
    min=n;       
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){
            min=n/i;     
        }
    }
    while(min!=0){
        min/=10;
        max++;
    }           
    cout<<max<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
//#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const long long linf = 4523372036854775807;
const int inf = 1500000000;
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	int from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	int x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
int ari(int a, int b, int c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
int fact(int i) {
	ll sum = 1;
	for (int j = 2; j <= i; j++)
		sum = (sum* j) % Mod;
	return sum;
}//階乗(正）
 //---------------------------------------------------
 //+++++++++++++++++++++++++++++++++++++++++++++++++++
int n, a[100001];
signed main() {
	cin >> n;
	int sum = 0;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int i = 1; i <= n; i++) {
		if (a[a[i]] == i)
			sum++;
	}
	cout << sum / 2 << endl;
	getchar(); getchar();
}

Measured memory_bytes: 640
a, b ,k =map(int, input().split())

l = []
for i in range(1,max(a,b)+1):
    if max(a,b)%i == 0:
        l.append(i)
m = []
for j in range(1,min(a,b)+1):
    if min(a,b)%j == 0:
        m.append(j)
z = []
for n in l:
    for o in m:
        if n == o:
            z.append(o)
print(z[-k])



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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
ll Q;
string s;
ll ret = 0;
bool foundA = false;

vector<ll> target;

void input() {
  IN(N);
  IN(Q);
  IN(s);
  target.push_back(-INF);
  REP(i, s.size()){
    char c = s[i];
    if (foundA && c == 'C') {
      target.push_back(i);
    }
    if (c == 'A') {
      foundA = true;
    } else {
      foundA = false;
    }
  }
  target.push_back(INF);
  REP(i,Q){
    ll l=0, r=0;
    ll a=0, b=0;
    ll ans = 0;
    IN(l);
    IN(r);
    ll left, right;
    left = 0;
    right = target.size()-1;
    while(true) {
      // DEBUG("left=");
      // DEBUG(left);
      // DEBUG("right=");
      // DEBUG(right);
      // DEBUG("\n");
      a = (left + right)/2;
      // DEBUG(target[a]);
      // DEBUG(l);
      if(target[a] > l){
        right = a;
      }else if (target[a] < l){
        left = a;
      }else{
        a -= 1;
        break;
      }
      if(right - left <= 1){
        if(right == l){
          a = right - 1;
        }else if (left == l){
          a = left - 1;
        }else{
          a = left;
        }
        break;
      }
    }
    DEBUG("a=");
    DEBUG(a);
    left = 0;
    right = target.size()-1;
    while(true) {
      // DEBUG("left=");
      // DEBUG(left);
      // DEBUG("right=");
      // DEBUG(right);
      // DEBUG("\n");
      b = (left + right)/2;
      if(target[b] > r){
        right = b;
      }else if (target[b] < r){
        left = b;
      }else{
        break;
      }
      if(right - left <= 1){
        if(left == r){
          b = left;
        }else if (right == r){
          b = right;
        }else{
          b = right;
        }
        break;
      }
    }
    DEBUG("b=");
    DEBUG(b);
    DEBUG("\n");
    PRINT(b - a - 1);
  }
}

void solve() {
}

int main(void){
  input();
  EACH(target.begin(), target.end()){
    DEBUG(*itr);
  }
  // solve();
  // PRINT(ret);
}


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

using namespace std;

const int mod = 998244353;
const int N = 300005;

int n, a, b;
int prd[N], inv[N];
long long k;

int binPow(int x, int y) {
	if (!y) return 1;
	int ret = binPow(x, y >> 1);
	ret = 1LL * ret * ret % mod;
	if (y & 1) ret = 1LL * ret * x % mod;
	return ret;
}

inline int C(int n, int k) {
	if (n < k || k < 0) return 0;
	return 1LL * prd[n] * inv[k] % mod * inv[n - k] % mod;
}

int main() {
	cin >> n >> a >> b >> k;
	prd[0] = 1;
	for (int i = 1; i <= n; ++i) prd[i] = 1LL * prd[i - 1] * i % mod;
	inv[n] = binPow(prd[n], mod - 2);
	for (int i = n; i >= 1; --i) inv[i - 1] = 1LL * inv[i] * i % mod;
	long long res = 0;
	for (int i = 0; i <= n; ++i) {
		if (k < 1LL * i * a || (k - 1LL * i * a) % b || (k - 1LL * i * a) / b > n) continue;
		int cnta = i, cntb = (k - 1LL * i * a) / b;
		res += 1LL * C(n, cnta) * C(n, cntb) % mod;
		res %= mod;
	}
	cout << res;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, k) {
    int d, tmp;
    cin >> d;
    rep(i, d) {
      cin >> tmp;
      a[tmp-1]++;
    }
  }

  int ans = 0;
  rep(i,n) {
    if(a[i] == 0) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624