akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include<vector>
#include<iostream>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
 
const LD eps=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};


template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}


extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<> void print<string>(const string& container)
{
	cout<<container<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec)
{
	for(T& x: vec) is >> x;
	return is;
}


template<typename T, typename U>
ostream& operator << (ostream& os, const pair<T, U>& p)
{
	os<<'('<<p.first<<", "<<p.second<<')';
	return os;
}

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}


template<unsigned int N> struct IsPrime {
	static const int size=(N>>5) + 1;
	unsigned int is_prime[size];
	constexpr IsPrime() : is_prime() {
		is_prime[0]=0x3;
		for(unsigned int i=2;i<N;i++)
		{
			if((is_prime[i>>5] & (1u<<(i&0x1f))) > 0)  continue;
			for(int j=i+i;j<N;j+=i)
				is_prime[j>>5]|=(1u<<(j&0x1f));
		}
	}
	constexpr bool operator[] (const int p) const
	{
		return (is_prime[p>>5] & (1u<<(p&0x1f))) == 0;
	}
};

template<int N> struct LikelyPrime {
	unsigned short sum[N+1];
	constexpr LikelyPrime(const IsPrime<N> pr) : sum() {
		for(int i=3;i<N;i++)
			sum[i+1]=sum[i]+(unsigned short)((pr[i] && pr[(i+1)/2])?1:0 );
	}
};

