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

int main() {
	int n,m;
	cin>>n;
	vector<int> t(n);
	for(int i=0;i<n;i++){
		cin>>t.at(i);
	}
	cin>>m;
	for(int i=0;i<m;i++){
		int count=0,p,x;
		cin>>p>>x;
		for(int j=0;j<n;j++){
			if(j==p-1){
				count+=x;
			}
			else{
				count+=t.at(j);
			}
		}
		cout<<count<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>
#include <cstdlib>
using namespace std;

int main(){
  string word;
  stack<int> S;
  int a,b;
  while(cin >> word) {
    if (word == "+") {
        a = S.top();
        S.pop();
        b = S.top();
        S.pop();
        S.push(b+a);
    }
    else if(word == "-") {
      a = S.top();
      S.pop();
      b = S.top();
      S.pop();
      S.push(b-a);    }
    else if (word == "*"){
      a = S.top();
      S.pop();
      b = S.top();
      S.pop();
      S.push(b*a);
    }
    else {
       a = atoi(word.c_str());
       S.push(a);
    }

  }
  a = S.top();
  cout << a <<endl;
  return 0;
}

Measured memory_bytes: 1200
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

typedef long long ll;

int T;

ll A, B, C, D;

ll gcd(ll a, ll b) {
    return !b ? a : gcd(b, a % b);
}

int main() {
    scanf("%d", &T);
    while(T--) {
        scanf("%lld%lld%lld%lld", &A, &B, &C, &D);
        ll g = gcd(B, D);
        if(A < B || B > D || B - g + A % g > C) puts("No"); else puts("Yes");
    }
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();

		if (t.startsWith(s)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}


}

Measured memory_bytes: 35720
package main

import (
	"fmt"
)

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func main() {
	var a, b, c, d int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	fmt.Scan(&d)
	fmt.Println(min(a, b) + min(c, d))
}


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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> void chmax(T& a,const T& b){if(a < b) a = b;}
template<typename T> void chmin(T& a,const T& b){if(b < a) a = b;}
typedef long long ll;

int N,M,Q;

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

	cin >> N >> M >> Q;
	vector<int> A(Q);
	FOR(i,0,Q){
		cin >> A [i];
	}

	set<int> st;
	vector<int> B,pos(M + 1,-1);
	for(int i = Q - 1;i >= 0;i--){
		if(st.count(A [i]) == 0){
			pos [A [i]] = B.size();
			B.push_back(A [i]);
			st.insert(A [i]);
		}
	}

	vector<int> cnt(B.size() + 1);
	cnt [0] = N;
	for(int i = Q - 1;i >= 0;i--){
		int p = pos [A [i]];
		if(cnt [p]){
			cnt [p]--;
			cnt [p + 1]++;
		}
	}
	
	st.clear();
	vector<int> C;
	for(int i = 0;i < B.size() && cnt [i] == 0;i++){
		C.push_back(B [i]);
		st.insert(B [i]);
	}

	for(int i = 1;i <= M && C.size() < B.size();i++){
		if(st.count(i) == 0){
			C.push_back(i);
		}
	}

	cout << (B == C ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 6904
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

int viewer[250100];
int emp[250100];
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    int n;
    cin >> n;
    int dif[4]={-n,-1,1,n};
    repi(i,1,n*n+1){
        viewer[i]=min(min((i-1)/n,n-1-(i-1)/n),min((i-1)%n,(n-i%n)%n));
    }
    //print(viewer[4]);
    ll sum=0;
    rp(i,n*n){
        int p;
        cin >> p;
        sum += viewer[p];
        emp[p]=1;
        for(auto d:dif){
            if(p%n==0&&d==1) continue;
            if((p-1)/n==0&&d==-n) continue;
            if((p-1)/n==n-1&&d==n) continue;
            if(p%n==1&&d==-1) continue;
            if(emp[p+d]==1)
            chmin(viewer[p],viewer[p+d]);
            else
            chmin(viewer[p],viewer[p+d]+1);
            
        }
        queue<int> que;
        que.push(p);
        while(!que.empty()){
            int f=que.front(); que.pop();
            for(auto d:dif){
                if(f%n==0&&d==1) continue;
                if((f-1)/n==0&&d==-n) continue;
                if((f-1)/n==n-1&&d==n) continue;
                if(f%n==1&&d==-1) continue;
                if(emp[f]==0){
                    if(viewer[f+d]>viewer[f]+1){
                        viewer[f+d]=viewer[f]+1;
                        que.push(f+d);
                    }
                }
                else{
                    if(viewer[f+d]>viewer[f]){
                        viewer[f+d]=viewer[f];
                        que.push(f+d);
                    }
                }
            }
        }
        //print(sum);
    }
    print(sum);
    return 0;
}

Measured memory_bytes: 5536
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int i,j;
    
    int n;
    scanf("%d",&n);

    char* str = (char *)malloc(sizeof(char) * n);
	if (str == NULL) exit(0);
    scanf("%s",str);

    char word[26] = {};
    int countWord[26] = {};

    int startWordPoint[26] = {};
    int endWordPoint[26] = {};
	for (i = 0;i < n;i++) {
        for (j = 0;j < 26;j++) {
            // 未発見のワードなら格納して
            if(! word[j]){
                word[j] = str[i];
                startWordPoint[j] = i;
                countWord[j]++;
                break;
            }

            // 発見済みワードなら数だけ加算            
            if(str[i] == word[j]){
                countWord[j]++;
                
                // ワード数が1を超えたら、エンドポイントを更新
                if(countWord[j] > 1){
                    endWordPoint[j] = i;
                }
                break;
            }
    	}
	}

    int matchWordNumMax = 0;
	for (i = 0;i < n;i++) {
        int matchWordNum = 0;
        for (j = 0;j < 26;j++) {
            if(startWordPoint[j] < i && i <= endWordPoint[j]){
                matchWordNum++;
            } 
        }
        if(matchWordNum > matchWordNumMax) matchWordNumMax = matchWordNum;
	}

    // 確認
    /*
    for (j = 0;j < 26;j++) {
        printf("%c,",word[j]);
    }
	printf("\n");
    for (j = 0;j < 26;j++) {
        printf("%d,",countWord[j]);
    }
	printf("\n");
	*/
	printf("%d\n",matchWordNumMax);

    // 解放
	free(str);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] n = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
		System.out.println(n[sc.nextInt() - 1]);
		sc.close();
	}
}


