akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
    int N;
    int ans = 1<<30;
    string S;
    cin>>N>>S;

    vector<int> white(N+1,0);
    vector<int> black(N+1,0);

    for(int i=0; i<N; ++i) {
        white[i+1] = white[i] + (S[i] == '.' ? 1 : 0);
        black[i+1] = black[i] + (S[i] == '#' ? 1 : 0);
    }


    for(int i=0; i<=N; i++){
        int b = black[i] - black[0];
        int w = white[N] - white[i];

        ans = min(b+w,ans);
    }    

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 5180
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
int main() 
{ 
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
ll n;
cin>>n;
    char ch = 'a';
    char arr[27];
    for(int i=1;i<=26;i++){
      arr[i] = ch;
      ch++;
    }
   // ll n = j;
    string str;
while(n >= 1){
  ll x = n%26;
  if(x==0) x=26;
  str.push_back(arr[x]);
  n = n / 26;
  if(x==26) n--;
}
reverse(str.begin(),str.end());
cout<<str<<"\n";
	return 0; 
}
 

Measured memory_bytes: 3644
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int dp[10005];
vector<ll> primes;
void fill_prime(int n){
    primes.push_back(2);
    for(int i=3;i<=n;i++){
        bool flag = true;
        for(auto x: primes) if(i%x==0){flag = false; break;}
        if(flag) primes.push_back(i);
    }
}

