akhauriyash/Code-Regression huggingface dataset:
a = int(input())
while True:
  op = input()

  if op == "=":
    break
  b = int(input())
  if op == "+":
    a = a + b
  if op == "-":
    a = a - b
  if op == "*":
    a = a * b
  if op == "/":
    a = a // b
print(a)


Measured memory_bytes: 5592
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------

void solve(){
}
int main(){
    int n, x;
    cin >> n >> x;
    vector<int>ln(n);
    vector<int>xn(n + 1);
    xn.at(0) = 0;
    for(int i = 0; i < n; i++){
        cin >> ln.at(i);
    }
    for(int i = 0; i < n; i++){
        xn.at(i + 1) = xn.at(i) + ln.at(i);
        if(xn.at(i + 1) > x){
            cout << i + 1 << endl;
            break;
        }
        if(i == n - 1){
            cout << n + 1 << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
template<class T>
T gcd(T x, T y) {
	return y ? gcd(y, x % y) : x;
}

template<class T>
vector<T> enum_div(T n) {
	vector<T> ret;
	for (T i = 1; i * i < n; ++i) {

		if (n % i == 0) {
			ret.push_back(i);

			if (i != 1 && i * i != n) {
				ret.push_back(n / i);
			}
		}
	}
	return ret;
}

template<class T>
map<T, int> prime_factorization(T n) {
	map<T, int> ret;

	for (long long i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}

	if (n != 1)ret[n] = 1;
	return ret;
}

template<class T>
long long C(T n, T r) {
	static map<pair<T, T>, long long> _map;
	if (n < r) return 0;

	if (n == r || r == 0) {
		_map[make_pair(n, r)] = 1ll;
	}
	else if (_map[make_pair(n, r)] == 0) {
		_map[make_pair(n, r)] = (C(n - 1, r) + C(n - 1, r - 1));
	}

	_map[make_pair(n, r)] %= MOD;
	return _map[make_pair(n, r)];
}

int main() {
	int A, B;
	cin >> A >> B;
	if (9 < A || 9 < B) {
		cout << "-1" << endl;
	}
	else {
		cout << A * B << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
import unittest


class TestA(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think('SAT'), 1)

    def test_2(self):
        self.assertEqual(think('SUN'), 7)


def solve():
    s = read()
    result = think(s)
    write(result)


def read():
    return read_line()


def read_int(n):
    return read_type(int, n)


def read_float(n):
    return read_type(float, n)


def read_type(t, n):
    return list(map(lambda x: t(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(data):
    weekday = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
    return len(weekday) - weekday.index(data)


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

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

struct edge{
    int to,weight;
    edge(int to,int weight):to(to),weight(weight){}
};
using Graph = vector<vector<int>> ;
using GraphEdge = vector<vector<int>> ;

long long modinv(long long a, long long m=MOD) {
    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;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}
int main(){
    int N;cin >> N ;
    int h[101];
    rep(i,N)cin >> h[i];

    int height[101];
    memset(height,0,sizeof(height));
    height[101] = 101;
    int count = 0;
    while(1){
        bool first = true;
        for(int i=0;i<N;i++){
            if(h[i]>0){
                if(first){
                    count++;
                    first = false;
                }
                h[i]--;
            }else{
                first = true;
            }
        }
        bool ok = true;
        for(int i=0;i<N;i++){
            if(h[i]!=0)ok = false;
        }
        if(ok)break;
    }
    cout << count << endl;
    


    return 0;
}

Measured memory_bytes: 3620
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=0
s=[0]
for i in range(n):
  s.append(a[i]+s[-1])
for i in range(n-k+1):
  tot=s[i+k]-s[i]
  ans=max((tot+k)/2,ans)
print(ans)

Measured memory_bytes: 25060
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        int m=ni();
        int n=ni();
        long sum=0;
        for(int i=0;i<n;i++)
            sum+=nl();
        if(sum>m)
            pn("-1");
        else
            pn(m-sum);
    }
 
    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = true;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        //t=ni();
        while(t-->0) {process();}
        out.flush();out.close();  
    }
 
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////
 
    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 34184
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef vector<int> vec;
int main(){
  int a,b,c,L,S;  cin>>a>>b>>c;
  L=max(a, max(b,c));
  S=min(a, min(b,c));
  cout<<L-S;
}

Measured memory_bytes: 256
N, K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
now = A[0]
num = 1
l = []
for i in range(1,N):
    if now != A[i]:
        l.append(num)
        now = A[i]
        num = 1
    else:
        num += 1
l.append(num)
l.sort()
if len(l) <= K:
    print(0)
else:
    print(sum(l[0:len(l)-K]))


Measured memory_bytes: 25644
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
const int M = 100;
int dp[N][M];
int d[] = { 0,2,5,5,4,5,6,3,7,6 };
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	map<int, int> mc;
	int n, m;
	cin >> n >> m;
	vector<pair<int, int>> vp;
	int minv = 10;
	while (m--)
	{
		int x;
		cin >> x;
		mc[d[x]] = max(mc[d[x]], x);
		minv = min(minv, d[x]);
	}
	for (auto& p : mc)
	{
		vp.emplace_back(p.second, p.first);
	}
	sort(vp.rbegin(), vp.rend());
	dp[0][0] = 1;
	int k1 = 0, k2 = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < 100 && minv * i + j <= n; j++)
		{
			if (dp[i][j] == 0) continue;
			if (minv * i + j > n) break;
			if (minv * i + j == n) k1 = i, k2 = j;
			for (auto& p : mc)
			{
				int cost, val;
				tie(cost, val) = p;
				int o = j - minv + cost;
				if (o < 0 || o >= 100) continue;
				dp[i + 1][o] = 1;
			}
		}
	}
	while (k1)
	{
		for (auto& p : vp)
		{
			int val, cost;
			tie(val, cost) = p;
			int o = k2 + minv - cost;
			if (o < 0 || o >= 100) continue;
			if (dp[k1 - 1][o])
			{
				putchar(val + '0');
				k1--, k2 = o;
				break;
			}
		}
	}
	puts("");
	return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <string>
using namespace std;
 
int main()
{
	string s;
	cin >> s;
	string t;
	cin >> t;
	for(int i = 0,n = s.size(); i < n; i++)
	{
		if(s[i] != t[i])
		{
			cout << "No" << endl;
			return 0;
		}
	}
	if(t.size() == s.size() + 1)
		cout << "Yes" << endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int A=a/d;
  int B=c/b;
  if(a%d!=0)A++;
  if(c%b!=0)B++;
  if(A>=B)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}




Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint a[200005];
llint b[200005], c[200005];
llint d[25][25];

llint enc(string s)
{
	string t;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == '.'){
			t = s.substr(i+1);
			s = s.substr(0, i);
			break;
		}
	}
	while(t.size() < 9) t += "0";
	s += t;
	
	llint ret = 0;
	for(int i = 0; i < s.size(); i++){
		ret *= 10, ret += s[i]-'0';
	}
	return ret;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	string s;
	for(int i = 1; i <= n; i++){
		cin >> s;
		llint res = enc(s);
		//cout << res << endl;
		
		llint cnt = 0, cnt2 = 0;
		while(res % 2 == 0 && cnt < 20) res /= 2, cnt++;
		while(res % 5 == 0 && cnt2 < 20) res /= 5, cnt2++;
		cnt = min(cnt, 20LL), cnt2 = min(cnt2, 20LL);
		b[i] = cnt, c[i] = cnt2;
		//cout << cnt << " " << cnt2 << endl;
		d[cnt][cnt2]++;
	}
	
	llint ans = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 0; j <= 20; j++){
			for(int k = 0; k <= 20; k++){
				if(j+b[i] >= 18 && k+c[i] >= 18) ans += d[j][k];
			}
		}
		if(b[i] >= 9 && c[i] >= 9) ans--;
	}
	ans /= 2;
	cout << ans << endl;
	
	
	return 0;
}

