akhauriyash/Code-Regression huggingface dataset:
D=*0..gets.to_i
c=0,i=1,2
$<.map{|l|a,b=l.split.map &:to_i
D[a],D[b]=D[b],D[a]
i!=a&&i!=b||i=a+b-i
c<<D[i-1]<<D[i+1]}
p~-c.uniq.size

Measured memory_bytes: 5788
using System;
using System.Collections.Generic;
using System.Linq;

class ABC124A{
    public static void Main(){
        var ab = Console.ReadLine().Split().Select(int.Parse);
        if(ab.ElementAt(0)+ab.ElementAt(1)>ab.Max()*2-1){
            Console.WriteLine(ab.ElementAt(0)+ab.ElementAt(1));
            return;
        }
        Console.WriteLine(ab.Max()*2-1);
    }
}

Measured memory_bytes: 11348
//
//  main.cpp
//  ???tp?????????a
//
//  Created by ???????????¬ on 2015/08/02.
//  Copyright (c) 2015??´ Home. All rights reserved.
//

#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    long long h,w;
    
    while (1){
        cin >>h >>w;
        if (h==0&& w==0)break;
        
        for ( long long i = 0; i < h; i++ ){
            for ( long long j = 0; j < w; j++ ){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;

    }

    // insert code here...
    //std::cout << "Hello, World!\n";
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;
ll INF = 1e12+10;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
vector<pair<ll, ll> > pairs;
#define print1(x) cerr << "x = " << x << endl;
#define print2(x, y) cerr<< "x,y = "  << x << "," << y << endl;
#define print3(x, y, z) cerr << "x,y,z = " << x << "," << y << "," << z << endl;

int opinion[16], fopinion[16], A[16];

// �f������O(n^(1/2))
bool is_prime(int n){
    for (int i = 2; i * i <= n; i++){
        if (n % i == 0) return false;
    }
    return n != 1;
}

int main()
{
    ll X;
    cin >> X;
    reps(i, X, X * 2){
        if (is_prime(i)){
            cout << i;
            return 0;
        }
    }
    return 0;
}


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

public class Main{
	public static void main(String[] args) throws IOException{
		Scanner stdIn = null;
		List<Integer> result = new ArrayList<Integer>();
		
		Map<Integer, Integer> data = new HashMap<Integer, Integer>();
		int[] rank = new int[31];
		try{
			stdIn = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
			String str;
			while( !(str = stdIn.next()).equals("0,0") ){
				String[] s = str.split(",");
				int[] a = new int[2];
				a[0] = Integer.parseInt(s[0]); a[1] = Integer.parseInt(s[1]);				
				data.put(a[0], a[1]);
				if( rank[a[1]] != 1 ){
					rank[a[1]] = 1;
				}
			}
			int r = 0;
			for(int i = 30; i >= 0; i--){
				if( rank[i] == 1 ){
					rank[i] += r;
					r++;
				}
			}
		
			while( stdIn.hasNext() ){
				int n = stdIn.nextInt();
				result.add(rank[data.get(n)]);
			}
			for(Integer num : result){
				System.out.println(num);
			}
		} finally {
			if( stdIn != null ){
				stdIn.close();
			}
		}
	}
}

	

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

bool IsM(string x) {
	
	if (x.size() % 2 == 1) return 0;
	int mid = x.size() / 2;
	string a = x.substr(0, mid);
	string b = x.substr(mid, mid);

	return (a == b);
}


int main(void) {
	string str;

	cin >> str;

	str = str.substr(0, str.size() - 1);

	while (IsM(str) == 0) {
		str = str.substr(0, str.size() - 1);
	}

	cout << str.size() << endl;

	return 0;
}

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

int main()
{
  int a, b;
  cin >> a >> b;
  if(a >= 13){
      cout << b << endl;
  }else if(a <= 12 && a >= 6){
      cout << b/2 << endl;
  }else{
      cout << 0 << endl;
  }
}


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



int main() {
string S;
cin >> S;
int lo = S.size();
int a, z;
for(int i = 0; i < lo; i++){
if(S[i] == 'A'){
a = i;
break;
}
}
for(int i = lo-1; i > 0; i--){
if(S[i] == 'Z'){
z = i;
break;
}
}
cout << z-a+1 << endl;

}



Measured memory_bytes: 3740
/*
      author : N
      created: 10.08.2020 23:40:46
*/

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


int main(){
    int n;
    cin >> n;
    cout << n*(n+1)/2 << endl;
    return 0;
}

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

using namespace std;

int N, M, K, dp[309][309][309], a[309], sa[309];
char sir[309];
const int mod = 998244353;

int add (int x, int y) {int ans = x + y; if (ans >= mod) ans -= mod; return ans;}
int subtract (int x, int y) {if (x >= y) return x - y; return x - y + mod;}
int mul (int x, int y) {return 1LL * x * y % mod;}
void adto (int &x, int y) {x += y; if (x >= mod) x -= mod;}

int power (int a, int b)
{
    int p = 1;
    for (int i=0; (1<<i) <= b; i++)
    {
        if (b & (1 << i)) p = mul (p, a);
        a = mul (a, a);
    }
    return p;
}

int fac[2000009], inv[2000009];
void Prec (int lim){fac[0] = inv[0] = 1;for (int i=1; i<=lim; i++)fac[i] = mul (fac[i - 1], i);
inv[lim] = power (fac[lim], mod - 2);for (int i=lim - 1; i>=0; i--)inv[i] = mul (inv[i + 1], i + 1);}
int comb (int N, int K){if (K > N || N < 0 || K < 0) return 0; int ans = mul (fac[N], inv[N - K]);ans = mul (ans, inv[K]);return ans;}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%s %d", sir + 1, &K), N = strlen (sir + 1);
int cnt = 0;
for (int i=1; i<=N; i++)
    if (sir[i] == '0')
        a[++M] = cnt, cnt = 0;
    else
        cnt ++;
if (cnt > 0) ///not needed
    a[++M] = cnt;
sa[M] = a[M];
for (int i=M - 1; i>=0; i--)
    sa[i] = sa[i + 1] + a[i];
dp[M + 1][0][0] = 1;
for (int i=M + 1; i>1; i--)
    for (int j=0; j<=sa[i]; j++) /// sum b
        for (int k=0; k<=N && k<=K; k++) /// sum a - b, a >= b
            if (dp[i][j][k] > 0)
                for (int p=0; p + j <= sa[1]; p++)
                    if (p <= a[i - 1])
                        adto (dp[i - 1][j + p][k + a[i - 1] - p], dp[i][j][k]);
                    else
                        adto (dp[i - 1][j + p][k], dp[i][j][k]);
int ans = 0;
for (int i=0; i<=N && i<=K; i++)
    adto (ans, dp[1][sa[1]][i]);
printf ("%d\n", ans);
return 0;
}


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

if a+b<=n:
  a=0
  b=0
else:
  if n>a:
    b -= n-a
    a=0
    if b < 0:
      b = 0
  else:
    a = a - n

print("%d %d" %(a,b))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
int main()
{
    Hello
    int h, w;
    cin >> h >> w;
    char arr[100 + 5][100 + 5];
    bool vis[100 + 5][100 + 5] = {};
    for(int i = 0; i < h; i++)
        for(int j = 0; j < w; j++)
            cin >> arr[i][j];
    for(int i = 0; i < h; i++){
        bool hash = false;
        for(int j = 0; j < w; j++)
            if(arr[i][j] == '#')
                hash = true;
        if(!hash)
            for(int j = 0; j < w; j++)
                vis[i][j] = true;
    }
    for(int j = 0; j < w; j++){
        bool hash = false;
        for(int i = 0; i < h; i++)
            if(arr[i][j] == '#')
                hash = true;
        if(!hash)
            for(int i = 0; i < h; i++)
                vis[i][j] = true;
    }
    for(int i = 0; i < h; i++){
        bool endll = false;
        for(int j = 0; j < w; j++)
            if(vis[i][j] == false)
                endll = true;
        if(endll == false)
            continue;
        for(int j = 0; j < w; j++)
            if(vis[i][j] == false)
                cout << arr[i][j];
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def submit():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))

    d = [float('inf') for _ in range(n)]
    d[0] = 0
    for i in range(1, n):
        for j in range(1, k + 1):
            if i - j >= 0:
                d[i] = min(d[i],
                           d[i - j] + abs(h[i] - h[i - j]))
            else:
                break
    print(d[n - 1])

submit()

Measured memory_bytes: 56672
import java.util.*;
public class Main {
    
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int K = scanner.nextInt();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String result = "NG";
        for (int i = A; i <= B; i++) {
            if(i%K == 0){
                result = "OK";
            }
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 35800
use std::io::Write;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

const A_MAX: usize = 100_000;

fn main() {
    let (n, m): (usize, usize) = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        let mut ws = s.split_whitespace();
        let a = ws.next().unwrap().parse().unwrap();
        let b = ws.next().unwrap().parse().unwrap();
        (a, b)
    };

    let mut a: Vec<usize> = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.split_whitespace().map(|x| x.parse().unwrap()).collect()
    };

    // b[k] = (a[j] >= kとなるjの個数)
    let mut b = vec![];
    let mut sorted_a = a.clone();
    sorted_a.sort();
    // debugln!("{:?}", sorted_a);
    let mut i = 0;
    for k in 0..(2 * A_MAX + 1) {
        while i < n && sorted_a[i] < k {
            i += 1;
        }
        b.push(n - i);
    }
    // debugln!("{:?}", b);
    // debugln!("b: {:?}", &b[0..20]);
    // debugln!("{}", b[9]);
    // debugln!("{}", b[10]);
    // debugln!("{}", b[11]);

    a.sort_by(|x, y| y.cmp(x));

    // f(k) >=m, f(k + 1) < mとなるkを探す
    let k = if f(A_MAX * 2, &a, &b) >= m {
        A_MAX * 2
    } else {
        let mut left = 0;
        let mut right = A_MAX * 2;
        while left + 1 < right {
            let mid = (left + right) / 2;

            if f(mid, &a, &b) >= m {
                left = mid;
            } else {
                right = mid;
            }
        }
        left
    };
    // debugln!("k: {}", k);
    // debugln!("f(k): {}", f(k, &a, &b));

    // f(k + 1)までの実際の和を求める
    // debugln!("b[x]: {}", b[109]);
    let mut cumsum = vec![];
    cumsum.push(0);
    for i in 0..n {
        let cumsum_i = cumsum[i] + a[i];
        cumsum.push(cumsum_i);
    }
    // debugln!("cumsum: {:?}", cumsum);
    let mut sum_k = 0;
    for a_i in &a {
        // debugln!("a[i]: {}", a_i);
        // debugln!("b[k + 1 - a_i]: {}", b[k + 1 - a_i]);
        // debugln!("cumsum[b[...]]: {}", cumsum[b[k + 1 - a_i]]);
        let x = b[k.saturating_sub(*a_i)];
        sum_k += cumsum[x] + a_i * x;
    }
    // debugln!("f(k + 1): {}", f(k + 1, &a, &b));
    // debugln!("sum k+1: {:?}", sum_kpls1);

    let ans = sum_k - (f(k, &a, &b) - m) * k;
    println!("{}", ans);
}

// a[i] + a[j] >= kとなる(i, j)の個数
fn f(k: usize, a: &Vec<usize>, b: &Vec<usize>) -> usize {
    let n = a.len();

    let mut ret = 0;
    for i in 0..n {
        ret += b[k.saturating_sub(a[i])];
    }
    ret
}


Measured memory_bytes: 13812
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N;
	cin >> N;
	VI A(N);
	int ma = 0;
	REP(i, N) {
		cin >> A[i];
		chmax(ma, A[i]);
	}
	rSORT(A);
	int sum1[80] = { 0 };
	int sum0[80] = { 0 };
	int ans = 0;

	REP(j, N) {
		int a = A[j];
		int i = 0;
		while (i<80) {
			if (a % 2 == 0) {
				sum0[i]++;
			}
			else {
				sum1[i]++;
			}
			a /= 2;
			i++;
		}
	}
	REP(i, 80) {
		ans += ((sum1[i] * sum0[i])%mod) * ((1LL << i)%mod);

		//cout << sum1[i] << " " << sum0[i] << endl;
		ans %= mod;
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
#define Pll pair<ll,ll>

template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

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

ll fn(int N){
	if(N<=0) return 0;
	else return (N*(N-1))/2;
}
int main(void){
	ll N,A,B;
	cin>>N>>A>>B;

	if(A>B){
		print(0);
	}else if(N==1){
		if(A==B) print(1);
		else print(0);
	}else{
		print((N-2)*(B-A)+1);
	}
	

	return 0;
}




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

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

  string s;
  int w;
  cin >> s >> w;

  string result;
  for (int i = 0; i < s.size(); i += w) {
    result += s[i];
  }
  cout << result << "\n";
}


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

int main(){
    string s; cin >> s;
    if(s[1]=='B') cout << "ARC" <<endl;
    else cout << "ABC" << endl;
}

Measured memory_bytes: 3624
N, M = [int(i) for i in input().split()]
UVm = [[int(i) for i in input().split()] for _ in range(M)]
S, T = [int(i) for i in input().split()]

graphs = [[] for _ in range( 3 * N)]
dists = [-1 for _ in range( 3 * N)]
for uv in UVm:
  u = uv[0] - 1
  v = uv[1] - 1
  graphs[u].append(v + N)
  graphs[u + N].append( v + 2 * N)
  graphs[u + 2 * N].append(v)

  
from collections import deque
que = deque()
que.append(S - 1)
dists[S - 1] = 0
while len(que) > 0:
  nex = que.popleft()
  for edge in graphs[nex]:
    if dists[edge] != -1:
      continue
    que.append(edge)
    dists[edge] = dists[nex] + 1

print(dists[T-1]//3)



Measured memory_bytes: 78356
// -*- mode: cpp; coding=utf-8-unix; -*-
// vim: filetype=cpp fileencoding=utf-8 fileformat=unix
#include <iostream>
#include <iomanip>
#include <math.h>
#include <map>
#include <list>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <sstream>
#include <string.h>
// #include <limits.h>

#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define INTMAX  99999999

#define DEBUG 1

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;


int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);

	int N;
	int C[20];
	int V[20];
	int P[20];

	cin >> N;
	for (int n=0; n<N; n++) {
		cin >> V[n];
	}
	for (int n=0; n<N; n++) {
		cin >> C[n];
	}
	int profit = 0;
	for (int n=0; n<N; n++) {
		P[n] = V[n] - C[n];
		if (P[n]>=0) {
			profit += P[n];
		}
	}
	cout << profit << endl;

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  char str[1001], i;

  scanf("%s", str);

  for(i = 0; str[i] != '\0'; i++){
    if(str[i] - 3 > 64)
      str[i] = str[i] - 3;
  else
    str[i] = str[i] - 3 + 26;
  }
str[i] = '\0';

 printf("%s\n", str);

 return 0;
}

