akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
using namespace std;int n,a[200010];inline int read(){ register int ret=0;char c=getchar();while(c<'0'||c>'9')c=getchar();while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();return ret;}int main(){n=read();for(register int i=1;i<=n;++i)a[i]=read();for(register int i=n;i>0;i-=2)printf("%d ",a[i]);for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);return 0;}

Measured memory_bytes: 2944
s = raw_input()

#while s.find('ST') > -1:
#    s = ''.join(s.split('ST'))
#
#print len(s)

temp = []
for i in range(len(s)):
    now = s[i]
    if len(temp) == 0:
        temp.append(now)
    elif temp[-1] + now == 'ST':
        temp.pop()
    else:
        temp.append(now)

print len(temp)

Measured memory_bytes: 10788
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
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 T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;


lint D, M, d, q;
lint decrease[26];
lint decrease_sum[26];
lint positive_sum = 0;
lint satis[365][26];
lint last[26];
lint t[365];
set<lint> app[26];

lint downscore(lint passed) {
	lint sum = 0;
	REP(i, 26) {
		sum += decrease[i] * (passed - last[i]);
	}
	return -sum;
}

int main() {
	cin >> D;
	REP(i, 26) {
		cin >> decrease[i];
	}
	REP(i, D) {
		REP(j, 26) {
			cin >> satis[i][j];
		}
	}

	lint score = 0;
	REP(i, D) {
		cin >> t[i]; t[i]--;
		app[t[i]].insert(i);
	}
	REP(i, D) {
		positive_sum += satis[i][t[i]];
	}
	REP(i, 26) {
		vector<lint> vec;
		vec.push_back(-1);
		for (auto itr : app[i]) {
			vec.push_back(itr);
		}
		vec.push_back(D);
		REP(j, SZ(vec) - 1) {
			lint k = vec[j + 1] - vec[j] - 1;
			decrease_sum[i] += k * (k + 1) / 2;
		}
	}
	score = positive_sum;
	REP(i, 26) score -= decrease[i] * decrease_sum[i];

	cin >> M;
	REP(i, M) {
		cin >> d >> q; d--; q--;
		score += satis[d][q] - satis[d][t[d]];
		score += decrease[q] * decrease_sum[q];
		score += decrease[t[d]] * decrease_sum[t[d]];
		app[t[d]].erase(d);
		app[q].insert(d);

		{
			decrease_sum[t[d]] = 0;
			vector<lint> vec;
			vec.push_back(-1);
			for (auto itr : app[t[d]]) {
				vec.push_back(itr);
			}
			vec.push_back(D);
			REP(j, SZ(vec) - 1) {
				lint k = vec[j + 1] - vec[j] - 1;
				decrease_sum[t[d]] += k * (k + 1) / 2;
			}
		}

		{
			decrease_sum[q] = 0;
			vector<lint> vec;
			vec.push_back(-1);
			for (auto itr : app[q]) {
				vec.push_back(itr);
			}
			vec.push_back(D);
			REP(j, SZ(vec) - 1) {
				lint k = vec[j + 1] - vec[j] - 1;
				decrease_sum[q] += k * (k + 1) / 2;
			}
		}
		score -= decrease[q] * decrease_sum[q];
		score -= decrease[t[d]] * decrease_sum[t[d]];

		t[d] = q;
		cout << score << endl;
	}
}


Measured memory_bytes: 3668
//19
#include<cstdio>

int main(){
  int n;
  scanf("%d",&n);
  while(n--){
    unsigned b[2][9];
    for(int i=0;i<9;i++){
      unsigned bb;
      scanf("%x",&bb);
      b[1][i]=bb>>16;
      b[0][i]=bb&(1<<16)-1;
    }
    unsigned c=0;
    unsigned r=0;
    for(int i=0;i<2;i++){
      for(unsigned j=0;j<1<<16;j++){
	unsigned s=c;
	for(int k=0;k<8;k++){
	  s+=b[i][k]^j;
	}
	if((s&(1<<16)-1)==(b[i][8]^j)){
	  r+=j<<(16*i);
	  c=s>>16;
	  break;
	}
      }
    }
    printf("%x\n",r);
  }
  return 0;
}

Measured memory_bytes: 1032
#include <stdio.h>

int bubble(int [],int );
int main(void){
	int n,A[100];
	int i,c;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&A[i]);
	c=bubble(A,n);
	for(i=0;i<n;i++){
		printf("%d",A[i]);
		if(i!=n-1) printf(" ");
		else printf("\n");
	}
	printf("%d\n",c);
	return 0;
}

int bubble(int A[],int n){
	int i,flag,a,count=0;
	flag=1;
	while(flag){
		flag=0;
		for(i=n-1;i>0;i--){
			if(A[i]<A[i-1]){
				a=A[i];
				A[i]=A[i-1];
				A[i-1]=a;
				count++;
				flag=1;
			}
		}
	}
	return count;
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
const int INF = 1001001001;

int digit_sum(int n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        //↑合計 ↓桁数
        //res++;
        n /= 10;
    }
    return res;
}

int main()
{
    int n; cin >> n;
    int mn=INF;
    for(int a=1; a<n; a++){
        int b = n - a;
        mn = min(mn,digit_sum(a) + digit_sum(b));
    }
    cout << mn << endl;
}

/*
Ctrl+@
g++ a.cpp
./a.out
*/