Measured memory_bytes: 6716
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

// 無限大の値
const ll  lINF = 1LL << 60;
const int iINF = 1 << 29;


vvi graph(8, vi(8, 0));


int bfs(int s, int n, vi visited){
  if(accumulate(visited.begin(), visited.end(), 0)==n) return 1;

  int ret = 0;
  rep(i,n){
    if(!graph[s][i] || visited[i]) continue;

    visited[i] = 1;
    ret += bfs(i, n, visited);
    visited[i] = 0;
  }

  return ret;
}

int main(void){
  int n,m;
  cin >> n >> m;
  

  int a,b;
  rep(i,m){
    cin >> a >> b;
    graph[a-1][b-1] = graph[b-1][a-1] = 1;
  }

  vi visited(n);
  visited[0] = 1;
  cout << bfs(0, n, visited) << endl;
  return 0;
}

Measured memory_bytes: 3560
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
N = I()

ans = int(0)
cou = []

cou = make_divisors(N)
if cou[-1]!=int(N**(0.5)):
    ans = cou[-1]+cou[-2]-2
else:
    ans = 2*cou[-1]-2

#print(cou)
print(ans)


Measured memory_bytes: 3268
#include <cassert>
#include <functional>
#include <map>
#include <vector>
#include <numeric>
#include <iostream>
using namespace std;

bool solve(int n, int *a) {
    if (n == 1) return false;
    if ((accumulate(a, a+n, 0LL) + n) % 2) return true;
    if (n % 2 == 0) return false;
    if (find(a, a+n, 1) != a+n) return false;
    int c = 0;
    for (int i = 0; i < n; i++) if (a[i] % 2 == 1) c++;
    if (c > 1 || c == 0) return false;
    for (int i = 0; i < n; i++) if (a[i] % 2 == 1) a[i]--;
    int g = a[0];
    for (int i = 1; i < n; i++) g = gcd(g, a[i]);
    for (int i = 0; i < n; i++) a[i] /= g;
    return !solve(n, a);
}

