akhauriyash/Code-Regression huggingface dataset:
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = do
	[ n, m ] <- readInts
	[ ss', cs' ] <- transpose . ( [ -1, -1 ] : ) <$> replicateM m readInts
	let
		ss = tail ss'
		cs = tail cs'
	print $ fromMaybe (-1) $ listToMaybe $ do
		i <- [ 0 .. 1000 ]
		let
			str = map digitToInt $ show i
		guard $ length str == n && check ( map pred ss ) cs str
		return i

check ss cs str = runST $ do
	res <- newSTRef True
	forM_ ( zip ss cs ) $ \( s, c ) -> do
		modifySTRef res ( && s < length str && ( str !! s ) == c )
	readSTRef res

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

int main(){
    int N;
    cin >> N;
    int A[N - 1];
    for (int i = 0; i < N - 1; i++)
    {
        cin >> A[i];
    }

    int ans[N];
    for (int i = 0; i < N; i++)
    {
        ans[i] = 0;
    }
    
    for (int i = 0; i < N - 1; i++)
    {
        int k = A[i] - 1;
        ans[k]++;
    }

    for (int i = 0; i < N; i++)
    {
        cout << ans[i] << endl;
    }
    

    return 0;
}

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

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}
}star;
#define DEBUG if(0)
#endif

#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

int main() {
	int D, N;
	cin >> D >> N;
	if (N == 100)N++;
	for (int i : range(D))N*=100;
	cout << N << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<time.h>
using namespace std;
#define int long long
#define inf 1e9+7
typedef pair<int, int> P;

signed main() {
	int m;
	cin >> m;
	cout << 48 - m << endl;
}

Measured memory_bytes: 764
#include<stdio.h>

#define M 100000

int main(){
  int n,s[M],q,t[M],c=0;
  int left,right,mid;
  int i;

 
  scanf("%d",&n);
  for(i=0 ; i<n ; i++)scanf("%d",&s[i]);
  scanf("%d",&q);
  for(i=0 ; i<q ; i++)scanf("%d",&t[i]);

  for(i=0 ; i<q ; i++){
    left = 0;
    right = n;
    while(left < right){
      mid = (left + right) / 2;
      if(s[mid] == t[i]){
	c++;
	break;
      }
      else if(t[i] < s[mid]) right = mid;
      else left = mid + 1;
    }

  }
  
  printf("%d\n",c);

  return 0;
}



Measured memory_bytes: 2276
#include <bits/stdc++.h>
using namespace::std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x) cout << (x) << endl;

int main() {
  int a, b, ab, x, y;
  cin >> a >> b >> ab >> x >> y;
  ab *= 2;
  int sum = 0;
  if (a+b > ab) {
    sum += ab*min(x, y);
  }
  else {
    sum += (a+b)*min(x, y);
  }
  if (x > y) {
    if (a < ab) {
      sum += a*(x-y);
    }
    else {
      sum += ab*(x-y);
    }
  }
  else if (x < y) {
    if (b < ab) {
      sum += b*(y-x);
    }
    else {
      sum += ab*(y-x);
    }
  }
  dump(sum);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	sort(a.rbegin(),a.rend());
	int ans = 0;
	rep(i,k) ans += a.at(i);
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair

const int MAX_N = 200005;
int P[MAX_N];
int N;

void solve()
{
	int ans = 0;
	int m = N+1;
	for(int i=0;i<N;++i){
		if(P[i]<m){
			ans++;
			m=P[i];
		}
	}
	cout << ans << '\n';
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N;
	for(int i=0;i<N;++i)cin >> P[i];
	solve();
	return 0;
}

Measured memory_bytes: 1024
n,m=map(int,input().split())
a=[]
for _ in range(n):
    A=list(map(int,input().split()))
    a.append(A)
a.sort()
ans=0
for i in a:
    if m>i[1]:
        ans+=i[0]*i[1]
        m-=i[1]
    else:
        ans+=m*i[0]
        print(ans)
        exit()


Measured memory_bytes: 27760
#include <iostream>
#include <cmath>
using namespace std;
using ll = long long;
#define in(v) cin>>v;
#define out(v) cout<<v<<"\n"

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  ll N; in(N);
  ll max_a = 0;
  for (ll i = 1; i * i <= N; ++i) {
    if (N % i == 0)
      max_a = i;
  }
  out(1+floor(log10(N / max_a)));

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long N,A,B;
    cin >> N >> A >> B;

    long long res = 0;

    res += N/(A+B)*A;

    if(N%(A+B)>=A){//"~bbbr/rr"
        res += A;
    }else if(N%(A+B)<A){//"b/bbrrr"
        res += N%(A+B);
    }

    cout << res << endl;

}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x,y;cin>>x>>y;
    rep(i,100){
        if(i*2+(x-i)*4==y&&x-i>=0)return yes,0;
    }
    no;
}


