akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#include<cstdio>
#define el "\n"
#define sp " "
typedef long long ll;

main()
{
  ll n,i,j,k;
  cin>>n>>k;
  ll a[n+1];
  vector<ll> dp(n+1,1e15);
  
  for(i=1;i<=n;i++)
    cin>>a[i];
  dp[0]=0;
  dp[1]=0;
  dp[2]=abs(a[2]-a[1]);
  for(i=3;i<=n;i++)
  {
  for(j=i-1;i-j<=k&&j>0;j--)
    dp[i]=min(dp[j]+abs(a[i]-a[j]),dp[i]);
    
}
    cout<<dp[n];
    
}
  

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

int main()
{
    long long  x,y,i,ans=0,a[100005];
    scanf("%lld %lld",&x,&y);
    for(;x<=y;x*=2,ans++);
    printf("%lld\n",ans);
    return 0;
}


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

typedef struct{
  int n;
  int i;
  int j;
  int k;
} Sigen;


int main(){
  int n;
  while(1){
    cin >> n;
    if(n == 0) break;

    for(int i = 0;i < n;i++){
      Sigen s1,s2,s3;
      cin >> s1.n >> s1.i >> s1.j >> s1.k;
      cin >> s2.n >> s2.i >> s2.j >> s2.k;

      s3.n = s1.n * s2.n + s1.i * s2.i * -1 + s1.j * s2.j * -1 + s1.k * s2.k * -1;
      s3.i = s1.n * s2.i + s1.i * s2.n + s1.j * s2.k + s1.k * s2.j * -1;
      s3.j = s1.n * s2.j + s1.i * s2.k * -1 + s1.j * s2.n + s1.k * s2.i;
      s3.k = s1.n * s2.k + s1.i * s2.j + s1.j * s2.i * -1 + s1.k * s2.n;

      cout << s3.n << " " << s3.i << " " << s3.j << " " << s3.k << endl;
    }
  }
  return 0;
}




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

int main(){
    int a,b,c;
    
    cin>>a>>b>>c;
    
    bool flag1=a+b==c;
    bool flag2=b+c==a;
    bool flag3=a+c==b;
    
    if(flag1||flag2||flag3){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
import os
import math


N = int(input())
for i in range(N):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())

    c = 2 * ((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1))
    x = ((y3 - y1) * (x2 ** 2 - x1 ** 2 + y2 ** 2 - y1 ** 2) + (y1 - y2) * (x3 ** 2 - x1 ** 2 + y3 ** 2 - y1 ** 2)) / c
    y = ((x1 - x3) * (x2 ** 2 - x1 ** 2 + y2 ** 2 - y1 ** 2) + (x2 - x1) * (x3 ** 2 - x1 ** 2 + y3 ** 2 - y1 ** 2)) / c
    r = math.sqrt((x1 - x) ** 2 + (y1 - y) ** 2)

    print("{:.3f} {:.3f} {:.3f}".format(x, y, r))

Measured memory_bytes: 7772
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
 
#define PI acos(-1.0)
#define CIR(i, l, u) for(int i = l; i < u; ++i)
#define cir(i, u, l) for(int i = u; i > l; --i)
#define p(x) cout << x << endl
#define pd(x) cout << "*" << x << endl
#define py cout << "YES" << endl
#define pn cout << "NO" << endl 
#define INI(n, i) memset(n, i, sizeof(n))
#define MAX(a, b) a = a > b ? a : b
#define MIN(a, b) a = a < b ? a : b
#define ll long long
const int inf = 0x3f3f3f3f;
const int maxn = 5e5 + 10;
const ll mod = 1e9 + 7;

//struct N{
//	int val;
//	int pos;
//} bra[105];
//
//bool cmp(N a, N b)
//{
//	return a.val < b.val;
//}

//bool cmp(int a, int b)
//{
//	return a > b;
//}

struct cmp2
{
    bool operator () (const int a,const int b)
    {
        return a>b;//????
    }
};

ll gcd(ll m,ll n)
{
    ll y;  
    y=m%n;
    while(y!=0)
    {
        m=n;
        n=y;
        y=m%n;
    }
    return n;
}

int main()
{
	char str[maxn], temp[100005];
	INI(str, 0); INI(temp, 0);
	cin>> temp;
	int len = strlen(temp);
	int q, tmp;
	cin >> q;
	int s = 2e5 + 5, t = len - 1 + 2e5 + 5;
	CIR(i, 0, len) str[s + i] = temp[i];
	while(q--)
	{
		int j;
		cin >> j;
		if(j == 1)
		{
			tmp = s;
			s = t;
			t = tmp;
		}
		else
		{
			int f;
			char ch;
			cin >> f >> ch;
			if(f == 1)
			{
				if(s < t)
				{
					str[--s] = ch;
				}
				else
				{
					str[++s] = ch;
				}
			}
			else
			{
				if(s < t)
				{
					str[++t] = ch;
				}
				else
				{
					str[--t] = ch;
				}
			}
		}
	}
	
	if(s < t)
	{
		CIR(i, s, t + 1) cout<<str[i];
		cout << endl;
	}
	else
	{
		cir(i, s, t - 1)
		{
			cout << str[i];
		}
		cout <<endl;
	 } 

	return 0;
}




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

using namespace std;

double x[1010], y[1010], r[1010];
int N;

typedef pair<double, int> P;

double INF = 1e15;
double EPS = 1e-9;

double dijkstra()
{
  priority_queue<P, vector<P>, greater<P> > que;
  vector<double> mincost(N, INF);
  que.push(P(0.0, 0));
  mincost[0] = 0.0;
  while(!que.empty()) {
    P p = que.top(); que.pop();
    double dist = p.first; int cur = p.second;
    if(cur == 1) return dist;
    if(dist > mincost[cur] + EPS) continue;
    for(int i = 0; i < N; i++) {
      if(i == cur) continue;
      double hoge = (x[i]-x[cur])*(x[i]-x[cur])+(y[i]-y[cur])*(y[i]-y[cur]);
      double norm = sqrt(hoge), bari = r[i]+r[cur];
      double cost = 0.0;
      if(hoge > bari*bari) cost = norm - bari;
      if(mincost[i] > dist + cost + EPS) {
	que.push(P(cost + dist, i));
	mincost[i] = cost + dist;
      }
    }
  }
  return -1.0;
}

int main()
{
  cin >> x[0] >> y[0] >> x[1] >> y[1]; r[0] = r[1] = 0.0;
  cin >> N; N += 2;
  for(int i = 2; i < N; i++) cin >> x[i] >> y[i] >> r[i];
  printf("%.10f\n", dijkstra());
  return 0;
}


Measured memory_bytes: 4468
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007
#define M 998244353

using namespace std;

int main() {
    lli n,h,a,b,c=0,cnt=0;
    vector<lli> vec;
    lli i,j,k;
    cin>>n>>h;
    rep(i,0,n){
        cin>>a>>b;
        vec.push_back(b);
        c=max(c,a);
    }
    sort(vec.begin(),vec.end());
    rep(i,0,n){
        if(vec[n-1-i]>c){
            h-=vec[n-1-i];
            cnt++;
            if(h<=0){
                h=0;
                break;
            }
        }
        else{
            break;
        }
    }
    if(h%c>0){
        cnt++;
    }
    cnt+=h/c;
    cout<<cnt<<endl;
}


Measured memory_bytes: 4304
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    int h[n];
    for(int i=0; i<n; i++) cin >> h[i];
    sort(h, h+n);

    int m = 1000000001;
    for(int i=0; i<n-k+1; i++) {
        m = min(m, h[i+k-1]-h[i]);
    }
    cout << m << endl;
    return 0;
}



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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int H=in(),N=in();
	auto A=vecin(N);

	out(accumulate(ALL(A),0)>=H?"Yes":"No");

	return 0;
}

