akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll INF = 1LL << 58;

//xより以下の要素へのindex
template <class T> int former(const vector<T> &v, T x) {
  return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
//x以上の要素へのindex
template <class T> int latter(const vector<T> &v, T x) {
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;
    ll mod=pow(10,9)+7;
    cin>>h>>w;
    vector<vector<char> > a(h+1,vector<char>(w+1,'#'));
    vector<vector<ll> > dp(h+1,vector<ll>(w+1,0));
    FOR(i,1,h+1){
        FOR(j,1,w+1){
            cin>>a[i][j];
        }
    }
    FOR(i,1,h+1){
        FOR(j,1,w+1){
            if ((a[i][j-1]=='#'&&a[i-1][j]=='#')||a[i][j]=='#'){//左も上も壁の時その場所には行けない
                dp[i][j]=0;
            }else if(a[i][j-1]=='#'){//左が壁の時
                dp[i][j]=dp[i-1][j]%mod;
            }else if(a[i-1][j]=='#'){//上が壁の時
                dp[i][j]=dp[i][j-1]%mod;
            }else{
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
            }
            dp[1][1]=1;
        }
    }
    cout<<dp[h][w]<<endl;
}

Measured memory_bytes: 9216
a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
a3,b3=map(int,input().split())
A=[]
A.append(a1)
A.append(b1)
A.append(a2)
A.append(b2)
A.append(a3)
A.append(b3)
if A.count(a1)==3 or A.count(b1)==3:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 3064
import scala.io.StdIn

object Main {

  type State = Tuple3[Int, Int, Long]

  def update(state: State, num: Int): State = {
    val isMinus = if (num >= 0) 0 else 1
    val absNum = Math.abs(num)
    val sum = state._3 + (absNum: Long)

    Tuple3(state._1 + isMinus, if (state._2 >= absNum) absNum else state._2, sum)
  }

  def maxPossibleValue(state: State): Long = {
    if (state._1 % 2 == 0) state._3 else state._3 - (2 * state._2: Long)
  }

  def main(args: Array[String]): Unit = {
    val n = StdIn.readLine.toInt
    val as = StdIn.readLine.split(" ").map(_.toInt)

    println(maxPossibleValue(as.foldLeft((0, Int.MaxValue, 0): State)(update)))
  }
}

Measured memory_bytes: 50548
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
void Train() {
	int N, i;
	cin >> N >> i;
	cout << N - i + 1 << "\n";
}

int main() {
	Train();
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    long int W, H, x, y, ans;
    scanf("%ld %ld %ld %ld",&W,&H,&x,&y);
    if(2*x==W && 2*y==H){
        ans = 1;
    }
    else{
        ans = 0;
    }
    printf("%lf %ld\n", W*H/2.0, ans);

    return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		PrimeNumberGenerator pg = new PrimeNumberGenerator();
		while(true){
			String[] tmpArray = br.readLine().split(" ");
			int n = Integer.parseInt(tmpArray[0]);
			int p = Integer.parseInt(tmpArray[1]);
			
			if(n == -1 && p == -1){
				break;
			}
			
			int primes[] = pg.primeOverN(n, 100);
			
			int[] sum = sumOfPrimes(primes);
//			for(int i = 0; i < sum.length ; i++){
//				System.out.print(sum[i]+" ");
//			}
//			
//			System.out.println();
			
			System.out.println(sum[p - 1]);
			
		}
	}
	
	static int[] sumOfPrimes(int[] primes){
		int n = primes.length;
		int[] result = new int[n*(n + 1)/2];
		
		int index = 0;
		for(int i = 0; i < n; i++){
			for(int j = i; j < n; j++){
				result[index++] = primes[i] + primes[j];
//				System.out.println("add "+primes[i]+" + " + primes[j]);
			}
		}
		
		Arrays.sort(result);
		return result;
	}

}

class PrimeNumberGenerator {
    private boolean[] isPrime= new boolean[10000000];
 
    public PrimeNumberGenerator() {
        //Date from = new Date();
        Arrays.fill(isPrime, true);
 
        isPrime[0] = false;
        isPrime[1] = false;
        isPrime[2] = true;
 
        for(int i = 3; i <= Math.sqrt( isPrime.length ); i+=2){
            /*
            if(i % 2 == 0){
                isPrime[i] = false;
                continue;
            }
            */
 
            if(isPrime[i] == false){
                continue;
            }
 
            for(int j = i * 2; j <= isPrime.length - 1; j += i){
                isPrime[j] = false;
            }
        }
        //Date to = new Date();
        //System.out.println("init takes "+ (to.getTime() - from.getTime())+ "milli sec");
    }
    
    public int[] primeOverN(int n, int size){
    	int[] result = new int[size];
    	
    	int index = 0;
    	for(int i = n + 1; index != size ; i++ ){
    		if(i != 2 && i % 2 == 0){
    			continue;
    		}
    		if(isPrime[i]){
    			result[index] = i;
    			index++;
    		}
    	}
    	return result;
    }
 
