akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

class CountingSort
{
 public:
  void solve( int n, int* a, int* b, int k );
};

void CountingSort::solve( int n, int* a, int* b, int k )
{
  int *c = new int[k+1];

  for ( int i=0; i<=k; i++ )
    c[i] = 0;

  for ( int i=0; i<n ; i++ )
    c[a[i]]++;

  for ( int i=1; i<k; i++ )
    c[i] += c[i-1];

  for( int i=n-1; i >= 0; i-- )
    {
      b[c[a[i]]-1] = a[i];
      c[a[i]]--;
    }
  
  return;
}

int main( void )
{
  int n, k;
  int *a, *b;

  CountingSort *cs = new CountingSort();

  k = 10000;
  
  cin >> n;

  a = new int[n];
  b = new int[n];
    
  for(int i=0; i<n; i++)
    cin >> a[i];

  cs -> solve( n, a, b, k );
  
  for(int i=0; i<n; i++)
    if (i == n-1)
      cout << b[i] << endl;
    else
      cout << b[i] << " ";

  delete cs;

  return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

signed main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    Int(n);
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<int> b(n);
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    
    int ans = 0, x = 1;
    rep(i, 29) {
        vi aa(n), bb(n);
        rep(j, n) {
            aa[j] = a[j] % (x * 2);
            bb[j] = b[j] % (x * 2);
        }
        sort(all(bb));
        int s = 0;
        rep(j, n) {
            if (aa[j] < x) {
                s += lower_bound(all(bb), x*2-aa[j]) - lower_bound(all(bb), x-aa[j]);
            } else {
                s += lower_bound(all(bb), x*2-aa[j]) - bb.begin();
                s += bb.end() - lower_bound(all(bb), x*3-aa[j]);
            }
        }
        ans += (1ll << i) * (s % 2);
        x *= 2ll;
    }

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

    return 0;
}







Measured memory_bytes: 6572
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
   	int n = sc.nextInt();
    
    int oddCount;
    if (n % 2 == 0) {
      oddCount = n / 2;
    } else {
      oddCount = n / 2 + 1;
    }
    
    double oddCountDouble = (double) oddCount;
    double answer = oddCountDouble / n;
    System.out.println(answer);
  }
}

Measured memory_bytes: 23764
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int K;
  cin >> K;
  queue<ll> q;
  
  int cnt = 0;
  
  for (int n = 1; n <= 9; ++n) {
    q.push(n);
    ++cnt;
    if (cnt == K) {
      cout << n << endl;
      return 0;
    }
  }
  
  while (not q.empty()) {
    ll n = q.front();
    q.pop();
    int d = n % 10;
    for (int nd = d - 1; nd <= d + 1; ++nd) {
      if (nd < 0 or nd > 9) continue;
      q.push(10 * n + nd);
      ++cnt;
      if (cnt == K) {
	cout << 10 * n + nd << endl;
	return 0;
      }
    }
  }
  
  return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
using namespace std;

typedef long long int ll;

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	string st;
	cin >> st;
	if(st[0] == st[2])
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

Measured memory_bytes: 3608
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

typedef long long LL;

const int Mod = 1e9 + 7;
const int N = 3e6 + 10;

int n, m, k;
LL pw2[N], pw3[N], fac[N], inv[N];

LL Power(LL a, LL b) {
	LL c = 1;
	for (; b; b >>= 1, (a *= a) %= Mod)
		if (b & 1)
			(c *= a) %= Mod;
	return c;
}

void Init() {
	pw2[0] = pw3[0] = 1;
	fac[0] = inv[0] = 1;
	for (int i = 1; i < N; ++i) {
		pw2[i] = pw2[i - 1] * 2 % Mod;
		pw3[i] = pw3[i - 1] * 3 % Mod;
		fac[i] = fac[i - 1] * i % Mod;
	}
	inv[N - 1] = Power(fac[N - 1], Mod - 2);
	for (int i = N - 2; i; --i)
		inv[i] = inv[i + 1] * (i + 1) % Mod;
}

LL Binom(int m, int n) {
	if (n > m)
		return 0;
	return fac[m] * inv[n] % Mod * inv[m - n] % Mod;
}

void Solve() {
	scanf("%d %d %d", &n, &m, &k);
	LL fb = 0;
	LL fc = 0;
	LL ans = 0;
	for (int i = n; i <= n + m + k; ++i) {
		LL cnt = Binom(i - 1, n - 1);
		if (i - n == m + 1) 
			fb = 1;
		else if (i - n > m + 1) 
			fb = (fb * 2 + Binom(i - n - 1, m)) % Mod;
		if (i - n == k + 1)
			fc = 1;
		else if (i - n > k + 1)
			fc = (fc * 2 + Binom(i - n - 1, k)) % Mod;
		LL f = (pw2[i - n] - fb + Mod - fc + Mod) % Mod;
		(ans += f * cnt % Mod * pw3[n + m + k - i]) %= Mod;
	}
	printf("%lld\n", ans);
}

int main() {

	Init();
	Solve();

	return 0;
}

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

