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

//#define int long long
using bll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(v) (v).begin(), (v).end()
#define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

signed main() {
	ll N;
	scanf("%lld", &N);
	ll size=pow(2,N);
	multiset<ll> a;
	rep(i, size) {
		ll t;
		scanf("%lld", &t);
		a.insert(t);
	}

	queue<ll> q;
	auto itr=a.end();
	itr--;
	q.push(*itr);
	q.push(-1);
	a.erase(itr);
	while(1){
		ll t=q.front();
		q.pop();
		if(t==-1){
			if(a.size()==0){
				p("Yes");
				exit(0);
			}
			q.push(-1);
			continue;
		}
		auto itr=a.lower_bound(t);
		if(itr==a.begin()){
            p("No");
            exit(0);
        }
		itr--;
		q.push(t);
		q.push(*itr);
		a.erase(itr);
	}

	return 0;
}


Measured memory_bytes: 13696
#include<bits/stdc++.h>
using namespace std;
char str[1024];
char strtwo[1024];
int main()
{
	int k=0;
	int i;
	scanf("%s%s",str,strtwo);
	for(i=0;str[i]!='\0';i++)
	{
		if(str[i]==strtwo[i])
			k++;	
	}
	printf("%d",k);
	return 0;
}

Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def min(a,b)
    return a>b ? b : a
end
INF=Float::INFINITY
N,C=get_i
d=array(C)
color=Array.new(3){Hash.new(0)}
C.times do|i|
    d[i]=get_i
end
c=array(N)
N.times do|i|
    c[i]=get_i
end
N.times do|i|
    N.times do|j|
      color[(i+j+2)%3][c[i][j]]+=1
    end
end
ans=INF
C.times do|i|
    C.times do|j|
        next if i==j
        C.times do|k|
          next if i==k or j==k
          val=0
          color.each_with_index do|h,t|
            h.each do|key,v|
              case t
              when 0 then
                val+=d[key-1][i]*v
              when 1 then
                val+=d[key-1][j]*v
              when 2 then
                val+=d[key-1][k]*v
              end
            end
          end
          ans=min(ans,val)
        end
    end
end
puts ans

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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define vi vector<int>
typedef long long ll;

using namespace std;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(0); 
	int n;
	cin >> n;
	vi m(n , 0);
	rep(i , n){
		cin >> m[i];
		--m[i];
	}
	int ans = 0;
	rep(i , n){
		int t = m[i];
		if(m[t] == i)++ans;
	}
	cout << ans / 2 << nl;
	return 0;
}

Measured memory_bytes: 768
x,y,a,b,c=map(int,input().split())
p=sorted(list(map(int,input().split())),reverse=True)
q=sorted(list(map(int,input().split())),reverse=True)
r=sorted(list(map(int,input().split())),reverse=True)
p2=p[:x]
q2=q[:y]
memop=x-1
memoq=y-1
sp=sum(p2)
sq=sum(q2)
k=0
flagp=0
flagq=0
while k<c:
    if memop<0:
        flagp=1
    if memoq<0:
        flagq=1
    if flagp*flagq==1:
        print(sp+sq)
        exit()
    elif flagq==1:
        if p2[memop]>=r[k]:
            print(sp+sq)
            exit()
        else:
            sp-=p2[memop]
            sp+=r[k]
            k+=1
            memop-=1
    elif flagp==1:
        if q2[memoq]>=r[k]:
            print(sp+sq)
            exit()
        else:
            sq-=q2[memoq]
            sq+=r[k]
            k+=1
            memoq-=1
    elif p2[memop]>=r[k] and q2[memoq]>=r[k] and flagp+flagq==0:
        print(sp+sq)
        exit()
    elif p2[memop]>q2[memoq]:
        sq-=q2[memoq]
        sq+=r[k]
        k+=1
        memoq-=1
    elif p2[memop]<=q2[memoq]:
        sp-=p2[memop]
        sp+=r[k]
        k+=1
        memop-=1
print(sp+sq)


Measured memory_bytes: 22560
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

int N,Z,W;
int a[2010];

