akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
#define inf             1e18
#define mod             1000000007
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r;








void sol()
{   
    cin>>x>>n;
    si s;
    fo(i,n)
    {
        cin>>y;
        s.insert(y);
    }
    y=z=x;
    while(1)
    {
        if(s.count(y))y--;
        else break;
    }
    while(1)
    {
        if(s.count(z))z++;
        else break;
    }
    if(x-y>z-x)cout<<z;
    else cout<<y;
    // else cout<

    //cout<<  <<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

Measured memory_bytes: 3636
n = int(input())
s = []
for i in range(n):
    s.append(int(input()))

s.sort()
ans = sum(s)
if ans % 10 != 0:
    print(ans)
else:
    for i in range(n):
        if s[i] % 10 != 0:
            print(ans - s[i])
            break
    else:
        print(0)

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

#define N 100005

using namespace std;

long long n,m,a,b;
string s;

template<typename Drake>
void read(Drake &x){
	x=0;char ch=getchar();bool f=1;
	while(!isdigit(ch)){
		if(ch=='-')f^=1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	x*=(2*f-1);
}

template<typename Drake>
void write(Drake x){
	if(x<0){x=-x;putchar('-');}
	if(x>9)write(x/10);
	putchar(x%10+'0');
}

template<typename Drake>
void writeln(Drake x){
	write(x);
	puts("");
}

void init(){
	cin>>s;
}
 
int main(){
	init();
	int a=0;
	for(int i=0;i<s.size();i++)
	if(s[i]=='-')
	a--;
	else a++;
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
void ABC90(void);
void ABC91(void);
void ABC92(void);
void ABC93(void);
void ABC94(void);
void ABC95(void);
void ABC96(void);
void ABC97(void);
void ABC98(void);
void ABC99(void);

int main(void){
    ABC94();
}

void ABC94(){
    int n,m,x,i,j,a;
    cin>>n>>m>>x;
    vector<int> vec(n,0);
    for(i=0;i<m;i++){
        cin>>a;
        vec[a]++;
    }
    cout<<min(count(vec.begin(),vec.begin()+x+1,1),count(vec.begin()+x,vec.end(),1))<<endl;
}

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

int main(){
  int r, g, b;
  cin >> r >> g >> b;
  
  int num = r*100 + g*10 + b;
  
  if(num%4 == 0){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
   
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll n,q;
  cin >> n >> q;

  ll s[n],t[n],x[n];
  vector<tuple<ll,ll,ll>> eve;//イベントを入れる配列
  for(int i=0;i<n;i++){
    cin >> s[i] >> t[i] >> x[i];
    eve.push_back(make_tuple(s[i]-x[i],1,x[i]));
    eve.push_back(make_tuple(t[i]-x[i],-1,x[i]));
  }

  for(int i=0;i<q;i++){
    ll d;
    cin >> d;
    eve.push_back(make_tuple(d,2,i));
  }

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

  multiset<ll> mc;//現時点で通行止めにされている座標を持つセット

  for(int p=0;p<eve.size();p++){
    ll x=get<0>(eve[p]);
    ll y=get<1>(eve[p]);
    ll z=get<2>(eve[p]);
    if(y==1) mc.insert(z);
    else if(y==-1) mc.erase(mc.lower_bound(z));
    else{
      cout << (mc.empty() ? -1 : *(mc.begin())) << endl;
    }
  }



}

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

int main() {
	int x;
  	cin >> x;
  
  for (int i=x;i<100004;i++){
  int count=0;
    for(int j=1;j<=i;j++){
    	if(i%j==0){
        	count++;
        }
      
      if(count>2){
      	break;
      }
    }
  if(count==2){
  	cout<<i<<endl;
    break;
 
  }
  }
  
    
}

Measured memory_bytes: 3592
"use strict";

function main(arg) {
    const input = arg.split("\n")
    const [N,K] = input[0].split(" ").map(x=>Number(x))
    const p = input[1].split(" ").map(x=>Number(x)).sort((a,b)=>a-b)
        
    let sum = 0
    for(let i=0; i<K; i++) {
        sum += p[i]
    }
    console.log(sum)
    
    
}

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

Measured memory_bytes: 29704
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n,t[20000],sum;
int main(){
  while(cin>>n){
    if(n==0)break;
    for(int i=0;i<n;i++)cin>>t[i];
    sort(t,t+n);
    sum=0;
    for(int i=0;i<n-1;i++)sum+=(t[i]*(n-1-i));
    cout<<sum<<endl;
  }
  return 0;
}

Measured memory_bytes: 1252
import java.util.*;

public class Main {

    static final String[] NUMS = new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String s = sc.next();
        sc.close();

        // 主処理
        char[] array = s.toCharArray();
        int[] count = new int[100];
        for (int i = 0; i < n - 2; i++) {
            for (int j = i + 1; j < n - 1; j++) {
                int num = ((int) array[i] - 48) * 10 + ((int) array[j] - 48);
                if (0 < count[num]) {
                    continue;
                }

                int index = j + 1;
                count[num] = calcCount(s.substring(index));
            }
        }
        int sum = Arrays.stream(count).sum();
        int result = sum;

        // 出力
        System.out.println(result);
    }

    public static int calcCount(String s) {
        int count = 0;
        for (String num : NUMS) {
            if (s.contains(num)) {
                count++;
            }
        }
        return count;
    }
}


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

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

const MAX: usize = 160 * 80;

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

    let mut a: Vec<Vec<isize>> = Vec::new();
    for _ in 0..h {
        let v_i: Vec<isize> = {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let s = s.trim_right().to_owned();
            s.split_whitespace().map(|x| x.parse().unwrap()).collect()
        };
        a.push(v_i)
    }
    let a = a;

    let mut b: Vec<Vec<isize>> = Vec::new();
    for _ in 0..h {
        let v_i: Vec<isize> = {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let s = s.trim_right().to_owned();
            s.split_whitespace().map(|x| x.parse().unwrap()).collect()
        };
        b.push(v_i)
    }
    let b = b;
    // debugln!("{:?}", a);
    // debugln!("{:?}", b);

    // dp[i][j][k] = (i, j)で偏りをkにできるか。
    let mut dp = vec![vec![vec![false; MAX + 1]; w]; h];
    let bias_0 = (a[0][0] - b[0][0]).abs();
    dp[0][0][bias_0 as usize] = true;
    for i in 0..h {
        for j in 0..w {
            // これが違う
            for k in 0..(MAX + 1) {
                let bias = (a[i][j] - b[i][j]).abs();
                if i >= 1 && dp[i - 1][j][k] {
                    dp[i][j][k + bias as usize] = true;
                    dp[i][j][(k as isize - bias).abs() as usize] = true;
                }
                if j >= 1 && dp[i][j - 1][k] {
                    dp[i][j][k + bias as usize] = true;
                    dp[i][j][(k as isize - bias).abs() as usize] = true;
                }
            }
        }
    }

    // for i in 0..h {
    //     for j in 0..w {
    //         debugln!("{:?}", &dp[i][j][0..8]);
    //     }
    // }

    for k in 0..(MAX + 1) {
        if dp[h - 1][w - 1][k] {
            println!("{}", k);
            return;
        }
    }
}


Measured memory_bytes: 96508
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;


ll func(ll a,ll b){
	ll c;
	while(a%b!=0){
		c = b;
		b = a%b;
		a = c;
	}
	return b;
}

int main(void){
	ll N,M,L;
	cin >> N >> M;
	string S,T;
	cin >> S;
	cin >> T;
	ll K = func(N,M);
	ll k = (N*M)/func(N,M);
	for(int i= 0;i<func(N,M);i++){
		if(S[i*(k/M)]!=T[i*(k/N)]){
			cout << -1 << endl;
			return 0;
		}
	}
	cout << k << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef std::pair<int, int> ii;
typedef tuple<int,int,int> i3;
typedef std::pair<int, ii> iii;
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::vector<ii> vii;
typedef std::vector<iii> viii;
const int INF = 1001001000;
const ll mod = 1e9 + 7;
const ld pi=acos(-1);
#define pb(a) push_back(a)
#define m0(x,n) memset(x,n,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);  // greater than or equal
#define ub(v,n) upper_bound(v.begin(), v.end(), n);  // greater than
#define all(x) (x).begin(), (x).end();
#define fi first;
#define se second;
#define endl '\n';
#define loop(i,n) for(int i=0;i<(n);i++);
#define FOR(i, m, n) for(int i = m; i < n; i++);

int h,w;
string a[101];


struct flow_network {
  int n, s, t, *par, **c, **f;
  vi *adj;
  flow_network(int n, int s, int t) : n(n), s(s), t(t) {
    adj = new std::vector<int>[n];
    par = new int[n];
    c = new int*[n];
    f = new int*[n];
    for (int i = 0; i < n; ++i) { 
      c[i] = new int[n];
      f[i] = new int[n];
      for (int j = 0; j < n; ++j)
        c[i][j] = f[i][j] = 0;
    }
  }
  void add_edge(int u, int v, int w) {
    adj[u].push_back(v);
    adj[v].push_back(u);
    c[u][v] += w;
  }
  int res(int i, int j) { return c[i][j] - f[i][j]; }
  bool bfs() {
    std::queue<int> q;
    q.push(this->s);
    while (!q.empty()) {
      int u = q.front();  q.pop();
      for (int v : adj[u]) {
        if (res(u, v) > 0 and par[v] == -1) {
          par[v] = u;
          if (v == this->t)
            return true;
          q.push(v);
        }
      }
    }
    return false;
  }
  bool aug_path() {
    for (int u = 0; u < n; ++u)
      par[u] = -1;
    par[s] = s;
    return bfs();
  }
  int calc_max_flow() {
    int ans = 0;
    while (aug_path()) {
      int flow = INF;
      for (int u = t; u != s; u = par[u])
        flow = std::min(flow, res(par[u], u));
      for (int u = t; u != s; u = par[u])
        f[par[u]][u] += flow, f[u][par[u]] -= flow;
      ans += flow;
    }
    return ans;
  }
};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> h >> w;
  for (int i=0; i<h; i++) cin >> a[i];
  ii t,s;
  flow_network G(h+w+3,0,h+w+2);
  for (int i=1; i<=h; i++){
    for (int j=1; j<=w; j++){
      if (a[i-1][j-1]=='S') {s={i,j}; G.add_edge(0,i,INF); G.add_edge(0,j+h,INF);}
      if (a[i-1][j-1]=='T') {t={i,j}; G.add_edge(i,h+w+2,INF); G.add_edge(j+h,h+w+2,INF);}
      if (a[i-1][j-1]=='o') {G.add_edge(i,j+h,1); G.add_edge(j+h,i,1);}
    }
  }


  if (s.first==t.first or s.second==t.second) {cout<<-1<<endl;}
  else {cout<<G.calc_max_flow()<<endl;}




  


}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int A[101010];
int L[101010],R[101010];
int dp[101010][2];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	N+=2;
	FOR(i,N) {
		if(i==0 || i==N-1) A[i]=1;
		else cin>>A[i];
		while(1<<(L[i]+1)<=A[i]) L[i]++;
		R[i]=L[i];
		if(A[i]&(A[i]-1)) R[i]++;
		
		if(i) {
			dp[i][0]=(R[i]-L[i])+min(dp[i-1][0]+abs(L[i]-R[i-1]),dp[i-1][1]+abs(L[i]-L[i-1]));
			dp[i][1]=(R[i]-L[i])+min(dp[i-1][0]+abs(R[i]-R[i-1]),dp[i-1][1]+abs(R[i]-L[i-1]));
		}
	}
	
	cout<<(min(dp[N-1][0],dp[N-1][1])+1)/2<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  string s, t;
  cin >> s >> t;
  vector<char> sc(s.length()), tc(t.length());
  rep(i, s.length()) sc[i] = s[i];
  rep(i, t.length()) tc[i] = t[i];
  sort(sc.begin(), sc.end());
  sort(tc.rbegin(), tc.rend());

  bool flg = false;
  bool flg2 = true;
  for (int i = 0; i < s.length(); ++i) {
//    cout << sc[i] << " " << tc[i] << endl;
    if (sc[i] < tc[i]) {
      flg = true;
      break;
    } else if (flg2)
      if (sc[i] != tc[i]) flg2 = false;
    // if(i==s.length()-1&&s.length()<t.length())
  }
  cout << (flg || (flg2 && s.length() < t.length()) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}
use input::*;

fn main() {
    let n: usize;
    input!(n);
    let v = input_vector::<usize>();
    let mut a = vec![0; 3];
    let mut flag = false;
    for z in v {
        if z % 4 == 0 {
            a[2] += 1;
        } else if z % 2 == 0 {
            a[1] += 1;
        } else {
            a[0] += 1;
        }
    }

    if a[1] == 0 {
        if a[0] - 1 <= a[2] {
            flag = true;
        }
    } else {
        if a[0] <= a[2] {
            flag = true;
        }
    }
    if flag {
        p("Yes");
    } else {
        p("No");
    }
}

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

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	cout << min(A, B) + min(C, D);
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

コード通りにやるだけ
*/

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

signed main(){
	int a, b;
	cin >> a >> b;
	if(a == 1)a = 14;
	if(b == 1)b = 14;
	
	if(a > b)cout << "Alice" << endl;
	else if(b > a)cout << "Bob" << endl;
	else cout << "Draw" << endl;
	
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,a,b;
int p[125];

int main(){
  cin>>n>>a>>b;
  REP(i,n)cin>>p[i];
  int c1=0,c2=0,c3=0;
  REP(i,n){
    if(p[i]<=a)c1++;
    else if(p[i]<=b)c2++;
    else c3++;
  }
  int ans = min({c1,c2,c3});
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A, B;
    cin >> N >> A >> B;
    if ((A - B) % 2 == 0) {
        cout << "Alice" << endl;
    } else {
        cout << "Borys" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

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

	map<int,int>ma;
	rep(i,1000)ma[i*i]=1;
	int n,m;
	cin>>n>>m;
	vvi in(n,vi(m));
	rep(i,n)rep(j,m)cin>>in[i][j];
	int c=0;
	rep(i,n)loop(j,i+1,n){
		int s=0;
		rep(k,m)s+=(in[i][k]-in[j][k])*(in[i][k]-in[j][k]);
		if(ma[s])c++;
	}
	cout<<c<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
vector<ll>vec;
int main()
{
    ll a,b,c,d,e,i,j,k,l,n,m,x,y,t,p;
    cin>>n;
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a);
        vec.push_back(a);
    }
    x=0;
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            for(k=j+1;k<n;k++)
            {
                if(vec[i]!=vec[j] && vec[i]!=vec[k] && vec[j]!=vec[k])
                {
                    if(vec[i]+vec[j]>vec[k] && vec[j]+vec[k]>vec[i] && vec[i]+vec[k]>vec[j])
                    {
                        x++;
                        //cout<<vec[i]<<"  "<<vec[j]<<" "<<vec[k]<<endl;
                        //cout<<"xx: "<<i<<"  "<<j<<"  "<<k<<endl;
                    }
                }
            }
        }
    }

    cout<<x<<endl;
}



Measured memory_bytes: 3768
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<functional>
#include<map>
#include<cmath>
#define INF 999999999
typedef long long ll;

int main() {
	int n = 0, k = 0;
	int count = 0;
	int ans = 1;
	std::cin >> n >> k;
	for (int i = 0; i < n; i++) {
		if (ans * 2 > ans + k) {
			break;
		}
		ans = ans * 2;
		count++;
	}
	for (int i = 0; i < n - count;i++) {
		ans = ans + k;
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
count=0
for i in range(n+2):
    if i<k:
        continue
    elif i>=k:
        mini=i*(i-1)//2
        a=n*(n+1)//2
        b=(n-i)*(n-i+1)//2
        maxi=a-b
        total=maxi-mini+1
        count+=total
ans=count%(10**9+7)
print(ans)
        

Measured memory_bytes: 9196
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int m=0,n,l=0; cin>>n;
  unordered_map<int,int> mp;
  for(int i=0; i<n; ++i){
    int a; cin>>a;
    ++mp[a]; m=max(m,a);
  }
  vector<bool> b(m+1,true);
  for(int i=2; i<=m; ++i){
    int s=0;
    if(b[i]==true) for(int j=1; i*j<=m; ++j) {b[i*j]=false; s+=mp[i*j];}
    if(s==n){ cout<<"not coprime"; return 0;}
    else l=max(l,s);
  }
  if(l<2){ cout<<"pairwise coprime"; return 0;}
  else cout<<"setwise coprime";
  return 0;
}


Measured memory_bytes: 42852
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

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

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 105;

int n, a[MAXN], c[MAXN];

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read();
	for (int i = 1; i <= n; i ++)
		c[a[i] = Read()] ++;
	sort(a + 1, a + n + 1, greater <int> ());
	if (a[1] ^ a[2])
		return puts("Impossible"), 0;
	int mid = a[1] + 1 >> 1;
	for (int i = mid + 1; i <= a[1]; i ++)
		if (c[i] < 2)
			return puts("Impossible"), 0;
	if (c[mid] ^ (a[1] & 1) + 1)
		return puts("Impossible"), 0;
	if (a[n] < mid)
		return puts("Impossible"), 0;
	return puts("Possible"), 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s
 
typedef long long ll;
 
using namespace std;

ll modd = 1000*1000*1000+7;

int binomialmod2(ll a, ll b) {
    if ((b<0) || (b>a)) {  return 0;  }
    int ret = 1;
    while (b>0) {
        int digb = b%2, diga = a%2;
        a/=2; b/=2;
        if (digb>diga) { ret = 0; break; }
    }
    return ret;
};

int main()   {

    ios_base::sync_with_stdio(false);

    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
 
//    auto start = chrono::steady_clock::now();
  
//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readint(n);
        vector<int> a;
        readstring(s);
        for(char c : s) {
            a.push_back(c-'1');
        }

        vector<int> amod2;
        for(int x : a) {
            amod2.push_back(x%2);
        }

        int val = 0;
        forr(i,0,n) {
            val += binomialmod2(n-1, i) * amod2[i];
            val = val % 2;
        }
        if (val==1) {
            cout << 1 << endl; continue;
        }
        bool is_it_zero = false;
        forr(i,0,n) {
            if (a[i]==1) {is_it_zero=true;break;}
        }
        if (is_it_zero) {
            cout << 0 << endl; continue;
        }
        forr(i,0,n) {
            a[i]/=2;
        }
        val = 0;
        forr(i,0,n) {
            int x = binomialmod2(n-1, i);
            if (x==1) {
              val = val ^ a[i];
            }
        }
        cout << 2*val << endl;

    }
 
//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;
 
    return 0;
}


Measured memory_bytes: 14336
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>

using namespace std;

const int N = 1e6 + 5;
set <char> st;
map<char,long long> mp;
map<char,long long> mp2;
map<char,bool> used;
int main () {
 ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    long long n=(long long)s.size();
    long long ans=(n*(n-1))/2;
    for(int i=0;i<n;i++){
        mp[s[i]]++;
        long long k=mp[s[i]];
        mp2[s[i]]=(k*(k-1))/2;
    }
    for(int i=0;i<n;i++){
        if(!used[s[i]]){
            ans-=(mp2[s[i]]);
            used[s[i]]=1;
        }
    }
    cout<<max(1ll,ans+1);
    return 0;
}


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

#define NMAX 200005

using namespace std;
typedef long long ll;
typedef long double ld;

int main()
{
    ll n,x,cnt=0;
    cin>>n;
    for(ll i=1;i<=n;i++){
        cin>>x;
        cnt+=((x&1) & (i&1));
    }
    cout<<cnt;
    return 0;
}



Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define S(n) scanf("%d",&n)
int i,j,n,q,t,c,s[100000];
main(){
  for(S(n);i<n;S(s[i++]));
  for(S(q);j++<q;std::cin>>t,std::binary_search(s,s+n,t)&&c++);
  printf("%d\n",c);
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define clr(a, b) memset(a, b, sizeof(a))
#define Error(x) cout << #x << " = " << x << endl
#define iDEBUG freopen("in.txt", "r", stdin)
#define oDEBUG freopen("output.txt","w",stdout)
#define pb push_back
#define x first
#define y second
typedef long long ll;

using namespace std;

int digitSum(int n)
{
    int tmp = 0;
    while(n)
    {
        tmp += n%10;
        n /= 10;
    }
    return tmp;
}

int main()
{_
    int n, a, b, ans=0;
    cin >> n >> a >> b;
    for(int i=1; i<=n; i++)
    {
        int tmp = digitSum(i);
        if(tmp>=a && tmp<=b)
            ans += i;
    }
    cout << ans;


    return 0;
}

Measured memory_bytes: 256
n,m = map(int, input().split())
dic = []
for i in range(m):
    dic.append(list(map(int, input().split()))[1:])
P = list(map(int, input().split()))
cn = 0
for i in range(2**n):
    b = format(i,"b").rjust(n)
    for j in range(m):
        swcn = 0
        for s in dic[j]:
            swcn += 1 if b[s-1] == "1" else 0
        if swcn%2 != P[j]: break
    else:
        cn += 1
print(cn)

Measured memory_bytes: 3064
#include <iostream>
#include <numeric>
#include <assert.h>
#include <stdio.h>

#define SIZE_OF_ARRAY(D) (sizeof(D)/sizeof(D[0]))

using namespace std;

int maxElement(const int* array, size_t size)
{
    assert(array != NULL);
    assert(size >= 1);

    int max = array[0];
    for (size_t i = 1; i < size; ++i) {
        if (max < array[i]) {
            max = array[i];
        }
    }

    return max;
}

int main()
{
    int K, N;
    cin >> K >> N;
    int A[N], D[N+1];

    for(int i=0; i<N; i++){cin >> A[i];}
    
    D[0] = A[0];
    for(int i=1; i<N; i++){D[i] = A[i] - A[i-1];}
    D[N] = A[0] + (K - A[N-1]);
  
    int max = maxElement(D, SIZE_OF_ARRAY(D));
    cout << K - max << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <cmath>
#include <algorithm>
#include <array>
#include <iostream>
#include <vector>
using namespace std;
int main(int, char**)
{
	int r, g, b, n;
	cin >> r >> g >> b >> n;
	int count = 0;
	for (int i = 0; i <= n; ++i)
	{
		for (int j = 0; j <= n; ++j)
		{
			if (n >= (i * r + j * g) && (n - (i * r + j * g)) % b == 0)
			{
				++count;
			}
		}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
namespace mp = boost::multiprecision;
using namespace std;
typedef mp::cpp_int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

bool is_prime(int64_t x) {
  for(int64_t i = 2; i * i <= x; i++) {
    if(x % i == 0) return false;
  }
  return true;
}

int main(int argc, const char * argv[]) {
   	cin.tie(0); ios::sync_with_stdio(false);
    // source code
    int x;
    cin >> x;
    for (int i = x; i < 120000; i++) {
        if (is_prime(i)) {
            cout << i << "\n";
            return 0;
        }
    }
    
    return 0;
}


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

int main()
{
	
	int a[4], b[4];
	while(cin>>a[0]){
		
		int i,j;
		for(i=1;i<4;i++){
			cin>>a[i];
		}
		for(i=0;i<4;i++){
			cin>>b[i];
		}
		
		int hit = 0;
		int blow = 0;
		for(i=0;i<4;i++){
			if(a[i] == b[i]){
				hit++;
			}
		}
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(a[i] == b[j] && i != j){
					blow++;
				}
			}
		}
		cout<<hit<<' '<<blow<<endl;
	}
	return 0;
}

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

typedef int64_t Int;
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << endl; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

int main() {
    Int n;
    cin >> n;
    vector<Int> a(n);
    for (Int i = 0; i < (Int)n; i++) {
        cin >> a[i];
        if (a[i] == 0) {
            print(0);
            return 0;
        }
    }
    __int128_t x = 1;
    for (Int i = 0; i < (Int)n; i++) {
        x *= a[i];
        if (x > 1000000000000000000) {
            print(-1);
            return 0;
        }
    }
    Int res = x;
    print(res);
    return 0;
}

Measured memory_bytes: 3996
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

int l;

int main(){
	l=read();
	int n=(int)(log(l)*1.0/log(2))+1;
	cout<<n<<' '<<2*(n-1)+__builtin_popcount(l)-1<<endl;
	for(int i=1;i<n;i++){
		cout<<i<<' '<<i+1<<' '<<0<<endl;
		cout<<i<<' '<<i+1<<' '<<(1<<(i-1))<<endl;
	}
	int nw=(1<<(n-1));
	for(int i=n-2;i>=0;i--){
		if(l&(1<<i)){
			cout<<i+1<<' '<<n<<' '<<nw<<endl;
			nw=nw+(1<<i);
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<assert.h>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE


void solve(void)
{
  int H,W;
  cin>>H>>W;
  if(H%3 == 0 || W%3 == 0)
  {
    cout<<0<<endl;
    return;
  }

  int ANS = INF;
  chmin(ANS,H);
  chmin(ANS,W);

  for (int i = 1; i < W; i++)
  {
    int S1 = i*H;
    int S2 = (W - i)*(H/2);
    int S3 = (W - i)*(H/2 + H%2);
    chmin(ANS,max(S1,max(S2,S3))-min(S1,min(S2,S3)));
  }
  swap(H,W);
    for (int i = 1; i < W; i++)
  {
    int S1 = i*H;
    int S2 = (W - i)*(H/2);
    int S3 = (W - i)*(H/2 + H%2);
    chmin(ANS,max(S1,max(S2,S3))-min(S1,min(S2,S3)));
  }

  cout<<ANS<<endl;
  
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


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

const int N = 20;
int tab[N];
int ans = 0;
int n;

int sgn(int x){
    if(x > 0)
        return 1;
    return -1;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> tab[i];
    for(int i = 1; i < n - 1; i++){
        if( sgn( tab[i] - tab[i - 1] ) != sgn( tab[i] - tab[i + 1] ) )
            ans++;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
tree = [0] * n

for i in range(n):
    tree[i] = int(input())

tree.sort()
ans = 10 ** 9
# print(tree)
for i in range(k - 1, n):
    # print(i, i - k + 1)
    tmp = tree[i] - tree[i - k + 1]
    ans = min(ans, tmp)

print(ans)

Measured memory_bytes: 7472
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void io(){ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
int main()
{
    io();
    set<string> s;
    ll n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        string ss;
        cin>>ss;
        s.insert(ss);
    }
    cout<<s.size();
}


Measured memory_bytes: 19288
#include <stdio.h>

int main() {
  int n;
  scanf("%d", &n);
  long long ans = 0;

  for(int i = 1; i <= n; i++) {
    if(i % 3 != 0 && i % 5 != 0) {
      ans += i;
    }
  }

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

Measured memory_bytes: 1728
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#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 repR(i,n) for(int i = n-1; i >= 0; i--)
#define FOR(i,m,n) for(int i = m; i < n; i++)
#define PB push_back
#define MP make_pair
#define EPS (1e-7)
#define INF (1e12)
#define PI (acos(-1))

int main(){
    int n, d, x, a;
    cin >> n >> d >> x;
    rep(i,n){
        cin >> a;
        x += (d-1)/a + 1;
    }
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)





using P = pair<ll, ll>;

int main() {
    ll n, m;
    cin >> n >> m;
    vector<vector<P>> g(n);
    REP(i, m){
        ll p, q, c;
        cin >> p >> q >> c;
        p--;q--;
        g[p].push_back({q, c});
        g[q].push_back({p, c});
    }
    vector<ll> dist(n, INF);
    dist[0] = 0;
    priority_queue<P> que;
    que.push({0, 0});
    vector<set<ll>> st(n);
    while(!que.empty()){
        auto tmp = que.top(); que.pop();
        ll d = -tmp.first, now = tmp.second;
        if(dist[now] < d) continue;
        for(auto &edge : g[now]){
            ll to = edge.first, c = edge.second;
            ll dd = dist[now];
            if(st[now].count(c) == 0) dd++;
            if(dist[to] > dd){
                dist[to] = dd;
                st[to].clear();
                st[to].insert(c);
                que.push({-dd, to});
            }
            else if(dist[to] == dd) st[to].insert(c);
        }
    }
    cout << ((dist[n - 1] != INF)? dist[n - 1] : -1) << endl;
}

Measured memory_bytes: 27504
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include<bitset>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,A[200001],cnt[200001]={};
	scan(N);
	rep(i,N-1){
		int t;
		scan(t);
		cnt[t]++;
	}
	rep(i,N){
		prin(cnt[i+1]);
	}
	return 0;
}


Measured memory_bytes: 4420
#include <iostream>

using namespace std;

int main(){
	
	int n;
	cin >> n;
	
	for(int i = 0;i < n;i++){
		int a,b,c;
		cin >> a >>b >> c;
		if(a*a == b*b + c*c || b*b == a*a+c*c || c*c == a*a+b*b){
			cout << "YES" << endl;
			}else{
				cout << "NO" << endl;
			}
			}
			}


Measured memory_bytes: 1148
#include<iostream>

using namespace std;

int main() {
	int A, B;
	cin >> A >> B;

	if (B == 1) {
		cout << 0;
		return 0;
	}

	if (A >= B) {
		cout << 1;
		return 0;
	}

	for (int i = 2; i < 100; i++) {
		if ((A - 1) * (i - 1) + A >= B) {
			cout << i;
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	arr := [3]int{1, 2, 3}
	result := []int{}
	for _, v := range arr {
		if v != a && v != b {
			result = append(result, v)
		}
	}
	fmt.Println(result[0])
}


Measured memory_bytes: 512
<?php
    $in = explode(" ", trim(fgets(STDIN)));
    $h1 = $in[0];
    $m1 = $in[1];
    $h2 = $in[2];
    $m2 = $in[3];
    $k = $in[4];
    
    $h = $h2 - $h1;
    $m = $m2 - $m1;
    $wakemin = $h * 60 + $m;
    echo $wakemin - $k;
?>

Measured memory_bytes: 16168
n = int(input())
price0 = 0
minp = 0
maxv = 0

for i in range(n):
    if i == 0:
        price0 = int(input())
        continue
    if i == 1:
        price1 = int(input())
        minp = min(price1, price0)
        maxv = price1 - price0
        continue
    price = int(input())
    value = price - minp
    minp = min(minp, price)
    maxv = max(maxv, value)
    
print(maxv)


Measured memory_bytes: 5612
#include <stdio.h>

void selectionSort(int a[], int n) {
  int cnt = 0;
  int s = 0;
  int min_j = 0;

  for (int i = 0; i < n; i++) {
    int min_j = i;
    int flag = 0;
    for (int j = i + 1; j < n; j++) {
      if (a[min_j] > a[j]) {
        min_j = j;
        flag = 1;
      } else {
        continue;
      }
    }
    if (flag) {
      s = a[i];
      a[i] = a[min_j];
      a[min_j] = s;
      cnt++;
    }
  }
  for (int i = 0; i < n; i++) {
    if (i == n - 1) {
      printf("%d", a[n - 1]);
    } else {
      printf("%d ", a[i]);
    }
  }
  printf("\n");
  printf("%d\n", cnt);
}


int main() {
  int n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  selectionSort(a, n);

  return 0;
}



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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  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*(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;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};



int main() {
  int x, y;
  cin >> x >> y;
  if ((x+y)%3) {
    cout << 0 << endl;
    return 0;
  }
  int n = (x+y)/3;
  x -= n; y -= n;
  if (x < 0 || y < 0) {
    cout << 0 << endl;
    return 0;
  }
  combination c(x+y);
  mint ans = c(x+y,x);
  cout << ans.x << endl;
  
  return 0;
}

Measured memory_bytes: 10624
#include<iostream>
#include<cstring>
using namespace std;
int main(){
  int n;
  double hig;
  int data[7];
  for(int i=0;i<7;i++){
    data[i]=0;
  }
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>hig;
    if(hig<165.0){
      data[1]++;
    }if(hig>=165.0&&170.0>hig){
      data[2]++;
    }if(hig>=170.0&&175.0>hig){
      data[3]++;
    }if(hig>=175.0&&180.0>hig){
      data[4]++;
    }if(hig>=180.0&&185.0>hig){
      data[5]++;
    }if(hig>=185.0){
      data[6]++;
    }
  }
  for(int i=1;i<7;i++){
    cout<<i<<":";
    for(int j=0;j<data[i];j++){
      cout<<"*";
    }
    cout<<endl;
  }  
  return 0;
}

Measured memory_bytes: 1232
using System;
using System.Collections.Generic;
namespace ITP1_5_A
{
    class Problem
    {

        public static List<string[]> getinputdata (){

            List<string[]> list_temp = new List<string[]>();
            string strdata = Console.ReadLine ();

            while (strdata!=null) {

                string[] s_temp = strdata.Split (' ');

                list_temp.Add (s_temp);

                strdata = Console.ReadLine ();

            }

            return list_temp;
        }


        public static void DrawRectangle (int h,int w){

            for (int j = 0; j <= h; j++)
            {
                if (j == h)
                {
                    Console.WriteLine("");
                    break;
                }

                for (int k = 0; k <= w; k++)
                {
                    if (k != w)
                    {
                        Console.Write("#");
                    }
                    else
                    {
                        Console.WriteLine("");
                    }

                }
            }


        }

        public static void Main (string[] args)
        {
            List<string[]> list_result = new List<string[]>();
            list_result = getinputdata ();

            int H;
            int W;

            for (int i = 0; i < list_result.Count-1; i++)
            {
                H = int.Parse(list_result[i][0]);
                W = int.Parse(list_result[i][1]);

                DrawRectangle(H, W);
            }

        }
    }
}

Measured memory_bytes: 8972