int main(){
    fill_prime(100000);
    COMinit();

    int n,m; cin >> n >> m;
    vector<int> pn;
    for(auto x: primes) {
        if(m%x==0){
            pn.push_back(0);
            int id = pn.size()-1;
            while(m%x==0){m /= x; pn[id]++;}
        }
    }
    if(m>1) pn.push_back(1);
    sort(all(pn));
  //  for(auto x: pn) cout << x << endl;

    ll ans = 1;
    for(auto x: pn) ans = (ans * COM(x+n-1, x)) %MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12544
#include<stdio.h>
int main(void)
{
	int n,d;
	int i;
	int temp, co = 0;

	scanf("%d %d",&n,&d);
	while (n > 0) {
		temp = d + 1;
		temp = temp + d;
		n -= temp;
		co++;
	}
	printf("%d\n", co);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define N 100005
#define mod 1000000007
using namespace std;
typedef long long LL;
inline LL read()
{
	char c=getchar(); LL num=0,f=1;
	while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
	while (c<='9'&&c>='0') { num=num*10+c-'0'; c=getchar(); }
	return num*f;
}
LL n,A,B,s[N],f[N],g[N],ans;
int main()
{
	n=read(); A=read(); B=read(); if (A>B) swap(A,B);
	for (int i=1;i<=n;i++) s[i]=read();	
	for (int i=3;i<=n;i++) if (s[i]-s[i-2]<A) { printf("0"); return 0; }
	f[0]=g[0]=1; int l=0,r=0;
	for (int i=1;i<=n;i++)
	{
		while (r<i-1&&s[i]-s[r+1]>=B) r++;
		if (l<=r) f[i]=(g[r]-(l?g[l-1]:0)+mod)%mod;
		g[i]=(g[i-1]+f[i])%mod;
		if (i>1&&s[i]-s[i-1]<A) l=i-1;
	}
	for (int i=n;i>=0;i--)
	{
		ans=(ans+f[i])%mod;
		if (i<n&&s[i+1]-s[i]<A) break;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
#include<string.h>


int main(void){
char N[10];
int accounter=0;
int wacounter=0;
int tlecounter=0;
int recounter=0;
int n;
scanf("%d", &n);
for(int i=0;i<n;i++){
  scanf("%s",N);
if(strcmp(N,"AC")==0){
accounter++;
}else if(strcmp(N,"WA")==0){
wacounter++;
}else if(strcmp(N,"TLE")==0){
tlecounter++;
}else if(strcmp(N,"RE")==0){
recounter++;
}
}
printf("AC x %d\n", accounter);
printf("WA x %d\n", wacounter);
printf("TLE x %d\n", tlecounter);
printf("RE x %d\n", recounter);
return 0;
}

Measured memory_bytes: 1732
#Editorial
from math import floor,sqrt
Q = int(input())
for _ in range(Q):
    A,B = map(int,input().split())
    if A > B:
        A,B = B,A
    if A == B:
        print(2*A-2)
        continue
    if A+1 == B:
        print(2*A-2)
        continue
    C = floor(sqrt(A*B))
    if C == sqrt(A*B):
        C -= 1
    if C*(C+1) >= A*B:
        print(2*C-2)
    else:
        print(2*C-1)


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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  LL X;
  cin>> X;
  LL num = 100;
  REP(i,10000){
    num = num + num / 100;
    if(num>=X){
      cout << i + 1 << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string o = sc.Next();
        string e = sc.Next();

        string answer = "";
        for (int i = 0; i < o.Length; i++)
        {
            answer += o[i].ToString();
            if (i < e.Length)
            {
                answer += e[i].ToString();
            }
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

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

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

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

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 N,M;
    cin >> N >> M;

    vector<vector<i64>> tree(N);
    rep(i,0,N-1){
        i64 x,y;
        cin >> x >> y;
        --x;
        --y;
        tree[x].emplace_back(y);
        tree[y].emplace_back(x);
    }

    const i64 maxn=100000;

    static i64 memo1[maxn];
    fill_n((i64*)memo1,maxn,0);

    function<i64(i64,i64)> rec1=[&](i64 u,i64 p){
        auto& res=memo1[u];
        res=1;
        for(auto v:tree[u]){
            if(v==p) continue;
            res*=(rec1(v,u)+1)%M;
            res%=M;
        }
        return res;
    };

    rec1(0,-1);

    static i64 memo2[maxn];
    fill_n((i64*)memo2,maxn,0);

    function<void(i64,i64,i64)> rec2=[&](i64 u,i64 p,i64 up){
        memo2[u]=(1+up)%M*memo1[u]%M;

        vector<i64> l(tree[u].size()),r(tree[u].size());
        rep(i,0,tree[u].size()){
            i64 v=tree[u][i];
            if(i==0) l[0]=(v==p)?(up+1)%M:((1+memo1[v])%M);
            else l[i]=((v==p)?(up+1)%M:((1+memo1[v])%M))*l[i-1]%M;
        }
        for(i64 i=int(tree[u].size())-1; i>=0; --i){
            i64 v=tree[u][i];
            if(i==int(tree[u].size())-1) r[int(tree[u].size())-1]=(v==p)?(up+1)%M:((1+memo1[v])%M);
            else r[i]=((v==p)?(up+1)%M:((1+memo1[v])%M))*r[i+1]%M;
        }

        rep(i,0,tree[u].size()){
            i64 v=tree[u][i];
            if(v==p) continue;

            i64 tmp=1;
            if(i-1>=0){
                tmp*=l[i-1];
                tmp%=M;
            }
            if(i+1<tree[u].size()){
                tmp*=r[i+1];
                tmp%=M;
            }

            rec2(v,u,tmp);
        }
    };

    rec2(0,-1,0);

    rep(i,0,N) cout << memo2[i] << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 22016
k = int(input())

def digit_sum(s):
    return sum(map(int, list(s)))

def func1(s):
    return int(s)/digit_sum(s)

def func2(n):
    n = str(n)
    fm, fa = float("inf"), -1
    for i in range(len(n)):
        s = n[:i+1] + "9"*(len(n)-i-1)
        if fm > func1(s):
            fm = func1(s)
            fa = int(s)
    return fa

n = 1
for _ in range(k):
    print(n)
    n = func2(n+1)




Measured memory_bytes: 3188
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int K,N;
    cin>>K>>N;
    vi v;
    F0R(x,N)
    {
		int nb;
		cin>>nb;
		v.pb(nb);	
    }
    sort(all(v));
    int mn=INT_MAX;
    FOR(x,1,N-1)
    {
    	int val=min(K-(v[x]-v[x-1]),K-(v[x+1]-v[x]));
    	mn=min(mn,val);
    }
    mn=min(mn,v[N-1]-v[0]);
	cout<<mn<<endl;
	return 0;
}
 


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, A, B;
    cin >> N >> A >> B;

    if (N*A >= B) {
        cout << B << endl;
    } else {
        cout << N*A << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000
typedef long long ll;
int main(){
    
    ll n, x; cin >> n >> x;
    vector<vector<ll> > dp(n, vector<ll> (n, INF));
    //dp[i][j] := 魔法をi回(0 <= i <= N-1)使った時の、スライムj(0 <= j <= N-1)を買うのにかかる最短時間
    vector<ll> a(n);
    ll ans = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        ans += a[i];
    }

    //dp初期条件
    for(int j = 0; j < n; j++){
        dp[0][j] = a[j];
    }

    //dp
    for(int i = 1; i < n; i++){
        ll temp = 0;
        for(int j = 0; j < n; j++){
            int index = j - i;
            if(index < 0){
                index += n;
            }
            dp[i][j] = min(dp[i - 1][j], a[index]);
            temp += dp[i][j];
        }
        ans = min(ans, i * x + temp);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 31616
///بِسْمِ الّٰلهِ الرَّحْمٰنِ الرَحِيْمِ
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi acos(-1.0)
int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
     ll int i,n,t,j=0,p,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d;
     string s,sm;
     cin>>s;
     cin>>sm;
     sm.erase(sm.size()-1,1);
     if(sm==s){
        cout<<"Yes"<<endl;
     }
     else{
        cout<<"No"<<endl;
     }


     return EXIT_SUCCESS;
}



Measured memory_bytes: 3608
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
using ll = long long;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

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

//動的計画法で役に立つ関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//最大公約数と最小公倍数
ll gcd(ll a, ll b) {
    if(b==0)return a;
    return gcd(b, a%b);
}

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

vector<vector<long long> > comb(int n) {
  vector<vector<long long> > v(n + 1,vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int a,b;cin>>a>>b;
    if ((a+b)%2!=0) cout<<"IMPOSSIBLE"<<endl;
    else cout<<(a+b)/2<<endl;
  
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <math.h>
using namespace std;
typedef long long ll;


int main() {
  int n, xmin=0, ymin=0, xmax=0, ymax=0;

  cin >> xmax >> ymax >> n;

  vector<vector<int>> vv(n,vector<int>(3));

  for(int i=0; i<n; i++) cin >> vv.at(i).at(0) >> vv.at(i).at(1)>> vv.at(i).at(2);

  for(int i=0; i<n; i++)
  {
    switch (vv.at(i).at(2))
    {
    case 1:
      (xmin < vv.at(i).at(0)) && (xmin = min(vv.at(i).at(0), xmax));
      break;
    case 2:
      (xmax > vv.at(i).at(0)) && (xmax = max(vv.at(i).at(0), xmin));
      break;
    case 3:
      (ymin < vv.at(i).at(1)) && (ymin = min(vv.at(i).at(1), ymax));
      break;
    case 4:
      (ymax > vv.at(i).at(1)) && (ymax = max(vv.at(i).at(1), ymin));
      break;
    }
  }

  cout << (xmax-xmin)*(ymax-ymin) << endl;
}

Measured memory_bytes: 256
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

typedef pair<int, int> pint;
typedef long long ll;

int main()
{
    int N;
    cin >> N;
    int data[100001] = {};
    rep(i, N)
    {
        int tmp;
        cin >> tmp;
        data[tmp]++;
    }

    int ans = 0;

    ans = max(ans, data[0] + data[1]);
    ans = max(ans, data[100000] + data[100000 - 1]);
    for (int i = 1; i < 100000; i++)
    {
        int tmp_ans = 0;
        tmp_ans += data[i];
        tmp_ans += data[i - 1];
        tmp_ans += data[i + 1];
        ans = max(ans, tmp_ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cstdlib>
using namespace std;
const int N=2e5+10;
char s[N];
int main()
{
    int a,b,c,d,n,i;
    scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
    scanf("%s",s+1);
    if(a>b)
    {
        swap(a,b);
        swap(c,d);
    }
    for(i=a;i<=max(c,d);i++)
        if(s[i]=='#'&&s[i+1]=='#')
        {
            printf("No");
            return 0;
        }
    if(c<a||d<b)
    {
        printf("No");
        return 0;
    }
        if(d>c)
        {
            printf("Yes");
            return 0;
        }
        for(i=b;i<=d;i++)
            if(i+1<=n&&s[i-1]=='.'&&s[i+1]=='.'&&s[i]=='.')
            {
               // printf("%d\n",i);
                printf("Yes");
                return 0;
            }
        printf("No");
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<ll> vc;
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)

int main() {
    // your code goes here
    char c[10];
    cin >> c;
    if(c[2]==c[3]&&c[4]==c[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

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

int main() {
	int width;
	int height;
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;;
	width = tx - sx;
	height = ty - sy;
	string ans;
	int i;
	rep(i, height)ans += 'U';
	rep(i, width)ans += 'R';

	rep(i, height)ans += 'D';
	rep(i, width)ans += 'L';

	ans += 'L';
	rep(i, height + 1)ans += 'U';
	rep(i, width + 1)ans += 'R';
	ans += 'D';

	ans += 'R';
	rep(i, height + 1)ans += 'D';
	rep(i, width + 1)ans += 'L';
	ans += 'U';
	
	cout << ans;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n,cnt=0,maxi=0; cin>>n;
    vector<ll> h(n+1);
    h[0]=0;
    repi(i,1,n+1){
        cin>>h[i];
        if(h[i-1]>=h[i]) cnt++;
        else{
            maxi=max(maxi,cnt);
            cnt=0;
        }
    }
    maxi=max(maxi,cnt);
    cout<<maxi;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 100005

ll n;
string s;

int main()
{
    _FastIO;
    cin >> n;
    set<string> ms;
    map<string , ll> m;
    set<string>::iterator it;
    for(ll i = 0; i < n; i++){
        cin >> s;
        sort(s.begin() , s.end());
        ms.insert(s);
        m[s]++;
    }
        ll ans = 0;
    for(it = ms.begin(); it != ms.end(); it++){
        ll k = m[*it];
        if(k > 1){
          ll sum = (k * (k - 1)) / 2;
          ans += sum;
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    int count = 0;
    string s;
    for (int i = 1; i <= n; ++i) {
        s = to_string(i);
        if (s.size() % 2 == 1) {
            count++;
        }
    }
    cout << count << endl;
}


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

using ll = long long int;

ll a, b, c, k;

ll ans;

int main(void){
  // Here your code !
  scanf("%lld %lld %lld %lld", &a, &b, &c, &k);

  if (k % 2 == 0) ans = a - b;
  else ans = b - a;

  if (abs(ans) > 1e18) printf("Unfair\n");
  else  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
  int max = 0;
  char s[20];
  scanf("%s",&s);
  for(int i = 0;i < strlen(s);i++){
    int j = 0;
    while(j < strlen(s) && (s[i + j] == 'A' || s[i + j] == 'T' || s[i + j] == 'C' || s[i + j] == 'G')){
      j++;
    }
    if(max < j){
      max = j;
    }
  }
  //if(max < 2)max = 0;
  printf("%d",max);
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;

template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void getint(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}
static const long long MOD_NUM = 1000000007LL;

static void A_task();

int main()
{
	A_task();
	fflush(stdout);
	return 0;
}

static void A_task()
{
	char strA[11] = { 0 }, strB[11] = { 0 }, strU[11] = { 0 };
	int A, B;

	getstring(strA);
	getstring(strB);
	getint(A, B);

	getstring(strU);

	if (strcmp(strA, strU) == 0) {
		A--;
	}
	else {
		B--;
	}
	printf("%d %d\n", A, B);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>

#define MOD (1000000007)

int main()
{
	int N, M;
	std::vector<int> A;
	
	std::cin >> N >> M;
	for (int i = 0; i < M; ++i) {
		int a;
		std::cin >> a;
		if (A.empty()) {
			A.push_back(a);
		} else {
			auto prev = A.back();
			if (prev == a)
				continue;
			if (prev == a-1) {
				std::cout << "0\n";
				return 0;
			}
			A.push_back(a);
		}
	}

	int j = 0;
	int x_i = 1;
	int x_i1 = 0;
	for (int i = 1; i <= N; ++i) {
		if (j < M && A[j] == i) {
			x_i1 = x_i;
			x_i = 0;
			++j;
		} else {
			int next = (x_i1 + x_i) % MOD;
			x_i1 = x_i;
			x_i = next;
		}
	}
	
	std::cout << x_i << "\n";
}


Measured memory_bytes: 640
def solve():
    [N, T] = [int(x) for x in input().split()]
    ts = [int(x) for x in input().split()]

    return sum([
        min(T, t2-t1) for t2, t1 in zip(ts[1:], ts[:-1])
    ]) + T


def main():
    print(solve())


if __name__ == '__main__':
    main()

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

int main(void){
    int N; cin >> N;
    if (N == 3) {
        cout << "2 5 63" << endl;
        return 0;
    }
    
    vector<int> A;
    vector<int> B;
    vector<int> C;
    for (int i = 2; i <= 30000; i++) {
        if (i % 6 == 0) C.push_back(i);
        else if (i % 2 == 0) A.push_back(i);
        else if (i % 3 == 0) B.push_back(i);
    }
    
    vector<int> ans;
    ans.push_back(2);
    ans.push_back(4);
    ans.push_back(3);
    ans.push_back(9);
    N -= 4;
    for (int i = 3; i < A.size() && 2 <= N; i += 2) {
        ans.push_back(A[i]);
        ans.push_back(A[i-1]);
        N -= 2;
    }
    for (int i = 3; i < B.size() && 2 <= N; i += 2) {
        ans.push_back(B[i]);
        ans.push_back(B[i-1]);
        N -= 2;
    }
    for (int i = 0; i < C.size() && 0 < N; i++) {
        ans.push_back(C[i]);
        N--;
    }
    for (auto i : ans) {
        cout << i << " ";
    }
    cout << endl;
}


Measured memory_bytes: 640
// https://atcoder.jp/contests/agc012/tasks/agc012_a
/*

N team, mỗi team 3 người

vd :
2
5 2 8 5 1 5

1 2 5 5 5 8

team 1 : 5 5 1
=> 5
team 2 : 2 8 5
=> 5

=> total : 10

chọn 2 thằng mạnh nhất và 1 thằng yếu nhất
lý do : vì thằng mạnh nhất sẽ bị lỏ đi, mình sẽ lấy đc thằng mạnh nhì, còn lý do lấy thằng yếu nhất là để chừa là các thằng mạnh cho các team còn lại khác


mình chỉ quan tâm 2/3 số lượng phần tử cuối
và trong 2/3 này, mình lấy thằng mạnh thứ 2 => tức nhảy theo += 2
*/

#include <iostream>
#include <algorithm>

using namespace std;

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

	int strengths[3*N+1];
	for(int i = 1; i <= 3*N; i++)
	{
		cin >> strengths[i];
	}

	sort(strengths+1, strengths+3*N+1);

	long long ans = 0;
	for(int i = N+1 ; i <= 3*N; i+= 2)
	{
		ans += strengths[i];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1408
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(declaim (ftype (function * (values fixnum &optional)) read-fixnum))
(defun read-fixnum (&optional (in *standard-input*))
  (declare #.OPT)
  (macrolet ((%read-byte ()
               `(the (unsigned-byte 8)
                     #+swank (char-code (read-char in nil #\Nul))
                     #-swank (sb-impl::ansi-stream-read-byte in nil #.(char-code #\Nul) nil))))
    (let* ((minus nil)
           (result (loop (let ((byte (%read-byte)))
                           (cond ((<= 48 byte 57)
                                  (return (- byte 48)))
                                 ((zerop byte) ; #\Nul
                                  ;; (return-from read-fixnum 0)
                                  (error "Read EOF or #\Nul."))
                                 ((= byte #.(char-code #\-))
                                  (setf minus t)))))))
      (declare ((integer 0 #.most-positive-fixnum) result))
      (loop
        (let* ((byte (%read-byte)))
          (if (<= 48 byte 57)
              (setq result (+ (- byte 48) (the fixnum (* result 10))))
              (return (if minus (- result) result))))))))

(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (as (make-array n :element-type 'int32))
         (num-neg 0)
         (least-abs #xffffffff))
    (declare (uint32 n num-neg least-abs))
    (dotimes (i n)
      (let ((a (read-fixnum)))
        (when (< a 0)
          (incf num-neg))
        (setf least-abs (min least-abs (abs a)))
        (setf (aref as i) a)))
    (println
     (if (evenp num-neg)
         (reduce #'+ as :key #'abs)
         (- (reduce #'+
                    (delete least-abs as :key #'abs :count 1)
                    :key #'abs)
            least-abs)))))

#-swank(main)


Measured memory_bytes: 20708
#include<stdio.h>
void func(int,int,int,int );
int main(void)
{
	int i,j,k,flg,n,m,x,y,z,mm,nn,nm;
	scanf("%lld %lld",&n,&m);
	flg=1;
	m=m/1000; 
	for(i=0;i<=n;i++){
		if(m-10*i>=0){
			mm=m-10*i; nn=n-i;
			if(5*nn-mm>=0){
				nm=5*nn-mm;
				if(nm%4==0 && nn-(nm/4)>=0){
						flg=0; x=i; z=nm/4; y=nn-z;
				}
			}
		}
	}
	if(flg==0) printf("%lld %lld %lld\n",x,y,z);
	else printf("-1 -1 -1\n");
	return 0;
}

Measured memory_bytes: 128
n = int(input())
nums = list(map(int, input().split()))
ans = []

for _ in range(n):
  ans.append(-1)

for i in range(1, n + 1)[::-1]:
  C = i*2
  BALL = nums[i-1]
  while C <= n:
    BALL = BALL ^ ans[C-1]
    C += i
  ans[i-1] = BALL 

print(ans.count(1))
ans2 = []
for i in range(n):
  if ans[i] == 1:
    ans2.append(i+1)

L=[str(a) for a in ans2]
L=" ".join(L)
print(L)


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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

#define N 200016

pii p[N];

int main()
{
    canhazfast();

    int n;
    ll s = 0;

    cin >> n;
    for (int i = 0; i < n; ++i) cin >> p[i].sec >> p[i].fir;
    sort(p, p+n);
    for (int i = 0; i < n; ++i) {
        s += p[i].sec;
        retif(s > p[i].fir) cout << "No\n", 0;
    }
    cout << "Yes\n";

    return 0;
}


Measured memory_bytes: 1792
// Package main provides
//
// File:  c.go
// Author: ymiyamoto
//
// Created on Mon Jan  7 00:29:36 2019
//
package main

import "fmt"

func main() {
	var S, T string
	fmt.Scan(&S, &T)

	indexT := -1
	for i := len(S) - len(T); i >= 0; i-- {
		invalid := false
		for j := range T {
			if S[i+j] != T[j] && S[i+j] != '?' {
				invalid = true
			}
		}
		if invalid {
			continue
		}
		indexT = i
		break
	}

	if indexT == -1 {
		fmt.Println("UNRESTORABLE")
		return
	}

	for i := range S {
		if (i < indexT) || (i >= indexT+len(T)) {
			if S[i] == '?' {
				fmt.Print("a")
			} else {
				fmt.Print(string(S[i]))
			}
		} else {
			fmt.Print(string(T[i-indexT]))
		}
	}

	fmt.Println()
}


Measured memory_bytes: 512
#include "iostream"
using namespace std;

int main(){
  
  int N, M;
  int L, R;
  int Lmax=0;
  int Rmin=1000000;
  
  cin >> N >> M;
  
  for(int i=1;i<=M;i++){
  	cin >> L >> R;

    if(L > Lmax) Lmax = L;
    if(R < Rmin) Rmin = R;
    
  }
  
  if(Rmin-Lmax>=0){
  	cout << Rmin-Lmax + 1 ;
  }else{
   	cout << 0; 
  }
  
  return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    string s, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;
    if( u == s ) cout << a - 1 << " " << b;
    else cout << a << " " << b - 1;
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#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 if (a == b) {
     printf("a == b\n") ;
    }
return 0 ;
}

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

using namespace std;

typedef long long ll;

const ll INF = (ll) 1e18 + 100;

ll prod(ll x, ll y) {
  if (x == 0 || y == 0) return 0;
  if (x == INF || y == INF) return INF;
  ll p = x * y;
  if (p / x == y && p % x == 0 && p <= INF) return p;
  return INF;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll x, k, d;
  cin >> x >> k >> d;
  x = abs(x);
  if (x - prod(k, d) >= 0) {
    cout << x - prod(k, d) << "\n";
  } else {
    ll s = (x - x % d) / d;
    s = k - s;
    if (s % 2 == 0) cout << x % d << "\n"; else cout << abs(x % d - d) << "\n";
  }
  return 0;
}


Measured memory_bytes: 3660
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iterator>
#include <cstring>

using namespace std;
const int INF = (1<<30);
const int NEGA=-INF; 
typedef pair<int, int> P;
typedef long long ll;
#define PB push_back
#define rep(i, a) for (int i = 0; i < a; i++)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define mp make_pair
#define INT int_64

ll ans = 0;
int a;
int main() 
{
    int n;
    cin>>n;
    while(ans*ans<=n){
      ans++;
    }
    cout<<(ans-1)*(ans-1)<<endl;
	return 0;
}


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

int main(){
  int n; cin >> n;
  int al[26], temp[26];
  for(int i=0; i<26; i++){
    al[i] = 100;
    temp[i] = 0;
  }

  string s;
  for(int i=0; i<n; i++){
    cin >> s;
    for(int j=0; j<s.length(); j++){
      temp[s[j]-'a']++;
    }
    for(int j=0; j<26; j++){
      al[j] = min(al[j], temp[j]);
      temp[j]=0;
    }
  }

  for(int i=0; i<26; i++){
    if(al[i]){
      for(int j=0; j<al[i]; j++) cout << (char)(i+'a');
    }
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
 
using namespace std;
 
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
#define MAX 100010
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 //   freopen("input.txt","r",stdin);
 //  freopen("output.txt","w",stdout);
    
    string s;
    cin>>s;
    long long int ans = 0;
    bool one = true;
    int n =s.size();
    for(int i=0;i<n;i++)
    {
        if(one)
        {
            if(s[i]!='1')
                ans++;
        }
        else
        {
            if(s[i]!='0')
                ans++;
        }
        one = !one;
    }
    one = true;
    long long int temp =0 ;
    for(int i=0;i<n;i++)
    {
        if(one)
        {
            if(s[i]!='0')
                temp++;
        }
        else
        {
            if(s[i]!='1')
                temp++;
        }
        one = !one;
    }
    cout<<min(temp,ans);
    return 0;
}

Measured memory_bytes: 512
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	String[] ss;

	void run(){
		ss=new String[3];
		for(;;){
			ss[0]=sc.next();
			if(ss[0].equals("0")){
				break;
			}
			ss[1]=sc.next();
			ss[2]=sc.next();
			solve();
		}
	}

	void solve(){
		for(int j=0; j<3; j++){
			int a=0, b=0;
			for(int i=0; i<ss[j].length()-1; i++){
				if(ss[j].charAt(i+1)=='A'){
					a++;
				}else{
					b++;
				}
			}
			if((a+1==11&&b<=9)||(a+1>=12&&a+1==b+2)){
				a++;
			}else{
				b++;
			}
			println(a+" "+b);
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
#!/usr/bin/env ruby
n, m = gets.chomp.split.map(&:to_i)
h = [0] + gets.chomp.split.map(&:to_i)
ans = Array.new(n + 1, 0)

m.times do
  a, b = gets.chomp.split.map(&:to_i)

  if h[a] > h[b]
    ans[b] = -1
  elsif h[a] < h[b]
    ans[a] = -1
  else
    ans[a] = -1
    ans[b] = -1
  end
end

ans = ans.filter { |i| i != -1 }.length - 1

puts ans


Measured memory_bytes: 24256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Linq.Enumerable;
using static System.Math;

class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        var X = ReadLine().Split(' ').Select(int.Parse).ToArray();

        var sortedX = X.OrderBy(x => x).ToArray();
        var medL = sortedX[N / 2];
        var medS = sortedX[N / 2 - 1];

        foreach (var x in X)
        {
            if(x <= medS)
                WriteLine(medL);
            else
                WriteLine(medS);
        }
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


Measured memory_bytes: 55620
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

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

    int s = 1;
    for (int i = 0; i < N; i++) {
        if (!i) {
            s *= K;
        }
        else {
            s *= (K - 1);
        }
    }

    cout << s << endl;
}

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

int main()
{
    int h,w;cin>>h>>w;
    string s[h + 2];
    s[0] = string(w+2, '.');
    s[h+1] = string(w+2, '.');
    for(int i = 1; i <= h; i++) {
        cin >> s[i];
        s[i] = '.' + s[i] + '.';
    }
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(s[i][j] == '#') cout << '#';
            else {
                int cnt = 0;
                if(s[i - 1][j - 1] == '#') cnt++;
                if(s[i - 1][j] == '#') cnt++;
                if(s[i - 1][j + 1] == '#') cnt++;
                if(s[i][j - 1] == '#') cnt++;
                if(s[i][j + 1] == '#') cnt++;
                if(s[i + 1][j - 1] == '#') cnt++;
                if(s[i + 1][j] == '#') cnt++;
                if(s[i + 1][j + 1] == '#') cnt++;
                cout << cnt;
            }
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
//Author : Ayush Jain

#include <bits/stdc++.h>
using namespace std;

#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
const int N=1e5 + 5;
const int M=1e5 + 5;

ull pw[67];
void pre()
{
	pw[0]=1;
	for(int i=1;i<64;i++) pw[i]=2*pw[i-1];
}

int main()
{
	ios_base::sync_with_stdio(false);
	pre();
	int m;
	cin>>m;
	cout<<24+(24-m)<<endl;	
	
		
	return 0;
}

Measured memory_bytes: 256
H,W,K=map(int, input().split())
C=list(input()for _ in range(H))
ans=0
import itertools
tf=("Yes", "No")
l=list(itertools.product(tf, repeat=(H+W)))
black=0
for i in range(2**(H+W)):
  for j in range(H):
    for k in range(W):
      if l[i][j]=="No"and l[i][H+k]=="No"and C[j][k]=="#":
        black+=1
  if black==K:
    ans+=1
  black=0
print(ans)


Measured memory_bytes: 9316
goal = ((1, 2, 3), (4, 5, 6), (7, 8, 0))

parents = {}
total = {}
flag = True

initial = []
position = []
for i in range(3):
	a, b, c = map(int, input().split())
	if a == 0:
		position.extend([i, 0])
	elif b == 0:
		position.extend([i, 1])
	elif c == 0:
 		position.extend([i, 2])
	initial.append( (a, b, c) )

parents[tuple(initial)] = position
total[tuple(initial)] = 1

count = 0

if tuple(initial) == goal:
	flag = False

while flag:
	count += 1
	children = {}
	for par_key in parents.keys():
		position = parents[par_key]

		if position[0] < 2:
			child = [list(par_key[0]), list(par_key[1]), list(par_key[2])]
			child[position[0]][position[1]] = child[position[0]+1][position[1]]
			child[position[0]+1][position[1]] = 0
			child_tuple = (tuple(child[0]), tuple(child[1]), tuple(child[2]))
			if child_tuple == goal:
				flag = False
				break
			elif child_tuple not in total:
				children[child_tuple] = [position[0]+1, position[1]]
				total[child_tuple] = 1

		if position[0] > 0:
			child = [list(par_key[0]), list(par_key[1]), list(par_key[2])]
			child[position[0]][position[1]] = child[position[0]-1][position[1]]
			child[position[0]-1][position[1]] = 0
			child_tuple = (tuple(child[0]), tuple(child[1]), tuple(child[2]))
			if child_tuple == goal:
				flag = False
				break
			elif child_tuple not in total:
				children[child_tuple] = [position[0]-1, position[1]]
				total[child_tuple] = 1

		if position[1] < 2:
			child = [list(par_key[0]), list(par_key[1]), list(par_key[2])]
			child[position[0]][position[1]] = child[position[0]][position[1]+1]
			child[position[0]][position[1]+1] = 0
			child_tuple = (tuple(child[0]), tuple(child[1]), tuple(child[2]))
			if child_tuple == goal:
				flag = False
				break
			elif child_tuple not in total:
				children[child_tuple] = [position[0], position[1]+1]
				total[child_tuple] = 1

		if position[1] > 0:
			child = [list(par_key[0]), list(par_key[1]), list(par_key[2])]
			child[position[0]][position[1]] = child[position[0]][position[1]-1]
			child[position[0]][position[1]-1] = 0
			child_tuple = (tuple(child[0]), tuple(child[1]), tuple(child[2]))
			if child_tuple == goal:
				flag = False
				break
			elif child_tuple not in total:
				children[child_tuple] = [position[0], position[1]-1]
				total[child_tuple] = 1

	parents = children

print(count)


Measured memory_bytes: 75604
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

class UNION_FIND{
public:
	vector<int> a;
	UNION_FIND(int n){
		a.clear();
		a.resize(n, -1);
	}

	~UNION_FIND(){
		a.clear();
	}

	int find(int x){
		if (a[x] < 0){
			return x;
		}else{
			return (a[x] = find(a[x]));
		} // end if
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if (x != y){
			if (a[x] > a[y]) swap(x,y);
			a[x] += a[y];
			a[y] = x;
		} // end if
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}

	int size(int x){
		return -a[find(x)];
	} // end if
};

const int MAX_M = (int)1e5 + 5;
int A[MAX_M], B[MAX_M];

int main()
{
	memset(A, 0, sizeof(A));
	memset(B, 0, sizeof(B));
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll N, M; cin >> N >> M;
	rep (i, M){
		int in_a, in_b; cin >> in_a >> in_b;
		--in_a, --in_b;
		A[i] = in_a, B[i] = in_b;
	} // end rep

	vector<ll> ans; ans.clear();
	ll curr = N*(N - 1LL)/2LL;

	UNION_FIND uf(N);
	rep (i, M){
		ans.push_back(curr);
		int a = A[M-1-i], b = B[M-1-i];
		if (uf.same(a,b)) continue;
		ll sa = (ll)uf.size(a), sb = (ll)uf.size(b);
		curr -= sa * sb;
		uf.unite(a,b);
	} // end for

	reverse(ALL(ans));

	rep (i, M){
		cout << ans[i] << endl;
	} // end rep
			

	return 0;
}

Measured memory_bytes: 3444