Measured memory_bytes: 256
import bisect
N = int(input())
L = [int(x) for x in input().split()]
L = sorted(L)
ans = 0
for one in range(N - 2):
    for two in range(one+1, N-1):
        ans += bisect.bisect_left(L, (L[one] + L[two]))-two-1
        #print(bisect.bisect_left(L, (L[one] + L[two]))-two-1)
print(ans)


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

int main()
{
  int s,h,m;
  cin >> s;
  h=s/3600;
  s=s%3600;
  m=s/60;
  s=s%60;
  cout << h << ":" << m << ":" << s << endl;
   return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

int n,m;
vector<int> g[100010];
ll dp[100010];

ll dfs(int v){
  if(dp[v]!=-INF)return dp[v];
  ll res=0;
  for(int nv : g[v]){
    maxch(res,dfs(nv)+1);
  }
  return dp[v]=res;
}

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

  cin>>n>>m;
  rep(i,m){
    int x,y;
    cin>>x>>y;
    x--;y--;
    g[x].push_back(y);
  }

  ll res=0;
  rep(i,n)dp[i]=-INF;
  rep(i,n){
    maxch(res,dfs(i));
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 8576
from collections import deque
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
moves = ((0, 1), (1, 0), (0, -1), (-1, 0))
path = [[float('inf')]*w for _ in range(h)]
path[0][0] = 0
def bfs():
    q = deque([[0, 0]])
    while q:
        y, x = q.popleft()
        if y == h and x == w:
            return 
        for dy, dx in moves:
            ny = y + dy 
            nx = x + dx 
            if 0 <= ny < h and 0 <= nx < w and s[ny][nx] == '.' and path[ny][nx] == float('inf'):
                path[ny][nx] = min(path[ny][nx], path[y][x]+1)
                q.append([ny, nx])

bfs()

black = 0

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            black += 1 

if path[h-1][w-1] != float('inf'):
    print(h*w - black - path[h-1][w-1] - 1)
else:
    print(-1)

                    


Measured memory_bytes: 3316
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
const long long mod = 1000000007;

int main() {
	int W, H, x, y;
	scanf("%d %d %d %d", &W, &H, &x, &y);
	printf("%f %d", (double)(W)*H / 2.0, (x * 2 == W && y * 2 == H) ? 1 : 0);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define ppi pair<int,pair<int,int> >
#define fr first
#define sc second
#define PI acos(-1)
#define mp make_pair

const int mod = 1e9 + 7;

using namespace std;

#define sim template < class c

#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
//
//int n;
//vector<ll>v;
//vector<ll>pr;
//int p[40000];
//bool isprime(ll x){
//    for(int i = 0;pr[i]*pr[i]<=x;i++)
//        if(x % pr[i] == 0)return 0;
//    return 1;
//}
//ll sum (int x){
//    ll a = 0;
//    for(int i = 0;i<n;i++)a += abs(v[i] - x);
//    return a;
//}
//for(int i = 2;i<40000;i++)if(p[i] == 0){
//        pr.push_back(i);
//        for(int j = i + i;j<40000;j+=i)p[i] = 1;
//    }
//    cin >> n;
//    for(int i = 0;i<n;i++)
//    {
//        int x; cin >> x;
//        v.push_back(x);
//    }
//    sort(v.begin(),v.end());
//    ll ans = 1e18;
//    if(n % 2){
//        int i = n / 2;
//        int x = v[i];
//        int y = x;
//        while(!isprime(y))y++;
//        ans = min(ans , sum(y));
//        y = x;
//        while(y > 1 && !isprime(y))y--;
//        if(isprime(y))
//            ans = min(ans , sum(y));
//    }
//    else{
//        int i = n / 2 , j = n / 2 - 1;
//        int x1 = v[i],x2 = v[j];
//        while(!isprime(x1))x1++;
//        ans = min(ans , sum(x1));
//        x1++;
//        while(!isprime(x1))x1++;
//        ans = min(ans , sum(x1));
//
//        x1 = v[i];
//        while(x1 > 0 && !isprime(x1))x1--;
//        if(isprime(x1))ans = min(ans , sum(x1));
//        x1--;
//        while(x1 > 0 && !isprime(x1))x1--;
//        if(isprime(x1))ans = min(ans , sum(x1));
//
//
//
//        while(x2 > 1 && !isprime(x2))x2--;
//        if(isprime(x2))
//            ans = min(ans , sum(x2));
//        x2--;
//
//        while(x2 > 1 && !isprime(x2))x2--;
//        if(isprime(x2))
//            ans = min(ans , sum(x2));
//
//    }
//    cout << ans << endl;
int main()
{

    int m,d;
    cin >> m >> d;
    int ans=0;
    for(int i = 1;i<=m;i++){
        for(int j = 1;j<=d;j++){
            if(j / 10 >= 2 && j % 10 >= 2 && (j/10 * (j % 10)) == i)
                ans ++;
        }
    }
    cout << ans << endl;
        return 0;
}


Measured memory_bytes: 256
grp = ["S", "H", "C", "D"]
cards = []
for g in grp:
	for i in xrange(1, 13+1):
		cards.append("{0} {1}".format(g, i))
n = int(raw_input())
for i in xrange(n):
	card = raw_input()
	cards.remove(card)
for card in cards:
	print card

Measured memory_bytes: 4208
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramB
    {
        static string[] _mGraph;
        static string[] _nGraph;

        static int[] _dx = { 1, 0 };
        static int[] _dy = { 0, 1 };

        static int _n;
        static int _m;

        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            _n = int.Parse(inputs[0]);
            _m = int.Parse(inputs[1]);

            _nGraph = new string[_n];
            _mGraph = new string[_m];
            for (var i = 0; i < _n; i++)
            {
                _nGraph[i] = Console.ReadLine();
            }
            for (var i = 0; i < _m; i++)
            {
                _mGraph[i] = Console.ReadLine();
            }

            for (var ny = 0; ny <= _n - _m; ny++)
            {
                for (var nx = 0; nx <= _n - _m; nx++)
                {
                    if (_nGraph[nx][ny] != _mGraph[0][0]) continue;
                    if (search(nx, ny))
                    {
                        Console.WriteLine("Yes");
                        return;
                    }
                }
            }

            Console.WriteLine("No");
        }

        static bool search(int nx, int ny)
        {
            for (var my = 0; my < _m; my++)
            {
                for (var mx = 0; mx < _m; mx++)
                {
                    if (_nGraph[ny + my][nx + mx] != _mGraph[my][mx])
                        return false;
                }
            }
            return true;
        }
    }
}


Measured memory_bytes: 27388
#include <bits/stdc++.h>
typedef std::pair<int, int> P;

int W = 0;
int H = 0;

const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, 1, -1};

