akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
int main()
{
  int x,y,z;
  cin>>x>>y>>z;
  int k=y;
  y=x;
  x=k;
  k=z;
  z=x;
  x=k;
  cout<<x<<" "<<y<<" "<<z<<endl;
  return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

int main() {
  int N; cin >> N;
  int P[N]; rep(i,N) { cin >> P[i]; P[i]--; }
  int seq[N]; rep(i,N) seq[P[i]]= i;
  int back[N]; fill_n(back,N,-1);
  rep(i,N-1) {
    if (seq[i+1]>seq[i]) {
      back[seq[i+1]] = seq[i];
    }
  }

  int r[N]; fill_n(r,N,1);
  rep(i,N) {
    if (back[i]!=-1) r[i] = r[back[i]]+1;
  }
  int rmax = 0; rep(i,N) rmax = max(rmax, r[i]);
  int result = N - rmax;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3328
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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)*}
    };
}

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

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, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[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());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        _n: usize,
        s: chars,
    }
    let mut s = s;
    s.dedup();
    puts!("{}\n", s.len());
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

using namespace std;
const int mod=1000000007;
int w,h,ansarr[1006][1006];
char grid[1006][1006];
long long solve(int x,int y)
{
    if(grid[x][y]=='#')
    {
        return 0;
    }
    if(x>=w||y>=h)
    {
        return 0;
    }
    if(x==w-1&&y==h-1)
    {
        return 1;
    }

    if(ansarr[x][y]!=-1)
    {
        return ansarr[x][y];
    }

    long long ans=0;
    ans=(ans%mod+solve(x+1,y)%mod)%mod;
    ans=(ans%mod+solve(x,y+1)%mod)%mod;
    ansarr[x][y]=ans;
    return ans;
}

int main()
{
    memset(ansarr,-1,sizeof ansarr);
    cin >> w>>h;
    for(int i=0; i<w; i++)
    {
        for(int j=0; j<h; j++)
        {
            cin >> grid[i][j];
        }
    }
    cout << solve(0,0);
    return 0;
}


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

int main()
{
    int n,k;
    std::cin>>n>>k;
    std::vector<int> v(n,0);
    for (int i=0; i<k; i++)
    {
        int d;
        std::cin>>d;
        for (int j=0; j<d; j++)
        {
            int x;
            std::cin>>x;
            v[x-1]++;
        }
    }
    int cnt=0;
    for (int i=0; i<n; i++) if (!v[i]) cnt++;
    std::cout<<cnt;
    return 0;
}

Measured memory_bytes: 3616
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>
#include <unordered_map>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<vector<int>>())

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
typedef std::pair<int, int> pii;
typedef std::pair<int, double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

#define PI 3.14159265358979323846264338327950L


const int mod = 998244353;


void solve(){
    
    
    int n;
    cin >> n;
    rep(i,n) cout << "ACL";
}




int main() {
    int T;
    
    T = 1;
    //cin >> T;
    
    while (T--) {
        solve();
        cout << endl;
    }
}




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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int h, w; cin >> h >> w;
  vector<string> a(h);
  rep(i, h) cin >> a[i];
  vector<int> dh, dw;
  rep(i, h) {
    bool ok = true;
    rep(j, w) if(a[i][j] == '#') ok = false;
    if(ok) dh.push_back(i);
  }
  rep(j, w) {
    bool ok = true;
    rep(i, h) if(a[i][j] == '#') ok = false;
    if(ok) dw.push_back(j);
  }
  rep(i, h) {
    if(binary_search(ALL(dh), i)) continue;
    rep(j, w) if(!binary_search(ALL(dw), j)) cout << a[i][j];
    cout << endl;
  }
}


Measured memory_bytes: 3632
<?php
fscanf(STDIN,'%d %d',$H,$N);
$A = array_map('intval', explode(' ', fgets(STDIN)));

$sum = 0;
foreach ($A as $row){
  $sum += $row;
}

If($sum >= $H) {
  echo "Yes";
} else {
  echo "No";
}

Measured memory_bytes: 16884
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100005
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int cmp(const void* a,const void* b){return *(int*)a-*(int*)b;}