bool test(int n, const int *a) {
    map<vector<int>, bool> cache;
    function<bool(vector<int> &)> solve = [&](vector<int> &v) {
        if (auto it = cache.find(v); it != cache.end())
            return it->second;
        for (int i = 0; i < v.size(); i++) {
            if (v[i] > 1) {
                vector<int> w = v;
                w[i]--;
                int g = w[0];
                for (int j = 0; j < w.size(); j++)
                    g = gcd(g, w[j]);
                if (g > 1) for (int & x : w) x /= g;
                if (!solve(w)) return cache[v] = true;
            }
        }
        return cache[v] = false;
    };
    auto vec = vector<int>(a, a+n);
    return solve(vec);
}

int main() {
    int n; cin >> n;
    int a[n]; for (int i = 0; i < n; i++) cin >> a[i];
    cout << (solve(n, a) ? "First\n" : "Second\n");

    // bool expect = test(n, a), ans = solve(n, a);
    // cout << (ans ? "First\n" : "Second\n");
    // assert(ans == expect);
}


Measured memory_bytes: 3500
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;

using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;

auto R(int s, int n) {
    return boost::irange(s, n);
}
auto R(int n) {
    return boost::irange(0, n);
}
void show(const auto& v){
    for(auto i:v) cout << i << " ";
    cout << endl;
}

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

int main()
{
    int n;
    cin>>n;
    ll a;
    cin>>a;
    for(int i:R(n-1)){
        ll b;
        cin>>b;
        if(a>b){
            ll c=g(a,b);
            a*=b/c;
        }else{
            ll c=g(b,a);
            a*=b/c;
        }
    }
    cout<<a<<endl;
    return 0;
}

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

#define BTC 380000.0

int main() {
    int N;
    cin >> N;
    vector<double>x(N);
    vector<string>u(N);
    for (int i = 0; i < N; ++i) {
        cin >> x[i] >> u[i];
    }

    double ans = 0;
    for (int i = 0; i < N; ++i) {
        if(u[i] == "JPY") {
            ans = ans + x[i];
        }else{
            ans = ans + (x[i] * BTC);
        }
    }
    cout << ans;
    return 0;
}

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

