akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <assert.h>
#include <chrono>
#include <bitset>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <random>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<pll> vpll;

#ifdef OLBOEB
mt19937 rnd(228 + 1488 + 238 + 24111997 % 322);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

void print_time() {
#ifdef OLBOEB
    cout.flush();
    cerr << "\ntime: " << clock() * 1.0 / CLOCKS_PER_SEC << endl;
#endif
}

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sz(x) ((ll)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

template <typename T>
void update_max(T& x, T y) { x = max(x, y); }
template <typename T>
void update_min(T& x, T y) { x = min(x, y); }

template<class T1, class T2>
ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class T> ostream& operator<<(ostream& out, set<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class L, class R> ostream& operator<<(ostream& out, map<L, R> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }






int main() {
    cout << fixed << setprecision(20);
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    ll x, y;
    cin >> x >> y;
    --x, --y;
    vl p = {(ll)3e5, (ll)2e5, (ll)1e5};
    ll ans = 0;
    if (x < 3) ans += p[x];
    if (y < 3) ans += p[y];

    if (x + y == 0) ans += 4e5;

    cout << ans;


    print_time();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(){
	int N, dec[4]= {0};
	scanf("%d", &N);
	
	for(int i = 0; i < N; i++){
		char S[5];
		scanf("%s", S);
		switch(S[0]){
			case 'A':
				dec[0]++;
				break;
			case 'W':
				dec[1]++;
				break;
			case 'T':
				dec[2]++;
				break;
			case 'R':
				dec[3]++;
				break;
		}
	}
	printf("AC x %d\n", dec[0]);
	printf("WA x %d\n", dec[1]);
	printf("TLE x %d\n", dec[2]);
	printf("RE x %d\n", dec[3]);
	
	
	return 0;
}

Measured memory_bytes: 1684
module Main where

import qualified Data.Vector as Vector
import Data.List

main :: IO ()
main =
    print =<< solve <$> getInt


getInt :: IO [Integer]
getInt = map read <$> words <$> getLine

solve :: [Integer] -> Integer
solve [1, _] = 1
solve [_, 1] = 1
solve [h, w] = (div (h + 1) 2) * (div (w + 1) 2) + (div h 2) * (div w 2)


Measured memory_bytes: 508
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static final Scanner     sc = new Scanner(System.in);
    static final PrintStream so = System.out;
    public static void main(String[] args) {
        char[] s = nchars();
        int[] count = new int[3];
        for (int i = 0; i < s.length; i++) {
            count[s[i] - 'a']++;
        }
        Arrays.sort(count);
        so.println(count[2] - count[0] <= 1 ? "YES" : "NO");
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static int nint() {
        return sc.nextInt();
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nchars() {
        return sc.next().toCharArray();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0, 0);
    }
    
    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static long[] nlongs(int n, int padL, int padR) {
        long[] a = new long[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nlong();
        return a;
    }
    
    private static String[] nstrs(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = nstr();
        return a;
    }
    
    private static char[][] nchars2D(int h, int w) {
        return nchars2D(h, w, 0);
    }
    
    private static char[][] nchars2D(int h, int w, int pad) {
        char[][] a2 = new char[h+pad*2][w+pad*2];
        for(int i = 0; i < h; i++)
            System.arraycopy(nchars(), 0, a2[pad+i], pad, w);
        return a2;
    }
}


Measured memory_bytes: 25772
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int>a(n),A(n),s(n+1),S(n+1),r;
for(int i=1;i<=n;i++){
cin>>a[i-1];
S[i]=a[i-1];
S[i]+=S[i-1];
}
for(int i=1;i<=n;i++){
cin>>A[i-1];
s[i]=A[i-1];
s[i]+=s[i-1];
}
for(int i=1;i<=n;i++){
    r.push_back(S[i]+s[n]-s[i-1]);
}
sort(r.begin(),r.end());
reverse(r.begin(),r.end());
cout<<r[0];
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
const int MOD = 1000000007;
using namespace std;

int main(){
    int N,A;
	cin >> N >> A;
    if((N % 500) >A){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 100;
const double eps = 1e-8;
double x[maxn], y[maxn];
int n;

bool check(double a, double b, double r) {
    for (int i = 1; i <= n; i++) {
        if ((a - x[i]) * (a - x[i]) + (b - y[i]) * (b - y[i]) - r > eps) return false;
    }
    return true;
}

int main() {

    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%lf %lf", &x[i], &y[i]);
    }
    double x1, x2, x3, y1, y2, y3, r;
    double ans = inf;
    for (int i = 1; i <= n; i++) {
        x1 = x[i];
        y1 = y[i];
        for (int j = i + 1; j <= n; j++) {
            x2 = x[j];
            y2 = y[j];
            for (int k = j + 1; k <= n; k++) {
                x3 = x[k];
                y3 = y[k];
                double a = ((y2 - y1) * (y3 * y3 - y1 * y1 + x3 * x3 - x1 * x1) -
                            (y3 - y1) * (y2 * y2 - y1 * y1 + x2 * x2 - x1 * x1)) /
                           (2.0 * ((x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1)));
                double b = ((x2 - x1) * (x3 * x3 - x1 * x1 + y3 * y3 - y1 * y1) -
                            (x3 - x1) * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1)) /
                           (2.0 * ((y3 - y1) * (x2 - x1) - (y2 - y1) * (x3 - x1)));
                r = (x1 - a) * (x1 - a) + (y1 - b) * (y1 - b);
                if (check(a, b, r)) {
                    ans = min(ans, r);
                }
                a = (x1 + x2) / 2;
                b = (y1 + y2) / 2;
                r = (x1 - a) * (x1 - a) + (y1 - b) * (y1 - b);
                if (check(a, b, r)) {
                    ans = min(ans, r);
                }

                a = (x1 + x3) / 2;
                b = (y1 + y3) / 2;
                r = (x1 - a) * (x1 - a) + (y1 - b) * (y1 - b);
                if (check(a, b, r)) {
                    ans = min(ans, r);
                }
                a = (x3 + x2) / 2;
                b = (y3 + y2) / 2;
                r = (x2 - a) * (x2 - a) + (y2 - b) * (y2 - b);
                if (check(a, b, r)) {
                    ans = min(ans, r);
                }
            }
        }
    }
    if (n == 2) {
        ans = (x[1] - x[2]) * (x[1] - x[2]) + (y[1] - y[2]) * (y[1] - y[2]);
        printf("%.7f\n", sqrt(ans) / 2);

    } else
        printf("%.7f\n", sqrt(ans));
    return 0;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}


ll sep(const vector<ll>& v, int left, int right) {
    int ng = left, ok = right - 1;
    ll sum = v[right] - v[left];

    while(ok - ng > 1){
        int mid = (ok + ng) / 2;
        if((v[mid] - v[left])*2 >= sum){
            ok = mid;
        }else{
            ng = mid;
        }
    }

    if(ok == left + 1){
        return ok;
    }else{
        int a = ok - 1, b = ok;
        if(abs(sum - 2*(v[a] - v[left])) < abs(sum - 2*(v[b] - v[left]))){
            return a;
        }else{
            return b;
        }
    }
}

signed main(){
    int n;
    cin >> n;
    vector<ll> v(n+1, 0LL);

    REP(i, n){
        ll a;
        cin >> a;
        v[i+1] = v[i] + a;
    }

    ll ans = INF;

    FOR(i, 2, n-1){
        vector<int> s(5);
        s[0] = 0, s[4] = n;
        s[2] = i;
        s[1] = sep(v, s[0], s[2]), s[3] = sep(v, s[2], s[4]);
        ll mi = INF, ma = -INF;
        REP(j, 4){
            chmin(mi, v[s[j+1]] - v[s[j]]);
            chmax(ma, v[s[j+1]] - v[s[j]]);
        }
        chmin(ans, ma - mi);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
package main

import "fmt"

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)

	var sum int
	for i := 1; i <= n; i++ {
		tmp := calc(i)
		if tmp >= a && tmp <= b {
			sum += i
		}
	}
	fmt.Println(sum)
}

func calc(n int) int {
	result := n % 10
	for n >= 10 {
		n /= 10
		result += n % 10
	}
	return result
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int n, dp[MAXN];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    dp[0] = 0;
    FOR(i,1,n) dp[i] = 10000000;
    FOR(i,1,n) {
        dp[i] = min(dp[i], dp[i-1] + 1);
        for (int j = 6; i - j >= 0; j *= 6) dp[i] = min(dp[i], dp[i-j] + 1);
        for (int j = 9; i - j >= 0; j *= 9) dp[i] = min(dp[i], dp[i-j] + 1);
    }
    cout << dp[n];
    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3


import numpy as np


def solv(m, a):
    boxs = np.zeros(m, dtype=np.int)

    for i in range(m, 0, -1):
        # idx = np.arange(i+i-1, m, i)
        s = np.count_nonzero(boxs[i+i-1:m:i])
        boxs[i-1] = (s + a[i-1]) % 2

    return boxs


if __name__ == '__main__':

    m = int(input())
    a = np.array(list(map(int, input().split())), dtype=np.int)

    ans = solv(m, a)

    print(sum(ans))
    for i in range(m):
        if ans[i]:
            print(i+1)


Measured memory_bytes: 16280
#include<stdio.h>
int judge(int n, int y)
{
  int i,j,a,b,c,sum;
  for(i=0; i<=n; i++){
    for(j=0; j<=n; j++){
      c=n-i-j;
      sum=(i*10000)+(j*5000)+(c*1000);
      if(sum==y&&c>=0)
        return printf("%d %d %d\n",i,j,c);
    }
  }
  return puts("-1 -1 -1");
}
int main()
{
  int n,y;
  scanf("%d %d",&n,&y);
  judge(n,y);
  return 0;
}

Measured memory_bytes: 128
/* ex 7_1
series2 */
#include <stdio.h>

typedef struct point {
    int x_elem;
    int y_elem;
} point;

int main(void) {
    // input and set variable
    point first;
    point second;
    point shift_point;
    point third;
    point fourth;
    scanf("%d", &(first.x_elem));
    scanf("%d", &(first.y_elem));
    scanf("%d", &(second.x_elem));
    scanf("%d", &(second.y_elem));

    // calculate vector
    shift_point.x_elem = first.y_elem - second.y_elem;
    shift_point.y_elem = second.x_elem - first.x_elem;

    third.x_elem = second.x_elem + shift_point.x_elem;
    third.y_elem = second.y_elem + shift_point.y_elem;

    fourth.x_elem = first.x_elem + shift_point.x_elem;
    fourth.y_elem = first.y_elem + shift_point.y_elem;

    printf("%d %d %d %d\n", third.x_elem, third.y_elem, fourth.x_elem,
           fourth.y_elem);
    return 0;
}

Measured memory_bytes: 1728
#include <stdio.h>

int selectionSort(int A[], int N) {
    int i, j, t, sw =0, minj;
    for(i=0;i<N-1;i++) {
        minj = i;
        for(j=i;j<N;j++) {
            if(A[j]<A[minj]) minj = j;
        }
        t=A[i]; A[i]=A[minj]; A[minj]=t;
        if(i!=minj) sw++;
    }
    return sw;
}

int main(void) {
    int A[100], N, i, sw;

    scanf("%d",&N);
    for(i=0;i<N;i++) scanf("%d",&A[i]);

    sw = selectionSort(A,N);

    for(i=0;i<N;i++) {
        if(i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",sw);

    return 0;
}


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000
#define MOD 1000000007

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

int main(){
	vector<int> v(3);
	REP(i,3)cin >> v[i];
	sort(ALL(v),greater<int>());
	cout << v[0]*10+v[1]+v[2] << endl;
	return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  int N;
  cin>>N;
  vector<int>h(N);
  for(int i=0;i<N;i++)cin>>h[i];
  vector<int>dp(N,INT_MAX);
  dp[0]=0;
  for(int i=0;i<N;i++){
    if(i+1<N)dp[i+1]=min(dp[i]+abs(h[i+1]-h[i]),dp[i+1]);
    if(i+2<N)dp[i+2]=min(dp[i]+abs(h[i+2]-h[i]),dp[i+2]);
  }
  cout<<dp[N-1]<<endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define two(a) (1<<(a))
#define LINF (1ll<<61)
#define EPS (1e-14)
#define Lshift(a,b) ((a)<<(b))
#define Rshift(a,b) ((a)>>(b))
#define rep(a,b) for(a=0 ; a<b ; a++)
#define xrep(a,b,c) for(a=b ; a<c ; a++)
#define INF (1<<29)
#define sz(a) int(a.size())
#define mset(x) memset(x, 0, sizeof(x))
#define swap(a,b) ( (a^=b) , (b^=a) , (a^=b) )
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
#define maxL (10000000>>5)+1
#define mod 1000000007
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define si set<int>
#define pb push_back
typedef long long ll;
using namespace std;


int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
}


Measured memory_bytes: 3660
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //d
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> w(n + 1);
  for (int i = 0; i < n; i++) {
    w[i + 1] = w[i];
    if (s[i] == 'W') w[i + 1]++;
  }
  vector<int> r(n + 2);
  for (int i = n; i >= 1; i--) {
    r[i] = r[i + 1];
    if (s[i - 1] == 'R') r[i]++;
  }
  int ans = 1 << 30;
  for (int i = 0; i <= n; i++) {
    int mi = min(w[i], r[i + 1]);
    int rem = w[i] + r[i + 1] - mi - mi;
    ans = min(ans, mi + rem);
  }
  cout << ans << endl;
  return 0;
}

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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

inline ll gcd(ll a, ll b) {
  for (; a; swap(b %= a, a));
  return b;
}

signed main() {
    string s;
    cin >> s;
    const int sz = s.size();
    rep(i, sz) {
        rep(j, sz) {
            if (i+j > sz) continue;
            if("keyence" == s.substr(0, i) + s.substr(i+j)){
                cout << "YES" << nl;
                return 0;
            }
        }
    }
    cout << "NO" << nl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    int x;
    cin >> x;
    cout << 360/__gcd(360,x) << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++) //n回繰り返すときだけ使う普通はforで楽しないのがいいかな

using namespace std;
typedef long long int ll;
int main()
{        
    int a,b,c,x,y;
    int sum;
   
    cin >> a >> b >> c >> x >> y;
    int MIN =min(x,y);
    int ans =min(a+b,c*2)*MIN;
    x -=MIN;
    y -=MIN;
    ans +=min(a,c*2)*x +min(b,c*2)*y;
    cout << ans << endl;
    return 0;
    



}


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

int main(){
    Int H, W; cin >> H >> W;

    if(H == 1 || W == 1){
        cout << 1 << endl; return 0;
    }

    if(H * W % 2 == 0){
        cout << H*W/2 << endl;
    } else {
        cout << H*W/2 + 1 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int n; 
  cin >> n;
  vector<int> a(n+1);
  rep(i,n) cin >> a[i];
  a[n] = 0;
  sort(a.begin(), a.end(), greater<int>());
  ll l2a = -1, l2b = -1, cnt = 1; int j;
  rep(i,n) {
    if (a[i] == a[i+1]) cnt++;
    if (cnt >= 2) {l2a = a[i]; j = i; break;}
  } 
  cnt = 1;
  for (int i = j+2; i < n; i++)
  {
    if (a[i] == a[i+1]) cnt++;
    if (cnt >= 2) {l2b = a[i]; break;}
  }
  if (l2a == -1 || l2b == -1) cout << 0 << endl;
  else cout << l2a * l2b << endl;
  return 0;
}

Measured memory_bytes: 3740
#----------[インポート]----------#
from collections import deque
#----------[入力受取・初期設定]----------#
H, W = map(int, input().split())
C = tuple(map(int, input().split())) # 魔法の位置
D = tuple(map(int, input().split())) # ゴール
D_y = D[0] -1 # 0スタート
D_x = D[1] -1 # 0スタート
S = [list(input()) for _ in range(H)]
visited = [[-1] * W for _ in range(H)]
visited[C[0]-1][C[1]-1] = 0 # 初期値
moves = [(1, 0), (0, 1), (-1, 0), (0, -1)] # 普通の移動
main_q = deque()
magic_q = deque() # マジック用のキュー
main_q.append((C[0]-1, C[1]-1))
#----------[BFS]----------#
while main_q:
    y, x = main_q.pop()
    magic_q.append((y, x))
    for move in moves:
        dy, dx = move
        moved_y = y + dy
        moved_x = x + dx

        if moved_y < 0 or H -1 < moved_y or moved_x < 0 or W -1 < moved_x:
            continue
        if S[moved_y][moved_x] == '#':
            continue
        if S[moved_y][moved_x] == '.' and visited[moved_y][moved_x] == -1:
            main_q.append((moved_y, moved_x))
            visited[moved_y][moved_x] = visited[y][x]
    #----------[マジック用のBFS]----------#
    if not main_q: # main_qが空になった場合は探索済みからマジックを使う
        while magic_q:
            y, x = magic_q.pop()
            for dy in range(-2, 3):
                for dx in range(-2, 3):
                    moved_y = y + dy
                    moved_x = x + dx

                    if moved_y < 0 or H -1 < moved_y or moved_x < 0 or W -1 < moved_x:
                        continue
                    if S[moved_y][moved_x] == '#':
                        continue
                    if S[moved_y][moved_x] == '.' and visited[moved_y][moved_x] == -1:
                        main_q.append((moved_y, moved_x))
                        visited[moved_y][moved_x] = visited[y][x] + 1
#----------[回答表示]----------#
answer = visited[D_y][D_x]
print(answer)

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

template<typename Int>
void Warshall_Floid(std::vector<std::vector<Int>>& min_dist, int V, Int INF){
    for(int relay = 0; relay < V; relay++){
        for(int from = 0; from < V; from++){
            for(int to = 0; to < V; to++){
                if(min_dist[from][relay] == INF) continue;
                if(min_dist[relay][to] == INF) continue;
                min_dist[from][to] = std::min(min_dist[from][to], min_dist[from][relay] + min_dist[relay][to]);
            }
        }
    }
}

int main(){
    using namespace std;
    using i64 = int_fast64_t;

    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r(R);
    for(int i = 0; i < R; i++) cin >> r[i], r[i]--;
    
    const i64 INF = 1e18;
    vector<vector<i64>> dist(N, vector<i64>(N, INF));
    for(int i = 0; i < N; i++) dist[i][i] = 0;
    for(int i = 0; i < M; i++){
        int A, B;
        i64 C;
        cin >> A >> B >> C; A--, B--;
        dist[A][B] = C;
        dist[B][A] = C;
    }

    Warshall_Floid(dist, N, INF);

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

    i64 ans = INF;
    do{
        i64 res = 0;
        int last = r[0];
        for(auto v : r) {
            res += dist[last][v];
            last = v;
        }
        ans = min(ans, res);
    }while(next_permutation(r.begin(), r.end()));

    cout << ans << endl;
}

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

using namespace std;

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int N;
int h[110000];
signed main() {
    cin>>N;
    h[0]=-100;
    for(int i=1;i<=N;i++)cin>>h[i];
    for(int i=1;i<=N;i++){
        if(h[i]>h[i-1])h[i]--;
        if(h[i-1]>h[i]){cout<<"No"<<endl;return 0;}
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 1024
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
function Main(input) {
    tmp = input.split(" ");
    x = parseInt(tmp[0], 10);
    k = parseInt(tmp[1], 10);
    d = parseInt(tmp[2], 10);
    count = 0;
    count += Math.floor(Math.abs(x) / d);


    if (count > k) {
        count = k;
    }

    if (x > 0) {
       x =  x - (d * count);
    } else{
        x =  x + (d * count);
    }

    if (count <= k) {
        if ((k - count) % 2 == 0) {
        
        } else{
            if (x > 0) {
                x =  x - d;
             } else{
                 x =  x + d;
             }
        }
    }


    console.log(Math.abs(x));
    



}

Measured memory_bytes: 29620
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>
     
using namespace std;
     
typedef long long ll;
     
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
     
#define MOD 1000000007

vector<vector<ll> > vv;

void dfs(ll a, ll p, vector<ll> &v){
  if(a==p)return;
  v.pb(a);
  rep(i,0,vv[a].sz){
    dfs(vv[a][i],p,v);
  }
  return;
}


int main(){
  ll n,k;
  cin>>n>>k;
  vector<vector<ll> > vv_(n,vector<ll>());
  vv = vv_;
  rep(i,0,n){
    ll a;
    cin>>a;
    a--;
    vv[i].pb(a);
  }
  ll mx = -1000000001;
  vector<ll> v1;
  rep(i,0,n){
    ll a;
    cin>>a;
    v1.pb(a);
  }
  rep(i,0,n){
    vector<ll> v;
    v.pb(i);
    dfs(vv[i][0],i,v);
    vector<ll> v2;
    ll sum = 0;
    rep(j,0,v.sz){
      sum += v1[v[j]];
    }
    if(k>v.sz){
      ll e = k/v.sz;
      ll k1 = k%v.sz;
      if(k%v.sz==0){
        e--;
        k1 = v.sz;
      }
      ll d1 = 0;
      rep(j,0,v.sz){
        d1 += v1[v[j]];
        mx = max(mx,d1);
      }
      ll d = 0;
      if(sum>0)d += e*sum;
      mx = max(mx,d);
      rep(j,0,k1){
        d += v1[v[j]];
        mx = max(mx,d);
      }
    }
    else{
      ll d = 0;
      rep(j,0,k){
        d += v1[v[j]];
        mx = max(mx,d);
      }
    }
  }
  cout << mx << endl;
  return 0;
}


Measured memory_bytes: 4404
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		// input
		Scanner inData = new Scanner(System.in);

		// 種類
		int N = inData.nextInt();
		// 購入種別数
		int K = inData.nextInt();
		// 各種類ごとの値段
		int[] P = new int[N];
		for(int i=0; i<N; i++) P[i] = inData.nextInt();
		Arrays.sort(P);

		int kin = 0;
		for (int i = 0; i < K; i++) {
			kin += P[i];
		}

		System.out.println(kin);

		inData.close();
	}
}

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

#define clr(a,i) memset((a), (i) ,sizeof(a))

int main(){
  int h,w;
  string s;
  std::cin >> h >> w;
  rep(i,h)rep(j,w){
    std::cin >> s;
    if(s=="snuke"){
      char c='A'+j;
      cout << c << i+1 << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 384
package main

import (
  "bufio"
  "fmt"
  "os"
  "strconv"
  "strings"
)

const MOD int64 = 1000000007

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,100)}
  n,m := input.Next2Ints()
  l := make([]int,m)
  r := make([]int,m)
  x := make([]int,m)
  for i:=0;i<m;i++ { l[i],r[i],x[i] = input.Next3Ints();l[i]-- }
  dp := make([][][]int64,2)
  dp[0] = make([][]int64,n+1)
  dp[1] = make([][]int64,n+1)
  for i:=0;i<n+1;i++ {
    dp[0][i] = make([]int64,n+1)
    dp[1][i] = make([]int64,n+1)
  }
  dp[0][0][0] = 1
  for i:=0;i<n;i++ {
    p := (i+1)%2
    for j:=0;j<n+1;j++ {
      for k:=0;k<n+1;k++ { dp[p][j][k] = 0 }
    }
    min := []int{0,0,0}
    max := []int{2*n,2*n,2*n}
    for j:=0;j<m;j++ {
      if i < l[j] || r[j] != i+1 { continue }
      if x[j] < 3 && min[x[j]] < i+1-l[j] { min[x[j]] = i+1-l[j] }
      if x[j] > 1 && max[x[j]-1] > i+1-l[j] { max[x[j]-1] = i+1-l[j] }
    }
    for j:=0;j<i+1;j++ {
      c := 1
      if j == i { c = 0 }
      for k:=j+c;k<i+1;k++ {
        if min[1] <= j+1 && j+1 < max[1] && min[2] <= k+1 && k+1 < max[2] {
          dp[p][j+1][k+1] = (dp[p][j+1][k+1] + dp[1-p][j][k])%MOD
        }
        if (i > 0 && min[1] <= 1 && 1 < max[1] && min[2] <= k+1 && k+1 < max[2]) {
          dp[p][1][k+1] = (dp[p][1][k+1] + dp[1-p][j][k])%MOD
        }
        if (j < i && min[1] <= 1 && 1 < max[1] && min[2] <= j+1 && j+1 < max[2]) {
          dp[p][1][j+1] = (dp[p][1][j+1] + dp[1-p][j][k])%MOD
        }
      }
    }
  }
  ans := int64(0)
  p := n%2
  for i:=0;i<n+1;i++ {
    for j:=i+1;j<n+1;j++ { ans = (ans+6*dp[p][i][j])%MOD }
  }
  ans = (ans+3*dp[p][n][n])%MOD
  fmt.Println(ans)
}

type Input struct { reader *bufio.Reader }
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) Next2Ints() (int,int) {
  s := strings.Fields(i.NextLine())
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  return x,y
}
func(i *Input) Next3Ints() (int,int,int) {
  s := strings.Fields(i.NextLine())
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  z,_ := strconv.Atoi(s[2])
  return x,y,z
}

Measured memory_bytes: 2304
N, M, Q = map(int, input().split())
reqs = []
for _ in range(Q):
    reqs.append(tuple(map(int, input().split())))

reqs = sorted(reqs, key=lambda x: x[1])

def search(A, req_head):
    if req_head >= len(reqs):
        return 0

    max_score = 0
    for e in range(A[-1], M+1):
        score = 0
        i = req_head
        while i < len(reqs) and reqs[i][1] < len(A):
            i += 1
        while i < len(reqs) and reqs[i][1] == len(A):
            a, b, c, d = reqs[i]
            if e - A[a] == c:
                score += d
            i += 1
        score += search(A + [e], i)
        max_score = max(max_score, score)

    return max_score

print(search([None, 1], 0))


Measured memory_bytes: 9088
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

int main() {
  ll N, K;

  cin >> N >> K;

  int ans;
  if (N % K == 0) {
    ans = 0;
  } else {
    ans = 1;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    cout << (n-2)*180 << endl;
}

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

using namespace std;

int main(){
	int m,n,k;
	cin>>m>>n>>k;
	vector<pair<int,int> > v;
	for(int i=0;i<k;i++){
		int x,y;
		cin>>x>>y;
		v.push_back({x,y});
	}
	vector<int> count(300006,0);
	for(int i=0;i<k;i++){
		count[v[i].first]++;
	}
	int maxx=0;
	int max_count=0;
	for(int i=1;i<300006;i++){
		if(count[i]>max_count){
			maxx=i;
			max_count=count[i];
			
		}
		count[i]=0;
	}
	int ans=max_count;
	for(int i=0;i<k;i++){
		if(v[i].first!=maxx){
			count[v[i].second]++;
		}
	}
	int maxy=0;
	max_count=0;
	for(int i=0;i<300006;i++){
		if(count[i]>max_count){
			maxy=i;
			max_count=count[i];
		}
		count[i]=0;
	}
	ans+=max_count;
	for(int i=0;i<k;i++){
		count[v[i].second]++;
	}
	maxx=0;
	max_count=0;
	for(int i=1;i<300006;i++){
		if(count[i]>max_count){
			maxx=i;
			max_count=count[i];
			
		}
		count[i]=0;
	}
	int ans1=max_count;
	for(int i=0;i<k;i++){
		if(v[i].second!=maxx){
			count[v[i].first]++;
		}
	}
	maxy=0;
	max_count=0;
	for(int i=0;i<300006;i++){
		if(count[i]>max_count){
			maxy=i;
			max_count=count[i];
		}
		count[i]=0;
	}
	ans1+=max_count;
	cout<<max(ans,ans1)<<endl;
	
	
}

Measured memory_bytes: 7440
import fractions
N = int(input())
a = list(map(int, input().split()))
res = a[0]
for i in range(1,N):
    res = res*a[i]//fractions.gcd(res,a[i])
res -= 1
ans = 0
for i in range(N):
    ans += res%a[i]
print(ans)

Measured memory_bytes: 66792
/*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define Lfmax DBL_MAX
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int>
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a>=c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(LL &a,LL &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(LL &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

int main()
{	
	int n;
	scd(n);
	LL a,b;
	string c;	
	while(n!=0)
	{
		vector<string> e;
		map<string,LL> d;
		int fl=0;
		forin(i,0,n)
		{
			cin>>c>>a>>b;
			fl=0;
			forin(i,0,e.size())
			{
				if(e[i]==c)
				{
					fl=1;
					break;
				}
			}
			if(fl==0)
			e.pb(c);
			
			d[c]+=a*b;
		}
		fl=0;
		int size=e.size();
		forin(i,0,size)
		{
			if(d[e[i]]>=1000000)
			{
				fl=1;
				cout<<e[i]<<endl;
			}
		}
		
		if(fl==0)
		printf("NA\n");
		
		
		scd(n);
	}
	
	return 0;
}

Measured memory_bytes: 3352
#include <bits/stdc++.h>
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
#define int ll
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;
int a, b;

vector<int> prime_factorize(ll x){
	vector<int> res;
	for(int i=2; i*i<=x; i++){
		if (x % i == 0){
			res.push_back(i);
			while(x % i == 0) x /= i;
		}
	}
	if (x > 1) res.push_back(x);
	return res;
}

int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> a >> b;
	vector<int> primes_a = prime_factorize(a);
	vector<int> primes_b = prime_factorize(b);
	int ans = 1; //1 include
	int n = primes_a.size(), m = primes_b.size();
	for(int i=0, j=0; i<n && j<m; ){
		if (primes_a[i] == primes_b[j]) {
			i++, j++;
			ans++;
		}
		else if (primes_b[j] < primes_a[i]) j++;
		else i++;
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
  int D;
  cin >> D;
  if(D==25) cout << "Christmas" << endl;
  if(D==24) cout << "Christmas Eve" << endl;
  if(D==23) cout << "Christmas Eve Eve" << endl;
  if(D==22) cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

struct Card {
    char suit;
    int value;
};

void print(Card a[], int n) {
    for (int i = 0; i < n; ++i) {
        if (i > 0) cout << " ";
        cout << a[i].suit << a[i].value;
    }
    cout << endl;
}

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

void selectionSort(Card c[], int n) {
    for (int i = 0; i < n; ++i) {
        int minj = i;
        for (int j = i; j < n; ++j) {
            if (c[j].value < c[minj].value) minj = j;
        }
        swap(c[i], c[minj]);
    }
}

bool isStable(Card c1[], Card c2[], int n) {
    for (int i = 0; i < n; ++i) {
        if (c1[i].suit != c2[i].suit) return false;
    }
    return true;
}

int main() {
    Card c1[100];
    Card c2[100];
    int n;

    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> c1[i].suit >> c1[i].value;
    }

    copy(begin(c1), end(c1), begin(c2));

    bubbleSort(c1, n);
    selectionSort(c2, n);

    print(c1, n);
    cout << "Stable" << endl;
    print(c2, n);
    if (isStable(c1, c2, n)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }

    return 0;
}

Measured memory_bytes: 3100
n = int(input())
l = []
current_time = 0


for i in range(n):
    a, b = map(int, input().split())
    l.append((b, a))

l.sort()

for e in l:
    a, b = e
    current_time = current_time + b
    if current_time > a:
        print('No')
        exit(0)

print('Yes')




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

int main(void){
    
    string n;
    
    cin >> n;
    
    if(n.at(1)=='B'){
        
        cout << "ARC" << endl;
        
    } else {
        
        cout << "ABC" << endl;
        
    }
    
    return 0;
    
}

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

signed main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    //int t=1 ; cin>>t ; while(t--)
    {
    	int n;
    	cin >> n;
    	int a[n], b[n];
    	for(int i=0;i<n;i++)
    		cin >> a[i] >> b[i];

    	double ans = 0;
    	for(int i=0;i<n;i++)
    	{
        	for(int j=0;j<n;j++)
            	ans += sqrt(pow((a[i]-a[j]),2) + pow((b[i]-b[j]),2));
        }

        ans /= n;
        cout << fixed << setprecision(8) << ans << '\n';
    	

    	
    }
    
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
const int mod = 1e9 + 7;
const double pi = acos(-1.0);
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
int main(){
    ll n, m;
    cin >> n >> m;
    ll d = 0;
    rep(i,m){
        int a; cin >> a;
        d += a;
    }
    cout << ((n >= d)?n-d : -1) << endl;
    return 0;
}  

Measured memory_bytes: 3644
//
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
// #define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()

int main(){
	int N,M; cin>>N>>M;

	vector<tuple<int,int,int>> T;//[city]<prefecture,year,city>
	rp(i,M){
		int p,y; cin>>p>>y;
		T.emplace_back(p,y,i);
	}

	sort(all(T));

	// for(auto e:T){
	// 	int p,y,c;tie(p,y,c)=e;
	// 	cout<<p<<","<<y<<","<<c<<"\n";
	// }

	vector<tuple<int,int,int>> ans;//[i]<city,h_id,l_id>
	vi p_count(N);
	rp(i,M){
		int p,y,c;tie(p,y,c)=T[i];
		p_count[p-1]++;
		int h_id = p;
		int l_id = p_count[p-1];
		ans.emplace_back(c, h_id, l_id);
	}

	sort(all(ans));

	// ote("--");
	// for(auto e:ans){
	// 	int c,h,l;tie(c,h,l)=e;
	// 	cout<<c<<","<<h<<","<<l<<"\n";
	// }

	for(auto e:ans){
		int c,h,l;tie(c,h,l)=e;
		printf("%06d%06d\n",h,l);
	}


}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



int n;
string s;
int A[5050];
void Z_algo(string S){
	fill(A, A+5050, 0);
	A[0] = S.size();
	int i = 1, j = 0;
	while (i < S.size()) {
		while (i+j < S.size() && S[j] == S[i+j]) ++j;
		A[i] = j;
		if (j == 0) { ++i; continue;}
		int k = 1;
		while (i+k < S.size() && k+A[k] < j) A[i+k] = A[k], ++k;
		i += k; j -= k;
	}
}
void solve(){
	cin >> n;
	cin >> s;
	
	int ma = 0;
	for(int i = 0; i < n; i++){
		Z_algo(s.substr(i));
		for(int j = 1; j < n-i; j++){
			chmax(ma, min(A[j],j));
		}
	}
	cout << ma << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O2") 

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

typedef long long int ll;
typedef unsigned long long int ull;

#define test(t)		int t; cin>>t; while(t--)
#define f(i, a, b)	for(int i = a; i < b; ++i)
#define all(a)		a.begin(), a.end()
#define endl 		"\n"
#define deb(x)		cout << #x << "--" << x << "--" << endl;
#define deb2(x,y)	cout << #x << "-" << x << "-" << " ~~ " <<  #y << "-" << y << "-" << endl;
#define deb3(x,y,z)	cout << #x << "-" << x << "-" << " ~~ " <<  #y << "-" << y << "-" << " ~~ " << #z << "-" << z << "-" << endl;
#define deba(arr)	cout << #arr << " ~ [ "; for(auto n: arr) cout << n << " "; cout << "]" << endl;
#define fast 		ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define mx9		1000000007
#define mx7		10000007
#define mx6		1000006
#define mx5		200005
#define inf		1<<30                                 
#define eps		1e-9
#define mod		1000000007
#define PI		3.141592653589793238462643383279502884L
/*
LEARNINGS:
if(a[i] > 1000000000000000000 / pro)
 you have to check if it exceed 1018 by performing division instead of multiplication. 
*/
void solve()
{
  ll n;
  cin >> n;
  ll a[n], z = 0;
  f(i, 0, n)
  {
    cin >> a[i];
    if(a[i] == 0)
      z += 1;
  }
  if(z >= 1)
  {
    cout << "0" << endl;
    return;
  }
  ll pro = 1;
  f(i, 0, n)
  {
    if(a[i] > 1000000000000000000 / pro)
    {
      cout << "-1" << endl;
      return;
    }
    pro *= a[i];
  }
  cout << pro << endl;
}
int main()
{
    fast;
    //test(t)
        solve();
    return 0;
}


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



ll power(ll x,ll k){
  ll ret=1;
  while(k>0){
    if(k&1) (ret*=x) %= M;
    (x*=x) %= M;
    k >>= 1;
  }
  return ret;
}

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

  int m,n;
  cin>>m>>n;
  cout<<power(m,n)<<endl;


}


Measured memory_bytes: 3172
#include <stdio.h>


int main(){
    int n, m, l, i, j, k;
    unsigned long long int A[100][100], B[100][100], C[100][100];

    for(i = 0; i < 100; i++){
        for(j = 0; j < 100; j++){
            A[i][j] = 0;
            B[i][j] = 0;
            C[i][j] = 0;
        }
    }

    scanf("%d %d %d", &n, &m, &l);
    
    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){
            getchar();
            scanf("%lld", &A[i][j]);
        }
    }

    for(i = 0; i < m; i++){
        for(j = 0; j < l; j++){
            getchar();
            scanf("%lld", &B[i][j]);
        }
    }


    for(i = 0; i < n; i++){
        for(j = 0; j < l; j++){
            for(k = 0; k < m; k++){
                C[i][j] += A[i][k] * B[k][j];
            }
        }
    }

    for(i = 0; i < n; i++){
        for(j = 0; j < l; j++){
            printf("%lld%s", C[i][j], (j == l - 1) ? "\n" : " ");
        }
    }
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long


signed main(){
    int H,W;
    cin>>H>>W;
    vector<vector<char>>vec(H+2,vector<char>(W+2,'#'));
    REP(i,H){
        REP(j,W){
            cin>>vec[i+1][j+1];
        }
    }
    REP(i,H+2){
        REP(j,W+2){
            cout<<vec[i][j];
        }
        cout<<endl;
    }
}

Measured memory_bytes: 256
n = int(input())
As = [int(input()) for _ in range(n)]
cnt = 0
current_button = 0
for _ in range(n):
    current_button = As[current_button] - 1
    cnt += 1
    if current_button == 1:
        break
if current_button != 1:
    print(-1)
else:
    print(cnt)




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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 1e5+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}

bool isAc[MAX_N];
int waCnt[MAX_N];
int ac = 0;
int pen = 0, n, m;

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

    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int p; string s;
        cin >> p >> s;
        if (s == "AC") {
            isAc[p] = true;
        } else {
            if (!isAc[p]) waCnt[p]++;
        }
    }

    for (int i = 1; i <= n; i++) {
        if (isAc[i]) {
            ac++;
            pen += waCnt[i];
        }
    }

    cout << ac << " " << pen;


    return 0;
}


Measured memory_bytes: 768