akhauriyash/Code-Regression huggingface dataset:
package main

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

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt, sum int = 0, 0, 0

func main() {
	reader.Split(bufio.ScanWords)
	N, _ := strconv.Atoi(read())
	K, _ := strconv.Atoi(read())
	h := make([]int, N)
	for i := 0; i < N; i++ {
		h[i], _ = strconv.Atoi(read())
	}
	for i := 0; i < N; i++ {
		if K <= h[i] {
			ans++
		}
	}
	fmt.Println(ans)
}

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

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

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

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

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; i++ {
		fac[i] = fac[i-1] * i % mod
		inv[i] = mod - inv[mod%i]*(mod/i)%mod
		finv[i] = finv[i-1] * inv[i] % mod
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] > h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


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

int main()
{
  int n;
  string s;
  cin >> n >> s;
  ll r, g, b;
  r = g = b = 0;
  for (int i = 0; i < n; i++)
  {
    if (s[i] == 'R')
    {
      r++;
    }
    else if (s[i] == 'G')
    {
      g++;
    }
    else if (s[i] == 'B')
    {
      b++;
    }
  }

  ll ng = 0;
  for (int i = 0; i < n - 1; i++)
  {
    for (int j = i + 1; j < n; j++)
    {
      if (s[i] == s[j])
        continue;
      int k = j * 2 - i;
      if (k >= n || s[k] == s[i] || s[k] == s[j])
        continue;

      ng++;
    }
  }
  ll rgb = r * g * b;
  cout << rgb - ng << endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define int long long
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=998244353;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int32_t main()
{

    int n;
    cin>>n;
    if(n==1)
        puts("Hello World");
    else
    {
        int a,b;
        cin>>a>>b;
        cout<<a+b<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long A = long.Parse(str[0]);
		long B = long.Parse(str[1]);
		long N = long.Parse(str[2]);
		long ans = Math.Max(A*(N%B)/B,A*Math.Min(N,B-1)/B);
		Console.WriteLine(ans);
	}
}

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

int main(){
	int x, y;
	cin >> x >> y;

	int ans = 0;
	if(x == 1) ans += 300000;
	else if(x == 2) ans += 200000;
	else if(x == 3) ans += 100000;

	if (y == 1)
		ans += 300000;
	else if (y == 2)
		ans += 200000;
	else if (y == 3)
		ans += 100000;

	if(x == 1 && y == 1) ans += 400000;

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string.h>
#include <math.h>
#include <bits/stdc++.h>

using namespace std;

bool isPrime[1000010];

int main(){
    for(int i = 1; i < 1000010; i++) isPrime[i] = 1;
    for(int i = 2; i < 1000010; i++){
        if(!isPrime[i]) continue;
        for(int j = i + i; j < 1000010; j += i){
            isPrime[j] = 0;
        }
    }
    vector<int> v;
    for (int i = 2; i < 1000010; i++){
        if(isPrime[i]) v.push_back(i);
    }
    int n;
    cin >> n;
    cout << *lower_bound(v.begin(),v.end(),n) << endl;
    return 0;
}


Measured memory_bytes: 1916
N = int(input())
a = list(map(int,input().split()))
b = {}
flag = 0
ke = []
for i in range(N):
    if a[i] in b:
        b[a[i]] += 1
    else:
        b[a[i]] = 1

if 0 in b:
    if b[0] == N:
        flag = 1

if len(b) == 2:    
    for key in b:
        ke.append(key)  
    if 0 in b:
        if b[ke[1]] / b[0] == 2 or b[ke[0]] / b[0] == 2:
            flag = 1

if len(b) == 3:
    for key in b.keys():
        ke.append(key)

    if b[ke[0]] == b[ke[1]] and b[ke[1]] == b[ke[2]]:
        if ke[0] ^ ke[1] == ke[2] or ke[1] ^ ke[2] == ke[0] or ke[0] ^ ke[2] == ke[1]:
            flag = 1

if flag == 1:
    print('Yes')
else:
    print('No')




Measured memory_bytes: 14212
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

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

  ll x = (N + 1) / 2;

  cout << fixed << setprecision(20) << x / (double)N << endl;
}

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

int main() {
  int A,B;
  cin>>A>>B;
  cout<<max(A+B,max(A-B,A*B))<<endl;
}

Measured memory_bytes: 3460
#include<bits/stdc++.h>
#define N 300005
#define mod 1000000007
#define ll long long
using namespace std;
ll up,n,m,k;
ll ans=0,fac[N*3],ifac[N*3],mul[N*3];
inline ll calc(int a,int b){return fac[a]*ifac[b]%mod*ifac[a-b]%mod;}
inline ll ksm(ll x,int p){
	ll ret=1;
	while(p){
		if(p&1)ret=ret*x%mod;
		x=x*x%mod,p>>=1;
	}
	return ret;
}
int main(){
	cin>>n>>m>>k,up=n+m+k,fac[0]=mul[0]=ifac[1]=ifac[0]=1;
	for(ll i=2;i<=up;++i)ifac[i]=(mod-mod/i)*ifac[mod%i]%mod;
	for(ll i=1;i<=up;++i)mul[i]=mul[i-1]*3%mod,(ifac[i]*=ifac[i-1])%=mod,fac[i]=fac[i-1]*i%mod;
	if(m<k)m^=k,k^=m,m^=k;
	for(ll i=0,j=1;i<=m+k;++i){
		(ans+=calc(n-1+i,n-1)*mul[m+k-i]%mod*j%mod)%=mod;
		if(i<k)(j<<=1)%=mod;
		else if(i>=m)(j+=j-calc(i,k)-calc(i,i-m))%=mod;
		else (j+=j-calc(i,k))%=mod;
	}
	cout<<(ans+mod)%mod;
	return 0;
}

Measured memory_bytes: 21376
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	double d;
	cin>>n>>d;
	ll ans=0;
	for(ll i=0;i<n;i++){
		double x,y;
		cin>>x>>y;
		double dis = sqrt(x*x + y*y);
		if(dis <= d) ans++;
	}
	cout<<ans;
	
	
	
	return 0;
}

