akhauriyash/Code-Regression huggingface dataset:
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

const int maxn = 5010, mod = (int) 1e9 + 7;

int mul(int a, int b) {
  return (long long) a * b % mod;
}

void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

int f[maxn], inv[maxn], finv[maxn];

void precalc() {
  f[0] = 1;
  for (int i = 1; i < maxn; i++) {
    f[i] = mul(f[i - 1], i);
  }
  inv[1] = 1;
  for (int i = 2; i < maxn; i++) {
    inv[i] = (mod - (long long) (mod / i) * inv[mod % i] % mod) % mod;
  }
  finv[0] = 1;
  for (int i = 1; i < maxn; i++) {
    finv[i] = mul(finv[i - 1], inv[i]);
  }
}

int n;
int a, b, c;

int read() {
  if (scanf("%d%d%d%d", &n, &a, &b, &c) < 4) {
    return false;
  }
  return true;
}

int dpbc[maxn / 2][maxn];

void solve() {
  if (b & 1) {
    printf("0\n");
    return;
  }
  for (int i = 0; i <= c; i++) {
    dpbc[0][i] = 0;
  }
  dpbc[0][0] = 1;
  for (int i = 0; i < b / 2; i++) {
    int sum = 0;
    for (int j = 0; j <= c; j++) {
      add(sum, dpbc[i][j]);
      dpbc[i + 1][j] = sum;
    }
  }
  int res = 0;
  for (int cnta = 0; cnta <= a; cnta++) {
    int cntac = a - cnta;
    if (cntac > c) {
      continue;
    }
    int cc = c - cntac;
    for (int cntc = 0; cntc * 3 <= cc; cntc++) {
      int ccc = cc - cntc * 3;
      int segs = cnta + cntac + cntc + b / 2;
      add(res, mul(mul(f[segs], mul(mul(finv[cnta], finv[cntac]), mul(finv[cntc], finv[b / 2]))), dpbc[b / 2][ccc]));
    }
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef LOCAL
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


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

#define REP(i, n) for(int i=0;i<n;i++)
#define REPR(i, n) for(int i=n;i>0;i--)
#define FOR(i, j, n) for(int i=j;i<n;i++)
#define COUT(n) cout<<(n)<<"\n"

typedef long long ll;
const int INF = 1e9;

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

    int n, d; cin >> n >> d;

    int tmp = (n % (2*d + 1) == 0 ? 0 : 1);

    COUT(n / (2*d + 1) + tmp);

    return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int n;
	cin >> n;
	int tall[6] = {};
	double x;
	for (int i = 0; i < n; i++) {
		cin >> x;
		if (x < 165.0)tall[0]++;
		else if (165.0 <= x&&x < 170.0)tall[1]++;
		else if (170.0 <= x&&x < 175.0)tall[2]++;
		else if (175.0 <= x&&x < 180.0)tall[3]++;
		else if (180.0 <= x&&x < 185.0)tall[4]++;
		else if (185.0 <= x)tall[5]++;
	}
	for (int i = 0; i < 6; i++) {
		cout << i + 1 << ':';
		for (int j = 0; j < tall[i]; j++)cout << '*';
		cout << endl;
	}
	return 0;
}

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

using namespace std;

const int MAX_N = 1e4 + 5;

vector<int> adj [MAX_N];
int ans [MAX_N];
int arr [MAX_N];
int lvl [MAX_N];

void dfs (int u, int p) {
  lvl[u] = lvl[p] + 1;
  for (int nxt : adj[u]) {
    if (nxt != p) {
      dfs(nxt, u);
    }
  }
}

int main () {
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;

    adj[u].push_back(v);
    adj[v].push_back(u);
  }

  int sum = 0, mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
    mx = max(mx, arr[i]);
  }

  sort(arr, arr + n, greater<int>());

  dfs(1, 0);
  
  vector<pair<int, int>> ord;
  for (int i = 1; i <= n; i++) {
    ord.push_back(make_pair(lvl[i], i));
  }
  sort(ord.begin(), ord.end());

  for (int i = 0; i < n; i++) {
    ans[ord[i].second] = arr[i];
  }

  cout << sum - mx << '\n';
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << '\n';
}


Measured memory_bytes: 4856
#include<stdio.h>
#include<stdlib.h>
#include <math.h>
#include<string.h>
#include<limits.h>

