akhauriyash/Code-Regression huggingface dataset:
import java.util.*;import java.io.*;import java.math.*;

public class Main
{
	static class Pair{
		int damage,cost;
		public Pair(int damage,int cost){
			this.damage=damage;
			this.cost=cost;
		}
	}

	static Pair arr[];
	static long dp[];

	static long min_cost_to_dec(int h,int n){
		if(h<=0)
			return 0;

		if(dp[h]!=-1)
			return dp[h];

		dp[h]=Long.MAX_VALUE;
		for(int i=1;i<=n;i++){
			dp[h]=Math.min(arr[i].cost+min_cost_to_dec(h-arr[i].damage,n),dp[h]);
		}

		return dp[h];
	}
    public static void process()throws IOException
    {
    	int h=ni(),n=ni();
    	arr=new Pair[n+1];
    	dp=new long[h+1];

    	Arrays.fill(dp,-1l);

    	for(int i=1;i<=n;i++)
    		arr[i]=new Pair(ni(),ni());
    	pn(min_cost_to_dec(h,n));
    }


   	static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

    	//oj = System.getProperty("ONLINE_JUDGE") != null;
    	if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;



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

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
    
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
	
	
	

Measured memory_bytes: 25044
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

#define C(I) cout<<(I)<<endl

ll n,m,a,b,c,x,y,z,aa[100010],ba[100010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc;
vector<ll> va,vb,vc;
set<int> sta;




int main(){
    cin>>sa>>sb;
    sort(sa.begin(),sa.end());
    sort(sb.begin(),sb.end(),greater<char>());
    C(sa<sb ? "Yes":"No");
    
    
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void print_vector(vector<int> v){
  for(int i = 0; i < (int)v.size(); i++){
	  if (i == (int)v.size() - 1) cout << v[i];
	  else cout << v[i] << " ";  
	}
  cout << endl;	
}

void solve(){
  	int n, q;
  	vector<int> v;
  	cin >> n ;
  	for(int i = 0; i < n; i++){
	  int x;
	  cin >> x;
	  v.push_back(x);	
	}
	cin >> q;
	for(int i = 0; i < q; i++){
    int query;
    cin >> query;
	auto ret = lower_bound(all(v), query) - v.begin();
	cout << ret << endl;
   } 
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 3944
#include <stdio.h>

void swap(int* x, int* y) {
    int t = *x;
    *x = *y;
    *y = t;
}

int gcd(int x, int y) {

    if ( x < y ) {
        swap(&x, &y);
    }

    if ( y == 0 ) {
        return x;
    }

    return gcd(y, x % y);
}

int main(int argc, char* argv[]) {
    int x, y;
    int r;

    scanf("%d %d\n", &x, &y);

    r = gcd(x, y);

    printf("%d\n", r);

    return 0;
}



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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl
#define mp make_pair
#define pb push_back

const long long MOD = 1000000007;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;


int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(12);

    ll a, b, h, m;
    cin >> a >> b >> h >> m;

    double ar = h * 2.0 / 12 * PI + m/60.0/12*2*PI ;
    double br = m * 2.0 / 60 * PI;

    double ax = cos(ar) * a;
    double ay = sin(ar) * a;
    double bx = cos(br) * b;
    double by = sin(br) * b;

//    debug(ar);
//    debug(cos(ar));
//    debug(sin(ar));
//    debug(ax);
//    debug(ay);
//    debug(bx);
//    debug(by);

    cout << sqrt(pow(ax-bx, 2) + pow(ay-by, 2)) << endl;

    return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int counter = 0;
  for (int i=0; i<N-1; i++) {
    if (S.at(i) == S.at(i+1)) {
      counter++;
    }
  }
  int answer = N-counter;
  cout << answer << endl;
}

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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

using ll = long long;
using ull = unsigned long long;

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if(k <= a + b) {
        cout << min(a, k) << endl;
    } else {
        cout << a - (k - a - b) << endl;
    }
    return 0;
}
// ===========================================

// Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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


Measured memory_bytes: 3632
h, w, k = map(int, input().split())
c = [input() for _ in range(h)]

count = 0
for binh in range(2**h):
    for binw in range(2**w):
        redh, redw = bin(binh)[2:].zfill(h), bin(binw)[2:].zfill(w)  # remove suffix '0x'
        squares = [list(row) for row in c]
        for i, rh in enumerate(redh):
            for wh in range(w):
                if rh == '1':
                    squares[i][wh] = '*'
        for j, rw in enumerate(redw):
            for hw in range(h):
                if rw == '1':
                    squares[hw][j] = '*'
        count += sum(row.count('#') for row in squares) == k

print(count)


Measured memory_bytes: 9140
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();
	int c = sc.nextInt();
	for(int i = a; i<=a*b; i=i+a) {
	    if(i%b==c) {
		System.out.println("YES");
		return;
	    }
	}
	System.out.println("NO");
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <queue>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <deque>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define fst first
#define snd second
const ll mod = 1000000007;
const ll INF = (1LL << 59);
const int iINF = (1 << 31)-1;
const double dINF = 1000000000000000000.0;
const int MAX_N = 1 << 17;


int main(){
	ll n;
	cin >> n;
	int keta = 0;
	int ans[20] = {};
	int n_[20];
	ll m = n;
	while (m > 0) {
		n_[keta] = m % 10;
		m /= 10;
		keta++;
	}
	for (int i = 0; i < keta; i++) {
		for (int j = keta-1; j >= 0; j--) {
			if (j < i) {
				ans[i] += 9;
			}
			else if(i==j){
				if (i == 0) {
					ans[i] += n_[j];
				}
				else if (n_[j] == 0) {
					ans[i] -= 18;
					
				}
				else {
					ans[i] += n_[j] - 1;
				}
			}
			else {
				ans[i] += n_[j];
			}
		}
	}
	int r = 0;
	for (int i = 0; i < keta; i++) {
		r = max(r, ans[i]);
	}
	cout << r << endl;
	return 0;
}

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

int main()
{
    int a,b,c,x,y,sum1,sum2,sum3;
    scanf("%d%d%d%d%d",&a,&b,&c,&x,&y);
    sum1=(x*a)+(y*b);
    if(x>y)
    {
        sum2=(2*x*c);
        sum3=(2*y*c)+(a*(x-y));
    }
    else
    {
        sum2=(2*x*c)+(b*(y-x));
        sum3=(2*y*c);
    }
    if(sum1<sum2)
    {
        if(sum1<sum3)
            printf("%d",sum1);
        else
            printf("%d",sum3);
    }
    else
    {
        if(sum2<sum3)
            printf("%d",sum2);
        else
            printf("%d",sum3);
    }
    return 0;
}

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

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

    vector<int> A(N);

    int sum=0;
    for(int i=0;i<N;i++){
        cin>>A[i];
        sum+=A[i];
    }

    int cnt=0;
    for(int i=0;i<N;i++){
        if(4*M*A[i]>=sum){
            cnt++;
        }
    }
    if(cnt<M){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }

    return 0;
}

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

int main(){
  int N;
  cin >> N;
  int V[N];
  for (int i = 0; i < N; i++){
    cin >> V[i];
  }
  int max_1 = 0, max_2 = 0, cnt = 0;
  for (int i = 0; i < N; i++){
    if (V[i] > max_1){
      max_1 = V[i];
      cnt = 0;
    }
    if (V[i] == max_1){
      cnt++;
    }
  }
  for (int i = 0; i < N; i++){
    if (V[i] > max_2 && V[i] != max_1) max_2 = V[i];
  }
  for (int i = 0; i < N; i++){
    if (V[i] == max_1 && cnt < 2) cout << max_2 << endl;
    else cout << max_1 << endl;
  }
  return 0;
}

Measured memory_bytes: 4380
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>

using namespace std;

typedef long long ll;

int main()
{
  ll a, b, c;
  cin >> a >> b >> c;
  c = min(c, a + b + 1);
  cout << b + c << endl;
  return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
g = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    g[a].append(b)
    g[b].append(a)

dp = [[0]*n for i in range(2**n)]
dp[1][0] = 1

for s in range(2**n):
    for v in range(n):
        if (s >> v) & 1:
            # t = s - {v}
            t = s ^ (1 << v)
            for u in g[v]:
                if (t >> u) & 1:
                    dp[s][v] += dp[t][u]
#print(dp)
ans = 0
for v in range(n):
    ans += dp[-1][v]
print(ans)

Measured memory_bytes: 9020
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {

			int k = sc.nextInt();
			int x = sc.nextInt();
			int total = 500 * k;
			System.out.println(total >= x ? "Yes" : "No");

		}
	}
}


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