Measured memory_bytes: 3800
# coding: utf-8

W,H,x,y,r = (int(x) for x in input().rstrip().split())

if x - r >= 0 and x + r <= W and \
   y - r >= 0 and y + r <= H:
    print("Yes")
else:
    print("No")



       
# <?php

# // x - r > 0
# // x + r < W

# // y - r > 0
# // y + r < H

# fscanf(STDIN,"%d %d %d %d %d",$W,$H,$x,$y,$r);

# if ($x - $r >= 0 && $x + $r <= $W &&
#     $y - $r >= 0 && $y + $r <= $H) {
#         echo "Yes".PHP_EOL;
#     } else {
#         echo "No".PHP_EOL;
#     }

# ?>


Measured memory_bytes: 5608
#include <stdio.h>
#include <stdlib.h>
void insertionSort(int *, int);
int main(){
  int *A;
  int k;
  int n;
  scanf("%d", &n);
  A = (int *)malloc(sizeof(int) * n);
  for(k = 0; k < n; k++)
    scanf("%d", &A[k]);
//  printf("\n");
  insertionSort(A, n);
  free(A);
  return 0;
}

void insertionSort(int* A, int N){
  int i, k;
  printf("%d", A[0]);
  for(k = 1; k < N; k++)
    printf(" %d", A[k]);
  printf("\n");
  for(i = 1; i < N; i++){
    int j;
    for(j = i - 1; j >= 0 && A[j] > A[j + 1]; j--){
      int tmp = A[j];
      A[j] = A[j + 1];
      A[j + 1] = tmp;
    }
    printf("%d", A[0]);
    for(k = 1; k < N; k++)
      printf(" %d", A[k]);
    printf("\n");
  }
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  long long int N, X;
  string S;
  vector<long long int> x_v, d_v;
  cin >> N >> X;
  
  for (int i = 0; i < N; i++) {
    long long int x;
    cin >> x;
    x_v.push_back(x);
  }
  for (int i = 0; i < N; i++) {
    long long int d;
    d = abs(X - x_v[i]);
    d_v.push_back(d);
  }
  sort(d_v.begin(), d_v.end());
  for (int i = 0; i < N; i++) {
    //cout << d_v[i] << endl;
  }
  long long int common_factor = d_v[0];
  for (int i = 1; i < N; i++) {
    common_factor = gcd(common_factor, d_v[i]);
  }
  cout << common_factor << endl;
  return 0;
}


Measured memory_bytes: 2548
#include<stdio.h>

int main(void)


{


 long long int a[10000],min=1000000,max=-1000000,sum=0;


 int n,i;


 scanf("%d",&n);


 for(i=0;i<n;i++){


    scanf("%lld",&a[i]);


    if(a[i]>=max){


       max=a[i];


     }


     if(a[i]<=min){


        min=a[i];


     }


     sum+=a[i];


   }


   printf("%lld %lld %lld\n",min,max,sum);


   return 0;


}


    

Measured memory_bytes: 2776
#include<iostream>
using namespace std;
int main(){
	int s;
	cin>>s;
	if(s==0)
	cout<<0;
	if(s==1||s==10||s==100)
	cout<<1;
	if(s==110||s==101||s==11)
	cout<<2;
	if(s==111)
	cout<<3;
	return 0;
	}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int INF = 2e9;