int main(){
  int A, B, C, D;
  int L, R;
  cin >> A >> B >> C >> D;
  L = A + B;
  R = C + D;
  if ( L >  R ){
      cout << "Left" << endl;
  }
  if ( L == R ){
      cout << "Balanced" << endl;
  }
  if ( L <  R ){
      cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

long long GCD(long long a, long long b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) { cin >> A[i]; }
    vector<ll> left(N), right(N);
    ll lgcd = A[0];
    for (int i = 0; i < N; i++) {
        lgcd = GCD(lgcd, A[i]);
        left[i] = lgcd;
    }

    ll rgcd = A[N - 1];

    for (int i = N - 1; i > -1; i--) {
        rgcd = GCD(rgcd, A[i]);
        right[i] = rgcd;
    }

    int lcur = 0, rcur = 2;
    ll ans = 1;
    ans = max(ans, max(right[1], left[N - 2]));
    ans = max(ans, max(lgcd, rgcd));
    while (rcur <= N - 1) {
        ans = max(ans, GCD(left[lcur], right[rcur]));
        lcur++;
        rcur++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 5616
from itertools import combinations_with_replacement

n, m, q = map(int, input().split())

query = []
num_list = list(range(m))

for _ in range(q):
    array = list(map(int, input().split()))
    query.append(array)

max_score = 0

for i in combinations_with_replacement(num_list, n):
    score = 0
    for a,b,c,d in query:
        if i[b-1] - i[a-1] == c:
            score += d
    if max_score < score:
        max_score = score

print(max_score)

Measured memory_bytes: 9044
#include <bits/stdc++.h>
#define MAX(a,b) (((a)>(b))?(a):(b))
using namespace std;

int main(){
    int r, g, b, n;
    int i, j, k;
    long long c = 0;
    cin >> r >> g >> b >> n;
    for(i = 0; i <= n; i++){
        for(j = 0; j + i <= n; j++){
            k = n - j - i;
            if(i % r == 0 && j % g == 0 && k % b == 0)
                c++;
        }
    }
    cout << c << endl;
}

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

int main() {
  int r;
  int g;
  int b;
  int number;

  cin >> r >> g >> b;

  number=100*r+10*g+b;

  if (number%4==0){
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) ((int)(a).size())
typedef long long int64;
int main(){
#ifdef LOCAL
  freopen(".a.in", "r", stdin);
#endif
  ios_base::sync_with_stdio(false),cout.tie(0),cin.tie(0);
  int t;cin>>t;
  cout<<(t^1)<<'\n';
  
  return 0;
}
//2020.09.13 20:00:37


Measured memory_bytes: 3648
#include <stdio.h>

int main()
{
	int n,max,min,x,i;
	double sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{	
		scanf("%d",&x);
		if(i==0)
		{
			max=x;
			min=x;
		}
		if(x>max)max=x;
		if(x<min)min=x;
		sum+=x;
	}
	
	printf("%d %d %.0lf\n",min,max,sum);
	return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_poizcy.hpp>
typedef long long  ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<double, double>  iidb;
typedef pair<ll, ii>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9+7;
const double PI = acos(-1);
const ll MOD= 1e9+7;
#define initseg ll new_nodo=(nodo*2),mid=(iz+der)/2;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define tam 210000
#define offset 200
#define ptr nodo*
const ll inf=2e18;
double v[tam];
const double EPS=1e-9;
int main()
{
	int n,k;
	cin>>n>>k;
	forr(i,0,n)
	{
		cin>>v[i];
		v[i]=log(v[i]);
	}
	double tot,sigtot;
	tot=sigtot=0;
	/*forr(i,0,n)
	{
		cout<<v[i]<<" ";
	}
	cout<<endl;*/
	forr(i,0,k)
	{
		tot+=v[i];
	}
	//cout<<tot<<endl;
	forr(i,k,n)
	{
		if (v[i-k]<v[i])
			cout<<"Yes\n";
		else
			cout<<"No\n";
		tot=sigtot;
	}

}				

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

string S;
vector<int> A, B;

void add(vector<int> &A, vector<int> &B) {
    while(A.size() < B.size()) A.push_back(0);
    int c = 0;
    for(int i = 0; i < A.size(); i++) {
        int bv = i < B.size()? B[i] : 0;
        A[i] += c + bv;
        c = A[i] / 10;
        A[i] %= 10;
    }
    if(c) A.push_back(c);
}

bool check(int x) {
    B.clear();
    int n = x;
    while(n) {
        B.push_back(n % 10);
        n /= 10;
    }
    add(B, A);

    int cnt = 0;
    for(int i = 0; i < B.size(); i++) {
        cnt += B[i];
    }
    return cnt <= x;
}

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

    cin >> S;

    for(int i = (int)S.size() - 1; i >= 0; i--) A.push_back(S[i] - '0');
    int c = 0;
    for(int i = 0; i < A.size(); i++) {
        A[i] = c + 9 * A[i];
        c = A[i] / 10;
        A[i] %= 10;
    }
    if(c) A.push_back(c);

    int s = 0, e = 1e7, p = -1;
    while(s <= e) {
        int m = (s + e)>>1;

        if(check(m)) {
            p = m;
            e = m - 1;
        }
        else s = m + 1;
    }
    printf("%d", (p + 8) / 9);
}


Measured memory_bytes: 5908
#include <iostream>
#include <string>
#include <map>
using namespace std;
 
int main()
{
  string s, t;
  cin >> s >> t;
 
  map<char, char> map1, map2;
  for(int i = 0; i < s.size(); i++){
    if(map1.find(s[i]) == map1.end()){
      map1[s[i]] = t[i];
    }else{
      if(map1[s[i]] != t[i]){
        cout << "No" << endl;
        return 0;
      }
    }
 
    if(map2.find(t[i]) == map2.end()){
      map2[t[i]] = s[i];
    }else{
      if(map2[t[i]] != s[i]){
        cout << "No" << endl;
        return 0;
      }
    }
  }
 
  cout << "Yes" << endl;
 
  return 0;
}

Measured memory_bytes: 776
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <string>

using namespace std;

void solve() {
    int64_t a, b, k;
    cin >> a >> b >> k;
    if(a > k){
        a -= k;
    } else {
        k -= a;
        a = 0;
        if(b > k){
            b -= k;
        } else {
            b = 0;
        }
    }
    cout << a << " " << b;
}

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

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    string s;
    cin >> s;
    if (s == "Sunny")
        cout << "Cloudy" << endl;
    else if (s == "Cloudy")
        cout << "Rainy" << endl;
    else
        cout << "Sunny" << endl;
    return 0;
}

Measured memory_bytes: 764
fun main(args: Array<String>)
{
    val (a, b, c, x, y) = readNInts()

    val candidate = mutableListOf<Int>()
    for (i in 0..(listOf(x, y).max()!! * 2) step 2)
    {
        var tmp = x - i / 2
        val na = if (tmp > 0) tmp else 0
        tmp = y - i / 2
        val nb = if (tmp > 0) tmp else 0

        candidate.add(a * na + b * nb + c * i)
    }

    println(candidate.min())
}

// Read an integer
// Usage: val a = readInt()
fun readInt() = readLine()!!.toInt()

// Read N integers separated by " "
// Usage: val (a, b, c) = readNInts()
fun readNInts() = readLine()!!.split(" ").map(String::toInt)

// Read a string
// Usage: val a = readString()
fun readString() = readLine()!!


Measured memory_bytes: 42348
n = int(input())
H = list(map(int, input().split()))
count = 0

while any(h for h in H):
	count += 1
	flag = False
	for i, h in enumerate(H):
		if h:
			flag = True
			H[i] -= 1
		else:
			if flag == True:
				break
print(count)

Measured memory_bytes: 41424
#include <stack>
#include <string>
#include <iostream>
using namespace std;

int main() {
	stack<int> S,T;
	string geo;
	int i,sum,deepness,part;
	i = 0;
	sum = 0;
	deepness = 0;
	part = 0;
	cin >> geo;
	while(geo[i]!='\0') {
		//cout << i << endl;
		if(geo[i]=='\\') {
			if(i!=0) {
				if((geo[i-1] != '\\') && (part != 0) ) {
					while((! T.empty())&& (deepness < T.top() )) {
						T.pop();
						int n = T.top();
						T.pop();
						part += n;
					}
					if(part !=0) T.push(part);
					T.push(deepness);
					part = 0;
				}
			}
			S.push(i);
			deepness +=1;
            //cout << deepness << endl;
		}
		else if(geo[i]=='/') {
			if(! S.empty()) {
				int k=S.top();
				S.pop();
				sum += i - k;
				part += i-k;
				deepness -= 1;
				//cout << deepness << endl;
			}
		}
		++i;
	}
	cout << sum << endl;
	if(part !=0) {
		while((! T.empty()) && (deepness < T.top() )) {
			T.pop();
			int n = T.top();
			T.pop();
			part += n;
		}
		T.push(part);
		T.push(deepness);
		part = 0;
	}
	i =0;
	stack<int> INV;
	while (! T.empty()) {
		T.pop();
		int m=T.top();
		T.pop();
		INV.push(m);
		++i;
	}
	cout << i;
	for(int l =0 ; l<i; ++l) {
		int m = INV.top();
		INV.pop();
		cout << " " << m;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1316
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

ll N, M, Q;
vector<ll> l, r, p, q;

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

    scanf("%lli%lli%lli", &N, &M, &Q);
    l.resize(M), r.resize(M), p.resize(Q), q.resize(Q);
    ll d[N][N];
    fill(d[0], d[N], 0);
    rep(i, M) {
        scanf("%lli%lli", &l[i], &r[i]);
        l[i]--, r[i]--;
        d[l[i]][r[i]]++;
    }
    ll dp[N][N];
    fill(dp[0], dp[N], 0);
    rep(i, N) {
        rep(j, N) {
            if (j == 0) dp[i][j] = d[i][j];
            else dp[i][j] = dp[i][j - 1] + d[i][j];
        }
    }

    rep(i, Q) {
        scanf("%lli%lli", &p[i], &q[i]);
        p[i]--, q[i]--;
        ll ans = 0;
        for (ll j = p[i]; j <= q[i]; ++j) {
            if (p[i] == 0) ans += dp[j][q[i]];
            else ans += dp[j][q[i]] - dp[j][p[i] - 1];
        }
        printf("%lli\n", ans);
    }
    return 0;
}

Measured memory_bytes: 9600
from collections import deque
from collections import OrderedDict

def main():
    N, *AB = map(int, open(0).read().split())
    C = [0]*N
    ans = 0
    for i in range(N):
        a = AB[i * 2 + 0]
        b = AB[i * 2 + 1]
        C[i] = a + b
        ans -= b
    C.sort(reverse=True)
    eaten = (N + 1) // 2
    for i in range(eaten):
        ans += C[2*i]
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 26028
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int n,a[maxn],b[maxn],a1[maxn],b1[maxn];
vector<int> G[maxn];
map<int,int> mp;
bool vis[maxn];
void dfs(int u)
{
	vis[u]=1;
	for (int i=0;i<G[u].size();i++)
	{
		int v=G[u][i];
		if (!vis[v]) dfs(v);
	}
}
int main()
{
	int col=0;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		a1[i]=a[i];
		a[n+1]^=a[i];
		if (!mp[a[i]]) mp[a[i]]=++col;
	}
	a1[n+1]=a[n+1];
	if (!mp[a[n+1]]) mp[a[n+1]]=++col;
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&b[i]);
		b1[i]=b[i];
		b[n+1]^=b[i];
		if (!mp[b[i]]) mp[b[i]]=++col;
	}
	b1[n+1]=b[n+1];
	if (!mp[b[n+1]]) mp[b[n+1]]=++col;
	sort(a1+1,a1+n+2);
	sort(b1+1,b1+n+2);
	for (int i=1;i<=n+1;i++)
	    if (a1[i]!=b1[i])
	    {
	    	cout<<"-1";
	    	return 0;
		}
	
	for (int i=1;i<=n+1;i++) a[i]=mp[a[i]],b[i]=mp[b[i]];
	int ans=0;
	for (int i=1;i<=n;i++)
	    if (a[i]!=b[i])
	    {
	    	ans++;
	        G[a[i]].push_back(b[i]);
	    }
	if (a[n+1]!=b[n+1]) G[a[n+1]].push_back(b[n+1]);
	for (int i=1;i<col;i++)
	    if (G[i].size()&&!vis[i])
	    {
		    dfs(i);
		    ans++;
		}
	if (!vis[col]) ans++;
	cout<<ans-1;
	return 0;
}

Measured memory_bytes: 15232
#include<iostream>
#include<stdio.h>
#include<cmath>
#include<string>
#include<string.h>
using namespace std;

class dice{
	public:
		int a[7];
		int b;
		void moveN(){
			b = a[1];
			a[1] = a[2];
			a[2] = a[6];
			a[6] = a[5];
			a[5] = b;
		}
		void moveE(){
			b = a[3];
			a[3] = a[1];
			a[1] = a[4];
			a[4] = a[6];
			a[6] = b;
		}
		void moveW(){
			b = a[1];
			a[1] = a[3];
			a[3] = a[6];
			a[6] = a[4];
			a[4] = b;
		}
		void moveS(){
			b = a[2];
			a[2] = a[1];
			a[1] = a[5];
			a[5] = a[6];
			a[6] = b;
		}
		void spinR(){
			b = a[2];
			a[2] = a[4];
			a[4] = a[5];
			a[5] = a[3];
			a[3] = b;
		}
		void spinL(){
			b = a[2];
			a[2] = a[3];
			a[3] = a[5];
			a[5] = a[4];
			a[4] = b;
		}
};
int main(){
	dice ans;
	int q, u, f;
	string com;
	for (int i = 1; i < 7; i++){
		cin >> ans.a[i];
	}
	cin >>q;
	for (int i = 0; i < q; i++){
		cin >> u >> f;
		if (ans.a[3] == u)ans.moveW();
		if (ans.a[4] == u)ans.moveE();
		for (;;){
			if (ans.a[1] == u){
				for (int k = 1; k < 5; k++){
					if (ans.a[2] == f){
						cout << ans.a[3] << endl;
						break;
					}
					ans.spinR();
				}
				break;
			}
			ans.moveS();
		}
	}
	/*for (int i = 0; i <= com.size(); i++){
		if (com[i] == 'N')ans.moveN();
		else if (com[i] == 'E')ans.moveE();
		else if (com[i] == 'W')ans.moveW();
		else if (com[i] == 'S')ans.moveS();
	}
	cout << ans.a[1] << endl;*/
	return 0;
}


Measured memory_bytes: 3076
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        int[][] x = new int[n][d];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < d; j++) {
                x[i][j] = sc.nextInt();
            }
        }

        int ans = 0;
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < i; j++) {
                double dist = 0;
                for (int k = 0; k < d; k++) {
                    dist += calc(x[i][k], x[j][k]);
                }

                // 整数？
                if (Math.sqrt(dist) % 1 == 0) {
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }

    private static double calc(int i, int j) {
        return Math.pow(Math.abs(i - j), 2);
    }
}


