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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  int N; cin >> N;
  string S; cin >> S;
  int result = 0;
  rep(i,N-2) if (S.substr(i,3)=="ABC") result++;
  cout << result << endl;
  return 0;
}

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

ll solve() {
    ll A, B;
    cin >> A >> B;
    if ( A < 10 && B < 10 ) return A*B;
    else return -1;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ll l,r;
	cin>>l>>r;
	if(l%2019 == 0 || r%2019 == 0)
		cout<<0<<endl;
	else 
	{
		if(r-l>=2019) cout<<0<<endl;
		else
		{
			ll ans =99999999999999;
			for(ll i = l;i<=r;i++)
			{
				for(ll j = i + 1;j<=r;j++)
				{
					ans = min(ans,(i%2019)*(j%2019)%2019);
				}
			}
			cout<<ans<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int a[6], q, t, f, temp, i;
void rotateX(){
    temp = a[0];
    a[0] = a[1];
    a[1] = a[5];
    a[5] = a[4];
    a[4] = temp;
}
void rotateY(){
    int j;
    temp = a[1];
    a[1] = a[2];
    a[2] = a[4];
    a[4] = a[3];
    a[3] = temp;
}
void rotateZ(){
    int j;
    temp = a[0];
    a[0] = a[2];
    a[2] = a[5];
    a[5] = a[3];
    a[3] = temp;
}
int main(){
    for(i=0;i<6;i++)
        scanf("%d", &a[i]);
    scanf("%d", &q);
    while(q--){
        scanf("%d %d", &t, &f);

        if(t == a[0]){
            for(i=0;i<4 && a[1]!=f;i++)rotateY();
            printf("%d\n", a[2]);
            continue;
        }else{
            if(f == a[1]){
                for(i=0;i<4 && a[0]!=t;i++)rotateZ();
                printf("%d\n", a[2]);
                continue;
            }else{
                for(i=0;i<4 && a[0]!=t && a[1]!=f;i++)rotateX();
                if(a[0] == t){
                    for(i=0;i<4 && a[1]!=f;i++)rotateY();
                    printf("%d\n", a[2]);
                    continue;
                }else if(f == a[1]){
                    for(i=0;i<4 && a[0]!=t;i++)rotateZ();
                    printf("%d\n", a[2]);
                    continue;
                }else{
                    for(i=0;i<4 && a[0]!=t && a[1]!=f;i++)rotateZ();
                    if(a[0] == t){
                        for(i=0;i<4 && a[1]!=f;i++)rotateY();
                        printf("%d\n", a[2]);
                        continue;
                    }else if(f == a[1]){
                        for(i=0;i<4 && a[0]!=t;i++)rotateZ();
                        printf("%d\n", a[2]);
                        continue;
                    }
                }
            }
        }

        for(i=0;i<6;i++)printf("%d ", a[i]);printf("\n");
        //printf("%d\n", a[2]);
    }
return 0;
}



Measured memory_bytes: 2048
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>

//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourd; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, q, last, cnt, sum[10000], ans, dp[10000][10000], a[10000],b[10000];
string str, ss;
bool f;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ -1,0 } ,{ 0,-1 } };
struct Edge { LL to, cost; };
vector<LL>vec[100100];
vector<Pll>v[200000];
map<Pll, LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

int main() {
	rep(i, 4)
		cin >> a[i];
	sort(a, a + 4);
	cout << (a[0] == a[1] && a[2] == a[3] ? "yes" : "no") << endl;
	return 0;
}



Measured memory_bytes: 10228
#include <map>
#include <cstdio>
using namespace std;
typedef map<pair<int,int>,int> mpiii;

void solve(int T){
	mpiii m;
	char cmd[2];
	int n;
	for(;T--;){
		scanf("%s%d",cmd,&n);
		if(*cmd=='D'){
			for(mpiii::iterator it=m.begin();it!=m.end();){
				if(it->second==n){
					mpiii::iterator it2=it;
					++it;
					m.erase(it2);
				}else{
					++it;
				}
			}
		}else if(*cmd=='R'){
			mpiii::iterator it=m.lower_bound(make_pair(n,2000000000));
			if(it==m.begin()){
				puts("-1");
			}else{
				--it;
				printf("%d\n",it->first.first<=n&&n<=it->first.second ? it->second : -1);
			}
		}else if(*cmd=='W'){
			int z;
			scanf("%d",&z);
			int cur=0;
			for(mpiii::iterator it=m.begin();it!=m.end();++it){
				int d=it->first.first-cur;
				if(d>z)d=z;
				if(d)m[make_pair(cur,cur+d-1)]=n;
				z-=d;
				if(z==0)break;
				cur=it->first.second+1;
			}
			if(z)m[make_pair(cur,cur+z-1)]=n;
		}
	}
}
int main(){for(int T;~scanf("%d",&T)&&T;puts(""))solve(T);}

Measured memory_bytes: 1240
n = int(input())
a = [int(input()) for i in range(n)]
t = -1
s = 0
ans = 0
for i in range(n):
    if a[i] == t+1:
        t += 1
        s = t
    elif a[i] > t+1:
        print(-1)
        exit()
    else:
        ans += s
        t = a[i]
        s = t
ans += s
print(ans)


Measured memory_bytes: 16920
n = int(input())

goals = [tuple(map(int, input().split())) for _ in range(n)]

step = 0
start = (0, 0)
for g in goals:
    s = g[0] - step
    d = abs(g[1] - start[0]) + abs(g[2] - start[1])

    if s < d or s % 2 != d % 2:
        print('No')
        break

    step = g[0]
    start = (g[1], g[2])
else:
    print('Yes')


Measured memory_bytes: 17324
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

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

    vector<int> ans(N);
    for(int i = 0; i < N; ++i){
        if(i % 2 != 0){
            ans[0] -= a[i];
        }else{
            ans[0] += a[i];
        }
    }
    cout << ans[0] << " ";
    for(int i = 0; i < N -2; ++i){
        ans[i+1] = 2 * (a[i] - ans[i] / 2);
        cout << ans[i+1] << " ";
    }
    cout << 2 * (a[N - 2] - ans[N - 2] / 2) << endl;

    return 0;
}


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

