akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define sz(c)       int(c.size())
#define rep(i,a,b)  for (int i=a; i<(b); ++i)
#define per(i,a,b)  for (int i=(b)-1; i>=(a); --i)
#define fore(c,...) for (auto __VA_ARGS__:(c))
using namespace std;
typedef long long ll;



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

	auto solve=[](int X) {
		rep(a,-1000,1001) rep(b,-1000,1001) {
			ll A=(ll)a*a*a*a*a;
			ll B=(ll)b*b*b*b*b;
			if (A-B==X) {
				cout<<a<<" "<<b<<endl;
				return true;
			}
		}
		return false;
	};

	// solve(31);
	// return 0;

	// rep(x,1,(int)1e9+1) {
		// if (solve(x)) {
			// cout<<x<<" ";
			// cout<<endl;
		// }
	// }

	int X;
	cin>>X;
	solve(X);

}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
void Main(){
    int N = read(), ans = 1;
    vector<int> H(N);
    for (auto &h:H) h = read();
    for (int i = 1; i<N; i++) {
        if(H[i]>=H[i-1]) ans++;
        H[i] = max(H[i],H[i-1]);
    }
    printf("%d\n", ans);
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int p[n];
    for(int i=0;i<n;i++)cin >> p[i];
    sort(p,p+n);
    int sum=0;
    for(int i=0;i<n;i++){
        sum+=p[i];
        if(i==n-1)sum-=p[i]/2;
    }
    cout << sum << endl;
}

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

int main(void)
{
	int n, d, sum=0, num=0, cnt[100000]={};
  	cin >> n;
	for(int i=0;i<n;i++)
	{
	  cin >> d;
	  cnt[d]++;
	}
	for(int i =0;i<100000;i++)
	{
	  sum += cnt[i];
	  if(sum > n/2)
	  	break;
	  if(sum == n/2)
	  	num++;
	}
  	cout << num;
  	return 0;   
}

Measured memory_bytes: 640
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class Pair
{
	public int Vertex { get; private set; }
	public long Cost { get; private set; }

	public Pair(int v, long c)
	{
		Vertex = v;
		Cost = c;
	}
}


public class D
{
	public static void Main()
	{
		string[] args;

		int N = Int32.Parse(Console.ReadLine());
		List<Pair>[] graph = new List<Pair>[N+1];
		for(int i = 1; i <= N; i++)
			graph[i] = new List<Pair>();
		
		for(int i = 0; i < N-1; i++)
		{
			args = Console.ReadLine().Split(' ');
			int a = Int32.Parse(args[0]);
			int b = Int32.Parse(args[1]);
			long c = Int64.Parse(args[2]);
			graph[a].Add(new Pair(b,c));
			graph[b].Add(new Pair(a,c));
		}

		args = Console.ReadLine().Split(' ');
		int Q = Int32.Parse(args[0]);
		int K = Int32.Parse(args[1]);

		int[] x = new int[Q];
		int[] y = new int[Q];
		for(int i = 0; i < Q; i++)
		{
			args = Console.ReadLine().Split(' ');
			x[i] = Int32.Parse(args[0]);
			y[i] = Int32.Parse(args[1]);
		}

		long[] d = new long[N+1];
		for(int i = 1; i <= N; i++)
			d[i] = Int64.MaxValue;
		Queue<int> queue = new Queue<int>(N);
		d[K] = 0;
		queue.Enqueue(K);
		while(queue.Count > 0)
		{
			int v = queue.Dequeue();
			foreach(Pair pair in graph[v])
			{
				int u = pair.Vertex;
				if(d[u] < Int64.MaxValue)
					continue;
				d[u] = d[v] + pair.Cost;
				queue.Enqueue(u);
			}
		}

		for(int i = 0; i < Q; i++)
			Console.WriteLine(d[x[i]] + d[y[i]]);
	}
}





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