Measured memory_bytes: 524
# -*- coding: utf-8 -*-
N = int(input())
a = [int(i) for i in input().split()]

ans = 0
tmp = 1
for i in range(N):
    if a[i] == tmp:
        tmp += 1
    else:
        ans += 1

if ans == N:
    ans = -1

print(ans)


Measured memory_bytes: 26268
h,w=map(int,input().split())
s=[list(input()) for _ in range(h)]
for i in range(h):
  for j in range(w):
    if s[i][j]==".":
      x=[(i+1,j+1),(i,j+1),(i-1,j+1),(i+1,j),(i-1,j),(i+1,j-1),(i,j-1),(i-1,j-1)]
      x = [(p,q) for p,q in x if min(p,q)>=0 and p<h and q<w]
      y=0
      for p,q in x:
        if s[p][q]=="#":
          y+=1
      s[i][j]=str(y)
for i in range(h):
  print("".join(s[i]))

Measured memory_bytes: 41820
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int main()
{
	int n;
	vector<int> x;

	for (cin >> n; n--; )
	{
		int p;
		cin >> p;
		x.push_back(p);
	}

	int m;
	for (cin >> m; m--;)
	{
		int a;
		cin >> a;

		a--;
		bool ok = true;
		for (int i = 0; i < x.size(); i++)
		{
			if (i != a)
			{
				if (x.at(a) + 1 == x.at(i))
				{
					ok = false;
					break;
				}
			}
		}

		if (ok)
		{
			x.at(a)++;
			if (x.at(a) > 2019)
			{
				x.at(a) = 2019;
			}
		}
	}

	for (auto i: x)
	{
		cout << i << endl;
	}
}


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

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

    vector<int> mochi(N);
    for (int i = 0; i < N; i++)
    {
        cin >> mochi.at(i);
    }

    for (int i = 0; i < mochi.size(); i++)
    {
        for (int j = i + 1; j < mochi.size(); j++)
        {
            if (mochi.at(i) == mochi.at(j))
            {
                mochi.at(j) = 0;
            }
        }
    }

    int count = 0;

    for (int i = 0; i < mochi.size(); i++)
    {
        if (mochi.at(i) == 0)
        {
            count++;
        }
    }

    cout << mochi.size() - count << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n,sum=0;
  cin>>n;
  int n2=n;
  string ans;
  while(n2>0)sum+=n2%10,n2/=10;
  if(n%sum==0)ans="Yes";
  else ans="No";
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin>>k;
    cout<<a[k-1];
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring> //memset
using namespace std;