    public boolean isPrime(int index){
        if(index % 2 == 0 && index != 2){
            return false;
        }
        return isPrime[index];
    }
}

Measured memory_bytes: 69204
#include <stdio.h>

int main(void)
{
	int x,y;
	int i;
	int count=0;
		
	scanf("%d",&x);
	scanf("%d",&y);
	
	if((y%2==0&&y/2==x)||(y%4==0&&y/4==x))
	{
	count++;
	}
	else
	{
		for(i=1;i<x;i++)
		{
			if(   (2*i+4*(x-i))   ==y)
			{
				count++;
			}
		}
	}
	
	if(count!=0)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
}

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

int main() {
  string S;
  char n;
  int cnt(0);
  cin>>S;
  n=S[0];
  for (int i(1);i<S.size();i++){
    if(n!=S[i]){
      cnt+=1;
    }
    n=S[i];
  }
  cout << cnt;
}

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

//ユークリッドの互除法
int GCD(int x, int y){
    if( x % y == 0 ){
        return y;
    }
    return GCD( y , x % y );
}

//O(A+NloglogN)解
int main(){
    using namespace std;
    int MAX_A = 1000000;
    vector<int> lowerst_prime(MAX_A + 1, 1e9);//最小の素因数をいれる(2以上をみていけばいい)
    vector<int> count(MAX_A + 1, 0);//約数として出てくる回数を数える
    for(int i = 2; i <= MAX_A; i++){//エラトステネスの篩
        if(lowerst_prime[i] != 1e9) continue;
        lowerst_prime[i] = i;
        for(long long j = (long long)i * i; j <= MAX_A; j += i){//i * iスタートでいいのは、i * bはbの約数でもあるため
            lowerst_prime[j] = min(lowerst_prime[j], i);
        }
    }
    //入力
    int N;
    cin >> N;
    vector<int> A(N);
    int setwise_gcd = 0;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        //setwise判定
        setwise_gcd = GCD(setwise_gcd, A[i]);//定義から、i == 0 ではA[0]を返す
    }
    if(setwise_gcd != 1){
        cout << "not coprime" << endl;
        return 0;
    }
    for(int i = 0; i < N; i++){
        while(A[i] > 1){
            int divide = lowerst_prime[A[i]];
            count[divide]++;
            while(A[i] % divide == 0){//割れるだけ割る
                A[i] /= divide;
            }
        }
    }
    for(int i = 0; i <= MAX_A; i++){
        if(count[i] >= 2){
            cout << "setwise coprime" << endl;
            return 0;
        }
    }
    cout << "pairwise coprime" << endl;
}

Measured memory_bytes: 14804
#include<bits/stdc++.h>
using namespace std;
int main()
{   
    int a,b,c,cot=0;
    cin>>a>>b>>c;
    for(int i=a;i<=b;i++){
        if(c%i==0)
            cot++;
    }
    cout<<cot<<endl;
    return 0;
}


Measured memory_bytes: 3096
def isnew(done, a, i):
    if done[a[0]][a[1]] == i:
        return False
    else:
        return True


h, w, n = map(int, input().split())

arr = []

s = [0, 0]

done = [[0 for i in range(w)] for j in range(h)]

for i in range(h):
    a = input()
    for j in range(w):
        if a[j] == 'S':
            s = [i, j]
    arr.append(a)
    
step = 0
    
for i in range(1, n+1):
    pre = [s]
    now = []
    f = 0
    while f == 0:
        step += 1
        for j in range(len(pre)):
            if pre[j][0] != 0:
                p = arr[pre[j][0]-1][pre[j][1]]
                pp = [pre[j][0]-1, pre[j][1]]
                if p == str(i):
                    s = pp
                    f = 1
                    break
                elif p != 'X' and isnew(done, pp, i):
                    now.append(pp)
                    done[pre[j][0]-1][pre[j][1]] = i

            if pre[j][0] != h-1:
                p = arr[pre[j][0]+1][pre[j][1]]
                pp = [pre[j][0]+1, pre[j][1]]
                if p == str(i):
                    s = pp
                    f = 1
                    break
                elif p != 'X' and isnew(done, pp, i):
                    now.append(pp)
                    done[pre[j][0]+1][pre[j][1]] = i

            if pre[j][1] != 0:
                p = arr[pre[j][0]][pre[j][1]-1]
                pp = [pre[j][0], pre[j][1]-1]
                if p == str(i):
                    s = pp
                    f = 1
                    break
                elif p != 'X' and isnew(done, pp, i):
                    now.append(pp)
                    done[pre[j][0]][pre[j][1]-1] = i

            if pre[j][1] != w-1:
                p = arr[pre[j][0]][pre[j][1]+1]
                pp = [pre[j][0], pre[j][1]+1]
                if p == str(i):
                    s = pp
                    f = 1
                    break
                elif p!= 'X' and isnew(done, pp, i):
                    now.append(pp)
                    done[pre[j][0]][pre[j][1]+1] = i
            

        pre = []
        for k in range(len(now)):
            temp = []
            for l in range(2):
                temp.append(now[k][l])
            pre.append(temp)
        now = []
                
                