int main() {
	ll n, a, b; cin >> n >> a >> b;
	vector<int> x(n);
	rep(i, 0, n) cin >> x[i];
	ll ans = 0;
	rep(i, 0, n - 1) {
		ans += min(1LL*(x[i + 1] - x[i]) * a, b);
	}
	printf("%lld", ans);
	return 0;
}

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

using namespace std;

const int NS = (int)2e5+4;
int N, Q;
char arr[NS], mov[NS][4];

int main(){
    scanf("%d %d", &N, &Q);
    scanf("%s", arr+1);
    for(int i=1;i<=Q;++i) scanf(" %c %c", &mov[i][1], &mov[i][2]);
    int ans = N;
    int l = 1, r = N, mid;
    while(l<r){
        mid = (l+r)/2+1; int pos = mid;
        for(int i=1;i<=Q;++i) if(mov[i][1]==arr[pos]){
            pos += mov[i][2]=='L'? -1:1;
            if(!pos) break;
        }
        if(!pos) l = mid;
        else r = mid-1;
    }
    if(l==1&&r==1){
        mid = 1; int pos = mid;
        for(int i=1;i<=Q;++i) if(mov[i][1]==arr[pos]){
            pos += mov[i][2]=='L'? -1:1;
            if(!pos) break;
        }
        if(pos) r = 0;
    }
    ans -= r;
    l = 1, r = N, mid;
    while(l<r){
        mid = (l+r)/2; int pos = mid;
        for(int i=1;i<=Q;++i) if(mov[i][1]==arr[pos]){
            pos += mov[i][2]=='L'? -1:1;
            if(pos>N) break;
        }
        if(pos>N) r = mid;
        else l = mid+1;
    }
    if(l==N&&r==N){
        mid = N; int pos = mid;
        for(int i=1;i<=Q;++i) if(mov[i][1]==arr[pos]){
            pos += mov[i][2]=='L'? -1:1;
            if(pos>N) break;
        }
        if(pos<=N) l = N+1;
    }
    ans -= N-l+1;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
using namespace std;

struct node {
	int key;
	node *p, *lc, *rc;
	node(int key){
		this->p = this->lc = this->rc = NULL;
		this->key = key;
	}
	void push(node *nod){
		if(this->key == INT_MAX){
			this->key = nod->key;
			return;
		}
		
		if(this->key > nod->key){
			if(this->lc == NULL){
				nod->p = this;
				this->lc = nod;
			}else this->lc->push(nod);
		}else{
			if(this->rc == NULL){
				nod->p = this;
				this->rc = nod;
			}else this->rc->push(nod);
		}
	}
	bool find(int fkey){
		if(this->key > fkey){
			if(this->lc == NULL) return false;
			else return this->lc->find(fkey);
		}else if(this->key < fkey){
			if(this->rc == NULL) return false;
			else return this->rc->find(fkey);
		}else return true;
	}
	void inprint(){
		if(this->lc != NULL) this->lc->inprint();
		cout << " " << this->key;
		if(this->rc != NULL) this->rc->inprint();
	}
	void preprint(){
		cout << " " << this->key;
		if(this->lc != NULL) this->lc->preprint();
		if(this->rc != NULL) this->rc->preprint();
	}
};

int main() {
	int n;
	cin >> n;
	
	node top(INT_MAX);
	while(n--){
		string com;
		cin >> com;
		
		if(com[0] == 'i'){
			int key;
			cin >> key;
			
			node *nod = new node(key);
			top.push(nod);
		}else if(com[0] == 'f'){
			int key;
			cin >> key;
			
			cout << (top.find(key) ? "yes" : "no") << endl;
		}else{
			top.inprint();
			cout << endl;
			top.preprint();
			cout << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 19956
import sys
sys.setrecursionlimit(10**9)

k=int(input())

def dfs(keta,num):
  lunlun.append(int(num))
  if keta==10:
    return

  min_v=max(0,int(num[-1])-1)
  max_v=min(9,int(num[-1])+1)

  for i in range(min_v,max_v+1):
    dfs(keta+1,num+str(i))

lunlun=[]
for i in range(1,10):
  dfs(0,str(i))

lunlun.sort()
print(lunlun[k-1])

Measured memory_bytes: 32676
#include <bits/stdc++.h>
using namespace std;
struct _I { _I() {cin.tie(0);ios::sync_with_stdio(false);}} __I;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_h(const vector<T>& c, int n=INT_MAX)
{ rep(i, min(n, (int)c.size())) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 
#define MOD 1000000007

int main()
{
    int H, W, D; cin >>H>>W>>D;
    unordered_map<int, pii> m;
    rep(i, H) {
        rep(j, W) {
            int A; cin >> A;
            m[A] = make_pair(i, j);
        }
    }

    vi cost(H*W+1, 0); // 前のマス(x-D)からあるマス(x)に移動するのに必要な累積コスト(魔力)
    rep1(x, H*W+1) {
        if (x-D >= 1) {
            cost[x] = cost[x-D] + abs(m[x].first - m[x-D].first) + abs(m[x].second - m[x-D].second);
        }
    }

    int Q; cin >> Q;
    rep(i, Q) {
        int L, R; cin >> L >> R;
        cout << (cost[R] - cost[L]) << endl;
    }
}


Measured memory_bytes: 5284
#include <bits/stdc++.h>
using namespace std;
char a[10001];
long long f[10001][3][101];
int main()
{
	int ans=0,d,i,j,k,l,len;
	scanf("%s",a);
	scanf("%d",&d);
	len=strlen(a);
	f[0][0][0]=1;
	for(i=0;i<len;i++)
	{
        for(j=0;j<2;j++)
		{
            for(k=0;k<d;k++)
			{
                for(l=0;l<=(j?9:a[i]-'0');l++)
				{
					if(j==1||l<a[i]-'0')
					{
						f[i+1][1][(k+l)%d]+=f[i][j][k];
						f[i+1][1][(k+l)%d]%=1000000007;
					}
					else
					{
						f[i+1][0][(k+l)%d]+=f[i][j][k];
						f[i+1][0][(k+l)%d]%=1000000007;
					}
                }
            }
        }
    }
	printf("%lld",((f[len][0][0]+f[len][1][0]-1)%1000000007+1000000007)%1000000007);
	return 0;
}

Measured memory_bytes: 23936
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N=gets.to_i
A=get_i
rate=array(9,0)
A.each do|a|
    if a.between?(1,399)
        rate[0]+=1
    elsif a.between?(400,799)
        rate[1]+=1
    elsif a.between?(800,1199)
        rate[2]+=1
    elsif a.between?(1200,1599)
        rate[3]+=1
    elsif a.between?(1600,1999)
        rate[4]+=1
    elsif a.between?(2000,2399)
        rate[5]+=1
    elsif a.between?(2400,2799)
        rate[6]+=1
    elsif a.between?(2800,3199)
        rate[7]+=1
    else
        rate[8]+=1
    end
end

min=0
8.times do|i|
  min+=1 if rate[i]>0
end
max=min+rate[8]
puts [(min.zero? and rate[8]>0) ? 1 : min,max].join(" ")

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
    vector<int> v(3);
    cin >> v[0] >> v[1] >> v[2];
    sort(v.begin(),v.end(),greater<int>());

    cout << v[0] * 10 + v[1] + v[2]<< endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int a, b;
    cin >> a >> b;
    if (a <= b) {
        cout << a << endl;
    }
    else {
        cout << a - 1 << endl;
    }
}

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

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define all(x) x.begin(), x.end()
#define PB push_back
#define F first
#define S second

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

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

	int n, m; cin >> n >> m;
	if(n == 1 && m == 0){
		cout << "0\n"; return 0;
	}
	string ans(n, '*');
	//cout << ans << '\n';
	FOR(i, m){
		int a, b; cin >> a >> b;
		if(ans[a-1] != '*' && ans[a-1] != b+'0'){
			cout << "-1\n"; return 0;
		}
		ans[a-1] = b+'0';
	}

	if(ans[0] == '*') ans[0] = '1';

	if(ans[0] == '0' && n > 1){
		cout << "-1\n"; return 0;
	}

	FOR(i, 3) if(ans[i] == '*') ans[i] = '0';

	cout << ans << '\n';


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	ll n, m, d; cin >> n >> m >> d;
	ll pro = 2 * (n - d);
	if (d == 0)pro /= 2;
	long double p = (long double)pro / n / n;
	p *= (m - 1);
	cout << p << "\n";

	return 0;
}

Measured memory_bytes: 3776
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <functional>

using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
void dfs(int N,int s,vector<int> G[],function<void(int,int,int)> F){
	stack<pair<int,int>> sp;
	sp.push({s,-1});
	while(!sp.empty()){
		int v = sp.top().first;
		int f = sp.top().second;
		sp.pop();
		for(int i=0;i<G[v].size();i++){
			int t = G[v][i];
			if(t != f){
				F(t,v,i);
				sp.push({t,v});
			}
		}
	}
}
long Dist[100000];
vector<int> G[100000];
vector<long> C[100000];
void Calc(){
	int N = rei();
	for(int i=0;i<N-1;i++){
		int f = rei()-1;
		int t = rei()-1;
		long c = rel();
		G[f].push_back(t);
		G[t].push_back(f);
		C[f].push_back(c);
		C[t].push_back(c);
	}
	int Q = rei();
	int K = rei()-1;
	function<void(int,int,int)> F = [&](int t,int v,int i){
		Dist[t] = Dist[v] + C[v][i];	
	};
	dfs(N,K,G,F);
	for(int i=0;i<Q;i++){
		int x = rei()-1;
		int y = rei()-1;
		long ans = Dist[x] + Dist[y];
		cout << ans << "\n";
	}
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 15088
/* template.cpp(shinobu_menkoi) {{{ */
#include <bits/stdc++.h>
using namespace std;

// clang-format off
#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rep1(n) rep2(_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, n) rep4(i, a, n, 1)
#define rep4(i, a, n, s) for (lint i = (a); i < (lint)(n); i += (s))
#define rrep(...) GET_MACRO(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rrep1(a) rrep2(_, a)
#define rrep2(i, a) rrep3(i, a, 0)
#define rrep3(i, a, n) rrep4(i, a, n, 1)
#define rrep4(i, a, n, s) for (lint i = (a); i >= (lint)(n); i -= (s))
#define each(i, ctn) for (auto &&i : (ctn))

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(v) begin(v), end(v)
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'
#define TEMP_T template <class T>
#define TEMP_TU template <class T, class U>

TEMP_T using vec = vector<T>;
TEMP_T using heap = priority_queue<T>;
TEMP_T using minheap = priority_queue<T, vec<T>, greater<T>>;
using lint = long long;
using ulint = unsigned long long;
using ld = long double;
using vi = vec<int>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<int, int>;
using vs = vec<string>;

TEMP_TU ostream &operator<<(ostream &os, const pair<T, U> &p) { return os << p.fi << " " << p.se; }
TEMP_TU istream &operator>>(istream &is, pair<T, U> &p) { return is >> p.fi >> p.se; }

const int INF{1001001001};
const lint LINF{1001001001001001001ll};
const int MOD{(int)1e9 + 7};
const double EPS{1e-9};
const double PI{acos(-1)};
const int dx[]{0, 1, 0, -1, 1, -1, 1, -1}, dy[]{1, 0, -1, 0, 1, -1, -1, 1};

inline bool inside(int y, int x, int h, int w) { return y >= 0 && x >= 0 && y < h && x < w; }
TEMP_T inline bool chmin(T &a, const T &b) { if (a > b) a = b; return a > b; }
TEMP_T inline bool chmax(T &a, const T &b) { if (a < b) a = b; return a < b; }
TEMP_T inline void print(const T &x) { cout << x << '\n'; }
TEMP_T inline void print(const vec<T> &v, string d = "\n") { rep(i, v.size()) cout << v[i] << (i == (lint)v.size() - 1 ? "\n" : d); }
template <class T = int> inline T in() { T x; cin >> x; return x; }
template <class T = string> vec<T> split(const string &s, char d = ',') {
  vec<T> v; stringstream ss(s); for (string b; getline(ss, b, d); ) {
    stringstream conv(b); T t; conv >> t; v.eb(t); } return v;
}
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } pre__;
// clang-format on
/* }}} */

vector<int> G[200000];
int n, m;

bool dfs(int now, int d) {
  if (now == n - 1) return true;
  if (d >= 2) return false;
  bool ret = false;
  each(e, G[now]) {
    ret |= dfs(e, d + 1);
  }

  return ret;
}

signed main() {
  cin >> n >> m;
  rep(i, m) {
    int a = in() - 1, b = in() - 1;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }

  print((dfs(0, 0)) ? "POSSIBLE" : "IMPOSSIBLE");
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int _StartTime_ = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);

    int n, a; cin >> n;
    deque<int> dq;
    rep(i,n) {
        cin >> a;
        if(i%2==0) dq.push_back(a);
        else dq.push_front(a);
    }
//    for(auto p : dq) debug(p);

    if(n%2==1) {
        while(dq.size()) {
            cout << dq.back(); dq.pop_back();
            cout << (dq.size() ? ' ' : '\n');
        }
    }
    else {
        while(dq.size()) {
            cout << dq.front(); dq.pop_front();
            cout << (dq.size() ? ' ' : '\n');
        }
    }

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC));
}

