akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);

const int N = 2e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
int tc;

int main()
{
    string s; cin>>s;
    if(s[0] == 'R' && s[1]=='R' && s[2] == 'R')
        cout<<3<<endl;
    else if(s[0] == 'R' && s[1] == 'R')
        cout<<2<<endl;
    else if(s[1] == 'R' && s[2] =='R')
        cout<<2<<endl;
    else if(s[0] =='R' || s[1] == 'R' || s[2] == 'R')
        cout<<1<<endl;
    else
        cout<<0<<endl;

    return 0;
}

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

int main(void) {
    int h, w, dx[4] = {0, -1, 1, 0}, dy[4] = {-1, 0, 0, 1};
    char b[55][55];
    bool ans = true;
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> b[i][j];
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (b[i][j] == '#') {
                bool flag = false;
                for (int k = 0; k < 4; k++) {
                    int nx = j + dx[k], ny = i + dy[k];
                    if (nx < 0 || nx >= w || ny < 0 || ny >= h)
                        continue;
                    if (b[ny][nx] == '#')
                        flag = true;
                }
                if (!flag)
                ans = false;
            }
        }
    }
    cout << (ans ? "Yes": "No") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define pb push_back
#define pp pop_back
#define f first
#define s second
#define sz(a) (int)((a).size())
#define NoType ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL)
#define mp make_pair

typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//find_by_order(x) -> returns an iterator to the element at a given position
//order_of_key(x) -> returns the position of a given element

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pi;

const int mod = (int)1e9 + 7;
const int MAXN = 1e5+12;
//indexed_set s;

string s;

int main() {

    cin >> s;

    ll sum = 0;
    for (int i = 0; i < s.size(); i++) sum += (s[i] - 48);

    if (sum % 9 == 0) cout << "Yes";
    else cout << "No";

return 0;
}


Measured memory_bytes: 3700
N, M = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort.reverse

s = [a.shift / 2]
(M - 1).times do
  if a == []
    a = s
    s = [a.shift / 2]
  elsif a[0] > s[0]
    s << a.shift / 2
  else
    s << s.shift / 2
  end
end

ans = 0
a += s
a.each do |e|
  ans += e
end

puts ans


Measured memory_bytes: 13936
#include<iostream>
#include<string>
#include<set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define INF 1e9
using namespace std;

bool check(char ch){
	if(ch=='a'||ch=='i'||ch=='u'||ch=='e'||ch=='o')return true;
	else return false;
}

int max(int a,int b){
	return (a>b)?a:b;
}