print(step)


Measured memory_bytes: 15512
#include <stdio.h>

int x,y,ans,ans2;
int main()
{
    #ifdef NOT_DMOJ
    freopen("data.txt","r",stdin);
    #endif // NOT_DMOJ
    scanf("%d%d",&x,&y);
    if (x==y) {
        printf("0");
        return 0;
    }
    // x to y
    if (x<y) ans=y-x;
    else ans=x-y+2;
    // -x to y
    x*=-1;
    if (x==y) {
        printf("1");
        return 0;
    }
    if (x<y) ans2=y-x;
    else ans2=x-y;
    ans2++;
    if (ans>ans2) ans=ans2;
    printf("%d",ans);
}


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

int main() {
    int w, h, n;
    scanf("%d %d %d", &w, &h, &n);

    int x, y, a;
    int max_x = w, min_x = 0, max_y = h, min_y = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d %d %d", &x, &y, &a);
        if (a == 1) min_x = max(min_x, x);
        else if (a == 2) max_x = min(max_x, x);
        else if (a == 3) min_y = max(min_y, y);
        else if (a == 4) max_y = min(max_y, y);
    }

    int nw = max(max_x - min_x, 0);
    int nh = max(max_y - min_y, 0);
    printf("%d\n", nw * nh);
}

Measured memory_bytes: 3784
k = gets.to_i
 
AB = gets
arrayAB = AB.split(" ")
 
IntA = arrayAB[0].to_i
IntB = arrayAB[1].to_i
 
message = ""
 
for i in IntA..IntB do   
  if i % k ==  0
    message = "OK"
    break
  end
end
 
if message.empty?
	message = "NG"
end
 
puts(message)

Measured memory_bytes: 14340
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
    vector <long long> v;
    long long ans=0;
    int n,k,y; cin>> n>>k;
    y=n;
    while (y--){
        long long x; cin>>x;
        v.push_back(x);
    }
    if (k>=n)
        cout<<0;
    else {
    sort (v.begin(), v.end());
    for (int i=0; i<v.size()-k; i++)
        ans+=v[i];
    cout<< ans;
    }
         return 0;
}

Measured memory_bytes: 2420
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[]) {
  string S, T;
  cin >> S >> T;
  if (T.size() > S.size()) {
    cout << "UNRESTORABLE" << endl;
    return 0;
  }
  vector<string> ans;
  for (size_t i = 0; i < S.size() - T.size() + 1; i++) {
    string temp = S.substr(0, i);
    bool is_all_ok = true;
    for (size_t j = 0; j < T.size(); j++) {
      if (S[i + j] == T[j] || S[i + j] == '?') {
        temp.push_back(T[j]);
      } else
        is_all_ok = false;
    }
    if (is_all_ok) {
      string sub = S.substr(i + T.size(), S.size() - T.size());
      temp += sub;
      ans.push_back(temp);
    }
  }
  if (ans.empty()) {
    cout << "UNRESTORABLE" << endl;
    return 0;
  }
  string out = "|";
  for (size_t i = 0; i < ans.size(); i++) {
    for (size_t j = 0; j < ans[i].size(); j++) {
      if (ans[i][j] == '?') ans[i][j] = 'a';
    }
    if (out > ans[i]) out = ans[i];
  }
  cout << out << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

#define double long double

int main() {
  constexpr double inf = 1e100;

  cin.tie(nullptr); ios::sync_with_stdio(false);
  int w, h; cin >> w >> h;
  V<string> s(h); for (auto&& e : s) cin >> e;
  int si = -1, sj = -1, gi = -1, gj = -1;
  for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) if (s[i][j] == 'g') {
    gi = i, gj = j;
  } else if (s[i][j] == 's') {
    si = i, sj = j;
  }
  VV<> d(h, V<>(w, -1));
  d[gi][gj] = 0;
  queue< pair<int, int> > que;
  que.emplace(gi, gj);
  while (not que.empty()) {
    int i, j;
    tie(i, j) = que.front(); que.pop();
    for (int di = -1; di <= 1; ++di) for (int dj = -1; dj <= 1; ++dj) if (abs(di) + abs(dj) == 1) {
      int ni = i + di, nj = j + dj;
      if (s[ni][nj] != 's' and s[ni][nj] != '.') continue;
      if (d[ni][nj] != -1) continue;
      d[ni][nj] = d[i][j] + 1;
      que.emplace(ni, nj);
    }
  }
  VV<> e(h, V<>(w, -1));
  for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) if (s[i][j] == '*') {
    e[i][j] = 0;
    que.emplace(i, j);
  }
  while (not que.empty()) {
    int i, j;
    tie(i, j) = que.front(); que.pop();
    for (int di = -1; di <= 1; ++di) for (int dj = -1; dj <= 1; ++dj) if (abs(di) + abs(dj) == 1) {
      int ni = i + di, nj = j + dj;
      if (s[ni][nj] != 's' and s[ni][nj] != '.') continue;
      if (e[ni][nj] != -1) continue;
      e[ni][nj] = e[i][j] + 1;
      que.emplace(ni, nj);
    }
  }
  double ng = 0, ok = inf;
  while (true) {
    double mid = (ng + ok) / 2;
    double num = 0, den = 0;
    for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) if (s[i][j] == 's' or s[i][j] == '.') {
      num += min<double>(d[i][j] == -1 ? inf : d[i][j], (e[i][j] == -1 ? inf : e[i][j]) + mid);
      den += 1;
    }
    (num / den < mid ? ok : ng) = mid;
    if ((ok - ng) / ok < 1e-10) break;
  }
  double res = min<double>(d[si][sj] == -1 ? inf : d[si][sj], (e[si][sj] == -1 ? inf : e[si][sj]) + ok);
  cout << fixed << setprecision(15) << res << '\n';
}


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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define per(i, b) per2(i, 0, b)
#define per2(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define ALL(c) (c).begin(), (c).end()
#define SZ(x) ((int)(x).size())

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

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

    rep(p, 2) {
        rep(q, 2) {
            V<int> state(N);
            state[0] = p, state[1] = q;
            for (int i = 2; i < N; ++i) {
                state[i] = (s[i - 1] == 'x') ^ state[i - 1] ^ state[i - 2];
            }
            bool ok = 1;
            if ((s[0] == 'x') != (state[0] ^ state[1] ^ state[N - 1])) {
                ok = 0;
            }
            if ((s[N - 1] == 'x') != (state[N - 1] ^ state[N - 2] ^ state[0])) {
                ok = 0;
            }
            if (ok) {
                rep(i, N) printf("%c", state[i] ? 'W' : 'S');
                puts("");
                return 0;
            }
        }
    }
    puts("-1");

    return 0;
}