int main(void){
    int n ;
    char s[12000],comp[60]="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
    cin >> n >> s ;
    for (int i=0; i<strlen(s); i++){
        for (int j=0; j<60; j++){
            if (s[i]==comp[j]){
                cout << comp[j+n] ;
                break ;
            }
        }
    }
    cout << endl ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define um unordered_map
#define us unordered_set
#define f first
#define s second
#define pb push_back
#define MOD 998244353
#define eps 1e-9
#define INF 1000000002

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pii> piii;
const int N = 303;

int n;
int main() {
    ll a,b;
    cin>>a>>b;
    set<ll> primes;
    int ans = 1;
    for(int i =2;i<=1000000;i++) {
        bool aa = false, bb = false;
        while(a % i == 0)
            a /= i, aa = true;
        while(b % i == 0)
            b /= i, bb = true;
        if(aa && bb)
            ans++;
    }
    if( a > 1 && a == b)
        ans++;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#同値なものはリストでまとめる

n = int(input())
c = [[[] for i in range(9)] for i in range(9)]

for i in range(1,n+1):
  s = str(i)
  if s[-1] == '0':
    continue
  c[int(s[0])-1][int(s[-1])-1].append(i)

ans = 0

for i in range(9):
  for j in range(9):
    ans += len(c[i][j])*len(c[j][i])

print(ans)

Measured memory_bytes: 16816
#include<bits/stdc++.h> 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define int long long
#define swap(x,y) (x^=y^=x^=y)

#define debug1(a) cerr<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

using namespace std;
 
#define mod 1000000007
long long modexpo(long long x, long long p){
    int res = 1;x = x%mod;
    while(p){
        if(p%2)res = res * x;
        p >>= 1;
        x = x*x % mod;
        res %= mod;
    }
    return res;
}

struct compare{
    bool operator() (const pair<int,int> a, const pair<int,int> b) const{
        return a.first < b.first;
    }
};

int32_t main(){
    IOS
    int a,b,c,d, ans = -1e18;
    cin >> a >> b >> c >> d;
    ans = max(ans, a*c);
    ans = max(ans, a*d);
    ans = max(ans, b*c);
    ans = max(ans, b*d);
    if(ans < 0){
        if(a <= 0 && b >= 0){
            ans = 0;
        }
        if(c <= 0 && d >= 0){
            ans = 0;
        }
    } 
    cout << ans << "\n";
} 

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<int,int>;

const int MOD = 1e9 + 7;

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

    ll n, a , b;
    cin >> n >> a >> b;

    if(a == 0){
        cout << 0 << endl;
    }else{
        ll tmp = n / (a + b);
        ll tmp2 = n % (a + b);
        if(tmp2 >= a){
            cout << tmp * a + a << endl;
        }else{
            cout << tmp * a + tmp2 << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict

def bs(arr, val):
	l, h = 0, len(arr)-1
	ans = -1
	while l <= h:
		m = l + h >> 1
		if arr[m] > val:
			ans = m
			h = m - 1
		else:
			l = m + 1
	return ans

s = sys.stdin.readline().strip()
n = len(s)

t = sys.stdin.readline().strip()

occurence = defaultdict(list)
for i in range(n):
	occurence[s[i]].append(i+1)

def solve():
	folds = 0
	cur_ptr = 0

	for ele in t:
		indexes = occurence[ele]
		if not indexes: return -1

		idx = bs(indexes, cur_ptr)
		if idx != -1: 
			cur_ptr = indexes[idx]
		else:
			folds += 1
			cur_ptr = indexes[0]
		# print(ele, cur_ptr, folds)
	ans = folds*(n) + cur_ptr
	return ans

print(solve())

Measured memory_bytes: 45680
//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
vector<int> g[100005];
int main(){
	int n,m;cin>>n>>m;
	int ind[n+1]={0};
	for(int i=0;i<m;i++){
		int x,y;cin>>x>>y;
		g[x].pb(y);
		g[y].pb(x);
		ind[y]++;
	}
	queue<int> q;
	for(int i=1;i<=n;i++){
		if(ind[i]==0)q.push(i);
	}
	int dp[n+1];
	memset(dp,0,sizeof(dp));
	while(!q.empty()){
		int x=q.front();
		q.pop();
		for(auto u:g[x]){
			ind[u]--;
			if(ind[u]==0){
				q.push(u);
			}
			dp[u]=max(dp[u],dp[x]+1);
		}
	}
	cout<<*max_element(dp+1,dp+n+1)-1;
}

Measured memory_bytes: 6528
//  RAKSHIT KADAM
//ALWAYS USE &IT FOR ITERATING USING AUTO ...
//USE COUNT(STARTING ADDRESS, ENDING ADRESS ,VALUE) FOR FINDING THE COUNT IN THE RESPECTIVE DATA STRUCTURE
//NOTE THAT MEMSET CANT FILL THE DOUBLE VALUES;
//ACCUMULATE DOES NOT WORK PROPERLY IF VALUES START SUMMING BEYOND 1E9...
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!

// NUMERIC DEFINITIONS :
    #define INF 100000000000000005
    #define inf 1000000000
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
#define ld long double
 #define ll long long
 #define int long long

 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>

 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn = 500003;
 
void solve()
{
    ll a,b,v,w,t;
    cin>>a>>v>>b>>w>>t;
    
    if(a<b)
    {
        if(v*t+a>=b+w*t)
        {
            cout<<"YES"<<Endl;
        }
        else cout<<"NO"<<endl;
    }
    else if(a==b)
    {
        cout<<"YES"<<endl;
    }
    else
        
    {
        if(b-w*t >=a-v*t)
        {
            cout<<"YES"<<endl;
        }
        else cout<<"NO"<<endl;
    }
}

signed main()
{
   Need_for_speed(activated);
//
//satisfy
//    {
//  solve();
//   }

    solve();
    
    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <string>
using namespace std;
string s,t;
int main(){
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(i+1<s.size()&&s[i]=='B'&&s[i+1]=='C'){
            t=t+"D";
            i++;
        }else t=t+s[i];
    }
    long long ans=0;
    int x=0;
    for(int i=0;i<t.size();i++){
        if(t[i]=='B'||t[i]=='C')x=0;
        if(t[i]=='A')x++;
        if(t[i]=='D')ans+=x;
    }
    cout<<ans<<endl;
}

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

#define f(x) ((x) * (x))

int main()
{
  int d;
  while(cin >> d){
    int ans = 0;
    for(int i = 1; i < 600 / d; i++){
      ans += d * f(i * d);
    }
    cout << ans << endl; 
  }
}

Measured memory_bytes: 1160
import kotlin.math.log10

fun main() {
    val n = readLine()!!.trim().toInt()
    val nums = readLine()!!.trim().split(' ').map(String::toLong)
    if (nums.contains(0)){
        println(0)
        return
    }
    val log = nums.sumByDouble { log10(it.toDouble()) }
    if (log > 18.5) {
        println(-1)
    }else {
        println(nums.reduce(Long::times).takeIf{it <= 1000000000000000000L} ?: -1)
    }
}


Measured memory_bytes: 63160
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
	int n,m,x,ans=1000000007;
	cin>>n>>m>>x;
	vector<int>cost(n);
	vector<vector<int>>pt(n,vector<int>(m));
	rep(i,n){
	    cin>>cost[i];
	    rep(j,m)cin>>pt[i][j];
	}
	int bit=(1<<n),suc,bill;
	vector<int>skill(m);
	rep(b,bit){
	    rep(j,m)skill[j]=0;
	    suc=1;
	    bill=0;
	    //reset
	    rep(i,n){
	        if(b&1<<i){
	            rep(j,m)skill[j]+=pt[i][j];
	            bill+=cost[i];
	        }
	    }
	    rep(j,m){
	        if(skill[j]<x)suc=0;
	    }
	    if(suc){
	        ans=min(ans,bill);
	    }
	    
	}
	if(ans==1000000007)ans=-1;
	cout<<ans;
	return 0;
}


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

int A,B;

int main()
{
    scanf("%d%d",&A,&B);
    if(A + B >= 10)
    {
        printf("error\n");
    }
    else
    {
        printf("%d\n",A + B);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>
#include <boost/math/constants/constants.hpp>
using namespace std;
namespace rng {
    using namespace boost::range;
    using namespace boost::adaptors;
}

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

using boost::irange;
using boost::math::double_constants::pi;
using i64 = int64_t;
constexpr char nl = '\n';
auto yesno(bool b) { return b ? "Yes" : "No"; }

template<class T> istream& operator>>(istream& in, vector<T>& vs) { for (T& v :vs) in >> v; return in; }
template<class T> ostream& operator<<(ostream& out, const vector<T>& vs) { for (size_t i = 0; i < vs.size(); ++i) { if(i) { out << ' '; } out << vs[i]; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
template<class T> void trace_(const T& v) { cout << v; }
template<class T> void trace_(const vector<vector<T>>& m) { cout << nl; for (const auto& v : m) { trace_(v); cout << nl; } }
template<class T> void trace_(const char* s, const T& v) { cout << s << "="; trace_(v); cout << nl; }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { for (; *s != ','; ++s) { cout << *s; } cout << "="; trace_(v); trace_(s, vs...); }
#define TRACE(...) trace_(#__VA_ARGS__, __VA_ARGS__)
#else
#define TRACE(...)
#endif

int main() {
    int A, B;
    cin >> A >> B;
    if (1 <= A && A <= 9 && 1 <= B && B <= 9) {
        cout << A * B << nl;
    } else {
        cout << -1 << nl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int n, m, a, b;
vector<int> edge[108000];
vector<P> ans;
int dep[108000];
bool come[108000];

int dfs(int x, int last){
    int cnt = 0;
    //int deg = 0;
    come[x] = true;
    vector<P> tmp;
    for(auto to:edge[x]){
        if(to == last)continue;
        if(come[to]){
            if(dep[to] < dep[x]){
                ans.push_back(P(x, to));
                cnt++;
            }
        }
        else{
            dep[to] = dep[x] + 1;
            int tocnt = dfs(to, x);
            if(tocnt % 2 == 1)ans.push_back(P(to, x));
            else{
              ans.push_back(P(x, to));
              cnt++;
            }
            //cnt += tocnt;
            //deg++;
        }
    }
    // cout << x << " " << cnt << endl;
    return cnt % 2;
}

int main(){
    cin >> n >> m;
    for(int i = 0;i < m;i++){
        cin >> a >> b;
        a--,b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    if(dfs(0,-1) % 2 == 1){
        cout << -1 << endl;
        return 0;
    }

    for(auto p:ans)cout << p.first+1 << " " << p.second+1 << endl;

    return 0;
}


Measured memory_bytes: 18672
#include<set>  
#include<map>  
#include<stack>  
#include<cstdio>  
#include<queue>  
#include<cmath>  
#include<vector>  
#include<climits>  
#include<cstring> 
#include<iostream> 
#include<algorithm> 
using namespace std;
#define INF 0x3f3f3f3f
#define LL long long
int read(){ 
    int f=1,x=0; 
    char c=getchar(); 
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();} 
    while('0'<=c&&c<='9'){x=((x<<3)+(x<<1))+c-'0';c=getchar();} 
    return f*x; 
}
#define MAXN 2200000
struct edge{
    int v,w;
    edge(){}
    edge(int V,int W){v=V,w=W;}
};
int n,m;
struct node{
    int u,k;
    node(){}    
    node(int U,int K){u=U,k=K;}
    friend bool operator < (node a,node b){return a.u==b.u?a.k<b.k:a.u<b.u;}
};
struct node1{
    int u,v,k;
    node1(){}   
    node1(int U,int V,int K){u=U,v=V,k=K;}
};
vector<node> Make_zx;
vector<node1> Make_xx;
vector<edge> G[MAXN+5];
int dis[MAXN+5];
bool vis[MAXN+5];
queue<int>Q;
int SPFA(int S,int T){
    memset(vis,0,sizeof(vis));
    memset(dis,0x3f,sizeof(dis));
    dis[S]=0,vis[S]=1,Q.push(S);
    while(!Q.empty()){
        int u=Q.front(),v,w,siz=G[u].size();
        Q.pop();
        vis[u]=0;
        for(int i=0;i<siz;i++){
            v=G[u][i].v,w=G[u][i].w;
            if(dis[v]>dis[u]+w){
                dis[v]=dis[u]+w;
                if(!vis[v]){
                    vis[v]=1;
                    Q.push(v);
                }
            }
        }
    }
    return dis[T]==INF?-1:dis[T]/2;
}
int main(){
	while(~scanf("%d%d",&n,&m))
	{
	    for(int i=1;i<=m;i++){
	        int p=read()-1,q=read()-1,c=read()-1;
	        Make_zx.push_back(node(p,c));
	        Make_zx.push_back(node(q,c));
	        Make_xx.push_back(node1(p,q,c));
	        Make_xx.push_back(node1(q,p,c));
	    }
	    sort(Make_zx.begin(),Make_zx.end());
	    for(int i=0;i<int(Make_zx.size());i++){
	        G[n+i].push_back(edge(Make_zx[i].u,1));
	        G[Make_zx[i].u].push_back(edge(n+i,1));
	    }
	    for(int i=0;i<int(Make_xx.size());i++){
	        int l1=lower_bound(Make_zx.begin(),Make_zx.end(),node(Make_xx[i].u,Make_xx[i].k))-Make_zx.begin(),
	        l2=lower_bound(Make_zx.begin(),Make_zx.end(),node(Make_xx[i].v,Make_xx[i].k))-Make_zx.begin();
	        G[l1+n].push_back(edge(l2+n,0));
	    }
	    printf("%d\n",SPFA(0,n-1));
	}
}

Measured memory_bytes: 96252
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
	public static void main(String[] args){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> list = new ArrayList<String>();
		try {
			//文字列の入力
			String str = br.readLine();

			//i番目の文字をArrayListに追加
			for(int i=0; i<str.length(); i++){
				list.add(str.substring(i,i+1));
			}

			//逆順に並び替える
			Collections.reverse(list);

			//出力
			for(String s : list){
				System.out.print(s);
			}
			System.out.println("");	//改行

		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 9056
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
//#define MXN 300000
#define N 100005
LL dp[4005][4005];
LL fra[10005];
LL inv[10005];
int mod=1e9+7;
LL f_pow(LL a,LL b){
    LL res=1,temp=a;
    while(b){
        if(b&1)res=res*temp%mod;
        temp=temp*temp%mod;
        b>>=1;
    }
    return res;
}
void build(){
    fra[0]=1;
    for(int i = 1;i<10000;i++){
        fra[i]=fra[i-1]*i%mod;
    }
    inv[9999]=f_pow(fra[9999],mod-2);
    for(int i = 9998;i>=0;i--)
        inv[i]=inv[i+1]*(i+1)%mod;
}
int main(){
    int n;
    scanf("%d",&n);
    pii p[200005];
    for(int i=0;i<n;i++){
        int x,y;
        scanf("%d %d",&x,&y);
        p[i]=mp(x,y);
        dp[2000-x][2000-y]++;
    }
    for(int i = 0;i<=4000;i++)
        for(int j=0;j<=4000;j++){
            if(i!=0)
            dp[i][j]+=dp[i-1][j];
            if(j!=0)
            dp[i][j]+=dp[i][j-1];
           // dp[i][j]+=dp[i-1][j]+dp[i][j-1];
            dp[i][j]%=mod;
        }
    LL ans=0;
    for(int i = 0;i<n;i++){
        ans+=dp[p[i].x+2000][p[i].y+2000];
        ans%=mod;
    }
    build();
    for(int i = 0;i<n;i++){
        ans-=fra[(p[i].x+p[i].y)*2]*inv[p[i].x*2]%mod*inv[p[i].y*2]%mod;
        ans=(ans%mod+mod)%mod;
    }
    printf("%lld\n",ans*(mod+1)/2%mod);
}


Measured memory_bytes: 127104
package main

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

type Int64Map map[ // Int64Map は、map[Int64][Int64]に便利メソッドを追加します.
int64]int64

func lib_AbsInt64(value int64) int64 {
	return int64(math.Abs(float64(value)))
}
func lib_NewInt64Map() Int64Map {
	return map[int64]int64{}
}
func (m Int64Map) ChMin(key, value int64) (replaced bool, valueAlreadyExist bool) {
	if v, ok := m[key]; ok {
		if v > value {
			m[key] = value
			return true, true
		} else {
			return false, true
		}
	}
	m[key] = value
	return true, false
}
func (m Int64Map) MustGet(key int64) int64 {
	v, ok := m[key]
	if !ok {
		panic(fmt.Sprintf("ivnalid key is specfied in Int64Map: %v", key))
	}
	return v
}
func main() {
	scanner := bufio.NewScanner(os.Stdin)
	const initialBufSize = 4096
	const maxBufSize = 1000000
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	scanner.Split(bufio.ScanWords)
	var N int64
	scanner.Scan()
	N, _ = strconv.ParseInt(scanner.Text(), 10, 64)
	h := make([]int64, N)
	for i := int64(0); i < N; i++ {
		scanner.Scan()
		h[i], _ = strconv.ParseInt(scanner.Text(), 10, 64)
	}
	fmt.Println(solve(N, h))
}
func solve(N int64, h []int64) int64 {
	m := lib_NewInt64Map()
	m[0], m[1] = 0, lib_AbsInt64(h[1]-h[0])
	for i := int64(2); i < N; i++ {
		m.ChMin(i, m[i-1]+lib_AbsInt64(h[i-1]-h[i]))
		m.ChMin(i, m[i-2]+lib_AbsInt64(h[i-2]-h[i]))
	}
	return m.MustGet(N - 1)
}


Measured memory_bytes: 7040
function main() {
	S = input[0];
	h = parseInt(S / 3600);
	m = parseInt(S / 60 % 60);
	s = parseInt(S % 60);

	msg = h + ':' + m + ':' + s;

	console.log(msg);
}

var input = "";

process.stdin.resume();
process.stdin.setEncoding("utf-8");
process.stdin.on("data", function(chunk) {
	input += chunk;
});

process.stdin.on("end", function() {
	input = input.split("\n");
	main();
})

Measured memory_bytes: 15620
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  string s;
  getline(cin,s);
  REP(i,s.size()){
    if(islower(s[i])) s[i] = toupper(s[i]);
    else if(isupper(s[i])) s[i] = tolower(s[i]);
  }
  cout << s << endl;
}


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

#define endl '\n'
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define SORT(v) sort(all(v))
#define SORTD(v) sort(all(v), greater<int>())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<30
#define v(T) vector<T>
#define vv(T) v(v(T))
#define print(x) cout<<x<<endl
#define printv(v) for(auto i : v){cout<<i<<" ";}cout<<endl
#define printu(v) for(auto i : v){print(i);}
#define readv(v, n) for (int i=0;i<n;i++)cin >> v[i]
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

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; }

int h, w;
v(string) s;
 
vv(int) vw;
vv(int) vh;
int ret;
int wdfs(int h_index, int w_index) {
	if (w_index >= w) return ret;
	if (s[h_index][w_index] == '#') {
		return ret;
	}
	ret++;
	vw[h_index][w_index] = wdfs(h_index, w_index + 1);
	return ret;
}

int hdfs(int h_index, int w_index) {
	if (h_index >= h) return ret;
	if (s[h_index][w_index] == '#') {
		return ret;
	}
	ret++;
	vh[h_index][w_index] = hdfs(h_index + 1, w_index);
	return ret;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> h >> w;
	vh = vv(int)(2001, vi(2001, 0));
	vw = vv(int)(2001, vi(2001, 0));
	rep(i, h) {
		string k;
		cin >> k;
		s.push_back(k);
	}
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == '.' && vw[i][j] == 0) {
				vw[i][j] = 1;
				ret = 0;
				wdfs(i, j);
			}
			if (s[i][j] == '.' && vh[i][j] == 0) {
				vh[i][j] = 1;
				ret = 0;
				hdfs(i, j);
			}
		}
	}
	int mx = 0;
	rep(i, h) {
		rep(j, w) {
			chmax(mx, vw[i][j] + vh[i][j] - 1);
		}
	}
	print(mx);
	return 0;
}

Measured memory_bytes: 36096
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = 998244353ll;

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll dp[3333][3333];
int a[3333];

int main(void){
	int n,s,i,j;
	ll ans = 0ll;
	cin >> n >> s;
	for(i=0; i<n; ++i){
		cin >> a[i];
	}
	dp[0][a[0]] = 1ll;
	for(i=1; i<n; ++i){
		for(j=0; j<=s; ++j){
			add_mod(dp[i][j],dp[i-1][j]);
			if(j+a[i]<=s){
				add_mod(dp[i][j+a[i]],dp[i-1][j]);
			}
		}
		add_mod(dp[i][a[i]],i+1);
	}
	for(i=0; i<n; ++i){
		add_mod(ans,dp[i][s]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 80128
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;

int main(){
  int a, b, c, d;
  cin >> a;
  d = a%10;
  a /=10;
  c = a%10;
  a /=10;
  b = a%10;
  a /=10;
  if( (a + b + c + d) == 7){
    cout << a << "+" << b << "+" << c << "+" << d; 
  }else if((a - b + c + d) == 7){
    cout << a << "-" << b << "+" << c << "+" << d; 
  }else if((a - b - c + d) == 7){
    cout << a << "-" << b << "-" << c << "+" << d; 
  }else if((a - b - c - d) == 7){
    cout << a << "-" << b << "-" << c << "-" << d; 
  }else if((a + b + c - d) == 7){
    cout << a << "+" << b << "+" << c << "-" << d; 
  }else if((a + b - c - d) == 7){
    cout << a << "+" << b << "-" << c << "-" << d; 
  }else if((a + b - c + d) == 7){
    cout << a << "+" << b << "-" << c << "+" << d; 
  }else if((a - b + c - d) == 7){
    cout << a << "-" << b << "+" << c << "-" << d; 
  }
  cout << "=7" << endl;
}

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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    ll N; cin >> N;
    vector<ll> A(N); REP(i,N) cin >> A[i];
    if(A[0] != 0){
        cout << -1 << en;
        return 0;
    }
    REP(i,N-1){
        if(A[i+1]-A[i] > 1){
            cout << -1 << en;
            return 0;
        }
    }

    ll ans = A[N-1];
    RREP(i,N-1){
        if(A[i]+1 == A[i+1]) continue;
        ans += A[i];
    }
    cout << ans << en;
    return 0;
}

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

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


int main(){
    int N,X,T;
    cin>>N>>X>>T;
    if(N%X==0){
        cout << (N/X)*T << endl;
    }else{
        cout << (N/X+1)*T << endl;
    }
    
}

Measured memory_bytes: 3584
N=int(input())
a = list(map(int,input().split()))
if N == 1:
    print(a[0])
    if a[0] == 1:
        print(1)
else:
    ball = [0 for i in range(N)]
    ans = []
    for i in range(N-1,-1,-1):
        sumi = sum(ball[2*i+1::i+1])
        if a[i] != sumi%2:
            ball[i] = 1
            ans.append(i+1)
    ans.sort()
    print(len(ans))
    if len(ans) != 0:
        print(*ans)

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

#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))

#define sum(v) accumulate(all(v), 0)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))

#define INF 1000000000
#define MOD 1000000007

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>

using namespace std;

main {
  int n;
  cin>>n;
  rep(i,n) {
    int a,b,c;
    cin>>a>>b>>c;
    a*=a; b*=b; c*=c;
    cout<<(a+b==c||b+c==a||c+a==b?"YES":"NO")<<endl;
  }
  bye;
}

Measured memory_bytes: 3004
import java.io.InputStreamReader
import java.io.BufferedReader

fun main(args: Array<String>) {
  val mod = 1000000007
  val br = BufferedReader(InputStreamReader(System.`in`))

  val(n, m) = br.readLine().split(" ").map { it.toInt() }
  val isBroken = BooleanArray(n+1)
  for(i in 1..m) {
    val step = br.readLine().toInt()
    isBroken[step] = true
  }

  val dp = IntArray(n+2)
  dp[0] = 1
  for(i in 0..n-1) {
    if(isBroken[i])
      continue

    dp[i+1] = (dp[i+1] + dp[i]) % mod
    dp[i+2] = (dp[i+2] + dp[i]) % mod
  }

  val ans = dp[n]
  println(ans)
}

Measured memory_bytes: 39472
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl;
#define rep(i,n) for(ll i = 0;i < n;++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0);

const ll INF = 1e9+7;

// 各桁の和
template<typename T>
T digit(T num){
  T sum = 0;
  while(num){
    sum += num % 10;
    num /= 10;
  }
  return sum;
}

template<typename T>T gcd(T a,T b){
  if(b == 0)
    return a;
  return gcd(b,a%b);
}
template<typename T>T lcm(T a, T b){
  T g = gcd(a,b);
  return a/g*b; 
}
template<typename T>T power(T a,T b){
  T tmp = 1;
  rep(i,b){
    tmp *= a;
  }
  return tmp;
}
int main(){
  int x;cin>>x;
  int ans = 0;
  for(int i = 1;i <= x;++i){
    for(int j = 2;j <= 50;++j){
      int tmp = power(i,j);
      if(tmp > x)break;
      ans = max(ans,tmp);
    }
  }
  print(ans)
  return 0;
}


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

int N, A, B;

void solve() {
  int count, ans, a;
  ans = 0;

  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= 4; j++) {
      a = pow(10, j);
      count += (i / a) % 10;
    }
    if (A <= count && count <= B) {
      ans += i;
    }
    count = 0;
  }
  cout << ans << endl;
}

int main() {
  cin >> N >> A >> B;
  solve();
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void){
    // Your code here!
    int i;
    int sum=0;
    char W[11],T[1001];
    
    scanf("%s",&W);
    for(i=0;W[i];i++){
        W[i]=tolower(W[i]);
    }
    while(1){
        scanf("%s",&T);
        if(strcmp("END_OF_TEXT",T)==0) break;
        for(i=0;T[i];i++){
            T[i]=tolower(T[i]);
        }
        if(strcmp(W,T)==0) ++sum;
    }
    printf("%d\n",sum);
    
    return 0;
}



Measured memory_bytes: 2064
#include<cstdio>
int pow(int a){
	int k=1;
	for(int i=1;i<=a;i++){
		k=k*2;
	}
	return k;
}
int main(){
	int n;
	scanf("%d",&n);
	int a[n]={};
	for(int j=0;j<n;j++){
		for(int i=0;i<10;i++){
			int k;
			scanf("%d",&k);
			a[j]+=k*pow(9-i);
		}
	}
	int b[100][11]={};
	for(int i=0;i<n;i++){
		for(int j=0;j<11;j++){
			scanf("%d",&b[i][j]);
		}
	}
	long long int ans=-1000000000;
	for(int i=1;i<1024;i++){
		long long int x=0;
		for(int j=0;j<n;j++){
			int y=i&a[j];
			int z=0;
			for(int k=0;k<10;k++){
				if((y/pow(k))%2==1)z++;
			}
			x+=b[j][z];
		}
		if(x>ans)ans=x;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
var
  a,b:string;
  n,m,i,j:longint;
  k,p,q:qword;
begin
  readln(n,m);
  readln(a);
  readln(b);
  p:=n;
  q:=m;
  if p<q then begin i:=p; p:=q; q:=i; end;
  while (p mod q)<>0 do if p>q then begin p:=p mod q; i:=p; p:=q; q:=i; end;
  k:=n*m div q;
  p:=k div n;
  q:=k div m;
  i:=1;
  j:=1;
  while (j<=m)and(i<=n) do
  begin
	 if b[j]<>a[i] then begin writeln('-1'); halt; end;
     i:=i+q;
	 j:=j+p;
  end;
  writeln(k);
end.

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

int main() {
    string s; cin >> s;
    bool even = true;
    for (char c = 'a'; c <= 'z'; c++) {
        int cnt = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s[i] == c) {
                cnt++;
            }
        }
        if (cnt % 2 == 1) even = false;
    }
    cout << (even ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] Hs = new int[N];
    for (int i = 0; i < N; i++) {
      Hs[i] = sc.nextInt();
    }
    int maxh = Hs[0];
    int seeSea = 0;
    for (int i = 0; i < N; i++) {
      if (Hs[i] >= maxh) {
        seeSea++;
        maxh = Hs[i];
      }
    }
    System.out.println(seeSea);
  }
}

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

int main(){
  int N, X, Y;
  cin >> N >> X >> Y;
  
  vector<int> ans(N + 1, 0);
  for (int i = 1; i < N; i++){
    for (int j = i + 1; j < N + 1; j++){
      int kouho1 = j - i;
      int kouho2 = abs(X - i) + 1 + abs(Y - j);
      ans.at(min(kouho1, kouho2))++;
    }
  }
  
  for (int i = 1; i < N; i++){
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void){
	int n, k;

	cin >> n >> k;

	vector<int> x(n + 1);

	for (int i = 1; i < n + 1; i++)
		cin >> x[i];

	int num = 0;
	for (int i = 1; i < n + 1; i++){
		if (x[i] >= k)
			num += x[i] - k;
		else
			num += min(k - x[i], x[i]);
	}

	cout << 2*num << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <utility>
#include <iomanip>
#define input(a) cin >> a
#define print(x) cout << x << endl
#define rep(a,n) for(int i = a; i < n; i++)
#define ll long long int
using namespace std;


int main(){
    int n,a;
    string ans;
    cin >> n >> a;
    int ex = n%500;
    if (ex <= a) ans = "Yes";
    else ans = "No";
    print(ans);

    return 0;
}


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

int main()
{
	int n, t, a;
	cin >> n >> t >> a;
	int ans;
	double puni = (1ll << 60);
	for (int i = 0; i < n; i++)
	{
		int h;
		cin >> h;
		if (abs(a - (t - h * 0.006)) < puni)
		{
			puni = abs(a - (t - h * 0.006));
			ans = i + 1;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N = gets.to_i

if N < 10
  puts N
elsif N < 100
  puts 9
elsif N < 1000
  puts (1..9).count + (100..N).count
elsif N < 10000
  puts (1..9).count + (100..999).count
elsif N < 100000
  puts (1..9).count + (100..999).count + (10000..N).count
elsif
  puts (1..9).count + (100..999).count + (10000..99999).count
end

Measured memory_bytes: 1788
import java.io.*;
import java.util.*;
import java.lang.*;

public class Main {
    public static FScanner sc;
    public static PrintWriter out;
    public static void main(String[] args) {
        sc=new FScanner();
        out=new PrintWriter(new BufferedOutputStream(System.out));

        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String seq = sc.nextLine();

        int counter = 0;
        int counter2 = 0;
        for(int p = 0; p < n; p++){
            if(seq.charAt(p) == 'a' && counter <  a + b){
                counter++;
                out.println("Yes");
            }
            else if(seq.charAt(p) == 'b' && counter2 < b && counter < a + b){
                counter2++;
                counter++;
                out.println("Yes");
            }

            else{
                out.println("No");
            }
        }




        out.close();
    }

    //-----------------------------------------------------HERE---------------------------------------------------------



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

    //scanner
    public static class FScanner {
        BufferedReader br;
        StringTokenizer st;

        public FScanner() {
            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: 29308
#include <bits/stdc++.h>
using namespace std;

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  map<ll,ll> m;
  rep(i,n){
    ll a; cin>>a;
    a/=400;
    if(a>8) a=8;
    m[a]++;
  }
  ll min=0,max=0;
  rep(i,8){
    if(m[i]){
      min++;
      max++;
    }
  }
  if(m[8]){
    if(min==0) min++;
    max+=m[8];
  }
  cout<<min <<" "<<max<<endl;
}

Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
template <typename T>
class UnionFind
{
public:
    vector<T> par;
    UnionFind(T n) : par(n, -1) {}
    void init(T n)
    {
        for (ll i = 0; i < n; i++)
        {
            par[i] = -1;
        }
    }

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

    bool same(T x, T y)
    {
        return root(x) == root(y);
    }

    bool merge(T x, T 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;
    }

    ll size(T x)
    {
        return -par[root(x)];
    }
};

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n,m;
cin >> n >> m;
vector<ll> a(m),b(m);
for(ll i = 0; i < m; i++){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
}
UnionFind<ll> uft(n);
vector<ll> ans;
reverse(a.begin(),a.end());
reverse(b.begin(),b.end());
ll origin = n * (n - 1) / 2;

for(ll i = 0; i < m; i++){
    ans.emplace_back(origin);
    if(uft.same(a[i],b[i]))
        continue;
    else{
        ll tmp = uft.size(a[i]) * uft.size(b[i]);
        origin -= tmp;
        uft.merge(a[i],b[i]);
    }
}
reverse(ans.begin(),ans.end());
for(ll i = 0; i < m; i++){
    cout << ans[i] << endl;
}
}

Measured memory_bytes: 4596
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
int main(void){
    int n,cnt = 0;
    cin >> n;
    vector<int> p(55);
    for(int i = 0;i < n;i++){
        cin >> p[i];
        if(p[i] != i+1) cnt++;
    }
    if(cnt == 2 || cnt == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    string s;
    cin>>s;
    int cnt=0;
    rep(i,s.size()){
        if(s[i]=='x')++cnt;
    }
    if(cnt>=8)cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
    return 0;
}

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


int main(){
	int x,y,m;
	cin >> x >> y;

	while(1){
		m = x%y; // %??????????????????
		if( m==0 ) break;
		
		x = y; // x???y?????????
		y = m; // y???m??????????????¨??§?¬???? y???m??§??????
	}

	cout << y << "\n";
	return 0;
}

Measured memory_bytes: 1164
n=int(input())

ans = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(ans[n-1])

Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;
ll mypow(ll x, ll n, ll m) {
	if (n == 0) {
		return 1;
	}
	if (n % 2 == 0) {
		return mypow(x*x%m, n / 2, m);
	}
	else {
		return x * mypow(x, n - 1, m) % m;
	}
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
///////////////////////////////////////


int main() {
	ll n, a, b; cin >> n >> a >> b;
	if (n == 2)cout << '0' << endl;
	else {
		ll key = mypow(2, n, INF);
		ll x = 1;
		ll y = 1;
		for (ll i = 1; i <= a; ++i) {
			x *= (n + 1 - i);
			x %= INF;
			x *= modinv(i, INF);
			x %= INF;
		}
		for (int i = 1; i <= b; ++i) {
			y *= (n + 1 - i);
			y %= INF;
			y *= modinv(i, INF);
			y %= INF;
		}
		cout << ((key - x + INF) % INF - y - 1 + INF) % INF << endl;
	}
	return 0;
}


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

int main(void)
{
	int H, W;

	do{
		cin >> H >> W;
	
		for(int i = 1; i <= H; i++) {
			if(i == 1 || i == H) {
				for(int j = 1; j <= W; j++)
					cout << '#';
			} else {
				cout << '#';
				for(int j = 2; j <= W - 1; j++)
					cout << '.';
				cout << '#';
			}
			cout << endl;
		}
		if(H || W) cout << endl;
	}while(H || W);

	return 0;
}

Measured memory_bytes: 1152