akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int k;
  cin>>k;

  cout<<k/2*(k-k/2)<<endl;


}

Measured memory_bytes: 256
let N, K = stdin.ReadLine().Split() |> Array.map int |> fun x -> x.[0], x.[1]
let A = stdin.ReadLine().Split() |> Array.map int
A
|> Seq.pairwise
|> Seq.map (fun (x, y) -> y - x)
|> Seq.append [ A.[0] + N - A.[K - 1] ]
|> fun x -> (x |> Seq.sum) - (x |> Seq.max)
|> printfn "%d"


Measured memory_bytes: 64920
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int K = sc.nextInt();

		if (500*X >= K) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;
const int INF = 1001001001;


int main(){
  int n, x, y;
  cin >> n >> x >> y;
  --x; --y;
  vector<int> ans(n);
  rep(sv, n) {
    vector<int> dist(n, INF);
    queue<int> q;
    auto push = [&](int v, int d) {
      if (dist[v] == INF) {
        dist[v] = d;
        q.push(v);
      }
    };
    push(sv, 0);
    while (!q.empty()) {
      int v = q.front(); q.pop();
      int d = dist[v];
      if(v - 1 >= 0) push(v - 1, d + 1);
      if(v + 1 < n) push(v + 1, d + 1);
      if(v == x) push(y, d + 1);
      if(v == y) push(x, d + 1);
    }
    
    rep(i, n) ans[dist[i]]++;
  }
  
  for (int i = 1; i <= n - 1; ++i) {
    cout << ans[i] / 2 << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n, mn=1e9, mx=-1e9, mni, mxi, k, a[55];
int main() {
	int i;
	cin>>n;
	for(i=1; i<=n; i++) {
		cin>>a[i];
		if(a[i]<mn) mn=a[i], mni=i;
		if(a[i]>mx) mx=a[i], mxi=i;
	}
	if(mn==mx) {cout<<0; return 0;}
	if(mn<0 && mx>0) {
		cout<<2*n-1<<endl;
		k = mn+mx<0 ? mni : mxi;
		for(i=1; i<=n; i++) cout<<k<<' '<<i<<endl;
	} else {
		cout<<n-1<<endl;
	}
	if(mn+mx<0) for(i=n; i>1; i--) cout<<i<<' '<<i-1<<endl;
	else for(i=1; i<n; i++) cout<<i<<' '<<i+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000001


int main(){
	
	int N;
	cin>>N;
	
	vector<pair<int,int>> P(N);
	
	for(int i=0;i<N;i++){
		cin>>P[i].first>>P[i].second;
	}
	
	sort(P.begin(),P.end());
	
	reverse(P.begin(),P.end());
	
	vector<int> Rmin(N+1,Inf),Lmax(N+1,0);
	vector<int> RminR(N+1,Inf),LmaxR(N+1,0);
	
	for(int i=0;i<N;i++){
		Rmin[i+1] = min(P[i].second,Rmin[i]);
		Lmax[i+1] = max(P[i].first,Lmax[i]);
	}
	
	reverse(P.begin(),P.end());
	
	for(int i=0;i<N;i++){
		RminR[i+1] = min(P[i].second,RminR[i]);
		LmaxR[i+1] = max(P[i].first,LmaxR[i]);
	}

	
	reverse(P.begin(),P.end());
	
	int ans = 0;
	for(int i=0;i<N;i++){
		int a = P[i].second-P[i].first+1;
		int l = max(Lmax[i],LmaxR[N-1-i]);
		int r = min(Rmin[i],RminR[N-1-i]);
		int b = r-l+1;
		if(b<0)b=0;
		
		ans = max(ans,a+b);
	}
	
	for(int i=1;i<N-1;i++){
		int a = Rmin[i]-Lmax[i]+1;
		if(a<0)a=0;
		int b = RminR[N-i]-LmaxR[N-i]+1;
		if(b<0)b=0;
		ans = max(ans,a+b);
	}
	
	cout<<ans<<endl;
	
    return 0;
}



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

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

  bool A = false;
  bool C = false;
  int upper_cnt = 0;

  if (S.at(0) == 'A') A = true;
  for (int i = 2; i < S.size() - 1; i++)
  {
    if (S.at(i) == 'C') C = true;
  }
  
  for (int i = 0; i < S.size(); i++)
  {
    if(isupper(S.at(i))) upper_cnt += 1;
  }
  
  if (A && C && upper_cnt == 2){
    cout << "AC" << endl;
  }
  else
  {
    cout << "WA" << endl;
  }
  
}

Measured memory_bytes: 3608
text = "".join(reversed(input()))
words = ["".join(reversed(x)) for x in ["dreamer", "eraser", "dream", "erase"]]

while text != "":
  has_striped = False
  for word in words:
    if text.find(word) != 0: continue
    text = text[len(word):]
    has_striped = True
  if not has_striped: break

print("YES" if text == "" else "NO")

Measured memory_bytes: 3956
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

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

    Int p = N/K;

    cout<<min(N-p*K,abs(N-(p+1)*K))<<endl;

    return 0;
}



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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};

int n,m;