int main() {
  int N,X,i,D=0,ans=0;
  scanf("%d%d",&N,&X);
	int L[N];
	FOR(i,0,N)scanf("%d",&L[i]);
	ans++;
	FOR(i,0,N){
		D+=L[i];
		if(D<=X)ans++;
		else break;
	}

  printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
q = int(input())

def primes(n):
  is_prime = [True] * (n+1)
  is_prime[0] = False
  is_prime[1] = False
  for i in range(2, int(n**0.5) + 1):
    if not is_prime[i]:
      continue
    for j in range(i*2, n+1, i):
      is_prime[j] = False
  return [int(i) for i in is_prime]

n = 10**5
p = primes(n)
s = [-1]*(n+1)
for i in range(n):
  if p[i]==1 and p[(i+1)//2]:
    s[i] = 1
  else:
    s[i] = 0

from itertools import accumulate
s = list(accumulate(s))
for i in range(q):
  l,r = (int(i) for i in input().split())
  print(s[r]-s[l-1])

             

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

using namespace std;

int main() {
  int N;
  long long h_max = -1, ans = 0;
  
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    long long in;
    
    cin >> in;
    
    h_max = max(h_max, in);
    
    ans += h_max - in;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3616
#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int((a).size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++) 
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if (i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = INF + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);
//const li MOD = 100055128505716009;
//const li P = 3e4 + 11;

int n;

bool read() {
	if (!(cin >> n))
		return false;
	return true;
}

void solve() {
	int odd = 0;
	fore(i, 1, n + 1) {
		odd += (i & 1);
	}

	cout << odd * 1.0 / n << endl;
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);

	int tt = clock();

#endif

	ios::sync_with_stdio(0);
	cin.tie(0);

	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef _DEBUG
	while (read()) {
#else
	if (read()) {
#endif

		solve();

#ifdef _DEBUG
		cout << "TIME = " << clock() - tt << endl;
		tt = clock();
#endif
	}
	}

Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll A[100010];
    rep(i,0,N) cin >> A[i];
    ll ans = 0;
    ll val = 1;
    rep(i,0,N){
        if(val == 1){
            ans += A[i]-1;
            val++;
        }else{
            if(A[i] == val){
                val++;
            }else if(A[i] < val){
                continue;
            }else{
                if(A[i] % val == 0){
                    ans += (A[i]-1) / val;
                }else{
                    ans += A[i] / val;
                }
            }

        }
    }
    print(ans);
}

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

typedef long long ll;

ll R, D, X;

int main() {
  cin >> R >> D >> X;
  for (ll i = 0; i < 10; ++i) {
    X = R * X - D;
    cout << X << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
typedef pair<int, int> p;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9



int main() {
	ll N, T;
	cin >> N >> T;
	ll loss = 0;
	ll endt = 0;

	for (int i = 0; i < N; i++) {
		int t;
		cin >> t;
		if (t < endt) {
			loss += (endt - t);
		}
		endt = t + T;
	}
	ll ans = N * T - loss;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    N = int(sys.stdin.readline())
    L1 = [list(map(int, sys.stdin.readline().split())) for i in range(N)]
    L = [[] for _ in range(N+1)]
    for row in L1:
        L[row[0]] += row[2:]
    #print(L)
    
    d = [-1 for i in range(N+1)] #距離
    def bfs(p, queue=[]):
        queue+=[p]
        d[p]=0
        while queue:
            now = queue.pop(0)
            for ch in L[now]:
                if d[ch] ==-1: #未開
                    d[ch] = d[now]+1
                    queue +=[ch]
    
    
    bfs(1)
    for idx, ans in enumerate(d[1:]):
        print(idx+1, ans)


if __name__=='__main__':
    main()


Measured memory_bytes: 5636
package main

import (
	"fmt"
)

type pair [2]int

var (
	h, w int
	list [][][]pair
	d    [][]int
)

const (
	maxW = 50
	maxH = 50
	inf  = 100000000
)

type queue struct {
	q []pair
}

func (q *queue) push(p pair) {
	q.q = append(q.q, p)
}

func (q *queue) shift() pair {
	p := q.q[0]
	q.q = q.q[1:]
	return p
}

func main() {
	fmt.Scan(&h, &w)

	s := make([][]rune, h+2)
	var (
		l        string
		blackCnt int
	)
	for i := 0; i < h+2; i++ {
		s[i] = make([]rune, w+2)
		if i == 0 || i == h+1 {
			continue
		}
		fmt.Scan(&l)
		for j, r := range l {
			s[i][j+1] = r
			if r == '#' {
				blackCnt++
			}
		}
	}

	list = make([][][]pair, maxH+2)
	for i := 0; i < maxH+2; i++ {
		list[i] = make([][]pair, maxW+2)
	}

	for i := 1; i < h+1; i++ {
		for j := 1; j < w+1; j++ {
			if s[i-1][j] == '.' {
				list[i][j] = append(list[i][j], pair{i - 1, j})
			}
			if s[i][j-1] == '.' {
				list[i][j] = append(list[i][j], pair{i, j - 1})
			}
			if s[i+1][j] == '.' {
				list[i][j] = append(list[i][j], pair{i + 1, j})
			}
			if s[i][j+1] == '.' {
				list[i][j] = append(list[i][j], pair{i, j + 1})
			}
		}
	}

	d := make([][]int, maxH+2)
	for i := 0; i < maxH+1; i++ {
		d[i] = make([]int, maxW+2)
		for j := 0; j < maxW+1; j++ {
			d[i][j] = inf
		}
	}
	d[1][1] = 0

	q := &queue{}
	q.push(pair{1, 1})

	for len(q.q) > 0 {
		p := q.shift()
		if p[0] == h && p[1] == w {
			break
		}
		for _, pp := range list[p[0]][p[1]] {
			if d[pp[0]][pp[1]] == inf {
				q.push(pp)
				d[pp[0]][pp[1]] = d[p[0]][p[1]] + 1
			}
		}
	}
	if d[h][w] == inf {
		fmt.Println(-1)
		return
	}
	fmt.Println(h*w - d[h][w] - blackCnt - 1)
}


Measured memory_bytes: 1024
// AOJ ITP 1_6_C
#include<cstdio>
#define rep(i,a) for( int i = 0; i != (a); ++i )

int room[4][3][10];

int main()
{
	int n;
	scanf( "%d", &n );
	rep( i, n )
	{
		int b, f, r, v;
		scanf( "%d%d%d%d", &b, &f, &r, &v );
		room[b-1][f-1][r-1] += v;
	}

	rep( i, 4 )
	{
		rep( j, 3 )
		{
			rep( k, 10 )
				printf( " %d", room[i][j][k] );		
			puts("");
		}
		if( i != 3 )
		{
			rep( j, 20 )
				putchar( '#' );
			puts("");
		}
	}

	return 0;
}

Measured memory_bytes: 1040
#include <stdio.h>
 
int main(void){
    int n,a[100],i;
     
    scanf("%d",&n);
    for(i = 0;i < n;i++){
        scanf(" %d",&a[i]);
    }
    for(i = n-1;i >= 1;i--){
        printf("%d ",a[i]);
    }
    printf("%d\n",a[0]);
     
    return 0;
}


Measured memory_bytes: 2140
#include<iostream>
using namespace std;
int main(){
    long long int N,K,S[101]={},a,flag=0;
    while(1){
        cin >> N >> K;
        if(N==0&&K==0)  break;
        for(int i=0;i<K;i++){
            cin >> S[i];
        }
        for(int j=0;j<N;j++){
            for(int i=0;i<K;i++){
                cin >> a;
                S[i] -= a;
            }
        }
        flag = 0;
        for(int i=0;i<K;i++){
            if(S[i]<0){
                flag++;
                break;
            }
        }
        if(!flag){
            cout << "Yes\n";
        }
        else{
            cout << "No\n";
        }
    }
    return 0;
}


Measured memory_bytes: 2928
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 217
// 44

using namespace std;

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, n, a, b;
    ios::sync_with_stdio(false);
    cin >> n >> a >> b;
    if(!(a + b <= n + 1 && 1LL * a * b >= n)) {
        cout << -1;
        return 0;
    }
    int nr = n - a, val = 1;
    for(i = 1; i <= a; i++) {
        int cnt = min(b - 1, nr);
        nr -= cnt;
        for(int j = val + cnt; j >= val; j--) {
            cout << j << " ";
        }
        val += cnt + 1;
    }
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 2176
N,K=map(int,input().split())
X=list(map(int,input().split()))
X.sort()
ans=10**10

for i in range(N-K+1):
    R=X[i+K-1]
    L=X[i]
    A=[ans, abs(L)+abs(R-L), abs(R)+abs(R-L)]
    ans=min(A)

print(ans)

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

int main()
{
    int n,x=0,maxi=0,j;
    string s;
    cin >> n >>s;
    for(j=0;j<n;j++)
    {
        if (s[j]=='I')
        {
            x++;
        }
        else if (s[j]=='D')
        {
            x--;
        }
        if(x>maxi)
            maxi=x;
    }
    cout << maxi;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
typedef long long ll;
typedef unsigned long long ull;
 
#define pi 3.141592653589793238462643383279502884197169399375105820974944592307816406286
#define mod 1000000007
#define diff 1000014129
 
using namespace std;
 
bool isprime(ull n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(ull i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
 
long long int gcd(long long int a,long long int b)
{
    if(b==0)
    return a;
    else
    return gcd(b,a%b);
}
 
long long int exp(long long int value,long long int power)
{
    long long int result=1;
    while(power>0)
    {
        if(power&1LL)
        {
            result*=value;
            result%=mod;
        }
        value*=value;
        value%=mod;
        power/=2LL;
    }
    return result;
}
 
long long int lcm(ll n1,ll n2)
{
    ll max = (n1 > n2) ? n1 : n2; // maximum value between n1 and n2 is stored in max
    do {
        if (max%n1 == 0 && max%n2 == 0) {
            return max;
        }
        else
            ++max;
    }
    while (true);
}
 
int isprime(ll n)
{
    if(n==1)
    return 0;
    if(n <= 3)
        return 1;
    if(n%2 == 0 || n%3 == 0)
        return 0;
    for(ll i = 5 ; i*i <= n ; i+=6)
    {
        if(n%i == 0 || n%(i+2) == 0)
            return 0;
    }
    return 1;
}

ll pre_sum[1000005];
ll a[1000005];
ll b[1000005];
ll c[1000005];
ll d[1000005];
/*
bool ispalin(ll n)
{
    ll k=0;
    while(n>0)
    {
        a[k]=n%10;
        k+=1;
        n/=10;
    }
    for(ll i=0;i<(k/2);i++)
    {
        if(a[i]!=a[k-i-1])
        return false;
    }
    return true;
}
bool comp(pair<ll,ll>x ,pair<ll,ll> y)
{
    if(x.first<y.first)
    return true;
    else if(x.first==y.first)
    {
        if(x.second<=y.second)
        return true;
        else
        return false;
    }
    else return false;
}
*/

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    long long int cnt,min_,max_,ans,n,sum,f,j,len,row,col,p,q,r,t,i,k,l,m,x,y,z;
    cin>>n>>x>>y;
    k=abs(x-y);
if(k%2==0)
cout<<"Alice";
else
cout<<"Borys";
    return 0;
 
}
 
/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        List<List<Integer>> Array = new ArrayList<>();
        
        int n = sc.nextInt();
        
        for(int i=0;i<n;i++){
            List<Integer> array = new ArrayList<>();
            Array.add(array);
        }
        
        int q = sc.nextInt();
        
        for(int i=0;i<q;i++){
            int a = sc.nextInt();
            
            if(a == 0){
                int t= sc.nextInt();
                int x = sc.nextInt();
                Array.get(t).add(x);
            }else if(a == 1){
                int t = sc.nextInt();
                int k= 0;
                	for(int j : Array.get(t)){
                    	System.out.print(j);
                			k++;
                		if(k != Array.get(t).size())
                            System.out.print(" ");
                    }
                System.out.println();
            }else{
                int t = sc.nextInt();
                Array.get(t).clear();
        	}
        }
    }
}


Measured memory_bytes: 308940
#include <bits/stdc++.h>
using namespace std;
char a[100005];
int main() {
    cin>>a;
    int len=strlen(a),cnt=0;
    for(int i=1;i<len;i++){
        if(a[i]!=a[i-1])cnt++;
    }
    std::cout <<cnt << std::endl;
    return 0;
}


Measured memory_bytes: 3716
#![allow(dead_code)]
fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);
    use std::fmt::Write;
    let mut buf = String::new();

    let n: usize = sc.read();
    let a: Vec<usize> = sc.vec(n);
    
    let mut b = vec![0; n];
    for &a in &a {
        b[a-1] += 1;
    }
    let mut c = vec![0; n+1];
    for &b in &b {
        c[b] += 1;
    }
    let mut d = vec![0; n];
    let mut e = 0;
    d[n-1] = n;
    for i in (0..n-1).rev() {
        e += c[i+2];
        d[i] = d[i+1] - e;
    }

    for k in 1..n+1 {
        let ans = bis(0, n+1, |x|
            d[x-1] >= x * k
        );
        writeln!(&mut buf, "{}", ans);
    }

    buf
}
#[test]
fn test_solve() {
   assert_eq!(solve("3\n2 1 2\n"), "3\n1\n0\n");
   assert_eq!(solve("5\n1 2 3 4 5\n"), "5\n2\n1\n1\n1\n");
   assert_eq!(solve("4\n1 3 3 3\n"), "4\n1\n0\n0\n");
}
fn bis<P>(t: usize, f: usize, eval: P) -> usize
where
    P: Fn(usize) -> bool,
{
    if t + 1 == f || f + 1 == t {
        return t;
    }
    let m = (t + f) >> 1;
    if eval(m) {
        bis(m, f, eval)
    } else {
        bis(t, m, eval)
    }
}
fn main() {
    let mut buf = String::new();
    use std::io::Read;
    std::io::stdin().read_to_string(&mut buf).unwrap();
    use std::io::Write;
    std::io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}
struct Scanner<I> {
    src: I,
}
impl<'a> Scanner<std::str::SplitWhitespace<'a>> {
    fn from_str(src: &'a str) -> Self {
        Scanner {
            src: src.split_whitespace(),
        }
    }
}
impl<'a, I> Scanner<I>
where
    I: std::iter::Iterator<Item = &'a str>,
{
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.src.next().unwrap().parse().ok().expect("Parse error")
    }
    fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    fn chars(&mut self) -> Vec<char> {
        self.src.next().unwrap().chars().collect()
    }
}

Measured memory_bytes: 22780
#include<stdio.h>

#define MAX 100
#define INF 1000000
#define white 0
#define gray 1
#define black 2

int n,u,M[MAX][MAX];

void dijkstra(void);

int main(){
  int i,j,k,v,c;

  scanf("%d",&n);

  for(i=0;i<n;i++)
    for(j=0;j<n;j++)
      M[i][j] = INF;

  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&v,&c);
      M[u][v] = c;
    }
  }

  dijkstra();

  return 0;
}