Measured memory_bytes: 640
N,M=map(int,input().split())

A=list(map(int,input().split()))
C=[]
bmax=0
for i in range(M):
    b,c=map(int,input().split())
    bmax+=b
    C.append([c,b])

A.sort()
C.sort(reverse=True)

idx=0
cnt=C[idx][1]
for i in range(N):
    if A[i]<C[idx][0]:
        A[i]=C[idx][0]
        cnt-=1
        if cnt==0:
            if i+1<bmax:
                idx+=1
                cnt=C[idx][1]
            else:
                break
print(sum(A))


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

int main() {
  string w;
  cin >> w;
  vector<int> a(26, 0);
  string ans = "No";
  
  for(int i = 0; i < w.size(); i++){
    a.at(w.at(i) - 97)++;
  }
  
  for(int i = 0; i < a.size(); i++){
    if(a.at(i) %2 == 1)
      break;
    if(i == a.size() -1 and a.at(i) %2 == 0)
      ans = "Yes";
  }
  cout << ans << endl;
}

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


typedef long long ll;
typedef long double ld;

using namespace std;
const int MAXN = 120000;

int n;
int a[MAXN];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d", a + i);
	sort(a, a + n);
	reverse(a, a + n);
	for (int i = n - 1; i >= 0; --i) {
		if (i >= a[i])
			continue;
		int cnr = 0;
		int cnu = a[i] - 1 - i;
		for (int j = i + 1; j < n; ++j)
			if (i < a[j])
				++cnr;
		if (cnr % 2 == 1 || cnu % 2 == 1) {
			cout << "First\n";
		}
		else {
			cout << "Second\n";
		}
		return 0;
	}
	return 0;
}




Measured memory_bytes: 640
N = int(input())
lst = [] 
for i in range(N):
    lst.append(list(map(int, input().split())))
dp = [[0]*3 for i in range(N)]

for i in range(3):
    dp[0][i] = lst[0][i]

