akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

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

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b>>1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

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


int main() {
	ll H1, H2;
	ll M1, M2;
	ll K;
	cin >> H1 >> M1 >> H2 >> M2 >> K;

	ll T = 60 * (H2 - H1) + M2 - M1;

	cout << T-K << endl;
}


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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#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 true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

vector<int> graph[1005];
vector<int> rev[1005];

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  vector<int> cnt(n);
  vector<P> costp(n);
  vector<int> cost(n);
  for(int i=1; i<n; i++) {
    int p; cin >> p;
    p--;
    graph[p].push_back(i);
    rev[i].push_back(p);
    cnt[p]++;
  }
  rep(i, n) cin >> cost[i];
  stack<int> st;
  rep(i, n) {
    if (cnt[i] == 0) st.push(i);
  }
  while(!st.empty()) {
    int p = st.top(); st.pop();
    int c = cost[p];
    int sum = 0;
    int usum = 0;
    vector<int> w;
    bitset<5001> bs;
    bs.set(0);
    for(auto v: graph[p]) {
      int l = costp[v].second;
      int u = costp[v].first;
      sum += l;
      usum += u;
      int d = u-l;
      bs |= (bs<<d);
    }
    if (c < sum) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    }
    int res;
    for(int i=c-sum; i>=0; i--) {
      if (bs[i]) {
        res = usum-i;
        break;
      }
    }
    costp[p].first = max(res, c);
    costp[p].second = min(res, c);
    for(auto e: rev[p]) {
      cnt[e]--;
      if (cnt[e] == 0) st.push(e);
    }
  }
  cout << "POSSIBLE" << endl;
}

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


using ll = long long;
ll N;


vector<pair<ll, int>> factor(ll n)
{
    vector<pair<ll, int>> fa;
    ll p;
    int e;
    if (n % 2 == 0) {
        e = 0;
        while (n % 2 == 0) {
            n /= 2;
            e++;
        }
        fa.emplace_back(2, e);
    }

    p = 3;
    while (p * p <= n) {
        if (n % p == 0) {
            e = 0;
            while (n % p == 0) {
                n /= p;
                e++;
            }
            fa.emplace_back(p, e);
        }
        p += 2;
    }

    if (n > 1) {
        fa.emplace_back(n, 1);
    }

    return fa;
}


vector<ll> divisors(const vector<pair<ll, int>> &fa)
{
    vector<ll> v(1, 1);
    int len = 1;
    for (const auto &x : fa) {
        ll p = x.first;
        int e = x.second;
        ll t = 1;
        for (int i = 1; i <= e; i++) {
            t *= p;
            for (int k = 0; k < len; k++)
                v.push_back(v[k] * t);
        }
        len *= e + 1;
    }
    return v;
}


void solve()
{
    int s = 1;
    vector<pair<ll, int>> fa = factor(N - 1);
    for (auto x : fa)
        s *= x.second + 1;
    s--;
    vector<ll> d = divisors(factor(N));
    for (auto x : d) {
        if (x == 1)
            continue;
        ll t = N;
        while (t % x == 0)
            t /= x;
        if (t % x == 1)
            s++;
    }
    cout << s << endl;
}


int main()
{
    cin >> N;
    solve();
    return 0;
}


Measured memory_bytes: 384
n, k = map(int, input().split())
lst = list(map(int, input().split()))
lst = [0] + lst
count = [0]*(n+1)
pat1 = 0
now = 1
while True:
  count[now] += 1
  if count[now] == 2:
    break
  now = lst[now]
  pat1 += 1


cur = 1
pat2 = 0
while True:
  if cur == now:
    break
  cur = lst[cur]
  pat2 += 1

    

if k > pat2:
  k -= pat2
  k = k % (pat1-pat2)
  k += pat2
  
now = 1
for i in range(k):
  now = lst[now]
  
print(now)



Measured memory_bytes: 32248
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
  int i;
  cin >> i;
  int j;
  int k=0;
  for(j=0;j<i;j++){
    int a;
    int b;
    cin >> a >> b;
    k = k + b - a + 1;
  }
  cout << k;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <set>
#include <iomanip>
#include <vector>
#include <limits.h>

using namespace std;

int main() {
	long long x, y;
	cin >> x >> y;
	long long k = 1;
	if (y == x) {
		cout << -1;
		return 0;
	}
	while (k * x <= INT_MAX) {
		++k;
		if ((k * x) % y != 0)
			break;
		++k;
		if ((k * x) % y != 0)
			break;
		++k;
		if ((k * x) % y != 0)
			break;
	}
	if (k * x <= INT_MAX)
		cout << k * x;
	else
		cout << -1;

#ifdef DIMA_DEBUG
	system("pause");
#endif // DIMA_DEBUG

}