Measured memory_bytes: 1016
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }

const int mod=1000000007;

int main() {
  string s;
  cin>>s;
  if(s=="RRR"){cout<<3<<endl;}
  else if(s=="RRS"||s=="SRR"){cout<<2<<endl;}
  else if(s[0]=='R'||s[1]=='R'||s[2]=='R'){cout<<1<<endl;}
  else{cout<<0<<endl;}
  return 0;
}


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

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
	if b[i] <= a[i]:
		ans += b[i]
	else:
		b[i] -= a[i]
		ans += a[i]
		if b[i] >= a[i+1]:
			ans += a[i+1]
			a[i+1] = 0
		else:
			ans += b[i]
			a[i+1] -= b[i]
print(ans)

Measured memory_bytes: 73316
h, w = gets.strip.split.map(&:to_i)
pics = []
pics << '.' * (w + 2)
h.times do
  pics << '.' + gets.strip + '.'
end
pics << '.' * (w + 2)

ok = true
for i in 1..h
  for j in 1..w
    p = pics[i][j]
    next if p != '#'
    left = pics[i][j - 1]
    right = pics[i][j + 1]
    up = pics[i - 1][j]
    down = pics[i + 1][j]
    ok = false if left == '.' && right == '.' && up == '.' && down == '.'
  end
end

puts ok ? 'Yes' : 'No'


Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>

// int max: 2 x 10^9, long long max: 9 x 10^18

using namespace std;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main()
{
  int n,m;
  cin >> n >> m;
  vector<int> x(m), y(m), z(m);
  
  for(int i=0; i<m; i++){
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    x[i] = a; y[i] = b; z[i] = c;
  }
  
  UnionFind u(n);
  for(int i=0; i<m; i++){
    u.unite(x[i], y[i]);
  }
  
  set<int> s;
  for(int i=0; i<n; i++){
    s.insert(u.root(i));
  }
  
  cout << s.size() << endl;

  return 0;
}

Measured memory_bytes: 8768
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let s: String = cin
        .bytes() // Bytes
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace()) // c が whitespace である限り skip
        .take_while(|c| !c.is_whitespace()) // c が whitespace でない限り要素を返す
        .collect();
    s.parse().ok().expect("failed parsing")
}

#[allow(non_snake_case)]
fn main() {
    input! {
        A:usize,
        B:usize,
    }
    let B = B - 1;
    let ans = B / (A - 1) + (B % (A - 1) != 0) as usize;
    println!("{}", ans);
}


Measured memory_bytes: 4352
from math import factorial

N, M = list(map(int, input().split()))
perm_N, perm_M = 1, 1
mod = 10**9 + 7
for i in range(1, N+1):
    perm_N = perm_N * i % mod
for i in range(1, M+1):
    perm_M = perm_M * i % mod