int main(){
	double a1=0,a2=0,a3=0,b1=0,b2=0,b3=0;
	double x[3],y[3];
	double y1,y2,y3,x1,x2,x3;
	double xp,yp,A=0,B=0,C=0;
	int i,j;
	
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&xp,&yp)!=EOF){
	
	if(y[0]<=y[1] && y[0]<=y[2]){
		y1=y[0];
		x1=x[0];
		if(y[1]<=y[2]){
			y2=y[1];
			x2=x[1];
			y3=y[2];
			x3=x[2];
		}
		else{
			y3=y[1];
			x3=x[1];
			y2=y[2];
			x2=x[2];
		}
	}
	else if(y[1]<=y[0] && y[1]<=y[2]){
		y1=y[1];
		x1=x[1];
		if(y[0]<=y[2]){
			y2=y[0];
			x2=x[0];
			y3=y[2];
			x3=x[2];
		}
		else {
			y3=y[0];
			x3=x[0];
			y2=y[2];
			x2=x[2];
		}
	}
	else if(y[2]<=y[0] && y[2]<=y[1]){
		y1=y[2];
		x1=x[2];
		if(y[1]<=y[0]){
			y2=y[1];
			x2=x[1];
			y3=y[0];
			x3=x[0];
		}
		else {
			y3=y[1];
			x3=x[1];
			y2=y[0];
			x2=x[0];
		}
	}
	if(x1!=x2){
		a1=(y1-y2)/(x1-x2);
		b1=y1-a1*x1;
		A=a1*xp+b1;
	}
	if(x2!=x3){
		a2=(y2-y3)/(x2-x3);
		b2=y2-a2*x2;
		B=a2*xp+b2;
	}
	if(x3!=x1){
		a3=(y3-y1)/(x3-x1);
		b3=y3-a3*x3;
		C=a3*xp+b3;
	}
		
	if(a1>=0 && a2>0 && a3>0 || a1<=0 && a2<0 && a3<0){//ok
		if(A<yp && B<yp && C>yp)printf("YES\n");
		else printf("NO\n");
	}
	else if(a1>=0 && a2<0 && a3>0 || a1<=0 && a2>0 && a3<0){//ok
		if(A<yp && B>yp && C>yp)printf("YES\n");
		else printf("NO\n");
	}
	else if(a1>=0 && a2<0 && a3<0 || a1<=0 && a2>0 && a3>0){//ok
		if(A<yp && B>yp && C<yp)printf("YES\n");
		else printf("NO\n");
	}
	else if(x1==x2 && a2==0 && a3<0){
		if(x1>xp && y2>yp && C<yp)printf("YES\n");
		else printf("NO\n");
	}
	else if(x1==x2 && a2==0 && a3>0){
		if(x1<xp && y2>yp && C<yp)printf("YES\n");
		else printf("NO\n");
	}
	else if(x1==x3 && a2==0 && a1<0){
		if(x1>xp && y2>yp && A<yp)printf("YES\n");
		else printf("NO\n");
	}
	else if(x1==x3 && a2==0 && a1>0){
		if(x1<xp && y2>yp && A<yp)printf("YES\n");
		else printf("NO\n");
	}
	else if(a1==0 && x2==x3 && a3>0){//ok
		if(x2>xp && y2<yp && C>yp)printf("YES\n");
		else printf("NO\n");
	}
	else if(a1==0 && x1==x3 && a2>0){
		if(x1>xp && y2<yp && B>yp)printf("YES\n");
		else printf("NO\n");
		printf("m");
	}
	else if(a1==0 && x1==x3 && a2<0){
		if(x1<xp && y2<yp && B>yp)printf("YES\n");
		else printf("NO\n");
		
	}
	else if(a1==0 && x2==x3 && a3<0){//ok
		if(x2<xp && y2<yp && C>yp)printf("YES\n");
		else printf("NO\n");
	}
	else printf("NO\n");

		A=0;
		B=0;
		C=0;
		a1=0;
		a2=0;
		a3=0;
		b1=0;
		b2=0;
		b3=0;
	}
return 0;
}

Measured memory_bytes: 612
import java.util.Scanner;
class Main {

	public static void printarray(int[] a,int n){
    	for(int f=0;f<n;f++){
    		if(f<n-1)System.out.print(a[f]+" ");
    		else System.out.println(a[f]);
    	}
	}

	public static void scanarray(int[] a,int n, Scanner s){
    	for(int i=0;i<n;i++){
    		a[i] = s.nextInt();
    	}
	}

    public static void main(String args[]) {
    	Scanner scan = new Scanner(System.in);
    	int n = scan.nextInt();
    	int a[] = new int[n];
    	int val;

    	scanarray(a,n,scan);
    	printarray(a,n);

    	int v;
    	int j;
    	for(int i=1;i<n;i++){
    		v=a[i];
    		j=i-1;
    		while(j>=0 && a[j]>v){
    			a[j+1]=a[j];
    			j--;
    		}
    		a[j+1]=v;

    		printarray(a,n);
    	}
    }
}

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

int main(){
    string S; cin >> S;
    for (int i=0; i<S.length(); i++){
        S[i]='x';
    }
    cout << S;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 100000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}

//sは初めの点、vは頂点size、dは最短距離を求める(初期化はINF),Gは有向グラフ
void dijkdtra(int s, int v, vector<int>& d, whei(edge)& G) {
	priority_queue<Pint, vector<Pint>, greater<Pint>> que;//firstが距離、secondが頂点
	d[s] = 0;//スタートの距離はもちろんzero
	que.push(Pint(0, s));
	while (!que.empty()) {
		Pint p = que.top();
		que.pop();
		int V = p.second;
		if (d[V] < p.first)continue;
		for (int i = 0; i < G[V].size(); i++) {
			edge e = G[V][i];
			if (d[e.to] > d[V] + e.cost) {
				d[e.to] = d[V] + e.cost;
				que.push(Pint(d[e.to], e.to));
			}
		}
	}
}


