akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib> 
#include <iostream>

using namespace std;

int cmp(int* a, int* b)
{
	return (*a < *b) ? 1 : ((*a > *b) ? -1 : 0);
}

int main()
{
	int dat[10];

	for (int i = 0; i < 10; i++)
	{
		cin >> dat[i];
	}

	qsort(dat, 10, sizeof(int), reinterpret_cast<int(*) (const void*, const void*)>(cmp));

	for (int i = 0; i < 3; i++)
	{
		cout << dat[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1168
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:String,
    }
    let mut ans=0;
    let a=a.chars().map(|a| a.to_digit(2).unwrap() as usize).collect_vec();
    for i in 0..a.len() {
        if (a[i]+i)%2==0 {ans+=1}
    }
    println!("{}",min(ans,a.len()-ans))
}

Measured memory_bytes: 3040
#include <bits/stdc++.h>
#define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl;

typedef long long ll;
const ll INF = 99999999999999;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846;

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll number1, ll number2)
{
    return number1 * number2 / gcd(number1, number2);
}
template <class T>
bool contain(const std::string &s, const T &v)
{
    // contain(to_string(N), '3')
    return s.find(v) != std::string::npos;
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
        return c - '0';
    return 0;
}
using namespace std;

unsigned GetDigit(unsigned num)
{
    return std::to_string(num).length();
}

int main()
{

    int n, ans, target = 1;
    cin >> n;
    vector<int> a(n);
    rep(i, n)
    {
        cin >> a[i];
    }

    rep(i, n)
    {
        if (a[i] == target)
        {
            target++;
        }
    }
    if (target == 1)
    {
        ans = -1;
    }
    else
    {
        ans = n - target + 1;
    }
    cout << ans << endl;
    return 0;
}


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

int n;
int a[200010];
int b[200010];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    rep(i, n) cin >> a[i];
    rep(i, n) b[a[i]] = i;
    int len = 0;
    int combo = 0;
    rep(i, n) {
        if(i + 2 <= n && b[i + 1] < b[i + 2]) combo++;
        else {
            len = max(combo + 1, len);
            combo = 0;
        }
    }
    cout << n - len << endl;


    return 0;
}


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

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