Measured memory_bytes: 3604
#include<string>
#include<map>
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
using namespace std;
vector<int> p[101000];
int vis[101000];
int a[101000],b[101000];
queue<int> q;
int main(){
    int n,x,y;
    scanf("%d",&n);
    for(int i = 1; i < n; i ++){
        scanf("%d%d",&x,&y);
        p[x].push_back(y);
        p[y].push_back(x);
    }
    q.push(1);
    vis[1] = 1;
    a[1] = 0;
    while(!q.empty()){
        int tem = q.front();q.pop();
        int k = p[tem].size();
        for(int i = 0; i < k; i ++){
            if(vis[p[tem][i]])
                continue;
            a[p[tem][i]] = a[tem] + 1;
            q.push(p[tem][i]);
            vis[p[tem][i]] = 1;
        }
    }
    
    memset(vis,0,sizeof(vis));
    q.push(n);
    vis[n] = 1;
    b[n] = 0;
    while(!q.empty()){
        int tem = q.front(); q.pop();
        int k = p[tem].size();
        for(int i = 0; i < k ; i ++){
            if(vis[p[tem][i]])
                continue;
            b[p[tem][i]] = b[tem] + 1;
            q.push(p[tem][i]);
            vis[p[tem][i]] = 1;
        }
    }
    int cnt = 0;
    for(int i = 1; i <= n; i ++){
        if(a[i] <= b[i])
            cnt ++;
    }
    int cnt2 = n - cnt;
    if(cnt > cnt2)
        printf("Fennec");
    else
        printf("Snuke");
    return 0;
}

Measured memory_bytes: 7040
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 800 + 100;
const int INF = 0x1f1f1f1f;
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};

typedef pair<int, int> pii;

int n, m, k, sx, sy;
int ans = INF;
char s[MAXN][MAXN];
int dis[MAXN][MAXN], step[MAXN][MAXN];


void bfs1()
{
	queue<pii> que;
	dis[sx][sy] = 0, step[sx][sy] = 0, que.push(make_pair(sx, sy));
	while(!que.empty())
	{
		int x = que.front().first, y = que.front().second;
		que.pop();
		for(int i = 0; i < 4; i++)
		{
			int xx = x + dx[i], yy = y + dy[i];
			if(xx < 1 || xx > n || yy < 1 || yy > m) continue;
			if(dis[xx][yy] >= 0) continue;
			if(s[xx][yy] == '#') continue;
			if(dis[x][y] + 1 > k) continue;
			dis[xx][yy] = dis[x][y] + 1, step[xx][yy] = 1;
			que.push(make_pair(xx, yy));
		}
	}
}

void bfs2()
{
	queue<pii> que;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			if(dis[i][j] >= 0)
				dis[i][j] = k, que.push(make_pair(i, j));
	while(!que.empty())
	{
		int x = que.front().first, y = que.front().second;
		que.pop();
		for(int i = 0; i < 4; i++)
		{
			int xx = x + dx[i], yy = y + dy[i];
			if(xx < 1 || xx > n || yy < 1 || yy > m) continue;
			if(dis[xx][yy] >= 0) continue;
			dis[xx][yy] = dis[x][y] + 1, step[xx][yy] = (dis[xx][yy] + k - 1) / k;
			que.push(make_pair(xx, yy));
		}
	}
}

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n >> m >> k;
	for(int i = 1; i <= n; i++)
		cin >> (s[i] + 1);
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			if(s[i][j] == 'S')
				sx = i, sy = j;
	memset(dis, -1, sizeof(dis));
	bfs1();
	bfs2();
	for(int j = 1; j <= m; j++)
		ans = min(ans, step[1][j]), ans = min(ans, step[n][j]);
	for(int i = 1; i <= n; i++)
		ans = min(ans, step[i][1]), ans = min(ans, step[i][m]);
	cout << ans << endl;

	return 0;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a < b && b < c) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

  return 0;
}


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

int main(){
	int e,minn;
	while(1){
		cin>>e;
		if(e==0) break;
		minn=200000000;
		for(int z=0;z*z*z<=e;z++){
			for(int y=0;y*y+z*z*z<=e;y++){
				int x=e-(y*y+z*z*z);
				minn=min(minn,x+y+z);
			}
		}
		cout<<minn<<endl;
	}
	return 0;
}


Measured memory_bytes: 3064
#![allow(dead_code, unused_variables, unused_imports)]
use proconio::marker::Chars;
use proconio::{fastout, input};
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};

#[fastout]
fn main() {
    input!{
        n:usize,
    }
    
    let mut ans = 0;
    for i in 1..=n{
        if cnt_digit(i)%2 == 1{
            ans += 1;
        }
    }
    println!("{}",ans);
}   

