akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (signed)(a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define MOD 1000000007
#define pb(a) push_back((a))
#define INF 93193111451418101
#define MIN -93193111451418101
#define EPS 1e-11
#define tp(a, b, c) make_tuple(a, b, c)
using namespace std;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
template <typename T> void fill_all(T &arr, const T &v) { arr = v; }
template <typename T, typename ARR> void fill_all(ARR &arr, const T &v) {
  for (auto &i : arr) {
    fill_all(i, v);
  }
}
//------------------変数-----------------------//
//-------------------関数----------------------//

ll n, cost[14514], dp[2][2][5005]; //前が同じか、i,j
string str;
//-------------------??¢??°----------------------//
bool c(string s) {
  if (str == s) {
    return true;
  }
  return false;
}
int main() {
  cin >> str;
  if (c("KIHBR")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("AKIHBR")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("KIHABR")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("KIHBAR")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("KIHBRA")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("AKIHABR")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("AKIHBAR")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("AKIHBRA")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("KIHABAR")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("KIHABRA")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("KIHBARA")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("AKIHABAR")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("AKIHABRA")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("AKIHBARA")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("KIHABARA")) {
    cout << "YES" << endl;
    return 0;
  }
  if (c("AKIHABARA")) {
    cout << "YES" << endl;
    return 0;
  }
  cout << "NO" << endl;
}


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

typedef long long lli;

const int MAXN = 4001;
lli num[MAXN];

int main() {
  for(lli a = 0; a <= 1000; ++a) {
    for(lli b = 0; b <= 1000; ++b) {
      ++num[a+b];
    }
  }
  lli n;
  while(cin >> n) {
    lli ans = 0;
    for(int k = 0; k <= 2000; ++k) {
      int u = n - k;
      if(u < 0 || u > 2000) continue;
      ans += num[k] * num[u];
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1172
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a - b < 0) {
			System.out.print(0);
		}else {
			System.out.print(a-b);
		}
	}
}

Measured memory_bytes: 19796
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int h,w,k;
	cin >> h >> w >> k;
	vector<string> a(h);
	for(int i=0;i<h;i++)
		cin >> a[i];
	vector<vector<int>> ans(h,vector<int>(w,-1));
	int cnt=0;
	for(int i=0;i<h;i++)
	{
		int bef=-1;
		for(int j=0;j<w;j++)
		{
			if(a[i][j]=='#')
			{
				cnt++;
				bef=cnt;
				ans[i][j]=bef;
			}
			else
			{
				ans[i][j]=bef;
			}
		}
	}
	for(int i=0;i<h;i++)
		for(int j=w-1-1;j>=0;j--)
		{
			if(ans[i][j]==-1)
				ans[i][j]=ans[i][j+1];
		}
	
	for(int i=0;i<h;i++)
		if(ans[i][0]==-1)
			for(int j=0;j<w;j++)
				ans[i][j]=(i==h-1 ? ans[i-1][j]:ans[i+1][j]);
	for(int j=0;j<w;j++)
		for(int i=1;i<h;i++)
			if(ans[i][j]==-1)
				ans[i][j]=ans[i-1][j];
	for(int j=0;j<w;j++)
		for(int i=h-2;i>=0;i--)
			if(ans[i][j]==-1)
				ans[i][j]=ans[i+1][j];


	for(int i=0;i<h;i++)
		for(int j=0;j<w;j++)
			cout << ans[i][j] << (j==w-1 ? "\n":" ");

}

Measured memory_bytes: 1280
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main(){
	int hito[101] = {0};
	int a = 0,b = 0,ab = 0,o = 0;
	string s;

	for(int i = 1; i <= 101; i++){

		scanf("%d,",&hito[i]);
		cin >> s;

		if(hito[i] == 0) break;

		else if(s == "A"){
			a++;
		}else if(s == "B"){
			b++;
		}else if(s == "AB"){
			ab++;
		}else if(s == "O"){
			o++;
		}
	}

	cout << a << endl;
	cout << b << endl;
	cout << ab << endl;
	cout << o << endl;

	return 0;
}

Measured memory_bytes: 1232
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
double pi = 3.141592653589793;
ll mod = 1000000007;

