akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define PB push_back
#define MP make_pair
#define FST first
#define SND second
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

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

const int MOD = 1000000007;

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

class UnionFind {
public:
    vector<int> pir;

    UnionFind(int size) : pir(size, -1) {}

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x != y) {
            if (pir[y] < pir[x]) swap(x, y);
            pir[x] += pir[y];
            pir[y] = x;
        }
        return x != y;
    }

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

    int root(int x) {
        if (pir[x] < 0) {
            return x;
        } else {
            return pir[x] = root(pir[x]);
        }
    }

    int size(int x) {
        return -pir[root(x)];
    }
};

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int n, k, l;
    cin >> n >> k >> l;
    VI p(k), q(k), r(l), s(l);
    REP(i, k) {
        cin >> p[i] >> q[i];
        p[i]--;
        q[i]--;
    }
    REP(i, l) {
        cin >> r[i] >> s[i];
        r[i]--;
        s[i]--;
    }

    UnionFind UFk(n), UFl(n) ,UF(n);
    REP(i, k) {
        UFk.unite(p[i], q[i]);
    }
    REP(i, l) {
        UFl.unite(r[i], s[i]);
    }

    map<PII,int> map;
    REP(i,n){
        if(map.find(MP(UFk.root(i),UFl.root(i)))==map.end()){
            map[MP(UFk.root(i),UFl.root(i))] = 0;
        }
        map[MP(UFk.root(i),UFl.root(i))]++;
    }

    REP(i, n) {
        cout << map[MP(UFk.root(i),UFl.root(i))] << endl;
    }

    return 0;
}

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

int main() {
  string w;
  cin >> w;
  
  int s=0;
  for(int i=0;i<w.size();i++){
    int r=0;
    for(int j=0;j<w.size();j++){
      if(w.at(i) == w.at(j)){
        r++;
      }
    }
    if(r%2 != 0){
      s++;
    }
  }
  
  if(s == 0){
    cout << "Yes" <<endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
N = int(input())
for h in range(1,3501):
    for n in range(1,3501):
        if (4*h*n-N*h-N*n)>0 and (h*n)%(4*h*n-N*h-N*n)==0:
            print(h,n,h*n*N//(4*h*n-N*h-N*n))
            exit()


Measured memory_bytes: 3064
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        hoge();
        System.Console.ReadLine();
    }

    public static void hoge()
    {
        var line = System.Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
        var n = line[0];
        var k = line[1];

        List<int> lst = new List<int>();

        while(n > 0)
        {
            lst.Add(n % k);
            n /= k;
        }
        System.Console.WriteLine(lst.Count);
    }

}


Measured memory_bytes: 13396
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589

using namespace std;

int gcd(int a, int b);
int lcm(int a, int b);

void solve_A(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);

    if(a[0] == a[1] && a[1] != a[2]) cout << "Yes";
    else if(a[0] != a[1] && a[1] == a[2]) cout << "Yes";
    else cout << "No";
}

int main(void){
    solve_A();
    
    return 0;
}

int gcd(int a, int b){
    if(a < b) swap(a, b);

    int r = a % b;
    while(r != 0){
        a = b;  b = r;  r = a % b;
    }
    return b;
}

