akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<int(n); i++)
#define ALL(a) (a).begin(), (a).end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

const ll mod = 1e9 + 7;

long long gcd(ll x, ll y){
	if(x > y) swap(x, y);
	while(x != 0){ y %= x; swap(x, y); }
	return y;
}

ll mpow(ll x, ll r){
	if(r == 0) return 1;
	if(r % 2 == 1){ return x * mpow(x, r-1) % mod; }
	else{ ll aa = mpow(x, r/2); return aa*aa%mod; }
}
ll dp[2020][2020];
vector<P> a;

int main(){
	int N; cin >> N;
	ll A[N];
	rep(i, N){
		cin >> A[i];
		a.push_back(P(A[i], i));
	}
	sort(ALL(a), greater<P>() );
	for(int i=1; i<=N; i++){
		for(int j=0; j<=i; j++){
			ll d1 = abs(i-j-1-a[i-1].second), d2 = abs(a[i-1].second-(N-j));
			if(i-j > 0 && j > 0){
				dp[i-j][j] = max(dp[i-j-1][j] + a[i-1].first*d1, dp[i-j][j-1] + a[i-1].first*d2);
			}else if(i-j > 0){
				dp[i-j][j] = dp[i-j-1][j] + a[i-1].first*d1;
			}else{
				dp[i-j][j] = dp[i-j][j-1] + a[i-1].first*d2;
			}
		}
	}
	ll ans = -1;
	rep(i, N+1){
		if(ans < dp[i][N-i]) ans = dp[i][N-i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 26332
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0
#define INF 1e100
#define EPS 1e-8
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
string FILE_NAME = "testcase.0120_";
string NAME;
string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}
/*
	bitDP : dp[S][k]:= k 番目のケーキ (k &#8713; S )をつかった場合、距離が最小になる
		dp[S | k][k] = min (dp[S][j] + (j,k)の距離 ) (j ∈ S, k &#8713; S )
*/

double dp[1<<12][12];
vector<int> r;

double calc (int i, int j ){
	double res = (double)((r[i] + r[j] )*(r[i] + r[j] ) - (r[i] - r[j] )*(r[i] - r[j] ) );

	return sqrt (res );
} 

double dist[11][11];
// 3 〜 10 までの2つの円の距離を求めておく
void calc_dist (void ){
	memset (dist, 0., sizeof (dist ) );
	for (int i = 3 ;i <= 10; i++ ){
		for (int j = 3; j <= 10; j++ ){
			dist[i][j] = 2.*sqrt (i*j );
		} // end for
	} // end for
}

// 円 i, j の距離を求めておく
double d[12][12];
void calc_d (int n ){
	memset (d, 0., sizeof (d ) );
	rep (i, n ){
		rep (j, n ){
			d[i][j] = dist[r[i]][r[j]];
		} // end rep
	} // end rep
}	


int main()
{
//	cut here before submit 
#if DEBUG
	NAME = FILE_NAME;
	int CNT = 1;
	NAME += itos (CNT );
	while (freopen (NAME.c_str() , "r", stdin ) != NULL ) {
#endif
	ios_base::sync_with_stdio(0);
	string str = "";
	calc_dist ();
	int box;
	while (getline (cin, str ) ){
		memset (dp, 0., sizeof (dp ) );
		r.clear();
		stringstream ss (str );
		int in;
		ss >> box;
		while (ss >> in ) r.push_back (in );
	 	int n = r.size();
		calc_d (n );
		rep (i, 1<<n ) rep (j, n ) dp[i][j] = INF;
		rep (j, n ) dp[1<<j][j] = (double)r[j];
		rep (i, 1<<n ){
			rep (j, n ){
				if (dp[i][j] != INF ){
					rep (k, n ){
						if (k == j ) continue;
						if (i & (1<<k ) ) continue;
						dp[i | (1<<k)][k] = min (dp[i | (1<<k)][k], dp[i][j] + d[j][k] );
					} // end rep
				} // end if
			} // end rep
		} // end rep

		double res = INF;
		rep (j, n ) res = min (res, dp[(1<<n)-1][j] + (double)r[j] );

		if (res > (double)box ){
			cout << "NA" << endl;
		}else{
			cout << "OK" << endl;
		} // end if
	} // end while

#if DEBUG
	CNT++;	// cut here before submit
	NAME = FILE_NAME;
	NAME += itos (CNT );
	} // end loop; cut here before submit
#endif			
	return 0;
}

Measured memory_bytes: 1636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>P;
typedef pair<ll,ll>LLP;
const int MAXN=2e5+20;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const double PI=acos(-1.0);
const double RATE=0.995;
const double eps=1e-6;
std::mt19937 rnd(time(0));
int arr[MAXN];
signed main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;++i)
    {
        scanf("%d",&arr[i]);
    }
    sort(arr,arr+n);
    ll ans=0;
    for(int i=0;i<n;++i)
    {
        for(int j=i+1;j<n;++j)
        {
            int r=arr[i]+arr[j]-1;
            int l=abs(arr[i]-arr[j])+1;
            int pos=lower_bound(arr+j+1,arr+n,l)-arr;
            int pos2=upper_bound(arr+j+1,arr+n,r)-arr;
            if(pos==n)
                break;
            if(pos2==n)
                pos2--;
            if(arr[pos2]>r)
                pos2--;
            ans+=max(0ll,1ll*(pos2-pos+1));
            //cout<<i<<" "<<j<<endl;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
n, m, k = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
SA, SB = [0], [0]
for i in range(n):
    SA.append(SA[i] + A[i])
for j in range(m):
    SB.append(SB[j] + B[j])
ans, tmp = 0, m
for i in range(n + 1):
    if SA[i] > k:
        break
    for j in range(tmp + 1)[::-1]:
        if SA[i] + SB[j] <= k:
            break
    ans = max(ans, i + j)
    tmp = j
print(ans)


Measured memory_bytes: 47356
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define res(i,n) for(int i=n;;i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
long double PI = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998626034825342117;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(long long x, long long y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(long long x, long long y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    vector<int>A(N);
    vector<bool>B(1000000000, false);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        if (!B[A[i]-1])B[A[i] - 1] = true;
        else B[A[i] - 1] = false;
    }
    int ans = 0;
    for (int i = 0; i < 1000000000; i++)if (B[i])ans++;
    cout << ans << endl;
}

Measured memory_bytes: 125648
using System;
class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        double[] a = Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);
        double sum=0;

        for (int i = 0; i < n; i++)
        {
            sum = sum + 1/a[i];
        }

        Console.WriteLine(1/sum);
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin)-1;i>=(end);i--)
#define IREP(i, n) IFOR(i,n,0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" <<; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;

ll mod = 1000000007;

int main()
{
	// 入力
	ll N;
	cin>>N;
	vec a(N-1,-1),b(N-1,-1);
	vec c(N,-1);
    vector<vector<ll>> child(N+1);
	REP(i,N-1){
		cin>>a[i]>>b[i];
		a[i]--;
		b[i]--;
		child[a[i]].pb(b[i]);
		child[b[i]].pb(a[i]);
	}

	REP(i,N){
		cin>>c[i];
	}

	ISORT(c);

	ll M=0;
	FOR(i,1,N){
		M+=c[i];
	}
	cout<<M<<endl;

	vec d(N,-1);
	ll nextc=0;
    // vector<vector<pair<int, int>>> childdist(N+1);
    stack<ll> stack;

    ll v=-1;
    vec init(N+1,0);
    bool pop;
    stack.push(a[0]);
    while(!stack.empty()){
    	v=stack.top();
    	pop=true;
        FOR(i,init[v],child[v].size()){
        	init[v]++;
        	if(d[child[v][i]]==-1) {
        		d[child[v][i]]=c[nextc];
        		nextc++;
        		stack.push(child[v][i]);
        		pop=false;
        		break;
        	}
        }
        if(pop) stack.pop();
    }

    REP(i,N){
    	cout<<d[i]<<" ";
    }
    cout<<endl;

	return 0;
}

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

clock_t present = clock();
void complexiti(){
	present = clock() - present;
	cerr << "TIME : " << float(present)/CLOCKS_PER_SEC << '\n';
}

void solver(){
	//~ type your code here
	int a;string s;
	cin >> a >> s;
	if(a >= 3200){
		cout << s << endl;
	}else{
		cout << "red" << endl;
	}
	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int queries = 1;
	//~ cin >> queries;
	for(int i = 0 ; i < queries ; ++i){
		solver();
	}
	complexiti();
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib> 
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
	int x=0,f=1; char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();}
	return x*f;
}
int n,p[110000],sum;
int main()
{
	n=read();
	for (int i=1; i<=n; i++) p[i]=read();
	for (int i=1; i<=n;) 
		if (p[i]==i && p[i+1]==i+1) {
			sum++;
			i+=2;
		} 
		else if (p[i]==i) {
			sum++;
			i++;
		} 
		else i++;
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 640
-- https://github.com/minoki/my-atcoder-solutions
import Data.Char (isSpace)
import Data.List (unfoldr)
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as BS

main = do
  [n,x] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  ys <- U.unfoldrN n(BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let zs = U.scanl' (+) 0 ys
  print $ U.length $ U.takeWhile (<= x) zs


Measured memory_bytes: 508
n = gets.to_i
arr = Array.new(n + 1) { 0 }

1.upto(100) do |x|
  x.upto(100) do |y|
    y.upto(100) do |z|
      f = (x + y + z)**2 - x * y - y * z - z * x
      break if f > n

      if x == y && y == z
        arr[f] += 1
      else
        arr[f] += (x != y && y != z) ? 6 : 3
      end
    end
  end
end

puts arr.drop(1)

Measured memory_bytes: 14164
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define INFTY (1 << 30)

int A[2000001], n;

void  maxheapify(int i) {
    int left, right, largest;
    
    left = 2 * i;
    right = 2 * i + 1;
    
    if (left <= n && A[left] > A[i]) largest = left;
    else largest = i;
    
    if (right <= n && A[right] > A[largest]) largest = right;
    
    if (largest != i) {
        swap(A[i], A[largest]);
        maxheapify(largest);
    }
}

int extract() {
    int maxv;
    if (n < 1) return -INFTY;
    maxv = A[1];
    A[1] = A[n--];
    maxheapify(1);
    
    return maxv;
}


void heapIncreaseKey(int i, int key) {
    if (key < A[i]) return;
    A[i] = key;
    while(i > 1 && A[i / 2] < A[i]) {
        swap(A[i], A[i / 2]);
        i = i /2;
    }
}

void insert(int key) {
    n++;
    A[n] = -INFTY;
    heapIncreaseKey(n, key);
}

int main() {
    char c[10];
    int key;
    
    while(1) {
        scanf("%s", c);
        if (c[0] == 'e' && c[1] == 'n') break;
        else if (c[0] == 'i') {
            scanf("%d", &key);
            insert(key);
        }
        else {
            printf ("%d\n", extract());
        }
    }
    return 0;
}



Measured memory_bytes: 7084
N,M,Q = map(int, input().split())
train = []
quest = []
for i in range(M):
    train.append([int(x) for x in input().split()])
for j in range(Q):
    quest.append([int(x) for x in input().split()])

List = []
for s in range(N):
    List.append([])

for k in range(N):
    for l in range(k+1):
        List[k].append(0)

for i in range(M):
    List[N-(train[i][1]-train[i][0]+1)][train[i][0]-1] += 1

num = N-1

while num >= 1:
    for j in range(len(List[num-1])):
        List[num-1][j] += List[num][j] + List[num][j+1]
        if num-1 < N-2:
            List[num-1][j] -= List[num+1][j+1]
    num -= 1
for k in range(Q):
    print( List[N-(quest[k][1]-quest[k][0]+1)][quest[k][0]-1])

Measured memory_bytes: 53524
n = int(input())
h = list(map(int, input().split()))

dp = [10 ** 18 for _ in range(n)]
dp[0] = 0
for i in range(1, n):
    dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]),
                dp[i-2] + abs(h[i] - h[i-2]))