Measured memory_bytes: 23252
// D - Lucky PIN
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define all(x) (x).begin(),(x).end()
// #define lsearch(x,c) lower_bound((x).begin()+(c),(x).end(),(c))-(x).begin()
// #define usearch(x,c) upper_bound(all(x),(c))-(x).begin()

int main(){
	int N; string S; cin>>N>>S; S = "-" + S;
	// cout<<"+123456789+123456789+\n";//
	// cout<<S<<"\n";//

	vector<vector<int>> ix(10, vector<int>());
	for(int i=1; i<=N; i++) ix[S[i]-'0'].push_back(i);

	// for(int i=0; i<10; ++i){if(ix[i].size()<=0)continue;cout<<i<<") ";for(auto e:ix[i]){cout<<e<<" ";}puts("");}puts("---");///

	int ans = 0;
	rp(i,0,1000){

		int c1=i/100%10, c2=i/10%10, c3=i/1%10;
		int c,p;

		p = 0;
		c = c1;
		auto x = ix[c];
		p = lower_bound(x.begin(), x.end(), p) - x.begin();
		if(p>=x.size()) continue;

		p = x[p];
		c = c2;
		x = ix[c];
		p = lower_bound(x.begin(), x.end(), p+1) - x.begin();
		if(p>=x.size()) continue;

		p = x[p];
		c = c3;
		x = ix[c];
		p = lower_bound(x.begin(), x.end(), p+1) - x.begin();
		if(p>=x.size()) continue;

		// cout<<c1<<c2<<c3<<"\n";//
		ans++;
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 640
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		//		new Main().solveB();
		new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;
		int numX = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();
			numX = scanner.nextInt();

			if (numX - numA <= numB && numA <= numX) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {

		try (Scanner scanner = new Scanner(System.in)) {
			int numN = scanner.nextInt();
			int numM = scanner.nextInt();
			int numX = scanner.nextInt();

			Set<Integer> wk = new HashSet<Integer>();

			for (int i = 0; i < numM; i++) {
				wk.add(scanner.nextInt());
			}
			int res1 = 0;
			for (int i = numX; i <= numN; i++) {
				if (wk.contains(i)) {
					res1++;
				}

			}
			int res2 = 0;
			for (int i = 0; i <= numX; i++) {
				if (wk.contains(i)) {
					res2++;
				}

			}

			System.out.println(Math.min(res1, res2));

		}
	}

	private void solveC() {

		try (Scanner scanner = new Scanner(System.in)) {
			int numN = scanner.nextInt();
			//入力値
			long[] wk = new long[numN];
			//中央値算出用の配列
			long[] wk2 = new long[numN];

			for (int i = 0; i < wk.length; i++) {
				wk[i] = scanner.nextInt();
				wk2[i] = wk[i];
			}

			//中央値の算出
			Arrays.sort(wk2);

			//中央値の準備（１：中央値より大きい位置が除外された時の中央値　２：中央値より小さい値が除外された時の中央値）
			long m1 = wk2[(numN / 2) - 1];
			long m2 = wk2[(numN / 2)];

			for (int i = 0; i < wk.length; i++) {
				if (wk[i] <= m1) {
					System.out.println(wk2[numN / 2]);
				} else {
					System.out.println(wk2[(numN / 2) - 1]);
				}
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

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

using namespace std;

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

	vector<int> a(n);

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

sort(a.begin(),a.end());
double ans = a[0];
for(int i = 1;i < n;i++){
	ans = (ans + a[i])/2; 
}

cout << setprecision(6) <<fixed <<ans <<endl;
return 0;
}

Measured memory_bytes: 256
x = int(input())
if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 <= x <= 1999:
    print(1)

Measured memory_bytes: 9180
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <istream>
#include <sstream>
#include <iomanip>
using namespace std;

typedef ostringstream oss;
typedef istringstream iss;

string J(string str) {
	str += str[0];
	str.erase(str.begin());
	return str;
}

string C(string str) {
	str.insert(str.begin(), *(str.rbegin()));
	str.erase(str.size() - 1);
	return str;
}

string E(string str) {
	for (int i = 0; i < str.size() / 2; i++) {
		swap(str[i], str[(str.size() + 1) / 2  + i]);
	}
	return str;
}

string A(string str) {
	for (int i = 0; i < str.size() / 2; i++) {
		swap(str[i], str[str.size() - 1 - i]);
	}
	return str;
}

string P(string str) {
	for (int i = 0; i < str.size(); i++) {
		if (str[i] >= '0' && str[i] <= '8') {
			str[i]++;
		}else if (str[i] == '9') {
			str[i] = '0';
		}
	}
	return str;
}

string M(string str) {
	for (int i = 0; i < str.size(); i++) {
		if (str[i] >= '1' && str[i] <= '9') {
			str[i]--;
		}else if (str[i] == '0') {
			str[i] = '9';
		}
	}
	return str;
}

struct pFunc
{
	pFunc(){}
	pFunc(string (*p)(string str)) : f(p) {}
	string (*f)(string str);
};


int main(void) {
	map<char, pFunc> F;
	F['J'] = pFunc(C);
	F['C'] = pFunc(J);
	F['E'] = pFunc(E);
	F['A'] = pFunc(A);
	F['P'] = pFunc(M);
	F['M'] = pFunc(P);

	int N;
	cin >> N;
	cin.ignore();
	for (; N; N--) {
		string str, ope;
		getline(cin, ope);
		getline(cin, str);
		for (int i = ope.size() - 1; i >= 0; i--) {
			str = F[ope[i]].f(str);
		}
		cout << str << endl;
	}


	return 0;
}

Measured memory_bytes: 1220
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let n: i32 = read();
    let mut an :Vec<i32> = read_vec();
    an.sort();
    an.reverse();
    let mut ans = 0;
    for i in  0..an.len() {
        if i % 2 == 0 {
            ans += an[i];
        } else {
            ans -= an[i];
        }
    }
    println!("{}",ans);
}

Measured memory_bytes: 4476
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
#include <fstream>
#include <stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
//const ll INF = 100000000000010000;
//const ull B = 998244353;
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

vector<ll> dx = { 0, 1, 0, -1, 1, -1, 1, -1, 0};
vector<ll> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0};

void chmin(ll& x, ll y) {
	x = min(x, y);
}

void chmax(ll& x, ll y) {
	x = max(x, y);
}

ll pow_long(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y % 2 == 1) res *= x;
		x *= x;
		y /= 2;
	}
	return res;
}

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 1000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