void display(std::string *tile){
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      std::cout << tile[i][j] << " ";
    }
    std::cout << std::endl;
  }
  std::cout << std::endl;
}

P getStart(std::string *tile){
  P start;
  bool flag = false;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(tile[i][j] == '@'){
        start.first = i;
        start.second = j;
        flag = true;
        break;
      }
      if(flag) break;
    }
  }
  return start;
}

int main(){
  while(1){
    std::cin >> W >> H;
    if(W + H == 0) break;
    std::vector<std::string> tile(H);
    for(int i = 0; i < H; i++){
      std::cin >> tile[i];
    }

    //display(tile.data());
    P s = getStart(tile.data());

    std::vector<std::vector<bool> > visited(H, std::vector<bool>(W, false));

    std::queue<P> que;
    que.push(s);
    int ans = 1;
    while(que.size()){
      P now = que.front();que.pop();
      for(int i = 0; i < 4; i++){
        int nx = now.second + dx[i], ny = now.first + dy[i];
        if(0 <= nx && nx < W && 0 <= ny && ny < H && !visited[ny][nx] && tile[ny][nx] == '.'){
          que.push(P(ny, nx));
          visited[ny][nx] = true;
          ans++;
        }
      }
    }
    
    std::cout << ans << std::endl;
    
  }
  
  return 0;
}

Measured memory_bytes: 3156
#include <iostream>
#include <string>
#include <algorithm>
#define	MOD = 1000000007;
using namespace std;

int main()
{
	int N;
	string S;

	cin >> N >> S;

	int c = 0;
	int max = 0;
	for (int i = 0; i < S.size(); i++)
	{
		if (S[i] == 'D')
		{
			c--;
		}
		else if (S[i] == 'I')
		{
			c++;
		}
		if (max < c)
		{
			max = c;
		}
	}

	cout << max << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    int n; cin >> n;
    int odd=0,even=0;
    rep(i,n){
        int num; cin >> num;
        if(num%2==0) even += 1;
        else odd += 1;
    }
    if(odd%2!=0) cout << "NO" << endl;
    else cout << "YES" << endl;

    return 0;
}

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

 int main() {
   int N, M;
   cin >> N >> M;

   vector<pair<ll, ll>> A;
   rep(i, 0, N) {
     ll tmp;
     cin >> tmp;
     A.push_back({tmp, 1});
   }

   rep(i, 0, M) {
     ll b, c;
     cin >> b >> c;
     A.push_back({c, b});
   }

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

   ll ans = 0, cnt = N;
   for (int i = A.size() - 1; i >= 0; i--){
     ans += A.at(i).first * min(cnt, A.at(i).second);
     cnt -= A.at(i).second;
     if (cnt <= 0) break;
   }

   cout << ans << endl;
 }


Measured memory_bytes: 6512
#include<stdio.h>
#include<ctype.h>
#include<string.h>
int main(){
char w[15],t[1010];
int i,ans=0;
scanf("%s",w);
while(1){
scanf("%s",t);
if(strcmp(t,"END_OF_TEXT")==0){
break;
}
for(i=0;t[i]!='\0';i++){
t[i]=tolower(t[i]);
}
if(strcmp(w,t)==0){
ans++;
}
}
printf("%d\n",ans);
return 0;
}


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

using namespace std;