for i in range(1, N):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + lst[i][0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + lst[i][1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + lst[i][2]

print(max(dp[N-1]))

Measured memory_bytes: 47384
#include <cstdio>
#include <algorithm>
#define IL inline
#define N 303
#define REP(a,b,c) for(a=b;a<=c;a++)
#define PER(a,b,c) for(a=b;a>=c;a--)
using namespace std;
const int mod=1e9+7;
int n,m,f[N][N],l[N][4],r[N][4],sta[5],ans=0;
IL void umin(int &x,int y){if(y<x)x=y;}
IL void umax(int &x,int y){if(y>x)x=y;}
IL int rd(){
	int res=0;char c;while((c=getchar())<'0'||c>'9');
	while(c>='0'&&c<='9')res=res*10+c-'0',c=getchar();return res;
}
struct ord{
	int l,r,x;
	IL bool operator < (const ord &b) const{return r<b.r;}
}a[N];
int main(){
	n=rd(),m=rd();int i,j,k,t,p;
	REP(i,1,m)a[i].l=rd(),a[i].r=rd(),a[i].x=rd();
	sort(a+1,a+1+m);
	REP(i,1,n)REP(j,1,3)l[i][j]=mod;
	REP(i,1,m)umin(l[a[i].r][a[i].x],a[i].l),umax(r[a[i].r][a[i].x],a[i].l);
	f[0][0]=3;
	REP(i,1,n-1){
		REP(j,0,i-1){
			sta[1]=j;
			REP(k,0,j)if(f[j][k]){
				sta[2]=k;
				REP(t,1,3)if(r[i][t]){
					REP(p,1,2)if(sta[p]<r[i][t])break;
					if(p!=t){f[j][k]=0;break;}
					REP(p,p,2)if(sta[p]<l[i][t])break;
					if(p!=t){f[j][k]=0;break;}
				}
			}
		}
		//先检测非法，将非法解删除
		PER(j,i-1,0)
			PER(k,j,0){
			f[i][j]=(f[i][j]+f[j][k])%mod;
			f[i][k]=(f[i][k]+f[j][k])%mod;
		}
	}
	REP(j,0,i-1){
			sta[1]=j;
			REP(k,0,j){
				sta[2]=k;
				REP(t,1,3)if(r[i][t]){
					REP(p,1,2)if(sta[p]<r[i][t])break;
					if(p!=t){f[j][k]=0;break;}
					REP(p,p,2)if(sta[p]<l[i][t])break;
					if(p!=t){f[j][k]=0;break;}
				}
			ans=(ans+f[j][k])%mod;
			}
	}
	printf("%d\n",ans);
	return 0;
}

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

long n,q;
map<long,vector<long>> m;
map<long,long> p;
vector<long> ans(200000,-1);

void dfs(long x,long y) {
  if(p.count(x)) y+=p[x];
  ans[x-1]=y;
  for(long i=0;i<m[x].size();i++) {
    if(ans.at(m[x][i]-1)==-1) dfs(m[x][i],y);
  };
  return;
}

int main() {
  cin >> n >> q;
  for(long i=0;i<n-1;i++) {
    long a,b;
    cin >> a >> b;
    m[a].push_back(b);
    m[b].push_back(a);
  }
  for(long i=0;i<q;i++) {
    long a,b;
    cin >> a >> b;
    p[a]+=b;
  }
  dfs(1,0);

  for(long i=0;i<n;i++) {
    cout << ans[i] << " ";
  };
  cout << endl;
}

Measured memory_bytes: 56832
# --coding: utf-8 --

n, price = map(int, input().split(' '))
delta = int(price / 1000 - n)
res = '-1 -1 -1'
for x in range(n + 1):
    for y in range(n + 1):
        if delta == 9 * x + 4 * y and x + y <= n:
            res = '{} {} {}'.format(x, y, n - x - y)
            break
print(res)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;

int main() {
  int n;
  ll ans = 0;
  cin >> n;
  map<string, ll> s;
  string str;
  REP(i, n) {
    cin >> str;
    sort(str.begin(), str.end());
    s[str] = s[str] ? s[str]+1 : 1;
  }
  map<string, ll>::iterator itr;
  for (itr = s.begin(); itr != s.end(); ++itr) {
    if (itr->second > 1) {
      ans += itr->second * (itr->second - 1) / 2;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 11136
<?php
$n = trim(fgets(STDIN));
$x = explode(" ",trim(fgets(STDIN)));
$y = explode(" ",trim(fgets(STDIN)));
$p = array_fill(0,5,0);
foreach($x as $key => $v){
    $xy = abs($v-$y[$key]);
    $p[1] += $xy;
    $p[2] += pow($xy,2);
    $p[3] += pow($xy,3);
    $pI[] = $xy;
}
$p[2] = sqrt($p[2]);
$p[3] = pow($p[3],1/3);
$p[4] = max($pI);
for($i = 1; $i <= 4; $i++){
    echo sprintf("%.6f\n",$p[$i]);
}

Measured memory_bytes: 15672
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    srand((unsigned)time(NULL));
    ll X,Y;
    cin>>X>>Y;
    ll ans=2019;
    for(int i=1;i<=10000000;i++)
    {
                 ll a = rand ()% (Y-X) + X; // number generation [x, y-1] is
                 ll b = rand ()% (Y-a) + a + 1; // generate [a + 1, y] number
        ll num=a*b%2019;
        ans=min(ans,num);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    char t[100];
	int a=0,b=0,i=0;
    while(i!=n){
       cin>>t[i];
       if(t[i]=='(') b++;
       else{
           if(b) b--;
           else a++;
        }
        i++;
    }
    for(i=0;i<a;i++) cout<<"(";
    for(i=0;i<n;i++) cout<<t[i];
    for(i=0;i<b;i++) cout<<")";
    return 0;
}

Measured memory_bytes: 256
import math
k, n = map(int,input().split())
a = list(map(int,input().split()))

ans = 10**9
for i in range(n):
  if i == 0:
    a1 = a[-1]-a[0]
    a2 = a[0]+(k-a[1])
    ans = min(ans,a1,a2)
  else:
    a1 = (k-a[i])+a[i-1]
    ans = min(ans,a1)
print(ans)    
    

Measured memory_bytes: 26444
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,i,j,k,n,h,m,x,y;
	string	s;
	cin >> a >> b >> h >> m;
	double hh,mm,deg,ans;

	hh = (double)(h*60+m) / 2;
	mm = m*6;

	deg = abs(hh-mm);
	if (deg > 180) deg = 360 - deg;
	//printf("%f\n",deg);

	deg = deg * (M_PI/180);
	//printf("%f\n",deg);
	ans = sqrt( a*a + b*b - 2*a*b*cos(deg));

	//vector<ll>	aa(n);
	//for(i=0;i<n;i++) cin >> aa[i];
	//vector<ll>	dp(n+1,INFL);
	//vector<vector<ll>>	dp2(x , vector<ll>(y,INFL));
	printf("%.10f\n",ans);
	//cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin >> s >> t;
  int a,b;
  cin >> a >> b;
  string u;
  cin >> u;
  if(s==u)cout << a-1 << " " << b << endl;
  else cout << a << " " << b-1 << endl;
}


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 1e9 + 1
#define INF_LL 1LL<<60
#define ll long long
#define ALL(x)          (x).begin(),(x).end()

#define MAX_V 105

#define MAX_N 100
#define MAX_M 100

int main(){
    int h1, m1, h2, m2, k;
    cin >> h1 >>  m1 >> h2 >> m2 >> k;
    int tmp = h2*60+m2 - (h1*60+m1);
    cout << tmp - k << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(A==B){
  cout << C << endl;
  }
  else if(A==C){
  cout << B << endl;
  }
  else{
  cout << A << endl;
  }
}


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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */

int main(){
    /* code */ 
    int N, M; cin >> N >> M;
    auto res = (N==M) ? "Yes" : "No";
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
int dp[110000];//dp[i]:i段目までの最小値
const int INF = 1001001001;
int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n)cin >> h[i];
    rep(i,n+1)dp[i] = INF;
    dp[1] = 0;
    rep(i,n){
        if(!i)continue;//このdpは、足場１から足場Nまで、高々n-1回の移動しかしないから、ループはN-1回でよい
        if(i+1 <= n)dp[i+1] = min(dp[i+1],dp[i]+ abs(h[i] - h[i-1]));
        if(i+2 <= n)dp[i+2] = min(dp[i+2],dp[i] + abs(h[i+1] - h[i-1]));
    }
    cout << dp[n] << endl;


    return 0;
}

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

using namespace std;

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

        int a, b, x;

        cin >> a >> b >> x;

        if (x  > (a + b) || a > x) {
                cout << "NO" << endl;
        } else {
                cout << "YES" << endl;
        }

        return 0;
}


Measured memory_bytes: 256
using System;

namespace dotnet_test
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nums = new int[] {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
            int K =
            int.Parse(Console.ReadLine());
            
            Console.WriteLine(nums[K - 1]);
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL endl
using namespace std;
typedef long double ld;
typedef unsigned long long lli;
typedef pair<lli,lli> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define deb(x) cout << #x": " << (x) << endl;
const lli N = 1e7;
const lli INF = 1e14;
const lli mod = 1e9+7;

// ---- コーディングはここから！ ('-')7


int main(){_
	lli n,k; cin>>n>>k;
	vl v(n); fore(i,0,n)cin>>v[i];
	lli last = 1LL;
	fore(i,k,n){
		if(v[i]>v[i-k])cout<<"Yes"<<ENDL;
		else cout<<"No"<<ENDL;
	}

}


Measured memory_bytes: 4784
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq

#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

N, M = map(int, input().split())
A = [int(i) for i in input().split()]
ans = 0

A.sort(reverse = True)

if(A[M-1]<(sum(A)/(4*M))):
  print("No")
else:
  print("Yes")



Measured memory_bytes: 38828
// Copyright (C) 2017 Sayutin Dmitry.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.

#include <iostream>
#include <vector>
#include <stdint.h>
#include <algorithm>
#include <set>
#include <map>
#include <array>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <string>
#include <assert.h>
#include <iterator>
#include <cstdint>
#include <cinttypes>
#include <string.h>
#include <random>
#include <numeric>
#include <tuple>


using std::cin;
using std::cout;
using std::cerr;

using std::vector;
using std::map;
using std::array;
using std::set;
using std::string;

using std::pair;
using std::make_pair;

using std::min;
using std::abs;
using std::max;

using std::unique;
using std::sort;
using std::generate;
using std::reverse;
using std::min_element;
using std::max_element;

#ifdef LOCAL
#define LASSERT(X) assert(X)
#else
#define LASSERT(X) {}
#endif

template <typename T>
T input() {
    T res;
    cin >> res;
    LASSERT(cin);
    return res;
}

template <typename IT>
void input_seq(IT b, IT e) {
    std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>);
}

#define SZ(vec)         int((vec).size())
#define ALL(data)       data.begin(),data.end()
#define RALL(data)      data.rbegin(),data.rend()
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

#include <bitset>
using std::bitset;

#define pb push_back
#define eb emplace_back

int main() {
    std::iostream::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    const int max_n = 2000 * 2000 + 1;
    std::bitset<max_n> bts;
    bts[0] = 1;

    int total = 0;
    for (int k = input<int>(); k != 0; --k) {
        int v = input<int>();
        bts = bts | (bts << v);

        total += v;
    }

    int i = (total + 1) / 2;
    while (bts[i] == 0)
        ++i;
    cout << i << "\n";
    
    return 0;
}


Measured memory_bytes: 2176
#include <stdio.h>

int divisor(int num){
  int count = 0;
  for(int i=1;i<=num;i++){
    if(num%i==0)
      count++;
  }
  return count;
}

int counter(int num){
  int x = 0;
  for(int i=1;i<=num;i++){
    if(i%2==1 && divisor(i)==8){
      x++;
    }
  }
  return x;
}

int main(void){
  int n = 0;
  scanf("%d", &n);
  printf("%d", counter(n));
}

Measured memory_bytes: 128
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){

    long long int N;
    cin>>N;
    if(N%2ll==1){
        cout<<0<<endl;
        return 0;
    }
    long long int ans=0;
    long long int hatena=2;
    while(1){
        hatena*=5;
        ans+=N/hatena;
        if(N<hatena)break;
    }
    cout<<ans<<endl;
    /*
    long long int ans=0;
    for(long long int i=10;0<i;i-=2){
        if     (i%10000000000==0)ans+=10;
        else if(i%1000000000==0)ans+=9;
        else if(i%100000000==0)ans+=8;
        else if(i%10000000==0)ans+=7;
        else if(i%1000000==0)ans+=6;
        else if(i%100000==0)ans+=5;
        else if(i%10000==0)ans+=4;
        else if(i%1000==0)ans+=3;
        else if(i%100==0)ans+=2;
        else if(i%10==0)ans+=1;
    }
    cout<<ans<<endl;
    */
    return 0;
}


Measured memory_bytes: 3608
import sys
input = sys.stdin.readline
N=int(input())
a=list(map(int,input().split()))
A=0
amax=0
imax=1
for i in range(N):
    if A<abs(a[i]):
        A=abs(a[i])
        amax=a[i]
        imax=i+1
#print(imax,amax)
ans=[]
for i in range(N):
    ans.append([imax,i+1])
if amax>=0:
    for i in range(1,N):
        ans.append([i,i+1])
else:
    for i in range(1,N):
        ans.append([N-i+1,N-i])
print(len(ans))
for i in ans:
    print(*i)


Measured memory_bytes: 38384
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(), K = sc.nextInt(), ans = K;
    for(int i=0; i<N-1; i++) {
      ans *= (K-1); 
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 35816
#include<stdio.h>
#include<iostream>
#include <iomanip>
#include<vector>

using namespace std;

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

  if(s[2]==s[3] && s[4]==s[5])
    cout<<"Yes";
  else
    cout<<"No";
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>
#include <vector>
#include <queue>
#include <ctime>
#include <numeric>
#include <cstdlib>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int N, K;

int main(){
	
	cin>>N>>K;
	
	cout<<N-K+1<<endl;
	
	
	return 0;
	
}

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

using namespace std;


#define F first
#define S second
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define INT(a) int((a)+1e-9)
#define SUPMaxX 22
#define SUPMaxY 22

typedef pair<int,int> Pii;

int DX[4]={1,0,-1,0};
int DY[4]={0,1,0,-1};

int maxX,maxY;
char tizu[SUPMaxX][SUPMaxY];
queue<Pii> ps;

int solve(){
	int re=1;
	while(!ps.empty()){
		Pii p=ps.front();
		ps.pop();
		int px=p.F;
		int py=p.S;
		FOR(i,0,4){int qx=px+DX[i]; int qy=py+DY[i];
			if(tizu[qx][qy]=='.'){
				tizu[qx][qy]='@';
				ps.push(make_pair(qx,qy));
				re++;
			}
		}
	}
	return re;
}


int main(){
	while(true){
		cin >> maxY >> maxX;			if(!maxX) return 0;
		FOR(x,0,maxX+2) FOR(y,0,maxY+2) tizu[x][y]='#';
		FOR(x,1,maxX+1) FOR(y,1,maxY+1){
			cin>>tizu[x][y];
			if(tizu[x][y]=='@') ps.push(make_pair(x,y));
		}
		cout<<solve()<<endl;
	}
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;

int mod_expo(int x, int p)
{
    if(!p)
        return 1;
    long long res = mod_expo(x, p / 2);
    res *= res;
    res %= MOD;
    if(p & 1)
        res *= x;
    return res % MOD;
}

int main(){
    int n;
    cin>>n;
    int a[n];
    for (int i=0; i<n; i++){
        cin>>a[i];
    }
    sort(a, a+n);
    if (n%2==0){
        int start=1;
        int i=0;
        while (i<n-1){
            if (a[i]!=start || a[i+1]!=start){
                cout<<0;
                return 0;
            }
            start+=2;
            i+=2;
        }
        cout<<mod_expo(2, n/2)<<"\n";

    }
    else{
        int start=2;
        if (a[0]!=0) {
            cout<<0;
            return 0;
        }
        int i=1;
        while (i<n-1){
            if (a[i]!=start || a[i+1]!=start){
                cout<<0;
                return 0;
            }
            start+=2;
            i+=2;
        }

        cout<<mod_expo(2, (n-1)/2)<<"\n";
    }


}

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

#define rev(x) string(x.rbegin(), x.rend())

int main() {
	ios::sync_with_stdio(0);
	//
	string S;
	cin >> S;
	int Q;
	cin >> Q;
	int qtype, f;
	char c;
	//
	bool is_rev = 0;
	string head = "";
	string tail = "";
	//
	while (Q--) {
		cin >> qtype;
		if (qtype == 1) {
			is_rev ^= 1;
		} else {
			cin >> f >> c;
			if ( !((f-1) ^ is_rev) ) {
				head += c;
			} else {
				tail += c;
			}
		}
	}
	//
	string Ans;
	if (is_rev) {
		Ans = rev(tail) + rev(S) + head;
	} else {
		Ans = rev(head) + S + tail;
	}
	cout << Ans << endl;
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
   ll a, b;
   cin >> a >> b;

   if (a >= b) {
       REP(i, a) {
           cout << b;
       }
       cout << endl;
   } else {
       REP(i, b) {
           cout << a;
       }
       cout << endl;
   }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,b,a) for(int i=(b);i>=(a);i--)
#define len(a) int((a).size())
using namespace std;
using LL = long long;
using PII = pair<int, int>;

int main() {
    int a, b;
    string s;
    scanf("%d%d", &a, &b);
    cin >> s;
    if (s.size() != a + b + 1) return !printf("No\n");
    for (int i=0;i<s.size();i++) {
        char c = s[i];
        if (i == a) {
            if (c != '-') return !printf("No\n");
        } else {
            if (c < '0' || c > '9') return !printf("No\n");
        }
    }
    printf("Yes\n");
}

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

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

  map<char, int> count;
  for(int i=0;i<str.size();i++) {
    count[str[i]]++;
  }

  if(str.size() == 1) {
    cout << 0 << endl;
    return 0;
  }

  int ans = INT_MAX;

  for(auto it = count.begin(); it != count.end(); it++) {
    bool same = false;
    string s = str;
    while(!same) {
      for(int i=0;i<s.size();i++) {
        if(s.size() == 1) same = true;
        else {
          if(s[i] != s[0]) break;
          if(i == s.size()-1) same = true;
        }
      }
      if(same) {
        if(str.size()-s.size() < ans) ans = str.size() - s.size();
        break;
      }
      for(int i=1;i<s.size();i++) {
        if(s[i] == it->first) s[i-1] = s[i];
      }
      s.pop_back();
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int a, b; cin >> a >> b;
    cout << max(0, a - 2 * b) << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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 ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n, y;
  cin >> n >> y;
  bool flag = 1;
  for (ll i = 0; i <= n; i++) {
    for (ll j = 0; i+j <= n; j++) {
      if (10000*i + 5000*j <= y) {
        if (1000*(n-i-j) == y-10000*i-5000*j) {
          cout << i << ' ' << j << ' ' << n-i-j << endl;
          flag = 0;
          break;
        }
      }
    }
    if (!flag) break;
  }
  if (flag) cout << -1 << ' ' << -1 << ' ' << -1 << endl;
}

Measured memory_bytes: 256
def solve(n, k, al):
    bin_k = format(k,"b")
    len_k = len(bin_k)
    
    # search
    answer = 0
    enable_one = False
    zero_limit = n // 2
    for i in range(len_k,-1,-1):
        bit = 1 << i
        answer = answer << 1
        if enable_one or ((k & bit) != 0):
            # 0 or 1 case
            zero_count = 0
            for e in al:
                if (e & bit) == 0:
                    zero_count += 1
            if zero_count > zero_limit:
                answer += 1
            else:
                enable_one = True
    # print(answer)

    s = 0
    for e in al:
        s = s + (answer ^ e)
    print(s)

def main():
    n, k = map(int, input().split())
    al = list(map(int, input().split()))
    solve(n, k, al)

main()   


Measured memory_bytes: 14708
#Conding: Utf-8

N= int(input())
a=list(map(int, input().split()))

count=num=total=0
b=[]

for i in a:
    if i<0:
        count+=1
    elif i==0:
        num+=1

if count%2==0 or num>0:
    for j in a:
        total=total+abs(j)
    print(total)
else:
    for k in a:
        total=total+abs(k)
    for l in a:
        b.append(abs(l))

    print(total-2*min(b))

Measured memory_bytes: 14224
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
void print(int x){printf("%d\n", x);}
void print(ll x){printf("%lld\n", x);}
void printvec(vector<int>& a){
rep(i, a.size()-1){
printf("%d ", a[i]);
}
printf("%d\n", a[a.size()-1]);
}
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; }
 
int main()
{
    int n;
    cin >> n;
    ll max_=INT64_MIN, min_=INT64_MAX;
    ll s=0;
    ll tmp;
    rep(i, n){
        scanf("%lld", &tmp);
        chmax(max_, tmp);
        chmin(min_, tmp);
        s += tmp;
    }
    printf("%lld %lld %lld\n", min_, max_, s);
    return 0;
}


Measured memory_bytes: 3224
#include<bits/stdc++.h>
 
using namespace std;
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif
 
#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000000
#define ll long long
#define int ll
#define db double
#define str string
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Forrev(i,s,e) for (ll i=(s); i>=(e); i--)
#define all(v) v.begin(),v.end()
 
#define vll vector<ll>
#define vs vector<string>
#define mapll map<ll,ll>
#define pll pair<ll,ll>
#define initialise(a, x) memset(a, x, sizeof(a))
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll> ,greater<ll>>
 
#define ff first
#define ss second
#define endl "\n"
#define mp make_pair
const ll mod=1e9 + 7;
 
ll takemod(ll a) {
    return ((a%mod)+mod)%mod;
}
 
ll gcd(ll a, ll b) { 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);        
}
 
ll fast_exp(ll base, ll expo) {
    ll res=1;
    while(expo>0) {
        if(expo&1) res=(res*base)%mod;
        base=(base*base)%mod;
        expo>>=1;}
    return res;
}
 
ll modinv(ll a) {
    return takemod(fast_exp(takemod(a), mod-2));
}
 
void solve() {
	int n;
	cin >> n;

	int arr[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	
	int dp[n][n][2];
	
	for (int i = 0; i < n; i++) {
		dp[i][i][0] = arr[i];
		dp[i][i][1] = -arr[i]; 
	}

	for (int i = 1; i <n; i++) {
		
		for (int j = 0; j+i < n; j++) {
			dp[j][j+i][0] = max(dp[j+1][j+i][1] + arr[j], dp[j][i+j-1][1] + arr[j+i]);
			dp[j][j+i][1] = min(dp[j+1][j+i][0] - arr[j], dp[j][i+j-1][0] - arr[j+i]); 
		}
	}
	
	cout << dp[0][n-1][0] << endl;

}

 
signed main() 
{
    fast_cin();
    
    
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
    }
    
    
    return 0;    
}

Measured memory_bytes: 85432
from functools import reduce

N, A, B = map(int, input().split())
MOD = 10 ** 9 + 7


def cmb(N, A):
    num = reduce(lambda x, y: x * y % MOD, range(N, N - A, -1))
    den = reduce(lambda x, y: x * y % MOD, range(1, A + 1))
    return num * pow(den, MOD - 2, MOD) % MOD


ans = pow(2, N, MOD) - cmb(N, A) - cmb(N, B) - 1
ans = ans % MOD
print(ans)


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

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define PB push_back
#define F first
#define S second
#define SZ(a) a.size()
#define MP(a,b) make_pair(a,b)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define NL << "\n"

#define mod 1000000007
#define pi 3.14159265359

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;
typedef pair<ll, ll> pll;
typedef pair<ll, string> pls;
typedef pair<string, ll> psl;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<pll> vpll;
typedef double ld;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  
  string dance; cin >> dance;
  int b = 0;
  //cout << "DBG: " << SZ(dance) NL;
  for1(i,SZ(dance)){
    if(i&1 && dance[i-1] == 'L') b = 1;
    if(!(i&1) && dance[i-1] == 'R') b = 1;
    //cout << i << " - " << dance[i-1] NL;
  }

  cout << (b? "No": "Yes") NL;
  
  return 0;
}




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

using namespace std;

using ll = long long;
#define pb push_back
#define dbg(x) cerr << #x << " " << x << "\n"

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

    int d, l, r;
    cin >> l >> r >> d;
    cout << r / d - (l - 1) / d << "\n";
    return 0;
}


