akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdio>
#define Fast ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long long
#define rep(i, n) for(i=0; i<n; i++)
using namespace std;
int main() {
    Fast;
    string s;
    ll k;
    cin >> s;
    cin >> k;
    ll i;
    //int len = s.length();
    rep(i, k){
        if(s[i]=='1') continue;
        else{
            cout << s[i] << endl;
            return 0;
        }
    }
    cout << "1\n";
    return 0;
}

Measured memory_bytes: 3620
N = int(input())
a = [int(x) for x in input().split()]

b = [0 for x in range(N)]

for i in reversed(range(N)):
    j = i + 1
    tmp = 0
    while j <= N:
        tmp += b[j - 1]
        j += i + 1
    if (tmp + a[i]) % 2 == 1:
        b[i] = 1

M = sum(b)
print(M)
if M != 0:
    for i in range(N):
        if b[i] == 1:
            print(i + 1, end=' ')
    print('\n')

Measured memory_bytes: 7276
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<cmath>
#include<functional>
#include<algorithm>
#define INF (1<<29)
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;




string form(const string &s){
	string res;
	int p=0,m=0;
	rep(i,s.size()){
		if(s[i]=='+')p++;
		else if(s[i]=='-')m++;
		else if(isalnum(s[i])){
			res+=(s[i]-'A'+p-m+26*100)%26+'A';
			p=m=0;
		}
		else if(s[i]=='?'){
			res+='?';
			p=m=0;
		}
		else res+=s[i];
	}
	return res;
}

int p;
string rev(const string &s){
	if(p==s.size())return "";
	string t;
	char c=s[p++];
	if(c=='['){
		t=rev(s);
		reverse(t.begin(),t.end());
		return t+rev(s);
	}else if(c==']'){
		return "";
	}else {
		return c+rev(s);
	}

}


int main(){
	string s;
	while(cin>>s&&s!="."){
		p=0;
		s=form(s);
		string t=rev(s);
		rep(i,t.size())if(t[i]=='?')t[i]='A';
		cout<<t<<endl;

	}
	return 0;
}

Measured memory_bytes: 1204
a,b = list(map(int, input().split()))

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

a_plus = a+1
b_plus = b+1

price_a = int(a*(100/8))
price_aplus = int(a_plus*(100/8))
price_b = int(b*(100/10))
price_bplus = int(b_plus*(100/10))

#配列作成
if is_integer_num(a_plus*(100/8)):
  al = list(range(price_a+1, price_aplus))
else:
  al = list(range(price_a, price_aplus+1))
bl = list(range(price_b, price_bplus))

ans = list(set(al) & set(bl))

if len(ans) == 0:
  print(-1)
else:
  print(min(ans))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ft first
#define sd second
#define pb push_back
using namespace std;
const ll mod = 1e9+7;
const ll inf = 1e9+9;
 