int main() {
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    ll ans;
    if (K % 2 == 0) {
        ans = A - B;
    } else {
        ans = B - A;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,a[100000],L,g,tmp;
map<ll,ll> mp;
ll gcd(ll x,ll y){
    if(y==0)return x;
    return gcd(y,x%y);
}
int main(void){
    cin>>n>>k;
    cin>>a[0];
    a[0]/=2;
    L=a[0];
    for(int i=1;i<n;i++){
        cin>>a[i];
        a[i]/=2;
        g=gcd(L,a[i]);
        L=L/g*(a[i]/g)*g;
        if(L>k){cout<<0<<endl;return 0;}
    }
    tmp=(L/a[0])%2;
    for(int i=1;i<n;i++){
        if(tmp!=(L/a[i])%2){cout<<0<<endl;return 0;}
    }
    cout<<((k/L)+1)/2<<endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;


public class Main {

    static void solve() {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();


        if(n>=400 && n<=599) {
            System.out.println(8);
            return;
        }
        if(n>=600 && n<=799) {
            System.out.println(7);
            return;
        }
        if(n>=800 && n<=999) {
            System.out.println(6);
            return;
        }
        if(n>=1000 && n<=1199) {
            System.out.println(5);
            return;
        }
        if(n>=1200 && n<=1399) {
            System.out.println(4);
            return;
        }
        if(n>=1400 && n<=1599) {
            System.out.println(3);
            return;
        }
        if(n>=1600 && n<=1799) {
            System.out.println(2);
            return;
        }
        if(n>=1800 && n<=1999) {
            System.out.println(1);
            return;
        }


//        for (int i = 0; i < n; i++) {
//
//        }

//        int t = scan.nextInt();
//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
//            int[] arr1 = new int[n];
//            for (int j = 0; j < n; j++) {
//                arr1[j] = scan.nextInt();
//            }
////            scase(n, arr1);
//        }


//        long t = scan.nextLong();

//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
////            scase(n);
//        }
    }


    static void solveCase(int t, int x, String s) {

    }

    static void scase(int[] arr1, int[] arr2) {
    }


    public static void main(String[] args) {

        solve();

    }


//
//    class Counter extends HashMap<Integer, Integer> {
//        public int get(int k) {
//            return containsKey(k) ? super.get(k) : 0;
//        }
//
//        public void add(int k, int v) {
//            put(k, get(k) + v);
//        }
//    }

    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }
}

Measured memory_bytes: 27024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1);





int main() 
{
  string S; cin>>S;
  ll N=S.size();
  queue<ll> que;
  vector<ll> ans(N);
  rep(i,N-1)
  {
    if(S.at(i)=='R'&&S.at(i+1)=='L')
    {
      que.push(i+1);
    }
    /*
    if(S.at(i)=='L'&&S.at(i+1)=='R')
    {
      que.push(i+1);
    }
    */
  }
  rep(i,N)
  {
    if(i>que.front()&&S.at(i)=='R') {que.pop();}
    if(S.at(i)=='R')
    {
      if((que.front()-i)%2==0)
      {
        ans.at(que.front())++;
        continue;
      }
      ans.at(que.front()-1)++;
    }
    if(S.at(i)=='L')
    {
      if((i-que.front())%2==0)
      {
        ans.at(que.front())++;
        continue;
      }
      ans.at(que.front()-1)++;
    }
  }
  rep(i,N)
  {
    if(i!=0) {cout<<" ";}
    cout<<ans.at(i);
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 4424
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
#define Swap(a,b) (a+=b,b=a-b,a-=b)
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
static inline char GET(void)
{
  static char buf[1<<22],*s1=buf,*s2=buf;
  return s1==s2&&(s2=(s1=buf)+fread(buf,1,1<<22,stdin),s1==s2)?EOF:*s1++;
}
static inline void PUT(char c)
{
  static char buf[1<<15],*ptr=buf;
  if(ptr==buf+strlen(buf)||c==0){fwrite(buf,1,ptr-buf,stdout),ptr=buf;}*ptr++=c;
}
static inline int IN(void)
{
  int x=0,f=0,c=GET();while(c<48||c>57){f^=c==45,c=GET();}
  while(c>47&&c<58){x=x*10+c-48,c=GET();}return f?-x:x;
}
static inline void OUT(int a)
{
  if(a<0)PUT('-'),a=-a;
  int d[40],i=0;do{d[i++]=a%10;}while(a/=10);
  while(i--){PUT(d[i]+48);}PUT('\n');
}
//https://atcoder.jp/contests/abc176/submissions/16571317
//https://atcoder.jp/contests/abc176/submissions/16449316
static inline int Max(int x,int y){return x>y?x:y;}
int work[10006][3],sz=0;
static inline void Add(int x,int y,int v){work[sz][0]=x;work[sz][1]=y;work[sz++][2]=v;}
int main(void)
{
  int N=IN(),A[3*N],dp[N][N],B[N],mx,extra=0;
  rep(i,3*N)A[i]=IN()-1;
  memset(B,-0x3f,sizeof(B));
  memset(dp,-0x3f,sizeof(dp));
  dp[A[0]][A[1]]=dp[A[1]][A[0]]=B[A[0]]=B[A[1]]=mx=0;
  rep(i,N-1)
  {
    if(A[3*i+2]>A[3*i+3])Swap(A[3*i+2],A[3*i+3]);
    if(A[3*i+3]>A[3*i+4])Swap(A[3*i+3],A[3*i+4]);
    if(A[3*i+2]>A[3*i+3])Swap(A[3*i+2],A[3*i+3]);
    int x[3]={A[3*i+2],A[3*i+3],A[3*i+4]};
    if(x[2]==x[0]){extra++;continue;}
    if(x[0]==x[1])rep(j,N)Add(j,x[2],dp[j][x[0]]+1);
    if(x[1]==x[2])rep(j,N)Add(j,x[0],dp[j][x[1]]+1);
    rep(j,3)Add(x[j==0],x[j==2?1:2],dp[x[j]][x[j]]+1);
    rep(j,3)rep(k,j)Add(x[j],x[k],mx);
    rep(j,N)rep(k,3)Add(j,x[k],B[j]);
    rep(j,sz)if(dp[work[j][0]][work[j][1]]<work[j][2])
      dp[work[j][0]][work[j][1]]=dp[work[j][1]][work[j][0]]=work[j][2],
      B[work[j][0]]=Max(B[work[j][0]],work[j][2]),
      B[work[j][1]]=Max(B[work[j][1]],work[j][2]),mx=Max(mx,work[j][2]);
    sz=0;
  }
  return OUT(Max(mx,dp[A[3*N-1]][A[3*N-1]]+1)+extra),0;
}

Measured memory_bytes: 17256
X = []
def dfs(k, L):
    global cnt
    if k:
        X.append(int("".join(map(str, L))))
    if k == K:
        return
    if k == 0:
        for i in range(1, 10):
            dfs(k + 1, L + [i])
    else:
        l = L[-1]
        for i in range(max(l-1, 0), min(l+2, 10)):
            dfs(k + 1, L + [i])

K = 10
dfs(0, [])
print(sorted(X)[int(input()) - 1])

Measured memory_bytes: 92284
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, a[200005] = {}, b[69][200005] = {}, c = 1;
    ll k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++) cin >> a[i], b[0][i] = a[i];
    for (int i = 1; i <= 66; i++) for (int j = 1; j <= n; j++) b[i][j] = b[i - 1][b[i - 1][j]];
    for (int i = 62; i >= 0; i--) {
        if (k & (1ll << i)) c = b[i][c];
    }
    cout << c;
}


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

#define I inline
#define fi first
#define se second
#define R register
#define LL long long
#define mp make_pair
#define reg register int
#define pii pair<int,int>
#define cr const reg&
using namespace std;
const int inf = 2147483647;
const int N = 1e5 + 1;

I int _max(cr x, cr y) {return x > y ? x : y;}
I int _min(cr x, cr y) {return x < y ? x : y;}
I int read() {
	reg x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return x * f;
}

struct edge {
	int x, y, next;
} e[N * 2]; int len, last[N];
int sx, sy, dep[N], s[N], val[N];
int tp, sta[N];
bool v[N];

I void ins(cr x, cr y) {e[++len] = edge{x, y, last[x]}, last[x] = len;}

void dfs(cr x, cr fa) {
	v[x] = 1;
	for(reg k = last[x], y = e[k].y; k; k = e[k].next, y = e[k].y) if(y ^ fa){
		if(v[y]) sx = x, sy = y;
		else dep[y] = dep[x] ^ 1, dfs(y, x);
	}
}
void solve(cr x) {
	v[x] = 1;
	for(reg k = last[x], y = e[k].y; k; k = e[k].next, y = e[k].y) if(!v[y]){
		solve(y);
		val[x] += val[y];
		s[x] += s[y];
	}
}

int main() {
	reg n = read(), m = read();
	for(reg i = 1; i <= m; i++) {
		reg x = read(), y = read();
		ins(x, y), ins(y, x);
	} dfs(1, 0); LL ans = 0;
	reg u = 0; for(reg i = 1; i <= n; i++) {
		if(dep[i]) s[i] = 1, u++;
		else s[i] = -1, u--;
	} if(n == m) {
		if(dep[sx] ^ dep[sy]) {
			if(u) {puts("-1"); return 0;}
			val[sx]--, val[sy]++;
		} else {
			if(u & 1) {puts("-1"); return 0;}
			s[sx] -= u / 2, s[sy] -= u / 2;
			ans += abs(u / 2);
		}
	} else if(u) {puts("-1"); return 0;}
	memset(v, 0, sizeof(v));
	solve(1);
	sta[++tp] = 0;
	for(reg i = 1; i <= n; i++) {
		if(!val[i]) ans += abs(s[i]);
		else if(val[i] == -1) sta[++tp] = -s[i];
		else sta[++tp] = s[i];
	} sort(sta + 1, sta + tp + 1);
	reg c = sta[tp + 1 >> 1];
	for(reg i = 1; i <= tp; i++) ans += abs(sta[i] - c);
	printf("%lld\n", ans);
	return 0;
}



Measured memory_bytes: 9344
#include<bits/stdc++.h>
using namespace std;
int n,m,par[100005];
vector<int>g[100005];
vector<pair<int,int> >ans;
int deg[100005];
int find(int x){return x==par[x]?x:par[x]=find(par[x]);}
void dfs(int x,int par){
	for(auto to:g[x]){
		if(to!=par){
			dfs(to,x);
		}
	}
	if(deg[x]){
		ans.push_back(make_pair(x,par));
		deg[x]^=1;
	}else{
		ans.push_back(make_pair(par,x));
		deg[par]^=1;
	}
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n>>m;
	if(m&1){
		cout<<-1<<endl;
		return 0;
	}
	for(int i=1;i<=n;i++)par[i]=i;
	for(int i=1;i<=m;i++){
		int x,y;
		cin>>x>>y;
		if(find(x)!=find(y)){
			par[find(x)]=find(y);
			g[x].push_back(y);
			g[y].push_back(x);
		}else{
			ans.push_back(make_pair(x,y));
			deg[x]^=1;
		}
	}
	dfs(1,0);
	ans.pop_back();
	for(auto p:ans){
		cout<<p.first<<" "<<p.second<<endl;
	}
}

Measured memory_bytes: 13812
#include <iostream>
#include <vector>

using namespace std;

void ascendingOrderSort(vector<int>& cards);
void swap(int& left, int& right);
bool drawCard(vector<int>& cards, int& score);

int main() {
    int numOfCards = 0;
    cin >> numOfCards;
    vector<int> cards;
    int number;
    for (int i = 0; i < numOfCards; ++i) {
        cin >> number;
        cards.push_back(number);
    }
    
    ascendingOrderSort(cards);
    
    int scoreOfAlice = 0;
    int scoreOfBob = 0;
    while (true) {
        if(!drawCard(cards,scoreOfAlice)) {
            break;
        }
        if(!drawCard(cards,scoreOfBob)) {
            break;
        }
    }
    
    cout << scoreOfAlice - scoreOfBob << endl;
}
        
void ascendingOrderSort(vector<int>& cards) {
    for (size_t i = 0U; i < cards.size(); ++i) {
        for (size_t j = i + 1U; j < cards.size(); ++j) {
            if (cards.at(i) > cards.at(j)) {
                swap(cards.at(i), cards.at(j));
            }
        }
    }
}    

void swap(int& left, int& right) {
    int temp = left;
    left = right;
    right = temp;
}

bool drawCard(vector<int>& cards, int& score) {
    if (cards.empty()) {
        return false;
    } else {
        score += *cards.rbegin();
        cards.pop_back();
        return true;
    }
} 

Measured memory_bytes: 3612
n, k = map(int, input().split()) 
p_list = list(map(int, input().split()))
e_list = [(p + 1) / 2 for p in p_list]

s = sum(e_list[:k])
ans = s
for i, e in enumerate(e_list[k:]):
    s = s - e_list[i] + e
    ans = max(ans, s)
print(ans)

Measured memory_bytes: 25060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 2010

ll n, k;
ll cnt[100100];

int main() {
	cin >> n >> k;
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		cnt[a] += b;
	}
	REP(i, 100000) {
		k -= cnt[i + 1];
		if (k <= 0) {
			cout << i + 1 << endl;
			break;
		}
	}
}