print(dp[-1])


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

signed main(){
    string s;
    cin>>s;
    int n=s.size();
    int ans=0;
    rep(i,n)if(s[i]!=s[n-1-i])ans++;
    cout<<ans/2<<endl;
}

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

struct StCoord
{
  StCoord() : m_nx(0), m_ny(0) { }

  int m_nx;
  int m_ny;
};

void fnInput(vector<StCoord>& rvoCoord)
{
  int nCrdSiz;
  cin >> nCrdSiz;
  rvoCoord.resize(nCrdSiz);

  for (StCoord& roCoord : rvoCoord)
    cin >> roCoord.m_nx >> roCoord.m_ny;
}

double fnAveDistGet(const vector<StCoord>& cnrvoCoord)
{
  vector<vector<double>> vvnDist(cnrvoCoord.size(), vector<double>(cnrvoCoord.size()));
  
  for (int i = 0; i < cnrvoCoord.size(); i++)
    for (int j = 0; j < cnrvoCoord.size(); j++)
      if (i != j)
      {
        int nDistx = cnrvoCoord[i].m_nx - cnrvoCoord[j].m_nx;
        int nDisty = cnrvoCoord[i].m_ny - cnrvoCoord[j].m_ny;
        vvnDist[i][j] = vvnDist[j][i] = sqrt(nDistx * nDistx + nDisty * nDisty);
      }

  int nFact = 1;
  for (int n = 1; n < cnrvoCoord.size() + 1; n++)
    nFact *= n;

  double nTotalDist = 0.0;
  vector<int> vnCity(cnrvoCoord.size());
  iota(begin(vnCity), end(vnCity), 0);

  do {
    for (int i = 0; i < cnrvoCoord.size() - 1; i++)
      nTotalDist += vvnDist[ vnCity[i] ][ vnCity[i + 1] ];
  }
  while ( next_permutation(begin(vnCity), end(vnCity)) );

  return nTotalDist / nFact;
}