int main(){
	int n,m;
	while(cin>>n,n){
		string s[n];
		m=0;
		rep(i,n){
			cin>>s[i];
			string alt="";
			rep(j,s[i].size()){
				if(j==0)alt+=s[i][j];
				if(j!=s[i].size()-1&&check(s[i][j]))alt+=s[i][j+1];
			}
			s[i]=alt;
			m=max(m,alt.size());
		}
		bool tmp;
		set<string> st;
		int ans=-1;
		loop(k,1,m+1){
			st.clear();
			tmp=true;
			rep(j,n){
				string now=(k<=s[j].size())?s[j].substr(0,k):s[j];
				if(st.find(now)!=st.end()){
					tmp=false;
					break;
				}else st.insert(s[j].substr(0,k));
			}
			if(tmp){
				ans=k;
				break;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3192
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int m,d;
  cin >> m >> d;

  int ans = 0;
  FOR(j,1,m+1){
  FOR(i,1,d+1){
    int x,y;
    x = i/10; y = i%10;
    if(x > 1 && y > 1 && x*y == j) ans++;
  }}

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    double a, b;
    cin >> a >> b;
    printf("%.10f\n", a * b / 3.305785);

    return 0;
}

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

string s;
int n;
bool bj1,bj2;

int main()
{

	cin >>s;
	s = " "+s;
	n = s.size();
	for(int i=1; i<n; i +=2 )
		if(s[i] != 'R' && s[i] != 'U' && s[i] != 'D')
				{
					cout<<"No"<<endl;
					return 0;
				}

	for(int i=2; i<n; i +=2 )
		if(s[i] != 'L' && s[i] != 'U' && s[i] != 'D')
			{
				cout<<"No"<<endl;
				return 0;
			}
			
	cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main()
{
  int n,x,count=0,i,j,k,box[100];
  while(1)
    {
      scanf("%d%d",&n,&x);
      if(n==0 && x==0)break;
      for(i=0;i<n;i++)
	box[i]=i+1;
      for(i=0;i<n-2;i++)
	for(j=i+1;j<n-1;j++)
	  for(k=j+1;k<n;k++)
	    if(box[i]+box[j]+box[k]==x)count++;
      printf("%d\n",count);
      count=0;
    }
  return 0;
}

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


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

  vector<tuple<string, int, int>> P;  //P[i]="city", points, i
  
  for (int i = 0; i < N; i++) {
    cin >> s >> pts;
    P.push_back(make_tuple(s, 100-pts, i+1));
  }

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

  // 各組織について、答えを出力
  for (int i = 0; i < N; i++) {
    cout << get<2>(P[i]) << endl;
  }
}



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


const int L = 100;
int dp[L][10][4];
string n;
int k;


void init()
{
    dp[0][0][0] = 1;
    for (int d = 1; d <= 9; d++) dp[0][d][1] = 1;
    for (int i = 1; i < L; i++) {
        for (int d = 0; d <= 9; d++)
            for (int dd = 0; dd <= 9; dd++)
                for (int c = 0; c <= 3; c++) {
                    int t = (d == 0) ? 0 : 1;
                    if (t + c <= 3) dp[i][d][t + c] += dp[i - 1][dd][c];
                }
    }
}


void solve()
{
    int len = n.size();
    int krest = k;
    int ans = 0;
    for (int i = 0; i < len; i++) {
        int d = n[i] - '0';
        int jmax = (i == len - 1) ? d : d - 1;
        for (int j = 0; j <= jmax; j++) ans += dp[len - 1 - i][j][krest];
        if (d > 0) krest--;
        if (krest < 0) break;
    }
    cout << ans << endl;
}


int main()
{
    cin >> n >> k;
    init();
    solve();
    return 0;
}


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

int main() {
  int N;
  int K;
  int x;
  int s = 0;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> x;
    if (x < K -x)
      s += 2*x;
    else
      s += 2*(K-x);
  }
    cout << s << endl;
}





Measured memory_bytes: 256
def solve2():
    r, c = map(int, input().split(' '))

    ans_matrix = [[0 for _ in range(c + 1)] for _ in range(r + 1)]
    input_matrix = []

    for _ in range(r):
        input_matrix.append(list(map(int, input().split(' '))))

    largest_square = 0

    for i in range(len(input_matrix)):
        for j in range(len(input_matrix[i])):
            new_i, new_j = i + 1, j + 1
            if input_matrix[i][j] == 0:
                ans_matrix[new_i][new_j] = min(ans_matrix[new_i - 1][new_j], ans_matrix[new_i][new_j - 1], ans_matrix[new_i - 1][new_j - 1]) + 1
                largest_square = ans_matrix[new_i][new_j] if ans_matrix[new_i][new_j] > largest_square else largest_square
            else:
                ans_matrix[new_i][new_j] = 0

    print(largest_square ** 2)


def main():
    solve2()


if __name__ == '__main__':
    main()

Measured memory_bytes: 57904
#include<stdio.h>
int N, P, ans, max, i;
int main(){
	scanf("%d", &N);
	for(i=0; i<N; i++){
		scanf("%d", &P);
		ans += P;
		if(P > max){max = P;}
	}
	printf("%d\n", ans- max/2);
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>;
int sum;
int ans = 1 << 30;
int main() {
	std::string S;
	std::cin >> S;
	ans = S.size();
	for (int i = 1;i<(int)S.size(); i++) {
		if (S[i - 1] != S[i]) {
			ans = std::min(ans, (std::max(i, (int)S.size() - i)));
		}
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
#define endl "\n"
 
const LD EPS=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};


template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}


extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<> void print<string>(const string& container)
{
	cout<<container<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec)
{
	for(T& x: vec) is >> x;
	return is;
}


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

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}

template<typename Head, typename... Tail>
struct vector_demensions
{
	using type=vector<typename vector_demensions<Tail...>::type>;
};

template<typename Head>
struct vector_demensions<Head> { using type=Head; };

template<typename T>
vector<T> make_vectors(int size, T val)
{
	return vector<T>(size, val);
}

template<typename T=int, typename... Args>
auto make_vectors(int size, Args... tail)
	-> typename vector_demensions<Args..., T>::type
{
	auto val=make_vectors<T>(forward<Args>(tail)...);
	return vector<decltype(val)>(size, val);
}


int main()
{
	string s;
	int w;
	cin>>s>>w;
	string t="";
	REP(i,s.size())
	{
		if(i%w==0)
			t+=s[i];
	}
	print(t);
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

ll t[100002];
ll d,k,n,m,ans;

int main(){
  while(cin>>d&&d){
    cin>>n>>m;
    ans=0;
    for(int i=0;i<n-1;i++)cin>>t[i];
    t[n]=d;t[n-1]=0;
    n++;
    sort(t,t+n);
    for(int i=0;i<m;i++){
      cin>>k;
      ll* it = lower_bound(t,t+n,k);
      if(*it == k)continue;
      ans+= min( k - *(it-1) , *it - k );
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

int main() {
	int		a,b,c,i,j,k,n,m,x,y,ans = 0;
	string	str;
	
	cin >> n >> k;

	while ( n > 0 ) {
		n = n / k;
		ans++;
	}
	cout << ans << endl;


}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 1000000

typedef struct pp{
  char name[10];
  int time;
} P;

P Q[MAX];
int head, tail, n;

void initialize(){
  tail = 0;
  head = tail;
}

int isEmpty(){
  return head == tail;
}

int isFull(){
  return head == (tail + 1) % MAX;
}

void enqueue(P x){
  Q[tail] = x;
  if(tail+1==MAX){
    tail=0;
  }
  else tail++;
}

P dequeue(){
  P x;
  x = Q[head];
  if(head+1==MAX){
    head=0;
  }
  else head++;
  
  return x;
}

int min(int a, int b){
  return a < b ? a : b;
}

int main(){
  int elapsed_time=0;
  P  remaining;
  int i,q,c;

  scanf("%d %d",&n,&q);

  for(i=1; i<=n; i++){
    scanf("%s",&Q[i].name);
    scanf("%d",&Q[i].time);
  }

  head = 1;
  tail = n+1;

  while(head != tail){
    remaining = dequeue();
    c = min(q,remaining.time);
    remaining.time -= c;
    elapsed_time += c;
    if(remaining.time > 0){
      enqueue(remaining);
    }
    else {
      printf("%s %d\n",remaining.name,elapsed_time);
    }
  }

  return 0;
}



Measured memory_bytes: 4744
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
    int n,m;
  cin>>n>>m;
  cout<<(n-1)*(m-1);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
ll comb(ll, ll);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    int n, a, b;
    cin >> n >> a >> b;
    int ans = min(a * n, b);
    cout << ans << endl;
    return 0;
}

ll comb(ll a, ll b) {
    if (a < b) {
        return 0;
    }

    ll v[a + 1][a + 1] = {};

    rep(i, a + 1) {
        v[i][0] = 1;
        v[i][i] = 1;
    }

    repd(k, 2, a + 1) {
        repd(j, 1, k) { v[k][j] = v[k - 1][j - 1] + v[k - 1][j]; }
    }

    return v[a][b];
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }

    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }
        return;
    } else {
        prime_map(m, num);
    }
}


Measured memory_bytes: 256
#include<stdio.h>

#define N 100

int selectionSort(int *,int);

int main(void){
  int A[N],num,cnt;
  int i;

  scanf(" %d",&num);
  for(i = 0; i < num; i++){
    scanf(" %d",&A[i]);
  }

  cnt = selectionSort(A,num);

  for(i = 0; i < num-1; i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[num-1]);

  printf("%d\n",cnt);
  
  return 0;
}

int selectionSort(int *A, int num){
  int i,j;
  int min,tmp,cnt=0;

  for(i = 0; i < num; i++){
    min = i;
    for(j = i; j < num; j++){
      if(A[j] < A[min]){
	min = j;
      }
    }
    tmp = A[i];
    A[i] = A[min];
    A[min] = tmp;
    if(i != min) cnt++;
  }

  return cnt;
}
  
    



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

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    ll n;
    cin >> n;
    vi a(n);
    ll max = 1000000000000000000;
    rep(i,n) cin >> a.at(i);
    long long res = 1;
    rep(i,n) if(a.at(i) == 0) res = 0;
    if(res != 0){
        rep(i,n){
            ll tempRes = res * a.at(i);
            if(tempRes > max || tempRes/a.at(i)!=res || tempRes/res!=a.at(i)){
                res = -1;
                break;
            }
            res = tempRes;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3988
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;
#define int LL

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' && ch > '9') && (ch != '-')) ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}  

signed main() {

#ifdef LOCAL
  FILEIO("a");
#endif

  int Q; read(Q);
  while (Q--) {
    int a, b, c, d; read(a), read(b), read(c), read(d);
    int tot = a + b;
    int cnt = (a + b) / (min(a, b) + 1);
    int l = 0, r = a + b + 1, mid, ans;
    while (l <= r) {
      mid = (l + r) >> 1;
      int na = mid / (cnt + 1) * cnt + mid - mid / (cnt + 1)* (cnt + 1);
      int nb = mid / (cnt + 1);
      if (na > a || nb > b || a - na + (mid % (cnt + 1)) <= 0) r = mid - 1;
      else if ((b - nb + a - na) / (a - na + (mid % (cnt + 1) > 0 || !mid)) > cnt) r = mid - 1;
      else l = mid + 1, ans = mid;
    }
    if (ans % (cnt + 1) == 0) --ans;
    int na = ans / (cnt + 1) * cnt + ans - ans / (cnt + 1)* (cnt + 1);
    int nb = ans / (cnt + 1);
    a -= na, b -= nb;
    int pos = tot - (a + 1) * (cnt + 1) + 1;
    for (RI i = min(c, ans + 1); i <= min(d, ans); ++i)
      putchar('A' + (i % (cnt + 1) == 0));
    for (RI i = max(ans + 1, c); i <= min(d, tot); ++i)
      putchar('B' - ((i - pos) % (cnt + 1) == 0));
    puts("");
  }
  
  cerr << (double)(clock()) / CLOCKS_PER_SEC * 1000 << "ms" << endl;

  return 0;
}

// created by Daniel yuan


Measured memory_bytes: 384
N = int(input())
Ts = list(map(int, input().split()))
As = list(map(int, input().split()))

maxs = [0] * N
musts = [None] * N
prev = 0
for i in range(N):
    t = Ts[i]
    if prev < t:
        musts[i] = t
    maxs[i] = t
    prev = t

prev = 0
for i in range(N-1, -1, -1):
    a = As[i]
    if prev < a:
        if (musts[i] and musts[i] != a) or maxs[i] < a:
            print(0)
            exit()
        musts[i] = a
    maxs[i] = maxs[i] if maxs[i] < a else a
    prev = a

ans = 1
MOD = 10 ** 9 + 7
for i in range(N):
    if musts[i] is None:
        ans *= maxs[i]
        ans %= MOD
print(ans)


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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

int main(){
  char s[6];
  cin>>s;
  if(s[2]==s[3]&&s[4]==s[5]){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define pb push_back 
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int h, n;
	cin >> h >> n;
	int sumi = 0;
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		sumi += x;
	}
	if(sumi >= h)
		cout << "Yes\n";
	else cout << "No\n";

}

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

int main()
{
  int n; cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
	int t; cin >> t;
	a.push_back(t);
  }
  sort(a.begin(), a.end());
  long long res1 = 0, res2 = 0;
  if (n % 2 == 1) {
	for (int i = 0; i < n; i++) {
	  if (i <= (n - 2) / 2) {
		res1 += -2 * a[i];
	  }
	  else if (i == (n - 2) / 2 + 1) {
		res1 += a[i];
	  }
	  else if (i == (n - 2) / 2 + 2) {
		res1 += a[i];
	  }
	  else {
		res1 += 2 * a[i];
	  }
	}
	for (int i = 0; i < n; i++) {
	  if (i < (n - 2) / 2) {
		res2 += -2 * a[i];
	  }
	  else if (i == (n - 2) / 2 || i == (n - 2) / 2 + 1) {
		res2 += -1 * a[i];
	  }
	  else {
		res2 += 2 * a[i];
	  }
	}
	cout << max(res1, res2) << endl;
	return 0;
  }
  else {
	for (int i = 0; i < n; i++) {
	  if (i < (n - 2) / 2) {
		res1 += -2 * a[i];
		res2 += 2 * a[i];
	  }
	  else if (i == (n - 2) / 2 ) {
		res1 += -1 * a[i];
		res2 += -1 * a[i];
	  }
	  else if (i == (n - 2) / 2 + 1) {
		res1 += a[i];
		res2 += a[i];
	  }
	  else {
		res1 += 2 * a[i];
		res2 += -2 * a[i];
	  }
	}
	cout << max(res1, res2) << endl;
	return 0;
  }
  return 0;
}



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


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

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

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

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

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

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

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

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

// 円周率
// M_PI

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

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


signed main() {
  int n;
  cin >> n;
  int64_t a;
  bool flag = true;
  map<int64_t,int> count;
  for(int i=0;i<n;i++){
    cin >> a;
    count[a]++;
    if(count[a]>1) {
      flag = false;
    }
  }
  if(flag) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}




Measured memory_bytes: 16040
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

ll MOD = 998244353;

int main() {
    ll n, s;
    cin >> n >> s;
    vector<ll> a(n);
    rep(i, n)cin >> a[i];
    vector<vector<ll>> dp(n+1, vector<ll>(s+1, 0));
    dp[0][0] = 1;
    REP(i, n){
        rep(j, s+1){
            dp[i][j] = (dp[i][j] + (dp[i-1][j] * 2) % MOD) % MOD;
            if(j - a[i-1] >= 0){
                dp[i][j] = (dp[i][j] + dp[i-1][j-a[i-1]]) % MOD;
            }
        }
    }
    cout << dp[n][s] << endl;
}


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

int main(){
    
    // 1. 入力情報.
    char c[10];
    scanf("%s", c);
    int l = strlen(c);
    
    // 2. 判定.
    bool ok = false;
    for(int i = 0; i < l - 1; i++){
        if(c[i] == 'A' && c[i + 1] == 'C') ok = true;
    }
    
    // 3. 出力.
    if(ok) printf("%s\n", "Yes");
    else   printf("%s\n", "No");
    return 0;
    
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] a = new int[N+1];
		for( int i=1; i<=N; i++ ){
			int b = sc.nextInt();
			if( b>N ){
				a[0]++;
			}else{
				a[b]++;
			}
		}
		for( int i=1; i<=N; i++ ){
			if( a[i]>i ){
				a[0] += a[i] - i;				
			}
			if( i>a[i] ){
				a[0] += a[i];
			}
		}
		System.out.println(a[0]);
	}
}


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

long long c(int n, long long x, vector<long long> a, vector<long long> b) {
	if (x == 1) {
		if (n == 0) return 1;
		else return 0;
	}
	else if (x < a[n - 1] + 2) {
		return c(n - 1, x - 1, a, b);
	}
	else if (x == a[n - 1] + 2) {
		return b[n - 1] + 1;
	}
	else if (x < 2 * a[n - 1] + 3) {
		return b[n - 1] + c(n - 1, x - a[n - 1] - 2, a, b) + 1;
	}
	else {
		return b[n];
	}
}

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

	vector<long long> a;
	vector<long long> b;
	long long ax = 1;
	long long bx = 1;
	a.push_back(ax); 
	b.push_back(bx);
	for (int i = 0; i < N; i++) {
		ax = ax * 2 + 3;
		a.push_back(ax);
		bx = bx * 2 + 1;
		b.push_back(bx);
	}

	long long count = c(N, X, a,b);
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import math
from sys import stdin
input = stdin.readline
import numpy as np


N = int(input())
al = [chr(i) for i in range(97, 97+26)]

ans = ""

while N>0:
    N -= 1
    ans += al[N%26]
    N //= 26

print(ans[::-1])

Measured memory_bytes: 27144
def addketa(x):
    lunlun.append(x)
    if(x > 999999999):
        return 0
    strx = str(x)
    strxlast = int(strx[-1])
    if(strxlast == 0):
        addketa(int(strx+"0"))
        addketa(int(strx+"1"))
    else:
        if(strxlast == 9):
            addketa(int(strx+"8"))
            addketa(int(strx+"9"))
        else:
            addketa(int(strx+str(strxlast-1)))
            addketa(int(strx+str(strxlast)))
            addketa(int(strx+str(strxlast+1)))

            
K = int(input())
lunlun = []


for x in range (1, 10):
    addketa(x)

lunlun.sort()

print(lunlun[K-1])

Measured memory_bytes: 11320
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
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 (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;
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;
}

void solve()
{
	int n;
	cin>>n;
	vector<ll>a(n);
	ll sum=0;
	ll sq=0;
	rep(i,n){
		cin>>a[i];
		sum+=a[i];
		sum%=M;
		sq+=a[i]*a[i]%M;
		sq%=M;
	}
	sum*=sum;
	sum%=M;
	sum-=sq;
	sum*=modinv(2,M);
	sum%=M;
	while(sum<0){
		sum+=M;
	}
	cout<<sum<<endl;

}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Measured memory_bytes: 4776
/*
    Code written by Talant I.D.
*/
   
#include <bits/stdc++.h>
   
using namespace std;
   
typedef long long ll;
typedef pair <int, int> pii;
typedef tuple <int, int, int> tiii;
   
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define mod (int)1e9+7
#define eps (double)1e-9
#define all(v) v.begin(),v.end()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);
#define curMod 998244353

int main(){
		//do_not_disturb
		ll n, i, j, sum = 0;
		cin >> n;
		ll a[n];
		for(i = 0; i < n; i++){
			cin >> a[i];
		}
		for(i = 0; i < n; i++){
			for(j = i+1; j < n; j++){
				sum += a[i]*a[j];
			}
		}
		cout << sum;
    return 0;
} // What is to be written here?


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=5e5+25;
long long l,r,tott,tem[N],vol[N],n,L,sum;
struct dsa{
	long long v;
	double t;
} a[N];
int main(){
	cin>>n>>L;
	for(int i=1;i<=n;i++) scanf("%lld%lld",&tem[i],&vol[i]);
	for(int i=1;i<=n;i++){
		while(sum+vol[i]>L){//当水溢出时，优先把单调队列的前几份水排空 
	        int rea=min(sum+vol[i]-L,a[l].v);
	        a[l].v-=rea;
	        sum-=rea;
	        tott-=rea*a[l].t;
	        if(!a[l].v) l++;
		}
		sum+=vol[i];
		tott+=vol[i]*tem[i];
		a[++r].v=vol[i];
		a[r].t=tem[i];
		while(l<r&&a[r].t<a[r-1].t){//考虑混合 
			a[r-1].t=(a[r].t*a[r].v+a[r-1].t*a[r-1].v)/(a[r-1].v+a[r].v);
			a[r-1].v=a[r-1].v+a[r].v;
			r--;
		}
		printf("%.10lf\n",(double)tott/L);
	}
}

Measured memory_bytes: 26112
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;

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

void solve(){
	int n = rint, t = rint;
	X[] xs;
	foreach(i; 0 .. n) xs ~= X(rlong, rlong);
	xs.sort!"a.a<b.a"();
	
	long[][] uf = new long[][](t, n); // t分までに食べ終わる料理での満足度
	long[] vs = new long[](n); // 最後までに注文する料理での満足度
	// 料理を増やしながら様子を見る
	foreach(j, x; xs){
		foreach(i; 0 .. t){
			long u = 0;
			if(i >= x.a) u = max(u, x.b);
			if(i >= 1) u = max(u, uf[i - 1][j]);
			if(j >= 1) u = max(u, uf[i][j - 1]);
			if(i >= x.a && j >= 1) u = max(u, uf[i - x.a][j - 1] + x.b);
			uf[i][j] = u;
		}
		long v = max(uf[t - 1][j], x.b);
		if(j >= 1) v = max(v, vs[j - 1], uf[t - 1][j - 1] + x.b);
		vs[j] = v;
		log("j:", j, uf.map!(q => q[j]), vs[j]);
	}
	
	vs[n - 1].writeln;
	
}
struct X{
	long a, b;
}
	


Measured memory_bytes: 74364
#include<stdio.h>

int main(){
    int a,b;
    scanf("%d %d", &a, &b);
    if (a == b){
        printf("a == b\n");
    }
    else if (a < b){
        printf("a < b\n");
    }
    
    else {
        printf("a > b\n");
    }
    return 0;
}


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

int main()
{
	int a,b;
	cin >>a;
	cin >>b;
	if (a>b) {
		cout<<"a > b\n";
	}
	else if (a<b) {
		cout<<"a < b\n";
	}
	else {
		cout<<"a == b\n";
	}
	return 0;
}

Measured memory_bytes: 3052
using System;
namespace ForATCODER
{
    public class Program
    {
        public static void Main(string[] args)
        {
            ulong N = (ulong)s2i(Console.ReadLine());
            ulong sum = 0;
            for (ulong i = 1; i <= N; i++)
            {
                if (i % 3 != 0 && i % 5 != 0) sum += i;
            }
            Console.WriteLine(sum);

        }
        static int s2i(String s)
        {
            return Convert.ToInt32(s);
        }
        static void RESULT(int res)
        {
            Console.WriteLine(res);
        }
        static void RESULT(String res)
        {
            Console.WriteLine(res);
        }
        static String[] ReadLineAll(int count)
        {
            String[] res = new String[count];
            for (int i = 0; i < count; i++)
            {
                res[i] = Console.ReadLine();
            }
            return res;
        }

        static int[] S2Iarray(String[] src)
        {
            int len = src.Length;
            int[] res = new int[len];
            for (int i = 0; i < len; i++)
            {
                res[i] = Convert.ToInt32(src[i]);
            }
            return res;
        }
    }
}


Measured memory_bytes: 27460
#include<iostream>
#include<cstdio>
#include<cstdlib> 
#include<cstring>
using namespace std;
int read()
{
	int 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;
}
int n,a,b,MAX=-1,MIN=999999999;
int main()
{
	n=read();
	for (int i=1; i<=n; i++) {
		a=read(); b=read();
		if (a>MAX) MAX=a,MIN=b;
	}
	cout<<MAX+MIN;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n,m;
	cin>>n>>m;
	vector<string>in(n);
	rep(i,n)cin>>in[i];
	int co=0;
	rep(i,n)rep(j,m)if(in[i][j]=='#')co++;
	if(co==n+m-1)cout<<"Possible"<<endl;
	else cout<<"Impossible"<<endl;
}









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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int a, b; cin >> a >> b;
    cout << (a+b)%24 << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7724
import java.util.*;
public class Main {
	static Scanner s = new Scanner(System.in);

	static int n,a,b;
	static String v;
	public static void main(String __[]){
		input();
		solve();
	}
	private static void input() {
		n=s.nextInt();
		a=s.nextInt();
		b=s.nextInt();
		v=s.next();
	}
	private static void solve(){
		int count=0,foreigner=0;
		for(int i=0;i<n;i++) {
			switch (v.charAt(i)) {
			case 'a':
				if(count<a+b) {
					count++;
					System.out.println("Yes");
				}else {
					System.out.println("No");
				}
				break;
			case 'b':
				if(count<a+b&&++foreigner<=b) {
					count++;
					System.out.println("Yes");
				}else {
					System.out.println("No");
				}
				break;
			case 'c':
				System.out.println("No");
				break;
			}
		}
	}
}


Measured memory_bytes: 36016
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,a) loop(i,0,a)
string m,p;
int main(){
    int n;cin>>n;
    cin.ignore();
    while(n--){
        getline(cin,m);
        p.resize(m.size());
        for(int a=1;;a++){
            if(__gcd(a,26)!=1) continue;
            rep(b,26){
                char dic[256];
                rep(from,26){
                    int to=from*a+b;
                    to%=26;
                    dic[to+'a']=from+'a';
                }
                dic[' ']=' ';
                rep(i,m.size()){
                    p[i]=dic[(int)m[i]];
                }
                if(p.find("this")==(size_t)-1&&
                   p.find("that")==(size_t)-1) continue;
                cout<<p<<endl;
                goto end;
            }
        }
    end:;
    }
}