if abs(N-M) == 1:
    print(perm_N*perm_M%mod)
elif N == M:
    print(perm_N*perm_M*2%mod)
else:
    print(0)


Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int cnt = 0;
        for (char c : s.toCharArray()) {
            if (c == '1')cnt++;
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

const double TAU = atan2(0, -1) * 2.0;

int main() {
	IN(int, a, b, h, m);
	
	cout.precision(12);
	OUT(sqrt(a * a + b * b - 2 * a * b * cos(TAU * (11 * m - 60 * h) / 720.0)));
}


Measured memory_bytes: 4176
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
#include <iterator>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 100000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string ab = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string as = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

  for(int i=0; i<len; ++i) {
    cout << array[i] << endl;
  }

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------
//提出するときC++に帰る
//--------------------------



int main() {

  long double A, B;
  cin >> A >> B;
  cout << (ll)(A*B+0.001) << endl;

  return 0;
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define FOR(i,a,n) for(int i=a,i##_len=(int)n;i<i##_len;++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define SZ(c) ((int)c.size())
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0}, DY[9]={-1,0,1,0,-1,1,1,-1,0};
const int INF=1e9*2; const long long INFLL=1e18*2;
template<class T> ostream& operator << (ostream &os, const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is, vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.second >> p.first; return is; }
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//------------------------------------------------------------------------------

signed main() {
    string s;
    cin>>s;
    string boin="aeiou";
    bool f=false;
    FORE(x,boin) {
        if(s[0]==x) f=true;
    }
    cout<<(f?"vowel":"consonant")<<endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

const int MAX_N = 3001;

int N;
ll a[MAX_N];
ll dp[MAX_N][MAX_N][2];

int main() {
  scanf("%d", &N);
  for(int i = 0; i < N; ++i) scanf("%lld", &a[i]);

  for(int i = 0; i < N; ++i) dp[i][i][0] = dp[i][i][1] = a[i];
  
  for(int d = 1; d < N; ++d) {
    for(int p = 0; p < 2; ++p) {
      for(int i = 0; i + d < N; ++i) {
        int j = i + d;
        dp[i][j][p] = max(a[i] - dp[i + 1][j][1 - p], a[j] - dp[i][j - 1][1 - p]);
      }
    }
  }
  
  printf("%lld\n", dp[0][N - 1][0]);
  return 0;
}

Measured memory_bytes: 85516
from itertools import combinations
import sys
n, k = map(int, input().split())

if (n-1) * (n-2) // 2 < k:
    print(-1)
    sys.exit()

n_add  = (n-1) * (n-2) // 2 - k
print(n_add + n - 1)

for i in range(2, n+1):
    print(1, i)

for i, (v1, v2) in enumerate(combinations(range(2, n+1), 2)):
    if i == n_add:
        break
    print(v1, v2)


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

void QuickSort(double *a, int left, int right){
  if(right - left <= 1) return;

  int pivot_index = (left + right) / 2;
  int pivot = a[pivot_index];
  swap(a[pivot_index],a[right-1]);

  int i = left;
  for(int j = left; j < right - 1; ++j){
    if (a[j] < pivot){
      swap(a[i],a[j]);
      i++;
    }
  }
  swap(a[i],a[right - 1]);

  QuickSort(a,left,i);
  QuickSort(a,i + 1,right);

}

int main()
{
  int i,n;
  cin>>n;
  double a[100];
  for(i=0;i<n;i++) cin>>a[i];
  double ans;

  QuickSort(a,0,n);

  ans = a[0];
  for(i=0;i<n-1;i++){
    ans = (ans+a[i+1]) / 2;
  }

  cout<<ans<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// const long double PI = acos(-1);
constexpr int inf = 1e9;
constexpr ll INF = 2e18;
// constexpr ll MOD = 1e9+7;
constexpr ll MOD = 998244353;

int n,m;
vector<int> G[100010];
ll value[100010];
bool used[100010];

void input() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> value[i];
    for (int i = 0; i < m; i++) {
        int x,y;
        cin >> x >> y;
        G[x].push_back(y);
        G[y].push_back(x);
    }
}

void get_block(int k, vector<ll> &v) {
    if (used[k]) return;
    used[k] = 1;
    v.push_back(value[k]);
    for (int i = 0; i < G[k].size(); i++) {
        get_block(G[k][i], v);
    }
}

void solve() {
    vector<vector<ll>> vb;
    vector<ll> single;

    if (m < (n + 1) / 2 - 1) {
        cout << "Impossible" << endl;
        return;
    }

    //divide blocks
    for (int i = 0; i < n; i++) {
        if (!used[i]) {
            vector<ll> v;
            get_block(i,v);
            if (v.size() == 1) {
                single.push_back(v[0]);
                continue;
            }
            sort(v.begin(), v.end());
            vb.push_back(v);
        }
    }

    if (single.size() + vb.size() == 1) {
        cout << 0 << endl;
        return;
    }

    multiset<ll> st;
    for (int i = 0; i < vb[0].size(); i++) {
        st.insert(vb[0][i]);
    }
    ll ans = 0;
    for (int i = 1; i < vb.size(); i++) {
        if (st.empty()) {
            cout << "Impossible" << endl;
            return;
        }
        ll mi = *st.begin();
        st.erase(st.find(mi));
        ans += mi + vb[i][0];
        for (int j = 1; j < vb[i].size(); j++) {
            st.insert(vb[i][j]);
        }
    }

    for (int i = 0; i < single.size(); i++) {
        if (st.empty()) {
            cout << "Impossible" << endl;
            return;
        }
        ll mi = *st.begin();
        st.erase(st.find(mi));
        ans += mi + single[i];
    }

    cout << ans << endl;
}

int main(int argc, char *argv[]) {
    input();
    solve();
    return 0;
}


Measured memory_bytes: 12136
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

typedef pair<int,int> pii;

bool cmp(pii a, pii b){
    if(a.first != b.first){
        return a.first < b.first;
    } else {
        return a.second > b.second;
    }
}

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

    int n,m; cin >> n >> m;
    std::vector<pii> v(0);

    rep(i,n){
        int a,b; cin >> a >> b;
        v.push_back(pii(a,b));
    }

    sort(v.begin(), v.end(), cmp);

    // cout << " " << endl;
    // rep(i,n){
    //     cout << v[i].first << " " <<  v[i].second << endl;
    // }

    priority_queue<int> q;
    ll count = 0LL;

    int j = 0;
    rep(i,m){
        int day = i+1;

        while(v[j].first <= day && j<n){
            q.push(v[j].second);
            j++;
        }

        count += q.empty() ? 0 : q.top();
        if(!q.empty()) q.pop();
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 1908
N, Q = map(int, input().split())
S = input()

left = [0 for _ in range(N+1)]

for i in range(1, N+1):
    left[i] = left[i-1]
    if S[i-1:i+1] == "AC":
        left[i] += 1

for _ in range(Q):
    l, r = map(int, input().split())

    print(left[r-1] - left[l-1])


Measured memory_bytes: 6160
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
B = list(map(int, input().split()))

m = max(B)
f = False
ans = []
for _ in reversed(range(N)):
    for j in reversed(range(len(B))):
        if B[j] == j+1:
            ans.append(B.pop(j))
            f = True
            break
    if f:
        f = False
        continue
    else:
        print(-1)
        exit()
print("\n".join(map(str, reversed(ans))))


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

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

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;
    int l[m],r[m];
    ll min = INF, max = 0;
    REP(i,m)
    {
        int l,r;
        cin >> l >>r;
        if (l > max)
            max = l;
        if (r < min)
            min = r;
    }
    if (min < max)
        cout << 0 << endl;
    else
        cout << min - max + 1 << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
using System.Collections.Generic;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var a = ReadLine().Split(" ");
        var x = int.Parse(a[0]);
        var y = int.Parse(a[1]);

        for (int i = 0; i <= x ; i++)
        {
            var legs = 0;
            legs = 4*i + 2 * (x - i);
            if(legs == y)
            {
                WriteLine("Yes");
                return;
            }
        }
        WriteLine("No");
    }
}


Measured memory_bytes: 27520
# -*- coding: utf-8 -*-
 
N = int(input())

zorome = 0
ans_chk = 0
for i in range(N):
  D = list(map(int,input().split()))
  if ( D[0]==D[1] ):
    if   ( zorome==0 ):
      zorome = 1
    elif ( zorome==1 ):
      zorome = 2
    elif ( zorome==2 ):
      zorome = 3
      print('Yes')
      ans_chk = 1
      break
  else:
    zorome = 0

if ( ans_chk==0 ):
  print('No')
  

Measured memory_bytes: 9184
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>

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

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

#include<algorithm>
#define MAX_N 8
bool G[MAX_N][MAX_N] = {false};
int order[MAX_N];

void permutation(int n){
    for(int i=0; i<n; i++){
        order[i]=i;
    }
    
    int res=0;
    do{
        if(order[0] != 0) continue;
        bool ok=true;
        /* ここにpermの処理を書く */
        for(int i=0; i+1<n; i++){
            int from = order[i];
            int to = order[i+1];
            
            if(!G[from][to]) ok=false;
        }
        if(ok) res++;
    }while(next_permutation(order, order+n));
    
    cout << res << endl;
}

int main(int argc, const char * argv[]) {
    int n, m;
    cin >> n >> m;
    
    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a][b]=true;
        G[b][a]=true;
    }
    
    permutation(n);
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
  
int N;
vector<int> A, B;

map<vector<int>, int> bfs(vector<int> start) {
  map<vector<int>, int> memo;
  queue< vector<int> > Q;
  Q.push(start);
  memo[start] = 0;
  
  while(!Q.empty()) {
    vector<int> vi = Q.front();
    Q.pop();

    int cost = memo[vi];
  
    if(cost >= (N - 1) / 2) continue;
    
    for(int i = 0; i < N; i++) {
      for(int j = i + 2; j <= N; j++) {
        vector<int> tmp = vi;
        reverse(tmp.begin() + i, tmp.begin() + j);
        if(memo.find(tmp) == memo.end()) {
          memo[tmp] = cost + 1;
          Q.push(tmp);
        }
      }
    }
  }
  
  return memo;
}

int solve() {
  int ans = N - 1;
  map<vector<int>, int> memo_A = bfs(A);
  map<vector<int>, int> memo_B = bfs(B);
  if(memo_A.find(B) != memo_A.end()) ans = memo_A[B];
  else {
    do {
      if(memo_A.find(B) == memo_A.end()) continue;
      if(memo_B.find(B) == memo_B.end()) continue;
      ans = min(ans, memo_A[B] + memo_B[B]);
    } while(next_permutation(B.begin(), B.end()));
  }
  return ans;
}

int main() {
  cin >> N;
  rep(i, N) {
    int a;
    cin >> a;
    A.push_back(a);
  }
  B = A;
  sort(B.begin(), B.end());
  cout << solve() << endl;
  return 0;
}

Measured memory_bytes: 81196
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  int N=s.size();
  int M=t.size();
  vector<int>A(N+1);A[0]=0;
  for(int i=1;i<=N;i++)
    if(s.at(i-1)=='B')
      A[i]=(A[i-1]+1)%3;
  else
    A[i]=(A[i-1]+2)%3;
  vector<int>B(M+1);B[0]=0;
  for(int i=1;i<=M;i++)
    if(t.at(i-1)=='B')
      B[i]=(B[i-1]+1)%3;
  else
    B[i]=(B[i-1]+2)%3;
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
  int a,b,c,d;cin>>a>>b>>c>>d;
    int j=(A[b]-A[a-1]-B[d]+B[c-1]+12)%3;
    if(j==0)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
   }
  return 0;
}

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