int main()
{
  vector<StCoord> voCoord;

  fnInput(voCoord);
  cout << fixed << setprecision(10) << fnAveDistGet(voCoord) << endl;

  return 0;
}

Measured memory_bytes: 256
##### 解けた #####

N=int(input())
D,X=list(map(int,input().split(" ")))
c=0 # 何個食べられたか

# 各参加者について
for _ in range(N):
    c+=(1+(D-1)//int(input())) # 食べた数をインクリメント

print(X+c)

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

int main()
{
	// 整数の入力
	int a;
	cin >> a;
	
	if (a == 1) {
		cout << "Hello World" << endl;
	}
	else {
		int b, c;
		cin >> b >> c;
		cout << b + c << endl;
	}


	return 0;
}

Measured memory_bytes: 256
S = input()
L=len(S)
ans=0
S1=S[:(L-1)//2]
S2=S[((L+3)//2)-1:]
if (S==S[::-1]) & (S1==S1[::-1]) & (S2==S2[::-1]):
    ans='Yes'
else:
    ans='No'
print(ans)

Measured memory_bytes: 9108
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> V;
typedef pair<int,int> P;
typedef vector<vector<int>> Graph;

int main() {
    set<pair<ll,int>> a;
    int n,m;
    cin >> n >> m;
    rep(i,n){
        ll A;
        cin >> A;
        a.insert(make_pair(A,i));
    }
    rep(i,m){
        auto l = a.end();
        --l;
        auto k = *l;
        //cout << k.first << " " << k.second << endl;
        a.erase(make_pair(k.first,k.second));
        a.insert(make_pair(k.first/2,k.second));
    }
    ll ans = 0;
    for(auto i : a){
        //cout << i.first << " " << i.second << endl;
        ans += i.first;
    }
    cout << ans << endl;
}

Measured memory_bytes: 9856
/**
 *  author: mahfuzz
 *  created: 13.04.2020
**/
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << #x << ':' << x << "\n"
typedef long long ll;

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    int a, b; cin >> a >> b;
    
    int temp = 1, cnt = 0;
    while(temp < b){
        ++cnt;
        --temp;
        temp += a;
    }
    
    cout << cnt << "\n";

    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int prime(int x){
    if(x<2) return 0;
    else if(x==2) return 1;
    if(x%2==0) return 0;
    for(int i=3; i*i<=x; i+=2){
        if(x%i==0) return 0;
    }
    return 1;
}

int main(){
    int n,x,i;
    int cnt=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&x);
        if(prime(x)) cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}


Measured memory_bytes: 2056
S = int(input())

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

mod = 10**9+7

if S<3:
	print(0)
else:
	a=0
	for i in range(1,1+(S//3)):
		a+=cmb(S-i-i-1,i-1)%mod
	
	print(a%(10**9+7))




# 2darray [[0] * 4 for i in range(3)]
# import itertools

Measured memory_bytes: 9612
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

template<class T> class max_flow {
    int MAX_V;
    vector<vector<tuple<int, T, int>>>G;
    vector<bool>used;

public:
    //初期化
    max_flow(int _v) :MAX_V(_v) {
        G.resize(MAX_V);
    }
    //辺を追加
    void add_edge(int from, int to, T cap) {
        G[from].emplace_back(to, cap, (int)G[to].size());
        G[to].emplace_back(from, 0, (int)G[from].size() - 1);
    }
    //増加パスをDFSで探す
    int dfs(int v, int t, int f) {
        if (v == t)return f;
        used[v] = true;
        rep(i, 0, G[v].size()) {
            int to = get<0>(G[v][i]), rev = get<2>(G[v][i]);
            T& cap = get<1>(G[v][i]);
            if (!used[to] && cap > 0) {
                int d = dfs(to, t, min(f, cap));//経路中の最小コスト
                if (d > 0) {
                    cap -= d;
                    get<1>(G[to][rev]) += d;
                    return d;
                }
            }
        }
        return 0;
    }
    //sからtへの最大流
    int flow(int s, int t) {
        int res = 0;
        for (;;) {
            used.resize(MAX_V, false);
            int f = dfs(s, t, INF);
            if (f == 0)return res;
            res += f;
            used.clear();
        }
    }
};

int main() {
	init();

    int N; cin >> N;
    max_flow<int> fl(2 * N + 2);
    vector<pair<int, int>>red(N), blue(N);
    rep(i, 0, N) {
        int a, b; cin >> a >> b;
        red[i] = { a,b };
    }
    rep(i, 0, N) {
        int a, b; cin >> a >> b;
        blue[i] = { a,b };
    }
    rep(i, 0, N) {
        rep(j, 0, N) {
            if (red[i].first < blue[j].first && red[i].second < blue[j].second) {
                fl.add_edge(i, j + N, 1);
            }
        }
    }
    rep(i, 0, N) {
        fl.add_edge(2 * N, i, 1);
        fl.add_edge(i + N, 2 * N + 1, 1);
    }
    cout << fl.flow(2 * N, 2 * N + 1) << "\n";

	return 0;
}


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

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) throws IOException {
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        System.out.println(Math.max(Math.max(a + b, a - b), a * b));
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 32768);
        StringTokenizer tokenizer;

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 22356
N = int(input())
A = list(map(int, input().split()))
c = 0
f=0
while f==0:
    B = [i%2 for i in A]
    A = [i/2 for i in A]
    if sum(B) != 0:
        f+=1
    else:
        c+=1
print(c)

Measured memory_bytes: 38768
//write：Sakura
//id：
//problem：Eating Symbols Easy
//note：

#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

char s[5];
int ans=0; 

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%s",s);
	ans=1;
	for(int i=0;i<5;i++){
		if(s[i]=='+')ans+=1;
		else ans-=1;
	}
	printf("%d\n",ans);
	return 0;
}


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

#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) (x).begin(), (x).end()

inline void Main() {
  // code
  int a,b,c;
  cin>>a>>b;
  c = b*2+1;
  if(a%c==0){
    cout << a/c<<endl;
  } else {
    cout <<a/c+1<<endl;
  }
}

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
using ll = long long;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
}

void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}

int main() {
    ll N,K;
    cin >> N >> K;
    auto a = InputVec(N);
    vector<bool> isWin(K + 1);
    for (int i = 0; i <= K; ++i) {
        isWin[i] = false;
    }
    isWin[0] = false;
    for (int i = 1; i <= K; ++i) {
        for (int j = 0; j < N; ++j) {
            if(i - a[j] >= 0 && !isWin[i - a[j]]){
                isWin[i] = true;
            }
        }
    }
    for (int i = 0; i < isWin.size(); ++i) {
        //cout << isWin[i] << endl;
    }
    cout << (isWin[K] ? "First" : "Second") << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main() {
	string str;

	cin >> str;

	for(int i = 0; i < str.length(); i++) {
		if(str[i] == '1') {
			str[i] = '9';
		}
		else if(str[i] == '9') {
			str[i] = '1';
		}
	}

	cout << str << endl;

	return 0;
}


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

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((a) >> (b)) & 1
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int H, W, K;
int dp[110][10]; //dp[h][k]:=上からh,左からkの位置にたどり着くような阿弥陀の本数。

signed main() {
  cin >> H >> W >> K;

  m0(dp);
  dp[0][0] = 1;

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      for (int bit = 0; bit < 1 << (W - 1); bit++) {
        bool flag = true;
        for (int l = 0; l < W - 2; l++) {
          if ((bitcheck(bit, l)) == 1 && (bitcheck(bit, l + 1)) == 1) {
            flag = false;
          }
        }

        if (flag) {
          if (j >= 1 && (bitcheck(bit, j - 1)) == 1) {
            dp[i + 1][j - 1] += dp[i][j];
            dp[i + 1][j - 1] %= MOD;
          } else if (j <= W - 2 && (bitcheck(bit, j)) == 1) {
            dp[i + 1][j + 1] += dp[i][j];
            dp[i + 1][j + 1] %= MOD;
          } else {
            dp[i + 1][j] += dp[i][j];
            dp[i + 1][j] %= MOD;
          }
        }
      }
    }
  }

  cout << dp[H][K - 1] << endl;
  return 0;
}


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