int lcm(int a, int b){
    return a * b / gcd(a, b);
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<bitset>
#include<stack>
#include<cassert>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define mem(x,y) memset(x,y,sizeof x)
#define sqr(x) ((x)*(x))
//debug
#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...)
#endif
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
const int INF=2e9;
const db eps=1e-12;
template<typename T>
inline void read(T &x) {
  x=0; int f=1; char ch=getchar();
  while( (ch<'0' || ch>'9') && ch!='-') ch=getchar(); if(ch=='-') {f=-1; ch=getchar();}
  while(ch>='0' && ch <='9') x=x*10+ch-'0',ch=getchar();
  x*=f;
}
//==========================head template==========================
ll n,x;
ll ans=0;
ll Calc(ll a,ll b) {//a<b
  if(!a) return b;
  ans+=b/a*(2*a);
  return Calc(b%a,a);
}
signed main() {
  read(n); read(x);
  ans=n;
  ll a=x,b=n-x;
  ans-=Calc(a,b);
  printf("%lld\n",ans);
  return 0;
}


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

int main() {
    int N, M;
    scanf("%d%d", &N, &M);
    vector<int> A(N, 0);
    for (int i = 0; i < N; i++) scanf("%d", &A[i]);
    sort(A.begin(), A.end());
    int thres = accumulate(A.begin(), A.end(), 0);
    int cnt = 0;
    for (int i = N - 1; i >= 0; i--) if (A[i] * 4 * M >= thres) cnt++;
    cout << ((cnt >= M) ? "Yes" : "No") << endl;
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000000LL;
const int MAX=100001;
const double EPS=1e-10;
int main(){
    int n,d,x;
    cin>>n>>d>>x;
    int ans=x;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        ans+=(d-1)/a+1;
    }
    cout<<ans<<endl;
}


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

int main() {
    string S, X, Y;
    cin >> S;

    int Q; cin >> Q;
    int rev = 0;
    for (int i = 0; i < Q; ++i) {
        int type; cin >> type;
        if (type == 2) {
            int f; char c;
            cin >> f >> c; --f;
            if (rev) f = 1 - f; // 反転状態だったら、フラグを反転
            if (f == 0) X += c;
            else Y += c;
        }
        else rev = 1 - rev;
    }
    reverse(X.begin(), X.end());
    string res = X + S + Y;
    if (rev) reverse(res.begin(), res.end());
    cout << res << endl;
}


Measured memory_bytes: 1348
#include<bits/stdc++.h>
#define pb emplace_back
#define ll long long
#define mp make_pair
#define PI acos(-1)
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll i,j,k,x,y,z,m,n,t,a,b,c,l,r,q;
    cin>>n;
    vector<ll>v1(n);
    map<ll,ll>val;
    ll sum=0;
    for(i=0; i<n; i++)
    {
        cin>>v1[i];
        val[v1[i]]++;
        sum+=v1[i];
    }
    cin>>q;
    while(q--)
    {
        cin>>l>>r;
        x=val[l];
        val[l]=0;
        sum-=x*l;
        val[r]+=x;
        sum+=x*r;
        cout<<sum<<'\n';
    }
}







Measured memory_bytes: 9888
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a)//少数出力
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

#include <iostream>

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