Measured memory_bytes: 1024
Arr = []
Arr = input().split()
for i in range(3):
    Arr[i] = int(Arr[i])
for j in range(0, 2, 1):
    for i in range(0 , 2-j , 1):
        if(Arr[i] > Arr[i+1]):
            buf = Arr[i]
            Arr[i] = Arr[i+1]
            Arr[i+1]=buf
print("{} {} {}".format(Arr[0],Arr[1],Arr[2]))

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

int main() {
  int N;
  int K;
  cin >> N >> K;
  vector<int> ls(N);
  for (int i = 0; i < N; i++) {
    cin >> ls[i];
  }
  sort(ls.begin(), ls.end());
  int len = 0;
  for (int i = 0; i < K; i++) {
    len += ls[ls.size()-i-1];
  }
  cout << len << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
#define all(a) a.begin(),a.end()
using namespace std;
ll n,d,ans=0;
int main(void){
	cin>>n>>d;
	d=d*d;
	REP(i,n){
		ll x,y;
		cin>>x>>y;
		ll cnt=x*x+y*y;
		if(cnt<=d)ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3600
import sys
import heapq
n = int(input())
v_ls = []
x_ls = []
y_ls = []
for j in range(n):
    x, y = [int(i) for i in sys.stdin.readline().split()]
    v_ls.append((j, x, y))

graph = {i:[] for i in range(n)}
v_ls.sort(key=lambda x:x[1])
for i, v in enumerate(v_ls[:-1]):
    _from = v
    _to = v_ls[i + 1]
    diff = _to[1] - _from[1]
    graph[_from[0]].append((_to[0], diff))
    graph[_to[0]].append((_from[0], diff))

v_ls.sort(key=lambda x:x[2])
for i, v in enumerate(v_ls[:-1]):
    _from = v
    _to = v_ls[i + 1]
    diff = _to[2] - _from[2]
    graph[_from[0]].append((_to[0], diff))
    graph[_to[0]].append((_from[0], diff))

v_ls.sort(key=lambda x:x[0])
already = set()
cur = [(0, 0)]
cost = 0
while len(cur) > 0:
    cur_cost, cur_ind = heapq.heappop(cur)
    if cur_ind in already:
        continue
    already.add(cur_ind)
    cost += cur_cost
    for _next, next_cost in graph[cur_ind]:
        if _next in already:
            continue
        heapq.heappush(cur, (next_cost, _next))
    if len(already) == n:
        break
print(cost)

Measured memory_bytes: 126296
#include<cstdio>

#define MOD 1000000007

typedef long long int lli;
char prime[200000];

lli inv(lli x) {
    lli r = 1;
    lli b = MOD - 2;
    while(b) {
        if(b&1) r *= x, r %= MOD;
        x *= x, x %= MOD;
        b >>= 1;
    }
    return r;
}

lli comb(lli x, lli y) {
    lli r = 1;
    for(lli i=0; i<y; i++)
        r *= x-i, r %= MOD;
    for(lli i=0; i<y; i++)
        r *= inv(i+1), r %= MOD;
    return r;
}

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

    for(lli i=2; i*i<=m; i++)
        prime[i] = 1;
    for(lli i=2; i*i<=m; i++)
        for(lli j=2; i*j*i*j<m; j++)
            prime[i*j] = 0;

    lli res = 1;
    for(lli i=2; i*i<=m; i++) {
        lli j;
        for(j=0; m%i == 0; m/=i, j++);
        res *= comb(n-1+j, j), res %= MOD;
    }
    if(m != 1)
        res *= n, res %= MOD;

    printf("%lld\n", res);
}


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

#define ll long long
#define pi pair<int,int>
#define ppi pair<pi,pi>
#define mp make_pair
#define fr first
#define sc second

using namespace std;


int main(){

    ios::sync_with_stdio(0);
    cin.tie(0) , cout.tie(0);

    int n; cin >> n;
    bool ok = 0;
    while(n > 0){
        if(n % 10 == 7)ok = 1;
        n /= 10;
    }
    if (ok)cout << "Yes\n";
    else    cout << "No\n";


    return 0;
}


Measured memory_bytes: 3636
n=int(input())
h=list(map(int,input().split()))
for i in range(n-2,-1,-1):
    if h[i]>h[i+1]:
        h[i]-=1
for i in range(n-1):
    if h[i]>h[i+1]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 14252
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
using namespace std;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
int main(){
    int n;
    stack<int> st;
    while(cin >> n){
        if(n == 0){
            cout << st.top() << endl;
            st.pop();
        }
        else {
            st.push(n);
        }
    }
    return 0;
}


Measured memory_bytes: 3072
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[45];
        num[0] = 1;
        num[1] = 1;
        for(int i = 2; i <= n ; i++) {
                num[i] = num[i -1] + num[i -2];
        }
        int a = num[n];
        System.out.println(a);
    }
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

typedef long long int ll;

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

  if(n % 2 == 0){
      cout << n / 2 << endl;
  }else{
      cout << n / 2 + 1 << endl;
  }
}

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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