int main(){

  
  cin >> n >> m;
  //vector<int> v(n);
  priority_queue<int,vector<int>,greater<int>> que;
  REP(i,n){
    int x;cin >> x;
    que.push(x);
  }
  vector<P> u;
  REP(i,m){
    int x,y;cin >> x >> y;
    u.push_back(make_pair(y,x));
  }
  sort(ALL(u),greater<P>());
  REP(i,m){
    
    REP(j,u[i].second){
      int k = que.top();
      if(k >= u[i].first)break;
      que.pop();
      que.push(u[i].first);
    }
  }
  ll res = 0;
  REP(i,n)res += que.top(),que.pop();
  cout << res << endl;



  return 0;
}


Measured memory_bytes: 1784
let is_palindrome s =
  let len = String.length s in
  let rec loop = function
      i when i = (len/2) -> true
    | i -> if s.[i] = s.[len-1-i] then
             loop (i+1)
           else false
  in loop 0;;

let () =
  let rec read count =
    try let line = read_line () in
        if is_palindrome line then
          read (count+1)
        else
          read count
    with End_of_file
         -> count
  in
  Printf.printf "%d\n" (read 0);;

Measured memory_bytes: 2300
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
const ll MOD = (ll)1e9+7;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t x){
	if(was_output)cout << " ";
	was_output = true;
	cout << x;
}

void outendl(){
	was_output = false;
	cout << endl;
}

vector<int> fast;
vvector<int> roads;