fn cnt_digit(mut n:usize) -> usize{
    let mut cnt = 0;
    while n > 0{
        cnt += 1;
        n /= 10;
    }
    cnt
}

Measured memory_bytes: 2172
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <bits/stdc++.h>
#include <iomanip>
#include <numeric>
#include <utility>
#include <map>
#include <algorithm>
typedef long long ll;
using namespace std;
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll c = 1;
    ll tmp = 1000000000000000000;
    vector<ll> vec(N);
    for (ll i = 0; i < N; ++i)
        cin >> vec[i];
    sort(vec.begin(), vec.end());
    if (vec[0] == 0)
        cout << 0 << "\n";
    else
    {
        for (auto i : vec)
        {
            if ((tmp + 1) / c < i)
            {
                cout << "-1\n";
                return 0;
            }
            c *= i;
            if (c > tmp)
            {
                cout << "-1\n";
                return 0;
            }
        }
        cout << c << "\n";
    }
}


Measured memory_bytes: 3984
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n;

    cin >> n;

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

    vector<int> r(0);
    bool h = false;
    while(true){
        h = false;
        for(int i = v.size() - 1; i >= 0; i--){
            if(v[i] == i + 1){
                r.push_back(i);
                v.erase(v.begin() + i);
                h = true;
                break;
            }
        }
        if(h){
            if(v.empty()) break;
            continue;
        }
        cout << -1 << endl;
        return 0;
    }

    for(auto i = r.rbegin(); i != r.rend(); i++){
        cout << *i + 1 << endl;
    }

    return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<ll,ll>;

template <typename M>
struct SegmentTree{
    using T = typename M::type;

    int numLeaves;
    std::vector<T> data;
    
    SegmentTree(int n){
        numLeaves = 1;
        while(numLeaves < n){
            numLeaves *= 2;
        }
        
        data.resize(numLeaves * 2);
        std::fill(data.begin() + numLeaves, data.end(), M::identity());
        
        for(int i=numLeaves-1;i>0;--i){
            data[i] = M::bop(data[i*2], data[i*2+1]);
        }
    }

    template <typename F>
    SegmentTree(int n, F f){
        numLeaves = 1;
        while(numLeaves < n){
            numLeaves *= 2;
        }

        data.resize(numLeaves * 2);
        for(int i=0;i<n;++i){
            data[i + numLeaves] = std::move(f(i));
        }
        std::fill(data.begin() + numLeaves + n, data.end(), M::identity());

        for(int i=numLeaves-1;i>0;--i){
            data[i] = M::bop(data[i*2], data[i*2+1]);
        }
    }

    void set(int k, T v){
        k += numLeaves;
        data[k] = M::bop(data[k], v);
        
        while(k > 1){
            k /= 2;
            data[k] = M::bop(data[k*2], data[k*2+1]);
        }
    }
    
    T product(int l, int r){
        l += numLeaves;
        r += numLeaves;
        
        T pl = M::identity(), pr = M::identity();
        for(;l<r;l/=2,r/=2){
            if(l & 1){
                pl = M::bop(pl, data[l]);
                l += 1;
            }
            if(r & 1){
                r -= 1;
                pr = M::bop(data[r], pr);
            }
        }
        
        return M::bop(pl, pr);
    }
    
    T at(int i){
        return data[i + numLeaves];
    }
};

struct M{
    using type = P;
    static type identity(){
        return std::make_tuple(0, 0);
    }
    static type bop(type &m1, type &m2){
        return std::max(m1, m2);
    }
};

int N;
int A[100100];

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

    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> A[i];
    }

    SegmentTree<M> seg(100100);

    for(int i=0;i<N;++i){
        ll c, s;
        std::tie(c, s) = seg.product(0, A[i]);

        seg.set(A[i], std::make_tuple(c + 1, s + A[i]));
    }

    ll maxSum;
    std::tie(std::ignore, maxSum) = seg.product(0, 100100);
    std::cout << maxSum << std::endl;
}



Measured memory_bytes: 7308
# 適当に10**5ぐらい回して無限に続けられたら-1でよくね？
A, B, C = map(int, input().split())


def update(A, B, C):
    return B // 2 + C // 2, C // 2 + A // 2, A // 2 + B // 2


for i in range(10 ** 5):
    if A & 1 or B & 1 or C & 1:
        print(i)
        exit()
    A, B, C = update(A, B, C)

print(-1)


Measured memory_bytes: 39024
/*#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>*/
#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef vector<P> vP;
const ll mod = 1e9 + 7;
ll dx[4] = {1,0,-1,0};
ll dy[4] = {0,1,0,-1};