int selectionSort(int A[], int N){

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

int main(){

    int A[100],N,sw;

    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];

    sw = selectionSort(A,N);

    for(int i = 0; i < N; i++){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;
    return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
int main() {
    int k, x;
    cin >> k;
    cin >> x;
    int i;
    for(i = -k+1;i <= k-1;i++) {
       cout <<  x + i;
       cout<< ' ';
    }
    cout << '\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<complex>
#include<algorithm>
#include<cmath>
#define EPS 1e-8
using namespace std;
 
typedef complex<double> P;
 
P center(P a,P b){
  P m = (a+b)/2.0;
  P n = (a-b)*P(0,1);
  n = n/abs(n);
 
  double x = abs(a-b)/2.0;
  return m + n*sqrt(1.0 - x*x);
}
 
int main(){
  int n;
  P p[300];
 
  while(cin >> n && n){
    for(int i=0;i<n;i++)cin >> p[i].real() >> p[i].imag();
 
    int ans = 1;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
    if(i!=j){
      if(abs(p[i]-p[j])+EPS>2.0)continue;
      P c = center(p[i],p[j]);
      int num = 0;
      for(int k=0;k<n;k++)
        if(abs(c-p[k])<1.0+EPS)num++;
      ans = max(ans,num);
    }
      }
    }
    cout << ans << endl;
  }
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n, ans = 0;
  cin >> n;
  vector<ll> l(n);
  rep(i, n) cin >> l[i];
  sort(l.begin(), l.end());
  for (int i = 0; i < n - 2; ++i) {
    for (int j = i + 1; j < n - 1; ++j) {
      if (l[i] == l[j]) continue;
      for (int k = j + 1; k < n; ++k) {
        if (l[j] == l[k]) continue;
        if (l[i] + l[j] > l[k]) ans++;
      }
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let n:u64 = procon_read()[0];
	println!("{}", n*(n+1)/2 - 3*(n/3)*(1 + n/3)/2 - 5*(n/5)*(1 + n/5)/2 + 15*(n/15)*(1 + n/15)/2);
}

Measured memory_bytes: 2120
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]

l = sorted(l, key = lambda x: x[0])
p = 0
for v in l:
    if m >= v[1]:
        m = m - v[1]
        p += v[0] * v[1]
    elif m < v[1]:
        p += v[0] * m
        m = 0
        
    if m == 0:
        break
        
print(p)

Measured memory_bytes: 29836
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
long long mem[1005][1005];
bool vis[1005][1005];
int a, b, c, d;
long long fact[1005], inv[1005];
long long bigpow(long long b, long long p) {
  if (p == 0) return 1;
  long long t = bigpow(b, p / 2);
  t *= t;
  t %= MOD;
  if (p % 2 == 1) {
    t *= b;
    t %= MOD;
  }
  return t;
}
long long biginv(long long x) {
  return bigpow(x, MOD - 2);
}
long long dp(int x, int y) {
  if (x == 0) return 1;
  if (y > b) return 0;
  if (vis[x][y]) return mem[x][y];
  vis[x][y] = true;
  long long ret = dp(x, y + 1);
  for (int z = c; z <= d && y * z <= x; z++) {
    long long t = dp(x - y * z, y + 1);
    t *= fact[x];
    t %= MOD;
    t *= inv[x - y * z];
    t %= MOD;
    for (int j = 0; j < z; j++) {
      t *= inv[y];
      t %= MOD;
    }
    t *= inv[z];
    t %= MOD;
    ret += t;
  }
  return mem[x][y] = (ret % MOD);
}
int main() {
  fact[0] = 1;
  inv[0] = 1;
  for (int i = 1; i <= 1000; i++) {
    fact[i] = fact[i - 1] * i % MOD;
    inv[i] = biginv(fact[i]);
  }
  int n;
  cin >> n >> a >> b >> c >> d;
  cout << dp(n, a) << endl;
  return 0;
}


Measured memory_bytes: 9216
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
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 string import ascii_lowercase
X = {c for c in ascii_lowercase}
S = input()
for s in S:
    if s in X:
        X.remove(s)
X = sorted(X)
if len(X) == 0:
    print("None")
else:
    print(X[0])


Measured memory_bytes: 27536
#define M 99999
T[M],t[M];main(I,i,j,m,a,b,p,q){
for(i=2;i<M;i++)if(!T[i])for(j=i*2;j<M;j+=i)T[j]=1;
for(i=2,j=1;i<M;i++)if(!T[i])t[j++]=i;
for(;scanf("%d%d%d",&m,&a,&b),m;printf("%d %d\n",p,q))for(i=1;I=t[i];i++)if(I*I>m)i=0,m--;else if(!T[q=m/I]&&(p=I)*q==m&&a*q<=b*p)break;
exit(0);}

Measured memory_bytes: 1028
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
constexpr ll mod[2] = {1000000007,998244353};
struct rolling_hash{
	ll z = 100,ex[2][100010];
	vector<ll> v,w[2];
	rolling_hash(string &s){
		int i,j,n = s.size();
		for(i=0;i<n;i++){
			v.push_back(s[i] - 'a' + 1);
		}
		w[0].assign(n + 1,0),w[1].assign(n + 1,0);
		ex[0][0] = 1,ex[1][0] = 1;
		for(i=0;i<n;i++){
			for(j=0;j<2;j++){
				w[j][i + 1] = (w[j][i]*z + v[i])%mod[j];
				ex[j][i + 1] = ex[j][i]*z%mod[j];
			}
		}
	}
	inline pll get(int l, int r){//[l,r)
		ll x = (w[0][r] - ex[0][r - l]*w[0][l]%mod[0] + mod[0])%mod[0];
		ll y = (w[1][r] - ex[1][r - l]*w[1][l]%mod[1] + mod[1])%mod[1];
		return {x,y};
	}
};

string s;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int i,j,n,ans = 0;
	cin >> n >> s;
	rolling_hash rh(s);
	for(i=0;i<n;i++){
		for(j=i + 1;j<n;j++){
			if(s[i]!=s[j]) continue;
			int l = 0,r = min(j - i,n - j);
			if(rh.get(i,i + r)==rh.get(j,j + r)){
				ans = max(ans,r);
				continue;
			}
			while(r - l>1){
				int mid = (l + r)/2;
				if(rh.get(i,i + mid)==rh.get(j,j + mid)) l = mid;
				else r = mid;
			}
			ans = max(ans,l);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
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; }
const ll INF = 1e9;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 2000010;

ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll g(ll r,ll c){
    return COM(r+c+2,min(r+1,c+1))-1;
}
int main() {
    COMinit();
    ll r1,c1,r2,c2;
    cin >> r1 >> c1 >> r2 >> c2;
    PRINT(((g(r2,c2)-g(r1-1,c2)-g(r2,c1-1)+g(r1-1,c1-1))%MOD+MOD)%MOD);
}

Measured memory_bytes: 47104
#include<bits/stdc++.h> 
using namespace std;
int n,a,b;
void solve(int a,int b,int v){
	if (a==b){
		printf("%d ",a);
		return;
	}
	int x=(a^b)&(-(a^b));
	v^=x;
	int y=v&(-v);
	solve(a,a^y,v);
	solve(a^y^x,b,v);
}
int main(){
	scanf("%d%d%d",&n,&a,&b);
	if (__builtin_popcount(a^b)&1)puts("YES"),solve(a,b,(1<<n)-1);
	else puts("NO");
}

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

int main() {
 int N;
 int P=0;
 int W=0;
 int G=0;
 int Y=0;
 cin >> N;
 for(int i=0; i<N; i++){
 	string S;
	cin >> S;
	if(S=="P") P=1;
	if(S=="W") W=1;
	if(S=="G") G=1;
	if(S=="Y") Y=1;
 }
 if(P+W+G+Y==3) cout << "Three" << endl;
 else cout << "Four" << endl;
}


Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())
      
(n, m), *q = [list(map(int, o.split())) for o in open(0)]
UF = UnionFind(n)
for x, y, _ in q:
    UF.union(x - 1, y - 1)
print(UF.group_count())

Measured memory_bytes: 31820
#include <iostream>
#include <stdio.h>

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int n;
    int a, b;

    vector<int> x;
    vector<int> y;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a;
        x.push_back(a);
    }

    for (int i = 0; i < n; i++) {
        cin >> b;
        y.push_back(b);
    }

    double distance1=0;
    for (int i = 0; i < n; i++) {
        distance1 = distance1 + abs(x[i] - y[i]);
    }

    double distance2 = 0;
    for (int i = 0; i < n; i++) {
        double aa = abs(x[i] - y[i]);
        distance2 = distance2 + aa*aa;
    }

    double distance3 = 0;
    for (int i = 0; i < n; i++) {
        double aa = abs(x[i] - y[i]);
        distance3 = distance3 + aa*aa*aa;
    }
    //cbrt

    double distance4 = 0;
    for (int i = 0; i < n; i++) {
        if (abs(x[i] - y[i]) > distance4) {
            distance4 = abs(x[i] - y[i]) ;
        }
    }

    printf("%lf\n", distance1);
    printf("%lf\n", sqrt(distance2));
    printf("%lf\n", cbrt(distance3));
    printf("%lf\n", distance4);

    return 0;
}


