akhauriyash/Code-Regression huggingface dataset:
def solve(s, a, b, c, d):
    if '##' in s[a:c + 1]:
        return False
    if '##' in s[b:d + 1]:
        return False

    # A < B < D
    # Cの位置により場合分け

    # A < C < B < D
    if c < b:
        return True

    # A < B < C < D
    if c < d:
        return True

    # A < B < D < C
    return '...' in s[b - 1:d + 2]


if __name__ == '__main__':
    n, *args = map(int, input().split())
    a, b, c, d = map(lambda x: x - 1, args)

    s = input()

    print('Yes' if solve(s, a, b, c, d) else 'No')


Measured memory_bytes: 3572
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.PriorityQueue;
import java.math.BigInteger;
import java.math.BigDecimal;
       
public class Main{
   
static final InputStream in=System.in;
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static final long LINF=Long.MAX_VALUE/2;
static int MAX=1500;
static char[] str=new char[MAX+1];
   
public static void main(String[] args) throws IOException{
  BufferedReader br=new BufferedReader(new InputStreamReader(in));
  int n=Integer.parseInt(br.readLine());
  while(n-->0){
    String line=br.readLine();
    int cur=0;
    Arrays.fill(str,'-');
    for(int i=0;i<line.length();i++) str[i]=line.charAt(i);
    int m=Integer.parseInt(br.readLine());
    while(m-->0){
      String com=br.readLine();
      String com0=com.substring(0,com.indexOf(" "));
      String com1=com.substring(com.indexOf(" ")+1);
      if("forward".equals(com0)){
        if("char".equals(com1)){
          if(str[cur]!='-') cur++;
        }
        else if("word".equals(com1)){
          while(str[cur]==' ') cur++;
          while(str[cur]!=' '&&str[cur]!='-') cur++;
        }
      }
      else if("backward".equals(com0)){
        if("char".equals(com1)){
          if(cur>0) cur--;
        }
        else if("word".equals(com1)){
          while(cur>0&&str[cur-1]==' ') cur--;
          while(cur>0&&str[cur-1]!=' ') cur--;
        }
      }
      else if("insert".equals(com0)){
        if(com1.length()>2){
          String insertionStr=com1.substring(1,com1.length()-1);
          for(int i=MAX-insertionStr.length();i>=cur;i--){
            if(str[i]!='-') str[i+insertionStr.length()]=str[i];
          }
          for(int i=0;i<insertionStr.length();i++){
            str[cur+i]=insertionStr.charAt(i);
          }
          cur+=insertionStr.length();
        }
      }
      else if("delete".equals(com0)){
        if("char".equals(com1)){
          if(str[cur]!='-'){
            for(int i=cur;;i++){
              if(str[i]=='-') break;
              str[i]=str[i+1];
            }
          }
        }
        else if("word".equals(com1)){
          int cnt=cur;
          while(str[cnt]==' ') cnt++;
          if(str[cnt]!='-'){
            while(str[cnt]!=' '&&str[cnt]!='-') cnt++;
            for(int i=cur;;i++){
              if(str[i]=='-') break;
              str[i]=str[i-cur+cnt];
            }
          }
        }
      }
    }
    StringBuilder sb=new StringBuilder();
    for(int i=0;;i++){
      if(i==cur) sb.append("^");
      if(str[i]=='-') break;
      sb.append(String.valueOf(str[i]));
    }
    out.println(sb);
  }
out.flush();
}
}

Measured memory_bytes: 20772
#include<stdio.h>
int main(void){
    int a,b,tmp,mod,step;
    while(1){
        step=0;
        scanf("%d %d",&a,&b);
        if(a==0 && b==0){
            break;
        }
        if(a<b){
            tmp=a;
            a=b;
            b=tmp;
        }
        mod=a%b;
        step+=1;
        while(mod!=0){
            a=b;
            b=mod;
            mod=a%b;
            step+=1;
        }
        printf("%d %d\n",b,step);
    }
    return 0;
}


Measured memory_bytes: 2024
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; ++i)
#define REPR(i,n) for (int i = n-1; i >= 0; --i)

const int MAX = 3e3+10;
int dp[MAX][MAX];