int main(){
	int n;
	cin >> n;
	roads.resize(n);
	rep(i, n){
		rep(j, n){
			char d;
			cin >> d;
			if(i>=j)continue;
			if(d=='1'){
				roads[i].push_back(j);
				roads[j].push_back(i);
			}
		}
	}
	auto func = [&](int start){
		fast.assign(n, 0);
		fast[start] = 1;
		queue<pii> que;
		que.emplace(start, -1);
		while(que.size()){
			pii d = que.front();
			que.pop();
			foreach(i, roads[d.first]){
				if(i==d.second)continue;
				if(fast[i]==0){
					fast[i] = fast[d.first] + 1;
					que.emplace(i, d.first);
					continue;
				}
				if(fast[i] == fast[d.first]-1)continue;
				if(fast[i]!=fast[d.first]+1)return INF;
			}
		}
		int res = 0;
		foreach(i, fast){
			chmax(res, i);
		}
		return res;
	};
	
	int ans = -1;
	rep(i, n){
		int d = func(i);
		if(d<INF)chmax(ans, d);
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
#define p pair<pair<string,int>,int>
using namespace std;
int main(){
	int r,D,x;
	cin>>r>>D>>x;
	for(int i=0;i<10;i++){
		x=r*x-D;
		cout<<x<<"\n";
	}
	return 0;
}

Measured memory_bytes: 256
r,t,n,*k=map(int,open(0).read().split());l=b=0;M=max
for x,y,a in zip(*[iter(k)]*3):exec(("l=M(l,x)","r=min(r,x)","b=M(b,y)","t=min(t,y)")[a-1])
print(M(0,r-l)*M(0,t-b))

Measured memory_bytes: 3316
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long LL;
#define mp(a, b) make_pair(a, b)
#define fir first
#define sec second
template <class T> inline void read(T &a) {
	static int ch = 0; bool f = 0; a = 0;
	while (ch < '0' || ch > '9') f |= ch == '-', ch = getchar();
	while (ch >= '0' && ch <= '9') a = a * 10 + ch - '0', ch = getchar();
	if (f) a = -a;
}
//#define MULTI_CASE
#define MOD
#define N 100005

vector <int> E[N];

int n, K;
int V[N], P[N];
int L[N], R[N], a[N];

void solveL() {
	priority_queue <pii> q;
	for (int i = 1; i <= K; i++) q.push(mp(P[i], V[i]));
	while (!q.empty()) {
		pii o = q.top(); q.pop();
		if (L[o.sec] != o.fir) continue;
		for (auto v : E[o.sec]) {
			if (L[v] < o.fir - 1) {
				L[v] = o.fir - 1;
				q.push(mp(L[v], v));
			}
		}
	}
}

void solveR() {
	priority_queue <pii, vector <pii>, greater<pii> > q;
	for (int i = 1; i <= K; i++) q.push(mp(P[i], V[i]));
	while (!q.empty()) {
		pii o = q.top(); q.pop();
		if (R[o.sec] != o.fir) continue;
		for (auto v : E[o.sec]) {
			if (R[v] > o.fir + 1) {
				R[v] = o.fir + 1;
				q.push(mp(R[v], v));
			}
		}
	}
}

void dfs(int x, int fa) {
	for (auto v : E[x]) if (v != fa) {
		if (a[x] + 1 <= R[v]) a[v] = a[x] + 1;
		else a[v] = a[x] - 1;
		dfs(v, x);
	}
}


void work() {
	read(n);
	for (int i = 1; i < n; i++) {
		int u, v; read(u); read(v);
		E[u].push_back(v);
		E[v].push_back(u);
	}
	for (int i = 1; i <= n; i++) L[i] = -10 * N, R[i] = 10 * N;
	read(K);
	for (int i = 1; i <= K; i++) {
		read(V[i]); read(P[i]);
		L[V[i]] = R[V[i]] = P[i];
	}
	solveL();
	solveR();
	for (int i = 1; i <= n; i++) if (L[i] > R[i]) {
		puts("No"); return;
	}
	a[V[1]] = L[V[1]];
	dfs(V[1], -1);
	for (int i = 1; i <= n; i++) if (a[i] < L[i] || a[i] > R[i]) {
		puts("No"); return;
	}
	puts("Yes");
	for (int i = 1; i <= n; i++) {
		printf("%d\n", a[i]);
	}
}


int main() {
#ifdef MULTI_CASE
	int T;
	cin >> T;
	for (int i = 1; i <= T; i++) {
		printf("Case %d: ", i);
		work();
	}
#else
	work();
#endif
	return 0;
}

Measured memory_bytes: 12604
#include <iostream>

int main() {
    int N, K;
    std::string S;
    std::cin >> N >> S >> K;
    
    char c = S[K-1];
    
    for (auto &&i : S) {
        if (i == c)
            std::cout << i;
        else
            std::cout << '*';
    }
    std::cout << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define COUT(x) cout<<(x)<<"\n"
#define REP(i,n) for(int i=0;i<n;i++)

int a,b;
const int h=100,w=100;
char g[h][w];

int main() {
  cin >> a >> b;
  a--; b--;

  REP(i,h) REP(j,w) {
    g[i][j] = i<h/2 ? '#' : '.';
  }

  int swaped = 0;
  for (int i = 0; i < h; i+=2) {
    if (h/2 < i && !swaped) {
      swap(a,b);
      swaped = 1;
    }
    for (int j = 0; j < w; j+=2) {
      if (a==0) break;
      g[i][j] = g[i][j] == '.' ? '#' : '.';
      a--;
    }
  }

  cout << h << " " << w << endl;
  REP(i,h) REP(j,w) {
    cout << g[i][j];
    j == w-1 && cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3640
a,b,c = map(int,input().split())
m1 = max(a,b,c)
m3 = min(a,b,c)
m2 = a+b+c-m1-m3
m = m2-m3
n = m1-m2
if m%2 == 0:
  print((m+2*n)//2)
else:
  print((m+2*n+3)//2)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include <string>
#include<cstdio>
#include<stack>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define D(n,retu) REP(i,n){cin>>retu[i];}
 
using namespace std;
typedef long long ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}
 
//------------------変数-----------------------//
ll a[100001], n, cou = 0, saishuu=27582543523490925,zero=0;
typedef pair<ll, ll>p;
//-------------------関数----------------------//
 
int main() {
	cin >> n;//代入
	REP(i, n) {
		cin >> a[i];
	}
	REP(i, n - 1) {
		a[i + 1] += a[i];//累積和
	}
	ll kari[100001];
	REP(z, 2) {
		REP(i, n) { kari[i] = a[i]; }
		ll effect = 0; cou = 0;
		REP(i, n) {
			if (i % 2 == zero) {
				if (kari[i] <= 0) {
					effect += 1 - kari[i];
					cou += 1 - kari[i];
				}
			}
			else {
				if (kari[i] >= 0) {
					effect += -1 - kari[i];
					cou += 1 + kari[i];
				}
			}
			kari[i + 1] += effect;
		}
		zero = 1;
		saishuu = min(saishuu, cou);
	}
	cout << saishuu << endl;
}

Measured memory_bytes: 1792
use std::io::Read;

fn main() {
    let mut buf = String::new();

    std::io::stdin().read_to_string(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();

    let mut h: Vec<usize> = vec![];
    for _ in 0..n {
        h.push(iter.next().unwrap().parse().unwrap());
    }

    let mut ans = 0;

    for i in 0..n {
        while h[i] != 0 {
            let mut j = i;

            while j < n && h[j] != 0 {
                j += 1;
            }

            for k in i..j {
                h[k] -= 1;
            }

            ans += 1;

            // h[i..j] -= 1;

            // for t in &h{
            //     print!("{} ", t);
            // }
            // println!("");
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
a,v=map(int,input().split())
b,w = map(int,input().split())
t=int(input())


if a<=b:

    dist_a = a + t*v

    dist_b = b + t*w

    if dist_a>=dist_b:
        print('YES')
    else:
        print('NO')
else:

    dist_a = a - t*v

    dist_b = b - t*w

    if dist_a<=dist_b:
        print('YES')
    else:
        print('NO')
    

Measured memory_bytes: 9128
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(int i=(a);i<(b);++i)


#define huge 1000000007
typedef long long ll;

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll K = 0;
	ll M = 0;
	ll X = 0;
	//double a[100000] = {};
	//double b[100000] = {};
	//ll v[100] = {};
	ll *a, *b, *d;
	string S,T,U;
	ll count = 0;
	ll sum = 0;
	ll min = 100000;
	ll max = 0;
	int flag = 0;
	char temp,head;
	//int is = 0;

	
	//char p;
	cin >>N >> M;
	
	vector<pair<float, float>> is(M);
	//a = (ll *)malloc(N * sizeof(ll));
	//b = (ll *)malloc(N * sizeof(ll));


	rep(i, 0, M) {
		cin >> is[i].first >> is[i].second;
	}

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

	/*rep(i, 0, M) {
		cout << is[i].first << is[i].second << endl;
	}*/

	min = is[0].second;

	count = is[0].first;
	sum++;
	//cout << count << min << endl;

	for (int i = 0; i < M; i++) {

		if (is[i].first != count)
		{
			count = is[i].first;
			//cout << is[i].first << is[i].second << endl;
		
			if (min <= is[i].first) {
				sum++;
				min = is[i].second;
				//cout << "added" << endl;
			}
			else if (min > is[i].second) {
				min = is[i].second;
			}
			//cout <<"min"<< min << endl;
		}


	}

		cout << sum << endl;

	return 0;

}



Measured memory_bytes: 1024
H = int(input())
S = []
for _ in range(H):
	S.append(input()) 

L = []

for i in range(0,len(S)):
	L.append(sorted(S[i]))

for i in range(0,len(L)):
	L[i] = ",".join(L[i])

dicL = dict()
answer = 0

for l in L:
	if l in dicL:
		dicL[l] += 1
		answer += dicL[l]
	else:
		dicL[l] = 0
		
print(answer)

Measured memory_bytes: 32028
#include<stdio.h>
int main()
{
	int a,b,c,d,e,f,g;
	scanf("%d%d",&a,&b);
	if(a%(b*2+1)==0)
	{
		printf("%d",a/(b*2+1));
	}
	else
	{
		printf("%d",a/(b*2+1)+1);
	}
}

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


int main(){
    string s;
    ll k;
    cin>>s;
    cin>>k;
    int len=s.length();
    int index=0;
    char next='1';
    for(int i=0;i<len;i++)
    {
        if(s[i]!='1')
        {
            index=i+1;
            next=s[i];
            break;
        }
    }
    if(index>k)
    {
        cout<<"1";
    }
    else
    {
        cout<<next;
    }
    return 0;
}


Measured memory_bytes: 256
a = input()
l = len(a)
ans = 0
for i in range(l):
	tmp = 0
	for j in range(l-i):
		if a[i+j] != "A" and a[i+j] != "G" and a[i+j] != "C" and a[i+j] != "T":
			break
		tmp += 1
	if ans < tmp:
		ans = tmp
print(ans)

Measured memory_bytes: 3060
#include <stdio.h>

#define MAX 25
#define NIL -1
#define max(x,y) x > y ? x : y

typedef struct{
  int parent,left,right;
}TREE;

void print(TREE tree[],int i,int depth[],int height[]);
void SetDepth(TREE tree[],int root,int depth[],int p);
int SetHeight(TREE tree[],int root,int height[]);


int main(){
  TREE tree[MAX];
  int depth[MAX],height[MAX];
  int i;
  int n,id,left,right;
  int root;

  for (i = 0;i < MAX;i++){
    tree[i].parent = NIL;
    tree[i].left = NIL;
    tree[i].right = NIL;
    depth[i] = 0;
    height[i] = 0;
  }
  
  scanf("%d",&n);

  for (i = 0;i < n;i++){
    scanf("%d %d %d",&id,&left,&right);
    
    tree[id].left = left;
    tree[id].right = right;
    tree[left].parent = id;
    tree[right].parent = id;
  }

  for (i = 0;i < n;i++){
    if (tree[i].parent == NIL){
      root = i;
      break;
    }     
  }

  SetDepth(tree,root,depth,0);
  SetHeight(tree,root,height);

  for (i = 0;i < n;i++)
    print(tree,i,depth,height);
  
  return 0;
}

void print(TREE tree[],int i,int depth[],int height[]){
  int deg = 0;

  printf("node %d: ",i);
  printf("parent = %d, ",tree[i].parent);

  if (tree[i].parent == NIL)
    printf("sibling = -1, ");
  
  else if (i == tree[tree[i].parent].left)
  printf("sibling = %d, ",tree[tree[i].parent].right);

  else
    printf("sibling = %d, ",tree[tree[i].parent].left);

  if (tree[i].left != NIL)
    deg++;
  
  if (tree[i].right != NIL)
    deg++;

  printf("degree = %d, ",deg);
  printf("depth = %d, ",depth[i]);
  printf("height = %d, ",height[i]);

  if (tree[i].parent == NIL)
    printf("root\n");

  else if (tree[i].left != NIL || tree[i].right != NIL)
    printf("internal node\n");

  else
    printf("leaf\n");
}

void SetDepth(TREE tree[],int root,int depth[],int p){
  depth[root] = p;

  if(tree[root].left != NIL)
    SetDepth(tree,tree[root].left,depth,p + 1);

  if (tree[root].right != NIL)
    SetDepth(tree,tree[root].right,depth,p + 1);
}

int SetHeight(TREE tree[],int root,int height[]){
  int h1 = 0,h2 = 0;

  if (tree[root].left != NIL)
    h1 = SetHeight(tree,tree[root].left,height) + 1;

  if (tree[root].right != NIL)
    h2 = SetHeight(tree,tree[root].right,height) + 1;
    
  return height[root] = max(h1,h2);
}



Measured memory_bytes: 2100
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int main() {
	//read ans
	int N, M;
	cin >> N >> M;
	vector<vector<int>> Works(M);
	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		if (a > M) continue;
		else Works[a - 1].push_back(b);
	}
	long long ans = 0;
	priority_queue<int> Q;
	for (int i = 0; i < M; i++) {
		for (int w : Works[i]) Q.push(w);
		if (Q.empty()) continue;
		ans += Q.top();
		Q.pop();
	}
	cout << ans << endl;
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;

int main() {
    int n,k;
    cin>>n>>k;
    int arr[n+1];
    for(int i=1;i<=n;i++)
        cin>>arr[i];
    
    int dp[n+1][k+1];
    dp[0][0]=1;
    for(int i=1;i<=k;i++)
        dp[0][i] = 0;
    for(int i=1;i<=n;i++){
        vector<int> pref(k+1);
        pref[0] = dp[i-1][0];
        for(int j=1;j<=k;j++)
            pref[j] = (pref[j-1]+dp[i-1][j])%MOD;
        for(int j=0;j<=k;j++){
            if(arr[i]>=j)
                dp[i][j] = pref[j];
            else
                dp[i][j] = (pref[j] - pref[j-arr[i]-1]+MOD)%MOD;
        }
        pref.clear();
    }
    
    cout<<dp[n][k]<<"\n";
}

Measured memory_bytes: 43376
/**
 * @author: Mackenzie
**/
#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;

int main() {
#ifdef LOCALe
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    ll n, m;
    cin >> n >> m;
    if (n >= m / 2) {
        cout << m / 2 << endl;
    } else {
        cout << n + (m - 2 * n) / 4 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
ans = 10 ** 9
for i in range(1,N // 2 + 1):
  A = list(map(int,list(str(i))))
  B = list(map(int,list(str(N - i))))
  ans = min(ans, sum(A) + sum(B))
print(ans)  
  
  

Measured memory_bytes: 41960
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  int ans=1e9;
  string s;
  cin >> s;
  
  for(char a=0 ; a<='z'; a++) {
    
    int n=0,k=s.size();
    
    for(int i=s.size()-1; i>=0; i--) {
      if(s[i]==a) {
        k=i;
      }
      n=max(n,k-i);
    }
    ans=min(ans,n);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];

  int ans = 1e9;
  for (int x = -100; x <= 100; ++x){
    int diff = 0;
    for (int y : a) {
      diff += (x - y) * (x - y);
    }
    chmin(ans, diff);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    S = input().strip()
    L = input().strip()
    for i in range(max(len(S), len(L))):
        if i < len(S):
            print(S[i], end="")
        if i < len(L):
            print(L[i], end="")
    print()


if __name__ == '__main__':
    main()


Measured memory_bytes: 60652
import sys
sys.setrecursionlimit(10 ** 7)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

A, B = map(int, input().split())
x = gcd(A, B)
prime_list = prime_decomposition(x)
s = set(prime_list)
print(len(s)+1)


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

typedef long long ll;

int main(){
    ll n;
    cin>>n;
    
    int a[n], b[n], c[n-1], temp;

    for(int i=0;i<n;i++){
        cin>>temp;
        a[i] = temp-1;
    }

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

    for(int i=0;i<n-1;i++){
        cin>>c[i];
    }

    int prev = -2;
    int ans = 0;
    for(int i=0;i<n;i++){
        int d = a[i];
        if(prev == d - 1) ans += c[d-1];
        ans += b[d];
        prev = d;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int N, M, ans = 0;
	long long K;
	scanf("%d %d %lld", &N, &M, &K);
	long long A[N + 1], B[M + 1];
	A[0] = B[0] = 0;
	for (int i = 1; i <= N; ++i) scanf("%lld", &A[i]);
	for (int i = 1; i <= M; ++i) scanf("%lld", &B[i]);
	for (int i = 1; i <= N; ++i) A[i] += A[i - 1];
	for (int i = 1; i <= M; ++i) B[i] += B[i - 1];
	for (int i = 0; i <= N; ++i) {
		if (A[i] > K) break;
		int b = upper_bound(B, B + M + 1, K - A[i]) - B;
		ans = max(ans, i + b - 1);
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 4852
n,*a=$<.read.split.map(&:to_i)

res=[]
[-1,1].each do |x|
  now=tmp=0
  s=x
  a.each do |x|
    s=-s
    now+=x
    if (now^s<0 || now.zero?)
      tmp+=(s-now)*s
      now=s
    end

  end
  res << tmp
end
puts res.min


Measured memory_bytes: 9340
def abc170_d():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    Amax = A[-1]
    check = [False] * (Amax + 1)
    ans = 0
    for i in range(N):
        if check[A[i]]: continue
        if not(i < N-1 and A[i] == A[i+1]): ans += 1
        k = 1
        while k*A[i] <= Amax:
            check[k*A[i]] = True
            k += 1
    print(ans)

abc170_d()

Measured memory_bytes: 32192
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(ll n,ll m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];

int main() {
    FAST;
    ll a;
    string s;
    cin>>a>>s;
    ll b;
    b=(s[0]-'0')*100+(s[2]-'0')*10+(s[3]-'0');
    cout<<(a*b)/100;
    cout<<"\n";
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(ll n, ll m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

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

typedef struct { 
    char suit;
    int value;
} Card;

void bubbleSort(Card C[], int N) {
    int i, j;
    for (i = 0; i < N; i++) {
        for (j = N - 1; j > i; j--) {
            if (C[j].value < C[j-1].value) {
                Card tmp = C[j];
                C[j] = C[j-1];
                C[j-1] = tmp;
            }
        }
    }
}

void selectionSort(Card C[], int N) {
    int i, j, minj;
    for (i = 0; i < N; i++) {
        Card tmp;
        minj = i;
        for (j = i; j < N; j++) {
            if (C[j].value < C[minj].value) {
                minj = j;
            }
        }
        tmp = C[i];
        C[i] = C[minj];
        C[minj] = tmp;
    }
}

int equals(Card *c1, Card *c2) {
    if (c1->suit != c2->suit || c1->value != c2->value) {
        return 0;
    } else {
        return 1;
    }
}

void isStable(Card in[], Card out[], int N) {
    int i, j, a, b;
    for (i = 0; i < N - 1; i++) {
        for (j = i + 1; j < N - 1; j++) {
            for (a = 0; a < N - 1; a++) {
                for (b = a + 1; b < N - 1; b++) {
                    if (in[i].value == in[j].value && equals(&in[i], &out[b]) && equals(&in[j], &out[a])) {
                        printf("Not stable\n");
                        return;
                    }
                }
            }
        }
    }
    printf("Stable\n");
}

void trace(Card C[], int N) {
    int i;
    for (i = 0; i < N; i++) {
        if (i) printf(" ");
        printf("%c%d", C[i].suit, C[i].value);
    }
    printf("\n");
}

int main(void) {
    int i, N;
    Card in[36]; // 初期状態
    Card C1[36]; // バブルソート用
    Card C2[36]; // 選択ソート用
    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf(" %c%d", &in[i].suit, &in[i].value);
    }
    memcpy(C1, in, sizeof(in[0]) * N);
    memcpy(C2, in, sizeof(in[0]) * N);
    bubbleSort(C1, N);
    trace(C1, N);
    isStable(in, C1, N);
    selectionSort(C2, N);
    trace(C2, N);
    isStable(in, C2, N);
    return 0;
}



Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include<queue>
#include <sstream>
#include <set>
typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
using namespace std;
int main(){
    int N,A,B;cin >> N>>A >> B;

    cout << min(A,B)<<' ';

    int T = A+B;

    if(T-N>0){
        cout << T - N <<endl;
    }else{
        cout << 0 << endl;
    }

}

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

using namespace std;

#define M 100001

int n, h, a[M], b[M], c[M], ans, sum;

int main(){
    
    cin >> n >> h;
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
    sort(a, a + n, greater<int>());
    sort(b, b + n, greater<int>());
    partial_sum(b, b + n, c);
    ans = 1e9;
    for (int i = 0; i < n; i++){
        sum = i + 1;
        if (h-c[i] > 0){
            sum += (((h-c[i])%a[0] == 0)? (h-c[i])/a[0] : ((h-c[i])/a[0] + 1));
            ans = min(ans, sum);
        }
        else ans = min(ans, sum);
    }
    cout << ans;
    
}

Measured memory_bytes: 1408
import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
N = int(input())
arr = make_divisors(N)
# print(arr)
if len(arr) % 2 == 1:
    print(arr[-1]*2-2)
else:
    print(arr[-1]+arr[-2]-2)

Measured memory_bytes: 3288
#include<stdio.h>
#include<map>
#include<cmath>
#include<set>
#include<queue>
#include<algorithm>

using namespace std;

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

const int MX = 200005;
const int MM = 1000000007;

ll gcd(ll x, ll y){
	return y ? gcd(y, x%y) : x;
}

int main()
{
	int N;
	scanf("%d", &N);
	for(int i = 1; i <=	3500; i++){
		for(int j = i; j <= 3500; j++){
			ll x = 4*i*j - N*i - N*j;
			ll y = (ll)N*i*j;
			if( x <= 0 ) continue;
			ll g = gcd(x, y);
			x /= g, y /= g;
			if( x == 1 ) return !printf("%d %d %lld\n", i, j, y);
		}
	}
}


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

import math
limit = int(100 // 0.08 + 1)
for i in range(1,limit+1):
  v_a = i * 0.08
  v_b = i * 0.1
  if math.floor(v_a) == a and math.floor(v_b) == b:
    print(i)
    exit(0)

print(-1)


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

int n;
vector<int> x(10), y(10);

long double distance(int i, int j){
    long double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return sqrt(dx * dx + dy * dy);
}

int main(){
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> x[i] >> y[i];
    }

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

    long double total = 0.0;
    do{
        //cout << "x" << endl;
        for(int i=0; i<n-1; i++){
            total += distance(cities[i],cities[i+1]);
            //cout << cities[i] << " " << cities[i+1] << endl;
        }
    }while(next_permutation(cities.begin(),cities.end()));

    int factorial = 1;
    for(int i=1; i<=n; i++){
        factorial *= i;
    }

    cout << fixed << setprecision(10) << total / factorial << endl;
    return 0;
}

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

array<vector<int>, 2> linearsieve(int n){
	vector<int> lpf(n + 1), prime;
	prime.reserve(n + 1);
	for(int i = 2; i <= n; ++ i){
		if(!lpf[i]) lpf[i] = i, prime.push_back(i);
		for(int j = 0; j < int(prime.size()) && prime[j] <= lpf[i] && i * prime[j] <= n; ++ j){
			lpf[i * prime[j]] = prime[j];
		}
	}
	return {lpf, prime};
}

int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n;
	cin >> n;
	auto [lpf, prime] = linearsieve(n);
	vector<int> p(n + 1, 1), sigma(n + 1, 1);
	long long res = 1;
	for(auto k = 2; k <= n; ++ k){
		if(!(k / lpf[k] % lpf[k])){
			p[k] = p[k / lpf[k]] + 1;
		}
		sigma[k] = sigma[k / lpf[k]] / p[k] * (p[k] + 1);
		res += 1LL * k * sigma[k];
	}
	cout << res << "\n";
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 122852
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0}, dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	ll a[n];
	rep(i, n) cin >> a[i];
	bool ch = 0;
	rep(i, n) {
		if (a[i] == 0) ch = 1;
	}
	if (ch) {
		cout << 0 << endl;
		return 0;
	}
	ll m = 1000000000000000000;
	rep(i, n) m /= a[i];
	if (m < 1) {
		cout << -1 << endl;
		return 0;
	}
	ll ans = 1;
	rep(i, n) ans *= a[i];

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


Measured memory_bytes: 4428
N, M, L = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]
Q = int(input())
Y = [list(map(int, input().split())) for _ in range(Q)]

INF = 10 ** 9 + 7
graph = [[INF] * N for _ in range(N)]
count = [[INF] * N for _ in range(N)]
for i in range(N):
    graph[i][i] = 0
    count[i][i] = 0

for a, b, c in X:
    graph[a - 1][b - 1] = c
    graph[b - 1][a - 1] = c

for k in range(N):
    for i in range(N):
        for j in range(N):
            graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])

for i in range(N):
    for j in range(N):
        if i != j and graph[i][j] <= L:
            count[i][j] = 1

for k in range(N):
    for i in range(N):
        for j in range(N):
            count[i][j] = min(count[i][j], count[i][k] + count[k][j])

for s, t in Y:
    if count[s - 1][t - 1] == INF:
        print(-1)
    else:
        print(count[s - 1][t - 1] - 1)


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  set<int> q;
  int n;
  cin >> n;
  int a;
  for(int i=0;i<n;i++) {
    cin >> a;
    q.insert(a);
  }

  if(q.size() == n)
    cout << "YES\n";
  else
    cout << "NO\n";

  return 0;
}


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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n,a,b;
  cin>>n>>a>>b;
  int sum=0;
  for(int i=1;i<=n;i++){
    int j=i;
    int digit=0;
    while(j){
      digit+=j%10;
      j=j/10;
    }
    if(digit<=b && digit>=a){
      sum+=i;
    }

  }
  cout<<sum;


}

Measured memory_bytes: 256
from math import sqrt

li = []
N = int(input())
for _ in range(N):
    li.append(int(input()))

# li = [5, 2, 3, 4, 5, 6]
li = set(li)

count = 0
for v in li:
    if v == 2:
        count += 1
    elif v % 2 == 0:
        continue
    else:
        ubd = int(sqrt(v))
        flag = 1
        for i in range(3, ubd+1):
            if v % i == 0:
                flag = 0
                break
        count += flag

print(count)



Measured memory_bytes: 6604
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define int long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define each(i, x) for (auto &i : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-9;
ll mod = static_cast<ll>(1e9 + 7);
template <class T>
constexpr int sz(const T &a) { return (int)a.size(); }
template <class T>
constexpr T pow2(const T a) { return a * a; }
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class A, int N, class T>
void fillArray(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

template <typename F>
class FixPoint : private F {
public:
    explicit constexpr FixPoint(F &&f) noexcept : F(std::forward<F>(f)) {}
    template <typename... Args>
    constexpr decltype(auto)
    operator()(Args &&... args) const {
        return F::operator()(*this, std::forward<Args>(args)...);
    }
};

template <typename F>
static inline constexpr decltype(auto)
make_func(F &&f) noexcept {
    return FixPoint<F>{std::forward<F>(f)};
}

void solve() {
    string s;
    cin >> s;
    if (s == "ABC")
        cout << "ARC" << endl;
    else
        cout << "ABC" << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout.flush();
    return 0;
}


Measured memory_bytes: 3616
#pragma comment(linker, "/STACK:32000000")
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0, _= (n); i < _; ++i)
#define DWN(i, n) for (int i = (n) - 1; i >= 0; --i)
#define FOR(i, l, r) for (int i = (l), _ = (r); i < _; ++i)
#define EDGE(u, v, e) for (int e = head[u], v; e != nil && (v = to[e], true); e = next[e])

using namespace std;

typedef unsigned int uint;
typedef long long int64;
typedef unsigned long long uint64;
typedef complex<double> comp;

inline bool read(int& val)    { return scanf("%d",    &val) != -1;}
inline bool read(int64& val)  { return scanf("%I64d", &val) != -1;}
inline bool read(double& val) { return scanf("%lf",   &val) != -1;}
inline bool read(char* val)   { return scanf("%s",     val) != -1;}
template<class T1, class T2>
inline bool read(T1& a, T2& b)
{ return read(a) && read(b); }
template<class T1, class T2, class T3>
inline bool read(T1& a, T2& b, T3& c)
{ return read(a) && read(b) && read(c); }
template<class T1, class T2, class T3, class T4>
inline bool read(T1& a, T2& b, T3& c, T4& d)
{ return read(a) && read(b) && read(c) && read(d); }
template<class T1, class T2, class T3, class T4, class T5>
inline bool read(T1& a, T2& b, T3& c, T4& d, T5& e)
{ return read(a) && read(b) && read(c) && read(d) && read(e); }

const int nil = -1;
const int N = 211111;

long long val[N];
char op[N][3];

int main() {
//	freopen("test.txt", "r", stdin);
	int n; read(n);
	cin >> val[0];
	FOR (i, 1, n) cin >> op[i] >> val[i] ;
	long long sum = val[0];
	FOR (i, 1, n) {
		if (op[i][0] == '+') sum += val[i];
		if (op[i][0] == '-') sum -= val[i];
	}

	long long plus = 0, cost = 0;
	long long ans = sum;
	for (int i = n - 1; i > 0; i--) {
		if (op[i][0] == '+') cost += 2 * val[i];
		if (op[i][0] == '-') {
			ans = max(ans, sum + plus - cost);
			plus += 2 * val[i];
			cost = 0;
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;



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

	string a, b;
	cin >> a >> b;
	if (a.size() > b.size()) {
		cout << "GREATER" << endl;
	}
	else if (a.size() < b.size()) {
		cout << "LESS" << endl;
	}
	else {
		int t = a.size();
		rep(i, t) {
			if (a[i] != b[i]) {
				if (a[i] > b[i]) {
					cout << "GREATER" << endl;
				}
				else {
					cout << "LESS" << endl;
				}
				return 0;
			}
		}
		cout << "EQUAL" << endl;
	}

	return 0;
}


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

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

int N;
string S;

signed main()
{
    cin >> N;
    cin >> S;

    int ans = 0;
    rep(i,1000)
    {
        int mem = 1;
        rep(j,N)
        {
            if('0' + ((i / mem) % 10) == S[j])
            {
                mem *= 10;
                if(mem == 1000)
                {
                    ans++;
                    break;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3644
n = gets.to_i
a = []
a += gets.split.map(&:to_i) until a.size == n
h = {}
(0..n-1).each do |i|
  x = 0
  (i..n-1).each do |j|
    x = x * 10 + a[j]
    h[x] = 1
  end
end
0.upto(Float::INFINITY) do |i|
  if !h[i]
    p i
    break
  end
end


Measured memory_bytes: 127200
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());//昇順ソート
#define usort(a) sort(a.rbegin(),a.rend());//降順ソート

using namespace::std;

int jo(ll int a, ll int b){//累乗
    ll int num=1;
    rep(i,0,b) num=num*a;
    return num;
}
char tobig(char s){//char大文字化
  return (s-0x20);
}
char tolow(char s){//char小文字化
  return (s+0x20);
}
int ctoi(char a){//char->int
  if('0'<=a&&a<='9') return (a-'0');
  return -1;
}

int gcd(ll int a,ll int b) {//最大公約数
  if(a<b) return gcd(b,a);
  int c;
  while ((c=a%b)) {
    a=b;
    b=c;
  }
  return b;
}
int lcm(ll int a,ll int b){//最小公倍数
 return (a*b)/gcd(a,b);
}


int main(){
  int N,K; cin>>N>>K;
  if((N+1)/2>=K) cout<<"YES";
  else cout<<"NO";
}




// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順


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

// max, min, log, input is defined

using namespace std; 

int main(){
	int n, cou=0;
	int mini = 2e9;
	char s[300100];
	int delE[300100];
	int delW[300100];
	cin >> n;
	cin >> s;
	
	// 0 is leader
	for (int i = 1; i < n; ++i)
	{
		if (s[i]=='E') cou++;
	}
	delW[0] = cou;
	delE[0] = 0;
	cou = 0;

	// i is leader
	for (int i = 1; i < n; ++i)
	{
		if (s[i-1] == 'W') cou++;
		delE[i] = delE[i-1] + cou;
		cou = 0;
		if (s[i] == 'E') cou++;
		delW[i] = delW[i-1] - cou;
		cou = 0;
	}

	for (int i = 0; i < n; ++i)
	{
		mini = min(mini, delW[i]+delE[i]);
	}
	cout << mini;
	return 0;
}

Measured memory_bytes: 2944