Measured memory_bytes: 1212
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    println(problem072b(s))
}

fun problem072b(s: String): String {
    return s.filterIndexed { index, c -> (index + 1) % 2 != 0 }
}

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

using namespace std;
typedef long long ll;
const ll mx = 10000007;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
#define    ss   second
#define    ff   first
#define    pb   push_back
#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
#define FIO ios_base::sync_with_stdio(false);  cin.tie(NULL);

ll e[mx], w[mx];
int main() {
    FIO;
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll cnt = 0;
    for (ll i = 0; i < n; i++) {
        if(s[i] == 'W') {
            cnt++;
        }
        w[i+1] = cnt;
    }

     cnt = 0;
    for (ll i = n - 1; i >= 0; i--) {
        if(s[i] == 'E') {
            cnt++;
        }
        e[i+1] = cnt;
    }


    ll ans = INT_MAX;
    for (ll i = 1; i <= n; i++) {
        ans = min(ans, w[i-1]+e[i+1]);
    }

    cout << ans << endl;
}


Measured memory_bytes: 8432
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <queue>

template <class T>
inline void read(T &x) {
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

typedef long long LL;

std::queue<LL> q;
int k;

int main() {
    for (int i = 1; i <= 9; ++i)    q.push(i);
    read(k);
    for (int i = 1; i < k; ++i) {
        LL a = q.front();
        int dig = a % 10;
        q.pop();
        if (dig != 0)   q.push(a * 10 + dig - 1);
        q.push(a * 10 + dig);
        if (dig != 9)   q.push(a * 10 + dig + 1);
    }
    printf("%lld\n", q.front());
    return 0;
}

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

int main() {
  double n,k;
  cin >> n >> k;
  double ans = 0;

  for (double i = 1; i <= n; i++) {
    double cnt = 1;
    double tmp = i;
    while(tmp < k) {
      tmp *= 2;
      cnt *= 2;
    }
    ans += ((1/n) * (1/cnt));
  }
  printf("%.12f\n", ans);
  return 0;
}

Measured memory_bytes: 3780
#include <iostream>
#define MOD 1000000007

using namespace std;

int N;
long long num[1001];

void solve() {
    for(int _n = 2; _n <= N; _n++) {
        int n = _n;
        for(int i = 2; i * i <= n; i++){
            while(n % i == 0){
                num[i]++;
                n /= i;
            }
        }
        if(n != 1) num[n]++;
    }
    long long sum = 1;
    for(long long i = 2; i <= N; i++){
        if(num[i]>0) sum = sum * (num[i] + 1) % MOD;
    }
    cout << sum << endl;
}

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

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


int main(){
 int n;cin >> n;
 string s;cin >> s;
 int w[n];int e[n];int sum = 0;
 rep{
     if(s.at(i)== 'W'){
         sum += 1;
     }
     w[i] = sum;
 }
 sum = 0;
 for(int i = n-1;i>=0;i--){
     if(s.at(i)=='E'){
         sum += 1;
     }
     e[i] = sum;
 }
 int ans = n;
 rep{
     if(i==0){
         ans = min(ans,e[1]);
     }else if(i==n-1){
         ans = min(ans, w[n-2]);
     }else{
         ans = min(ans, w[i-1]+e[i+1]);
     }
 }
 cout << ans << endl;
} 

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  int m, n;
  cin >> n;

  map<string, int> s;
  for (int i = 0; i < n; i++)
  {
    string a;
    cin >> a;

    if (s.find(a) == s.end())
    {
      s[a] = 1;
    }
    else
    {
      s[a]++;
    }
  }

  cin >> m;
  for (int i = 0; i < m; i++)
  {
    string b;
    cin >> b;

    if (s.find(b) == s.end())
    {
      s[b] = -1;
    }
    else
    {
      s[b]--;
    }
  }

  int res = 0;
  for (auto iter = s.begin(); iter != s.end(); iter++)
  {
    if (res < iter->second)
    {
      res = iter->second;
    }
  }

  cout << res << endl;
}

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