int q;
int l,r;
int main()
{
	constexpr IsPrime<100001> pr;
	constexpr LikelyPrime<100001> s(pr);
	scanf("%d",&q);
	while(q--)
	{
		scanf("%d%d", &l, &r);
		if(l==1)
		printf("%d\n", s.sum[r+1]);
		else
		printf("%d\n", s.sum[r+1]-s.sum[l]);
	}
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define lowbit(x) (x&(-x))
#define N 100005
#define LL long long
struct xx {
	int ed,last;
} w[N<<1];
int cot = 0,head[N];
void Add(int s,int e) {
	w[++cot].ed = e,w[cot].last = head[s],head[s] = cot;
	return ;
}
int Q[N<<3];
int mark[7][N],mem[N];
int main() {
	int n,m;
	cin >> n >> m;
	for(int i=1,s,e; i<=m; i++) {
		scanf("%d%d",&s,&e);
		Add(s,e);
	}
	int s,t;
	cin >> s >> t;
	int top = 1,tail = 1;
	memset(mem,-1,sizeof(mem));
	Q[tail] = s,mem[s] = 0;
	while(top <= tail) {
		int now = Q[top++];
		for(int a=head[now]; a; a=w[a].last) {
			int e1 = w[a].ed;
			if(mark[1][e1]) continue;
			mark[1][e1] = 1;
			for(int b=head[e1]; b; b=w[b].last) {
				int e2 = w[b].ed;
				if(mark[2][e2]) continue;
				mark[2][e2] = 1;
				for(int c=head[e2]; c; c=w[c].last) {
					int e3 = w[c].ed;
					if(mark[3][e3]) continue;
					mark[3][e3] = 1;
					if(mem[e3]==-1) mem[e3] = mem[now] + 1,Q[++tail] = e3;
				}
			}
		}
	}
	printf("%d",mem[t]);
	return 0;
}

Measured memory_bytes: 5888
#include<bits/stdc++.h>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int A,B,C,cnt=0;
    cin >> A >> B >> C;
    if(A-B==0) cnt++;
    if(B-C==0) cnt++;
    if(C-A==0) cnt++;
    if(cnt==1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#define MAX 99999999
using namespace std;

int main() {
    int N, X, min_m = MAX, sum_x = 0, sum = 0;
    int m[105];
    cin >> N >> X;
    for (int i = 0; i < N; i++) {
        cin >> m[i];
        min_m = min(m[i], min_m);
        sum_x += m[i];
        sum++;
    }
    sum += int((X - sum_x) / min_m);
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
# 2入力
K, N = map(int, input().split())
A = input().split()
A = [int(i) for i in A]

lag = []
for i in range(len(A)):
    if i != N-1:
        lag.append(A[(i+1)%N] - A[i%N])
    else:
        lag.append(K-A[i] + A[0])


max_value = max(lag)
max_index = lag.index(max_value)
lag.pop(max_index)
print(sum(lag))

Measured memory_bytes: 87500
fun main (args : Array<String>) {
	val (n, m) = readLine()!!.split(" ").map(String::toInt)
	val N : Int = n.toInt()
	val M : Int = m.toInt()
	var L : Int
	var R : Int
	val lList : MutableList<Int> = mutableListOf()
	val rList : MutableList<Int> = mutableListOf()
	var result : Int = 0
	for (i in 0..M - 1) {
		val (l, r) = readLine()!!.split(" ").map(String::toInt)
		L = l.toInt()
		R = r.toInt()
		lList.add(L)
		rList.add(R)
	}
	lList.sort()
	lList.reverse()
	rList.sort()
	for (i in lList[0]..rList[0]) {
		result++
	}
	println("${result}")
	
}

Measured memory_bytes: 58448
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M,Q = MI()
    LR=LLIN_(M)
    PQ=LLIN(Q)

    D=[[0]*N for _ in range(N)]
    for l,r in LR:
        D[l][r] += 1

    cumsum_2d = [[0]*(N+1) for _ in range(N+1)]
    
    for i in range(N):
        for j,d in enumerate(D[i]):
            cumsum_2d[i+1][j+1] = d

    for i in range(N):
        for j,d in enumerate(D[i]):
            cumsum_2d[i+1][j+1] += cumsum_2d[i+1][j] + cumsum_2d[i][j+1] - cumsum_2d[i][j]
    
    for p,q in PQ:
        print(cumsum_2d[q][q]-cumsum_2d[p-1][q]-cumsum_2d[q][p-1]+cumsum_2d[p-1][p-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 101212
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <algorithm>
#include <stdio.h>
#include <functional>
#include <iomanip>
using namespace std;

//??°?????????????????°

void function()
{
	//??¢??°
}

int main()
{
	char c;
	int a[26] = { 0 };

	while (cin >> c)
	{
		if (isupper(c)) c = tolower(c);

		if ((int)'a' <= (int)c && (int)c <= (int)'z')
		{
			a[(int)c - (int)'a']++;
		}
	}

	for (int i = 0; i < 26; i++)
	{
		cout << (char)(i + (int)'a') << " : " << a[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1140
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  int N,T;
  std::cin >> N >> T;
  vt<int> t(N);
  rep(i,N) std::cin >> t[i];

  ll time = T;
  for(int i = 1; i < N; i++){
    if(T+t[i-1] > t[i])
      time += t[i] - t[i-1];
    else
      time += T;
  }

  std::cout << time << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main() {
  int h, w;
  int i;
  scanf("%d %d%*c", &h, &w);

  char buf[102];
  for (i = 0; i < h;i++) {
    scanf("%s%*c", buf);
    printf("%s\n", buf);
    printf("%s\n", buf);
  }
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,b)  for(int i=0;i<(int)(b);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
typedef long long ll;
typedef long double ld;

using namespace std;

int main(){
    cs;
    int n,h,t=0,ans=0;
    cin>>n;
    rep(i,n){
        cin>>h;
        if(h<t) ans+=t-h;
        t=h; 
    }
    cout<<ans+h;
    
}

Measured memory_bytes: 256
#define MYDEBUG
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <algorithm>
#include <queue>
#include <set>
#include <cstdio>
#include <unordered_map>

#ifdef MYDEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define all(x) x.begin(), x.end()
using namespace std;

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
	out << "[";
	size_t last = v.size() - 1;
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i];
		if (i != last)
			out << ",";
	}
	out << "]";
	return out;
}

void solve() {
	string s;
	cin >> s;
	replace(all(s), ',', ' ');
	cout << s << endl;
}
int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back()
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;


signed main(){
    int n;
    cin >> n;
    n++;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    if(a[0]==1&&n==1){
        cout << 1 << endl;
        return 0;
    }
    if(a[0]!=0){
        cout << -1 << endl;
        return 0;
    }
    ll leaf[n];
    repp(i,n){
        if(i==n-1) leaf[i]=a[n-1];
        else leaf[i]=leaf[i+1]+a[i];
    }
    ll now=1;
    ll ans=1;
    for(int i=1;i<n;i++){
        if(i!=n-1&&now*2<a[i]+1){
            cout << -1 << endl;
            return 0;
        }
        if(now*2<leaf[i]){
            ans+=2*now;
            now=now*2-a[i];
        }else{
            ans+=leaf[i];
            now=leaf[i]-a[i];
        }
        if(i!=n-1&&now<=0){
            cout << -1 << endl;
            return 0;
        }
        if(i==n-1&&now!=0){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
}


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

int main() {
  bool ans = false;
  int k;
  int a, b;
  cin >> k >> a >> b;
  int K = k;
  for(int i=0; i<1001; i++) {
    if(K>b) {
      break;
    }
    if(a<=K&&K<=b) {
      ans = true;
    }
    K+=k;
  }
  if(ans) {
    cout << "OK" << endl;
  } else {
    cout << "NG" << endl;
  }
}
    

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int N = 1e6;

int main() {
	ios_base::sync_with_stdio(0);
	int a,b,n,T,cas=0;
	long long h, s=0;
	cin>>h;
	for(long long i=1;i<=h;i*=2) s+=i;
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, m;
  cin >> n >> m;
  ll ans = abs((n - 2) * (m - 2));
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,n) a[i] = in();
    cout << *max_element(ALL(a)) - *min_element(ALL(a)) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>


#define max 256

int main()
{
	int n, i = 0, j = 0, count = 0;
	char a[max], b[max], x[max];

	scanf("%d", &n);

	scanf("%s %s", &a, &b);

	while (j!= n)
	{
		x[i] = a[j];
		x[i + 1] = b[j];

		i = i + 2;
		j++;
	}

	x[2 * n] = '\0';




	printf("%s\n", x);

	
	return 0;
}

Measured memory_bytes: 128
from fractions import gcd


def solve(string):
    a, b, c, d = map(int, string.split())
    lcm = c * d // gcd(c, d)
    return str(b - a + 1 - (b // c - (a - 1) // c + b // d - (a - 1) // d - b // lcm +
                            (a - 1) // lcm))


if __name__ == '__main__':
    print(solve(input()))


Measured memory_bytes: 5048
package main

import "fmt"

func main() {
	var x, y int
	fmt.Scan(&x, &y)
	m := map[int]int{1: 1, 2: 3, 3: 1, 4: 2, 5: 1, 6: 2, 7: 1, 8: 1, 9: 2, 10: 1, 11: 2, 12: 1}
	if m[x] == m[y] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		str+="E";
		int min = Integer.MAX_VALUE;

		for(int i=0; i<str.length()-3;i++) {
			Integer num = Integer.valueOf(str.substring(i,i+3));
			int abs = Math.abs(753-num);
			if(abs<min) {
				min=abs;
			}
		}
		System.out.println(min);
	}
}

Measured memory_bytes: 21844
n,m,l=map(int, input().split())
a = []
b = []

for i in range(n):
    a.append(list(map(int, input().split())))
for j in range(m):
    b.append(list(map(int, input().split())))

for i in range(n):
    c = []
    for j in range(l):
        sum = 0
        for k in range(m):
            sum += a[i][k] * b[k][j]
        c.append(sum)
    print(" ".join(list(map(str, c))))



Measured memory_bytes: 6248
import sys
k1 = [[0 for i in xrange(10)] for j in xrange(3)]
k2 = [[0 for i in xrange(10)] for j in xrange(3)]
k3 = [[0 for i in xrange(10)] for j in xrange(3)]
k4 = [[0 for i in xrange(10)] for j in xrange(3)]
 
n = input()
for i in xrange(n):
    m = map(int,raw_input().split())
    if m[0] == 1:
     k1[m[1]-1][m[2]-1] = k1[m[1]-1][m[2]-1] + m[3] 
    elif m[0] == 2:
     k2[m[1]-1][m[2]-1] = k2[m[1]-1][m[2]-1] + m[3]         
    elif m[0] == 3:
     k3[m[1]-1][m[2]-1] = k3[m[1]-1][m[2]-1] + m[3]         
    elif m[0] == 4:
     k4[m[1]-1][m[2]-1] = k4[m[1]-1][m[2]-1] + m[3] 
 
 
for i in xrange(3):
    for j in xrange(10):
        x = ' ' + str(k1[i][j])
        sys.stdout.write(x)
    if j == 9:
        print ""
 
print"#"*20 
 
for i in xrange(3):
    for j in xrange(10):
        y = ' ' + str(k2[i][j])
        sys.stdout.write(y)
    if j == 9:
        print ""
 
print"#"*20        
 
for i in xrange(3):
    for j in xrange(10):
        z = ' ' + str(k3[i][j])
        sys.stdout.write(z)
    if j == 9:
        print ""
         
print"#"*20 
 
for i in xrange(3):
    for j in xrange(10):
        zz = ' ' + str(k4[i][j])
        sys.stdout.write(zz)
    if j == 9:
        print ""

Measured memory_bytes: 6452
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int N=5005;
int n,A,B,a[N];
ll f[N],v1[N],v2[N];
ll mn[N*4],tg[N*4];
struct TR1{
	int t[N];
	void change(int x){
		for (;x<=n;x+=x&(-x)) t[x]++;
	}
	int ask(int x){
		int ans=0;
		for (;x;x-=x&(-x)) ans+=t[x];
		return ans;
	}
}T1;
void build(int k,int l,int r){
	mn[k]=1ll<<60; tg[k]=0;
	if (l==r) return;
	int mid=(l+r)/2;
	build(k*2,l,mid);
	build(k*2+1,mid+1,r);
}
void pushdown(int k){
	if (!tg[k]) return;
	tg[k*2]+=tg[k]; tg[k*2+1]+=tg[k];
	mn[k*2]+=tg[k]; mn[k*2+1]+=tg[k];
	tg[k]=0;
}
void change(int k,int l,int r,int x,int y,ll v){
	if (l==x&&r==y){
		tg[k]+=v;
		mn[k]+=v;
		return;
	}
	pushdown(k);
	int mid=(l+r)/2;
	if (y<=mid) change(k*2,l,mid,x,y,v);
	else if (x>mid) change(k*2+1,mid+1,r,x,y,v);
	else{
		change(k*2,l,mid,x,mid,v);
		change(k*2+1,mid+1,r,mid+1,y,v);
	}
	mn[k]=min(mn[k*2],mn[k*2+1]);
}
void change(int k,int l,int r,int x,ll v){
	if (l==r){	
		mn[k]=v;
		return;
	}
	pushdown(k);
	int mid=(l+r)/2;
	if (x<=mid) change(k*2,l,mid,x,v);
	else change(k*2+1,mid+1,r,x,v);
	mn[k]=min(mn[k*2],mn[k*2+1]);
}
ll ask(int k,int l,int r,int x,int y){
	if (l==x&&r==y) return mn[k];
	pushdown(k);
	int mid=(l+r)/2;
	if (y<=mid) return ask(k*2,l,mid,x,y);
	if (x>mid) return ask(k*2+1,mid+1,r,x,y);
	return min(ask(k*2,l,mid,x,mid),ask(k*2+1,mid+1,r,mid+1,y));
}
int main(){
	scanf("%d%d%d",&n,&A,&B);
	For(i,1,n) scanf("%d",&a[i]);
	For(i,1,n){
		v1[i]=1ll*A*(i-1)+1ll*T1.ask(a[i])*(B-A);
		v2[i]=1ll*A*(n-a[i])+1ll*B*(a[i]-1)-v1[i];
		T1.change(a[i]);
	}
	ll ans=1ll<<60;
	build(1,1,n);
	For(i,1,n) f[i]=v1[i];
	For(i,1,n){
		f[i]=min(f[i],ask(1,1,n,1,a[i])+1ll*(i-1)*A);
		change(1,1,n,a[i],n,B-A);
		change(1,1,n,a[i],f[i]-1ll*i*A);
	}
	For(i,1,n)
		ans=min(ans,f[i]+v2[i]);
	printf("%lld\n",ans);
}

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

int main(){
	ll N, M; cin >> N >> M;
	vector<ll> A(N);
	rep(i, N) cin >> A[i];
	sort(ALL(A));
	ll sum[N+1];
	sum[0] = 0;
	rep(i, N){ sum[i+1] = sum[i] + A[i];}
	ll ok = 300000, ng = -1, ret, cnt;
	while(ok-ng>1){
		ll mid = (ok + ng)/2;
		ll now = N-1;
		cnt = 0;
		ret = 0;
		rep(i, N){
			while(A[i] + A[now] >= mid && now > -1){
				now--;
			}
			ret += sum[N] - sum[now+1] + A[i]*(N-1-now);
			cnt += N - 1 - now;
		}
		if(cnt <= M) ok = mid;
		else ng = mid;
	}
	cout << ret - (cnt-M)*ng << endl;
	return 0;
}


Measured memory_bytes: 1792
time = []
for i in range(5):
  time.append(int(input()))
  
time_diff = [(10-(i%10))%10 for i in time]
time_ten = [i+(10-i%10)%10 for i in time]


max_diff = time_diff.index(max(time_diff))

ans = sum(time_ten) - time_ten[max_diff] + time[max_diff]

print(ans)

Measured memory_bytes: 3060
from collections import deque
N,M=map(int,input().split())
G=[[] for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    G[a-1].append(b-1)
K=[0 for i in range(N)]
for i in range(N):
    for p in G[i]:
        K[p]+=1
q=deque(i for i in range(N) if K[i]==0)
res=[]
while q:
    v1=q.popleft()
    res.append(v1)
    for v2 in G[v1]:
        K[v2]-=1
        if K[v2]==0:
            q.append(v2)
if len(res)==N:
    print(-1)
    exit()
X={i for i in range(N)}
for st in range(N):
    before=[-1 for i in range(N)]
    q=deque([st])
    flag=0
    while(q):
        r=q.popleft()
        for p in G[r]:
            if before[p]==-1:
                before[p]=r
                q.append(p)
            if before[st]!=-1:
                Y={st}
                tmp=before[st]
                while(tmp!=st):
                    Y.add(tmp)
                    tmp=before[tmp]
                if len(Y)<len(X):
                    X={i for i in Y}
                flag=1
                break
        if flag:
            break
print(len(X))
for i in X:
    print(i+1)


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

int main() {
    int n, m;
    cin >> n >> m;;
    set<int> counter;
    counter.insert(0);
    vector<int> num(n, 1);
    rep(i, m) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        num[x]--;
        num[y]++;
        if(counter.count(x)){
            counter.insert(y);
            if(num[x] <= 0){
                counter.erase(x);
            }
        }
    }
    cout << counter.size() << endl;
}

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

int main() {
    int a, b;
    vector<int> vec(5);

    int i = 0;
     int maxv = 0, maxi = 0;
    while (true) {
        cin >> a >> b;
        if (a == 0 && b == 0)
            break;
        if (maxv < a+b) {
            maxv = a + b;
            maxi = i;
        }
        
        if (i >= 4) {
            printf("%c %d\n", 'A'+maxi, maxv);
            maxv = 0;
            maxi = 0;
            i = 0;
        }
        else {
            i++;
        }
    }
}


Measured memory_bytes: 3148
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var array = 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 };
            var K = int.Parse(Console.ReadLine());

            Console.WriteLine(array[K - 1]);
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <cmath>

using namespace std;

int n, A, B, C;
int *l;
#define INF 1000000000

int dfs(int i, int a, int b, int c) {
    if (i == n) {
        if (min(min(a, b), c) > 0)
            return abs(a-A) + abs(b-B) + abs(c-C)-30;
        else 
            return INF;
    }

    int ret0 = dfs(i+1, a+l[i], b, c) + 10;
    int ret1 = dfs(i+1, a, b+l[i], c) + 10;
    int ret2 = dfs(i+1, a, b, c+l[i]) + 10;
    int ret3 = dfs(i+1, a, b, c);

    return min(min(ret0, ret1), min(ret2, ret3));
}

int main() {
    cin >> n >> A >> B >> C;
    l = new int[n];
    for (int i = 0; i < n; i++)
        cin >> l[i];

    cout << dfs(0, 0, 0, 0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#define INF 999999999
#define ll long long
using namespace std;
ll n;
ll v[400005];
ll t[400005];//最大值 
ll o[400005]; //最小值 
ll lM,rM,lm=INF,rm=INF;
inline ll read()
{
  ll f=1,x=0;char ch=getchar();
  while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
  while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
  return x*f;
}
struct node
{
	ll ma,mi;
}p[200005];
ll ans=(ll)INF*(ll)INF;
bool cmp(node a,node b)
{
	return a.mi<b.mi;
}
int main()
{
	n=read();
  	for(int i=1;i<=2*n;i++)
    {
        v[i]=read();
    }
	for(int i=1;i<=n;i++)
	{
	    ll x1=max(v[2*i-1],v[2*i]);
	    ll x2=min(v[2*i-1],v[2*i]);
	    p[i].ma=x1,p[i].mi=x2;
		lM=max(lM,x1);
	    lm=min(lm,x1);
	    rM=max(rM,x2);
	    rm=min(rm,x2);
	}
	ll ans=(lM-lm)*(rM-rm);
 	if(lm>rM)
 	{
	 	printf("%lld\n",ans);
	 	return 0;
	 }
	sort(p+1,p+n+1,cmp);//属性值小的放在另一堆，排序 
	 t[1]=p[1].ma;
	 o[1]=p[1].ma;
	 for(int i=2;i<=n;i++)
	 {
 		t[i]=max(t[i-1],p[i].ma);
 		o[i]=min(o[i-1],p[i].ma);
 	} 
 	lm=rm;//从上向下交换左右属性值 
 	rM=max(rM,t[1]);
 	rm=min(p[1].ma,p[2].mi);
 	for(int i=2;i<=n;i++)
 	{
	 	ans=min(ans,(lM-lm)*(rM-rm));//最大与最小 
	 	rM=max(rM,t[i]);//维护一个最大值（交换） 
	 	rm=min(o[i],p[i+1].mi);//维护最大值（即前面最小的值和下一个的最小值） 
	 }
	 printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 12800
import java.util.*;

public class Main {
  private static String[] KEYWORDS = new String[]{
    "dream",
    "dreamer",
    "erase",
    "eraser",
  };

  private static boolean myStartsWith(String text, String pattern, int startIndex) {
    if (startIndex + pattern.length() > text.length()) {
      return false;
    }
    for (int i = 0; i < pattern.length(); i++) {
      if (text.charAt(startIndex + i) != pattern.charAt(i)) {
        return false;
      }
    }
    return true;
  }

  private static boolean isReachable(String str) {
    boolean[] reachable = new boolean[str.length() + 1];
    reachable[str.length()] = true;
    for (int i = str.length() - 1; i >= 0; i--) {
      for (String keyword : KEYWORDS) {
        if (i + keyword.length() <= str.length() &&
            reachable[i + keyword.length()] &&
            myStartsWith(str, keyword, i)) {
//            str.substring(i).startsWith(keyword)) {
          reachable[i] = true;
          break;
        }
      }
    }
    return reachable[0];
  }

  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    String str = s.next();
    System.out.println(isReachable(str) ? "YES" : "NO");
  }
}


Measured memory_bytes: 13832
#include <iostream>

using namespace std;

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

  long long ans = 1e14;
  for (long long i = 1; i*i <= n; i++) {
    if (n % i == 0) {
      long long j = n/i;
      ans = min(ans, i+j-2);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

type player struct {
	name  string
	cards []string
}

func main() {
	var a, b, c string
	fmt.Scan(&a, &b, &c)

	players := []*player{
		{name: "A", cards: strings.Split(a, "")},
		{name: "B", cards: strings.Split(b, "")},
		{name: "C", cards: strings.Split(c, "")},
	}
	cardPlayerIdxMap := map[string]int{"a": 0, "b": 1, "c": 2}
	curTurn := 0
	for {
		curPlayer := players[curTurn]
		if len(curPlayer.cards) == 0 {
			fmt.Println(curPlayer.name)
			return
		}
		card := curPlayer.cards[0]
		curPlayer.cards = curPlayer.cards[1:]
		curTurn = cardPlayerIdxMap[card]
	}
}


Measured memory_bytes: 1852
N = [int(n) for n in input().split()]
ans = True

if not 1 in N:
    ans = False
if not 9 in N:
    ans = False
if not 7 in N:
    ans = False
if not 4 in N:
    ans = False

if ans:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3060
A = input()
B = input()
C = input()

card_len = {'a' : len(A), 'b' : len(B), 'c' : len(C)}
counter_dict = {'a' : 0, 'b' : 0, 'c' : 0}
def check_winner(now):

  if counter_dict[now] == card_len[now]:
    return now
  if now == 'a':
    next = A[counter_dict[now]]
  elif now == 'b':
    next = B[counter_dict[now]]
  elif now == 'c':
    next = C[counter_dict[now]]
  counter_dict[now] += 1
  return check_winner(next)


print(check_winner('a').upper())

Measured memory_bytes: 38512
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#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++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n, k;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>k;
    if((n-1)*(n-2)/2<k){
        cout<<-1<<"\n";
        return 0;
    }
    else{
        int edgecount=n-1+(n-1)*(n-2)/2-k;
        cout<<edgecount<<"\n";
        for(int i=2;i<n+1;i++){
            cout<<1<<" "<<i<<"\n";
        }
        int count=(n-1)*(n-2)/2-k;
        for(int i=2;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                if(count==0) return 0;
                cout<<i<<" "<<j<<"\n";
                count--;
            }
        }
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <map>
#include <set>
#include <math.h>
#include <ctype.h>
#include <string.h>
#include <string>
#include <stdlib.h>
#include <queue>
#include <limits.h>
using namespace std;

typedef long long ll;

const int N = 1e5;
int n, h[N], dp[N], k;

int main(int argc, char **argv) {
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; ++i)
		scanf("%d", &h[i]);
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	for (int i = 1; i < n; ++i)
		for (int j = 1; j <= k && i - j >= 0; ++j)
			dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
	printf("%d\n", dp[n - 1]);
	return 0;
}


Measured memory_bytes: 1024
using System;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var AB = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var A = AB[0];
            var B = AB[1];

            var output = 0;
            for (var i = A; i <= B; i++)
            {
                var i1 = i.ToString();
                var i2 = new string(i1.Reverse().ToArray());
                if (i1 == i2)
                {
                    output++;
                }
            }

            Console.WriteLine(output);
        }
    }
}


Measured memory_bytes: 15432
#include <stdio.h>

int main()
{
 long long i,e,n,min,max,sum=0;

 scanf("%d", &n);

 int a[10000];

 for(i=0;i<n;i++)
 {
  scanf("%ld", &a[i]);
  sum= sum + a[i];
 }

  min=a[0];
  max=a[0];

 for(e=1;e<n;e++)
 {
    if(a[e]<min)
     min=a[e];

    if(a[e]>max)
     max=a[e];
   }

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

return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

long long  mod = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<int> a(n),b(n);
    rep(i,n){
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b.begin(),b.end());
    rep(i,n){
        if(a[i]>=b[n/2]){
            cout << b[n/2-1] << endl;
        }else{
            cout << b[n/2] << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3712
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;
const int NONE = -1;
int main(void) {
	int N;
	cin >> N;
	vector<int> v(N);
	rep(i, N) cin >> v[i];

	map<int, int> odd_index_value;
	map<int, int> even_index_value;

	for (int i = 0; i < N; i++) {
		if (i % 2 == 0) {
			even_index_value[v[i]]++;
		}
		else {
			odd_index_value[v[i]]++;
		}
	}


	vector<pair<int, int> > appearance_times_of_odd_index_value;//(出現回数,値)
	appearance_times_of_odd_index_value.push_back(make_pair(NONE,0));
	for (auto &kv:odd_index_value) {
		appearance_times_of_odd_index_value.push_back(make_pair(kv.second,kv.first));
	}
	sort(RALL(appearance_times_of_odd_index_value));


	vector<pair<int, int> > appearance_times_of_even_index_value;//(出現回数,値)
	appearance_times_of_even_index_value.push_back(make_pair(NONE, 0));
	for (auto& kv : even_index_value) {
		appearance_times_of_even_index_value.push_back(make_pair(kv.second, kv.first));
	}
	sort(RALL(appearance_times_of_even_index_value));

	if (appearance_times_of_even_index_value[0].second == appearance_times_of_odd_index_value[0].second and even_index_value.size() == 1 and odd_index_value.size() == 1) {
		cout << N / 2 << endl;
	}
	else if (appearance_times_of_even_index_value[0].second == appearance_times_of_odd_index_value[0].second) {
		cout << min(N - appearance_times_of_even_index_value[1].first - appearance_times_of_odd_index_value[0].first, N - appearance_times_of_even_index_value[0].first - appearance_times_of_odd_index_value[1].first) << endl;
	}
	else {
		cout << N - appearance_times_of_even_index_value[0].first - appearance_times_of_odd_index_value[0].first << endl;
	}

	return 0;
}

Measured memory_bytes: 6520
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,dp[1009][1009];
char c[1009][1009];
const ll mod=1e9+7;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>m;
for(ll i=1;i<=n;i++)
    for(ll j=1;j<=m;j++)
    cin>>c[i][j];
dp[1][1]=1;
for(ll i=1;i<=n;i++)
for(ll j=1;j<=m;j++){
    if((i==1&&j==1)||c[i][j]=='#')
        continue;
    dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
}
cout<<dp[n][m];
return 0;
}


Measured memory_bytes: 12452
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main(){
    int s; cin>>s;
    int h=s/3600;
    s%=3600;
    int m=s/60;
    s%=60;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG 
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, s, n) for (int i = s; i < n; i++)
#define all(v) v.begin(), v.end() // sort(all(array))
#define INF 1000000000
#define mod 1000000007
using namespace std;
using ll = long long;
using vi = vector<int>; //vi array(要素数, 初期値)
using pll = pair<ll, ll>;
using pii = pair<int, int>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>; //vvi table(行数, vi(列数, 初期値))
using vvc = vector<vc>;
using vvs = vector<vs>;
using vvb = vector<vb>;

int main() {
    int n, k; cin >> n >> k;
    vi p(n); rep(i, n) cin >> p[i];
    sort(all(p));

    int cost = 0;
    rep(i, k) {
        cost += p[i];
    }
    cout << cost << endl;
}

Measured memory_bytes: 3532
s = input()
t = input()
f = 0
if len(t)-1 == len(s):
  for i in range(len(s)):
    if t[i] == s[i]:
      pass
    else:
      f = 1
      break
else:
  print("No")
if f == 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9124
#include<stdio.h>

int result[45];

int fibonacci(int n){
  if(n==0 || n==1) return result[n] = 1;
  if(result[n] != -1) return result[n];
  return result[n] = fibonacci(n-1) + fibonacci(n-2);
}

int main(){
  int n,i;
  for(i=0; i<45; ++i){
    result[i] = -1;
  }
  scanf("%d",&n);
  printf("%d\n",fibonacci(n));
  return 0;
}



Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
int main (){
    long long N,ans=1;
    char x;
    cin >> N;
    vector<long long> v(26,0);
    
    for(long long i=0;i<N;i++){
        cin >> x;
        v.at(x-'a')++;
    }
    
    for(long long j=0;j<26;j++){
        ans *= v.at(j)+1;
        ans %= 1000000007;
    }

    ans--;
    
    ans %= 1000000007;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long CountReverse(long long* a, int n){
    long long count = 0;
    for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            if(a[i] > a[j]) count++;
        }
    }
    return count;
}

long long CountReverse2(long long* a, int n){
    long long count = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(a[i] > a[j]) count++;
        }
    }
    return count;
}

int main(){
    long long N, K;
    cin >> N >> K;
    long long * A = new long long[N];
    for(long i=0;i<N;i++){
        cin >> A[i];
    }
    long long rk = ((K * (K -1) / 2) % (1000000000 + 7) * (CountReverse2(A, N) % (1000000000 + 7))) + (K * CountReverse(A, N)) % (1000000000 + 7);
    cout << rk % (1000000000 + 7) << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
typedef std::pair<int,int> pii;
typedef std::pair<int,double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

#define PI 3.14159265358979323846264338327950L
const int mod = 1000000007;


void solve(){
    int n,k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    
    for(int i = k; i < n; i++){
        if (a[i] > a[i-k]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    
}


int main(){
    int T;
    T = 1;
    //cin >> T;
    while(T--){
        solve();
        cout << endl;
    }
}





































Measured memory_bytes: 4840
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    string S;
    cin >> S;
    char c = S[0];
    int ans = 0;
    for(int i = 0; i < S.size(); i++) {
        if(c != S[i]) {
            c = S[i];
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
N, M = gets.split.map(&:to_i)
Ss = M.times.map{gets.split.drop(1).map(&:to_i)}
Ps = gets.split.map(&:to_i)

require 'matrix'
a = Matrix[*[0, 1].repeated_permutation(N)]
b = Matrix[*Ss.map{|s| s.each_with_object([0]*N){|i, o| o[i - 1] = 1}}]
puts (a*b.t).to_a.map{|v| v.map{|e| e % 2}}.count(Ps)

Measured memory_bytes: 4860
n,w = gets.split.map(&:to_i)

s = []
n.times{s << gets.split.map(&:to_i)}

s = s.group_by{|x,y|x}.map{|k,v|[k, v.map{|x,y|y}.sort.reverse]}


ws = s.map{|x,y| x}
(4-ws.size).times{ws << 1000000000}
vs = s.map{|x,y| y}
(4-vs.size).times{vs << [0]}



m = 0
(0..vs[0].size).each do |i1|
  (0..vs[1].size).each do |i2|
    (0..vs[2].size).each do |i3|
      (0..vs[3].size).each do |i4|
        next if ws[0]*i1 + ws[1]*i2 + ws[2]*i3 + ws[3]*i4 > w
        m = [[vs[0][0,i1], vs[1][0,i2], vs[2][0,i3], vs[3][0,i4]].flatten.inject(&:+) || 0, m].max
      end
    end
  end
end

puts m

Measured memory_bytes: 2044
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

inline int read()
{
	int res = 0; bool bo = 0; char c;
	while (((c = getchar()) < '0' || c > '9') && c != '-');
	if (c == '-') bo = 1; else res = c - 48;
	while ((c = getchar()) >= '0' && c <= '9')
		res = (res << 3) + (res << 1) + (c - 48);
	return bo ? ~res + 1 : res;
}

int n, x, ans;

int main()
{
	n = read();
	while (n--) x = read(), ans |= (x & 1);
	puts(ans ? "first" : "second");
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer str = new StringTokenizer(bfr.readLine());
		int N = Integer.parseInt(str.nextToken());
		int M = Integer.parseInt(str.nextToken());
		str = new StringTokenizer(bfr.readLine());
		int[] arr = new int[N];
		int sum = 0;
		for(int i=0; i<N; i++) {
			arr[i] = Integer.parseInt(str.nextToken());
			sum+=arr[i];
		}
		Arrays.sort(arr);
		for(int i=N-1; i>(N-1)-M; i--) {
			if(arr[i]<((double)sum/(4*M))) {
				System.out.println("No");
				return;
			}	
		}
		System.out.println("Yes");
	}

}


Measured memory_bytes: 22484
n = int(input())
li = []

for i in range(n):
    a,b = map(int,input().split())
    c = a+b
    li.append([a,b,c])

li.sort(key=lambda x:x[2],reverse=True)

takahashi = 0
aoki = 0
for i in range(n):
    if i%2 == 0:
        takahashi += li[i][0]
    else:
        aoki += li[i][1]

print(takahashi-aoki)


Measured memory_bytes: 24452
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const double PI=3.1415926535897932;
using namespace std;
typedef long long ll;

int main(void){
    ll n;
    cin>>n;
    int c=0;
    vector <ll>a(n+1);
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n;i+=2){
        if(a[i]%2==1)c++;
    }
    cout<<c<<endl;
    
    
}

Measured memory_bytes: 3624
n,m=map(int,input().split())
f1=[]
f2=[]
for i1 in range(1,int(m**0.5)+1):
    if m%i1==0:
        i2=m//i1
        if i1>=n:
            ans=i2
            break
        elif i2==n:
            ans=i1
            break
        elif i2<n:
            ans=f1[-1]
            break
        f1+=[i1]
        f2+=[i2]
else:
    ans=f1[-1]
print(ans)


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

int n, k;
vector<P> e;
vector<int> edge[2000];
bool visit[2000];
int num;

void dfs(int s, int node) {
    visit[s] = true;
    if (node > k / 2) num++;
    rep(i, edge[s].size()) {
        if (visit[edge[s][i]]) continue;
        dfs(edge[s][i], node + 1);
    }
}

int main(){
    cin.sync_with_stdio(false);
    cin >> n >> k;

    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        e.pb(P(a, b));
        edge[a].pb(b), edge[b].pb(a);
    }

    int mini = INF;
    if (k % 2 == 0) {
        rep(i, n) {
            rep(j, n) visit[j] = false;
            num = 0;
            dfs(i, 0);
            minch(mini, num);
        }
    } else {
        rep(i, e.size()) {
            rep(j, n) visit[j] = false;
            num = 0;
            visit[e[i].se] = true;
            dfs(e[i].fi, 0);
            dfs(e[i].se, 0);
            minch(mini, num);
        }
    }

    cout << mini << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
using namespace std;
using Graph = vector<vector<int>>;

signed main()
{
  int N, K;
  cin >> N >> K;
  
  vector<pair<int, int>> num(N);
  for( int i = 0; i < N; i++ ){
    int A, B;
    cin >> A >> B;
    num.at(i) = make_pair(A, B);
  }
  sort(num.begin(), num.end());
  
  int total = 0;
  for( int i = 0; i < N; i++ ){
    total += num.at(i).second;
    if( total >= K ){
      cout << num.at(i).first << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

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

	vector<int> data(N);
	long long int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> data[i];
		sum += data[i];
	}

	bool init = false;
	long long int min_el = 0;
	long long int cur = 0;

	for (int i = 0; i < N - 1; i++) {
		cur += data[i];
		long long int temp = abs(cur - (sum - cur));
		if (init) {
			min_el = min(min_el, temp);
		} else {
			min_el = temp;
			init = true;
		}

	}

	cout << min_el << endl;

	return 0;
}


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

typedef long long int ll;
int main()
{
  ll n,k;cin>>n>>k;
  if(n>=k)
  {
  	ll t=n%k;
    cout<<min(t,abs(t-k));
  }
  else
    cout<<min(n,abs(n-k));
  
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int MOD = 1000000007;

int dp[1100][1100];

vector<string> a;

inline void add(int& a, int b) {
	a += b;
	if (a >= MOD)a -= MOD;
}

int main() {
	int h, w;
	cin >> h >> w;
	a.resize(h);
	for (int i = 0;i < h;i++)cin >> a[i];

	dp[0][0] = 1;


	for (int i = 0;i < h;i++) {
		for (int j = 0;j < w;j++) {
			if (i+1<h && a[i + 1][j] == '.')add(dp[i + 1][j], dp[i][j]);
			if (j+1<w && a[i][j + 1] == '.')add(dp[i][j + 1], dp[i][j]);
		}
	}

	cout << dp[h - 1][w - 1] << endl;

}

Measured memory_bytes: 5632