akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var s, t string
	if sc.Scan() {
		s = sc.Text()
	}
	if sc.Scan() {
		t = sc.Text()
	}
	maxMatch := 0
	for i := 0; i <= len(s)-len(t); i++ {
		test := s[i : i+len(t)]
		match := 0
		for i, _ := range make([]int, len(t)) {
			if test[i] == t[i] {
				match++
			}
		}
		if match > maxMatch {
			maxMatch = match
		}
	}
	fmt.Printf(strconv.Itoa(len(t) - maxMatch))
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

#define x(p) real(p)
#define y(p) imag(p)

const double eps=1e-8;
const double inf=1e12;
const double PI=acos(-1);
typedef complex<double> P;

namespace std{
  bool operator<(const P& a,const P& b){
    return x(a)==x(b)?y(a)<y(b):x(a)<x(b);
  }
}
double cross(const P& a,const P& b){
  return y(conj(a)*b);
}
double dot(const P& a,const P& b){
  return x(conj(a)*b);
}
struct L : public vector<P> { // line and segment
  L(const P& a,const P &b){
    push_back(a);
    push_back(b);
  }
};
int ccw(P a,P b,P c) {
  b=b-a;c=c-a;
  if(cross(b,c)>0) return +1;       // counter clockwise
  if(cross(b,c)<0) return -1;       // clockwise
  if(dot(b,c)<0)   return +2;       // c--a--b on line
  if(norm(b)<norm(c)) return -2;       // a--b--c on line
  return 0;
}
bool intersectSS(const L& s,const L& t){
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1])<=0&&ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1])<=0;
}
P crosspoint(const L& l,const L& m) {
  double A=cross(l[1]-l[0],m[1]-m[0]);
  double B=cross(l[1]-l[0],l[1]-m[0]);
  if (abs(A)<eps&&abs(B)<eps) return m[0]; // same line
  if (abs(A)<eps) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0]+B/A*(m[1]-m[0]);
}

bool hoge(P p){
  return abs(x(p)-100)<eps||abs(x(p)+100)<eps||abs(y(p)-100)<eps||abs(y(p)+100)<eps;
}

int main(){
	cin.sync_with_stdio(false);
  while(1){
    vector<L> ls;
    int n;
    cin>>n;
    if(n==0)break;
    double x1,x2,y1,y2;
    rep(i,n){
      cin>>x1>>y1>>x2>>y2;
      ls.pb(L(P(x1,y1),P(x2,y2)));
    }
    int res=1;
    rep(i,n){
      vector<P> ps,pss;
      rep(j,i){
        if(intersectSS(ls[i],ls[j])){
          P p=crosspoint(ls[i],ls[j]);
          if(hoge(p))continue;
          ps.pb(p);
        }
      }
      rep(j,ps.size()){
        bool aru=false;
        rep(k,pss.size()){
          if(abs(ps[j]-pss[k])<eps)aru=true;
        }
        if(!aru)pss.pb(ps[j]);
      }
      res+=pss.size()+1;
    }
    cout<<res<<endl;
  }
	return 0;
}

Measured memory_bytes: 3244
#include <stdio.h>