int main() {
  
  int N, L; cin >> N >> L; string ans;
  
  vector<string> vec(N);
  
  for (int i = 0; i < N; i++) cin >> vec[i];
  
  sort(vec.begin(), vec.end());
  
  for (string S : vec) ans += S;
  
  cout << ans << endl;
  
}

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

const string YES = "Yes";
const string NO = "No";

void solve(long long n, string s){
    if(n%2){
        cout<<NO<<endl;
        return;
    }
    string t=s.substr(0,n/2);
    cout<<(t+t==s?YES:NO)<<endl;
}

int main(){
    long long n;
    scanf("%lld",&n);
    string s;
    cin >> s;
    solve(n, s);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		int taroPoint = 0;
		int hanakoPoint = 0;

		// 互いに持っている手札の枚数(勝負回数)
		int hasCard = scan.nextInt();

		// 勝負ループ
		for (int battle = 0; battle < hasCard; battle++) {
			// 太郎と花子の手札を入力
			String taroHands = scan.next();
			String hanakoHands = scan.next();

			// 太郎と花子の手札のアルファベットを格納するchar型の変数
			int[] taroHand = new int[taroHands.length()];
			int[] hanakoHand = new int[hanakoHands.length()];

			// 太郎の手札の文字を一つずつ文字コード(数字)に変換して格納
			for (int storeTaro = 0; storeTaro < taroHands.length(); storeTaro++) {
				taroHand[storeTaro] = (int) taroHands.charAt(storeTaro);
			}
			// 花子の手札の文字を一つずつ文字コード(数字)に変換して格納
			for (int storeHanako = 0; storeHanako < hanakoHands.length(); storeHanako++) {
				hanakoHand[storeHanako] = (int) hanakoHands.charAt(storeHanako);
			}

			// 最大文字数100以下
			for (int check = 0; check < 100; check++) {
				// 太郎の手札の一文字の数値が花子より大きいとき
				if (taroHand[check] > hanakoHand[check]) {
					taroPoint += 3;
					break;
					// 花子の手札の一文字の数値が太郎より大きいとき
				} else if (taroHand[check] < hanakoHand[check]) {
					hanakoPoint += 3;
					break;
				}

				// 二人の手札の文字数が同じとき
				if (check + 1 == hanakoHands.length() && check + 1 == taroHands.length()) {
					taroPoint++;
					hanakoPoint++;
					break;
				}
				// 太郎の手札の文字数のほうが短いとき
				if (check + 1 == taroHands.length()) {
					hanakoPoint += 3;
					break;
				}
				// 花子の手札の文字数のほうが短いとき
				if (check + 1 == hanakoHands.length()) {
					taroPoint += 3;
					break;
				}
			}

		}
		System.out.println(taroPoint + " " + hanakoPoint);
		scan.close();
	}
}