string S;

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T = 1;
	//cin >> T;
	rep(i, T) solve();
}


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

int main(){
  long long N,M; cin >> N >> M;
  long long sum = 0;
  long long a,b;
  for(long long i=1;i<=N;i++){
      a = i-M; b = N%i-M+1;
   sum += N/i * max(a,(long long)0)+ max(b,(long long)0);
  }
  if(M == 0)sum -= N;
  cout << sum << endl;
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r; cin >> r;
    int ans = r*r;
    cout << ans << endl;
    return 0;
}

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

int main(){
  int N, K; cin >> N >> K;
  string S; cin >> S;
  S[K-1] = tolower(S[K-1]);
  cout << S;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define setp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 3e5 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r; 
}

void solve()
{
	int h, w;
	cin >> h >> w;
	map<int, int> cntX, cntY;
	map<pii, int> cntXY;
	map<int, vector<int> > g;
	int m;
	cin >> m;
	vector<pii> vals, v1, v2;
	set<pii> st;
	rep(i, m){
		int x, y;
		cin >> x >> y;
		cntX[x]++;
		cntY[y]++;
		g[x].pb(y);
		cntXY[mp(x, y)]++;
		vals.pb({x, y});
	}
	int res = 0;
	rep(i, m){
		int x = vals[i].F, y = vals[i].S;
		res = max(res, cntX[x] + cntY[y] - cntXY[mp(x, y)]);
	}
	multiset<pii> si;
	for(auto it : cntY) si.insert({it.S, it.F});
	for(auto it : cntX){
		int pres = it.S;
		for(auto to : g[it.F]){
			si.erase({cntY[to], to});
		}
		if(!si.empty()) pres += (*si.rbegin()).F;
		for(auto to : g[it.F]){
			si.insert({cntY[to], to});
		}
		res = max(res, pres);
	}
	cout << res;
}