int main(){
  int i,j,n,A[100],v,k;

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=n;i++){
    v=A[i];
    j=i-1;
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
      A[j+1]=v;
    }
    for(k=1;k<=n;k++){
      printf("%d",A[k]);
      if(k==n) printf("\n");
      else printf(" ");
    }
  }
  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long a[3];
    cin>>a[0]>>a[1]>>a[2];
    int counter=0;
    sort(a,a+3);
    for(int i=0; i<3;i++){
    if(a[i]%2==0){
    counter++;}}
    if(counter>0)
    cout<<0<<endl;
    else
    cout<<a[0]*a[1]<<endl;
}
    


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
int kaijo(int n){
	int ans=1;
	for(int i=2;i<=n;i++){
		ans*=i;
		ans%=MOD;
	}
	return ans;
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int comb(int a,int b){
	return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
}
int w,h,x,y;
signed main(){
	cin>>w>>h>>x>>y;
	if(x*2==w&&y*2==h){
		printf("%.12lf ",(double)w*h/2);
		cout<<1<<endl;
	}
	else{
		printf("%.12lf ",(double)w*h/2);
		cout<<0<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
# 初期入力

import sys
input = sys.stdin.readline
H,W,K = (int(i) for i in input().split())
c =[["a"]*W for i in range(H)]
for i in range(H):
    #c[i] =input().strip()
    c[i] =list(input().strip())

#どの行または列を選ぶか全探索
from itertools import combinations
from copy import deepcopy

ans =0
for h in range(H+1):
    for w in range(W+1):
        #paint =deepcopy(c)
        for h2 in combinations(list(range(H)), h):
            for w2 in combinations(list(range(W)), w):
                paint =deepcopy(c)
                for h3 in h2:
                    for i in range(W):
                        paint[h3][i] ="r"
                for i in range(H):
                    for w3 in w2:
                        paint[i][w3] ="r"
                #「＃」がいくつあるか
                count_black =0
                for i in range(H):
                    count_black +=paint[i].count("#")
                    #print(count_black,paint[i])
                if count_black ==K:
                    ans +=1

#('a', 'b')('a', 'c')('b', 'c')
print(ans)

Measured memory_bytes: 9064
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;


int main(){
    int t;
    t=1;
    //cin>>t;

    while(t--){
        bool a=false,b=false;
        string s;
        cin>>s;
        for(int i=0;i<s.size();i++){
            if(!a&&s[i]=='C') a= true;
            if(a&&!b&&s[i]=='F') b= true;
        }
        if(a&&b) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }

    return 0;
}

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

using namespace std;

const int N = 3001;
using ll = long long;
ll dp[N][N][2];
int a[N];

ll solve(int l, int r, int player) {
    if (l > r) {
        return 0;
    }
    ll& ans = dp[l][r][2];
    if (ans != -1) {
        return ans;
    }
    ans = -1e18;
    if (player == 0) {
        ans = max(solve(l + 1, r, 1) + a[l], solve(l, r - 1, 1) + a[r]);
    } else {
        ans = min(solve(l + 1, r, 0) - a[l], solve(l, r - 1, 0) - a[r]);
    }
    return ans;
}

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    memset(dp, -1, sizeof dp);
    cout << solve(1, n, 0);
    return 0;
}


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

int main(){
	ll n;
	cin >> n;
	if(n == 0){
		cout << 0 << endl;
		return 0;
	}
	string s;
	while(n != 0){
		if(n % -2 == 0){
			s += '0';
		}else{
			n--;
			s += '1';
		}
		n /= -2;
	}
	reverse(s.begin(), s.end());
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處
namespace Number {
    typedef long long int LL;
    // 求取 a, b 的最大公因數
    LL gcd(LL a, LL b) {
        if (a % b == 0) {
            return b;
        }
        return gcd(b, a % b);
    }
    // 求取 a, b 的最大公因數 gcd
    // 以及 x, y 使得 a*x + b*y = gcd
    LL gcd_extend(LL a, LL b, LL *x, LL *y) { 
        if (a == 0) { 
            *x = 0, *y = 1; 
            return b; 
        } 
    
        LL x1, y1; // To store results of recursive call 
        LL gcd = gcd_extend(b%a, a, &x1, &y1); 
    
        *x = y1 - (b/a) * x1; 
        *y = x1; 
    
        return gcd; 
    }
    // 求 a_inv 使得 (a * a_inv) % m = gcd(a, m)
    // 若 a, m 互質，即求 a 在 mod m 群的反元素 a_inv 
    LL mod_inv(LL a, LL m) { 
        LL x, y; 
        LL g = gcd_extend(a, m, &x, &y); 
        // 處理 x 爲負的情形 
        LL a_inv = (x%m + m) % m; 
        return a_inv;
    }
    // 求 x^n % m
    LL mod_pow(LL x, LL n, LL m) {
        if (n == 0) {
            return 1;
        } else if (n & 1) {
            LL half = mod_pow(x, n/2, m);
            return (half * half % m) * x % m;
        } else {
            LL half = mod_pow(x, n/2, m);
            return half * half % m;
        }
    }
    // 連乘
    LL mul(LL from, LL to, LL m) {
        LL ret = 1;
        for (LL i = from; i <= to; i++) {
            ret *= i;
            ret %= m;
        }
        return ret;
    }
    // 求 (C n 取 k) % m
    LL mod_comb(LL n, LL k, LL m) {
        LL mi = k < n-k ? k : n-k;
        LL up = mul(n - mi + 1, n, m);
        LL down = mul(1, mi, m);
        return (up * mod_inv(down, m)) % m;
    }
}
  

LL a[100005];

int main() {
    LL n, m;
    cin >> n >> m;
    LL lcm = 1;
    bool ok = true;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] /= 2;
        LL mul = (lcm / Number::gcd(a[i], lcm));
        if ((m + 1) < a[i] * mul) {
            ok = false;
            break;
        }
        lcm = a[i] * mul;
    }
    for (int i = 0; i < n && ok; i++) {
        if ((lcm / a[i]) % 2 == 0) {
            ok = false;
        }
    }
    if (!ok) {
        cout << 0 << endl;
    } else {
        cout << (m / lcm + 1) / 2  << endl;
    }
}


Measured memory_bytes: 4400
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define oo 1000000010
const int N = 110;
int dp[N][N][2];
char grid[N][N];
int n , m;

int solve(int i,int j,bool pre){
	if(i == n - 1 && j == m - 1)
		return (grid[i][j] == '#' && pre == 0 ? 1 : 0);
	if(dp[i][j][pre] != -1)
		return dp[i][j][pre];
	dp[i][j][pre] = oo;
	int cur = 0;
	if(grid[i][j] == '#' && pre == 0)
		cur = 1;
	if(i + 1 < n)
		dp[i][j][pre] = min(dp[i][j][pre] , solve(i + 1,  j , (grid[i][j] == '#' ? 1 : 0) ) + cur);
	if(j + 1 < m)
		dp[i][j][pre] = min(dp[i][j][pre] , solve(i ,  j + 1 , (grid[i][j] == '#' ? 1 : 0) ) + cur);
	return dp[i][j][pre];
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i = 0 ;i < n;i++)
		scanf("%s",grid[i]);
	memset(dp,-1,sizeof(dp));
	cout << solve(0 , 0 , 0) << endl;
	return 0;
}