Measured memory_bytes: 25428
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
static const int inf = 1 << 30;
static const int MAX = 100;

int main(void) {
  int N, D, X;
  int A[MAX];
  cin >> N >> D >> X;
  REP(i, N) { cin >> A[i]; }

  int sum = 0;

  REP(i, N) {
    int j = 0;
    while (j * A[i] + 1 <= D) {
      sum++;
      j++;
    }
  }

  cout << sum + X << endl;
}

Measured memory_bytes: 256
import bisect

n = int(input())
L = [int(i) for i in input().split()]

L.sort()
ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        ans += bisect.bisect_left(L, L[i] + L[j]) - j - 1

print(ans)

Measured memory_bytes: 3188
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

// Substring
// 2012/09/19
public class Main{
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

	int n, m;
	String s;
	String[] queries;

	void run(){
		try{
			String[] ss=br.readLine().split(" ");
			n=Integer.parseInt(ss[0]);
			m=Integer.parseInt(ss[1]);
			s=br.readLine();
			queries=new String[m];
			for(int i=0; i<m; i++){
				queries[i]=br.readLine();
			}
			solve();
		}catch(IOException e){}
	}

	void solve(){
		RollingHash rh=new RollingHash(s);
		HashSet<Long> set=new HashSet<Long>();
		rh.addRight();
		for(int i=0; i<m; i++){
			if(queries[i].equals("L++")){
				rh.removeLeft();
			}else if(queries[i].equals("L--")){
				rh.addLeft();
			}else if(queries[i].equals("R++")){
				rh.addRight();
			}else if(queries[i].equals("R--")){
				rh.removeRight();
			}
			set.add(rh.hash);
		}
		println(set.size()+"");
	}

	class RollingHash{
		String s;
		int left, right; // [left, right)
		long hash, c=(int)1e9+7, ci;
		long[] cm;

		RollingHash(String s){
			this.s=s;
			ci=1;
			long x=c;
			// c^(-1)=c^(2^63-1)
			for(int i=0; i<63; i++){
				ci*=x;
				x*=x;
			}
			cm=new long[s.length()+1];
			cm[0]=1;
			for(int i=1; i<cm.length; i++)
				cm[i]=c*cm[i-1];
		}

		void init(int left, int right){
			this.left=left;
			this.right=right;
			hash=0;
			for(int i=left; i<right; i++)
				hash=hash*c+s.charAt(i);
		}

		void moveRight(){
			hash=c*hash+s.charAt(right)-cm[right-left]*s.charAt(left);
			left++;
			right++;
		}

		void moveLeft(){
			hash=(hash+cm[right-left]*s.charAt(left-1)-s.charAt(right-1))*ci;
			left--;
			right--;
		}

		void addRight(){
			hash=c*hash+s.charAt(right);
			right++;
		}

		void addLeft(){
			hash=hash+cm[right-left]*s.charAt(left-1);
			left--;
		}

		void removeRight(){
			hash=(hash-s.charAt(right-1))*ci;
			right--;
		}

		void removeLeft(){
			hash=hash-cm[right-left-1]*s.charAt(left);
			left++;
		}
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

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

using namespace std;

int n, q;
vector<int> a;

bool dfs(int target, int index, int sum) {
    if (sum == target) return true;
    if (index >= n) return false;

    bool result = false;

    result |= dfs(target, index + 1, sum);
    result |= dfs(target, index + 1, sum + a[index]);

    return result;
}

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

    cin >> n;
    
