akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    vector<int> c(9,0);
    vector<int> d(9,0);
    int a0 = 0, a1 = 0, a2 = 0;
    int b0 = 0, b1 = 0, b2 = 0;
    bool flag = 0;
    for(int i = 0;i < 9; i++){
        cin >> c[i];
    }
    for(int i = 0;i <= c[0]; i++){
        for(int j = 0; j < 9; j++){
            d[j] = c[j];
        }
        a0 = i;
        if((d[0] -= a0) < 0){continue;}
        if((d[1] -= a0) < 0){continue;}
        if((d[2] -= a0) < 0){continue;}
        b0 = c[0] - a0;
        d[0] -= b0;
        if((d[3] -= b0) < 0){continue;}
        if((d[6] -= b0) < 0){continue;}
        a1 = c[3] - b0;
        d[3] -= a1;
        if((d[4] -= a1) < 0){continue;}
        if((d[5] -= a1) < 0){continue;}
        a2 = d[6];
        b1 = d[1];
        b2 = d[2];
        d[6] -= a2;
        d[1] -= b1;
        d[2] -= b2;
        if((d[4] - b1) != 0 || (d[5] - b2) != 0 || (d[7] - b1 - a2) != 0 || (d[8] - a2 - b2) != 0){continue;}
        cout << "Yes";
        return 0;
    }
    cout << "No";
    
}




Measured memory_bytes: 256
var arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var max = 0;
arr.forEach {
  if( max < $0 ) {
    ( max = $0 )
  }
}

for var i = 0; i < 3; i += 1 {
    if( max == arr[i] ) {
		arr.removeAtIndex(i)
      	break
    }
}

print( arr[0] + arr[1] )

Measured memory_bytes: 4208
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <tuple>
#include <cmath>
using namespace std;
#define _GLIBCXX_DEBUG

int main(void){

    string s;
    cin >> s;
    for(int i=0; i< 3; i++){
        cout << s.at(i);
    }

    cout << endl;

}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int N;
    cin >> N;
 
    string s = to_string(N);
 
    if (((s[0] == s[1]) && (s[1] == s[2])) || ((s[1] == s[2]) && (s[2] == s[3])))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n;
  int a=11;
  scanf("%d",&n);
  if(n>81){
    printf("No");
  }
  else if(n<10){
    printf("Yes");
  }
  else{
    for(int i=9;i>1;i--){
      if(n%i==0){
        a=n/i;
        break;
      }
      else{}
    }
    if(a<10){
      printf("Yes");
    }
    else{
      printf("No");
    }
  }
  return 0;
}

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

typedef long long ll;
const ll MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> count(n + 5, 0);
  count[0] = 3;
  vector<ll> dp(n + 1, 0);
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    dp[i] = dp[i - 1] * count[a];
    dp[i] %= MOD;
    count[a + 1]++;
    count[a]--;
  }
  cout << dp[n] << endl;
}


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