signed main(){
  cin>>N>>Z>>W;
  for(int t=0;t<N;t++)cin>>a[t];
  int temp1=0;
  if(N>=2)temp1=abs(a[N-1]-a[N-2]);
  int temp2=abs(W-a[N-1]);
  int ans=max(temp1,temp2);

  cout<<ans<<"\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
using namespace std;
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;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, K, Q;
  cin >> N >> K >> Q;
  vector<ll> score(N);
  rep(i, Q) {
    ll A; cin >> A;
    ++score[A-1];
  }
  rep(i, N) {
    if(K + score[i] - Q > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

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

int main(){

  int n;
  cin>>n;
  
  vector<int> A,B;

  int x,zero=0;
  for(int i=0;i<n;i++){
    
    cin>>x;
    
    if(x==0)zero++;
    
    if(x==0||x==1) B.push_back(x);
    else A.push_back(x);
  }
  
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  
  if(zero%2){
    
    if(B[B.size()-1]==1){

      for(int i=0;i<B.size()-1;i++)
	if(B[i]==0&&B[i+1]==1){
	  swap(B[i],B[i+1]);
	  break;
	}
      
    }else if(A.size()){
      
      int tmp=A[0];
      A.erase(A.begin());

      vector<int> C;
      int f=0;
      for(int i=B.size()-1;i>=0;i--){
	C.push_back(B[i]);
	if(!f&&B[i]==0){
	  f=1;
	  C.push_back(tmp);
	}
      }
      reverse(C.begin(),C.end());
      
      B=C;
    }
    
  }
  
  if(A.size()>=2&&A[A.size()-1]==3&&A[A.size()-2]==2)
    swap(A[A.size()-1],A[A.size()-2]);

  for(int i=0;i<A.size();i++)cout<<A[i]<<endl;
  
  for(int i=0;i<B.size();i++)cout<<B[i]<<endl;
    
  return 0;
}

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

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

  for(int i=0;i<s.size();i++){
    for(int j=i+1; j<s.size();j++){
      if(s[i] == s[j]){
        printf("no");
        return 0;
      }
    }
  }

  printf("yes");
  
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := []int{}
	for i := 0; i < n; i++ {
		var aa int
		fmt.Scan(&aa)
		a = append(a, aa)
	}
	sortWithPrint(n, a)
}

func sortWithPrint(n int, a []int) {
	for i := 0; i < n; i++ {
		v := a[i]
		j := i-1
		for ; j >= 0 && a[j] > v; j-- {
			a[j+1] = a[j]
		}
		a[j+1] = v

		// print
		fmt.Print(a[0])
		for k := 1; k < n; k++ {
			fmt.Printf(" %d", a[k])
		}
		fmt.Println()
	}
}



Measured memory_bytes: 1212
n, y = map(int, input().split())

c = 0

for a in range(n + 1):
    for b in range(n + 1 - a):
        c = n - a - b
        ans = 10000 * a + 5000 * b + 1000 * c
        if (ans == y):
            print(a, b, c)
            exit()

print(-1, -1, -1)


Measured memory_bytes: 2940
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#define INF 0x1234567812345678

using namespace std;
typedef long long int lli;

lli d[200][200];
int v,e;

void warshall() {
    for(int k=0; k<v; k++)
        for(int i=0; i<v; i++)
            for(int j=0; j<v; j++)
                if(d[i][k] != INF && d[k][j] != INF)
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}

int main(void) {
    scanf("%d%d",&v,&e);
    for(int i=0; i<200; i++)
        for(int j=0; j<200; j++)
            d[i][j] = 0x1234567812345678;

    for(int i=0; i<e; i++) {
        int s,t,d_;
        scanf("%d%d%d",&s,&t,&d_);
        d[s][t] = d_;
    }
    for(int i=0; i<v; i++)
        d[i][i] = 0;
    warshall();
    for(int i=0; i<v; i++)
        if(d[i][i] < 0) {
            printf("NEGATIVE CYCLE\n");
            return 0;
        }
    for(int i=0; i<v; i++)
        for(int j=0; j<v; j++) {
            if(d[i][j] == INF)
                printf("INF");
            else
                printf("%lld", d[i][j]);
            printf("%c", (j==v-1 ? '\n' : ' '));
        }
    return 0;
}

Measured memory_bytes: 1344
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 123456789
//0x3f3f3f3f
#define INFL 10000000000000000
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
typedef pair<int,pii> pdii;
long long int MOD = 1000000007;
vector<pii> graph[2525];
int N;
vector<ll> a;
int main(){
	int N;
	ll A,B;
	cin>>N>>A>>B;
	vector<ll> hp;
	for(int i=0;i<N;i++){
		ll x;
		cin>>x;
		hp.pb(x);
		
	}
	ll hpd[114514];
	ll mi=0,ma=1e9+1;
	while(ma-mi>1){
		ll med=(ma+mi)/2;
		ll cnt=0;
		for(int i=0;i<N;i++){
			if((hp[i]-med*B)>0){
				cnt+=(hp[i]-med*B+A-B-1)/(A-B);
			}
		}
		if(cnt>med){
			mi=med;
		}else{
			ma=med;
		}
	}
	cout<<ma<<endl;
}



Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
constexpr uint64_t L1 = 1ull;
constexpr ull bit(int n){ return 1ull << n;}

constexpr ll INF       = 1000000000;/* 1e+9a */


void solve(istream& cin) {
    string s;
    while(cin >> s){
        int B = 0;
        ll ans = 0;
        for (int i = 0; i < s.size(); ++i) {
            if(s[i] == 'B'){
                B++;
            }
            else{
                ans += B;
            }
        }// i
        cout << ans << endl;
    }
}

int main(int argc, char *argv[]) {
    string FileName("A"), Modifier("_MEPH");
    string ExecutionName = FileName + Modifier;
    string sub(argv[0]);
    // pass消去
    if(sub.size() > ExecutionName.size())
        sub = sub.substr(sub.size()-ExecutionName.size(), ExecutionName.size());

	// 数値計算もの用
    cout << setprecision(16) << scientific;
    if (sub != ExecutionName) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        solve(cin);
    }
    else {    
	    cerr << sub << endl;
        string inFile = "A_sample.txt";
        auto fs = fstream(inFile, fstream::in);
        solve(fs);
    }
}


Measured memory_bytes: 720
n=int(input())
array=[]
for i in range(2,n+1):
    s=i
    while s!=1:
        turn=0
        for j in range(2,s+1):
            if s%j==0:
                s=s//j
                array.append(j)
                break
ans=1
import collections
c=collections.Counter(array)
l=list(c.values())
for i in range(len(l)):
    ans*=l[i]+1
print(ans%(10**9+7))
 

Measured memory_bytes: 3316
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(ll (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrrep(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,q;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
    
//------ Believe yourself as a genius!!!!!! ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>a>>b;
    s=to_string(b);
    cnt=1;
    rep(i,Size(s))cnt*=10;
    ans=a*cnt+b;
    rrep(i,1,ohara){
        if(i*i==ans){
            Cout("Yes");
            return 0;
        }
    }
    Cout("No");
    return 0;
}

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

using namespace std;

int main(void){
    int n, k;
    cin >> n >> k;
    vector<bool> ok(n, false);
    for(int i = 0; i < k; i++){
        int d;
        cin >> d;
        for(int j = 0; j < d; j++){
            int a;
            cin >> a;
            ok[a-1] = true;
        }
    }
    int sum = 0;
    for(int i = 0; i < n; i++){
        if(!ok[i]){
            sum++;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3600
N = int(input())
B = list(map(int,input().split(' ')))
A = []
A.append(B[0])
if N == 2:
  A.append(B[-1])
  print(sum(A))
  exit()
else:
  for i in range(N-2):
    a = min(B[i],B[i+1])
    A.append(a)
  A.append(B[-1])
  print(sum(A))

Measured memory_bytes: 3064
def main():
    n,k = map(int, input().split())
    H = [int(input()) for _ in range(n)]

    ans = 10 ** 9
    H_sorted = sorted(H)
    for i in range(n-k+1):
        ans = min(ans,H_sorted[i+k-1]-H_sorted[i])
    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;

int n, m, q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> A) {
    if (A.size() == n + 1) {
        int now = 0;
        for (int i = 0; i < q; i++) {
            if (A[b[i]] - A[a[i]] == c[i]) {
                now += d[i];
            }
        }
        ans = max(ans, now);
        return;
    }
    A.push_back(A.back());
    while (A.back() <= m) {
        dfs(A);
        A.back()++;
    }
}

int main(int argc, char const *argv[]) {
    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    for (int i = 0; i < q; i++) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(vector<int>(1, 1));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3156
N, x = map(int, input().split())

childlen = []
for part in input().split():
    childlen.append(int(part))

childlen.sort()

happy = 0
for n in range(len(childlen)):
    child = childlen[n]
    x -= child
    happy += 1
    
    if x < 0:
        print(happy - 1)
        exit(0)
    elif x == 0:
        print(happy)
        exit(0)

# もしも配りきれなかったら、一旦戻す
if x != 0:
    happy -= 1

print(happy)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

const int k = 38;
const int n = k * (k-1) + 1;

vector<int> a[n+1];

int tmp[k][k];

int main()
{
	int ind = 1;
	for(int i=1; i<=k; ++i){
		a[i].pb(1);
		for(int j=1; j<k; ++j) a[i].pb(++ind);
	}
	{
		int tp = k+1;
		for(int i=0; i<k-1; ++i){
			for(int j=0; j<k-1; ++j){
				tmp[i][j] = tp++;
			}
		}
	}
	
	int rn = k;
	for(int t=2; t<=k; ++t){
		for(int j=1; j<k; ++j){
			a[rn + j].pb(t);
			int col = j-1;
			for(int l=1; l<k; ++l){
				a[rn + j].pb(tmp[l-1][col]);
				col += (t-2); col %= (k-1);
			}
		}
		rn += k-1;
	}
	printf("%d %d\n", n, k);
	for(int i=1; i<=n; ++i){
		for(int x:a[i]) printf("%d ",x);
		putchar(10);
	}
	return 0;
}


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

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

	vector<int> a_num(n + 1, 0), b_num(n + 1, 0);

	for (int i = 0; i < m; i++) {
		int tmp_a, tmp_b;
		cin >> tmp_a >> tmp_b;
		a_num[tmp_a]++;
		b_num[tmp_b]++;
	}

	for (int i = 1; i <= n; i++) {
		cout << a_num[i] + b_num[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<string> S(n);
  vector<unordered_map<string, int>> ss(1000005);
  vector<int> size(1000005);
  int mn = inf;
  rep(i, n) {
    cin >> S[i];
    reverse(all(S[i]));
    ss[S[i].size()][S[i]]++;
    size[S[i].size()]++;
    mn = min((int)S[i].size(), mn);
  }
  ll ans = 0;
  rep(i, n) {
    vector<bool> alpha(26);
    while(S[i].size() >= 0) {
      if(S[i].size()+1 < mn) break;
      rep(k, 26) if(alpha[k]) {
        S[i] += char('a'+k);
        if(size[S[i].size()] && ss[S[i].size()].find(S[i]) != ss[S[i].size()].end()) ans++;
        S[i].pop_back();
      }
      if(S[i].size() == 0) break;
      alpha[S[i].back()-'a'] = true;
      S[i].pop_back();
    }
  }
  ans -= n;
  cout << ans << endk;
  return 0;
}


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

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

  int h, w;
  cin >> h >> w;
  vector< string > tab(h);
  for(int i = 0; i < h; i++) cin >> tab[i];

  bool r[h], c[w];
  fill(r, r + h, false);
  fill(c, c + w, false);
  for(int i = 0; i < h; i++){
    bool found = false;
    for(int j = 0; j < w; j++){
      if(tab[i][j] == '#'){
        found = true;
        break;
      }
    }
    r[i] = found;
  }
  for(int j = 0; j < w; j++){
    bool found = false;
    for(int i = 0; i < h; i++){
      if(tab[i][j] == '#'){
        found = true;
        break;
      }
    }
    c[j] = found;
  }

  vector< string > ans;
  for(int i = 0; i < h; i++){
    if(!r[i]) continue;
    string s;
    for(int j = 0; j < w; j++){
      if(c[j]) s.push_back(tab[i][j]);
    }
    ans.push_back(s);
  }

  string buf;
  for(string s: ans){
    buf += s + "\n";
  }

  cout << buf;

  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
using namespace std;

int main() {
	double A, B, H, M, deg1, deg2, deg3, C;
	double pi = acos(-1),hun;

	cin >> A >> B >> H >> M;

	hun = H * 60 + M;
	deg1 = 0.5 * hun;
	deg2 = 6 * hun;
	deg3 = abs(deg2 - deg1) * pi / 180;
	C = sqrt(A * A + B * B-2*A*B*cos(deg3));

	cout << fixed << setprecision(20) << C << endl;


	return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(m+1);
    for (int i = 0; i < m; i++)
    {
        cin >> a.at(i);
    }
    vector<long long> x(n+1);
    int c = 0;
    x.at(0) = 1;
    x.at(1) = 1;
    if (a.at(0) == 1)
    {
        c++;
        x.at(1) = 0;
    }
    for (int i = 2; i < n+1; i++)
    {
        x.at(i) = x.at(i - 1) + x.at(i - 2);
        x.at(i) = x.at(i) % 1000000007;
        if (a.at(c) == i)
        {
            c++;
            x.at(i) = 0;
        }
    }
    cout << x.at(n) << endl;
}


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

int x, y, z, k;
long long a[1000], b[1000], c[1000];

int main() {
  cin >> x >> y >> z >> k;
  for (int i = 0; i < x; ++i) cin >> a[i];
  for (int i = 0; i < y; ++i) cin >> b[i];
  for (int i = 0; i < z; ++i) cin >> c[i];
  
  vector<long long> v;
  for (int i = 0; i < x; ++i) for (int j = 0; j < y; ++j) v.push_back(a[i] + b[j]);
  
  sort(v.rbegin(), v.rend());
  sort(c, c+z), reverse(c, c+z);
  
  vector<long long> w;
  for (int i = 0; i < v.size(); ++i) for (int j = 0; j < z; ++j) if (i * j <= k) {
    w.push_back(v[i] + c[j]);
  }
  
  sort(w.rbegin(), w.rend());
  
  for (int i = 0; i < k; ++i) cout << w[i] << endl;
}

Measured memory_bytes: 22248
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+5;
ll a[N]={0,1,2,3,4,5,6,7,8,9};
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,k=9,p1=1,p2=0;
	cin>>n;
	while(k<n)
	{
		if(abs(a[p1]%10-a[p2])<=1)
			a[++k]=a[p1]*10+a[p2];
		p2++;
		if(p2==10) p1++,p2=0;
	}
	cout<<a[n]<<'\n';
	return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h> 
using namespace std;
 
typedef long long ll;

#define rep(pp,nn) for (int ii = pp; ii < nn; ++ii)
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
 
string int_to_string(int x) {
    stringstream ss;
	ss << x;
	string ni = ss.str();
	return ni;
}
constexpr int mod = 1e9 + 7;
ll POW(ll a, ll b) {
	ll ans = 1;
	while (b) {
		if(b & 1) {
			ans = ans * a;
		}
		a = a * a;
		b /= 2;
	}
	return ans;
}

ll power(ll a, ll b) {
	ll ans = 1;
	while (b) {
		if(b & 1) {
			ans = (ans * a) % mod;
		}
		a = (a * a) % mod;
		b /= 2;
	}
	return ans;
}
ll gcd(ll a, ll b) {
	if (a == 0) {
		return b;
	}
	return gcd(b % a,a);
}
ll lcm(ll a, ll b) {
	return (a * b) / gcd(a,b);
}
bool isprime(ll n) {
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i == 0) {
			return 0;
		}
	}
	return 1;
}

ll power_mod(ll a, ll b, ll mo) {
	ll ans = 1;
	while (b) {
		if(b & 1) {
			ans = (ans * a) % mo;
		}
		a = (a * a) % mo;
		b /= 2;
	}
	return ans;
}     

int main() {
	int n;
	cin >> n;
	int cnt = 0;
	for (int i = 1; i <= n; ++i) {
		int x;
		cin >> x;
		if (x % 2 == 1 && i % 2 == 1) {
			cnt++;
		}
	}
	cout << cnt;
}








Measured memory_bytes: 3568
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a // gcd(a, b) * b
#print(lcm(lcm(1000000,999999),999998))
#print(999998//2*999999)


#print(1000000*999999*999998%mod)
n=I()
lis=LI()
promod=1
LCM=1
for i in range(n):
    LCM=lcm(lis[i],LCM)
#print(LCM)

for i in range(n):
    promod=(promod*(lis[i]%mod))%mod
smmod=0
for i in range(n):
    smmod=(smmod+promod*pow(lis[i],mod-2,mod))%mod
#print(smmod)
x=(promod*pow(LCM%mod,mod-2,mod))%mod
ans=(smmod*pow(x,mod-2,mod))%mod
print(ans)
    
    


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

int main(){
	long long a, b;
	cin >> a >> b;
	if( a*b <= 0 ){
		cout << "Zero" << endl;
		return 0;
	}
	if( a > 0 && b > 0 ){
		cout << "Positive" << endl;
		return 0;
	}
	if( a < 0 && b < 0 ){
		if( (b-a+1)%2 == 0 ){
			cout << "Positive" << endl;
		}else{
			cout << "Negative" << endl;
		}
		return 0;
	}
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <sstream>
using namespace std;

int top = 0;
int s[1000];

void push(int n){
	++top;
	s[top] = n;
}

int pop(){
	--top;
	return s[top + 1];
}

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

	string str;
	getline(cin, str);
	//cin >> str;

	int prev = 0;
	size_t i0 = 0;
	while(i0 <= str.size()){
		string s0;
		if(str[i0] == ' ' || i0 == str.size()){
			s0 = str.substr(prev, i0 - prev);
			//cout << s0 << endl;
			prev = i0 + 1;
			int a = 0;
			int b = 0;
			if(s0[0] == '+'){
				b = pop();
				a = pop();
				push(a + b);
			}
			else if(s0[0] == '-'){
				b = pop();
				a = pop();
				push(a - b);
			}
			else if(s0[0] == '*'){
				b = pop();
				a = pop();
				push(a * b);
			}
			else if(s0[0] == '/'){
				b = pop();
				a = pop();
				push(a / b);
			}
			else {
				//push(stoi(s0));
				istringstream is(s0);
				int a0;
				is >> a0;
				push(a0);
			}
		}
		++i0;
	}

	cout << pop() << endl;

	return 0;
}

Measured memory_bytes: 1232
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const h1 = parseInt(args[0][0], 10)
	const w1 = parseInt(args[0][1], 10)
	const h2 = parseInt(args[1][0], 10)
	const w2 = parseInt(args[1][1], 10)
	console.log((h1 * w1) - (w1 * h2 + (h1 - h2) * w2))
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define inf 12345678
using namespace std;
inline int read()
{int x=0,f=0;
char c=getchar();
while (c<'0'||c>'9') 
{if (c=='-') f=1;
c=getchar();
}
while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
if (f) x=-x;
return x;
}
inline int max(int a,int b)
{return a>b?a:b;}
inline int min(int a,int b)
{return a<b?a:b;}
int l[21][200005],r[21][200005];
int a[200005],n,v,p[21],cnt=0;
int fl[262145],fr[262145],tot[21];
inline int calc(int pos)
{int lp=l[cnt+1][pos]-1,rp=r[cnt+1][pos]+1;
for (int i=0;i<(1<<cnt);i++)
{if (fl[i]>=lp&&fr[(1<<cnt)-1-i]<=rp) return 1;
}
return 0;
}
int main (){
	int i,j;
	n=read();v=read();
	for (i=1;i<=n;i++)
	{a[i]=read();}
	while (v) {p[++cnt]=v;v>>=1;}
	p[++cnt]=0;
	reverse(p+1,p+cnt+1);
	for (j=1;j<=cnt;j++)
	{int pos=1;
	while (pos<=n)
	{int sta=pos;
	while (pos<=n&&a[pos+1]-a[pos]<=p[j]) pos++;
	for (i=sta;i<=pos;i++) 
	{l[j][i]=sta;r[j][i]=pos;}
	pos++;tot[j]++;
	}
	l[j][n+1]=n+1;r[j][n+1]=n+1;
	l[j][0]=0;r[j][0]=0;
	}
	if (tot[cnt]>cnt)
	{for (i=1;i<=n;i++)
	{puts("Impossible");}
	return 0;
	}
	cnt--;
	for (i=0;i<(1<<cnt);i++)
	{fl[i]=0;fr[i]=n+1;
	for (j=1;j<=cnt;j++)
	{if (!((1<<(j-1))&i)) continue;
	fl[i]=max(fl[i],r[j][fl[(i^(1<<(j-1)))]+1]);
	fr[i]=min(fr[i],l[j][fr[(i^(1<<(j-1)))]-1]);
	}
	}
	int las;
	for (i=1;i<=n;i++)
	{if (l[cnt+1][i]==i) las=calc(i);
	puts(las?"Possible":"Impossible");
	}
	return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<ll,ll>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll N;
    vector<pl> AB;
    cin >> N;
    for (int i = 0; i < N; i++) {
        ll a,b;
        cin >> a >> b;
        AB.pb(mp(a,b));
    }
    asort(AB);
    cout << AB[AB.size()-1].first + AB[AB.size()-1].second << endl;
}

Measured memory_bytes: 5348
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
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<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

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

ll calc(ll x){
    if (x == 1) return 1;
    return 2 * calc(x / 2) + 1;
}

int main() {
    ll x;
    cin >> x;
    cout << calc(x) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main(){
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    if(s<t) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;
template <typename Functor>
struct fix_type
{
    Functor functor;
    template <typename... Args>
    decltype(auto) operator()(Args&&... args) const& { return functor(functor, std::forward<Args>(args)...); }
};
template <typename Functor>
fix_type<typename std::decay<Functor>::type> fix(Functor&& functor) { return {std::forward<Functor>(functor)}; }
template <typename T, typename A>
inline ostream& operator<<(ostream& os, const vector<T, A>& v)
{
    os << "[";
    for (const auto& p : v) { os << p << ","; }
    return (os << "]" << endl);
}

int main()
{
    int N;
    cin >> N;
    ll C;
    cin >> C;
    vector<ll> x(N);
    vector<ll> y(N);
    vector<ll> v(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> v[i];
        y[N - i - 1] = C - x[i];
    }
    vector<ll> lsum(N + 1, 0);
    vector<ll> rsum(N + 1, 0);
    vector<ll> lmax(N + 1, 0);
    vector<ll> rmax(N + 1, 0);
    for (int i = 1; i <= N; i++) {
        lsum[i] = lsum[i - 1] + v[i - 1];
        lmax[i] = max(lmax[i - 1], lsum[i] - x[i - 1]);
    }
    for (int i = 1; i <= N; i++) {
        rsum[i] = rsum[i - 1] + v[N - i];
        rmax[i] = max(rmax[i - 1], rsum[i] - y[i - 1]);
    }
    ll ans = 0;
    for (int i = 0; i <= N; i++) {
        ans = max(ans, lsum[i] - 2 * (i == 0 ? 0 : x[i - 1]) + rmax[N - i]);
    }
    for (int i = 0; i <= N; i++) {
        ans = max(ans, rsum[i] - 2 * (i == 0 ? 0 : y[i - 1]) + lmax[N - i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5760
n, m, l = map(int, input().split())
A = []
B = []

for i in range(n) :
    col = list(map(int, input().split()))
    A.append(col)

for i in range(m) :
    col = list(map(int, input().split()))
    B.append(col)

ans = []

for i in range(n) :
    col = []
    for j in range(l) :
        element = 0
        for k in range(m) :
            element += A[i][k] * B[k][j]
        col.append(element)
    ans.append(col)

for col in ans :
    print(" ".join(map(str, col)))



Measured memory_bytes: 6908
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

p = [a, b, c, d, e]
if n%min(p) != 0:
    print(n//min(p)+5)
else:
    print(n//min(p)+4)

Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<stdlib.h>

using namespace std;

int sta[1000];
int c;

void push(int x){
  sta[++c]=x;
}
int pop(){
  c=c-1;
  return sta[c+1];
}


int main(){
  char st1[1000];
  int math1,math2;
  int c=0;
  while(scanf("%s",st1)!=EOF){
    /*printf("%c\n",st1[0]);
    math1=atoi(st1);
    if(flag==0){
      a=math1;
    }
    flag=1;
    //printf("%d\n",math1);
    //printf("%d\n",a);
    sum=math1+a;
    */
    if(st1[0]=='+'){
      math1=pop();
      math2=pop();
      push(math1+math2);
    }
    else if(st1[0]=='*'){
      math1=pop();
      math2=pop();
      push(math1*math2);
    }
    else if(st1[0]=='-'){
      math2=pop();
      math1=pop();
      push(math1-math2);
    }
    else {
      push(atoi(st1));
    }
  }
  printf("%d\n",pop());
  return 0;
}



Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    string s;
    cin >> s;
    bool ok = 0;
    for (char c : s) ok |= c == '7';
    cout << (ok ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3624
s = [int(i) for i in input().split('/')]

y = s[0]
m = s[1]
d = s[2]

if y < 2019:
	print('Heisei')
elif y > 2019:
	print('TBD')
else:
	if m < 4:
		print('Heisei')
	elif m > 4:
		print('TBD')
	else:
		if d <= 30:
			print('Heisei')
		else:
			print('TBD')
	

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

using namespace std;

const int INF = 1e9;

int n,i,dp[200055],to[200055],j;
char s[200055];
stack <int> pos[26];

int main(){
	scanf("%s", s + 1);
	
	n = strlen(s + 1);
	
	for(i = n + 1; i <= n + 26; i++)
	s[i] = 'a' + i - 1 - n;
	
	for(i = 0; i < 26; i++)
	pos[i].push(n + i + 1);
	
	for(i = n; i >= 0; i--){
		int mn = INF;
		int ind = -1;
		
		for(j = 0; j < 26; j++){
			if(dp[pos[j].top()] < mn){
				mn = dp[pos[j].top()];
				ind = pos[j].top();
			}
		}
		
		dp[i] = mn + 1;
		to[i] = ind;
		
		if(i != 0)
		pos[s[i] - 'a'].push(i);
	}
	
	int now = 0;
	
	while(now <= n){
		now = to[now];
		printf("%c", s[now]);
	}
	
	printf("\n");
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a + b == c || a + c == b || b + c == a) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void Solve() {
	int n, a, b;
	cin >> n >> a >> b;

	if (abs(a - b) % 2 == 0) {
		cout << "Alice\n";
	} else {
		cout << "Borys\n";
	}		
}

int main() {
	int tests = 1;
	for (;tests; --tests) {
		Solve();
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main(){
  long long n, k;
  cin >> n >> k;
  if(n < k) cout << 1 << endl;
  else{
    vector<long long> sum(n + 1, 0);
    long long ans = 1;
    for(long long i = 0; i <= n; ++i){
      sum[i] = i * (i + 1) / 2;
    }
    for(int i = k; i <= n; ++i){
      ans += sum[n] - sum[n - i] - sum[i - 1] + 1;
      ans %= MOD;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 4772
# https://agc024.contest.atcoder.jp/tasks/agc024_a


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

if K < 2:
    for i in range(K):
        A, B, C = B + C, A + C, A + B
    ans = A - B

    if ans > 10 ** 18:
        print('Unfair')
    else:
        print(ans)
else:
    if K % 2 == 0:
        ans = A - B
    else:
        ans = -A + B

    if ans > 10 ** 18:
        print('Unfair')
    else:
        print(ans)


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

int main() {
  vector<int> g(100010,0);
  ll N,K,Q;
  cin >> N >> K >> Q;
  for (int i = 0; i < Q; i++) {
    int a; cin >> a;
    g[a-1]++;
  }
  int ans =0;
  for (int i = 0; i < N; i++)
  {
    if (K-(Q-g[i])>0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<int> vec(n + 1, 0);
	for(int i = 0; i < n; i++)
	{
		int x; cin >> x;
		vec[x]++;
	}
	bool ok = true;
	//for(int i = 0; i < n; i++) cout << vec[i] << " "; cout << endl;
	if(n % 2 == 0)
	{
		for(int i = 0; i < n; i++)
		{
			if(vec[i] != 2 && i % 2 != 0) ok = false;
			else if(vec[i] > 0 && i % 2 == 0) ok = false;
		}
	}
	else
	{
		if(vec[0] != 1) ok = false;
		for(int i = 1; i < n; i++)
		{
			if(vec[i] != 2 && i % 2 == 0) ok = false;
			else if(vec[i] > 0 && i % 2 != 0) ok = false;
		}
	}
	if(ok == false)
	{
		cout << 0 << endl;
	}
	else
	{
		ll x = 1;
		for(int i = 0; i < n / 2; i++)
		{
			x = (x * 2) % MOD;
		}
		cout << x << endl;
	}
	return 0;
}



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

void pv(vector<int>& v) {
    cout << "{ ";
    for (auto el: v) {
        cout << el << ", ";
    }
    cout << " }" << endl;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int x, y;
    cin >> x >> y;
    for (int i = 0; i <= x; i++) {
        int c = i;
        int t = x - i;
        if (2 * c + 4 * t == y) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


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

int main() {
  int N, counter = 0;
  bool flg = false;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A.at(i);

  while(true) {
    rep(i, N) {
      if (A.at(i) % 2 != 0) flg = true;
    }
    if (flg) break;
    rep(i, N) A.at(i) /= 2;
    counter++;
  }
  
  cout << counter << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1005,M=5005,inf=1e8,lim=-1e7;
int n,i,lt[N],he[N],a[N];
int fx[N],fy[N],gx[M],gy[M];
int read(){
	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());
	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;
}
void gmax(int &x,int k){if (k>x) x=k;}
void cal(int x){
	int i,m=a[x],sum=0;
	for (i=0;i<=m;i++) gx[i]=gy[i]=0;
	for (int y=he[x];y;y=lt[y]){
		int v=a[y],vx=fx[y],vy=fy[y];
		sum+=v;
		int kx=a[y]-vx,ky=a[y]-vy;
		for (i=m;i>=0&&gx[i]>lim;i--)
			gx[i]=max(i>=v?gx[i-v]+kx:-inf,i>=vy?gx[i-vy]:-inf);
		for (i=m;i>=0&&gy[i]>lim;i--)
			gy[i]=max(i>=v?gy[i-v]+ky:-inf,i>=vx?gy[i-vx]:-inf);
	}
	fx[x]=sum-gx[m];fy[x]=sum-gy[m];
}
int main(){
	for (n=read(),i=2;i<=n;i++){
		int x=read();lt[i]=he[x];he[x]=i;
	}
	for (i=1;i<=n;i++) a[i]=read();
	for (i=n;i;i--) cal(i);
	puts(fx[1]<inf||fy[1]<inf?"POSSIBLE":"IMPOSSIBLE");
}

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

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;

    int max = 0;

    int temp = 0;
    for(int i=0; i<s.length(); i++){
        char a = s[i];
        if(a == 'A' || a == 'T' || a == 'C' || a == 'G'){
            temp ++;
        }else{
            if(max < temp){
                max = temp;
            }
            temp = 0;
        }
    }

    if(max < temp){
        max = temp;
    }
    
    cout << max << '\n';
    
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int k,x;
cin >> k >> x;
for(int i=x-k+1;i<x+k;i++) {
  cout << i << " ";
}
cout << endl;
return 0;
}


Measured memory_bytes: 256
string solve(string s){
	return s.replace(',',' ');
}
void main(){
	string s = readln().chomp();
	solve(s).writeln();
}
     
import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math, std.range;
const long mod = 10^^9+7;      
// 1要素のみの入力
T inelm(T= int)(){
	return to!(T)( readln().chomp() );
}
     
// 1行に同一型の複数入力
T[] inln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split())ln ~= elm.to!T();
	return ln;
}


Measured memory_bytes: 2684
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>

#pragma warning( disable: 4996 )

using namespace std;

typedef long long ll;

#define INF 100000000
#define EPS 1e-9


int n;

vector<int> ans_list;

int main(){

	while (true){
		cin >> n;
		if (n == 0)
			break;
		int count = 0;
		int sum = 0;
		for (int i = 1; i < n; i++){
			sum = i;
			for (int j = i + 1;; j++){
				sum += j;
				if (sum == n){
					count++;
					break;
				}
				else if (sum > n)
					break;
			}
		}

		ans_list.push_back(count);

	}

	for (int i = 0; i < ans_list.size(); i++){
		cout << ans_list[i] << endl;
	}


	return 0;

}

Measured memory_bytes: 1216
let func a b c =
  let rec f x res =
    if x > b then res
    else
    if c mod x = 0 then f (x+1) (res+1)
    else f (x+1) res
  in f a 0
  
let () =
  print_int @@  Scanf.scanf "%d %d %d\n" func; print_newline ()

Measured memory_bytes: 2412
class UnionFind
  attr_accessor :parent, :rank, :size

  def initialize(size)
    @size = size
    @parent = size.times.to_a
    @rank = Array.new(size, 0)
  end

  def root(x)
    if parent[x] == x
      x
    else
      parent[x] = root(parent[x])
    end
  end

  def same?(x, y)
    root(x) == root(y)
  end

  def merge(x, y)
    x_root = root(x)
    y_root = root(y)

    return if x_root == y_root

    if rank[x_root] < rank[y_root]
      parent[x_root] = y_root
      rank[x_root] = nil
    else
      parent[y_root] = x_root
      rank[y_root] = nil
      rank[x_root] += 1 if rank[x_root] == rank[y_root]
    end
  end

  def shortage_all
    size.times { root(_1) }
  end
end

N, M = gets.split.map(&:to_i)
uf = UnionFind.new(N)

m = 0
M.times do
  a, b = gets.split.map(&:to_i)
  a -= 1
  b -= 1
  uf.merge(a,b)
end
uf.shortage_all
puts uf.parent.tally.values.max


Measured memory_bytes: 26744
def search(N,Y):
    exist = False
    
    yukichi_max = Y//10000
    for yukichi in range(yukichi_max+1):
        ichiyo_max = (Y-yukichi*10000)//5000
        for ichiyo in range(ichiyo_max+1):
            hideyo = N-yukichi-ichiyo
            
            if (yukichi*10000 + ichiyo*5000 + hideyo*1000) == Y:
                return yukichi, ichiyo, hideyo
                
                
    if not exist:
        return (-1,-1,-1)

N,Y = map(int, input().split())

    
print(*search(N,Y))

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

int main() {
  int r, g , b, n; cin >> r >> g >> b >> n;
  int counter = 0;

  for(int i = 0; i <= n/r; i++) {
    for(int j = 0; j <= n/g; j++) {
      int k = n - i*r - j*g;
      if(k%b == 0 && k >= 0) counter++;
    }
  }
  cout << counter << endl;
}


Measured memory_bytes: 256
n, x = map(int, input().split())
city_list = list(map(int, input().split()))


diff = [abs(i-x) for i in city_list]

def gcd(a, b):
    while  b != 0:
        a, b  = b, a % b
    return a


fact = diff[-1]
for i in diff[:-1]:
    fact = gcd(fact, i)


print(fact)

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

vector<ll> primes;

void calc_prime() {
    ll upper = 123456 * 10;
    vector<bool> used(upper, false);
    for(ll i = 2; i < upper; i++) {
        if(used[i]) continue;
        primes.push_back(i);
        for(ll j = 1; i * j < upper; j++) used[i * j] = true;
    }
    primes.push_back(1e9);
}

bool solve() {
    ll N;
    cin >> N;
    if(!N) return false;
    auto itel = upper_bound(primes.begin(), primes.end(), N);
    auto iteu = upper_bound(primes.begin(), primes.end(), 2 * N);
    cout << distance(itel, iteu) << endl;
    return true;
}

int main() {
    calc_prime();
    while(solve());
    return 0;
}



Measured memory_bytes: 3892