#define INF 1234567890
#define ll long long

int A, B, C, K;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> A >> B >> C >> K;
	int val, res = 0;
	val = min(A, K); res += val; K-=val;
	val = min(B, K); K-=val;
	val = min(C, K); res -= val; K-=val;
	cout << res;
	return 0;
}

Measured memory_bytes: 3612
/// 1行の文字を空白で分割してVec<T>にする。
fn read_split<T : std::str::FromStr>() -> Vec<T> {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}

fn read_one<T : std::str::FromStr>() -> T {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().parse().ok().unwrap()
}

fn main() {
    let input : i32 = read_one();
    let towns : Vec<i64> = read_split();
    let heros : Vec<i64> = read_split();
    let mut count : i64 = 0;
    let mut remnant : i64 = towns[0];
    for i in 0..input {
        let (result, remnant1) = action(heros[i as usize], remnant, towns[(i + 1) as usize]);
        remnant = remnant1;
        count += result;
    }
    println!("{}", count);
}

fn action(power : i64, town1 : i64, town2 : i64) -> (i64, i64) {
    if power <= town1 {
        return (power, town2);
    }
    if power >= town1 + town2 {
        return (town1 + town2, 0);
    }
    (power, town1 + town2 - power)
}

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

#define Fast           ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO             freopen("in.txt", "r", stdin)
#define FC             freopen("out.txt", "w", stdout)
#define aise           cout<<"aise"<<endl
#define pb             push_back
#define pf             push_front
#define ppb            pop_back
#define ppf            pop_front
#define mp             make_pair
#define ll             long long
#define all(x)         x.begin(), x.end()
#define mset(v, a)     memset(v, a, sizeof(v))
#define pll            pair< ll, ll >
#define pd             pair< double, double >
#define ff             first
#define ss             second
#define pi             acos(-1.0)
#define mxN            2010
#define inf            1e14
#define mod            1000000007