int main() {
  int X, Y;
  cin >> X >> Y;
  if( Y % 2 == 1 || X > 50){
    cout << "No" << endl;
  }
  else if(4 * X >= Y  && Y >= 2 * X){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int N;

int main(void){
    
    scanf("%d", &N);
    printf("%d\n", (N % 2 == 0) ? N : 2 * N);
    
    return 0;
}


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

int main(){
  int n, m;
  cin >> n >> m;
  int x=1;
  for(int i=0; i<m; i++){
    x *= 2;
  }
  cout << ((n-m)*100 + 1900*m)*x << endl;
  return 0;
}


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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

#define INF LLONG_MAX

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int n;
  cin >> n;
  
  int t[2],x[2],y[2];
  t[0] = x[0] = y[0] = 0;
  
  for(int i=0;i<n;i++){
    cin >> t[1] >> x[1] >> y[1];
    int dist = abs(x[1]-x[0])+abs(y[1]-y[0]);
    int duration = t[1]-t[0];
    if(duration<dist){
      cout << "No" << endl;
      return 0;
    }
    if( (duration-dist)%2 == 1 ){
      cout << "No" << endl;
      return 0;
    }
    t[0] = t[1];
    x[0] = x[1];
    y[0] = y[1];
  }
  cout << "Yes" << endl;
  return 0;
}



Measured memory_bytes: 3580
// khodaya khodet komak kon
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vpl;

const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll N = 2e5 + 10;
const ll INF = 1e18;
const ll LOG = 20;
ll a, b;
int main(){
	
	IOS;
	cin >> a >> b;
	if (b % a != 0) cout << b - a;
	else cout << a + b;
	
	
	
	
	
	
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




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

#define ll long long int

using namespace std;

int main() {
    ll n;
    cin >> n;
    vector<char> v;
    do {
        --n;
        int p = n%26;
        v.push_back((char)('a'+p));
        n /= 26;
    } while (n > 0);
    for (auto iter = v.rbegin(); iter != v.rend(); ++iter) {
        cout << *iter;
    }
    cout << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <map>
#include <cctype>
#include <algorithm>
using namespace std;

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

	int q;
	cin >> q;

	for (int i = 0; i < q; i++)
	{
		string cmd;
		cin >> cmd;
		if (cmd == "print") {
			int a, b;
			cin >> a >> b;
			cout << s.substr(a, b - a + 1) << endl;
		}
		else if (cmd == "reverse") {
			int a, b;
			cin >> a >> b;
			reverse(s.begin() + a, s.begin() + b + 1);
		}
		else if (cmd == "replace") {
			int a, b;
			string p;
			cin >> a >> b >> p;
			copy(p.begin(), p.end(), s.begin() + a);
		}
	}

	return 0;
}



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

using namespace std;

#define int long long
#define LL long long
#define ULL unsigned long long

const int LL_INF = ~(ULL)0 >> 1;

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

    for (auto c : s) {
        for (int i = 0; i < 3; ++i) c = (c - 1 < 'A') ? 'Z' : c - 1;
        cout << c;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3200
n = int(input())
A = list(map(int, input().split()))
# a+i と i-aのとりうる値の個数をカウントするが
# 一致するとしても[0, n)の範囲だけなのでDの大きさはnで十分
D = [0]*n
for i, a in enumerate(A):
    if i+a < n:
        D[i+a] += 1
ans = 0
# i-aに対応するD[i-a]を加えるだけで答えが求まる
for i, a in enumerate(A):
    if i-a >= 0:
        ans += D[i-a]
print(ans)

Measured memory_bytes: 32152
#include <bits/stdc++.h>
#define ll long long 
#define intm INT_MAX
#define llm LONG_LONG_MAX

using namespace std;
int MOD = 13;


int ar[200030];
int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n, k;
	cin >> k >> n;
	for(int i=1; i <= n; i++) cin >> ar[i];
	int mx1 = 0;
	int sm = 0;
	for(int i=2; i <= n; i++){
		sm += ar[i] - ar[i-1];
		mx1 = max(mx1, ar[i]-ar[i-1]);
	}	
	int mx2 = k-sm;
	cout << k-max(mx1,mx2);
	
		
}



Measured memory_bytes: 1024
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
#include <fstream>
#include <climits>
 
  using namespace std;
   
 
//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ

  typedef long long ll;
  typedef long double lld;
  typedef unsigned long long ull;
  int INF = INT_MAX;
  ll mod = 1000000007;
  // lld PI = 3.141592653;



  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
     int n;
     cin>>n;
     vector<int> a(n), b(n), c(n);
     vector<pair<int,int>> indexes(n+1, {INF, 0});
     for (int i = 0;i<n;i++) {cin>>a[i]; indexes[a[i]].first = min(indexes[a[i]].first, i); indexes[a[i]].second = max(indexes[a[i]].second, i);}
      for (int i = 0;i<n;i++) cin>>b[i];
      pair<int,int> cant = {INF, -1};
      // for (int i = 1;i<=n;i++) cout<<indexes[i].first<<" "<<indexes[i].second<<endl;
      for (int i = 0;i<n;i++){
        if (indexes[b[i]].first == INF || indexes[b[i]].second == INF) continue;

        // cout<<indexes[b[i]].first<<" "<<indexes[b[i]].second<<endl;
        // cout<<i<<" "<<endl;
        // cout<<indexes[b[i]].second - i<<endl;
        int f = indexes[b[i]].first - i;
        int s = indexes[b[i]].second - i;
        // cout<<f<<" "<<s<<endl;
        // cout<<i<<endl;
        // cout<<indexes[b[i]].first<<" "<<indexes[b[i]].second<<endl;
        cant.first = min({f, cant.first, s});
       cant.second = max({s, cant.second, f});
        // cout<<cant.first<<endl;
      }
      // cout<<cant.first<<" "<<cant.second<<"\n";
      set<int> cannot;
      for (int t = cant.first; t<=cant.second;t++) cannot.insert((t+n)%n);
      for (int k = 0;k<n;k++){
        if (cannot.count(k)) continue;

        int step = (k+n)%n;
        // cout<<k<<endl;
        for (int i = 0;i<n;i++){
            c[(i+step)%n] = b[i];


        }
        cout<<"Yes\n";
        for (int i = 0;i<n;i++) cout<<c[i]<<" ";
        cout<<"\n";
      return 0;
      }
      cout<<"No\n";
}


Measured memory_bytes: 15968
n, q = [int(a) for a in input().split()]
total_time = 0
queue = []
for i in range(n):
    queue.append([a for a in input().split()])

while len(queue) > 0:
    name = queue[0][0]
    time = int(queue[0][1])
    if time <= q:
        total_time += time
        print(name + " " + str(total_time))
        del queue[0]
    else:
        total_time += q
        time -= q
        queue.append([name, time])
        del queue[0]


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

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int N;
  cin >> N;

  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());

  int x = 0, y = 0;
  for (int i = 0; i < N; i++) {
    if (i & 1) y += a[i];
    else x += a[i];
  }
  cout << x - y << endl;

  return 0;
}

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