void dijkstra(){
  int i,min,d[MAX],color[MAX] = {white};

  for(i=0;i<n;i++)
    d[i] = INF;

  d[0] = 0;
  color[0] = gray;

  while(1){
    min = INF;
    u = -1;
    for(i=0;i<n;i++)
      if(min > d[i] && color[i] != black){
	u = i;
	min = d[i];
      }
    if(u == -1)break;
    color[u] = black;
    for(i=0;i<n;i++)
      if(color[i] != black && M[u][i] != INF){
	if(d[i] > d[u] + M[u][i]){
	  d[i] = d[u] + M[u][i];
	  color[i] = gray;
	}
      }
  }
  for(i=0;i<n;i++){
    if(d[i] == INF)printf("%d -1\n",i);
    else printf("%d %d\n",i,d[i]);
  }

}

Measured memory_bytes: 632
#include<bits/stdc++.h>
#define rp(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll=long long;
ll fives(ll x){
    if(x<5) return 0;
    return x/5 + fives(x/5);
}

int main(){
    ll n;
    cin >> n;
    if(n%2==1){
        cout << 0 << endl;  
    }
    else{
        cout << fives(n/2) << endl;
    }
    return 0;
}

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

int n;
set<pair<int, int>> s;

int main() {
    ios::sync_with_stdio(false);
    cin >> n;
    if (n & 1) {
        for (int i = 1; i < n; i++) {
            int x = i;
            int y = n - i;
            if (x > y) swap(x, y);
            s.insert(make_pair(x, y));
        }
    } else {
        for (int i = 1; i <= n; i++) {
            int x = i;
            int y = n - i + 1;
            if (x > y) swap(x, y);
            s.insert(make_pair(x, y));
        }
    }
    cout << n * (n - 1) / 2 - (int)s.size() << endl; 
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            if (s.find(make_pair(i, j)) == s.end()) {
                cout << i << " " << j << endl;
            }
        }
    }
    return 0;
}

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

