akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)
var c = 1000000007

func main() {
	scanInit()

	n := nextInt()
	ans := 1
	for i := 1; i < n+1; i++ {
		ans = (ans * i) % c
	}

	fmt.Println(ans)

}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1784
import Control.Monad
import Control.Applicative
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import Data.Foldable (foldMap)
import Data.List.Split
import Data.Char
import Data.Ratio
import Data.Ord
import Data.Array.IO
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
-- end of templete

f [] = []
f ('a':'p':'p':'l':'e':s) = "peach" ++ f s
f ('p':'e':'a':'c':'h':s) = "apple" ++ f s
f (x:s) = (x : f s)

main = getLine >>= putStrLn . f

Measured memory_bytes: 3572
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// -----------------------------------------------------------------------------
// main
// -----------------------------------------------------------------------------
fn main(){
    input!{
        n: usize,
        x: usize,
        a: [usize; n]
    }
    let mut x = x;
    let mut a = a;
    a.sort();
    let sum_a: usize = a.iter().sum();
    let mut ans = 0;
    if sum_a == x{
        ans = n;
    }else if sum_a < x{
        ans = n-1;
    }else{
        for i in 0..n{
            if a[i] <= x{
                x -= a[i];
                ans += 1;
            }else{
                break;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Washoum
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        inputClass in = new inputClass(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ICoins solver = new ICoins();
        solver.solve(1, in, out);
        out.close();
    }

    static class ICoins {
        public void solve(int testNumber, inputClass sc, PrintWriter out) {
            int n = sc.nextInt();
            double[] p = new double[n];
            for (int i = 0; i < n; i++) {
                p[i] = sc.nextDouble();
            }

            double[][] dp = new double[n + 1][n + 1];
            boolean[][] go = new boolean[n + 1][n + 1];
            go[0][0] = true;
            dp[0][0] = 1;

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (go[i][j])
                        dp[i + 1][j] += dp[i][j] * (1 - p[i]);
                    go[i + 1][j] = true;
                    dp[i + 1][j + 1] += dp[i][j] * p[i];
                    go[i + 1][j + 1] = true;
                }
            }

            double ans = 0;
            for (int i = n; i > n / 2; i--) {
                ans += dp[n][i];
            }
            out.println(ans);
        }

    }

    static class inputClass {
        BufferedReader br;
        StringTokenizer st;

        public inputClass(InputStream in) {

            br = new BufferedReader(new InputStreamReader(in));
        }

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

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

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

    }
}



Measured memory_bytes: 132432
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static void Write(object obj) {
#if DEBUG
        Debug.Write(obj.ToString());
#else
        Console.Write(obj.ToString());
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        while (true) {
            if (Is(n)) return n;
            n++;
        }
    }

    static bool Is(int n) {
        var r = (int)Math.Sqrt((double)n);
        
        for(int i=2; i<=r; i++) {
            if (n % i == 0) return false;
        }
        return true;
    }
}


Measured memory_bytes: 13140
# coding: utf-8
# Your code here!
n,d=map(int,input().split())
point=[[int(i) for i in input().split()]for j in range(n)]
t=[False for i in range(n)]
for i in range(n):
    tmp=(point[i][0]**2+point[i][1]**2)**0.5
    if tmp<=d:
        t[i]=True
print(t.count(True))

Measured memory_bytes: 44224
n, m, k = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
 
a_sum=[0]
for i in range(n):
  a_sum.append(a[i]+a_sum[i])
  
b_sum=[0]
for i in range(m):
  b_sum.append(b[i]+b_sum[i])
  
ans, j = 0, m
for i in range(n+1):
  if a_sum[i]>k:
    break
  while a_sum[i] + b_sum[j] > k and j>0:
    j-=1
  if a_sum[i]+b_sum[j]<=k:
    ans=max(ans, i+j)
print(ans)

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

