akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> P;

const int MAX_H = 20;
int h, w;
char s[MAX_H][MAX_H];

const int INF = 1e9;
int d[MAX_H][MAX_H];
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int bfs(int sx, int sy, int gx, int gy) {
    queue<P> q;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            d[i][j] = INF;
        }
    }
    q.push(P(sx, sy));
    d[sy][sx] = 0;

    while (q.size()) {
        P p = q.front();
        q.pop();
        if (p.first == gx && p.second == gy) {
            break;
        }
        for (int i = 0; i < 4; i++) {
            int nx = p.first + dx[i], ny = p.second + dy[i];
            if (nx >= 0 && nx < w && ny >= 0 && ny < h && s[ny][nx] != '#' && d[ny][nx] == INF) {
                q.push(P(nx, ny));
                d[ny][nx] = d[p.second][p.first] + 1;
            }
        }
    }
    return d[gy][gx];
}

void solve() {
    int max = 0;
    for (int sy = 0; sy < h; sy++) {
        for (int sx = 0; sx < w; sx++) {
            if (s[sy][sx] == '.') {
                for (int gy = 0; gy < h; gy++) {
                    for (int gx = 0; gx < w; gx++) {
                        if (s[gy][gx] == '.') {
                            int ans = bfs(sx, sy, gx, gy);
                            if (ans > max) {
                                max = ans;
                            }
                        }
                    }
                }
            }
        }
    }
    cout << max << endl;
}

int main() {
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> s[i][j];
        }
    }
    solve();
}

Measured memory_bytes: 256
a, b = gets.split.map(&:to_i)
diff = (a - b).abs
ans = [a, b].min + (diff / 2)
j1 = a % 2 == 0 && b % 2 == 0
j2 = a % 2 != 0 && b % 2 != 0
if j1 || j2
    puts ans
else
    puts 'IMPOSSIBLE'
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll dp[55][2];
int main(){
	int n,p,a[55];
	cin>>n>>p;
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<2;j++){
			if(a[i]%2){
				dp[i][j]=dp[i-1][0]+dp[i-1][1];
			}
			else dp[i][j]=dp[i-1][j]+dp[i-1][j];
		}
	}
	cout<<dp[n][p]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long double PI = acos(-1.0);