const int P = (1e9)+7;

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

    map<int,int> Map;

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

    bool Ans = true;

    for(auto x : Map)
    {
        if(x.first!=0 && x.second!=2)
        {
            Ans = false;
        }
    }

    ll ans = 1;

    if(Ans)
    {
        for(int i=0;i<(N/2);i++)
        {
            ans *= 2;
            ans %= P;
        }

        cout << ans << endl;
    }
    else
    {
        cout << '0' << endl;
    }

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> data(N);
  int sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> data.at(i);
    sum += data.at(i);
  }
  
  int suml = 0, sumr = 0;
  int cntl = 0, cntr = N-1;
  for (int i = 0; i < N; i++) {
    if (suml > sumr) {
      sumr += data.at(cntr);
      cntr--;
    } else {
      suml += data.at(cntl);
      cntl++;
    }
  }
  
  cout << abs(suml-sumr) << endl;
}

Measured memory_bytes: 256
#include <cstdio>
long long a,b,k;
int main()
{
  scanf("%lld%lld%lld",&a,&b,&k);
  if(a<k){
    k-=a;
  	a=0;
  } else {
  	a-=k;
    k=0;
  }
  if(b<k){
  	k-=b;
    b=0;
  } else {
  	b-=k;
    k=0;
  }
  printf("%lld %lld",a,b);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

int main() {
	ll n, m, a; cin >> n >> m;
	if (n == 1 && m == 1) a = 1;
	else if (m == 1) a = n - 2;
	else if (n == 1) a = m - 2;
	else a = (n - 2)*(m - 2);
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll LINF = 1001002003004005006LL;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int h1, m1, h2, m2, k; cin >> h1 >> m1 >> h2 >> m2 >> k;
    if (h1 > h2) h2 += 24;
    int tom = (h2-h1)*60 + (m2-m1);
    cout << tom - k << endl; 
    return 0;
}

Measured memory_bytes: 3636
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    N = str(N)
    N1 = N[-1]
    if N1 == "3":
        print("bon")
    elif N1 == "0" or N1 =="1" or N1 =="6" or N1 =="8":
        print("pon")
    else:
        print("hon")
    


if __name__ == "__main__":
	main()

Measured memory_bytes: 61736
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

func cal(n, x int) int {
	cnt := 0
	for i := 1; i <= n; i++ {
		for j := i + 1; j <= n; j++ {
			for k := j + 1; k <= n; k++ {
				if i+j+k == x {
					cnt++
				}
			}
		}
	}
	return cnt
}

func main() {
	w := bufio.NewWriter(os.Stdout)
	for {
		n, x := scanInt(), scanInt()
		if n+x == 0 {
			break
		}
		fmt.Fprintln(w, cal(n, x))
	}
	w.Flush()
}



Measured memory_bytes: 1136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long int MOD = 1000000007;
const long long  INF = 1LL << 60;

int main(void){
    int N; cin >> N;
    
    vector<ll> money = {1};
    int i = 1;
    while(pow(6,i) <= N){
        money.push_back(pow(6,i));
        money.push_back(pow(9,i));
        i++;
    }
    
    // for(auto i: money) cout << i << ' ';
    vector<ll> dp(10000000, INF);
    dp[0] = 0;
    for(int i = 0; i < N; i++){
        for(auto j : money){
            dp[i+j] = min(dp[i+j], dp[i] + 1);
        }
    }
    cout << dp[N] << endl;
}


Measured memory_bytes: 78336
#include<bits/stdc++.h>
using namespace std;
#define PB push_back
#define ll long long

int main(){
#ifndef ONLINE_JUDGE
	freopen("C:\\Users\\User\\Documents\\input.txt","r",stdin);
#endif
	int T,i,j;
	ll a,b,c,d,res=0;
	cin>>a>>b>>c>>d;

	res=max(a*c,max(b*d,max(a*d,b*c)));
	printf("%lld\n",res);


		
		
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int n;
    cin >> n;
    if(n==0) return 0;
    vector<vector<int>> e(26);
    vector<int> deg(26,0);
    vector<string> s(n);
    queue<int> q;
    rep(i,n){
      cin >> s[i];
    }
    rep(i,n){
      rep(j,i){
        rep(k,min(s[i].length(),s[j].length())){
          if(s[i][k]!=s[j][k]){
            e[s[j][k]-'a'].push_back(s[i][k]-'a');
            deg[s[i][k]-'a']++;
            goto next;
          }
        }
        if(s[i].length()<s[j].length()){
          cout << "no" << endl;
          goto nextt;
        }
        next:;
      }
    }
    rep(i,26) if(deg[i]==0) q.push(i);
    while(!q.empty()){
      int now = q.front();
      q.pop();
      for(auto nx:e[now]){
        deg[nx]--;
        if(deg[nx]==0) q.push(nx);
      }
    }
    rep(i,26){
      if(deg[i]!=0){
        cout << "no" << endl;
        goto nextt;
      }
    }
    cout << "yes" << endl;
    nextt:;
  }
  return 0;
}



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