ll power(ll a, ll b, ll m = mod) {
    ll x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
 
const int N = 2e5+9;
// ll a[N];
const int B = 10;
string s; int n, k;
long long dp[105][2][5];
long long solve(int ind, bool tight, int cnt) {
    if(cnt > k) return 0;
    if(ind == n) {
        return cnt == k;
    }
    int dig = s[ind]-'0';
    if(tight == 0) dig = 9;
    long long& ret = dp[ind][tight][cnt];
    if(ret != -1) return ret;
    ret = 0;
    for(int i = 0; i <= dig; i++) {
        ret += solve(ind+1, tight && (i == dig), cnt + !!i);
    }
    return ret;
}
signed main() {  
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> s;
    cin >> k;
    n = s.size();
    memset(dp, -1, sizeof dp);
    cout << solve(0, 1, 0) << "\n";


    return 0;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define ll unsigned long long
using namespace std;
int main(){
    int N;
    string S,T;
    cin>>N>>S>>T;
    REP(i,N){
        cout<<S[i]<<T[i];
    }
    cout<<endl;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void) {
	int n,count=1;
	scanf("%d",&n);
	while(n!=1){
		if((n%2)==0){
			count=count*2;
			n=n/2;
		}else{
			n=n-1;
		}
	}
	printf("%d",count);
	return 0;
}


Measured memory_bytes: 128
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


long long M = 1000000007;


int main(int argc, char const *argv[]) {
    long long n;cin>>n;
    vector<long long> a(n), b(n+2);
    for(int i=0;i<n;++i){
        cin>>a[i];
        b[a[i]] = i+1;
    }
    set<long long> se;
    se.insert(0);
    se.insert(n+1);
    long long res = 0;
    for(long long i = 1;i<=n;++i){
        long long p = b[i];
        se.insert(p);
        auto itr = se.find(p);
        itr--;
        long long l = p-(*itr)-1;
        itr++;
        itr++;
        long long r = (*itr)-p-1;
        res += i*(1 + l + r + l*r);
    }
    cout<<res<<endl;
    return 0;
}

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

double a[55];
double ans;

int main()
{
  
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  ans = a[0];
  for (int i = 1; i < n; i++)
  	ans = (double)((ans + a[i]) / 2);
  cout << fixed << setprecision(55) << ans << endl;
	  
  return 0;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N,D,X;
    cin >> N >> D >> X;
    int count = X;
    REP(i,N){
        int per;
        cin >> per;
        count += 1 + (D-1)/per;
    }
    cout << count << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

int main (void) {
  int n;
  cin >> n;
  int a;
  cin >> a;
  n %= 500;
  cout << (n <= a ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
int main()
{
	std::string s;
	std::cin>>s;
	std::sort(s.begin(),s.end());
	int j=0;
	for(int i=0;i<s.size();i=i+2)
	{
		if(s[i]==s[i+1])
		j++;
		if(i==2 and (s[i]==s[i-1]))
		j--;
	}
	if(j==2)
	std::cout<<"Yes\n";
	else
	std::cout<<"No\n";	
}

Measured memory_bytes: 3596
#include <stdio.h>
int main() {
    long N, min_n, max_n;
    long long sum = 0;
    min_n = 1000000000;
    max_n = -1000000000;
    scanf("%ld", &N);
    for (int i = 0 ; i < N; i++) {
        long number = 0;
        scanf("%ld", &number);
        sum += number;
        if (number < min_n) min_n = number;
        if (number > max_n) max_n = number;
    }
    printf("%ld %ld %lld\n", min_n, max_n, sum);
}


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

using namespace std;

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

const int N = 2e5;
int a[N], r[N];
vector<int> e[N], b;

int find(int v) {
  int l = 0, r = b.size() - 1, s = b.size();
  while(l + 1 < r) {
    int m = (r + l) / 2;
    if(b[m] < v) l = m;
    else r = m;
  }
  if(l < s && v <= b[l]) return l;
  else if(l < r && r < s && v <= b[r]) return r;
  else return -1;
  return 0;
}

int dfs(int c, int p) {
  int x = find(a[c]), y;
  if(x == -1) b.push_back(a[c]);
  else {
    y = b[x];
    b[x] = a[c];
  }
  r[c] = b.size();
  for(auto i : e[c]) {
    if(i != p) dfs(i, c);
  }
  if(x == -1) b.pop_back();
  else b[x] = y;
  return 0;
}

int main() {
  int n;
  cin >> n;
  rep(i,n) cin >> a[i];
  rep(i,n-1) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    e[u].push_back(v);
    e[v].push_back(u);
  }

  dfs(0, -1);

  rep(i,n) cout << r[i] << endl;
  return 0;
}



Measured memory_bytes: 29944
from functools import partial
from sys import stdin

p = partial(print, end='')

sx, sy, tx, ty = map(int, stdin.readline().split())

dx = tx - sx
dy = ty - sy

p('R' * dx)
p('U' * dy)
p('L' * dx)
p('D' * (dy + 1))
p('R' * (dx + 1))
p('U' * (dy + 1))
p('LU')
p('L' * (dx + 1))
p('D' * (dy + 1))
print('R')


Measured memory_bytes: 4212
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {
        static void Main(string[] args)
        {
            int[] nk = ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = nk[0];
            int k = nk[1];
            long[] vs = new long[n];
            for (int i = 0; i < n; i++)
            {
                vs[i] = long.Parse(ReadLine());
            }
            Array.Sort(vs);
            long ans = long.MaxValue;
            for (int i = 0; i < n-(k-1); i++)
            {
                if (vs[i+k-1] - vs[i] < ans)
                {
                    ans = vs[i + k - 1] - vs[i];
                }
            }
            WriteLine(ans);
        }
    }
}

Measured memory_bytes: 18140
#include <assert.h>
#include <bits/stdc++.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <bitset>
#include <fstream>
#include <unordered_map>
#include <iostream>
#include <list>
#include <set>
#include <stack>
#include <string>
#include <vector>

 
using namespace std;
 
typedef string str;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;




#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define trav(a, x) for (auto &a : x)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define PRINT_ARRAY(a, N)        \
  F0R(z, N) cout << a[z] << " "; \
  cout << "\n"
 
const int MOD = 1000000007;  // 998244353
const ll INF = 1e18;
const ld PI = 4 * atan((ld)1);


ll N, W;
ll w[100005];
ll v[100005];
ll dp[101][100005];

int main() {
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
		cout.tie(NULL);
		cin >> N >> W;

		F0R(i, N) cin >> w[i] >> v[i];

		for (int i = 1; i <= N; i++) {
				for (int j = 1; j <= W; j++) {
						dp[i][j] = dp[i - 1][j];
						if (j - w[i - 1] >= 0) dp[i][j] = MAX(dp[i][j], v[i - 1] + dp[i - 1][j - w[i - 1]]);
				}
		}
		cout << dp[N][W] << endl;
}


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

lr = []
for _ in range(Q):
    lr.append(list(map(int,input().split(' '))))

index_list = []
#index_list = [0] * N
start = 0
for i in range(N):
    if S[i-1] == 'A' and S[i] == 'C':
        start += 1
        #index_list[i] = index_list[i-1] + 1
    #else:
    index_list.append(start)
        #index_list[i] = index_list[i-1]

for l,r in lr:
    print(index_list[r-1] - index_list[l-1])

Measured memory_bytes: 30612
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

void prime_factorize(int n, std::map<int,int>& prime_factors) {
	for(int i=2;i*i<=n;i++) {
		while(n%i==0) {
			prime_factors[i]++;
			n/=i;
		}
	}
	if(n!=1) prime_factors[n]++;
}

int gcd(int a, int b) {
  if (b==0) return a;
  return gcd(b,a%b);
}

signed main() {
	int a,b;
	std::cin >> a >> b;
	std::map<int,int> prime_factors;
	prime_factorize(gcd(a,b),prime_factors);
	print(prime_factors.size()+1);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * Rounding
 */
public class Main{

    public static void main(String... args) {
        // 標準入力から読み取り
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        sc.close();

        /* xがa未満であれば0を、a以上の時に10を出力 */
        // System.out.println(x < a ? 0 : 10);
        if(x < a) System.out.println(0);
        else System.out.println(10);
    }
}

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

int main(){
  int a, b, c, t;
  cin >> a >> b >> c;
  if(a>b){
  	t = a;
  	a = b;
  	b = t;
  }
  if(b>c){
  	t = b;
  	b = c;
  	c = t;
  }
  if(a>b){
  	t = a;
  	a = b;
  	b = t;
  }
  cout << a << " " << b << " " << c << endl;
  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <math.h>
using namespace std;

#define rep(i, o) for (int i = 0; i < (o); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

int main() {
  int n, k;
  cin >> n >> k;

  int snuke[n] = {0}; int snack[k] = {0};
  rep(i, k) {
      cin >> snack[i];
      rep(j, snack[i]) {
          int have_snack;
          cin >> have_snack;
          snuke[have_snack-1]++;
      }
  }

  int count = 0;
  rep(i, n) {
      if (snuke[i] == 0) count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cassert>

int digit_sum(int n){
    assert(1 <= n);
    int sum = 0;
    while(n > 0){
        sum += n % 10;
        n = n / 10;
    }
    return sum;
}

int main(int argc, char **argv)
{

    int N;
    std::cin >> N;

    assert(2 <= N);
    assert(N <= 100000);

    int v = -1;
    for(int A = 1; A <= N-1; A++){
        int B = N - A;
        int nv = digit_sum(A) + digit_sum(B);
        if(v == -1 || nv < v) v = nv;
    }

    std::cout << v << std::endl;    
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N; cin >> N;
  vector<ll> a(N), b(N);
  rep(i, N) cin >> a[i] >> b[i];

  ll n_plus = 0;
  for (int i = N - 1; i >= 0; --i){
    a[i] += n_plus;
    if (a[i] % b[i] == 0) continue;
    if (a[i] > b[i]){
      ll k = a[i] / b[i] + 1;
      n_plus += b[i] * k - a[i];
    }
    else{
      n_plus += b[i] - a[i];
    }
  }
  cout << n_plus << endl;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

string str;

string Func(int n, int sum, string s){
    if(n == 4){
        //cout << s << endl;
        if(sum == 7){
            return s;
        }
        else {
            return "";
        }
    }
    string s1 = Func(n + 1, sum + int(str[n] - '0'), s + "+" + str[n]);
    string s2 = Func(n + 1, sum - int(str[n] - '0'), s + "-" + str[n]);
    if(s1 != ""){
        return s1;
    }
    if(s2 != ""){
        return s2;
    }
    return "";
}

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

    cin >> str;

    int sum = int(str[0] - '0');
    string s;
    s += str[0];
    cout << Func(1, sum, s) + "=7" << endl;

    return 0;
}

Measured memory_bytes: 256
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    n = int(input())
    xy = [list(map(int, input().split())) for i in range(n)]
    
    d = defaultdict(int)
    for i in range(n):
        for j in range(n):
            if i == j:
                continue
            aaa = xy[i][0] - xy[j][0]
            bbb = xy[i][1] - xy[j][1]
            d[(aaa,bbb)]+=1
            
    t = 0
    for v in d.values():
        t = max(v , t)
    print(n - t)

    






    


if __name__ == '__main__':
    main()


Measured memory_bytes: 5752
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_082_A.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP    PIC X(7).
    01 a      PIC 9(3).
    01 b      PIC 9(3).

    01 D      PIC 9(3).
    01 R      PIC 9(3).

    01 ZS     PIC Z(3)9.
    01 DUMMY  PIC X(1).

    01 ans    PIC X(3).
PROCEDURE                        DIVISION.
MAIN.
    ACCEPT INP.

    UNSTRING INP
    DELIMITED BY SPACE
    INTO a b.

    ADD a TO b.
    DIVIDE 2 INTO b GIVING D REMAINDER R.
    ADD R TO D.

    MOVE D TO ZS

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


Measured memory_bytes: 512
#include<stdio.h>

int A[10000000], n;

int BinarySearch(int);

int main(){
  int i,j,k,sum=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);}

  scanf("%d",&j);
  for(i=0;i<j;i++){
    scanf("%d",&k);
    if(BinarySearch(k))
      sum++;
  }
  printf("%d\n",sum);
  return 0;}
int BinarySearch(int key){
  int left=0;
  int right=n;
  int mid;
  while(left<right){
    mid=(left+right)/2;
    if(key==A[mid])
      return 1;
    if(key>A[mid])
      left=mid+1;
    else if(key<A[mid])
      right=mid;}
  return 0;}



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

int main(){
    int n;
    long long total=0;
    int max=-1000000;
    int min=1000000;
    cin >> n;
    for(int i=0;i<n;i++){
        int temp;
        cin >> temp;
        if(max<temp) max=temp;
        if(min>temp) min=temp;
        total+=temp;
    }
    cout << min << ' ' << max << ' ' << total << endl;
    return 0;
}



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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int a,b,sum;

main() {
    cin >> a >> b;
    rep1(i,b-a) sum += i;
    ct(sum-b)
}






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

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        string s=cin.next();
        string[] youbi={"SUN","MON","TUE","WED","THU","FRI","SAT"};
        int ans=0;
        for(int i=0;i<7;i++)
        {
          if(s==youbi[i]){ans=i;break;}
        }
      ans=7-ans;
      Console.WriteLine(ans);
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

Measured memory_bytes: 11092
/*This is the solution from Ling2Feng1, no matter AC or not.*/
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<cstdio>
#include<string>
#include<vector>
#include<math.h>
#include<time.h>
#include<utility>
#include<cstdlib>
#include<sstream>
#include<cstring>
#include<stdio.h>
#include<iomanip>
#include<iostream>
#include<algorithm>
//#include<conio.h>
//ios::sync_with_stdio(false);
using namespace std;
int n,m;
map<int,int> mp;
int a; 
int main(){
	mp.clear();
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		mp[a]++;
	}
	cin>>m;
	for(int i=0;i<m;i++){
		cin>>a;
		if(mp[a]) --mp[a];
		else{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 9600
use std::io::*;
use std::str::FromStr;
use std::cmp;
use std::collections::HashMap;
use std::collections::HashSet;
use std::char;
use std::cmp::{min, max};
use itertools::Itertools;
use std::ops::{Add, AddAssign};
use num_integer::{Integer, gcd, lcm};
use std::collections::VecDeque;
use smallvec::alloc::collections::LinkedList;
use regex::internal::Char;
use std::iter::once;

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

fn read_tuple2<T: FromStr, S: FromStr>(stdin: &mut StdinLock) -> (T, S) {
    let a = read(stdin);
    let b = read(stdin);
    (a, b)
}

fn read_tuple3<T: FromStr, S: FromStr, R: FromStr>(stdin: &mut StdinLock) -> (T, S, R) {
    let a = read(stdin);
    let b = read(stdin);
    let c = read(stdin);
    (a, b, c)
}

fn lower_bound<T: Copy, F>(v: &Vec<T>, f: F) -> Option<usize> where
    F: Fn(T) -> bool
{
    let mut left = 0;
    let mut right = v.len() - 1;
    if !f(v[left]) {
        return None;
    }
    if f(v[right]) {
        return Some(right);
    }
    loop {
        if right - left == 1 {
            return Some(left);
        }
        let mid = (left + right) / 2;
        if f(v[mid]) {
            left = mid;
        } else {
            right = mid;
        }
    }
}


fn main() {
    // template
    let stdin = stdin();
    let mut stdin = stdin.lock();
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    // template ends
    let (n, m): (u64, u64) = read_tuple2(&mut stdin);
    let time = 2_u64.pow(m as u32);
    let ans = (100 * (n - m) + m * 1900) * time;
    writeln!(out, "{}", ans);
}



Measured memory_bytes: 2160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//解説AC
int main() {
  int n;
  cin>>n;
  vector<int>c(n),s(n),f(n),a(n+1,0);
  for(int i=0;i<n;i++){
    cin>>c[i]>>s[i]>>f[i];
  }
  for(int i=0;i<n;i++){
    for(int j=i;j<n-1;j++){
      if(a[i]<s[j])a[i]=s[j];
      else if(a[i]%f[j]==0);
      else a[i]+=f[j]-a[i]%f[j];
      a[i]+=c[j];
    }
  }
  for(int i=0;i<n;i++){
    cout<<a[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

void _main() {
    int N, K;
    cin >> N >> K;
    if (K == 1) {
        cout << N * N * N << endl;
        return;
    }
    if (K == 2) {
        int n0 = N / 2;
        int n1 = N - n0;
        cout << n0 * n0 * n0 + n1 * n1 * n1 << endl;
        return;
    }
    int n = N / K;
    int ans = n * n * n;
    if (K % 2 == 0) {
        n = N / (K / 2) - n;
        ans += n * n * n;
    }
    cout << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 
#define int long long
#define double long double

////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////

int n,m,v,vv,p,a[110000];

bool f(int x){
  if(x <= p)return true;
  if(a[x]+m < a[p])return false;
  int k = p*m;
  repd(i,x+1,n+1){
    k += m;
  }
  repd(i,p,x){
    k += (a[x]+m-a[i]);
  }
  return (k >= m*v);
}

signed main(){
  cin>>n>>m>>v>>p;rep(i,n)cin>>a[i+1];a[0] = INF;
  sort(a+1, a+n+1, greater<int>());
  int ok = 1, ng = n+1;
  while(abs(ok-ng) > 1){
    int mid = (ok+ng)/2;
    (f(mid) ? ok : ng) = mid;
  }

  cout << ok << endl;
}




Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
 
//最小公倍数lcm
static long lcm (long a, long b) {
	long temp;
	long c = a;
	c *= b;
	while((temp = a%b)!=0) {
		a = b;
		b = temp;
	}
	return c/b;
}
  
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   long A = sc.nextLong()-1;
   long B = sc.nextLong();
   long C = sc.nextInt();
   long D = sc.nextInt();
   
   long lcm_cd = 0;
   long sum_B = 0;
   long sum_A = 0;
   if(C >=D) 
   {
    lcm_cd = lcm(C,D);
   }
   else 
   {
     lcm_cd = lcm(D,C);
   } 
   sum_B = B - ( (B/C) + (B/D) - (B/lcm_cd) );
   sum_A = A - ( (A/C) + (A/D) - (A/lcm_cd) );
   System.out.println(sum_B-sum_A);
 }
}

Measured memory_bytes: 23380
var N = 0
var A = 0

fun main(args: Array<String>) {
    readLine()?.split(" ")?.map {
        it.toInt()
    }?.let {
        N = it[0]
        A = it[1]
    }


    val x = IntArray(N + 1)
    readLine()?.split(" ")?.map {
        it.toInt()
    }?.forEachIndexed { i, n ->
        x[i + 1] = n
    }

    val dp = Array(N + 1) {
        Array(N + 1) {
            LongArray(N * A + 1)
        }
    }
    for (i in 0..N) {
        dp[i][0][0] = 1
    }

    for (i in 1..N) {
        for (j in 1..i) {
            for (k in 1..(N * A)) {
                dp[i][j][k] = if (k < x[i]) {
                    dp[i - 1][j][k]
                } else {
                    dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i]]
                }
            }
        }
    }

    var ans = 0L
    for (j in 1..N) {
        ans += dp[N][j][j * A]
    }

    println(ans)
}



Measured memory_bytes: 109720
import sys
import fractions
if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline

A, B = map(int, input().split())

def make_divisors(n):
		divisors = []
		for i in range(1, int(n**0.5)+1):
				if n % i == 0:
						divisors.append(i)
						if i != n // i:
								divisors.append(n//i)

		divisors.sort()
		return divisors

# nの素数判定
def is_prime(n):
		if n == 1:
				return False
		for i in range(2,int(n**0.5)+1):
				if n % i == 0:
						return False
		return True

N=(fractions.gcd(A, B))
#print(N)
div = make_divisors(N)
#print(div)

ans = 1 # divに1が含まれているため（互いに素の中で必ず1は選べる）
for d in div:
	ans += 1 if is_prime(d) else 0

print(ans)

Measured memory_bytes: 5308
# coding:utf-8

a,b = (int(x) for x in input().rstrip().split())

area = a * b
rap = 2 * (a + b)

print(str(area) + " " + str(rap))


# <?php

# fscanf(STDIN,"%d %d",$a,$b);

# $area = $a * $b;
# $rap = 2 * ($a + $b);

# echo $area . " " . $rap . PHP_EOL;

# ?>


Measured memory_bytes: 5608
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').let {
        it[0].toInt() to it[1].toLong()
    }
    val a = readLine()!!.split(' ').map { it.toInt() }.sorted().toIntArray()
    val f = readLine()!!.split(' ').map { it.toInt() }.sortedDescending().toIntArray()

    var l = 0L
    var r = 1e12.toLong()
    while (l < r) {
        val m = l + (r - l) / 2

        var x = 0L
        for (i in 0 until n) {
            x += Math.max(a[i] - (m / f[i]), 0)
        }

        if (x <= k) {
            r = m
        } else {
            l = m + 1
        }
    }

    println(l)
}


Measured memory_bytes: 113928
n = gets.to_i
num = gets.strip.split.map(&:to_i)
i = 0
sum = 0
h = num[0]
while i < n do
  if num[i] >= h
    sum += 1
  end
  if num[i] >= h
    h = num[i]
  end
  i += 1
end
puts sum

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

#define REP(i, n, m) for(int i = n; i < m; i++)
#define REPR(i, n, m) for(int i = n; i >= m; i--)
#define LREP(i, n, m) for(ll i = n; i < m; i++)
#define LREPR(i, n, m) for(ll i = n; i >= m; i--)

#define INF 1e9 + 1;
#define MOD 1e9 + 7;

typedef long long ll;
//typedef pair<int, int > P;
//typedef pair<ll, ll > LP;

using namespace std;

int gcd(int a, int b){
    if(a < b) swap(a, b);
    return b?gcd(b, a%b):a;
}

ll N, K;

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

    cin >> N >> K;

    ll ans;
    ll num;
    num = N / K;
    ans = num * num * num;
    if(K % 2 == 0){
        num = (N + K / 2) / K;
        ans = ans + num * num * num;
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
n = int(input())

sp = [list(input().split()) for i in range(n)]
for index, sp_t in enumerate(sp):
        sp_t.append(index)
sp.sort(key=lambda x:int(x[1]), reverse=True)
# print(sp)
sp.sort(key=lambda x:x[0])
# print(sp)

for sp_t in sp:
        print(sp_t[2]+1)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
using namespace std;
bool check(vector<int> A, int middle, int K){
    int sum = 0;
    for(int i = 0; i < A.size(); ++i){
        if(A[i] <= middle) continue;
        else sum += A[i]/middle;
    }
    return (sum <= K);
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for(int i = 0; i < N; ++i){
        cin >> A[i];
    }

    int first = 0, last = 1e9;
    while(last - first > 1){
        int middle = (last + first)/2;
        if(check(A, middle, K)) last = middle;
        else first = middle;
    }
    cout << last << '\n';
    return 0;
}
//Saw catupper-san's video

Measured memory_bytes: 4716
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    string s;
    cin >> s;
    int a = 0;
    for (char c : s) a += (c == '+' ? 1 : -1);
    cout << a << endl;

    return 0;
}

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

using namespace std;
const int MAXN = 3e3 + 7;
const int INF = 1e9 + 7;

int dp[MAXN][MAXN];
  
int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  int m = t.size();
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      if(i == 0 || j == 0) dp[i][j] = 0;
      else if (s[i-1] == t[j-1]) dp[i][j] = 1 + dp[i-1][j-1];
      else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
    }
  }
  string ans = "";
  int i = n, j = m;
  while (i > 0 && j > 0) {
    if (s[i - 1] == t[j - 1]) {
      ans.push_back(s[i - 1]);
      i--; j--;
    }
    else if(dp[i-1][j] > dp[i][j-1]) i--;
    else j--;
  }
  reverse(ans.begin(), ans.end());
  cout << ans;
  return 0;
}

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

#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 CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define endl '\n'

using namespace std;

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

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 = 200005;

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;
    cin >> n;
    int nt = 0;
    P npos = MP(0, 0);
    bool f = true;
    while(n--) {
        int t, x, y;
        cin >> t >> x >> y;
        int tt = abs(x - npos.F) + abs(y - npos.S);
        if(t - nt < tt) {
            f = false;
            continue;

        }
        if(t - nt > tt && ((t - nt) - tt) % 2 == 1) {
            f = false;

        }
        npos = MP(x, y);
        nt = t;
    }
    if(f) cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
package main

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

// 最大積載量がpの時、k台のトラックで何個詰めるかを返します
func check(n int, k int, ws []int, p int64) int {
	i := 0
	for j := 0; j < k; j++ {
		s := 0
		for int64(s+ws[i]) <= p {
			s = s + ws[i]
			i++
			if i == n {
				return n
			}
		}
	}
	return i
}

func resolve(n int, k int, ws []int) int64 {
	var left int64
	left = 0
	var right int64
	right = 10000 * 100000
	var mid int64
	for (right - left) > 1 {
		mid = int64((right + left) / 2)
		v := check(n, k, ws, mid)
		if v >= n {
			// 積載量midで十分に詰める
			right = mid
		} else {
			// 積載量midでは足りない
			left = mid
		}
	}
	return right
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	n, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return n
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	k := nextInt(sc)
	var ws []int
	for i := 0; i < n; i++ {
		ws = append(ws, nextInt(sc))
	}
	p := resolve(n, k, ws)
	fmt.Println(p)
}



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

using namespace std;
typedef long long ll;
typedef double ld;

ll n;
ll yak[10000010];
ll ans;

int main(void)
{
	scanf("%lld", &n);
	
	for(ll i = 1 ; i <= 10000000 ; i++)
	{
		for(ll j = 1 ; j <= 10000000 / i ; j++)
			yak[i * j]++;
	}
	
	for(ll i = 1 ; i <= n ; i++)
		ans += yak[i] * i;
	
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 81948
#include<stdio.h>
typedef long long ll;
int main(void)
{
  long  n;
  ll a[200000];
  ll max=1000000000000000000;
  scanf("%ld",&n);
  for(long i=0;i<n;i++){
    scanf("%lld",&a[i]);
    if(a[i]==0||a[i]>max){
      puts("0");
      return 0;
    }
  }
  ll sum=1;
  long start=0;
  while(start<n){
    if(a[start]>max){
      puts("-1");
      return 0;
    }
    sum*=a[start];
    max/=a[start];
    start++;
  }
  printf("%lld\n",sum);
  return 0;
}


Measured memory_bytes: 2520
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long int ll;

#define MAXN 1005
#define MAXA 10005
#define MAXH 10005

int h,n;
ll A[MAXN];
ll B[MAXN];

ll dp[MAXH+MAXA];

int main(){
	cin >> h >> n;
	
	int largest = -1;
	for( int i = 0; i < n; i++ ){
		cin >> A[i] >> B[i];
		if( largest < A[i] ) largest = A[i];
	}
	
	memset( dp, 0x3f, sizeof(dp) );
	
	dp[0] = 0;
	for( int i = 0; i < n; i++ ){
		for( int j = A[i]; j <= h+largest; j++ ){
			dp[j] = min( dp[j], dp[j-A[i]]+B[i]  );
		}
	}
	
	
	ll res = 0x3f3f3f3f3f3f3f3fL;
	for( int i = h; i <= h+largest; i++ )
		res = min(res,dp[i]);
	
	cout << res << endl;

}



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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

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

typedef long long ll;



int main() {
    int N,Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    vector<pair<int,int>> v(Q);
    vector<int> cnt(N);
    REP(i,Q) {
        int l,r;
        cin >> l >> r;
        v[i]=make_pair(l-1,r-1);
    }
    bool Acamed=false;
    int nowAC=0;
    REP(i,N) {
        if (S[i]=='A') Acamed=true;
        else if(Acamed && S[i]=='C') {
            Acamed=false;
            nowAC++;
        }
        else Acamed=false;
        cnt[i]=nowAC;
    }
    REP(i,Q) {
        cout << cnt[v[i].second]-cnt[v[i].first] << endl;
    }


    return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n, a, b;
	cin >> n >> a >> b;

	int diff = abs(a - b - 1);
	if (diff & 1) {
		cout << "Alice\n";
	} else {
		cout << "Borys\n";
	}

	return 0;

}

Measured memory_bytes: 256
// B - An Odd Problem
#include <bits/stdc++.h>
using namespace std;
int in(){int x;cin>>x;return x;}

int main(){
	int c = 0, n = in();
	for(int i=1; i<=n; ++i) if(i%2 & in()%2) c++;
	cout<< c <<endl;
}


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

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

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

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	string s;
	cin >> s;

	bool ans = true;
	string s1 = s;
	string s2 = s;
	reverse(all(s2));
	rep(i, s1.size())
	{
		if(s1[i] != s2[i])
			ans = false;
	}
	s1 = s.substr(0, (s.size() - 1) / 2);
	s2 = s1;
	reverse(all(s2));
	cerr << s1 << endl;
	cerr << s2 << endl;
	rep(i, s1.size())
	{
		if(s1[i] != s2[i])
			ans = false;
	}
	s1 = s.substr((s.size() + 3) / 2 - 1);
	s2 = s1;
	reverse(all(s2));
	cerr << s1 << endl;
	cerr << s2 << endl;
	rep(i, s1.size())
	{
		if(s1[i] != s2[i])
			ans = false;
	}

	cout << (ans ? "Yes" : "No") << endl;
	return 0;
}

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

int main(){
  string haiku;
  cin >> haiku;
  
  cout << haiku.substr(0, 5) << " ";
  cout << haiku.substr(6, 7) << " "; 
  cout << haiku.substr(14) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 55;

int main()
{
  int N, M, D[1000], C[1000];
  long long dp[1001];

  cin >> N >> M;
  for(int i = 0; i < N; i++) {
    cin >> D[i];
  }
  for(int j = 0; j < M; j++) {
    cin >> C[j];
  }

  fill_n(dp, N + 1, INF);
  dp[0] = 0;
  for(int i = 0; i < M; i++) {
    for(int j = N; j > 0; j--) {
      dp[j] = min(dp[j], dp[j - 1] + D[j - 1] * C[i]);
    }
  }
  cout << dp[N] << endl;

  return(0);
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, x;
  scanf(" %d", &n);
  char command[256];
  list<int> L;
  for (size_t i = 0; i < n; i++) {
    scanf(" %s%d", command, &x);
    if (strcmp(command, "insert") == 0) {
      L.push_front(x);
    } else if (strcmp(command, "delete") == 0) {
      auto iter = L.begin();
      while (iter != L.end()) {
        if (*iter == x) {
          L.erase(iter);
          break;
        } else {
          iter = next(iter);
        }
      }

    } else if (strcmp(command, "deleteFirst") == 0) {
      L.pop_front();
    } else if (strcmp(command, "deleteLast") == 0) {
      L.pop_back();
    }
  }

  int cnt = 0;
  for (auto e : L) {
    if (cnt == 0) {
      cout << e;
    } else {
      cout << " " << e;
    }
    cnt++;
  }
  cout << endl;
}



Measured memory_bytes: 34500
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

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

	int x = 0;
	int ans = x;
	for (auto op : S) {
		if (op == 'I') {
			++x;
		}
		else if (op == 'D') {
			--x;
		}
		ans = max(ans, x);
	}
	cout << ans << endl;
}


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

int main(){
  string s;
  cin >> s;
  bool Cflag=false;
  if(s.at(0)!='A'){cout << "WA" << endl; return 0;}
  if((int)(s.at(1))<=96){cout << "WA" << endl; return 0;}
  for(int i=2; i<s.size()-1; i++){
    if(Cflag){
      if(s.at(i)<=96){cout << "WA" << endl; return 0;}
    }else{
      if(s.at(i)=='C'){Cflag = true;}
      else if(s.at(i)<=96){cout << "WA" << endl; return 0;}
    }
  }
  if((int)(s.at(s.size()-1))<=96){cout << "WA" << endl; return 0;}
  if(Cflag)cout << "AC" << endl;
  else cout << "WA" << endl;
}

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

void solve()
{
	long long ans = N-1;
	for(long long i = 2; i*i<=N;++i){
		if(N%i==0) ans=min(ans, i-1+(N/i-1));
	}
	cout << ans << "\n";
}

int main()
{
	cin >> N;
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll n;
    cin >> n;
    vec a(3*n);
    for (auto &e : a) {
        cin >> e;
    }

    ll score = 0;
    priority_queue<ll, vec, greater<ll>> p;
    vec pos;
    Rep (i, n) {
        score += a[i];
        p.push(a[i]);
    }
    pos.push_back(score);

    Rep (i, n) {
        score += a[i+n];
        p.push(a[i+n]);
        ll e = p.top();
        p.pop();
        score -= e;
        pos.push_back(score);
    }

    reverse(a.begin(), a.end());
    score = 0;
    while (p.size()) p.pop();
    vec neg;
    for (ll &e : a) e *= -1;
    Rep (i, n) {
        score += a[i];
        p.push(a[i]);
    }
    neg.push_back(score);
    Rep (i, n) {
        score += a[i+n];
        p.push(a[i+n]);
        ll e = p.top();
        p.pop();
        score -= e;
        neg.push_back(score);
    }
    reverse(neg.begin(), neg.end());

    ll ans = -inf;
    Rep (i, n+1) {
        chmax(ans, pos[i] + neg[i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 5748
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

s = ns()
t = ns()
print('Yes' if s == t[:-1] else 'No')


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

int main(){
    string thing;
    cin >> thing;
    //cout << "Yes"<< endl;
    //cout << thing[3] << thing[4] << endl;
    if(thing[2] == thing[3] && thing[4] == thing[5]){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#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;

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

    int n; cin >> n;
    std::vector<ll> a(n); rep(i,n) cin >> a[i];
    
    ll double_x = 0LL;

    rep(i,n){
        if(i%2) double_x -= a[i];
        else double_x += a[i];
    }
    
    rep(i,n){
        printf("%lld%c", double_x, i==n-1?'\n':' ');
        double_x = (a[i]-double_x/2)*2;
    }

    return 0;
}

Measured memory_bytes: 2176