int main() {
   
   int n;
   cin >> n;
   
   int max = 0;
   int count = 0;
   int h_prev = 0;
   for (int i = 0; i < n; ++i) {
      int h;
      cin >> h;
      
      if (h_prev >= h) {
         ++count;
         max = max < count ? count : max;
      }
      else {
         max = max < count ? count : max;
         count = 0;
      }
      
      h_prev = h;
   }
   
   cout << max << endl;
   
   return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int main(void){
  int n;
  while(scanf("%d",&n), n){
    int ans = 0, com_cum[1001];
    com_cum[1] = 0;
    for(int i=1; i <= n; i++){
      com_cum[i] = com_cum[i-1] + i;
    }
    for(int i=0; i < n; i++){
      for(int j=i+1; j < n; j++){
	if(n == com_cum[j] - com_cum[i])
	  ans++;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

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

int main() {

    int n;
    cin >> n;

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

    unordered_set<int> st;
    for(int i = 0; i < (1<<n); ++i){
        int sum = 0;
        for(int j = 0; j < n; ++j){
            if(i & (1<<j)) sum += a[j];
        }
        st.insert(sum);
    }

    int q;
    cin >> q;
    for(int _ = 0; _ < q; ++_){
        int m;
        cin >> m;

        if(st.count(m)) puts("yes");
        else puts("no");
    }

    return 0;
}


Measured memory_bytes: 3120
current = 0
walls = {}
total = 0
ponds = []
gets.split('').each.with_index do |c, i|
  case c
  when '\\'
    walls[current] = i
    current -= 1
  when '/'
    current += 1
    start =  walls[current]
    if start
      total += i - start
      subponds = ponds.select {|pond| pond[0] > start }
      if subponds.empty?
        ponds << [start, (i - start)]
      else
        ponds -= subponds
        ponds << [start, (i - start) + subponds.map {|sp| sp[1]}.reduce(&:+)]
      end
    end
  when '_'
  when "\n"
    break
  end
end
puts total
ponds = [ponds.size] + ponds.map {|p| p[1]}
puts ponds.join(' ')



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

using namespace std;

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

	int ans = 0;
	for (int i = 0; (size_t)i < S.size() / 2; i++) {
		if (S[i] != S[S.size() - 1 - i]) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define FO(i,a,b) for (int i = (a); i < (b); i++)
#define sz(v) int(v.size())

using namespace std;

int n, m;
int a[105];

bool cmp(int i, int j) {
    return i%2 > j%2;
}

int main() {
    scanf("%d %d", &n, &m);
    int nodd = 0;
    FO(i,0,m) {
        scanf("%d", a+i);
        if (a[i] % 2 == 1) nodd++;
    }
    if (nodd >= 3) {
        printf("Impossible\n");
        return 0;
    }
    if (m == 1) {
        printf("%d\n", a[0]);
        if (n == 1) printf("1\n1\n");
        else printf("2\n%d 1\n", a[0]-1);
        return 0;
    }

    sort(a,a+m,cmp);

    if (a[1]%2 == 1) {
        swap(a[1], a[m-1]);
    }
    FO(i,0,m) printf("%d%c", a[i], " \n"[i+1==m]);

    vector<int> r;
    if (a[0] > 1) r.push_back(a[0]-1);
    FO(i,1,m-1) {
        r.push_back(a[i]);
    }
    r.push_back(a[m-1]+1);
    printf("%d\n", sz(r));
    FO(i,0,sz(r)) printf("%d%c", r[i], " \n"[i+1==sz(r)]);
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastReader fr = new FastReader();
		int n = fr.nextInt();
		int a = fr.nextInt();
		int b = fr.nextInt();
		String s = fr.nextLine();
		int curPassCount = 0;
		int overSeasRank = 1;
		for (int i=0; i<n; i++) {
			if (s.charAt(i) == 'c') {
				System.out.println("No");
			} else if (s.charAt(i) == 'b') {
				if (overSeasRank <= b && curPassCount < a + b) {
					curPassCount++;
					overSeasRank++;
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
			} else {
				if (curPassCount < a + b) {
					curPassCount++;
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
			}
		}
	}
	

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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

}


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

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

    int x = 0;
    int ans = 0;
    for(int i = 0; i < s.length(); i++){
        if(s[i] == 'I') x++;
        else x--;

        if(ans < x) ans = x;
    }
    cout << ans << endl;
    return 0;
}

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

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define fr(i,k,n) for (int i = k; i < n; ++i)
#define fri(i,k,n) for (int i = k; i >= n; --i)
#define INF (int)1e9
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(arr) arr.begin(),arr.end()

void boost(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int N=2e5+5;
vi adj[N],freq;
int vis[N],cnt,cc;

void dfs(int u){
	vis[u]=1;
	cnt++;
	for(auto v: adj[u]){
		if(!vis[v])
			dfs(v);
	}
}

void solve(){
	int n,m;
	cin>>n>>m;
	int u,v;
	fr(i,0,m){
		cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	cc=0;
	fr(i,1,n+1){
		if(!vis[i]){
			cnt=0;
			dfs(i);
			cc++;
			freq.pb(cnt);
		}
	}
	sort(all(freq));
	ll ans=0;
	int prev=0;
	fr(i,0,cc){
		freq[i]-=prev;
		ans+=freq[i];
		prev+=freq[i];
	}
	cout<<ans<<endl;
	return;
}

int main()
{
	boost();
	
	int tc=1;
	//cin>>tc;
	while(tc--)
		solve();
	return 0;
}

Measured memory_bytes: 21548
#include <stdio.h>

int main(void) {

  int a,b;
  int i,flag,ini=0;

  while(1) {

    scanf("%d %d",&a,&b);

    if(a==0 && b==0) {
      break;
    }

    flag=0;

    if(ini==1) puts("");
    else ini=1;

    for(i=a;i<=b;i++) {
      
      if((i%4==0 && i%100!=0) || i%400==0) {
	printf("%d\n",i);
	flag=1;
      }

    }

    if(flag==0) printf("NA\n");

    //printf("\n");
  }

  return 0;

}

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

int parent(int);
int left(int);
int right(int);

int main(){
  int h,l,r,*A;
  int i;

  scanf("%d",&h);
  A = (int *)malloc(sizeof(int)*(h+1));
  for(i=1;i<=h;i++){
    scanf("%d",&A[i]);
  }

  for(i=1;i<=h;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i!=1) printf("parent key = %d, ",A[parent(i)]);
    if((l=left(i)) <= h) printf("left key = %d, ",A[l]);
    if((r=right(i)) <= h) printf("right key = %d, ",A[r]);
    printf("\n");
  }

  return 0;
}

int parent(int i){
  if(i%2==0) return i/2;
  else return (i-1)/2;
}

int left(int i){
  return i*2;
}

int right(int i){
  return i*2+1;
}

Measured memory_bytes: 600
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        int ans=0;
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] S=new int[n];
        for(int i=0;i<n;i++){
            S[i]=sc.nextInt();
        }
        int q=sc.nextInt();
        int[] T=new int[q];
        for(int i=0;i<q;i++){
            T[i]=sc.nextInt();
        }
        Arrays.sort(S);
        Arrays.sort(T);
        int[] newS=new int[n+1];
        for(int i=0;i<n+1;i++)
            newS[i]=-1;
        newS[0]=S[0];
        int k=1;
        for(int i=1;i<n;i++){
            if(S[i]!=S[i-1])
                newS[k++]=S[i];
        }
        for(int i=0;i<q;i++){
            for(int j=0;newS[j]!=-1;j++){
                if(newS[j]==T[i]){
                    ans++;
                    break;
                }
            }
        }
        System.out.println(ans);
    }
}



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

void Disp(int *a,int n){
    for(int i = 0;i < n-1;i++){
        cout << a[i] << " ";
    }cout << a[n-1] << endl;
}

int main(){
    int v,j,n = 0;
    
    cin >> n;
    
    int a[n];
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    
    for(int i = 1;i < n;i++){
        Disp(a,n);
        v = a[i];
        j = i - 1;
        
        while(j >= 0 && a[j] > v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
    }
    
    Disp(a,n);
    
    return 0;
}

Measured memory_bytes: 3116
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
	#define dbg(x) cout << #x << " : " << x << endl;
#else 
	#define dbg(x)
#endif

#define int long long
#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 500010;
const double EPS = 1e-9;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int pw(int a, int b) {
	if (!b) return 1;
	int res = pw(a, b / 2);
	res = res * res % MOD;
	if (b & 1)
		res = res * a % MOD;
	return res;
} 
int f[MX];
int f1[MX];

int C(int n, int k) {
	if (k < 0 || k > n)
		return 0;
	return f[n] * f1[k] % MOD * f1[n - k] % MOD;
}

int A(int n, int k) {
	if (k < 0 || k > n)
		return 0;
	return f[n] * f1[n - k] % MOD;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   	
   	f[0] = 1;
   	fi(1, MX)
   		f[i] = f[i - 1] * i % MOD;
   	f1[MX - 1] = pw(f[MX - 1], MOD - 2);
   	fi1(MX - 1, 0)
   		f1[i] = f1[i + 1] * (i + 1) % MOD;
   	int n, m;
   	cin >> n >> m;
   	int res = A(m, n) * A(m, n) % MOD;
   	dbg(res);
   	fi(1, n + 1) {
   		int d = C(n, i) * A(m, i) % MOD * pw(A(m - i, n - i), 2) % MOD;
   		if (i % 2) {
   			res -= d;
   		} else {
   			res += d;
   		}
   		dbg(res);
   	}  
   	res += MOD * MOD;
   	cout << res % MOD << '\n';
}

Measured memory_bytes: 11344
#include<iostream>
#include <string>

using namespace std;

int main(void)
{
	string S;
	cin >> S;

	bool flag[3] = { false, false, false };
	if (S[0] == 'A'){
		flag[0] = true;
	}
	int c = 0;
	for (int i = 2; i < S.size() - 1; i++){
		if (!flag[1] && S[i] == 'C'){
			flag[1] = true;
			c = i;
		}
		else if (flag[1] && S[i] == 'C'){
			flag[1] = false;
			break;
		}
	}
	flag[2] = true;
	for (int i = 1; i < S.size(); i++){
		if (i == c){
//			cout <<"c" << i << endl;
			continue;
		}
		if (!('a' <= S[i] && S[i] <= 'z')){
			flag[2] = false;
		}
	}

	if (flag[0] && flag[1] && flag[2]){
		cout << "AC" << endl;
	}
	else{
		cout << "WA" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a,b;
        a = sc.nextInt();
        b = sc.nextInt();
        if(a<b)System.out.println("a < b");
        else if(a>b)System.out.println("a > b");
        else System.out.println("a == b");
    }
}


Measured memory_bytes: 26232
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long 
int ctoi(char c) {return c-'0';}/*char to int*/
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}/*MAX*/
int lcm(ll a,ll b){return a*b/gcd(a,b);}/*MIN*/
bool primecheck(ll n){/*sosuu*/if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
int  main(){
int n;
cin >> n;
priority_queue<ll>d;
for(int i=0;i<n;i++){
    ll z;
    cin >> z;
    d.push(z);
}
int m;
cin >> m;
priority_queue<ll>t;
for(int j=0;j<m;j++){
    ll z;
    cin >> z;
    t.push(z);
}
bool ans = true;
while(!t.empty()){
    if(d.empty()){
        ans=false;
        break;
    }
    ll dd = d.top();

    ll tt = t.top();
    if(dd==tt){
        t.pop();
        d.pop();
    }
    else{
        d.pop();
    }
}
if(ans)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}







Measured memory_bytes: 4848
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout << xs[i] << " ";
	cout << xs[xs.size()-1] << endl;
}
template<typename T> inline void debug(const vector<T> &xs){
#ifdef DEBUG
	pr(xs);
#endif
}

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

	vector<int> items(1, 1);
	int p6=1, p9=1;
	for(int i=0; i<7; i++){
		p6 *= 6;
		p9 *= 9;
		items.push_back(p6);
		items.push_back(p9);
	}
	debug(items);

	vector<int> cnt(N+1, 1e8);
	cnt[0] = 0;
	for(int i=1; i<=N; i++){
		for(int item: items){
			if(i>=item) cnt[i] = min(cnt[i], 1+cnt[i-item]);
		}
	}

	cout << cnt[N] << endl;


	return 0;
}


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

int main(){

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

	int x,y;
	int valueX;
	int valueY;

	if(n%a == 0){
		x = n/a;	
	}
	else{
		x = n/a + 1;
	}

	if(n%c == 0){
		y = n/c;
	}
	else{
		y = n/c +1;
	}

	valueX = x*b;
	valueY = y*d;

	if(valueX <= valueY){
		cout << valueX << endl;
	}
	else{
		cout << valueY << endl;
	}



	return 0;
}



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

int main() {
	int x, y, z;
	cin >>x >> y >> z;
	if((x * 100 + y * 10 + z) % 4 == 0)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;  
	return 0;
}


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

 int main(){
  int N;
  cin >> N;
  if( N%1111 == 0 ){
  	cout << "Yes" << endl;
  }
  else if( N%1110 < 10 ){
  	cout << "Yes" << endl;
  }
  else if( N%1000%111==0 ){
  	cout << "Yes" << endl;
  }


  else{
  	cout << "No" << endl;
  }
  	 }

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100005
#define N -1
struct Node{int p, l, r;};
struct Node T[MAX];
int n, D[MAX];

void print(int x){
  int i,c;
  printf("node %d: ",x);
  printf("parent = %d, ",T[x].p);
  printf("depth = %d, ",D[x]);
  if(T[x].p==N)
    printf("root, ");
  else if(T[x].l==N)
    printf("leaf, ");
  else
    printf("internal node, ");
  printf("[");
  for(i=0,c=T[x].l;c!=N;i++,c=T[c].r){
    if(i)
      printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

int rec(int x, int p){
  D[x]=p;
  if(T[x].r!=N)
    rec(T[x].r,p);
  if(T[x].l!=N)
    rec(T[x].l,p+1);
}

int main(){
  int i,j,d,v,c,l,r;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=T[i].l=T[i].r=N;
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&v,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0)
	T[v].l=c;
      else
	T[l].r=c;
      l=c;
      T[c].p=v;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].p==N)
      r=i;
  }
  rec(r,0);
  for(i=0;i<n;i++){
    print(i);
  }
  return 0;
}
      

Measured memory_bytes: 5296
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  int n, k;
  readf("%s %s\n", &n, &k);
  auto p = readln.chomp.split.to!(int[]);
  auto di = new double[](1001);
  di[0] = 0;
  foreach (i; 1..1001) {
    di[i] = di[i-1] + i;
  }
  
  double sum = 0;
  foreach (i; 0..k) {
    sum += di[p[i]] / p[i];
  }
  auto res = sum;
  foreach (i; 1..n-k+1) {
    sum -= di[p[i-1]] / p[i-1];
    sum += di[p[i+k-1]] / p[i+k-1];
    res = max(res, sum);
  }
  writefln("%.12f", res);
}


