akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int X, Y, A, B, C;
	cin >> X >> Y >> A >> B >> C;

	int a[100000], b[100000], c[100000];
	rep(i, A) cin >> a[i];
	rep(i, B) cin >> b[i];
	rep(i, C) cin >> c[i];

	sort(a, a + A);
	reverse(a, a + A);
	sort(b, b + B);
	reverse(b, b + B);
	sort(c, c + C);
	reverse(c, c + C);

	ll kotae = 0;

	ll ctmp = 0;
	ll abtmp = 0;
	rep(i, X) abtmp += a[i];
	rep(i, Y) abtmp += b[i];
	int aa = X - 1;
	int bb = Y - 1;
	chmax(kotae, ctmp + abtmp);
	rep(i, min(C, X + Y)) {
		ctmp += c[i];
		if (aa == -1) {
			abtmp -= b[bb--];
		}
		else if (bb == -1) {
			abtmp -= a[aa--];
		}
		else {
			if (a[aa] < b[bb]) {
				abtmp -= a[aa--];
			}
			else abtmp -= b[bb--];
		}
		chmax(kotae, ctmp + abtmp);
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 1408
def solve():

    H, W = [int(i) for i in input().split()]
    alist = [input() for i in range(H)]

    cols = [False]*H
    rows = [False]*W

    for i in range(H):
        for j in range(W):
            if alist[i][j] == '#':
                cols[i] = True
                rows[j] = True

    for i in range(H):
        if cols[i]:
            for j in range(W):
                if rows[j]:
                    print(alist[i][j], end="")

            print()


if __name__ == "__main__":
    solve()


Measured memory_bytes: 42584
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache  # @lru_cache(None)
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**6)
# ----------------------------------------------------------- #

X = list(int(x) for x in input().split())
for i, x in enumerate(X, start=1):
    if i != x:
        print(i)
        exit()

Measured memory_bytes: 72484
#include<bits/stdc++.h>
#define        ll    long long int
#define        sz    100100

using namespace std;

ll hp[sz][5],n;
ll vis[sz][5];
ll dp[sz][5];

ll tani(ll d,ll pre)
{
    if(d>n)return 0;

    if(vis[d][pre]==1)return dp[d][pre];

    vis[d][pre]=1;

    if(pre==0)
    {
        return dp[d][pre]=max(hp[d][1]+tani(d+1,1),max(hp[d][2]+tani(d+1,2),hp[d][3]+tani(d+1,3)));
    }
    else if(pre==1)
    {
        return dp[d][pre]=max(hp[d][2]+tani(d+1,2),hp[d][3]+tani(d+1,3));
    }
    else if(pre==2)
    {
        return dp[d][pre]=max(hp[d][1]+tani(d+1,1),hp[d][3]+tani(d+1,3));
    }
    else
    {
        return dp[d][pre]=max(hp[d][1]+tani(d+1,1),hp[d][2]+tani(d+1,2));
    }
}

int main()
{
     ll i,j,p;

     cin>>n;

     for(i=1;i<=n;i++)
     {
         for(j=1;j<=3;j++)
         {
             cin>>hp[i][j];
         }
     }
     p=tani(1,0);
     cout<<p<<endl;

     return 0;
}


Measured memory_bytes: 16640
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
int kaijou(int n){
    int a=1;
  if(n==0){
    return 1;
  }
    REP(i,n){
        a*=i+1;
    }
    return a;
}
int ncr(int n,int r){
  int a;
  if(n<0||r<0||n<r){
    return 0;
  }
  a=kaijou(n)/kaijou(r)/kaijou(n-r);
  return a;
}
//cout << setprecision(123);
int main(){
  ll A,B,C,D,ansa,ansb,ans,X;
  cin>>A>>B>>C>>D;
 X=C*D/gcd(C,D);
  ansb=B-B/C-B/D+B/X;
  ansa=A-1-(A-1)/C-(A-1)/D+(A-1)/X;
  
  
  ans=ansb-ansa;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vb = vector<bool>;
using vs = vector<string>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const ld eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1; i>=(a); i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl;})

