akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using I = long long;
using U = unsigned long long;

using F = long double;

template <typename T> using Vec = vector<T>;
template <typename K, typename V> using HashMap = unordered_map<K, V>;
template <typename T> using HashSet = unordered_set<T>;
template <typename T> using PQueue = priority_queue<T>;
template <typename T> using Uq = unique_ptr<T>;

using StrView = string_view;

auto solve(I const S, I const W) -> void {
  if (S <= W) {
    puts("unsafe");
  } else {
    puts("safe");
  }
}

auto main() -> int {
  I S;
  scanf("%lld", &S);
  I W;
  scanf("%lld", &W);
  solve(S, W);
  return 0;
}


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

int main() {
  long long N;
  cin >> N;
  vector<long long> to(N-1);
  long long a;
  cin >> a;
  to[0] = a*2;
  for (int i=1; i<N-1; i++) {
    cin >> a;
    a *= 2;
    to[i] = to[i-1] + a;
  }
  cin >> a;
  long long sum = (to[N-2] + a*2)/2;
  cerr << sum << endl;
  long long ans = 1010101010101010;
  for (int i=0; i<N-1; i++) {
    to[i] -= sum;
    to[i] = abs(to[i]);
    ans = min(ans,to[i]);
  }
  cout << ans << endl;
  
  return 0;
}

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

int main(){

int n,m,l;
cin>>n>>m>>l;
long a[n][m],b[m][l],c[n][l]={};

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

for(int i=0;i<m;i++){
    for(int j=0;j<l;j++){
        cin>>b[i][j];        
    }
}

for(int i=0;i<n;i++){
    for(int j=0;j<l;j++){
        for(int k=0;k<m;k++){
          c[i][j]+=a[i][k]*b[k][j];
        }       
    }
}

for(int i=0;i<n;i++){
    for(int j=0;j<l;j++){
        if(j==l-1){
            cout<<c[i][j]<<endl;  
        }else{
            cout<<c[i][j]<<" ";    
        }      
    }
}

    return 0;
}