Measured memory_bytes: 256
def myinput(n):
	C=[int(input())]
	L=[1]
	for i in range(1,n):
		c = int(input())
		if C[-1] == c:
			L[-1]+=1
		else:
			C.append(c)
			L.append(1)
	return [C,L]

def check(C,L,low, hih):
	m = len(C)
	ret = 0
	if 0<=low and L[low]>=4 and (hih>=m or C[low] != C[hih]):
		ret += L[low]
		low -= 1
	if hih<m and L[hih]>=4 and (low<0 or C[low] != C[hih]):
		ret += L[hih]
		hih += 1
	while 0 <= low and hih < m and C[low] == C[hih] and L[low] + L[hih] >= 4:
		ret += L[low] + L[hih]
		low -= 1
		hih += 1
	return ret

def solve(C,L):
	m = len(C)
	ret = 0
	for i in range(m):
		L[i]-=1
		if i+1 < m:
			L[i+1]+=1
			if L[i]>0:
				ret = max(ret, check(C, L, i  , i+1))
			else:
				ret = max(ret, check(C, L, i-1, i+1))
			L[i+1]-=1
		if i-1 >= 0:
			L[i-1]+=1
			if L[i]>0:
				ret = max(ret, check(C, L, i-1, i))
			else:
				ret = max(ret, check(C, L, i-1, i+1))
			L[i-1]-=1
		L[i]+=1
	return ret

while True:
	n = int(input())
	if n == 0:
		break
	C,L = myinput(n)
	print(n - solve(C,L))



