akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll a[1005];
vector<ll>v;
int main()
{
    ll n, cnt = 0;
    cin >> n;
    for(ll i = 0; i < n; i ++)
    {
        cin >> a[i];
    }
    for(ll i = 0; i < n; i ++)
    {
        v.pb(i + 1);
    }
    for(ll i = 0; i < n; i ++)
    {
        if(a[i] != v[i])
        {
            cnt ++;
        }
    }
    if(cnt == 2 or cnt == 0)
    {
        cout << "YES";
        return 0;
    }
    cout << "NO";
}


Measured memory_bytes: 256
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
#define min(x,y) (x < y ? x : y)
#define max(x,y) (x < y ? y : x)
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "YES"; } string_type do_falsename() const { return "NO"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

void solve() {
  vector<ll> v(4); cin >> v;
  sort(all(v));
  cout << (v == vector<ll>{1, 4, 7, 9}) << endl;
}


Measured memory_bytes: 764
import numpy as np
N = int(input())
v = list(map(int,input().split()))
v.sort()
x = np.zeros(N,dtype = "float64")
for i in range (0,N):
  x[i] = v[i]

for i in range (0,N-1):
  x[i+1] = (x[i] + x[i+1]) / 2
print(x[N-1])

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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

int five(ll n) { return n * n * n * n * n; }

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

  ll x;
  cin >> x;
  bool can = false;
  for (ll i = -118; i <= 119; i++) {
    for (ll j = -118; j <= 119; j++) {
      if (i - j != 0 && x % (i - j) == 0) {
        if (five(i) - five(j) == x) {
          cout << i << " " << j << "\n";
          can = true;
          break;
        }
      }
    }
    if (can) {
      break;
    }
  }
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> vec(N + 1, 0);
	for(int i = 0; i < N; i++)
	{
		int a;
		cin >> a;
		vec[a]++;
	}
	sort(vec.begin(), vec.end());
	reverse(vec.begin(), vec.end());
	int sum = 0;
	for(int i = 0; i < K; i++)
	{
		sum += vec[i];
	}
	cout << N - sum << endl;
	return 0;
}



Measured memory_bytes: 1024
n = int(input())
R = [0, 0, 0, 0]
for i in range(n):
    s = input()
    if s == "AC":
        R[0] += 1
    elif s == "WA":
        R[1] += 1
    elif s == "TLE":
        R[2] += 1
    else:
        R[3] += 1
print("AC x",R[0])
print("WA x",R[1])
print("TLE x",R[2])
print("RE x",R[3])

Measured memory_bytes: 9224
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, k int
	fmt.Fscan(r, &n)
	fmt.Fscan(r, &k)

	mp := make(map[int]int)
	var d, a int
	for i := 0; i < k; i++ {
		fmt.Fscan(r, &d)
		for j := 0; j < d; j++ {
			fmt.Fscan(r, &a)
			mp[a]++
		}
	}

	fmt.Println(n - len(mp))
}

// Union-Find
type unionFind struct {
	d []int
}

func newUnionFind(n int) *unionFind {
	uf := new(unionFind)
	uf.d = make([]int, n)
	for i := 0; i < n; i++ {
		uf.d[i] = -1
	}
	return uf
}

func (uf *unionFind) find(x int) int {
	if uf.d[x] < 0 {
		return x
	}
	uf.d[x] = uf.find(uf.d[x])
	return uf.d[x]
}

func (uf *unionFind) unite(x, y int) bool {
	rootX := uf.find(x)
	rootY := uf.find(y)
	if rootX == rootY {
		return false
	}

	if uf.d[rootX] < uf.d[rootY] {
		uf.d[rootX] += uf.d[rootY]
		uf.d[rootY] = rootX
	} else {
		uf.d[rootY] += uf.d[rootX]
		uf.d[rootX] = rootY
	}

	return true
}

func (uf *unionFind) same(x, y int) bool {
	return uf.find(x) == uf.find(y)
}

func (uf *unionFind) size(x int) int {
	return -uf.d[uf.find(x)]
}

// mod combination
func modpow(a, n, mod int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % mod
		}
		a = a * a % mod
		n = n / 2
	}
	return res
}

func modcomb(n, a, mod int) int {
	x := 1
	y := 1
	for i := 0; i < a; i++ {
		x = x * (n - i)
		x %= mod
		y = y * (i + 1)
		y %= mod
	}
	return x * modpow(y, mod-2, mod) % mod
}

func modfactorial(n, mod int) int {
	result := 1
	for i := 1; i <= n; i++ {
		result = (result * i) % mod
	}
	return result
}

// Utility

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func primeFactor(x int) map[int]int {
	res := make(map[int]int)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			res[i]++
			x = x / i
		}
	}
	if x != 1 {
		res[x] = 1
	}
	return res
}

func divisor(x int) []int {
	res := make([]int, 0)
	for i := 1; i*i <= x; i++ {
		if x%i == 0 {
			res = append(res, i)
			if i != x/i {
				res = append(res, x/i)
			}
		}
	}
	return res
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}