signed main(){
	int N,K; cin>>N>>K;
	int ans=0;
	if(K==0)ans=N*N;
	else{
		int p,r;
		for(int b=1;b<=N;b++){
			r=N%b; p=(N-r)/b;
			ans+=p*max(0LL,b-K)+max(0LL,r-K+1);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 173_A
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();

		a = -a;

		for(; a<0; ) {
			a += 1000;
		}

		// 出力
		System.out.println(a);
	    // Scannerクラスのインスタンスをクローズ
		sc.close();
	}

}


Measured memory_bytes: 35616
N = int(input())

if N == 1:
    print(1)

elif N == 2 or N == 3:
    print(2)

elif N < 8:
    print(4)

elif N < 16:
    print(8)

elif N < 32:
    print(16)

elif N < 64:
    print(32)

else:
    print(64)


Measured memory_bytes: 2940
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static int[][] map;
	static int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
	static int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}};
	static int ans;
	static int[] parent;//union-find用
	static int[] rank;//union-find用

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();


		ans = -1;

		for(int i = 0;i<=100000 ; i++) {
			int a = i*8/100;
			int b = i/10;
			if(a==A && b==B) {
				ans = i;
				break;
			}
		}



		System.out.println(ans);
	}

	//素数判定
	public static boolean isPrime(long num) {
		if (num < 2) return false;
		else if (num == 2) return true;
		else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

		double sqrtNum = Math.sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		}

		// 素数である
		return true;
	}

	//BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	}

	//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	}
	public static long gcd(long a, long b) {
		return b == 0 ? a: gcd(b, a % b);
	}

	//Union-Find用の配列を要素数nで初期化
	static void ufInit(int n){
		parent = new int[n];
		rank = new int[n];
	}

	//Union-Findの要素の最上位の親（グループ名）を返す
	static int ufFind(int a) {
		if(parent[a]==a) {
			return a;
		}else {
			return ufFind(parent[a]);
		}
	}

	//Union-Find木を連結する
	static void ufUnite(int a, int b) {
		a = parent[a];
		b = parent[b];

		if(a==b) {
			return;
		}
		if(rank[a] > rank[b]){
			parent[b]=a;
		}else {
			parent[a]=b;
			if(rank[a]==rank[b]) {
				rank[b]++;
			}
		}
	}

	static boolean ufSame(int a, int b) {
		return ufFind(a)==ufFind(b);
	}
}


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