int main () {
  string s, t;
  cin >> s >> t;
  int m = s.size();
  int n = t.size();
  REPR (i, m) REPR (j, n)
    dp[i][j] = max(max(dp[i][j+1], dp[i+1][j]), (s[i]==t[j]) + dp[i+1][j+1]);
  int i = 0, j = 0;
  while (i < m && j < n) {
    if (dp[i][j] == dp[i][j+1]) j++;
    else if (dp[i][j] == dp[i+1][j]) i++;
    else {
      if (s[i] == t[j]) cout << s[i];
      i++;
      j++;
    }
  }
  cout << endl;
}

Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(ll a, ll b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmax(T &a, const T &b){ if(a < b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(a > b){ a=b; return 1; } return 0; }

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

  double a, b;
  ll h, m;
  cin >> a >> b >> h >> m;

  double diga = (h/12.0)*360 + (m * 0.5);
  double digb = 6*m;
  double digsum = max(diga, digb) - min(diga, digb);
  if(digsum > 180){
    digsum = 360.0 - digsum;
  }
  digsum = digsum * (PI/180.0);
  double ans = sqrt(a*a + b*b - 2.0*a*b*cos(digsum));
  cout << setprecision(16) << ans << endl;
  return 0;
}

Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
	#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a*b==c*d) cout<<a*b;
    else cout<<((a*b>c*d)?a*b:c*d);
    return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int cal(vector<int>& freqs, int color, vector<vector<int>>& D, int C)
{
  int ret = 0;
  for (int i = 1; i <= C; ++i) {
    ret += freqs[i] * D[i][color];
  }
  return ret;
}

int main()
{
  int N, C; scanf("%d %d", &N, &C);
  vector<vector<int>> D(C + 5, vector<int>(C + 5, 0));
  vector<vector<int>> G(N + 5, vector<int>(N + 5, -1));
  for (int i = 1; i <= C; ++i) {
    for (int j = 1; j <= C; ++j) {
      scanf("%d", &D[i][j]);
    }
  }

  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      scanf("%d", &G[i][j]);
    }
  }

  vector<vector<int>> freqs(3, vector<int>(C + 1, 0));
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      int m = (i + j) % 3;
      ++freqs[m][G[i][j]];
    }
  }
  int ans = INF;
  for (int i = 1; i <= C; ++i) {
    int cnt1 = cal(freqs[0], i, D, C);
    for (int j = 1; j <= C; ++j) {
      if (j == i) { continue; }
      int cnt2 = cal(freqs[1], j, D, C);
      for (int k = 1; k <= C; ++k) {
        if (k == i or k == j) { continue; }
        int cnt3 = cal(freqs[2], k, D, C);
        ans = min(ans, cnt1 + cnt2 + cnt3);
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 1280
//vec[i]の範囲外エラー表示
#define _GLIBCXX_DEBUG
//includeとusing
#include <bits/stdc++.h>
using namespace std;
//型名省略
using ll = long long;
using st = string;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using pcc = pair<char, char>;
//定数
const ll INF = 1e9;
const ll MOD = 1e9+7;
const vl dx = {1,0,-1,0,1,0,-1,0};
const vl dy = {0,1,0,-1,0,1,0,-1};
//マクロ
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define rrep(i,n) for(ll i = (ll) n - 1; i >= 0;i--)
#define REP(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define RREP(i,x,n) for(ll i = (ll) n - 1; i >= x; i--)
#define each(i,A) for(ll i: (vl) A)
#define all(A) A.begin(), A.end()
#define Size(A) ll(A.size())
//入力
template<typename T> T input() {T x; cin >> x; return x;}
//正誤判定
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}
//余り切り上げ
ll ceil(ll a,ll b) {return (a + b - 1) / b;}
//最大値・最小値
template <typename T> bool chmax(T &a, const T& b) {if(a < b) {a = b; return true;} return false;}
template <typename T> bool chmin(T &a, const T& b) {if(a > b) {a = b; return true;} return false;}
//最大公約数
ll gcd(ll a,ll b){if(a<b)swap(a,b); if(a%b==0)return b; return gcd(b,a%b);}
//最小公倍数
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//n乗の余り
ll modpow(ll x,ll n,ll mod){ll res=1;for(ll i=0;i<n;i++){res=res*x%mod;}return res;}
ll MODpow(ll x,ll n){ll res=1;for(ll i=0;i<n;i++){res=res*x%MOD;}return res;}


/*--------------------------------------------------------------------------*/

//main関数
int main() {

    ll n, k; cin >> n >> k;
    ll ans = k;
    rep(i,n - 1){
        ans *= (k - 1);
    }
    cout << ans << endl;
}



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

int n;
vector <int> card,t,m;

void cut(int k){
  for(int i=1,j=0;i<=k;i++,j++) t[j] = card[i];
  for(int i=k+1,j=0;i<=2*n;i++,j++) m[j] = card[i];

  for(int i=1,j=0;i<=2*n-k+1;i++,j++) card[i] = m[j];
  for(int i=2*n-k+1,j=0;i<=2*n;i++,j++) card[i] = t[j];
}

void r_shuffle(){
  for(int i=1;i<=n;i++){
    t[i-1] = card[i]; m[i-1] = card[i+n];
  }
  for(int i=1,j=0;i<=2*n;i+=2,j++){
    card[i] = t[j]; card[i+1] = m[j];
  }
}

int main(){
  int h,k;
  cin >> n >> h;
  card.resize(1001); t.resize(512); m.resize(512);
  for(int i=1;i<=2*n;i++) card[i] = i;
  for(int i=0;i<h;i++){
    cin >> k;
    if(k == 0) r_shuffle();
    else cut(k);
  }
  for(int i=1;i<=n*2;i++) cout << card[i] << endl;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n+1][4];
    for(int i=1;i<n+1;i++)
     for(int j=1;j<4;j++)
      cin>>a[i][j];
    int dp[n+1][4];
    dp[0][1]=0;
    dp[0][2]=0;
    dp[0][3]=0;
    for(int i=1;i<n+1;i++)
    {
    	dp[i][1]=max(dp[i-1][2]+a[i][1],dp[i-1][3]+a[i][1]);
    	dp[i][2]=max(dp[i-1][1]+a[i][2],dp[i-1][3]+a[i][2]);
        dp[i][3]=max(dp[i-1][1]+a[i][3],dp[i-1][2]+a[i][3]);
    }
    cout<<max(max(dp[n][1],dp[n][2]),dp[n][3]);
	return 0;
}


Measured memory_bytes: 3328
#include<iostream>
using namespace std;
int a,b,c,d,n,i,mas[10000];
int main (){
	cin>>b>>n;
	for(i=0;i<n;i++){
		cin>>mas[i];
		a=a+mas[i];
	}
	if(b-a>-1){
	cout<<b-a;
	}
	else{
		cout<<-1;
	}
}

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int a, b;
    string op;

    while (1) {
        cin>>a>>op>>b;
        if (op == "?") break;
        if (op == "+") cout<<a+b<<endl;
        else if (op == "-") cout<<a-b<<endl;
        else if (op == "*") cout<<a*b<<endl;
        else cout<<a/b<<endl;
    }
}