int palindrome(string s, int x, int y){ //xは始点、yは終点
    bool flg=true;
    for(int i=x;i<y/2;i++){
        if(s.at(i) != s.at(y-1-i)){
            flg=false;
            break;
        }
    }
    if(flg==true){
        return 1;
    }
    else{
        return 0;
    }
}

int main(){
    string s; cin >> s;
    if(palindrome(s,0,s.size())==1){
        string forward_s = s.substr(0,(s.size()-1)/2);
        if(palindrome(s,0,forward_s.size())==1){
            string back_s = s.substr((s.size()+3)/2-1);
            if(palindrome(back_s,0,back_s.size())==1){
                cout << "Yes" << endl;
            }
            else{
                cout << "No" << endl;
            }
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        cout << "No" << endl;
    }
}

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

using ll = long long;
using pii = pair<int, int>;

#define     endl               "\n"
#define     fast_io            ios::sync_with_stdio(false); cin.tie(0);
#define     file_io            freopen("input.txt", "r", stdin);   \
                               freopen("output.txt", "w", stdout);
#define     all(x)             begin(x), end(x)
#define     debug(x)           cerr <<"Line "<< __LINE__ <<" : "<< #x " = "<< x <<endl;
 
template<typename T, typename TT>
ostream& operator<<(ostream &os, const pair<T, TT> &t) { return os<<"("<<t.first<<", "<<t.second<<")"; }
template<typename T>
ostream& operator<<(ostream& os, const vector<T> &t) { for(auto& i: t) os<<i<<" "; return os; }
 



int main(int argc, char** argv) {
    fast_io
   
	int n;
	cin >> n;
	
	unordered_map<char, bitset<53>> table;
	for(int i = 0; i < n; ++i) {
		char ch; int a;
		cin >> ch >> a;
		table[ch][a] = 1;
	}
	
	for(char ch : {'S', 'H', 'C', 'D'}) {
		for(int i = 1; i <= 13; ++i) if(!table[ch][i]) cout << ch << " " << i << endl;
	}
	

    return 0;
}























Measured memory_bytes: 3168
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>
#include <fstream>

using namespace std;
typedef long long ll;

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 (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353;
constexpr int MAX = 5000000;


int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string s; cin >> s;
	if (s.back() == 's') s += "es";
	else s += 's';
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3648
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		
		TreeMap<String, Integer> map = new TreeMap<String, Integer>();
		String ansLongWord = "";
		int maxLen = 0;
		while(stdIn.hasNext())
		{
			String word = stdIn.next();
			if(word.equals("end"))
			{
				break;
			}
			if(maxLen < word.length())
			{
				maxLen = word.length();
				ansLongWord = word;
			}
			if(map.containsKey(word))
			{
				int c = map.get(word);
				map.put(word, c + 1);
			}
			else
			{
				map.put(word, 1);
			}
			
		}
		Iterator it = map.keySet().iterator();
		int maxCount = 0;
		String ansFreqWord = "";
		while(it.hasNext())
		{
			String s = (String)it.next();
			if(maxCount < map.get(s))
			{
				maxCount = map.get(s);
				ansFreqWord = s;
			}
		}
		System.out.println(ansFreqWord + " " + ansLongWord);
	}
}