int main(){
    char S[5];
    scanf("%s",S);
    int i,ans=0;
    for(i=0;i<4;i++){
        if(S[i]=='+') ans += 1;
        else ans -= 1;
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#define repeat_from(i,m,n) for (int i = (m); (i) < (n); ++(i))
#define repeat(i,n) repeat_from(i,0,n)
using namespace std;
int main() {
    while (true) {
        int n; cin >> n;
        if (not n) break;
        vector<int> a(n); repeat (i,n) cin >> a[i];
        double b; cin >> b;
        int r; double v, e, f; cin >> r >> v >> e >> f;
        vector<double> ts(a.back()+1);
        ts[0] = 0;
        repeat (x,a.back()) {
            ts[x+1] = ts[x] + (x >= r
                ? 1 / (v - e *(double) (x - r))
                : 1 / (v - f *(double) (r - x)));
        }
        vector<double> dp(n+1);
        dp[0] = 0;
        repeat_from (j,1,n+1) dp[j] = ts[a[j-1]];
        repeat_from (i,1,n+1) {
            repeat_from (j,i+1,n+1) {
                int x = a[j-1] - a[i-1];
                dp[j] = min(dp[j], dp[i] + ts[x] + b);
            }
        }
        printf("%.6lf\n", dp[n]);
    }
    return 0;
}

Measured memory_bytes: 1324
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int n, k, x, y, i, ans=0, high=0;
    scanf("%d", &n);
    int h[n];
    for(i=0; i<n; i++) scanf("%d", &h[i]);

    for(i=0; i<n; i++){
        if(h[i]>=high){
            ans++;
            high = h[i];
        }
    }
    printf("%d", ans);
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int dp[102][4][4][4];

int main() {
    int n; cin >> n;
    const int mod = int(1e9) + 7;

    dp[0][3][3][3] = 1;

    for (int len = 0; len < n; len++) {
        for (int c1 = 0; c1 < 4; c1++) {
            for (int c2 = 0; c2 < 4; c2++) {
                for (int c3 = 0; c3 < 4; c3++) {
                    if ( dp[len][c1][c2][c3] == 0 ) { continue; }
                    for (int a = 0; a < 4; a++) {
                        if (a == 2 && c1 == 1 && c2 == 0) { continue; }
                        if (a == 2 && c1 == 0 && c2 == 1) { continue; }
                        if (a == 1 && c1 == 2 && c2 == 0) { continue; }
                        if (a == 2 && c1 == 1 && c3 == 0) { continue; }
                        if (a == 2 && c2 == 1 && c3 == 0) { continue; }
                        dp[len+1][a][c1][c2] += dp[len][c1][c2][c3];
                        dp[len+1][a][c1][c2] %= mod;
                    }
                }
            }
        }
    }

    int ans = 0;

    for (int c1 = 0; c1 < 4; c1++) {
        for (int c2 = 0; c2 < 4; c2++) {
            for (int c3 = 0; c3 < 4; c3++) {
                ans += dp[n][c1][c2][c3];
                ans %= mod;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int n, m;
char buf[1000100];
int a[1000100];
int b[1000100];
inline int abs(int x) { return x < 0 ? -x : x; }
int exp2(int x)
{
	if (x <= 0) return 0;
	int ret = 0;
	while (!(x & 1)) { x >>= 1; ret++; }
	return ret;
}
int main()
{
	scanf("%d", &n);
	scanf("%s", &buf);
	n--;
	for (int i = 0; i <= n; i++) a[i] = buf[i] - '0';
	for (int i = 0; i < n; i++) b[i] = abs(a[i] - a[i + 1]);
	n--;
	// answer mod 2 = sum of b[i] binom(n, i)
	// if rhs = 1, answer is guaranteed to be 1
	int p2 = 0; // exponent of 2 in binom(n, i)
	int s = 0;
	for (int i = 0; i <= n; i++)
	{
		if (!p2) s ^= b[i];
		p2 += exp2(n - i) - exp2(i + 1);
	}
	if (s & 1)
	{
		printf("1\n");
		return 0;
	}
	// now answer is either 0 or 2
	// in order for the answer to be 2, all b[i] has to be 0 or 2
	// use the same argument as above with b'[i] = b[i]/2
	s = 0;
	bool flag = false;
	p2 = 0;
	for (int i = 0; i <= n; i++)
	{
		if (b[i] == 1) { flag = true; break; }
		if (!p2) s ^= (b[i] / 2);
		p2 += exp2(n - i) - exp2(i + 1);
	}
	if (!flag && (s & 1)) printf("2\n");
	else printf("0\n");
	return 0;
}


Measured memory_bytes: 9088
void main() {
	(700 + rs.count!(a => a == 'o') * 100).writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;

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


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int W, a, b; std::cin >> W >> a >> b;
  std::cout << (std::abs(a-b)<=W ? 0 : std::abs(a-b)-W) << std::endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        
        Scanner scanner = new Scanner(System.in);
        
        int W = scanner.nextInt();
        int H = scanner.nextInt();
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int r = scanner.nextInt();
        
        if (0 <= x - r && x + r <= W) {
            if (0 <= y - r && y + r <= H) {
                System.out.println("Yes");
                return;
            }
        }
        
        System.out.println("No");
 
        
        
    }
}


Measured memory_bytes: 26404
n=int(input())
a=[0]*(n+1)
d=0
for i in range(1,101):
    for j in range(1,101):
        for h in range(1,101):
            c=i**2+j**2+h**2+i*j+j*h+i*h
            if c<=n:
                a[c]+=1
for i in a[1:]:
    print(i)

Measured memory_bytes: 9128
#include<bits/stdc++.h>
using namespace std;
#define maxn 55
const int p=1e9+7;
template <typename T>inline T read()
{
    register T sum=0;
    register char cc=getchar();
    int sym=1;
    while(cc!='-'&&(cc>'9'||cc<'0'))cc=getchar();
    if(cc=='-')sym=-1,cc=getchar();
    sum=sum*10+cc-'0';
    cc=getchar();
    while(cc>='0'&&cc<='9')sum=sum*10+cc-'0',cc=getchar();
    return sym*sum;
}
template <typename T>inline T read(T &a)
{
    a=read<T>();
    return a;
}
template <typename T,typename... Others> inline void read(T& a, Others&... b)
{
    a=read(a);
	read(b...);
}
int n,f[maxn][maxn],C[maxn][maxn];
int add(int x,int y)
{
	x+=y;
	return x>=p? x-p:x;
}
void Add(int &x,int y)
{
	x+=y;
	if(x>=p)
		x-=p;
}
int mul(int x,int y)
{
	return 1ll*x*y%p;
}
int main()
{
	read(n);
	f[1][0]=f[1][1]=1;
	for(int i=0;i<=n;i++)
	{
		C[i][0]=1;
		for(int j=1;j<=i;j++)
			C[i][j]=add(C[i-1][j],C[i-1][j-1]);
	}
	for(int i=1;i<n;i++)
		for(int j=0;j<=i;j++)
			if(f[i][j])
				for(int x=0;x+i<=n;x++)
					for(int y=0;x+y+i<=n;y++)
						if(x+y&&x+y>=j&&((x+y-j)&1)==0)
							Add(f[i+x+y][abs((x+y-j)/2+j-x)],mul(f[i][j],mul(C[i+x+y][x+y],C[x+y][x])));
	printf("%d\n",f[n][0]);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int INF = 1e9;
const int MOD = INF+7;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define all(v) v.rbegin(),v.rend()
#define MP make_pair
#define pb push_back
using P = pair<int,int>;
//a

signed main(){
    int A,B;
    cin >> A >> B;
    if(A == B) cout << A+B << endl;
    else cout << max(A,B)*2 - 1 << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
long long n , a=0 , w=0 , t=0 , r=0;
string ar;
cin>>n;
for(long long i=0 ; i<n ; i++)
{
    cin>>ar;
    if(ar == "AC"){
        a++;
    } else if(ar == "WA"){
        w++;
    }else if(ar == "TLE"){
        t++;
    }else if(ar == "RE"){
        r++;
    }
}
cout<<"AC"<<" "<< "x" <<" "<<a<<endl;
cout<<"WA"<<" "<< "x" <<" "<<w<<endl;
cout<<"TLE"<<" "<< "x" <<" "<<t<<endl;
cout<<"RE"<<" "<< "x" <<" "<<r<<endl;
return 0;
}

Measured memory_bytes: 3616
/*
      HET PAGHADAR
      DA-IICT
      @HET262
*/
 
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<ll> vec; 
#define inf LLONG_MAX
#define bp __builtin_popcountll
#define pb push_back
#define ff first
#define ss second
#define P pair<ll,ll>
#define N 1000005
#define mod 1000000007
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
int32_t main()
{
      FAST;
      
      ll n;
      cin>>n;
      
      ll ans=0,p=1;
      
      while(n!=0)
      {
            ans+=p;
            p*=2;
            n/=2;
      }
      cout<<ans<<"\n";
 
}
 

Measured memory_bytes: 256
S = list(map(int, list(input())))

def sol() :
    for i in range(8) :
        s = S[0]
        ret = [-1] * 3
        for j in range(1,4) :
            mask = 2**(j - 1)
            op = i & mask
            if op == 0 :
                s += S[-j]
                ret[-j] = '+'
            else :
                s -= S[-j]
                ret[-j] = '-'
        if s == 7 :
            return ret
    return -1

ans = sol()

print(S[0], end='')
for i in range(3) :
    print(ans[i], end='')
    print(S[i+1], end='')
print('=7')

Measured memory_bytes: 3064
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(a * n, b) << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

    static int func(int x, int y){
        if(x > y) {
            if(x % y == 0) return y;
            return func(y, x%y);
        }
        else{
            if(y % x == 0) return x;
            return func(x, y%x);
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
       
        int x = sc.nextInt();
        int y = sc.nextInt();

        int answer = func(x, y);

        System.out.println(answer);
        sc.close();
    }
}


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

int main(void){
	int m;
	cin>>m;
	while(m--){
		int first,year,n;
			int ans = 0;
		cin>>first>>year>>n;
		for(int i=0;i<n;i++){
			int flg,tesu;
			double per;
			cin>>flg>>per>>tesu;

			int money = first;
			int sum = 0;
			for(int j=0;j<year;j++){
				if(flg){
					int b = money * per;
					money = money + b - tesu;
				}
				else{
					int b = money * per;
					money -= tesu;
					sum += b;
				}
			}
			ans = max(ans,sum+money);
		}
		cout<<ans<<endl;
	}

	return 0;
}

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

int ans=0;
void dfs(vector<int> &cnt,vector<bool> &hour,int now){
  if(now==13){
    int mi=24;
    for(int i=0;i<24;i++){
      if(!hour.at(i)) continue;
      for(int j=i+1;j<24;j++){
        if(!hour.at(j)) continue;
        mi=min({mi,j-i,24-(j-i)});
      }
    }
    ans=max(ans,mi);
    return;
  }

  if(cnt.at(now)==0){
    dfs(cnt,hour,now+1);
  }
  else if(cnt.at(now)==1){
    hour.at(now)=true;
    dfs(cnt,hour,now+1);
    hour.at(now)=false;
    hour.at(24-now)=true;
    dfs(cnt,hour,now+1);
    hour.at(24-now)=false;
  }
}

int main(){
  int N;
  cin >> N;
  vector<int> cnt(13,0);
  cnt.at(0)=1;
  for(int i=0;i<N;i++){
    int d;
    cin >> d;
    cnt.at(d)++;
  }

  if(cnt.at(0)>=2 || cnt.at(12)>=2){
    cout << 0 << endl;
    return 0;
  }
  for(int i=1;i<12;i++){
    if(cnt.at(i)>=3){
      cout << 0 << endl;
      return 0;
    }
  }

  vector<bool> hour(24,false);
  hour.at(0)=true;
  cnt.at(0)=0;
  for(int i=0;i<13;i++){
    if(cnt.at(i)==2){
      hour.at(i)=true;
      hour.at(24-i)=true;
      cnt.at(i)=0;
    }
  }
  dfs(cnt,hour,0);
  cout << ans << endl;

  return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T> constexpr T INF = numeric_limits<T>::max() / 2;

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

  int N, K;
  cin >> N >> K;
  int ans = 0;
  REP(i, N) {
    int h;
    cin >> h;
    if (h >= K) {
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def main():
    N, K, S = map(int, input().split())

    if S == 10**9:
        ans = [S] * K + [1] * (N-K)
    else:
        ans = [S] * K + [10**9] * (N-K)
    print(*ans)


if __name__ == "__main__":
    main()


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

using namespace std;

#define REP(var, n)  for (decltype(n) var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<decltype(var)>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

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

#define D(x) do { std::cerr << x << " "; } while (0)
#define D2(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)


template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}


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

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


typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;

auto solve() {
    int N;
    cin >> N;

    vi a(N);
    for (auto &&e:a) cin >> e;

    vvvd dp = vvvd(N + 2, vvd(N + 2, vd(N + 2, 0.0)));

    REP(i, N + 1) {
        REP(j, N + 1) {
            REP(k, N + 1) {
                int ism = i + j + k;
                if (ism == 0) continue;
                if (ism > N) continue;

                double sm = ism;

                dp[i][j][k] = (double) N / sm;
                if (i > 0)
                    dp[i][j][k] += (double) i / sm * dp[i - 1][j + 1][k];
                if (j > 0)
                    dp[i][j][k] += (double) j / sm * dp[i][j - 1][k + 1];
                if (k > 0)
                    dp[i][j][k] += (double) k / sm * dp[i][j][k - 1];
            }
        }
    }

    {
        int e1 = 0, e2 = 0, e3 = 0;
        for (auto &&e:a) {
            if (e == 1) e3++;
            if (e == 2) e2++;
            if (e == 3) e1++;
        }
        return dp[e1][e2][e3];
    }
}


int main() {
    cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);

//    cout << (solve() ? "even" : "odd") << endl;
//    cout << (solve() ? "YES" : "NO") << endl;
    cout << solve() << endl;
//    solve();

    return 0;
}


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

#define sc second
#define fr first
#define mk make_pair
#define pb push_back
#define int long long

using namespace std;

const int N = (1e6 + 5);
const int inf = (1e9 + 7);

int n,k;

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

    if ((n + 1) / 2 >= k) puts("YES");
    else puts("NO");
}


Measured memory_bytes: 256
N = int(input())
inf = input().split()
s = inf[0]
t = inf[1]
ans = ''
for i in range(2*N):
  if i%2==0:
    j = i//2
    ans += s[j]
  else:
    j = (i-1)//2
    ans += t[j]

print(ans)

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
  int r,g,b; cin >> r>>g>>b;
  int now = 100 * r + 10 * g + b;
  if (now % 4 == 0) YES();
  else NO();

  return 0;
}


Measured memory_bytes: 3572
#include <cstdio>

typedef long long int64;

int main()
{
	int64 n;
	scanf("%lld", &n);
	n++;
	int ans = 0;
	while (n > 9) ans += 9, n /= 10;
	ans += n - 1;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
def main():
    # 下、右、上、左
    dy = (1, 0, -1, 0)
    dx = (0, 1, 0, -1)
    H, W = map(int, input().split())
    s = ["." * (W + 2)]
    s += ["." + input() + "." for i in range(H)]
    s += ["." * (W + 2)]
    for y in range(1, H + 1):
        for x in range(1, W + 1):
            if "." == s[y][x]:
                continue
            if "#" == s[y + dy[0]][x + dx[0]]:
                continue
            if "#" == s[y + dy[1]][x + dx[1]]:
                continue
            if "#" == s[y + dy[2]][x + dx[2]]:
                continue
            if "#" == s[y + dy[3]][x + dx[3]]:
                continue
            print("No")
            return
    print("Yes")
    return


main()


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

using namespace std;

typedef long long int ll;

int main()
{
  	ll n;
  	cin >> n;
  	long double x = (n*(1.0))/(3.0);
  	long double ans = x*x*x;
  	
  	cout << setprecision(10) << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)

const ll INF = 1000000005;
int main(void) {
  int n;
  cin >> n;
  vector<ll> h(n + 1);
  rep(i, n) cin >> h[i];
  h[n] = INF;
  int ans = 0;
  int cnt = 0;
  rep(i, n) {
    if(h[i] < h[i + 1]) {
      cnt = 0;
    } else {
      ++cnt;
      ans = max(ans, cnt);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
import sys
from collections import deque
from functools import lru_cache
import bisect
import copy
import heapq
import itertools
import math
import random
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    N, A, B = read_values()
    V = [int(input()) for _ in range(N)]
    K = A - B
    l = 0
    r = max((v - 1) // B + 1 for v in V)
    while l < r - 1:
        m = (l + r) // 2

        t = 0
        for v in V:
            u = v - m * B
            t += max(0, (u + K - 1) // K)
        
        if t > m:
            l = m
        else:
            r = m
    
    print(r)


if __name__ == "__main__":
    main()



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


#define NUM 3005

struct point{
	int x,y;
};

struct Info{
	Info(double arg_slope,double arg_segment){
		slope=arg_slope;
		segment=arg_segment;
	}
	bool 
}*/
#include<iostream>
#include<algorithm>
using namespace std;

#define N_MAX 3000
class Point{
public:
	int x,y;
	Point(int x=0,int y=0):x(x),y(y){
		
	} 
};

int N,K;
Point P[N_MAX];
Point T[N_MAX];

bool compX(const Point &p1,const Point &p2){
	if(p1.x==p2.x)return p1.y<p2.y;
	return p1.x<p2.x;
}

bool compA(const Point &p1,const Point &p2){
	return p2.x*p1.y<p1.x*p2.y;
}

bool eq(const Point &p1,const Point &p2){
	return p2.x*p1.y==p1.x*p2.y;
}
int check(int p,int M){
	sort(T,T+M,compA);
	int maxL=1;
	int L=1;
	Point pre=T[0];
	for(int i=1;i<M;i++){
		if(eq(pre,T[i])){
			L++;
			maxL=max(maxL,L);
		}else{
			L=1;
		}
		pre=T[i];
	}
	return maxL;
}
bool solve(){
	for(int i=0;i<N;i++){
		int k=0;
		int v=0;
		for(int j=i+1;j<N;j++){
			if(P[i].x==P[j].x){
				v++;
			}
			else{
				T[k]=P[j];
				T[k].x-=P[i].x;
				T[k].y-=P[i].y;
			k++;
			}
		}
		if(1+v>=K)return true;
		if(1+check(i,k)>=K)return true;
	}
	return false;
}
int main(void){
	cin>>N>>K;
	for(int i=0;i<N;i++)cin>>P[i].x>>P[i].y;
	sort(P,P+N,compX);
	
	cout<<solve()<<endl;
	
	return 0;
}


Measured memory_bytes: 3164
#include<iostream>
#include<string>
using namespace std;
int main() {
	string s;
	cin >> s;
	bool x = false;
	if (s[0] != s[1]) x = true;
	if (s[1] != s[2]) x = true;
	if (s[2] != s[0]) x = true;
	if (x) cout << "Yes" << endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    map<string, int> mp;
    string str;
    int max_yen = 0;
    for (int i=0; i<N; i++) {
        cin >> str;
        if (mp.find(str) == mp.end()) {
            mp[str] = 1;
        } else {
            mp[str]++;
        }
    }
    int M;
    cin >> M;
    for (int i=0; i<M; i++) {
        cin >> str;
        if (mp.find(str) != mp.end() && mp[str] != 0) {
            mp[str]--;
        }
    }
    for(auto itr = mp.begin(); itr != mp.end(); itr++) {
        if (max_yen < itr->second) {
            max_yen = itr->second;
        }
    }
    cout << max_yen << endl;
    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
		}
		long[] left = new long[n];
		long[] right = new long[n];
		left[0] = a[0];
		for (int i = 1; i < n; i++) {
			left[i] = gcd(left[i - 1], a[i]);
		}
		right[n - 1] = a[n - 1];
		for (int i = n - 2; i >= 0; i--) {
			right[i] = gcd(right[i + 1], a[i]);
		}
		long ans = Math.max(left[n - 2], right[1]);
		for (int i = 0; i + 2 < n; i++) {
			ans = Math.max(ans, gcd(left[i], right[i + 2]));
		}
		System.out.println(ans);
	}
	static long gcd(long a, long b) {
	    if (b == 0) {
	        return a;
	    }
	    return gcd(b, a % b);
	}
}

Measured memory_bytes: 52316
#include <iostream>
using namespace std;
int main(void){
  double x[4],y[4];
  while(cin>>x[0]>>y[0]){
    for(int i=1;i<4;i++){
      cin>>x[i]>>y[i];
    }
    if((x[0]==x[1]&&y[2]==y[3])||(x[2]==x[3]&&y[0]==y[1])){
      cout<<"YES\n";
    }else if((y[1]-y[0])*(y[3]-y[2])==-(x[1]-x[0])*(x[3]-x[2])){
      cout<<"YES\n";
    }else{
      cout<<"NO\n";
    }
  }
  return(0);
}

Measured memory_bytes: 1188
#![allow(unused_imports)]
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{fastout, input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: usize, k: usize,
        mut a: [i64; n],
    }
    let m = 1000000007i64;
    let mod_product = |acc: i64, &value: &i64| {
        (acc * value).rem_euclid(m)
    };

    if k == n || k % 2 == 1 && a.iter().all(|v| *v <= 0) {
        a.sort_by_key(|v| -*v);
        let ans = a.iter().take(k).fold(1, mod_product);
        println!("{}", ans);
        return;
    }

    a.sort_by_key(|v| Reverse(v.abs()));
    let mut plus = Vec::new();
    let mut minus = Vec::new();
    for i in 0..n {
        if a[i] >= 0 {
            plus.push(a[i]);
        } else {
            minus.push(a[i]);
        }
    }

    let mut ppos = 0;
    let mut mpos = 0;
    let mut vals = Vec::new();
    let mut retry = false;
    while vals.len() < k {
        if vals.len() < k - 1 && ppos + 1< plus.len() && mpos + 1 < minus.len() {
            if plus[ppos] * plus[ppos+1] < minus[mpos] * minus[mpos+1] {
                vals.push(minus[mpos]);
                vals.push(minus[mpos+1]);
                mpos += 2;
            } else {
                vals.push(plus[ppos]);
                vals.push(plus[ppos+1]);
                ppos += 2;
            }
        } else if vals.len() < k - 1 && mpos + 1 < minus.len() {
            vals.push(minus[mpos]);
            vals.push(minus[mpos+1]);
            mpos += 2;
        } else if ppos < plus.len() {
            vals.push(plus[ppos]);
            ppos += 1;
        } else {
            retry = true;
            break;
        }
    }
    let ans = if !retry {
        vals.iter().fold(1, mod_product)
    } else {
        a.sort_by_key(|v| v.abs());
        assert!(k % 2 == 1);
        assert!(a.iter().filter(|v| **v < 0).count() > 2);
        a.iter().take(k).fold(1, mod_product)
    };
    println!("{}", ans);
}


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

int main () {
    int n, k, d;
    cin >> n >> k;
    map <int, int> m;
    while (k--) {
        cin >> d;
        while (d--) {
            int in;
            cin >> in;
            m[in]++;
        }
    }
    int count(0);
    for (int i = 1; i <= n; i++) {
        if (m[i] == 0) count++;
    }
    cout << count << "\n";
    return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

vector<int> z_algorithm(const string &s) {
    int n = s.size();
    vector<int> res(n);
    res[0] = n;
    int i = 1, j = 0;
    while (i < n) {
        while (i + j < n && s[j] == s[i+j]) ++j;
        res[i] = j;
        if (j == 0) { ++i; continue; }
        int k = 1;
        while (i + k < n && k + res[k] < j) res[i + k] = res[k], ++k;
        i += k, j -= k;
    }
    return res;
}

int main() {
    int n; cin >> n;
    string s; cin >> s;
    int ma = 0;
    for (int i = 0; i < n; i++) {
        auto res = z_algorithm(s.substr(i));
        for (int j = 0; j < n - i; j++) {
            if (res[j] <= j) chmax(ma, res[j]);
        }
    }
    cout << ma << endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
using namespace std;
int main() {
    int N;
    cin >> N;
    int a;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin >> a;
        A.at(i) = a;
    }
    sort(A.begin(), A.end() );
    reverse(A.begin(), A.end());
    int sum_A,sum_B;
    sum_A =0;
    sum_B =0;
    for(int i=0;i<N;i++){
        if(i%2==0){
            sum_A = sum_A + A.at(i) ;
        }
        else{
            sum_B = sum_B + A.at(i) ;
        }
    }
    cout << sum_A - sum_B << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

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 all(x) x.begin(),x.end()


int main()
{
	string n; cin >> n;
	if (n[0] == n[2])cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

template <typename T> class SlideMin {
public:
  vector<int> deq;
  vector<T> res;
  int n, k;
  SlideMin(vector<T> Array, int sz) {
    n = (int) Array.size(), k = sz;
    deq.resize(n), res.resize(n);
    int s = 0, t = 0;
    for (int i = 0; i < n; i++) {
      while (s < t && Array.at(deq.at(t-1)) <= Array.at(i)) {
        t--;
      }
      deq.at(t++) = i;
      res.at(i) = Array.at(deq.at(s));
      if (deq.at(s) == i - k + 1) {
        s++;
      }
    }
  }
};

int main() {
  int N, M, K;
  cin >> N >> M >> K;
  vector<long> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  SlideMin<long> SM(A, M);
  for (int i = 0; i + 1 < K; i++) {
    vector<long> tmp(N, -1e18);
    for (int j = 1; j < N; j++) {
      tmp.at(j) = max(tmp.at(j), SM.res.at(j - 1) + (i + 2) * A.at(j));
    }
    SM = SlideMin<long>(tmp, M);
  }
  cout << *max_element(SM.res.begin(), SM.res.end()) << "\n";
}

Measured memory_bytes: 4976
n = gets.to_i
a = []
for i in 1..n
  a << gets.to_i
end

a = a.sort
ls = [a[0], a[-1]]
lmin = true
rmin = false
a = a[1..(a.size-2)]

while a.size > 0
  if lmin
    ldif = a[-1] - ls[0]
  else
    ldif = ls[0] - a[0]
  end
  if rmin
    rdif = a[-1] - ls[-1]
  else
    rdif = ls[-1] - a[0]
  end

  if rdif > ldif
    if rmin
      ls << a[-1]
      a.delete_at(a.size-1)
      rmin = false
    else
      ls << a[0]
      a.shift()
      rmin = true
    end
  else
    if lmin
      ls.unshift(a[-1])
      a.delete_at(a.size-1)
      lmin = false
    else
      ls.unshift(a[0])
      a.shift()
      lmin = true
    end
  end
end

sum = 0
for i in 0..(ls.size-2)
  sum += (ls[i+1]-ls[i]).abs
end
print sum



Measured memory_bytes: 6304
#include <bits/stdc++.h>
using namespace std;
 
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define mp make_pair
#define mod 1000000007
#define qmod 998244353
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
const ll LINF = LLONG_MAX;

int main(){
	ll n,a,b;
	cin>>n>>a>>b;
	string s;
	cin>>s;
	int c1=0,c2=0;
	int len = s.size();
	for(int i=0;i<len;i++){
		if(s[i]=='a'){
			if(c1+c2<a+b){
				cout<<"Yes\n";
				c1++;
			}
			else{
				cout<<"No\n";
			}
		}
		else if(s[i]=='b'){
			if(c1+c2<a+b&& c2<b){
				cout<<"Yes\n";
				c2++;
			}
			else
				cout<<"No\n";
		}
		else
			cout<<"No\n";
	}
	
}

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

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

    int h[200];
    for(int i = 0;i < n;i++){
        cin >> h[i];
    }

    int ans = 0;
    for(int i = 0;i <= 100;i++){
        bool f = false;
        for(int j = 0;j < n;j++){
            if(h[j] > 0){
                h[j]--;
                f = true;
            }else{
                if(f) ans++;
                f = false;
            }
        }
        if(f) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/*
 * src.cpp
 *
 *  Created on: 2016/08/10
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const int MAX_N=30,MAX_C=30;

int N,C;

int a[MAX_N],b[MAX_C];

int dp[MAX_N+1][1<<16];

int cnt(int x){
	int res=0;
	while (x){
		res+=x&1;
		x>>=1;
	}
	return res;
}

int main(){
	do{
		scanf("%d %d",&N,&C);
		if (N){
			memset(dp,-1,sizeof(dp));
			dp[0][0]=0;
			REP(i,N){
				int s=0;
				REP(j,16){
					int t;
					scanf("%d",&t);
					s|=t<<(15-j);
				}
				a[i]=s;
			}
			REP(i,C){
				int s=0;
				REP(j,16){
					int t;
					scanf("%d",&t);
					s|=t<<(15-j);
				}
				b[i]=s;
			}
			REP(i,N){
				REP(j,1<<16){
					if (dp[i][j]!=-1){
						int next=j | a[i];
						dp[i+1][next]=max(dp[i+1][next],dp[i][j]);
						REP(k,C){
							dp[i+1][next-(next&b[k])]=max(dp[i+1][next-(next&b[k])],dp[i][j]+cnt(next&b[k]));
						}
					}
				}
			}
			int ans=0;
			REP(i,1<<16){
				ans=max(ans,dp[N][i]);
			}
			printf("%d\n",ans);
		}
	}while(N);
	return 0;
}

Measured memory_bytes: 9136
#include <bits/stdc++.h>
#define int long long
using namespace std;
int knapsack(vector<int> &weight, vector<int> &value, int w)
{
    int n = weight.size();

    int dp[n][w + 1];
    memset(dp, 0, sizeof(dp));

    for (int i = 1; i <= w; i++)
        if (i >= weight[0])
            dp[0][i] = value[0];

    for (int i = 1; i < n; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            dp[i][j] = dp[i - 1][j];
            if (j >= weight[i])
                dp[i][j] = max(dp[i][j], dp[i - 1][j - weight[i]] + value[i]);
        }
    }
    return dp[n - 1][w];
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, w;
    cin >> n >> w;
    vector<int> weight(n);
    vector<int> value(n);
    for (int i = 0; i < n; i++)
    {
        cin >> weight[i] >> value[i];
    }
    cout << knapsack(weight, value, w);
    return 0;
}

Measured memory_bytes: 78336
#include<bits/stdc++.h>
using namespace std;
int main(){
string s,t;
int m=-1;
cin>>s>>t;
if(s.size()<t.size()){
cout<<"UNRESTORABLE"<<endl;
}
else{
for(int i=0;i<=s.size()-t.size();i++){
  bool f=true;
  for(int j=0;j<t.size();j++){
    if(s.at(i+j)==t.at(j)||s.at(i+j)=='?')continue;
    else{
      f=false;
      break;
    }
  }
  if(f){
    m=i;
  }
}
if(m==-1){
cout<<"UNRESTORABLE"<<endl;
}
else{
for(int i=m;i<t.size()+m;i++){
s.at(i)=t.at(i-m);
}
for(int i=0;i<s.size();i++){
if(s.at(i)=='?'){
s.at(i)='a';
}
}
cout<<s<<endl;
}
}
}


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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)
#define fi first
#define se second

using ll = long long;
using v_int = std::vector<int>;
using v2_int = std::vector<v_int>;
using v_ll = std::vector<ll>;
using v2_ll = std::vector<v_ll>;
using v_string = std::vector<std::string>;
using v_bool = std::vector<bool>;
using v2_bool = std::vector<v_bool>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using mii = std::map<int, int>;
using mll = std::map<ll, ll>;

const double PI = 3.1415926535897932;
const int INF = 2*(int)1e9;
const ll LINF = (ll)1e18;
const ll MOD = 1000000007;
const int dc[4] = {1, -1, 0,  0};
const int dr[4] = {0,  0, 1, -1};
//const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
//const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

using namespace std; 

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p)
{
    return o << "{" << p.first << "," << p.second << "}";
}

template<typename T> inline
istream& operator>>(istream &is, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) {
        is >> v[i]; 
    }
    return is;
}

template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) { 
        os << v[i];
        if(i != len-1) { os << ","; } 
    } 
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }

template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    int d;
    ll g;
    cin >> d >> g;

    vector<pii> test;

    irep(i, d) {
        int p, c;
        cin >> p >> c;
        test.push_back(pii(p, c));
    }

    int ans = INF;

    irep(i, (1<<d)) {
        int cnt = 0;
        ll sum = 0;
        irep(j, d) {
            if(i & (1<<j)) {
                sum += (test[j].fi * (j+1) * 100);
                sum += test[j].se;
                cnt += test[j].fi;
            }
        }

        if(sum < g) {
            irrep2(j, d-1, 0) {
                if(i & (1<<j)) { continue; }
                if(sum >= g) { break; }
                irep(k, test[j].fi) {
                    if(sum >= g) { break; }
                    sum += (j+1) * 100;
                    cnt++;
                }
            }
        }
        chmin(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

/*atcoder*/


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
using namespace std;
int main(){

    // Seiranchan!
    int a,b,x;
    cin >> a >> b>> x;

    if(a>x){
        cout << "NO" <<endl;
    }else if((a+b)<x){
        cout << "NO" <<endl;
    }else {
        cout << "YES" << endl;
    }
}


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

using namespace std;

int main() {

  int n, z, w;
  cin >> n >> z >> w;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  if (n == 1) {
    cout << abs(a[0] - w) << '\n';
    return 0;
  }

  cout << max(abs(w - a[n - 1]), abs(a[n - 2] - a[n - 1])) << '\n';
  return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int N,W;
vector<int> v,w;
vector<vector<int>> dp(110,vector<int>(10100,-1));
int main(){
    int n;
    cin>>n;
    int ga,sa,ba,gb,sb,bb;
    cin>>ga>>sa>>ba>>gb>>sb>>bb;
    vector<ll> dp(n+1,0);
    for(int i=0;i<=n;i++){
        dp.at(i)=i;
        if(i>=ga)dp.at(i)=max(dp.at(i),dp.at(i-ga)+gb);
        if(i>=sa)dp.at(i)=max(dp.at(i),dp.at(i-sa)+sb);
        if(i>=ba)dp.at(i)=max(dp.at(i),dp.at(i-ba)+bb);
    }
    int ma=dp.at(n);
        vector<ll> dp2(ma+1,0);
         for(int i=0;i<=ma;i++){
        dp2.at(i)=i;
        if(i>=gb)dp2.at(i)=max(dp2.at(i),dp2.at(i-gb)+ga);
        if(i>=sb)dp2.at(i)=max(dp2.at(i),dp2.at(i-sb)+sa);
        if(i>=bb)dp2.at(i)=max(dp2.at(i),dp2.at(i-bb)+ba);
    }
    cout<<dp2.at(ma)<<endl;
}

Measured memory_bytes: 199936