int main(){
    ll n,k;
	cin >> n >> k;
	vP v(n);
	rep(i,n) {
		ll a,b;
		cin >> a >> b;
		v[i] = P(a,b);
	}
	sort(all(v));
	rep(i,n){
		if(k - v[i].second <= 0) {
			cout << v[i].first << endl;
			break;
		}
		else k -= v[i].second;
	}
    return 0;
}  


Measured memory_bytes: 1792
N = int(input())
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
ans = 0
for i in range(N):
  a1 = A[i]
  a2 = A[i+1]
  b = B[i]
  A[i] = A[i]-min(a1,b)
  ans += min(a1,b)
  b = b-min(a1,b)
  A[i+1] = A[i+1]-min(a2,b)
  ans += min(a2,b)
print(ans)

Measured memory_bytes: 18624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#pragma 03
using namespace std;
using namespace __gnu_pbds;
int main(){
	ll x, y, z; cin >> x >> y >> z;
	swap(x, y); swap(x, z);
	cout << x << " " << y << " " << z;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int N, D;
    cin >> N >> D;
    int res = 0;
    while(N >= 2 * D + 1){
        N -= 2 * D + 1;
        res++;
    }
    if(N > 0){
        res++;
    }
    cout << res << endl;
}

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

int main(){

	int A,B,C;
  	cin >> A >> B >> C;
  	
  	if(A >= B && A >= C){
    
      	cout << A*10 + B +C << endl;
    
    }else if(B > A &&B > C){
      
    	 cout << B*10 + A + C << endl;	
    
    }else if(C > A&& C > B){
    
    	 cout << C*10 + A + B << endl;	    
    
    }

}

Measured memory_bytes: 256
n = int(input())
a, b = map(int, input().split())
P = list(map(int, input().split()))

x = 0
y = 0
z = 0
for p in P:
    if p <= a:
        x += 1
    elif a+1 <= p <= b:
        y += 1
    else:
        z += 1
print(min([x, y, z]))

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

vector<int> mh={0,1,-1,0};
vector<int> mw={1,0,0,-1};