//NCR iterative
/*voidcomb_table(intN)
{
    for(inti=0; i<=N; ++i)
    {
        for(intj=0; j<=i; ++j)
        {
            if(j==0or j==i)
            {
                C[i][j]=1LL;
            }
            else
            {
                C[i][j]=(C[i-1][j-1]+C[i-1][j]);
            }
        }
    }
}*/


//NCR recursive
/*ll dp[55][55];

ll NCR(ll n,ll r)
{

    if(n==r)
        return dp[n][r]=1;
    if(r==0)
        return dp[n][r]= 1;
    if(r==1)
        return dp[n][r]=n ;
    if(dp[n][r] != -1)
        return dp[n][r];
    return dp[n][r] = NCR(n-1,r)+NCR(n-1,r-1);
}*/

//Sieve:
/*bool Flag[1000010];
vector<ll> Prime;

void sieve()
{

    ll val=sqrt(1000010);
    for(ll i=4;i<=1000005; i+=2) Flag[i]=1;
    for(ll i=3;i <= val;i+=2)
    {

        if(Flag[i]==0)
        {

            for(ll j=i*i;j<=1000005;j+=i) Flag[j]=1;
        }
    }
    Flag[1]=1;
    for(ll i=1;i<=1000000;i++)
        if(Flag[i]==0) Prime.pb(i);
}*/


