akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

T RD(T = long)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool INSIDE(T)(T x, T b, T e) { return x >= b && x < e; }

long mod = pow(10, 9) + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

struct UnionFind
{
	void init(long n) { par = new long[](n); foreach (i; 0..n) par[i] = i; }
	long root(long i) { return par[i] == i ? i : (par[i] = root(par[i])); }
	bool same(long i, long j) { return root(i) == root(j); }
	void unite(long i, long j) { i = root(i); j = root(j); if (i == j) return; par[i] = j; }
	long[] par;
}

long[] dijkstra(long from, long to, long[][] edges)
{
	long[] path;
	auto cost = new long[](edges.length); fill(cost, long.max); cost[from] = 0;
	long[][] open = [[from]];
	while (!open.empty)
	{
		auto n = open.front; open.popFront;
		auto p = n[0];
		foreach (i; 0..edges.length)
		{
			if (edges[p][i] == -1) continue;
			auto c = cost[p] + edges[p][i];
			if (c < cost[to] && c < cost[i]) { cost[i] = c; if (i == to) path = i ~ n; else open ~= i ~ n; }
		}
	}
	return cost[to] ~ path;
}

void main()
{
	auto N = RD;
	auto A = RD;
	auto B = RD;

	auto h = new long[](N);
	foreach (i; 0..N)
	{
		h[i] = RD;
	}
	h.sort();

	bool test(long cnt)
	{
		long b_sum = B * cnt;
		long a_cnt;
		foreach (i; 0..N)
		{
			if (h[i] <= b_sum) continue;
			long remain = h[i] - b_sum;
			long diff   = A - B;
			long need_a = remain / diff + (remain % diff != 0 ? 1 : 0);
			a_cnt += need_a;
			if (a_cnt > cnt) return false;
		}
		return true;
	}

	long max_cnt = h[$-1] / B + (h[$-1] % B != 0 ? 1 : 0);
	long mid_cnt = max_cnt / 2;
	long band    = max(1, mid_cnt);
	long ans;
	bool end;
	while (true)
	{
		stderr.writeln(mid_cnt);
		if (band == 0) end = true;
		if (test(mid_cnt))
		{
			ans = mid_cnt;
			mid_cnt -= max(1, band);
		}
		else
		{
			mid_cnt += max(1, band);
		}
		band = band == 1 ? 0 : (band + 1) / 2;

		if (end) break;
	}

	writeln(ans);
	stdout.flush();
}

Measured memory_bytes: 4092
def f0(x):
    ones = (x + 1) // 2
    if x % 2 == 1:
        x = ones % 2
    else:
        x = x ^ (ones % 2)

    return x


def f(A, B):
    s = f0(A - 1)
    t = f0(B)
    return s ^ t


def main():
    A, B = map(int, input().split())
    ans = f(A, B)

    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
N = gets.to_i
h = gets.split.map(&:to_i)

ans = 0

loop do
  from = 0

  while h[from] == 0 && from < N
    from += 1
  end

  break if from >= N

  min_value = h[from]
  to = from

  while h[to + 1] != 0 && to < N - 1
    to += 1
    min_value = [min_value, h[to]].min
  end

  ans += min_value

  (from..to).each do |i|
    h[i] -= min_value
  end
end

puts ans


Measured memory_bytes: 3836
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    if((a*b)%2 == 0){
      System.out.println("Even");
    } else {
      System.out.println("Odd");
    }
  }
}

Measured memory_bytes: 21844
"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10));
   let A = xs[0];
   let B = xs[1];
   let count = 0;
   
   for(let i=A; i<=B; i++){
     let ans1 = i.toString();
     let ans2 = ans1.split('').reverse().join('');
     
     if(ans1==ans2){
       count++;
     }
   }
   console.log(count);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 37516
//arc074_c.cpp
//Sat Jan  5 11:24:02 2019

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

ll solve(ll x, ll y){
	ll tempx = floor(x/3);
	ll returndif = LLINF;
	for (ll i=tempx;i<=tempx+1;i++){
		ll firstarea = i*y;
		ll tempy = floor(y/2);
		for (ll j=tempy;j<=tempy+1;j++){
			ll s[3];
			s[0] = firstarea;
			s[1] = (x-i)*j;
			s[2] = (x-i)*(y-j);
//			cout << s[0] << " " << s[1] << " " << s[2] << endl;
			sort(s,s+3);
			if (s[2]-s[0]<returndif){
				returndif = s[2]-s[0];
			}
		}
		ll tempx2 = floor((x-tempx)/2);
		for (ll j=tempx2;j<=tempx2+1;j++){
			ll s[3];
			s[0] = firstarea;
			s[1] = j*y;
			s[2] = (x-i-j)*y;
//			cout << s[0] << " " << s[1] << " " << s[2] << endl;
			sort(s,s+3);
			if (s[2]-s[0]<returndif){
				returndif = s[2]-s[0];
			}
		}
	}
	return returndif;
}