int main() {
  int A, B;
  string op;
  
  cin >> A >> op >> B;
  
  if (op == "+") {
    cout << A + B << endl;
  }
  
  if (op == "-") {
    cout << A - B << endl;
  }

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<string>
#define LL long long
#define li i<<1
#define ri i<<1|1
using namespace std;
inline LL read()
{
    char c=getchar();LL x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}
LL n,k,a[1005],ans;
int main()
{
	n=read();
	k=read();
	for(int i=0;i<n;++i)
		a[i]=read();
	sort(a,a+n);
	for(int i=0;i<k;++i)
		ans+=a[i];
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3704
use proconio::input;
use std::collections::BTreeMap;

fn lower_bound(map: &BTreeMap<usize, usize>, target: usize) -> usize {
    *map.range(target..).next().unwrap().1
}

fn update(map: &mut BTreeMap<usize, usize>, key: &usize, value: usize) {
    let t = *map.entry(*key).or_insert(usize::max_value());
    *map.entry(*key).or_default() = t.min(value);
}

fn main() {
    input! {
        n: usize,
        q: usize,
        query: [(usize, usize); q],
    }

    let mut h_map = BTreeMap::new();
    let mut w_map = BTreeMap::new();

    h_map.insert(n-1, n);
    w_map.insert(n-1, n);

    let mut ans = 0;

    for &(c, x) in query.iter() {
        if c == 1 {
            let t = lower_bound(&h_map, x);
            if t <= 1 {
                continue;
            }
            ans += t-2;
            update(&mut w_map,&(t-1), x);
            // if let Some(&y) = w_map.get(&(t-1)) {
            //     *w_map.entry(t-1).or_default() = y.min(x);
            // }
            // else {
            //     *w_map.entry(t-1).or_default() = x;
            // }
        }
        else {
            let t = lower_bound(&w_map, x);
            if t <= 1 {
                continue;
            }
            ans += t-2;
            update(&mut h_map, &(t-1), x);
            // if let Some(&y) = h_map.get(&(t-1)) {
            //     *h_map.entry(t-1).or_default() = y.min(x);
            // }
            // else {
            //     *h_map.entry(t-1).or_default() = x;
            // }
        }
        // dbg!(c, x, ans);
        // dbg!(h_map.clone());
        // dbg!(w_map.clone());

    }

    println!("{}", (n-2)*(n-2) - ans);
}


Measured memory_bytes: 12088
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto s = readln.chomp;
    writeln(700 + s.count('o') * 100);
}


Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
X=int(input())
ans = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i+100*j+50*k == X:
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int a[5],ans;

    for(int i=0; i<5; i++){
        cin>>a[i];
        if(!a[i])
            ans=i+1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3592
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            sS = System.Console.ReadLine().Trim().Split(' ');
            List<int> lstInp = new List<int>();
            for (int i = 0; i < sS.Length; i++) { lstInp.Add(int.Parse(sS[i])); }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iOut = 0;
            for (int i = 0; i < lstInp.Count - 1; i++)
            {
                for (int j = i + 1; j < lstInp.Count; j++)
                {
                    iOut += lstInp[i] * lstInp[j];
                }
            }

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }


}


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

using namespace std;

int main(void) {
	int N, K; cin >> N >> K;
	string s; cin >> s;

	int res = 0;
	for (int i = 0; i < N-1; i++) {
		if (s[i] == s[i + 1]) {
			res += 1;
		}
	}

	res = min(res + 2 * K, N - 1);
	cout << res << endl;

	return 0;
}

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

int H, W, N, A, now = 0;

int f1() {
  if (!A) {
    cin >> A;
    now++;
  }
  A--;
  return now;
}

void f2(int i) {
  vector<int> V(W);
  for (int i = 0; i < W; i++) V.at(i) = f1();
  if (i % 2) reverse(V.begin(), V.end());
  for (int i = 0; i < W; i++) {
    if (i != 0) cout << " ";
    cout << V.at(i);
  }
  cout << "\n";
}