Measured memory_bytes: 3072
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
			Scanner sc = new Scanner(System.in);
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = b-1;
			if(c%(a-1)>=1) {
				System.out.println(c/(a-1)+1);
			}else {
			System.out.println(c/(a-1));
			}
			sc.close();
	}

}


Measured memory_bytes: 23892
N = int(input())

P = []
for i in range(N):
  x,y = map(int,input().split())
  P.append([x,y])

T = 0  
for i in range(N):
  for j in range(i+1,N):
    d = ((P[i][0]-P[j][0])**2+(P[i][1]-P[j][1])**2)**0.5
    T += d

ans = T*2/N
print(ans)

Measured memory_bytes: 3064
// Problem : E - Count Median
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define fastio                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z)                                                       \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define dbp(x) \
  cout << #x << "= {" << (x.first) << ", " << (x.second) << "}" << endl;
#define dbv(v)                         \
  {                                    \
    cout << #v << " : ";               \
    for (auto x : v) cout << x << ' '; \
    cout << endl;                      \
  }
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rep2(i, a, b) for (int i = a; i >= b; i--)
#define die(x) return cout << x << '\n', 0;

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int32_t main() {
  fastio;

  int testcases;
  testcases = 1;
  // cin>>testcases;

  while (testcases--) {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    rep(i, 0, n - 1) cin >> a[i] >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    int x, y;
    if (n % 2 == 0) {
      rep(i, 0, n - 1) {
        a[i] = 2 * a[i];
        b[i] = 2 * b[i];
      }
      x = (a[n / 2] + a[n / 2 - 1]) / 2;
      y = (b[n / 2] + b[n / 2 - 1]) / 2;
    } else {
      x = a[n / 2];
      y = b[n / 2];
    }
    //  db2(x, y);
    cout << y - x + 1;
  }

  return 0;
}


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