string land[51];
int black[51][51],white[51][51],w,h,visited[51][51];
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};

void bfs() {

    memset(visited, 0, sizeof(visited));
    memset(black, 0, sizeof(black));
    memset(white, 0, sizeof(white));

    queue<pair<int,int> > q;
    //black
    for(int i=0; i<h; ++i)
        for(int j=0; j<w; ++j)
            if(land[i][j] == 'B')
                q.push(make_pair(i,j));


    while(!q.empty()) {
        int y = q.front().first,x = q.front().second; q.pop();
        if(visited[y][x] != 0) continue;
        visited[y][x] = 1;
        for(int k=0; k<4; ++k) {
            int nx = x + dx[k],ny = y + dy[k];
            if(nx < 0 || nx > w-1 || ny < 0 || ny > h-1) continue;
            if(land[ny][nx] != '.') continue;
            black[ny][nx] = 1;
            q.push(make_pair(ny,nx));
        }
    }

    memset(visited, 0, sizeof(visited));
    for(int i=0; i<h; ++i)
        for(int j=0; j<w; ++j)
            if(land[i][j] == 'W')
                q.push(make_pair(i,j));


    while(!q.empty()) {
        int y = q.front().first,x = q.front().second; q.pop();
        if(visited[y][x] != 0) continue;
        visited[y][x] = 1;
        for(int k=0; k<4; ++k) {
            int nx = x + dx[k],ny = y + dy[k];
            if(nx < 0 || nx > w-1 || ny < 0 || ny > h-1) continue;
            if(land[ny][nx] != '.') continue;
            white[ny][nx] = 1;
            q.push(make_pair(ny,nx));
        }
    }

}