    a.resize(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    cin >> q;

    int m;
    for (int i = 0; i < q; i++) {
        cin >> m;

        cout << (dfs(m, 0, 0) ? "yes" : "no") << endl;
    }

    return 0;
}



Measured memory_bytes: 3172
#include <cstdio>

int main(int argc, char const *argv[]){
//	freopen("in.txt", "r", stdin);

	int n;
	scanf("%d", &n);
	int ans = 100000;
	for(int i = 0; i < n; i ++){
		ans *= 1.05;
		if(ans % 1000 != 0){
			ans = ans - ans % 1000 + 1000;
		}
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;

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

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def calc_prime_numbers(n):
    """Sieve of Eratosthenes"""
    if n == 1:
        return []

    is_prime = [True] * (n + 1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(n ** 0.5) + 1):
        for j in range(2 * i, n + 1, i):
            is_prime[j] = False

    prime_number_list = []
    for i in range(n + 1):
        if is_prime[i]:
            prime_number_list.append(i)

    return prime_number_list


def main():
    N = int(input())

    MAX_A = 55555
    prime_numbers = calc_prime_numbers(MAX_A)

    ans = []
    for prime_number in prime_numbers:
        if prime_number % 5 == 1:
            ans.append(prime_number)

        if len(ans) == N:
            break

    print(" ".join(map(str, ans)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 9812
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,m = inm()
d = [0]*(n+1)
for i in range(m):
    a,b = inm()
    d[a] += 1
    d[b] += 1
for i in range(n+1):
    if d[i]%2==1:
        print('NO')
        exit()
print('YES')


Measured memory_bytes: 45656
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x1 = sc.nextInt();
		int x2 = sc.nextInt();
		int x3 = sc.nextInt();
		int x4 = sc.nextInt();
		int x5 = sc.nextInt();
		int[] X = new int[]{x1, x2, x3, x4, x5};
		for (int i = 0; i < 5; i++) {
			if (X[i] == 0) {
				System.out.println(i + 1);
			}
		}
	}

}

Measured memory_bytes: 35800
#include<bits/stdc++.h>
using namespace std;
string s;
int pos=-1;
int main(){
	cin>>s;
	for(int i=0;i<s.length();i++){
    	if(s[i]=='C'){
    		pos=i;
    		break;
    	}	
	}
	if(pos>=0)for(int i=pos+1;i<s.length();i++) if(s[i]=='F') {
		cout<<"Yes";
		return 0;
	}
	cout<<"No";
}


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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>

using namespace std;

ll N, X;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

vector<ll> total;
vector<ll> pnum;

ll calc(ll n, ll x) {
  if (n == 0) {
    return (x > 0) ? 1 : 0;
  }
  if (x <= total[n - 1] + 1) {
    return calc(n - 1, x - 1);
  }
  return pnum[n - 1] + 1 + calc(n - 1, x - 2 - total[n - 1]);
}

int main() {
  scanf("%lld %lld", &N, &X);

  total.emplace_back(1);
  pnum.emplace_back(1);
  for (ll i = 1; i <= N; i++) {
    total.emplace_back(total[i - 1] * 2 + 3);
    pnum.emplace_back(pnum[i - 1] * 2 + 1);
  }

  cout << calc(N, X) << endl;
}

// P
// BPPPB
// BBPPPBPBPPPBB
// BBBPPPBPBPPPBBPBBPPPBPBPPPBBB
// BBBBPPPBPBPPPBBPBBPPPBPBPPPBBBPBBBPPPBPBPPPBBPBBPPPBPBPPPBBBB

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

int main(){
    string S,ans;
    cin >> S;
    int s = atoi(S.c_str());
    int b = s%100;
    int a = (s-b) / 100;
    if(1<=a && a <= 12){
        if (1<=b &&b<=12){
            ans = "AMBIGUOUS";
        }else ans = "MMYY";
    }else if(1<=b &&b<=12){
        ans = "YYMM";
    }else ans = "NA";

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};


typedef struct node * Node;



Node root;


void insert(int k)
{
  Node x;
  Node y;
  Node z;
  y = NIL;
  x = root;

  z = (Node)malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while(x!=NIL){
    y=x;
    if(z->key<x->key)
      x = x->left;
    else
      x = x->right;
  }
  z->parent = y;

  if(y==NIL)
    root = z;
  else if(z->key<y->key)
    y->left = z;
  else
    y->right = z;

}

void inorderTreeWalk(Node x)
{
  if(x==NIL)
    return;
  
  inorderTreeWalk(x->left);
  printf(" %d",x->key);
  inorderTreeWalk(x->right);
}

void preorderTreeWalk(Node x)
{
  if(x==NIL)
    return;
  
    printf(" %d",x->key);
    preorderTreeWalk(x->left);
    preorderTreeWalk(x->right);
  
}


int main()
{
  char str[20];
  int x, m, i;

  scanf("%d",&m);
  for( i=0 ; i<m ; i++ ){
    scanf("%s",str);
    if(str[0]=='i'){
      scanf("%d",&x);
      insert(x);
    }
    else if(str[0]=='p'){
      inorderTreeWalk(root);
      printf("\n");
      preorderTreeWalk(root);
      printf("\n");
    }
  }

  return 0;
  
}

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

using namespace std;
typedef long long ll;

int main() {
    ll N,K;
    cin >> N >> K;
    vector<priority_queue<ll,vector<ll>,greater<ll>>> que(K);
    deque<ll> dq;
    vector<ll> V(N);
    for(int i=0;i<N;i++){
        cin >> V[i];
        dq.push_back(V[i]);
    }
    vector<ll> ans(K+10);
    for(int i=0;i<K;i++){
        ans[i]=-1000000000000000;
    }
    ans[0]=0;
    for(int i=1;i<=min(K,N);i++){
        for(int j=0;j<=i;j++){
            ll tmp=0;
            priority_queue<ll,vector<ll>,greater<ll>> Q;
            for(int s=0;s<j;s++) {
                tmp+=V[s];
                Q.push(V[s]);
            }
            for(int c=0;c<i-j;c++){
                tmp+=V[N-1-c];
                Q.push(V[N-1-c]);
            }
            int ct=0;
            while(ct<K-i && !Q.empty()){
                ct++;
                ll per=Q.top();
                if(per>=0) break;
                else Q.pop();
                tmp-=per;
            }
            ans[i]=max(ans[i],tmp);
        }
    }
    ll anst=ans[0];
    for(int i=0;i<=min(K,N);i++){
        anst=max(anst,ans[i]);
    }
    cout << anst << endl;
}

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

namespace ABC169test
{
	class Program
	{
		static void Main(string[] args)
		{
			long N = Convert.ToInt64(Console.ReadLine());
			long[] A = new long[N];
			long[] B = new long[N];
			string[] s = new string[2];

			long MIN, MAX;
			long below = 0, above;		//基準より上下（基準含まない）
			long b = 0, a = 0;	//次に追加されるINDEX
			long count = 0;
			bool check;

			for(int i=0; i<N; i++)
			{
				s = Console.ReadLine().Split(" ");
				A[i] = Convert.ToInt64(s[0]);
				B[i] = Convert.ToInt64(s[1]);
			}
			Array.Sort(A);
			Array.Sort(B);

			long meda, medb;

			if(N%2 == 1)
			{
				meda = A[N / 2];
				medb = B[N / 2];
				count = medb - meda + 1;
			}
			else
			{
				for(int i=0; i < N; i++)
				{
					A[i] *= 2;
					B[i] *= 2;
				}
				meda = (A[N / 2 - 1] + A[N / 2]) / 2;
				medb = (B[N / 2 - 1] + B[N / 2]) / 2;
				count = medb - meda + 1;
			}

			Console.WriteLine(count);
		}
	}
}

Measured memory_bytes: 43588
[n,d] = [int(i) for i in input().split()]
xys = []
for i in range(n):
    xys.append([int(i) for i in input().split()])
ans = 0
for i in range(n):
    x = xys[i][0]
    y = xys[i][1]
    if d ** 2 >= x ** 2 + y ** 2:
        ans += 1
print(ans)


Measured memory_bytes: 102604
N=int(input())
S=input()
T=[0]*len(S)

alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(0,len(S)):
  u=alpha.index(S[i])
  a=u+N
  if a>=26:
    a-=26
  T[i]=alpha[a]

print("".join([str(n) for n in T]))

Measured memory_bytes: 3188
package main

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

const INF = (1 << 31) - 1

func main() {
	sc.Split(bufio.ScanWords)
	A := nextInt()
	B := nextInt()
	if A > B {
		swap(&A, &B)
	}
	C := nextInt()
	D := nextInt()
	if C > D {
		swap(&C, &D)
	}
	E := nextInt()
	F := nextInt()
	waters := map[int]bool{}
	sugers := map[int]bool{}
	for a := 0; a <= F; a += 100 * A {
		for b := 0; a+b <= F; b += 100 * B {
			waters[a+b] = true
		}
	}
	for c := 0; c <= F; c += C {
		for d := 0; c+d <= F; d += D {
			sugers[c+d] = true
		}
	}

	bestWater, bestSuger := A*100, 0
	for water, _ := range waters {
		for suger, _ := range sugers {
			total := water + suger
			bestTotal := bestWater + bestSuger
			if total <= F && (100+E)*suger <= total*E && total*bestSuger < bestTotal*suger {
				bestWater = water
				bestSuger = suger
			}
		}
	}
	fmt.Println(bestWater+bestSuger, bestSuger)
}

// -------- Library --------
var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	v, _ := strconv.Atoi(next())
	return v
}

func nextIntArray(size int) []int {
	res := make([]int, size)
	for i := 0; i < size; i++ {
		res[i] = nextInt()
	}
	return res
}

func min(a int, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}

func shift(p int) int {
	return 1 << uint(p)
}

func swap(a *int, b *int) {
	tmp := a
	a = b
	b = tmp
}


Measured memory_bytes: 768
#include<iostream>
using namespace std;
int main() {
	int n, p = 0;
	int x[101], y[101];
	cin >> n;
	for(int i = 0; i < n - 1; i++){
	    cin >> x[i];
	    if(i == 0){
	        y[0] = x[i];
	    }
	}
	for(int i = 0; i < n - 1; i++){
	    if(i != 0 && x[i] <= x[i-1]){
	        y[i] = x[i]; 
	    }
	    else if(i != 0){
	        y[i] = x[i - 1];
	    }
	}
	y[n - 1] = x[n - 2];
	for(int i = 0; i < n; i++){
	    p += y[i];
	}
	cout << p;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  vector<int> task(3);
  for(int i=0;i<3;i++){
  	cin>>task.at(i);
  }
  sort(task.begin(),task.end());
  reverse(task.begin(),task.end());
  cout<<task.at(0)-task.at(2)<<endl;
}


Measured memory_bytes: 256
#include <string>
#include <iostream>
using namespace std;
using ll = long long;

int main(){
  ll N,H,W;
  cin>>N>>H>>W;
  ll num;
  for(int i=0;i<N;++i){
    ll a,b;
    cin>>a>>b;
    if(a>=H&&b>=W)num++;
  }
  cout<<num<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int D;
	scanf("%d", &D);
	int c[26], s[D][26], last[26], ans[D];
	for (int i = 0; i < 26; ++i) scanf("%d", &c[i]);
	for (int i = 0; i < D; ++i) {
		for (int j = 0; j < 26; ++j) scanf("%d", &s[i][j]);
	}
	fill_n(last, 26, -1);
	for (int i = 0; i < D; ++i) {
		int x = -1000000000, opt = 0;
		for (int j = 0; j < 26; ++j) {
			if (c[j] * (i - last[j]) + s[i][j] > x) x = c[j] * (i - last[j]) + s[i][j], opt = j;
		}
		last[opt] = i;
		ans[i] = opt;
	}
	for (int i = 0; i < D; ++i) printf("%d\n", ans[i] + 1);
	return 0;
}

Measured memory_bytes: 1772
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC pop_options
//#pragma GCC target("popcnt")
//#pragma GCC target("sse4")
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rng(a) a.begin(),a.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i > -1; i--)
#define rer(i, x, n) for (int i = x; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef long double ld;














const int lim = 4000006;
signed main(){
    int n;
    cin >> n;
    int a[n];
    int S = 0;
    for (int i = 0; i < n; i++){cin >> a[i]; S += a[i];}
    bitset<lim> b;
    b[0] = 1;
    for (int i = 0; i < n; i++)
        b |= b << a[i];
    for (int j = (S + 1)/ 2; ; j++){
        if (b[j]){cout << j; return 0;}
    }


}


Measured memory_bytes: 1664
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;
typedef long long ll;
ll N;
char hat[100];
ll R=0;
ll B=0;


int main(void) {
    // insert code here...
    cin >> N;
    for(int i = 0; i < N; i++){
        char a;
        cin >> a;
        if(a=='R'){
            R++;
        }else{
            B++;
        }
        
    }
    
    if(R>B){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin >> N;
  string ans = "No";
  int num_doublet_occur = 0;
  while (N--)
  {
    int D1, D2;
    cin >> D1 >> D2;
    if (D1 == D2) num_doublet_occur++;
    else num_doublet_occur = 0;
    if (num_doublet_occur >= 3) ans = "Yes";
  }
  cout << ans;
}

Measured memory_bytes: 3628
// +build ignore
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []byte {
	return []byte(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

func gcd(x, y int) int {
	if x%y != 0 {
		return gcd(y, x%y)
	}
	return y
}

func run(input io.Reader, output io.Writer) int {
	sc := NewScanner()
	A := sc.nextInt()
	B := sc.nextInt()
	N := sc.nextInt()

	i := B - 1
	if N < B {
		i = N
	}
	fmt.Println(A*i/B - A*(i/B))

	return 0
}

func main() {
	os.Exit(run(os.Stdin, os.Stdout))
}


Measured memory_bytes: 1756
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
	string s, t;
	cin >> s >> t;
	int count = 0;
	rep(i, s.size()) {
		if(s[i] != t[i]) count++;
	}
	printf("%d\n", count);
	return 0;
}

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

int main() {
    int k; cin >> k;
    int lunlun;
    queue<long long> que;
    for (int i = 1; i <= 9; i++)
    {
        que.push(i);
    }

    while (true)
    {
        if(k == 1) {
            cout << que.front() << endl;
            return 0;
        }
        else {
            if(que.front() % 10 != 0) que.push(que.front() * 10 + que.front() % 10 - 1);
            que.push(que.front() * 10 + que.front() % 10);
            if(que.front() % 10 != 9) que.push(que.front() * 10 + que.front() % 10 + 1);
            que.pop();
            k--;
        }
    }

	return 0;
}


Measured memory_bytes: 5108
using System.Linq;
using System.Collections.Generic;
using System;

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            var dict = new Dictionary<int, int>();
            for (int i = 0; i < n; i++)
            {
                string[] line = Console.ReadLine().Trim().Split(' ');
                var bango = int.Parse(line[0]);
                dict[bango] = int.Parse(line[1]) + int.Parse(line[2]);
            }
            var res = dict.OrderByDescending(x => x.Value).First();
            Console.WriteLine(res.Key + " " + res.Value);
        }
    }
}

Measured memory_bytes: 10880
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
ll INF = 1e9+7;
int main()
{
    int n;
    cin >> n;
    map<int, int> m;
    for(int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        m[a]++;
    }
    vector<int> v;
    for(auto itr = m.begin(); itr != m.end(); itr++)
    {
        v.push_back(itr->second);
    }
    sort(v.begin(), v.end());
    vector<int> sum(n+1);
    int size = v.size();
    int pos = 1;
    sum[0] = 0;
    int cur = 0;
    while(cur < size)
    {
        while(pos <= v[cur])
        {
            sum[pos] = sum[pos-1];
            if(pos < v[cur]) pos++;
            else break;
        }
        sum[pos] += v[cur];
        while(cur < size-1 && v[cur] == v[cur+1])
        {
            sum[pos] += v[cur];
            cur++;
        }
        cur++;
        pos++;
    }
    for(int i = pos; i <= n; i++)
    {
      sum[i] = sum[i-1];
    }
    for(int k = 1; k <= n; k++)
    {
        int l = -1;
        int h = n / k + 1;
        while(h - l > 1)
        {
            int num = (h + l) >> 1;
            int card = sum[num];
            int dis = distance(lower_bound(v.begin(), v.end(), num+1), v.end());
            card += dis * num;
            if(card >= num * k)
            {
                l = num;
            }
            else
            {
                h = num;
            }
        }
        cout << l << endl;
    }
}


Measured memory_bytes: 16752
#include <iostream>

using namespace std;

int main () {

    string s, a = "";
    cin >> s;

    int w = 0, b = 0;

    // strip the string 
    char current = s[0];
    a += s[0];

    for (int i = 0; i < s.size(); i++){
        if (s[i] != current) {
            current = s[i];
            a += s[i];
        }
    }

    cout << a.size() - 1 << endl;

    return 0;
}

Measured memory_bytes: 640
S = str(input())
if S[0]==S[1]:
  if (S[2]==S[3])and(S[0]!=S[2]):
    print('Yes')
  else:
    print('No')
elif S[0]==S[2]:
  if (S[1]==S[3])and(S[0]!=S[1]):
    print('Yes')
  else:
    print('No')
elif S[0]==S[3]:
  if (S[1]==S[2])and(S[0]!=S[1]):
    print('Yes')
  else:
    print('No')
else:
  print('No')


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

int main()
{
  double v;
  int h;

  while(scanf("%lf",&v)!=EOF){

    h=v*v/19.6/5+2;
    cout<<h<<endl;

  }
}

Measured memory_bytes: 1236
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,a,b) for(ll i=(a)-1;i>=(b);i--)