const int maxn=1e3+10;
int a,b,c;

int main(){
	cin>>a>>b>>c;
	if(a==b)
		printf("%d\n",c);
	else if(a==c)
		printf("%d\n",b);
	else
		printf("%d\n",a);
	return 0;
}

Measured memory_bytes: 764
#include <stdio.h>

int main(void) {
  double v, y, t;
  int n, i;

  while (scanf("%lf", &v) != EOF) {
    i = 1;
    t = v / 9.8;
    y = 4.9 * t * t;

    while (1) {
      if (5 * i - 5 >= y) break;
      i++;
    }
    n = i;
    printf("%d\n", n);
  }
  return 0;
}

Measured memory_bytes: 624
#include <iostream>
#include <queue>
#include <utility>
using namespace std;
using P = pair<int, int>;

int main(void){
    const int INF = (int)1e8;
    int H, W; cin >> H >> W;
    char s[51][51];
    int d[51][51];
    int white = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            d[i][j] = INF;
            cin >> s[i][j];
            if(s[i][j] == '.') white++;
        }
    }

    queue<P> que;
    que.push(P(0, 0));
    d[0][0] = 0;
    int dx[4] = {1, -1, 0, 0};
    int dy[4] = {0, 0, 1, -1};

    while(not que.empty()){
        P p = que.front(); que.pop();
        int y = p.first, x = p.second;
        if(y==H-1 and x==W-1) break;

        for(int i = 0; i < 4; i++){
            int ny = y + dy[i], nx = x + dx[i];
            if(0<=ny and ny<H and 0<=nx and nx<W and s[ny][nx]=='.' and d[ny][nx]==INF){
                d[ny][nx] = d[y][x] + 1;
                que.push(P(ny, nx));
            }
        }
    }

    int res;
    if(d[H-1][W-1] == INF) res = -1;
    else res = white - d[H-1][W-1] - 1;

    cout << res << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    ll n, m, k; cin >> n >> m >> k;
    vector<ll> a(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
    }

    vector<ll> b(m);
    ll bs = 0;
    for (ll i = 0; i < m; ++i) {
        cin >> b[i];
        bs += b[i];
    }

    ll ans = 0;
    ll j = m;
    ll sum = 0;
    for (ll i = 0; i <= n; ++i) {
        ll cnt = i;
        if (i > 0) {
            sum += a[i - 1];
        }

        while (j >= 0) {
            if (sum + bs <= k) {
                ans = max(ans, cnt + j);
                break;
            }

            j--;
            bs -= b[j];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 6392
N = int(input())
S = []
for _ in range(N):
    S.append(input())
    
print("AC x " + str(S.count("AC")))
print("WA x " + str(S.count("WA")))
print("TLE x " + str(S.count("TLE")))
print("RE x " + str(S.count("RE")))

Measured memory_bytes: 16284