map< int64_t, int > prime_factor(int64_t n) {//素因数分解
	map< int64_t, int > ret;
	for (int64_t i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

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

ll lcm(ll number1, ll number2) {//lcmを求める
	return number1 * number2 / gcd(number1, number2);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {

	ll a, b;
	scanf("%lld%lld", &a, &b);
	auto c = prime_factor(gcd(a, b));
	printf("%d\n", c.size() + 1);

	return 0;
}


Measured memory_bytes: 256
private fun readInts() = readLine()!!.split(" ").map { it.toInt() }

fun main(args: Array<String>) {
    val (N, M, C) = readInts()
    val B = readInts()

    println(
        Array(N) { readInts() }
            .map { it.foldIndexed(C) { index, sum, value -> sum + (value * B[index]) } }
            .count { it > 0 }
    )
}


Measured memory_bytes: 38004
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string s1, s2, s3;
  cin>>s1>>s2>>s3;
  string ans = "A";
  ans.push_back(s2[0]);
  ans.push_back('C');
  cout<<ans<<endl;
}



Measured memory_bytes: 3548
# -*- coding: utf-8 -*-
 
n = int(input())
if n == 100000:
  print(90909)
elif n / 10000 >= 1:
  print(9 + 900 + n - 10000 + 1)
elif n / 1000 >= 1:
  print(909)
elif n / 100 >= 1:
  print(9 + n - 100 + 1)
elif n / 10 >= 1:
  print(9)
elif n < 10:
  print(n)

Measured memory_bytes: 3060
n=int(input())
a=[int(i) for i in input().split()]
#print(n,a)

m=n//2
cnt=0
for i in range(n):
  if a[i]%2==0:
    cnt+=1
    if a[i]%4==0:
      cnt+=1

print('Yes' if cnt>=2*m else 'No')

Measured memory_bytes: 14224
// Problem : A - Plural Form
// Contest : AtCoder - AtCoder Beginner Contest 179
// URL : https://atcoder.jp/contests/abc179/tasks/abc179_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


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


#define sc(ar,n) for(int pen=0;pen<n;pen++){ cin>>ar[pen];}
#define pr(ar,n) for(int pen=0;pen<n;pen++){ cout<<ar[pen]<<" ";} cout<<endl;
#define mem(ar,x) memset(ar,x,sizeof(ar))
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define rt return 0;
#define ct continue;
#define pb push_back
#define ll long long int
#define ff first
#define ss second
#define mod 1000000007
#define maxn 1000003
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif



int main(){
	
	fastio;
	string s;
	cin>>s;
	
	int n = sz(s);
	
	if(s[n-1] != 's')s.pb('s');
	
	else {
		s.pb('e');
		s.pb('s');
	}
	cout<<s;
	
	}


	
	
	
	



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

int main(){
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(q);
    for(int i = 0; i < q; i++) cin >> a[i];
    vector<int> correctnum(n+1, 0);
    for(int i = 0; i < q; i++) correctnum[a[i]]++;
    for(int i = 1; i <= n; i++){
        if(k-q+correctnum[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 4028
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=100005;

ldb dp[301][301][301];int n;
ldb solve(int i,int j,int k)
{
    if(i<0||j<0||k<0)
        return 0;
    if(i==0&&j==0&&k==0)
        return dp[i][j][k]=0;
    if(dp[i][j][k]!= -1)
        return dp[i][j][k];
    dp[i][j][k]=0;
    dp[i][j][k]=(ldb)n/(i+j+k);
    dp[i][j][k]=dp[i][j][k]+(ldb)(i*solve(i-1,j,k))/(i+j+k);
    dp[i][j][k]=dp[i][j][k]+(ldb)(j*solve(i+1,j-1,k))/(i+j+k);
    dp[i][j][k]=dp[i][j][k]+(ldb)(k*solve(i,j+1,k-1))/(i+j+k);
    return dp[i][j][k];
}

void solve()
{
    memset(dp,-1,sizeof(dp));
    cin>>n;
    int a[n];
    int cnt[4]={0};
    for(int i=0;i<n;i++)
    { cin>>a[i];
        cnt[a[i]]++;
    }
    cout<<setprecision(20);
    cout<<solve(cnt[1],cnt[2],cnt[3])<<endl;
        
    
    
    
    
    
    
}


int32_t main()
{
    IOS;
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}






Measured memory_bytes: 426496
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    String[] s = S.split("");
    String[] t = T.split("");
    int ans = 0;
    for (int i = 0; i < 3; i++){
      if (s[i].equals(t[i])) ans++;
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 35712
# https://www.geeksforgeeks.org/compute-ncr-p-set-3-using-fermat-little-theorem/
def comb(n, r, p): 
    num = den = 1 
    for i in range(r): 
        num = (num * (n - i)) % p 
        den = (den * (i + 1)) % p 
    return (num * pow(den,  p - 2, p)) % p 
  
m = 10**9 + 7
x, y = (int(x) for x in input().split())
ans = 0
if (x - 2*y) % 3 == 0:
    beta = (x - 2*y) // -3
    alpha = y - 2*beta
    ans = comb(alpha+beta, max(alpha, beta), m)
print(ans)

Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=(int)1e9+7;
		static void Main(){
		Sc sc=new Sc();
		int[] s=sc.Ia;
		int[][] h1=new int[s[0]+1][];
		int[][] h2=new int[s[0]+1][];
		int[][] h3=new int[s[0]+1][];
		h1[0]=new int[s[1]+1];
		h2[0]=new int[s[1]+1];
		h3[0]=new int[s[1]+1];
		string[] g=new string[2];
		g[0]=new string('0',s[1]+1);
		for(int i = 1;i<=s[0];i++) {
			h1[i]=new int[s[1]+1];
			h2[i]=new int[s[1]+1];
			h3[i]=new int[s[1]+1];
			g[i%2]="0"+sc.S;
			for(int j = 1;j<=s[1];j++) {
				h1[i][j]=h1[i][j-1]+g[i%2][j]-'0';
				h2[i][j]=h2[i][j-1];
				h3[i][j]=h3[i-1][j];
				if(g[i%2][j]=='1'){
					if(g[i%2][j-1]==g[i%2][j]){h2[i][j]++;}
					if(g[(i+1)%2][j]==g[i%2][j]){h3[i][j]++;}
				}
			}
		}
		for(int i = 1;i<=s[0];i++) {
			for(int j = 1;j<=s[1];j++) {
				h1[i][j]+=h1[i-1][j];
				h2[i][j]+=h2[i-1][j];
				h3[i][j]+=h3[i][j-1];
			}
		}
		StringBuilder sb=new StringBuilder();
		for(int i = 0;i<s[2];i++) {
			int[] q=sc.Ia;
			sb.Append(((h1[q[2]][q[3]]+h1[q[0]-1][q[1]-1]-h1[q[0]-1][q[3]]-h1[q[2]][q[1]-1])-(h2[q[2]][q[3]]+h2[q[0]-1][q[1]]-h2[q[0]-1][q[3]]-h2[q[2]][q[1]])-(h3[q[2]][q[3]]+h3[q[0]][q[1]-1]-h3[q[0]][q[3]]-h3[q[2]][q[1]-1]))+"\n");
		}
		Console.Write(sb);
	}
}

public class Sc{
	private string[] a;
	private int n=-1,m=0;
	public int I{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return int.Parse(a[n]);}}
	public long L{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return long.Parse(a[n]);}}
	public double D{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return double.Parse(a[n]);}}
	public string S{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return a[n];}}
	public int[] Ia{get{if(n!=-1&&n!=a.Length-1){m=n;n=-1;return Array.ConvertAll(a.Skip(m+1).ToArray(),int.Parse);}return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

Measured memory_bytes: 79316
from __future__ import print_function

import array
import bisect
import collections
import copy
import fractions
import functools
import heapq
import itertools
import math
import operator
import random
import re
import string
import sys
import time
from collections import Counter, deque
from fractions import Fraction
from functools import reduce
from heapq import heapify, heappop, heappush, heappushpop, heapreplace
from itertools import accumulate
from operator import mul
from queue import PriorityQueue as pq
from queue import Queue

sys.setrecursionlimit(500000)









input = sys.stdin.readline


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

# from fractions import gcd
# from math import gcd

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


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


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    if r>n:
        return 0
    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():
    n = int(input().strip())
    a = list(map(int, input().strip().split()))
    C=Counter()
    for i in range(n):
        C[a[i]]+=1
    ans_temp=0
    X=[0 for _ in range(n+1)]
    for key, value in C.items():
        X[key] = combinations_count(value, 2)
        ans_temp += X[key]
    for k in range(n):
        print( ans_temp - X[a[k]] + combinations_count(C[a[k]]-1,2) )


if __name__ == '__main__':
    main()


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

int main() {
  ll n, k;
  cin >> n >> k;
  vector<vector<int>> z(n, vector<int>(2));
  rep(i,n) cin >> z[i][0] >> z[i][1];
  sort(z.begin(), z.end());
  rep(i,n) {
    if (k > z[i][1]) k -= z[i][1];
    else {
      cout << z[i][0] << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



const int M_N=200000;

struct BIT{
    //1-indexed
    LL bit[M_N+1],n;
    //iまでの総和を返す
    LL sum(int i){
        LL s=0;
        while(i>0){
            s=(s + bit[i])%mod;
            i=i&(i-1);
        }
        return s;
    }
    //iにx加算する
    void add(int i,LL x){
        while(i<=n){
            bit[i]=(bit[i] + x)%mod;
            i+=i&-i;
        }
    }

};

int main(){
    int n;
    LL A,B;
    cin >> n >> A >> B;
    vector<LL> s(n+1,-LINF);
    for (int i = 0; i < n; i++) {
        cin >> s[i+1];
    }
    BIT bit[2];
    bit[0].n = bit[1].n = n + 1;
    bit[0].add(1,1);
    bit[1].add(1,1);
    int la = 0, lb = 0;
    for (int i = 1; i < n; i++) {
        auto x = upper_bound(ALL(s),s[i+1] - A) - s.begin();
        bit[0].add(i + 1,(bit[1].sum(min(i,(int)x))-bit[1].sum(min({i,(int)x,lb}))+mod)%mod);
        auto y = upper_bound(ALL(s),s[i+1] - B) - s.begin();
        bit[1].add(i + 1,(bit[0].sum(min(i,(int)y))-bit[0].sum(min({i,(int)y,la}))+mod)%mod);
        if(s[i+1] < s[i] + A) la = i;
        if(s[i+1] < s[i] + B) lb = i;
    }
    cout << ((bit[0].sum(n+1) - bit[0].sum(la) + mod)%mod + (bit[1].sum(n+1) - bit[1].sum(lb) + mod)%mod)%mod << endl;
    return 0;
}


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

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int x; cin >> x;
	int now = 0;
	for (int i = 1; ; i++) {
		now += i;
		if (now >= x) {
			cout << i << endl; return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
def f(a,d,T):
    try:
        return T[d+1:].index(a)+(d+1)
    except ValueError:
        return len(T)

def g(a,d,T):
    try:
        return T[:d].index(a)
    except ValueError:
        return 0

A=26

D=int(input())

C=[0]+list(map(int,input().split())) #減る満足度のベース
S=[0]*(D+1) #S[d][i] :(d+1)日目にコンテストiを開催した時の満足度

for i in range(1,D+1):
    S[i]=[0]+list(map(int,input().split()))

T=[0]
for i in range(D):
    T.append(int(input()))
            
X=0
L=[0]*(A+1)
R=[[0]*(A+1) for _ in range(D+1)]
for d in range(1,D+1):
    X+=S[d][T[d]]
    for j in range(1,A+1):
        if j!=T[d]:
            L[j]+=1
            R[d][j]=R[d-1][j]+1
            X-=C[j]*L[j]
        else:
            L[j]=0

M=int(input())
for _ in range(M):
    d,q=map(int,input().split())
    p=T[d]

    Y=(R[d-1][p]+1)*(f(p,d,T)-d)
    Z=R[d][q]*(f(q,d,T)-d)
    
    h=R[d-1][p]
    for i in range(d,f(p,d,T)):
        h+=1
        R[i][p]=h

    m=0
    for j in range(d,f(q,d,T)):
        R[j][q]=m
        m+=1
    
    T[d]=q
    X+=(S[d][q]-S[d][p])+Z*C[q]-Y*C[p]
    print(X)


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

int main(){

	int n; cin >> n;
	int ac,wa,tle,re;
	ac = wa = tle = re = 0;
	while(n--){
		string ver; cin >> ver;
		if(ver.compare("AC")==0)ac++;
		else if(ver.compare("WA")==0)wa++;
		else if(ver.compare("TLE")==0)tle++;
		else if(ver.compare("RE")==0)re++;
	}
	printf("AC x %d\n",ac);
	printf("WA x %d\n",wa);
	printf("TLE x %d\n",tle);
	printf("RE x %d\n",re);


	return 0;
}

Measured memory_bytes: 3704
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(x...) {                                       \
   cerr << "\e[91m";                                        \
   cerr << __LINE__ << ": " << #x << " = "; DBG::_print(x); \
   cerr <<"\e[39m";                                         \
}
#else
#define DEBUG(x...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;



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

   int N;
   cin >> N;

   map<int,int> freq;
   llong sum = 0;
   REP(i, N) {
      int a;
      cin >> a;
      sum += a;
      ++freq[a];
   }

   int Q;
   cin >> Q;
   FOR(q, 1, Q) {
      int b, c;
      cin >> b >> c;
      if (!freq.count(b) == 0) {
         int f = freq[b];
         sum -= f * 1LL * b;
         freq.erase(b);
         freq[c] += f;
         sum += f * 1LL * c;
      }
      cout << sum << '\n';
   }

   return 0;
}


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

#define sqr(A) ((A) * (A))
#define F first
#define S second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;

const int N = 2e2 + 20;
int a[N], n, ans;

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 0; i < 2 * n; i++)
		cin >> a[i];
	sort(a, a + 2 * n);
	for (int i = 2 * n - 1; i >= 1; i -= 2)
		ans += min(a[i], a[i - 1]);
	cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

int main() {
	int N, D;
	cin >> N >> D;
	if (N % (2 * D + 1) == 0) {
		cout << N / (2 * D + 1) << endl;
	}
	else {
		cout << N / (2 * D + 1) + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
string_ring = list(input())
string = list(input())

length_ring = len(string_ring)
length_str = len(string)
l = 1
check = False
flag = 0
for i in range(length_ring):
    if string_ring[i] == string[0]:
        k = i
        l = 1
        for j in range(1, length_str):
            flag = 1
            if k + l == length_ring:
                k = 0
                l = 0
            if string_ring[k + l] != string[j]:
                break
            l += 1
            if j == length_str - 1:
                check = True
                break
        if flag != 1:
            check = True
        if check:
            break

if check == False:
    print('No')
else:
    print('Yes')


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vector<int> A(n);
    rep(i,n)cin>>A[i];
    vector<int> cnt(six,0);
    for(auto i : A){
      if(cnt[i]!=0){
        cnt[i]=2;
        continue;
      }
      for(int j=i;j<=six;j+=i)cnt[j]++;
    }
    int ans=0;
    for(auto i:A){
      if(cnt[i]==1)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
    int k;
    cin>>k;
    int val = 0;
    for(int j=1;j<=1e7;j++) {
        val = (val * 10 + 7) % k;
        if(val == 0) return cout<<j,0;
    }
    cout<<-1;
    return 0;
}


Measured memory_bytes: 3608
/**********************************************************************/
/********                                                      ********/
/********                     Writer:孙~~                      ********/
/********                       Lang:C++                       ********/
/********                     Status:Unknow                    ********/
/********                                                      ********/
/**********************************************************************/
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <list>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <cstring>
#include <cmath>
//#include<bits/stdc++.h>
using namespace std;

const int INF=0x3f3f3f3f;
const int SIZE=200005;

int a[SIZE],n;
long long s[SIZE];
inline long long sum(int a,int b){if(a==0) return s[b]; else return s[b]-s[a-1];}

inline long long calc(int id1,int id2,int id3){return max(sum(0,id1),max(sum(id1+1,id2),max(sum(id2+1,id3),sum(id3+1,n-1))))-min(sum(0,id1),min(sum(id1+1,id2),min(sum(id2+1,id3),sum(id3+1,n-1))));}

int pos(int l,int r){
	int le=l,ri=r,ans=-1;
	while(le<ri){
		int mid=(le+ri)/2;
		if(sum(l,mid)<=sum(mid+1,r)) le=mid+1; else{
			ri=mid;
			ans=mid;
		}
	}
	if(ans==-1) return r-1;
	else if(sum(l,ans)-sum(ans+1,r)<sum(ans,r)-sum(l,ans-1)) return ans; else return ans-1;
}

int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",a+i);
	s[0]=a[0];
	for(int i=1;i<n;i++) s[i]=s[i-1]+(long long)a[i];
	long long best=1ll<<60;
	for(int i=1;i<=n-1;i++){
		best=min(best,calc(pos(0,i),i,pos(i+1,n-1)));
	}
	printf("%lld\n",best);
	return 0;
}

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

using namespace std;

int ans, a, b, k, cnt;

int main(){
	cin >> a >> b >> k;
	for(int i = min(a, b);; --i){
		if(a % i == 0 && b % i == 0){
			cnt++;
			if(cnt == k){
				ans = i;
				break;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cassert>
#include <algorithm>
#include <math.h> 
#include <set>
#include <map>
#include <utility>
#include <deque>
#include <queue>


using namespace std;

#define ll long long int
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repp(i, n) for(int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
#define pb push_back
#define mp make_pair
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<ll>;
using vvi = vector<vi>;
const ll MOD = 1e9 + 7;
vi alphabet = { 'a','b','c','d','e','f','g','h','i','j','k','l','m',
               'n','o','p','q','r','s','t','u','v','w','x','y','z' };


int main() {
    int N;
    cin >> N;
    vi A(N);
    rep(i, N) cin >> A[i];
    sort(A);
    riverse(A);
    ll frag1 = 0;
    ll frag2 = 0;
    int frag = 1;
    rep(i, N - 1) {
        if (A[i] == A[i + 1] && frag == 1) {
            frag1 = A[i];
            frag = 2;
            continue;
        }
        else if (frag == 2) {
            frag = 3;
            continue;
        }
        else if (A[i] == A[i + 1] && frag == 3) {
            frag2 = A[i];
            break;
        }
    }
    ll ans = frag1 * frag2;
    cout << ans << endl;
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

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

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int n = read();
  map<int, int> numCnt;
  REP(i, n) {
    int tmp = read();
    if (numCnt.count(tmp) == 0)
      numCnt[tmp] = 1;
    else
      numCnt[tmp]++;
  }
  int ans = 0;
  for (auto &p : numCnt) {
    if (p.first < p.second)
      ans += p.second - p.first;
    else if (p.first > p.second)
      ans += p.second;
  }
  print(ans);
}


Measured memory_bytes: 6272
fn main() {
    let (d, t, s): (i32, i32, i32) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut ws = buf.split_whitespace();
        let d = ws.next().unwrap().parse().unwrap();
        let t = ws.next().unwrap().parse().unwrap();
        let s = ws.next().unwrap().parse().unwrap();
        (d, t, s)
    };

    let reach = t * s >= d;
    if reach {
        println!("Yes");
    } else {
        println!("No")
    }
}


Measured memory_bytes: 2076
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int j,k,l,m,n,su=0;
  j=s.size();
  for(int i=0;i<j;i++){
    m=s[i]-48;
    su=su+m;
  }
  if(su%9==0)
    cout<<"Yes";
  else
    cout<<"No";
}


Measured memory_bytes: 3700
h,w = map(int,input().split())
ij = [list(map(int,input().split())) for x in range(10)]
for k in range(10):
    for i in range(10):
        for j in range(10):
            ij[i][j] = min(ij[i][j],ij[i][k]+ij[k][j])
ans = 0
for i in range(h):
    for j in list(map(int,input().split())):
        if j == -1:continue
        ans += ij[j][1]
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

using namespace std;

typedef long long ll;

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

    int N, K; cin >> N >> K;
    vector<int> h(N);

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

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

    int result = 10000000000;
    for (int i = 0; i < N - K + 1; ++i) {
        result = min(result, h[i + K - 1] - h[i]);
    }

    cout << result << "\n";

    return 0;
}

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

using namespace std;

int main()
{
	int N,M,i;
	cin>>N>>M;
	vector<int> A(M);
	for(i=0 ; i<M ; i++)
	{
		cin>>A[i];
		N-=A[i];
	}
	if(N>=0)
	{
		cout<<N;
	}
	else
	{
		cout<<-1;
	}
	return 0;
}

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

int main(){
    long long n;
    cin>>n;
    long long sum=0;
    for(int i=1;i<=n;i++){
        if(i%3!=0&&i%5!=0){
            sum+=i;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3620
values = raw_input()
n,x = int(values.split(" ")[0]), int(values.split(" ")[1])
cities = raw_input()
cities = [int(i) for i in cities.split(" ")]

cities = sorted(cities)

distances = []
for i in cities:
	distances.append(abs(i-x))
for i in range(1,len(cities)):
	distances.append(abs(cities[i]-cities[i-1]))

def hcd(a,b):
	while b!=0:
		t = b
		b = a % b
		a = t
	return a

m = distances[0]
for i in range(1,len(distances)):
	m = hcd(m, distances[i])
print(m)

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

int main(){
  int n;
  std::cin >> n;
  std::vector<std::string> s(n);
  for(int i=0;i<n;i++){
    std::cin >> s[i];
  }
  
  std::sort(s.begin(), s.end());
  s.erase(std::unique(s.begin(), s.end()), s.end());

  std::cout << s.size();
  return 0;
}

Measured memory_bytes: 9540
import java.util.Scanner;

public class Main {
	//java11

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		if(s.charAt(1) == 'B')
			s = "ARC";
		else
			s = "ABC";

		System.out.println(s);

	}

}


Measured memory_bytes: 35684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int a[n];
    ll raccoon = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        raccoon += a[i];
    }
    ll snuke = 0, ans = 1e15;
    for (int i = 0; i < n - 1; i++) {
        snuke += a[i];
        raccoon -= a[i];
        ans = min(ans, abs(raccoon - snuke));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void print_letter(int n, char ch)
{
	int i;

	for (i = 0; i < n; i++) {
		printf("%c", ch);
	}
}

int main(void)
{
	int sx, sy, tx, ty;
	int x, y;

	scanf("%d %d %d %d", &sx, &sy, &tx, &ty);

	x = tx - sx;
	y = ty - sy;

	print_letter(y, 'U');
	print_letter(x, 'R');
	print_letter(y, 'D');
	print_letter(x + 1, 'L');
	print_letter(y + 1, 'U');
	print_letter(x + 1, 'R');
	print_letter(1, 'D');
	print_letter(1, 'R');
	print_letter(y + 1, 'D');
	print_letter(x + 1, 'L');
	print_letter(1, 'U');
	printf("\n");

	return (0);
}

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

int main() {
  unsigned long long n, m, sum=0;
  cin >> n;
  set<unsigned long long> v;
  
  for(int i=0; i<n; i++){
    cin >> m;
    if(v.find(m) == v.end()) v.insert(m);
    else v.erase(v.find(m));
  }
  cout << v.size() << endl;
}

Measured memory_bytes: 4864
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;

void solve() {
	string n; cin >> n;
	int cnt = 1;
	string ans = "No";
	if (n[0] == n[1] && n[1] == n[2]) ans = "Yes";
	if (n[1] == n[2] && n[2] == n[3]) ans = "Yes";
	cout << ans << endl;
	return;
}

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

Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var abk = Console.ReadLine().Split();
        var a = int.Parse(abk[0]);
        var b = int.Parse(abk[1]);
        var k = int.Parse(abk[2]);

        for (int i = Math.Min(a, b); 0 < i; i--)
        {
            if (a % i == 0 && b % i == 0)
            {
                if (k == 1)
                {
                    Console.WriteLine(i);
                    return;
                }
                else
                {
                    k--;
                }
            }
        }
    }
}


Measured memory_bytes: 13140
import itertools
N = int(input())
S = [input()[0] for T in range(N)]
MARCH = [S.count('M'),S.count('A'),S.count('R'),S.count('C'),S.count('H')]
Total = 0
for T in itertools.combinations(MARCH,3):
    Total += T[0]*T[1]*T[2]
print(Total)

Measured memory_bytes: 9780
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int m,d;
    cin>>m>>d;
    int cnt=0;
    REP(i,4,m+1)REP(j,22,d+1){
        if(j%10<2) continue;
        if(j/10<2) continue;
        if((j%10)*(j/10)==i) cnt ++; 
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const ll MOD=10000000007;

int main() {
  int N,K,Q;
  cin >> N >> K >> Q;
  map<int,int> m;
  for (int i=0;i<Q;i++){
    int x;
    cin >> x;
    m[x-1]++;
  }
  for (int i=0;i<N;i++){
    if (K-Q+m[i]>0){
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
}
  

Measured memory_bytes: 5376
//ford-fulkerson法 
//O(F|E|)

//参考　蟻本！
//judge http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_A&lang=jp

#include<iostream>
#include<vector>

using namespace std;

typedef long long ll;

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

struct edge{ll to; /*どの頂点に向かうか*/ 
            ll cap; /*現在の辺のキャパシティ*/ 
            ll rev_id;/*逆辺の添字*/ 
        };

vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(ll from,ll to,ll cap) {
    G[from].push_back((edge){to,cap,(ll)G[to].size()});
    G[to].push_back((edge){from,0,(ll)G[from].size() - 1});
}

ll dfs(ll v,ll t,ll f) {
    if(v == t)return f;//終点についたらフローを返す。

    used[v] = true;

    for(int i = 0;i < G[v].size();i++) {
        edge &e = G[v][i];
        if(!used[e.to] && e.cap > 0) {
            ll d = dfs(e.to,t,min(f,e.cap));
            if(d > 0) {
                e.cap -= d;
                G[e.to][e.rev_id].cap += d;
                return d;
            }
        }
    }
    return 0;
}

ll max_flow(ll s/*始点*/,ll t/*終点*/) {
    ll flow = 0;
    for(;;) {
        fill(used,used+MAX_V,false);
        ll f = dfs(s,t,1000000000);
        if(f == 0)break;
        flow += f;
    }
    return flow;
}

int main() {
    ll V,E;
    cin >> V >> E;

    rep(i,E) {
        ll u,v,c;
        cin >> u >> v >> c;
        add_edge(u,v,c);
    }

    cout << max_flow(0,V-1) << endl;
    return 0;
}


Measured memory_bytes: 3244
n, m = map(int, input().split())

ans = 0

if n > 1:
  if n % 2 != 0:
    ans += n * (n // 2)
  else:
    ans += n * ((n-1) // 2) + n / 2 

if m > 1:
  if m % 2 != 0:
    ans += m * (m // 2)
  else:
    ans += m * ((m-1) // 2) + m / 2

print(int(ans))

Measured memory_bytes: 3060
#include<cstdio>                                                                                                    
                                                                                                                    
int main(){                                                                                                         
        int a, b, i, n;                                                                                             
        scanf("%d%d", &a, &b);                                                                                      
        i = b - a - 1;                                                                                              
        printf("%d", i*(i+1)/2-a);                                                                                  
        return 0;                                                                                                   
} 

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

int main() {
    int a, b;
    char op;

    while (true) {
        cin >> a >> op >> b;
        if (op == '?')
            break;
        if (op == '+')
            printf("%d\n", a + b);
        else if (op == '-')
            printf("%d\n", a - b);
        else if (op == '*')
            printf("%d\n", a * b);
        else
            printf("%d\n", a / b);
        
    }
}


Measured memory_bytes: 3200
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i =0; i < n ;i++)
using namespace std;
string s[25000];

int main(void){
    int K, idx=0;
    string S;
    cin >> S;
    cin >> K;

    rep(i, S.size()){
        s[idx] += S[i];
        idx++;
        for(int j=1; j < 5; j++){    
            if(i + j < S.size()){
                s[idx] += s[idx-1];
                s[idx].push_back(S[i+j]);
                idx++;
            }
        }
    }
  

    sort(s, s+idx);
    
    string ans(s[0]);
    string temp;
    K--;

    rep(i, idx-1){
        if(K==0) break;
        if(ans != s[i+1]){
            K--;
            ans = s[i+1];
        }
    }
    //rep(i, idx) cout << s[i]<< endl;
    cout << ans<< endl;
}


Measured memory_bytes: 1664