akhauriyash/Code-Regression huggingface dataset:
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif

int N;
vvvi F;
vvi P;
vi a;
int ans;

void calc_profit() {
    int AL = a.size();

    bool ok = false;
    REP(i, AL) {
        if (a[i] == 1) {
            ok = true;
            break;
        }
    }
    if (!ok) return;

    vi cnt(N, 0);
    REP(i, AL) {
        if (a[i]==1) {
            REP(j, N) {
                if (F[j][i / 2][i % 2] == 1) cnt[j]++;
            }
        }
    }

    int prof = 0;
    REP(i, N) prof += P[i][cnt[i]];

    ans = max(ans, prof);    
}

void dfs(int n){
    if (n >= 10) {
        calc_profit();
        return;
    }

    REP(i, 2) {
        if (i == 0) {
            a[n] = 0;
            dfs(n + 1);
        } else {
            a[n] = 1;
            dfs(n + 1);
        }
    }
}

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

    cin >> N;
    F = vvvi(N, vvi(5, vi(2, 0)));
    REP(i, N)
        REP(j, 5)
            cin >> F[i][j][0] >> F[i][j][1];

    P = vvi(N, vi(11, 0));
    REP(i, N)
        REP(j, 11)
            cin >> P[i][j];

    ans = -INF;
    a = vi(10, 0);
    dfs(0);
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool f[100000];
int c[100000];
int main(){
    for(int i=2;i<100000;i++){
      if(f[i]) continue;  //一度trueにしている場所
      for(int j=i+i;j<100000;j += i)
        f[j]=true;  //iの倍数をtrueにする
    }


    for(int i=3;i<=100000;i++){
      if(!(f[i]) && !(f[(i+1)/2])) c[i]++; //iとi+1/2が０ならば１＋
    }

    for(int i=3;i<=100000;i++){
      c[i] += c[i-1];
    }

    int q,r,l;//q=入力、r=１番目、l=２番目
    scanf("%d",&q);
    for(int i=0;i<q;i++){
      scanf("%d%d",&r,&l);
      printf("%d\n",c[l]-c[r-1]);
    }
}

Measured memory_bytes: 1152
n,x=list(map(int,input().split()))
a=list(map(int,input().split()))
count=0

for i in range(n-1):
  if(a[i]+a[i+1] > x):
    sa=(a[i]+a[i+1])-x
    count=count+sa

    if(a[i+1] > 0 and sa <= a[i+1]):
      a[i+1]=a[i+1]-sa
    else:
      a[i+1]=0

print(count)

Measured memory_bytes: 14540
//NAME-DEEPESH BHATT
//Institute-IIT Dhanbad
//MOTTO-THINK FIRST,CODE LATER

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1000000007  ;
#define endl '\n'
#define pb push_back
#define mp make_pair

//Check for signed int overflow
// use __builtin_popcount(num) to calculate no.of setbits in num
//s.lower_bound() works in O(logn) whereas lower_bound(s.begin(),s.end(),x) works in O(n)
//      if(!lazy)
//         solve 1600+(rating) problems in codeforces.
//      else
//         solve 1400+(rating) problems in codeforces.

ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a ,ll b)
{
    return a/gcd(a,b)*b;
}
/*ll power(ll a,ll n){
    if (n == 0)
        return 1;
    ll p = power(a, n / 2);
    p = (p * p)%MOD;
    if (n % 2)
        return (p * a)%MOD;
    else
        return p%MOD;
}*/