//int main()
//{
//	long long N, K;
//	string S;
//
//	cin >> N >> K;
//	cin >> S;
//
//	long long happy = 0, cross = 0;
//
//	// ����happy
//	for (long iN = 0; iN < N; iN++) {
//		if (S[iN] == 'L') {
//			if (iN > 0 && S[iN - 1] == 'L') {
//				happy++;
//			}
//		}
//		else {
//			if (iN < N - 1 && S[iN + 1] == 'R') {
//				happy++;
//			}
//		}
//
//		if (iN < N - 1 && S[iN] != S[iN + 1]) {
//			cross++;
//		}
//	}
//
//	long long cross_pair = cross / 2;
//	bool amari = cross % 2 == 0 ? false : true;
//
//	long long flip = std::min(cross_pair, K);
//	happy += flip * 2;
//
//	if (amari == true && K > cross_pair) {
//		happy += 1;
//	}
//
//	cout << happy << endl;
//}


//int main()
//{
//	unsigned long long N;
//	vector<long long> B;
//
//	cin >> N;
//	for (unsigned long iN = 0; iN < N - 1; iN++)
//	{
//		long long num;
//		cin >> num;
//		B.push_back(num);
//	}
//
//	long long sumA = 0;
//	for (int iA = 0; iA < N; iA++)
//	{
//		if (iA == 0) {
//			sumA += B[0];
//		}
//		else if (iA == N - 1) {
//			sumA += B[N - 2];
//		}
//		else {
//			sumA += std::min(B[iA], B[iA - 1]);
//		}
//	}
//
//	cout << sumA << endl;
//}