int main() {

    while(cin>>w>>h, w|h) {
        for(int i=0; i<h; ++i)
            cin>>land[i];
        bfs();
        int wh=0,bl=0;

        for(int i=0; i<h; ++i) {
            for(int j=0; j<w; ++j) {
                if(black[i][j] == 1 && white[i][j] == 0)
                    bl++;

                if(white[i][j] == 1 && black[i][j] == 0)
                    wh++;
            }
        }

        cout<<bl<<" "<<wh<<endl;
    }
}

Measured memory_bytes: 0
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

type Data struct {
	Id, P, Y int
	ANS      string
}

type DataS []Data

func (datas DataS) Len() int {
	return len(datas)
}

func (datas DataS) Swap(i, j int) {
	datas[i], datas[j] = datas[j], datas[i]
}

func (datas DataS) Less(i, j int) bool {
	if datas[i].P < datas[j].P {
		return true
	} else if datas[i].P > datas[j].P {
		return false
	} else {
		return datas[i].Y < datas[j].Y
	}
}

func (datas DataS) Format() map[int]string {
	count := make(map[int]int)
	for _, d := range datas {
		count[d.P]++
	}
	tmpIdx := 1
	tmpP := 1 // 問題文からして順番でいいはずだろうきっと多分
	for i := 0; i < len(datas); i++ {
		if datas[i].P > tmpP {
			tmpP = datas[i].P
			tmpIdx = 1
		}
		datas[i].ANS = fmt.Sprintf("%06d%06d", tmpP, tmpIdx)
		tmpIdx++
	}
	ret := make(map[int]string)
	for i := 0; i < len(datas); i++ {
		ret[datas[i].Id] = datas[i].ANS
	}
	return ret
}

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()
	_, M := nextInt(), nextInt()
	P, Y := make([]int, M), make([]int, M)
	DTS := make(DataS, M)
	for i := 0; i < M; i++ {
		P[i], Y[i] = nextInt(), nextInt()
		DTS[i] = Data{Id: i, P: P[i], Y: Y[i]}
	}
	sort.Sort(DTS)
	ans := DTS.Format()
	for i := 0; i < M; i++ {
		fmt.Fprintln(out, ans[i])
	}
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}