int main() {
  cin >> H >> W >> N;
  for (int i = 0; i < H; i++) f2(i);
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x;
  cin >> n >> x;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  ll sum = 0;
  ll res = 1;
  for (int i = 0; i < n; i++) {
    sum += v[i];
    if(sum > x){
      cout << res << endl;
      return 0;
    }
    res++;
  }
  cout << n+1 << endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
s = sum(A)

ans = [0] * N
tmp = 0
for i in range(0,N-1,2):
    ans[i] += A[i]*2
ans[-1] = s - sum(ans)

for i in range(0,N-1):
    ans[i] = A[i-1]*2 - ans[i-1]

print(*ans)

Measured memory_bytes: 14616
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
struct node
{
	int id,num;
}a[100005];
int n,i,ans;
bool cmp(node a,node b)
{
	return a.num<b.num;
}
int Abs(int a)
{
	return a>0?a:-a;
}
int main()
{
	scanf("%d",&n);
	for(i=1;i<=n;++i)
	{
		a[i].id=i;
		scanf("%d",&a[i].num);
	}
	sort(a+1,a+1+n,cmp);
	for(i=1;i<=n;++i)
		if(Abs(i-a[i].id)&1)
			++ans;
	ans/=2;
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 1152
import java.util.Scanner;
public class Main {
 static int[][] gyo2=new int[1000000][10];
 static int count=0;
	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
int N=sc.nextInt();
int M=sc.nextInt();
int Q=sc.nextInt();
int a[]=new int[Q];
int b[]=new int[Q];
int c[]=new int[Q];
int d[]=new int[Q];
for(int i=0;i<Q;i++) {
	a[i]=sc.nextInt();
	b[i]=sc.nextInt();
	c[i]=sc.nextInt();
	d[i]=sc.nextInt();
}
int[] gyo=new int[N];
rekyo(gyo, N, 0, M);
long ans=0;
for(int i=0;i<count;i++) {
	long kari=0;
	for(int j=0;j<Q;j++) {
		//System.out.println(gyo2[i][b[j]-1]+" "+gyo2[i][a[j]-1]+" "+c[j]);
		if(gyo2[i][b[j]-1]-gyo2[i][a[j]-1]==c[j]) {
			kari+=d[j];
		}
	}
	if(ans<kari) {
		ans=kari;
	}

}
System.out.println(ans);
		}

	public static void rekyo(int gyo[],int n,int kosu,int M) {
		if(kosu==0) {
			for(int i=1;i<=M;i++) {
				gyo[0]=i;
				rekyo(gyo,n,kosu+1,M);
			}
		}else if(1<=kosu&&kosu<n) {
			for(int i=gyo[kosu-1];i<=M;i++) {
				gyo[kosu]=i;
				rekyo(gyo,n,kosu+1,M);
			}
		}else {
			for(int i=0;i<n;i++) {
				gyo2[count][i]=gyo[i];
			}
			count++;
			return;
		}
	}

	}



Measured memory_bytes: 103128
import sys
def input(): return sys.stdin.readline().rstrip()
 
def main():
    k=int(input())
    ans=1
    amari=0
    for _ in range(10**6+5):
        amari = (amari*10+7)%k
        if amari==0:
            print(ans)
            break
        ans+=1
    else:
        print(-1)

 
if __name__=='__main__':
    main()

Measured memory_bytes: 9180
#coding:utf-8
n, m = map(int, input().split())
l, r = 0, 10**6
for i in range(m):
    a, b = map(int, input().split())
    l = max(l, a)
    r = min(r, b)
print(r - l  + 1 if l <= r else 0)

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int n = ni();
 
        long MOD = 1000000007;
        long ans = 1;
 
        for (int i = 1; i <= n; i++) {
            ans = (ans * i) % MOD;
        }
 
        out.println(ans);
    }
 
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 21332
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define max(x,y)(x>y?x:y)
#define min(x,y)(x>y?y:x)
typedef long long int ll;
typedef unsigned long long int ull;
int asc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
int desc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return 1;else if(x==y)return 0;else return -1;}
int main(){
    int n,k;scanf("%d %d",&n,&k);
    ll h[n];for(int i=0;i<n;i++)scanf("%lld",&h[i]);

    qsort(h,n,sizeof(ll),desc_cmp);
    for(int i=0;i<k&&i<n;i++){
        h[i]=0;
    }
    ll ans=0;
    for(int i=0;i<n;i++)ans+=h[i];

    printf("%lld\n",ans);
}

Measured memory_bytes: 3324
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int k = sc.nextInt();
       String s = sc.nextLine();
        if (s.length()<=k){
            pw.println(s);
        }
        else {
            pw.println(s.substring(0,k)+"...");
        }
        pw.flush();
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}