namespace aizu1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            card[] sortCards = new card[n];

            for(int i=0;i<n;i++)
            {
                sortCards[i] = new card(Console.ReadLine(),i);
            }

            Sort(sortCards,0, n-1);
            Console.WriteLine(isStable(sortCards)?"Stable":"Not stable");

            for(int i=0;i<n;i++)
            {
                Console.WriteLine(sortCards[i]);
            }
        }

        static void Sort<T>(T[] A, int p, int r) where T:IComparable<T>
        {
            if (p >= r) return;
            int x = Partition(A, p, r);
            Sort(A, p, x - 1);
            Sort(A, x + 1, r);
            
        }
        static int Partition<T>(T [] A, int p, int r)where T:IComparable<T>
        {
            T x = A[r];
            int i = p - 1;
            for(int j=p;j<r;j++)
            {
                if(A[j].CompareTo(x)<=0)
                {
                    i++;
                    if (i != j)
                    {
                        T t = A[i];
                        A[i] = A[j];
                        A[j] = t;
                    }
                }

            }
            T tmp = A[i + 1];
            A[i + 1] = A[r];
            A[r] = tmp;

            return i+1;
        }
        static bool isStable( card[] sortCards)
        {
            for(int i=0;i<sortCards.Length-1;i++)
            {
                if (sortCards[i].CompareTo(sortCards[i + 1]) == 0 && sortCards[i].pos > sortCards[i + 1].pos)
                    return false;
            }
            return true;
        }

        class card: IComparable<card>
        {
            public char color { set; get; }
            public int num { set; get; }
            public int pos { set; get; }

            public card(string s, int i)
            {
                string[] str = s.Split(' ');
                color = s[0];
                num = int.Parse(str[1]);
                pos = i;
            }

            public int CompareTo(card other)
            {
                return num-other.num;
            }

            public override string ToString()
            {
                return color + " " + num;
            }
        } 

    }
}