ll fastPower (ll a, ll n) {
	if (n == 0) return 1 % MOD;
    ll ans = fastPower(a, n / 2);

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

ll invmod (ll x) {
	return fastPower(x, MOD-2);
}

ll comb (ll a, ll n) {
	ll ans = 1;
	for(ll i = n; i >= n - a + 1; i--){
		ans *= i;
		ans %= MOD;
	}
	for(ll i = 1; i <= a; i++){
		ans *= invmod(i);
		ans %= MOD;
	}
	return ans;
}

ll sub(ll a, ll b) {
	ll ans = a - b;
	if (ans < 0) ans += MOD;
	return ans % MOD;
}

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

    ll ans = fastPower(2, n);
    ll tosub = 1 + comb(a, n) + comb(b, n);
    tosub %= MOD;
    ans = sub(ans, tosub);

    cout << ans << endl ;
    return 0;

}


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

typedef long long ll;
using namespace std;

int main() {
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    int ans = 0;
    for (int i = 0; i <= N; i += R) {
        for (int j = i; j <= N; j += G) {
            if ((N - j) % B == 0) {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include<stdio.h>

int main() {
	char a[4], b[4];
	scanf(" %s %s", a, b);
	if(a[0] == b[2] && a[1] == b[1] && a[2] == b[0]) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;
class c
{
    static void Main()
    {
        var ans = 0;
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        for (int i = a[0]; i <= a[1]; i++)
        {
            if (i % a[2] == 0) ans++;
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 27548
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>
#include <sstream>
#include <regex>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
ll gcd(ll a, ll b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int a, b, k; cin >> a >> b >> k;
	rep(i, k)
	{
		if (i % 2 == 0)
		{
			if (a == 0)continue;
			if (a % 2 == 1)--a;
			a /= 2;
			b += a;
		}
		else
		{
			if (b == 0)continue;
			if (b % 2 == 1)--b;
			b /= 2;
			a += b;
		}
	}
	cout << a << " " << b << endl;
}

Measured memory_bytes: 3612
n = int(input())
s = input()

nR = [0]*n
nG = [0]*n
nB = [0]*n
if s[-1] == 'R':
    nR[-1] = 1
elif s[-1] == 'G':
    nG[-1] = 1
elif s[-1] == 'B':
    nB[-1] = 1
for i in range(n-2, -1, -1):
    if s[i] == 'R':
        nR[i] = nR[i+1] + 1
        nG[i] = nG[i+1]
        nB[i] = nB[i+1]
    elif s[i] == 'G':
        nR[i] = nR[i+1]
        nG[i] = nG[i+1] + 1
        nB[i] = nB[i+1]
    elif s[i] == 'B':
        nR[i] = nR[i+1]
        nG[i] = nG[i+1]
        nB[i] = nB[i+1] + 1

cnt = 0
for i in range(n):
    for j in range(i, n-1):
        if s[i] != s[j]:
            f = 0
            if 2*j - i < n:
                if s[i] != s[2*j-i] and s[j] != s[2*j-i]:
                    f = 1

            if s[i] != 'R' and s[j] != 'R':
                cnt += nR[j] - f
            elif s[i] != 'G' and s[j] != 'G':
                cnt += nG[j] - f
            elif s[i] != 'B' and s[j] != 'B':
                cnt += nB[j] - f

print(cnt)

Measured memory_bytes: 68788
//: Playground - noun: a place where people can play


import Foundation
/*
 func readInt(str : String) -> Int{
 return Int(str)  ?? 0
 }
 
 func splitInt(str : String,array :inout [Int]) ->(){
 var temp : String = ""
 for itr in str{
 if itr == " "{
 array.append(Int(temp) ?? 0)
 print(temp)
 temp =  ""
 } else {
 temp += String(itr)
 }
 }
 array.append(Int(temp) ?? 0)
 }
 */

var str: String = readLine() ?? ""
var array :[Int] = []
let startindex = str.startIndex
var temp:String = ""
var index = startindex
for itr in str.characters{
    if itr == " "{
        array.append(Int(temp) ?? 0)
        temp = "";
    } else {
        temp += String(itr);
    }
}
array.append(Int(temp) ?? 0)
if  abs(array[0]-array[1]) < abs(array[0]-array[2]){
    print("A")
}else{
    print("B")
}



Measured memory_bytes: 7140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

map<ll, int> prime_factor(ll n){
	map<ll, int> res;
	for(ll i = 2; i*i<=n; i++){
		while(n%i==0){
			res[i]++;
			n/=i;
		}
	}
	if(n!=1) res[n]++;
	return res;
}


int main(){
    int n;
    cin >> n;
    map<ll, int> mp;
    for(int i = 1; i <= n; i++) {
        auto p = prime_factor(i);
        for(auto u : p) {
            mp[u.first] += u.second;
        }
    }
    int a2, a4, a14, a24, a74;
    a2 = a4 = a14 = a24 = a74 = 0;
    for(auto p : mp) {
        if(p.second >= 74) a74++;
        if(p.second >= 24) a24++;
        if(p.second >= 14) a14++;
        if(p.second >= 4) a4++;
        if(p.second >= 2) a2++;
    }
    ll ans = 0;
    ans += a74;
    ans += a24*(a2-1);
    ans += a14*(a4-1);
    ans += (a4*(a4-1)/2)*(a2-2);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define S(x) scanf("%d",&x);
#define SS(x,y) scanf("%d%d",&x,&y);
char num[100006];
int vis[100006];
struct node
{
    int id;
    int l,r;
    int cou;
    node()
    {
        cou=0;
        l=0;
        r=0;
    }
} a[100006];
int main()
{
    scanf("%s",num);
    int len=strlen(num);
    for(int i=0;i<len;i++)
    {
        if(num[i]==num[i+2])
        {
            printf("%d %d",i+1,i+3);
            return 0;
        }
        if(num[i]==num[i+1])
        {
            printf("%d %d",i+1,i+2);
            return 0;
        }
    }
    printf("-1 -1");
    /*for(int i=0; i<len; i++)
    {
        vis[num[i]-'a']++;
        if(vis[num[i]-'a']==1)
        {
            a[num[i]-'a'].l=i;
            a[num[i]-'a'].cou=1;
        }
        else if(vis[num[i]-'a']>1)
        {
            a[num[i]-'a'].r=i;
            a[num[i]-'a'].cou=vis[num[i]-'a'];//---
        }
        for(int j=0; j<28; j++)
        {
            if((a[j].r-a[j].l+1)/2<a[j].cou&&((a[j].r-a[j].l+1)>=2))
            {
                printf("%d %d",a[j].l+1,a[j].r+1);
                return 0;
            }
        }
    }
    //枚举26个字母
    printf("-1 -1");//---//*/
    return 0;
}


Measured memory_bytes: 1920
class AOJ1
  def digitNumber first,second
    n = first + second
    digit = n.to_s.length
    return digit
  end
end


while g = gets  do
  line = g.chomp.split(" ")
  first = line[0].to_i
  second = line[1].to_i
  
  aoj = AOJ1.new
  puts aoj.digitNumber first,second
end

Measured memory_bytes: 6092
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        a: [[i64; n]; n]
    }
    let m = 1000000007;
    let mut tab: Vec<i64> = vec![0; 1 << n];
    tab[0] = 1;
    for i in 1..n + 1 {
        let mut s = (1 << i) as i64 - 1;
        while s < 1 << n {
            for j in 0..n {
                if s & (1 << j) > 0 && a[i - 1][j] == 1 {
                    tab[s as usize] += tab[s as usize - (1 << j)]
                }
            }
            tab[s as usize] %= m;

            let t = s & (-s);
            let u = s + t;
            s = (s & !u) / (t << 1) | u;
        }
    }
    println!("{}", tab[(1 << n) - 1]);
}


Measured memory_bytes: 20732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int N, M, Q, Sum=0, Ans=0;
  cin >> N >> M >> Q;
  vector<int> A(Q), B(Q), C(Q), D(Q), V(N);
  rep(i,Q){
    cin >> A.at(i) >> B.at(i) >> C.at(i) >> D.at(i);
    A.at(i)--;
    B.at(i)--;
  }
  rep(s, M){
    V.at(0)=s;
    for(int j=s; j<M; j++){
      V.at(1)=j;
                    if(N==2){
                      rep(i, Q) if(V.at(B.at(i))-V.at(A.at(i))==C.at(i)) Sum+=D[i];
                      Ans=max(Ans, Sum);
                      Sum=0;
                    }

      for(int k=j; k<M; k++){
        if(N<=2) break;
        V.at(2)=k;
                    if(N==3){
                      rep(i, Q) if(V.at(B.at(i))-V.at(A.at(i))==C.at(i)) Sum+=D[i];
                      Ans=max(Ans, Sum);
                      Sum=0;
                    }
        
        for(int l=k; l<M; l++){
          if(N<=3) break;
          V.at(3)=l;
                    if(N==4){
                      rep(i, Q) if(V.at(B.at(i))-V.at(A.at(i))==C.at(i)) Sum+=D[i];
                      Ans=max(Ans, Sum);
                      Sum=0;
                    }

          for(int m=l; m<M; m++){
            if(N<=4) break;
            V.at(4)=m;
                    if(N==5){
                      rep(i, Q) if(V.at(B.at(i))-V.at(A.at(i))==C.at(i)) Sum+=D[i];
                      Ans=max(Ans, Sum);
                      Sum=0;
                    }
            
            for(int n=m; n<M; n++){
              if(N<=5) break;
              V.at(5)=n;
                    if(N==6){
                      rep(i, Q) if(V.at(B.at(i))-V.at(A.at(i))==C.at(i)) Sum+=D[i];
                      Ans=max(Ans, Sum);
                      Sum=0;
                    }
              
              for(int o=n; o<M; o++){
                if(N<=6) break;
                V.at(6)=o;
                    if(N==7){
                      rep(i, Q) if(V.at(B.at(i))-V.at(A.at(i))==C.at(i)) Sum+=D[i];
                      Ans=max(Ans, Sum);
                      Sum=0;
                    }
                for(int p=o; p<M; p++){
                  if(N<=7) break;
                  V.at(7)=p;
                    if(N==8){
                      rep(i, Q) if(V.at(B.at(i))-V.at(A.at(i))==C.at(i)) Sum+=D[i];
                      Ans=max(Ans, Sum);
                      Sum=0;
                    }
                  for(int q=p; q<M; q++){
                    if(N<=8) break;
                    V.at(8)=q;
                    if(N==9){
                      rep(i, Q) if(V.at(B.at(i))-V.at(A.at(i))==C.at(i)) Sum+=D[i];
                      Ans=max(Ans, Sum);
                      Sum=0;
                    }
                    for(int r=q; r<M; r++){
                      if(N<=9) break;
                      V.at(9)=r;
                      rep(i, Q) if(V.at(B.at(i))-V.at(A.at(i))==C.at(i)) Sum+=D[i];
                      Ans=max(Ans, Sum);
                      Sum=0;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  cout << Ans << endl;
}

Measured memory_bytes: 3584
#include <iostream>

using int64 = long long;

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

  int64 ans = 0;
  int a_num = 0,
      i = 0;
  
  while (i < s.size() - 1) {
    if (s[i] == 'A') {
      a_num++;
      i++;
    } else if (s[i] == 'B' && s[i + 1] == 'C') {
      ans += a_num;
      i += 2;
    } else {
      a_num = 0;
      i++;
    }
  }

  std::cout << ans << std::endl;

  return 0;
}

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

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC

#define fi first
#define se second
#define ll long long
#define dl double long

using namespace std;

const int NN = 1e6 + 7;
const int N = 2e5 + 7;
const int M = 20;
const ll mod = 998244353;
const ll inf = 1e18 + 7;
const dl rf = 1e-14;

bool foo( string s )
{
    for( int i = 0 , j = (int)s.size() - 1; i < j; i++,j-- ){
        if( s[i] != s[j] )return false;
    }
    return true;
}

void solve1()
{
    string s;
    cin >> s;
    int n = (int)s.size();
    string t = "";
    string z = "";
    for( int i = 0; i < n / 2; i++ ){
        t += s[i];
    }
    for( int i = (n + 3) / 2 - 1; i < n; i++ ){
        z += s[i];
    }
    if( foo(s) && foo(t) && foo(z) )cout << "Yes";
    else cout << "No";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;//cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


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

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

using namespace std;

int main(){
  int n;cin>>n;
  vector<int> arr(n), a(n), b(n);
  rep(i, n)arr[i]=i+1;
  rep(i, n)cin>>a[i];
  rep(i, n)cin>>b[i];

  int result=0, c=1;
  do{
    bool af=true, bf=true;
    rep(i,n)if(arr[i]!=a[i])af=false;
    if(af)result = result+(c);

    rep(i,n)if(arr[i]!=b[i])bf=false;
    if(bf)result=result-(c);
//rep(i,n)cout<<arr[i];cout<<endl;
    c++;
  }while( next_permutation(arr.begin(), arr.end()) );
  cout<<abs(result);
  
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
a = [0] + a
pl = 0

for i in range(1,n+1):
    if a[i-1] > a[i]:
        apls = a[i-1] - a[i]
        a[i] += apls
        pl += apls
print(pl)

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

struct UnionFind {
    vector<int> d;
    // コンストラクタ 最初はすべて-1スタート
    UnionFind(int n = 0) : d(n, -1) {}

    int find(int x) {
        // 頂点が根なら頂点番号を返す
        // 違う場合、親についてfindクエリ実行(再帰)
        if (d.at(x) < 0) return x;
        return find(d.at(x));
    }

    bool unite(int x, int y) {
        // 両方の根を見る
        x = find(x);
        y = find(y);
        // 連結同士が一致している場合は、何もしない
        if (x == y) return false;
        // 小さいほうを大きいほうにつなげるため、yに小さいほうをあてる
        if (d.at(x) > d.at(y)) swap(x, y);
        // yをxにつなげる
        d.at(x) += d.at(y);
        d.at(y) = x;
        return true;
    }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) { return -d.at(find(x)); }
};

int main() {
    //
    int n, m;
    cin >> n >> m;

    UnionFind uf(n);  // 初期化

    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        uf.unite(a, b);
    }

    int kekka = 0;
     for (int i = 0; i < n; i++) kekka = max(kekka, uf.size(i));

    cout << kekka << endl;
    //
}

Measured memory_bytes: 4052
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, M, P[111111], Y[111111];

  std::cin >> N >> M;

  std::vector<std::vector<int>> a(N);

  for (int i = 0; i < M; i ++) {
    std::cin >> P[i] >> Y[i];

    P[i] --;

    a[P[i]].push_back(i);
  }

  std::vector<int> b(M, -1);

  for (int i = 0; i < N; i ++) {
    std::sort(ALL(a[i]), [&](int x, int y) {
                           return Y[x] < Y[y];
                         });

    for (int j = 0, size = a[i].size(); j < size; j ++)
      b[a[i][j]] = j;
  }

  for (int i = 0; i < M; i ++)
    printf("%06d%06d\n", P[i] + 1, b[i] + 1);

  return 0;
}


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

int main(){
    int w, h, n; cin >> w >> h >> n;
    vector<int> x(100), y(100), a(100);
    int x0=0, x1=w, y0=0, y1=h;
    for(int i=0; i<n; i++){
        cin >> x[i] >> y[i] >> a[i];

        if(a[i]==1){
            x0 = max(x0, x[i]);
        }else if(a[i]==2){
            x1 = min(x1, x[i]);
        }else if(a[i]==3){
            y0 = max(y0, y[i]);
        }else if(a[i]==4){
            y1 = min(y1, y[i]);
        }
    }
    int ans = max(x1-x0, 0)*max(y1-y0, 0);
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
int main()
{
    int n;
    cin >> n;
    int h[100];
    rep(i, n){
        cin >> h[i];
    }

    int max_h = h[0];
    int ans = 1;
    for(int i=1; i<n; i++){
        if(max_h <= h[i]){
            max_h = h[i];
            ans++;
        }
    }
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

bool isEven(vector<int>);

int main(void) {
  int num;
  cin >> num;
  
  int l;
  vector<int> vec;
  for (int i = 0;i < num;i++) {
    cin >> l;
    vec.push_back(l);
  }
  
  int count = 0;
  
  while(isEven(vec)) {
    transform(vec.begin(), vec.end(), vec.begin(), [](int i) {
      return i / 2;
    });
    count++;
  }
  
  cout << count;
  
  return 0;
}

bool isEven(vector<int> vec)
{
  for ( auto& e : vec) {
    if (e % 2 != 0) {
      return false;
    }
  }
  
  return true;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <ios>
#include <iomanip>
#include <stack>
#include <queue>
#include <algorithm>

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

using namespace std;

const int INF = 100000000;

int main(){
  int r,g;
  cin >> r;
  cin >> g;

  cout << 2 * g - r << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int X[100010];
int cnt[100010];
int same[100010];
int c[100010];
int main()
{
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> X[i];
		cnt[X[i] % M]++;
		c[X[i]]++;
	}
	for (int i = 0; i < 100010; i++) {
		same[i % M] += c[i] / 2;
	}
	int ans = cnt[0] / 2;
	//cout << ans << endl;
	if (M % 2 == 0) ans += cnt[M / 2] / 2;
	//cout << ans << endl;
	for (int i = 1; i <= (M - 1) / 2; i++) {
		ans += min(cnt[i], cnt[M - i]);
		if (cnt[i] >= cnt[M - i]) {
			int sum = cnt[i] - cnt[M - i];
			ans += min(sum / 2, same[i]);
		}
		else {
			int sum = cnt[M - i] - cnt[i];
			ans += min(sum / 2, same[M - i]);
		}
		//cout << same[i] << " " << same[M - i] << endl;
		//cout << ans << endl;
	}
	cout << ans << endl;
}


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

using namespace std;

struct Node{
  int key;
  Node *right,*left,*parent;
};

Node *root,*NIL;

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

Node* find(Node *u,int k){
  while(u != NIL && k != u->key){
    if(k < u->key){
      u = u->left;
    }
    else{
      u = u->right;
    }
  }
  return u;
}

Node* treeSuccessor(Node* x){

  if(x->right != NIL){
    return treeMinimum(x->right);
  }

  Node *y = x->parent;

  while( y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  
  return y;
  
}

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

  if(z->left == NIL || z->right == NIL){
    y = z;
  }
  else{
    y = treeSuccessor(z);
  }

  if( y->left != NIL){
    x = y->left;
  }
  else{
    x = y->right;
  }

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

  if( y->parent == NIL){
    root = x;
  }
  else{
    if(y == y->parent->left){
      y->parent->left = x;
    }
    else{
      y->parent->right = x;
    }
  }

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

  free(y);
  
}

void insert(Node* z){

  Node* y;
  Node* x;

  y = NIL;
  x = root;
  //cout << "insert key" << z->key <<endl;
  //printf("root:%x nill:%x",root,NIL);

  while(x != NIL){
    
    //cout << "in while" <<endl;
    y = x;

    if(z->key < x->key){
      x = x->left;
    }

    else{
      x = x->right;
    }
  }
  
  z->parent = y;
  //cout << "set parent";
  if(y == NIL){
    //cout << "decision root" << endl;
    root = z;
  }
  else if(z->key < y->key){
    y->left = z;
  }
  else{
    y->right = z;
  }
 
}


/* 中間順 */
void inorder(Node* u){
  if(u == NIL){return;}

  inorder(u->left);
  cout << " " << u->key;
  inorder(u->right);

}

/* 先行順 */
void preorder(Node* u){
  if(u == NIL){return;}
  cout << " " << u->key;
  preorder(u->left);
  preorder(u->right);
}


int main(){

  long ii,jj,kk;

  int n;

  cin >> n;

  string command;
  int key;
  Node* z;

  //root = (Node*)malloc(sizeof(Node));
  //NIL  = (Node*)malloc(sizeof(Node));

  for(ii=0;ii<n;ii++){
    cin >> command ;

    if(command == "insert"){

      cin >> key;
      z = (Node*)malloc(sizeof(Node));
      z->key = key;
      z->left = NIL;
      z->right = NIL;
      insert(z);
    }
    else if(command == "find"){
      cin >> key;
      Node *t = find(root,key);
      if(t != NIL){
        cout << "yes" << endl;
      }
      else{
        cout << "no" << endl;
      }
    }
    else if(command == "delete"){
      cin >> key;
      treeDelete(find(root,key));
    }
    else{
      //cout << "===========" << endl;
      inorder(root);
      cout << endl;
      preorder(root);
      cout << endl;
      //cout << "===========" << endl;
    }

  }



  return 0;
}



Measured memory_bytes: 21764
#include <iostream>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
    return (a % b) ? gcd(b, a % b) : b;
}
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
int main() {
    int N;
    ll T[100], ans = 1;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> T[i];
        ans = lcm(ans, T[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 100005

int N,K;
int X[SIZE];

int main(){

	scanf("%d %d",&N,&K);

	int num_plus = 0,num_minus,base_loc=N;

	for(int i = 0; i < N; i++){

		scanf("%d",&X[i]);
		if(X[i] >= 0){
			num_plus++;
			if(base_loc==N){
				base_loc=i;
			}
		}
	}

	if(base_loc == N){

		printf("%d\n",abs(X[N-K]));

	}else if(base_loc == 0){

		printf("%d\n",X[K-1]);

	}else{

		int ans = BIG_NUM;

		int dist_L,dist_R;
		for(int r = K; r >= 0; r--){
			if(base_loc+r-1 >= N)continue;
			int l = K-r;
			if(base_loc-1-l+1 < 0)continue;

			dist_R = X[base_loc+r-1];
			dist_L = abs(X[base_loc-1-l+1]);

			int tmp = 2*min(dist_L,dist_R)+max(dist_L,dist_R);
			ans = min(ans,tmp);
		}

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

	return 0;
}


Measured memory_bytes: 4204
//(・ω・)
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, atoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
#include <sstream> //istringstream
using namespace std;

int main(){
   int n,a,b;
   cin >> n >> a >> b;
   string s;
   cin >> s;
   int tuuka=0,kaigai=0;
   for(int i=0; i<n; i++){
      if(s[i]=='a'){
         if(tuuka<a+b){
            cout << "Yes" << endl;
            tuuka++;
         }
         else cout << "No" << endl;
      }
      else if(s[i]=='b'){
         if(tuuka<a+b && kaigai<b){
            cout << "Yes" << endl;
            tuuka++;
            kaigai++;
         }
         else cout << "No" << endl;
      }
      else cout << "No" << endl;
   }
}

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

public class Main {
    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int test_cases = 1;
        Solver s = new Solver();
        for (int i = 1; i <= test_cases; i++) {
            s.solve(i, in, out);
        }
        out.close();
    }
}

class Solver {

    void solve(int test_number, InputReader in, PrintWriter out) throws IOException {
        long n = in.nextLong();
        out.println(n % get(n) == 0 ? "Yes" : "No");
    }

    private long get(long n) {
        int ans = 0;
        while (n > 0) {
            ans += n % 10;
            n /= 10;
        }
        return ans;
    }
}


class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader() {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }

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

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

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

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

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

int main() {
    vector<int> a;
    int t;
    cin >> t;
    while (t--) {
        int q;
        cin >> q;
        switch (q) {
            case 0:
            int k;
            cin >> k;
            a.push_back(k);
            break;

            case 1:
            cin >> k;
            cout << a[k] << endl;
            break;

            default:
            a.pop_back();
        }
    }
}


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

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

int min = a[0];
int sum_min = 0;
int sum_list = a[0];
for (int i=1; i<N; i++){
    sum_list += a[i];
    sum_min += 1;
    if (min > a[i]) {
        min = a[i];
    }
}

int nokori = X - sum_list;
int add_donuts = nokori/min;
int sum_counts = add_donuts + sum_min;

cout << sum_counts + 1  << endl;
}



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

int main(){
  while(1){
  string str;
  cin>>str;
  if(str=="#")break;
  int mp[10][10]={};

  int  x=0,y=0;
  int w,h;
  for(int i=0;i<str.size();i++){
    if(str[i]=='/'){
      y++;
      h=y;
      w=x;
      x=0;
      continue;
    }
    if(str[i]=='b') mp[y][x++]=1;
    else if('0'<=str[i]&&str[i]<='9') x+=str[i]-'0';
  }


  int a,b,c,d;
  cin>>a>>b>>c>>d;
  a--,b--,c--,d--;
  mp[c][d]=mp[a][b];
  mp[a][b]=0;

  string ans;
  for(int i=0;i<=h;i++){
    int cnt=0;
    for(int j=0;j<w;j++){
      if(mp[i][j]==0) cnt++;
      else if(cnt) ans+=(cnt+'0'),cnt=0;
      if(mp[i][j]==1) ans+='b';
    }
    if(cnt) ans+=(cnt+'0');
    if(i!=h)ans+='/';
  }
  cout <<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3168
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
cs int Mod = 1e9 + 7, iv2 = (Mod+1)>>1;
int add(int a, int b){ return a + b >= Mod ? a + b - Mod : a + b; }
int dec(int a, int b){ return a - b < 0 ? a - b + Mod : a - b; }
int mul(int a, int b){ return 1ll * a * b % Mod; }
void Add(int &a, int b){ a = add(a,b); }
void Mul(int &a, int b){ a = mul(a,b); }
void Dec(int &a, int b){ a = dec(a,b); }
int ksm(int a, int b){ int as=1; for(;b;b>>=1,Mul(a,a)) if(b&1) Mul(as,a); return as; }
cs int N = 2e5 + 50;
int n, a[N], ct[N], pr[N], iv[N], ps[N], z[N];
namespace bit{
	int c[N], b[N];
	void clr(){ memset(c,0,sizeof(c)); memset(b,0,sizeof(b)); }
	void add(int x, int v){ for(;x<=n;x+=x&-x) Add(c[x],v), ++b[x]; }
	int ask(int x){ int as=0; for(;x;x-=x&-x) Add(as,c[x]); return as; }
	int ask(int l, int r){ return dec(ask(r),ask(l-1)); }
	int qry(int x){ int as=0; for(;x;x-=x&-x) as+=b[x]; return as; }
}
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d",&n);
	for(int i=1; i<=n; i++) scanf("%d",&a[i]), ++ct[a[i]];
	for(int i=n; i>=1; i--) ct[i]+=ct[i+1];
	int prd = 1;
	for(int i=1; i<=n; i++) ct[i]-=(n-i), Mul(prd,max(ct[i],0));
	if(!prd) return puts("0"), 0; pr[0] = iv[0] = 1;
	for(int i=1; i<=n; i++){
		int x=mul(ct[i]-1,ksm(ct[i],Mod-2)); if(!x) ps[z[i]=z[i-1]+1]=i, x=1;
		else z[i]=z[i-1]; pr[i] = mul(pr[i-1],x);
		iv[i] = mul(iv[i-1], ksm(x,Mod-2));
	} int Ans=0; bit::clr();
	for(int i=1; i<=n; i++){
		int sm = bit::ask(ps[z[a[i]]]+1,a[i]);
		Add(Ans, mul(mul(iv2, prd), mul(sm, pr[a[i]])));
		bit::add(a[i], iv[a[i]]);
	} bit::clr();
	for(int i=n; i>=1; i--){
		int sm = bit::ask(ps[z[a[i]]]+1,a[i]-1);
		Dec(Ans, mul(mul(iv2, prd), mul(sm, pr[a[i]])));
		Add(Ans, mul(prd, bit::qry(a[i]-1)));
		bit::add(a[i], iv[a[i]]);
	} cout << Ans; return 0;	
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
int64_t INF = 1000000007;
// int64_t INF = 9223372036854775807;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n;
    cin >> n;
    vi a(n);
    rep(i,n) cin >> a.at(i);
    // 全部のパターン - 奇数のパターン
    int64_t all = 1;
    int64_t odd = 1;
    rep(i,n){
        all *= 3;
        if(a.at(i)%2==0){
            odd *= 2;
        }else{
            odd *= 1;
        }
    }
    cout << all - odd << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main(){
	var n int
	var t int
	fmt.Scan(&n)
	l := make(map[int]bool)
	for i := 0; i < n; i++ {
		fmt.Scan(&t)
		if !l[t] {
			l[t] = true
		} else {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}

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

int main(){
  char c;
  cin >> c;
  if ( c == 'a' || c == 'e' || c =='i' || c =='u' || c =='o'){
    cout << "vowel" << endl;
  }
  else cout << "consonant" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll ans = 1e18;
    for(ll i=1;i*i<=N;i++) if(N%i==0){
        ans = min(ans,i-1+N/i-1);
    }
    cout << ans << "\n";
}

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


int main(){
  int N, M;

  cin >> N >> M;

  int *A = new int[M];
  int *resu = new int[N];
  int B[100][100];

  for(int i=0;i<M; ++i){
    cin >> A[i];
    A[i] = A[i];
  }

  for(int i=0; i<N; ++i){
    resu[i] = 0;
  }

  /*
  for(int i=0; i<M; ++i){
    ++resu[A[i]];
    }*/

  for(int a = 0; a<M; ++a){
    for(int n = 0; n<N; ++n){
      cin >> B[a][n];
    }
  }

  
  for(int a = 0; a<M; ++a){
    for(int n = 0; n<N; ++n){
      if(B[a][n] == A[a]){
	++resu[n];
      }else{
	++resu[A[a] - 1];
      }
    }
  }


  for(int i=0; i<N; ++i){
    cout << resu[i] << endl;
  }

  delete[] A;
  
  return 0;
}



Measured memory_bytes: 3128