Measured memory_bytes: 3148
import java.util.*;
public class Main {
    public static void main(String[] ano) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
        	int d =scan.nextInt();
        	int sum =0;
        	for(int i=1;i<=(600/d-1);i++){
        		sum += d*Math.pow(i*d,2);
        	}
        	System.out.println(sum);
        }
    }
}

Measured memory_bytes: 11000
#include <bits/stdc++.h>
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
using namespace std;
 
int main() {
	ll a,b,k;
	cin>>a>>b>>k;
	
	if(a<=k){
		
		k = k-a;
		a=0;
		
		if(b<=k){
			b=0;
		}
		else{
			b-=k;
		}
	}
	else{
		a-=k;
	}
	
	cout<<a<<" "<<b<<endl;

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

x = int(input())
ans += 1000*(x//500)
x %= 500
ans += 5 * (x//5)
print(ans)

Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {

		int x;

		x = Integer.parseInt(new Scanner(System.in).next());
		if ((x >= 1) && (x <= 100)) {

			x = x * x * x;
			System.out.println(x);
		}
	}
}

Measured memory_bytes: 25988
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  double ans=a[0];
  for(int i=1;i<n;i++){
    ans+=a[i];
    ans=ans/2;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll a,b,k;
  cin >> a >> b >> k;
  for(ll i = a; i < min(a+k,b+1); i++){
    cout << i << endl;
  }
  for(ll i = max(a+k,b-k+1); i <= b; i++){
    cout << i << endl;
  }
  return 0;
}


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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		long t[] = new long[N];
		for(int i=0;i<N;i++){
			t[i] = Long.parseLong(sc.next());
		}
		long tmp = 1;
		for(int i=0;i<N;i++){
			long gcd = gcd(tmp,t[i]);
			tmp = Math.max(tmp,t[i])/gcd * Math.min(tmp,t[i]);
		}

		out.println(tmp);
		
		sc.close();
		out.flush();
	}

	public static long gcd(long a, long b){
		long r = a % b;
		if(r==0){
			return b;
		}
		else{
			return gcd(b,r);
		}
	}
}