Measured memory_bytes: 15264
#include <bits/stdc++.h>
using namespace std;
const int MAXA = 1000010;

int main()
{
  int64_t N, ma = -MAXA, mi = MAXA, madx, midx;
  cin >> N;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A.at(i);
    ma = max(ma, A.at(i));
    mi = min(mi, A.at(i));
  }
  queue<pair<int, int>> Q;
  if (abs(ma) >= abs(mi))
  {
    auto it = find(A.begin(), A.end(), ma);
    int idx = distance(A.begin(), it);
    for (int i = 0; i < N; i++)
    {
      if (A.at(i) < ma)
      {
        A.at(i) += ma;
        Q.push({idx, i});
      }
      if (i > 0 && A.at(i) < A.at(i - 1))
      {
        A.at(i) += A.at(i - 1);
        Q.push({i - 1, i});
      }
    }
  }
  else
  {
    auto it = find(A.begin(), A.end(), mi);
    int idx = distance(A.begin(), it);
    for (int i = N - 1; i >= 0; i--)
    {
      if (A.at(i) > mi)
      {
        A.at(i) += mi;
        Q.push({idx, i});
      }
      if (i != N - 1 && A.at(i) > A.at(i + 1))
      {
        A.at(i) += A.at(i + 1);
        Q.push({i + 1, i});
      }
    }
  }
  cout << Q.size() << endl;
  while (!Q.empty())
  {
    cout << Q.front().first + 1 << ' ' << Q.front().second + 1 << endl;
    Q.pop();
  }
}


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


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