int main(){
	cin.sync_with_stdio(0);

	ll temp;
	cin >> temp;

	if(temp >= 30){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std; 
using ll = long long;
using ld = long double;
vector<vector<ld>> memo(3e3, vector<ld>(3e3, -1));

ld dp(vector<ld> &v, int i, int n){
	if(i >= v.size())
		return n > v.size()-n;
	if(memo[i][n] != -1)
		return memo[i][n];

	memo[i][n] = dp(v, i+1, n+1)*v[i];
	memo[i][n] += dp(v, i+1, n)*(1-v[i]);
	return memo[i][n];
}

signed main() { 
	cin.tie(0);
	cin.sync_with_stdio();
	int n; 
	cin>>n;
	vector<ld> v(n);
	for(ld &i : v)
		cin>>i;
	cout<<setprecision(20)<<dp(v, 0, 0);
}


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

typedef double db;
typedef int in;
typedef long int li;
typedef long long int lli;
typedef long ld;
typedef long lld;

#define pi M_PI
#define in scanf
#define out printf
#define inf INT_MAX
#define rep(i,n) for(int i=0;i<n;++i)
#define repi(i,j,n) for(int i=j;i<n;++i)
#define debugd(d) printf("%d\n",d)
#define debugs(s) printf("%s\n",s)
#define debugc(c) printf("%c\n",c)
#define debugf(f) printf("%f\n",f)

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
int compare_intr(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}


int main (void)
{
  int r,g;
  scanf("%d\n",&r);
  scanf("%d\n",&g);
  printf("%d\n",2*g-r);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string.h>
using namespace std;

int main(){
    int n, k;

    cin >> n >> k;

    long long count;

    for(int i = 1; i <= n; i++){
        if(i == 1){
            count = k;
        }
        else{
            count = count * (k - 1);
        }

    }

    printf("%lld\n", count);

    return 0;
}

Measured memory_bytes: 256
from heapq import heappush,heappop,heapify

n = int(input())
G = [[] for _ in range(n)]
info = []

for i in range(n):
    info =  list(map(int,(input().split())))[2:]
    for j in range(int((len(info))/2)):
        G[i].append((info[2*j],info[2*j+1]))

color = ["white" for _ in range(n)]
dist = [(1<<21) for _ in range(n)]
que = []

def dijkstra():
    dist[0] = 0
    que.append((0,0)) #(dist,node)
    while que:
        # heapify(que)
        now = heappop(que)
        u = now[1]
        if dist[u] < now[0]:
            continue
        # print(u)
        color[u] = "black"
        for j in range(len(G[u])):
            if dist[u] + G[u][j][1] < dist[G[u][j][0]]:
                heappush(que,(dist[u] + G[u][j][1],G[u][j][0]))
                dist[G[u][j][0]] = dist[u] + G[u][j][1]

# for i in range(n):
#     print(*G[i])

dijkstra()

for i,dist in enumerate(dist):
    print(i,dist)



Measured memory_bytes: 69096
// https://ynucpc.github.io/blog/2018/04/15/cp_vscode/
// http://www.atmarkit.co.jp/ait/articles/1509/08/news019.html

#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rep3(i,n,m) for(ll i=(n);i<(ll)(m);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 max(a, b) ((a) > (b) ? (a) : (b))
// #define min(a, b) ((a) < (b) ? (a) : (b)) 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
int _stoi(string s, int tmp=10){
	istringstream stm(s);
	int res;
	stm >> res;
	return res;
}
double _stod(string s, int tmp=10){
	istringstream stm(s);
	double res;
	stm >> res;
	return res;
}
template<typename T>string to_string(const T& n){
	std::ostringstream stm;
	stm << n;
	return stm.str();
}

// 降順ソート: sort(A, A+N, greater<>());
// min: *min_element(A, A+N)
// argmin: min_element(A, A+N)-A

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


int main(){	
	// ll A; cin >> A;
	// cout << "hello" << _stoi("14") << max({1,3}) << endl;
	
	ll N;
	cin >> N;
	// ll dp[N+1][16] = {};
	// rep(i, 16){
	// 	dp[3][i] = (i!=2 && i!=6 && i!=9) ? 4 : 3;
	// }
	// for (ll i=4; i<=N; i++){
	// 	rep(j, 16){
	// 		for (int k=0; k<16; k+=4){
	// 			if (!((j/4+k==1 && j==6)
	// 				|| (j/4+k==2 && j==9)
	// 				|| (j/4+k==4 && j==2))){
	// 				dp[i][j] += dp[i-1][(j/4+k)];
	// 			}
	// 		}
	// 	}
	// }

	ll dp[N+1][4][4][4]={};
	rep(i, 4)rep(j, 4)rep(k, 4)if(
		(i==0 && j==1 && k==2) ||
		(i==0 && j==2 && k==1) ||
		(i==1 && j==0 && k==2)
	){
		dp[3][i][j][k]=0;
	}else{
		dp[3][i][j][k]=1;
	}
	for (ll n=4; n<=N; n++)
		rep(i, 4)rep(j, 4)rep(k, 4)rep(l, 4)
			if(!(
				(j==0 && k==1 && l==2) ||
				(j==0 && k==2 && l==1) ||
				(j==1 && k==0 && l==2) ||
				(i==0 && j==1 && l==2) ||
				(i==0 && k==1 && l==2)
			)){
				dp[n][j][k][l] += dp[n-1][i][j][k];
				dp[n][j][k][l] %= 1000000007;
			}
	
	ll ans=0;
	rep(i, 4)rep(j, 4)rep(k, 4)ans += dp[N][i][j][k];
	cout << ans%1000000007 << endl;


}








Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<utility>
#include<iomanip>
using namespace std;
int read(){
    int xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
long long READ(){
    long long xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
char one(){
	char ch=getchar();
	while(ch==' '||ch=='\n')
		ch=getchar();
	return ch;
}
int main(){
	//freopen("in.txt","r",stdin);
	int n=read(),k=read();
	int ans=0;
	while(n)
		ans++,n/=k;
	printf("%d\n",ans);
	return 0;
}





Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Comparator;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C2DPlane2NPoints solver = new C2DPlane2NPoints();
        solver.solve(1, in, out);
        out.close();
    }

    static class C2DPlane2NPoints {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            IntPair[] red = new IntPair[n];
            IntPair[] blue = new IntPair[n];
            boolean[] used = new boolean[n];
            Arrays.fill(used, false);
            int cnt = 0;

            for (int i = 0; i < n; i++) {
                red[i] = new IntPair(in.nextInt(), in.nextInt());
            }
            for (int i = 0; i < n; i++) {
                blue[i] = new IntPair(in.nextInt(), in.nextInt());
            }

            Comparator<IntPair> rcmp = Comparator.comparing(IntPair::getY).reversed();
            Comparator<IntPair> bcmp = Comparator.comparing(IntPair::getX);

            Arrays.sort(red, rcmp);
            Arrays.sort(blue, bcmp);

            // System.out.println(Arrays.toString(red));
            // System.out.println(Arrays.toString(blue));

            for (int j = 0; j < n; j++) {
                for (int i = 0; i < n; i++) {
                    if (!used[i] && red[i].x < blue[j].x && red[i].y < blue[j].y) {
                        used[i] = true;
                        cnt++;
                        break;
                    }
                }
            }

            out.println(cnt);

        }

    }

    static class IntPair {
        public int x;
        public int y;

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        public IntPair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public String toString() {
            return "IntPair{" +
                    "x=" + x +
                    ", y=" + y +
                    '}';
        }

    }
}



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

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

	switch (D) {
	case 25:
		cout << "Christmas" << endl;
		break;
	case 24:
		cout << "Christmas Eve" << endl;
		break;
	case 23:
		cout << "Christmas Eve Eve" << endl;
		break;
	case 22:
		cout << "Christmas Eve Eve Eve" << endl;
		break;
	}
}

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

int deg[10];

signed main()
{
	//ios::sync_with_stdio(false);
	int a1,b1,a2,b2,a3,b3;
	cin>>a1>>b1>>a2>>b2>>a3>>b3;
	deg[a1]++;deg[a2]++;deg[a3]++;
	deg[b1]++;deg[b2]++;deg[b3]++;
	int cnt=0;
	for(int i=1;i<=4;i++){
		if(deg[i]==0){
			cout<<"NO"<<endl;
			return 0;
		}
		if(deg[i]%2==1) cnt++;
	}
	if(cnt==0||cnt==2) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
 * Author:  heyuhhh
 * Created Time:  2020/6/22 10:01:22
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <assert.h>
#include <functional>
#include <numeric>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << std::endl; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
  template <template<typename...> class T, typename t, typename... A> 
  void err(const T <t> &arg, const A&... args) {
  for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
  #define dbg(...)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e6 + 5;

void run() {
    int n; cin >> n;
    vector <int> a(n);
    vector <bool> check(N), vis(N);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (vis[a[i]]) {
            check[a[i]] = true;
        }
        vis[a[i]] = true;
    }
    for (int i = 1; i < N; i++) if (vis[i]) {
        for (int j = i + i; j < N; j += i) {
            check[j] = true;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (!check[a[i]]) ++ans;
    }
    cout << ans << '\n';
}

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

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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define maxn 100
#define int long long int
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

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

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

int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0)
    {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x)
{ //bit計算
    if (x == 0)
        return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void)
{
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++)
    {
        if (!prime[i])
        {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i)
        {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
signed main()
{
    int N;
    cin >> N;
    bool wl = true;
    rep(i, N)
    {

        int A;
        cin >> A;
        if (A % 2 == 1)
        {
            wl = false;
        }
    }
    if (!wl)
    {
        cout << "first" << endl;
    }
    else
    {
        cout << "second" << endl;
    }
}


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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) reps(i,0,((n)+1))
#define repst(i,s,n) reps(i,s,((n)+1))
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (i==n-1?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ');}}

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

// まずはgrundy数の実験をする
// k==2のとき 0,0,1,0,2,1,3,0,4,2,5,1,6,3,7,0,8,4,9,2,... となる 奇数番目は0,1,2,... 偶数番目は0,0,1,0,2,1,3,0,4,2,...
// k==3のときは3個ごとに0,1,2,...
// g(n)	= n/k (n%k==0)
//		= g(n-1-[n/k]) (else)
// この式の通りに求めようとすると[n/k]が小さい場合に時間がかかる ここを一気にスキップできるようにすればいい

ll n, a, k, x;

ll g(ll a, ll k) {
	ll x, t;
	while (a>=k) {
		x = a/k, t = a%k;
		t %= x+1;
		if (t==0) return x;
		a = (k-1)*x + t-1;
	}
	return 0;
}

signed main() {
	cin >> n;
	rep(i,n) {
		cin >> a >> k;
		x ^= g(a,k);
	}
	cout << (x ? "Takahashi" : "Aoki") << ln;
}

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

int main()
{
	int x, y;
	while (cin >> x >> y, x || y) {
		if (x <= y) {
			cout << x << ' ' << y << endl;
		}
		else {
			cout << y << ' ' << x << endl;
		}
	}
	return 0;
}

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

int H, W, dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}, dist[2005][2005][4];
char A[2005][2005];

int dfs(int ci, int cj, int x){
    if(A[ci][cj]=='#') return dist[ci][cj][x] = 0;
    if(dist[ci][cj][x]>-1) return dist[ci][cj][x];
    int ni = ci + dx[x], nj = cj + dy[x];
    if(0<=ni and ni<=H and 0<=nj and nj<=W) return dist[ci][cj][x] = dfs(ni, nj, x) + 1;
    else return dist[ci][cj][x] = 1;
}

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    cin>>H>>W;
    int ans = 0;
    for(int i=0;i<H;i++)for(int j=0;j<W;j++) cin>>A[i][j];
    for(int i=0;i<H;i++)for(int j=0;j<W;j++) for(int k=0;k<4;k++) dist[i][j][k] = -1;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(A[i][j]=='.'){
                int cur = 0;
                for(int k=0;k<4;k++) cur += dfs(i, j, k);
                ans = max(ans, cur-3);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 66944
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if ((a == 5 && b == 5 && c == 7) || (a == 5 && b == 7 && c == 5) || (a == 7 && b == 5 && c == 5))cout << "YES" << endl;
	else cout << "NO" << endl;
	int x;
	cin >> x;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>

typedef long long ll;
const int N=101000;
int A[N],B[N];
int n;
ll ans;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d%d",A+i,B+i),A[i]%=B[i];
	ans=0;
	for(int i=n;i;i--)
	{
		A[i]=(ans+A[i])%B[i];
		if(A[i]!=0)ans+=B[i]-A[i];
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int abs(int n){
    if (n < 0){
        n = -1 * n;
    }
    return n;
}

int main(){
    long long N;
    cin >> N;

    vector <int> ans(0);
    int count = 0;

    if (N == 0){
        ans.push_back(0);
        count = 1;
    }else{
        while (N != 0){
            long long a = pow(-2, count);
            long long b = pow(2, count + 1);
            long long n = abs(N);

            if (n % b == 0){
                ans.push_back(0);
            }else{
                N -= a;
                ans.push_back(1);
            }
            count ++;
        }
    }
    
    for (int i = count - 1; i >= 0; i--){
        cout << ans[i];
    }
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;

int n, m;
int d[60][60];
int a[60];
int b[60];
int r[60][60];

void warshall_floyd() {
	for (int k = 0; k < n; k++) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				d[i][j] = min(d[i][k] + d[k][j], d[i][j]);
			}
		}
	}
}

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

	int ai, bi;
	for (int i = 0; i < m; i++) {
		cin >> ai >> bi;
		ai--; bi--;
		a[i] = ai; b[i] = bi;

	}

	for (int I = 0; I < n; I++) {
		for (int J = 0; J < n; J++) {
			if (I != J)d[I][J] = INF;
			else d[I][J] = 0;
		}
	}
	for (int j = 0; j < m; j++) {
		d[a[j]][b[j]] = 1;
		d[b[j]][a[j]] = 1;
	}
	warshall_floyd();
	for (int I = 0; I < n; I++) {
		for (int J = 0; J < n; J++) {
			//cout << d[I][J]<<" ";

			if (d[I][J] != INF) {
				r[I][J]++;
			}
		}
		//cout << endl;
	}



	int ans = 0;
	for (int i = 0; i < m; i++) {
		for (int I = 0; I < n; I++) {
			for (int J = 0; J < n; J++) {
				if(I!=J)d[I][J] = INF;
				else d[I][J] = 0;
			}
		}
		for (int j = 0; j < m; j++) {
			d[a[j]][b[j]] = 1;
			d[b[j]][a[j]] = 1;
		}
		d[a[i]][b[i]] = INF;
		d[b[i]][a[i]] = INF;
		warshall_floyd();
		int ope = 0;
		for (int I = 0; I < n; I++) {
			for (int J = 0; J < n; J++) {
				if (d[I][J] == INF&&r[I][J]!=0)ope++;
			}
		}
		if (ope != 0)ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/10;
const ll MOD = 1e9+7;

int main(){
  ll N,M;cin >> N >>M;
  vector<vint> g(N);
  repeat(i,M){
    int A,B;cin >> A >> B;
    A--;B--;
    g[A].push_back(B);
    g[B].push_back(A);
  }
  vector<bool> used(N,false);
  vector<int> color(N,0);
  ll black=0;
  bool oddcycle=false;
  queue<int> Q;
  Q.push(0);
  color[0]=1;
  while(!oddcycle&&!Q.empty()){
    int u = Q.front();
    Q.pop();
    if(used[u]) continue;
    used[u] = true;
    if(color[u]>0) black++;
    for(int v:g[u]){
      if(color[v]==color[u]){
        oddcycle=true;
        break;
      }
      color[v] = -color[u];
      Q.push(v);
    }
  }
  ll ans=0;
  if(oddcycle){
    ans = N*(N-1)/2-M;
  }else{
    ans = (N-black)*black-M;
  }
  cout << ans <<endl;
  return 0;
}


Measured memory_bytes: 6272
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
    public static void main (String[] args) throws java.lang.Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        long S = Long.parseLong(lines[0]);
        long C = Long.parseLong(lines[1]);
        
        long ans = Math.min(S,C/2);
        
        S -= ans;
        C -= ans*2;
        
        ans += C/4;
        
        System.out.println(Long.toString(ans));
    }
}

Measured memory_bytes: 23124
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
using namespace std;
#define fi first
#define se second
typedef long long lli;
typedef pair<int, int> pii;
int n;
string s[3];

void ReadInput()
{
    cin >> n;
    for(int i = 0; i < 3; ++i)
        cin >> s[i];
}

void Solve()
{
    int ans = 0;
    for(int i = 0; i < n; ++i)
    {
        set<char> st;
        for(int j = 0; j < 3; ++j)
            st.insert(s[j][i]);
        ans += (int)st.size() - 1;
    }

    cout << ans << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ReadInput();
    Solve();
}


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

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

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

    let mut iter = buf.split_whitespace();
    let k: i32 = iter.next().unwrap().parse().unwrap();
    println!("{}", k / 2 * (k - k/2));
}



Measured memory_bytes: 4352
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<sstream>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 1000000000+7
using namespace std;
typedef long long ll;

bool isACGT(char c){
  string s = "ACGT";
  for(auto b:s){
    if(c == b){
      return true;
    }
  }
  return false;
}

int main(){
  string s; cin >> s;
  int ans = 0;
  rep(i, 0, s.length()){
    int tmp = 0;
    rep(j, i, s.length()){
      if(isACGT(s[j])){
        tmp++;
      }else{
        break;
      }
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
using System;

namespace ABC108_C{
    class Program{
        static void Main(string[] args){
            var input  = Console.ReadLine().Split(' ');
            var n = long.Parse(input[0]);
            var k = long.Parse(input[1]);

            var ans = (long)Math.Pow(n / k,3);
            var temp = 0;
            if(k % 2 == 0){
                for(var i = 1;i <= n;i++){
                    if(i % k == k / 2){
                        temp++;
                    }
                }
            }
            ans += (long)Math.Pow(temp,3);
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}

int myGCD(int A, int B)
{
  int a = A, b = B;
  while (a * b != 0  &&  a != 1  &&  b != 1)
  {
    if (a < b) b %= a;
    else a %= b;
  }
  if (a * b == 0) return max(a, b);
  else return 1;
}

int myLCM(int A, int B)
{
  return A * B / myGCD(A, B);
}

int f(int a, int c, int d)
{
  return a - (a / c + a / d - a / myLCM(c, d));
}

signed main()
{
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  int ans = f(B, C, D) - f(A - 1, C, D);

  cout << ans << endl;
  
  //cerr << f(B, C, D) << " " << f(A - 1, C, D) << endl;
}

Measured memory_bytes: 256
A, B, C, X = map(int, [input() for i in  range(4)])
counter = 0
numA=min(X//500, A)
for a in range(0,numA+1):
    numB=min((X-500*a)//100,B)
    for b in range(0, numB+1):
        for c in range(0, C+1):
            if (X-500*a-100*b)-50*c==0:
                counter+=1
print(counter)

Measured memory_bytes: 40048
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<long long> X(M);
    rep(i, M) cin >> X[i];
    
    sort(X.begin(), X.end());
    vector<long long> Y(M - 1);
    REP(i, M) Y[i - 1] = X[i] - X[i - 1];
    sort(Y.rbegin(), Y.rend());
    long long ans = X[M - 1] - X[0];
    rep(i, min(N - 1, M - 1)) ans -= Y[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] h = new int[n+1];
        for(int i = 0; i < n; i++){
            h[i] = Integer.parseInt(sc.next());
        }
        
        int count = 0;
        for(int i = 1; i <= 100; i++){
            for(int j = 0; j < n; j++){
                if(h[j] >= i && h[j+1] < i){
                    count++;
                }
            }
        }
        
        System.out.println(count);
    }
}

Measured memory_bytes: 25044
#include<bits/stdc++.h>
using namespace std;
#define debug(x)        cout<<#x<<" :"<<x<<endl;
#define ff              first
#define ss              second
#define ar              array
#define int             long long
#define ld              long double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define f(i,n)          for(int i=0;i<n;i++)
#define MOD             1000000007
#define pi              3.14159265
#define umii            unordered_map<int,int>
#define umci            unordered_map<char,int>
#define umsi            unordered_map<string,int>

void k_007()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("ip1.txt", "r", stdin);
	freopen("op1.txt", "w", stdout);
#endif
}

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
	return (a.second < b.second);
}
int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int prime(int n) {
	int flag = 1;
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0) {flag = 0; break;}
	}
	return flag;
}
int power(int x, int y)
{
	if (y == 0)
		return 1;
	else if (y % 2 == 0)
		return ((power(x, y / 2) % MOD) * ( power(x, y / 2) % MOD)) % MOD;
	else
		return ((x % MOD) * (power(x, y / 2) % MOD) * (power(x, y / 2) % MOD)) % MOD;
}
int lcm(int a, int b)
{
	return (a * b) / gcd(a, b);
}
// int JUDGE_ONLINE = 1;
// if (fopen("ip1.txt", "r")) {
// 	JUDGE_ONLINE = 0;
// 	assert(freopen("ip1.txt", "r", stdin));
// 	assert(freopen("op1.txt", "w", stdout));
// }

// if (!JUDGE_ONLINE) {
// 	cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
// }
int ai(char c)
{
	return (c - '0');
}
int32_t main()
{
	k_007();
	int x;
	cin>>x;
	if(x >= 30)
	{
		cout<<"Yes";
	}
	else
		cout<<"No";
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> PLL;
#define chmax(x, y) do { x = max(x, y); } while(0)
#define chmin(x, y) do { x = min(x, y); } while(0)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<ll>(a); i < static_cast<ll>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
template<typename T>
using reversed_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T> >;


signed main() {
  ll A, B, H, M;
  cin >> A >> B >> H >> M;
  double theta1 = 2 * M_PI * (H * 60 + M) / (12 * 60.0);
  double theta2 = 2 * M_PI * M / 60.0;
  double x1 = A * cos(theta1), y1 = A * sin(theta1);
  double x2 = B * cos(theta2), y2 = B * sin(theta2);
  double ans = sqrt((x1-x2) * (x1-x2) + (y1-y2) * (y1-y2));
  cout << setprecision(10) << ans << endl;
  return 0;
}


Measured memory_bytes: 4160
N = int(input())
h = list(map(int,input().split()))
sorth = sorted(h)[::-1]
count = 0
time = 0
while(h !=[0]*N):
    for i in range(N):
        if i == N-1 and h[i] > 0:
            count += 1
        elif h[i] > 0 and h[i+1] == 0 : count += 1
        h[i] -= 1 if h[i] > 0 else 0
print(count)      

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;

#define what_is(x) cerr << #x << " is " << x << endl;

const int N = 1e5+1;

ll n, ans, a[N];

int main () {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	// cout.precision(1); cout << fixed;
	cin >> n; ans = 1;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	ans = __gcd(a[0], a[1]);
	for (int i = 2; i < n; i++)
		ans = __gcd(ans, a[i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
import bisect

x ,n=map(int,input().split())
p=list(map(int,input().split()))

p.sort()

index = bisect.bisect_left(p,x)

if n==0:
    print(x)
else:
    p= p+[p[n-1]+2]
    for i in range(n):
        # print(index-i, index+i)
        if p[max(index-i,0)] != x-i:
            print(x-i)
            break
        elif p[min(index+i,n)] != x+i:
            print(x+i)
            break
    else:
        print(p[0]-1)


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

int main()
{
  double n;

  while (cin >> n){
    double sum = 0;
    sum += n;
    for (int i = 2; i <= 10; i++){
      if (i % 2 == 0){
        n *= 2;
      }
      else {
        n /= 3;
      }
      sum += n;
    }
    printf("%.8f\n", sum);
  }

  return (0);
}

Measured memory_bytes: 1236
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{

    class Program
    {
        static void Main(string[] args)
        {
            int length = int.Parse(Console.ReadLine());
            string A = Console.ReadLine();
            string B = Console.ReadLine();
            string C = Console.ReadLine();
            int output = 0;
            for (int i = 0; i < length; i++)
            {
                Hashtable pair = new Hashtable();
                pair[A[i]] = 1;
                if (pair.ContainsKey(B[i]))
                {
                    pair[B[i]] = 2;
                }
                else
                {
                    pair[B[i]] = 1;
                }

                if (pair.ContainsKey(C[i]))
                {
                    pair[C[i]] = int.Parse(pair[C[i]].ToString()) + 1;
                }
                else
                {
                    pair[C[i]] = 1;
                }

                switch (pair.Keys.Count)
                {
                    case 3:
                        output++;
                        output++;
                        break;
                    case 2:
                        output++;
                        break;
                    case 1:
                        break;

                }
            }
            Console.WriteLine(output);

        }
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

//#define int long long
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>void put_double(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
template<class T>void print(T a){cout << a << endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    int n; cin >> n;
    int sum = 1, i = 2;
    while(sum < n) {
        sum += i;
        if(sum >= n) {
            int d = sum - n;
            repi(j, 1, i + 1) {
                if(j == d) continue;
                print(j);
            }
            return 0;
        }
        i++;
    }
    print(1);
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <climits>
#include <cmath>
#include <utility>
#include <iomanip>
//#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long int;
//// 任意長整数型
//namespace mp = boost::multiprecision;
//using Bint = mp::cpp_int;



int main(int argc, char *argv[])
{
	string s;
	//input
	cin >> s;



	//calc
	int ans = 0;
	
	if (s == "RRR"){
		ans = 3;
	}
	else if (s == "RRS" || s == "SRR"){
		ans = 2;
	}
	else if (s == "SSS"){
		ans = 0;
	}
	else{
		ans = 1;
	}


	//ans
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3540
import java.util.*;
import static java.lang.Math.*;

public class Main {
    
    static int[] a;
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "ABC";
		if(s.equals(result)) result = "ARC";
		
		// 出力
		System.out.println(result);
	}
}


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

int main() {
    ll N;
    cin >> N;

    vector<int> a;
    while (N > 26) {
        if (N % 26 == 0) {
            a.push_back(26);
            N /= 26;
            N -= 1;
        } else {
            a.push_back(N % 26);
            N /= 26;
        }
    }

    a.push_back(N);

    for (int i = a.size() - 1; i >= 0; i--) {
        printf("%c", 'a' + a[i] - 1);
    }

    printf("\n");
    return 0;
}


Measured memory_bytes: 3596
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <map>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

const long long int MOD = 1000000007;

int ctoi(char c) {
	if (c >= '0' && c <= '9')
		return c - '0';
	else
		return -1;
}

int main()
{
	long long int n, cnt = 0;

	cin >> n;
	
	vector <long long int> l(n);

	for (int i = 0; i < n; i++)
		cin >> l[i];

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

	for (int i = n - 3; i >= 0; i--) {
		for (int j = n - 2; j > i; j--) {
			for (int k = j + 1; k < n; k++) {
				if (l[i] + l[j] > l[k])
					cnt++;
				else
					break;
			}
		}
	}

	cout << cnt << endl;
	

	return 0;

}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i=0; i<N; ++i) cin >> a[i];

    // 降順にsort
    // sort(a.begin(), a.end(), [](int a, int b){
    //     return a > b;
    // });

    // これでもok
    std::sort(a.begin(), a.end(), std::greater<int>());

    int f = 0;
    int s = 0;
    for(int i=0; i<N; i+=2) {
        if(i==N-1) {
            f += a[i]; 
        }
        else {
            f += a[i];
            s += a[i+1];
        }
    }
    cout << f - s << endl;
}

Measured memory_bytes: 256
S = input()
flag = True
cnt = 1
for char in S:
    if cnt % 2 == 0:
        if not (char == "L" or char == "U" or char == "D"):
            flag = False
    else:
        if not (char == "R" or char == "U" or char == "D"):
            flag = False
    cnt = cnt + 1

if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38256
'use strict';
(function(stdin) { 
  var inputs = stdin.toString();
  var params = inputs.split('\n')[0].split(' ').map(Number);
  (function(W,H,x,y,r) {
    //????????????????????????
    if(x - r < 0 || y - r < 0 || x + r > W || y + r > H){
      console.log('No');
    }else{
      console.log('Yes');
    }
    }(params[0],params[1],params[2],params[3],params[4])); 
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7380
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    string s;
    cin >> s;
    int n = (int)s.size();
    if(s[n-1] == 's'){
        cout << s << "es" << endl; 
    }else{
        cout << s << "s" << endl; 
    }
}

Measured memory_bytes: 3580
import java.util.Scanner;
     
    class Main{
    	public static void main(String arg[]) {
    		Scanner sc = new Scanner(System.in);
    		int A = sc.nextInt();
    		int B = sc.nextInt();
    		int C = sc.nextInt();
    		int D = sc.nextInt();
    		sc.close();
    		int[] Alice = new int[102];
    		int[] Bob = new int[102];
    		int count = 0;
    		
    		for(int i = 0; i <= 100; i++ ) {
    			if( i < A || i >= B) {
    				Alice[i] = 999;
    			}else {
    				Alice[i]= i; 
    			}
    		}
    		
    		for(int i = 0; i <= 100; i++ ) {
    			if( i < C || i >= D) {
    				Bob[i] = 998;
    			}else {
    				Bob[i]= i; 
    			} 
    		}
    		
    		for(int i = 0; i <= 100; i++) {
    			if(Alice[i] == Bob[i]) {
    				count++;
    			}
    		}
    		System.out.println(count);
    	}
    }

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

int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if((A == 5 && B == 5 && C == 7) ||
       (A == 5 && B == 7 && C == 5) ||
       (A == 7 && B == 5 && C == 5)) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



// https://atcoder.jp/contests/abc138/submissions/7013118

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    string s, t;
    cin >> s >> t;
    
    vector<vector<int> > is(26);
    
    int n = sz(s), m = sz(t);
    rep(i, n) is[s[i] - 'a'].eb(i);
    rep(i, n) is[s[i] - 'a'].eb(i + n);
    // 2周する 下のif (p >= n) で便利(場合分けいらない)
    // 2つのforに分けるのは, 昇順にするため
    
    ll ans = 0;
    int p = 0;
    
    // rep(i, sz(is[2])) cout << is[2][i] << " "; cout << endl;
    
    rep(i, m) {
        int c = t[i] - 'a';
        
        if (sz(is[c]) == 0) {
            puts("-1");
            return 0;
        }
        p = *lower_bound(all(is[c]), p) + 1;
        // ccc cccとか, 1足さな
        // かつ, 1indexed
        
        // out(p);
        if (p >= n) {
            p -= n;
            ans += n;
        }
    }
    
    ans += p; // 最後の文字
    out(ans);
}


Measured memory_bytes: 1736
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.nextLine();
		scanner.close();

		int count = 0;
		for (int n = 0; n < S.length(); n++) {
			String c = S.substring(n, n + 1);

			if (n == 0) {
				if (!c.equals("A")) {
					System.out.println("WA");
					return;
				}
				continue;
			}

			if (n == 1 || n == S.length() - 1) {
				if (!c.equals("A") && Character.isUpperCase(S.charAt(n))) {
					System.out.println("WA");
					return;
				}
				continue;
			}

			if (c.equals("C") && count == 0) {
				count++;
				continue;
			}

			if (Character.isUpperCase(S.charAt(n))) {
				System.out.println("WA");
				return;
			}
		}
		if (count == 0) {
			System.out.println("WA");
			return;
		}
		System.out.println("AC");
	}
}


Measured memory_bytes: 21844
while(1):
    a=[]
    n = int(input())
    if n==0:
        break
    a=[int(input()) for i in range(n)]
    result=[]
    for i in range(n):
        result1=a[i]
        result.append(result1)
        for j in range(i+1,n):
            result1=result1+a[j]
            result.append(result1)
    print(max(result))

Measured memory_bytes: 188644