// cout << fixed << setprecision(14);
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

    int N;
    cin >> N;
    if(N >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

typedef vector<int> vi;
typedef pair<int, int> pi;

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

#define pb push_back
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, b, e) for (int i = (b); i <= (int)(e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

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

    vector<pi> v;
    REP(i, N) {
        int a; cin >> a;
        v.pb(make_pair(a, i));
    }
    sort(v.begin(), v.end());

    REP(i, N) {
        cout << v[i].second + 1 << " \n"[i == N-1];
    }


    return 0;
}


Measured memory_bytes: 1780
//
//  main.cpp
//  ProCon
//
//  Created by hashimotoryoma on 2017/08/20.
//  Copyright © 2017年 hashimotoryoma. All rights reserved.
//

#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <vector>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))

using namespace std;

typedef long long ll;



int main() {
    // insert code here...    return 0;
    //////
    // input from txt
    /*
     std::ifstream in("input.txt");
     std::cin.rdbuf(in.rdbuf());
     std::ofstream out("output.txt");
     std::cout.rdbuf(out.rdbuf());
     ////
     */
    int N;
    cin >> N;
    cout << N*(N+1)/2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <numeric>
#include <bitset>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
#include <cassert>
using namespace std;

typedef long long ll;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
bool ISINT(double x){return fabs(x-(int)x)<EPS;}
bool ISEQ(double x,double y){return fabs(x-y)<EPS;}
string itos(ll x){stringstream ss;ss<<x;return ss.str();}
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define EREP(i,a,b) for(int i=a;i<=b;i++)
#define erep(i,n) EREP(i,0,n)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin();itr!=c.end();itr++)

int main(void){
  int n,k,t,u,v,l;
  int d[202];
  bool flg[10002];

  while(cin>>n>>k>>t>>u>>v>>l){
    memset(flg,0,sizeof(flg));
    rep(i,n){
      cin>>d[i];
      flg[d[i]] = true;
    }

    int pos = 0;
    int rem = 0;
    int hav = 0;
    double ans = 0;

    while(pos < l){
      if(flg[pos]){
        if(hav == k){
          rem = t * v;
        }
        else{
          hav++;
          if(rem == 0){
            rem = t * v;
            hav--;
          }
        }

        ans += 1.0 / v;
        rem--;
        if(rem == 0 && hav > 0){
          rem = t * v;
          hav--;
        }
      }
      else{
        if(rem > 0){
          ans += 1.0 / v;
          rem--;
          if(rem == 0 && hav > 0){
            rem = t * v;
            hav--;
          }
        }
        else{
          ans += 1.0 / u;
        }
      }

      pos++;
    }

    printf("%.7f\n",ans);
  }
}

Measured memory_bytes: 0
/*
██╗  ██╗ █████╗ ██████╗ ███████╗███████╗███╗   ███╗        ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗ ████║        ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝ ███████║██████╔╝█████╗  █████╗  ██╔████╔██║        █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗ ██╔══██║██╔══██╗██╔══╝  ██╔══╝  ██║╚██╔╝██║        ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██║  ██║██║  ██║███████╗███████╗██║ ╚═╝ ██║███████╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
				Believe in yourself ,( try and try and then try ), You can do it  
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define clr(arr, x) memset(arr, x, sizeof arr)
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define OO 0x3f3f3f3f3f3f3f3fLL
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
void K_K(){ 
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int main(){
	K_K();
	ll x;
	cin >> x;
	for (int i = 0;; i++){
		ll l = -1e3, r = 1e3;
		while (l <= r){
			ll a = (l + r) >> 1;
			ll n = pow(i, 5) - pow(a, 5);
			if (n == x){
				rt(i << ' ' << a);
			}
			else if (n < x)
				r = a - 1;
			else
				l = a + 1;
		}
	}
}

Measured memory_bytes: 4072
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    string a,b,c;
    int e,r;
    cin >> a >> b >> e >> r >> c;
    if(a==c)
    e= e-1;
    else
    r= r-1;
    cout << e << " " <<r;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;

int main()
{
    char a;
    cin >> a;
    if(isupper(a)) cout << 'A' << endl;
    if(islower(a)) cout << 'a' << endl;
    return 0;
}

Measured memory_bytes: 3584
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long X = sc.nextLong();
		long Y = sc.nextLong();
		long a = X;
		int cnt = 0;
		while(a <= Y) {
			a = a * 2;
			cnt++;
		}
		System.out.println(cnt);
		sc.close();

	}

}

Measured memory_bytes: 21844
#include <stdio.h>

int main(void)
{
	long n, ans=0, a[1000000], k=10, k1=1;
	long b[3]={3,5,7};
	int k2=3, k3=3, c, k4=0;
	scanf("%ld", &n);
	while (k<=n) 
	{
		k*=10;
		k1++;
	}
	if (k1>=3)
	{
		for (int i = 0; i < 3; ++i)
		{
			a[i]=b[i];
		}
		for (int i = 1; i < k1; ++i)
		{
			for (int i = 0; i < k2; ++i)
			{
				for (int j = 0; j < 3; ++j)
				{
					a[k3]=a[k4+i]*10+b[j];
					k3++;
				}
			}
			k4+=k2;
			k2*=3;
		}

		for (int i = 0; i < k3; ++i)
		{
			if (a[i]>n) break;
			c=1;
			while (a[i] > 0)
			{
				c=c*((a[i]+10)%10);
				a[i]/=10;
			}
			if (c%105==0)
			{
				ans+=1;
			}
		}
	}
	printf("%ld\n", ans);
}


Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
long long x,y,cnt;
int main(){
    while(scanf("%lld%lld",&x,&y)!=EOF){
        //cnt=0;
        for(int i=1;x<=y;i++){
            x*=2;///6
            cnt=i;
        }
        cout<<cnt<<endl;
    }
    return 0;
}


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

int main() {
	int N;
	cin >> N;
	int answer = 0;
	rep(i, 10) {
		if (N < pow(2, i)) {
			answer = i - 1;
			break;
		}
	}
	cout << pow(2, answer) << endl;
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
PROGRAM-ID. 174D.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
  SELECT STDIO ASSIGN TO KEYBOARD. 
*>
DATA DIVISION.
FILE SECTION.
FD STDIO.
01 INP        PIC  X(200000).
*>
WORKING-STORAGE SECTION.
01 N          PIC  9(06).
01 TBL1.
   03 C       PIC  X(01) OCCURS 200000.
01 I          PIC  9(06) COMP.
01 R-C        PIC  9(06).
01 CNT        PIC  9(06).
01 OUT        PIC  Z(05)9.
*> 
PROCEDURE DIVISION.
  ACCEPT N.
*>
  OPEN INPUT STDIO.
  READ STDIO.
  CLOSE STDIO.
  MOVE INP   TO TBL1.
*>
  INSPECT INP TALLYING R-C FOR ALL 'R'
*>
  MOVE ZERO TO CNT.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > R-C
    IF (C(I) = 'W') 
      ADD  1 TO CNT
    END-IF
  END-PERFORM.
*>
  MOVE CNT TO OUT.
  DISPLAY FUNCTION TRIM(OUT).
  STOP RUN.


Measured memory_bytes: 5052
from itertools import *
from collections import defaultdict
def ints():
  return [int(x) for x in input().split()]
def readi():
  return int(input())

N, K = ints()
A = ints()
S = [0] + list(accumulate(A))

def f(i):
  return (S[i]-i)%K

s = 0
memo = defaultdict(int)
for j in range(1, N+1):
  fj = f(j)

  if j-K>=0:
    memo[f(j-K)] -= 1
  memo[f(j-1)] += 1

  s += memo[fj]
print(s)


Measured memory_bytes: 48400
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

a,b,c,d=get_i
l=[a,c].max
r=[b,d].min
puts r-l<0 ? 0 : r-l

Measured memory_bytes: 1788
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>

struct test {
    int H, W;
    char S[20][20];
    int ans;
} td[] =
    {
        {
            3, 3,
            {"...","...","..."},
            4,
        },
        {
            3, 5,
            {"...#.",".#.#.",".#..."},
            10,
        },
    };

void
solver(int h, int w, char s[20][20])
{
    int i, j, k;
    int r[400][400];
    int ans=0;

    bzero(r, sizeof(r));
    for (i=0; i<h; i++) {
        for (j=0; j<w; j++) {
            if (s[i][j]=='#')
                continue;
            if (j!=0 && s[i][j-1]=='.')
                r[i*w+j][i*w+(j-1)] = 1;
            if (j+1!=w && s[i][j+1]=='.')
                r[i*w+j][i*w+(j+1)] = 1;
            if (i!=0 && s[i-1][j]=='.')
                r[i*w+j][(i-1)*w+j] = 1;
            if (i+1!=h && s[i+1][j]=='.')
                r[i*w+j][(i+1)*w+j] = 1;
        }
    }
    for (k=0; k<w*h; k++) {
        for (i=0; i<w*h; i++) {
            for (j=0; j<w*h; j++) {
                if (i==j)
                    continue;
                if (r[i][k]==0 || r[k][j]==0)
                    continue;
                if (r[i][j]>r[i][k]+r[k][j] || r[i][j]==0)
                    r[i][j] = r[i][k]+r[k][j];
            }
        }
    }
#if 0
    for (i=0; i<w*h; i++) {
        for (j=0; j<w*h; j++) {
            printf("%d ", r[i][j]);
        }
        printf("\n");
    }
#endif
    for (i=0; i<w*h; i++) {
        for (j=0; j<w*h; j++) {
            if (ans<r[i][j])
                ans = r[i][j];
        }
    }
    printf("%d\n", ans);
}

int
main(int argc, char *argv[])
{
    int H, W;
    char S[20][20];
    int tt;

#if 0    
    for(tt=0;tt<sizeof(td)/sizeof(struct test); tt++) {
        solver(td[tt].H, td[tt].W, td[tt].S);
        printf("%d\n",td[tt].ans);
    }
#endif
    
    scanf("%d%d", &H, &W);
    for (tt=0; tt<H; tt++) {
        scanf("%s", S[tt]);
    }
    solver(H, W, S);
    return 0;
}

Measured memory_bytes: 768
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;
use std::mem::swap;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        mut p: [usize;n],
    }

    p.push(0);
    let mut cnt = 0;
    let mut flag: Vec<bool> = vec![true;n+1];
    for i in 0..n+1 {
        if p[i]==i+1 {
            flag[i] = false;
        }
    }
    debug!(flag);
    debug!(p.len());
    for i in 0..n {
        if flag[i]==false {
            p.swap(i,i+1);
            cnt += 1;
            debug!(i);
            if p[i+1]==i+2 {
                flag[i+1] = false;
            } else {
                flag[i+1] = true;
            }
        } 
    }
    debug!(flag);
    debug!(p);
    println!("{}", cnt);
}


Measured memory_bytes: 4484
#include <bits/stdc++.h>
#define int long long
#define pb       push_back
#define io    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define all(a)      (a).begin(),(a).end()
#define endl        '\n'
#define F    first
#define S second
#define mod 1000000007 
#define N 100005
#define pii pair<int,int>
using namespace std;
vector<int> v[N];
stack<int> s;
vector<bool> vis(N,false);
vector<int> dist(N,0);

void dfs(int x)
{
    vis[x]=true;
    for(auto i: v[x])
    {
        if(!vis[i])
            dfs(i);
            
         dist[x]=max(dist[x],1+dist[i]);
    }
}
void solve()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        v[a].pb(b);
    }
    for(int i=1;i<=n;i++)
    {
        if(!vis[i])
        {
            dfs(i);
        }
    }
    cout<<*max_element(all(dist));
}

signed main(){
    io;
    int t=1;
    //cin>>t;
    while(t--){
      solve();
    }
    return 0;
}


Measured memory_bytes: 8576
N = int(input())

def chk(n):
    cnt = 0
    for i in range(1, n + 1):
        if n % i == 0:
            cnt += 1
    return cnt == 8

cnt = 0
for i in range(1, N+1):
    if i % 2 == 0:
        continue
    if chk(i):
        cnt += 1
print(cnt)

Measured memory_bytes: 3060
s = input()
k = int(input())
number = len(s)
word_list = []
for i in range(number):
  for j in range(1,6):
    if i+j > number:
      break
    word_list.append(s[i:i+j])

unique_list = list(set(word_list))

print(sorted(unique_list)[k-1])


Measured memory_bytes: 41456
use std::collections::HashMap;

const INF : i64 = 1i64<<61;

fn solve(n : usize, k : usize, a : &Vec<i64>, memo : &mut HashMap<(usize, usize), i64>) -> i64 {
    if k == 0 { return 0 }
    else if n/2 > k || (n+2)/2 < k { return -INF }
    else {
        match memo.get(&(n, k)) {
            Some(ans) => return *ans,
            None =>  {
                let v1 = a[n] + solve(n-2, k-1, a, memo);
                let v2 = solve(n-1, k, a, memo);
                let res = std::cmp::max(v1, v2);
                memo.insert((n,k), res);
                return res
            }
        }
    }
}

fn main() {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    use std::iter::FromIterator;
    let mut iter = input.split_whitespace();
    let n : usize = iter.next().unwrap().parse().unwrap();
    let a : Vec<i64> = Vec::from_iter(iter.map(|s| s.parse().unwrap()));

    let mut memo = HashMap::new();
    println!("{}", solve(n-1, n/2, &a, &mut memo))
}


Measured memory_bytes: 32832
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  string S;
  cin>>S;
  
  if(S.size()<4) cout<<"No"<<endl;
  else{
    if(S.at(0)=='Y' && S.at(1)=='A' && S.at(2)=='K' && S.at(3)=='I') cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
ll gcd(ll a, ll b){
	if(a==0) return b;
	else return gcd(b%a, a);
}
ll lcm(ll x, ll y){
	return x*(y/gcd(x, y));
}
int main(){
  	ll A, B, C, D;
  	cin >> A >> B >> C >> D;

  	ll c = B/C - (A-1)/C;
  	ll d = B/D - (A-1)/D;

  	ll cd = lcm(C, D);
  	ll e = B/cd - (A-1)/cd;

  	//cout << cd <<endl;

  	cout << B-A+1 - c - d + e <<endl;
  	
  	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>



int main() {
	long long x, y, c, count = 0;
	scanf("%lld %lld", &x, &y);
	
	c = x;

	while (c <= y) {
		count++;
		c = 2 * c;
	}
	
	printf("%lld\n", count);

	return 0;
}

Measured memory_bytes: 128
<?php
list($n, $a, $b) = ints();

if(abs($a-$b)%2 == 0){
    printf("%d", intdiv(abs($a-$b),2));
}else{
    printf("%d", min(max($n-$a, $n-$b) - intdiv(abs($a-$b),2), max($a-1, $b-1) - intdiv(abs($a-$b),2)));
}


function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array:";
            echo implode(" ", $val)."\n";
        }else{
            echo "array:array\n";
            foreach($val as $row){
                echo implode(" ", $row)."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}

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

using namespace std;
using ll = long long;

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

	int n;
	cin >> n;

	ll sum = 0;

	for (int i = 1; i <= n; i++) {
		if (i % 3 == 0 && i % 5 == 0)continue;
		if (i % 3 == 0)continue;
		if (i % 5 == 0)continue;
		sum += (ll)i;
	}

	cout << sum << endl;

	return 0;
}

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

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline T gcd(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T lcm(T a,T b){return a*b/gcd(a,b);}

const int INF=1e9;
const double eps=0.0000000001;



int main(){

  int a,b,t;
  cin >> a >> b >> t;
  cout << (t/a)*b << endl; 

}

Measured memory_bytes: 256
import Foundation

func readInt() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let line = readInt()
    let N = line[0]
    let M = line[1]
    let X = line[2]

    let books = (1...N).map { _ in readInt() }
    var ans = Int.max
    for bit in 0..<(1 << N) {
        var comb = [Int](repeating: 0, count:M+1)
        for i in 0..<N {
            if bit & (1 << i) > 0 {
                let book = books[i]
                comb = zip(comb, book).map { $0.0 + $0.1 }
            }
        }
        if comb[1...].allSatisfy({ $0 >= X }) {
            ans = min(ans, comb[0])
        }
    }

    if ans == Int.max {
        print(-1)
    } else {
        print(ans)
    }
}


main()

Measured memory_bytes: 13552
n = int(input())
h = [int(i) for i in input().split()]
for i in range(n - 1, 0, -1):
    d = h[i - 1] - h[i]
    if d > 1:
        print("No")
        break
    if d == 1:
        h[i - 1] -= 1
else:
    print("Yes")

Measured memory_bytes: 14252
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<string>
#include<map>
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int> P;
typedef pair<int, P> PP;
const long long inf = 1ll << 61;
int p[105];
signed main() {
	int a, b, x; cin >> a >> b >> x;
	int ans = inf;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			int sum = i * 1000 + j * 500;
			if (sum >= x)ans = min(ans, a*i + b*j);
		}
	}
	cout << ans << endl;
}



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

using namespace std;

#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define re return
#define endl '\n'

using ll = long long;
using ull = unsigned long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using ld = long double;

template <class T> T abs (T x) { re x > 0 ? x : -x; }
template <class T> T sqr (T x) { re x * x; }

const ld pi = 4 * atan(1.);
const int inf = 1e9 + 7; 
const int N = 3e5 + 17;

int n, m, k;
string s[1000];
int cntx[1000], cnty[1000];
int d[1000][1000];
vii g[N];


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    queue<ii> q;
    for (int i = 0; i < n; i++) 
        for (int j = 0; j < n; j++)
            d[i][j] = inf;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        for (int j = 0; j < n; j++)
            if (s[i][j] == '.') cntx[i]++;
            else d[i][j] = 0, q.push({i, j});
    }
    int t = 0, k = 0;
    for (int j = 0; j < n; j++) {
        for (int i = 0; i < n; i++) 
            if (s[i][j] == '.') cnty[j]++;
            else t++;
        if (cnty[j]) k++;
    }    
    if (!t) { cout << -1; re 0; }

    int ans = inf;
    for (int i = 0; i < n; i++) {
        int need = cntx[i];
        if (n - cnty[i] == 0) need++;
        ans = min(need, ans);
    }
    cout << ans + k;
}


Measured memory_bytes: 14828
#include <bits/stdc++.h>
using namespace std;
#define ll	    long long
#define vi      vector <ll>
#define vii     vector <pair<int,int>>
#define ii      pair<int,int>
#define loop(n)	for(ll i=0;i<n;i++)
#define pb      push_back
const ll mod=1e9+7;
ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)
            res*=a;
        a*=a;
        b>>=1;
    }
    return res;
}
void fast();
int main()
{
    ll a,b;
    cin>>a>>b;
    if(a)
        a--;
    ll ans=0;
    ll res[41]={};
    for(int i=0;i<=40;i++){
        ll x=power(2,i);
        ll q=a/x,w=a%x+1;
        if(!(q&1))
            w=0;
        res[i]=(q/2*x)+w;
        q=b/x,w=b%x+1;
        if(!(q&1))
            w=0;
        res[i]=(q/2*x)+w-res[i];
        if(res[i]&1)
            ans+=x;
    }
    cout<<ans;
}
void fast(){
std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
/// 20
/// 15 7 13 15 15 15 15 13 19
/*

*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
void solve(){
    int n,a,b,arr[3],x;
    fill(arr,arr + 3,0);
    cin >> n >> a >> b;
    for(int i = 0; i < n; i++){
        cin >> x;
        if(x <= a)arr[0]++;
        else if(x <= b)arr[1]++;
        else arr[2]++;
    }
    sort(arr,arr + 3);
    cout << arr[0] << endl;
}
main(){
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}


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


int dx[4] = {1, -1, 0,  0};
int dy[4] = {0,  0, 1, -1};
char m[22][22];
int d[22][22];

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i,h) cin >> s[i];
  int ans = 0;
  rep(si,h)
    rep(sj,w) {
      if(s[si][sj]=='#') continue;
      vector<vector<int>> dist(h,vector<int>(w,INF));
      queue<P> q;
      auto update = [&](int i, int j, int x) {
        if(dist[i][j]!=INF) return;
        dist[i][j] = x;
        q.push(P(i,j));
      };
      update(si,sj,0);
      while(!q.empty()) {
        int i = q.front().first;
        int j = q.front().second;
        q.pop();
        rep(dir,4) {
          int nx = i + dx[dir], ny = j + dy[dir];
          if(nx<0||nx>=h||ny<0||ny>=w) continue;
          if(s[nx][ny] == '#') continue;
          update(nx,ny, dist[i][j]+1);
        }
      }
    rep(i,h) {
      rep(j,w) {
        if(dist[i][j]==INF) continue;
        ans = max(ans, dist[i][j]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3640
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int a[411][411], vis[411][411], b = 0, w = 0;

void dfs (int i, int j)
{
    vis[i][j] = 1;
    if (a[i][j] == 1) b++;
    else w++;
    
    if (a[i + 1][j] == -a[i][j] && !vis[i + 1][j]) dfs(i + 1, j); 
    if (a[i - 1][j] == -a[i][j] && !vis[i - 1][j]) dfs(i - 1, j); 
    if (a[i][j + 1] == -a[i][j] && !vis[i][j + 1]) dfs(i, j + 1); 
    if (a[i][j - 1] == -a[i][j] && !vis[i][j - 1]) dfs(i, j - 1); 
}
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	readb(n, m);
	FOR (i, 1, n)
	{
	    string s;
	    cin >> s;
	    FOR (j, 0, sz(s) - 1)
	        if (s[j] == '.') a[i][j + 1] = 1;
	        else a[i][j + 1] = -1;
	}
    
    int ans = 0;
    FOR (i, 1, n)
        FOR (j, 1, m)
            if (!vis[i][j])
            {
                b = w = 0;
                dfs(i, j);
                ans += b*w;
            }
    
    print(ans);
}



















Measured memory_bytes: 17920
#ABC145D

MOD = 10 ** 9 + 7
import math
x,y = map(int,input().split())
a,b = -1,-1

for i in range(x+1):
    m = 0
    if (x-i) % 2 == 0:
        m = (x-i) // 2
        if 2*i + m == y:
            if i >= 0 and m >= 0:
                a = i
                b = m
                break
    else:
        continue
        
def kai(x):
    an = 1
    for i in range(1,x+1):
        an = an * i % MOD
        
    return an

def pow_k(x, n):
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K = K * x % MOD
        x = x ** 2 % MOD
        n //= 2

    return K * x % MOD

al = kai(a)
be = kai(b)

if a == -1 and b == -1:
    print(0)
else:
    print(( kai(a+b) * pow_k(al,MOD-2)) % MOD * pow_k(be,MOD-2) % MOD )

Measured memory_bytes: 41196
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String[] lines = in.readLine().split(" ");
      int h = Integer.parseInt(lines[0]);
      int w = Integer.parseInt(lines[1]);
      boolean[][] mat = new boolean[h][w];

      String line;
      for(int y=0; y<h; y++) {
        line = in.readLine();
        for(int x=0; x<w; x++) {
          mat[y][x] = line.charAt(x) == '#' ? true : false;
        }
      }

      int[] rx = {0,0,-1,1};
      int[] ry = {-1,1,0,0};
      boolean result = true;
      boolean isPossible = false;
      for(int y=0; result && y<h; y++) {
        for(int x=0; result && x<w; x++) {
          if(mat[y][x]) {
            for(int i=0; i<4; i++) {
              if(y+ry[i] > -1 && y+ry[i] < h && x+rx[i] > -1 && x+rx[i] < w)
                if(mat[y+ry[i]][x+rx[i]]) isPossible = true;
            }
            if(isPossible) isPossible = false;
            else {
              result = false;
              // System.out.println( y + " " + x);
            }
          }
        }
      }

      String ans = result ? "Yes" : "No";
      System.out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

Measured memory_bytes: 23252
import bisect
INF = 10**9 + 1
n, m = map(int, input().split())
X, Y = [-INF, 0, INF], [-INF, 0, INF]
ABC, DEF = [], []
for i in range(n):
    a, b, c = map(int, input().split())
    ABC.append((a, b, c))
    X.append(a)
    X.append(b)
    Y.append(c)
    Y.append(c)
for j in range(m):
    d, e, f = map(int, input().split())
    DEF.append((d, e, f))
    X.append(d)
    X.append(d)
    Y.append(e)
    Y.append(f)
X.sort()
Y.sort()
V = [[0 for y in Y] for x in X]
for a, b, c in ABC:
    j = bisect.bisect_left(Y, c)
    ia = bisect.bisect_left(X, a)
    ib = bisect.bisect_left(X, b)
    for i in range(ia, ib):
        V[i][j] = 1
for d, e, f in DEF:
    i = bisect.bisect_left(X, d)
    je = bisect.bisect_left(Y, e)
    jf = bisect.bisect_left(Y, f)
    for j in range(je, jf):
        V[i][j] = 1
i = bisect.bisect_left(X, 0)
j = bisect.bisect_left(Y, 0)
Q = [(i, j)]
V[i][j] = 1
ans = 0
while Q:
    i, j = Q.pop()
    ans += (X[i + 1] - X[i]) * (Y[j + 1] - Y[j])
    for di, dj in [(0, 1), (1, 0), (0, -1), (-1, 0)]:
        if 0 < i + di < len(X) - 1 and 0 < j + dj < len(Y) - 1:
            if V[i + di][j + dj] == 0:
                V[i + di][j + dj] = 1
                Q.append((i + di, j + dj))
        else:
            print('INF')
            exit()
print(ans)


Measured memory_bytes: 511184
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def m_dist(p,q):
	return abs(p[0]-q[0])+abs(p[1]-q[1])

def gg(pos, ssl):
	mmm=m_dist(pos,ssl[0])
	m_id=0
	for i, q in enumerate(ssl[1:], 1):
		td=m_dist(pos, q)
		if td < mmm:
			mmm = td
			m_id = i
	return m_id
		
def main():
	#a = int(input())
	n, m = tin()
	#s = input()
	pl=[lin() for _ in range(n)]
	ssl = [lin() for _ in range(m)]
	for p in pl:
		r = gg(p, ssl)
		#pa((p,ssl))
		print(r+1)
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

signed main(void)
{
	int n, t, a;
	cin >> n >> t >> a;
	int h[n];
	vector<pair<double, int>> tmp(n);
	rep(i, n)
	{
		cin >> h[i];
		tmp[i].first = abs((t - h[i] * 0.006) - a);
		tmp[i].second = i + 1;
	}
	sort(tmp.begin(), tmp.end());
	cout << tmp[0].second << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;

constexpr auto pow(long long x, long long n, const long long mod) {
    long long ret = 1;
    while(n > 0) {
        if ((n & 1) == 1) ret = (ret * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return ret;
}

int main() {
    constexpr i64 mod = 998244353, base = pow(10, 18, mod), lim = 480;
    int n;
    std::cin >> n;

    auto f = [=](int n) { return pow(base, n, mod); };

    std::vector<i64> used(lim);
    std::vector<std::vector<i64>> ss(3, std::vector<i64>(lim));
    for (int i = 0; i < 3; i++) {
        int m;
        std::cin >> m;
        std::vector<std::vector<int>> g(n + 1);
        std::vector<int> par(n + 1);
        for (int j = 0; j < m; j++) {
            int u, v;
            std::cin >> u >> v;
            if (u < v) std::swap(u, v);
            g[v].push_back(u);
        }

        for (int j = n; j > 0; j--) {
            if (g[j].size() >= lim) std::fill(used.begin(), used.end(), 0ll);
            else std::fill(used.begin(), used.begin() + g[j].size() + 1, 0ll);

            for (int p : g[j]) used[par[p]] = 1;

            par[j] = std::find(used.begin(), used.end(), 0ll) - used.begin();
            ss[i][par[j]] = (ss[i][par[j]] + f(j)) % mod;
        }
    }

    i64 ret = 0;
    for (int i = 0; i < lim; i++) for (int j = 0; j < lim; j++) {
        if ((i ^ j) < lim) ret = (ret + ss[0][i] * ss[1][j] % mod * ss[2][i ^ j] % mod) % mod;
    }

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 4816
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    int n;
    cin>>n;
    vector<int> a(n,0); for(int i=0;i<n;i++) cin>>a[i];
    long long curr=1000;
    for(int i=1;i<n;i++){
        if(a[i-1]<a[i]){
            curr=(curr%a[i-1])+(curr/a[i-1])*a[i];
        }
    }
    cout<<curr<<"\n";
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    solve();
    return 0;
}

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

#define ll long long

using namespace std;

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

	Y /= 1000;

	int x, y, z;
	for (x = 0; 10 * x <= Y; x++) {
		for (y = 0; 10 * x + 5 * y <= Y; y++) {
			z = N - x - y;
			if (z >= 0 && 10 * x + 5 * y + z == Y) {
				cout << x << " " << y << " " << z << endl;
				system("pause");
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;
	system("pause");
	return 0;
}


Measured memory_bytes: 504
/*** 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 printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
void print() {}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail){ cout << head << " \n"[sizeof...(tail) == 0]; print(forward<Tail>(tail)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s[0] == 'S'){
        print("Cloudy");
    }else if(s[0] == 'C'){
        print("Rainy");
    }else{
        print("Sunny");
    }
    
}

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

int main() {
  string s;
  cin>>s;
  int s_idx = 0;
  string akihabara = "AKIHABARA";
  int a_idx = 0;
  while (true) {
    if (s[s_idx] == akihabara[a_idx]) {
      ++s_idx;
      ++a_idx;
    } else if (akihabara[a_idx] == 'A') {
      ++a_idx;
    } else {
      cout<<"NO"<<endl;
      return 0;
    }
    if (s_idx == s.length()) {
      if (a_idx >= akihabara.length() - 1) {
        cout<<"YES"<<endl;
        return 0;
      } else {
        cout<<"NO"<<endl;
        return 0;
      }
    } else if (a_idx == akihabara.length()) {
        cout<<"NO"<<endl;
        return 0;
    }


  }

}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP0(i, n) for (int i = (n)-1; i >= 0; --i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define RREP1(i, n) for (int i = (n); i >= 1; --i)

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

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
long double eps = 1.0E-14;
#define pow10(n) int(1e##n + n)

void solve()
{
    int N, M;
    cin >> N >> M;
    double sum = 0;
    vector<int> A(N);
    REP0 (i, N)
    {
        cin >> A[i];
        sum += A[i];
    }
    sum /= (4.0 * M);

    int cnt = 0;
    REP0 (i, N)
    {
        if (sum <= A[i])
        {
            cnt++;
        }
    }
    cout << (cnt >= M ? "Yes" : "No") << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(20);
    solve();
    return 0;
}


Measured memory_bytes: 256
k,n=map(int,input().split())
li=list(map(int,input().split()))
def l(m):
    x=li[m+1]-li[m]
    return(x)
list_l=[l(m) for m in range(n-1)]
list_l.append(li[0]+k-li[n-1])
list_l.sort()
list_l.reverse()
print(sum(list_l)-list_l[0])

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

int main()
{
    long long n , ans;

    cin >> n;

    ans = n;

    for(long long i = 1; i * i <= n; i++)
    {
        if(n % i == 0)
        {
            ans = min(ans, i + n/i - 2);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, a, b;
  cin >> n >> a >> b;
  if (abs(a - b) - 1 & 1)
    cout << "Alice" << endl;
  else
    cout << "Borys" << endl;
}


Measured memory_bytes: 256
H, W, D = map(int, input().split())
A = [0] * H * W
for i in range(H):
    temp = list(map(int, input().split()))
    for j in range(len(temp)):
        A[temp[j] - 1] = (i + 1, j + 1)

Q = int(input())
L = []
R = []
for _ in range(Q):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)


def consumption(point_A, point_B):
    return abs(point_A[0] - point_B[0]) + abs(point_A[1] - point_B[1])


X = []
for i in [D] + list(range(1, D)):
    power = 0
    x = [0]
    for j in range(int((H * W - i) / D)):
        power += consumption(A[i - 1 + j * D], A[i - 1 + (j + 1) * D])
        x.append(power)
        #print("{}->{}".format(A[i - 1], A[i - 1 + (j + 1) * D]))
    X.append(x)
# print(X)
for i in range(Q):
    k = L[i] % D
    if k == 0:
        l = int((L[i] - D) / D)
        r = int((R[i] - D) / D)
    else:
        l = int((L[i] - k) / D)
        r = int((R[i] - k) / D)
    #print(X[k], l, r)
    print(X[k][r] - X[k][l])


Measured memory_bytes: 30888
#include <iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;
int n;
int a[300000];
int flag[300000];
int m=0;
int main()
{
    cin>>n;
    for (int i=0; i<n; ++i)
    {
        cin>>a[i];
        flag[a[i]]+=1;
        if (a[i]>m)
            m=a[i];
    }

    for (int i=0; i<n; ++i)
    {
        if (a[i]!=m)
            cout<<m<<endl;
        else{
            if (flag[a[i]]>1)
                cout<<a[i]<<endl;
            else
            {
                for (int j=m-1; j>=0; --j)
                    if (flag[j])
                {
                    cout<<j<<endl;
                    break;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3072
/******************
*  Author: BD747  *
******************/
#include<algorithm>
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

string s;
int ans;

int sti(string s){
	int res=0;
	for(int i=0;i<s.size();i++){
		res*=10;
		res+=((int)s[i]-'0');
	}
	return res;
}

int main(){

	cin>>s;
	ans=1e9;
	for(int i=0;i<s.size()-2;i++){
		int k=abs(753-sti(s.substr(i,3)));
		ans=min(ans,k);
	}
	cout<<ans;
	
	return 0;
}


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

using namespace std;
using ll = long long;

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

#define READ(x) (cin >> (x))

#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))

int main() {
    // get values from input
    int N;
    string S;

    READ(N);
    READ(S);

    // main procedure
    long R_count = count(ALL(S), 'R');
    long G_count = count(ALL(S), 'G');
    long B_count = count(ALL(S), 'B');

    long all_tirplet_count = R_count * G_count * B_count;

    long exclude_count = 0;
    for (int d = 1; d <= ((N - 1) / 2); ++d) {
        for (int i = 0; i < (N - 2 * d); ++i) {
            int j = i + d;
            int k = i + 2 * d;

            if ((S[i] != S[j]) && (S[i] != S[k])
                    && (S[j] != S[k])) {
                ++exclude_count;
            }
        }
    }

    long ans = all_tirplet_count - exclude_count;

    // output
    WRITE_N(ans);

    return 0;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <stack>
#include <unordered_map>
#include <vector>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 1000005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE = 1;

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    n = read<int>();
    bool flag = true;
    for (int i = 0; i < n; i++) {
        int x = read<int>();
        if (!(x & 1) && x % 3 && x % 5) {
            flag = false;
        }
    }
    printf("%s\n", flag ? "APPROVED" : "DENIED");
    return 0;
}

Measured memory_bytes: 256
def resolve():

    from collections import deque

    H, W = map(int, input().split())
    maze = [input() for i in range(H)]
    start_list=[]
    for i in range(H):
        for j in range(W):
            if maze[i][j]=='#':
                start_list.append([i,j])
    INF = 10 ** 20

    visited = [[INF] * W for j in range(H)]


    def bfs(maze):
        queue = deque()
        for [i,j] in start_list:
            queue.append([i,j])
            visited[i][j]=0
        while queue:
            y, x = queue.popleft()
            cnt=0
            for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
                ny, nx = y + j, x + k
                if 0 <= ny < H and 0 <= nx < W and \
                        maze[ny][nx] == "." and visited[ny][nx]==INF:
                        visited[ny][nx] = visited[y][x] + 1
                        queue.append([ny, nx])
        return visited


    bfs(maze)
    ans=0
    for i in range(H):
        for j in range(W):
            ans=max(ans,visited[i][j])

    print(ans)


resolve()

Measured memory_bytes: 217360
seat = [0]*17
wait = [0]*100
queue = []
t = 0
while 1:
    if t <= 5*99 and t%5 == 0:
        queue.append(t/5)
        
    newqueue = queue[:]
    for group in queue:
        p = (2 if group%5 != 1 else 5)
        for j in range(17-p+1):
            if seat[j:j+p] == [0]*p:
                seat[j:j+p] = [17*(group%2)+3*(group%3)+19]*p
                newqueue.remove(group)
                break
        else:
            break
    queue = newqueue[:]
    seat = [max(0,i-1) for i in seat]
    for group in queue:
        wait[group] += 1
    t += 1
    if t > 5*99 and not queue: break

while 1:
    try:
        print wait[int(raw_input())]
    except:
        break
    

Measured memory_bytes: 4252
/* while(!cin.eof()) */
 
#include<bits/stdc++.h>
using namespace std; 
#define int long long 
#define mod (int)(1e9+7)
#define MAXI (int)(1e17+100)
#define N 1000005



// Driver code to test above functions
int32_t main()
{
    
 
  
     
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    
    int n;
    cin >> n;

    set<string> s;
    map<string, int> mp;

    for(int i=0;i<n;i++)
    {
        string ss;
        cin >> ss;
        s.insert(ss);
        mp[ss]++;
    } 

    int maxi = -1;

    for(auto i=mp.begin();i!=mp.end();i++)
        maxi = max(maxi, i->second);

    for(auto i=s.begin();i!=s.end();i++)
        if(mp[*i]==maxi)
            cout << *i << endl;
        


    return 0;
    
} 



Measured memory_bytes: 33280
package main

import (
	"fmt"
)

func main(){
	var n int
	fmt.Scan(&n)
	ws := make(map[string]bool, n)
	var str string
	var word string
	for i := 0; i<n; i++ {
		fmt.Scan(&str)
		if ws[str] {
			fmt.Println("No")
			return
		}
		if word != "" && str[0:1] != word[len(word)-1:] {
			fmt.Println("No")
			return
		}
		word = str
		ws[str] = true
	}
	fmt.Println("Yes")
}

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

using namespace std;

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

	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	for(int i=0; i<n; i++)
        cin >> v[i];
    sort(v.begin(), v.end());
    int sum=0;
    for(int i=0; i<k; i++)
        sum+=v[i];
    cout << sum << endl;

	return 0;
}


Measured memory_bytes: 3660