int main() {
    ll H, A;
    cin >> H >> A;
    cout << H/A + (H%A != 0) << endl;
}



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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll inf = 3e18;
const char sp = ' ';

int N, Q, a[100000];

int main() {
	cin >> N >> Q;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	sort(a, a + N);
	while (Q--) {
		int l, r;
		cin >> l >> r;
		cout << upper_bound(a, a + N, r) - lower_bound(a, a + N, l) << endl;
	}
}


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

int main(){
  int s; cin >> s;
 
    vector<int> a(1000000);
    a[0] = s;
    for (int i=1; i<=1000000; i++){
        if (a[i-1]%2 == 0) a[i] = a[i-1]/2;
        else a[i] = 3*a[i-1]+1;
    }
 
  int i, j;
    bool found = false;
    int ans = 0;
    for (i=0; i<=1000000; i++) {
        for (j = i+1; j<1000000; j++) {
          if (a[i] == a[j]) found = true;
          if (found == true) {
                ans = j+1;
                break;
            }
        }
        if (found == true)  break;
    }
    cout << ans << endl;
  
    return 0;
}

Measured memory_bytes: 4096
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        //static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var S = new string(ReadLine().Reverse().ToArray());
            var b = 0;
            var match = new string[] {
                new string("dreamer".Reverse().ToArray()),
                new string("dream".Reverse().ToArray()),
                new string("eraser".Reverse().ToArray()),
                new string("erase".Reverse().ToArray()),
            };

            while (b < S.Length)
            {
                var flag = false;
                foreach (var m in match)
                {
                    if (S.Length - m.Length < b)
                        continue;
                    if (S.Substring(b, m.Length) == m)
                    {
                        flag = true;
                        b += m.Length;
                        break;
                    }
                }
                if (!flag)
                {
                    WriteLine("NO");
                    return;
                }
            }
            WriteLine("YES");
            //Out.Flush();
        }
    }
}