Measured memory_bytes: 29852
#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

int main(int argc, char *argv[]) {
  double a, l, x;
  while (cin >> a >> l >> x) {
    double abc = a * l * sqrt(1 - a/2/l * a/2/l) / 2;
    double acd = l * (l+x)/2 * sqrt(1 - l/(l+x) * l/(l+x)) / 2;
    printf("%.10lf\n", abc + acd*2);
  }
  return 0;
}

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

using namespace std;

int main(int argc, char *argv[]) {
  int n, k;
  cin >> n >> k;
  map<int, int> mp;
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    mp[t]++;
  }
  vector<pair<int, int>> a = {mp.begin(), mp.end()};
  sort(a.begin(), a.end(), [](pair<int, int> x, pair<int, int> y) {
      return x.second > y.second;
    });
  int sum = 0;
  for (int i = k; i < a.size(); i++) {
    sum += a[i].second;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 11136
// 2015/06/30 Tazoe

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

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

	int d[10001];
	d[0] = p;			// 配列dに出発駅pも含める

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

	sort(d, d+M+1);			// ソート

	int c_min = N-1;

	for(int i=0; i<M+1; i++){	// すべての駅について
		int q = d[i];				// 折り返し駅q
		int r1 = d[(i-1+M+1)%(M+1)];		// qの1つ前の駅r1
		int r2 = d[(i+1)%(M+1)];		// qの1つ後の駅r2

		int c1 = ((p-q+N)%N)*2+(r1-p+N)%N;	// 先に左回りのコストc1
		int c2 = ((q-p+N)%N)*2+(p-r2+N)%N;	// 先に右回りのコストc2

		c_min = min(c_min, min(c1, c2));	// c_min, c1, c2の最小
	}

	cout << c_min*100 << endl;

	return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=max(x,a)
#define chmin(x,a) x=min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}
using Edge=pair<int,ll>;
using Graph=vector<vector<int> >;//ll or Edge
using Edge=pair<int,ll>;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// sort_reverse...greater<ll>()
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
void dfs(string S,char mx, int n){
    if(S.size()==n){
        cout<<S<<endl;
        return;
    }
    for(char c='a';c<=mx+1;c++){
        string T=S+c;
        dfs(T,max(mx,c),n);
    }
}
int main(){
    int n;cin>>n;
    dfs("",'a'-1,n);
    return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000

using namespace std;

int main(void) {
	double n, m;
	double x = 0;
	double p = 0;
	double q = 0;
	int sis = 100;

	cin >> n >> m;

	//x = (n - m) * 100;

	/*
	FOR(i, 1, sis) {
		p += 1800 * i*m + 100 * i*n;
	}
	q = pow((pow(2, m) - 1), sis) / pow(pow(2, m), sis + 2);
	q -= 1 / pow(4, m);

	cout << p << endl;
	cout << q << endl;
	cout << p * q << endl;
	*/
	p = (1, pow(2, m));
	FOR(i, 1, 10000) {
		x += ((i * 1900)*m+(i*100)*(n-m))*p;
		//cout << pow((pow(2, m) - 1), i - 1) / pow(pow(2, m), i) << " " << i << endl;
		//cout << pow((pow(2, m) - 1), i - 1) << endl;
		//cout << pow(pow(2, m), i) << endl;
		break;
		//cout << x << endl;
	}
	
	printf("%.0lf\n", x);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MN = 3e3 + 5, MOD = 998244353;
int N, S, a[MN]; ll dp[MN][MN]; 

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> N >> S;
    ll ans = 0;
    for (int i = 1; i <= N; i++) cin >> a[i];
    // dp[i][j] = fixed right bracket at i, way to sum to j
    for (int i = 1; i <= N; i++) {
        // dont use current value
        for (int j = 0; j <= S; j++) dp[i][j] = dp[i - 1][j];
        // only use current value, i places to place left bracket
        (dp[i][a[i]] += i) %= MOD;
        // use current value with previous states, 
        for (int j = a[i]; j <= S; j++) (dp[i][j] += dp[i - 1][j - a[i]]) %= MOD;
        ans = (ans + dp[i][S]) % MOD;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 70656
package main

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

func main() {
  var n int
  var k int
  fmt.Scan(&n)
  sc := bufio.NewScanner(os.Stdin)
  var card [] int
  var s string
  if sc.Scan(){
	s = sc.Text()
  }
  slice := strings.Split(s, " ")
  for i := 0; i<n; i++ {
	k,_ = strconv.Atoi(slice[i])
	card = append(card,k)
  }

  var sumA, sumB int
  var max, maxNum int
  for i:=0; i<n; i++ {
	max=1
	maxNum=0
	for j:=0; j<n; j++{
	  if max < card[j] {
		max = card[j]
		maxNum = j
	  }
	}
	if i%2 == 0{
	  sumA = sumA + max
	} else {
	  sumB = sumB + max
	}
	card[maxNum] = 0
  }
  fmt.Println(sumA - sumB)
}


Measured memory_bytes: 640
n,m=map(int,input().split())
slis=[]
counter=0
for i in range(m):
	s=list(map(int,input().split()))
	s.remove(s[0])
	slis.append(s)
plis=list(map(int,input().split()))

for i in range(2**n):
	sw_st=list(format(i,"b").zfill(n))
	alis=[]
	for j in range(m):
		c=0
		for k in range(n):
			if sw_st[k]=="1" :
				if k+1 in slis[j]:
					c+=1
		alis.append(c%2)
	if alis==plis:
		counter+=1
print(counter)

Measured memory_bytes: 3064
N,T = map(int,input().split())
t = [int(i) for i in input().split()]
fin = 0
ans = 0
for i in range(N):
    if t[i] <= fin - T:
        continue
    elif fin <= t[i]:
        fin = t[i]+T
        ans += T
    else:
        ans += T+t[i]-fin
        fin += T+t[i]-fin
print(ans)

Measured memory_bytes: 25200
#include <bits/stdc++.h>
#define MOD 1000000007

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;

ll inv[301010];
ll nor[301010];

ll bcoef(int a,int b){ //a>=b
   return (((nor[a]*inv[b])%MOD)*inv[a-b])%MOD ;
}


int main()
{
    ll p=MOD;
    inv[0] = 1;
    inv[1] = 1;
    for (int i=2; i<300010; ++i)
	inv[i] = (p - (p/i) * inv[p%i] % p) % p;
	for(int ctr1=2;ctr1<300010;ctr1++)
        inv[ctr1]=(inv[ctr1-1]*inv[ctr1])%MOD;
	nor[0] = 1;
	for(int ctr1=1;ctr1<300010;ctr1++)
        nor[ctr1]=(nor[ctr1-1]*ctr1)%MOD;


    int h,w,a,b;
    cin>>h>>w>>a>>b;
    ll rez=0;
    for(int ctr1=b+1;ctr1<=w;ctr1++){
        rez=(rez+(bcoef(h-a-1+ctr1-1,ctr1-1)*bcoef(a-1+w-ctr1,a-1))%MOD)%MOD;
    }
    cout<<rez;
    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

map<string,int> m;

main()
{
    int n; cin>>n;
    rep(i,n)
    {
        string s; cin>>s;
        m[s]++;
    }

    int mx=0;
    each(it,m)mx=max(mx,it.second);
    vector<string> t;
    each(it,m)
    {
        if(it.second==mx)t.push_back(it.first);
    }

    sort(all(t));

    each(it,t)cout<<it<<endl;

}

Measured memory_bytes: 26868
#include <stdio.h>
#include <string.h>

int main( void ) {
	char str1[ 100000 ], str2[ 100000 ], fig, tmp;
	int n, idx1, idx2, sum;

	for ( ; scanf( "%d", &n ), n; printf( "%s\n", str1 ) )
		for ( scanf( "%s", str1 ); n--; strcpy( str1, str2 ) ) {
			idx1 = idx2 = 0;
			while ( ( fig = str1[ idx1 ] ) != '\0' ) {
				for ( sum = 1; ( tmp = str1[ ++idx1 ] ) != '\0' && fig == tmp; sum++ ) ;

				sprintf( str2 + idx2++, "%d%c", sum, fig );
				do {
					idx2++;
				} while ( sum /= 10 );
			}
		}

	return 0;
}

Measured memory_bytes: 712
N, A, B = map(int, input().split())
V = sorted([int(a) for a in input().split()])[::-1]

fa = [1]
for i in range(1, 60): fa.append(fa[-1] * i)
C = lambda a, b: fa[a] // (fa[a-b] * fa[b])

print(sum(V[:A])/A)
print(sum([C(V.count(V[i-1]), V[:i].count(V[i-1])) for i in range(A, B+1) if sum(V[:i])*A == sum(V[:A])*i]))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  string c = "CODEFESTIVAL2016";
  string s; cin >> s;
  int ans = 0;
  REP(i, 16) ans += s[i]!=c[i];
  cout << ans << endl;
}

Measured memory_bytes: 256
"use strict";

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

function main(input) {
  const [[numsCount], nums] = input.split("\n").map(s => s.split(" ").map(Number));


  nums.sort();
  const map = new Map();
  // 同じ数のカウントを値に
  nums.forEach((e) => {
    if(!map.has(e)) {
      map.set(e, 0);
    }
    map.set(e, map.get(e) + 1);
  });

  const ans = Array.from(map).reduce((p, [key, val]) => {
    const nextVal = map.has(key + 1) ? map.get(key + 1) : 0;
    const nextNextVal = map.has(key + 2) ? map.get(key + 2) : 0;
    return Math.max(p, val + nextVal + nextNextVal);
  }, 0);
  console.log(ans);
}

Measured memory_bytes: 31132
s = input()

cl = []
fl = []

for i, c_test in zip(range(len(s)), s):
    if c_test == 'C':
        cl.append(i)

for i, f_test in zip(range(len(s)), s):
    if f_test == 'F':
        fl.append(i)
if len(cl) == 0 or len(fl) == 0:
    print("No")    
elif max(fl) > min(cl):
    print("Yes")
else:
    print("No")

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

struct TNode
{
	int Id;
	TNode* Parent;
	TNode* LChild;
	TNode* RChild;
};

//???????????????????????????TNode*???????????????(vector??????????????¢?????????????????????)
class TTable
{
private:
	vector<TNode*> FNodes;
	void Create(int Id)
	{
		if(FNodes[Id] == NULL){
			TNode* Node;
			Node = new TNode;
			*Node = {Id, NULL, NULL, NULL};
			FNodes[Id] = Node;
		}
	}
public:
	//TNode*?????????&?????????????????????????????????
	//????????????????????§delete????????????????????????????????????????????????????????¨?????????????????????????????????????????????
	//???????????????????????????Id??¨TNode*???????????????????????¨??§????????????????????????????????¨????????????????????????????????????
	TNode* operator[](int n)
	{
		Create(n);
		return FNodes[n];
	}
	TNode* operator[](int n)const
	{
		return FNodes[n];
	}
	TTable(int n)
	{
		//????´??????°???????????????
		FNodes.resize(n, NULL);
	}
	~TTable()
	{
		int n = FNodes.size();
		for(int i = 0; i < n; i++){
			delete FNodes[i];
		}
	}
	int size()const
	{
		return FNodes.size();
	}
};

enum TNodeType {Root, InternalNode, Leaf};

void CreateLeftRelation(TNode* ParentNode, TNode* LChildNode)
{
	ParentNode->LChild = LChildNode;
	LChildNode->Parent = ParentNode;
}

void CreateRightRelation(TNode* ParentNode, TNode* RChildNode)
{
	ParentNode->RChild = RChildNode;
	RChildNode->Parent = ParentNode;
}

void Input(TTable& Table)
{
	for(int i = 0; i < Table.size(); i++){
		int Id;
		cin >> Id;
		TNode* Node = Table[Id];
		int left;
		cin >> left;
		if(left != -1){
			CreateLeftRelation(Node, Table[left]);
		}
		int right;
		cin >> right;
		if(right != -1){
			CreateRightRelation(Node, Table[right]);
		}
	}
}

void PreorderOutput(const TNode* Node)
{
	cout << ' ' << Node->Id;
	if(Node->LChild){
		PreorderOutput(Node->LChild);
	}
	if(Node->RChild){
		PreorderOutput(Node->RChild);
	}
}

void InorderOutput(const TNode* Node)
{
	if(Node->LChild){
		InorderOutput(Node->LChild);
	}
	cout << ' ' << Node->Id;
	if(Node->RChild){
		InorderOutput(Node->RChild);
	}
}

void PostorderOutput(const TNode* Node)
{
	if(Node->LChild){
		PostorderOutput(Node->LChild);
	}
	if(Node->RChild){
		PostorderOutput(Node->RChild);
	}
	cout << ' ' << Node->Id;
}

TNode* GetRootNode(TNode* Node)
{
	while(Node->Parent){
		Node = Node->Parent;
	}
	return Node;
}

void Output(const TTable& Table)
{
	TNode* Node = GetRootNode(Table[0]);
	cout << "Preorder"  << endl;
	PreorderOutput(Node);
	cout << endl;
	cout << "Inorder"   << endl;
	InorderOutput(Node);
	cout << endl;
	cout << "Postorder" << endl;
	PostorderOutput(Node);
	cout << endl;
}

int main()
{
	int n;
	cin >> n;
	TTable Table(n);
	Input(Table);
	Output(Table);
    return 0;
}

Measured memory_bytes: 3116
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/
ll comb(ll a, ll b) {
	ll ret=1;
	ll temp = a;
	for (ll i = 0; i < b; i++) {
		ret *= temp;
		temp--;
	}
	temp = b;
	for (ll i = 0; i < b; i++) {
		ret /= temp;
		temp--;
	}

	return ret;
}

int main()
{
	ll n;
	ll *a;
	ll ansa=0, ansb=0;
	ll max = 0;

	cin >> n;
	a = new ll[n];
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n,greater<ll>());

	ll sub = 0;
	ll tempi = 0;
	ll tempj = 0;
	for (ll i = 0; i < 2; i++) {
		
		for (ll j = i+1; j < n; j++) {
			if (sub > min(abs(a[i] - a[j]),a[j])) {
				break;
			}
			else {
				sub = min(abs(a[i] - a[j]), a[j]);
				tempi = i;
				tempj = j;
			}
		}
	}
	ansa = a[tempi];
	ansb = a[tempj];
	
	//for (ll i = 0; i < 1; i++) {
	//	ll sub = 0;
	//	ll tempi = i;
	//	ll tempj = 0;
	//	for (ll j = i + 1; j < n; j++) {
	//		if (sub > min(abs(a[i] - a[j]), j)) {
	//			break;
	//		}
	//		sub = abs(a[i] - a[j]);
	//		tempj = j;

	//	}
	//	ll temp = comb(a[tempi], a[tempj]);
	//	if (temp > max) {
	//		max = temp;
	//		ansa = a[tempi];
	//		ansb = a[tempj];
	//	}
	//}
	cout << ansa << " " << ansb << endl;


	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
using namespace std;
int main() {
  int h, n;
  cin >> h >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];

  const int inf = 1e9;
  vector<int> dp(h + 1, inf);
  dp[0] = 0;
  for (int i = 0; i <= h; i++) {
    for (int j = 0; j < n; j++) {    
      int idx = min(h, i + a[j]);
      dp[idx] = min(dp[idx], dp[i] + b[j]);
    }
  }
  cout << dp[h] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int W,H,x,y,r;
  
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

  if(W>0 && W<=100 && H>0 && H<=100 && r>0 && r<=100)
  {
    if(x>=-100 && x<=100 && y>=-100 && y<=100)
    {
      if(x-r>=0 && x+r<=W && y-r>=0 && y+r<=H)
      {
        printf("Yes\n");
      }
      else
      {
        printf("No\n");
      }
    }
  }
  return 0;
}


Measured memory_bytes: 2108
#include<cstdio>
#include<cmath>
using namespace std;
int main (void)
{
	double a, b, x, y, ans;
	
	scanf("%lf%lf%lf",&a,&b,&x);
	if (x<=a*a*b/2) {
		y=x*2/a/b;
		ans=atan(b/y);
	}
	else {
		y=x*2/a/a-b;
		ans=atan((b-y)/a);
	}
	ans=ans/acos(-1.0)*180;
	printf("%.10f\n",ans);
	
	return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, cnt[5];
double DP[305][305][305];

double Solve(int i, int j, int k){
  if (DP[i][j][k] != -1) return DP[i][j][k];
  if (i > N || j > N || k > N) return 0;

  double ans = 0;
  if (i > 0){
    ans += Solve(i-1, j, k) * (double)i / (double)(i+j+k);
  }
  if (j > 0){
    ans += Solve(i+1, j-1, k) * (double)j / (double)(i+j+k);
  }
  if (k > 0){
    ans += Solve(i, j+1, k-1) * (double)k / (double)(i+j+k); 
  }
  ans += (double)N / (double)(i+j+k);

  return DP[i][j][k] = ans;
}

int main(){
  cin >> N;
  for (int i = 0; i < N; i++){
    int A; cin >> A; cnt[A]++;
  }
  fill((double*)DP, (double*)(DP+N+1), -1);
  DP[0][0][0] = 0;

  printf("%.100lf\n", Solve(cnt[1], cnt[2], cnt[3]));

  return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  char c1, c2;
  cin >> c1 >> c2;
  if (c1 == c2) cout << "H" << endl;
  else cout << "D" << endl;
  return 0;
}


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

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)
vector<vector<int> > g;
vector<vector<int> > rev;
    
class tsort {
public:
	int V;
	vector<vector<int> > G;
	vector<int> deg,res;
	tsort(int node_size) : V(node_size), G(V), deg(V, 0){}
	void add_edge(int from,int to){
		G[from].push_back(to);
		deg[to]++;
	}
	bool solve() {
		queue<int> que;
		for(int i = 0; i < V; i++){
			if(deg[i] == 0){
				que.push(i);
			}
		}
		while(!que.empty()){
			int p = que.front();
			que.pop();
			res.push_back(p);
			for(int v : G[p]){
				if(--deg[v] == 0){
					que.push(v);
				}
			}
		}
		return (*max_element(deg.begin(),deg.end()) != 0);
	}
};

int main(){
    int n,m;
    cin >> n >> m;
    g.resize(n);
    rev.resize(n);
    tsort ts(n);
    rep(i,n+m-1){
        int a,b;
        cin >> a >> b;
        a--;b--;
        ts.add_edge(a,b);
        g[a].push_back(b);
        rev[b].push_back(a);
    }
    int r = 0;
    rep(i,100010){
        if(rev[r].size()!=0){
            r = rev[r][0];
        }
    }
    //cerr << r << endl;
    ts.solve();
    //rep(i,n)cerr << ts.res[i] << " ";
    vector<int> q(n);
    rep(i,n){
        q[ts.res[i]] = i;
    }
    vector<int> p(n);
    for(int i=0;i<n;i++){
        int ma = -1;
        for(auto x:rev[i]){
            //cerr << i << " " << x << endl;
            if(ma<q[x]){
                p[i] = x+1;
                ma = q[x];
            }
        }
        if(i==r){
            p[i] = 0;
        }
    }
    for(int i=0;i<n;i++){
        cout << p[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 19072
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
using boost::multiprecision::integer_modulus;
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int gcdmod(cpp_int t, int b) {
    int a = integer_modulus(t, b);
    return gcd(a, b);
}
const int mod = 1e9 + 7;
int main() {
    int N, A;
    cin >> N >> A;
    cpp_int sum = 1, lcm = A;
    for (int i = 1; i < N; i++) {
        cin >> A;
        int t = gcdmod(lcm, A);
        lcm *= A / t;
        sum = (sum * A / t) + (lcm / A);
    }
    cout << integer_modulus(sum, mod) << "\n";
}


Measured memory_bytes: 384
using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		string[] s = Console.ReadLine().Split(' ');
		var a = int.Parse(s[0]);
		var b = int.Parse(s[1]);
		var c = int.Parse(s[2]);
		if((a < b) && (b < c)) Console.WriteLine("Yes");
		else  Console.WriteLine("No");
	}
}

Measured memory_bytes: 8864
use std::io::BufRead;

pub struct StdinReader<R: BufRead> {
    pub buf_reader: R,
    pub buf: String,
}
impl<R: BufRead> StdinReader<R> {
    pub fn new(r: R) -> Self {
        StdinReader {
            buf_reader: r,
            buf: String::with_capacity(10000),
        }
    }
}

#[macro_export]
macro_rules! input {
    ($reader : expr, $t : ty) => { // one variable
        match &mut $reader {
            reader => {
                use std::io::BufRead;
                reader.buf_reader.read_line(&mut reader.buf).unwrap();
                let tmp_var: $t = reader.buf.trim().parse().unwrap(); 
                reader.buf.clear();
                tmp_var
            },
        }
    };
    ($reader : expr, $t0 : ty, $t1 : ty) => { // 2 tuple
        match &mut $reader {
            reader => {
                use std::io::BufRead;
                reader.buf_reader.read_line(&mut reader.buf).unwrap();
                let tmp_var: Vec<$t0> = reader.buf.trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
                reader.buf.clear();
                (tmp_var[0], tmp_var[1])
            }
        }
    };
    ($reader : expr, $t0 : ty, $t1 : ty, $t2 : ty) => { // 3 tuple
        match &mut $reader {
            reader => {
                use std::io::BufRead;
                reader.buf_reader.read_line(&mut reader.buf).unwrap();
                let tmp_var: Vec<$t0> = reader.buf.trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
                reader.buf.clear();
                (tmp_var[0], tmp_var[1], tmp_var[2])
            }
        }
    };
    ($reader : expr, $t : ty; $size : expr) => { // Vector
        match &mut $reader {
            reader => {
                use std::io::BufRead;
                reader.buf_reader.read_line(&mut reader.buf).unwrap();
                let tmp_var: $t = reader.buf.trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
                reader.buf.clear();
                tmp_var
            }
        }
    };
}

fn main() {
    let handle = std::io::stdin();
    let mut r = StdinReader::new(handle.lock());
    let n: usize = input!(r, usize);
    let ls: Vec<usize> = input!(r, Vec<usize>; n);
    let mut is_ok = true;
    for i in 0..n {
        let mut sum_len = 0;
        for j in 0..n {
            if j == i {
                continue;
            }
            sum_len += ls[j];
        }
        if sum_len <= ls[i] {
            is_ok = false;
        }
    }
    if is_ok {
        println!("{}", "Yes");
    } else {
        println!("{}", "No");
    }
}


Measured memory_bytes: 4352
import java.util.Scanner;
 
public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
            for(int i = 0; n > i; i++)
            {
                double x1 = sc.nextDouble();
                double y1 = sc.nextDouble();
                double x2 = sc.nextDouble();
                double y2 = sc.nextDouble();
                double x3 = sc.nextDouble();
                double y3 = sc.nextDouble();
                    double A1 = (2 * (x2 - x1));
                    double B1 = (2 * (y2 - y1));
                    double C1 = (x1*x1 - x2*x2 + y1*y1 - y2*y2);
                    double A2 = (2 * (x3 - x1));
                    double B2 = (2 * (y3 - y1));
                    double C2 = (x1*x1 - x3*x3 + y1*y1 - y3*y3);
                        double px = ((B1*C2 - B2*C1)/(A1*B2 - A2*B1));
                        double py = ((C1*A2 - C2*A1)/(A1*B2 - A2*B1));
                        double r = (Math.sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1)));
                    System.out.printf("%.3f %.3f %.3f\n", px, py, r);
            }
    }
}