func reverseString(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

// Queue ...
type Queue []int

// pop ...
func (q *Queue) empty() bool {
	return len(*q) == 0
}

// push ...
func (q *Queue) push(i int) {
	*q = append(*q, i)
}

// pop ...
func (q *Queue) pop() (int, bool) {
	if q.empty() {
		return 0, false
	} else {
		res := (*q)[0]
		*q = (*q)[1:]
		return res, true
	}
}

// Stack ...
type Stack []int

// pop ...
func (s *Stack) empty() bool {
	return len(*s) == 0
}

// push ...
func (s *Stack) push(i int) {
	*s = append(*s, i)
}

// pop ...
func (s *Stack) pop() (int, bool) {
	if s.empty() {
		return 0, false
	} else {
		index := len(*s) - 1
		res := (*s)[index]
		*s = (*s)[:index]
		return res, true
	}
}


Measured memory_bytes: 1848
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
	int a,b,n,r,s;
	while(cin >> a >> b >> n) {
    r=a % b; s=0;
	for (n;n>0;n--) { r*=10; s+=r/b; r=r % b;}
	cout << s << endl;
	}
	return 0;
}

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

using namespace std;

string inde(string s){
	string ret;
	int c=0;
	for(auto x:s){
		if(x == '[') ret += '[';
		else if(x == ']') ret += ']';
		else if(x == '+') c++;
		else if(x == '-') c--;
		else if(x == '?'){
			ret += 'A';
			c = 0;
		} else {
			c %= 26;
			ret += (x - 'A' + c + 26)%26 + 'A';
			c = 0;
		}
	}
	return ret;
}

string rev(string s){
	int nest = 0;
	int start = 0;
	string ret;
	for(int i=0;i<s.size();i++){
		if(s[i] == '['){
			if(nest == 0) start = i+1;
			nest++;
		}
		else if(s[i] == ']'){
			nest--;
			if(nest == 0) {
				string rstr = rev(s.substr(start,i-start));
				ret += string(rstr.rbegin(),rstr.rend());
			}
		}
		else if(nest == 0){
			ret += s[i];
		}
	}
	return ret;
}

int main(){
	string s;
	while(cin >> s,s != "."){
		cout << rev(inde(s)) << endl;
	}
	
	return 0;
}


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

int INF;
int n;
vector<pair<int, int>> es[10000];

// sから各頂点への最短経路を求める
void dijkstra () {
  
  priority_queue<pair<int, int>> pq;
  int d[10000];

  // 0:未調査 1:調査中 2:調査完了
  int status[10000];

  for (int i = 0; i < n; i++) {
    d[i] = INF;
    status[i] = 0;
  }

  d[0] = 0;
  status[0] = 1;
  pq.push(make_pair(0,0));

  while (!pq.empty()) {

    pair<int, int> p = pq.top(); pq.pop();
    int u = p.second;
    status[u] = 2;

    // 最小値を取り出し、それが最短でなければ無視
    if (d[u] < p.first * (-1)) {
      continue;
    }
    
    for (int i = 0; i < es[u].size(); i++) {
      int v = es[u][i].first;
      if (status[v] == 2) {
        continue;
      }
      if (d[u] + es[u][i].second < d[v]) {
        d[v] = d[u] + es[u][i].second;
        // priority_queueはデフォルトで大きい順を優先するため-1を掛ける
        pq.push(make_pair(d[v] * (-1), v));
        status[v] = 1;
      }
    }
    
  }
  for (int i = 0; i < n; i++) {
    if (d[i] == INF) {
      cout << i << " -1" << endl;
    } else {
      cout << i << " " << d[i] << endl;
    } 
  }
}

int main() {
  
  cin >> n;

  INF = 20000000;

  // 入力を受け取る
  for (int i = 0; i < n; i++) {
    int u, k;
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      int v, c;
      cin >> v >> c;
      es[u].push_back(make_pair(v,c));
    }
  }

  // ダイクストラ法開始
  dijkstra();

  return 0;
}