Measured memory_bytes: 3312
#include<iostream>
using namespace std;
int main(void){
  int n,m,k,a[30][31]={0},tmp,ans=0;
  cin>>n>>m;
  for(int i=0;i<n;i++){
    cin>>k;
    for(int j=1;j<=k;j++){
      cin>>tmp;
      a[i][tmp]++;
    }
  }
  bool flag;
  for(int i=1;i<=m;i++){
    flag=true;
    for(int j=0;j<n;j++)if(a[j][i]==0){flag=false;break;}
    if(flag)ans++;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
import itertools

A = list(range(int(input()) + 1))
B = list(range(int(input()) + 1))
C = list(range(int(input()) + 1))
X = int(input())
count = 0

abc_list = list(itertools.product(A, B, C))
for a, b, c in abc_list:
    if 500 * a + 100 * b + 50 * c == X:
        count += 1
print(count)

Measured memory_bytes: 13600
import sys
import numpy as np
import heapq as hp
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def compute(A, B, X):
    """左からn番の人まで。AからX人とる。ときの最大スコアを返す。"""
    result = np.zeros(len(A), np.int64)
    result[X - 1] = A[:X].sum()
    q = []
    for i in range(X):
        q.append(A[i] - B[i])
    hp.heapify(q)
    for i in range(X, len(A)):
        x = result[i - 1] + A[i]  # とりあえず A をとる
        loss = hp.heappushpop(q, A[i] - B[i])  # ひとつ B に取り換えたときのロス
        result[i] = x - loss
    return result

def main(ABC, X, Y, Z):
    A = ABC[::3]
    B = ABC[1::3]
    C = ABC[2::3]
    ind = np.argsort(C - A)
    A, B, C = A[ind], B[ind], C[ind]
    q = [0] * 0

    q = [0] * 0
    dp1 = compute(A, B, X)
    dp2 = compute(C[::-1], B[::-1], Z)[::-1]
    x = dp1[X - 1:X + Y] + dp2[X:X + Y + 1]
    return x.max()

if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    i8 = numba.from_dtype(np.int64)
    u1 = numba.from_dtype(np.dtype('U1'))
    sig1 = (i8[:], i8[:], i8)
    sig2 = (i8[:], i8, i8, i8)

    cc = CC('my_module')
    cc.export('compute', sig1)(compute)
    compute = numba.njit(compute)
    cc.export('main', sig2)(main)
    cc.compile()

from my_module import main

X, Y, Z = map(int, readline().split())
ABC = np.array(read().split(), np.int64)

print(main(ABC, X, Y, Z))

Measured memory_bytes: 110540
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<deque>
#include<set>
using namespace std;

using ll = long long;
const int INF = 1001001001;

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

int main(void)
{
  int r;
  cin >> r;
  printf("%.4f\n", 2 * r * M_PI);
}



Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
#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 pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

VI v[2010];
int insec(int p,int q) {
	set<int> s(all(v[p]));
	int c=0;
	for (auto w:v[q]) if (s.count(w)) c++;
	return c;
}
void construct(int p) {
	rep(i,0,p) v[i].pb(0);
	rep(i,1,p) {
		v[0].pb(i);
		rep(j,i*(p-1)+1,(i+1)*(p-1)+1) v[j].pb(i);
	}
	int tot=p;
	rep(i,0,p-1) {
		rep(j,0,p-1) {
			v[i+1].pb(tot);
			rep(k,0,p-1) {
				v[p+k*(p-1)+(i*k+j)%(p-1)].pb(tot);
			}
			++tot;
		}
	}
	printf("%d %d\n",p*(p-1)+1,p);
	rep(i,0,p*(p-1)+1) {
		for (auto w:v[i]) printf("%d ",w+1);
		puts("");
	}
}
int main() {
	construct(42);
}


Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		if (A >=1200) {
			System.out.println("ARC");
		} else {
			System.out.println("ABC");
		}
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>

int main() {
    uint64_t K;
    uint32_t N, Q;
    std::cin >> N >> K >> Q;
    std::vector<int64_t> point(N, (K-Q));
    uint32_t a = 0;
    
    //全体から1引いて正解者A_iさんには1点あげる 最後0点でない人は勝ち抜け
    for (uint32_t i = 0; i < Q; i++){
        std::cin >> a;
        a--;
        point[a]++;
    }
    for(uint32_t k = 0; k < N; k++){
        if(point[k] > 0){
            std::cout << "Yes" << std::endl;;
        }else if(point[k] <= 0){
            std::cout << "No" << std::endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>
int main(void){
    // Your code here!
    int l,r,d,cnt=0;
    scanf("%d%d%d",&l,&r,&d);
    for(int i=l;i<=r;i++){
        if(i%d==0)cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 1720
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

ll gcd(ll a, ll b)
{
	if (a < b) swap(a, b);
	return (a%b ? gcd(a%b, b) : b);
}

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

void extgcd(ll a, ll b, ll& x, ll& y)
{
	if (b != 0) { extgcd(b, a % b, y, x); y -= a / b * x; }
	else { x = 1; y = 0; }
}


int main()
{
	cin.sync_with_stdio(false);
	int lcma = 1, lcmb = 1;
	FOR(i, 1, 24)
	{
		if (i == 13 || i == 17 || i == 19 || i == 23)
		{
			lcmb = lcm(lcmb, i);
		}
		else
		{
			lcma = lcm(lcma, i);
		}
	}
	int n;
	while (cin >> n, n)
	{
		vi a(lcma), b(lcmb);
		REP(i, n)
		{
			int d, t;
			cin >> d >> t;
			vi v(d);
			REP(i, d) cin >> v[i];
			if (d == 13 || d == 17 || d == 19 || d == 23)
			{
				REP(i, lcmb)
				{
					if (t == d) t = 0;
					b[i] += v[t];
					t++;
				}
			}
			else
			{
				REP(i, lcma)
				{
					if (t == d) t = 0;
					a[i] += v[t];
					t++;
				}
			}
		}
		cout << *max_element(ALL(a)) + *max_element(ALL(b)) << endl;
	}
	return 0;
}

Measured memory_bytes: 4188
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i = x; i < (int)(n); i++)
#define rep_ll(i,x,n) for(ll i = x; i < (ll)(n); i++)
using namespace std;
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
const long double PI = (acos(-1));
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1};
ll mod = 1000000007;
int main(){
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i, 0, n) cin >> p[i];

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

    ll total=0;
    rep(i,0,k) total+=p[i];
    cout << total;
}

Measured memory_bytes: 3644
def main3():
    N, M = map(int, input().split())

    ball  = [0, 1] + [1 for i in range(N - 1)]
    rflag = [0, 1] + [0 for i in range(N - 1)] 

    for i in range(M):
        x, y = map(int, input().split())

        if rflag[x] == 1:
            rflag[y] = 1

        ball[x] -= 1
        ball[y] += 1

        if ball[x] == 0:
            rflag[x] = 0

    ans = sum(rflag[1:])
    print(ans)
    
if __name__ == "__main__":
    main3()

Measured memory_bytes: 11108
#include <stdio.h>
int main (){
 
 char huruf [100];
 int i;
 scanf("%c", &huruf);

 if(huruf[i] >= 'A' && huruf [i] <= 'Z'){
  puts("A");
 }
  else{
   puts("a");
  }
 
 return 0;
}

Measured memory_bytes: 1580
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N, M = MAP()
balls = [[1, 0] for _ in range(N)]  #[white, red]の個数
balls[0] = [0, 1]

for _ in range(M):
	x, y = MAP()

	w_x, r_x = balls[x-1]
	w_y, r_y = balls[y-1]

	if w_x >= 1 and r_x >= 1: 
		balls[x-1][0] -= 1
		balls[y-1][1] += 1

	elif w_x == 0:
		balls[x-1][1] -= 1
		balls[y-1][1] += 1

	else:
		balls[x-1][0] -= 1
		balls[y-1][0] += 1

ans = 0
for i in range(N):
	if balls[i][1]:
		ans += 1
print(ans)

Measured memory_bytes: 15304
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> x(5);
  int a = 0;
  for(int i = 0;i < 5;i++){
    cin >> x.at(i);
    if (x.at(i) == 0){
      a = i + 1;
      break;
    }
  }
  cout << a << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <queue>
#include <vector>

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;

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

void dijkstra(int n, ll *d, vector<P> *t) {
  queue<int> q;
  q.push(0);

  while (!q.empty()) {
    int u = q.front();
    q.pop();

    for (auto &p : t[u]) {
      if (d[p.first] == INF) {
        d[p.first] = d[u] + p.second;
        q.push(p.first);
      }
    }
  }
}

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

  vector<P> t[n];

  rep(i, n - 1) {
    int u, v, w;
    cin >> u >> v >> w;
    --u;
    --v;
    t[u].push_back(make_pair(v, w));
    t[v].push_back(make_pair(u, w));
  }

  ll d[n];
  rep(i, n) d[i] = INF;
  d[0] = 0;
  dijkstra(n, d, t);

  rep(i, n) { cout << (d[i] % 2 == 0 ? 0 : 1) << '\n'; }

  return 0;
}


Measured memory_bytes: 7168
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


int main(void)
{

    int n;
    scanf("%d", &n);
    int cnt = 0;
    for (int i=1; i < n+1; i++){
        if(i < 10)
            cnt++;
        if(99 < i && i < 1000)
            cnt++;
        if(9999 < i && i < 100000)
            cnt++;
    }

    printf("%d\n", cnt);


    return 0;
} 



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int a,b,c,n;
int main() {
    scanf("%d%d%d%d",&a,&b,&c,&n);
    int ans=0;
    for(int i=0; a*i<=n; i++) {
        for(int j=0; a*i+b*j<=n; j++) {
            if((n-a*i-b*j)%c==0) {
                ans++;
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  
  int num = ceil(N / 2.0);
  if (num >= K) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
def main():
  import collections
  import sys
  input = sys.stdin.readline
  n = int(input())
  b = []
  for i in range(n):
    a = int(input())
    b_append = b.append
    b_append(a)

  s = set(b)
  s = tuple(s)
  c = collections.Counter(b)
  ans = 0
  for i in range(len(s)):
    if c[s[i]] % 2 == 0:
      continue
    else:
      ans += 1
  print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 62296
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#define RG register
#define IL inline
#define inf 2147483640
#define LL long long
#define pi acos(-1.0)
#define db double
#define N 55
#define mo 1000000007
using namespace std;
IL int gi()
{
	RG int res=0,w=1;
	RG char ch;
	for(ch=getchar();(ch<'0'||ch>'9')&&ch!='-';ch=getchar());
	if(ch=='-') w=-1,ch=getchar();
	for(;ch>='0'&&ch<='9';ch=getchar()) res=10*res+ch-48;
	return res*w;
}
char s1[N],s2[N];
int n;
int dp[N][10]={0};
//11:1 12:2 13:3
//21:4 22:5 23:6
//31:7 32:8 33:9
int main()
{
	//freopen("2.in","r",stdin);
	//freopen("2.out","w",stdout);
	n=gi();
	scanf("%s",s1+1); scanf("%s",s2+1);
	if(s1[1]==s2[1]) dp[1][1]=dp[1][5]=dp[1][9]=1;
	else dp[1][2]=dp[1][3]=dp[1][4]=dp[1][6]=dp[1][7]=dp[1][8]=1;
	for(RG int i=2;i<=n;++i)
		{
			for(RG int s=1;s<=9;++s)
				{
					if((s1[i]==s2[i])&&(s!=1)&&(s!=5)&&(s!=9)) continue;
					if((s1[i]!=s2[i])&&(s==1||s==5||s==9)) continue;
					for(RG int p=1;p<=9;++p)
						{
							if(!dp[i-1][p]) continue;
							if((s1[i]==s1[i-1])&&((s-1)/3 != (p-1)/3)) continue;
							if((s2[i]==s2[i-1])&&((s-1)%3 != (p-1)%3)) continue;
							if((s1[i]!=s1[i-1])&&((s-1)/3 == (p-1)/3)) continue;
							if((s2[i]!=s2[i-1])&&((s-1)%3 == (p-1)%3)) continue;

							dp[i][s]=(dp[i][s]+dp[i-1][p])%mo;
						}
				}
		}
	RG int ans=0;
	for(RG int i=1;i<=9;++i) ans=(ans+dp[n][i])%mo;
	printf("%d\n",ans);
	//fclose(stdin);fclose(stdout);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repk(i,m,n) for(ll i=m;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD1=1e9+7;
const int MOD2=998244353;
const int INF=2*1e9;
int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  int n, k; cin >> n >> k;
  vi v(n);
  rep(i, n) cin >> v[i];
  int LEN = min(n, k);
  int ans = 0;
  for (int l = 0; l <= LEN; l++) {
    for (int r = 0; l+r <= LEN; r++) {
      int len = l+r;
      if(len == 0) continue;
      vi vec;
      rep(i,l) vec.pb(v[i]);
      rep(i,r) vec.pb(v[n-i-1]);
      sort(all(vec));
      // rep(i, len) {
      //   cout << vec[i] << " >"[i==l+r-1];
      // }
      for (int i = 0; i < k-len; i++) {
        if (vec[i] < 0) {
          vec[i] = 0;
        }
      }
      int sum = 0;
      rep(i, len) {
        sum += vec[i];
      }
      // cout << " " << sum << endl;
      if (sum > ans) {
        ans = sum;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  if (n == 1) cout << "Hello World" << endl;
  else if (n == 2) {
    int a,b;
    cin >> a >> b;
    
    cout << a+b << endl;
  }
}


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

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

  cout << s << endl;
  return 0;
}


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

int main() {
  string a,b,c;
  cin>>a>>b>>c;
  char a1,b1,c1;
  a1=a[0]-'a'+'A';
  b1=b[0]-'a'+'A';
  c1=c[0]-'a'+'A';
  cout<<a1<<b1<<c1<<endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

const ll MOD = 1e9+7;

int main(){
  ll n,m; cin >> n >> m;
  vector<ll> sum_x(n+1,0), sum_y(m+1,0);
  REP(i,n){
    ll x; cin >> x;
    sum_x[i+1] = sum_x[i] + x;
  }
  REP(i,m){
    ll y; cin >> y;
    sum_y[i+1] = sum_y[i] + y;
  }

  ll s = 0, t = 0;
  FOR(i,1,n){
    (s += (sum_x[n] - sum_x[i])%MOD - (n-i)*((sum_x[i]-sum_x[i-1])%MOD)%MOD + MOD) %= MOD;
  }
  FOR(i,1,m){
    (t += (sum_y[m] - sum_y[i])%MOD - (m-i)*((sum_y[i]-sum_y[i-1])%MOD)%MOD + MOD) %= MOD;
  }
  ll ans = s*t%MOD;
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include <math.h>
#include <map>
#include <unordered_map>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define pb(s) push_back(s)
#define CST(x) cout<<fixed<<setprecision(x)
#define ci(x) cin >>x
#define co(x) cout<<x<<endl
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vvpl=vector<vector<pl>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a) {
 long long ans=1;
 while(a>1){
 ans*=a;
 ans%=1000000007;
     a--;
    }
    return ans;
     }

ll PS(ll x) {
  ll c=1;
  rep(i,x) {
    c=c*2;
  }
  return c;
}


int main() {

  ll a;
  cin >>a;
  cout<<a+a*a+a*a*a<<endl;
}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define RFOR(i, begin, end) for(int i=(end)-1, i##_begin_=(begin);i>=i##_begin_;i--)
#define rep(i, N) FOR(i, 0, N)
#define rrep(i, N) RFOR(i, 0, N)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
using namespace std;
using ll = long long int;
using V = vector<ll>;
using P = pair<ll, ll>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
constexpr int mod = 1e9+7;
ll gcd(ll a, ll b) { return b? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}

ll n;


int main() {
    cin >> n;
    V b(n-1);
    rep(i, n-1) cin >> b[i];

    ll ret = b[0];
    rep(i, n-2) ret += min(b[i], b[i+1]);
    ret += b[n-2];
    cout << ret << endl;
    return 0;
}


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

using namespace std;
int num[100002];

int main(){
	int M=0,N;
	cin >> N;
	int a[N];
	for(int i=0;i<N;i++){
		cin >> a[i];
		if(a[i]!=0){
			num[a[i]-1]++;
			if(M<num[a[i]-1]){M=num[a[i]-1];}
		}
		num[a[i]]++;
		if(M<num[a[i]]){M=num[a[i]];}
		num[a[i]+1]++;
		if(M<num[a[i]+1]){M=num[a[i]+1];}
	}
	cout << M << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

struct Restaurant{
	string s;
	int p;
	int num;
};

bool operator< (const Restaurant& left, const Restaurant& right){
	return
		left.s == right.s ?
		left.p > right.p : left.s < right.s;
}

int main(){
	int n,i;
	cin >> n;
	vector<Restaurant> R(n);
	for (i=0; i<n; i++){
		R[i].num=i+1;
		cin >> R[i].s >> R[i].p;
	}

	int ans;
	sort(R.begin(),R.end());

	for (i=0; i<n; i++){
		cout << R[i].num << endl;
	}
	return 0;
}

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

int main()
{
  int n, k;

  cin >> n >> k;

  if(n%k != 0){

    cout << 1;
  }
  else
    cout << 0;
}


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


int main() {

	string s, t;
	cin >> s >> t;

	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());

	if(s<t){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;

typedef pair<int,int>Pi;
typedef pair<long long,long long>P;
typedef pair<long long,P>PP;
typedef pair<P,P>PPP;

const long long MOD=1e9+7;
const long long INF=5e18;
const int di[4]={1,0,-1,0};
const int dj[4]={0,1,0,-1};

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define double long double

int a,b,c,d;

void input(){
	cin>>a>>b>>c>>d;
	return;
}

void solve(){
	if((a*b)%2==1&&(c+d)%2==1)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return;
}

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


Measured memory_bytes: 3084
#![allow(non_snake_case)]

#[allow(unused_macros)]
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

fn main() {
    input!{
        N: usize,
        S: chars
    }
    let mut cnt = 0;
    let mut point = 0;
    let mut min_point = 0;
    for i in 1..N {
        if S[i] == 'E' {
            cnt += 1;
        }
        if S[i] == S[i - 1] {
            if S[i] == 'E' {
                point -= 1;
            } else {
                point += 1;
            }
            min_point = std::cmp::min(point, min_point);
        }
    }
    println!("{}", cnt + min_point);
}

Measured memory_bytes: 6396
# copy
n, k = map(int, input().split())
plst = []
xlst = []
ylst = []
dlst = []

for _ in range(n):
    x1, y1, d1, x2, y2, d2 = map(int, input().split())
    plst.append((x1, y1, d1, x2, y2, d2))
    xlst.append(x1)
    xlst.append(x2)
    ylst.append(y1)
    ylst.append(y2)
    dlst.append(d1)
    dlst.append(d2)

xlst = list(set(xlst))
ylst = list(set(ylst))
dlst = list(set(dlst))

xlst.sort()
ylst.sort()
dlst.sort()

lx = len(xlst)
ly = len(ylst)
ld = len(dlst)

xdic = dict(reversed(t) for t in enumerate(xlst))
ydic = dict(reversed(t) for t in enumerate(ylst))
ddic = dict(reversed(t) for t in enumerate(dlst))

new_map = [[[0] * ld for _ in range(ly)] for _ in range(lx)]

for p in plst:
    x1, y1, d1, x2, y2, d2 = p
    x1, y1, d1, x2, y2, d2 = \
        xdic[x1], ydic[y1], ddic[d1], xdic[x2], ydic[y2], ddic[d2]
    for x in range(x1, x2):
        for y in range(y1, y2):
            for d in range(d1, d2):
                new_map[x][y][d] += 1

ans = 0
for i in range(lx - 1):
    xlsti = xlst[i]
    xlsti1 = xlst[i + 1]
    x = xdic[xlsti]
    for j in range(ly - 1):
        ylstj = ylst[j]
        ylstj1 = ylst[j + 1]
        y = ydic[ylstj]
        for z in range(ld - 1):
            dlstz = dlst[z]
            dlstz1 = dlst[z + 1]
            d = ddic[dlstz]
            if new_map[x][y][d] >= k:
                ans += (xlsti1 - xlsti) * (ylstj1 - ylstj) * (dlstz1 - dlstz)
print(ans)



Measured memory_bytes: 14320
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007
using namespace std;


int main(void){
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;

	int a[n],b[n],id=0;
	rep(i,n){
		a[i]=0;
		b[i]=0;
	}
	if(s[0]=='1')b[0]=1;
	
	a[0]=1;
	rep(i,n-1){
		if(s[i]!=s[i+1]){
			id++;
			a[id]++;
			if(s[i+1] == '1')b[id]=1;
		}
		else a[id]++;
	}

	ll ans=0, cnt=0, tmp=0;
	int r=0;
	for(int l=0;l<id+1;l++){
		while(r<id+1 && (cnt<k || b[r]==1)){
			tmp+=a[r];
			if(b[r]==0)cnt++;
			r++;
		}
		if(ans < tmp)ans=tmp;
		tmp-=a[l];
		if(b[l]==0)cnt--;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using P = pair<ll, ll>;

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

//---------------------------

int main(){
    int a,b;
    cin >> a >> b;
    cout << (a-1)*(b-1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    unsigned long long int N; cin >> N;
    string ans = "";
    while (N > 0) {
        N -= 1;
        int tmp = N % 26;
        ans += (char)(tmp + 97);
        N /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


Measured memory_bytes: 3596
from math import floor
A,B = map(int,input().split(" "))
s = 10*B
t = 10*(B+1)
ans = 2**60
for tmp in range(s,t):
    if floor(tmp*0.08) == A:
        ans = tmp
        break
s = 125*A
t = 125*(A+1)
for tmp in range(s,t):
    if floor(tmp/10) == B:
        ans = min(ans,tmp)
        break
if ans == 2**60:
    ans = -1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main()
{
  int N; cin >> N;
  int A[N]; rep(i,N) cin >> A[i];
  
  sort(A, A+N, greater<int>());
  
  int ans = A[0] - A[N-1];
  
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int N=sc.nextInt();//にんじんの個数
			int K=sc.nextInt();//保持できるにんじんの数
			int k=0;//保持しているにんじんの数
			int T=sc.nextInt();//加速できる時間
			int U=sc.nextInt();//普通の速さ
			int V=sc.nextInt();//加速の速さ
			int d=V*T;//加速で進む距離
			int L=sc.nextInt();//スタ－トからゴールまでの距離
			int[] D=new int[L+1];//にんじんが置かれている場所
			int[] l=new int[L+1];
			for(int i=1; i<=N; i++) {
				int carrot=sc.nextInt();
				D[carrot]=i;
			}
			double ans=0;
			for(int i=0; i<L; i++) {
				if(l[i]==0 && D[i]==0 && k==0) {
					ans+=1.0/U;
				}
				else if(D[i]>0){
					if(l[i]==0) {
						ans+=1.0/V;
						if(i+d>=L) {
							for(int j=i; j<L; j++) {
								l[j]=1;
							}
						}
						else {
							for(int j=i; j<i+d; j++) {
								l[j]=1;
							}
						}
					}
					else if(l[i]==1 && K>0) {
						k++;
						K--;
						ans+=1.0/V;
					}
					else if(l[i]==1 && K==0) {
						ans+=1.0/V;
						if(i+d>=L) {
							for(int j=i; j<L; j++) {
								l[j]=1;
							}
						}
						else {
							for(int j=i; j<i+d; j++) {
								l[j]=1;
							}
						}
					}
				}
				else if(l[i]==1) {
					ans+=1.0/V;
				}
				else if(k>0) {
					k--;
					K++;
					ans+=1.0/V;
					if(i+d>=L) {
						for(int j=i; j<L; j++) {
							l[j]=1;
						}
					}
					else {
						for(int j=i; j<i+d; j++) {
							l[j]=1;
						}
					}
				}
				
			}
			System.out.println(ans);
			
			

		}
	}
}


Measured memory_bytes: 27368
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	xx := make([]int, n)
	next := make([]int, n)
	for i := 0; i < n; i++ {
		xx[i] = getNextInt(scanner)
	}
	l := getNextInt(scanner)
	alive := 0
	for i := 0; i <= n; i++ {
		for alive < n && (i == n || xx[i]-xx[alive] > l) {
			next[alive] = i - 1
			alive++
		}
	}

	doubling := make([][]int, 32)
	doubling[0] = next
	for i := 1; i < 32; i++ {
		doubling[i] = make([]int, n)
		for j := 0; j < n; j++ {
			doubling[i][j] = doubling[i-1][doubling[i-1][j]]
		}
	}
	q := getNextInt(scanner)

	for i := 0; i < q; i++ {
		a := getNextInt(scanner) - 1
		b := getNextInt(scanner) - 1
		if a > b {
			a, b = b, a
		}
		c := 0
		for j := 31; j >= 0; j-- {
			if doubling[j][a] >= b {
				continue
			}
			a = doubling[j][a]
			c |= 1 << uint(j)
		}
		fmt.Fprintln(writer, c+1)
	}
	writer.Flush()
}


Measured memory_bytes: 30080
#include <algorithm>
#include <climits>
#include <cstdio>

#define int long long

const int N = 300010;

struct Line {
  int k, b;

  Line() : k(0), b(0) {}
  Line(int _k, int _b) : k(_k), b(_b) {}

  int GetY(int x) { return k * x + b; }
};

int n, m;
int t[N];
int dp1[N], dp2[N];
int sum[N];

double Compare(Line l1, Line l2) {
  return 1.0 * (l2.b - l1.b) / (l1.k - l2.k);
}

template <typename T>
struct Stack {
  T st[N];
  int tp;

  Stack() : tp(0) {}

  void Push(T x) { st[++tp] = x; }

  T Top() { return st[tp]; }

  int Size() { return tp; }

  void Pop() { --tp; }

  void Clear() { tp = 0; }

  T operator[](const int& pos) const { return st[pos]; }
};

Stack<Line> stack;

void DP(int* dp) {
  for (int i = 1; i <= n; ++i)
    sum[i] = sum[i - 1] + t[i];
  stack.Clear();
  stack.Push(Line(0, 0));
  for (int i = 1; i <= n; ++i) {
    while (stack.Size() >= 2 &&
           stack.Top().GetY(i) <= stack[stack.Size() - 1].GetY(i))
      stack.Pop();
    dp[i] =
        std::max(dp[i - 1], stack.Top().GetY(i) + (i * i + i) / 2 - sum[i]);
    Line now(-i, dp[i] + (i * i - i) / 2 + sum[i]);
    while (stack.Size() >= 2 &&
           Compare(now, stack[stack.Size() - 1]) >=
               Compare(stack.Top(), stack[stack.Size() - 1]))
      stack.Pop();
    stack.Push(now);
  }
}

int ans[N];

void Dfs(int l, int r) {
  if (l == r) {
    ans[l] = 1 - t[l];
    return;
  }
  int mid = (l + r) >> 1;
  Dfs(l, mid);
  Dfs(mid + 1, r);
  stack.Clear();
  for (int i = l - 1; i < mid; ++i) {
    Line now(-i, dp1[i] + (i * i - i) / 2 + sum[i]);
    while (stack.Size() >= 2 &&
           Compare(now, stack[stack.Size() - 1]) >=
               Compare(stack.Top(), stack[stack.Size() - 1]))
      stack.Pop();
    stack.Push(now);
  }
  int pos = 1;
  int maxn = LLONG_MIN;
  for (int i = r; i > mid; --i) {
    while (pos < stack.Size() && Compare(stack[pos], stack[pos + 1]) >= i)
      ++pos;
    maxn = std::max(maxn,
                    stack[pos].GetY(i) + (i * i + i) / 2 - sum[i] + dp2[i + 1]);
    ans[i] = std::max(ans[i], maxn);
  }
  stack.Clear();
  for (int i = mid + 1; i <= r; ++i) {
    Line now(-i, dp2[i + 1] + (i * i + i) / 2 - sum[i]);
    while (stack.Size() >= 2 &&
           Compare(now, stack[stack.Size() - 1]) >=
               Compare(stack.Top(), stack[stack.Size() - 1]))
      stack.Pop();
    stack.Push(now);
  }
  pos = stack.Size();
  maxn = LLONG_MIN;
  for (int i = l - 1; i < mid; ++i) {
    while (pos >= 2 && Compare(stack[pos], stack[pos - 1]) <= i)
      --pos;
    maxn =
        std::max(maxn, stack[pos].GetY(i) + (i * i - i) / 2 + sum[i] + dp1[i]);
    ans[i + 1] = std::max(ans[i + 1], maxn);
  }
}

signed main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; ++i)
    scanf("%lld", &t[i]);
  DP(dp1);
  std::reverse(t + 1, t + n + 1);
  DP(dp2);
  std::reverse(t + 1, t + n + 1);
  std::reverse(dp2 + 1, dp2 + n + 1);
  for (int i = 1; i <= n; ++i)
    sum[i] = sum[i - 1] + t[i];
  Dfs(1, n);
  scanf("%lld", &m);
  while (m--) {
    int p, x;
    scanf("%lld%lld", &p, &x);
    printf("%lld\n", std::max(dp1[p - 1] + dp2[p + 1], ans[p] + t[p] - x));
  }
}


Measured memory_bytes: 18944
#include <bits/stdc++.h>
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;
using P = pair<ll, int>;
struct Max
{
    using T = P;
    T operator()(const T& a, const T& b) const { return max(a, b); }
    static constexpr T identity() { return P{-INF<ll>, -INF<int>}; }
};
template <typename Base>
class SparseTable
{
public:
    using T = typename Base::T;
    using SemiLattice = Base;
    SparseTable(const vector<T>& val) : size(val.size()), lg2(size + 1, 0)
    {
        for (int i = 2; i <= size; i++) {
            lg2[i] = lg2[i / 2] + 1;
        }
        table.resize(size, vector<T>(lg2[size] + 1));
        for (int i = 0; i < size; i++) {
            table[i][0] = val[i];
        }
        for (int j = 0; j < lg2[size]; j++) {
            const int w = 1 << j;
            for (int i = 0; i <= size - (w << 1); i++) {
                T tl = table[i][j], tr = table[i + w][j];
                table[i][j + 1] = op(tl, tr);
            }
        }
    }
    T accumulate(const int l, const int r) const
    {
        assert(0 <= l and l < r and r <= size);
        const int j = lg2[r - l];
        return op(table[l][j], table[r - (1 << j)][j]);
    }

private:
    const int size;
    vector<int> lg2;
    vector<vector<T>> table;
    const SemiLattice op{};
};
using ST = SparseTable<Max>;
int N, M;
void rec(const int inf, const int sup, vector<vector<ll>>& imos, const ST& stable)
{
    if (inf >= sup) return;
    const auto p = stable.accumulate(inf, sup);
    const int ind = p.second;
    const ll v = p.first;
    imos[ind][ind] += v;
    if (inf > 0) {
        imos[ind][inf - 1] -= v;
        if (sup < N) {
            imos[sup][inf - 1] += v;
        }
    }
    if (sup < N) {
        imos[sup][ind] -= v;
    }
    rec(inf, ind, imos, stable);
    rec(ind + 1, sup, imos, stable);
}

int main()
{
    cin >> N >> M;
    vector<ll> pos(N, 0);
    for (int i = 1; i < N; i++) {
        ll A;
        cin >> A;
        pos[i] = pos[i - 1] + A;
    }
    vector<vector<ll>> imos(N, vector<ll>(N, 0));
    vector<vector<P>> vs(M, vector<P>(N));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            cin >> vs[j][i].first;
            vs[j][i].second = i;
        }
    }
    for (int i = 0; i < M; i++) {
        ST stable{vs[i]};
        rec(0, N, imos, stable);
    }
    for (int y = 0; y < N; y++) {
        for (int x = N - 2; x >= 0; x--) {
            imos[y][x] += imos[y][x + 1];
        }
    }
    for (int x = 0; x < N; x++) {
        for (int y = 1; y < N; y++) {
            imos[y][x] += imos[y - 1][x];
        }
    }
    ll ans = -INF<ll>;
    for (int i = 0; i < N; i++) {
        for (int j = i; j < N; j++) {
            const ll cost = pos[j] - pos[i];
            const ll yam = imos[j][i];
            ans = max(ans, yam - cost);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 212704
#include <bits/stdc++.h>
#include <vector>
#include <string>
using namespace std;
#define FL(i,a,b) for(int i = a;i<b;i++)
typedef vector<int> vi;
typedef long long int lli;
const int inf = numeric_limits<int>::max();


int main(){
   string s;
   cin>>s;
   if(s=="ABC"){
       cout<<"ARC";
   }
   else{
       cout<<"ABC";
   }
    
    
}




Measured memory_bytes: 3604
import java.util.Scanner;


public class Main {
	

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[][][] data = new int[4][3][10];
		
		for(int i = 0; i < n; i++) {
			int b = stdIn.nextInt();
			int f = stdIn.nextInt();
			int r = stdIn.nextInt();
			int v = stdIn.nextInt();
			
			data[b-1][f-1][r-1] += v;
		}
		
		for(int i = 0; i < 4; i++) {
			for(int j = 0; j < 3; j++) {
				for(int k = 0; k < 10; k++) {
					System.out.print(" " + data[i][j][k]);
				}
				System.out.println();
			}
			if(i != 3) {
			System.out.println("####################");
			}
		}
	}

}

Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

signed main() {
    int n;
    string s;
    cin >> n >> s;
    vector<int> left_side(n, 0);
    vector<int> right_side(n, 0);
    for (int i = 1; i < n; i++) {
        left_side[i] = left_side[i - 1];
        if (s[i - 1] == 'W') {
            left_side[i]++;
        }
    }
    for (int i = n - 2; i >= 0; --i) {
        right_side[i] = right_side[i + 1];
        if (s[i + 1] == 'E') {
            right_side[i]++;
        }
    }
    int min_v = INF;
    for (int i = 0; i < n; ++i) {
        min_v = min(min_v, left_side[i] + right_side[i]);
    }
    cout << min_v << "\n";
}

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

int main()
{
    long long i, j, k, n, t, x, y, s=0, c=0, l;
    cin >> x >> y;
    if(x<=8 && y<=8)
        cout << "Yay!";
    else
        cout << ":(";
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <bitset>
#include <functional>
#include <tuple>
#include <complex>
#include <chrono>
#include <climits>

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef unsigned int uint;
typedef unsigned long long ull;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
// default_random_engine generator;
// mt19937 rnd(1);

const int MAXN = 200200;

vector<int> g[MAXN];

pii dfs(int v, int p = -1) {
    pii res = {0, v};

    for (int u : g[v]) {
        if (u == p) {
            continue;
        }
        pii q = dfs(u, v);
        if (q.first > res.first) {
            res = q;
        }
    }
    ++res.first;
    return res;
}

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

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n;
    cin >> n;

    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    int v = dfs(0).second;

    int res = dfs(v).first;

    cout << (res % 3 != 2 ? "First" : "Second") << endl;



}  


Measured memory_bytes: 23680
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    g = gcd(a, b)
    g_a = a // g
    g_b = b // g
    return g_a * g_b * g

n, m = map(int, input().split())
a = list(map(int, input().split()))



b = []
for i in range(n):
    b.append(a[i]//2)

num = 1
for i in range(n):
    num = lcm(num, b[i])
    if num > m:
        print(0)
        exit()

for i in range(n):
    if (num // b[i]) % 2 == 0:
        print(0)
        exit()


p = m // num
if p % 2 == 0:
    print(p//2)
else:
    print((p+1)//2)


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

const int MAX_N = 2e5+10;
int N;
string S;

void solve()
{
	int rc = count(S.begin(),S.end(),'R');
	int wc = N-rc;
	int ans = min(rc,wc);
	int sw = 0;
	int i=0,j=N-1;
	while(i<j){
		while(i<j&&S[i]=='R')i++;
		while(i<j&&S[j]=='W')j--;
		if(i<j)sw++;
		swap(S[i],S[j]);
	}
	ans=min(ans,sw);
	cout << ans;
}

int main()
{
	cin >> N >> S;
	solve();
	return 0;
}

Measured memory_bytes: 3768
main(h,m,s){
	for(;scanf("%d%d%d",&h,&m,&s),~h;){
		int left=7200-(60*(60*h+m)+s);
		printf("%02d:%02d:%02d\n",left/3600,left%3600/60,left%60);
		left*=3;
		printf("%02d:%02d:%02d\n",left/3600,left%3600/60,left%60);
	}
	exit(0);
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<cctype>
using namespace std;
 
int main(){
    char ch;
    int alpha[26] = {};
 
    while(cin >> ch){
        ch = tolower(ch);
        if(isalpha(ch)){
            alpha[ch-'a']++;
        }
    }
 
    for(int i=0; i<26; i++){
        printf("%c : %d\n",'a'+i,alpha[i]);
    }
 
    return 0;
}

Measured memory_bytes: 1124
#include<iostream>
using namespace std;
int main(){
	int x1,x2,x3,x4,y1,y2,y3,y4,a,b;
	cin>>x1>>y1>>x2>>y2;
	a=x1-x2;
	b=y1-y2;
	x3=x2+b;
	x4=x1+b;
	y3=y2-a;
	y4=y1-a;
	
	cout<<x3<<' '<<y3<<' '<<x4<<' '<<y4<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<deque>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<iomanip>
#include<sstream>
using namespace std;

#define pi acos(-1.0)
#define ms(x,n) memset(x,n,sizeof(x));

typedef long long ll;//string::npos
typedef long long iint;

ll gcd(ll a,ll b) {
	return a%b==0?b:gcd(b,a%b);
}
ll lcm(ll x,ll y) {
	ll z=gcd(x,y);
	return x*y/z;
}

const int MAXX=2e5+5;
const int INF=1e7+5;
const int mod=998244353;

//vector<int> vt;
//pair<int,int> p;
//map<int,int> m;
int main() {
	ios::sync_with_stdio(false);
	
	int k,n,x,subs=0,r=2,ans1=0,ans2=0;
	int a[MAXX];
	cin>>k>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	for(int i=2;i<=n;i++){
		x=a[i]-a[i-1];
		if(subs<x){
			subs=x;
			r=i;
		}
	}
	ans2=a[r-1]+(k-a[r]);
	ans1=a[n]-a[1];
	cout<<min(ans1,ans2)<<endl;
	
	
	
	
	return 0;
}



Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define assign(x,val) memset(x,val,sizeof(x))
#define all(x) (x).begin(), (x).end()
#define for0(i,n) for(ll i=0;i<n;++i)
#define for1(i,n) for(ll i=1;i<=n;++i)
#define ford(i,n) for(ll i=n;i>=1;--i)
#define forg(i,a,b) for(ll i=a;i<b;++i)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpl;
long long mod = 1000000007;
const long double PI = (long double)(3.1415926535897932384626433832795);


void solve(){
  ll n;cin>>n;
  if(n&1) cout<<0<<endl;
  else{
  	ll cnt = 0;
    while(n){
      cnt += (n/5)/2;
      n/=5;
    }
    cout<<cnt<<endl;
  }

}

int main(){
	ll t = 1;
	//cin>>t;
	for0(i, t){
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
using System;

class main
{
    static void Main(string[] args)
    {
        string s1, s2, a4;
        int c = int.Parse(Console.ReadLine());
        for (int m = 0; m < c; m++)
        {
            s1 = Console.ReadLine();
            s2 = Console.ReadLine();
            a4 = string.Empty;
            ulong a1 = 0, a2 = 0;
            string[] s3 = new string[5];
            string[] s4 = new string[5];
            string[] s5 = new string[5];
            ulong[] a3 = new ulong[5];
            if (s1.Length > 80 || s2.Length > 80)
            {
                Console.WriteLine("overflow");
                goto end;
            }
            s1 = s1.PadLeft(80, '0');
            s2 = s2.PadLeft(80, '0');
            for (int i = 0; i < 5; i++)
            {
                s3[i] = s1.Substring(16 * i, 16);
                s4[i] = s2.Substring(16 * i, 16);
            }
            for (int j = 4; j >= 0; j--)
            {
                a1 = ulong.Parse(s3[j]);
                a2 = ulong.Parse(s4[j]);
                a3[j] += a1 + a2;
                if (a3[j].ToString().Length == 17)
                {
                    if (j == 0)
                    {
                        Console.WriteLine("overflow");
                        goto end;
                    }
                    a3[j] -= 10000000000000000;
                    a3[j - 1] += 1;
                }
                s5[j] = a3[j].ToString().PadLeft(16, '0');
            }
            a4 = string.Join("", s5);
            while (a4.StartsWith("0"))
            {
                a4 = a4.TrimStart('0');
                if (a4 == "")
                {
                    Console.WriteLine(0);
                    goto end;
                }
            }
            Console.WriteLine(a4);
        end: ;
        }
    }
}

Measured memory_bytes: 6356
import java.util.*;

public class Main{
	public static void main(String[] args){
		int i;
		Scanner scan = new Scanner(System.in);

		while(scan.hasNextInt()){
			int n = scan.nextInt();
			int m = scan.nextInt();

			ArrayList<Integer> a = new ArrayList<Integer>();
			ArrayList<Integer> b = new ArrayList<Integer>();
			ArrayList<Integer> c = new ArrayList<Integer>();

			for(i=0;i<n;i++) c.add(i);

			while(m-- > 0){
				int r = scan.nextInt();

				for(i=0;i<n/2;i++) b.add(c.remove(0));
				for(;i<n;i++) a.add(c.remove(0));

				while(!a.isEmpty() || !b.isEmpty()){
					int sa = a.size();
					int sb = b.size();

					for(i=0;i<sa && i<r;i++) c.add(a.remove(0));
					for(i=0;i<sb && i<r;i++) c.add(b.remove(0));
				}
			}

			System.out.println(c.get(n-1));
		}
	}
}

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

int main() {
  long W, H, x, y;
  cin >> W >> H >> x >> y;
  double S = ((double)(W*H))/((double)2);
  int b_multi = 0;
  if ( W == 2 * x && H == 2 * y ) {
    b_multi = 1;
  }
  cout << S << " " << b_multi << endl;
}

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

int main()
{
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  cout << x2-(y2-y1) << " " << y2+(x2-x1) << " " << x2-(y2-y1)-(x2-x1) << " " << y2+(x2-x1)-(y2-y1) << endl;
}

Measured memory_bytes: 256