#define mx 100005
#define ll long long

int ar[mx];
char ch[mx];

int n,m,k,ii,a;

void solve()
{
    cin>>a;
    cout<<(a+a*a+a*a*a)<<endl;
}

int main()
{
   //freopen("in.txt","r",stdin);
   //freopen("out.txt","w",stdout);
   int t=1;
   //scanf("%d",&t);
   while(t--)solve();
   return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i, m, n) for(int i = (int)m; i < (int)n; i++)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;


/*FUNCs=================================================*/
ll dp[101][100100] = {};
struct item
{
    ll weight, value;
};
/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    int n, w; cin >> n >> w;
    vector<item> items(n+1);
    rep(i,n) cin >> items[i+1].weight >> items[i+1].value;

    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= w; j++){

            if(items[i].weight <= j){
                dp[i][j] = max(dp[i][j], dp[i-1][j-items[i].weight] + items[i].value);
            }
            if(i > 0) dp[i][j] = max(dp[i][j], dp[i-1][j]);
            if(j > 0) dp[i][j] = max(dp[i][j-1], dp[i][j]);
        }
    }
    cout << dp[n][w] << '\n';
}

Measured memory_bytes: 78464
#!/usr/bin/env python3
import sys
INF = float("inf")


def yes():
    print("YES")  # type: str