int main(){
	ll h,w;
	cin >> h >> w;

	ll ans1 = solve(h,w);
	ll ans2 = solve(w,h);
//	cout << ans1 << " " << ans2 << endl;
	cout << min(ans1,ans2) << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
// #define DEBUG
#ifdef DEBUG
#define debug(var) cout << (#var) << ": " << (var) << endl;
template<class T> void dump_array_impl(const T& a) {
  bool first = true;
  for (auto&& x : a) {
    if (!first) cout << ", "; else first = false; cout << x;
  }
}
#define debug_array(a) cout<<(#a)<<": ";dump_array_impl(a);cout<<endl
#else
#define debug(var) {}
#define debug_array(a) {}
#endif
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) {
  v = vector<T>(n, x);
}
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n) {
  v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i];
}
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n;
vector<double> p, s;
int main() {
  cin >> n; read_n(p, n);
  init_n(s, n+1, 0.0);
  s[0] = 1.0;
  for (lli i=0; i<n; ++i) {
    for (lli j=i; j>=0; --j) {
      s[j+1] = s[j+1] + p[i] * s[j];
      s[j] = (1.0 - p[i]) * s[j];
    }
  }
  double ans = 0;
  for (lli i=n; i>n/2; --i) ans += s[i];
  printf("%.12lf\n", ans);
  return 0;
}


Measured memory_bytes: 256
N = int(input())
S = [input() for i in range(N)]

ans = {}
for i in S:
  if i in ans:
    ans[i] += 1
  else:
    ans[i] = 1

max_value = max(ans.values())
ANS = []
for key, value in ans.items():
  if ans[key] == max_value:
    ANS.append(key)
    
for i in sorted(ANS):
  print(i)

Measured memory_bytes: 35220
#include <bits/stdc++.h>
using namespace std;
char s[110][110];
char s2[210][110];
int main(void)
{
    int H,W;
    cin>>H>>W;
    for(int i=1;i<=H;i++)
    {
        cin>>s[i];
    }
    for(int i=1;i<=2*H;i++)
    {
        for(int j=0;j<W;j++)
        {
            s2[i][j]=s[(i+1)/2][j];
        }
    }
    for(int i=1;i<=2*H;i++)
    {
        cout <<s2[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())

a=[[0 for M in range(m)]for N in range(n)]
for k in range(n):
    A=list(map(int,input().split()))
    a[k]=A

b=[0]*m
for l in range(m):
    B=int(input())
    b[l]=B

for i in range(n):
    sum=0
    for j in range(m):
        sum=sum+a[i][j]*b[j]
    print(sum)


Measured memory_bytes: 6024
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main()
{
    int K, N;
    cin >> K >> N;
    int maximum = 0;
    int last = 0;

    //問題の読込
    vector<int> A(N);
    rep(i, N) { 
        int tmp = 0;
        cin >> tmp;
        A.at(i) = tmp - last;
        maximum = max(maximum, A.at(i));
        last = tmp;
    }

    cout << K - max(maximum, (K-last)+A.at(0));

}


Measured memory_bytes: 1272
def main():
  s = input()
  q = int(input())

  for _ in range(q):
    order = list(input().split())
    a,b = int(order[1]), int(order[2])

    if order[0] == 'print':
      print(s[a:b+1])
    elif order[0] == 'reverse':
      s = s[:a] + ''.join(list(reversed(s[a:b+1]))) + s[b+1:]
    else:
      p = order[3]
      s = s[:a] + p + s[b+1:]

if __name__ == '__main__':
  main()


Measured memory_bytes: 5616
import java.util.Arrays;
import java.util.Scanner;

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

        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++){
          a[i] = sc.nextInt();
        }
        Arrays.sort(a);

        long s = 0;

        for(int i=0; i<n; i++){
            s += a[i];
        }

        System.out.println(a[0] + " " + a[n-1] + " " + s );
    }
}



Measured memory_bytes: 41436
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  N = int(readline())
  A = list(map(int, readline().split()))
  B = list(map(int, readline().split()))
  C = list(map(int, readline().split()))
  ans = sum(B)
  for i in range(N-1):
    if A[i] + 1 == A[i+1]:
      ans += C[A[i]-1]
  print(ans)
  
  
if __name__ == '__main__':
  main()

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

using namespace std;
#define ll long long
const int N=100005;
int n;
int ar[N],br[N],cr[N];
int mem[N][5];

int solve(int ind,int lst){
    if(ind>=n){
        return 0;
    }
    if(mem[ind][lst]!=-1){
        return mem[ind][lst];
    }
    int ret=0;
    if(lst==1){
        ret=max(ret,solve(ind+1,2)+br[ind]);
        ret=max(ret,solve(ind+1,3)+cr[ind]);
    }
    else if(lst==2){
        ret=max(ret,solve(ind+1,1)+ar[ind]);
        ret=max(ret,solve(ind+1,3)+cr[ind]);

    }
    else if(lst==3){
        ret=max(ret,solve(ind+1,1)+ar[ind]);
        ret=max(ret,solve(ind+1,2)+br[ind]);

    }
    else{
        ret=max(ret,solve(ind+1,1)+ar[ind]);
        ret=max(ret,solve(ind+1,2)+br[ind]);
        ret=max(ret,solve(ind+1,3)+cr[ind]);

    }
    return mem[ind][lst]=ret;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(mem,-1,sizeof mem);
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>ar[i]>>br[i]>>cr[i];
    }
    cout<<solve(0,0)<<endl;
    return 0;
}

Measured memory_bytes: 8064
#include <stdio.h>

int main(){
    int h,s,m;
    int h1,s1,m1;
    int n;
    
    scanf("%d",&n);
    
    h = n / 3600;
    h1 = n % 3600;
    m = h1 / 60;
    s = h1 % 60;
    
    printf("%d:%d:%d\n",h,m,s);
    
    return 0;
}

Measured memory_bytes: 592
// 天ぷらうどんって美味しくない？.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//


#include <iostream>
#include<vector>
using namespace std;