Measured memory_bytes: 11000
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
//    freopen("in.txt", "r", stdin);
    int a,b,c;
    scanf("%d%d%d", &a, &b, &c);
    printf("%d\n", (a-b)%c);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i=0;i<N;i++){
        cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    int a;
    if(N%2 ==0){
        a=vec.at((N/2))-vec.at((N/2)-1);
    }
    else{
        a =max(vec.at(1+N/2)-vec.at(N/2),vec.at(N/2)-vec.at((N/2)-1));
    }
    cout<<a<<endl;
    
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClassLibrary1
{
    public class ListNode
    {
        public int val;
        public ListNode next;
        public ListNode(int x) { val = x; }
    }


    public class Class1
    {
        static Dictionary<Tuple<long, long>, long> dic = new Dictionary<Tuple<long, long>, long>();

        static long mod = 1000000007;

        static void Main(string[] args)
        {

            var N = ReadString().ToArray()[0];

            var ss = "abcdefghijklmnopqrstuvwxyz".ToArray();
            for(int i=0; i<26; i++)
            {
                if( ss[i] == N)
                {
                    Console.WriteLine(ss[i+1]);
                    return;
                }
            }

        }

        public static long Factorial(int n)
        {
            if (n == 0)
                return 1L;
            return n * Factorial(n - 1);
        }

        private static string ReadString()
        {
            return Console.ReadLine();
        }
        private static string[] ReadStringArr()
        {
            return Console.ReadLine().Split(' ');
        }
        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadLongArr()
        {
            string[] s = ReadStringArr();
            long[] l = new long[s.Length];
            for(int i=0; i<l.Length; i++)
            {
                l[i] = long.Parse(s[i]);
            }

            return l;
        }
    }

}


Measured memory_bytes: 13268
n = int(input())
s = []
sum = 0
for i in range(n):
    x = int(input())
    sum += x
    s.append(x)
if sum % 10 != 0:
    ans = sum
else:
    ans = 0
    s.sort()
    for i in s:
        if (sum - i) % 10 != 0:
            ans = sum - i
            break
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <map>
using namespace std;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n;i>s;i--)
#define rep_re(i,s,n)for(int i = n;i>=s;i--)
typedef long long ll;
//static const ll MOD = 1e9 + 7;
//static const ll INF = (ll)1 << 62;
//
ll n, m;
vector<pair<ll, ll>> p;
priority_queue<ll> pri;
int main() {
	cin >> n >> m;
	rep(i, 0, n) {
		ll a, b; cin >> a >> b;
		p.push_back({ a,b });
	}
	sort(p.begin(), p.end());

	ll d = 1;
	vector<pair<ll, ll>>::iterator it = p.begin();
	ll ans = 0;
	while (d <= m) {
		for (; it != p.end();) {
			if (it->first <= d) {
				pri.push(it->second);
				it++;
			}
			else {
				break;
			}
		}
		if (pri.size() != 0) {
			ans += pri.top(); pri.pop();
		}
		d++;
	}

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


Measured memory_bytes: 3568
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF (1LL<<60)
#define fs first
#define sc second
#define pb push_back
#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(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);  
  //問題文を読む時間をケチらない！！

  int n,k;

  cin >> n >> k;

  if((n+1)/2 >= k) cout  << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    Scanner(System.`in`).use { sc ->
        var n = sc.nextInt()
        val k = sc.nextInt()
        val hate: Set<Char> = sc.asSequence().take(k).map {it[0]}.toSet()
        while (true) {
            if (n.toString().asSequence().none { c: Char ->
                hate.contains(c)
            }) {
                break
            }
            n++
        }
        println(n)
    }
}