Measured memory_bytes: 14816
import java.util.*;
import java.io.*;
import java.lang.*;
 
public class Main {

  static class FastReader {

    BufferedReader br; 
    StringTokenizer st; 

    public FastReader() { 
      br = new BufferedReader(new InputStreamReader(System.in)); 
    } 

    String next() { 
      while (st == null || !st.hasMoreElements()) { 
        try { 
          st = new StringTokenizer(br.readLine()); 
        } catch (IOException e) { 
          e.printStackTrace(); 
        } 
      } 
      return st.nextToken(); 
    } 

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

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

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

    String nextLine() { 
      String str = ""; 
      try { 
        str = br.readLine(); 
      } catch (IOException e) { 
        e.printStackTrace(); 
      } 
      return str; 
    } 
  }
 
  public static void main(String args[]) throws IOException {
    // try {
    //   FileOutputStream output = new FileOutputStream("temp.out");
    //   PrintStream out = new PrintStream(output);
    //   //Diverting the output stream into file "temp.out".Comment the below line to use console
    //   System.setOut(out);
  
    //   InputStream input = new FileInputStream("temp.in");
    //   //Diverting the input stream into file "temp.in".Comment the below line to use console
    //   System.setIn(input);
  
    // } catch (FileNotFoundException e) {
    //   e.printStackTrace();
    // }
  
    FastReader sc = new FastReader();
    PrintWriter wr = new PrintWriter(System.out);
 
    // int t = 1;
    // t = sc.nextInt();    //Comment this line if there is single test case

    // while((t--) != 0) {

    // }    

    String str = sc.nextLine();
    int ans = 0;

    for(int i = 0; i < str.length(); i++) {
        
        char ch = str.charAt(i);
        String str1 = String.valueOf(ch);
        ans += Integer.parseInt(str1);  
    }

    if((ans % 9) == 0) {
      wr.println("Yes");
    } else {
      wr.println("No");
    }
        
    wr.flush();
    wr.close();
  }
}