int main()
{
	unsigned long long N;
	vector<long long> B;

	cin >> N;

	cout << N * N * N << endl;
}



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

#define ll long long
#define endl '\n'
const int N = 1e6 + 5;

int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        ll a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        ll k;
        cin >> k;
        cout << a[k - 1];
}


Measured memory_bytes: 256
//
//  main.cpp
//  codeforces 1
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#define int long long
#define N 1500002
using namespace std;
signed main() {
    int x;
    cin>>x;
    if(x>=30) {
        cout<<"Yes"<<endl;
    }
    else {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
	#include <ext/pb_ds/assoc_container.hpp>
	#include <ext/pb_ds/tree_policy.hpp>
	#define PI 				acos(-1)
	#define mp				make_pair
	#define pb				push_back
	#define all(a)			(a).begin(), (a).end()
	#define sz(a)			a.size()
	#define srt(a)			sort(all(a))
	#define mem(a, h)		memset(a, (h), sizeof(a))
	#define f 				first
	#define s 				second
	#define MOD1			998244353
	#define fore(i, b, e)	for(int i = b; i < e; i++)
	#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
	int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

	using namespace std;
	using namespace __gnu_pbds;

	typedef long long 		ll;
	typedef unsigned long long 		ull;
	typedef pair<int, int>  ii;
	typedef vector<int>     vi;
	typedef vector<ii>      vii;
	typedef vector<ll>      vll;
	typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
	//find_by_order kth largest  order_of_key <
	const int tam = 100010;
	const int MOD = 1e9+7;
	const double EPS = 1e-9;

	int main()
	{
		ios::sync_with_stdio(0); cin.tie(0);
		//freopen("qwe.txt", "r", stdin);
		int a, b;
		cin>>a>>b;
		char res[100][100];
		fore(i, 0, 50)
			fore(j, 0, 100)
				res[i][j] = '.';
		fore(i, 50, 100)
			fore(j, 0, 100)
				res[i][j] = '#';

		a--, b--;
		int x = 0, y = 0;
		while(b > 0)
		{
			res[y][x] = '#';
			b--;
			x += 2;
			if(x >= 100)
				x = 0, y+=2;
		}
		x = 0, y = 51;
		while(a > 0)
		{
			res[y][x] = '.';
			a--;
			x += 2;
			if(x >= 100)
				x = 0, y+=2;
		}
		cout<<100<<' '<<100<<'\n';
		fore(i, 0, 100)
		{
			fore(j, 0, 100)
				cout<<res[i][j];
			cout<<'\n';
		}
		return 0;
	}

	// read the question correctly (is y a vowel? what are the exact constraints?)
	// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <math.h>
#include <string.h>
#include <map>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#define INF 1000000
#define MAX 500000
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long int ll;
typedef vector <ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
vector <vi> adj(MAX);
vi col;
 ll n;
 vi dfs_num,dfs_parent,dfs_low,vertex;
int dfsnumcnt=0,dfsRoot,rootChildren=0;

int main()
{
//   freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ll n,m=1000000007,ans=1;
cin>>n;
for(ll i=1;i<=n;i++)
    ans=(ans*i)%m;
cout<<ans<<endl;
return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    int n, m;
    cin >> n >> m;
    vpii ans;
    bool flug = false;
    for (int l=1,r=n-1; l<r; ++l,--r) {
        if (n%2==0&&!flug&&r-l<=n/2) {
            --r;
            flug = true;
        }
        ans.emplace_back(l, r);
    }
    rep(i, m) printf("%d %d\n", ans[i].first, ans[i].second);
    return 0;
}


Measured memory_bytes: 4300
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    int n,m;
    cin >> n >> m;
    
    vector<int> data(m);
    rep(i,0,m){
        cin >> data[i];
    }
    if(m==1){
        cout<<0<<endl;
        return 0;
    }
    if(n>=m){
        cout<<0<<endl;
        return 0;
    }
    sort(data.begin(),data.end());
    vector<int> distance(m-1);
    rep(i,0,m-1){
        distance[i]=data[i+1]-data[i];
    }
    sort(distance.begin(),distance.end());
    reverse(distance.begin(),distance.end());
    int total = data[m-1]-data[0];
    rep(i,0,n-1){
        total -= distance[i];
    }
    cout<<total<<endl;
    


    return 0;
}

Measured memory_bytes: 3804
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        String[] weeks = {"SUN","MON","TUE","WED","THU","FRI","SAT"};

        int result = 7;
        for (int i = 0; i < weeks.length; i++) {
            if (weeks[i].equals(s)) {
                result -= i;
            }
        }

        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 21716
n = int(input())
x = [0 for i in range(3)]
for _ in range(n):
    a,b,c = list(map(int,input().split()))
    a = a + max(x[1],x[2])
    b = b + max(x[0],x[2])
    c = c + max(x[0],x[1])
    x[0] = a 
    x[1] = b 
    x[2] = c 
print(max(x))

Measured memory_bytes: 3064
/*
Look at the star
Look at the shine for U
*/
#include<bits/stdc++.h>
#define ll long long
#define PII pair<int,int>
#define sl(x) scanf("%lld",&x)
using namespace std;
const int N = 1e6+5;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
ll inv(ll b){if(b==1)return 1; return (mod-mod/b)*inv(mod%b)%mod;}
ll fpow(ll n,ll k){ll r=1;for(;k;k>>=1){if(k&1)r=r*n%mod;n=n*n%mod;}return r;}
ll s[N];
int main()
{
	ll i,j,k,n;
	sl(n);
	for(i = 1;i <= n;i++)
		sl(s[i]);
	sort(s+1,s+1+n);
	ll sum = 0;
	for(i = 1;i < n;i++)
		sum += s[i];
	if(sum <= s[n])
		puts("No");
	else
		puts("Yes");
	return 0;
}

Measured memory_bytes: 256
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim N As Integer = NextInt()
        Dim ans As Integer = Integer.MaxValue

        For i As Integer = 0 To N - 1
            Dim a As Integer = NextInt()
            ans = Math.Min(ans, Calc(a))
        Next

        WriteLine(ans)
    End Sub

    Function Calc(a As Integer) As Integer
        Dim result As Integer
        Do While a Mod 2 = 0
            result += 1
            a \= 2
        Loop
        Return result
    End Function

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


Measured memory_bytes: 19920
char buf[99];sz;
int N,A,B;
long mod=1e9+7;
long p(long a,long b){return b?p(a*a%mod,b>>1)*(b&1?a:1)%mod:1;}
long C(long a,long b)
{
	long x=1,y=1;
	for(int i=1;i<=b;i++)
	{
		x=x*(a-i+1)%mod;
		y=y*i%mod;
	}
	return x*p(y,mod-2)%mod;
}
main()
{
	read(0,buf,99);
	for(;;)
	{
		char c=buf[sz++];
		if(c<'0')break;
		N=N*10+c-'0';
	}
	for(;;)
	{
		char c=buf[sz++];
		if(c<'0')break;
		A=A*10+c-'0';
	}
	for(;;)
	{
		char c=buf[sz++];
		if(c<'0')break;
		B=B*10+c-'0';
	}
	printf("%d\n",((p(2,N)-1-C(N,A)-C(N,B))%mod+mod)%mod);
}


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

int main(void) {
    int x;
    cin >> x;

    for (int a = 0; a <= 1000; ++a) {
        ll a5 = 1;
        rep(i,5) a5 *= a;
        for (int b = -1000; b <= 1000; ++b) {
            ll b5 = 1;
            rep(i,5) b5 *= b;
            if (a5-b5 == x) {
                cout << a << ' ' << b << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cstdio>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define queint queue<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>//大きい順
#define pqg priority_queue<int,vec,greater<int>>//小さい順
#define pb push_back
#define vec vector<int>
#define vecvec vector<vector<int>>
#define vecll vector<ll>
#define vecvecll vector<vector<ll>>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
#define mp make_pair
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}




struct UnionFindTree{
    vec par,size,rank,height;//par[i]:iの親,size[i]:iの属する木の要素数,rank[i]:iが、自分の属する木の何階層目にあるか,height[i]:iを根とする部分木の高さ
    int setNum;//木が何本あるか
    UnionFindTree(int n):par(n),size(n),rank(n),height(n){
        rep(i,n){
            par[i]=i;
            size[i]=1;
            rank[i]=-1;
            height[i]=1;
        }
        setNum=n;
    }
    int root(int x){
        if(par[x]==x)return x;
        return root(par[x]);
    }
    void unite(int x, int y){
        int rx=root(x);
        int ry=root(y);
        if(rx==ry)return;
        if(height[rx]<height[ry]){
            par[rx]=ry;
            size[ry]+=size[rx];
        }else{
            par[ry]=rx;
            size[rx]+=size[ry];
            if(height[rx]==height[y]){
                height[rx]++;
            }
        }
        setNum--;
    }
    bool same(int x, int y){
        return root(x)==root(y);
    }
    int getSize(int x){//xの属する木の要素数
        return size[root(x)];
    }
    int getSetNum(){//木の本数
        return setNum;
    }
    int getRank(int x){//xが何階層目にあるか
        if(par[x]==x)return 0;
        return getRank(par[x])+1;
    }
    int getHeight(int x){//xの属する木の高さ
        return height[root(x)];
    }
};

int main(){
    int n=in(),m=in();
    vector<queue<int>> q(m);
    rep(i,n){
        int k=in();
        rep(j,k){
            q[in()-1].push(i);
        }
    }
    UnionFindTree tree(n);
    rep(i,m){
        if(!q[i].empty()){
            int t=q[i].front();
            q[i].pop();
            while(!q[i].empty()){
                tree.unite(t,q[i].front());
                q[i].pop();
            }
        }
    }
    if(tree.getSetNum()==1)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 69376
n, max_w = gets.split.map(&:to_i)
dp = Array.new(n+1){ Array.new(4*n){ -1 } }
dp[0][0] = 0
w1 = nil
n.times do |a|
  bufs = []
  w, v = gets.split.map(&:to_i)
  w1 ||= w
  w -= w1
  n.times do |i|
    (4*n).times do |j|
      next if dp[i][j] == -1
      bufs << [i+1, j+w, [dp[i][j] + v, dp[i+1][j+w]].max]
    end
  end
  bufs.each do |buf|
    dp[buf[0]][buf[1]] = buf[2]
  end
end
result = 0
(n+1).times do |i|
  (4*n).times do |j|
    next if dp[i][j] == -1 || i*w1 + j > max_w
    v = dp[i][j]
    result = [result, v].max
  end
end
puts result


Measured memory_bytes: 4348
#include <iostream>

using namespace std;

int main()
{

    int a,b,num1,num2;
cin>>a>>b;
num1=a;
num2=b;
if(a>b){
    for(int i=1;i<=a;i++){
        cout<<b;
    }
}
   else if(a<b) {
    for (int i = 1; i <= b; i++) {

    cout << a;}
}
   else {
    for (int i = 1; i <= a; i++) {
        cout << b;
    }
}
    return 0;
}


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

int main()
{
	int r, c;
	int i, j;
	int a;
	int sum2[100] = {};
	int sum3 = 0;

	cin >> r >> c;
	for (i = 0; i<r; i++) {
		int sum = 0;
		for (j = 0; j<c; j++) {
			cin >> a;
			cout << a << " ";

			sum += a;
			sum2[j] += a;
			sum3 += a;
		}
		cout << sum << endl;
	}
	for (i = 0; i < c; i++)
		cout << sum2[i] << " ";
	cout << sum3 << endl;

	return 0;
}

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

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

	int max_l = -1;
	int min_r = N + 1;
	int l, r;
	for (int i = 0; i < M; ++i) {
		cin >> l >> r;
		max_l = max(l, max_l);
		min_r = min(r, min_r);
	}
	int ans = max(min_r - max_l + 1, 0);

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


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pi 3.1415926536
#define pb push_back
#define N 1000000007
#define M 998244353
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define nrep(i,a,b) for(int i=a;i>=b;i--)
#define pl pair<ll,ll>
#define pi pair<int,int>
#define pll pair< ll, pair<ll,ll> > 
#define pii pair< int, pair<int,int> >
ll parent[200005];
ll siz[200005];
void make_set(ll v) {
    parent[v] = v;
    siz[v] = 1;
}
ll find_set(ll v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}
void union_sets(ll a, ll b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (siz[a] < siz[b])
            swap(a, b);
        parent[b] = a;
        siz[a]+=siz[b];
    }
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll l,t,T,x,m,y,z,n;
    cin>>n>>m;
    rep(i,1,n) make_set(i);
    rep(i,1,m){
    	cin>>x>>y;
    	union_sets(x,y);
	}
	ll ans = 0;
	rep(i,1,n) ans=max(ans,siz[i]);
	cout<<ans;
}

Measured memory_bytes: 6776
#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];
    }

    int result = 1;
    int mi_n = v[0];

    for (int i = 0; i < n; i++)
    {
       if(v[i] < mi_n)
       {
           result++;
           mi_n = v[i];
           //cout << mi_n << endl;
       }
    }
    cout << result << endl;
}


Measured memory_bytes: 1024
use input::Input;

fn main() {
    let mut input = Input::default();

    let a: f64 = input.parse();
    let b: f64 = input.parse();
    let h: f64 = input.parse();
    let m: f64 = input.parse();

    let x = 30.0 * h + 0.5 * m;
    let y = 6.0 * m;
    let g = (x - y).abs();
    let g = (g.min(360.0 - g) / 180.0 * std::f64::consts::PI).cos();
    let c = (a * a + b * b - 2.0 * a * b * g).sqrt();

    println!("{:.12}", c);
}

#[allow(dead_code)]
pub mod input {
    #[derive(Default)]
    pub struct Input(Vec<String>);

    impl Input {
        pub fn read_line(&mut self) -> String {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).ok().expect("read error");
            s
        }
        pub fn parse<T: std::str::FromStr>(&mut self) -> T {
            let x = if let Some(x) = self.0.pop() {
                x
            } else {
                let s = self.read_line();
                self.0 = s.split_whitespace().map(String::from).rev().collect();
                self.0.pop().expect("reached EOF")
            };
            x.parse().ok().expect("parse error")
        }
    }
}


Measured memory_bytes: 3004
n = int(input())
a = list(map(int,input().split()))

a.sort(reverse = True)

ans = 0

for i in range(n-1):
    if i % 2 == 0:
        i //= 2
        ans += a[i]
    else:
        i = (i+1)//2
        ans += a[i]

print(ans)


Measured memory_bytes: 105140
#include <stdio.h>

int main(void)
{
    char s[100] = "\0";
    int i = 1, len = 0, t;

    scanf("%s", s);

    while(s[len]) {
        len++;
    }

    for(t = 0; t <= (int)(len/2); t++) {
        if (s[t] != s[len - 1 - t])
            i = 0;
    }

    for(t = 0; t <= (int)(((int)len/2)/2);t++) {
        if (s[t] != s[(int)((len-1)/2) - 1 - t])
            i = 0;
    }

    for(t = 0; t <= (int)(((int)len/2)/2);t++) {
        if (s[(int)((len + 2)/2) + t] != s[len - 1 - t])
            i = 0;
    }

    if(i)
        printf("Yes");
    else
        printf("No");
    
	return 0;
}

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

/* #pragma */
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int GCD(int a,int b){return b?GCD(b,a%b):a;}
long long GCD(long long a, long long b){return b ? GCD(b, a%b) : a;}
int LCM(int a, int b){return a * b / GCD(a, b);}
long long LCM(long long a, long long b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int ll
//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//chcp 65001

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

	if((b-a)%2 == 0){
		cout << "Alice" << endl;
	}
	else if((b-a)%2 == 1)
	{
		cout << "Borys" << endl;
	}

	
	return 0;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    a = [int(readline()) for _ in range(n)]
    idx = {}

    for i, x in enumerate(a):
        idx[x] = i

    mx = 1
    cnt = 1
    for x in range(1, n):
        if idx[x] < idx[x + 1]:
            cnt += 1
            mx = max(mx, cnt)
        else:
            cnt = 1

    print(n - mx)


if __name__ == '__main__':
    main()


Measured memory_bytes: 112348
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q,K,R,W,H,P,L;
string S,T;
ll ans;
ll x[101010];
ll y[101010];
ll a[201010];
ll b[101010];
ll c[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(int to, int cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;


int main() {
	ans=INF;
	cin>>N>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	rep(i,0,N){
		cin>>l[i];
	}
	rep(i,0,pow(4,N)+1){
		ll num=i;
		ll tmp[20];
		ll mp=0;
		ll num1=0;
		ll num2=0;
		rep(j,0,N+10){
			tmp[j]=10000;
		}
		rep(j,1,4){
			tmp[j]=0;
		}
		rep(j,0,N){
			//cerr<<num%4;
			if(num%4!=0){
				if(tmp[num%4]!=0)mp+=10;
				tmp[num%4]+=l[j];
			}else{
				tmp[num1]=l[j];
				if(num1==0){
					num1=4;
				}else{
					num1++;
				}
			}
			num=num/4;
		}
		//cerr<<endl;
		rep(j,1,4){
			if(tmp[j]==0){
				tmp[j]=10000;
			}
		}
		num1=(ll)max((ll)4,num1);
		sort(tmp,tmp+num1);
		rep(j,0,num1){
			rep(k,j+1,num1){
				rep(l,k+1,num1){
					num2=abs(a[0]-tmp[j])+abs(a[1]-tmp[k])+abs(a[2]-tmp[l]);
					//cerr<<num2<<" "<<mp<<endl;
					ans=min(num2+mp,ans);
					
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(void){

    int N; cin>>N;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) {
        cin>>a[i];
    }
    sort(a.rbegin(), a.rend());
    int Alice=0,Bob=0;
    for (int i = 0; i < N; ++i) {
        if(i%2==0){
            Alice+=a[i];
        }else{
            Bob+=a[i];
        }
    }
    cout<<Alice-Bob<<endl;

    return 0;
}

Measured memory_bytes: 256
// だるま落とし類題

import java.util.Scanner;

public class Main{
    
    void main() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for(int i=0;i<n;i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }
        
        int dp[][] = new int[n][n];
        for(int i=0;i<n;i++) {
        	for(int j=0;j<n;j++) {
        		dp[i][j] = Integer.MAX_VALUE;
        	}
        }
        for(int i=0;i<n;i++) {
        	dp[i][i] = 0;
        }
        
        for(int l=1;l<n;l++) {
        	for(int i=0;i+l<n;i++) {
        		int j=i+l;
        		for(int k=i;k<j;k++) {
        			dp[i][j] = Math.min(dp[i][j], dp[i][k] + dp[k+1][j] + a[i] * b[k] * a[k+1] * b[j]);
        		}
        	}
        }
        
        System.out.println(dp[0][n-1]);
    }

    public static void main(String[] args) {
        new Main().main();
    }



}


Measured memory_bytes: 26256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    string s;
    ll k;
    cin>>s>>k;
    ll n=s.size(),cnt=1,ans=0;
    rep(i,n-1){
        if(s[i]==s[i+1]) cnt++;
        else break;
    }
    if(cnt==n){
        cout<<n*k/2;
        return 0;
    }
    rep(i,n-1){
        if(s[i]==s[i+1]){
            ans++;
            s[i+1]='.';
        }
    }
    ans*=k;
    if(s[0]==s[n-1]&&cnt%2==1) ans+=k-1;
    cout<<ans;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 100001

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

int main() {
    string s;
    cin >> s;
    int ans = 1;
    if (s[0] == s[1] || s[1] == s[2] || s[2] ==s[3] ) {
        ans = 0;
    }

    if (ans) cout << "Good" << endl;
    else cout << "Bad" << endl;


}



Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

    int ans = 0;
    for(int i=0;i<m;i++){
        int tmp;
        cin >> tmp;
        if(tmp<x)ans++;
    }

    cout << min(ans,m-ans) << endl;
}


Measured memory_bytes: 256
class Stack:
    MAX = 101

    def __init__(self):
        self.S = [None] * self.__class__.MAX
        self.top = 0

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.__class__.MAX - 1

    def push(self, x):
        self.top += 1
        self.S[self.top] = x

    def pop(self):
        self.top -= 1
        return self.S[self.top + 1]


stack = Stack()
[stack.push(eval("".join(map(str, [stack.pop(), s, stack.pop()][::-1]))))
 if s in["+", "-", "*"]else stack.push(int(s))for s in input().split()]
print(stack.pop())



Measured memory_bytes: 5612