Measured memory_bytes: 10152
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

ll a, b, c;

int main() {
	cin >> a >> b >> c;
	cout << (a + b + c >= 22 ? "bust" : "win") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define input freopen("input.txt", "r", stdin);
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);



#include<bits/stdc++.h>
using namespace std;
int main()
{
    int d, t, s;
    cin>>d>>t>>s;
    if(t*s>=d) puts("Yes");
    else puts("No");
}






Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define pa pair<int,int>
#define mod 998244353
#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define cl(x) memset(x,0,sizeof x)
#ifdef Devil_Gary
#define bug(x) cout<<(#x)<<" "<<(x)<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define bug(x)
#define debug(...)
#endif

const int INF = 0x7fffffff;
const int N=1e6+5;
/*
char *TT,*mo,but[(1<<15)+2];
#define getchar() ((TT==mo&&(mo=(TT=but)+fread(but,1,1<<15,stdin),TT==mo))?-1:*TT++)//*/
inline int read(){
    int x=0,rev=0,ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')rev=1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
    return rev?-x:x;
}/*
struct Edge{
	int nxt,v;
//	int w;
//	int id;
}e[N<<1];
void add(int u,int v){
	e[++tot].v=v,e[tot].nxt=head[u],head[u]=tot;
	e[++tot].v=u,e[tot].nxt=head[v],head[v]=tot;
}*/
int n,m,a[N],t[N],flg;
int main(){
#ifdef Devil_Gary
    freopen("in.txt","r",stdin);
//  freopen("out.txt","w",stdout);
#endif
	n=read();//,m=read();
	for(int i=1;i<=n;i++) a[i]=read(),t[a[i]]++;
	for(int i=2;i<N;i++){
		int cnt=0;
		for(int j=i;j<N;j+=i){
			cnt+=t[j];
		}
		if(cnt>1) flg=1;
	}
	if(!flg){
		puts("pairwise coprime");
	}
	else {
		for(int i=2;i<=n;i++) a[i]=__gcd(a[i],a[i-1]); 
		if(a[n]==1) puts("setwise coprime");
		else puts("not coprime");
	}
	return 0;
}