Measured memory_bytes: 8000
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int ans = 0;
		int b = 1;

		ArrayList<Integer> list = new ArrayList();
		while (n > 0) {
		    list.add(n % 10);
		    n /= 10;
		}

		for (int i = 0; i < 3; i++){
			if (list.get(i) == 9){
				ans += 1 * b;
			}else if (list.get(i) == 1){
				ans += 9 * b;
			}
			b *= 10;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21716
#include <stdio.h>

int r, D, x;

int main(void){
        scanf("%d%d%d", &r, &D, &x);
        int i = 0;
        if(2<=r&&r<=5&&1<=D&&D<=100&&D<=x&&x<=200){
            while(i<10){
            x=r*x-D;
            printf("%d\n",x);
            i++;
        }
        }
    return 0;
}

Measured memory_bytes: 128
r, c = map(int, input().split())
listA = [[0] * (c+1) for i in range(r+1)]

for i in range(0, r):
    listnum = input().split()
    for j in range (0, c):
        s = 0
        listA[i][j]=listnum[j]
        for elem in listnum:
            s = s + int(elem)
    listA[i][c] = str(s)

for i in range(0,c+1):
    t = 0
    for j in range(0,r):
        t = t + int(listA[j][i])
    listA[r][i] = str(t)

for i in range(0, r+1):
    print(" ".join(listA[i]))


Measured memory_bytes: 5976
using System;
class p
{
  static void Main()
  {
    string s = Console.ReadLine();
    bool result = true;
    
    // Aチェック
    if (s[0] != 'A') {
      result = false;
    }
    // Cチェック
    int index = s.IndexOf("C");
    if (index < 2 || s.Length - 2 < index) {
      result = false;
    }
    // 小文字チェック
    for (int i = 1; i < s.Length; i++) {
      if (i == index) { continue; }
      if (Char.IsUpper(s[i])) {
        result = false;
        break;
      }
    }
    Console.WriteLine(result ? "AC" : "WA");
  }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using p = pair<int,int>;

int main() {
  string S;
  
  cin >> S;
  int a,b,c,d;
  a = S.at(0) - '0';
  b = S.at(1) - '0';
  c = S.at(2) - '0';
  d = S.at(3) - '0';
  
  string result_string = "";
  int result;
  for (int i = 0; i < (1 << 3); i++)
  {
    bitset<3> s(i);
    if (s.test(0))
    {
      result = a + b;
      result_string = to_string(a) + "+" + to_string(b); 
    }
    else
    {
      result = a - b;
      result_string = to_string(a) + "-" + to_string(b);
    }
    if (s.test(1))
    {
      result = result + c;
      result_string = result_string + "+" + to_string(c); 
    }
    else
    {
      result = result - c;
      result_string = result_string + "-" + to_string(c); 
    }
    if (s.test(2))
    {
      result = result + d;
      result_string = result_string + "+" + to_string(d); 
    }
    else
    {
      result = result - d;
      result_string = result_string + "-" + to_string(d); 
    }
    if(result == 7)
    {
      cout << result_string << "=7" << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
H, W, D = map(int, input().split())
A = [[int(i) for i in input().split()]for i in range(H)]
Q = int(input())
L = [0 for i in range(Q)]
R = [0 for i in range(Q)]
for i in range(Q):
    L[i], R[i] = map(int, input().split())
B = [(0,0) for i in range(H*W)]
for i in range(H):
    for j in range(W):
        B[A[i][j]-1] = (i,j)
C = [0 for i in range(H*W)]
for k in range(H*W):
    if k-D<0:
        C[k] = 0
    else:
        C[k] = C[k-D] + abs(B[k][0]-B[k-D][0])+abs(B[k][1]-B[k-D][1])
for n in range(Q):
    print(C[R[n]-1]-C[L[n]-1])


Measured memory_bytes: 25864
n, x = map(int, input().split())
a_s = list(map(int, input().split()))

prev = a_s.pop()
result = max(prev - x, 0)
prev -= result
while a_s:
    cur = a_s.pop()
    if prev + cur > x:
        cur_res = prev + cur - x
        cur -= cur_res
        result += cur_res
    prev = cur

print(result)


Measured memory_bytes: 14152
from sys import stdin
n,m = map(int,stdin.readline().rstrip().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
li = make_divisors(m)
point = 1
if n == 1:
    print(m)
    exit()
for i in range(1,len(li)):
    if m//li[i] < n:
        point = li[i-1]
        break
print(point)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
using namespace std;
/*階乗*/
ll factorial(ll n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1)%1000000007;
    }
}

/* ユークリッドの互除法 最大公約数*/
/*ll gcd(ll a, ll b) {
	ll r;
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
*/


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

/*二点間の距離*/
double dist(pair<double,double> a,pair<double,double> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}

//繰り返し自乗法
double ism(double aa,ll p){
    double ap=aa;
    double ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans*=ap;
        }
        p/=2;
        ap=ap*ap;
    }
    return ans;

}
//繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa,ll p,ll m){
    ll ap=aa;
    ll ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans=(ans*ap)%m;    
        }
        p/=2;              
        ap=(ap*ap)%m;
    }
    return ans;

}
/*
ll solve(ll i,ll m,vector<ll>t,ll n){
    if(m==0){
        return 1;
    }
    if(i>=n){
        return 0;
    }
    
    
    cout<<i+1<<" "<<m<<endl;
    cout<<i+1<<" "<<m-t[i]<<endl;
    ll res=solve(i+1,m,t,n)||solve(i+1,m-t[i],t,n);
    return res;
}
*/

//小数点12桁
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;