Measured memory_bytes: 45484
#include<iostream>
#include<vector>
#include<map>
using namespace std;
int main(){
    unsigned long long int n;
    cin>>n;
    vector<unsigned long long int >v(n);
    map<unsigned long long int,unsigned long long int>mp;
    for(unsigned long long int i=0;i<n;i++)
    {
        cin>>v[i];
        if(mp.find(v[i])==mp.end()){
            mp[v[i]]=1;
        }
        else{
            mp[v[i]]++;
        }
    }
    unsigned long long int first=0;
    unsigned long long int second=0;
    unsigned long long int area=0;
    for(auto it=mp.rbegin();it!=mp.rend();it++){
        if(it->second>=4&&area==0){
            area=(it->first)*(it->first);
            if(first==0){
                break;
            }
            else
            {
                if(area<first*it->first){
                    area=first*it->first;
                    break;
                }
            }
        }
        else
        if(it->second>=2){
            if(first==0){
                first=it->first;
            }
            else
            if(second==0){
                second=it->first;
                if(area<first*second){
                    area=first*second;
                }
                break;
            }
        }
    }
    cout<<area;
}

Measured memory_bytes: 10108
using System;
using System.Collections.Generic;
using System.Linq;

namespace contest_Csharp
{
    class Program
    {
        static int power(int a, int b, int modulo)
        {
            int result = 1;
            int buff = a;
            for (int i = 1; i <= b; i *= 2)
            {
                result = result * ((b / i % (2) == 1) ? buff : 1) % modulo;
                buff = (buff * buff) % modulo;
            }
            return result % modulo;
        }
        static void Main(string[] args)
        {

            //var vals = Console.ReadLine().Split(' ')
            //    .Select(x => int.Parse(x)).ToList();
            string S = Console.ReadLine();
            var SR = S.ToList();
            SR.Reverse();
            int N = S.Length;
            int ans = 0;
            List<int> AS = new List<int>(new int[N]);
            int sumAS= 0;
            int count = 1;
            List<int> valcnt = new List<int>(new int[2019]);
            for (int i = 0; i < N; i++)
            {
                sumAS = (sumAS + power(10, i, 2019) * (SR[i] - '0')) % 2019;

                AS[i] = sumAS;
                valcnt[AS[i]]++;
            }
            valcnt[0]++;
            for (int i = 0; i < 2019; i++)
            {
                ans += valcnt[i] * (valcnt[i] - 1) / 2;
            }
            Console.WriteLine(ans);
        }
       
       

    }
}