Measured memory_bytes: 36964
#include <stdio.h>

int main() {
    int a,b,i,j;
 
    
    while(1){
        scanf("%d%d",&a,&b);
        if(a==0&&b==0)
            break;
        
        for(j=0;j<a;j++){
            for(i=0;i<b;i++)
                printf("#");
            printf("\n");
        }
        printf("\n");
    
    }
    return 0;
}


Measured memory_bytes: 2140
/*************************************************************************
  >         File: B.cc
  >       Author: lyyllyyl
  >         Mail: riho.yoshioka@yandex.com
  > Created Time: Sun 23 Oct 2016 09:47:50 PM CST
*************************************************************************/
#include <bits/stdc++.h>

int main() {
  std::ios::sync_with_stdio(0);
  int sum, n;
  std::cin >> sum >> n;
  int a[111];
  for (int i = 0; i < n; ++i) std::cin >> a[i];
  int mx = *std::max_element(a, a + n);
  if (2 * mx > sum) {
    std::cout << sum - (sum - mx) * 2 - 1 << std::endl;
  }
  else {
    std::cout << 0 << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
def main():
    x, k, d = map(int, input().split())
    x = abs(x)
    if k*d < x:
        print(abs(x - k*d))
    else:
        p = x//d
        x -= p*d
        k -= p
        if k%2 == 0:
            print(abs(x))
        else:
            print(abs(x-d))

if __name__ == "__main__":
    main()

Measured memory_bytes: 9184
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include<iomanip>
#define nummax 110000
using namespace std;

int main() {
	double ans = 0.0, y, i, N, K, x;
	cin >> N >> K;
	for (i = 1; i <= N; i++)
	{
		x = 0;
		while (1)
		{
			if (i * pow(2, (double)x) >= K)
				break;
			x++;
		}
		x *= -1;
		y = pow(2, (double)x);
		ans += y;
	}
	ans /= N;
	//cout << ans << endl;
	cout << fixed << setprecision(9) << ans << endl;
}


Measured memory_bytes: 256
/*input
2
ip cc
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define eb emplace_back
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define EL cout<<'\n'
#define BS(a,x) binary_search(ALL(a),x)
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
	REP(i,SZ(V)) out<<V[i]<<((i!=SZ(V)-1)?" ":"");
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=20;
const ll INF64=1e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}


int main(){
	IOS;
	int n,k;
	cin>>n>>k;
	int ans=0;
	REP(i,n){
		int x;
		cin>>x;
		if(x>=k) ans++;
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	char s[3]={0};
	int i,a=0,b=0;
	for(i=0;i<3;i++)
	{
		scanf("%c",&s[i]);
		if(s[i]=='A')
			a++;
		else 
			b++;
	}
	if(a==3||b==3)
		printf("No");
	else 
		printf("Yes");
	
}

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

int main(){
	int N,X;
	cin>>N>>X;
	
	int m[N];
	for(int i=0;i<N;i++)
		cin>>m[i];
	
	for(int i=0;i<N;i++)
		X-=m[i];
	
	sort(m,m+N);
	
	cout<<N+X/m[0]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






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


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string  s;
  cin >> s ;
  int n = SZ(s) ;
  bool f1,f2,f3 ;
  f1 = false ;
  f2 = false ;
  f3 = false ;
  string s1, s2, s3, t1, t2, t3 ;
  s1 = s ;
  t1 = s ;
  reverse(ALL(s1)) ;
  if(s1==t1){
    f1 = true ;
  }
  s2 = s.substr(0,(n-1)/2) ;
  t2 = s2 ;
  reverse(ALL(s2)) ;
  if(s2==t2){
    f2 = true ;
  }
  s3 = s.substr((n+3)/2,n-(n+3)/2+1) ;
  t3 = s3 ;
  if(s3==t3){
    f3 = true ;
  }
  
  if(f1 && f2 && f3){
    yes() ;
  }
  else{
    no() ;
  }
  
  
  
  
  return 0 ;
}




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

typedef long long lint;

char S[105];

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int N, K;

	cin >> S >> K;

	for(N = 0; S[N]; N++);
	bool o = true;
	for(int i = 1; i < N; i++) if(S[i] != S[0]) o = false;
	if(o) {
		cout << (lint)N * K / 2 << "\n";
		return 0;
	}
	lint ans = 0;
	int f, b, p;
	for(f = 1; S[f] == S[f - 1]; f++);
	p = f;
	for(int i = p + 1; i < N; i++) if(S[i] != S[i - 1]) {
		ans += (i - p) / 2;
		p = i;
	}
	b = N - p;
	//printf("ans = %lld, f = %d, b = %d\n", ans, f, b);
	ans *= K;
	if(S[0] == S[N - 1]) ans += (lint)(f + b) / 2 * (K - 1);
	else ans += (lint)(f / 2 + b / 2) * (K - 1);
	ans += f / 2 + b / 2;
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	ll tmp;
	int n, m,k;
	cin >> n >> m >>k;
	vector<int> a(n+1);
	REP1(i, n) cin >> a[i];
	vector<int> b(m+1);
	REP1(i, m) cin >> b[i];
	ll suma[n+1] = {}, sumb[m+1] ={};
	REP1(i, n) suma[i] = suma[i-1] + a[i];
	REP1(i, m) sumb[i] = sumb[i-1] + b[i];
	ll books;
	REP(booka, n+1){
		if(suma[booka] > k ) break;
		books = booka;
		tmp = k - suma[booka];
		auto it = upper_bound(sumb, sumb + m + 1, tmp);
		it--;
		books += it - sumb;
		ans =max(ans, books);
	}
	cout << ans << endl;
}

Measured memory_bytes: 7928
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

const LL inf = 1123456714343;
int N;
int t[112], v[112];
LL last, memo[41234][234];
std::vector<int>lim;

LL dp(LL ti, LL sp)
{
	if (sp < 0) { return -inf; }
	if (ti == 0) {
		if (sp != 0)return -inf;
		return 0;
	}
	if (memo[ti][sp] != -1) { return memo[ti][sp]; }
	if (sp > lim[ti - 1])return -inf;
	LL a = dp(ti - 1, sp + 1) + sp + (sp + 1);
	LL b = dp(ti - 1, sp) + sp + sp;
	LL c = dp(ti - 1, sp - 1) + sp + (sp - 1);
	LL res = std::max(b, c); 
	if (sp + 1 <= lim[ti - 1]) { res = std::max(res, a); }
	return memo[ti][sp] = res;
}

int main()
{
	in >> N;
	/*
	rep(i, N) { in >> t[i]; }
	rep(i, N) { in >> v[i]; }

	memset(memo, 0xff, sizeof(memo));
	rep(i, N)
	{
		t[i] *= 2;
		v[i] *= 2;
		rep(j, t[i]) { lim.push_back(v[i]); }
		last += t[i];
	}
	*/

	rep(i, N) {
		int a; in >> a;
		a *= 2;
		t[i] = a;
		last += a;
	}
	rep(i, N) {
		int a; in >> a;
		a *= 2;
		v[i] = a;
		rep(j, t[i]) {
			lim.push_back(a);
		}
	}

	memset(memo, 0xff, sizeof(memo));
	LL ans = dp(last, 0);
	out << std::fixed << std::setprecision(15);
	out << (double) ans/ 8. << std::endl;
	return 0;
}

Measured memory_bytes: 79100
#include<stdio.h>

int main(void)
{
	int f1, n, a, b, c, x, nx, nL[100], cnt, fp, j;
	while(scanf("%d %d %d %d %d",&n, &a, &b, &c, &x) && n > 0)
	{
		cnt = 0;
		fp = 0;
		j = 0;
		for(f1 = 0; f1 < n; f1++)
		{
			scanf("%d",&nL[f1]);
		}
		while(fp != n && cnt <= 10000)
		{
			if(cnt == 0 && nL[fp] == x && j == 0){
				fp++;
				j = 1;
			}
			else{
				cnt++;
				nx = (a * x + b) % c;
				if(nL[fp] == nx)
					fp++;
				x = nx;
			}
		}
		if(cnt <= 10000)
			printf("%d\n",cnt);
		else
			printf("-1\n");
	}
	return 0;
}

Measured memory_bytes: 0