int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
    // Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		long N = Long.parseLong(br.readLine());

		for (int h = 1; h <= 3500; h++) {
			for (int n = 1; n <= 3500; n++) {
				long up = N * h * n;
				long down = 4 * h * n - N * n - N * h;

				if (down == 0)
					continue;

				if (up % down != 0)
					continue;

				long w = up / down;

				if (0 < w && w <= 3500) {
					System.out.println(h + " " + n + " " + w);
					return;
				}
			}
		}
	}

	static boolean isInt(double d) {
		return d == (int) d;
	}
}

Measured memory_bytes: 37708
#include <bits/stdc++.h>
using namespace std;
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define mod 1000 * 1000 * 1000 + 7
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second
#define clr(x) x.clear()
#define LOG(x) std::cout << x << std::endl;

const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);

int a[105];

int main()
{
    int n;
    cin >> n;
    int tot = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        tot += a[i];
    }
    int ans = INF;
    for (int i = 0; i < n; ++i)
    {
        int x = 0, y = 0;
        for (int j = 0; j <= i; ++j)
        {
            x += a[j];
        }
        y = tot - x;
        ans = min(ans, abs(x - y));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1000+5;
queue<int>q[MAXN];
bool biaoji[MAXN];
int n;
bool pan()
{
	for(int i = 1;i <= n;i++){
		if(!q[i].empty()) return false;
	}
	return true;
}
int main()
{
	cin >> n;
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= n-1;j++){
			int t;
			scanf("%d",&t);
			q[i].push(t);
		}
	}
	for(int i = 1;;i++){
		memset(biaoji,true,sizeof(biaoji));
		if(pan()){
			cout << i - 1 << endl;
			break;
		}
			
		int flag = 0;
		for(int j = 1;j <= n;j++){
			if(biaoji[j] && !q[j].empty()){
				int t = q[j].front();
				if(biaoji[t] && !q[t].empty() && q[t].front() == j){
					biaoji[j] = false;
					biaoji[t] = false;
					flag = 1;
					q[j].pop();
					q[t].pop();
				}
			}
		}
		if(!flag){
			printf("-1\n");
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 6784
//求n以内素数个数以及所有素数
//复杂度O(n*loglogn)
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;
const int MAXN = 1000000+5;

int prime[MAXN]; //第i个素数
bool is_prime[MAXN+1]; //is_prime[i]为true表示i是素数，否则不是

//返回n以内素数个数
int seive(int n){
    int p=0;
    for(int i=0;i<=n;++i) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    for(int i=2;i<=n;++i){
        if(is_prime[i]){
            prime[p++]=i;
            for(int j=2*i;j<=n;j+=i) is_prime[j]=false;
        }
    }
    return p;
}

bool is_prime_large[MAXN]; // is_prime_large[i-a]=true <--> i是素数
//求区间[a,b)之间的素数及个数, a<b<=10^12, b-a<=10^6
int segment_sieve(ll a, ll b){
    seive((int)sqrt(b)+1);
    for(int i=0;i<b-a;++i) is_prime_large[i]=true;

    for(int i=2;(ll)i*i<b;++i){
        if(is_prime[i]){
            for(ll j=max(2LL,(a+i-1)/i)*i; j<b; j+=i) is_prime_large[j-a]=false;
        }
    }

    int p=0;
    for(ll i=a;i<b;++i){
        if(is_prime_large[i-a]) p++; 
    }
    return p;
}

int main(){
/*    ll a=22801763489, b=22801787297;*/
    //int p=segment_sieve(a,b);
    //cout<<"segment_sieve:"<<p<<endl;

    int n;
    while(cin>>n) {
        cout<<seive(n)<<endl;
    }
}


Measured memory_bytes: 4304