Measured memory_bytes: 11332
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define print(ele) cout << ele << endl
#define print10(ele) cout << fixed << setprecision(10) << ele << endl

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

int main() {
  int n;
  cin >> n;
  ivec t(n + 1), x(n + 1), y(n + 1);
  REP(i, n) cin >> t[i] >> x[i] >> y[i];
  bool ok = true;

  REP(i, n) {
    ll cur = x[i] + y[i];
    if (t[i] < cur) ok = false;
    if (t[i] % 2) {
      if (!(cur % 2)) ok = false;
    } else {
      if (cur % 2) ok = false;
    }
  }

  print((ok ? "Yes" : "No"));
  return 0;
}

Measured memory_bytes: 1408
n = int(input())
xs = []

for i in range(n):
    t, x, y = list(map(int, input().split()))
    xs.append([t, (x, y)])

tx = [0, (0, 0)]
ans = True

for i in range(n):
    dxy = (abs(xs[i][1][0]-tx[1][0])+abs(xs[i][1][1]-tx[1][1]))
    dt = xs[i][0]-tx[0]
    if dxy == dt:
        tx = xs[i]
    elif dxy < dt and (dt - dxy) % 2 == 0:
        tx = xs[i]
    else:
        ans = False
        break

msg = 'Yes' if ans else 'No'
print(msg)