Measured memory_bytes: 384
<?php

$n = (int)trim(fgets(STDIN));

$point = [
	[
		't' => 0,
		'x' => 0,
		'y' => 0,
	]
];
for ($i=0; $i <$n; $i++) { 
	$input = explode(' ', trim(fgets(STDIN)));
	$point[]=[
		't' => (int)$input[0],
		'x' => (int)$input[1],
		'y' => (int)$input[2],
	];
}

$prev = null;
foreach ($point as $tmp) {
	if ($prev === null) {
		$prev = $tmp;
	}else{
		$t_diff = $tmp['t'] - $prev['t'];
		$dist = abs($tmp['x'] - $prev['x']) + abs($tmp['y'] - $prev['y']);
		$d_diff = $t_diff - $dist;
		if ($d_diff < 0) {
			echo 'No';
			exit();
		}elseif ($d_diff % 2 !== 0) {
			echo 'No';
			exit();
		}
	}
}
echo 'Yes';


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<int> a(n);
    inc(i, 0, n) cin >> a[i];
    LL ans = 0;
    map<LL, int> m;
    LL sum = 0;
    m[0] = 1;
    inc(i, 0, n){
        sum += a[i];
        if(m.find(sum) != m.end()){
            ans += m[sum];
        }
        m[sum] += 1;
    }
    printf("%lld\n", ans);
    return 0;
}


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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

int main() {
    int n;
    cin >> n;
    
    int cnt = 0;
    string ns;
    rep(1, n+1) {
        ns = to_string(i);
        if (ns.size() % 2 != 0) cnt++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
import itertools
N = int(stdin.readline().rstrip())
A = tuple(stdin.readline().rstrip().split())
B = tuple(stdin.readline().rstrip().split())
add = []
for el in range(N):
    add.append(str(el+1))
p = itertools.permutations(add, N)
data = []
for el in p:
    data.append(el)
a = data.index(A)
b = data.index(B)
print(abs(b-a))

Measured memory_bytes: 45040
#include<stdio.h>

int main(){
  int n, m, p, x;
  int i, j, ans, sum, get;
  
  while(scanf("%d%d%d", &n, &m, &p), n){
    sum=0;
    for(i=0; i<n; i++){
      scanf("%d", &x);
      sum+=x;
      if(i==m-1){
	get=x;
      }
    }

    ans=0;
    if(get!=0){
      sum*=100;
      sum-=sum*p/100;
      ans=sum/get;
    }
    
    printf("%d\n", ans);
  }
  
  return 0;
}

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


int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int upper = min(B, D);
  int lower = max(A, C);

  cout << max(upper-lower, 0) << endl;
}
 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	vector<int> v(3);
	v[0] = a + b;
	v[1] = a - b;
	v[2] = a * b;
	sort(v.begin(), v.end());
	cout << v[2];
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
typedef long long LL;
const long long INF = 1LL << 60;

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

        LL minA = INF;
        LL sum = 0;
        int minusN = 0;
        for (int i = 0; i < N; ++i) {
                if (A[i] < 0) {
                        minusN++;
                }
                minA = min(minA, abs(A[i]));
                sum+=abs(A[i]);
        }
        if (minusN%2 == 0) {
                cout << sum << "\n";
        } else {
                sum = sum - minA*2;
                cout << sum << "\n";
        }
        return 0;
}


Measured memory_bytes: 1024
n, q = map(int, input().split())
s = input()

ls = [0] * n
for i in range(n-1):
   if s[i] == 'A' and s[i+1] == 'C':
      ls[i+1] = ls[i]+1
   else:
      ls[i+1] = ls[i]

ans = []
for i in range(q):
   l, r = map(int, input().split())
   ans.append(ls[r-1] - ls[l-1])

for x in ans:
   print(x)


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

using namespace std;
const double pi=acos(-1.0);
const double eps=1e-9;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define re return
#define vi vector <int> 
#define pii pair <int,int>
#define pll pair <long long , long long>
typedef long long ll;

int ans,n,a;
pii p[100000];