Measured memory_bytes: 3612
<?php
  fscanf(STDIN, "%s", $s);
  $c = false;
  $f = false;
  for($i = 0; $i < strlen($s); $i++){
    if($s[$i] == "C")$c = true;
    if($s[$i] == "F" && $c)$f = true;
  }
  echo $f ? "Yes" : "No";

Measured memory_bytes: 4728
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
#n = ip()                                     #入力整数1つ
#n,q= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
b = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
a = []
for i in range(len(b)):
    a.append(b[i])
p  = 0
for i in range(len(a)):
    if a[i] == '1':
        p+=1
print(p)

Measured memory_bytes: 15692
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c; cin>>a >>b >>c;
  string ans="NO";
  for(int i=1;i<=1000;i++){
    if(i*a%b==c){
      ans="YES";
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#define int long long
using namespace std;

signed main() {
	int a, b, c, d, e, f, g;
	cin >> a >> b >> c >> d >> e >> f >> g;
	int ans = b;
	//a d e
	int MAX = 0;
	if (a&&d&&e) {
		a--; d--; e--;
		MAX = 3 + a / 2*2 + d / 2*2 + e / 2*2;
		a++; d++; e++;
	}
	MAX = max(MAX, a / 2*2 + d / 2 *2 + e / 2*2);
	cout << ans + MAX << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
			Scanner scanner = new Scanner(System.in);
			int n = scanner.nextInt();
			int A[] = new int[n];
			for(int i = 0; i < n; i++) {
				A[i] = scanner.nextInt();
			}

			scanner.close();
			int changeCount = 0;

			//選択ソート
			for(int i = 0; i < A.length; i++) {
				int minIndex = i;
				for(int j = i; j < A.length; j++) {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				}
			//最小値が変わっていなければ値交換はしなくてよい
			if(minIndex == i) continue;
			//値交換
			int tmp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = tmp;
			changeCount++;
			}
			System.out.println(Arrays.toString(A).replaceAll("[,\\[\\]]", ""));
			System.out.println(changeCount);
	 }
}


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

int main(){
    int a,b,c,d;    cin >> a >> b >> c >> d;
    int takahashi = c/b, aoki = a/d;
    if(c%b != 0)    takahashi++;
    if(a%d != 0)    aoki++;
    if(takahashi <= aoki){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while (x->left != NIL) x = x->left;
  return x;
}

Node treeSuccessor(Node x){
  Node y;
  if (x->right != NIL) return treeMinimum(x->right); // case 1
  y = x->parent;
  while (y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y; // case 2
    }

Node treeSearch(Node x, int k){
  if(x==NIL || k == x->key) return x;
  if(k<x->key) return treeSearch(x->left,k);
  else return treeSearch(x->right,k);
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while (x != NIL){
    y = x; // 親を設定
    if (z->key < x->key) x = x->left; // 左の子へ移動
    else x = x->right; // 右の子へ移動
  }
  z->parent=y;

  if (y == NIL) // T が空の場合
    root= z;
  else if (z->key < y->key)
    y->left = z; // z を y の左の子にする
  else 
    y->right = z; // z を y の右の子にする
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if (z->left == NIL || z->right == NIL)y = z;
  else y = treeSuccessor(z);
  if (y->left != NIL) x = y->left;
  else x = y->right;
  if (x != NIL) x->parent = y->parent;
  if (y->parent == NIL) root = x;
  else if (y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;
  if (y != z) z->key = y->key;
}

void inorder(Node u){
  if (u != NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}
void preorder(Node u){
  if (u != NIL) {
    printf(" %d" ,u->key);
    preorder(u->left);
    preorder(u->right);
  }
}


int main(){
  int  n,i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }  else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
  
  return 0;
}

Measured memory_bytes: 19364
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (int i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define fi first
#define se second
#define int long long
using namespace std;
using ll = long long;
using II = pair<int, int>; using VII = vector<II>; using VVII = vector<VII>;
using VI = vector<int>; using VVI = vector<VI>; using VVVI = vector<VVI>;
template <class T = int> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T = int> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <class T> ostream& operator<<(ostream &s, const vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream &s, const vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream &s, const pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, const map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
constexpr int MOD = 1e9 + 7;

signed main() {
  int n; cin >> n;
  VVI A(n, VI(3));
  REP (i, n) {
    cin >> A[i][0] >> A[i][1] >> A[i][2];
  }
  REPI (i, 1, n) {
    REP (j, 3) {
      int tmp = 0;
      REP (k, 3) {
        if (j == k) continue;
        tmp = max(tmp, A[i - 1][k] + A[i][j]);
      }
      A[i][j] = tmp;
    }
  }
  cout << *max_element(ALL(A[n - 1])) << endl;
}


Measured memory_bytes: 5760
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
int a[300000]={0};
int main()
{
	int n,m,t,i,j;
	cin>>n>>m>>t;
	map<int,int>p;
	p.clear();
	for(i=1;i<n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
			if(i<=m&&j>=t)
			{
				int l=j-i-(t-m)+1;
				if(!p[l]) p[l]=1;
				else p[l]++;
//				cout<<i<<" "<<j<<" "<<l<<endl;
			}
			else
			{
				if(i<=m&&j<=m||i>=t&&j>=t)
				{
				int l=j-i;
				if(!p[l]) p[l]=1;
				else p[l]++;
				} 
				else if(i<=m&&j<t)
				{
					int l=j-i;
					int l2=m-i+1+t-j;
					if(l2<l) l=l2;
					if(!p[l]) p[l]=1;
					else p[l]++;
				}
				else if(i>m&&j<t)
				{
					int l=j-i;
					int l2=i-m+1+t-j;
					if(l2<l) l=l2;
					if(!p[l]) p[l]=1;
					else p[l]++;
				}
				else if(i>m&&j>=t)
				{
					int l=j-i;
					int l2=i-m+1+j-t;
					if(l2<l) l=l2;
					if(!p[l]) p[l]=1;
					else p[l]++;
				}
				
			
//				cout<<i<<" "<<j<<" "<<l<<endl;
			}
		}
	}
	for(i=1;i<=n-1;i++)
	{
		int t=p[i];
		cout<<t<<endl;
	}
 } 
// 0 0 0 4 5 6 0
// 1 2 3       7

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define MODNum 1000000007
#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    ll N, ans;
    cin >> N;
    ll Sum = 0;
    REP(ll,i,1,N+1){
        ll Number = i;
        if ( Number % 3 == 0 ){
            continue;
        }
        else if ( Number % 5 == 0 ){
            continue;
        } 
        else Sum += Number;
    }
    cout << Sum << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include <stdio.h>
using namespace std;
int main(){
    int a,b,d,r;
    double f;
    cin>>a>>b;
    d=a/b;
    r=a%b;
    f=1.00000000*a/b;
    printf("%d %d %.8lf\n",d,r,f);
    return 0;
}


Measured memory_bytes: 3212
#!usr/bin/env python3
s = input()
K = int(input())

l = {s}
for n in range(1, K+1):
    for i in range(0, len(s)-n+1):
        l.add(s[i:i+n])
l = list(l)

l.sort()

print(l[K-1])


Measured memory_bytes: 4464