Measured memory_bytes: 20692
#include "bits/stdc++.h"

using namespace std;

#define debug(args...) fprintf(stderr, args)

#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)

#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()

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

int n, a, b;

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

	if((b - a - 1) % 2) cout << "Alice\n";
	else cout << "Borys\n";

	return 0;
}


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

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

int main()
{
  int n,m;
  scanf("%d%d",&n,&m);
  static char s[100010],t[100010];
  scanf("%s%s",s,t);
  int g=gcd(n,m);
  bool F=true;
  for(int i=0;i<g;i++){
    if(s[n/g*i]!=t[m/g*i]){
      F=false;
      break;
    }
  }
  printf("%lld\n",F?(long long)n/g*m:-1);
  return 0;
}


Measured memory_bytes: 384
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte(){
        if(ptr < buflen){
            return true;
        }else{
            ptr = 0;
            try{
                buflen = in.read(buffer);
            }catch(IOException e){
                e.printStackTrace();
            }
            if(buflen <=0){
                return false;
            }
        }
        return true;
    }

    private int readByte(){
        if(hasNextByte())return buffer[ptr++];
        else return -1;
    }

    private static boolean isPrintableChar(int c){
        return 33<=c && c<=126;
    }
    public boolean hasNext(){
        while(hasNextByte() && !isPrintableChar(buffer[ptr]))ptr++;
        return hasNextByte();
    }

    public String next(){
        if(!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)){
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong(){
        if(!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        if(b < '0' || '9' < b){
            throw new NumberFormatException();
        }
        while(true){
            if('0' <= b && b<='9'){
                n*=10;
                n+=b-'0';
            }else if(b==-1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt(){
        long nl = nextLong();
        if(nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDoutble(){return Double.parseDouble(next());}
}
public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++){
            a[i] = fs.nextInt();
        }
        int m = 0;
        int[] b = new int[n];
        int sum;
        for(int i=n;i>=1;i--){
            sum = 0;
            for(int j=2*i;j<=n;j+=i){
                if(b[j-1]==1){
                    sum++;
                }
            }
            if(sum%2!=a[i-1]){
                b[i-1] = 1;
                m++;
            }
        }
        PrintWriter out = new PrintWriter(System.out);
        System.out.println(m);
        for(int i=0;i<n;i++){
            if(b[i]==1){
                out.println(i+1);
            }
        }
        out.flush();



    }
}   

Measured memory_bytes: 31724
/*
 _____ _             _              _           _ 
|_   _| |__   ___   / \   _ __  ___| |__  _   _| |
  | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
  | | | | | |  __// ___ \| | | \__ \ | | | |_| | |
  |_| |_| |_|\___/_/   \_\_| |_|___/_| |_|\__,_|_|                                                

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll,ll>
#define msi         map<string,ll>
#define mis         map<ll, string>
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define trav(a, x) 	for(auto& a : x)
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pair<ll, ll>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define max(a,b)	(a>b?a:b)
#define min(a,b)	(a<b?a:b)

/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace __gnu_pbds;
using namespace std;
#define PI 3.141592653589793
#define N  100005
map<ll,ll>ma;
ll a,b,c,d;

ll fun(ll n) {
	if(n<0)
		return 10000000000000;
	if(n==0)
		return 0;
	if(n==1)
		return d;
	if(n==2)
		return min(min(2*d,a+d),min(2*d+b,4*d+c));
	if(ma.find(n)!=ma.end())
		return ma[n];
	ll ans=LLONG_MAX;
	ll num=(n/2);
	ans=min(ans,fun(num)+a+abs(num*2-n)*d);
	num++;
	ans=min(ans,fun(num)+a+abs(num*2-n)*d);
	num=(n/3);
	ans=min(ans,fun(num)+b+abs(num*3-n)*d);
	num++;
	ans=min(ans,fun(num)+b+abs(num*3-n)*d);
	num=(n/5);
	ans=min(ans,fun(num)+c+abs(num*5-n)*d);
	num++;
	ans=min(ans,fun(num)+c+abs(num*5-n)*d);
	if(d<LLONG_MAX/n)
	ans=min(ans,n*d);
	ma[n]=ans;
	return ans;
}

void solve()
{
	ll n;
	cin>>n>>a>>b>>c>>d;
	ma.clear();
	cout<<fun(n)<<endl;
	return;
}
int main()
{
	FAST
	int TESTS=1;
	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	TIME
	return 0;
}

Measured memory_bytes: 4996