int main()
{
int H,W,ans,h,w,nh,nw;scanf("%d %d",&H,&W);ans=H*W;
vector<vector<char>> s(H,vector<char>(W));vector<vector<int>> dis(H,vector<int>(W,0));
for(int i=0;i<H;i++)for(int j=0;j<W;j++){cin>>s[i][j];if(s[i][j]=='#')ans--;}
queue<pair<int,int>> que;que.push(make_pair(0,0));
while(!que.empty())
{
  h=que.front().first,w=que.front().second;que.pop();
  if(s[h][w]=='#')continue;
  s[h][w]='#';
  for(int i=0;i<4;i++)
  {
    nh=h+mh[i],nw=w+mw[i];
    if(nh<0||nh>H-1||nw<0||nw>W-1)continue;
    if(s[nh][nw]=='#')continue;
    dis[nh][nw]=dis[h][w]+1;
    que.push(make_pair(nh,nw));
  }
}
ans=ans-1-dis[H-1][W-1];
if(!dis[H-1][W-1])ans=-1;
printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int func(string x,string y){
  int ans=0;
  for(char c='a';c<='z';c++){
    bool foundx=false,foundy=false;
    for(int i=0;i<x.size();i++){
      if(x.at(i)==c){foundx=true;}}
    for(int i=0;i<y.size();i++){
      if(y.at(i)==c){foundy=true;}}
    if(foundx&&foundy){ans++;}
    }
  return ans;}


int main(){
int N;
string S;
cin>>N>>S;
int Q=0;
for(int i=0;i<N;i++){
  int match =func(S.substr(0,i),S.substr(i));
  Q=max(match,Q);
}
  cout<<Q<<endl;
      return 0;}

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

using namespace std;

int main() {
    int n; cin >> n;
    vector<int> hs(n);
    for (int i = 0; i < n; i++) {
        cin >> hs[i];
    }
    int ans = 0;
    int cnt = 0;
    for (int i = 0; i < (int)hs.size() - 1; i++) {
        if (hs[i] >= hs[i+1]) {
            cnt++;
        } else {
            cnt = 0;
        }
        if (cnt > ans) {
            ans = cnt;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <vector>
using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
int n, m, a[N], go[N], bg[N], ps[N];
ll k, chaf[N], ans[N], x[N];
bool vis[N];
vector<int> cir[N];
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) scanf("%lld", &x[i]);
	for (int i = 1; i <= n; ++i) chaf[i] = x[i] - x[i - 1];
	scanf("%d%lld", &m, &k);
	for (int i = 1; i <= m; ++i) scanf("%d", &a[i]);
	for (int i = 1; i <= n; ++i) go[i] = i;
	for (int i = 1; i <= m; ++i) swap(go[a[i]], go[a[i] + 1]);
	for (int i = 1; i <= n; ++i) {
		if (vis[i]) continue ;
		int u = i;
		while (!vis[u]) {
			vis[u] = 1;
			bg[u] = i;
			u = go[u];
		}
		u = i;
		bg[u] = i;
		cir[i].push_back(u);
		ps[u] = 0;
		while (go[u] != i) {
			u = go[u];
			ps[u] = cir[i].size();
			cir[i].push_back(u);
		}
	}
	for (int i = 1; i <= n; ++i) ans[i] = chaf[cir[bg[i]][(ps[i] + k) % cir[bg[i]].size()]];
	for (int i = 1; i <= n; ++i) ans[i] += ans[i - 1];
	for (int i = 1; i <= n; ++i) printf("%lld\n", ans[i]);
	return 0;
}

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

void display(string str, int loop) {
    for(int i = 0; i < loop; i++) {
        cout << str;
    }
}

int main(void) {
    int sx, sy, tx, ty;
    string out;
    cin >> sx >> sy >> tx >> ty;
    int w = tx - sx;
    int h = ty - sy;

    display("R", w);
    display("U", h);
    display("L", w);
    display("D", h);
    display("D", 1);
    display("R", w+1);
    display("U", h+1);
    display("L", 1);
    display("U", 1);
    display("L", w+1);
    display("D", h+1);
    display("R", 1);
    
    return 0;
}

Measured memory_bytes: 256
#ifdef ConanYu
#include "local.hpp"
#else
#pragma GCC optimize("-O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void Main();
#define debug(...) do { } while (false)
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main(); return 0;
}
#endif

const int N = 500005;
int base[26][N];

void add(int id, int at, int y) {
  for(int i = at; i < N; i += i & (-i)) {
    base[id][i] += y;
  }
}

int query(int id, int at) {
  int ret = 0;
  for(int i = at; i > 0; i -= i & (-i)) {
    ret += base[id][i];
  }
  return ret;
}

void Main() {
  int n; cin >> n;
  string s; cin >> s;
  for(int i = 0; i < n; i++) {
    add(s[i] - 'a', i + 1, 1);
  }
  int q; cin >> q;
  while(q--) {
    int op; cin >> op;
    if(op == 1) {
      int a; cin >> a;
      string c; cin >> c;
      add(s[a - 1] - 'a', a, -1);
      s[a - 1] = c[0];
      add(s[a - 1] - 'a', a, 1);
    } else {
      int l, r; cin >> l >> r;
      int cnt = 0;
      for(int i = 0; i < 26; i++) {
        cnt += (query(i, r) - query(i, l - 1) > 0);
      }
      cout << cnt << "\n";
    }
  }
}

Measured memory_bytes: 51740
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main(){
  int H, W;
  cin >> H >> W;
  vector<vector<char>> a(H, vector<char>(W));
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cin >> a[i][j];
    }
  }
  vector<vector<long long>> dp(H, vector<long long>(W, 0));
  dp[0][0] = 1;
  for (int i = 1; i < H; i++){
    if (a[i][0] == '.'){
      dp[i][0] = 1;
    } else {
      break;
    }
  }
  for (int i = 1; i < W; i++){
    if (a[0][i] == '.'){
      dp[0][i] = 1;
    } else {
      break;
    }
  }
  for (int i = 1; i < H; i++){
    for (int j = 1; j < W; j++){
      if (a[i][j] == '.'){
        dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
        dp[i][j] %= MOD;
      }
    }
  }
  cout << dp[H - 1][W - 1];
}

Measured memory_bytes: 9088
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int[] blackSum = new int[n+1];
        for(int i = 0; i < n; i++) {
            if(s.charAt(i) == '#') blackSum[i+1] = blackSum[i] + 1;
            else blackSum[i+1] = blackSum[i];
        }
        int min = n;
        for(int i = 0; i < n+1; i++) {
            int rightBlack = blackSum[i] - blackSum[0];
            int leftBlack = blackSum[n] - blackSum[i];
            int leftWhite = n - i - leftBlack;
            min = Math.min(min, rightBlack+ leftWhite);
        }
        System.out.println(min);
    }
}


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

using namespace std;

const int P = 998244353;