Measured memory_bytes: 26304
#include <bits/stdc++.h>
#define db(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl;
#define ll long long
#define ld long double
#define pll pair<ll, ll>
#define MOD 1000000007
#define FOR(i, n) for(ll i = 0; i < n; i++)
using namespace std;
const long long INF = 3*1e18;

int main() {
    ios::sync_with_stdio(0);    
    cin.tie(0);
    ll n, m;
    cin >> n >> m;
    vector<ll> h(n);
    FOR(i, n) cin >> h[i];
    vector<ll> g[n+5];
    for(ll i = 0; i < m; ++i){
        ll u, v;
        cin >> u >> v;
        g[u].push_back(h[v-1]);
        g[v].push_back(h[u-1]);
    }
    ll count = 0;
    for(ll i = 1; i <= n; ++i){
        ll ht = h[i-1];
        if(g[i].size() != 0) {
            sort(g[i].begin(), g[i].end(), greater<ll>());
            if(ht > g[i][0]) ++count;
            //db(i);
        }    
        else ++count;   
    }
    cout << count << "\n";
}

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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll n, t, c=0;
  cin >> n;
  vecll a(9, 0);
  forll(i, 0, n){
	cin >> t;
	forll(j, 1, 9){
	  if (t < j * 400){
		a[j-1]++;
		break;
	  }
	}
	if (t >= 3200)
	  a[8]++;
  }
  forll(i, 0, 8){
	if (a[i] > 0)
	  c++;
  }
  cout << max((ll)1, c) << " " << c+a[8] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
 
 
 