def no():
    print("NO")  # type: str


def solve(a: int, b: int, c: int):
    if b-a == c-b:
        yes()
    else:
        no()
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    c = int(next(tokens))  # type: int
    solve(a, b, c)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,x,ans=0;
	cin>>n;
	for(int i=sqrt(n);i>0;i--){
		if(n%i==0){
			x=n/i;break;
		}
	}
	while(x){
		x/=10;
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    cin >> n;
    set<ll> st;
    for(i=0;i<n;i++){
        cin >> m;
        st.insert(m);
    }
    if(n==st.size()){
        cout << "YES" << endl;
    }else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 9600
// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T1, class T2> using P = pair<T1, T2>;
using I = int;
using D = double;
using B = bool;
using C = char;
using S = string;
using LL = long long;
using LD = long double;
using ULL = unsigned long long;
using PII = P<I, I>;
using VPII = V<PII>;
using PLL = P<LL, LL>;
using VPLL = V<PLL>;
using VI = V<I>;
using VVI = VV<I>;
using VLL = V<LL>;
using VVLL = VV<LL>;
using VC = V<C>;
using VVC = VV<C>;
using VS = V<S>;
using VVS = VV<S>;
using VB = V<B>;
using VVB = VV<B>;
#define REP(type, i, n) for (type i = 0; i < (type)(n); ++i)
#define REP2(type, i, m, n) for (type i = (m); i < (type)(n); ++i)
#define REPR(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define REPR2(type, i, m, n) for (type i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a, type) sort(ALL(a), greater<type>())
#define SORTF(a, comp) sort(ALL(a), comp)
#define REVERSE(a) reverse(ALL(a))
#define SIZE(a, type) ((type)(a).size())
#define bit_search(bit, n) REP(LL, bit, 1LL<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) (lower_bound(ALL(a), (x)) - a.begin())
#define bisect_right(a, x) (upper_bound(ALL(a), (x)) - a.begin())
#define INPUT(a) REPx(&x, a) cin >> x;
#define INPUT2(a) REPx(&x, a) INPUT(x);
#define INPUTP(a) REPx(&x, a) cin >> x.first >> x.second;
#define ENDL cout << endl;

const int INF = 2e9;
// const LL INF = 9e18;
const LL MOD = 1e9+7;

template<class T> using PRIORITY_QUEUE = priority_queue< T, V<T>, greater<T> >;
template<class T> inline bool chmin(T &a, T b){if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b) {a = b; return true;} return false;}
template<class T> inline void debug1(V<T> A){REP(int, i, SIZE(A, int)){if (A[i] == INF) cout << "I ";else cout << A[i] << " ";}ENDL}
template<class T> inline void debug2(VV<T> A){REP(int, i, SIZE(A, int)){REP(int, j, SIZE(A[i], int)){if (A[i][j] == INF) cout << "I "; else cout << A[i][j] << " ";}ENDL}}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  LL a, b, c, ans;
  cin >> a >> b >> c;
  if (!(a%2) || !(b%2) || !(c%2)) ans = 0;
  else ans = min(min(b*c, c*a), a*b);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3648
