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

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" \
						  << " = " << a[i] << endl;
#define fastio                        \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);
#define PI 3.141592654
#define all(v) v.begin(), v.end()

using namespace std;

using ll = long long;
const int MOD = 1e9 + 7;
const ll INF = 1e18 + 9;
using pi = pair<int, int>;

ll powmod(ll base, ll exp, const ll MOD) { ll ans = 1; while (exp) { if (exp & 1)	ans = (ans * base) % MOD; base = (base * base) % MOD; exp >>= 1; }return ans; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p); }

//ll f[500005];
//ll kCn(ll k, ll n) { return (f[n] * modInverse((f[n - k] * f[k]) % MOD, MOD)) % MOD; }


const int mxN = 1e6;


void test_case() {
	
}

int main() {
	fastio;
	int n;
	cin >> n;
	int ans = 0;
	vector<int> a(n);
	for (int i = 1; i <= n; ++i) {

		int x;
		cin >> x;
		if ((i & 1) && (x & 1))
			++ans;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3584
void main() {
  problem();
}

void problem() {
  auto K = scan!int;
  auto S = scan;

  string solve() {
    if (S.length > K) return S[0..K] ~ "...";
    return S;
  }

  solve().writeln;
}

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

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

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


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

typedef long long int ll;
typedef pair <ll, ll> pll;

const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const ll Inf = 1LL << 62;

int k[11];
int ar[11][11];
int p[11];
int mark[11];

ll Set(ll num, ll pos) {
	return num | (1LL << pos);
}

ll Clear(ll num, ll pos) {
	return num & ~(1LL << pos);
}

ll Toggle(ll num, ll pos) {
	return num ^ (1LL << pos);
}

bool Check(ll num, ll pos) {
	return (bool)(num & (1LL << pos));
}

int main() {
#ifdef Mr_Emrul
	freopen("inputf.in", "r", stdin);
#endif /// Mr_Emrul

	int n, m;
	cin >> n >> m;
	for(int i = 0; i < m; i++) {
		cin >> k[i];
		for(int j = 0; j < k[i]; j++) {
			cin >> ar[i][j];
			ar[i][j]--;
		}
	}
	for(int i = 0; i < m; i++) {
		cin >> p[i];
	}
	int lim = 1 << n;
	//printf("%d\n", lim);
	int ans = 0;
	for(int i = 0; i < lim; i++) {
		int cnt = 0;
		//for(int j = 0; j < n; j++) {
		//	cout << j << " " << Check(i, j) << endl;
		//}
		//cout << endl;
		for(int j = 0; j < m; j++) {
			int tot = 0;
			for(int l = 0; l < k[j]; l++) {
				//		printf("%d %d %d\n", j, ar[j][l], Check(i, ar[j][l]));
				if(Check(i, ar[j][l])) {
					tot += 1;
				}
			}
			tot %= 2;
			//printf("%d %d\n", tot, p[j]);
			if(tot == p[j]) {
				cnt += 1;
			}
		}
		//printf("\n");
		if(cnt == m) {
			ans += 1;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i % 2 == 0) {
      continue;
    }
    int d = 0;
    for (int x = 1; x <= i; x++) {
      if (i % x == 0) {
        d++;
      }
    }
    if (d == 8) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
ans = 0
if k == 0:
    print(n ** 2)
    exit()
for b in range(k+1,n+1):
    lmax = n // b
    ans += (b - k) * lmax
    t = n % b
    ans += max(0, t - k + 1)
print(ans)

Measured memory_bytes: 39408
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Lesson6B 太郎が花子と一緒にトランプ遊びをしようとしたところ 52枚あるはずのカードが n 枚のカードしか手元にありません。 これらの n
 * 枚のカードを入力として、足りないカードを出力するプログラム
 *
 * @author Internship
 *
 */
public class Main{

	/**
	 * プログラムのエントリポイント
	 *
	 * @param args
	 */
	public static void main(String[] args) {

		// スペード
		int[] intMarkS = new int[13];

		// ハート
		int[] intMarkH = new int[13];

		// クローバー
		int[] intMarkC = new int[13];

		// ダイヤ
		int[] intMarkD = new int[13];

		// カードの数字
		int intNum = 0;

		// 1行目を読み込む
		try {
			BufferedReader insBR = new BufferedReader(new InputStreamReader(
					System.in));

			int intFirstLine = Integer.parseInt(insBR.readLine());

			// 2行目以降を読み込む
			for (int i = 0; i < intFirstLine; i++) {
				String strLine = insBR.readLine();

				// 分解する
				String[] strAry = strLine.split(" ");

				// S 1
				// H 3
				// H 7
				// C 12
				// D 8

				// 配列に格納する　そのカードがあったら、そのカードの数字枠に１を入れる
				// 例　スペードの5　→　intMarkS[5] = 1
				// 最後にないカードの数字枠には0が入っていることになる

				// スペード
				if (strAry[0].equals("S")) {
					intNum = Integer.parseInt(strAry[1]);

					intMarkS[intNum - 1] = 1;

					// ハート
				} else if (strAry[0].equals("H")) {
					intNum = Integer.parseInt(strAry[1]);

					intMarkH[intNum - 1] = 1;

					// クローバー
				} else if (strAry[0].equals("C")) {
					intNum = Integer.parseInt(strAry[1]);

					intMarkC[intNum - 1] = 1;

					// ダイヤ
				} else if (strAry[0].equals("D")) {
					intNum = Integer.parseInt(strAry[1]);

					intMarkD[intNum - 1] = 1;
				}

			}

			// 出力
			for (int i = 0; i < intMarkS.length; i++) {
				if (intMarkS[i] == 0) {
					System.out.println("S " + (i + 1));
				}
			}

			for (int i = 0; i < intMarkH.length; i++) {
				if (intMarkH[i] == 0) {
					System.out.println("H " + (i + 1));
				}
			}

			for (int i = 0; i < intMarkC.length; i++) {
				if (intMarkC[i] == 0) {
					System.out.println("C " + (i + 1));
				}
			}

			for (int i = 0; i < intMarkD.length; i++) {
				if (intMarkD[i] == 0) {
					System.out.println("D " + (i + 1));
				}
			}

		} catch (IOException e) {
			System.out.println(e);
		} catch (NumberFormatException e) {
			System.out.println("数字で入力して下さい");
		}
	}
}

Measured memory_bytes: 16932
// in the name of Allah

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

#define endl '\n'
#define pb push_back
#define ll long long
#define double long double
#define sz(x) ((int) (x.size()))

#define fr first
#define se second

#define inf 1e9
#define max_n 123456
#define mod 1000000007

ll add(ll a, ll b) {
	a += b;
	if(a >= mod) return a - mod;
	return a;
}

ll mul(ll a, ll b) {
	a *= b;
	if(a >= mod) return a % mod;
	return a;
}

ll power(ll a, ll b) {
	ll p = 1;
	while(b) {
		if(b&1) p = mul(p, a);
		a = mul(a, a);
		b /= 2;
	}
	return p;
}

int n;
ll a[123456];
ll dp[123456];

ll memo(int idx) {
	if(idx < 0) return 1e18;
	if(idx == 0) return 0;
	if(dp[idx] != -1) return dp[idx];
	return dp[idx] = min(memo(idx-1) + abs(a[idx] - a[idx-1]), memo(idx-2) + abs(a[idx] - a[idx-2]));
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for(int i=0; i<n; i++) cin >> a[i];
	memset(dp, -1, sizeof dp);
	cout << memo(n-1) << endl;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            if (i * j == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}  

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

int main()
{
  double a, b, c, d, e, f;
  while(cin>>a>>b>>c>>d>>e>>f){     
    double y=(a*f-c*d)/(a*e-b*d);
    double x=(c-b*y)/a;	
    cout<<fixed<<setprecision(3)<<x << " " << y<< endl;
  }

  return 0;
}




Measured memory_bytes: 3280
import Data.List

solve :: [Int] -> Int
solve = f . map head . group where
  f (a:b:c:as)
    | signum (a-b) /= signum (b-c) = 1 + f (c:as)
    | otherwise = f (b:c:as)
  f _ = 1

main = getLine >> getLine >>= print.solve.map read.words

Measured memory_bytes: 36220
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class D {
        long f(long a) {
            if (a % 2 == 1) {
                if ((a & 2) == 0) {
                    return 1;
                } else {
                    return 0;
                }
            }
            long res = 0;
            for (int i = 60; i >= 1; i--) {
                if ((a & (1L << i)) != 0) {
                    res |= (1L << i);
                }
            }
            if ((a & 2) == 0) {
                return res;
            } else {
                return res | 1;
            }
        }

        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            long a = in.nl(), b = in.nl();
            if (a == 0)
                out.println(f(b));
            else
                out.println(f(b) ^ f(a - 1));

        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public long nl() {
            return Long.parseLong(ns());
        }

    }
}



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

int main() {
  string S, T;
  cin >> S >> T;
  int cnt = 0;
  for (int i = 0; i < 3; i++) {
    if (S[i] == T[i]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
 int a,b,c,d;
 scanf("%d %d %d",&a,&b,&c);
 if(a > b){
  d=a; a=b; b=d;
 }
 if(b > c){
  d=b; b=c; c=d;
 }
 if(a > b){
  d=a; a=b; b=d;
 }
 printf("%d %d %d\n",a,b,c);
 return 0;
}

Measured memory_bytes: 596
n=int(input())
a=list(map(int,input().split(" ")))

a.insert(0,-1)

m=len(a)-1
res=""

k=m
for i in range(int(m/2)+1):
    res+=str(a[k])+" "
    k-=2
    if k<=0:
        break

if m%2==0:
    s=1
else:
    s=2

if m>1:
    k=s
    for i in range(int(m/2)+1):
        res+=str(a[k])+" "
        k+=2
        if k>=m:
            break

print(res)


Measured memory_bytes: 26180
#include<iostream>
using namespace std;
int main(){
  int N,K;
  cin >> N >> K;
  /*for(int i = 0; i < N; i++){
    int x;
    cin >> x;
  }
  */
  int cnt = 0;
  N -= K; K--; cnt++;
  cnt += N / K;
  if(N % K){
    cnt++;
  }

  cout << cnt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  int n;
  cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];

  int max_i = 0;
  rep(i, n) {
    if (a[max_i] < a[i]) max_i = i;
  }

  int half_i = 0;
  double diff_i = a[max_i];
  rep(i, n) {
    if (i == max_i) continue;
    double diff = abs(a[i] - ((double)a[max_i] / 2));
    if (diff < diff_i) {
      diff_i = diff;
      half_i = i;
    }
  }
  
  cout << a[max_i] << " " << a[half_i] << endl;    
  
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()


void solve(long long N, long long Q, std::vector<long long> t, std::vector<long long> u, std::vector<long long> v){
    atcoder::dsu d(N);
    rep(i, Q){
        if(t[i] == 0) d.merge(u[i], v[i]);
        else{
            if(d.same(u[i], v[i])) cout << 1 << endl;
            else cout << 0 << endl;
        }
    }
}

struct IoSetup {
    IoSetup() {
        // cin.tie(nullptr);
        // ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main(){
    long long N;
    scanf("%lld",&N);
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> t(Q);
    std::vector<long long> u(Q);
    std::vector<long long> v(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&t[i]);
        scanf("%lld",&u[i]);
        scanf("%lld",&v[i]);
    }
    solve(N, Q, std::move(t), std::move(u), std::move(v));
    return 0;
}


Measured memory_bytes: 8308
use std::io::*;
use std::str::FromStr;
use std::cmp;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<i64>();
    let mut v = vec![0; n as usize];
    for i in 0..n {
        let tmp = read::<i64>();
        v[i as usize] = tmp - i - 1;
    }
    v.sort();
    let index = n / 2;
    let median = v[index as usize];
    let mut ans = 0;
    for i in 0..n {
        ans += (median - v[i as usize]).abs();
    }
    println!("{}", ans);
}

Measured memory_bytes: 6396
def main():
    from collections import defaultdict
    from math import gcd
    import sys
    input = sys.stdin.readline


    mod = 10 ** 9 + 7
    n = int(input())
    fishes = defaultdict(int)
    zero_zero = 0
    zero = 0
    inf = 0

    for _ in range(n):
        a, b = map(int, input().split())
        if a == 0 and b == 0:
            zero_zero += 1

        elif a == 0:
            zero += 1

        elif b == 0:
            inf += 1

        else:
            div = gcd(a, b)
            a //= div
            b //= div
            if b < 0:
                a *= -1
                b *= -1
            key = (a, b)
            fishes[key] += 1


    def get_bad_pair(fish):
        a, b = fish
        if a < 0:
            a *= -1
            b *= -1
        return (-b, a)


    ans = 1
    counted_key = set()
    for fish_key, count in fishes.items():
        if fish_key in counted_key:
            continue

        bad_pair = get_bad_pair(fish_key)
        if bad_pair in fishes:
            pair_count = fishes[bad_pair]
            pattern = pow(2, count, mod) + pow(2, pair_count, mod) - 1
            counted_key.add(bad_pair)

        else:
            pattern = pow(2, count, mod)

        ans = ans * pattern % mod

    ans *= pow(2, zero, mod) + pow(2, inf, mod) - 1
    if zero_zero:
        ans += zero_zero

    ans -= 1
    print(ans % mod)

if __name__ == "__main__":
    main()


Measured memory_bytes: 49360
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main(){
	long A, B, C, K;
  	cin >> A >> B >> C >> K; 

	if(A >= K){
		cout << K << endl;
	}
	else{
		K = K-A;
		if(B < K){
			K = K-B;
			
				cout << A-K << endl;
			
		}else{
			cout << A << endl;
		}
	}



	
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,ww;
	cin>>n>>ww;
	long long  w[n],v[n];
	for(int i=0;i<n;++i)
	cin>>w[i]>>v[i];
	long long dp[100005];
	for(int i=0;i<100005;++i)dp[i]=1e18;
	dp[0]=0;
	for(int i=0;i<n;++i)
	{
		for(int j=100000;j>=v[i];--j)
		dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
	}
	long long ans=0;
	for(int i=0;i<100001;++i)
	if(dp[i]<=ww)
	ans=i;
	cout<<ans;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    string s;
    cin>>s;
    int cur=0;
    int c2=0;
    int n=s.size();
    rep(i,n){
        if(s[i]=='(')++cur;
        else if(s[i]==')') --cur;
        else{
            c2=cur;
        }
    }
    cout<<c2<<endl;
    return 0;
}


Measured memory_bytes: 3224
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

string tostr(ll x){
    if(x  <= 0)return "";
    char c = '0'+x%10;
    return tostr(x/10) + c;
}
ll tonum(string s){
    reverse(ALL(s));
    ll num = 0;
    rep(i, s.size()){
        num += (s[i]-'0')*pow(10, i);
    }
    return num;
}
int main(){
    ll a, b;
    cin >> a >> b;
    ll res = 0;
    for(int i = a; i <= b; ++i){
        string s = tostr(i);
        string sr = s;
        reverse(ALL(sr));
        // cout << s << endl;
        if(s == sr)res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
  int n;
  string s;
  cin>>n>>s;
  sort(s.begin(),s.end());
  int eng[26]={};
  for (long long int i = 0; i < n; i++)
  {
    eng[s[i]-0x20-0x41]++;
  }
  
  long long int ans=1;
  for (long long int i = 0; i < 26; i++)
  {
    ans*=eng[i]+1;
    ans%=1000000007;
  }
  ans--;
  cout<<ans<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int a[3005];

long long fun(long long x,long long y)
{
	int a=x,b=y;
	while(y)
	{
		int temp = x%y;
		x=y;
		y=temp;
	}
	return a*b/x;
}

int main()
{
	int i,j,k,n,m;
	cin>>k;
	for(i=0;i<k;i++)
		cin>>a[i];
	
//	long long temp = fun(a[0],a[1]);
//	for(i=2;i<k;i++)
//		temp = fun(temp,a[i]);
//	
//	temp--;
//	long long ans = 0;
//	for(i=0;i<k;i++)
//		ans += temp%a[i];
	
	int ans1 = 0;
	for(i=0;i<k;i++)
		ans1 += a[i]-1;
		
	cout<<ans1;
//	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 256
val keyence = arrayOf('k', 'e', 'y', 'e', 'n', 'c', 'e')
var input: String =""

fun main(args: Array<String>){
    input = readLine()!!
    if(isFirstKeyence()){
        println("YES")
    }else{
        println("NO")
    }
}

fun isFirstKeyence(): Boolean {
    var keyencePosition = 0
    var keyenceLastPosition = keyence.size-1
    var inputMidPosition = 0
    for(i in 0 until input.length){
        // println(input[i])
        if(input[i] == keyence[keyencePosition]){
            if(keyencePosition == keyence.size-1){
                return true
            }else{
                keyencePosition++
            }
        }else{
            inputMidPosition = i
            break
        }
    }
    // println("----")
    for(i in input.length-1 downTo inputMidPosition+1){
        // println(input[i])
        if(input[i] == keyence[keyenceLastPosition]){
            if(keyenceLastPosition == keyencePosition){
                return true
            }else{
                keyenceLastPosition--
            }
        }else{
            return false
        }
    }
    return false
}

Measured memory_bytes: 33472
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int main(){
  int n, m, s;
  scanf("%d%d", &n, &m);
  int in, out, res = m;
  rep(i, n){
    scanf("%d%d", &in, &out);
    if(res < 0) continue;
    m += in;
    m -= out;
    res = max(res, m);
    if(m < 0) res = -1;
  }
  printf("%d\n", res < 0?0:res);
  return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
const int c=1e6;
const ll mod=1e9+7;
bool p[1000];
void sieve(){
p[0]=p[1]=1;
for(int i=2;i<=100;i++){
    for(int j=i*i;j<=100;j+=i){
        p[j]=1;
    }
}
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    int p[n+5],q[n+5],arr[n+5];
    for(int i=0;i<n;i++){
        cin>>p[i];
        arr[i]=p[i];
    }
    sort(arr,arr+n);
    for(int i=0;i<n;i++){
        cin>>q[i];
    }
    ll cntr=0,a=0,b=0,qe=0,pe=0;
    bool validp=0,validq=0;
    while(next_permutation(arr,arr+n)){
        cntr++;
        pe=0;
        qe=0;
        for(int i=0;i<n;i++){
        if(arr[i]==p[i]){
            pe++;
        }
        if(arr[i]==q[i]){
            qe++;
        }
    }
    if(qe==n){
        a=cntr;
        validp=1;
    }
    if(pe==n){
        b=cntr;
        validq=1;
    }
    if(validp&&validq){
        break;
    }
    }
    cout<<abs(a-b);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    ll n,x;cin>>n>>x;
    ll a[n];rep(i,n)cin>>a[i];
    sort(a,a+n);
    int cnt=0;
    bool flag = false;
    rep(i,n){
        x-=a[i];
        if(x>=0)cnt++;
    }
    co(x>0?max(0,cnt-1):cnt);
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int n,i,p,max,min,s;

    while(1){
      cin>> n;
      if(n){}else break;
      
      cin>> p;
      s = p;
      max = p;
      min = p;

      for(i = 0 ; i < n-1 ;i++){
          cin>> p;
          s += p;
          if(max < p){
              max = p;
	  }
          if(min > p){
              min = p;
	  }
      }
      s = (s - max - min)/ (n-2);
      cout<< s << endl;
  }    
  return 0;
} 

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>


#define MOD 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

typedef long long ll;

using namespace std;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
    string S;
    cin>>S;
    rep(i,0,S.size()){
        cout<<"x";
    }
    return 0;
}

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

int main() {
  char a1, a2, a3, b1, b2, b3;
  cin>>a1>>a2>>a3>>b1>>b2>>b3;
  int c;
  if (a1 == b1) c++;
  if (a2 == b2) c++;
  if (a3 == b3) c++;
  cout<<c<<endl;
}

Measured memory_bytes: 256
inp = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')
l = inp.shift().split(' ')
N = l[0] * 1
T = l[1] * 1
min = 1000
b = 0
for (i=0; i<N; i++) {
  l = inp[i].split(' ')
  c = l[0] * 1
  t = l[1] * 1
  if (T >= t) {
      if (min >= c) {
          min = c
          b = 1
      }
  }
}
console.log(b ? min : 'TLE')

Measured memory_bytes: 7372
A = sorted([int(i) for i in input().split()])
if all(A[i] % 2 == 0 for i in range(3)):
    ans = 0
else:
    minA = A[-1] // 2 * A[0] * A[1]
    ans= A[0] * A[1] * A[2] - minA * 2
print(ans)

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

fn calc_segment_index(l: usize, r: usize, k: usize) -> Vec<usize> {
    let mut x = l + k;
    let mut y = r + k;
    let mut a = vec![];
    let mut b = vec![];
    while x < y {
        if x & 1 == 1 {
            a.push(x);
            x += 1;
        }
        if y & 1 == 1 {
            y -= 1;
            b.push(y);
        }
        x >>= 1;
        y >>= 1;
    }
    b.reverse();
    a.append(&mut b);
    a
}

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let m: usize = it.next().unwrap().parse().unwrap();
    let size = n.next_power_of_two();
    let mut graph = vec![vec![]; 5 * size + 2 * m];
    let mut up = vec![0; 2 * size];
    let mut down = vec![0; 2 * size];
    for i in 1..(2 * size) {
        up[i] = size + i;
        down[i] = 3 * size + i;
    }
    for i in 1..size {
        graph[down[i]].push((down[2 * i    ], 0));
        graph[down[i]].push((down[2 * i + 1], 0));
        graph[up[2 * i    ]].push((up[i], 0));
        graph[up[2 * i + 1]].push((up[i], 0));
    }
    for i in 0..size {
        graph[i].push((up[size + i], 0));
        graph[down[size + i]].push((i, 0));
    }
    for k in 0..m {
        let l = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let r = it.next().unwrap().parse::<usize>().unwrap();
        let c: i64 = it.next().unwrap().parse().unwrap();
        let a = calc_segment_index(l, r, size);
        for a in a {
            graph[up[a]].push((5 * size + k, 0));
            graph[5 * size + m + k].push((down[a], 0));
        }
        graph[5 * size + k].push((5 * size + m + k, c));
    }
    let len = graph.len();
    let mut dp = vec![std::i64::MAX; len];
    dp[0] = 0;
    let mut h = std::collections::BinaryHeap::new();
    h.push((0, 0));
    while let Some((d, v)) = h.pop() {
        let d = -d;
        if d > dp[v] {
            continue;
        }
        for &(u, c) in &graph[v] {
            let d = d + c;
            if d < dp[u] {
                dp[u] = d;
                h.push((-d, u));
            }
        }
    }
    if dp[n - 1] == std::i64::MAX {
        println!("-1");
    } else {
        println!("{}", dp[n - 1]);
    }

}

fn main() {
    run();
}


Measured memory_bytes: 145660
def pretty_sequence(sequence):
    n = len(sequence)
    for i in range(n-1):
        print(format(sequence[i]) + ' ', end='')
    print(sequence[n - 1])

n = int(input())
sequence = [int(x) for x in input().split(' ')]


def selectionsort(seq, x):
    count = 0
    for i in range(x):
        minj = i
        for j in range(i, x):
            if seq[j] < seq[minj]:
                minj = j
        if seq[i] != seq[minj]:
            tmp_val = seq[i]
            seq[i] = seq[minj]
            seq[minj] = tmp_val
            count += 1
    return seq, count

sequence, count = selectionsort(sequence, n)
pretty_sequence(sequence)
print(count)

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

int main() {
  int n; cin>>n;
  map<string, int> A;
  rep(i, n) {
    string s; cin>>s;
    A[s]++;
  }
  int m; cin>>m;
  map<string, int> B;
  rep(i, m) {
    string s; cin>>s;
    B[s]++;
  }
  int res=0;
  for (auto iter1=A.begin(); iter1!=A.end(); iter1++) {
    for (auto iter2=B.begin(); iter2!=B.end(); iter2++) {
      if ((iter1->first)==(iter2->first)) {
        iter1->second-=iter2->second;
      }
    }
  }
  for (auto iter=A.begin(); iter!=A.end(); iter++) {
    res=max(res, iter->second);
  }
  cout<<res<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int f, s, n;
  	int a = 0;
  	cin >> f >> s;
  	for (int i = f; i<=s; i++){
		if (i/10000 == i%10){
        	if ((i - 10000*(i/10000)) / 1000 == (i%100 - i%10) / 10){
              a++;
            }else{
              continue;
            }
        }else{
          continue;
        }
    }
  	cout << a << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

const int N = 500010;
int c[30][N], n;
char s[N];

int lowbit(int x) {
	return x & -x;
}

void update(int x, int y, int *a) {
	for (int i = x; i <= n; i += lowbit(i)) a[i] += y;
}
int sum(int x, int *a) {
	int res = 0;
	for (int i = x; i >= 1; i -= lowbit(i)) res += a[i];
	return res;
}

int main() {
	int T;

	cin >> n >> s + 1 >> T;

	for (int i = 1; i <= n; i++) update(i, 1, c[s[i] - 'a']);

	while (T--) {
		int k; cin >> k;
		if (k == 1) {
			int p; string b;
			cin >> p >> b;
			update(p, -1, c[s[p] - 'a']);
			s[p] = b[0];
			update(p, 1, c[b[0] - 'a']);
		}
		else if (k == 2) {
			int x, y, res = 0;
			cin >> x >> y;
			for (int i = 0; i < 26; i++) res += sum(y, c[i]) - sum(x - 1, c[i]) > 0;
			cout << res << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 53504
import sys
import os
import math
import bisect
import collections
import itertools

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    snk = [0] * N
    for n in range(K):
        d = ii()
        A = il()
        for a in A:
            snk[a-1] += 1
    print(sum(1 for s in snk if s == 0))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9560
#include<stdio.h>
#include<string.h>

int main(void)
{
   int i, f, j;
   char s[201];

   scanf("%s",s);

   i=strlen(s);
   while(i/2!=f){
      f=0;
      s[i-1]='\0';
      i=strlen(s);
      if(i%2==0)
         while((s[f]==s[i/2+f])&&(f<i/2))
            f++;
   }

   printf("%d\n",strlen(s));
   return 0;
}

Measured memory_bytes: 1728
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

int n;
int m;
bool mark[N];
int parent[N];

int getP(int u){
    if(parent[u] == u)
        return u;
    return parent[u] = getP(parent[u]);
}

void join(int u , int v){
    u = getP(u);
    v = getP(v);
    parent[u] = v;
}

int main(){
    scanf("%d%d" , &n , &m);
    for(int i = 1; i <= n; i++){
        parent[i] = i;
    }
    for(int i = 1; i <= m; i++){
        int u , v , w;
        scanf("%d%d%d" , &u , &v , &w);
        join(u , v);
    }
    int cnt = 0;
    for(int i = 1; i <= n; i++){
        if(mark[getP(i)])
            continue;
        cnt++;
        mark[getP(i)] = 1;
    }
    printf("%d\n" , cnt);
}


Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
#define ___uzKqFSH79k 	
#define ___fLxbbhiKufocTX  
#define ___Wl1xBcCh3wUJkL "No"
#define ___a586oiN "Yes"
#define ___ppkyhuC6p (n<=a) 
#define ___HHOICEYOhSnA3 0;
#define ___mdXD5ZZ7pf ;
#define ___FOxYBsThgz4F2f cin>>n>>a;
#define ___R1zLSjhwl4 cout<<
#define ___LBVgkNt else 
#define ___mUzqNZ if 
#define ___DSX9KjxppJtq int 
#define ___dPk7Ldz main()
#define ___RzWgp n%=500;
#define ___VMOHLBci9o n,a;
#define ___XICIx45if1RrM namespace 
#define ___pTxFVnSQ4J return 
#define ___eUYMPsHHm3 std;
#define ___Uozk56x using 
#define ___SWgmm {
#define ___9NPYVyeslnd }
___Uozk56x ___XICIx45if1RrM ___eUYMPsHHm3 
___DSX9KjxppJtq ___VMOHLBci9o 
___DSX9KjxppJtq ___dPk7Ldz 
___SWgmm 
___uzKqFSH79k ___FOxYBsThgz4F2f 
___uzKqFSH79k ___RzWgp 
___uzKqFSH79k ___mUzqNZ ___ppkyhuC6p ___fLxbbhiKufocTX ___R1zLSjhwl4 ___a586oiN ___mdXD5ZZ7pf ___fLxbbhiKufocTX ___LBVgkNt ___R1zLSjhwl4 ___Wl1xBcCh3wUJkL ___mdXD5ZZ7pf 
___uzKqFSH79k ___pTxFVnSQ4J ___HHOICEYOhSnA3 
___9NPYVyeslnd 

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

int main() {
	int N, T[1000], A[1000];
	long long vote_T, vote_A;
	cin >> N;
	for (int i = 0; i < N; i++) {
		scanf("%d %d", &T[i], &A[i]);
		if (!i) {
			vote_T = T[0]; vote_A = A[0];
		}
		else {
			long long rate_T, rate_A;
			rate_T = (vote_T % T[i] == 0) ? vote_T / T[i] : vote_T / T[i] + 1;
			rate_A = (vote_A % A[i] == 0) ? vote_A / A[i] : vote_A / A[i] + 1;
			long long Max = max(rate_T, rate_A);
			vote_T = Max * T[i]; vote_A = Max * A[i];
		}
	}
	printf("%lld\n", vote_T + vote_A);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, m, ans = 0;
    string s;
    map<string, int> mp;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> s;
        mp[s]++;
    }
    cin >> m;
    for (int j = 0; j < m; j++){
        cin >> s;
        mp[s]--;
    }
    for(auto e : mp) ans = max(ans, e.second);
    cout << ans << endl;
}

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

using namespace std;

int main() {
    int n, l;
    cin >> n >> l;
    int left = l;
    int right = l + n - 1;
    int eat = 0;
    if (left >= 0) {
        eat = left;
    } else if (right <= 0) {
        eat = right;
    } else {
        eat = 0;
    }
    int ans = ((left + right) * n / 2) - eat;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3584
n,m=list(map(int,input().split()))
H=list(map(int,input().split()))
ans=0
Road=[[] for _ in range(n)]
for i in range(m):
  a,b=list(map(int,input().split()))
  Road[a-1].append(b)
  Road[b-1].append(a)

for i,R in enumerate(Road):
  count=0
  for j in range(len(R)):
    if H[i] <= H[R[j]-1]:
      break
    count += 1
  if count == len(R):
    ans+=1
print(ans)

Measured memory_bytes: 29372
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=200000000;
//setprecision(2) <<

const int MOD = 1000000007;




long myPow(long long x, long long n, long long m=MOD){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}
class Node{
public:
	long long under;
	long long up;
	long long a;
	long long b;
};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long N;
	cin>>N;
	vector<int>L(N);
	for(int i=0;i<N;i++){
		cin>>L[i];
	}
	long long ans=0;
	sort(L.begin(),L.end());
	for(int i=2;i<N;i++){
		for(int j=0;j<i;j++){
			//cout<<"i "<<L[i]<<"j "<<L[j]<<" ";
			int data=L.begin()+i-upper_bound(L.begin()+j+1,L.begin()+i,L[i]-L[j]);//-(L.begin()+j);
			ans+=data;
			
		}
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 256
use proconio::*;
#[warn(unused_imports)]
use proconio::marker::{Bytes, Chars};
use std::*;

#[warn(unused_imports)]
#[warn(dead_code)]
const MOD: i128 = 100_000_007;

#[fastout]
fn main() {
    input!{
        a : usize,
        b : usize
    };
    println!("{}", a*b);
}


Measured memory_bytes: 2164
<?php
fscanf(STDIN, '%d', $a);
fscanf(STDIN, '%d', $b);
if(($a == 1 && $b == 2) || ($a == 2 && $b == 1)) {
    echo 3;
} elseif(($a == 2 && $b ==3) || ($a == 3 && $b == 2)) {
    echo 1;
} else {
    echo 2;
}
echo PHP_EOL;

Measured memory_bytes: 4856
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{int from, to; ll cost;};

signed main(){
	ll N, W;
	cin >> N >> W;
	vector<ll> v[4];
	ll w0, ww, vv;
	cin >> w0 >> vv;
	v[0].push_back(vv);
	rep(N-1){
		cin >> ww >> vv;
		v[ww-w0].push_back(vv);
	}
	rep(4){
		sort(rall(v[i]));
		reppp(j, 1, (int)v[i].size()-1){
			v[i][j] += v[i][j-1];
		}
		v[i].insert(v[i].begin(), 0);
	}
	
	ll ans = 0;
	repp(i, min((ll)v[0].size(), W/w0+1)){
		repp(j, min((ll)v[1].size(), (W-i*w0)/(w0+1)+1)){
			repp(k, min((ll)v[2].size(), (W-i*w0-j*(w0+1))/(w0+2)+1)){
				ll l = min((ll)v[3].size(), (W-i*w0-j*(w0+1)-k*(w0+2))/(w0+3));
				if(i*w0 + j*(w0+1) + k*(w0+2) + l*(w0+3) <= W){
					if(ans < v[0][i] + v[1][j] + v[2][k] + v[3][l])
						ans  = v[0][i] + v[1][j] + v[2][k] + v[3][l];
				}
			}
		}
	}
	cout << ans;
	
}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<list>
#include<utility>

using namespace std;

#define INF 10000000

typedef pair<int,int> PII;
typedef pair<PII,int> PIII;

int N,M;

vector<PIII> edge[10000];
int visited[10000];
int dist[10000];
int cs[10000];

int solve(int s){

    memset(cs,0,sizeof(cs));
    memset(visited,0,sizeof(visited));
    visited[s]=1;

    priority_queue<PIII,vector<PIII>,greater<PIII> > pq;
    for(unsigned int i=0;i<edge[s].size();++i)pq.push(edge[s][i]);

    int sum=0;
    int cnt=1;


    while(!pq.empty()){

        PIII p = pq.top(); pq.pop();

        int n = p.second;
        int d = p.first.first;
        int c =-p.first.second;

        if(visited[n]){

            if(dist[n] == d)
                cs[n] = min(cs[n],c);

            continue;
        }

        dist[n] = d;
        visited[n] = 1;
        cs[n] = c;
        ++cnt;

        for(unsigned int i=0;i<edge[n].size();++i){

            PIII pp = edge[n][i];

            int next = pp.second;
            int nd   = pp.first.first;
            int nc   =-pp.first.second;

            if(visited[next]){

                if(dist[next]==dist[n]+nd)
                    cs[next] = min(cs[next],nc);

                continue;

            }

            pq.push(make_pair(make_pair(dist[n]+nd,-nc),next));

        }

    }

    for(int i=0;i<N;++i) sum+=cs[i];

    return sum;

}

int main(){

    cin.sync_with_stdio(false);

    while(1){

        cin >> N >> M;

        if(N==0&&M==0)break;

        for(int i=0;i<M;++i){
            
            int u,v,d,c;

            cin >> u >> v >> d >> c;

            edge[u-1].push_back(make_pair(make_pair(d,-c),v-1));
            edge[v-1].push_back(make_pair(make_pair(d,-c),u-1));

        }

        cout << solve(0) << endl;

        for(int i=0;i<N;++i)edge[i].resize(0);

    }


    return 0;

}

Measured memory_bytes: 3576
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt() + in.nextInt();
            out.println(n >= 10 ? "error" : n);
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



Measured memory_bytes: 21332
#include <stdio.h>

int main(void) {
  char N[5], twos;
  int i;
  scanf("%s",N);
  for (i = 0, twos = '0'; N[i]; i++) {
    if (N[i] == '2') {
      twos += 1;
    }
  }
  putchar(twos);
  return 0;
}

Measured memory_bytes: 128
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N,M,L = MI()


class WarshallFloyd():
    def __init__(self,N):  # Nは頂点の個数
        self.N = N
        self.d = [[float('inf')]*N for i in range(N)]  # d[i][j] = iからjへの最短距離,0-indexed
    def add(self,u,v,c,directed = False):
        if directed is False:  # 無向グラフの場合
            self.d[u][v] = c
            self.d[v][u] = c
        else:  # 有向グラフの場合
            self.d[u][v] = c
    def WarshallFloyd_search(self):
        for k in range(self.N):
            for i in range(self.N):
                for j in range(self.N):
                    self.d[i][j] = min(self.d[i][j],self.d[i][k] + self.d[k][j])
        return self.d


W = WarshallFloyd(N)
for i in range(M):
    a,b,c = MI()
    W.add(a-1,b-1,c,directed=False)
d = W.WarshallFloyd_search()

d2 = [[float('inf')]*N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if d[i][j] <= L:
            d2[i][j] = 1

for k in range(N):
    for i in range(N):
        for j in range(N):
            d2[i][j] = min(d2[i][j],d2[i][k]+d2[k][j])

Q = I()
for i in range(Q):
    s,t = MI()
    if d2[s-1][t-1] == float('inf'):
        print(-1)
        continue
    print(d2[s-1][t-1]-1)


Measured memory_bytes: 83292
import re
s = input()
len_s = len(s)
max_ACGT = 0

for i in range(len_s):
    for j in range(i + 1, len_s+1):
        partial_s = s[i:j]
        if len(re.findall('A|C|G|T', partial_s)) == len(partial_s) and len(partial_s) > max_ACGT:
            max_ACGT = len(partial_s)

print(max_ACGT)


Measured memory_bytes: 3188
#include<string>
#include<cmath>
#include<iostream>

using namespace std;
 
int main(){
	double v;

	while(cin >> v){
		int n=1;
		double t,y;

		t=v/9.8;
		y=4.9*t*t;

		while(5*(n-1)<y) n++;

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

Measured memory_bytes: 1224
#include <iostream>
#include <string>
#include <math.h>
#include <list>
using namespace std;

int main(){
    int K;
    long ans;
    list<long> lun = {9,8,7,6,5,4,3,2,1};

    cin >> K;

    for(int i=0; i<K; i++){
        
        ans = lun.back();
        lun.pop_back();

        int lmod = ans % 10;
        
        if(lmod != 0) lun.push_front(10*ans + lmod - 1);
        lun.push_front(10*ans + lmod);
        if(lmod != 9) lun.push_front(10*ans + lmod + 1);

    }

    cout << ans << endl;

}

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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] In = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int n = In[0];
            int m = In[1];
            int[] X = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            Array.Sort(X);
            int[] D = new int[m - 1];
            for(int i = 0; i < m-1; i++)
            {
                D[i] = X[i + 1] - X[i];
            }
            Array.Sort(D);
            long sum = 0;
            for(int i = 0; i < D.Length - n + 1; i++)
            {
                sum += D[i];
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 37016