int main() {
 	long long a,b,c ;
   long double x;
  cin >> a >> b >>c;
  x=sqrtl(a*b);
   
  if(a+b+2*x<c){
  cout << "Yes" << endl;
  }
  else {
    cout << "No"<< endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 500009
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
int main(void)
{
    //freopen("in.txt","r",stdin);

    double r,ans;
    cin>>r;
    ans=2*PI*r;
    cout<<ans<<endl;

    //main();
    return 0;
}


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

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

	auto y = [](int64_t x) {
		vector<int64_t> r;
		for (int64_t i = 1; i * i <= x; i++)
		{
			if (x % i == 0)
			{
				r.emplace_back(i);
				if (i * i == x)
				{
					continue;
				}
				r.emplace_back(x / i);
			}
		}
		sort(r.begin(), r.end());
		return r;
	}(n);
	y.erase(y.begin());

	int64_t ans = 0;
	for (auto &x : y)
	{
		int64_t m = x - 1;
		if (n / m == n % m)
		{
			ans += m;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <math.h>
#include <iomanip>
//std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <boost/multiprecision/cpp_dec_float.hpp>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define repP(i, a, b) for(int i = a; i < b; i++)
#define repM(i, a, b) for(int i = a - 1; i >= b; i--)

using namespace std;
namespace mp = boost::multiprecision;
// 仮数部 500 bit の浮動小数点数
using cpp_dec_float = mp::number<mp::cpp_dec_float<500>>;
int main()
{
  long double /*a = 0*/b = 0, c = 0, d = 0, e = 0, f = 0;
  int a;
  int i = 0, j = 0;
  int num = 0, count = 0, ans = 0;
  //double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  long double a1[999999], a2[999999], a3[999999];
  long double arr[100000][2];
  //char s1[200000], s2[200000], s3[200000];
  //string s1, s2, s3;
  
  cin >> a;
  //aPa - 1
  for(i = 0; i < a; i++){
    cin >> arr[i][0] >> arr[i][1];
  } 
    for(i = 0; i < a; i++){
      for(j = 0; j < a; j++){
        if(i != j){
          b = sqrt(pow(arr[i][0] - arr[j][0], 2) + pow(arr[i][1] - arr[j][1], 2));
          c += b;
        }
      }
    }
  
  cout << std::setprecision(30) << c / a << endl;
}


Measured memory_bytes: 256
import sys, io, os, re
import bisect
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor
from copy import copy, deepcopy
from collections import deque
from fractions import gcd
from functools import reduce

def array1(n): return [0] * n
def array2(n, m): return [[0] * m for x in range(n)]
def array3(n, m, l): return [[[0] * l for y in xrange(m)] for x in xrange(n)]

arr = list(sys.stdin.readline().strip().split())
arr[0] = int(arr[0])
arr[1] = int(arr[1][0])*100+int(arr[1][2])*10+int(arr[1][3])

print((arr[0]*arr[1])//100)

Measured memory_bytes: 72776
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    W,a,b = MI()
    if (b-(a+W)) * ((b+W)-a) < 0:
        print(0)
    else:
        print(min(abs(a+W-b), abs(b+W-a)))
if __name__ == '__main__':
    main()

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

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

	string s;
	long long int res = 0;
	long long int cnt = 0;

	cin >> s;

	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='B')
		{
			cnt++;
		}
		else
		{
			res += cnt;
		}
	}

	cout << res << '\n';
	
	return 0;	
}


Measured memory_bytes: 720
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        Map<Long,Integer> map = new HashMap<>();
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            map.put((long)A[i],map.getOrDefault((long)A[i],0)+1);
        }

        int ans = 0;
        for (int i = 0; i < N; i++) {
            int tmp = A[i];
            List<Pair> primes = new ArrayList<>();
            for (int p = 2; p*p <= tmp; p++) {
                if (tmp%p != 0) continue;

                Pair pair = new Pair(p);
                while (tmp%p == 0) {
                    pair.cnt++;
                    tmp /= p;
                }
                primes.add(pair);
            }
            if (tmp != 1) primes.add(new Pair(tmp,1));
            /*
            for (Pair x : primes) {
                System.out.println(x.p + " " + x.cnt);
            }
            */
            map.put((long)A[i],map.get((long)A[i])-1);
            boolean found = find(primes, map, 0, 1);
            //System.out.println(i+" "+A[i] + " " + found);
            if (!found) {
                ans++;
            }
            map.put((long)A[i],map.get((long)A[i])+1);
        }

        System.out.println(ans);
    }

    private static boolean find(List<Pair> primes, Map<Long,Integer> map, int now, long div) {

        if (now == primes.size()) {
            //System.out.println(" " + div);
            return map.get(div) != null && map.get(div) > 0;
        }

        Pair a = primes.get(now);
        int tmp = 1;
        boolean ret = false;
        for (int i = 0; i <= a.cnt; i++) {
            ret |= find(primes, map, now+1, (long)div*tmp);
            tmp *= a.p;
        }
        return ret;
    }

    private static class Pair {
        final int p;
        int cnt;
        Pair(int p) {
            this.p = p;
            this.cnt = 0;
        }
        Pair(int p, int cnt) {
            this.p = p;
            this.cnt = cnt;
        }
    }
}


Measured memory_bytes: 78700
#include <iostream>

#define ULL unsigned long long
#define LL long long

using namespace std;

ULL mem[201][201];

ULL gcd(ULL a,ULL b){
	if(mem[a][b]!=-1){
		return mem[a][b];
	}
	if(a%b==0){
		return mem[a][b]=mem[b][a]=b;
	}else{
		return mem[a][b]=gcd(b,a%b);
	}
	
}

int main(){
	ULL K,sum=0;

	for(int i=0;i<=200;i++){
		for(int j=0;j<=200;j++){
			mem[i][j]=-1;
		}
	}

	cin >> K;
	for(ULL i=1;i<=K;i++){
		for(ULL j=1;j<=K;j++){
			for(ULL m=1;m<=K;m++){
				sum+=gcd(i,gcd(j,m));
			}
		}
	}
	
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3904
#include <vector>
#include <map>
#include <algorithm>
#include <cstdio>
using namespace std;
int main(){
	int N,M;
	scanf("%d%d",&N,&M);
	vector<int>v(N);
	for(;M--;){
		int a,l;
		scanf("%d%d",&a,&l);
		for(int i=0;i<l;i++)v[(a+i)%N]=1;
	}
	rotate(v.begin(),min_element(v.begin(),v.end()),v.end());

	map<int,int>m;
	for(int i=0,c=0,x=0;i<N;i++){
		if(x&&!v[i]){
			m[-c]++;
			c=0;
		}else if(v[i]){
			c++;
		}
		x=v[i];
		if(i==N-1&&c)m[-c]++;
	}
	for(auto &e:m){
		printf("%d %d\n",-e.first,e.second);
	}
}


Measured memory_bytes: 1036
#include<bits/stdc++.h>
 
typedef long long int ll;
 
using namespace std;
 
#define MOD (ll)1000000007
 
ll arr[1000000];
 
ll func(int p)
{
	ll ans = 1;
	if(p == 0) return 1;
	for(int i = 1; i <= p; i++)
	{
		ans = ((ans%MOD) * (2%MOD))%MOD;
	}
	return ans;
} 
 
int main(){
 
    ll n;
    cin >> n;
    for(ll i = 0; i < n; i++){
        cin >> arr[i];
    }
    ll sum = 0;
    for(ll i = 0; i < 64; i++){
        ll oc = 0, zc = 0;
        for(ll j = 0; j < n; j++){
            if(arr[j]%2 == 0){
                zc++;
            }
            else{
                oc++;
            }
            arr[j] /= 2;
        }
        ll idsum = ((zc%MOD)*(oc%MOD))%MOD;
        idsum  = ((idsum%MOD) * (func(i)%MOD))%MOD;
        sum = ((sum%MOD) + (idsum%MOD))%MOD;
    }
    cout << sum;
}

Measured memory_bytes: 5916