int main() {
	int n,x,t;
	cin >> n >> x >> t;
	if (n%x == 0)
		cout << n / x * t << endl;
	else
		cout << (n / x + 1)*t << endl;
	return 0;


}
    

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] 

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

int main(){
	while(1){
		int n;
		bool know[100][100]; //構成員firstはsecondの情報を持つか
		
		for(int i=0; i<100; ++i)
		for(int j=0; j<100; ++j)
		know[i][j]=false;
		
		scanf(" %d", &n);
		if(n==0) break;
		for(int i=0; i<n; ++i){
			int m;
			scanf(" %d", &m);
				
			for(int j=0; j<m; ++j){
				int p;
				scanf(" %d", &p);
				know[i][p]=true; //iはpの情報を知っている
			}
		}	
		
		int k, list[100];
		scanf(" %d", &k);
		for(int i=0; i<k; ++i) scanf(" %d", &list[i]);
		
		int ans=-1;
		for(int i=0; i<n; ++i){
			bool flag=true;
			
			for(int j=0; j<k; ++j){
				if(!know[i][list[j]]){
					flag=false;
					break;
				}	
			}	
			
			if(flag){
				if(ans==-1) ans=i+1;
				else{ //複数いる
					ans=-1;	
					//printf("db\n");
					break;
				}
			}
		}
		
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1196
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    val t = sc.next()
    println(problem139a(s, t))
}

fun problem139a(s: String, t: String): Int {
    var count = 0
    for (i in 0..2) {
        if (s[i] == t[i]) count++
    }
    return count
}

Measured memory_bytes: 29604
x = list(map(int, input().split()))
x.sort()

first_1 = x[2] - x[1]
y = (x[2] - x[0] - first_1)
                                                                                                      
if y % 2 == 0:
  print(first_1 + (y//2))
else:
  print(first_1 + (y//2) + 2)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    int N;
    cin >> N;
    map<string, int> S;
    string t;
    int m = 0;
    for (int i = 0; i < N; i++) {
        cin >> t;
        if(S.count(t)){
            S[t]++;
            m = max(m, S[t]);
        }
        else{
            S[t] = 1;
            m = max(m, 1);
        }
    }
    for(auto v : S){
        auto a = v.first;
        auto b = v.second;
        if(b == m){
            printf("%s\n", a.c_str());
        }
    }

}

Measured memory_bytes: 19200
#S=input()
#T=input()
A,B,C,K=map(int,input().split(" "))
# a=[int(_) for _ in input().split(" ")]

#print("-----")

ans=0

if K<=A:
    ans=K
else:
    if K<=A+B:
        ans=A
    else:
        ans=A-(K-(A+B))


print(ans)





Measured memory_bytes: 9168
s = input()
stack = []
choices = ['dream', 'dreamer', 'erase', 'eraser']
for c in choices:
    if s[:len(c)] == c:
        stack.append(len(c))

ans = 'NO'
while len(stack) > 0:
    i = stack[-1]
    # print(stack, i)
    stack = stack[:-1]
    if i == len(s):
        ans = 'YES'
        break
    for c in choices:
        if s[i:i+len(c)] == c:
            stack.append(i+len(c))
                
print(ans)

Measured memory_bytes: 3540
from sys import stdin
import sys
# sys.setrecursionlimit(10**8)

def nextLine(): return next(stdin)
def nextStrList(): return nextLine().split()
def nextIntList(): return [int(_) for _ in nextStrList()]

import numpy as np

def main():
	n,m=nextIntList()
	al=nextIntList()
	
	s=n-sum(al)
	if s<0:
		print("-1")
	else: print(s)
	
if __name__=="__main__":
	main()


Measured memory_bytes: 27460
#include<bits/stdc++.h>
typedef long long i64;
const int N=4e5+7;
int n,x[N],gmn,gmx;
i64 ans=1ll<<61;
void mins(i64&a,i64 b){if(a>b)a=b;}
void mins(int&a,int b){if(a>b)a=b;}
void maxs(int&a,int b){if(a<b)a=b;}
void cal1(){
	int mn1,mx1,mn2,mx2;
	mn1=x[gmn];
	mx1=x[gmx^1];
	mn2=x[gmn^1];
	mx2=x[gmx];
	for(int i=0;i<n;i+=2){
		if(i/2==gmn/2||i/2==gmx/2)continue;
		maxs(mx1,x[i]);
		mins(mn2,x[i+1]);
	}
	mins(ans,i64(mx1-mn1)*(mx2-mn2));
}
struct pos{
	int x,y;
	bool operator<(const pos&w)const{return x<w.x;}
}ps[N];
int pp=0;
void cal2(){
	int mn1,mx1,mn2,mx2;
	mn1=x[gmn];
	mx1=x[gmx];
	mn2=x[gmn^1];
	mx2=x[gmx^1];
	if(mn2>mx2)std::swap(mn2,mx2);
//	printf("(%d %d)(%d %d)\n",mn1,mx1,mn2,mx2);
	for(int i=0;i<n;i+=2){
		if(i/2==gmn/2||i/2==gmx/2)continue;
		ps[pp++]=(pos){x[i],x[i+1]};
	}
	ps[pp++]=(pos){mn2,mn2};
	ps[pp++]=(pos){mx2,mx2};
	std::sort(ps,ps+pp);
	maxs(mx2,ps[pp-1].x);
	for(int i=0;i<pp;++i){
//		printf(" (%d %d)(%d %d)\n",mn1,mx1,std::min(ps[i].x,mn2),mx2);
		mins(ans,i64(mx1-mn1)*(mx2-std::min(ps[i].x,mn2)));
//		printf("(%d  %d)\n",ps[i].x,ps[i].y);
		maxs(mx2,ps[i].y);
		mins(mn2,ps[i].y);
	}
	mins(ans,i64(mx1-mn1)*(mx2-mn2));
}
int main(){
	scanf("%d",&n);
	n*=2;
	gmn=0,gmx=0;
	for(int i=0;i<n;++i)scanf("%d",x+i);
	for(int i=0;i<n;i+=2)if(x[i]>x[i+1])std::swap(x[i],x[i+1]); 
	for(int i=0;i<n;++i){
		if(x[i]<x[gmn])gmn=i;
		if(x[i]>x[gmx])gmx=i;
	}
	cal1();
	if(gmn^gmx^1)cal2();
	printf("%lld\n",ans);
	return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<string> a;
    vector<string> b;
    for (auto i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        a.push_back(s);
    }

    for (auto i = 0; i < m; i++)
    {
        string s;
        cin >> s;
        b.push_back(s);
    }

    for (auto i = 0; i < n - m + 1; i++)
    {
        for (auto j = 0; j < n - m + 1; j++)
        {
            int sum = 0;
            for (auto k = 0; k < m; k++)
            {
                for (auto l = 0; l < m; l++)
                {
                    if (a[i + k][j + l] == b[k][l])
                    {
                        sum += 1;
                    }
                }
            }

            if (sum == m * m)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    return 0;
}

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

int main() {
  int X;
  cin >> X;
  
  if(X < 600){
    cout << 8 << endl;
  }
  else if(X < 800){
    cout << 7 << endl;
  }
  else if(X < 1000){
    cout << 6 << endl;
  }
  else if(X < 1200){
    cout << 5 << endl;
  }
  else if(X < 1400){
    cout << 4 << endl;
  }
  else if(X < 1600){
    cout << 3 << endl;
  }
  else if(X < 1800){
    cout << 2 << endl;
  }
  else{
    cout << 1 << endl;
  }
}

Measured memory_bytes: 3632
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val k = sc.nextLong()
  val ab = List.fill(n)((sc.nextInt(), sc.nextLong())).sorted
  val c = ab.scanLeft((-1, 0L)){case ((_, sum), (a, b)) =>(a, sum + b)}
  val ans = c.find{case (_, sum) => k <= sum}.get._1
  println(ans)
}

Measured memory_bytes: 70980
n,a,b = map(int,input().split())
n_list = [0 for i in range(n)]
n_list[a-1] = 1
n_list[b-1] = 2
i = 0
a = a-1
b = b-1
alice = True
borys = True
while True:
    if n_list[a+1] == 0:
        n_list[a] = 0
        n_list[a+1] = 1
        a += 1
    else:
        if a-1 >= 0:
            n_list[a] = 0
            n_list[a-1] = 1
            a -= 1
        else:
            alice = False
            break
    if n_list[b-1] == 0:
        n_list[b] = 0
        n_list[b-1] = 2
        b -= 1
    else:
        if b+1 <= n-1:
            n_list[b] = 0
            n_list[b+1] = 2
            b += 1
        else:
            borys = False
            break
    if alice == False or borys == False:
        break
if alice == False:
    print('Borys')
else:
    print('Alice')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,a,n) for(int _tmp=n,i=a;i<=_tmp;++i)
#define dep(i,a,n) for(int _tmp=n,i=a;i>=_tmp;--i)
#define re(i,a,n) for(int _tmp=n,i=a;i<_tmp;++i)
#define fec(i,a) for(__typeof a.begin() i=a.begin();i!=a.end();++i)
#define For(i,u) for(int i=H[u];i;i=nxt[i])
#define si(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
using namespace std;
template<class T> inline void read(T&x){char c;bool fu=0;for(c=getchar();c<=32;c=getchar());if(c=='-')fu=1,c=getchar();for(x=0;c>32;c=getchar())x=x*10+c-'0';if(fu)x*=-1;}
template<class T> inline void read(T&x,T&y){read(x);read(y);}
template<class T> inline void read(T&x,T&y,T&z) {read(x,y);read(z);}
typedef long long ll;
typedef pair<int,int> pii;
const int N=111111;
//head
int n,T;
int a[N],num[N],num2[N],suf[N],pre[N];
int main() {
	read(n);read(T);
	rep(i,1,n)read(a[i]);
	num[n]=1;suf[n]=a[n];
	dep(i,n-1,1)if(suf[i+1]<a[i]){
		num[i]=1;suf[i]=a[i];
	}else if (suf[i+1]==a[i])num[i]=num[i+1]+1,suf[i]=suf[i+1];
	else suf[i]=suf[i+1];
	pre[1]=a[1];num2[1]=1;
	rep(i,2,n-1)if(pre[i-1]>a[i]){
		pre[i]=a[i];
		num2[i]=1;
	}else if (pre[i-1]==a[i])num2[i]=num2[i-1]+1,pre[i]=pre[i-1];
	else pre[i]=pre[i-1];
	int now=0,tmp=0,ans=0;
	rep(i,1,n-1)if(suf[i+1]-a[i]>now){
		now=suf[i+1]-a[i];
		tmp=1;
	}else if(suf[i+1]-a[i]==now){
		++tmp;
	}
	now=0,ans=0;
	dep(i,n,2)if(a[i]-pre[i-1]>now){
		now=a[i]-pre[i-1];
		ans=1;
	}else if(a[i]-pre[i-1]==now){
		++ans;
	}
	printf("%d\n",min(ans,tmp));
	return 0;
}

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

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

const int MAXN = 2e5;

int n;
vector<int> adj[MAXN+10];
int dep[MAXN+10];

void dfs(int now, int depth)
{
    dep[now]=depth;
    for(int nxt : adj[now])
    {
        if(dep[nxt]!=-1) continue;
        dfs(nxt, depth+1);
    }
}

int main()
{
    int i, j;

    scanf("%d", &n);
    for(i=1; i<n; i++)
    {
        int u, v;
        scanf("%d%d", &u, &v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    int a, b, val=-1;
    memset(dep, -1, sizeof(dep));
    dfs(1, 0);
    for(i=1; i<=n; i++) if(val<dep[i]) a=i, val=dep[i];
    memset(dep, -1, sizeof(dep)); val=-1;
    dfs(a, 0);
    for(i=1; i<=n; i++) if(val<dep[i]) b=i, val=dep[i];

    printf("%s", (val%3==1)?"Second":"First");
}


Measured memory_bytes: 18176
N = input()
nlen = len(N)
cnt = 0
for i in range(1, nlen):
  if i % 2:
    cnt += (10 ** i) - (10 ** (i - 1))
N = int(N)
if nlen % 2:
  cnt += N - 10 ** (nlen - 1) + 1
print(cnt)

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

int main() {
	int A,B,C,D;
	cin >> A>>B>>C>>D;

	if ((C % B != 0 ? C / B + 1 : C / B) > (A % D != 0 ? A / D + 1 : A / D)) cout << "No" << endl;
	else cout << "Yes" << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int n, a[100005];

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

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

    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    vector<int> dp(n + 1, INF);
    dp[1] = 0;
    dp[2] = abs(a[2] - a[1]);
    for (int i = 3; i <= n; i++) {
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
    }

    cout << dp[n] << '\n';
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int n, m, q;
int a[55], b[55], c[55], d[55];
int64_t ans = 0;

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

int main() {
	cin >> n >> m >> q;
	rep(i,q) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	dfs({1});
	cout << ans << '\n';
	return 0;
}

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

// 插入此處

LL a[100005];
LL b[100005];

LL hb (LL num)
{
    if (!num)
        return 0;

    int ret = 0;

    while (num >>= 1)
        ret ++;

    return ret;
}

int main() {
    LL n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    LL ans = 0;
    k++;
    for (LL h = hb(k); h >= 0; h--) {
        // printf("h = %lld\n", h);
        LL mx = (1 << h) & k;
        LL r = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] < mx) {
                r += b[i];
            }
            if (a[i] & mx) {
                a[i] -= mx;
            }
        }
        // printf("r = %lld\n", r);
        ans = max(ans, r);
        k -= mx;
    }
    cout << ans << endl;
}


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

int main() {

  int n;
  cin >> n;

  string s;
  cin >> s;

  for (int i = 0; i < s.size(); i++) {
    int c = (int) s[i];
    if (c + n <= 90) {
      cout << char((int) s[i] + n);
    } else {
      c = 65 + c + n - 91;
      cout << char(c);
    }
    
  }

  cout << endl;

}

Measured memory_bytes: 256
let readCharArray () = stdin.ReadLine().ToCharArray()

readCharArray ()
|> Array.mapFold (fun x y -> (x, (if y = 'R' then x + 1 else 0))) 0
|> fun (a, b) -> a |> Array.tail |> Array.append [| b |]
|> Array.max
|> printfn "%d"


Measured memory_bytes: 29976
require 'pp'
require 'set'

###################

#inputType = :singleLine
# inputType = :2Lines
inputType = :nLines
  
def main(query)
  h,w,m = query.shift

  th = {}
  tw = {}

  query = query.to_set
  
  query.each { | l |
    bh,bw = tois(l.split(" "))
    th[bh] = (th[bh] || 0) + 1
    tw[bw] = (tw[bw] || 0) + 1
  }

  sum = 0

  ppp "th=",th
  ppp "tw=",tw
  ppp "query=",query
  
  hs = th.keys.sort { | a,b | th[b] <=> th[a] }
  maxh = th[hs[0]]
  hs1 = hs.select { | a | th[a] == maxh }
  
  ws = tw.keys.sort { | a,b | tw[b] <=> tw[a] }
  maxw = tw[ws[0]]
  ws1 = ws.select { | a | tw[a] == maxw }

  hs1.each { | h |
    ws1.each { | w |
      k = h.to_s + " " + w.to_s
      if (! query.include?(k)) then
        return [(maxh + maxw)]
      end
    }
  }
  return [(maxh + maxw - 1)]
  
end

###################

TEST=false

def tois(l)
  l.map { | x | x.to_i}
end

def ppp(msg, val)
  if (TEST) then
    print msg
    pp val
  end
end

target = nil
if (ARGV.size == 0) then
  f = STDIN
end
if (ARGV.size > 0) then
  f = open(ARGV[0])
end
if (ARGV.size > 1) then
  target = ARGV[1].to_i
end

t = 1
ng = []
while true
  query = []
  if (inputType == :singleLine) then
    a = f.gets
    if ! a then
      exit
    end
    a.chomp!
    query.push a
  elsif (inputType == :l2Lines) then
    a = f.gets
    if ! a then
      exit
    end
    a.chomp!
    query.push a
    b = f.gets.chomp
    query.push b
  elsif (inputType == :l3Lines) then
    a = f.gets
    if ! a then
      exit
    end
    a.chomp!
    query.push a
    b = f.gets.chomp
    query.push b
    c = f.gets.chomp
    query.push c
  elsif (inputType == :nLines) then
    a = f.gets
    if ! a then
      exit
    end
    a.chomp!
    query.push a    

    n = a.split(" ")[2].to_i

    n.times { | i |
      query.push f.gets.chomp
    }    
  end
  
  aa = f.gets
  if ! aa then
    r = main(query) 
    r.each { | x | puts x }
    exit
  elsif ( aa.chomp == "---") then
    oks = []
    while true
      s = f.gets.chomp
      if (s == "===") then
        break
      end
      oks.push s
    end

    if (target == nil || t == target) then
      if target then
        TEST = true
      end

      puts "--- " + t.to_s + " ---"
      r = main(query)    

      if r.join('\n') == oks.join('\n') then
        puts "RESULT:"
        r.each { | x | puts x }
        puts "OK"
      else
        puts "RESULT:NG"
        r.each { | x | puts x }
        puts "NG!!!!!!!!!"
        ng.push t
      end
    end
  end
  t = t + 1
end
puts "---"
puts "NG targes = " + ng.to_s


Measured memory_bytes: 116500
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
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); }

void solve(void)
{
  double X;cin>>X;
  cout<<M_PI*2*X<<endl;
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 3804
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
vector<vector<int > >g;
vector<vector<int> > dp;
void dfs(int a, int p = -1) {
	dp[a][0] = 1;
	dp[a][1] = 1;
	for (int i : g[a]) {
		if (i != p) {
			dfs(i, a);
			dp[a][0] = (dp[a][0] * (dp[i][0] + dp[i][1])) % MOD;
			dp[a][1] = (dp[a][1] * (dp[i][0])) % MOD;
		}
	}
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	g.resize(N);
	dp.resize(N, vector<int>(2, 0));
	int res = 0;
	int a, b;
	for (int i = 0; i < N - 1; i++) {
		cin >> a >> b; a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs(0);
	res = (dp[0][0] + dp[0][1]) % MOD;
	cout << res << endl;
}

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

int main(){
int N,M,X;
  cin>>N>>M>>X;
  
  vector<int>A(M);
  for(int i=0; i<M; i++){
  cin>>A[i];
  }
  int left=0;
  int right=0;

  for(int i=0; i<M; i++){
  if(A[i]<X){left++;}
    else{right++;}
  }
  cout<<min(left, right)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

string s,t;

int main(){
	cin>>s>>t;
	cout<<t<<s<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int h, w;
vector<string> g;

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


int main() {
    cin >> h >> w;
    g.resize(h);
    rep(i, h) cin >> g[i];

    mat dp(h, vec(w, INF));
    dp[0][0] = 0;

    rep(i, h) rep(j, w) {
        if (i) dp[i][j] = min(dp[i][j], dp[i-1][j] + (g[i-1][j] != g[i][j]));
        if (j) dp[i][j] = min(dp[i][j], dp[i][j-1] + (g[i][j-1] != g[i][j]));
    }

    int k = dp[h-1][w-1];
    if (g[0][0] == '#') k++;
    if (g[h-1][w-1] == '#') k++;
    
    cout << k / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char S[11];
    scanf("%s", S);
    int count = 0;
    int max = 0;
    int flag = 0;
    for(int i = 0; i < 11; i++){
        if((count == 0) && ((S[i] == 'A')||(S[i] == 'C')||(S[i] == 'G')||(S[i] == 'T'))){
                flag= 1;
            }
        if(flag == 1){
            if ((S[i] == 'A')||(S[i] == 'C')||(S[i] == 'G')||(S[i] == 'T')){
                count += 1;
            }
            else{
                flag = 0;
                if(max < count){max = count;}
                count = 0;
                }
        }
    }
    printf("%d\n", max);
    return 0; 
}

Measured memory_bytes: 128
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;

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

    int a[n][3];
    for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1] >> a[i][2];

    long long dp[n][3];

    dp[0][0] = a[0][0];
    dp[0][1] = a[0][1];
    dp[0][2] = a[0][2];

    for (int i = 1; i < n; i++) {
        dp[i][0] = max(dp[i - 1][1] + a[i][0], dp[i - 1][2] + a[i][0]);
        dp[i][1] = max(dp[i - 1][0] + a[i][1], dp[i - 1][2] + a[i][1]);
        dp[i][2] = max(dp[i - 1][0] + a[i][2], dp[i - 1][1] + a[i][2]);
    }

    cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << endl;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    IOS;
    //freopen("inputfile.txt","r",stdin);
   string s,t;cin>>s>>t;
   int count = 0;
   for(int i=0;i<=s.size()-t.size();i++)
   {
        int h = i,c=0;
       for(int j=0;j<t.size();j++)
       {
           if(s[h]==t[j])c++;
           h++;
       }
       count = max(count,c);
   }
   cout<<t.size()-count<<endl;
   return 0;
}


Measured memory_bytes: 3520
N = int(input())
a = list(input())
 
l = [] #個数リスト
alphabet = 'abcdefghijklmnopqrstuvwxyz'

for i in range(N):
    count = 0
    x = a[:i]
    y = a[i:]
    for letter in alphabet:
        if letter in x and letter in y:
            count += 1
    l.append(count)
    
print(max(l))

Measured memory_bytes: 3060
input = readlines.map(&:chomp)
info = input.first.split(" ")

price_by_sound = input[0].to_i

money = info[1].to_i

how_many_times_takahashi_wanna_listen_to = info[2].to_i

paid_money = 0
times = 0

while paid_money <= money && times <= how_many_times_takahashi_wanna_listen_to do
  paid_money += price_by_sound
  times += 1
end

result = times - 1

puts result

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int main() {
  int h, w;
  cin >> h >> w;

  vector<string> vs(h, string(w, '0'));
  vector<string> result(h*2, string(w, '0'));

  REP(i, h) {
    cin >> vs[i];
  }

  REP(i, h) {
    result[i*2] = vs[i];
    result[i*2+1] = vs[i];
  }

  /*
  REP(i, h) {
    cout << vs[i] << endl;
  }
  cout << endl;
  */
  REP(i, h*2) {
    cout << result[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<deque>
#define rep(i,rept)	for(int i = 0; i<(ll)rept;++i)
typedef long long ll;
using namespace std;
 
int main() {
	int a, b, c, d, e;
	int needb = 0, needd = 0;
	cin >> a >> b >> c >> d >> e;
	
	if (a%b == 0) {
		needb = a / b;
	}
	else {
		needb = (a / b) + 1;
	}
 
	if (a%d == 0) {
		needd = a / d;
	}
	else {
		needd = a / d + 1;
	}
 
	cout << min(needb * c, needd * e) << endl;
 
}


Measured memory_bytes: 3096
#include <cstdio>
#include <iostream>

using namespace std;

const int nmax = 8;
bool graph[nmax][nmax];

int dfs(int v, int N, bool visited[nmax])
{
    /*
    printf("v: %d, N: %d\n", v, N);
    printf("graph: \n");
    for (int i=0; i<N; ++i) {
        for (int j=0; j<N; ++j) {
            printf("%c ", graph[i][j] ? '#' : '.');
        }
        printf("\n");
    }

    printf("visited: \n");
    for (int i=0; i<N; ++i) {
        printf("%c ", visited[i] ? '#' : '.');
    }
    printf("\n\n");
    */
    
    bool all_visited = true;

    for (int i=0; i<N; ++i) {
        if (visited[i] == false)
            all_visited = false;
    }

    if (all_visited) {
        return 1;
    }

    int ret = 0;

    for (int i=0; i<N;  ++i) {
        if (graph[v][i] == false)
            continue;
        if (visited[i])
            continue;

        visited[i] = true;
        ret += dfs(i, N, visited);
        visited[i] = false;
    }

    return ret;
}
/*
void dfs(int pos, int mask)
{
    if (pos == n) {
    
        return;
    }

    for (int i=0; i<n; i++) {
        if (mask & (1 << i)) {
            p[pos] = i;
            dfs(pos+1, (mask^(1<<i)));
        }
    }
}
int main()
{
    dfs(0, (1<<n)-1);
}
*/

int main()
{
    int N, M;
    
    cin >> N >> M;

    for (int i=0; i<M; ++i) {
        int A, B;
        cin >> A >> B;
        graph[A-1][B-1] = true;
        graph[B-1][A-1] = true;
    }

    bool visited[nmax];
    for (int i=0; i<N; ++i) {
        visited[i] = false;
    }

    visited[0] = true;
    cout << dfs(0, N, visited) << endl;
    return 0;

}


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

int main()
{
    int a;
    cin >> a;
    string s;
    cin >> s;
    if(a >= 3200){
        cout << s <<endl;
    }else {
        cout << "red" <<endl;
    }
   
  
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(){

	int n,x,i,j,k,count=0;
	
	while(1){
	scanf("%d %d",&n,&x);
	if(n==0 && x==0) break;

	for(i=1; i<=n; i++){
		for(j=1; j<=n; j++){
			for(k=1; k<=n; k++){
				if(i+j+k==x && i<j && j<k)
					count++;
			}}}
	printf("%d\n",count);
	count=0;
	}
	return 0;
}

Measured memory_bytes: 600
n = int(input())
alphabets = "abcdefghijklmnopqrstuvwxyz"
s = [input() for _ in range(n)]
NUM = {}
ans = ""


for char in alphabets:
    num_char = 100
    for S in s:
        num_char = min(num_char, S.count(char))
    NUM[char] = num_char

NUM = sorted(NUM.items())

for i in NUM:
    ans += i[0]*i[1]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll n;
	cin >> n;
	vector<ll> a(n);
	for (ll i = 0; i < n; i++) cin >> a[i];

	multiset<ll> st;
	st.insert(-a[0]);
	for (ll i = 1; i < n; i++) {
		auto itr = st.upper_bound(-a[i]);
		if (itr == st.end()) st.insert(-a[i]);
		else {
			st.erase(itr);
			st.insert(-a[i]);
		}
	}
	cout << st.size() << endl;
}


Measured memory_bytes: 5760
#include <iostream>

int main()
{
	int W, H, x, y;
	int p;
	double S;
	scanf("%d %d %d %d", &W, &H, &x, &y);

	if (W % 2 == 0 && x == W / 2 && H % 2 == 0 && H / 2 == y) {
		p = 1;
	}
	else {
		p = 0;
	}

	S = ((double)W * (double)H) / 2;

	printf("%f %d", S, p);

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int n, y;
	cin >> n >> y;
	int k10, k5, k1;
	bool ans;
	k10 = y / 10000;
	k5 = (y - k10 * 10000) / 5000;
	k1 = ((y % 10000) % 5000) / 1000;
	int sum = k1 + k10 + k5;
	while (1) {
		if (sum != n) {
			if (n < sum) {
				ans = true;
				break;
			}
			else if (n > sum) {
				if (n - sum >= 4 && k5 > 0) {
					k5--;
					k1 += 5;
					sum = k1 + k10 + k5;
					continue;
				}
				else if (k10 > 0) {
					k10--;
					k5 += 2;
					sum = k1 + k10 + k5;
					continue;
				}
				else {
					ans = true;
					break;
				}
			}
		}
		ans = false;
		break;
	}
	if (ans) {
		k10 = -1;
		k5 = -1;
		k1 = -1;
	}
	cout << k10 << " " << k5 << " " << k1 << endl;
}


Measured memory_bytes: 256
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin >> n >> k;
    ll reg = 0;
    ll res=0;
    ll res2=0;
    V result(n,-1);
    V wrong(n);
    rep(i,k){
        ll x;
        cin >> x;
        x--;
        string s;
        cin >> s;
        if(s=="AC"){
            if(result[x]==-1){
                result[x] = reg;
                res+=wrong[x];
                res2++;
            }
        }else{
            wrong[x]++;
        }
    }
    cout<<res2<<" "<<res<< endl;
}


Measured memory_bytes: 1792
N, Q = map(int, input().split())
S = input()
l = []
r = []
for i in range(Q):
    li, ri = map(int, input().split())
    l += [li]
    r += [ri]

S_tf = [0]*(N+1)
for ind in range(N):
    S_tf[ind + 1] = S_tf[ind] + (1 if S[ind:ind+2] == "AC" else 0)
for ind in range(Q):
    print(S_tf[max(0, r[ind]-1)] - S_tf[min(l[ind]-1, N)])

Measured memory_bytes: 15808
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<map>
#include<set>
#include<functional>
#include<queue>
#define int long long
using namespace std;

signed main() {
	int a; cin >> a;
	set<int>c; int d = 0;
	for (int b = 0; b < a; b++) {
		int e; cin >> e;
		if (e >= 3200) {
			d++;
		}
		else {
			c.insert(e / 400);
		}
	}
	if (c.size() == 0)cout << 1 << " " << d << endl;
	else  cout << c.size() << " " << c.size() + d << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int n,a,b,i,j,t,sum=0,cnt=0;
    scanf("%d%d%d",&n,&a,&b);
    for(i=1;i<=n;i++){
        t=i;
        cnt=0;
        for(j=0;j<5;j++){
            cnt+=t%10;
            t/=10;
        }
        if(cnt>=a && cnt<=b){
            sum+=i;
        }
    }
    printf("%d",sum);
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int tiers = 1;
  
  vector<int> vec(N);
  for (int i = 0; i < vec.size(); i++) {
    cin >> vec.at(i);
  }
  
  // 降順ソート
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  // 重複を避けて取り出し
  for (int i = 1; i < vec.size(); i++) {
    if (vec.at(i) == vec.at(i-1)) {
      continue;
    }
    else {
      tiers++;
    }
  }
  cout << tiers << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
 
using namespace std;
 
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
 
typedef vector<int> vi;
typedef pair<int,int> pii;
 
int main(void) {
  int i,j;
  char v[10][10]={};
  rep(i,8)
    cin>>v[i];
  puts("90");
  rep(i,8){
    rep(j,8)
      cout<<v[7-j][i];
    cout<<endl;
  }
  puts("180");
  rep(i,8){
    rep(j,8)
      cout<<v[7-i][7-j];
    cout<<endl;
  }
  puts("270");
  rep(i,8){
    rep(j,8)
      cout<<v[j][7-i];
    cout<<endl;
  }
}

Measured memory_bytes: 3088
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int n,a,b;cin>>n>>a>>b;
  ll ans=0;
  for(int i=1;i<=n;i++){
    int num=i;
    int aa=0;
    while(num>0){
      aa+=num%10;
      num/=10;
    }
    if(aa>=a&&aa<=b)
      ans+=i;
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  //vector<vector<int>> a(n, vector<int>(m));
  //vector<int> b(m);
  int a[n][m];
  int b[m];
  rep(i, n) {
    rep(j, m) {
      cin >> a[i][j];
    }
  }
  rep(i, m) {
    cin >> b[i];
  }
  //vector<int> c(n);
  int c[n];
  rep(i, n) {
    int sum = 0;
    rep(j, m) {
      sum += a[i][j] * b[j];
    }
    c[i] = sum;
  }
  rep(i, n) {
    cout << c[i] << endl;
  }
}



Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repin(a, n)  \
    vector<ll> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repins(a, n)     \
    vector<string> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repind(a, n)     \
    vector<double> a(n); \
    rep(i, n) { cin >> a[i]; }
#define in(a) \
    ll a;     \
    cin >> a;
#define ins(a) \
    string a;  \
    cin >> a;
#define ind(a) \
    double a;  \
    cin >> a;
template <class T>
inline void out(T a) {
    cout << a << endl;
}
inline void out(double a) { printf("%.10f\n", a); }
#define all(x)        (x).begin(), (x).end()
#define rep2(i, a, b) for (ll i = (a); i < (b); ++i)
#define yes           out("Yes");
#define no            out("No");

int main() {
    in(n);
    int ans = n;
    rep(i, 10) {
        ans -= 1000;
        if (ans <= 0) {
            break;
        }
    }

    out(-ans);
}

Measured memory_bytes: 3592
import java.util.Scanner;

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

        int X = sc.nextInt();
        int cnt;

        cnt = (X / 500) * 1000;
        X %= 500;

        cnt += (X / 5)*5;

        System.out.println(cnt);
    }
}


Measured memory_bytes: 21716