int main()
{
    ll n,k;
    cin>>n>>k;
    vector<ll>p(n);
    vector<double>sum(n+1,0);
    for(ll i=0;i<n;i++){
        cin>>p[i];
    }
    double a=0;
    for(ll i=0;i<n;i++){
        a+=(1+p[i])/2.0;
        sum[i+1]=a;
    }
    double ans=0;
    for(ll i=0;i<n+1-k;i++){
        ans=max(sum[i+k]-sum[i],ans);
    }
    cout<<ans<<endl;


    

}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
using namespace std;
int main(){
    string s;
    cin>>s;
    bool f=true;
    long long ans=0;
    if(s[0]!='A'){
        f=false;
    }
    f(i,2,s.size()-1){
        if(s[i]=='C'){
            ans++;
        }
        else if(s[i]-'a'<0){
            f=false;
        }
    }
    if(s[1]-'a'<0||s[s.size()-1]-'a'<0){
        f=false;
    }
    if(f&&ans==1){
        cout<<"AC"<<endl;
    }
    else{
        cout<<"WA"<<endl;
    }
    return 0;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    ll n;
    cin >> n;
    string ans;
    while (n > 0) {
        --n;
        ans += (char)(n%26+'a');
        n /= 26;
    }
    reverse(all(ans));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#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 <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// 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 <atomic>
#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>
#endif

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

int main()
{
  int x, y;
  cin >> x >> y;
  cout << x + y / 2 << endl;
  return 0;
}


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

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

const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

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

    int n;
    cin>>n;
    vector<mint> as(60);
    vector<mint> bs(60);
    rep(i, n) {
        ll a;
        cin>>a;
        rep(j, 60) {
            if (a>>j&1) as[j] += 1;
            else bs[j] += 1;
        }
    }

    mint base = 1;
    mint ans = 0;
    rep(i, 60) {
        ans += as[i] * bs[i] * base;
        base *= 2;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import itertools
S = str(input())
L = ("+","-")

kouho = list(itertools.product(L, repeat=3))
#print(kouho)
for x in kouho:
  temp = S[0]+x[0]+S[1]+x[1]+S[2]+x[2]+S[3]
  ans = eval(temp)
  if ans == 7:
    print(temp+"=7")
    exit()

Measured memory_bytes: 9108
N, Y = map(int, input().split())

flag = False
for i in range(Y//10000+1):
    x = Y//10000-i
    for j in range(N-x+1):
        y = N-x-j
        z = N-x-y
        if x*10000 + y*5000 + z*1000 == Y:
           flag = True
           break
    if flag:
        break

if flag:
    print(x,y,z)
else:
    print(-1, -1, -1)


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

using namespace std;

int main(int argc, char *argv[]) {
	char X, Y;
	cin >> X >> Y;

	char ans;
	if (X == Y) {
		ans = '=';	
	} else if (X > Y) {
		ans = '>';	
	} else {
		ans = '<';	
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

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

  cout << dup(n,2)-1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  ll a,b;
  cin >> a >> b;
  
  int ans = 0;
  while(a <= b){
    a *= 2;
    ans++;
  }
  
  cout << ans << endl;

 return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>

using namespace std;
 
int n,m,ans=0;
vector<int> tri[5005];


int main(void){
	scanf("%d%d",&n,&m);
	for(int i=0;i<=5003;i++){
		for(int j=0;j<=i+3;j++)tri[i].push_back(0);
	}
	for(int i=0;i<m;i++){
        int x,y,size;
        scanf("%d%d%d",&y,&x,&size);
        size++;
        tri[y][x]+=1;
        tri[y][x+1]-=1;
        tri[y+size][x]-=1;
        tri[y+size+1][x+1]+=1;
        tri[y+size][x+size+1]+=1;
        tri[y+size+1][x+size+1]-=1;
    }
    for(int i=2;i<=n;i++){
        for(int j=2;j<=i;j++){
            tri[i][j]+=tri[i][j-1];
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            tri[j][i]+=tri[j-1][i];
        }
    }
    for(int i=1;i<=n;i++){
        int y=i+1,x=2;
        while(y<=n){
            tri[y][x]+=tri[y-1][x-1];
            y++,x++;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=i;j++){
            if(tri[i][j]>=1)ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 62856
# 深さ優先探索
N = int(input())
links = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b, c = map(int, input().split())
    links[a].append((b, c))
    links[b].append((a, c))

Q, K = map(int, input().split())

d = [float('inf')] * (N + 1)
d[K] = 0
q = [K]
while q:
    i = q.pop()
    for j, c in links[i]:
        if d[i] + c < d[j]:
            d[j] = d[i] + c
            q.append(j)

result = []
for _ in range(Q):
    x, y = map(int, input().split())
    result.append(d[x] + d[y])
print('\n'.join(str(v) for v in result))
#print(*result, sep='\n')


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

#define fi first
#define se second

const int N = 100100;
const long long mod = 1e9 + 9;

using namespace std;

int n;
int k;
long long d[N];

int main()
{
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        ios_base::sync_with_stdio(0);

        cin >> n >> k;
        for(int i = 1;i  <= n; i++){
                int x, y;
                cin >> x >> y;
                for(int j = k; j >= x; j--){
                        d[j] = max(d[j], d[j - x] + y);
                }
        }
        cout << d[k] << "\n";
}



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

int main(){
  int n; cin>>n;
  int c2=0,c4=0;
  for(int i=0;i<n;i++){
    int a; cin>>a;
    if(a%4==0) c4++;
    else if(a%2==0) c2++;
  }
  if(c4>=(n+1)/2){
    cout<<"Yes";
  }else{
    n-=c4*2;
    if(n<2){
      cout<<"Yes";
    }else{
      if(n==c2){
        cout<<"Yes";
      }else{
        cout<<"No";
      }
    }
  }
  cout<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100050];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+1+n);
	int last=0,ans=0;
	for(int i=2;i<=n;i++)
	{
		if(a[i]!=a[i-1])
		{
			if(i-1-last>=a[i-1])
				ans+=(i-1-last-a[i-1]);
			else ans+=(i-1-last);
			last=i-1;
		}
	}
	if(n-last>=a[n])ans+=n-last-a[n];
	else ans+=(n-last);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define REP1(i, n) for(int i=1; i<=(n); i++)
#define RREP1(i, n) for(int i=(n); i>=1; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define out(...) printf(__VA_ARGS__)
#if DEBUG
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...) /* ... */
#endif
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

void solve();
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

/*================================*/
#if DEBUG
#define SIZE 100
#else
#define SIZE 223450
#endif

int N,Q,K;
int A[SIZE];

void solve() {
    cin>>N;
    N %= 1000;
    if (N) {
        cout << (1000-N) << endl;
    } else {
        cout << 0 << endl;
    }
}


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

int main(void){
    int n; cin >> n;
    int m;
    long long s=0;
    map<int, int> a;for (int i=0; i<n;i++){cin >> m; a[m]++; s+=m;}
    int q; cin >> q;
    int b, c;
    for (int i = 0; i < q; i++){
        cin >> b >> c;
        s += (c-b)*a[b];
        a[c] += a[b];
        a[b] = 0;
        cout << s << endl;
    }
    return 0;
}

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

#define _USE_MATH_DEFINES

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

const ll INF = 999999999;
const ll atcoder = 1000000007;
const int dx[4] = { 1 , 0 , -1 ,0 };
const int dy[4] = { 0 , 1 , 0 , -1 };

int main() {

	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	
	int answ = 0, anss = 0;
	double con = 0;
	vector<int>s, w;

	for (int i = 0; i * 100 * a <= f; i++) {
		for (int j = 0; j * 100 * b <= f; j++) {
			if (i * 100 * a + j * 100 * b <= f) {
				int sw = i * 100 * a + j * 100 * b;
				w.push_back(sw);
			}
		}
	}

	for (int i = 0; i <= f; i++) {
		for (int j = 0; j <= f; j++) {
			if (c*i + d*j <= f) {
				int ss = c*i + d*j;
				s.push_back(ss);
			}
		}
	}

	sort(w.begin(), w.end());
	sort(s.begin(), s.end());

	w.erase(unique(w.begin(), w.end()),w.end());
	s.erase(unique(s.begin(), s.end()),s.end());

	for (int i = 0; i < w.size(); i++) {
		for (int j = 0; j < s.size(); j++) {

			if (w[i] + s[j] > f)break;

			if (con < (double)s[j] * 100 / ((double)(w[i] + s[j])) && w[i] / 100 * e >= s[j]) {
				con = (double)s[j] * 100 / ((double)(w[i] + s[j]));
				answ = w[i] + s[j];
				anss = s[j];
			}

		}
	}
	if(anss != 0)cout << answ << ' ' << anss << endl;
	else cout << w[w.size()-1] << ' ' << anss << endl;

	return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  vector<ll>v;
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  v.push_back(a*c);
  v.push_back(a*d);
  v.push_back(b*c);
  v.push_back(b*d);
  sort(v.begin(),v.end());
  cout<<v[3];
}  

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

/* short names and const
using ll = long long;
using vll = vector<long long>;
using df = vector<vector<long long>>;
df data(n, vector<long long>(m));
const int MOD = 1e9 + 7;
const long long INF = 1e18;
*/

/* Boost!
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
using boost::algorithm::split; // split(result, s, boost::is_any_of(","));
#include <boost/algorithm/string/join.hpp>
using boost::algorithm::join; // string s = join(arr, "");
#include <boost/algorithm/string/replace.hpp>
using boost::algorithm::replace_all; // replace_all(s, "AtCoder", "A");
#include <boost/range/algorithm.hpp> // boost::sort(arr)
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
*/

/* print(arr)
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}
*/

/* fast cin and precise cout
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  getline(cin, s);
  cout << fixed << setprecision(15);
*/

/* sum function
int sum(vector<int> &arr) {
  int res = accumulate(arr.begin(), arr.end(), 0);
  return res;
}
*/

#include <boost/range/algorithm.hpp> // boost::sort(arr)


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

  int n, m;
  cin >> n >> m;
  vector<tuple<long long, int, int>> pref_year_city(m);
  rep(i, m) {
    int p, y;
    cin >> p >> y;
    pref_year_city[i] = make_tuple(p, y, i);
  }
  boost::sort(pref_year_city);
  unordered_map<int, long long> city_pref_cnt;
  vector<int> cnt(n + 1);
  for(auto & pyc : pref_year_city) {
    long long p;
    int c;
    tie(p, ignore, c)= pyc;
    ++cnt[p];
    city_pref_cnt[c] = p * 1000000 + cnt[p];
  }
  rep(i, m) {
    cout << setfill('0') << setw(12) << city_pref_cnt[i] << endl;
  }
}


Measured memory_bytes: 7588
# -*- coding: utf-8 -*-
import sys
n, m = map(int, input().split())
demands = [
    tuple(map(int,
              line.strip().split())) for line in sys.stdin.readlines()
]
demands.sort(key=lambda demand: demand[1])

x = -1
cnt = 0
for ai, bi in demands:

    if ai <= x:
        continue

    else:
        x = bi - 1
        cnt += 1

print(cnt)

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

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> v[n];
  for(int i=0; i<m; i++) {
    int x,y;
    cin >> x >> y;
    x--,y--;
    v[x].push_back(y);
  }
  bool u[n];
  memset(u,0,sizeof(u));
  int ans=0;
  for(int i=0; i<n; i++) {
    if(u[i]) continue;
    ans++;
    u[i]=1;
    queue<int> que;
    que.push(i);
    while(!que.empty()) {
      int x=que.front();que.pop();
      ans+=v[x].size()-1;
      for(int i=0; i<v[x].size(); i++) {
        int y=v[x][i];
        if(u[y]) continue;
        u[y]=1;
        que.push(y);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3176
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
using namespace std; 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define ll long long
int x[105];
int main(int argc, char** argv) {
	int n;
	cin>>n;
	rep(i,1,n)cin>>x[i];
	int minn=1e9;
	for(int i=1;i<=100;i++)
	{
		int now=0;
		for(int j=1;j<=n;j++)
		{
			now+=(x[j]-i)*(x[j]-i);
		}
		minn=min(minn,now);
	}
	cout<<minn;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int mod=998244353,maxn=4e5+5;
LL n,m,k;
LL fact[maxn],inv[maxn];
LL qpow(LL base,int p)
{
	LL res=1;
	while(p)
	{
		if(p&1) res=res*base%mod;
		base=base*base%mod;
		p>>=1;
	}
	return res;
}
LL C(LL a,LL b)
{
	return (fact[a]*inv[b]%mod)*inv[a-b]%mod;
}
LL ans=0;
int main()
{
	scanf("%lld%lld%lld",&n,&m,&k);
	fact[0]=1;
	for(int i=1;i<=2*n;++i) fact[i]=fact[i-1]*i%mod;
	inv[2*n]=qpow(fact[2*n],mod-2);
	for(int i=2*n-1;i>0;--i) inv[i]=inv[i+1]*(i+1)%mod;
	inv[0]=1;
	for(int p=n-k;p<=n;++p)
	{
		ans=(ans+m*qpow(m-1,p-1)%mod*C(n-1,p-1)%mod)%mod;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 9960
X,N = map(int,input().split())
P = {}
if N > 0:
  for p in input().split():
    i = int(p)
    P[i] = 0
x = X
n = -1
while True:
  if not x in P:
    break
  x = X + n
  n *= -1
  if n < 0:
    n -= 1
print(x)
  
  

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

vector<ll> enum_div(ll n)//nの約数を列挙
{
	vector<ll> ret;
	for(ll i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}


int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    ll N, M;
    cin >> N >> M;

    vector<ll> ret = enum_div(M);
    ret.push_back(M); //自分自身を追加

    ll ans = 0;
    for(ll i : ret){
        if(i * N <= M){
            chmax(ans, i);
        }
    }

    cout << ans << endl;

   

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
 
using namespace std;
 
#define Int int64_t
 
void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
 
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}
 
 
 
 
int main() {
	int a, b, c,d;
	cin >> a >> b >> c;
 
	d = b / a;
	if (d >= c) cout << c << endl;
	else cout << d << endl;
	
 
	return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        m: usize,
    };

    // n の約数を列挙する
    let mut d = vec![];
    for i in 1.. {
        if i * i > m {
            break;
        }
        if m % i == 0 {
            d.push(i);
            if i != m / i {
                d.push(m / i);
            }
        }
    }

    let mut ans = 1;
    for &d_i in d.iter() {
        if n * d_i <= m {
            ans = std::cmp::max(ans, d_i);
        }
    }
    println!("{}", ans);
}


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

struct RollingHash {
    typedef long long LL;
    typedef std::pair<long long, long long> hash_type;
    private:
        LL base1, base2;
        LL mod1, mod2;
        std::vector<LL> hash1, hash2;
        std::vector<LL> pow1, pow2;
    public:
        RollingHash(): base1(1009), base2(1013), mod1(1000000007), mod2(1000000009) {}

        void init(const std::string& s) {
            int N = s.size();

            hash1.assign(N+1, 0);
            hash2.assign(N+1, 0);
            pow1.assign(N+1, 1);
            pow2.assign(N+1, 1);

            for(int i=0; i<N; ++i) {
                hash1[i+1] = (hash1[i] + s[i]) * base1 % mod1;
                hash2[i+1] = (hash2[i] + s[i]) * base2 % mod2;
                pow1[i+1] = pow1[i] * base1 % mod1;
                pow2[i+1] = pow2[i] * base2 % mod2;
            }
        }

        inline LL get_hash1(int l, int r) {
            return ( (hash1[r] - hash1[l]*pow1[r-l]) % mod1 + mod1) % mod1;
        }

        inline LL get_hash2(int l, int r) {
            return ( (hash2[r] - hash2[l]*pow2[r-l]) % mod2 + mod2) % mod2;
        }

        hash_type get_hash_pair(int l, int r) {
            return std::make_pair(get_hash1(l, r), get_hash2(l, r));
        }
};

int n, m;
std::string s;
int main() {
    std::cin >> n >> m;
    std::cin >> s;

    auto rh = new RollingHash();
    rh->init(s);

    std::string query;
    std::set<RollingHash::hash_type> set;
    int l = 0, r = 0;
    for(int i=0; i<m; ++i) {
        std::cin >> query;
        if(query == "L++") {
            ++l;
        } else if(query == "L--") {
            --l;
        } else if(query == "R++") {
            ++r;
        } else {
            --r;
        }
        auto v = rh->get_hash_pair(l, r+1);
        set.insert(v);
    }
    
    std::cout << set.size() << std::endl;
}



Measured memory_bytes: 31360
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

int N, K;

int main() {
    cin >> N >> K;
    cout << ((N+1)/2 >= K ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 888
#include <iostream>

using namespace std;

int main() {
	double height;
	double mini = 10000.0, maxi = 0.0;
	while (cin >> height) {
		mini = min(mini, height);
		maxi = max(maxi, height);
	}
	cout << maxi - mini << endl;
	return 0;
}

Measured memory_bytes: 1280
#include <cstdio>
#include <cstdint>
#include <cstddef>
#include <cassert>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <queue>
#include <stack>

constexpr intmax_t  operator ""_jd(unsigned long long n) { return n; }
constexpr uintmax_t operator ""_ju(unsigned long long n) { return n; }
constexpr size_t    operator ""_zu(unsigned long long n) { return n; }
// constexpr ptrdiff_t operator ""_td(unsigned long long n) { return n; }

namespace detail {
template <typename Tp, size_t N>
std::vector<Tp> make_vector(
    std::vector<size_t>& sizes,
    typename std::enable_if<(N == 1), Tp const&>::type x
) {
  return std::vector<Tp>(sizes[0], x);
}
template <typename Tp, size_t N>
auto make_vector(
    std::vector<size_t>& sizes,
    typename std::enable_if<(N > 1), Tp const&>::type x
) {
  size_t size = sizes[N-1];
  sizes.pop_back();
  return std::vector<decltype(make_vector<Tp, N-1>(sizes, x))>(
      size, make_vector<Tp, N-1>(sizes, x)
  );
}
}  // detail::

template <typename Tp, size_t N>
auto make_vector(size_t const(&sizes)[N], Tp const& x) {
  std::vector<size_t> s(N);
  for (size_t i = 0; i < N; ++i) s[i] = sizes[N-i-1];
  return detail::make_vector<Tp, N>(s, x);
}

int main() {
  int a, b;
  scanf("%d %d", &a, &b);

  printf("%d\n", std::max(0, a-2*b));
}


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

int solnB(int n,int k,vector<int>& arr){
	int dp[n];
	if(n<2) return 0;
	dp[n-1]=0;
	// dp[n-2]=abs(arr[n-1]-arr[n-2]);
	for(int i=n-2;i>=0;i--){
		dp[i]=INT_MAX;
		for(int j=1;j<=k&&i+j<n;j++)
			dp[i] = min(dp[i],abs(arr[i]-arr[i+j])+dp[i+j]);
	}
	return dp[0];
}
int main(){
	int n,k;
	cin>>n>>k;
	vector<int> arr(n);
	for(int i=0;i<n;i++) cin>>arr[i];
	cout<<solnB(n,k,arr)<<endl;
}

/*
int solnA(int n,vector<int>& arr){
	int dp[n];
	if(n<2) return 0;
	dp[n-1]=0;
	dp[n-2]=abs(arr[n-1]-arr[n-2]);
	for(int i=n-3;i>=0;i--){
		dp[i] = min(abs(arr[i]-arr[i+1])+dp[i+1],abs(arr[i]-arr[i+2])+dp[i+2]);
	}
	return dp[0];
}
*/

Measured memory_bytes: 4024
#include <iostream>

using namespace std;

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

    int tab[n];
    for(int i = 0; i < n; i++) cin >> tab[i];

    int dp[n];

    dp[0] = 0;

    for(int i = 1; i < n; i++) {
        dp[i] = abs(tab[i] - tab[i-1]) + dp[i-1];

        if(i > 1) {
            dp[i] = min(dp[i], abs(tab[i] - tab[i-2]) + dp[i-2]);
        }
    }

    //for(int i = 0; i < n; i++) cout << dp[i] << endl;

    cout << dp[n-1];

    return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD (ll)(1e9+7)
ll N,K;
vector<ll> abv[101010];
ll Fa[101010];
ll i,j,k,ans;

ll moddiv(ll a,ll b){
    a %= MOD;
    b %= MOD;
    for(ll m=MOD-2;m>0;m/=2){
        if(m&1){
            a=a*b%MOD;
        }
        b=b*b%MOD;
    }
    return a;
}

ll bfs(ll a,ll pa){
    if(K<abv[a].size()+1)
        return -1;
    if(abv[a].size()-1==0){
        return 1;
    }
    
    ll ans = 1, i;
    fornum(i,0,abv[a].size()){
        ll bb = abv[a][i];
        if(bb==pa)
            continue;
        ll aaa = bfs(bb, a);
        
        if(aaa==-1)
            return -1;
        ans = (ans *aaa) % MOD;
    }

    return ans * moddiv(Fa[K-2],Fa[K-2-(abv[a].size()-1)]) % MOD;
}

int main(){
    scanf("%lld%lld", &N,&K);
    if(N==1){
        printf("%lld", K);
        return 0;
    }
    fornum(i,1,N){
        ll a, b;
        scanf("%lld%lld", &a,&b);
        abv[a].push_back(b);
        abv[b].push_back(a);
    }
    Fa[0] = 1;
    fornum(i,0,100010){
        Fa[i + 1] = Fa[i] * (i + 1) % MOD;
    }
    if(K<abv[1].size()+1){
        printf("0");
        return 0;
    }
    ll ans = 1;
    fornum(i,0,abv[1].size()){
        ll b = abv[1][i];
        ll aaa = bfs(b, 1);
        if(aaa==-1){
            printf("0");
            return 0;
        }
        ans = (aaa * ans) % MOD;
        //printf("%lld:%lld\n", b,ans);
    }
    //printf("%lld ", moddiv(Fa[K], Fa[K - (abv[1].size() + 1)]));
    printf("%lld", ans * moddiv(Fa[K], Fa[K-(abv[1].size() + 1)]) % MOD);


    return 0;
}

Measured memory_bytes: 12416
#include<stdio.h>
int Merge(int *,int,int,int);
int MergeSort(int *,int,int);
int SUM=0;


int MergeSort(int *A,int left,int right)
{  
  int center;
  if(left+1<right){
    center=(left+right)/2;
    MergeSort(A,left,center);
    MergeSort(A,center,right);
    Merge(A,left,center,right);
  }
  else return 0;
}

int Merge(int *A,int le,int mid,int rig)
{
  int i,j,N,a,b;
  int L[500000],R[500000];
  a=mid-le;
  b=rig-mid;
  for(i=0;i<a;i++){
    L[i]=A[le+i];
  }
  for(i=0;i<b;i++){
    R[i]=A[mid+i];
  }
  L[a]=1000000000;
  R[b]=1000000000;
  i=0;
  j=0;
  for(N=le;N<rig;N++){
    if(L[i]<=R[j]){
      A[N]=L[i];
      i=i+1;
      SUM=SUM+1;
    }
    else{
      A[N]=R[j];
      j=j+1;
      SUM=SUM+1;
    }
  }
}

int main()
{
  int i,n,S[500000];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  
  MergeSort(S,0,n);

  for(i=0;i<n-1;i++){
    printf("%d ",S[i]);
  }
  printf("%d",S[i]);
  printf("\n");
  printf("%d",SUM);
  printf("\n");
  return 0;
}



Measured memory_bytes: 5612
m = 2019
s = gets.chomp.reverse!
n = s.size
digit = 1;accum = 0
ans = 0
count = Array.new(m){0}
(0...n).each do |i|
  count[accum] += 1
  accum += s[i].to_i * digit
  accum %= m
  ans += count[accum]
  digit = digit * 10 % m
end
puts ans

Measured memory_bytes: 14660
n, w = map(int, input().split())
vw = [input().split() for _ in range(n)]
vw = [(int(x[0]), int(x[1])) for x in vw]
v_max = sum([x[0] for x in vw])

INF = 10 ** 9 + 1
pdp = [INF for _ in range(v_max+1)]
cdp = [INF for _ in range(v_max+1)]
pdp[0] = 0
cdp[0] = 0

for i in range(n):
    for j in range(v_max+1):
        if j + vw[i][0] < v_max + 1:
            cdp[j + vw[i][0]] = min(pdp[j + vw[i][0]], pdp[j] + vw[i][1])
        else:
            break
    pdp = cdp[:]

ans = INF
for i in range(len(cdp)):
    if cdp[i] <= w:
        ans = i

print(ans)



Measured memory_bytes: 6012
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;

#define N_MAX n+1

int main() {
	
	int a,b,c,k;
	cin >> a >> b >> c >> k;
	int mx = max(a,max(b,c));
	int els = a+b+c-mx; 
	for(int i=0;i<k;++i){
	    mx*=2;
	}
	cout << mx+els;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	map<int, ll> mp;
	rep(i, n) {
      cin>>a[i];
      mp[a[i]]++;
	}
	vector<ll> b(n), c(n);
	ll ans = 0;
	rep(i, n) {
		b[i] = (mp[i + 1] * (mp[i+1] - 1)) / 2;
		c[i] = ((mp[i + 1] - 2) * (mp[i+1] - 1)) / 2;
		ans += b[i];
	}
	rep(i, n) {
		cout << ans - b[a[i]-1] + c[a[i]-1] << endl;
	}
}

Measured memory_bytes: 18944