int main()
{
	ios:: sync_with_stdio(false);
	cin >> n;
	for(int i=0;i<n;i++)
	{
		cin >> a;
		p[i]=mp(a,i);
	}
	sort(p,p+n);
	for(int i=0;i<n;i++)
		if(p[i].se%2!=i%2)ans++;
	cout << (ans+1)/2;
	return 0;
}

Measured memory_bytes: 1024
#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) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
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 PI = (double)acos(-1);
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);
  };
};

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

  int d[110][110];
  m0(d);
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      if (i != j) d[i][j] = 1;
    }
  }

  if (N % 2 == 0) {
    for (int i = 1; i <= N - i + 1; i++) {
      d[i][N - i + 1] = 0;
    }

    cout << N * (N - 1) / 2 - N / 2 << endl;

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

    cout << N * (N - 1) / 2 - (N - 1) / 2 << endl;

    for (int i = 1; i <= N; i++) {
      for (int j = i + 1; j <= N; j++) {
        if (d[i][j]) {
          cout << i << " " << j << endl;
        }
      }
    }
  }

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

typedef pair<int,int> P;

int sum(vector<int> v){
	int s = 0;
	for(int i=0 ; i < v.size() ; i++ )
		s += v[i];
	return s;
}

int main(){
	int n, m;
	while( cin >> n >> m , n || m ){
		vector<int> a(n);
		vector<int> b(m);
		vector<P> ans;
		
		for(int i = 0 ; i < n ; i++ ){
			cin >> a[i];
		}
		for(int i = 0 ; i < m ; i++ ){
			cin >> b[i];
		}
		
		for(int i=0 ; i < n ; i++ ){
			for(int j=0 ; j < m ; j++ ){
				swap( a[i] , b[j] );
				
				if( sum(a) == sum(b) ){
					P p( b[j] , a[i] );
					ans.push_back( p );
				}
				swap( a[i] , b[j] );
			}
		}
		if( ans.empty() ){
			cout << -1 << endl;
		}else{
			int min_score = 100000;
			for(int i=0 ; i < ans.size() ; i++ ){
				min_score = min( min_score , ans[i].first + ans[i].second );
			}
			for(int i=0 ; i < ans.size() ; i++ ){
				if( min_score == ans[i].first + ans[i].second ){
					cout << ans[i].first << " " << ans[i].second << endl;
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int i, k;
		int[][] data = new int[N][3];
		int[] score = new int[N];
		for(i=0; i<N; i++){
			for(k=0; k<3; k++){
				data[i][k] = sc.nextInt();
			}
			score[i]=0;						//score[]を0で初期化。
		}
		for(k=0; k<3; k++){
			for(i=0; i<N; i++){
				if(check00(data, N, i, k) == 1){
					score[i] += data[i][k];
				}
			}
		}
		for(i=0; i<N; i++){
			System.out.println(score[i]);
		}

	}
	
	static int check00(int[][] data, int N, int r, int c){
		if(data[r][c] == 0){
			return 0;
		}
		int i;
		for(i=0; i<N; i++){
			if(i==r){
				continue;
			}
			else if(data[r][c] == data[i][c]){
				return 0;
			}
		}
		return 1;
	}

}

Measured memory_bytes: 20804
/*
[abc130] C - Rectangle Cutting
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

double W, H, x, y;

void solve() {
    cout << setprecision(15) << W * H * 0.5 << " "
         << (x == W * 0.5 && y == H * 0.5) << endl;
}

int main() {
    cin >> W >> H >> x >> y;

    solve();

    return 0;
}


Measured memory_bytes: 256
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

// -------------------</optimizations>--------------------
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double
#define pii pair<int,int>
#define pb push_back
#define cases int tc;cin>>tc;while(tc--)
#define N 10003
#define M 103
#define inf LLONG_MAX
#define Arena ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//int mod=1e9+7;
//int mod=998244353;
vector<int> g[N];
int c[N],ans[N];
int j,an;
bool vis[N];

void dfs(int i)
{
    vis[i]=1;
    
    for(auto it:g[i])
        if(!vis[it])
            dfs(it);
        
    if(!ans[i])
        ans[i]=c[j++];
}

void dfs2(int i)
{
    vis[i]=1;
    
    for(auto it:g[i])
    {
        if(!vis[it])
        {
            an+=min(ans[i],ans[it]);
            dfs2(it);
        }
    }
}

signed main()
{
    Arena
    
    int n;
    cin>>n;
    int i,a,b;
    for(i=1;i<=n-1;++i)
    {
        cin>>a>>b;
        g[a].pb(b);
        g[b].pb(a);
    }
    for(i=1;i<=n;++i)
        cin>>c[i];
    
    sort(c+1,c+n+1);
    j=1;
    dfs(1);
    
    an=0;
    fill(vis,vis+N,0);
    dfs2(1);
    
    cout<<an<<'\n';
    for(i=1;i<=n;++i)
        cout<<ans[i]<<' ';
    
    
    return 0;
}


Measured memory_bytes: 1280
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AIZU {
	class Program {
		static void print(object j) { Console.WriteLine(j.ToString()); }
		static void print(string j) { Console.WriteLine(j); }

		static void Main(string[] args)
		{
			int[] dec = { 1,9,36,84,126,126,84,36,9,1 };
			int[] inp = new int[10];
			string H;
			while (true) {
				H = Console.ReadLine();
				if (string.IsNullOrEmpty(H)) break;
				for (int i = 0; i < 10; i++) {
					inp[i] =H[i]-48;
				}
				var Res = 0;
				for (int i = 0; i < 10; i++) {
					Res += inp[i] * dec[i];
				}
				Res %= 10;
				print(Res);
			}
		}
	}
}

Measured memory_bytes: 9032
using System;
class Program
{
    static void Main(string[] args)
    {
        while (true)
        {
            string[] data = Console.ReadLine().Split(' ');
            int H = int.Parse(data[0]);
            int W = int.Parse(data[1]);
            if (H == 0 && W == 0)
            {
                return;
            }
 
            string line = "";
            for (int i = 0; i < W; i++)
            {
                line = line + "#";
            }
            for (int i = 0; i < H; i++)
            {
                Console.WriteLine(line);
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 5324
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

a,B,T=get_i
cnt=a
ans=0
while cnt<=T
  ans+=B
  cnt+=a
end
puts ans

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

int main(){
  int N;
  cin >> N;
  int F[N][10];
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < 10; ++j){
      cin >> F[i][j];
    }
  }
  int P[N][11];
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < 11; ++j){
      cin >> P[i][j];
    }
  }

  ll ans = -1000000000LL;
  for(int m = 1; m < (1 << 10); ++m){
    ll profit = 0;
    for(int i = 0; i < N; ++i){
      int c = 0;
      for(int j = 0; j < 10; ++j){
  	int op = (m >> j) & 1;
  	if(op && F[i][j]) c++;
      }
      profit += P[i][c];
    }
    ans = max(profit, ans);
  }

  cout << ans << endl;
  
}


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

#define int				long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define FORE( i, m, n ) FOR( i, m , n + 1 )
#define REP( i, n )     FOR( i, 0, n )
#define REPE( i, n )	FOR( i, 0, n + 1 )
#define REPR( i, m )	for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )	FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define P				pair<int, int>

template<class T>bool chmax( T& a, const T& b ) { if( a < b ) { a = b; return 1; } return 0; }
template<class T>bool chmin( T& a, const T& b ) { if( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main() {
	string s; cin >> s;

	for( int bit = 0; bit < ( 1 << 3 ); bit++ ) {
		int t, sum;
		sum = s[0] - '0';
		REP( i, 3 ) {
			t = s[i + 1] - '0';
			if( bit & ( 1 << 2 - i ) ) {
				sum += t;
			} else {
				sum -= t;
			}
		}

		if( sum == 7 ) {
			REP( i, 3 ) {
				cout << s[i];
				if( bit & ( 1 << 2 - i ) ) {
					cout << '+';
				} else {
					cout << '-';
				}
			}
			cout << s[3] << '=' << 7 << endl;
			break;
		}
	}
}

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

int main() {
	int a, b;
	cin >> a >> b;
	if ((a + b) * 5 % 10)
		cout << (a + b) / 2 + 1 << endl;
	else
		cout << (a + b) / 2 << endl;
}

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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

vector<long long> divisors(long long n) {
    vector<long long> v;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            v.push_back(i);
            if (i * i != n) {
                v.push_back(n / i);
            }
        }
    }
    return v;
}

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

    vector<ll> v = divisors(n);
    cout << to_string(v[v.size() - 1]).size() << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  100005

void solve()
{
    ll n,k;
    cin>>n>>k;
    ll r,s,p;
    cin>>r>>s>>p;
    string t;
    cin>>t;
    t="#"+t;
    string sr="";
    rep(i,0,n+1)
    sr+="#";
    ll ans=0;
    rep(i,1,k+1)
    {
        if(t[i]=='r')
        {
            sr[i]='p';
            ans+=p;
        }
        if(t[i]=='s')
        {
            sr[i]='r';
            ans+=r;
        }
        if(t[i]=='p')
        {
            sr[i]='s';
            ans+=s;
        }
    }
    rep(i,k+1,n+1)
    {
        if(t[i]==t[i-k])
        {
            if(sr[i-k]=='#')
            {
                if(t[i]=='r')
        {
            sr[i]='p';
            ans+=p;
        }
        if(t[i]=='s')
        {
            sr[i]='r';
            ans+=r;
        }
        if(t[i]=='p')
        {
            sr[i]='s';
            ans+=s;
        }

            }
            else
            {
                continue;
            }
        }
        else
        {
            if(t[i]=='r')
        {
            sr[i]='p';
            ans+=p;
        }
        if(t[i]=='s')
        {
            sr[i]='r';
            ans+=r;
        }
        if(t[i]=='p')
        {
            sr[i]='s';
            ans+=s;
        }
        }
    }
    cout<<ans<<endl;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3868
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i = 0; i < (n); i++)

int main(void) 
{
    int n, x;
    int cnt = 0;
    while(1) {
    cnt = 0;
    cin >> n >> x;
    if(n == 0 && x == 0) break;
    for(int i = 1; i <= n-2; i++) {
        for(int j = i+1; j <= n-1;j++) {
//            if(i == j) continue;
            for(int k = j+1; k <= n; k++) {
//                if(i == k || j == k) continue;
                if(i + j + k == x) {
           //         cout << "[" << cnt << "]" << i << " " << j << " " << k << endl;
                    cnt ++;
                }
            }
        }
    }
    cout << cnt << endl;
    }
}



Measured memory_bytes: 3116
#include <stdio.h>
#define ABS(a) ((a)>(0)?(a):-(a))
long long min(long long a, long long b){ return a > b ? b : a; }

long long rec(long long i, long long *H, long long K, long long *memo){
    if (i == 0)  return memo[0] = 0; 
    if (i - 2 < 0) return memo[1] = ABS(H[i - 1] - H[i]);
    if (memo[i] != -1) return memo[i];
    long long ret = 100000000000;
    for (int j = 1; j <= K; j++) {
        //rec(i)は i - j 番目の のカエルから飛んでくるものの内最小値
        if(i - j < 0) continue;
        ret =  min( rec(i - j,H,K,memo) + ABS(H[i - j] - H[i]),ret);
        //printf("%lld %lld\n", i - j, i);
    }
    return memo[i] = ret;
}

int main(void){
    long long N,K;
    long long H[100000];
    long long memo[100000];
    scanf("%lld %lld", &N, &K);
    for (long long  i = 0; i < N; i++) memo[i] = -1;
    for (long long i = 0; i < N; i++) scanf("%lld", &H[i]);
    long long ans = rec(N - 1,H, K, memo);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 9472
//#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <utility>
#include <climits>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define F first
#define S second
#define OUT(x) cout << (x) << "\n"
using namespace std;
using point = pair< int,int >;
using ll = long long;

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    OUT(b - a == c - b ? "YES" : "NO");
    return 0;
}



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

int main(){
        int n;
        cin>>n;
        char ans[51];
        int anslen;
        for(int i=0; i<n; i++){
                string s;
                cin>>s;
                char c[51];
                int len=s.length();
                for(int i=0; i<len; i++) c[i]=s[i];
                sort(c, c+len);

                if(i==0){
                        for(int i=0; i<len; i++) ans[i]=c[i];
                        anslen=len;
                }
                else{
                        char *ap=ans;
                        char *np=ans;
                        char *cp=c;
                        while(ap!=ans+anslen && cp!=c+len){
                                if(*ap == *cp){
                                        *np = *ap;
                                        np++; ap++; cp++;
                                }
                                else if(*ap > *cp){
                                        cp++;
                                }
                                else if(*ap < *cp){
                                        ap++;
                                }
                        }
                        anslen=np-ans;
                }

        }
        for(int i=0; i<anslen; i++) cout<<ans[i];
        cout<<endl;
        return 0;
}


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

int main() {
    string s;
    cin >> s;

    if (s.at(0) == s.at(1) && s.at(2) == s.at(3) && s.at(0) != s.at(2)){
        cout << "Yes" << endl;
    }
    else if (s.at(0) == s.at(2) && s.at(1) == s.at(3) && s.at(0) != s.at(1)){
        cout << "Yes" << endl;
    }
    else if (s.at(0) == s.at(3) && s.at(1) == s.at(2) && s.at(0) != s.at(1)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

bool ok[410][410];
bool visited[410][410];

int H, W;
vector<string> S;

bool inBoard(int x, int y) {
    return x >= 0 && x < W && y >= 0 && y < H;
}

pair<int, int> dfs(int x, int y, char prev) {
    if (visited[y][x]) return mp(0, 0);
    if (S[y][x] == prev) return mp(0, 0);
    ok[y][x] = true;
    visited[y][x] = true;

    pair<int, int> ret(0, 0);
    if (S[y][x] == '.') ret.first++;
    else ret.second++;

    rep(dir, 4) {
        int nx = x + dx[dir];
        int ny = y + dy[dir];
        if (!inBoard(nx, ny)) continue;
        auto pr = dfs(nx, ny, S[y][x]);
        ret.first += pr.first;
        ret.second += pr.second;
    }

    return ret;
}

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

    inputVector(S, H);

    int ret = 0;
    rep(y, H) rep(x, W) {
        auto pr = dfs(x, y, S[y][x] == '.' ? '#' : '.');
        ret += pr.first * pr.second;
    }

    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 18304
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }

const int MOD = 1000000007;

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

signed main() {
    SS(string,s);
    Yes((regex_match(s, regex("(hi)+"))));
}

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

int main(){
    char s[100]={},p[100]={},w[100]={};
    int i,j,slen;

    cin >> s;
    cin >> p;
    slen = strlen(s);
    for(i=0;i<slen;i++){
        if(strstr(s,p) != NULL){
            cout << "Yes" << endl;
            break;
        }else{
            for(j=1;j<slen;j++){
                w[j-1] = s[j];
            }
            w[j-1] = s[0];
            strcpy(s,w);
        }
    }
    if(i == slen) cout << "No" << endl;
    return 0;

}



Measured memory_bytes: 3100
N,W = map(int,input().split())
w,v = [0]*N, [0]*N
for i in range(N):
    w[i], v[i] = map(int,input().split())
V = sum(v)
dp = [[float('inf')]*(V+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
    for j in range(V+1):
        if j>=v[i]:
            dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]]+w[i])
        else:
            dp[i+1][j] = dp[i][j]
ans = 0
for j in range(V+1):
    if dp[N][j] <= W:
        ans = j
print(ans)


Measured memory_bytes: 308168
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int i;
    for(i = 0;i < s.size();++i){
        if(i % 2 == 0){
            cout << s.at(i);
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
// ABC165C - Many Requirements

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

int N, M, Q;
int a[50], b[50], c[50], d[50];
int ans = 0;

void dfs(int i, int A[10]) {
	if (i == N) {
//		for (int i = 0; i < N; i++) {
//			cout << A[i] << " ";
//		}
//		cout << endl;
		int t = 0;
		for (int i = 0; i < Q; i++) {
			if (A[b[i]-1] - A[a[i]-1] == c[i]) {
				t += d[i];
			}
		}
		ans = max(ans, t);
		return;
	}
	for (int j = 0; A[i-1] + j <= M; j++) {
		A[i] = A[i-1] + j;
		dfs(i+1, A);
	}
}

int main() {
	cin >> N >> M >> Q;
	for (int i = 0; i < Q; i++) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}

	int A[10];

	A[0] = 1;
	dfs(1, A);

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		StringBuilder s,t;
		s= new StringBuilder(sc.next());
		t=new StringBuilder(sc.next());
		boolean flag=false;
		for(int i=0;i<s.length();i++) {
			s=new StringBuilder(Rotate(s));
			if(t.toString().equals(s.toString())) {
				flag=true;
				break;
			}
		}
		if(flag==true)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
	
	public static StringBuilder Rotate(StringBuilder str) {
		int len=str.length();
		char t=str.charAt(0);
		for(int i=0;i<len-1;i++) {
			str.setCharAt(i,str.charAt(i+1));			
		}
		str.setCharAt(len-1,t);
		return str;
	}
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

void solve(){
  ll a,b;
  cin >>a >> b;
  a+=b;
  cout << (a>=10?"error":to_string(a)) << endl;
}

int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}


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

int n;
long long dp[(1 << (1 << (1 << (1 << 1))))], a[(1 << (1 << (1 << 1)))][(1 << (1 << (1 << 1)))];
vector<pair<int, int> > v;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            cin >> a[i][j];
        }
    }
    for(int btm = 0; btm < (1 << n); ++btm) {
        for(int i = 0; i < n; ++i) {
            for(int j = 0; j < i; ++j) {
                if((1 << i) & btm && (1 << j) & btm) {
                    dp[btm] += a[i][j];
                }
            }
        }
        for(int i = 0, tmp = 0; i < n; ++i) {
            if((1 << i) & btm) {
                ++tmp;
            }
            v.push_back({tmp, btm});
        }
    }
    sort(v.begin(), v.end());
    for(int i = 0, btm = 0; i < v.size(); ++i) {
        btm = v[i].second;
        for(int sbm = (btm - 1) & btm; sbm; (--sbm) &= btm) {
            dp[btm] = max(dp[btm], dp[sbm] + dp[btm ^ sbm]);
        }
    }
    cout << dp[(1 << n) - 1] << endl;
    return 0;
}

Measured memory_bytes: 10732
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=1; i<=(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    ll A,B,C;
    cin>>A>>B>>C;
    if(A%2==0||B%2==0||C%2==0) cout<<0<<endl;
    else {
        vector<ll> v;
        v.pb(A);
        v.pb(B);
        v.pb(C);
        sort(all(v));
        cout<<v[0]*v[1]<<endl;
    }
}

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

#define ll long long
#define ull unsigned long long
#define pb push_back
#define pf push_front
#define pof pop_front
#define pob pop_back
#define mp make_pair
#define pll pair<ll,ll>
#define pii pair<int,int>
#define all(s) s.begin(),s.end()
#define vll vector<ll>
#define vi vector<int>
#define vpii vector<pii>
#define vpll vector<pll>
#define vd vector<double>
#define vull vector<ull>
#define vc vector<char>
#define vs vector<string>
#define fi first
#define se second
#define sz(x) x.size()
#define cinarr(n,a) for(int i = 0; i < n; i++) cin >> a[i];
#define coutarr(n,a) for(int i = 0; i < n; i++) cout << a[i] << (i+1==n?'\n':' ');
#define fori(i,a,b,x) for(int i = a; i <= b; i+=x)
#define ford(i,a,b,x) for(int i = a; i >= b; i-=x)
#define tc int t; cin >> t; for(int cs = 1; cs <= t; cs++)
#define IOS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define ld long double
#define reset(x,y) memset(x,y,sizeof x);
#define sqr(x) 1LL*(x)*(x)
#define cube(x) 1LL*(x)*(x)*(x)
#define ub(v, a) upper_bound(all(v), a)
#define lb(v, a) lower_bound(all(v), a)
#define EPS 1e-10
#define INF 2000000000
#define mod 1000000007
#define minof(a) min_element(all(a))
#define maxof(a) max_element(all(a))
#define debug(val) cerr << "The value of " << #val << " is = " << val << endl;
#define testing cerr << "--------------------------\n";

//input space ---> scanf("%[^\n]%*c",s);

int main() {
	IOS
	int n;
	cin >> n;
	for(int i = 1; i <= 9; i++) {
		if(n % i == 0) {
			if(n/i <= 9) {
				cout << "Yes\n";
				return 0;
			}
		}
	}
	cout << "No\n";
}


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

using namespace std;

#define F first
#define S second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define endl '\n'

typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<string,ll> si;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<si> vsi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vsi> vvsi;

const int INF = 2000000000;
const ll INFLL = 1LL * INF * INF;
ll mod = (int)pow(10,9)+7;
// ll mulmod(ll a, ll b, ll mod) 
// { 
//     ll res = 0; // Initialize result 
//     a = a % mod; 
//     while (b > 0) 
//     { 
//         // If b is odd, add 'a' to result 
//         if (b % 2 == 1) 
//             res = (res + a) % mod; 
  
//         // Multiply 'a' with 2 
//         a = (a * 2) % mod; 
  
//         // Divide b by 2 
//         b /= 2; 
//     } 
  
//     // Return result 
//     return res % mod; 
// } 
// bool sieve[100005];

// void sieveoferat()
// {
// 	for(ll p = 2; p*p<100005 ; p++)
// 	{
// 		if(sieve[p])
// 		{
// 			for(int j = p*p; j<100005; j+=p)
// 				sieve[j] = false;
// 		}
// 	}
// }

// void dp(sp_1, sp_2.....)
// {
// 	if()//exit statement
// 	if()//using the memoization 
// 	ll ans = //default/dummy answer
// 	//recursions
// 			//max/min
// 	return memo[][].. = ans;

// }

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
 	cout.tie(NULL);
 	//memset(memo, -1, sizeof memo);
 	// memset(sieve, true, sizeof sieve);
 	// sieveoferat();
 	string s; cin>>s;
 	ll a[4];
 	bool hard = false;
 	for(int i =0  ; i<4 ; i++)
 		a[i] = s[i] -48;
 	for(int i =1  ; i<4 ; i++)
 		if(a[i]==a[i-1])
 			hard = true;
 	if(hard)
 		cout<<"Bad\n";
 	else
 		cout<<"Good\n";
 	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n, h, w;
  cin >> n >> h >> w;
  ll ans = (n - h + 1) * (n - w + 1);
  print(ans);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef vector<int> vint;
#define rep(i,n) for(lint i = 0;i < n;i++)
#define all(x) x.begin(),x.end()
#define clr(a) memset(a,0,sizeof(a))
#
int main(void){
    lint N,A,B;
    cin >> N;
    if(N == 1)
        cout << "Hello World";
    else{
        cin >> A >> B;
        cout << A+B;
    }
    return 0;
}
/*
ループ for(lint i = 0;i < N;i++)
ソート sort(a,a+N);
*/

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>

int main(){
    char ch;
    while(1){
        scanf("%c", &ch);
        if(ch=='\n'){
            printf("\n");
            break;
        }else if(islower(ch)){
            printf("%c", toupper(ch));
        }else if(isupper(ch)){
            printf("%c", tolower(ch));
        }else{
            printf("%c", ch);
        }
    }

    return 0;
}


Measured memory_bytes: 2104
import java.util.Scanner;

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

        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int K = Integer.parseInt(sc.next());
        int cnt = 0;

        for (int i = Math.min(A, B); i >= 1; i--) {
            if (A % i == 0 && B % i == 0) {
                cnt++;
                if (cnt == K) {
                    System.out.println(i);
                    return;
                }
            }
        }
    }
}

Measured memory_bytes: 21844