Measured memory_bytes: 36652
#include<bits/stdc++.h>
#define M 100005
using namespace std;
int n,A[M];
multiset<int>s;
multiset<int>::iterator it;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&A[i]);
	int ans=0;
	for(int i=1;i<=n;i++){
		it=s.lower_bound(A[i]);
		if(s.size()&&it!=s.begin())s.erase(--it);
		else ans++;
		s.insert(A[i]);
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

#define sz(v)           ((int)((v).size()))
#define clr(v, d)       memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0; i<sz(v); ++i)
#define lp(i, n)        for(int i=0; i<(int)(n); ++i)
#define lpi(i, j, n)    for(int i=(j); i<(int)(n); ++i)
#define lpd(i, j, n)    for(int i=(j); i>=(int)(n); --i)
#define INF             1000000000

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

void init(){
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

const int N = 105;
int n;
int arr[N];

int cal(int idx){
	if(idx > 100 || idx < 1){
		return INF;
	}
	int ret = 0;
	lp(i, n){
		ret += (arr[i] - idx) * (arr[i] - idx);
	}
	return ret;
}

int main()
{
	init();
	int st = 1, end = 100, mid;
	cin >> n;
	lp(i, n)
		cin >> arr[i];
	while(st < end){
		mid = (st+end)/2;
		if(cal(mid) > cal(mid+1)){
			st = mid+1;
		}
		else{
			end = mid;
		}
	}
	cout << cal(st);
	return 0;
}



Measured memory_bytes: 256
n,m = map(int,input().split())
lr = [list(map(int,input().split())) for i in range(m)]

max = 0
min = n+1
for i in range(m):
    if lr[i][0] > max :
        max = lr[i][0]
    if lr[i][1] < min :
        min = lr[i][1]

if min-max >= 0:
    print(min-max+1)
else :
    print(0)


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

using namespace std;

const int N = 10000 + 77 , M = 100 + 77 , Mod = 1000000007;
char S[N];
int n , d , dp[N][M] , A;
int main(){
   //ios::sync_with_stdio(0);cin.tie(0);
   scanf("%s %d" , S + 1 , & d);
   n = strlen(S + 1);
   dp[0][0] = 1;
   for(int i = 1;i <= n;++ i)
      for(int j = 0;j < d;++ j)
         for(int k = 0;k < 10;++ k){
            int t = ((j - k) % d + d) % d;
            dp[i][j] = (dp[i][j] + dp[i - 1][t]) % Mod;
         }
   for(int i = 1;i < n;++ i)
      for(int j = 1;j < 10;++ j){
         int t = ((- j) % d + d) % d;
         A = (A + dp[i - 1][t]) % Mod;
      }
   int sum = 0;
   for(int i = 1;i <= n;++ i){
      int st = 0;
      if(i == 1)
         ++ st;
      for(;st < S[i] - '0';++ st){
         int t = ((- st - sum) % d + d) % d;
         A = (A + dp[n - i][t]) % Mod;
      }
      sum += S[i] - '0';
   }
   if(sum % d == 0)
      ++ A;
   cout << A % Mod;

   return 0;
}


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

long long kumi(long long n){
  return n*(n-1)/2;
}
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  for(int i=0;i<N;i++){
    A[i]--;
  }
  vector<int>count(N);
  for(int i=0;i<N;i++){
    count[A[i]]++;
  }
  long long sum=0;
  for(int i=0;i<N;i++){
    sum+=kumi(count[i]);
  }
  for(int i=0;i<N;i++){
    long long ans=sum;
    ans-=kumi(count[A[i]]);
    ans+=kumi(count[A[i]]-1);
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

ll dp[110][100010];

int main(int argc, char const *argv[])
{
	int N, W; cin >> N >> W;
	vector<int> w(N), v(N); {
		rep(i, N) cin >> w[i] >> v[i];
	}

	rep(i, 110) rep(j, 100010) dp[i][j] = -1;
	dp[0][0] = 0;

	rep(i, N)rep(j, W) {
			if (dp[i][j] == -1) continue;
			if (j + w[i] <= W) dp[i + 1][j + w[i]] = max(dp[i][j] + v[i], dp[i + 1][j + w[i]]);
			dp[i + 1][j] = max(dp[i][j], dp[i + 1][j]);
	}

	ll ans = 0;
	rep(i, W + 1) ans = max(ans, dp[N][i]);
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 86144
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

h,w=mii()

mat=[limii() for _ in range(10)]

arr=[limii() for _ in range(h)]

chk=shortest_path(csr_matrix(mat))

ans=0

for i in arr:
    for j in i:
        if j!=-1:
            ans+=int(chk[j][1])
print(ans)


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

int main() {
  int n, k, a;
  cin >> n >> k;
  a = k;
  int ans;
  for(int i=0; i<10000000; i++) {
    if(n < a) {
      ans = i+1;
      break;
    }
    else {
      a *= k;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#define ONLINE_JUDGE
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

void solve();

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

void solve(){
    ll a,b;cin>>a>>b;
    repe(c,1,3){
        if(a*b*c%2){
            cout<<"Yes"<<endl;
            return;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; cout.tie(NULL);
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#define pb push_back
#define mod 1000000007


int32_t main(){
    IOS;

int n,m;
cin>>n>>m;

char a[n][m];

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

int dp[n][m];
for(int i=0;i<n;i++)
{
    for(int j=0;j<m;j++)
    {
        if(a[i][j] == '#')
        dp[i][j] = 0;
          
        else if(i==0 && j==0)
        dp[i][j] = 1;

        else if(j==0)
        dp[i][j] = dp[i-1][j];

        else  if(i==0)
        dp[i][j] = dp[i][j-1];

        else
        {
            dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
        }
    }

}
cout<<dp[n-1][m-1]<<endl;

}


Measured memory_bytes: 9088
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

K = INT()
S = input()

if len(S) <= K:
    print(S)
else:
    print(S[:K] + '...')


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

typedef long long ll;
int ara[60];
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        ara[a]++;
        ara[b]++;
    }
    for(int i=1;i<=n;i++)
    {
        cout<<ara[i]<<endl;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string& S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}
// mod 1000000007 の世界で a += b する関数
int n;
int bit[100010];
void add(int v, int x) {

	while (v <= n)
	{
		bit[v] += x;
		v += v & -v;
	}
}

ll sum(int v) {
	ll r = 0;
	while (v > 0)
	{
		r += bit[v];
		v -= v & -v;
	}
	return r;
}
void put(string v) {
	cout << "a" << v<< "b" << endl;
}
void solv() {

	for (size_t i = 1; i <= 3000; i++)
	{
		int x, y;
		cin >> x >> y;
		if (x == 0 && y == 0) break;
		cout << min(x, y) << " " << max(x, y) << endl;
	}
	

}


int main() {
	//	COMinit();
	solv();

	return 0;
}



Measured memory_bytes: 3108
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n) a[i] = a[i] - (i+1);

    sort(a.begin(),a.end());

    // int mi = a[0];

    // rep(i,n) a[i] = a[i] - mi;

    // int sum = 0;
    // rep(i,n) sum += a[i];

    // sum = sum/n;

    // if(sum>=0){
    //     sum = sum/n;
    // }else{
    //     sum = -(abs(sum)+n-1)/n;
    // }


    // rep(i,n) a[i] = a[i] - sum;

    ll ans = 0;

    // int m = n/2;

    // int q = a[m];

    ll tmp;

    if(n%2==1){
        tmp = a[n/2];
    }else{
        tmp = (a[n/2] + a[n/2 - 1])/2;
    }
    // cout << tmp << endl;

    // rep(i,n) cout << a[i] << endl;

    rep(i,n) ans += abs(a[i] - tmp);

    cout << ans;

    return 0;
}

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

signed main(void)
{
	int h;
	cin >> h;
	if (h == 1)
		cout << "Hello World" << endl;
	else
	{
		int a, b;
		cin >> a >> b;
		cout << a + b << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority queue
#include<deque>//double_ended queue
using namespace std;
long long INF=10000; // LLONG_MAX;
struct edge {long long from,to,cost;};

//最短経路問題
int V;//頂点の数
int E;//辺の数
long long c[1000][1000];//二点間コスト、存在しなければINF
long long d[1000];//kを始点とする最短経路
edge es[1000];
bool roop=false;//負の閉路の存在の有無

bool used[1000];


//ベルマンフォード法
void shortest_path(int s){
    for(int i=0;i<V;i++){d[i]=INF;}
    d[s]=0;//sを始点とする
    int cnt=0;
    while(cnt<V){
        bool update=false;
        for(int i=0;i<E;i++){
            edge e=es[i];
            if(d[e.from]!=INF && d[e.to]>d[e.from]+e.cost){
                d[e.to]=d[e.from]+e.cost;
                update=true;
            }
        }
        if(!update){break;}
        cnt++;
    }
    if(cnt==V){roop=true;}
}

//ダイクストラ法
void dijkstra (int s){
    for(int i=0;i<V;i++){d[i]=INF;}
    for(int i=0;i<V;i++){used[i]=false;}
    d[s]=0;
    while(true){
        int v=-1;
        for(int u=0;u<V;u++){
            if(!used[u] && (v==-1 || d[u]<d[v]) ){v=u;}
        }
        if(v==-1){break;}
        used[v]=true;
        for(int u=0;u<V;u++){
            d[u]=min(d[u],d[v]+c[v][u]);
        }
    }
}

int main()
{ 
    int h,w;
    cin>>h>>w;
    V=10;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            cin>>c[j][i];
        }
    }
    dijkstra(1);
    int a;
    long long int ans=0;
    for(int i=0;i<h*w;i++){
        cin>>a;
        if(a>=0 &&a<=9){ans=ans+d[a];}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, K, i;
  cin>>N>>K;
  vector<char>S(N);
  for(i=0; i<N; i++)cin>>S[i];

  vector<char>is(N-1);
  for(i=0; i<N-1; i++){
    if(S[i]=='L' && S[i+1]=='R'){
      is[i] = 'b';
    }else if(S[i]=='R' && S[i+1]=='L'){
      is[i] = 'c';
    }else{//if(S[i]==S[i+1])
      is[i] = 'g';
    }
  }

  int bs, cs, gs;
  bs = cs = gs = 0;
  for(i=0; i<N-1; i++){
    switch(is[i]){
      case 'b': bs++;break;
      case 'c': cs++;break;
      case 'g': gs++;break;
    }
  }

  int ans = 0;
  int minbc = min(bs,cs);
  if(minbc >= K){
    ans = gs + K*2;
  }else{
    if(bs==cs){
      ans = gs + minbc*2;
    }else{
      ans = gs + minbc*2 + 1;
    }
  }

  if(gs==N-1)ans = gs;//整列していた時

  cout<<ans<<endl;
}

Measured memory_bytes: 384
using System;

public class Hello{
    public static void Main(){
        string ans;
        ulong S=ulong.Parse(Console.ReadLine());
        if(S==1000000000000000000){
            ans="0 0 1000000000 0 0 1000000000";
        }else{
            ulong a=sqrt(S);
            ulong c=a*a-S;
            if(c<=1000000000){
                ans="0 0 "+a.ToString()+" "+c.ToString()+" 1 "+a.ToString();
            }else{
                ans="0 1 "+(a-1).ToString()+" 0 "+(S-(a-1)*(a-1)).ToString()+" "+a.ToString();
            }
        }
        Console.WriteLine(ans);
    }
    
    static ulong sqrt( ulong s ){
        if(s==3){
            return 2;
        }
        ulong x = s / 2 ;
        ulong last_x = 0 ;

        while ( x != last_x )
        {
            last_x = x ;
            x = (x + s / x) / 2 ;
        }
    
        return x+1 ;
    }
}


Measured memory_bytes: 13140
//long time no ac
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";


#define     SPEED     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	ll          long long int
#define 	pb          push_back
#define 	pii         pair<int,int>
#define 	vi          vector<int>
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	hell        1000000007
#define 	rep(i,n)    for(i=0;i<n;i++)
#define 	repe(i,a,b) for(i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search
#define 	mp          make_pair

ll power(ll a,ll b)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2);
	if(b%2==0)
		return((c%hell)*(c%hell))%hell;
	return ((((c%hell)*(c%hell))%hell)*(a%hell))%hell;
}

/********************************************************/
ll p[100005],q[100005],r[100005],dp[100005][2][2][2] ,n;

ll f(ll x,ll a,ll b,ll c)
{
	if(x>n)
		return hell;
	if(x==n)
		return 0;
	if(dp[x][a][b][c] ==-1)
	{
		if(a==1)
			dp[x][a][b][c]=max({f(x+1,0,1,0)+q[x],f(x+1,0,0,1)+r[x]});
		else if(b==1)
			dp[x][a][b][c]=max({f(x+1,1,0,0)+p[x],f(x+1,0,0,1)+r[x]});
		else if(c==1)
			dp[x][a][b][c]=max({f(x+1,0,1,0)+q[x],f(x+1,1,0,0)+p[x]});
		else
			dp[x][a][b][c]=max({f(0,0,1,0),f(0,1,0,0),f(0,0,0,1)});

	}
	// debug2(x,dp[x][a][b][c]);
	// debug3(a,b,c);
	return dp[x][a][b][c];
}

int main()
{
	SPEED;
	ll k,t,c=0,i,j,m,cs=0;
	t=1;

	//cin>>t;
	string s;
	while(t--)
	{
		cin>>n;
		// n=s.length();
		// ll a[n];
		rep(i,n)
		{
			cin>>p[i]>>q[i]>>r[i];
			dp[i][0][0][0]=-1;
			dp[i][0][0][1]=-1;
			dp[i][0][1][0]=-1;
			dp[i][0][1][1]=-1;
			dp[i][1][0][0]=-1;
			dp[i][1][0][1]=-1;
			dp[i][1][1][0]=-1;
			dp[i][1][1][1]=-1;
		}
		// dp[0]=0;
		// dp[1]=abs(h[0]-h[1]);
		// repe(i,2,n)
		// {
		// 	dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]) , dp[i-2]+abs(h[i]-h[i-2]));
		// }
		// f(0,0,0,0);
		cout<<f(0,0,0,0);// max({dp[0][1][0][0],dp[0][0][1][0],dp[0][0][0][1]});
		if(t!=0)
	   		cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 15104
#include <bits/stdc++.h>
#define for0(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define V vector<int>
#define VP vector<pair<int, int> >
#define FASTIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
#ifdef _WIN32
#include <windows.h>
#define print(x) PRINT(x, #x)
template<typename T> inline const void PRINT(T VARIABLE, string NAME)
{
#ifndef ONLINE_JUDGE /// ONLINE_JUDGE IS DEFINED ON CODEFORCES
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole, 10);
    cerr << NAME << " = " << VARIABLE;
    SetConsoleTextAttribute(hConsole, 7);
    cerr << '\n';
#endif
}
#else
#define print(x) 0
#endif
typedef long long ll;
typedef unsigned long long ull;
const ll INFLL = 2 * (ll)1e18 + 100;
const int INFINT = 2 * (int)1e9 + 100;
const double PI = atan(1) * 4;
const double EPS = 1e-12;
const int SEED = 1e3 + 7;

const int MOD = 1e9 + 7; /// careful here (7 or 9, 66.. etc)
const int NMAX = 2 * 1e6 + 5;

int n, l, r;

int main()
{
    FASTIO;
    cin >> n >> l >> r;

    if((r - l) % 2 == 0) cout << "Alice";
    else cout << "Borys";

    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
A - abc of ABC
https://beta.atcoder.jp/contests/abc093/tasks/abc093_a

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    S = input().strip()
    if 'a' in S and 'b' in S and 'c' in S:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main(sys.argv[1:])
    


Measured memory_bytes: 2940
#include <stdio.h>

int main(void)
{
    char buf[10000];
    int n;
    int i = 0;

    scanf("%d", &n);
    scanf("%s", buf);

    while (buf[i] != '\0' && buf[i] != '\n')
    {
        buf[i] = 'A' + ((buf[i] - 'A' + n) % 26);
        i++;
    }

    printf("%s", buf);

    return 0;

}

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

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i=0; i<N; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  cout << v[N-1]-v[0] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define f(i,n) for(int i=0; i<n; ++i)
#define fi(i,st,n) for(int i=st; i<=n; ++i)
#define veci vector<int>
#define vecp vector<pair<int,int> >
#define vecl vector<ll>
int prime[100000+10];

ll lcm(ll a, ll b) {
	return a*b/__gcd(a,b);
}

ll power(ll a, ll n, ll mod) {
	ll res = 1;
	while(n > 0) {
		if(n&1) {
			res = (res*a)%mod;
		}
		a = (a*a)%mod;
		n = n/2;
	}
	return res;
}

ll sum(int arr[], int n) {
	ll res = 0;
	f(i,n) {
		res += arr[i];
	}
	return res;
}

void seive() {
	prime[1] = 0;
	for(int i=2; i<=100000; i++) {
		prime[i] = 1;
	}
	for(ll i=2; i<=100000; i++) {
		if(prime[i]) {
			for(ll j=i*i; j<=100000; j+=i) {
				prime[j] = 0;
			}
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,k;
	cin>>n>>k;
	vector<pair<int,int> > v;
	f(i,k) {
		int a,b;
		cin>>a>>b;
		v.pb({a,b});
	}
	ll pre[n+10] = {0};
	pre[1] = 1;
	ll sum[n+10] = {0};
	sum[1] = 1;
	ll mod = 998244353;
	for(int i=2; i<=n; i++) {
		for(int j=0; j<k; j++) {
			if(v[j].first == v[j].second) {
				pre[i] += pre[max(0,i-v[j].first)];
//				cout<<"-1";
			}
			else {
				pre[i] += sum[max(0,i-v[j].first)] - sum[max(0,i-v[j].second-1)];
//				cout<<"-2";
			}
			pre[i] %= mod;
		}
//		cout<<pre[i]<" ";
		pre[i] %= mod;
		sum[i] = sum[i-1] + pre[i];
	}
	cout<<pre[n]<<"\n";
 	return 0;
}


Measured memory_bytes: 6724
def print_list():
    for i,e in enumerate(A):
        if i == N - 1:
            print(e)
        else:
            print(e, end=" ")

N = int(input())
A = [int(e) for e in input().split()]
flag = 1; cnt = 0
while flag == 1:
    flag = 0
    for i in range(N-1, 0, -1):
        if A[i] < A[i-1]:
            w = A[i]; A[i] = A[i-1]; A[i-1] = w
            cnt += 1
            flag = 1
print_list()
print(cnt)



Measured memory_bytes: 5608
A, B = map(int,input().split())

A_down = (25 * A ) //2
A_up = (25 * (A + 1 )) //2

if (A_down * 8 )//100 != A:
    A_down += 1

if (A_up * 8 )//100 != A:
    A_up -= 1


B_down = 10 * B
B_up = 10 * (B + 1) - 1 

if A_up < B_down or B_up < A_down:
    print(-1)
else:
    if  B_down <= A_down <= B_up:
        print(A_down)
    elif A_down <= B_down <= A_up:
        print(B_down)
    else:
        print(-1)

Measured memory_bytes: 3064
public class Main {
    public static void main(String args[]) throws Exception {
    	for (int i = 1; i <= 9; i++){
    		for (int j = 1; j <= 9; j++){
    			System.out.println(i + "x" + j + "=" + i * j );
    		}
    	}
    }
}

Measured memory_bytes: 16872
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int n, q;
vector<int> adj[200005];
int cost[200005];
bool visited[200005];
void dfs(int s, int p){
    if (visited[s]) return;
    visited[s] = true;
    if (s!=0) cost[s] += cost[p];
    for(int i=0; i<adj[s].size(); i++){
        dfs(adj[s][i], s);
    }
    return;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> q;
    rep(i, n-1){
        int a, b;
        cin >> a >> b;
        a--; b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    rep(i, q){
        int p, x;
        cin >> p >> x;
        p--;
        cost[p] += x;
    }
    rep(i, n) visited[i] = false;
    dfs(0, 0);
    rep(i, n){
        cout << cost[i] << ' ';
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll a,b;
  cin >> a >> b;
  cout << max({a+b,a-b,a*b}) << endl;
}

Measured memory_bytes: 256
import bisect

N=int(input())
A=list(map(int,input().split()))
A=sorted(A)

t=0
c=0
for i in range(N-2):
    for j in range(i+1,N-1):
        t=A[i]+A[j]
        num=bisect.bisect_left(A,t)-1
        c+=max((num-j),0)

print(c)


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

int main(){
	string txt;
  	getline(cin, txt);
  	if(txt[txt.size() - 1] == 's')
      	cout << txt << "es";
  	else 
      	cout << txt << "s";
  
  
 	return 0; 
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;


int main() {
vector<int> vec(3);
int ans = 0;
for (int i = 0;i < 3;i++) {
    cin >> vec.at(i);
    }
int K;
cin >> K;
sort(vec.begin(),vec.end());
for (int i =0;i < K;i++) vec.at(2) *= 2;
   
ans += vec.at(0) + vec.at(1) + vec.at(2);

cout << ans << endl;

return 0;
}



Measured memory_bytes: 256
arr = list(input())

la = len(arr)

if la %2 ==0:
    a1 = arr[:la//2]
    a2 = arr[la//2:]
    a2.reverse()


    cnt = 0
    for i in range(la//2):
        if a1[i]  != a2[i]:
            cnt +=1

else:
    a1 = arr[:la//2]
    a2 = arr[la//2:]
    a2.reverse()
    cnt = 0
    for i in range(la//2):
        if a1[i]  != a2[i]:
            cnt +=1

print(cnt)

Measured memory_bytes: 38384