akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b,c,d;
ll solve2(ll p,ll x)
{
    return p/x;
}
ll solve(ll x)
{
    return solve2(b,x)-solve2(a-1,x);
}
int main()
{
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
    ll e=c/__gcd(c,d)*d;
    printf("%lld\n",b-a+1-(solve(c)+solve(d)-solve(e)));
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Dynamic Arrays and List - Vector II
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_1_D&lang=jp

"""
n, q = map(int, input().split())
A = [[] for _ in range(n)]
for _ in range(q):
    op, t, x = (input() + ' 1').split()[:3]
    if op == '0':
        A[int(t)].append(x)
    elif op == '1':
        print(*A[int(t)])
    else:
        A[int(t)] = []



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

using namespace std;

int main()
{
    long long h, w, i, j, cont=0;
    cin >> h >> w;
    char arreglo[h+2][w+2];
    for(i=0; i<h+2; i++)
    {
        arreglo[i][0]='0';
        arreglo[i][w+1]='0';

    }
    for(i=0; i<w+2; i++)
    {
        arreglo[0][i]='0';
        arreglo[h+1][i]='0';
    }
    for (i=1; i<h+1; i++)
    {
        for (j=1; j<w+1; j++)
        {
            cin >> arreglo[i][j];
        }
    }
    for(i=1; i<h+1; i++)
    {
        for(j=1; j<w+1; j++)
        {
            if(arreglo[i][j]=='.')
            {
                cont=0;
            if(arreglo[i-1][j-1]=='#') cont++;
            if(arreglo[i-1][j]=='#') cont++;
            if(arreglo[i-1][j+1]=='#') cont++;
            if(arreglo[i][j-1]=='#') cont++;
            if(arreglo[i][j+1]=='#') cont++;
            if(arreglo[i+1][j-1]=='#') cont++;
            if(arreglo[i+1][j]=='#') cont++;
            if(arreglo[i+1][j+1]=='#') cont++;
            cout << cont;
            }
            if(arreglo[i][j]=='#') cout << "#";
        }
        cout << endl;
    }

    return 0;
}

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

typedef long long ll;
const int MAXN = 200010;
const int INF = 1000000000;
const ll MOD = 1000000007;
int n, cnt, ord[MAXN];
int q[MAXN], head, tail;
ll dp[MAXN], sum[MAXN];
struct Point {
	int x, v, id;
}P[MAXN];
vector<int> G[MAXN];
struct Line {
	int l, r;
	bool operator < (const Line &rhs) const {
		return l < rhs.l || (l == rhs.l && r > rhs.r);
	}
}L[MAXN];

bool cmp1(Point a, Point b) {
	return a.v < b.v;
}

bool cmp2(Point a, Point b) {
	return a.x < b.x;
}

inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	for(; !isdigit(ch); ch = getchar()) if(ch=='-') f=-1;
	for(; isdigit(ch); ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x * f;
}

int main() {
	int i, j;
	n = read();
	for(i = 1; i <= n; i++)
		P[i].x = read(), P[i].v = read(), P[i].id = i;
	sort(P+1, P+n+1, cmp1);
	for(i = 1; i <= n; i++) ord[P[i].id] = i;
	sort(P+1, P+n+1, cmp2);
	//for(i = 1; i <= n; i++) printf("%d ", ord[i]);
	//printf("\n");
	int Maxv = -INF, u;
	for(i = 1; i <= n; i++) {
		if(P[i].v > Maxv) 
			Maxv = P[i].v, u = i;
		L[i].r = ord[P[u].id];
		//printf("%d\n", L[i].r);
	}
	//printf("\n");
	int Minv = INF;
	for(i = n; i >= 1; i--) {
		if(P[i].v < Minv) 
			Minv = P[i].v, u = i;
		L[i].l = ord[P[u].id];
		//printf("%d\n", L[i].l);
	}
	//printf("\n");
	sort(L+1, L+n+1);
	/*for(i = 1; i <= n; i++) printf("%d %d\n", L[i].l, L[i].r);
	printf("\n");*/
	for(i = 1; i <= n; i++) G[L[i].r].push_back(L[i].l);
	dp[0] = 1, sum[0] = 1;
	for(i = 1; i <= n; i++) {
		for(j = 0; j < G[i].size(); j++) {
			sum[i] = (sum[i-1]+dp[i])%MOD;
			dp[i] = (dp[i]+((sum[i]-sum[G[i][j]-1]+MOD)%MOD+dp[G[i][j]-1])%MOD)%MOD;
		}
		sum[i] = (sum[i-1]+dp[i])%MOD;
	}
	printf("%lld\n", dp[n]);
	return 0;
}


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

int main(){
    int N,x;
    cin>>N>>x;
    int a[N];
    rep(i,N)scanf("%d",&a[i]);

    ll ans;
    if(a[0]>x)ans=a[0]-x,a[0]=x;
    else ans=0;
    int y;
    for(int i=0;i<N-1;i++){
        y=a[i]+a[i+1]-x;
        if(y>0){
            ans+=y;
            a[i+1]=x-a[i];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 640
import sys
from collections import deque
sys.setrecursionlimit(10 ** 7)

def solve():
    H, W = map(int, input().split())
    M = [[] for _ in range(H)]
    queue = deque()
    for i in range(H):
        M[i] = list(input())
        for j in range(W):
            if M[i][j] == '#':
                queue.append((i, j))
    ans = 0
    while queue:
        # 今の地点から1ステップ変化
        n = len(queue)
        flag = False
        for _ in range(n):
            cy, cx = queue.popleft()
            for dy, dx in ((-1, 0), (0, 1), (1, 0), (0, -1)):
                ny, nx = cy + dy, cx + dx
                if 0 <= nx < W and 0 <= ny < H and M[ny][nx] == '.':
                    M[ny][nx] = '#'
                    flag = True
                    queue.append((ny, nx))
        if flag:
            ans += 1
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 147628
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int x, a, b;
	cin >> x >> a >> b;
	cout << (x-a)%b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string s,t[6][5]={{"a","b","c","d","e"},{"f","g","h","i","j"},{"k","l","m","n","o"},{"p","q","r","s","t"},{"u","v","w","x","y"},{"z",".","?","!"," "}};
  bool f;
  while(cin >> s){
    f=true;
    if(s.size()%2){
      cout << "NA\n";
      continue;
    }
    for(int i=0;i<s.size();i++){
      if(i%2==0){
        if((int)s[i]>54){
          cout << "NA\n";
          f=false;
        }
      }else{
        if((int)s[i]>53){
          cout << "NA\n";
          f=false;
        }
      }
      if((int)s[i]<49 and f){
        cout << "NA\n";
        f=false;
      }
      if(!f)break;
    }
    if(!f)continue;
    for(int i=0;i<s.size();i+=2){
      cout << t[(int)s[i]-49][(int)s[i+1]-49];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
long long modpow(int n, int r) {
    long long ret = 1; long long tmp = (long long) n;
    while (r != 0) {
        if (r % 2) ret *= tmp;
        tmp *= tmp; tmp %= mod; ret %= mod;
        r /= 2;
    }
    return ret;
}
int main() {
    string s; cin >> s;
    long long ans = 0;
    int n = s.size();
    long long tmp = 1;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '1') {
            ans += tmp * modpow(3, (n - i - 1));
            ans %= mod;
            tmp = tmp * 2 % mod;
        }
        //cout << i << " " << ans << endl;
    }
    ans = (ans + tmp) % mod;
    cout << ans << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7

using ar3 = array<int, 3>;

ld comb(ll l, ll r) {
	ld res = 1;
	REP(i, r) {
		res *= l - i;
		res /= i + 1;
	}
	return res;
}

// [person][rest-number] -> prob
vector<vector<ld>> calc_prob_table(const vector<ar3>& info, const int M) {
	const int N = info.size();
	vector<vector<ld>> res(N, vector<ld>(M + 1));
	REP(i, N)REP(j, M + 1) {
		ld rest = info[i][0];
		res[i][j] = comb(M, j)*powl(rest / 100., j)*powl(1 - rest / 100., M - j);
	}
	//REP(i, N)REP(j, M - 1)res[i][j + 1] += res[i][j];
	return res;
}

ld lose_prob(const vector<ld>& prob, ar3 info, ld time, const ld L) {
	const int M = prob.size();
	time -= L / info[2];
	if (info[1] == 0) {
		time = INF * (time >= 0 ? 1 : -1);
	}
	else {
		time /= (ld)info[1];
	}

	ld res = 0;
	REP(i, min(time + 1e-5, (ld)M)) {
		res += prob[i];
	}
	return 1 - res;
}

int main()
{
	int N, M, L;
	cin >> N >> M >> L;
	vector<ar3> info(N);
	REP(i, N)REP(j, 3)cin >> info[i][j];

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

	auto table = calc_prob_table(info, M);
	REP(i, N) {
		ld res = 0;
		REP(rest, M + 1) {
			if (info[i][2] == 0)break;
			ld tres = table[i][rest];
			ld time = (ld)L / info[i][2] + info[i][1] * rest;
			REP(opp, N)if (opp != i && info[opp][2] != 0) {
				tres *= lose_prob(table[opp], info[opp], time, L);
			}
			res += tres;
		}
		cout << fixed << setprecision(10) << res << endl;
	}

	return 0;
}



Measured memory_bytes: 3544
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var input = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var N = input[0];
        var M = input[1];

        var A = Console.ReadLine().Split().Select(long.Parse).ToArray();
        Array.Sort(A);
        Array.Reverse(A);

        while (M > 0)
        {
            A[0] /= 2;
            M--;
            if (M == 0)
            {
                break;
            }
            for (int i = 1; i < N; i++)
            {
                if (A[0] > A[i])
                {
                    Array.Sort(A);
                    Array.Reverse(A);
                    break;
                }
                A[i] /= 2;
                M--;
                if (M == 0)
                {
                    break;
                }
            }
        }
        Console.WriteLine(A.Sum());
    }
}


Measured memory_bytes: 31580
#include<stdio.h>
#include<string.h>

#define M 1000000/* your task*/
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
    if ( ch == 'A') return 1;
    else if ( ch == 'C') return 2;
    else if ( ch == 'G') return 3;
    else if ( ch == 'T') return 4;
    else return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
    long long sum = 0, p = 1, i;
    for ( i = 0; i < strlen(str); i++ ){
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key){ return key%M/* your task */; }
int h2(int key){ return 1+(key%(M-1))/* your task */; }

int find(char str[]){
    
    /* your task */
    int i,key,h;
    key=getKey(str);
    for(i=0;;i++){
        h=(h1(key)+i * h2(key)) %M;
        if(strcmp(H[h],str)==0) return 1;
        else if (strlen(H[h]) == 0) return 0;
    }
    return 0;
    
}

int insert(char str[]){
    
    /* your task */
    int key,i,h;
    key=getKey(str);
    for(i=0;;i++){
        h=(h1(key) + i * h2(key)) % M;
        if(strcmp(H[h], str)==0)return 1;
        else if(strlen(H[h]) ==0){
            strcpy(H[h], str);
            return 0;
        }
    }
    return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
        scanf("%s %s", com, str);
        
        if ( com[0] == 'i' ){
            insert(str);
        } else {
            if (find(str)){
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 15412
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<pair<int, int>> X(N);
	for (int i = 0; i < N; ++i) {
		cin >> X[i].first;
		X[i].second = i;
	}
	sort(X.begin(), X.end());
	vector<int> ans(N);
	for (int i = 0; i < N; ++i) {
		if (i < N / 2) {
			ans[X[i].second] = X[N / 2].first;
		}
		else {
			ans[X[i].second] = X[N / 2 - 1].first;
		}
	}

	for (auto m : ans) {
		cout << m << endl;
	}
}


Measured memory_bytes: 4480
#include<cstdio>
using namespace std;
typedef long long ll;

ll n, w[4000], sum[4001], dp[4001][4001], INF = 1000000000000000, temp[4001][4001];

int main() {
  scanf("%lld", &n);
  for (ll i = 0; i < n; i++) scanf("%lld", &w[i]), sum[i] = w[i] + (i > 0 ? sum[i-1] : 0);
  for (ll len = 2; len <= n; len++) {
    for (ll i = 0, j = len; j <= n; i++, j++) {
      ll w = sum[j-1] - (i > 0 ? sum[i-1] : 0);
      if (len == 2) {
        dp[i][j] = w;
        temp[i][j] = i+1;
        continue;
      }
      dp[i][j] = INF;
      //for (ll x = i+1; x < j; x++) {
      for (ll x = temp[i][j-1]; x <= temp[i+1][j]; x++) {
        if (dp[i][j] > dp[i][x] + dp[x][j] + w) {
          dp[i][j] = dp[i][x] + dp[x][j] + w;
          temp[i][j] = x;
        }
      }
    }
  }
  printf("%lld\n", dp[0][n]);
}



Measured memory_bytes: 157668
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 int n;
 string s;
 set<string> x;
 cin >> n;
 while(n--)
 {
  cin >> s;
  x.insert(s);
 }
 cout << x.size();
 return 0;
}

Measured memory_bytes: 19180
package main

import (
	"bufio"
	"os"
	"strconv"
	"strings"
	"fmt"
	"bytes"
)

type node struct {
	prev, next *node
	key int
}

var dummy = &node{}

func initNode() {
	dummy.prev = dummy
	dummy.next = dummy
}

func insert(key int) {
	newNode := &node{key: key}
	newNode.next = dummy.next
	dummy.next.prev = newNode
	dummy.next = newNode
	newNode.prev = dummy
}

func search(key int) *node {
	current := dummy.next
	for current.key != key {
		if current == dummy {
			return nil
		}
		current = current.next
	}
	return current
}

func deleteNode(n *node) {
	if n == nil {
		return
	}
	n.prev.next = n.next
	n.next.prev = n.prev
	n = nil
}

func deleteFirst() {
	deleteNode(dummy.next)
}

func deleteLast() {
	deleteNode(dummy.prev)
}

func printList() string {
	buf := bytes.Buffer{}
	current := dummy.next
	for {
		buf.WriteString(strconv.Itoa(current.key))
		current = current.next
		if current == dummy {
			break
		}
		buf.WriteString(" ")
	}
	return buf.String()
}

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Scan()
	str := scanner.Text()
	n, _ := strconv.Atoi(str)
	initNode()
	for i := 0;i < n; i++ {
		scanner.Scan()
		str := strings.Split(scanner.Text(), " ")
		command := str[0]
		switch command {
		case "insert":
			key, _ := strconv.Atoi(str[1])
			insert(key)
		case "delete":
			key, _ := strconv.Atoi(str[1])
			if target := search(key); target != nil {
				deleteNode(target)
			}
		case "deleteFirst":
			deleteFirst()
		case "deleteLast":
			deleteLast()
		default:
			fmt.Println("specify the command form the following list: \"insert <key>\", \"delete <key>\", \"deleteFirst\", \"deleteLast\"")
			os.Exit(1)
		}
	}
	fmt.Println(printList())
}


Measured memory_bytes: 66332
#include <bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vvl = vector<vl>;

const ll MAX_VAL = 1e9;
int H, W, h, w;
vvl ans;

void update(int y, int x, int val) {
    for (int i = y; i < H; i += h) {
        for (int j = x; j < W; j += w) {
            ans[i][j] = val;
        }
    }
}

void output() {
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            cout << ans[i][j] << " \n"[j==W-1];
        }
    }
}

int main() {
    cin >> H >> W >> h >> w;

    bool ng = false;
    ng |= (h == 1 and w == 1);
    ng |= (h == 1 and W % w == 0);
    ng |= (H % h == 0 and w == 1);
    ng |= (H % h == 0 and W % w == 0);

    if (ng) {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    ans.assign(H, vl(W, 0));
    update(0, 0, MAX_VAL-1);
    update(h-1, w-1, -MAX_VAL);
    
    output();
    return 0;
}


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

int main(){
  int n, x;
  cin >> n >> x;
  vector<int> m(n);
  int used = 0;
  for(int i = 0; i < n; i++){
    cin >> m[i];
    used += m[i];
  }    
  int rest = x - used;
  int min = m[0];
  for(int i = 0; i < n; i++){
    if(min > m[i]) min = m[i];
  }
  cout << n + rest / min << endl;
  return  0;
}

Measured memory_bytes: 3604
import sys
def input():
	return sys.stdin.buffer.readline()[:-1]

n, q = map(int, input().split())
ans = (n-2) * (n-2)
v, h = [(n, n)], [(n, n)]
for _ in range(q):
	k, x = map(int, input().split())
	if k == 1:
		l, r = 0, len(h)
		while r-l > 1:
			m = (l + r) //2
			if h[m][0] >= x:
				l = m
			else:
				r = m
		ans -= h[l][1] - 2
		#print(h[l][1] - 1)
		if x < v[-1][1]:
			v.append((h[l][1] - 1, x))

	else:
		l, r = 0, len(v)
		while r-l > 1:
			m = (l + r) //2
			if v[m][0] >= x:
				l = m
			else:
				r = m
		ans -= v[l][1] - 2
		#print(v[l][1] - 1)
		if x < h[-1][1]:
			h.append((v[l][1] - 1, x))

print(ans)

Measured memory_bytes: 81328
#include <bits/stdc++.h>
// #include <math.h>
// #include <cmath>
// #include <vector>
// #include <utility> 
// #include <unordered_map>
// #include <map>
// #include <string>

using namespace std;
typedef long long int lli;

#define M_PI_H  3.14159265358979323846/2  /* pi by two*/
#define rep(i, start, end) for(int i = start; i < end; i++) 
#define repr(i, start, end) for(int i = start; i >= end; i--)   //INCLUSIVE



int main() 
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
	
	int a[5];
	rep(i, 0, 5){
		cin>>a[i];
	}

	rep(i, 0, 5){
		if(a[i] == 0) cout<<i+1;
	}

    return 0;
}

Measured memory_bytes: 3600
S = input()

res = []
if len(S) % 2 == 1:
    print('No')
else:
    for i in range(len(S)//2):
        if i % 2 == 0:
            res.append(S[2*i:2*(i+1)])
    ans = set(res)
    
    if ans == {'hi'}:
        print('Yes')
    else:
        print('No')

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

signed main()
{
     string s;
     cin >> s;
     int n = s.size();
     int ans = n;
     for (int i = 0; i < n - 1; ++i) {
          if (s[i] != s[i + 1]) {
               ans = min(ans, max(i + 1, n - i - 1));
          }
     }
     cout << ans;
     return 0;
}


Measured memory_bytes: 512
let N = Int(readLine()!)!
let a = readLine()!.characters.split(" ").map{Int(String($0))!}
var A = [Int : Int]()
var ans = 0
for i in a {
    if let _ = A[i] {
        A[i]! += 1
    } else {
        A[i] = 1
    }
}
for (i, j) in A {
    if i > j {
        ans += j
    } else {
        ans += j - i
    }
}
print(ans)

Measured memory_bytes: 7748
import java.util.Scanner;

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

        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int H = scanner.nextInt();
        int M = scanner.nextInt();
        double degree = calculateAngle(H, M);
        double side = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(Math.toRadians(degree)));
        System.out.println(side);
    }

    static double calculateAngle(double h, double m) {
        double hour_angle = (0.5 * (h * 60 + m));
        double minute_angle = (6 * m);
        double angle = Math.abs(hour_angle - minute_angle);
        angle = Math.min(360 - angle, angle);
        return angle;
    }
}

Measured memory_bytes: 27136
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define all(v) v.begin(),v.end()
#define sz size()
#define mp make_pair
#define pb push_back
#define rep(p,a,b) for(ll p=a ; p<b ; p++)
#define rap(p,a,b) for(ll p=a ; p<=b ; p++)
#define per(p,a,b) for(ll p=a ; p>=b ; p--)
#define F first
#define S second
using namespace std;

typedef vector <ll> vll;
typedef vector <ld> vld;
typedef pair< ll ,ll > pll;

vll a(10004),b(10004),dp(10004,1e8+7);
ll n,ma=1e9;


int main()
{
    ll t,i,j,k,ans,h;

    //cin>>t;
    t=1;
    while(t--)
    {
        cin>>h>>n;
        rep(p,0,n)cin>>a[p]>>b[p];

        dp[0] = 0;
        rep(p,1,h+1)
        {
            rep(q,0,n)
            {
                ll tmp = p-a[q];
                if(tmp<0)tmp=0;
                dp[p] = min(dp[p],dp[tmp]+b[q]);
            }
        }

        cout<<dp[h];
    }
    
    return 0;
}

Measured memory_bytes: 3832
#include <stdio.h>

int main(void)
{
	int x, y;
	int i;
	int r;
	
	scanf("%d %d", &x, &y);
	
	if (x < y){
		i = x;
		x = y;
		y = i;
	}
	
	r = x % y;
	while (r != 0){
		x = y;
		y = r;
		r = x % y;
	}
	
	printf("%d\n", y);
	
	return (0);
}

Measured memory_bytes: 592
#include<stdio.h>
#include<string.h>
int main(){
	
	char S[15];
	char T[15];
	char U[15];
	
	int A;
	int B;
	
	scanf("%s %s",S,T);
	
	scanf("%d %d",&A,&B);
	
	scanf("%s",U);
	
	
	if(strcmp(U,S)==0){
		printf("%d %d\n",A-1,B);
	}
	else if(strcmp(U,T)==0){
		printf("%d %d\n",A,B-1);
	}
	
	return 0;
	
	
	
	
	
	
	
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define pr printf
#define sc scanf

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef long double ld;
int n, k;
int li[500];
vector<int> divisors;

int main () {
    sc("%d %d", &n, &k);
    int s = 0;
    for(int i = 0; i < n; i++) {
        sc("%d", li+i);
        s += li[i];
    }
    for(int i = 1; i*i <= s; i++) {
        if(s % i == 0) {
            divisors.push_back(i);
            if(i*i != n) divisors.push_back(s/i);
        }
    }
    
    int r = 1;
    for( int d: divisors) {
        int s2 = 0;
        vector<int> v;
        for(int i = 0; i < n; i++) {
            s2 += li[i] % d;
            v.push_back(li[i] % d);
        }
        sort(v.begin(), v.end());
        int c = (s2/d);
        //pr("s2: %d d: %d c: %d\n", s2, d, c);
        int res = 0;
        
        for(int i = 0; i+c < n; i++) {
            res += v[i];
        }
        //pr("res: %d\n", res);
        if (res <= k) r = max(r, d);
    }
    pr("%d\n", r);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int[] c = new int[n], s = new int[n], f = new int[n];
			IntStream.range(0, n - 1).forEach(i -> {
				c[i] = scanner.nextInt();
				s[i] = scanner.nextInt();
				f[i] = scanner.nextInt();
			});
			IntStream.range(0, n).map(i -> getResult(i, n, 0, c, s, f)).forEach(System.out::println);
		}
	}

	/**
	 * index番目の駅から出発するときの終点までの運行開始からの所要時間を計算
	 * 
	 * @param index     出発駅
	 * @param n         駅の総数
	 * @param startTime 出発時間
	 * @param c
	 * @param s
	 * @param f
	 * @return index番目の駅から出発するときの終点までの運行開始からの所要時間
	 */
	private static int getResult(int index, int n, int startTime, final int[] c, final int[] s, final int[] f) {
		if (index >= n - 1) {
			return startTime;
		}
		return getResult(index + 1, n, Math.max((startTime + f[index] - 1) / f[index] * f[index], s[index]) + c[index],
				c, s, f);
	}
}


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

#define what_is(x)    cerr<<#x<<" is "<<x<<"\n";
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    int a,b; cin>>a>>b;
    if((a+b)%2){
        cout<<"IMPOSSIBLE";
        return 0;
    }
    cout<<(a+b)/2;
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 256
function main(input) {
  const n = parseInt(input[0]);
  
  let ans = Array(n).fill(0);

  const m =parseInt(n**(0.5));

  for(let x=1;x<m;x++){
    for(let y=1;y<m;y++){
      for(let z=1;z<m;z++){
        const num = x*x+y*y+z*z+x*y+y*z+z*x;
        if((num<=n)&&(num>0)){
          ans[num-1]++;
        }
      }
    }
  }
  for(let i=0;i<n;i++){
    console.log(ans[i]);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

Measured memory_bytes: 37264
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>

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-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
//#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;


void solve() {
	int N, L; cin >> N >> L;
	vector<string>v(N);
	REP(i, N)cin >> v[i];
	VSORT(v);
	REP(i, N) {
		cout << v[i];
	}cout << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int i,j,k,n=0,x,y,z;
	cin>>x>>y>>z;
	x-=z;
	y+=z;
	while(x>=y){
		x-=y;
		n++;
	}
	cout<<n<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

pii gcd(int a,int b)
{
	if(b==0)
		return pii(a,0);
	pii res=gcd(b,a%b);
	res.second++;
	return res;
}

int main()
{
	for(int a,b;cin>>a>>b,a|b;){
		pii res=gcd(max(a,b),min(a,b));
		cout<<res.first<<" "<<res.second<<endl;
	}
	
	return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
#define N 1000000007 // prime modulo value 

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	5e5;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

vll adj[MAXN];ll vis[MAXN]={};
/*
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
*/
// <------------- Declare Variables Here ------------> //



ll T = 1;
ll n, x, k, m, r, sum = 0, a, b;
string s;

// <------------- Implement Functions Here ----------> //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin  >> a >> b;
	ll cou = 0;
	while(a <= b) {
		cou++;
		a*=2;
	}
	cout<<cou;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 15336
// ARC060-A 高橋君のカード

#include <bits/stdc++.h>
using namespace std;

long long dp[55][55][3005] = {}; // [ここまで見た][選んだ個数][総和]

signed main() {
    int n, a, x[55];
    long long ans;

    cin >> n >> a;
    for(int i = 0; i < n; i++ ) {
        cin >> x[i];
    }

    dp[0][0][0] = 1;
    for(int i = 0; i < n; i++ ) {
        for(int j = 0; j < n; j++ ) {
            for(int k = 0; k <= i * 50; k++ ) {
                dp[i+1][j][k] += dp[i][j][k];

                dp[i+1][j+1][k+x[i]] += dp[i][j][k];
            }
        }
    }

    ans = 0;
    for(int j = 1; j <= n ;j++ ) {
        ans += dp[n][j][j*a];
    }

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

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

using namespace std;


int main() {
	int N;
	cin >> N;
	vector<long long int>D( 3 * N );
	for( size_t i = 0; i < 3 * N; i++ ) {
		cin >> D[i];
	}
	vector<pair<long long int, long long int>>dp( N + 1 );
	{
		priority_queue<long long int, vector<long long int>, greater<long long int>>que;
		long long int sum = 0;
		for( size_t i = 0; i < N; i++ ) {
			que.push( D[i] );
			sum += D[i];
		}
		dp[0].first = sum;
		for( size_t i = N; i < N * 2; i++ ) {
			que.push( D[i] );
			auto now = que.top(); que.pop();
			sum -= now;
			sum += D[i];
			dp[i - N + 1].first = sum;
		}
	}

	{
		priority_queue<long long int, vector<long long int>>que;
		long long int sum = 0;
		for( size_t i = 2 * N; i < 3 * N; i++ ) {
			que.push( D[i] );
			sum += D[i];
		}
		dp[N].second = sum;
		for( size_t i = 2 * N - 1; i >= N; i-- ) {
			que.push( D[i] );
			auto now = que.top(); que.pop();
			sum -= now;
			sum += D[i];
			dp[i - N].second = sum;
		}
	}
	long long int ans = LLONG_MIN;
	for( size_t i = 0; i < N + 1; i++ ) {
		//cout << dp[i].first << " " << dp[i].second << endl;
		ans = max( ans, dp[i].first - dp[i].second );
	}
	cout << ans << endl;

}

Measured memory_bytes: 5992
from collections import defaultdict

class Unionfindtree:
    def __init__(self,number):
        self.par = [i for i in range(number)]
        self.rank = [0]*(number)

    def find(self,x):#親を探す
        if self.par[x] ==x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self,x,y):#x,yを繋げる
        px = self.find(x)
        py = self.find(y)
        if px == py:
            return 
        if self.rank[px]<self.rank[py]:
            self.par[px]=py
        else:
            self.par[py]=px
        if self.rank[px]==self.rank[py]:
            self.rank[px] +=1
    
    def connect(self,x,y):#親が同じかみる
        return self.find(x)==self.find(y)

N,K,L = map(int,input().split())
load = Unionfindtree(N)
train = Unionfindtree(N)
for i in range(K):
    a,b = map(int,input().split())
    load.union(a-1,b-1)
for i in range(L):
    a,b = map(int,input().split())
    train.union(a-1,b-1)

ar = [(load.find(i),train.find(i)) for i in range(N)]

dd = defaultdict(int)
for s in ar:
    dd[s] += 1
ans =[]
for i in range(N):
    ans.append(dd[ar[i]])
print(' '.join(map(str, ans)))

Measured memory_bytes: 66936
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val list = Array(N) {
        readLine()!!.split(" ").map(String::toInt)
    }

    val dp = Array(N + 1) { Array(3) { 0 } }

    for (i in 0 until N) {
        for (j in 0 until 3) {
            for (k in 0 until 3) {
                if (j == k) {
                    continue
                }
                dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][k] + list[i][j])
            }
        }
    }

    println(dp[N].max())
}


Measured memory_bytes: 97280
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<vector>
#define inf 2147483647
#define cin1(x) scanf("%d",&x)
#define cin2(x,y) scanf("%d%d",&x,&y)
#define cin3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repb(i,a,b) for(int i=a;i<=b;i++)
#define rr read()
#define ll long long
#define CloseIo ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll  long long 
using namespace std;
const int N = 1e5 + 5;
int a[N];
int main() {
	rep(i,0,N)
		a[i]=1;
	string s;
	cin>>s;
	rep(i,0,s.length()){
		int j=i;
		if(s[i]=='R'){
			while(s[i+1]=='R'){
				a[i]=0;
				i++;
			}	
			int m=i-j;
			a[i]+=m/2;
			a[i+1]+=m/2+m%2;		
		}
		else{
			while(s[i+1]=='L'){
				a[i+1]=0;
				i++;
			}
			int m=i-j;
			a[j]+=m/2;
			a[j-1]+=m/2+m%2;
		}	
	}
	rep(i,0,s.length()){
		if(i)
			cout<<" ";
		cout<<a[i];
	}
	cout<<"\n";
    return 0;
}

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

using namespace std;

int main(){
    string s;
    int cnt = 0;
    char c;

    cin >> s;

    c = s[0];
    for(int i = 1;i< s.size();i++){
        if(s[i] != c){
            cnt++;
            c = s[i];
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 512
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = List.range n `To m
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list sep conv);
  arr

let rec powerset e =
  match Enum.get e with
  | None -> Enum.singleton @@ Enum.empty ()
  | Some v ->
    let f = powerset e in
    let g = Enum.clone f in
    EnumL.map f ~f:(fun x -> let y = Enum.clone x in push y v; y)
    |>  Enum.append g

let permutations l =
  let rec aux l =
    let rec interleave x = function
      | [] -> [[x]]
      | (hd::tl) as lst ->
        (x::lst) ::
        (ListL.map ~f:(List.cons hd)  @@ interleave x tl)
    in
    match l with
    | [] -> [[]]
    | hd::tl -> List.concat @@ List.map (interleave hd) @@ aux tl in
  let l = List.sort (List.compare Int.compare) @@ aux @@ List.of_enum l in
  List.enum % ListL.map ~f:List.enum @@ l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let n = scan "%d" id
let mat = scan_matrix ~sep:' ' n n 0 Int.of_string
let mat2 = Array.make_matrix n n true

let check () =
  ListL.map (0 ++^ n) ~f:(fun k ->
      ListL.map (0 ++^ n) ~f:(fun i ->
          ListL.map (0 ++^ n) ~f:(fun j ->
              if i <> k && k <> j &&
                 mat.(i).(j) = mat.(i).(k) + mat.(k).(j) then
                mat2.(i).(j) <- false;
              if mat.(i).(j) > mat.(i).(k) + mat.(k).(j) then -1
              else mat.(i).(j)
            ) |> List.min
        ) |> List.min
    ) |> List.min
  |> (fun v -> v = -1)

let () =
  if check () then Printf.printf "-1\n"
  else
    (ArrayL.mapi mat2 ~f:(fun i a ->
         ArrayL.mapi a ~f:(fun j v ->
             if v then mat.(i).(j)
             else 0
           ) |> Array.sum
       ) |> Array.sum
     |> (fun v -> Printf.printf "%d\n" (v/2)))


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

int main(){
  int N;
  cin >> N;
  int a;
  vector<int> rate(9);
  int min = 0;
  int max;

  for(int i = 0; i < N; i++){
    cin >> a;
    if(a < 3200){
      rate.at(a / 400)++;
    }
    else{
      rate.at(8)++;
    }
  }

  for(int i = 0; i < 8; i++){
    if(rate.at(i)){
      min++;
    }
  }

  max = min + rate.at(8);

  cout << (min==0?1:min) << " " << max << endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
int main(int argc, char *argv[]) {
  int N, x;
  std::cin >> N >> x;
  int a[101];
  for (int i = 0; i < N; ++i)
    std::cin >> a[i];

  std::sort(a, a + N);
  int sum = 0, count = 0;
  for (int i = 0; i < N; ++i) {
    sum += a[i];
    ++count;
    if (x < sum) {
      --count;
      break;
    }
  }
  if (x > sum)
    --count;
  std::cout << count << std::endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int N=2e5+10;
int main()
{
	int n;
	cin>>n;
	n%=10;
	if(n==2||n==4||n==5||n==7||n==9)
		printf("hon\n");
	else if(n==1||n==0||n==6||n==8)
		printf("pon\n");
	else 
		printf("bon\n"); 
	return 0;
}

Measured memory_bytes: 3628
import numpy as np
import sys
input = sys.stdin.readline
def main():
    n = int(input())
    A = np.array([list(input().rstrip()) for _ in range(n)], dtype='str')
    ans = 0
    for i in range(n):
        B = np.block([A[:, i:], A[:, :i]])
        if (B == B.T).all():
            ans += n
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 28244
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m;
  if(m*2-1<=n) cout<<"YES"<<endl;
  else if(n<m) cout<<"NO"<<endl;
  else if(m==1) cout<<"YES"<<endl;
  else if(n == 2 and m == 2) cout<<"NO"<<endl;
  // else if(, * 2 - 1>= m) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

}

int main(){
  solve();
  return 0;
}


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

//#define rep(i, s, n) for(int i=(s);i<(int)n;i++)
//int INF=1e9+7;

int main() {
  int64_t X, a=100;
  cin >> X;
  int s=0;
  while(a<X) {
    a*=1.01;
    s++;
  }
  cout << s << endl;
}

Measured memory_bytes: 3624
using System;

namespace Sample1
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            double a = double.Parse(input.Split(' ')[0]);
            Console.WriteLine("{1} {0}",
                (2 * a * Math.PI).ToString("F6"),
                (a * a * Math.PI).ToString("F6"));
        }
    }
}

Measured memory_bytes: 9204
import math
n, d = map(int, input().split())
x = [list(map(int,input().split())) for i in range(n)]
count = 0

for i in range(n):
    for j in range(i+1, n):
        a = 0
        for k in range(d):
            a += pow(x[i][k]- x[j][k], 2)
            
        a = math.sqrt(a)
        b = int(a)
        if a == b:
            count += 1

print(count)

Measured memory_bytes: 62548
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	ll n, c; cin >> n >> c;
	ll po[(ll)1e5 * 2 + 100][c];
	for(ll i = 0; i < 1e5 * 2 + 100; ++i)for(ll j = 0; j < c; ++j) po[i][j] = 0;
	for(ll i = 0; i < n; ++i){
		ll s, t, c; cin >> s >> t >> c;
		po[s * 2 - 1][--c] = 1;
		po[t * 2][c] = -1;
	}
	for(ll i = 1; i < 1e5 * 2 + 100; ++i)for(ll j = 0; j < c; ++j) if(po[i - 1][j] == 1 && po[i][j] == -1) po[i][j] = 0;
	for(ll i = 1; i < 1e5 * 2 + 100; ++i)for(ll j = 0; j < c; ++j){
		po[i][j] += po[i - 1][j];
		po[i][j] = min<ll>(po[i][j], 1);
		po[i][j] = max<ll>(po[i][j], 0);
	}
	ll yo[(ll)1e5 * 2 + 100] = {};
	for(ll i = 0; i < 1e5 * 2 + 100; ++i)for(ll j = 0; j < c; ++j) yo[i] += po[i][j];
	ll ans = 0;
	for(ll i = 0; i < 1e5 * 2 + 100; ++i){
		ans = max<ll>(ans, yo[i]);
	}
	cout << max<ll>(ans, 0) << endl;
	return 0;
}

Measured memory_bytes: 48768
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DEBUG_OUTPUT_ENABLED 1
	#define DBG(X) dout << #X << "=" << (X) << '\n';
	#define SAY(X) dout << (X) << '\n';
#else
	#define DEBUG_OUTPUT_ENABLED 0
	#define DBG(X) 42;
	#define SAY(X) 42;
#endif

#define dout   ___debug::instance

using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const multiset<T>& v) { for(auto el: v) cout << el << " "; return os; }
namespace ___debug {
	struct DebugStream {
		private:
			bool is_first;
		public:
			DebugStream(bool _is_first): is_first(_is_first) {}
			template<typename T> DebugStream operator<<(const T& value) const {
				assert(DEBUG_OUTPUT_ENABLED);
				if(is_first) cout << "[DBG] ";
				cout << value;
				return DebugStream(false);
			};

			template<typename T> DebugStream printArray(T* l, T* r) {
				assert(DEBUG_OUTPUT_ENABLED);
				if(is_first) cout << "[DBG] ";
				while(l != r) {
					cout << (*l);
					++l;
					if(l == r) {
						cout << '\n';
					} else {
						cout << ' ';
					}
				}
				return DebugStream(false);
			}
	};
	DebugStream instance(true);
};

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

void solve() {
	ll A = fetch<ll>();
	ll B = fetch<ll>();
	ll N = fetch<ll>();
	cout << (A * min(B - 1, N)) / B << '\n';
}

int main() {
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main(){
    int n,t,a;
    cin >> n >> t >> a;
    int h[n];
    rep(i,n)cin >> h[i];

    int ans;
    double x=0,b = INF;

    for(int i=0;i<n;i++){
        double tem = t -h[i] * 0.006;
        x = abs(a-tem);
        if(x<b){
            b=x;
            ans = i+1;
        }
    }

    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 3588
# 1
# https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_a
if False:
    N,K=map(int,input().split())
    print('YES' if N-K-(K-1)>=0 else 'NO')

# 2
# https://atcoder.jp/contests/exawizards2019/tasks/exawizards2019_b
if False:
    N=int(input())
    S=input()
    print('Yes' if S.count('R')>S.count('B') else 'No')

# 3
# https://atcoder.jp/contests/exawizards2019/tasks/exawizards2019_a
if False:
    print('Yes' if len(set(input().split()))==1 else 'No')

# 4
# https://atcoder.jp/contests/tenka1-2019-beginner/tasks/tenka1_2019_b
if True:
    N=int(input())
    S=input()
    K=int(input())
    r=S[K-1]
    ans=''
    for s in S:
        if s==r: ans+=s
        else: ans+='*'
    print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;

int main()
{
	vector<char>s(4);
	for (int i = 0; i < 4; i++)cin >> s[i];
	sort(s.begin(), s.end());
	cout << (s[0] == s[1] && s[2] == s[3] && s[0] != s[2] ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256