Measured memory_bytes: 5736
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int32_t main(){
	string s;
	cin>>s;
	set<int> se;
	for(auto x: s){
		se.insert(x);
	}
	if(se.size()>1){
		cout<<"Yes";
	}
	else {
		cout<<"No";
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
const ll mod = 1e9+7;
const ll nax = 1e5+7;
const ll INF = 1e18;

ll n,W,dp[102][nax],w[102],v[102];

int main(){
//	freopen("input.inp","r",stdin);
//	freopen("output.out","w",stdout);
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin>>n>>W;
	for (ll i=0;i<n;++i) cin>>w[i]>>v[i];
	
	for (ll i=0;i<102;++i){
		for (ll j=0;j<nax;++j) dp[i][j]=INF;
	}
	
	dp[0][0]=0;
	
	for (ll i=0;i<n;++i){
		for (ll value=0;value<nax;++value){
			
			dp[i+1][value] = min(dp[i][value],(value >= v[i]) ? dp[i][value-v[i]]+w[i] : INF);
			
		}
	}
	
	ll res=0;
	for (ll value=0;value<nax;++value) if (dp[n][value]<=W) res=max(res,value);
	
	cout<<res<<"\n";
}

Measured memory_bytes: 83340
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;
using P = pair<int, int>;

void execute()
{
	int N, M;
	cin >> N >> M;

	priority_queue<P, vector<P>, greater<P>> bridge;

	for (int i = 0; i < M; i++)
	{
		int left, right;
		cin >> left >> right;
		bridge.push(make_pair(right, left));
	}

	int through = 0;
	int ans = 0;
	for (; !bridge.empty();)
	{
		P next = bridge.top();
		bridge.pop();
		if (through <= next.second)
		{
			through = next.first;
			ans++;
		}
	}

	cout << ans << endl;

	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

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

int main(){
    int a, b, ans;
    char op;
    
    while(1){
        cin >> a >> op >> b;
        if (op == '?') break;
        
        if (op == '+') ans = a + b;
        else if (op == '-') ans = a - b;
        else if (op == '*') ans = a * b;
        else if (op == '/') ans = a / b;

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


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

using namespace std;
using ll = long long;

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

  char a;
  cin >> a;
  if ('a' <= a && a <= 'z') {
    cout << 'a' << endl;
  } else {
    cout << 'A' << endl;
  }

  return 0;
}


Measured memory_bytes: 3584
from math import *
PI = 3.1415926535898
while True:
    try:
    	k = raw_input()
    	if len(k) > 0:
	    	a, b, x, y = map(float, k.strip().split(' '))
	    	print pow((a-x)*(a-x)+(b-y)*(b-y), 0.5)
    except EOFError:
        break

Measured memory_bytes: 6660
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<map>
#include<cstring>
using namespace std;
using ulong = unsigned long;
using ll = long long;

int n, a;
vector<int> xs;
ll memo[51][51][2501];
ll solve(int idx, int cnt, int sum){
	if(memo[idx][cnt][sum] != -1){ return memo[idx][cnt][sum]; }
	if(idx == n){
		return sum && sum == cnt * a;
	}
	return memo[idx][cnt][sum] =
		solve(idx + 1, cnt, sum) +
		solve(idx + 1, cnt + 1, sum + xs[idx]);
}

ll ptrns[50][2501];
int main(){
	cin >> n >> a;
	xs.resize(n);
	for(int i=0;i<n;i++){
		cin >> xs[i];
	}
	memset(memo, -1, sizeof(memo));
	cout << solve(1, 0, 0) + solve(1, 1, xs[0]) << endl;

	return 0;
}




Measured memory_bytes: 51704
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var F = new int[N][];
            var P = new int[N][];
            var answer = -(1 << 30);
            for (var i = 0; i < N; i++)
            {
                F[i] = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            }
            for (var i = 0; i < N; i++)
            {
                P[i] = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            }
            for (var bit = 1; bit < (1 << 10); bit++)
            {
                var sum = 0;
                for (var i = 0; i < P.Length; i++)
                {
                    var count = 0;
                    for (var j = 0; j < F[i].Length; j++)
                    {
                        if (((bit >> j) & 1) == 1 && F[i][j] == 1) count++;
                    }
                    sum += P[i][count];
                }
                answer = Math.Max(answer, sum);
            }

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 28340
def main():
    import sys
    import numpy as np
    input = sys.stdin.readline
    H, W, Q = map(int, input().split())
    S = [list(map(lambda x: x=="1", input())) for _ in range(H)] + [[False]*(W+1)]
    S = np.array(S, dtype=np.int16)
    M = np.zeros((H + 1, W + 1), dtype=np.int32)

    UD = S[1:, :] * S[:-1, :]
    M[1:, :] += UD
    M[:-1, :] += UD

    LR = S[:, 1:] * S[:, :-1]
    M[:, 1:] += LR
    M[:, :-1] += LR

    M = S * 2 - M
    M = M.cumsum(axis=0).cumsum(axis=1)
    UD = UD.cumsum(axis=1, dtype=np.int16)
    LR = LR.cumsum(axis=0, dtype=np.int16)
    M[:, -1] = 0
    M[-1, :] = 0

    del S

    UD = np.pad(UD, ((0, 1), (0, 1)), mode="constant")
    LR = np.pad(LR, ((0, 1), (0, 1)), mode="constant")
    x1, y1, x2, y2 = np.array(list(map(int, sys.stdin.read().split())), dtype=np.int16).reshape(-1, 4).T
    Ans = M[x2-1, y2-1] + M[x1-2, y1-2] - M[x2-1, y1-2] - M[x1-2, y2-1]
    Ans += LR[x2-1, y1-2] - LR[x1-2, y1-2]
    Ans += LR[x2-1, y2-1] - LR[x1-2, y2-1]
    Ans += UD[x1-2, y2-1] - UD[x1-2, y1-2]
    Ans += UD[x2-1, y2-1] - UD[x2-1, y1-2]
    Ans //= 2
    print("\n".join(str(int(a)) for a in Ans))

main()


Measured memory_bytes: 172704
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
const int MaxN = 1e5;
char a[20];
long long sum[10] = {0};
int n;
int flag = 1;
double ans;

int main()
{
	int cnt = 0;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
	{
		scanf("%s", a);
		int len = strlen(a);
		if(a[0] == 'M') sum[1]++;
		if(a[0] == 'A') sum[2]++;
		if(a[0] == 'R') sum[3]++;
		if(a[0] == 'C') sum[4]++;
		if(a[0] == 'H') sum[5]++;
	}
	if(n < 3) flag = 0;
	sort(sum + 1, sum + 1 + 5);
	for(int i = 1; i <= 5; i++)
	{
		if(sum[i] == 0) cnt++;
		if(cnt >= 3)
		{
			flag = 0;
			break;
		}
	}
	for(int i = 1; i <= n; i++)
	{
		if(cnt == 2)
		{
			ans = sum[3] * sum[4] * sum[5];
		}
		if(cnt == 1)
		{
			ans = sum[2] * sum[3] * (sum[4] + sum[5]) + sum[2] * sum[4] * sum[5] + sum[3] * sum[4] * sum[5];
		}
		if(cnt == 0)
		{
			ans = sum[1]*sum[2]*(sum[3]+sum[4]+sum[5])+sum[1]*sum[3]*(sum[4]+sum[5])+sum[1]*sum[4]*sum[5]+sum[2]*sum[3]*(sum[4]+sum[5])+sum[2]*sum[4]*sum[5]+sum[3]*sum[4]*sum[5];
		}
	}
	if(flag == 1) printf("%.0lf\n", ans);
	if(flag == 0) printf("0\n");
	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	int N;
	cin >> N;
	vector<int> c(N);
	vector<int> v(N);
	for (int i = 0; i < N; ++i) { cin >> v[i]; }
	for (int i = 0; i < N; ++i) { cin >> c[i]; }

	int res = 0;
	for (int i = 0; i < pow(2, N); ++i) {
		int x = 0, y = 0;
		for (int j = 0; j < 20; ++j) {
			if ((i>>j) & 1) {
				x += v[j];
				y += c[j];
			}
		}
		res = max(res, x - y);
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

class F
{
  const long long M = 1000000000 + 7;
  
  long long v;
  
public:
  F(long long x = 0) : v(x % M) {}

  F operator+(long long x) const { return (v + x) % M; }
  F operator-(long long x) const { return (v - x + M) % M; }
  F operator*(long long x) const { return (v * x) % M; }
  F& operator+=(long long x) { v = (v + x) % M; return *this; }
  F& operator-=(long long x) { v = (v - x + M) % M; return *this; }
  F& operator*=(long long x) { v = (v * x) % M; return *this; }
  operator long long() const { return v; }
};

int
main()
{
  int n, m;
  cin >> n >> m;
  
  vector<long long> x(n), y(m);
  for (auto& xi : x) cin >> xi;
  for (auto& yi : y) cin >> yi;

  F X = 0;
  for (long long i = 1; i < n; ++i) {
    X += F(x[i] - x[i - 1]) * F(i * (n - i));
  }
  F Y = 0;
  for (long long i = 1; i < m; ++i) {
    Y += F(y[i] - y[i - 1]) * F(i * (m - i));
  }
  cout << X * Y << "\n";
  
  return 0;
}


Measured memory_bytes: 1792
import numpy as np
stdin = open(0)
 
N, K = map(int, stdin.readline().split())
A = np.array(stdin.read().split(), np.int64)
 
 
A = np.sort(A)
zero = A[A == 0]
pos = A[A > 0]
neg = A[A < 0]
 
 
def f(x):
    """count the number of products , <= x"""
    cnt_tpl = 0
    # zero and ...
    if x >= 0:
        cnt_tpl += len(zero) * N
    # positive and ...
    cnt_tpl += np.searchsorted(A, x // pos, side='right').sum()
    # negative and ...
    cnt_tpl += (N - np.searchsorted(A, (-x - 1) // (-neg), side='right')).sum()
    # a^2
    cnt_tpl -= np.count_nonzero(A * A <= x)
    assert cnt_tpl % 2 == 0
    return cnt_tpl // 2
 
 
left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x
 
 
print(right)

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

int main() {
    string S;
    cin >> S;
    int N = stoi(S);

    int sum = 0;
    rep(i, int(S.size())) sum += (S[i] - '0');

    if(N%sum) cout << "No" << endl;
    else cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int ans=1e9;
    for(int i=0;i<=s.size()-t.size();i++)
    {
        int res=0;
        for(int j=0;j<t.size();j++)
            res+=s[i+j]!=t[j];
        ans=min(ans,res);
    }
    cout<<ans<<endl;
}


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

int main(){
    int N;
    cin >> N;
    bool pittari = false;
    for(int i=0;i<=100/4;i++){
        for(int j=0;j<=100/7;j++){
            int total = 4*i + 7*j;
            if(total == N) {
                pittari = true;
                break;
            }
        }
    }
    if (pittari) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
package main

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

var (
	sc = bufio.NewReader(os.Stdin)
)

func main() {
	K := scanInt()

	for i := 0; i < K; i++ {
		fmt.Print("ACL")
	}
	fmt.Println()
}

func abs(a int) int         { return int(math.Abs(float64(a))) }
func scan(a ...interface{}) { _, err := fmt.Fscan(sc, a...); pnc(err) }
func scanStr() (s string)   { scan(&s); return }
func scanInt() int          { i, err := strconv.Atoi(scanStr()); pnc(err); return i }
func scanFloat() float64    { f, err := strconv.ParseFloat(scanStr(), 64); pnc(err); return f }
func pnc(err error) {
	if err != nil {
		panic(err)
	}
}


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

long int h[100000000];

long int cmp(const void *a,const void *b)
{
    return *(long int *)b - *(long int *)a;
}

int main()
{
    int i,n,k;
    long long int s=0;
    scanf("%d %d",&n,&k);
    for(i = 0;i < n;i++)
        scanf("%lld",&h[i]);
    qsort(h,n,sizeof(long int),cmp);
    for(i = 0;i < k;i++)
        h[i] = 0;
    for(i = 0;i < n;i++)
        s = s+h[i];
    printf("%lld",s);
    return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

typedef long long ll;

// const long long MOD = 998244353;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
// const int mod = 1000000007;
const int mod = 998244353;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
} c(200005);

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    mint ans = 0;
    mint col = m;
    for (int x = n - 1; x >= 0; --x) {
        mint now = col;
        now *= c(n - 1, x);
        if (x <= k) ans += now;
        col *= m - 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6204
#include<bits/stdc++.h>
#define ll long long int
#define endl '\n'
#define M 1000000007
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define f first
#define s second
#define b begin
#define e end
#define pb push_back
#define mp make_pair
#define FOR(i,a,b) for(i=a;i<b;i++)
#define RFOR(i,a,b) for(i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define itfr(it,x) for(it=x.begin();it!=x.end();it++)
#define flash ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;

int main()
{
    flash;
    //sieve();
    int T=1,t,n,m,k,i;
    // cin>>T;
    while(T--)
    {
        cin>>n>>k;
        int a[10]={0};
        FOR(i,0,k){
          cin>>t;
          a[t]=1;
        }
        vector<int> vs;
        FOR(i,0,10)
            if(a[i]==0)
                vs.pb(i);
        // for(auto it:vs)cout<<it<<" ";cout<<endl;
        int dg=0;
        for(i=n;i>0;i/=10)dg++;
        ll ans=0;
        k = pow(10,dg-1);
        int fl=0;
        int num=n;
        // cout<<dg<<" "<<k<<endl;
        while(ans<num)
        {
            if(k==0){
                ans = ans*10 + vs[0];
                continue;
            }
            m = n/k;
            n = n%k;
            k/=10;
            if(a[m]==0&fl==0){
                ans = ans*10 + m;
                continue;
            }
            dg=0;
            if(fl==0)
            {
                for(auto it:vs)
                    if(it>=m)
                    {
                        dg=it;
                        break;
                    }
                if(dg==0)
                {
                    if(vs[0]!=0)
                        dg=vs[0];
                    else
                    {
                        if(ans==0)
                            dg=vs[1];
                        else
                            dg=vs[0];
                    }
                }
                ans = ans*10+dg;
                fl=1;
            }
            else
            {
                ans = ans*10 + vs[0];
            }
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3984
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 1;
  ll n;
  cin >> n;
  // ll n, m;
  // cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  int cnt[n];
  zero(cnt);
  fi(0, n) {
    int x;
    cin >> x;
    if(x >= n || (n % 2 == 0 && x == 0)) {
      cout << "0\n";
      return 0;
    }
    cnt[x]++;
  }
  if(n % 2 && cnt[0] != 1) {
    cout << "0\n";
    return 0;
  }
  int i = n % 2 == 0 ? 1 : 2;
  for(; i < n; i += 2) {
    if(cnt[i] != 2) {
      cout << "0\n";
      return 0;
    }
    (ans *= 2) %= MOD;
  }
  cout << ans << endl;
  return 0;
}



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

using namespace std;

// step % 2, left, right, last_foot(0:1=L:R)
int dp[2][9][9][2];

const int INF = 100000000;

int main(){
	while(true){
		string line;
		cin >> line;
		if(line == "#"){ break; }
		if(line.size() < 2){
			cout << 0 << endl;
			continue;
		}
		int panel = line[0] - '1';
		for(int j = 0; j < 9; ++j){
			for(int k = 0; k < 9; ++k){
				for(int l = 0; l < 2; ++l){ dp[0][j][k][l] = INF; }
			}
		}
		for(int i = 0; i < 9; ++i){
			dp[0][panel][i][0] = 0;
			dp[0][i][panel][1] = 0;
		}
		int answer = INF;
		for(int i = 1; i < line.size(); ++i){
			answer = INF;
			panel = line[i] - '1';
			for(int j = 0; j < 9; ++j){
				for(int k = 0; k < 9; ++k){
					for(int l = 0; l < 2; ++l){ dp[i % 2][j][k][l] = INF; }
				}
			}
			for(int l = 0; l < 9; ++l){
				for(int r = 0; r < 9; ++r){
					// move left
					if(panel % 3 <= r % 3 && r != panel){
						int res = dp[i % 2][panel][r][0];
						res = min(res, dp[(i - 1) % 2][l][r][0] + 1);
						res = min(res, dp[(i - 1) % 2][l][r][1]);
						answer = min(answer, res);
						dp[i % 2][panel][r][0] = res;
					}
					// move right
					if(panel % 3 >= l % 3 && l != panel){
						int res = dp[i % 2][l][panel][1];
						res = min(res, dp[(i - 1) % 2][l][r][0]);
						res = min(res, dp[(i - 1) % 2][l][r][1] + 1);
						answer = min(answer, res);
						dp[i % 2][l][panel][1] = res;
					}
				}
			}
		}
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 0
//There was and will always be only one Chester. RIP legend
//--------------------Life is beautiful--------------------
#include<bits/stdc++.h>
using namespace std;
#define Nilesh ios_base::sync_with_stdio(false);
int main()
{
	Nilesh
	int  n;
	cin>>n;
	if(n<=999)
        cout<<"ABC";
    else
        cout<<"ABD";
	
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define ll long long int
# define pb push_back
# define pf push_front
# define mpi make_pair
# define pi pair<ll,ll>
# define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
# define mod 1000000007
# define endl "\n"
using namespace std;
int main()
{
	fast
	ll n,ct=0;
	cin>>n;
	vector <ll> v1,v2;
	for(ll i=0;i<n+1;i++)
	{
		ll x;
		cin>>x;
		v1.pb(x);
	}
	for(ll i=0;i<n;i++)
	{
		ll x;
		cin>>x;
		v2.pb(x);
	}
	for(ll i=0;i<n;i++)
	{
		if(v2[i]<=v1[i])
		{
			ct+=v2[i];
		}
		else
		{
			v2[i]=v2[i]-v1[i];
			ct+=v1[i];
			if(v2[i]<=v1[i+1])
			{
				ct+=v2[i];
				v1[i+1]=v1[i+1]-v2[i];
			}
			else
			{
				ct+=v1[i+1];
				v1[i+1]=0;
			}
		}
	}
	cout<<ct;
	return 0;
}


Measured memory_bytes: 2548
#include<iostream>
#include<vector>
using namespace std;
vector<int>ans;
vector<int>G[1001];
int N,M;
vector<int>vis;
bool used[1001];
void dfs(int u)
{
	vis.push_back(u);
	used[u]=true;
	for(int v:G[u])
	{
		if(vis[0]==v)
		{
			if(ans.empty()||ans.size()>vis.size())ans=vis;
		}
		else if(!used[v])dfs(v);
	}
	vis.pop_back();
}
main()
{
	cin>>N>>M;
	for(int i=0;i<M;i++)
	{
		int u,v;cin>>u>>v;
		G[u].push_back(v);
	}
	for(int i=0;i++<N;)
	{
		for(int j=0;j++<N;)used[j]=false;
		dfs(i);
	}
	cout<<(ans.empty()?-1:-99999)<<endl;
}


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

int main(){
    int a,b;
    int n = 0;
    cin >> a >> b;

    for (int i = 0; i < 2; i++){
        if ( a >= b ) {
            n += a;
            a = a - 1;
        } else {
            n += b;
            b = b - 1;
        }
    }
    cout << n << endl;
}

Measured memory_bytes: 256
n = int(input())
s = []
t = []

for i in range(n):
	tmp = input().split()
	s.append(tmp[0])
	t.append(int(tmp[1]))
x = input()

for i in range(n):
	if s[i] == x :
		a = i+1
		break

ans = 0
if a != n:
	for i in range(a, n):
		ans += t[i]
else:
	ans = 0

print(ans)


Measured memory_bytes: 3060
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        var N = int.Parse(inputs[0]);
        var X = long.Parse(inputs[1]);
        var x = new List<long>(N);
        inputs = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++)
        {
            var value = long.Parse(inputs[i]);
            x.Add(value);
        }

        x.Add(X);
        x = x.OrderBy(xd => xd).ToList();
        var gcd = 0L;
        for (int i = 0; i < x.Count - 1; i++)
        {
            var diff = Math.Abs(x[i + 1] - x[i]);
            gcd = Gcd(gcd, diff);
        }

        Console.WriteLine(gcd);
    }

    /**
     * ユークリッド互除法(最大公約数)
     * <see cref="https://qiita.com/gushwell/items/e9614b4ac2bea3fc6486"/>
     */
    public static long Gcd(long a, long b)
    {
        if (a < b)
            // 引数を入替えて自分を呼び出す
            return Gcd(b, a);
        while (b != 0)
        {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }
}



Measured memory_bytes: 23776
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie();
	cout.tie();
	int n, m, pref[101];
	cin >> n >> m;
	int arr[n+1];
	for(int i=0;i<n;i++){
		cin >> arr[i];
		if(i==0){
			pref[i]=arr[i];
		}
		else{
			pref[i]=pref[i-1]+arr[i];
		}
	}
	int banyak=0;
	double total=pref[n-1];
	double he=4*m;
	double syarat=1/he*total;
	//cout << syarat << endl;
	for(int i=0;i<n;i++){
		if(arr[i]>=syarat){
			banyak++;
			if(banyak==m){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}

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

using namespace std;

int main(void){
	char c1, c2, c3, c4, c5, c6;
	scanf("%c%c%c\n%c%c%c", &c1, &c2, &c3, &c4, &c5, &c6);

	if(c1 == c6 && c2 == c5 && c3 == c4){
		puts("YES");
	}else{
		puts("NO");
	}

	return 0;
}

Measured memory_bytes: 256
n = int(raw_input())
pts = [complex(*[float(_) for _ in raw_input().split()]) for i in xrange(n)]


def cross(a, b):
    return (a.conjugate() * b).imag


pts.sort(key=lambda p: (p.imag, p.real))

right = []
for p in pts:
    while len(right) >= 2 and cross(right[-1] - right[-2], p - right[-1]) < 0:
        right.pop()
    right.append(p)

left = []
for p in reversed(pts):
    while len(left) >= 2 and cross(left[-1] - left[-2], p - left[-1]) < 0:
        left.pop()
    left.append(p)

ans = right[:-1] + left[:-1]
print len(ans)
for p in ans:
    print int(p.real), int(p.imag)

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

using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ll long long
#define li long int
#define ld long double
#define lld long long double

#define pb push_back
#define mk make_pair
#define F first
#define S second

#define all(v) (v).begin(),(v).end()
#define fill(a) memset(a, 0, sizeof(a))

const int MX = 1e6;
const int MI = -1e6;
const int MOD = 1e9 + 7;
const string ALPHA = "abcdefghijklmnopqrstuvwxyz";
const double PI = 3.1415926535;

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

const int mod=1e9+7;
inline int add(int x,int y)
{
  x+=y;
  if (x>=mod)
    return x-mod;
  return x;
}
inline int sub(int x,int y)
{
  x-=y;
  if (x<0)
    return x+mod;
  return x;
}
inline int mul(int x,int y)
{
  return (x*1ll*y)%mod;
}
inline int power(int x,int y)
{
  int ans=1;
  while(y)
    {
      if (y&1) ans=mul(ans,x);
      x=mul(x,x);
      y>>=1;
    }
  return ans;
}
inline int inv(int x)
{
  return power(x,mod-2);
}
inline int gcd(int x, int y)
{
  return(y!=0)?gcd(y, x%y):x;
}
inline ll nPr(int n, int r)
{
  ll i,result=1;
  rep(i,r)
    {
      result*=(ll)(n-i);
    }
  return result;
}
inline ll nCr(int n,int r)
{
  ll i,result=1;
  rep(i,min(r,n-r))
    {
      result*=(ll)(n-i);
      result/=(ll)(i+1);
    }
  return result;
}
bool prime(int n)
{
  for (int i=2; i<n/2; i++)
    {
      if(n%i==0)
	return false;
    }
  return true;
}

/*------------CODE-----------*/

int main()
{
  IOS;
  string s1, s2;
  cin >>  s1 >> s2;
  for (int i=0; i<s1.length(); i++)
    {
      if (s1[i]!=s2[i])
	{
	  cout << "No" << endl;
	  return 0;
	}
    }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAx = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,x,y,z;
long long max_value = INF, max_index = -1;
long long min_value = MAx, min_index = -1;

typedef long long ll;
typedef pair<ll, ll> Pa;

int main() {
    cin >> N;
    if(N%2 == 1) cout << 0;
    else{
        ll sum = 0;
        while(N != 0){
            sum += N/10;
            N /= 5;
        }
        cout << sum;
    } 
}


Measured memory_bytes: 256
unittest
{
	assert( [ "3" ].parse.expand.solve == 61 );
	assert( [ "4" ].parse.expand.solve == 230 );
	assert( [ "100" ].parse.expand.solve == 388130742 );
}



import std.conv;
import std.functional;
import std.range;
import std.regex;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	return tuple( n );
}

auto solve( long n )
{
	return dfs( n, "" );
}

long dfs( long n, string ps )
{
	const MOD = 10L ^^ 9 + 7;
	
	if( n <= 0 ) return 1L;
	
	auto ans = 0L;
	foreach( c; [ "A", "C", "G", "T" ] )
	{
		auto nps = ps ~ c;
		if( matchFirst( nps, ".?A.?G.?C.?|.?ACG.?|.?GAC.?" ).empty )
		{
			if( nps.length <= 3 ) ans = ( ans + memoize!dfs( n - 1, nps ) ) % MOD;
			else                  ans = ( ans + memoize!dfs( n - 1, nps[ $ - 3 .. $ ] ) ) % MOD;
		}
	}
	return ans;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#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=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, w;
	string a[10];
	cin>>h>>w;
	REP(i, h){
		cin>>a[i];
	}
	a[0][0]=a[h-1][w-1]='.';
	int x=0, y=0;
	while(x<h && y<w){
		if(x+1<h && a[x+1][y]=='#'){
			a[++x][y]='.';
		}
		else if(y+1<w && a[x][y+1]=='#'){
			a[x][++y]='.';
		}
		else{
			break;
		}
	}
	bool ok=true;
	REP(i, h){
		REP(j, w){
			if(a[i][j]!='.'){
				ok=false;
				break;
			}
		}
	}
	cout<<(ok ? "Possible" : "Impossible")<<'\n';
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);
        
        String[] numbers = scanner.nextLine().split(" ");
        int s1 = Integer.parseInt(numbers[0]);
        int s2 = Integer.parseInt(numbers[1]);
        int c = Integer.parseInt(numbers[2]);
        
        long count = IntStream.rangeClosed(s1, s2).filter(i -> c % i == 0).count();
        System.out.println(String.format("%d", count));
    }
}


Measured memory_bytes: 32392
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int N,K;
    cin >>N>>K;
    int i=1,M=K;
    while(M<=N)
    {
        M=M*K;
        i++;
    }
    cout<<i<<endl;
    return 0;
}



Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            int K = in.Int();
            int[] A = in.Int(N);

            for (int i = K; i < N; i++) {
                out.println(A[i - K] < A[i] ? "Yes" : "No");
            }
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

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

        public int[] Int(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Int();
            }
            return a;
        }

    }
}



Measured memory_bytes: 55628
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static String I = "IMPOSSIBLE";
	public static String B = "Bad";
	public static String G = "Good";

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		if ((s.charAt(0) == s.charAt(1) || s.charAt(2) == s.charAt(3)
				|| s.charAt(2) == s.charAt(1))) {
			out(B);
		} else {
			out(G);
		}
	}

	/*
	 * 以下メソッド集
	 */
	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}
}


Measured memory_bytes: 23124
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

int N;
int x[100010];

int main(){
	scanf("%d" , &N);
	int z = 1;
	while(1){
		x[z] = x[z-1] + z;
		if(x[z] >= N) break;
		++z;
	}
	while(N > 0 && z > 0){
		if(x[z] >= N && z <= N){
			printf("%d\n" , z);
			N -= z;
		}
		--z;
	}
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#define SENTINEL 2000000000
#pragma warning(disable:4996)
using namespace std;
typedef struct {
	char c;
	int num;
}Card;
Card card[100050], a[100050];
bool flag = true;
int partition(int, int);
void quickSort(int, int);
void merge(int, int, int);
void mergeSort(int, int);
bool cmp(Card a, Card b) {
	return a.num <= b.num;
}
bool cmp2(Card a, Card b) {
	return a.c == b.c&&a.num == b.num;
}
int main() {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> card[i].c >> card[i].num;
		a[i].c = card[i].c;
		a[i].num = card[i].num;
	}
	quickSort(0, n - 1);
	mergeSort(0, n);
	for (int i = 0; i < n; i++) {
		if (cmp2(card[i], a[i]) == false) {
			cout << "Not stable" << endl;
			flag = false;
			break;
		}
	}
	if (flag==true)
		cout << "Stable" << endl;
	for (int i = 0; i<n; i++)
		printf("%c %d\n", card[i].c, card[i].num);
	return 0;
}
int partition(int p, int r) {
	Card x = card[r];
	int i = p - 1;
	for (int j = p; j<r; j++) {
		if (cmp(card[j], x)) {
			i++;
			std::swap(card[i], card[j]);
		}
	}
	std::swap(card[i + 1], card[r]);
	return i + 1;
}
void quickSort(int p, int r) {
	if (p<r) {
		int q = partition(p, r);
		quickSort(p, q - 1);
		quickSort(q + 1, r);
	}
}
void mergeSort(int left, int right) {
	if (left + 1<right) {
		int mid = (left + right) / 2;
		mergeSort(left, mid);
		mergeSort(mid, right);
		merge(left, mid, right);
	}
}
void merge(int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	Card L[n1 + 1], R[n2 + 1];
	for (int i = 0; i<n1; i++)
		L[i] = a[left + i];
	for (int i = 0; i<n2; i++)
		R[i] = a[mid + i];
	L[n1].num = SENTINEL;
	R[n2].num = SENTINEL;
	int i = 0, j = 0;
	for (int k = left; k<right; k++) {
		if (cmp(L[i], R[j])) {
			a[k] = L[i];
			i++;
		} else {
			a[k] = R[j];
			j++;
		}
	}
}


Measured memory_bytes: 5508
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1LL << 60;

int main() {
    
    int N,M;
    cin >> N >> M;
    int a[M];
    int b[M];

    rep(i,M){
        cin >> a[i] >> b[i];
    }

    int ans = 0;

    vector<int> one_case;
    for (int i = 1; i <= N; i++) { // one_case = {0,1,2,3,...n-1} とする
        one_case.emplace_back(i);
    }

    do {
        int ok_1 = 1;
        for (int i = 0; i < N-1; i++){
            if(one_case[0]!=1){
                ok_1 = 0;
                break;
            }
            int ok_2 = 0;
            for (int j = 0; j < M; j++){
                if((one_case[i]==a[j])&(one_case[i+1]==b[j])){
                    ok_2 = 1;
                    break;
                }
                if((one_case[i]==b[j])&(one_case[i+1]==a[j])){
                    ok_2 = 1;
                    break;
                }
            }

            if(ok_2 != 1){
                ok_1 = 0;
                break;
            }
        }

        if(ok_1==1){
            ans++;
        }


    } while (next_permutation(one_case.begin(), one_case.end()));

    cout << ans << endl;

}

Measured memory_bytes: 3548
#include<stdio.h>

void swap(int* a, int* b);

int main(void)
{
	int A, B, C;
	scanf("%d%d%d", &A, &B, &C);

	swap(&A, &B);
	swap(&A, &C);
	printf("%d %d %d", A, B, C);

	return 0;
}
void swap(int *a, int *b) {
	int box;
	box = *a;
	*a = *b;
	*b = box;
 }

Measured memory_bytes: 128