Measured memory_bytes: 3408
import sys

def solve():
    x = int(input())

    if x < 1200:
        print('ABC')
    else:
        print('ARC')
    

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None


if __name__ == '__main__':
    solve()

Measured memory_bytes: 3060
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;

struct node{
  vector<long> child;
  long flg;
};

std::vector<std::vector<int>> tree ;
vector<lll> sum;

bool dfs_sum(long start,lll sumt){
  //cout << "sequence" << start << endl;

  for(auto next:tree[start]){
    sum[next] += sumt;
    if(dfs_sum(next,sum[next])){

    }
  }
  
  return false;
}

int main(){
  lll ii,jj,kk;

  lll n,q;
  cin >> n  >> q;

  vector<lll> a,b;

  a.resize(n-1);
  b.resize(n-1);

  for(ii=0;ii<n-1;ii++){
    cin >> a[ii] >> b[ii];
  }

  vector<struct node> nodes;
  nodes.resize(n);

  tree.resize(n);

  for(ii=0;ii<n-1;ii++){
    //cout << "a[ii]" << a[ii] << "b[ii]" << b[ii] << endl;
    tree[a[ii]-1].push_back(b[ii]-1);
  }
  
  //cout << "flg "<< nodes[0].flg << endl;
  //for(ii=0;ii<n-1;ii++){
  //  nodes[a[ii]-1].push_back();
  //}
  vector<lll> p,x;

  p.resize(q);
  x.resize(q);

  for(ii=0;ii<q;ii++){
    
    cin >> p[ii] >> x[ii];

  }


  sum.resize(n);
  //cout << sum[0] << endl;

  for(ii=0;ii<q;ii++){
    sum[p[ii]-1] += x[ii];
    //cout << "p[ii]" << p[ii] << "x[ii]" << x[ii] << endl;
  }


  //合計の計算

  dfs_sum(0,sum[0]);
  
  for(ii=0;ii<n;ii++){
    cout   << sum[ii] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 33664
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

int main () {
  string s;
  cin >> s;
  int n0 = count(rng(s),'0');
  int n1 = count(rng(s),'1');
  cout << 2*min(n0, n1) << endl;
  return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <climits>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define fst first
#define snd second
#define MP make_pair //incase c++11 or later is not available

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
#define LIM_INF (INT_MAX)
//const int INF = INT_MAX/3;

/*------------------------------------------------------------------------------*/

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

  int minv, maxv = -INF*3;
  cin >> minv;

  REP(i, 1, n){
    int v;
    cin >> v;
    maxv = max(maxv, v - minv);
    minv = min(minv, v);
  }

  cout << maxv << endl;
  return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;
int main(){
  int n;
  cin>>n;
  for(int i=9;i>=0;i--){
    if(i!=0){
      if(n%i==0&&n/i<10){
        cout<<"Yes"<<endl;
        i=-1;
      }
    }
    else{
      cout<<"No"<<endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 256
def slove():
    import sys, itertools
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    ks = []
    for i in range(m):
        ks.append(list(map(int, input().rstrip('\n').split())))
    p = list(map(int, input().rstrip('\n').split()))
    ls = [True, False]
    all_cnt = 0
    for i in itertools.product(ls, repeat=n):
        b = True
        for j, v in enumerate(ks):
            cnt = 0
            for k, s in enumerate(v):
                if k != 0:
                    if i[s-1]:
                        cnt += 1
            if p[j] != cnt % 2:
                b = False
                break
        if b:
            all_cnt += 1
    print(all_cnt)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 41200
#include<stdio.h>

int main( void ){
	int i, n, min, max;
	
	scanf("%d", &n );
	
	int r[n];
	
	for( i = 0; i < n; i++ ){
		scanf("%d", &r[i] );
	}
	
	min = r[0];
	max = r[1] - r[0];
	for( i = 1; i < n; i++ ){
		if( max < r[i] - min ){
			max = r[i] - min;
		}
		if( min > r[i] ){
			min = r[i];
		}
	}
	
	printf("%d\n", max );
	
	return 0;
}




Measured memory_bytes: 2532
def yakusu(N):
    if N == 1:
        return []
        
    fin = int(N**0.5)

    num = list()
    for i in range(2, fin+1):
        if N % i == 0:
            num.append(i)
            if N != i**2:
                num.append(N//i)
    num.append(N)
    
    return num


N = int(input())


#N-1の約数の個数(から1を除く)
ans = len(yakusu(N-1))


#Nの約数の内、条件を満たすもの
arr = yakusu(N)
for i in range(len(arr)):
    tmp = N
    while tmp % arr[i] == 0:
        tmp //= arr[i]
    
    if tmp % arr[i] == 1:
        ans += 1

print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007
#define vi vector < int >
#define pii pair < int, int >
#define INF (int)1e9
#define pb push_back
#define fastIO ios::sync_with_stdio(0); cin.tie(0);

vector < vi > arr;
int n;
int cache[100010][3];

int dpSol(int i, int ch)
{
    if(i == n)
        return 0;
        
    int &res = cache[i][ch];
    if(res != -1)
        return res;
        
    if(ch == 0)
        return res = max(arr[i][1] + dpSol(i + 1, 1), arr[i][2] + dpSol(i + 1, 2));
    if(ch == 1)
        return res = max(arr[i][0] + dpSol(i + 1, 0), arr[i][2] + dpSol(i + 1, 2));
    return res = max(arr[i][0] + dpSol(i + 1, 0), arr[i][1] + dpSol(i + 1, 1));
}

int main()
{
    fastIO
    cin >> n;
    
    memset(cache, -1, sizeof(cache));
    
    arr = vector < vi >(n, vi(3));
    for(int i = 0; i < n; ++i)
        cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
        
    cout << max({dpSol(0, 0), dpSol(0, 1), dpSol(0, 2)});

    return 0;
}

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

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define cAll(x) (x).cbegin(),(x).cend()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = INT64_MAX;
const int INF = INT_MAX;

inline constexpr int sqr(int x) { return (x * x); }
inline void printd(double x) { printf("%.10lf\n", x); }
inline void upsort(VI& x) { sort((x).begin(), (x).end()); }
inline void downsort(VI& x) { sort((x).begin(), (x).end(), greater<int>()); }
inline int absdiff(int a, int b) { return (a - b)*(1|((a - b)>>(8*sizeof(int))));}

int gcd(int a, int b) {
	if (a < b) return gcd(b, a);
	int r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}

signed main()
{
	int K;
	cin >> K;

	int sum = 0;
	rng(a, 1, K+1) {
		rng(b, 1, K + 1) {
			rng(c, 1, K + 1) {
				int ab = gcd(a, b);
				sum += gcd(ab, c);
			}
		}
	}

	COL(sum);
	
	return 0;
}

Measured memory_bytes: 3636
using System;
using System.Linq;

namespace Curtain
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int A = inputs[0];
            int B = inputs[1];

            int result = A - (B * 2);
            if (result < 0)
            {
                result = 0;
            }

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13396
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <iostream>

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)  for(int i = (a); i > (b); --i)
#define rep(i, n)	   for(int i = 0; i < (n); ++i)
#define all(c)		   begin(c), end(c)
#define rall(c)		   rbegin(c), rend(c)
#define SZ(a)		   ((ll) a.size())

typedef long long		   ll;
typedef unsigned long long ull;


int main(){
  char S[27];
  string s="zyxwvutsrqponmlkjihgfedcba";
  scanf("%s",S);
  vector<int> sv(26,0);
  vector<int> flag(26,0);
  int i=0;
  char c,d,e;
  int j;
  int f=0;
  while(S[i]!=0){
    sv[i]=S[i]-96;
    flag[sv[i]-1]=1;
    i++;
  }
  if(S==s) cout << -1;
  else if(i==26){
    i=24;
    while(i>=0){
      c=S[i];
      j=25;
      e=125;
      while(j>i){
        d=S[j];
        if(d>c) e=min(e,d);
        j--;
      }
      if(e!=125){
        S[i]=e;
        S[i+1]=0;
        break;
      }
      i--;
    }
    cout << S;
  }
  else{
    j=0;
    while(flag[j]==1){
      j++;
    }
    c = j + 97;
    cout << S << c;
  }
}


Measured memory_bytes: 256
void main() {
	auto N = ri;
	auto S = rs;
	auto arr = new ulong[][](3, N);
	ulong conv(dchar c) {
		switch(c) {
			case 'R': return 0;
			case 'G': return 1;
			case 'B': return 2;
			default: assert(0);
		}
	}
	arr[conv(S[0])][0] = 1;
	foreach(i; 0..N-1) {
		foreach(k; 0..3) {
			arr[k][i+1] = arr[k][i];
		}
		auto ind = conv(S[i+1]);
		arr[ind][i+1] = arr[ind][i] + 1;
	}
	ulong res;
	debug arr.each!writeln;
	foreach(i; 0..N-2) foreach(j; i..N-1) {
		if(S[i] == S[j]) continue;
		auto tmp = [S[i], S[j]].to!(dchar[]).sort.array;
		dchar no;
		switch(tmp) {
			case ['B', 'G']:
				no = 'R';
				break;
			case ['B', 'R']:
				no = 'G';
				break;
			default: no = 'B'; break;
		}
		
		debug writefln("%d - %d", arr[conv(no)][$ - 1], arr[conv(no)][j]);
		auto tmp2 = arr[conv(no)][$ - 1] - arr[conv(no)][j];
		if((j-i) + j < N && S[ (j-i) + j] == no) tmp2--;

		debug writefln("%d %d %d", i, j, tmp2);
		res += tmp2;
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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


int main() {

    int a, b;
    cin >> a >> b;
    if (a <= b) cout << a << endl;
    else cout << a - 1 << endl;
    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 all(v) begin(v),end(v)
using ll = long long;

int main() {
  int n;cin>>n;
  rep(i,30)rep(j,20){
    if(4*i+7*j==n){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 3652
#include <iostream>

using namespace std;

int n;
int a,b;

const int MOD = 1e9 + 7;

int lgpow(int b,int e){
    int p = 1;

    while(e){
        if(e & 1){
            p = 1LL * p * b % MOD;
        }
        b = 1LL * b * b % MOD;
        e >>= 1;
    }

    return p;
}

int comb(int n,int k){
    int ans = 1;

    for(int i = 0;i < k;i++){
        ans = 1LL * ans * (1LL * (n - i) * lgpow(i + 1,MOD - 2) % MOD) % MOD;
    }

    return ans;
}

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

    int ans = lgpow(2,n);
    ans -= comb(n,a);if(ans < 0)ans += MOD;
    ans -= comb(n,b);if(ans < 0)ans += MOD;
    ans -= 1;if(ans < 0)ans += MOD;

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <algorithm>
#include <numeric>
#include <climits>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

struct P {int p, m;};

int main() {
	for (int n; (n = in());) {
		vector<int> v(n);
		for (int &a: v)
			a = in();
		sort(v.begin(), v.end());
		outl(accumulate(v.begin() + 1, v.end(), P{v[0], INT_MAX}, [](P acc, int a) {return P{a, min(acc.m, a - acc.p)};}).m);
	}
}


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

struct Dinic{
    struct edge{
        int to,cap,rev;
        edge(int to,int cap,int rev):to(to),cap(cap),rev(rev){}
    };

    const int INF=1001001001;
    vector<vector<edge>>G;
    vector<int>level,iter;
    Dinic(int v):G(v),level(v),iter(v){}

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

    void bfs(int s){
        fill(level.begin(),level.end(),-1);
        queue<int>que;
        level[s]=0;
        que.push(s);
        while(que.size()){
            int v=que.front();
            que.pop();
            for(auto &e:G[v]){
                if(e.cap&&level[e.to]==-1){
                    level[e.to]=level[v]+1;
                    que.push(e.to);
                }
            }
        }
    }

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

    int maxFlow(int s,int t){
        int flow=0;
        while(true){
            bfs(s);
            if(level[t]<0)return flow;
            fill(iter.begin(),iter.end(),0);
            int f;
            while((f=dfs(s,t,INF))>0)flow+=f;
        }
    }
};



signed main(){
    int N,M;cin>>N>>M;
    Dinic d(N);

    for(int i=0;i<M;i++){
        int a,b,c;
        cin>>a>>b>>c;
        d.addEdge(a,b,c);
    }

    cout<<d.maxFlow(0,N-1)<<endl;
    return 0;
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int N, R; cin >> N >> R;
    if (N >= 10) {
        cout << R << endl;
    } else {
        cout << R + 100 * (10 - N) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

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

    ll n,k,s;cin>>n>>k>>s;
    vector<ll> a(n);
    rep(i,k) a[i]=s;
    if(s==1e9){
        for(int i=k;i<n;i++) a[i]=1;
    }else{
        for(int i=k;i<n;i++) a[i]=s+1;
    }
    rep(i,n){
        cout<<a[i];
        cout<<(i==n-1?'\n':' ');
    }
    return 0;
}


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

int main()
{
	string s;
	string t;
	cin>>s>>t;
	int n =s.size();
	int m=t.size();
	

	
	int dp[n+1][m+1];
	memset(dp,0,sizeof(dp));
	
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(s[i-1]==t[j-1])
			dp[i][j]=1+dp[i-1][j-1];
			
			else
			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	
	int i=n,j=m;
	int index=dp[n][m]-1;
	char arr[index+1];

	while(i>0&&j>0)
	{
		if((dp[i-1][j]==dp[i][j-1])&&(dp[i-1][j]!=dp[i][j]))
		{

		  arr[index]=s[i-1];
		   i--;
		   j--;
		   index--;

	    }
	    else if(dp[i-1][j]>=dp[i][j-1])
	    i--;
	    else if(dp[i-1][j]<dp[i][j-1])
	    j--;
	}

	for(int i=0;i<dp[n][m];i++)
	cout<<arr[i];
	
	

}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll, ll> Pll;
typedef pair<int, Pii > P1;

#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define mp1(a,b,c) P1(a,P(b,c))
#define get_arsize(a) (sizeof(a)/sizeof(a[0]))

const ll MOD = 1000000007;
const double EPS = 1e-10;
const int MAX = 200000;

int main() {
  int n, a, ba;
  ll ans = 0;
  cin >> n;
  rep(i,n) {
    cin >> a;
    if (i == 0) {
      ba = a;
      continue;
    }
    if (ba > a) {
      ans += ba - a;
    } else {
      ba = a;
    }
  }
  cout << ans << endl;
  return 0;
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  uint64_t a,b;
  cin >> a >> b;
  list<uint64_t> factA,factB;
  primeFactorization(a,factA);
  primeFactorization(b,factB);
  
  factA.sort();factB.sort();
  uint64_t x = factA.front();
  uint64_t y = factB.front();
  int count = 1;
  uint64_t prevC = 0;
  while(factA.size()!=0&&factB.size()!=0){
    if(x==y){
      if(prevC!=x){
      	count++;
      	prevC = x;
      }
      factA.pop_front();
      factB.pop_front();
    }
    else if(x<y){
      factA.pop_front();
    }
    else{
      factB.pop_front();
    }
    x = factA.front();
    y = factB.front();
  }
  cout << count << endl;
  return 0;
}




Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
int answer(int h[],int n)
{
    int dp[n+1];
    dp[1]=0;
    for(int i=2;i<=n;i++)
    {
        if(i==2)
        {
            dp[i]=dp[i-1]+ abs(h[i-1]-h[i]);
            continue;
        }
        int a=dp[i-1]+ abs(h[i-1]-h[i]);
        int b=dp[i-2]+ abs(h[i-2]-h[i]);
        dp[i]=min(a,b);
    }
    return dp[n];
}
int main()
{
    int n;
    cin>>n;
    int h[100000];
    for(int i=1;i<=n;i++)
    {
        cin>>h[i];
    }
    cout<<answer(h,n);
}

Measured memory_bytes: 1024
S = list(input())
ans = 0
chain = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "G" or S[i] == "T" or S[i] == "C":
        if i == 0:
            chain += 1
        elif S[i-1] == "A" or S[i-1] == "G" or S[i-1] == "T" or S[i-1] == "C":
            chain += 1
        elif not S[i-1] == "A" or not S[i-1] == "G" or not S[i-1] == "T" or not S[i-1] == "C":
            chain = 1
        ans = max(ans, chain)
print(ans)

Measured memory_bytes: 3064
import java.util.*;
import java.util.Map.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
        while (n-- > 0) {
            int num = sc.nextInt();
            String strNum = String.valueOf(num);
            if (!map.containsKey(num)) {
                map.put(num, 1);
            } else {
                int v = map.get(num);
                map.put(num, v + 1);
            }
        }
        
        int count = 0;
        for (Entry<Integer, Integer> entry : map.entrySet()) {
            int key = entry.getKey();
            int val =  entry.getValue();
            
            if (val > key) {
                count += val - key;
            } else if (val < key) {
                count += val;
            }
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 60216
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int T;
  T=1;
  while(T--)
  {
    int n,k;
    cin>>n>>k;
    vector<int> h(n+1);
    for(int i=1;i<=n;i++)
    {
      cin>>h[i];
    }
    vector<int> dp(n+1,INT_MAX);
    dp[1]=0;
    for(int i=2;i<=n;i++)
    {
      for(int j=1;j<=k;j++)
      {
        if((i-j)>=1)
        {
          //cout<<dp[i-j]<<" "<<i<<" "<<j<<endl;
          dp[i]=min(dp[i],(dp[i-j]+abs(h[i]-h[i-j])));
        } 
      }
    }
    cout<<dp[n]<<endl;
  }
}


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

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    ans += r - l + 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N = gets.to_i
@a = gets.split.map{|m|m.to_i}

def check() 
    @a.each do |aa|
        if aa%2 != 0
            return false    
        end
    end
    return true 
end

sum = 0
while check()
    sum += 1
    @a = @a.map{|m|m/=2}
end
puts sum

Measured memory_bytes: 1788
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Map<String,Integer> map = new HashMap();
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        map.put("AC",0);
        map.put("WA",0);
        map.put("TLE",0);
        map.put("RE",0);
        for(int i=0;i<n;i++){
            String s = sc.next();
            map.merge(s,1,Integer::sum);
        }
        System.out.println("AC x " + map.get("AC"));
        System.out.println("WA x " + map.get("WA"));
        System.out.println("TLE x " + map.get("TLE"));
        System.out.println("RE x " + map.get("RE"));
    }
}

class Monmo {
    
}



Measured memory_bytes: 59292
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>
#include <map>
#include <queue>
#include <stack>
#define FOR(arg, ini, end) for(int arg = ini; arg < end; arg++)


using namespace std;
int main(int argc, const char * argv[]) {
    
    int n; cin >> n;
    if (n%2!=0) {
        cout << 0 << endl;
        return 0;
    }

    vector<int> d(n);
    FOR(i, 0, n) {
        cin >> d[i];
    }

    sort(d.begin(), d.end());
    int mid = n/2;
    cout << d[mid] - d[mid-1] << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a < b) {
		cout << "a < b" << endl;
	}
	else if (a > b) {
		cout << "a > b" << endl;
	}
	else {
		cout << "a == b" << endl;
	}
}



Measured memory_bytes: 3092
import sys, heapq, bisect, math, fractions
from collections import deque
from collections import Counter
from collections import OrderedDict

N = int(input())

left = 0
right = N - 1
mid = 0

print(left, flush=True)
l = input()
if l == "Vacant":
    exit()
    
print(right, flush=True)
r = input()
if r == "Vacant":
    exit()

while left + 1 != right:
    mid = (right + left) // 2
    print(mid, flush=True)
    m = input()
    if m == "Vacant":
        exit()
        
    if ((mid - left) % 2 == 0 and l != m) or ((mid - left) % 2 == 1 and l == m):
        right = mid
        r = m
    else:
        left = mid
        l = m


Measured memory_bytes: 5668
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
#include <math.h>
//#include <vector>
//#include <string>
//#include <list>
//#include <deque>
//#include <unordered_map>
typedef long long LL;
//typedef long double LD;
using namespace std;

//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main() {
    LL a;
    LL b;
    LL c;
    LL tmp;
    bool ans;

    cin >> a >> b >> c;
    tmp = a+b-c;
    //cout << tmp << endl;
    if(tmp>=0){
        ans=false;
    }else{
        tmp=4*a*b-tmp*tmp;
        //cout << tmp << endl;
        if(tmp<0){
            ans=true;
        }else{
            ans=false;
        }
    }
    if(ans==true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256