///بِسْمِ الّٰلهِ الرَّحْمٰنِ الرَحِيْمِ
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi acos(-1.0)
int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
     ll int i,n,t,p=INT_MAX,j=0,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d;
     string s,st;
     cin>>a>>b>>c;
     cout<<c<<" "<<a<<" "<<b<<endl;

     return EXIT_SUCCESS;
}




Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

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

		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		ArrayList<Work> works = new ArrayList<Work>();
		for(int i = 0; i < N; i++){
			works.add( new Work(scan.nextInt(), scan.nextInt()));
		}

		Collections.sort(works, new Comparator<Work>(){
			@Override
			public int compare(Work w1, Work w2) {
				return (w1.deadline - w2.deadline);
			}
		});
		
		int now = 0;
		boolean flag = true;
		for(int i = 0; i < N; i++){
			now += works.get(i).cost;
			if(now > works.get(i).deadline){
				flag = false;
				break;
			}
		}
		System.out.println(((flag)?"Yes":"No"));
		
	}

	public class WorkComparator implements Comparator<Work> {
		@Override
		public int compare(Work w1, Work w2) {
			return w1.cost < w2.cost ? -1 : 1;
		}
	}
}
class Work{
	int cost, deadline;
	Work(int x, int y){
		this.cost = x;
		this.deadline = y;
	}
}