long long power(long long x, long long t) {
	long long ret = 1;
	for(; t; t >>= 1, x = x * x % P) {
		if(t & 1) {
			ret = ret * x % P;
		}
	}
	return ret;
}

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

	int n;
	cin >> n;

	int m = 1000001;

	vector<int> mu(m);
	vector<bool> mark(m);
	vector<int> p;
	mu[1] = 1;
	for(int i = 2; i < m; ++i) {
		if(!mark[i]) {
			p.emplace_back(i);
			mu[i] = -1;
		}
		for(int j = 0; j < p.size() && i * p[j] < m; ++j) {
			mark[i * p[j]] = true;
			if(i % p[j] == 0) {
				mu[i * p[j]] = 0;
				break;
			}
			mu[i * p[j]] = -mu[i];
		}
	}

	vector<int> cnt(m);
	vector<int> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
		cnt[a[i]] += 1;
	}


	vector<vector<int> > sum(m);
	vector<vector<int> > tot(m);
	for(int i = 1; i < m; ++i) {
		sum[i].resize(m / i + 1);
	}
	for(int i = 1; i < m; ++i) {
		tot[i].resize(m / i + 1);
	}

	vector<int> s(m);
	for(int i = 1; i < m; ++i) {
		int pre = 0;
		for(int j = i; j < m; j += i) {
			s[i] = (s[i] + 1LL * pre * cnt[j] % P * j % P) % P;
			s[i] = (s[i] + 1LL * cnt[j] * (cnt[j] - 1) / 2 % P * j % P * j % P) % P;
			pre = (pre + 1LL * cnt[j] * j % P) % P;
		}
	}

	int ans = 0;

	for(int d = 1; d < m; ++d) {
		int inv = power(d, P - 2);
		for(int i = 1; d * i < m; ++i) {
			ans = (ans + 1LL * mu[i] * s[d * i] % P * inv % P + P) % P;	
		}
	}

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 219240
N = int(input())
arr =  list(map(int, input().split()))

sorted_list = sorted(arr)
count = 0
for i in range(N):
    if arr[i] == sorted_list[i]:
        pass
    else:
        count += 1

if count < 3:
    print('YES')
else:
    print('NO')






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

int main(){
  vector<int> vec;
  vec = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << vec.at(k-1) << endl;
  return 0;
}


Measured memory_bytes: 256
N=input()
import collections
tmp=list(collections.Counter(N).keys())
ans=float("Inf")
import copy
for i in tmp:
   c=0
   l=copy.deepcopy(N)
   while len(set(l))!=1:
      tmp2=[]
      for j in range(len(l)-1):
         if l[j] ==i or l[j+1]==i:
            tmp2.append(i)
         else:
            tmp2.append(l[j])
      c+=1
      l=copy.deepcopy(tmp2)
   ans=min(ans,c)
print(ans)

Measured memory_bytes: 9476
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