int main(){
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define LEN 100005

typedef struct pp
{
    char name[100];
    int t;
} P;

P Q[LEN];
int head, tail, n;

void enqueue(P x)
{
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}

P dequeue()
{
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}

int min(int a, int b) { return a < b ? a : b; }

int main()
{
    int elaps = 0, c;
    int i, q;
    P u;
    scanf("%d %d", &n, &q);

    for (i = 1; i <= n; i++)
    {
        scanf("%s", Q[i].name);
        scanf("%d", &Q[i].t);
    }
    head = 1;
    tail = n + 1;

    while (head != tail)
    {
        u = dequeue();
        c = min(q, u.t);
        u.t -= c;
        elaps += c;
        if (u.t > 0)
            enqueue(u);
        else
            printf("%s %d\n", u.name, elaps);
    }

    return 0;
}


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

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

int main(){
    int a,b;
    string s;
    cin >> a >> b >> s;
    bool flg=true;
    for(int i=0;i<a;i++){
        if(!('0'<=s[i] && s[i]<='9')) flg=false;
    }
    if(s[a]!='-') flg=false;
    for(int i=a+1;i<s.size();i++){
        if(!('0'<=s[i] && s[i]<='9')) flg=false;
    }
    puts(flg?"Yes":"No");
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $a, $b);

if ($a > 2 && ($a % 3 == 0)) {
  echo 'Possible';
} elseif ($b > 2 && ($b % 3 == 0)) {
  echo 'Possible';
} elseif ($a + $b > 2 && (($a + $b) % 3 == 0)) {
  echo 'Possible';
} else {
  echo 'Impossible';
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 200001
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define REV(i, n) for(ll i=n-1; i>=0; i--)
#define ALL(v) v.begin(), v.end()
#define pb push_back
const ll INF = 9e18;
ll n, a, b;
string s, t, u;

signed main(){
    cin >> s >> t >> a >> b >> u;
    if(s == u){
        cout << a - 1 << " " << b << endl;
    }else{
        cout << a << " " << b - 1 << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

ll power(ll a, ll b){
	ll res=1;
	while(b>0){
		if(b&1){
			res=res*a;
		}
		a=a*a;
		b>>=1;
	}
	return res;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, p, a;
	cin>>n>>p;
	bool odd=false;
	REP(i, n){
		cin>>a;
		if(a&1){
			odd=true;
		}
	}
	cout<<(odd ? power(2, n-1) : (p ? 0 : power(2, n)))<<'\n';
	return 0;
}


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

int main() {
  int n,m; cin>>n>>m;
  vector<P> p(n);
  rep(i, n) {
    int a,b;
    cin>>a>>b;
    p[i]=make_pair(a, b);
  }
  sort(p.begin(), p.end());
  priority_queue<int> que;
  int tmp=0;
  ll sum=0;
  rep(i, m) {
    while (p[tmp].first<=i+1&&tmp!=n) {
      que.push(p[tmp].second);
      tmp++;
    }
    if (!que.empty()) {
      sum+=que.top();
      que.pop();
    }
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> P(N);
    for(int i=0; i< N;i++){
        cin >> P.at(i);
    }
    int Cnt = 0;
    int min = INT_MAX;
    for(int i=0; i< N;i++){
        int pi = P.at(i);
        if(min >= pi){
            min = pi;
            Cnt +=1;
        }
       
        
    }
    cout << Cnt;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    string o, e; cin >> o >> e;

    for(int i=0; i<o.size(); i++){
        cout << o.at(i);
        if(i<e.size()) cout << e.at(i);
    }
    return 0;
}


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

using namespace std;

#define int long long

int dp[10010][110];
int mod = 1e9 + 7;

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	int d;
	cin >> d;
	int n = s.size();
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            for (int k = 0; k < 10; k++) {
                dp[i + 1][(j + k) % d] += dp[i][j];
                dp[i + 1][(j + k) % d] %= mod;
            }
        }
	}
	int sum = 0;
	int ans = 0;
	for (int i = 0; i < n; i++) {
        for (int j = 0; j < s[i] - '0'; j++) {
            ans += dp[n - i - 1][(d - (sum + j) % d) % d];
            ans %= mod;
        }
        sum += s[i] - '0';
	}
	if (sum % d == 0) {
        ans++;
	}
	ans += mod - 1;
	ans %= mod;
	cout << ans << endl;
	return 0;
}


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

using namespace std;

typedef long double db;
typedef long long ll;
typedef pair<db, db> pd;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;


#define printlist(ans) for(auto x: ans) cout << x << ' '; cout << endl;
#define printstring(ans)  for(auto x: ans) cout << x; cout << endl;


#define mod 1000000007
#define maxn 100005

ll tst;
void cleanData();

ll n, m, k, a[maxn];
void solve() {
	string s;
	cin >> s;
	cout << (s == "ABC"?"ARC":"ABC");
}

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

	tst = 1;
	//cin >> tst;
	while (tst--) {
		solve();
	}

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

void cleanData() {}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
const long long MOD = 1000000007;

int main()
{
    ll N, ans = 0;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    rep(i, 60) {
        ll zero = 0, one = 0;
        rep(j, N) {
            if ((A[j] & (1LL << i)) == 0) zero++;
            else one++;
        }
        ans += ((zero * one) % MOD) * ((1LL << i) % MOD);
        ans %= MOD;
    }

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

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

int main()
{
	int L, R;
	cin >> L >> R;

	if(L / 2019 != R / 2019)
	{
		cout << 0 << endl;
	}
	else
	{
		int min = 2019;
		L %= 2019;
		R %= 2019;
		for(int i = L; i <= R - 1; i++)
		{
			for(int j = i + 1; j <= R; j++)
			{
				if(min > (i * j) % 2019)
				{
					min = (i * j) % 2019;
				}
			}
		}
		cout << min << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

typedef long long ll;

int main()
{
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    int x,y;
    cin >> x >> y;
    if(x+y>=10) cout << "error\n";
    else cout << x+y << "\n";
    
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n; cin >> n;
	cout << (n+1)/2 - 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define int         ll int
#define float       double
#define	endl		'\n'
#define maxpq       priority_queue<ll>
#define minpq       priority_queue<ll, vector<ll>, greater<ll> >
#define mii         map<int,int>
#define msi         map<string,int>
#define mis         map< int, string>
#define mpi         map<pair< int, int>, int>
#define pii         pair< int, int>
#define vi          vector< int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define EPS         1e-9
#define INF         1e18
#define PI          3.14159265358979323846
#define MAXI        1000000
#define what_is(x)  cerr << #x << " is " << x << endl;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
#define N 100005
int modexp(int x,int n){
	x%=hell;
	int res=1;
	while(n>0){
		if(n&1) res=res*x%hell;
		x=x*x%hell;
		n/=2;
	}
	return res;
}

signed main()
{
	fast;
	int t=1;
	//cin>>t;
	while(t--)
	{
		int l,r,d;
		cin>>l>>r>>d;
		int ans=r/d-l/d;
		if(l%d==0) ans++;
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100005], b[100005], c[100005], dp[100005][2][2][2];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> a[i] >> b[i] >> c[i];
  dp[1][0][0][1] = c[1], dp[1][0][1][0] = b[1], dp[1][1][0][0] = a[1];
  for (int i = 2; i <= n; i++) {
    dp[i][0][0][1] = max(dp[i - 1][1][0][0] + c[i], dp[i - 1][0][1][0] + c[i]);
    dp[i][0][1][0] = max(dp[i - 1][1][0][0] + b[i], dp[i - 1][0][0][1] + b[i]);
    dp[i][1][0][0] = max(dp[i - 1][0][1][0] + a[i], dp[i - 1][0][0][1] + a[i]);
  }
  cout << max(dp[n][1][0][0], max(dp[n][0][1][0], dp[n][0][0][1])) << endl;
}

Measured memory_bytes: 8832
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner stdIn = new Scanner(System.in);
  int n = stdIn.nextInt();
 int k = stdIn.nextInt();
int ans = 1;

for(int i = 0; i < n; i++){
  if(ans+k < ans*2){
       ans += k;
}else{
  ans *=2;
}
}
  System.out.println(ans);
  
}
}

Measured memory_bytes: 22100
n, m = map(int, input().split())
ans = [-1] * n
flag = 0
for i in range(m):
    s, c = map(int, input().split())
    if ans[s-1] == -1:
        ans[s-1] = c
    elif ans[s-1] != c:
        flag = 1
if flag > 0:
    print(-1)
else:
    for i in range(n):
        if ans[i] == -1:
            if i == 0:
                if n == 1:
                    ans[i] = 0
                else:
                    ans[i] = 1
            else:
                ans[i] = 0
    p = map(str, ans)
    d = "".join(p)
    if d == "00" or d == "000":
        print(-1)
    else:
        print(d)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int a;
    string s;
    cin >> a >> s;
    cout << (a >= 3200 ? s : "red") << endl;
    return 0;
}

Measured memory_bytes: 256
x,k,d = map(int,input().split())

x = abs(x)
y = x % d
l = x // d

m = k - l
if m <= 0:
    x -= d * k
else:
    if abs(y-d) < abs(y):
        y -= d
        m -= 1
        if m % 2 == 0:
            x = y
        else:
            x = y + d
    else:
        if m % 2 == 0:
            x = y
        else:
            x = y - d

print(abs(x))


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

#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i = (int)(begin), i##_end = (int)(end); i < i##_end; ++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x

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

	int ans = 1;
	rep(i, 1, N + 1){
		if(ans == i) ans *= 2;
	}
	printf("%d\n", ans / 2);
	return 0;
}


Measured memory_bytes: 256
n,t=[int(_) for _ in input().split(" ")]
a=[int(_) for _ in input().split(" ")]
b,m=[],a[0]
for _ in a:
  b.append(m)
  m=min(m,_)
d={}
for _a,_m in zip(a,b):
  if (_a-_m) in d:
    d[_a-_m]+=1
  else:
    d[_a-_m]=1

print(d[max(d.keys())])

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

int main()
{
	string str;
	vector<string> cstr;
	getline(cin, str);

	int start = 0;
	for (int i = 0; i < str.size(); ++i){
		if (str[i] == ' '){
			cstr.push_back(str.substr(start,i - start));
			start = i+1;
		}
		if (i == str.size()-1){
			cstr.push_back(str.substr(start, i - start));
			start = i + 1;
		}
	}

	int maxl = 0,maxf = 0;
	for (auto& n : cstr){
		if (maxf < count(cstr.begin(), cstr.end(),n))			maxf = count(cstr.begin(), cstr.end(), n);
		if (n.size() > maxl)													maxl = n.size();
	}

	for (auto& n : cstr){
		vector<string> outs;
		if (maxf == count(cstr.begin(), cstr.end(), n)){
			cout << n << " ";
			break;
		}
	}

	for (auto& n : cstr){
		if (n.size() == maxl)
			cout << n << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
s = input()
start = int(s[:2])
end = int(s[-2:])
if 0 < start <= 12 and 0 < end <= 12:
  print('AMBIGUOUS')
elif 0 < end <= 12:
  print('YYMM')
elif 0 < start <= 12:
  print('MMYY')
else:
  print('NA')

Measured memory_bytes: 2940
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <bits/stdc++.h> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pl;
typedef pair<int, int> P;
#include <cmath>

int main()
{
  double A, B, H, M, ans, tmp, cospi, arg;
  cin >> A >> B >> H >> M;
  double ang1 = 6.0 * M, ang2 = 30.0 * H + 0.5 * M;
  // arg = min(360 - H * 30.0 + M * 0.5, H * 30 + M * 0.5);
  // cospi = cos(arg * M_PI / 180);
  tmp = (A * A) + (B * B) - (2 * A * B) * cos(abs(ang1 - ang2) * M_PI / 180);
  ans = sqrt(tmp);
  cout << fixed;
  cout << setprecision(20) << ans << endl;
  return 0;
}


Measured memory_bytes: 4120