//Conversion
/*string bin(ll x)
{

    string ret;
    while(x)
    {

        ll t=x%2;
        char c;
        if(t==1)
            c='1';
        else
            c='0';
        ret.pb(c);
        x/=2;
    }
    reverse(all(ret));
    return ret;
}*/

/*ll lcm(ll x, ll y)
{

    ll ret=__gcd(x,y);
    return (x*y)/ret;
}*/

/*ll dx[]= {0,0,1,-1};
ll dy[]= {1,-1,0,0};*/

int main()
{

    ll a,b,x;
    cin >> a >> b >> x;
    ll fr;
    fr=a/x;
    if(a%x==0) fr=a;
    else fr=(x*(fr+1));
    ll lr=b/x;
    lr=x*lr;
    lr/=x;
    fr/=x;
    ll ans=(lr-fr+1);
    cout << ans;
}


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

using namespace std;

#define ll long long

#define DEBUG (0)

int main()
{
  string S = "",T = "";
  cin >> S >> T;
  bool flag = true;

  for(int i = 0; i < S.length(); i++){
    if(S[i] != T[i]){
      flag = false;
    }
  }

  if(flag == true){
    cout << "Yes" << "\n";
  }else{
    cout << "No" << "\n";
  }
#if DEBUG
#endif
}


Measured memory_bytes: 3632
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n, a, b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    int cnt = 0;
    int o_cnt = 0;
    for( int i = 0; i < n; ++i ) {
        if( s[i] == 'a' ) {
            if( cnt < a + b ) { 
                ++cnt;
                cout << "Yes";
            } else {
                cout << "No";

            }

        }
        if( s[i] == 'b' ) {
            if( cnt < a + b && o_cnt < b ) {
                ++cnt; ++o_cnt;
                cout << "Yes";

            } else {
                cout << "No";

            }
        }
        if( s[i] == 'c' ) {
            cout << "No";

        }
        cout << endl;


    }
    return 0;
}



Measured memory_bytes: 848
// C++ includes
#include <bits/stdc++.h>
// 俳句
using namespace std;

// alias templates
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

// alias declaration
using ll = long long;
using str = string;

using vll = V<ll>;
using vvll = V<vll>;
using vs = V<str>;

// loops
#define FOR(i, a, b)  for (ll i = (a); i <= (ll)(b); i++) // [a,b]
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--) // [b,a]
#define REP(i, a) FOR((i), 0, (ll)(a)-1) // [0,a-1]

// for debug
#define dbg(a) cerr << "  " << (#a) << ": " << (a) << "\n";

// procon common constants
const ll MOD_BIG = 1e9 + 7;

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

    vll r(n),g(n),b(n);
    ll rr=0, gg=0, bb=0;
    rFOR(i,0,n-1){
        switch(s[i]){
            case 'R':
                rr++;
                break;
            case 'G':
                gg++;
                break;
            case 'B':
                bb++;
                break;
            default:
                return -1;
                break;
        }
        r[i]=rr;
        g[i]=gg;
        b[i]=bb;    
    }
    // REP(i,n){
    //     printf("%d ", r[i]);
    // }
    // puts("");
    // REP(i,n){
    //     printf("%d ", g[i]);
    // }
    // puts("");
    // REP(i,n){
    //     printf("%d ", b[i]);
    // }
    // puts("");
    
    ll ans = 0;
    FOR(i,0,n-3){
        FOR(j,i+1,n-2){
            if(s[i]==s[j]){
                continue;
            }
            if((s[i]=='R' && s[j]=='G') || (s[i]=='G' && s[j]=='R'))
            {
                ans += b[j+1];
                if(j+(j-i) <= n-1){
                    if(s[j+(j-i)]=='B'){
                        ans--;
                    }
                }
            }else if((s[i]=='R' && s[j]=='B') || (s[i]=='B' && s[j]=='R')){
                ans += g[j+1];
                if(j+(j-i) <= n-1){
                    if(s[j+(j-i)]=='G'){
                        ans--;
                    }
                }
            }else if((s[i]=='G' && s[j]=='B') || (s[i]=='B' && s[j]=='G')){
                ans += r[j+1];
                if(j+(j-i) <= n-1){
                    if(s[j+(j-i)]=='R'){
                        ans--;
                    }
                }
            }
            //printf("[%d]%c [%d]%c %d\n",i,s[i],j,s[j],ans);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3720
import java.util.Scanner;

class Main {

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

		int a = sc.nextInt();
		int b = sc.nextInt();

		if(a+b<10){
			System.out.println(a+b);
		}else{
			System.out.println("error");
		}
	}

}


Measured memory_bytes: 23892