ll gcd(ll a, ll b) {
	if (a < b)swap(a, 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;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e9;
const long long LINF = 1LL << 50;
#define int long long

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE x(n), y(n); rep(i, n)cin >> x[i] >> y[i];
	map<P, int>a;
	rep(i, n) {
		rep(j, n) {
			if (i == j)continue;
			P p = make_pair(x[i]-x[j], y[i]-y[j]);
			a[p]++;
		}
	}
	int tmp = 0;
	for (auto itr = a.begin(); itr != a.end(); itr++) {
		chmax(tmp, itr->second);
	}
	cout << n - tmp << endl;
	return 0;
}


Measured memory_bytes: 384
function Main(arg)
{
  var N = arg.split("\n")[0]-0;
  var P = arg.split("\n")[1].split(" ").map(v=>v-0);
 
  var max = N;
  var ans = 0;

  for (var i = 0; i < N; i++){
    if (max >= P[i]) {
      ans++;
      max = P[i];
    }
  }

  console.log(ans);
  return;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22224
n = int(input())
s = input()
ans = 0
for i in range(10):
    if str(i) in s:
        tmp1 = s[s.index(str(i))+1:]
        for j in range(10):
            if str(j) in tmp1:
                tmp2 = tmp1[tmp1.index(str(j))+1:]
                for k in range(10):
                    if str(k) in tmp2:
                        ans += 1
print(ans)

Measured memory_bytes: 3188
// Goods things are coming, just keep believing 
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
 
#define FOR(i, x, n) for(ll i = x; i < n; i++) 
#define pb push_back
#define pf push_front
#define ll long long
#define hii cout << "hii" << endl
#define okay cout << "okay" << endl
// #define hey cout << "hey" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
// #define mpp make_pair
#define endl '\n'
#define ff first 
#define int long long
#define ss second
#define vi vector<int>
#define all(s) s.begin(), s.end()
#define si size()
 #define ld long double
#define INF 1000000000;
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
 
 
 
const int N = 2e5 + 5;
const int LG = 20;
const int mod = 1e9 + 7;

int arr[N];
int pos[N];
vector<int> v[N];

int n;

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

void solve()
{
	int a, b, k;
	cin >> a >> b >> k;
	if(a >= k)
	{
		cout << a - k << " " << b;
	}
	else
	{
		cout << 0 << " " << max(0LL, b - (k - a));
	}
}
 
int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int t = 1;
	// cin >> t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 6400
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n;i>0;i--)
#define rep1(i,s,n) for(int i=s;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

int main(){
    int n,m,ans=0;
    cin>>n>>m;
    vec a(m),b(m);
    rep(i,m){
        cin>>a[i]>>b[i];
        a[i]--;
        b[i]--;
    }
    for(int i=0;i<m;i++){
        Graph G(n);
        vector<int> dist(n,-1);
        queue<int> que;
        int count = 0;
        for(int j=0;j<m;++j) {
            if(i!=j){
                G[a[j]].push_back(b[j]);
                G[b[j]].push_back(a[j]);
            }else continue;
        }
        for(int v = 0; v < n; ++v) {
            if (dist[v] != -1) continue;
            dist[v] = 0, que.push(v);
            while (!que.empty()) {
                int v = que.front(); que.pop();
                for (auto nv : G[v]) {
                    if (dist[nv] == -1) {
                        dist[nv] = dist[v] + 1;
                        que.push(nv);
                    }
                }
            }
            ++count;
        }
        if(count>1) ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
  string S;
  cin >> S;
  bool f = false;
  int i;
  if(S.size()%2 == 0) {
    f = true;
    for(i=0;i<S.size()/2;i++) {
      if(!(S[i*2] == 'h' && S[i*2+1] == 'i'))f = false;
    }
  }
  cout << (f?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
#include <omp.h>
using namespace std;
#define eps 0.000001
#define LONG_INF 10000000000000
#define GOLD 1.61803398874989484820458
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}


const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::string s){
    int cnt[2] = {};
    REP(i,N){
        if(s[i] == 'R') cnt[0]++;
        else cnt[1]++;
    }
    if(cnt[0] > cnt[1]) cout << YES << endl;
    else cout << NO << endl;
}

// Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::string s;
    std::cin >> s;
    solve(N, s);
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int

using namespace std;


int main() {
	speed;
	int x, a;
	cin >> x >> a;
	if (x < a)cout << 0;
	else { cout << 10; }

	ed;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
 
using namespace std;
using ll = long long;
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };


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

int main()
{
	int n, k, mx, a, i, g;

	cin >> n >> k >> g;
	mx = g;
	for(i = 1; i < n; i++){
		cin >> a;
		mx = max(mx, a);
		g = gcd(g, a);
	}

	if(mx < k || k % g != 0){
		cout << "IMPOSSIBLE" << endl;
	}
	else{
		cout << "POSSIBLE" << endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(void){
    long N,P,c;
    scanf("%ld%ld",&N,&P);
    c=1;
    while(pow(c,N)<=P){
        c+=100000;
    }
    while(pow(c,N)>P){
        c-=1;
    }
    while(1){
        if(P%(long)(pow(c,N))==0){
            break;
        }
        c-=1;
    }
    
    printf("%ld\n",c);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,count=0;
  cin>>n;
  for(int i=1;i<=n-1;i++){
    for(int j=1;j<=n-1;j++){
      if(i*j<=n-1){
        count++;}
      else{
        break;
      }
    }
  }
  cout<<count;
}
      
      

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		
		if(s.equals("ABC")) {
			System.out.println("ARC");
		}else {
			System.out.println("ABC");
		}
		
		
	}

}


Measured memory_bytes: 35484
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
N = int(input())
#開業されたN個要素を受け付ける
#input_list = [int(input()) for i in range(N)]
input_org = input()
keta = input_org.replace(' ', '')
input_list = list(map(int, input_org.split()))
ans = 1
#print(input_list)
#print( 0 in input_list)
if (0 in input_list):
    ans = 0
elif len(keta) - N > 20:
    ans = -1
else:
    for input in input_list:
        ans = ans*input
        if ans > 1000000000000000000:
            ans = -1

print(ans)


Measured memory_bytes: 25176
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int main(){
	ll a,b;
	cin >> a >> b;
	if(abs(a-b)>=2ll)cout << "Alice" << endl;
	else cout << "Brown" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppiii;

vector<pii> edges[100005];
ll dp[100005];
int n;

void bfs(int s) {
  for(int i = 1; i <= n; i++) dp[i] = 1e18;
  dp[s] = 0;
  queue<int> q;
  q.push(s);
  while(!q.empty()) {
    int curr = q.front();
    q.pop();
    for(pii out: edges[curr]) {
      if(dp[out.first] > dp[curr] + out.second) {
        dp[out.first] = dp[curr] + out.second;
        q.push(out.first);
      }
    }
  }
}

void solve() {
  cin >> n;
  for(int i = 1; i < n; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    edges[a].push_back({b, c});
    edges[b].push_back({a, c});
  }
  int q, k;
  cin >> q >> k;
  bfs(k);
  while(q--) {
    int a, b;
    cin >> a >> b;
    cout << dp[a] + dp[b] << "\n";
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
  solve();
}


Measured memory_bytes: 8820
#include <iostream>
#include <vector>
using namespace std;
using P = pair<int, int>;

P solve(int x, int y, vector<P>& dp, vector<vector<int>>& num, vector<P>& pos, vector<bool>& is_prime, int m) {
    int n = num[x][y];
    P& r = dp[n];
    if(r.first != -1) {
        return r;
    }
    r = make_pair(0, 0);
    for(int dx=-1; dx<=1; ++dx) {
        int nx = x+dx, ny = y+1;
        if(0 <= nx && nx < 1100 && ny < 1100 && num[nx][ny] != -1 && num[nx][ny] <= m) {
            P p = solve(nx, ny, dp, num, pos, is_prime, m);
            if(r.first < p.first) {
                r = p;
            } else if(r.first == p.first && r.second < p.second) {
                r = p;
            }
        }
    }
    if(is_prime[n]) {
        r.first += 1;
        if(r.second == 0) {
            r.second = n;
        }
    }
    return r;
}

int main() {
    int m, n;
    vector<vector<int>> number(1100, vector<int>(1100, -1));
    vector<P> pos(1000001);
    int dx[4] = {1, 0, -1, 0},
        dy[4] = {0, -1, 0, 1};
    int dir = 0;
    int x = 500, y = 500;
    for(int i=1; i<=1000000; ++i) {
        pos[i] = make_pair(x, y);
        number[x][y] = i;
        x += dx[dir], y += dy[dir];
        if(number[x+dx[(dir+1)%4]][y+dy[(dir+1)%4]] == -1) {
            dir = (dir+1)%4;
        }
    }
    vector<bool> is_prime(1000001, true);
    is_prime[0] = is_prime[1] = false;
    for(int i=2; i<is_prime.size(); ++i) {
        if(is_prime[i]) {
            for(int j=i+i; j<is_prime.size(); j+=i) {
                is_prime[j] = false;
            }
        }
    }
    while(cin >> m >> n, m) {
        vector<P> dp(1000001, P{-1, -1});
        P res = solve(pos[n].first, pos[n].second, dp, number, pos, is_prime, m);
        cout << res.first << " " << res.second << endl;
    }
}


Measured memory_bytes: 23656
#include<bits/stdc++.h>
#define int long long int
#define mod 998244353 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output1.txt","w", stdout);
    #endif
    string s;
    cin>>s;
    int n,ans=0;
    n=s.size();
    for (int i = 0; i < n; ++i)
    {
        ans=(ans+(s[i]-'0'))%9;
    }
    if (ans==0)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    #ifndef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0;
}       

Measured memory_bytes: 3876
A, B = map(int, input().split())
S = input()

def is_int(s):
    try:
        int(s)
        return True
    except ValueError:
        return False

if S[A] == '-':
    if is_int(S[:A]) and is_int(S[A + 1:]):
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define fr(i,n)  for(int i = 0;i<n;++i)
#define fri(i,a,b) for(int i= a;i<=b;++i)
#define fro(i,a,b) for(int i= a;i>=b;--i)
#define debug(P) cout<<#P<<" = "<<P<<endl;
#define fi first
#define se second
#define pb(x) push_back(x)
#define  mp(x,y) make_pair(x,y)
#define endl  "\n"
#define  ii  pair<int,int>
#define  LL  long long
#define  maxm(a,b,c)  max(a,max(b,c))
int main(){
	char x;
	cin>>x;
	cout<<char(int(x)+1);
}

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

using namespace std;

int main(){
	int a,b,k;
	cin >> a >> b >> k;
	for(int i=0;i<k;i++){
		if(i%2==0){
			if(a%2==1){
				a-=1;
			}
			a /= 2;
			b+=a;
		}else{
			if(b%2==1){
				b-=1;
			}
			b /= 2;
			a+=b;
		}
	}
	cout << a << " " << b << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n ,a, b;
    
    cin >> n >> a >>b;
    
    if((b - a) % 2 != 0){
        cout << "Borys" << endl;
    } else {
        cout << "Alice" << endl;
    }
}


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

int main(){
    ll n, l;
    cin >> n >> l;
    vector<ll> a(n), b(n-1);
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, n-1) b[i] = a[i] + a[i+1];
    auto mx = max_element(b.begin(), b.end());
    if(*mx < l){
        cout << "Impossible" << endl;
        return 0;
    }
    cout << "Possible" << endl;
    auto pos = mx - b.begin();
    rep(i, 0, pos) cout << i+1 << endl;
    for(ll i = n-2; i >= pos; i--) cout << i+1 << endl;
    return 0;
}

Measured memory_bytes: 4804
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define int long long
const int mod = 1e9 + 7;

int32_t main(){
	fastio;
	
	int n; cin >> n;
	vector<int> a(n);
	int val = 0;
	for(int i=0; i<n; i++){
		cin >> a[i];
		val ^= a[i];
	}
	
	for(int i=0; i<n; i++){
		a[i] ^= val;
		cout << a[i] << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 4744