int main() {
	int n, k;
	cin >> n >> k;
	rep(i, 0, k) {
		llint ans = c(n - k + 1, i + 1, mod) * c(k - 1, i, mod) % mod;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys
si = sys.stdin.readline


def main():
    h = {2, 4, 5, 7, 9}
    p = {0, 1, 6, 8}
    b = {3}
    n = int(si()[:-1][-1])
    if n in h:
        print('hon')
    elif n in p:
        print('pon')
    else:
        print('bon')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9124
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
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; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll dp[100007];

int main(){
  ll N,H[100007];
  cin >> N;
  rep(i,N){
    cin >> H[i];
  }
  dp[0]=0;
  dp[1]=abs(H[1]-H[0]);
  Rep(i,2,N){
    dp[i]=min(dp[i-1]+abs(H[i]-H[i-1]),dp[i-2]+abs(H[i]-H[i-2]));
  }
  cout << dp[N-1] << endl;
}

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

#define ll  long long
#define PII pair<ll,ll>
#define VI  vector<ll>
#define VB  vector<bool>
#define VC  vector<char>
#define VVI vector<vector<ll>>
#define VVC vector<vector<char>>
#define VS  vector<string>
#define VP  vector<PII>
#define lf(i,a,b) for(ll i=a;i<=b;i++)
#define lr(i,a,b) for(ll i=a;i>=b;i--)
#define lfl(i,v) for(ll i=0;i<v.size();i++)
#define lrl(i,v) for(ll i=(ll)(v.size())-1;i>=0;i--)
#define chk2(a,b) cout<<"check :  "<<a<<" "<<b<<endl
#define chk3(a,b,c) cout<<"check :  "<<a<<" "<<b<<" "<<c<<endl
#define chk4(a,b,c,d) cout<<"check :  "<<a<<" "<<b<<" "<<c<<" "<<d<<endl
#define chk5(a,b,c,d,e) cout<<"check :  "<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl
#define l_b(v,k)  lower_bound(v.begin(),v.end(),k)-v.begin()
#define u_b(v,k)  upper_bound(v.begin(),v.end(),k)-v.begin()
#define mod 1000000007
#define sort(v) sort(v.begin(),v.end())
#define p_b push_back
#define p_f push_front
#define m_p make_pair
#define fir first
#define sec second
#define sz size()


int main() 
{	ll T;
	T=1;
	while(T--)
	{	float d,t,s;
		cin>>d>>t>>s;
		if((d/s)<=t)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}  		
}      


Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin >> s;
  if(s == "ABC")
  {
    cout << "ARC\n";
  }
  else if(s == "ARC")
  {
    cout << "ABC\n";
  }
  return 0;
}  

Measured memory_bytes: 3620
#include<cstdio>
#include<algorithm>
#include<map>
#define ll long long
using namespace std;
map<ll, int> mp;
map<ll, int> mp1;
ll a[200010];
int main()
{
	ll n;
	scanf("%lld", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
		mp[a[i]]++;
	}
	int sum = 0;
	sort(a, a + n);
	for (int i = n-1; i>=0; i--) {
		if (mp[a[i]] == 0)continue;
		for (int y = 0; y <= 30; y++) {
			ll ch = (1 << y) - a[i];
			if (ch > 0) {
				ll t = mp[ch];
				if (t)
				{
					if (a[i] == ch&&t == 1)continue;
					mp[ch]--;
					mp[a[i]]--;
					sum++;
				}
				break;
			}
		}
	}
	printf("%d", sum);
}

Measured memory_bytes: 26752
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<map>
#define int long long
const int mx = 1e5+5;
using namespace std;
main()
{
	//freopen("input.txt","rt",stdin);
	int a,b;
	cin>>a>>b;
	if(a >= 13)
	{
		cout<<b<<endl;
	}
	else if (a >=6 && a <= 12)
	{
		cout<<b/2<<endl;
	}
	else
	{
		cout<<"0"<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,x;
  cin >> a >> b;
  x = a * b % 2;
  if (x == 1){
    cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <numeric>


int main() {
	long long a, b;

	std::cin >> a >> b;

	if ((a + b) % 2 == 0) {
		std::cout << (a + b) / 2 << std::endl;
	}
	else {
		std::cout << "IMPOSSIBLE" << std::endl;
	}


	return 0;
}

Measured memory_bytes: 256
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
import java.util.*;
/**
 *
 * @author arvin
 */
public class Main {
    
    static ArrayList<Integer> a[];
    static int b[];
    static long dp[];
    
    static long dfs(int x)
    {
        //if(x==4)
          //  System.out.print("s");
        long val=0l;
        for(int k=0;k<a[x].size();k++)
        {
            long ch;
            if(dp[a[x].get(k)]==0)
                ch=dfs(a[x].get(k));
            else
                ch=dp[a[x].get(k)];
            //dp[a[x].get(k)]=ch+1;
            val=Math.max(ch,val);
        }
        dp[x]=val+1;
        return dp[x];
    }
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        a=new ArrayList[n+1];
        b=new int[n+1];
        dp=new long[n+1];
        for(int i=0;i<=n;i++)
            a[i]=new ArrayList<>();
        for(int i=0;i<m;i++)
        {
            int x=sc.nextInt();
            int y=sc.nextInt();
            a[x].add(y);
            b[y]=1;
        }
        long ans=0l;
        for(int i=1;i<=n;i++)
            if(b[i]==0)
                ans=Math.max(dfs(i),ans);
        System.out.println(ans-1);
        /*for(int i=0;i<=n;i++)
            System.out.print(dp[i]+" ");
        System.out.print("\n");
        for(int i=0;i<=n;i++)
            System.out.print(b[i]+" ");*/
        sc.close();
    }
}


Measured memory_bytes: 102868
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

int[][10^^5+1] GP;
bool[10^^5+1] CS;
int[10^^5+1] PS;

int find_path(int N)
{
    auto ss = [[0, 0]];
    for (;;) {
        auto h = ss[0];
        auto i = h[0];
        auto s = h[1];
        ss = ss[1..$];
        
        PS[i] = s;

        if (s == N-1) return i+1;

        foreach (n; GP[s]) {
            if (CS[n]) continue;
            CS[n] = true;
            ss = [[i+1, n]] ~ ss;
        }
    }
}

int count_path(int s)
{
    if (CS[s]) return 0;
    CS[s] = true;
    auto r = 1;
    foreach (n; GP[s]) r += count_path(n);
    return r;
}

void main()
{
    auto N = readln.chomp.to!int;

    foreach (_; 0..N-1) {
        auto ab = readln.split.to!(int[]);
        auto a = ab[0] - 1;
        auto b = ab[1] - 1;
        GP[a] ~= b;
        GP[b] ~= a;
    }

    auto m = find_path(N);
    auto path = PS[0..m];
    CS[] = false;
    foreach (p; path) CS[p] = true;
    int f, s;
    foreach (p; path[0..($+1)/2]) {
        f += 1;
        foreach (n; GP[p]) f += count_path(n);
    }
    foreach (p; path[($+1)/2..$]) {
        s += 1;
        foreach (n; GP[p]) s += count_path(n);
    }

    writeln(f > s ? "Fennec" : "Snuke");
}

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

typedef long long ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define debug(x) cerr << #x << ": " << x << '\n'

int main()
{
    int N, K;
    cin >> N >> K;
    int h;
    int ans = 0;
    rep(i, N)
    {
        cin >> h;
        if (h >= K)
        {
            ++ans;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use std::cmp::min;

#[fastout]
fn main() {
    input! {
    n: usize,
    k: usize,
    s: Chars
    }
    let mut score = 0;
    for i in 0..n - 1 {
        if s[i] == s[i + 1] { score += 1 }
    }
    let ans = min(score + 2 * k, n - 1);
    println!("{}", ans);
}



Measured memory_bytes: 2532
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <limits.h>
#include <memory.h>


using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef vector<double> vec;
typedef vector<vec> mat;

int x[105];

int main() {

	int n,k;
	cin>>n>>k;
	FORI(0,n)
		cin>>x[i];
	int ans=0;
	FORI(0,n)
		ans+=2*min(x[i],k-x[i]);
	cout << ans << endl;
	
	return 0;
}




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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  int64_t a, b, c;
  cin >> a >> b >> c;

  int64_t a0 = a, b0 = b, c0 = c;
  int i = 0;
  while (!(a % 2) && !(b % 2) && !(c % 2)) {
    ++i;
    int64_t bc = (b + c) / 2, ca = (c + a) / 2, ab = (a + b) / 2;
    a = bc;
    b = ca;
    c = ab;
    if (a == a0 && b == b0 && c == c0) {
      cout << -1 << '\n';
      return 0;
    }
  }
  cout << i << '\n';

  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(a) for a in input().split()]

A.sort()
j = 0
cnt = 0
for i in range(1, N+1):
    if j < 0:
        print(0)
        continue
    cnt = 0
    while A[j] == i:
        j += 1
        cnt += 1
        if j == N-1:
            j = -1
            break
    print(cnt)

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

int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;

  ll cntR = 0, cntG = 0, cntB = 0;
  rep(i, n) {
    if (s[i] == 'R') cntR++;
    else if (s[i] == 'G') cntG++;
    else if (s[i] == 'B') cntB++;
  }

  ll ans = cntR * cntG * cntB;


  rep(i, n) {
    repI(j, i+1, n) {
      int k = 2*j - i;
      if (k >= n) break;
      if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) ans--;
    }
  }

  cout << ans << endl;

  return 0;
}


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

vector<string> ans;
void solve(int num,string& s){
  if(num==0){
    ans.push_back(s);
    return;
  }
  char tar=(num-1)+'a';
  char tmp=num+'a';
  for(int i=0;i<s.size();i++){
    if(s[i]==tmp){
      return;
    }
    if(s[i]==tar){
      s[i]=tmp;
      solve(num-1,s);
      s[i]=tar;
    }
  }
  solve(num-1,s);
  return;
}

int main(){
  string s;
  while(cin>>s,s!="#"){
    ans.clear();
    solve('z'-'a',s);
    cout<<ans.size()<<endl;
    sort(ans.begin(),ans.end());
    if(ans.size()<=10){
      for(int i=0;i<ans.size();i++){
	cout<<ans[i]<<endl;
      }
    }
    else{
      for(int i=0;i<5;i++) cout<<ans[i]<<endl;
      for(int i=ans.size()-5;i<ans.size();i++) cout<<ans[i]<<endl;
    }

  }
  return 0;
}


Measured memory_bytes: 4180
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
ll modexpo(ll a,ll b)
{
     ll ans=1LL;
     while(b>0)
     {
          if(b&1)ans=(ans*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return ans;
}
 
 
 
 
 
 
 







int last[200005];
int main(){
     int n;
     cin>>n;
     int a[n];
     for(int i=0;i<n;i++)cin>>a[i];
     memset(last,-1,sizeof(last));
     ll dp[n+1]={0};
     dp[0]=1;
     for(int i=0;i<n;i++){
          if(last[a[i]]==-1){
               dp[i+1]=dp[i];
               last[a[i]]=i+1;
          }
          else if(last[a[i]]!=-1){
               if(last[a[i]]!=i)
               dp[i+1]=(dp[i]+dp[last[a[i]]])%mod;
               else dp[i+1]=dp[i];
               last[a[i]]=i+1;
          }
     }
     cout<<dp[n];
}






































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

int main() {
  string n;
  cin >> n;
  
  if(n.at(0)==n.at(1) and n.at(1)==n.at(2)){
    cout << "Yes" << endl;
  }
  else if(n.at(1)==n.at(2) and n.at(2)==n.at(3)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

const int MOD = int(1E9) + 7;
const int MAXM = 100000;

inline int add(int x, int y) {return (x + y >= MOD ? x + y - MOD : x + y);}
inline int sub(int x, int y) {return (x - y < 0 ? x - y + MOD : x - y);}
inline int mul(int x, int y) {return 1LL * x * y % MOD;}

struct matrix{
    int m[3][3], r, c;
    matrix() {memset(m, 0, sizeof m);}
	friend matrix operator + (matrix A, matrix B) {
	    matrix C; C.r = A.r, C.c = B.c;
	    for(int i=0;i<C.r;i++)
			for(int j=0;j<C.c;j++)
				C.m[i][j] = add(A.m[i][j], B.m[i][j]);
	    return C;
	}
	friend matrix operator * (matrix A, matrix B) {
	    matrix C; C.r = A.r, C.c = B.c;
	    for(int i=0;i<C.r;i++)
	        for(int k=0;k<A.c;k++)
				for(int j=0;j<C.c;j++)
					C.m[i][j] = add(C.m[i][j], mul(A.m[i][k], B.m[k][j]));
	    return C;
	}
	friend matrix mpow(matrix A, int p) {
	    matrix ret; ret.r = ret.c = A.r;
	    for(int i=0;i<ret.r;i++)
	        for(int j=0;j<ret.c;j++)
	            ret.m[i][j] = (i == j);
	    while( p ) {
	        if( p & 1 ) ret = ret*A;
	        A = A*A;
	        p >>= 1;
	    }
	    return ret;
	}
}A, B, S;

void init() {
	A.r = A.c = 3;
	A.m[0][0] = 4, A.m[0][1] = MOD - 2, A.m[0][2] = 1;
	A.m[1][0] = A.m[2][1] = 1;
	B.r = 3, B.c = 1;
	B.m[0][0] = 5, B.m[1][0] = 1, B.m[2][0] = 0;
}

matrix get(int x) {
	matrix R; R.r = R.c = 3;
	R.m[0][0] = R.m[1][1] = R.m[2][2] = x;
	return R;
}

int f[MAXM + 5], X[MAXM + 5], N, M;
int main() {
	init(); scanf("%d%d", &N, &M);
	for(int i=1;i<=M;i++) scanf("%d", &X[i]);
	X[M + 1] = N, f[0] = -1, S = get(sub(0, f[0]));
	for(int i=1;i<=M+1;i++) {
		S = S * mpow(A, X[i] - X[i-1]);
		f[i] = (S*B).m[2][0];
		S = (S + get(sub(0, f[i])));
	}
	printf("%d\n", (S*B).m[2][0]);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std ;
const int N = 605 ;
char a[N][N] ;
char b[N][N] ;

typedef pair<long long,long long> pll ;

long long B[] = {12582917 , 25165843} ;
//long long B[] = {10, 25165843} ;
long long MOD[] = {50331653,100663319} ;

long long hashing[N][N][2] ;
long long BP[N] ;

void init (int n) {
    for (int i = 0 ; i < n ; i++) {
        for (int j = 0 ; j < n ; j++) {
            hashing[i][j][0] = ( (j ? hashing[i][j-1][0] : 0)*B[0] + a[i][j]-'a'+1 ) % MOD[0] ;
            hashing[i][j][1] = ( (j ? hashing[i][j-1][1] : 0)*B[0] + b[i][j]-'a'+1 ) % MOD[0] ;
        }
    }

    BP[0] = 1 ;
    for (int i = 1 ; i < N ; i++) {
        BP[i] = BP[i-1]*B[0] ;
        BP[i] %= MOD[0] ;
    }
}


long long H (int l , int r , int row , int idx) {
    long long h1 = ( hashing[row][r][idx] - ( l ? (hashing[row][l-1][idx]*BP[r-l+1]) : 0 ) %MOD[0] ) % MOD[0] ;
    //long long h2 = ( hashing[row][r][idx][1] - ( l ? (hashing[row][l-1][idx][1]*BP[r-l+1][1]) : 0 ) %MOD[1] ) % MOD[1] ;
    h1 += MOD[0] ;
    //h2 += MOD[1]  ;
    h1 %= MOD[0] ;
    //h2 %= MOD[1] ;
    return h1 ; // ; {h1,h2} ;
}


int main () {
   // freopen ("in.txt" , "r" , stdin) ;
    int n ; scanf("%d" , &n) ;
    for (int i = 0 ; i < n ; i++) {
        scanf("%s" , a[i]) ;
        for (int j = n ; j < 2*n - 1 ; j++) {
            a[i][j] = a[i][j-n] ;
        }
        a[i][2*n-1] = '\0' ;
    }
    for (int j = n ; j < 2*n - 1 ; j++) {
        strcpy(a[j],a[j-n]) ;
    }
    for (int i = 0 ; i < 2*n - 1 ; i++) {
        for (int j = 0 ; j < 2*n - 1 ; j++) {
            b[i][j] = a[j][i] ;
        }
    }

    init(2*n-1) ;

    /*for (int i = 0 ; i < 2*n - 1 ; i++) {
        printf ("%s\n" , a[i]) ;
    }*/

    int ans = 0 ;

    for (int i = 0 ; i < n ; i++) {
        for (int j = 0 ; j < 1 ; j++) {
            int flag = 1 ;
            for (int k = 0 ; k < n ; k++) {
                if (H(j,j+n-1,i+k,0) != H(i,i+n-1,j+k,1)) {
                    flag = 0 ;
                    break ;
                }
            }
            ans += flag ;
        }
    }

    cout << ans*n << endl ;

}


Measured memory_bytes: 6656
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let [a,b,k] = nextIntArray()
    let large = a > b ? a:b
    let small = a < b ? a:b
    let arr = []
    for(let i = 1; i<=large; i++){
        if(a % i == 0 && b % i == 0) arr.push(i)
    }
    console.log(arr[arr.length-k])
}
Main()


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

/*-------------------Define Start-------------------*/
typedef bool BL;    					// 布尔类型
typedef char SB;    					// 有符号1字节,8位
typedef unsigned char UB;    			// 无符号1字节,8位
typedef short SW;    					// 有符号短整型,16位
typedef unsigned short UW;    			// 无符号短整型,16位
typedef long SDW;    					// 有符号整型,32位
typedef unsigned long UDW;   			// 无符号整型,32位
typedef long long SLL;    				// 有符号长整型,64位
typedef unsigned long long ULL;			// 无符号长整型,64位
typedef char CH;    					// 单个字符
typedef float R32;    					// 单精度浮点数
typedef double R64;    					// 双精度浮点数

#define Rep(i, n) for (register SDW i = 0; i < (n); ++i)
#define For(i, s, t) for (register SDW i = (s); i <= (t); ++i)
#define rFor(i, t, s) for (register SDW i = (t); i >= (s); --i)
#define foreach(i, c) for (__typeof(c.begin()) i = c.begin(); i != c.end(); ++i)
#define ms0(a) memset(a,0,sizeof(a))
#define msI(a) memset(a,0x7f,sizeof(a))
#define LOWBIT(x) ((x)&(-x))

#define MP make_pair
#define PB push_back
#define ft first
#define sd second

#define pr(x) cout << #x << " = " << x << "  "
#define prln(x) cout << #x << " = " << x << endl

const ULL mod = 1e9 + 7;				//常用模数(可根据题目需要修改)
const ULL inf = 0x7fffffff;				//用来表示无限大
const ULL infLL = 0x7fffffffffffffffLL;	//用来表示无限大
/*-------------------Define End-------------------*/

const UDW maxN = 1e6 + 7;
string S, T;
UDW A, B;
string U;

void input(){
	cin >> S >> T >> A >> B >> U;
}

void solve(){
	if(S == U) {
		--A;
	}
	else if(T == U){
		--B;
	}
}

void output(){
	cout << A << " " << B << endl;
}

int main() {
	input();
	solve();
	output();
	return 0;
}

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

int main() {
  int n,k;
  cin >> n >> k;
  string s;
  cin >> s;
  
  s[k-1] += 0x20;
  cout << s << endl;
  return 0;
}


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

public class Main {
	private static void solve(){
		//Implement solution here.
		String s = next();
		int result = Integer.MAX_VALUE;
		for(int i = 0; i < s.length() - 2; i++) {
			char[] ca = new char[3];
			ca[0] = s.charAt(i);
			ca[1] = s.charAt(i + 1);
			ca[2] = s.charAt(i + 2);
			result = Math.min(result, Math.abs(Integer.parseInt(new String(ca)) - 753));
		}
		System.out.println(result);		
	}

	//Switch input source (stdin/file)
	private static Scanner scanner = new Scanner(System.in);
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				scanner = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath)))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(scanner.nextLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////



int main(){fastio
    ll n;cin>>n;
    vector<l_l>v[n];
    rep(i,1,n-1){
        ll a,b,c;cin>>a>>b>>c;a--;b--;
        v[a].pb(l_l(b,c));
        v[b].pb(l_l(a,c));
    }
    ll c[n];memset(c,-1,sizeof(c));
    c[0]=0;
    queue<ll>q;q.push(0);
    while(!q.empty()){
        ll t=q.front();q.pop();
        for(auto x:v[t]){
            ll ver=x.first;
            ll wei=x.second;
            if(c[ver]==-1){
                c[ver]=(c[t]+wei)&1;
                q.push(ver);
            }
        }
    }
    
    rep(i,0,n-1){
        cout<<c[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 8704
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 2e5 + 30, Mod = 1e9 + 7;
const ll SQ = 330;

int main () {
    ios::sync_with_stdio(0), cin.tie(0);
    ll s, w;
    cin >> s >> w;
    if (w >= s) cout << "unsafe";
    else cout << "safe";
    return (0);
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int maxNum = max({a,b,c});
  int ans = 0;
  ans += (maxNum - a) / 2;
  a += int((maxNum - a) / 2) * 2;
  ans += (maxNum - b) / 2;
  b += int((maxNum - b) / 2) * 2;
  ans += (maxNum - c) / 2;
  c += int((maxNum - c) / 2) * 2;
  if(maxNum * 3 - 1 == a + b + c){
    cout << ans + 2 << endl;
  }else if(maxNum * 3  - 2 == a + b + c){
    cout << ans + 1 << endl;
  }else{
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    def inv(a):
        a_sort = sorted(list(set(a)))
        n = len(a_sort) + 1
        bit = [0] * n
        tento = 0
        for ai, ak in enumerate(a):
            wa = 0
            i = ii = a_sort.index(ak) + 1
            while i:
                wa += bit[i]
                i -= i & -i
            tento += ai - wa
            while ii < n:
                bit[ii] += 1
                ii += ii & -ii
        return tento

    md = 10 ** 9 + 7
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    if k <= 4:
        a = a * k
        print(inv(a))
        exit()
    t1 = inv(a)
    t2 = inv(a * 2)
    t3 = inv(a * 3)
    d1 = t2 - t1
    d2 = t3 - t2
    dd = d2 - d1
    print((t1 + d1 * (k - 1) + dd * (k - 2) * (k - 1) // 2) % md)

main()


Measured memory_bytes: 3316
/// awoooooo

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;

const int N = (int)2e6 + 5;
const int inf = (int)1e9 + 7;

int n;
int a[N], b[N], c[N], pos[N];

int main(){
  cin >> n;
  for(int i = 1; i <= n; ++i){
    cin >> a[i];
    pos[a[i]] = i;
  }
  for(int i = 1; i <= n; ++i){
    cin >> b[i];
  }
  for(int i = 1; i < n; ++i){
    cin >> c[i];
  }
  int ans = 0;
  for(int i = 1; i <= n; ++i){
    ans += b[i];
    if(i < n && pos[i + 1] == pos[i] + 1){
      ans += c[i];
    }
  }
  cout << ans;
  return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    string S;
    cin >> S;
    if (S == "ABC") {
        cout << "ARC" << '\n';
    } else {
        cout << "ABC" << '\n';
    };
}

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


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <numeric>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

int Gcd(int a, int b) {
    return b ? Gcd(b, a%b) : a;
}

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

    int N, X; cin >> N >> X;
    vector<int> x(N);
    rep(i, 0, N) cin >> x[i], x[i] -= X;
    
    int res = abs(x[0]);
    rep(i, 1, N) res = Gcd(res, abs(x[i]));

    cout << res << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(void){

int a,b,d,r;

double f,x,y;

scanf("%d %d",&a,&b);

	x=a;
	y=b;
	
	d = a/b;
	r = a%b;
	f = x/y;
	
printf("%d %d %f\n",d,r,f);

return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

int main() {
	/*int X, A;
	cin >> X >> A;
	if (X < A) { cout << 0; }
	else {
		cout << 10;
	}*/


	int N, X, ans = 1, L, D = 0;
	cin >> N >> X;
	rep(i, N) {
		cin >> L;
		D += L;
		if (D <= X) {
			ans++;
		}
	}
	cout << ans;
	return 0;
}

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

using namespace std;

int main() {
    vector<int> nn;
    int n;
    cin >> n;
    int answer;

    for (int i = 0; i < n; i++) {
        int s;
        cin >> s;
        nn.push_back(s);
    }
    sort(nn.begin(), nn.end());

    answer = accumulate(nn.begin(), nn.end(), 0);

    for (int i = 0; i < n; i++) {
        if (answer % 10 == 0) {
            if (nn[i] % 10 != 0) answer -= nn[i];
        } else {
            break;
        }
    }
    if (answer % 10 == 0) answer = 0;

    cout << answer << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll h, w, k, x1, y1, x2, y2;
  cin >> h >> w >> k >> x1 >> y1 >> x2 >> y2;
  vector<vl> g(h + 2, vl(w + 2, -2));
  rep2(i, 1, h + 1) rep2(j, 1, w + 1) {
    char c;
    cin >> c;
    if(c == '.') g[i][j] = -1;
  }
  queue<pair<int, int>> q;
  g[x1][y1] = 0;
  q.push({x1, y1});
  while(!q.empty()) {
    int i = q.front().first;
    int j = q.front().second;
    // cout << i << ' ' << j << ' ' << g[i][j] << endl;
    q.pop();
    rep(d, 4) {
      int ni = i + dir[d];
      int nj = j + dir[d + 1];
      if(0 <= g[ni][nj] && g[ni][nj] <= g[i][j]) continue;
      stack<P> st;
      rep2(m, 1, k + 1) {
        int mi = i + dir[d] * m;
        int mj = j + dir[d + 1] * m;
        if(mi < 1 || h < mi || mj < 1 || w < mj || g[mi][mj] == -2) break;
        if(g[mi][mj] != -1) continue;
        g[mi][mj] = g[i][j] + 1;
        st.push({mi, mj});
      }
      while(!st.empty()) {
        q.push(st.top());
        st.pop();
      }
    }
  }
  // rep2(i, 1, h + 1) {
  //   rep2(j, 1, w + 1) cout << g[i][j] << ' ';
  //   cout << endl;
  // }
  cout << g[x2][y2] << endl;
}

Measured memory_bytes: 34428
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n;
double x[10], y[10], ans;
int main(){
	scanf("%d", &n);
	rep(i,n){
		scanf("%lf%lf", x+i, y+i);
		rep(j,i) ans += hypot(x[i]-x[j],y[i]-y[j])/n*2;
	}
	printf("%.9f\n", ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 

#define M 110
#define N 100010

ll w[M],v[M];
ll dp[M][N];
ll f(ll pos,ll val){
	if(val<0) return inf;
	if(pos<0) {
		if(val>0) return inf;
		return 0;
	}
	if(dp[pos][val]!=-1) return dp[pos][val];
	ll ans = min(f(pos-1,val),w[pos] + f(pos-1,val-v[pos]));
	// trace(pos,val,ans);
	return dp[pos][val] = ans;
}
int main(){
	IOS;
	// freopen("inp.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	
	ll n,W;cin>>n>>W;
	rep(i,0,n)cin>>w[i]>>v[i];

	memset(dp,-1,sizeof(dp));
	rep(i,0,N)f(n-1,i);
	// f(n-1,90);
	ll ans = -1;
	rep(i,0,N)if(dp[n-1][i]<=W)ans=max(ans,i);
	cout<<ans;

	return 0;
}

Measured memory_bytes: 86272
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define PRINT(v) for (auto x : (V)) cout <<x <<" " <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int main() {
  int n; cin >>n;
  vector<pair<ll,ll>> ba(n); rep(i, n) cin >>ba[i].second >>ba[i].first;
  sort(all(ba));
  ll time = 0;
  rep(i, n){
    time += ba[i].second;
    if (time > ba[i].first){
      cout <<"No" <<endl; return 0;
    }
  }
  cout <<"Yes" <<endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  string ans="No";
  for(int f=0;f<=25;++f){
    for(int s=0;s<=15;++s){
      if(4*f+7*s==n)ans="Yes";
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <deque>
#define pb push_back
#define mod 1000000007
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;

int main(void){
  string s;
  bool flag=false;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='9') flag=true;
  }
  if(flag) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}



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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int grid[10][10];

void init(){
    rep(i, 10) rep(j, 10) grid[i][j] = -1;
}

int main(void){
    //左上と右下を指定する
    //枠を見て最小値を決める
    //内部を見る
    int H, W;
    vector<int> ans;
    while(true){
        cin >> H >> W;
        if(H == 0) break;
        int res = 0;
        rep(i, H) rep(j, W) cin >> grid[i][j];
        for(int i = 0; i < H-2; i++){
            for(int j = 0; j < W-2; j++){
                for(int k = i+2; k < H; k++){
                    for(int l = j+2; l < W; l++){
                        //grid[i][j]が左上、grid[k][l]が右下
                        int temp = 0;
                        int base_height = mod;
                        vector<int> naibu;
                        for(int i2 = i; i2 <= k; i2++){
                            for(int j2 = j; j2 <= l; j2++){
                                if(i2 == i || i2 == k || j2 == j || j2 == l) base_height = min(base_height, grid[i2][j2]);
                                else naibu.push_back(grid[i2][j2]);
                            }
                        }
                        rep(a, naibu.size()){
                            if(naibu[a] >= base_height) temp = -mod;
                            else temp += base_height - naibu[a];
                        }
                        res = max(res, temp);
                        //if(i == 0 && j == 0 && k == 2 && l == 3) cout << base_height << " " << naibu.size() << " " << res << endl;
                    }
                }
            }
        }
        ans.push_back(res);
    }
    rep(i, ans.size()) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 3120
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    m = sum(A)/N
    ans = []
    for i, a in enumerate(A):
        ans.append((i, abs(a-m)))
    ans.sort(key=lambda x: x[1])
    print(ans[0][0])


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060