Measured memory_bytes: 21844
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	class P{
		double x, y;

		P(double x, double y){
			this.x=x;
			this.y=y;
		}

		double length(P p){
			return sqrt((p.x-x)*(p.x-x)+(p.y-y)*(p.y-y));
		}
	}

	void run(){
		sc=new Scanner(System.in);
		LinkedList<P> list=new LinkedList<P>();
		for(; sc.hasNext();){
			String[] s=sc.next().split(",");
			double x=Double.parseDouble(s[0]);
			double y=Double.parseDouble(s[1]);
			list.add(new P(x, y));
		}
		int n=list.size();
		P p0=list.getFirst();
		double sum=0;
		for(int i=0; i<n-2; i++){
			// i+1, i+2
			P p1=list.get(i+1);
			P p2=list.get(i+2);
			double a=p0.length(p1);
			double b=p1.length(p2);
			double c=p2.length(p0);
			double z=(a+b+c)/2;
			double s=sqrt(z*(z-a)*(z-b)*(z-c));
			sum+=s;
		}
		println(sum+"");
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

Measured memory_bytes: 12000
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String[] temp = scanner.nextLine().split(" ");
        int N = Integer.valueOf(temp[0]);
        int K = Integer.valueOf(temp[1]);

        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int h = Integer.valueOf(scanner.nextLine());
            list.add(h);
        }

        list.sort(Comparator.comparingInt(o -> o));
        int ans = 1000000000;
        int sa = N-K+1;
        int size = list.size();
        for (int i = 0; i < sa; i++) {
            int max = list.get(size - 1 - i);
            int min = list.get(sa - 1 - i);
            int t = max - min;
            if (ans > t) {
                ans = t;
            }
        }
        System.out.println(ans);
    }



}


Measured memory_bytes: 95388
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N; cin >> N;
    int A[N+1], B[N];
    for(int i = 0; i < N+1; i++) cin >> A[i];
    for(int i = 0; i < N; i++) cin >> B[i];
    long sum = 0;
    for(int i = 0; i < N; i++){        
        if(B[i] < A[i]){ 
            sum += B[i];
            A[i] = A[i] - B[i];
            B[i] = 0;
        }else{
            sum += A[i];
            B[i] = B[i] - A[i];
            A[i] = 0;
        }
        if(B[i] < A[i+1]){
            sum += B[i];
            A[i+1] = A[i+1] - B[i];
            B[i] = 0;
        }else{
            sum += A[i+1];
            B[i] = B[i] - A[i+1];
            A[i+1] = 0;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  for (;;) {
    int w;
    cin >> w;
    if (w == -1) return 0;
    cout << 4280 - (1150 + 125*min(10, max(w-10, 0)) + 140*min(10, max(w-20, 0)) + 160*max(w-30, 0)) << endl;
  }
}

Measured memory_bytes: 1160
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)

@mt
def slv(N, A):
    ans = 0
    M = Mod(10**9+7)
    for i in range(0, 60):
        m = 1 << i
        c = 0
        for a in A:
            if m & a > 0:
                c += 1
        ans = M.add(M.mul(M.mul(c, N-c), m), ans)
    return ans

def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))

    # N = 3 * (10**5)
    # A = [random.randint(0, 2**60) for _ in range(N)]
    # print(slv(N, A))