Measured memory_bytes: 21084
N,M,L=map(int, input().split())
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j]=min(d[i][j],d[i][k] + d[k][j])
    return d

d=[[float("inf")]*N for i in range(N)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(M):
    x,y,z=map(int,input().split())
    d[x-1][y-1]=z
    d[y-1][x-1]=z
for i in range(N):
    d[i][i]=0 #自身のところに行くコストは０
D=warshall_floyd(d)
E=[[float("inf")]*N for i in range(N)] 
for i in range(N):
  for j in range(N):
    if D[i][j]==0:
      E[i][j]=0
    elif D[i][j]<=L:
      E[i][j]=1
F=warshall_floyd(E)
N=int(input())
for i in range(N):
  x,y=map(int,input().split())
  if F[x-1][y-1]==float("inf"):
    print(-1)
  else:
    print(F[x-1][y-1]-1)

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

bool possible[100010];
int main()
{
    int coin[7]= {100,101,102,103,104,105};
    possible[0]=1;
    int N; cin>>N;
    for(int i=1;i<=N;i++)
    {
        for(int j=0;j<6;j++){
            if(i >= coin[j]) possible[i]|=possible[i-coin[j]];
        }
    }
    if(possible[N]) cout<<1<<endl;
    else cout<<0<<endl;
}


Measured memory_bytes: 384
N, T = list(map(lambda x : int(x), input().split(" ")))
cand = []
for i in range(N):
  c, t = list(map(lambda y : int(y), input().split(" ")))
  if t <= T:
    cand.append(c)

if len(cand) > 0:
  print(min(cand))
else:
  print("TLE")

Measured memory_bytes: 9124
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


from collections import defaultdict
n, M = map(int, input().split())
ns = defaultdict(list)
for _ in range(n-1):
    u,v = map(int, input().split())
    ns[u-1].append(v-1)
    ns[v-1].append(u-1)

bs = {}
cump0 = defaultdict(list)
cump1 = defaultdict(list)
def sub(u, p):
    if (p,u) in bs:
        return bs[p,u]
    b = 1
    ps = []
    for v in ns[u]:
        if v==p:
            continue
        bb = sub(v, u)
        b *= (1+bb)
        b %= M
        ps.append(bb)
    v0 = 1
    v1 = 1
    l = len(ps)
    for i in range(l):
        cump0[u].append(v0)
        cump1[u].append(v1)
        v0 *= ps[i]+1
        v1 *= ps[l-1-i]+1
        v0%=M;v1%=M
    cump0[u].append(v0)
    cump1[u].append(v1)
        
    bs[p,u] = b % M
    return b

ans = [None]*n
def sub2(u, p):
    i = 0
    for v in ns[u]:
        if v==p:
            continue
        b1 = bs[p,u]
        b2 = bs[u,v]
        b3 = bs[u,p]
        if p>=0:
            bb = (cump0[u][i] * cump1[u][-(i+2)] * (1+b3)) % M
        else:
            bb = (cump0[u][i] * cump1[u][-(i+2)]) % M
        bs[v,u] = bb
        ans[v] = bs[u,v] * (1+bb) % M
        sub2(v,u)
        i += 1
        
sub(0, -1)
bs[0,-1] = 1
ans[0] = bs[-1,0]
sub2(0,-1)

# for u in range(n):
#     ans[u] = sub(u, -1)[1] % M
write("\n".join(map(str, ans)))

Measured memory_bytes: 172788
import numpy as np
import math

def main():
    n, k = map(int, input().split())
    string = input()
    new_string = ""
    for i in range(len(string)):
        if i == k - 1:
            new_string += string[i].lower()
        else:
            new_string += string[i]
    print(new_string)

if __name__ == '__main__':
    main()

Measured memory_bytes: 21772
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100000;
const int MOD = 1000000007;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

int ceil(int x, int y) { return (x % y == 0) ? x / y : x / y + 1; }

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

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

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

  set<ll> p;
  ll i = 2;
  bool cond = true;
  while (cond) {
    bool prime = true;
    for (ll j = 2; j * j <= i; j++) {
      if (i % j == 0) {
        prime = false;
        break;
      }
    }
    if (prime) {
      p.insert(i);
      if (i >= MAX) {
        cond = false;
      }
    }
    ++i;
  }

  int x;
  cin >> x;

  int ans = *p.lower_bound(x);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 768
#include <iostream>
using namespace std;
int main(){
    int E,Y;
    cin >> E >> Y;
    if(E==0){
        if(1868<=Y && Y<=1911){
            cout << "M" << Y-1867 << endl;
        }
        else if(1912<=Y && Y<=1925){
            cout << "T" << Y-1911 << endl;
        }
        else if(1926<=Y && Y<=1988){
            cout << "S" << Y-1925 << endl;
        }
        else if(1989<=Y && Y<=2016){
            cout << "H" << Y-1988 << endl;
        }
    }
    else if(E==1){
        Y=Y+1867;
        cout << Y << endl;
    }
    else if(E==2){
        Y=Y+1911;
        cout << Y << endl;
    }
    else if(E==3){
        Y=Y+1925;
        cout << Y << endl;
    }
    else if(E==4){
        Y=Y+1988;
        cout << Y << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	
	int n = read.to!int;
	long[] as = readln.chomp.split.to!(long[]);
	
	long[] sums = [0];
	foreach(a; as) sums ~= sums[$ - 1] + a;
	
	long best = sums[n];
	foreach(s; sums){
		long tmp = abs(sums[n] - s - s);
		best = min(best, tmp);
	}
	
	best.writeln;
	
	
}


Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long int ll;
using namespace std;
const int mod=1e9+7;

int a,b,c;
string s;
int ans;
int main(){
    cin>>a;
    if(a<1000){
        p("ABC");
    }else{
        p("ABD");
    }

    return 0;
}


Measured memory_bytes: 256
N, W = map(int, input().split())
w = [0]*N
v = [0]*N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = [[0]*(W+1) for _ in range(N+1)]
# dp[i][sum_w]
# i-1番目までの品物から重さがsum_wを超えないように選んだ時の価値の総和
# sum_w = 0, 1, 2, ... ,W

for i in range(N):
    for sum_w in range(W+1):
        if sum_w - w[i] >= 0:
            dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - w[i]] + v[i])

        dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])
print(dp[N][W])

Measured memory_bytes: 120684
#include<bits/stdc++.h>
using namespace std;
struct rest
{
	string name;
	int sc;
	int num;
}a[105];
bool cmo(rest a,rest b)
{
	if(a.name!=b.name) return a.name<b.name;
	else return a.sc>b.sc;
}
int main()
{
	int n;cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i].name>>a[i].sc;
		a[i].num=i+1;
	}
	sort(a,a+n,cmo);
	for(int i=0;i<n;++i) cout<<a[i].num<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair



int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int n, x, y;
	cin >> n >> x >> y;
	x = abs(x - y);
	if (x & 1)
		cout << "Borys" << endl;
	else
		cout << "Alice" << endl;

	return 0;
}


Measured memory_bytes: 256