int32_t main()
{
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    ios_base::sync_with_stdio(false);    //for fast I/O operation
    cin.tie(nullptr);
    ll test=1;
    /*cin>>test;*/
    while(test--){
        ll n;
        cin>>n;
        vector<long double>p(n+1);
        for(ll i=1;i<=n;i++){
            cin>>p[i];
        }
        /*for(ll i=1;i<=n;i++){
            cout<<p[i]<<" ";
        }*/
        vector<long double>dp(n+1);
        dp[0]=1.0;
        for(ll i=1;i<=n;i++){
            for(ll j=i;j>=0;j--){
                if(j>0)
                    dp[j]=(dp[j]*(1-p[i])+dp[j-1]*p[i]);
                else{
                    dp[j]=dp[j]*(1-p[i]);
                }
            }
        }
        /*for(auto x:dp){
           cout<<x<<" ";
        }
        cout<<endl;*/
        long double ans=0;
        for(ll i=n/2+1;i<=n;i++){
            ans+=(dp[i]);
        }
        cout<<setprecision(10)<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3964
#include <iostream>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int ans = 0;
    char predir;
    for(int i = 0; i < n - 1; i++) {
        if(i == 0)
            predir = s[i];
        while(i < n && s[i] == predir)
            i++;
        if(i > n - 1)
            break;
        while(i < n && s[i] != predir)
            i++;
        if(i < n) {
            ans += 2;
            k--;
        } else {
            ans++;
            k--;
            break;
        }
        predir = s[i--];
        if(k == 0)
            break;
    }
    for(int i = 0; i < n; i++) {
        if(s[i] == 'L') {
            if(i != 0 && s[i] == s[i - 1])
                ans++;
        } else {
            if(i != n - 1 && s[i] == s[i + 1])
                ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
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);
	ll lc = (a/g) * b;
	return lc;
}
char a[55][55];
int h , w;
bool check(int x)
{
	int up = sqrt(x);
	for(int i = 2 ; i <= up ; i++){
		int t = x;
		while(t%i == 0)
		{
			t/= i;
		}
		if(t == 1)
			return true;
	}
	return false;
	
}
int main()
{
	int n;
	cin >> n;
	for(int i = n ; i >= 1; i--){
		if(check(i)){
			cout << i << endl;
			return 0;
		}
	}
	cout << 1 << endl;

	return 0;
} 



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

const int INF = 2e9;

int main(){
    ll n,p;
    cin >> n >> p;
    if(n == 1) {
        cout << p << endl;
        return 0;
    }
    if(p == 1){
        cout << 1 << endl;
        return 0;
    }
    ll ans;
    for(int gcd = 1;gcd <= sqrt(p);gcd++){
        ll g = pow(gcd,n);
        if(p % g == 0) ans = gcd;
    }
    cout << ans << endl;
}

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int h1,m1,h2,m2,k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	int time = h2-h1;
	time *= 60;
	time += m2;
	time -= m1;
	cout << time-k << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 3652
#include <cstdio>
#include <vector>

using namespace std;

int s[100001];
int N, Q;
int p[100001];
int operation[100001];
int mark_time[100001];

int find_root(int i);

int find_p_root(int i)
{
	if (s[i]==0) {
		s[i] = find_p_root(p[i]);
		return s[i];
	}
	else if (s[i]!=-i) {
		s[i] = find_root(s[i]);
		return s[i];
	}
	else
		return i;

}

int find_root(int i)
{
	if (s[i]!=-i) {
		s[i] = find_root(s[i]);
		return s[i];
	}
	else
		return i;
}

int main()
{
	//freopen("in.txt", "r", stdin);

	while (scanf("%d%d", &N, &Q)==2) {
		if (N==0 && Q==0) break;
		int i;
		p[1] = 1;
		for (i=2; i<=N; i++) {
			scanf("%d", &p[i]);
		}
		char c;
		for (i=0; i<Q; i++) {
			do { c = getchar();
			} while (c!='M' && c!='Q');
			scanf("%d", &operation[i]);
			if (c=='Q')
				operation[i] = -operation[i];
		}

		for (i=1; i<=N; i++) {
			s[i] = 0;
			mark_time[i]=0;
		}
		s[1] = -1;
		mark_time[1]=1;
		for (i=0; i<Q; i++) {
			if (operation[i]>0) {
				s[operation[i]] = -operation[i];
				mark_time[operation[i]]++;
			}
		}

		for (i=1; i<=N; i++) {
			if (s[i]==0) {
				int root = find_p_root(i);
				s[i] = root;
			}
		}

		long long sum = 0;
		for (i=Q-1; i>=0; i--) {
			if (operation[i]<0) {
				int root = find_root(-operation[i]);
				sum += root;
			}
			else if (operation[i]>0) {
				if (--mark_time[operation[i]]==0) {
					int parent = p[operation[i]];
					s[operation[i]] = parent;
				}
			}
		}
		printf("%lld\n", sum);

	}

	return 0;
}

Measured memory_bytes: 2684
#include<bits/stdc++.h>
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
    long long  i=0,j,n,d=0,e=0,f=0,k;
    long long sum=0,c=0;
    double maxi=0,v=0;
    cin>>n>>k;
    long long a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(j=0;j<k-1;j++)
        {
            c+=a[j];
        }
    for(i=k-1;i<n;i++)
    {
        c+=a[i];
        if(c>sum)
        {
            sum=c;
            d=i;
        }
        c-=a[i-(k-1)];
    }
    for(i=d;i>(d-k);i--)
    {
        v+=(a[i]+1);
    }
    maxi=v/2.0;
    cout<<fixed<<setprecision(12)<<maxi;

}


Measured memory_bytes: 1792
#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;

int main() {
    int n, x = 0, ans = 0;
    string s;
    cin >> n >> s;
    rep(i, n){
        x += (s[i] == 'I' ? 1 : -1);
        chmax(ans, x);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3548
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <map>

using namespace std;

int main() {
    int n;
    cin >> n;
    map<int, int> m;
    int zero=0;
    for (int i=0; i<n; i++) {
        int a;
        cin >> a;
        if (a == 0) zero++;
        else m[a]++;
    }
    if (m.size() == 3 && n % 3 == 0) {
        bool yes = true;
        int a = 0;
        for (auto &mi:m) {

            if (mi.second != n/3) {
                yes = false;
                break;
            }
            a = a xor mi.first;
        }
        if (yes && a == 0) {
            cout << "Yes" << '\n';
            return 0;
        }
    }
    if ((m.size() == 1 && (zero == n / 2 && n % 2 == 0) || (zero == n / 3 && n % 3 == 0)) || m.size() == 0) {
        cout << "Yes" << '\n';
        return 0;
    }
    cout << "No" << '\n';
    return 0;
}


Measured memory_bytes: 3840
#include <iostream>

int main(void)
{
  int A,B;
  std::cin >> A;
  std::cin >> B;
  
  int aa=0,bb=0;
  
  int cnt=0;
  for(int i=A;i<=B;i++)
  {
    aa = int(i%100);
   	int aaa,bbb;
    aaa = aa/10;
    bbb=aa%10;
    aa=bbb*10+aaa;
    bb = int(i / 1000);
    if(aa == bb)
    {
      cnt++;
    }
    else{
    }
    
  }
  
  std::cout << cnt << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
def solve(D, G, P, C):
    ret = float('inf')
    for i in range(pow(2, D)):
        selected = []
        tmp_score = 0
        tmp_counter = 0
        not_selected = -1

        for j in range(D):
            if i >> j & 1:
                selected.append(j)
                tmp_counter += P[j]
                tmp_score += P[j] * 100 * (j + 1) + C[j]
            else:
                not_selected = j

        if G <= tmp_score:
            ret = min(ret, tmp_counter)
            continue

        for _ in range(1, P[not_selected]):
            tmp_score += 100 * (not_selected + 1)
            tmp_counter += 1
            if G <= tmp_score:
                ret = min(ret, tmp_counter)
                break

    print(ret)

if __name__ == "__main__":
    D, G = map(int, input().split())
    P = []
    C = []

    for _ in range(D):
        p, c = map(int, input().split())
        P.append(p)
        C.append(c)

    solve(D, G, P, C)

Measured memory_bytes: 40816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1e9 + 7

template < typename T >
void printVector (const vector < T > & vec) {
	for (const T x : vec) {
		cout << x << " ";
	}
	cout << endl;
}

const ll INF = 1e18L + 5;

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

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

int main() {
	int N, W, w, v;
	scanf ("%d %d", &N, &W);
	vector < int > weight (N), value (N);
	for (int i = 0; i < N; i++) {
		scanf ("%d %d", &weight[i], &value[i]);
	}
	int value_sum = 0;
	for (int x : value) {
		value_sum += x;
	}
	vector < ll > dp (value_sum + 1, INF);
	dp[0] = 0;
	for (int i = 0; i < N; i++) {
		for (int value_already = value_sum - value[i]; value_already >= 0; value_already--) {
			min_self (dp[value_already + value[i]], dp[value_already] + weight[i]);
		}
	}
	int answer = 0;
	for (int i = 1; i <= value_sum; i++) {
		if (dp[i] <= W) answer = i;
	}
	printf ("%d\n", answer);
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<map>
using namespace std;
map<string,int>m;
int main(){
	ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
	int n,ma=0;cin>>n;
	for(string s;n;--n)cin>>s,++m[s];
	for(map<string,int>::iterator it=m.begin();it!=m.end();++it)
		ma=max(ma,it->second);
	for(map<string,int>::iterator it=m.begin();it!=m.end();++it)
		if(it->second==ma)cout<<it->first<<'\n';
	return 0;
}

Measured memory_bytes: 23808
#include <iostream>
#include <bitset>
#include <vector>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  string S;
  cin >> S;
  int n = S.size();
  ll sum = 0;
  for(int bit = 0; bit < (1 << (n - 1)); bit++){
    bitset<10> bs(bit);
    int cnt = 0;
    for(int i = 0; i < n; i++){
      sum += (ll)(S[n - 1 - i] - '0') * (ll)pow(10, cnt);
      if(bs.test(i)){
        cnt = 0;
      }else{
        cnt++;
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "5", "1 2 1 1 3" ].parse.expand.solve == "Yes" );
	assert( [ "4", "1 3 2 1" ].parse.expand.solve == "No" );
	assert( [ "5", "1 2 3 4 5" ].parse.expand.solve == "Yes" );
	assert( [ "1", "1000000000" ].parse.expand.solve == "Yes" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto hs = input.front.split.to!( long[] );
	return tuple( hs );
}

auto solve( long[] hs )
{
	for( auto i = hs.length.signed - 1; 0 < i; i-- )
	{
		hs[ i - 1 ] -= ( hs[ i ] < hs[ i - 1 ] );
		if( hs[ i ] < hs[ i - 1 ] ) return "No";
	}
	return "Yes";
}


Measured memory_bytes: 6964
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n = INT()

if n < 1000:
    print('ABC')
else:
    print('ABD')


Measured memory_bytes: 3896
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Feb  9 09:53:28 2019

@author: shinjisu
"""


# ARC 066 C lining up
def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def db(x):
    global debug
    if debug:
        print(x)


def solve():
    A.sort()
    db(A)
    if A[0] == 0:
        n = 1
    else:
        n = 0
    for i in range(n, len(A), 2):
        db(i)
        if A[i] != A[i+1]:
            return 0
    return 2**(len(A)//2) % (10**9+7)


debug = False
N = getInt()
A = getIntList()
db((N, A))
print(solve())


Measured memory_bytes: 13880
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (int i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n, m, c;
    cin >> n >> m >> c;
    vector<ll> b(m);
    rep(i, 0, m) cin >> b[i];

    int ans = 0;
    rep(i, 0, n) {
        int tmp = c;
        rep(j, 0, m) {
            ll a;
            cin >> a;
            tmp += a * b[j];
        }
        if (tmp > 0) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    int answater = 0, anssugar = 0;
    double max = 0;
    for (int i = 0; 100 * a * i <= f; ++i) {
        for (int j = 0; 100 * b * j <= f; ++j) {
            for (int k = 0; c * k <= f; ++k) {
                for (int l = 0; d * l <= f; ++l) {
                    int water = 100 * a * i + 100 * b * j;
                    int sugar = c * k + d * l;
                    int sum = water + sugar;
                    double concentration = 0;
                    if (sum != 0) {
                        concentration = (double)sugar / (water + sugar);
                    }
                    if (sum <= f && concentration >= max && 100.0 * sugar / water <= e) {
                        max = concentration;
                        answater = water;
                        anssugar = sugar;
                    }
                }
            }
        }
    }
    cout << answater + anssugar << " " << anssugar << endl;
    return 0;
}



Measured memory_bytes: 256
#include <cmath>
#include <cstdint>
#include <iostream>
#include <vector>

int main(int argc, char* argv[]) {
  int64_t N, K;
  std::cin >> N >> K;
  std::vector<int> h(N + 1);
  for (int64_t i = 1; i <= N; ++i) {
    std::cin >> h[i];
  }

  std::vector<int64_t> dp(N + 1);
  dp[1] = 0;
  for (int64_t n = 2; n <= N; ++n) {
    int64_t min_val{INT64_MAX};
    for (int64_t k = 1; k <= K && n - k >= 1; ++k) {
      min_val = std::min(min_val, dp[n - k] + std::abs(h[n] - h[n - k]));
    }
    dp[n] = min_val;
  }
  std::cout << dp[N] << std::endl;
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<(int)(b);i++)

int main() {
  string s,t;
  cin >> s >> t;
  int cmax=0;
  FOR(i,0,s.size()-t.size()+1){
    int c=0;
    FOR(j,0,t.size()){
      if(s[i+j]==t[j]) c++;
    }
    cmax=c>cmax?c:cmax; 
  }
  cout << t.size()-cmax << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	int sum=0;
	long long m=n;
	while(m)
	{
		sum+=m%10;
		m/=10;
	}
	if(n%sum==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
    return 0;
}


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

int main()
{
    ull N;
    cin >> N;
    vector<ull> P(N, 0);
    ull min = N+1;
    ull cnt = 0;
    for(ull i=0; i<N; i++)
    {
        ull temp = 0;
        cin >> temp;
        if(temp <= min)
        {
            min = temp;
            cnt++;
        }
    }

    cout << cnt;
    return 0;
}

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

string SPLIT = "split", JOIN = "join";

int m = 0;
pair<int, int> split(){
    m += 2;
    return {m-1, m};
}

int join(){
    m += 1;
    return m;
}

void solve(){
    string s; cin >> s;

    int ma, ba;
    ma = ba = 0;

    vector<pair<string, pair<int, int> > > ans;

    for(int i = 0;i < s.size();i++){
        if(s[i] == 'o') ma++;
        else ba++;
    }

    if(ma < ba){
        cout << -1 << endl;
        return;
    }

    if(ma == ba){
        int n = s.size();
        for(int i = 0;i < n;i+=2){
            if(s[i] == s[i+1]){
                cout << -1 << endl;
                return;
            }
            if(i < n-2){
                ans.push_back({SPLIT, {i, 1}});
            }
        }
    }else{
        int now = 0;
        while(s.find('x') != string::npos){
            if(s[0] != 'o' && s[s.size()-1] != 'o'){
                int t = 1;
                for(int i = 1;i < s.size();i++){
                    if(s[i] == 'o'){
                        t--;
                        if(t == 0){
                            auto ydk = split();
                            ans.push_back({SPLIT, {now, i}});
                            ans.push_back({JOIN , {ydk.second, ydk.first}});
                            now = join();
                            string tmp = s.substr(0, i+1);
                            s.erase(0, i+1);
                            s += tmp;
                            break;
                        }
                    }else{
                        t++;
                    }
                }
            }else{
                while(s[s.size()-1] != 'x'){
                        s.erase(s.size()-1);
                        s = 'o' + s;
                        auto ydk = split();
                        ans.push_back({SPLIT, {now, s.size()-2}});
                        ans.push_back({JOIN, {ydk.second, ydk.first}});
                        now=join();
                }
                s.erase(0, 1);
                s.erase(s.size()-1);
                auto ydk = split();
                ans.push_back({SPLIT, {now, 0}});
                ans.push_back({JOIN, {ydk.second, ydk.first}});
                now = join();
                ans.push_back({SPLIT, {now, s.size()-1}});
                now = split().first;
            }
        }

        for(int i = 0;i < s.size()-1;i++){
            ans.push_back({SPLIT, {now, 0}});
            now = split().second;
        }
    }

    cout << ans.size() << endl;

    for(int i = 0;i < ans.size();i++){
        auto p = ans[i];
        cout << p.first << " " << p.second.first << " " << p.second.second << endl;
    }
}

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

    while(q--){
        m = 0;
        solve();
    }
}


Measured memory_bytes: 3220
/* Nurgazy Zhandos */

#include <bits/stdc++.h>
#include <functional>
#include <algorithm>
#include <stdexcept>
#include <streambuf>	
#include <exception>
#include <typeinfo>
#include <valarray>
#include <iostream>
#include <iterator>
#include <cstdlib>
#include <istream>
#include <iomanip>
#include <fstream>
#include <complex>
#include <utility>
#include <ostream>
#include <numeric>	
#include <sstream>
#include <utility>
#include <bitset>
#include <iosfwd>
#include <string>
#include <limits>
#include <vector>
#include <cstdio>
#include <locale>
#include <memory>	
#include <string>	
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <stack>
#include <list>	
#include <map>
#include <set>
#include <ios>
#include <new>
//#include <unordered_set>
//#include <unordered_map> 

#define F first
#define S second

#define pf push_front
#define pb push_back
#define mp make_pair
#define pp pop_back
#define in insert

#define resize(v) v.resize(unique(all(v)) - v.begin()); 
#define all(a) a.begin(), a.end()
#define sz(a) a.size()
#define STOP return 0

#define nl '\n'

//#define int long long

using namespace std;

typedef pair <int, pair <int, int > > pIii;
typedef pair < pair <int, int >, int> piiI;
typedef pair <long long, long long> pll;
typedef pair <int, long double> pid;
typedef pair <long double, int> pdi;
typedef pair <int, long long> pil;
typedef pair <long long, int> pli;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long double ld;
typedef long long ll;

const int MAX_N = 1e5 + 123;
const int inf = 1e9 + 123;
const ll INF = 1e18 + 123;
const int NN = 2e6 + 123;
const double eps = 1e-9;
const int mod = 1e9 + 7;

inline void fre() {
	#ifdef TEZZY
//	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
	#endif
}

inline void boost() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
}

main () {
	fre();
	boost();

	int n;
	cin >> n;

	if(n <= 2) cout << 0, exit(0);
	
	if(n <= 5) cout << 1, exit(0);

	int cnt = 0;

	while(n > 0) {
	 	if(n - 3 >= 3) {
			cnt++;
			n -= 3;
	 	}
	 	else {
	 	 	cnt++;
	 	 	n = 0;
	 	}
	}

	cout << cnt;
}

Measured memory_bytes: 256
/*..............................................*\
Author:Kishor Kumar Paroi
Dept:CSE-1703053
email.kishor.josephite@gmail.com
RUET,BANGLADESH
\*---------------------------*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include<bits/stdc++.h>
#include<iostream>
#include<iterator>

#define max(a,b) ((a>b)?a:b)                        //finding max
#define min(a,b) ((a<b)?a:b)                        //finding min
#define Max(a,b,c) max(a,max(b,c))                  //finding max between 3 numbers
#define Min(a,b,c) min(a,min(b,c))                  //finding min between 3 numbers
#define Pi acos(-1.0)                               //defining Pi for mathematical uses
#define Clear(a) memset(a,0,sizeof(a))              //clearing memory of an array
#define setfalse(a) memset(a,false,sizeof(a))       //setting the array into false
#define settrue(a) memset(a,true,sizeof(a))         //setting the array into true
#define clrstr(a) memset(a,'\0',sizeof(a))          //setting string array to null
#define open freopen("input.txt","r",stdin)         //opening input file
#define close freopen ("output.txt","w",stdout)     //opening output file
#define Case(a) printf("Case %d: ",a)               //printing case number
#define caseh(a) printf("Case #%d: ",a)             //printing case number having '#'
#define getcase(a) scanf("%d",&a)                   //scanning case number
#define caseloop(a,b) for(a=1;a<=b;a++)             //making case loop
#define EPS 1e-9                                    //small value for avoiding preccesion error
#define LL long long                                //long long short form
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define vi vector<int>v
#define si vector<int>s

/*for(vector<int>iterator it=v.begin();it!=v.end();it++)
{
    cout<<*it<< " ";
}
cout<< endl;
*/

#define CIN1(a) long long a;cin >> a;
#define CIN2(a,b) long long a,b;cin >> a >> b;
#define CIN3(a,b,c) long long a,b,c;cin >> a >> b >> c;
#define rep(i,n) for(int i=0,i##_len=(n); i<i##_len; ++i)
//const int N=100*1000;
//const int mod=1e9+7;

//# define int min3(int a,int b,int c){return min(a,min(b,c));}
//#define int max3(int a,int b,int c){return max(a,max(b,c));}
//#define int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
//#define int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    vi;
    int n,x;cin>>n>>x;
    int s=0,m,k,tmp=1000;
    for(int i=0;i<n;i++)
    {
        cin>>m;
        if(tmp>m)
            tmp=m;
        s+=m;
    }
    cout<<((x-s)/tmp)+n<<endl;

    return 0;
}



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

int main()
{
  int N;
  cin >> N;
  
  double sum = 0;
  for(int i = 0; i < N; ++i)
  {
    double money;
    string currency;
    cin >> money >> currency;
    if(currency == "JPY")
    {
      sum += money;
    }
    else
    {
      sum += money * 380000.0;
    }
  }
  
  cout << sum << endl;
  return 0;
  
}

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

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int R = sc.nextInt();
    sc.close();

    int ans = R;
    if (N < 10) {
      ans += 100 * (10 - N);
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define all(t) (t).begin(),(t).end()
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}

int main(){
	int n;
	cin >> n;
	vector<string> s;
	string ss;
	FOR(i,n){
		cin >> ss;
		s.push_back(ss);
	}
	vector<pair<int,string>> x;

	sort(all(s));

	string cnt="";
	int v=0;
	int ans=1;
	FOR(i,n){
		if(cnt!=s[i]){
			x.push_back(make_pair(v,cnt));
			cnt=s[i];
			chmax(ans,v);
			v=1;
		}else{
			v++;
		}
	}
	x.push_back(make_pair(v,cnt));
			chmax(ans,v);

	sort(all(x));
	FOR(i,x.size()){
		if(ans==x[i].first){
			cout << x[i].second << endl;
		}
	}
}


Measured memory_bytes: 18672
#include <iostream>
#include <array>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	array<int,3> rgb;
	cin >> rgb[0] >> rgb[1] >> rgb[2] >> n;

	sort(rgb.begin(), rgb.end(), greater<int>());

	int maxI = n / rgb[0];
	int maxJ = n / rgb[1];
	int ret = 0;
	for (int i = 0; i <= maxI; ++i) {
		for (int j = 0; j <= maxJ; ++j) {
			int diff = n - (i * rgb[0] + j * rgb[1]);
			if (0 <= diff && diff % rgb[2] == 0) {
				++ret;
			}
		}
	}

	cout << ret << endl;

	return 0;
}

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

int main(){
	int t;
	while(true){
		cin >> t;
		if(t == 0)break;
		int ok = 0;
		int n[t],p[t],q[t],r[t];
		for(int i = 0; i < t; i++){
			cin >> n[i] >> p[i] >> q[i] >> r[i];
		}
		int rp,rq,rr,rimit;
		cin >> rp >> rq >> rr >> rimit;
		for(int i = 0; i < t; i++){
			if(p[i] <= rp && q[i] <= rq && r[i] <= rr && 4 * p[i] + 9 * q[i] + 4 * r[i] <= rimit){
				cout << n[i] << endl;
				ok = 1;
			}
		}
		if(!ok)cout << "NA" << endl;
	}
	return 0;
}


Measured memory_bytes: 3100
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int X=sc.nextInt();
		int Y=sc.nextInt();
		int Z=sc.nextInt();
		int cnt=0,sum=Z;
		while(sum+Y+Z<=X) {
			sum+=Y+Z;
			cnt++;
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 23380
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn f(n: usize) -> usize {
    if n == 0 {
        return 0;
    }
    let res = n % pop_count(n);
    f(res) + 1
}

fn pop_count(n: usize) -> usize {
    let mut res = 0;
    let mut n = n;
    while n > 0 {
        res += n % 2;
        n /= 2;
    }
    res
}

fn solve() {
    input! {
        n: usize,
        x: Chars
    };

    let x = x
        .into_iter()
        .map(|ch| ch.to_digit(10).unwrap() as usize)
        .collect::<Vec<_>>();
    let mut pc = 0;
    for n in 0..n {
        if x[n] == 1 {
            pc += 1;
        }
    }
    let sum_mod_plus = x.iter().copied().fold(0, |acc, x| (acc * 2 + x) % (pc + 1));
    let sum_mod_minus = x.iter().copied().fold(0, |acc, x| {
        if pc <= 1 {
            return 0;
        }
        (acc * 2 + x) % (pc - 1)
    });
    let digits_val_mod_plus = (0..n)
        .into_iter()
        .scan(1, |acc, _| {
            let res = *acc;
            *acc = (*acc * 2) % (pc + 1);
            Some(res)
        })
        .collect::<Vec<_>>();
    let digits_val_mod_minus = (0..n)
        .into_iter()
        .scan(1, |acc, _| {
            if pc <= 1 {
                return Some(0);
            }
            let res = *acc;
            *acc = (*acc * 2) % (pc - 1);
            Some(res)
        })
        .collect::<Vec<_>>();
    for i in 0..n {
        if x[i] == 0 {
            let res = (sum_mod_plus + digits_val_mod_plus[n - i - 1]) % (pc + 1);
            let res = 1 + f(res);
            println!("{}", res);
        } else {
            if pc == 1 {
                println!("0");
            } else if digits_val_mod_minus[n - i - 1] > sum_mod_minus {
                let res = (pc - 1) + sum_mod_minus - digits_val_mod_minus[n - i - 1];
                let res = 1 + f(res);
                println!("{}", res);
            } else {
                let res = sum_mod_minus - digits_val_mod_minus[n - i - 1];
                let res = 1 + f(res);
                println!("{}", res);
            }
        };
    }
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 6540
from collections import deque
import sys
input=sys.stdin.readline
S=input().splitlines()[0]
Q = int(input())
qs = [input().split() for _ in range(Q)]
flipcnt = 0
S =deque(S)
for q in qs:
    if len(q) == 1:
        flipcnt += 1
        continue
    else:
        if (int(q[1]) + flipcnt) % 2 == 1:
            #前
            S.appendleft(q[2])
        else:
            S.append(q[2])
    #print(S)

if flipcnt % 2 == 1:
    S.reverse()

print(''.join(S))

Measured memory_bytes: 44788
/*input
3 2
380 19 1
*/

#include <bits/stdc++.h>
#define ll long long

using namespace std;

void run() {
	int n, m, i, total=0;
	cin >> n >> m;
	vector<int> a(n);
	for(i=0; i<n; i++) {
		cin >> a[i];
		total += a[i];
	}
	int count = 0;
	for(i=0; i<n; i++) {
		if(a[i]*4*m >= total) count++;
	}
	if(count >= m) cout << "Yes" << endl;
	else cout << "No" << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);		
	int t = 1;
	while(t--) {
		run();
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
	int A, B;
	cin >> A >> B;
	int count = 0;
	for(int i=A; i<=B; ++i){
		string S;
		S = to_string(i);
		if(S[0]==S[4]&&S[1]==S[3]) ++count;
	}
	cout << count << endl;
}

Measured memory_bytes: 3664
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();
		int A = sc.nextInt();
		sc.close();
		if(X<A) {
			System.out.println("0");
		} else {
			System.out.println("10");
		}
	}
}

Measured memory_bytes: 22868
#include <cstdio>

int main(){
    int x[4],y[4];
    scanf("%d %d %d %d",&x[0],&y[0],&x[1],&y[1]);
    int vx = x[1] - x[0],vy = y[1] - y[0];
    int v;
    for(int i = 2; i < 4; i++){
        v = vx;
        vx = - vy;
        vy = v;
        x[i] = x[i - 1] + vx;
        y[i] = y[i - 1] + vy;
    }
    printf("%d %d %d %d\n",x[2],y[2],x[3],y[3]);
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int R;
  cin >> R;
  if (R<1200) {
    cout << "ABC" << endl;
  }
  else {
    if (R<2800) {
      cout << "ARC" << endl;
    }
    else {
      cout << "AGC" << endl;
    }
  }
}

Measured memory_bytes: 3588
import bisect as bi
def fact(n):
  arr=[]
  temp=n
  for i in range(2,int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0:
        cnt+=1
        temp//=i
      arr.append([i,cnt])
  if temp!=1:
    arr.append([temp,1])
  if arr==[]:
    arr.append([n,1])
  return arr
n=int(input())
if n==1:
  print(0)
  exit()
l=[i*(i+1)//2 for i in range(1,100)]
c=0
for t in fact(n):
  c+=bi.bisect_right(l,t[1])
print(c)

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

const int MAX = 2010;
const int MOD = 1000000007;

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 main() {
  int n,k; cin>>n>>k;
    // 前処理
    COMinit();

    // 計算例
    for(int i=1;i<=k;i++){
		cout << COM(n-k+1, i)*COM(k-1,i-1)%MOD << endl;
    }
}
    
  

    
  


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



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

  int n; cin >> n;
  string a,b,c; cin >> a >> b >> c;
  int ans = 0;
  for(int i = 0; i < n; i++){
    if(a[i] != b[i]) ans++;
    if(a[i] != c[i] && b[i] != c[i]) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
# coding: utf-8

# 入力１行目：4桁の整数(１文字列)
N, L = gets.split.map(&:to_i)

# N個のリンゴの味の総和
a = N*L + (1..N).inject(&:+) - N

puts a - (1..N).map{ |i| (L + i - 1) }.min{|i, j| i.abs <=> j.abs }

Measured memory_bytes: 1788
import math

n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
count = 0

for i in range(n-1):
  for j in range(i+1, n):
    in_root = 0.0
    in_root += sum((x[i][k]-x[j][k])**2 for k in range(d))
    ans = math.sqrt(in_root)
    if ans.is_integer():
      count += 1
        
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------
vector<int> d(2001);
vector<vector<int>> g(2001);
void dfs(int s)
{
    for (auto v : g[s])
    {
        if (d[v] == INF)
        {
            d[v] = d[s] + 1;
            dfs(v);
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n - 1; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int ans = n;
    if (k % 2 == 0)
    {
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                d[j] = INF;
            }
            d[i] = 0;
            dfs(i);
            int cnt = 0;
            for (int j = 0; j < n; j++)
            {
                if (d[j] > k / 2)
                {
                    cnt++;
                }
            }
            chmin(ans, cnt);
        }
    }
    else
    {
        for (int i = 0; i < n; i++)
        {
            for (auto j : g[i])
            {
                if (i < j)
                {
                    for (int e = 0; e < n; e++)
                    {
                        d[e] = INF;
                    }
                    d[i] = 0;
                    d[j] = 0;
                    dfs(i);
                    dfs(j);
                    int cnt = 0;
                    for (int e = 0; e < n; e++)
                    {
                        if (d[e] > (k - 1) / 2)
                        {
                            cnt++;
                        }
                    }
                    chmin(ans, cnt);
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = input()

ans = [S[0]]
for i in range(1, N):
  if S[i] != S[i-1]:
    ans.append(S[i])
    
print(len(ans))

Measured memory_bytes: 6224
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] age)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuffer sb = new StringBuffer();

		String input = br.readLine();
		int i = 0;
		char c = input.charAt(i);
		Character character = new Character( c );
		String inputer = character.toString();

		while( true ){
			if( Character.isUpperCase(input.charAt(i)) ){
				sb.append(inputer.toLowerCase());
			}else{
				sb.append(inputer.toUpperCase());
			}
			i++;

			if( input.length()==i ) break;

			 c = input.charAt(i);
			 character = new Character( c );
			 inputer = character.toString();
		}

		System.out.println(sb);
	}
}

Measured memory_bytes: 24508
#include <bits/stdc++.h>
    using namespace std;
     
    int main()
    {
    	string str;
      	cin>>str;
      	string yes_no[]={"No","Yes"};
      	int a=0,b=0,c=0;
      	for(int i=0 ; i<str.length() ; ++i)
        {
        	if(str[i]=='a')
            ++a;
          	else if(str[i]=='b')
            ++b;
          	else if(str[i]=='c')
            ++c;
        }
      	cout<<yes_no[a&&b&&c]<<endl;
    	return 0;
    }

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

#define endl '\n'

int A[11][11];

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

    int n, m;
    cin >> n >> m;
    for(int i = 0; i <= 9; i++) {
        for(int j = 0; j <= 9; j++) {
            cin >> A[i][j];
        }
    }

    for(int k = 0; k <= 9; k++) {
        for(int i = 0; i <= 9; i++) {
            for(int j = 0; j <= 9; j++) {
                A[i][j] = min(A[i][j], A[i][k] + A[k][j]);
            }
        }
    }

    long long res = 0;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            int v;
            cin >> v;
            if(v == -1)
                continue;
            res += A[v][1];
        }
    }
    cout << res;

    return 0;
}

Measured memory_bytes: 256
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

C1 = A1 - B1
C2 = A2 - B2

if C1 * C2 >= 0:
    print(0)

else:
    if C1 < 0:
        C1, C2 = -C1, -C2
    P = T1 * C1
    Q = P + T2 * C2
    if Q > 0:
        print(0)
    elif Q == 0:
        print('infinity')
    else:
        hi = 10**18
        lo = -1
        while hi - lo > 1:
            mid = (hi + lo) // 2
            if Q * mid + P <= 0:
                hi = mid
            else:
                lo = mid
        if Q * hi + P == 0:
            print(hi * 2)
        else:
            print(hi * 2 - 1)

Measured memory_bytes: 9128
a[20];main(z,n,m,i){for(;scanf("%d%d",&m,&n)*n;puts(a))for(*a=1;~n--;)for(i=18;i;a[i]=~n?a[i+1]+=z*m/1e4,z*m%10000:z&&!printf("%d%.3s",z,51-i*3+"MtsFksNytAsgGgsGokSaiSeiKanKo\0JouJo\0GaiKeiChoOkuMan"))z=a[--i];}

Measured memory_bytes: 616
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <map>
#include <iomanip>

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

using namespace std;
using lli = long long int;
using ll = long long;


int main() {
    lli H, N;
    cin >> H >> N;

    vector<lli> A(N);
    for (lli i = 0; i < N; ++i) {
        cin >> A[i];
    }

    lli sum = 0;
    for (lli i = 0;  i< N; ++i) {
        sum += A[i];
    }

    if (H <= sum) {
        printf("Yes");
    } else {
        printf("No");
    }
}


Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<string>
#include <algorithm>
#include<cstring>
#include <math.h>
#include <iomanip>
using namespace std;

int main()
{
  //coutの小数点の位置を決めておけるやつ
  cout<<fixed<<setprecision(8);

  while(1){
  int n;
  double s[1000];
  cin>>n;
  if(n==0) break;
  double sum=0;
  for(int i=0;i<n;i++){
    cin>>s[i];
    sum+=s[i];
  }
  double ave=sum/n;
  double ans=0.0;
  for(int i=0;i<n;i++){
    ans=ans+(s[i]-ave)*(s[i]-ave);
  }
  ans=sqrt(ans/n);
  cout<<ans<<endl;
  }
  
  return 0;
}      



Measured memory_bytes: 3228
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

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

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

int main_() {
	int N;
	cin >> N;
	int x = 800 * N;
	int y = 200 * (N / 15);

	int ans = x - y;

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


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

using namespace std;

#define PB(x)	push_back(x)
#define ALL(x)	(x).begin(), (x).end()
#define ALLR(x)	(x).rbegin(), (x).rend()
#define MP(x)	make_pair(x)

#define debug(_x)		cerr << #_x << '=' << _x << endl;
#define debug2(_x, _y)	cerr << #_x << '=' << _x << ' ' << #_y << '=' << _y << endl;
#define debugn(_a)		cerr << #_a << ": "; for (const auto _x: _a) cerr << _x << ' '; cerr << endl;

#define FAST_IO ios::sync_with_stdio(false); cin.tie(0)

#define int long long int

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX >> 1;
const int NINF = LONG_LONG_MIN;
const int mmod = 100000000000ll;

int32_t main() {
	FAST_IO;
	
	string s, t;
	cin >> s >> t;
	int a, b;
	cin >> a >> b;
	
	string p;
	cin >> p;
	if (p == s) a--;
	else b--;
	cout << a << ' ' << b << endl;
}
// g++ -Wall -Wextra -Wshadow -fsanitize=undefined 


Measured memory_bytes: 256