Measured memory_bytes: 110556
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	rep(i,n) cin >> h[i];
	sort(h.begin(), h.end());
	int ans = 1e9;
	rep(i,n-k+1){
		chmin(ans, h[i+k-1] - h[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
long long n, dp[200000], a[200000]; 
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i ++)
		cin >> a[i];
	dp[0] = 1000000000000;
//	dp[1] = a[1];
	for (int i = 2; i <= n; i ++)
	{
		dp[i] = min (dp[i-1] + abs(a[i] - a[i-1]), dp[i-2] + abs(a[i] - a[i-2]));
	}
	cout << dp[n];
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef vector<bool> vb;
 
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()
 
string s;

 
void solve(){
  cin >> s;
  
  if(s[0]=='7'||s[1]=='7'||s[2]=='7') cout << "Yes" << endl;
  else cout << "No" << endl;

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

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		double x1, y1, x2, y2;
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String[] coor = in.readLine().split(" ");
		x1 = Double.parseDouble(coor[0]);
		y1 = Double.parseDouble(coor[1]);
		x2 = Double.parseDouble(coor[2]);
		y2 = Double.parseDouble(coor[3]);
		System.out.println(Math.sqrt(Math.pow(Math.abs(x2 - x1), 2)
				+ Math.pow(Math.abs(y2 - y1), 2)));
	}
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


int main(){
  int n,k,c;
  cin >> n >> k >> c;

  vector<int> l(k+1), r(k+1);

  char s[n];
  REP(i,n)cin >> s[i];

  int cnt=0;
  int i = 0;
  while(i<n){
    if(s[i] == 'o'){
      l[++cnt] = i+1;
      i += c+1;
    }else{
      i++;
    }
    if(cnt==k)break;
  }
  i = n-1;
  cnt=k;
  while(i>=0){
    if(s[i] == 'o'){
      r[cnt--] = i+1;
      i -= c+1;
    }else{
      i--;
    }
    if(cnt==0)break;
  }

  FOR(i,1,k+1){
    if(l[i]==r[i])cout << l[i]  << endl;
  }
}



Measured memory_bytes: 3200
import itertools

n, m = map(int, input().split())

edge = [[0]*n for i in range(n)]

# ２つの頂点間に辺がある時1に、ないときは0に設定する
for i in range(m):
    a, b = map(int, input().split())
    edge[a-1][b-1] = 1
    edge[b-1][a-1] = 1

# 頂点の順列の全てのパターンを[itertools.permutations()]で生成する
# 各並びで辺がない箇所があるかどうかの確認を積で行う
# 全ての頂点間の積が1であれば辺がすべて存在し、そのルートがあるということになる
res = 0
for each in itertools.permutations(range(n)):
    if each[0] != 0:
        break

    x = 1
    for i in range(n-1):
        x *= edge[each[i]][each[i+1]]
    
    res += x

print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin>>n>>m;
    Int ans=0;
    vector<vector<int>> s(m);

    for(int i=0; i<m; i++){
        int k; cin>>k;
        for(int j=0; j<k; j++){
            int a; cin>>a;
            a--;
            s[i].push_back(a);
        }
    }
    vector<int> p(m);
    for(int i=0; i<m; i++) cin>>p[i];

    for(int bit=0; bit<(1<<n); ++bit){
        bool ok=true;
        for(int j=0; j<m; j++){
            int con=0;
            for(auto v: s[j]){
                if(bit&(1<<v)) con++;
            }
            if(con%2!=p[j]) ok=false;
        }
        if(ok) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<double> nabe(n);
    for(int i=0;i<n;i++){
        cin>>nabe[i];
    }
    sort(nabe.begin(),nabe.end());
    double ans=nabe[0];
    for(int i=1;i<n;i++){
        ans=(ans+nabe[i])/2.0;
    }
    cout<<ans;
}

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

#include<vector>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
const int INF = 1e9+1;
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;}

int N;


int main() {
    cin >> N;
    vector<int> C(N),S(N),F(N);
    for (int i = 0; i < N-1; i++) {
        cin >> C[i] >> S[i] >> F[i];
    }    
    vector<int> T(N);
    T[N-1] = 0;
    for (int k = 0; k < N-1; k++) {
        int tmp = S[k];
        for (int i = k; i < N-1; i++) {
            while ((tmp < S[i]) || (tmp % F[i] != 0)) {
                tmp++;
            }
            tmp += C[i];
        }
        T[k] = tmp;
    }

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


}


Measured memory_bytes: 256
def main():
    N, M, C = map(int, input().split())
    B = list(map(int, input().split()))

    ans = 0
    for i in range(N):
        A = list(map(int, input().split()))
        if sum([A[j] * B[j] for j in range(M)]) + C > 0:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
using namespace std;
int main(){
    int n,sum;
    cin >> n >> sum;
    vector<int> vec(n);
    for(int i=0;i<n;i++){
        cin >> vec[i];
    }
    sort(vec.begin(),vec.end());
    int count=0;
    bool h=false;
    for(int i=0;i<n;i++){
        sum -= vec[i];
        if(sum<0){
            h=true;
            break;
        }
        count++;
    }
    if(h){
        cout<<count<<endl;
        return 0;
    }
    if(sum>0){
        cout<<n-1<<endl;
    }else{
        cout<<n<<endl;
    }
}

Measured memory_bytes: 256
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define  all(v)            v.begin(), v.end()
#define  sz(x)             (long long)x.size()
#define  debug(x)          cout << '>' << #x << ':' << x << endl;
#define  debug2(x, y)      cout << #x << "=" << x << "," << #y << "=" << y << endl
#define  rep(i,n)          for(int i = 0; i <  n ; i++)
#define  reps(i,n)         for(int i = 1; i <= n ; i++)
#define  make_unique(v)    sort(all(v));v.erase(unique(all(v)), v.end());
#define  REMOVE(v,a)       v.erase(remove(v.begin(),v.end(), a), v.end());
#define  pb                push_back
#define  eb                emplace_back
#define  mp                make_pair
#define  endl              '\n'
#define  fi                first
#define  se                second
#define  ajs(a)            (a<0)?(-1*a):a

using namespace std;
typedef long long          ll;
typedef vector<long long>  vll;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;

const ll MOD = 1e9+7;
const double PI  = acos(-1.0);
const double EPS = (1e-10);
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = { -1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = { -1, 0, 1, 1, 1, 0, -1, -1};
bool cmp(int X, int Y) {return X > Y;}
int dcp(double A, double B){return fabs(A-B)<=EPS ? 0 : A<B ? -1:1;}

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll lcm(ll a, ll b) {return (a / gcd(a, b)) * b;}
ll modpow(ll a, ll b, ll m=MOD){a %= m; ll res = 1; while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){if(b<0){return 0;}ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}


const int N = 1e6 + 5;
vi adj[N];
ll vis[102][102];



int main(){ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll x,k,d;cin>>x>>k>>d;
x = abs(x);
ll fi = x/d;
if(k>=fi){
	x= x-fi*d;
	k=k-fi;
	}else{
	x = x-k*d;
	k = 0;
		
		}


if(k%2==0){
	x = abs(x);
	cout<<x;
	
	}else{
		
		ll p = min(abs(x-d),abs(x+d));
		cout<<p;
		
		}

}



	
	




		



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

int main(){
  int N, K;
  cin >> N >> K;
  int H[N];
  int ans = 0;
  rep(i, N){
    cin >> H[i];
  }
  rep(i, N){
    if (H[i] >= K) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3748