Measured memory_bytes: 22544
#include "bits/stdc++.h"
using namespace std;

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int32_t main() {
    //ios::sync_with_stdio(false); cin.tie(nullptr);

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

	// n switches, m bulbs
	vector<int> k(m), p(m), s[m];
	for (int i = 0; i < m; i++) {
		cin >> k[i];
		for (int j = 0; j < k[i]; j++) {
			int x;
			cin >> x;
			s[i].pb(x - 1);
		}
	}

	for (int i = 0; i < m; i++) {
		cin >> p[i];
	}

	int ans = 0;
	for (int mask = 0; mask < (1<<n); mask++) {
		int bad = 0;
		for (int b = 0; b < m; b++) {
			int cnt = 0;
			for (int i: s[b]) {
				if (mask & (1<<i)) {
					cnt++;
				}
			}
			if ((cnt % 2) != p[b]) {
				bad = 1;
				break;
			}
		}
		if (!bad) {
			ans++;
			//cout << "mask = " << 
			//mask << "\n";
		}
	}

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


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	double a;
	for(int i = 1; i <= n; i++){
		if(i % 2 == 1){
			a++;
		}
	}
	printf("%.10lf", a / n);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<math.h>
#include<array>
#include<algorithm>
#include<queue>
//#include<deque>
#include<vector>
//#include<utility>
//#include<set>
#include<map>
//#include<list>
#include<bitset>
#include<iomanip>

using namespace std;
using LLI = long long int;
LLI N;

//array<int, 8>dir_x = { 0,0,1,1,1,-1,-1,-1 };
//array<int, 8>dir_y = { 1,-1,1,0,-1,1,0,-1 };
//array<int, 4>dir_x2 = { 0,0,1,-1 };
//array<int, 4>dir_y2 = { 1,-1,0,0 };
//char alp[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };

//class UnionFind {
//public:
//	vector<int>data;
//	UnionFind(int size) :data(size, -1) {};
//	bool unionset(int x, int y) {
//		x = root(x), y = root(y);
//		if (x != y) {
//			if (data[y] < data[x]) {
//				swap(x, y);
//			}
//			data[x] += data[y];
//			data[y] = x;
//		}
//		return x != y;
//	}
//	bool findset(int x, int y) {
//		return root(x) == root(y);
//	}
//	int root(int x) {
//		return data[x] < 0 ? x : data[x] = root(data[x]);
//	}
//	int size(int x) {
//		return -data[root(x)];
//	}
//};

//LLI gcd(LLI x, LLI y) {
//	LLI  r;
//	if (x < y) {
//		swap(x, y);
//	}
//	r = x % y;
//	while (r != 0) {
//		x = y;
//		y = r;
//		r = x % y;
//	}
//	return y;
//}
//LLI lcm(LLI x, LLI y) {
//	return x / gcd(x, y) * y;
//}

//long nCr(int n, int r) {
//	long ans = 1;
//	for (int i = n; i > n - r; i--) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1; i++) {
//		ans = ans / i;
//	}
//	return ans;
//}
//long nHr(int n,int r) {
//	n = n + r - 1;
//	return nCr(n,r);
//}

//const int n_max = 8;
//array<array<bool, n_max>, n_max>graph;
//int dfs(int v,int N,array<bool,n_max>visited) {
//	int ret = 0;
//	bool all_visited = true;
//	for (int i = 0; i < N;i++) {
//		if (visited[i] == false) {
//			all_visited = false;
//		}
//	}	
//	if (all_visited) {
//		return 1;
//	}
//	for (int i = 0; i < N;i++) {
//		if (graph[v][i] == false) {
//			continue;
//		}
//		if (visited[i] == true) {
//			continue;
//		}
//		visited[i] = true;
//		ret += dfs(i,N,visited);
//		visited[i] = false;
//	}
//	return ret;
//}

//vector<vector<int>>sub;
//int dfs(int id) {
//	if (sub[id].size() == 0) {
//		return 1;
//	}
//	int minP = (int)1e9;
//	int maxP = 0;
//	for (int i : sub[id]) {
//		int P = dfs(i);
//		minP = min(minP, P);
//		maxP = max(maxP, P);
//	}
//	return minP + maxP + 1;
//}

//#define debug(x) cerr << #x << " : " << x << endl
//#define debugv(x) cerr << #x << " : "; for(auto i:x) cerr << i << ", "; cerr<<endl

int main(void) {
	LLI A, B, C, K, X;
	cin >> K >> X;
	A = X - K + 1;
	B = X + K - 1;
	for (int i = A; i <= B; i++) {
		cout << i << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	int a, b; cin >> a >> b;
	if (a <= 8 && b <= 8)cout << "Yay!" << endl;
	else cout << ":(" << endl;
	return 0;
}

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

int main(){
  int n,m;
  cin>>n>>m;
  vector<pair<int,int>> c(m);
  rep(i,m) cin>>c[i].second>>c[i].first;
  
  sort(c.begin(),c.end());
  
  int ans = 1;
  
  for(int i=1;i<m;i++){
    if(c[i].second >= c[i-1].first){
      ans++;
    }else{
      c[i].first = c[i-1].first;
    }
  }
  cout << ans << endl;
}

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

int main() {
	int n , k=0 , i , l =3e5 ;
	cin >> n ;
	int a[n];
	for(i=0;i<n;i++)
	{
		cin >> a[i] ;
	}
	for(i=0;i<n;i++)
	{
	   if(a[i]<l)
	   {
	   k++;
	   l=a[i];
	   }
	}
	cout << k ;
	return 0;
}

Measured memory_bytes: 4416
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using ull = unsigned long long;
using ll = long long;
using namespace std;

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

    if (n == 0) {
        cout << 0 << endl;
    }

    string s = "";

    while(n != 0) {

        if (n%2 == 0) {
            s += '0';
        } else {
            s += '1';
            n--;
        }
        n = n/-2;
    }

    reverse(s.begin(), s.end());

    cout << s << endl;

    return 0;
}

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

// B - Snake Toy

int length(vector<int> v, int K) {
  int i = 0, length = 0;
  vector<int>::iterator it;
  for ( it = v.begin(); it != v.end(); it++ ) {
    i++;
    length += *it;
    if(i == K) break;
  }
  return length;
}

int main()
{
  vector<int> v;
  int N, K;

  cin >> N >> K;
  int x;
  for (int i = 0; i < N; i++) {
    cin >> x;
    v.push_back(x);
  }

  sort(v.begin(), v.end(), greater<int>());
  cout << length(v, K) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  int a,b;
  cin>>a>>b;
  if(b%a)cout<<b-a<<endl;
  else cout<<a+b<<endl;
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split(" "))
KS = [list(map(int, input().split(" "))) for _ in range(M)]
P = list(map(int, input().split(" ")))

s = [set(ks[1:]) for ks in KS]
# l = [set() for _ in range(N)]
# for i, ks in enumerate(KS):
#     s = ks[1:]
#     for s_i in s:
#         l[s_i-1].add(i)
# print(l)

count = 0
for i in range(1<<N):
    t = set()
    for j in range(N):
        if (i>>j)%2:
            t.add(j+1)
            # print(j, end="_")
    # print(t, [len(s_i & t)%2==0 for s_i in s], s)
    if all(len(s_i & t)%2==P[k] for k, s_i in enumerate(s)):
        count += 1
            

print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+1;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,k,ans=0,i,j;
	string s;
	cin>>n>>k>>s;
	int l=0;
	if(s[0]=='R')
	{
		l=1;
		s[0]='L';
	}
	for(i=1;i<n;i++)
	{
		if(l)
		{
			if(s[i]=='R')s[i]='L';
			else s[i]='R';
		}
		if(s[i]==s[i-1])ans++;
	}
	for(i=0;s[i]=='L' && i<n;i++){}
	for(;i<n && k;i=j)
	{
		for(j=i+1;s[j]=='R' && j<n;j++){}
		ans++;
		if(j!=n)ans++;
		k--;
		for(;s[j]=='L' && j<n;j++){}
	}
	cout<<ans<<'\n';
}


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

        using namespace std;
        #define ok1 printf("ok1\n");
        #define ok2 printf("ok2\n");
        #define M 1000000000000000000LL
        #define rep(i,n) for(int i=0;i<n;i++)
        #define REP(i,s,n) for(int i=(s);i<(n);i++)
        #define repr(i,n) for(int i=n-1;i>=0;i--)
        #define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
        #define all(a) (a).begin(),(a).end()
        #define reall(a) (a).rbegin(),(a).rend()
        #define pb push_back
        #define pf push_front
        #define MIN(a,b) a=min((a),(b))
        #define MAX(a,b) a=max((a),(b))
        #define SIZE(v) (int)v.size()
        const double pi = acos(-1.0);

        typedef vector<int> vi;
        typedef vector<string> vs;
        typedef long long ll;
        typedef vector<ll> vll;
        typedef vector<vi> vvi;
        typedef vector<vll> vvll;
        typedef deque<ll> dll;
        typedef pair<ll, ll> P;
        const ll mod = 1e9 + 7;
        ll dx[4] = {1,0,-1,0};
        ll dy[4] = {0,1,0,-1};

        int main(){
            string s,t;
            int k;cin>>s>>k;
            for(auto c:s){
                if(c != 'a'){
                    if('z'-c+1<=k){
                        k -= 'z'-c+1;
                        t += 'a';
                    }
                    else t += c;
                }
                else t += c;
            }
            k %= 26;
            while(k--) {
                t[t.size()-1]++;
                if(t[t.size()-1]>'z') t[t.size()-1] = 'a';
            }
            cout << t << endl;
        }  


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int
const int MAX = 510000;