int main() {
    int N, num, cnt = 0;
    cin >> N;
    while (N) {
        N--;
        cin >> num;
        cnt += isPrime(num);
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3076
//#include "bits/stdc++.h"
#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>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#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>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;

int main()
{
	char a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	if (a == f &&b == e && c == d)
	{
		cout << "YES" << "\n";
	}
	else
	{
		cout << "NO" << "\n";
	}
}

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

/*
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
*/

#define INF 10e9
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;

typedef struct edge{
   long long int from;
   long long int to;
   long long int cost;
} edge;

int main(){
   long long int V, E, r;
   cin >> V >> E >> r;

   vector<edge> edges;
   long long int i;
   for(i = 0; i < E; i++){
       long long int s, t ,d;
       cin >> s >> t >> d;

       edge e;
       e.from = s;
       e.to = t;
       e.cost = d;
       edges.push_back(e);
   }

   long long int dist[V];
   for(i = 0; i < V; i++){
       dist[i] = INF;
   }

   dist[r] = 0;
   long long int count = 0;
   bool update;
   if(E == 0){
       update = false;
   }else{
       update = true;
   }
  

   while(update){
       count++;
       update = false;
       for(i = 0; i < E; i++){
           edge e = edges[i];
           if(dist[e.from] != INF && dist[e.to] > dist[e.from] + e.cost){
               dist[e.to] = dist[e.from] + e.cost;
               update = true;
           }
       }
   }


   for(i = 0; i < V; i++){
       if(dist[i] != INF){
           cout << dist[i] << endl;
       }else{
           cout << "INF" << endl;
       }
   }
}






Measured memory_bytes: 15212
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) //printf(f,##__VA_ARGS__),fflush(stdout)

typedef long long ll;


const int N=1e5+50,oo=0x3f3f3f3f;

struct E { int d,w; };
vector<E> g[N];
vector<int> ctr;
int n,siz[N];
ll dis[N],ans;

void dfs(int v,int p){
	int m=0;
	siz[v]=1;
	for(E e:g[v])if(e.d!=p){
		dfs(e.d,v);
		siz[v]+=siz[e.d];
		cmax(m,siz[e.d]);
	}
	cmax(m,n-siz[v]);
	if(m<=n/2)ctr.pb(v);
}

void solve(int v,int p){
	ans+=dis[v]<<1;	
	for(E e:g[v])if(e.d!=p){
		dis[e.d]=dis[v]+e.w;
		solve(e.d,v);
	}
}

int main(int argc,char  *argv[]){
#ifdef CURIOUSCAT
	freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	scanf("%d",&n);
	rep(i,1,n-1){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		g[u].pb((E){v,w});
		g[v].pb((E){u,w});
	}
	dfs(1,0);
	solve(ctr[0],0);
	int mn=oo;
	if(ctr.size()>1){
		for(E e:g[ctr[0]])if(e.d==ctr[1])mn=e.w;
	}else{
		for(E e:g[ctr[0]])cmin(mn,e.w);
	}
	printf("%lld\n",ans-mn);
}

Measured memory_bytes: 12288
#include <iostream>
#include <math.h>
#include <string>    // useful for reading and writing
#include <fstream>   // ifstream, ofstream
#include <sstream>   // istringstream

using namespace std;

int main()
{
    while(true)
    {
    int a,b;
    string op;
    cin >> a >> op >> b;
    if(op == "+")
    {
        cout << a + b << endl;
    }else if(op == "-")
    {  
        cout << a - b << endl;
    }else if(op == "*")
    {
        cout << a * b << endl;
    }else if(op == "/")
    {
        cout << a / b << endl;
    }else{
        break;
    }
    }
    return 0;
}


Measured memory_bytes: 3124
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int n, m, a, b;
vector<int> edge[108000];
vector<P> ans;
int dep[108000];
bool come[108000];

int dfs(int x, int last){
    int cnt = 0;
    int deg = 0;
    come[x] = true;
    vector<P> tmp;
    for(auto to:edge[x]){
        if(to == last)continue;
        if(come[to]){
            if(dep[to] < dep[x]){
                ans.push_back(P(x, to));
                deg++;
            }
        }
        else{
            dep[to] = dep[x] + 1;
            int tocnt = dfs(to, x);
            if(tocnt % 2 == 1)ans.push_back(P(to, x));
            else ans.push_back(P(x, to));
            cnt += tocnt;
            deg++;
        }
    }
    //cout << x << " " << cnt << " "<< deg << endl;
    return (cnt + deg) % 2;
}

int main(){
    cin >> n >> m;
    for(int i = 0;i < m;i++){
        cin >> a >> b;
        a--,b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    if(dfs(0,-1) % 2 == 1){
        cout << -1 << endl;
        return 0;
    }

    for(auto p:ans)cout << p.first+1 << " " << p.second+1 << endl;

    return 0;
}


Measured memory_bytes: 18544
n, k = map(int, input().split())
dd = list(map(int, input().split()))
frag = 1
for i in range(n, 10*n+1):
  frag = 1
  for d in dd:
    if(str(d) in str(i)):
      frag = 0
  if(frag):
    print(i)
    break

Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int main() {
	int N, M;	cin >> N >> M;
	vector<int> a(M), b(M);
	vector<int> num(N);
	for (int i = 0; i < M; ++i) {
		cin >> a[i] >> b[i];
	}
	for (int i = 0; i < M; ++i) {
		++num[a[i] - 1];
		++num[b[i] - 1];
	}
	for (auto e : num) {
		cout << e << endl;
	}
	cin >> N;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n;
  R n;
  set<int> s;
  rep(i,n) {
    int x;
    R x;
    s.in(x);
  }
  pr(s.size());
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<ll, ll>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 45;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

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
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  ll n; cin >> n;
  ll ans = n*(n-1)/2;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;

int main(){
    string S;
    cin >> S;

    int ma = 0;
    int c = 0;

    for(int i = 0; i < S.size(); i++){
        if(S[i] == 'A' || S[i] == 'T' || S[i] == 'C' || S[i] == 'G'){
            c++;
        }else{
            c = 0;
        }
        ma = max(ma,c);
    }

    cout << ma << endl;

    return 0;
}

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

int main() {
  int n,m; cin >> n >> m;
  Graph G(n);
  vector<int> dist(n, 0);

  int a,b;
  REP(i,m) {
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  queue<int> q; q.push(0);
  while(!q.empty()) {
    int t = q.front(); q.pop();
    for (int x : G[t]) {
      if (dist[x] > 0) continue;
      dist[x] = dist[t]+1;
      q.push(x);
    }
  }

  if (0 < dist[n-1] && dist[n-1] < 3) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}

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

int main() {
	for( ;; ) {
		string s;
		cin >> s;

		if( s == "-" ) {
			break;
		}

		int m;
		cin >> m;

		int pos = 0;
		int len = s.size();

		for( int i = 0; i < m; ++i ) {
			int x;
			cin >> x;

			pos = (pos + x) % len;
		}

		cout << s.substr( pos );
		if( pos ) { cout << s.substr( 0, pos ); }

		cout << endl;
	}
}



Measured memory_bytes: 3152
#include <stdio.h>
#include <vector>

int main() {
  long int n, a;
  scanf("%ld", &n);
  std::vector<int> v(n);
  for(int i = 0; i < n; ++i) scanf("%d", &v[i]);
  std::vector<std::vector<long long>> dp(n+1, std::vector<long long>(4, -1e15));
  dp[0][0] = 0; dp[1][0] = v[0]; dp[2][1] = v[1]; if(n > 2) dp[3][2] = v[2];
  for(int i = 3; i <= n; ++i){
    if(i & 1){
      dp[i][0] = dp[i-2][0] + v[i-1];
      dp[i][2] = std::max(dp[i][2], std::max(dp[i-2][2] + v[i-1], dp[i-3][1] + v[i-1]));
      if(i > 3) dp[i][2] = std::max(dp[i][2], dp[i-4][0] + v[i-1]);
    }
    else dp[i][1] = std::max(dp[i-2][1] + v[i-1], dp[i-3][0] + v[i-1]);
  }
  if(n % 2 == 0) a = std::max(dp[n][1], dp[n-1][0]);
  else a = std::max(dp[n][2], std::max(dp[n-1][1], dp[n-2][0]));
  printf("%ld\n", a);
  return 0;
}

Measured memory_bytes: 17524
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		if(N==1) {
			System.out.println("Hello World");
		}
		else if(N==2) {
			int a=scan.nextInt();
			int b=scan.nextInt();
			System.out.println(a+b);
		}

	}

}


Measured memory_bytes: 35816
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=j; i<=k; i++)
#define FFOR(i, j, k) for(int i=j; i<k; i++)
#define DFOR(i, j, k) for(int i=j; i>=k; i--)
#define bug(x) cerr<<#x<<" = "<<x<<'\n'
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
template <typename T> inline void read(T &x){
    char c;
    bool nega=0;
    while((!isdigit(c=getchar()))&&(c!='-'));
    if(c=='-'){
        nega=1;
        c=getchar();
    }
    x=c-48;
    while(isdigit(c=getchar())) x=x*10+c-48;
    if(nega) x=-x;
}
template <typename T> inline void writep(T x){
    if(x>9) writep(x/10);
    putchar(x%10+48);
}
template <typename T> inline void write(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    writep(x);
}
template <typename T> inline void writeln(T x){
    write(x);
    putchar('\n');
}
#define taskname "C"
int x;
int main(){
    #ifdef Megumin
        if(fopen(taskname".inp", "r"))
            freopen(taskname".inp", "r", stdin);
    #endif // Megumin
    read(x);
    int i=0;
    while(i*(i+1)/2<x) i++;
    write(i);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
long long keisan(vector<int> A,int B,int N){
  long long count=0;
  rep(i,N){
    count+=abs(A[i]-B);
  }
  return count;
}
int main() {
  long long count=0;
  int N;
  cin>>N;
  vector<int>A(N);
  rep(i,N){
    int x;
    cin>>x;
    A[i]=x-i;
  }
  sort(A.begin(),A.end());
  if(N%2){
  cout<<keisan(A,A[N/2],N);
    return 0;
  }
  else{
    cout<<keisan(A,(A[N/2]+A[N/2-1])/2,N);
  }
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fo(i,a,n) for(i=a;i<n;i++)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define sortrev(x) sort(all(x),greater<int>())
#define pi 3.1415926535897932384626

typedef pair<int,int> pii;
typedef pair<ll, ll> pl;
typedef vector<int>	vi;
typedef vector<ll>	vl;
typedef vector<pii>	vpii;
typedef vector<pl>	vpl;
typedef vector<vi>	vvi;
typedef vector<vl>	vvl;
typedef vector<double> vd;


const int mod = 100000007;
const int inf = 100000005;
const int N = 200005, M = N;
int i,j,n,m;

ll cnt , idx;
vi temp;


void solve() {
  ll n,k;
  cin>>n>>k;

  vi vec(n);
  fo(i,0,n) cin>>vec[i];
  sortrev(vec);
  ll ans = 0;
  fo(i,k,n) ans+=vec[i];

  cout<<ans<<"\n";
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int t = 1;
    //cin >> t;
    while(t--) {
      solve();
    }

    return 0;
}




Measured memory_bytes: 3948
N,M = map(int,input().split())
H = list(map(int,input().split()))
c = [0] * N
for i in range(M):
    A,B = map(int,input().split())
    if H[A -1] >= H[B -1]:
        c[B - 1] += 1
    if H[B - 1] >= H[A - 1]:
        c[A - 1] += 1
print(c.count(0))

Measured memory_bytes: 19960
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

#define KIT 4

int main() {
        int n, n1, i, t, t1, k, r;
        int tt[100002];
//      string s1, s2;
        int rr = 0;

        cin >> n >> k;
        n1 = n - 1;
        r = n - k;
        cin >> t1;
        for (i = 0; i < n1; i++) {
                t1++;
                cin >> t;
                tt[i] = t - t1;
//              cout << "t = " << t << "  t1 = " << t1 << endl;
                t1 = t;
        }

        sort(tt, tt + n1);

        for (i = 0; i < r; i++) {
                rr += tt[i];
//              cout << "tt = " << tt[i] << endl;
        }

        cout << n + rr << endl;

        return 0;
}



Measured memory_bytes: 3560
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;

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

int main()
{
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;

	vector<ll> p(a);
	vector<ll> q(b);
	vector<ll> r(c);

	for (int i = 0; i < a; i++)
	{
		cin >> p[i];
	}
	for (int i = 0; i < b; i++)
	{
		cin >> q[i];
	}
	for (int i = 0; i < c; i++)
	{
		cin >> r[i];
	}

	sort(p.begin(), p.end(), greater<ll>());
	sort(q.begin(), q.end(), greater<ll>());
	sort(r.begin(), r.end());

	p.resize(x);
	q.resize(y);

	ll sum = 0;

	while (!r.empty())
	{
		if (p.empty() && q.empty())
			break;

		if (p.empty())
		{
			if (q.back() < r.back())
			{
				sum += r.back();
				q.pop_back();
				r.pop_back();
			}
			else
			{
				break;
			}
		}

		else if (q.empty())
		{
			if (p.back() < r.back())
			{
				sum += r.back();
				p.pop_back();
				r.pop_back();
			}
			else
			{
				break;
			}
		}

		else if (p.back() < q.back())
		{
			if (p.back() < r.back())
			{
				sum += r.back();
				p.pop_back();
				r.pop_back();
			}
			else
			{
				break;
			}
		}

		else
		{
			if (q.back() < r.back())
			{
				sum += r.back();
				q.pop_back();
				r.pop_back();
			}
			else
			{
				break;
			}
		}
	}

	while (!p.empty())
	{
		sum += p.back();
		p.pop_back();
	}

	while (!q.empty())
	{
		sum += q.back();
		q.pop_back();
	}

	cout << sum << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <climits>
#include <algorithm>

using namespace std;

int main()
{
	unsigned int n;
	int ans = INT_MIN;
	int mi = INT_MAX;
	cin >> n;
	for (unsigned int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		if (mi < INT_MAX)
			ans = max(ans, x - mi);
		mi = min(mi, x);
	}
	cout << ans << endl;
	return 0;
}
 


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

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> P;
typedef pair<lint, lint> Plint;
 
const int MOD = 1e9+7;
const int INF = 1<<18;
const lint INFLINT = 1LL<<60;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define reps(i,n) for(lint i=0;i<=(lint)(n);i++)
#define rrep(i,n) for(lint i=(lint)(n)-1;i>0;i--)
#define rreps(i,n) for(lint i=(lint)(n)-1;i>=0;i--)

#define pb push_back

#define ALL(s) (s.begin(), s.end())
#define SZ(s) (s.size())

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

// Union-Find-Tree
class UnionFind {
	vector<int> par;
	UnionFind(int n):par(n){rep(i,n)par[i]=i;}
	int root(int x){if(par[x]==x)return x;return par[x]=root(par[x]);}
	void unite(int x,int y){int rx=root(x);int ry=root(y);if(rx==ry)return;par[rx]=ry;}
	bool same(int x,int y){return root(x)==root(y);}
};

// Final Weapon!
// #define int lint

int main() {
    int a, b,c, d;
    cin >> a >> b >> c >> d;
    bool t = true;
    while(a > 0 && c > 0) {
        if(t) c -= b;
        else a -= d;
        t = !t;
    }
    
    if(a <= 0) cout << "No";
    else cout << "Yes";
    
    return 0;
}


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

//関数
    
    
    
//main関数
int main() {
    
    
    
    //入力
     string s;
     cin >>s;
     
    
    
    
    
    
    
    
    
    //計算
    bool dom=true;
    for(int i=1;i<s.size();i++){
        if(s.at(i)!='9'){
            dom=false;
        }
    }
    int ans=9*(s.size()-1)+(s.at(0)-'0')-1;
    if(dom){
        ans++;
    }
    
    
    
    //出力
    cout <<ans<<endl;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1<<30;
enum mod = 10L^^9 + 7;

void main() {
    int n;
    scan(n);
    auto a = readln.split.to!(int[]);

    int f(int x) {
        int res;
        foreach (i ; 0 .. n) {
            res += (x - a[i])^^2;
        }
        return res;
    }

    int asum = a.sum();

    int ans = min(f(asum / n), f((asum + n - 1) / n));

    writeln(ans);
}














































void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
//#include<bits/stdc+.h>
//using namespace std;
int main(){
	char a[200005],b[200005];
	int c,i,j,sum=0;
	scanf("%s",&a);
	scanf("%s",&b);
	c=strlen(a);
	for(i=0;i<c;i++){
		if(a[i]!=b[i]){
			sum++;
		}
	}
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 3604
from collections import deque
import sys
input = sys.stdin.readline
h,w = map(int,input().split())
a = [list(input().rstrip()) for i in range(h)]
q = deque()
for i in range(h):
  for j in range(w):
    if a[i][j] == "#":
      a[i][j] = 0
      q.append((i,j,0))
    else:
      a[i][j] = -1
while q:
  s,t,cnt = q.popleft()
  for ns,nt in ((s+1,t),(s-1,t),(s,t+1),(s,t-1)):
    if 0<=ns<=h-1 and 0<=nt<=w-1 and a[ns][nt] == -1:
      q.append((ns,nt,cnt+1))
      a[ns][nt] = cnt+1
ans = 0
for i in range(h):
  for j in range(w):
    ans = max(ans,a[i][j])
print(ans)

Measured memory_bytes: 163932
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import java.util.*;

public class Main {
    static class UnionFind {
        List<Integer> Parent;
        UnionFind(int N) {
            Parent = new ArrayList<Integer>();
            Integer[] values = new Integer[N];
            Arrays.fill(values, -1);
            Parent.addAll(Arrays.asList(values));
        }
        int root(int A) {
            if (Parent.get(A) < 0)
                return A;
            int root = root(Parent.get(A));
            Parent.set(A, root);
            return root;
        }
        int size(int A) {
            return -Parent.get(root(A));
        }

        boolean connect(int A, int B) {
            A = root(A);
            B = root(B);
            if (A == B) {
                return false;
            }

            if (size(A) < size(B)) {
                int temp = A;
                A = B;
                B = temp;
            }

            Parent.set(A, Parent.get(A) + Parent.get(B));
            Parent.set(B, A);

            return true;
        }
    }
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int N = in.nextInt();
        int M = in.nextInt();
        int[] a = new int[M];
        int[] b = new int[M];
        for (int i=0;i<M;i++) {
            a[i] = in.nextInt()-1;
            b[i] = in.nextInt()-1;
        }
        int ans = 0;
        for (int i=0;i<M;i++) {
            UnionFind uf = new UnionFind(N);
            for (int j=0;j<M;j++) {
                if (j==i) {
                    continue;
                }
                uf.connect(a[j], b[j]);
            }
            if (uf.size(0)!=N) {
                ans++;
            }
        }
        out.println(ans);

        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


Measured memory_bytes: 21588
#include "bits/stdc++.h"
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define pi acos(-1.0)
#define ri register int
#define Max(x, y) (((x) > (y)) ? (x) : (y))
#define Min(x, y) (((x) < (y)) ? (x) : (y))
#define Abs(x) ((x) < 0 ? (-(x)) : (x))
#define int long long
const int maxn = 1e3 + 10;
inline int read()
{
    int f = 1, r = 0;
    char c = getchar();
    while (!isdigit(c)) {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (isdigit(c)) {
        r = 10 * r + c - '0';
        c = getchar();
    }
    return f * r;
}
inline void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
inline void writesp(int x) { write(x), putchar(' '); }
inline void writeln(int x) { write(x), puts(""); }
signed main()
{
    int cnt5 = 0, cnt7 = 0;
    for (ri i = 1; i <= 3; ++i) {
        int tmp = read();
        if (tmp == 5)
            cnt5++;
        else if (tmp == 7)
            cnt7++;
    }
    if (cnt5 == 2 && cnt7 == 1) {
        puts("YES");
    } else {
        puts("NO");
    }
    return 0;
}

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

void chmin(int &a, const int b) {
    if (a > b) a = b;
}

signed main() {
    int h, n;
    cin >> h >> n;

    vector<int> a(n), b(n);
    rep(i, 0, n) cin >> a[i] >> b[i];

    const int inf = 1LL << 60;
    vector<vector<int>> dp(n + 1, vector<int>(h + 1, inf));
    dp[0][0] = 0;

    rep(i, 0, n) rep(j, 0, h + 1) {
        chmin(dp[i + 1][j], dp[i][j]);
        chmin(dp[i][min(h, j + a[i])], dp[i][j] + b[i]);
    }

    cout << dp[n][h] << endl;

    return 0;
}

Measured memory_bytes: 78592
n = int(input())
v = [int(i) for i in input().split()]

from collections import Counter

v_0 = v[0::2]
v_1 = v[1::2]
v_0_ = Counter(v_0)
v_1_ = Counter(v_1)
v_0_[-1] = 0
v_1_[-1] = 0
v_0_ = v_0_.most_common()
v_1_ = v_1_.most_common()

if v_0_[0][0] != v_1_[0][0]:
    print(n-v_0_[0][1]-v_1_[0][1])
else:
    if v_0_[0][1] + v_1_[1][1] > v_0_[1][1] + v_1_[0][1]:
        print(n - v_0_[0][1] - v_1_[1][1])
    else:
        print(n - v_0_[1][1] - v_1_[0][1])


Measured memory_bytes: 19040
M=10**9+7
n,k,*a=map(int,open(y:=0).read().split())
a.sort()
x=s=1
while x+y<k:
 if(t:=a[y]*a[y+1])>a[-x]*a[~x]:s=s*t%M;y+=2
 else:s=s*a[-x]%M;x+=1
s*=x+y-k or a[-x]
if a[-1]<0<k%2:
 s=1
 for i in a[-k:]:s=s*i%M
print(s%M)

Measured memory_bytes: 31768
#include <bits/stdc++.h>
#define decode(s,t,u,m,p,e,d) m##s##u##t
#define beg decode(a,n,i,m,a,t,e)
#define online freopen("input.txt", "r", stdin);  //freopen("output.txt", "w", stdout);
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL);
#define ll long long int
#define run cout<<"running\n";
#define test ll t; cin>>t; while(t--)
using namespace std;
int beg()
{
    fast
    map<string,int> m;
    m.insert({"SUN",7});
    m.insert({"MON",6});
    m.insert({"TUE",5});
    m.insert({"WED",4});
    m.insert({"THU",3});
    m.insert({"FRI",2});
    m.insert({"SAT",1});
    string s;
    cin>>s;
    cout<<m[s];
}



Measured memory_bytes: 256
#include <iostream>
#include <time.h>

using namespace std;

template<typename T>
void Print(const T* pArray, int size)
{
	for (int i = 0; i < size; ++i)
		cout << pArray[i] << (i != size - 1 ? " " : "\n");
}

template<typename T>
void SelectionSort(T* pArray, int size, int& count)
{
	T temp;
	int minIndex;
	for (int i = 0; i < size - 1; ++i)
	{
		minIndex = i;
		for (int j = i + 1; j < size; ++j)
		{
			if (pArray[j] < pArray[minIndex])
				minIndex = j;
		}

		if (i != minIndex)
		{
			temp = pArray[i];
			pArray[i] = pArray[minIndex];
			pArray[minIndex] = temp;
			++count;
		}
	}
}

int main()
{
	int n; cin >> n;
	int* pArray = new int[n];
	for (int i = 0; i < n; ++i) cin >> pArray[i];

	int count = 0;
	SelectionSort(pArray, n, count);
	Print(pArray, n);
	cout << count << endl;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  vector<vector<int>> c(3, vector<int>(3));
  REP(i, 3) REP(j, 3) cin >> c[i][j];
  REP(i,101) REP(j, 101) REP(k, 101) {
    vector<int> a(3);
    vector<int> b(3);
    a[0] = i, a[1] = j, a[2] = k;
    b[0] = c[0][0] - a[0], b[1] = c[1][1] - a[1], b[2] = c[2][2] - a[2];
    if (b[0] < 0 || b[1] < 0 || b[2] < 0) continue;
    bool t = true;
    REP(l, 3) REP(m, 3) {
      if (c[l][m] != a[l] + b[m]) {
        t = false;
        break;
      }
    }
    if (!t) continue;
    puts("Yes");
    return 0;
  }
  puts("No");
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
using namespace std;

using edge = pair<int, long long>;
using Graph = vector<vector<edge>>;

template<typename T>
vector<T> dijkstra(const vector<vector<pair<int, T>>> &g, int s) {
    const T INF = numeric_limits<T>::max();
    vector<T> dist(g.size(), INF);
    vector<int> prev(g.size(), -1);
    using P = pair<T, int>;
    priority_queue<P, vector<P>, greater<P>> que;
    dist[s] = 0; que.emplace(dist[s], s);
    while (!que.empty()) {
        T cost; int u; tie(cost, u) = que.top(); que.pop();
        if (dist[u] < cost) continue;
        for (auto &e: g[u]) {
            int v; T nc; tie(v, nc) = e;
            if (dist[v] <= dist[u] + nc) continue;
            dist[v] = dist[u] + nc; prev[v] = u;
            que.emplace(dist[v], v);
        }
    }
    return dist;
}

const long long INF = 1LL << 60;    // 1.15x10^18
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main() {
    int n, m; cin >> n >> m;
    int s, t; cin >> s >> t; s--, t--;
    Graph gg(n), rg(n);
    while (m--) {
        int u, v; cin >> u >> v; u--, v--;
        int a, b; cin >> a >> b;
        gg[u].emplace_back(v, a);
        gg[v].emplace_back(u, a);
        rg[u].emplace_back(v, b);
        rg[v].emplace_back(u, b);
    }
    auto dS = dijkstra(gg, s), dT = dijkstra(rg, t);
    vector<long long> res(n + 1);
    for (int i = 0; i < n; i++) res[i] = dS[i] + dT[i];
    res.back() = INF;
    for (int i = n - 1; i >= 0; i--) chmin(res[i], res[i + 1]);
    for (int i = 0; i < n; i++) cout << (long long)1e15 - res[i] << endl;
    return 0;
}


Measured memory_bytes: 19320
import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def main():
  n,m=map(int,input().split())
  uf=UnionFind(n)
  now=n*(n-1)//2
  g=[]
  ans=[now]
  now=n*(n-1)//2
  for i in range(m):
    a,b=map(int,input().split())
    g.append((a-1,b-1))
  #print(g)
  g=g[::-1]
  for a,b in g:
    now-=uf.size(a)*uf.size(b)*(1-uf.same(a,b))
    ans.append(now)
    uf.union(a,b)
  ans=ans[:-1][::-1]
  print("\n".join(map(str,ans)))
  
  
  
  
  
  
  
  
  
  
  
  
  
  
if __name__ == "__main__":
	main()

Measured memory_bytes: 30832
n,m = map(int,input().split())
s_c = []
for x in range(m):
    s_c.append(list(map(int,input().split())))
    
ans = [0 for x in range(n)]
ch = []
flag = 0
for x in s_c:
    if (n!=1)&(x[0]==1)&(x[1]==0):
        print(-1)
        flag = 1
        break
    if x in ch:
        continue
    else:
        ch.append(x)
        if ans[x[0]-1]==0:
            ans[x[0]-1] = x[1]
        else:
            print(-1)
            flag = 1
            break
if flag == 0:
    if (ans[0] == 0)&(len(ans)!=1):
        ans[0] = 1
        print("".join(map(str,ans)))
    else:
        print("".join(map(str,ans)))

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>

typedef struct Retval{
    long score;
    int start;
    int end;
} Retval;

Retval* create_retval(long score, int start, int end) {
    Retval *retval = malloc(sizeof(Retval));
    retval->score = score;
    retval->start = start;
    retval->end = end;
    return retval;
}

Retval* max_score(Retval*** DP, long *a, int start, int end) {
    Retval* result[4];
    if (start > end)
        return NULL;
    if (DP[start][end] != NULL)
        return DP[start][end];
    
    if (start == end){
        return DP[start][end] = create_retval(a[start], start + 1, end);
    }
    if ((end - start) == 1) {
        if (a[start] < a[end])
            return DP[start][end] = create_retval(a[end], start, end - 1);
        else
            return DP[start][end] = create_retval(a[start], start + 1, end);
    }

    Retval *oposite;
    Retval *next_my;
    // 自分がstartをとる場合
    //result[0] = create_retval(max_score(a, start + 2, end)->score + a[start], start + 1, end);
    //result[1] = create_retval(max_score(a, start + 1, end - 1)->score + a[start], start + 1, end);
    // 次の手番の人の動き
    oposite = max_score(DP, a, start + 1, end);
    next_my = max_score(DP, a, oposite->start, oposite->end);
    result[0] = create_retval(next_my->score + a[start], start + 1, end);

    // 自分がendをとる場合
    oposite = max_score(DP, a, start, end - 1);
    next_my = max_score(DP, a, oposite->start, oposite->end);
    result[1] = create_retval(next_my->score + a[end], start, end - 1);
    //result[2] = create_retval(max_score(a, start + 1, end - 1)->score + a[end], start, end - 1) ;
    //result[3] = create_retval(max_score(a, start, end - 2)->score + a[end], start, end - 1);
    Retval* max = NULL;
    for (int i = 0; i < 2; i++) {
        if (result[i] == NULL)
            continue;
        //printf("result[%d]: score:%ld start:%d, end: %d\n", i, result[i]->score, result[i]->start, result[i]->end);
        if (max == NULL || max->score < result[i]->score)
            max = result[i];
    }
    return DP[start][end] = max;
}

int main() {
    int N;
    scanf("%d", &N);
    long *a = malloc((N+1) * sizeof(long));
    Retval ***DP = malloc((N+1) * sizeof(Retval*));
    for (int i = 1; i <= N; i++) {
        scanf("%ld", &a[i]);
        DP[i] = calloc(N+1,  sizeof(Retval));
    }


    Retval *X = max_score(DP, a, 1, N);
    Retval *Y = max_score(DP, a, X->start, X->end);
    if (Y == NULL)
        printf("%ld\n", X->score);
    else 
        printf("%ld\n", X->score - Y->score);

    return 0;
}


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

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

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  while (k--) {
    vector<ll> b(n + 1);
    rep(i, n) b[max(0LL, i - a[i])]++, b[min(i + a[i] + 1, n)]--;
    rep(i, n ) b[i + 1] += b[i];
    b.pop_back();
    if (a == b) break;
    a = b;
  }
  rep(i,n) cout << a[i] << ' ';
}

Measured memory_bytes: 6320
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args)
	{
		new Main().run();
	}
	
	public void run()
	{
		Scanner file = new Scanner(System.in);
		int N = (file.nextInt()+1)/2;
		int K = file.nextInt();
		System.out.println(N>=K? "YES":"NO");
	}
	
}


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

int main() {
  int n;
  cin >> n;
  vector<ll> A(n), c(n,0);
  rep(i,n) {
    cin >> A[i];
    c[A[i]-1]++;
  }
  vector<ll> dif(n);
  ll sum = 0;
  rep(i,n) {
    if (c[i] == 0) continue;
    sum += c[i]*(c[i]-1)/2;
    dif[i] = c[i]*(c[i]-1)/2 - (c[i]-2)*(c[i]-1)/2;
  }
  rep(i,n) {
    ll ans = sum - dif[A[i]-1];
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 7296
#include <stdio.h>

int main() {
  int number_of_remaining_chocolates, number_n, i, j, number_of_dates, answer, temp;
  scanf("%d", &number_n);
  scanf("%d %d", &number_of_dates, &number_of_remaining_chocolates);
  answer = number_of_remaining_chocolates;
  for(i = 0; i < number_n; i++) {
    scanf("%d", &temp);
    for(j = 0; ; j++) {
      if(j * temp + 1 <= number_of_dates) {
        answer++;
      } else {
        break;
      }
    }
  }
  printf("%d\n", answer);
  return 0;
}


Measured memory_bytes: 128
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


# 処理内容
def main():
    A, B = map(int, input().split())
    print(A * B)


if __name__ == '__main__':
    main()

Measured memory_bytes: 72760
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

	    int N=gi();
	    double[] T=new double[N];
	    double[] V=new double[N];
	    double[] V2=new double[N+1];
	    double[] V3=new double[N+1];
	    double[] vm=new double[N+1];
	    for (int i=0; i<N;i++) {
	    	T[i]=gd();
	    }
	    for (int i=0; i<N;i++) {
	    	V[i]=gd();
	    }
	    V2[0]=0;
	    V3[0]=0;
	    for (int i=1; i<N;i++) {
	    	V2[i]=Math.min(V[i-1], V[i]);
	    	V3[i]=Math.min(V[i-1], V[i]);
	    }
	    V2[N]=0;
	    V3[N]=0;

	    for (int i=1; i<N+1;i++) {
	    	if(V2[i]-V2[i-1] >T[i-1]) {
	    		V2[i]=V2[i-1]+T[i-1];
	    	} else if(V2[i-1]-V2[i] >T[i-1]) {
	    		V2[i-1]=V2[i]+T[i-1];
	    	}
	    }
	    for (int i=N-1; i>=0;i--) {
	    	if(V3[i]-V3[i+1] >T[i]) {
	    		V3[i]=V3[i+1]+T[i];
	    	} else if(V3[i+1]-V3[i] >T[i]) {
	    		V3[i+1]=V3[i]+T[i];
	    	}
	    }
	    for (int i=0; i<N+1;i++) {
	    	vm[i]=Math.min(V2[i], V3[i]);
	    }

	    double ans=0;
	    for (int i=0; i<N;i++) {
	    	if(2*V[i]-vm[i]-vm[i+1]<T[i]) {
	    		ans+=Math.pow(V[i]-vm[i], 2)/2 + Math.pow(V[i]-vm[i+1], 2)/2 + (V[i]-vm[i])*vm[i] + (V[i]-vm[i+1])*vm[i+1];
	    		ans+=(T[i] - 2*V[i]+vm[i]+vm[i+1]) * V[i];
	    	} else if(2*V[i]-vm[i]-vm[i+1]>=T[i]) {
	    		double x=(T[i]-Math.abs(vm[i+1]-vm[i]))/2;
	    		if(vm[i]>vm[i+1]) {
	    			ans+=Math.pow(x, 2)/2 + x*vm[i];
	    			ans+=Math.pow(x+vm[i]-vm[i+1], 2)/2 + vm[i+1]*(x+vm[i]-vm[i+1]);
	    		} else {
	    			ans+=Math.pow(x, 2)/2 + x*vm[i+1];
	    			ans+=Math.pow(x+vm[i+1]-vm[i], 2)/2 + vm[i]*(x+vm[i+1]-vm[i]);
	    		}
	    	}
	    }

        System.out.println(ans);
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

using namespace std;

namespace mySpace {
    int gcd(int a, int b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }
}

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

    int res = 0;
    for (int a = 1; a <= K; a++) {
        for (int b = 1; b <= K; b++) {
            for (int c = 1; c <= K; c++) {
                int t = mySpace::gcd(a, b);
                res += mySpace::gcd(c, t);
            }
        }
    }

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

Measured memory_bytes: 3636
l = gets.chomp.to_i

a = l / 3
b, c = a, a
if l % 3 == 1
  a += 0.333333333333
  b += 0.333333333333
  c += 0.333333333334
elsif l % 3 == 2
  a += 0.666666666666
  b += 0.666666666667
  c += 0.666666666667
end
print "#{sprintf("%.12f", a * b * c)}\n"

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
using namespace std;
long long a[4];
int id[4];
bool cmp(int x,int y){
  return a[x]<a[y];
}
int main()
{
    long long n;
    long long ans;
    for (int i=0;i<4;i++) cin>>a[i];
    cin>>n;
    a[0]*=8;a[1]*=4;a[2]*=2;
    for (int i=0;i<4;i++) id[i]=i;
    sort(id,id+4,cmp);
    if (id[0]!=3){
        ans=n*a[id[0]]/2;
    } else {
      if (n%2==0) ans=n*a[3]/2;
      else {
        ans=(n/2)*a[3];
        ans+=a[id[1]]/2;
      }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

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

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    ll ans = a[0];
    if (ans == 0) {
        cout << 0 << endl;
        return 0;
    }
    for (int i = 1; i < n; ++i) {
        if (ans > 1000000000000000000 / a[i]) {
            cout << -1 << endl;
            return 0;
        }
        ans *= a[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b;
    cin >> a >> b;
    if (a <= 0 && b >= 0) {
        cout << "Zero" << endl;
    } else if (a > 0) {
        cout << "Positive" << endl;
    } else if ((b-a+1)%2 == 0){
        cout << "Positive" << endl;
    } else {
        cout << "Negative" << endl;
    }
}

Measured memory_bytes: 256