if __name__ == '__main__':
    main()


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int x, y; cin >> x >> y;
    rep(i, x+1){
        if(i*2 + (x-i)*4 == y){
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7760
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()
#define _GLIBCXX_DEBUG

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int N; cin >> N;
	vector<int> A(N, 0);
	rep (i, N) cin >> A[i];

	int res = pow(3, N);
	int even = 0;
	int odd = 0;
	rep (i, N){
		even += (int)(A[i] % 2 == 0);
		odd  += (int)(A[i] % 2 != 0);
	} // end rep

	if (even != 0){
		res -= pow(2, even);
	} // end if

	if (odd == N){
		--res;
	} // end if

	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 640
N, K = map(int, input().split())

p = list(map(int, input().split()))
c = list(map(int, input().split()))

for i in range(len(p)):
    p[i] -= 1

ans = float("-inf")

for i in range(N):
    #iはスタートポジション
    pos = i
    #移動先のマスにかかれたポイント
    point = []
    total = 0
    while True:
        pos = p[pos]
        point.append(c[pos])
        # totalは周期の和がマイナスかプラスかで後々場合分けするために使う。(周期が負だったら一巡目で終わらせたい。周期が正だったらできる限り後の方で終わらせたい)
        total += c[pos]
        #スタートポジションに戻ってきた==サイクルを検知した
        if pos == i: break
    l = len(point)

    t = 0
    #total<0のときはif total>0以外の処理でまきとれる
    for i in range(l):
        t += point[i]
        #Kがi+1より小さい時のハンドリング
        if i+1 > K: break
        now = t
        if total > 0:
            #K-i-1の-1はポイントの一個目を獲得する時に1個動くので-1。二こ目のポイントを取る時はi=1で、K-2になり計算が合う。それをlでわり周期が何個回れるかを計算する
            #nowはtotalのセットが何個かあって、その先にpoint[i]がくっつくイメージ。[a,b,c] + [a,b,c] + [a,b,c] + ([a] or [a+b] + [a+b+c]) 
            cnt = (K-i-1) // l
            now += total * cnt 
        ans = max(ans, now)
print(ans)



 



Measured memory_bytes: 81136
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>
#include <new>

//#include "All.h"

using namespace std;

#define EPS (1e-9)
#define INF (1e9)
#define MOD (ll)(1e9 + 7)
#define PI (acos(-1))
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i, n) REP(i,0,n)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" ; "IMPOSSIBLE")

using ll = long long int;

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

ll beki(ll a, ll b) {
    ll tmp = 1;
    rep(i, b) tmp *= a;
    return tmp;
}

int K;
string S;

int main() {
    cin >> K >> S;
    rep(i, K) {
        
        cout << S[i];
        if (i == S.length() - 1) {
            cout << endl;
            return 0;
        }
    }
    cout << "..." << endl;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cmath>
#include <vector>
#include <iostream>
#include <set>
#include <queue>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
#define mst(a,b) memset((a),(b),sizeof(a))
#define rush() int T;scanf("%d",&T);while(T--)
typedef long long ll;
int main(){
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll n;
	cin>>n;
	int ans=sqrt(n);
	
	cout<<ans*ans; 
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <vector>


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

using namespace std;
using ll = long long;

#define M (1'000'000'007)

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;

    int l = 0;
    int r = s.size() - 1;
    int ans = 0;

    while (l < r) {
        if (s[l] == 'W') {
            if (s[r] == 'R') {
                ans++;
                l++;
                r--;
            } else {
                r--;
            }
        } else {
            if (s[r] == 'R') {
                l++;
            } else {
                r--;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
	int answer[] = { 1, 2, 3, 4, 5 };
	vector<int> vc;
	for (int i = 0; i < 5; i++) {
	int x;
	cin >> x;
	vc.push_back(x);
	}
	for (int i = 0; i < 5; i++){
		if (answer[i] != vc[i]) {
			cout << (i + 1);
		}
		else {
			continue;
		}
	}

	return 0;
}

Measured memory_bytes: 3632
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
c1 = Counter(A[::2])
c2 = Counter(A[1::2])
c1[0] = 0
c2[0] = 0
c1m = max(c1.items(), key=lambda x:x[1])
c2m = max(c2.items(), key=lambda x:x[1])
c1c2 = max(c for k,c in c2.items() if c1m[0]!=k)
c2c1 = max(c for k,c in c1.items() if c2m[0]!=k)
print(min(N - c1m[1] - c1c2, N - c2m[1] - c2c1))

Measured memory_bytes: 18648
<?php

fscanf(STDIN, '%d %d', $n, $d);

$count = 0;

for($i=0; $i<$n; $i++) {
    fscanf(STDIN, '%d %d', $x, $y);
    if (sqrt($x**2+$y**2) <= $d) {
        $count++;
    }
}

echo $count;

Measured memory_bytes: 16228
import sys
from math import sqrt
from collections import defaultdict
from itertools import combinations
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    divisor=defaultdict(int)
    for i in range(1,N+1):
        x=2
        while i!=1:
            if i%x==0:
                divisor[x]+=1
                i//=x
            else:
                x+=1
    divisor_2=[]
    divisor_4=[]
    divisor_14=[]
    divisor_24=[]
    divisor_74=[]
    for k,v in divisor.items():
        if v>=2:
            divisor_2.append(k)
        if v>=4:
            divisor_4.append(k)
        if v>=14:
            divisor_14.append(k)
        if v>=24:
            divisor_24.append(k)
        if v>=74:
            divisor_74.append(k)
    ans=0
    for a in divisor_2:
        for p in combinations(divisor_4,2):
            if not a in p:
                ans+=1
    for a in divisor_14:
        for b in divisor_4:
            if a!=b:
                ans+=1
    for a in divisor_24:
        for b in divisor_2:
            if a!=b:
                ans+=1
    ans+=len(divisor_74)
    print(ans)
                

if __name__ == '__main__':
    main()


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

int main(){
    int x, y;
    while(1){
        cin >> x >> y;
        if(x == 0 && y == 0)    break;
    
        int dp[y+2][x];
        char mat[y+2][x];
        for(int i = 0; i < y+2; i++){
            for(int j = 0; j < x; j++){
                dp[i][j] = 0;
                mat[i][j] = '0';
            }
        }

        for(int i = 0; i < y; i++){
            for(int j = 0; j < x; j++){
                cin >> mat[i][j];
            }
        }

        for(int j = 0; j < x; j++){
            if(mat[0][j] == '0')    dp[0][j] = 1;
        }

        for(int i = 0; i < y-1; i++){
            for(int j = 0; j < x; j++){
                if(mat[i][j] == '0'){
                    if(j != 0 && mat[i+1][j-1] == '0')      dp[i+1][j-1] += dp[i][j];
                    if(mat[i+1][j] != '1')                  dp[i+1][j] += dp[i][j];
                    if(j != x-1 && mat[i+1][j+1] == '0')    dp[i+1][j+1] += dp[i][j];
                }else if(mat[i][j] == '1'){
                    // do nothing.
                }else if(mat[i][j] == '2'){
                    dp[i+2][j] += dp[i][j];
                }
            }
        }

        int accum = 0;
        for(int j = 0; j < x; j++)  if(mat[y-1][j] != '1')  accum += dp[y-1][j];
        for(int j = 0; j < x; j++)  accum += dp[y][j];
        cout << accum << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include<stdio.h>
int main()
{
    int n, sum = 0, rem, div;
    scanf("%d", &n);

    while(n>=5)
    {
        if(n>=500)
        {
            div = n/500;
            rem = n%500;
            n = rem;
            sum = sum+(div*1000);
        }
        else
        {
            div = n/5;
            rem=n%5;
            n=rem;
            sum = sum+(div*5);
        }
    }

    printf("%d\n", sum);


    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define R register
#define LL long long
#define U unsigned
#define FOR(i,a,b) for(R int i = a;i <= b;++i)
#define RFOR(i,a,b) for(R int i = a;i >= b;--i)
#define CLR(i,a) memset(i,a,sizeof(i))
#define BR printf("--------------------\n")
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

int N,K;
int g,max;

int gcd(int x,int y){
    return (!y) ? x : gcd(y,x%y);
}

int main(){
    scanf("%d%d",&N,&K);
    FOR(i,1,N){
        int x;scanf("%d",&x);max = std::max(max,x);
        if(i == 1) g = x;
        else g = gcd(g,x);
    }
    if(K%g || K > max) puts("IMPOSSIBLE");
    else puts("POSSIBLE");
    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++)
void sort2array(double *a,long *b,long n){
    for(int i=0;i<n;i++){
        b[i]=i;
    }
    sort(b,b+n,[a](long i,long j)->bool {return a[i]<a[j];} );
}
int wtover(int a,int b){
    if(a%b>0)return (a/b)+1;
    else return a/b;
}
int INF=100000001;


int main(){
    int i,n,a,b,c;
    cin>>n;
    //入力
    //処理
    long sum=0;
    rep(a,n){
        rep(b,n){
            rep(c,n){
                sum+=gcd(gcd(a+1,b+1),c+1);
            }
        }
    }
    //出力
    cout<<sum<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define VIN(n,v) for(int64_t i=0;i<(n);i++){cin >> (v).at(i);}

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
I lcm(I a, I b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

int main(){
  I k,x;
  cin >> k >> x;
  REP(i,k*2-1){
    if (i != k*2-2) cout << x - k + i +1 << " ";
    else cout << x - k + i + 1;
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int a[5]; rep(i,5) cin>>a[i];
    int k; cin>>k;
    int ma=0;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            ma=max(ma,a[j]-a[i]);
        }
    }
    if(ma>k) cout<<":("<<endl;
    else cout<<"Yay!"<<endl;
    return 0;
}


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

int main(){
	
	int n;
	
	cin >> n;
	
	int a[n];
	
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	sort(a, a+n, greater<int>());
	
	int ans;
	
	ans = a[n/2-1] - a[n/2];
	
	cout << ans; 
	
	
	
}

Measured memory_bytes: 640
from collections import defaultdict,deque
#from itertools import permutations
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""

t=ii()
if t>=30:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 64720
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	int lp = 0;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) {
		int cnt = 0;
		for (int j = i; j < n; j++) {
			if (a[j] == 1) cnt++;
			else break;
		}
		lp = max(lp, cnt + 1);
	}
	cout << lp << endl;
	return 0;
}



Measured memory_bytes: 3112
package main

import (
	"fmt"
	"math"
)

func max(x, y int) int {
	if x < y {
		return y
	}
	return x
}
func min(x, y int) int {
	if x > y {
		return y
	}
	return x
}
func main() {
	var A, B, N, ret int
	fmt.Scanf("%d %d %d", &A, &B, &N)
	b := float64(B)

	t := min(B-1, N)
	ret = max(ret, int(math.Floor(float64(A*t)/b))-A*int(math.Floor(float64(t)/b)))
	fmt.Println(ret)
}


Measured memory_bytes: 1824
#include<iostream>
using namespace std;
int main()
{
    int n,sum=0,re[20]={0},i,a,b=-1;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> a;
        if(a-b==1) re[b-1]=1;
        b=a;
    }
    for(i=0;i<n;i++){
        cin >> a;
        sum+=a;
    }
    for(i=0;i<n-1;i++){
        cin >> a;
        if(re[i]==1)sum+=a;
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 256
/*#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")*/
//#pragma GCC optimize("fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
//#define _CRT_SECURE_NO_WARNINGS
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <bitset>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <math.h>
#include <random>
using namespace std;
typedef int  ll;
typedef pair<ll, ll> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
#define all(a) a.begin(), a.end()
#define lb(a, x) lower_bound(a.begin(), a.end(), x)
#define pb(x) push_back(x)
#define fr(i, n) for(int i = 0; i < n; ++i)
//typedef cc_hash_table<int, int, hash<int>> hst2;
//typedef cc_hash_table<int, hst2, hash<int>> hst;
typedef pii ord_set_t;
#ifdef ABCD
typedef map<ord_set_t, vi> ordered_set;
int __builtin_popcount(int x)
{
	int cnt = 0;
	for (; x > 0; x >>= 1) cnt += x & 1;
	return cnt;
}
#else
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
mt19937 rnd(239);
using namespace __gnu_pbds;
typedef tree<
	ord_set_t,
	vi,
	less_equal<ord_set_t>,
	rb_tree_tag,
	tree_order_statistics_node_update>
	ordered_set;
#endif
const int N = 300001;
int a[N];
bool check(int n)
{
	for (int i = 1; i < n; ++i)
	{
		if (a[i] < a[i - 1]) return false;
	}
	return true;
}
int main()
{

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef ABCD
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else

#endif
	int n; cin >> n;
	fr(i, n) cin >> a[i];
	for (int i = 0; i < n; ++i)
	{
		for (int j = i; j < n; ++j)
		{
			swap(a[i], a[j]);
			if (check(n))
			{
				cout << "YES";
				return 0;
			}
			swap(a[i], a[j]);
		}
	}
	cout << "NO";
}


Measured memory_bytes: 256
n, h = gets.split.map(&:to_i)
abs = []
n.times do
  abs << gets.split.map(&:to_i)
end

abs.sort_by! { |ab| -ab[0] }

a_max = abs[0][0]

abs.reject! { |ab| ab[1] <= a_max }

abs.sort_by! { |ab| -ab[1] }

ans = 0
sum = 0
abs.each do |a, b|
  sum += b
  ans += 1
  if sum >= h
    puts ans
    exit
  end
end
ans += ((h - sum).to_f / a_max.to_f).ceil
puts ans


Measured memory_bytes: 13388
# -*- coding:utf-8 -*-

def solve():
    A, B, C, K = list(map(int, input().split()))

    if A >= K:
        print(K)
        return

    total = A
    K -= A

    if B >= K:
        print(total)
        return

    K -= B

    total += -K

    print(total)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 9168
require 'matrix'
n,m=gets.chomp.split.map(&:to_i)
mat,vec,pro=[],[],[]
n.times{mat<< gets.chomp.split.map(&:to_i)}
m.times{vec<< gets.to_i}
n.times{|a|pro<< (Vector.elements(mat[a], true).inner_product Vector.elements(vec, true))
}
puts pro


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

int main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  
  for (int i=0; i<N; i++) {
    cin >> A.at(i);
  }
  
  int sum=0;
  int ima;
  ima = 1;
  
  while (ima != 2) {
    ima = A.at(ima-1);
    sum++;
    if (sum >= N+1) {
      sum = -1;
      break;
    }
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 3784
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <sstream>
#include <algorithm>
#include <math.h>
#include<string>
#include<vector>
using namespace std;
int main()
{
    double r;
    cin >> r;
    cout << double(2.0 * r * M_PI) << endl;
}


Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
#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 FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

ll mod = 1e9+7;

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

	ll n, a, b;
	cin >> n >> a >> b;
	ll m = b - a;
	if (m % 2) cout << "Borys" << endl;
	else cout << "Alice" << endl;
    return 0;
}

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

int N, M;
vector<int> G[100100];
int st[100100], rt[100100];
map<int, map<int, int>> idx;
vector<int> acc1[100100];
vector<int> acc2[100100];

int dfs1(int v, int pv) {
    for (auto& nv:G[v]) {
        if (nv==pv) continue;
        st[v] *= dfs1(nv, v)+1;
        st[v] %= M;
    }
    return st[v];
}

void dfs2(int v, int pv) {
    int cnt = 0;
    vector<int> l;
    
    for (auto& nv:G[v]) {
        if (nv==pv) {
            int left = acc1[pv][idx[pv][v]];
            int right = acc2[pv][idx[pv][v]+1];
            l.pb((left*right+1)%M);
            rt[v] *= (left*right+1)%M;
            rt[v] %= M;
        }
        else {
            l.pb(st[nv]+1);
            rt[v] *= st[nv]+1;
            rt[v] %= M;
        }
        
        idx[v][nv] = cnt;
        cnt++;
    }
    
    acc1[v].pb(1);
    for (auto& li:l) acc1[v].pb(acc1[v].back()*li%M);
    reverse(l.begin(), l.end());
    acc2[v].pb(1);
    for (auto& li:l) acc2[v].pb(acc2[v].back()*li%M);
    reverse(acc2[v].begin(), acc2[v].end());
    
    for (auto& nv:G[v]) {
        if (nv==pv) continue;
        dfs2(nv, v);
    }
}

 
signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N >> M;
    rep(i, N-1) {
        int x, y; cin >> x >> y;
        G[x-1].pb(y-1);
        G[y-1].pb(x-1);
    }
    rep(v, N) {
        st[v] = 1;
        rt[v] = 1;
    }
    dfs1(0, -1);
    dfs2(0, -1);
    rep(v, N) cout << rt[v] << endl;
}

Measured memory_bytes: 59904
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long

void solve() {
	string s; cin >> s;
    if(s[5] == '0' && (s[6] == '1' || s[6] == '2' || s[6] == '3' || s[6] == '4')) {
    	cout << "Heisei" << endl; return;
    }
    else {
        cout << "TBD" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[500][500];

int main(){
  cin >> n >> m;
  l = 0;
  lep(i,0,n){
    lep(j,0,n){
      ll k = i+j;
      if(0 <= m-k && m-k <= n)l++;
    }
  }
  print(l);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <map>
#include <string>

using namespace std;

int main(){
  int n,m,i,j,k,h,w;
  string s;
  cin >> n >> h >> w;
  vector<int> a(n),b(n);
  int cnt = 0;
  for(i=0;i<n;i++){
    cin >> a[i] >> b[i];
    if(a[i]>=h && b[i] >= w)cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a=[[0 for i in range(m)] for j in range(n)]
for i in range (n):
    a[i] = list(map(int, input().split()))
count=0
ans=0
for i in range(n):
    ans=0
    for j in range(m):
        ans=ans+a[i][j]*b[j]
    ans=ans+c
    if(ans>0):
        count+=1
print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin>>n;
  if(n%1000==0)
    cout<<"0\n";
  else
  {
    int ans=1000-(n%1000);
    cout<<ans<<"\n";
  }
  return 0;
}

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;

int main() {
    map<int, int> m;
    m.clear();
    int N;
    cin >> N;
    REP(i, N) {
        int a;
        cin >> a;
        m[a] = (m[a] + 1)%2;
    }

    int s = 0;
    for(auto i = m.begin();i != m.end();i++) {
        s += i->second;
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 4864
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
template <class... T> void printd(T&&...){ }
template <class... T> void printArr(T&&...){ }
#endif

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> vs(n);
    for(int i=0;i<m;i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        vs[a]++;
        vs[b]++;
    }
    for(int i=0;i<n;i++){
        if(vs[i] & 1){
            cout << "NO" << '\n';
            return 0;
        }
    }
    cout << "YES" << '\n';
    return 0;
}


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

using namespace std;
#define ll long long int
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

int32_t main()
{
   IOS;
    ll a,b,c,d,e,f,g,h,i,j,k,l;
    cin>>a>>b>>c>>d;
    e=b/c-a/c;
    if(a%c==0)
    {
        e+=1;
    }

     f=b/d-a/d;

    g=__gcd(c,d);
    h=(c*d)/g;
    i=b/h-a/h;
    cout<<b-a+1-(e+f-i);




    return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools

N = int(readline())
S = list(map(int,read().split()))

answer = 0
for d in range(1,N):
    n = (N-1)//d
    if (N-1)%d == 0:
        n = ((N-1)//d+1)//2
    if n <= 1:
        continue
    x = max(itertools.accumulate(x+y for x,y in zip(S[d:d*n:d],S[N-1-d:N-1-d*n:-d])))
    if answer < x:
        answer = x

print(answer)

Measured memory_bytes: 12936
#include <stdio.h>

int main(void)
{
    int n;
    scanf("%d",&n);

    unsigned long long sum=0;
    for(int i=1;i<n+1;i++){
        if(!(i%3==0||i%5==0)){
            sum+=i;
        }
    }
    printf("%llu",sum);

    return 0;
}

Measured memory_bytes: 1688