using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    bool a[4];
    rep(i, 4)a[i] = false;
    rep(i, s.size()){
        if(s[i] == 'N') a[0] = true;
        else if(s[i] == 'S')a[1] = true;
        else if(s[i] == 'W') a[2] = true;
        else a[3] = true;
    }
    if(a[0] == a[1] && a[2] == a[3]) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;
    cin>>a;
    int cnt=0; 
    for(int i=0;i<a.size();i++){
        if(a[i]=='C'){
            cnt=1;
        }
        if(a[i]=='F'&&cnt==1){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

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

const int maxn = 1e5 + 10;
typedef long long ll;
ll a[maxn], b[100];

bool ok[100];

void ins(ll x) {
  for (int i = 60; i >= 0; i--) if (!ok[i]) {
    if (x >> i & 1) {
        if (b[i]) x ^= b[i];
        else {
            b[i] = x;
            break;
        }
    }
  }
}

int main() {
  int n; scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
	scanf("%lld", &a[i]);
    for (int j = 60; j >= 0; j--)
      ok[j] ^= (a[i] >> j & 1);
  }
  for (int i = 1; i <= n; i++) ins(a[i]);
  ll ans1 = 0, ans2 = 0;
  for (int i = 60; i >= 0; i--) if (ok[i]) ans1 += 1ll << i;
  for (int i = 60; i >= 0; i--)
    for (int j = 60; j >= 0; j--) if (ok[j])
      b[i] &= ((1ll << 61) - 1 - (1ll << j));
  for (int i = 60; i >= 0; i--) if (!ok[i]) 
    ans2 = max(ans2, ans2 ^ b[i]);

//  for (int i = 60; i >= 0; i--) if (ok[i]) 
//    ans2 &= ((1ll << 61) - 1 - (1ll << i));
  cout << (ans1 + ans2 * 2) << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

const int N = 16;

int a[N][N];

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

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			a[i][j] = -1;
		}
	}
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int cnt;
		cin >> cnt;
		while (cnt--) {
			int x, y;
			cin >> x >> y;
			x--;
			a[i][x] = y;
		}
	}
	int ans = 0;
	for (int mask = 0; mask < (1 << n); mask++) {
		int ok = 1;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if ((mask >> i) & 1) {
					//honest
					if (a[i][j] == -1) continue;
					if ((a[i][j]) != ((mask >> j) & 1)) ok = 0;
				}
			}
		}
		if (ok) ans = max(ans, __builtin_popcount(mask));
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
using ll = long long;
//#define int ll
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
signed main(){
    int n,t; cin>>n>>t;
    vector<int>v(n);
    rep(i,n){
        cin>>v[i];
    }
    map<int,int>mp;
    int mini=INF;
    rep(i,n){
        if(!i){cmin(mini,v[i]);continue;}
        if(mini>v[i]){
            cmin(mini, v[i]);
            continue;
        }
        mp[v[i]-mini]++;
    }
    int ans=0;
    int maxi=0;
    for(auto itr:mp){
        if(maxi<itr.first)ans=itr.second;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5376
require 'prime'

### constant

MAX_N = 10 ** 6
MAX_P = 10 ** 3

### subroutines

def key(n)
  sum = 0
  lp = 0

  Prime.each do |pn|
    break if pn * pn > n
    if n % pn == 0
      sum += pn
      lp = pn
      while n % pn == 0
        n /= pn
      end
    end
  end

  if n > 1
    sum += n
    lp = n
  end

  2 * lp - sum
end

### main

loop do
  a, b = gets.split.map(&:to_i)
  break if a == 0
  
  ka = key(a)
  kb = key(b)

  puts (ka > kb) ? "a" : "b"
end

Measured memory_bytes: 6260
import std.stdio;
import std.algorithm;

void main() {
  int[] a;
  for(int i = 0; i < 10; i++) {
    int tmp; readf("%d\n", &tmp);
    a ~= tmp;
  }
  sort(a);
  for(int i = 0; i < 3; i++)
    stdout.writeln(a[a.length-i-1]);
}

Measured memory_bytes: 2484
#include <stdio.h>

int main(void) {
  int i, j;
  int data[4][13] = { {0} };
  int cards, num;
  char suit;

  scanf("%d", &cards);

  for (i = 0; i < cards; i++) {
    scanf("%*c%c %d", &suit, &num);

    if (suit == 'S') {
      data[0][num - 1] = 1;
    } else if (suit == 'H') {
      data[1][num - 1] = 1;
    } else if (suit == 'C') {
      data[2][num - 1] = 1;
    } else {
      data[3][num - 1] = 1;
    }

  }

  for (i = 0; i < 4; i++) {
    for (j = 0; j < 13; j++) {
      if (data[i][j] == 0) {
        switch (i) {
          case 0 : printf("S %d\n", j + 1); break;
          case 1 : printf("H %d\n", j + 1); break;
          case 2 : printf("C %d\n", j + 1); break;
          case 3 : printf("D %d\n", j + 1); break;
        }
      }
    }
  }

  return 0;
}



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

int main(){
	
	int a, b, c;
	int tmp;
	cin >> a >> b >> c;

	if (a > b){
		tmp = a;
		a = b;
		b = tmp;
	} 
	if (b > c){
		tmp = b;
		b = c;
		c = tmp;
	}
	if (a > b){
		tmp = a;
		a = b;
		b = tmp;
	}

	cout << a << " " << b << " " << c << endl;
	
	return 0;
}

Measured memory_bytes: 3076
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
while(true){
   var wh=arr.shift().split(" ").map(Number);
   if(wh.join(" ")=="0 0")break;
   var w=wh[0];
   var h=wh[1];
   var dp=[];
   for(var i=0;i<w;i++){
      dp[i]=[];
      for(var j=0;j<h;j++){
         dp[i][j]=[];
         for(var k=0;k<=4;k++){
            dp[i][j][k]=0;
         }
      }
   }
   dp[0][0][1]=1;
   dp[0][0][2]=1;
   for(var i=0;i<w;i++){
      for(var j=0;j<h;j++){
         if(i!=w-1)dp[i+1][j][3]+=dp[i][j][1]%100000;
         if(j!=h-1)dp[i][j+1][4]+=dp[i][j][2]%100000;
         if(i!=w-1)dp[i+1][j][3]+=dp[i][j][3]%100000;
         if(j!=h-1)dp[i][j+1][2]+=dp[i][j][3]%100000;
         if(i!=w-1)dp[i+1][j][1]+=dp[i][j][4]%100000;
         if(j!=h-1)dp[i][j+1][4]+=dp[i][j][4]%100000;
      }
   }
   var sum=dp[w-1][h-1].reduce(function(a,b){return a+b;});
   console.log(sum%100000);
}

Measured memory_bytes: 22636