akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <climits>

using namespace std;

int main(){
  string S, str1, str2;
  int size;

  cin >> S;

  while(1){
    S.pop_back(); S.pop_back();
    size = S.size();
    str1 = S.substr(0, size/2);
    str2 = S.substr(size/2, size/2);
    if(str1 == str2) break;
  }

  cout << size << endl;

	return 0;
}


Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

char tmp[100];
string s;

int read() {
  if (scanf("%s", tmp) < 1) {
    return false;
  }
  s = tmp;
  return true;
}

const int sigma = 26;

void solve() {
  if (sz(s) < sigma) {
    int msk = 0;
    for (int i = 0; i < sz(s); i++) {
      msk |= (1 << (s[i] - 'a'));
    }
    for (int i = 0; i < sigma; i++) {
      if (!(msk & (1 << i))) {
        s += (char) ('a' + i);
        break;
      }
    }
    printf("%s\n", s.c_str());
    return;
  }
  string t = s;
  if (!next_permutation(s.begin(), s.end())) {
    printf("-1\n");
    return;
  }
  for (int i = 0; i < sz(s); i++) {
    if (s[i] != t[i]) {
      s.resize(i + 1);
      break;
    }
  }
  printf("%s\n", s.c_str());
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
using namespace std;

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

    vector<string> vec = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string S;
    int ans = 0;

    cin >> S;
    for (int i = 0; i < 7; i++)
    {
        if (vec[i] == S)
        {
            ans = i;
        }
    }

    cout << 7 - ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>

/***** type *****/
using namespace std;
using ll = long long;
using ld = long double;
template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;
template <class T> using vvvt = vector<vector<vector<T>>>;
using ml = boost::multiprecision::cpp_int;

/***** define *****/
#define all(c) (c).begin(), (c).end()            // begin to end
#define rep(i, b, e) for (ll i = b; i < e; i++)  // repeat
#define repr(i, b, e) for (ll i = b; e < i; i--) // repeat reverse
/***** const value *****/
#define llong_max 9223372036854775807            // 9 * 10^18
#define ldbl_max 1.79769e+308                    // 1.7 * 10^308
#define mod 1000000007                           // 1e9 + 7
#define pi 3.14159265                            // 3.14 ...
#define nya 10                                   // nya size
/***** for each macro *****/
#define fori(i, ...) if(ll i = -1) for(__VA_ARGS__) if(i++, true)
#define each(i, e, v) fori(i, auto& e: v)
#define forir(i, ...) if(ll i = Size(v)) for(__VA_ARGS__) if(i--, true)
#define eachr(i, e, v) forir(i, auto& e: boost::adaptors::reverse(v))

/***** lambda *****/
auto Adjust = [] // add vector or sub vector
(auto b, auto e, auto x)
{ for (auto it = b; it != e; ++it)* it += x; };
auto Bit = [] // long long bit shift
(auto n) { return (1LL << n); };
auto Count = [] // long long count value
(auto b, auto e, auto x) { return (ll)count(b, e, x); };
auto CtoLL = [] // char to long long
(auto c) { return (ll)(c - '0'); };
auto Divc = [] // long double div ceiling
(auto a, auto b) { return ceil((ld)a / (ld)b); };
auto Nya = [] // long long nya size
(auto n) { return (ll)pow(10, n); };
auto Size = []  // long long collection size
(auto& c) { return (ll)(c).size(); };
auto Sum = []   // long long accumulate
(auto b, auto e) { return accumulate(b, e, 0LL); };
auto VVT = []   // vector<vector<T>> resize 
(auto& vvt, auto ysize, auto xsize)
{ vvt.resize(ysize); each(i, vy, vvt) vy.resize(xsize); };
auto VVVT = []   // vector<vector<vector<T>>> resize 
(auto& vvvt, auto zsize, auto ysize, auto xsize)
{ vvvt.resize(zsize); each(z, vz, vvvt) VVT(vz, ysize, xsize); };
auto InVVT = []  // input vector<vector<T>> (T != struct)
(auto& vvt) { each(y, vy, vvt) each(x, e, vy) cin >> e; };
auto InVVVT = [] // input vector<vector<vector<T>>> (T != struct)
(auto& vvvt) { each(z, vz, vvvt) InVVT(vz); };

namespace NyaGadgetCpp17
{
	/**
	@brief 最大公約数を計算する関数
	@note
	 aとbの最大公約数を返す
	**/
	long long Gcd(long long a, long long b)
	{
		return b ? Gcd(b, a % b) : a;
	}
	/**
	@brief 最小公倍数を計算する関数
	@note
	 aとbの最小公倍数を返す
	**/
	long long Lcm(long long a, long long b)
	{
		return a / Gcd(a, b) * b;
	}
};

int main(void)
{
	ll A, B; cin >> A >> B;
	cout << NyaGadgetCpp17::Lcm(A, B);

	return 0;
}


Measured memory_bytes: 256
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

def build_grid(H, W, intv, _type, space=True, padding=False):
    # 入力がスペース区切りかどうか
    if space:
        _input = lambda: input().split()
    else:
        _input = lambda: input()
    _list = lambda: list(map(_type, _input()))
    # 余白の有無
    if padding:
        offset = 1
    else:
        offset = 0
    grid = list2d(H+offset*2, W+offset*2, intv)
    for i in range(offset, H+offset):
        row = _list()
        for j in range(offset, W+offset):
            grid[i][j] = row[j-offset]
    return grid

def bfs(grid, src):
    """ BFS(グリッド、重みなし) """
    from collections import deque

    H, W = len(grid), len(grid[0])
    directions = ((1, 0), (-1, 0), (0, 1), (0, -1))
    dist = list2d(H, W, INF)
    que = deque()
    for h, w in src:
        que.append((h, w))
        dist[h][w] = 0
    while que:
        h, w = que.popleft()
        for dh, dw in directions:
            for k in range(1, K+1):
                h2 = h + dh*k
                w2 = w + dw*k
                if grid[h2][w2] == '@':
                    break
                # 枝刈り
                if dist[h2][w2] < dist[h][w] + 1:
                    break
                elif dist[h2][w2] == dist[h][w] + 1:
                    continue
                else:
                    dist[h2][w2] = dist[h][w] + 1
                    que.append((h2, w2))
    return dist

H, W, K = MAP()
x1, y1, x2, y2 = MAP()
grid = build_grid(H, W, '@', str, space=0, padding=1)

res = bfs(grid, [(x1, y1)])
ans = res[x2][y2]
if ans == INF:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 175400
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i > 0; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;


int main() {
	int n, m;
	cin >> n >> m;
	vector<p> a(n);
	rep(i, n) {
		cin >> a[i].first >> a[i].second;
	}
	sort(a.begin(), a.end());
	ll buy = 0, ans = 0;
	rep(i, n) {
		rep(j, a[i].second) {
			buy++;
			ans += a[i].first;
			if (buy >= m) {
				cout << ans << endl;
				return 0;
			}
		}
	}
	return 0;
}
//Ctrl+Aを使わない

Measured memory_bytes: 1792
n,a,b = list(map(int,input().split()))
num_sum = 0
for ni in range(n+1):
    d1 = ni%10
    d2 = (ni//10)%10
    d3 = (ni//100)%10
    d4 = (ni//1000)%10
    d5 = (ni//10000)%10
    digit_sum = d1 + d2 + d3 + d4 + d5
    if digit_sum >= a and digit_sum <= b: num_sum += ni
print(num_sum)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
vector<ll> vec[210000];
ll n, a, b, c[210000], d[210000], s, t;
const ll INF = 1000000000000000000;

void dfss(ll x){
    for (ll i = 0; i < vec[x].size(); i++) {
        if (c[vec[x][i]] != INF) continue;
        
        c[vec[x][i]] = c[x] + 1;
        dfss(vec[x][i]);
    }
}

void dfst(ll x){
    for (ll i = 0; i < vec[x].size(); i++) {
        if (d[vec[x][i]] != INF) continue;
        
        d[vec[x][i]] = d[x] + 1;
        dfst(vec[x][i]);
    }
}

int main(void){
    // Your code here!
    cin >> n;
    for (ll i = 1; i < n; i++) {
        cin >> a >> b;
        vec[a].push_back(b);
        vec[b].push_back(a);
    }
    for (ll i = 1; i <= n; i++) {
        c[i] = INF;
        d[i] = INF;
    }
    c[1] = 0, d[n] = 0;
    dfss(1);
    dfst(n);
    for (ll i = 1; i <= n; i++) {
        if (d[i] < c[i]) t++;
        else s++;
    }
    if (s > t) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;
}


Measured memory_bytes: 15360
// 2012/02/22 Tazoe

#include <iostream>
using namespace std;

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

	int T[100][3];
	for(int i=0; i<N; i++){
		T[i][0] = i;
		T[i][1] = 0;
		T[i][2] = 0;
	}

	for(int i=0; i<N*(N-1)/2; i++){
		int A, B, C, D;
		cin >> A >> B >> C >> D;

		if(C>D){
			T[A-1][1] += 3;
		}
		else if(C<D){
			T[B-1][1] += 3;
		}
		else{
			T[A-1][1] += 1;
			T[B-1][1] += 1;
		}
	}

	for(int i=0; i<N-1; i++){
		for(int j=i+1; j<N; j++){
			if(T[i][1]<T[j][1]){
				int tmp = T[i][0];
				T[i][0] = T[j][0];
				T[j][0] = tmp;
				tmp = T[i][1];
				T[i][1] = T[j][1];
				T[j][1] = tmp;
				tmp = T[i][2];
				T[i][2] = T[j][2];
				T[j][2] = tmp;
			}
		}
	}

	T[0][2] = 1;
	for(int i=1; i<N; i++){
		if(T[i][1]==T[i-1][1]){
			T[i][2] = T[i-1][2];
		}
		else{
			T[i][2] = i+1;
		}
	}

	for(int i=0; i<N-1; i++){
		for(int j=i+1; j<N; j++){
			if(T[i][0]>T[j][0]){
				int tmp = T[i][0];
				T[i][0] = T[j][0];
				T[j][0] = tmp;
				tmp = T[i][1];
				T[i][1] = T[j][1];
				T[j][1] = tmp;
				tmp = T[i][2];
				T[i][2] = T[j][2];
				T[j][2] = tmp;
			}
		}
	}

	for(int i=0; i<N; i++){
		cout << T[i][2] << '\n';
	}

	return 0;
}

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

int main() {
	int N;
    cin >> N;
    int count;
    for(int i=1;i<N+1;i++){
      int sum=0;
      for(int j=1;j<i+1;j++){
        if(i%j==0){
          sum++;
        }
      }
      if(sum==8 && i%2==1){
        count++;
      }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong MOD = 1_000_000_007;
ulong INF = 1_000_000_000_000;
ulong MIDDLE = 100_000;
alias Side = Tuple!(long, "from", long, "to");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    auto n = lread();
    auto a = aryread();
    auto numbers = new long[](MIDDLE + 1);
    foreach (e; a)
        numbers[e]++;

    long max_x;
    foreach (i; iota(1, MIDDLE))
    {
        long x = numbers[i - 1] + numbers[i] + numbers[i + 1];
        max_x = max(x, max_x);
    }
    max_x.writeln();
}


Measured memory_bytes: 4272
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<ll, ll>;
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 h, n;
    cin >> h >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    rep(i, n){
        cin >> a[i] >> b[i];
    }

    vector<ll> dp(10000+1, 1<<30);
    dp[0] = 0;
    for(int i=1; i<=10000; i++){
        rep(j, n){
            dp[i] = min(dp[i], dp[i-a[j]<0?0:i-a[j]]+b[j]);
        }
    }
    cout << dp[h] << endl;

    return 0;
}

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


int main() {

    /*
     * */
    string s;
    cin >> s;
    
    if (s[0] == s[1] && s[1] == s[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
import bisect
def main2():
    N = int(input())
    L = list(map(int, input().split()))
    L = sorted(L)

    ans = 0
    for i in range(len(L) - 2):
        for j in range(i + 1, len(L) - 1):
            ab = L[i] + L[j]
            r = bisect.bisect_left(L, ab)
            l = j + 1
            ans += r - l

    print(ans)

if __name__ == "__main__":
    main2()

Measured memory_bytes: 9308
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;

int main(){

	ll q, h, s, d, n, ans=0;
	cin >> q >> h >> s >> d >> n;
	h=min(2*q, h);
	s=min(2*h, s);
	d=min(2*s, d);
	ans+=(n%2)*s;
	n/=2;
	ans+=n*d;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
N = gets.to_i
arr = gets.split.map(&:to_f)
nn = (N + 1) / 2
dp = Array.new(nn + 1, 0)
dp[0] = 1
N.times do |i|
  (nn - 1).downto(0) do |j|
# dp[j+1],,,i回中少なくともj+1回表が出る確率合計
# dp[j] - dp[j+1],,,少なくともj回表 - 少なくともj+1回表＝ちょうどj回表の確率合計
# (dp[j] - dp[j+1]) * arr[i],,,ちょうどj回表の確率合計に現在のコインの表の確率を加味すると現在のコインによってちょうどj+1回の確率合計が求まる。
# dp[j+1] += ((dp[j] - dp[j+1]) * arr[i]),,,前回迄の確率合計に累積する。
    dp[j+1] += ((dp[j] - dp[j+1]) * arr[i]).round(12)
  end
end
# p dp
puts dp[nn]

Measured memory_bytes: 2172
#include <cstdio>

using namespace std;

int main() {
  for (;;) {
    const int c = getchar();                                                                                                                                              
    if (c == '\n')
      break;

    if ('a' <= c && c <= 'z')
      printf("%c", c - 0x20);
    else if ('A' <= c && c <= 'Z')
      printf("%c", c + 0x20);
    else
      printf("%c", c);
  }
  printf("\n");
  return 0;
}

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

// {{{ Union Find  to use UFinit(n) for 0-n UFs

int UFpare[100004];
int UFrank[100004];
int UFdist[100004];
void UFinit(int n){
    for (int i = 0; i <= n; i++) {
        UFpare[i] = i;
        UFrank[i] = 0;
        UFdist[i] = 0;
    }
}
int UFroot( int x ){
    if( UFpare[x] == x ) return x;
    else{
        int r = UFroot(UFpare[x]);
        UFdist[x] += UFdist[UFpare[x]];
        return UFpare[x] = UFroot(UFpare[x]);
    }
}
int UFdista( int x ){
    UFroot(x);
    return UFdist[x];
}
int UFdiff( int x, int y){
    return UFdista(y) - UFdista(x);
}
bool UFunion( int x , int y , int z ){
    z += UFdista(x); z -= UFdista(y);
    x = UFroot(x);
    y = UFroot(y);
    if( x == y ) return false;
    if( UFrank[x] < UFrank[y] ) swap(x,y), z = -z;
    if ( UFrank[x] == UFrank[y] ) UFrank[x]++;
    UFpare[y] = x;
    UFdist[y] = z;
    return true;
}
bool UFsame( int x, int y){
    return UFpare[x] == UFpare[y];
}

/*
 * UFinit(n) := initialize Union Find with n UFs( must operate )
 * UFpare[] = root of node
 * UFrank[] = rank of root
 * UFroot(x) := return root of node
 * UFunion(x,y) := unite two root in a root
 * UFsame(x,y) := return two root is same
 */
// }}}

int main() {

    int n,m;
    int l,r,d;
    int x[100003] = {};
    bool ans = 1;


    Scd2(n,m);
    UFinit(n);
    Rep(i,m){
        Scd3(l,r,d);
        if( !ans ) continue;
        if( !UFunion(l,r,d) ){
            //    printf ("%d\n", UFdiff(l,r));
            if( UFdiff(l,r) != d ){
                ans= false;
            }
        }
    }


    YesNo(ans);

    return 0;
}



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

int main(){
    int a,b;
    cin>>a>>b;
    if(a<b){
        for(int i=0;i<b;i++) cout<<a;
        cout<<endl;
    }else{
        for(int i=0;i<a;i++) cout<<b;
        cout<<endl;
    }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import copy
from collections import deque


def main():

    n ,a, b = map(int, input().split())
    s=input()
    cnt=[0,0]
    for i ,item in enumerate(s):
        if item=='a' and a+b>cnt[0]:
            print('Yes')
            cnt[0]+=1

        elif item=='b' and a+b>cnt[0] and b>cnt[1] :
            print("Yes")
            cnt[0]+=1
            cnt[1]+=1
        else:
            print("No")


main()


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


Measured memory_bytes: 51240
#include <stdio.h>

int main(){
	int n,i,a=0,b=0,c=0,d=0;
	scanf("%d",&n);
	char s[n][4];
	for(i=0;i<n;i++){
		scanf("%s",s[i]);
		if(s[i][0]=='A') a++;
		if(s[i][0]=='W') b++;
		if(s[i][0]=='T') c++;
		if(s[i][0]=='R') d++;
	}
	printf("AC x %d\n",a);
	printf("WA x %d\n",b);
	printf("TLE x %d\n",c);
	printf("RE x %d\n",d);
	return 0;
}

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

int main() {
    string s,t;cin>>s>>t;
    set<int> st;
    int a[26]{};
    fill(a,a+26,-1);
    for (int i=0;i<s.size();i++) {
        if (a[s[i]-'a']==-1) {
            if (st.count(t[i]-'a')) {
                cout<<"No"<<endl;
                return 0;
            }
            a[s[i]-'a']=t[i]-'a';
            st.insert(t[i]-'a');
        } else if (a[s[i]-'a']!=t[i]-'a') {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    string s1,s2;
    cin>>s1>>s2;
    map<char,int>m1,m2;
    for(int i = 0; i < s1.size(); i++){
      m1[s1[i]]++;
      m2[s2[i]]++;
    }
    vector<int>v1,v2;
    for(pair<char,int>c:m1){
        v1.push_back((c.second));
    }
    for(pair<char,int>c:m2){
        v2.push_back((c.second));
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    if(v1==v2){
        cout<<"Yes";
    }
    else {
        cout<<"No";
    }
return 0;
}

Measured memory_bytes: 900
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

int main(){
    int H,A;

    cin >> H >> A;
    cout << (H - 1) / A + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSR(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
string s;
int n;
int main(){
	cin>>n>>s;
	vector<int>vec;
	rep(i,n) vec.pb((s[i]=='o'?0:1));
	for(int a0=0;a0<2;a0++)for(int a1=0;a1<2;a1++){
		vector<int>vi; vi.pb(a0); vi.pb(a1);
		for(int i=1;i<n-1;i++){
			int x = (vi[i]^vi[i-1]^vec[i]);
			vi.pb(x);
		}
		if((vi[n-1]^vi[0]^vi[1]) == vec[0] && (vi[n-1]^vi[0]^vi[n-2]) == vec[n-1]){
			rep(i,n) printf((vi[i]==0?"S":"W"));
			puts("");
			return 0;
		}
	}
	puts("-1");
}

Measured memory_bytes: 1816
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int N;
int table[301],memo[301][301];

int calc(int left,int right){

	int left_table[10],right_table[10];
	for(int i = 0; i < 10; i++){
		left_table[i] = 0;
		right_table[i] = 0;
	}

	int index = 0;

	while(left > 0){
		left_table[index++] = left%10;
		left /= 10;
	}

	index = 0;

	while(right > 0){
		right_table[index++] = right%10;
		right /= 10;
	}

	int ret = 0,kuriagari = 0;

	for(int i = 0; i < 10; i++){
		ret += left_table[i]*right_table[i]+kuriagari;
		if(left_table[i]+right_table[i]+kuriagari >= 10){
			kuriagari = 1;
		}else{
			kuriagari = 0;
		}
	}

	return ret;
}

int recursive(int left,int right){

	if(left == right)return 0;

	if(memo[left][right] != BIG_NUM)return memo[left][right];

	for(int mid = left; mid <= right-1; mid++){
		memo[left][right] = min(memo[left][right],recursive(left,mid)+recursive(mid+1,right)+calc(table[mid]-table[left-1],table[right]-table[mid]));
	}

	return memo[left][right];
}

int main(){

	scanf("%d",&N);

	table[0] = 0;

	for(int i = 1; i <= N; i++){
		scanf("%d",&table[i]);
		table[i] += table[i-1];
	}

	for(int left = 0; left <= N; left++){
		for(int right = 0; right <= N; right++)memo[left][right] = BIG_NUM;
	}

	printf("%d\n",recursive(1,N));

	return 0;
}



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

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

template<class T, class U> void chmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> void chmin(T &a, U b) { if (b < a) a = b; }

using ll = long long;
using ld = long double;
using namespace std;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int h, w; cin >> h >> w;
  char c[h][w];
  
  rep(i, h) rep(j, w) cin >> c[i][j];
  rep(i, h) {
    rep(j, w) cout << c[i][j]; cout << '\n';
    rep(j, w) cout << c[i][j]; cout << '\n';
  }
  
  return (0);
}

Measured memory_bytes: 3668
#include <iostream>
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <complex>
#include <cassert>
#include <random>
#include <cstring>
#include <numeric>
#define ll long long
#define ld long double
#define null NULL
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < n; ++i)
#define sz(a) (int)a.size()
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
template<class T> int gmax(T &a, T b) { if (b > a) { a = b; return 1; } return 0; }
template<class T> int gmin(T &a, T b) { if (b < a) { a = b; return 1; } return 0; }
using namespace std;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }
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

const int MAXN = 25;
int A[MAXN], B[MAXN], C[MAXN];

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

        for(int i = 1; i <= n; ++i) {
            cin >> A[i];
        }
        for(int i = 1; i <= n; ++i) {
            cin >> B[i];
        }
        for(int i = 1; i < n; ++i) {
            cin >> C[i];
        }

        int sum = 0;
        for(int i = 1; i <= n; ++i) {
            sum += B[A[i]];
            if(i > 1 && A[i-1] == A[i] -1 ) {
                sum += C[A[i-1]];
            } 
        }

        printf("%d\n", sum);
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define substr(s,f,t) (s.substr(f-1,t-f+1))
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=1010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,k;cin>>n>>k;
  priority_queue<pair<ll,ll> >que;
  for(int i=0;i<n;i++){
    ll a,b;cin>>a>>b;
    que.push(mp(b,a));
  }
  priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>que2;
  ll syu[100010]={};
  ll ans=0;
  set<ll>se;
  for(int i=0;i<k;i++){
    ans+=que.top().F;
    syu[que.top().S]++;
    se.insert(que.top().S);
    que2.push(que.top());
    que.pop();
  }

  ans+=(ll)((ll)se.size()*(ll)se.size());
  ll numm=ans;
  while(!que.empty()){
    if(que2.empty())break;
    if(syu[que.top().S]){que.pop();continue;}
    while(syu[que2.top().S]==1){que2.pop();    if(que2.empty())break;}
    if(que2.empty())break;
    numm=(ll)(2*se.size()+1)+numm+que.top().F-que2.top().F;
    // cout<<ans<<" "<<numm<<endl;
    ans=max(ans,numm);

      syu[que2.top().S]--;
      que2.pop();
      se.insert(que.top().S);
      syu[que.top().S]++;
    
    que.pop();
 
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 7408
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define P pair<int, int>
#define Q pair<int, pair<int, int>>
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
const int Mod = 1e9 + 7;
const int mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll mod = Mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % mod;
			comp_[i] = mod_pow(fact_[i], mod - 2, mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % mod * comp_[y] % mod;
}*/
//---------------------------------------------------
signed main() {
	int n;
	vector<int>a, b;
	cin >> n;
	for (int i = 0; i < n; i++) {
		a.push_back(read());
	}
	sort(all(a));
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < i; j++) {
			int k = lower_bound(all(a), a[i] - a[j] + 1) - a.begin();
			ans += max(0ll, j - k);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define MOD 10000
 
string s;
short dp[2][3][10][500][501]; //[free][増減][prev][余り][index]
int m;
 
int solve( bool fr, int updw, int pre, int mod, int index){
  if( index == s.size() ) return !mod;
  if( dp[fr][updw][pre][mod][index] != -1 ) return dp[fr][updw][pre][mod][index];
  int ret = 0, end = fr ? 9 : s[index];
  for(int i = 0, u ; i <= end ; i++ ){
    switch(updw){
    case 0: //さいしょ
      if( pre && pre == i ) continue;
      else if( pre == 0 ) u = 0;
      else if( pre > i ) u = 1;
      else u = 2;
      break;
    case 1: //次あっぷ
      if( pre >= i ) continue;
      else u = 2;
      break;
    case 2: //次だうん
      if( pre <= i ) continue;
      else u = 1;
      break;
    }
    ret += solve( fr|(i!=s[index]), u, i, (mod*10+i)%m, index+1);
  }
  return dp[fr][updw][pre][mod][index] = ret % MOD;
}
 
void java(){
  for(int i = s.size() - 1 ; i >= 0 ; i-- ){
    if(s[i] == 0) s[i] = 9;
    else{
      s[i]--;
      break;
    }
  }
}

void init(){
    for(int j = 0 ; j < 3 ; j++ )
      for(int k = 0 ; k < 10 ; k++ )
	for(int l = 0 ; l < m ; l++ )
	  for(int q = 0 ; q <= s.size() ; q++ )
	    dp[0][j][k][l][q] = dp[1][j][k][l][q] = -1;
}

int main(){
  string s1;
  cin >> s >> s1 >> m;
  for(int i = 0 ; i < s.size() ; i++ ) s[i] -= '0';
  java();
  init();
  int an = solve( 0, 0, 0, 0, 0);
  s = s1;
  for(int i = 0 ; i < s.size() ; i++ ) s[i] -= '0';
  init();
  int bn = solve( 0, 0, 0, 0, 0);
  cout << ( bn - an + MOD ) % MOD << endl;
}

Measured memory_bytes: 30640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <cstring>
#include <queue>
using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rev(i,n) for(int i=(int)n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SS stringstream
#define DBG1(a) rep(_X,sz(a)){printf("%d ",a[_X]);}puts("");
#define DBG2(a) rep(_X,sz(a)){rep(_Y,sz(a[_X]))printf("%d ",a[_X][_Y]);puts("");}
#define bitcount(b) __builtin_popcount(b)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)

#define delete(a,n) a.erase(remove(all(a),n),a.end())
template<typename T, typename S> vector<T>& operator<<(vector<T>& a, S b) { a.push_back(b); return a; }
template<typename T> void operator>>(vector<T>& a, int b) {while(b--)if(!a.empty())a.pop_back();}
bool isprime(int n){ if(n<2)return false;  for(int i=2;i*i<=n;i++)if(n%i==0)return false;  return true;} 
ll b_pow(ll x,ll n){return n ? n==1 ? x: b_pow(x,n>>1)*b_pow(x,(n>>1)+(n&1)) : 1;}
string itos(int n){stringstream ss;ss << n;return ss.str();}



bool done[10][10];
int d[10][10];
int ans = 0;
int h,w,c;
int dx[] = {0,-1,0,1}, dy[] = {-1,0,1,0};

void dfs(int x,int y,int from,int to){
	if(!(x >= 0 && x < w && y >= 0 && y < h))return;
	if( done[y][x] || d[y][x] != from) return ;
	else d[y][x] = to , done[y][x] = true;
	rep(i,4){
		int tx = x + dx[i] , ty = y + dy[i];
		dfs(tx,ty,from,to);
	}
}
int ppp = 0;
int counta(int x,int y,int color){
	if(!(x >= 0 && x < w && y >= 0 && y < h))return 0;
	if( done[y][x] || d[y][x] != color) return 0;
	else done[y][x] = true, ppp++;
	rep(i,4){
		int tx = x + dx[i] , ty = y + dy[i];
		counta(tx,ty,color);
	}
}
void bt(int p){
	if(p == 5){
		ppp = 0;
		rep(i,10)rep(j,10)done[i][j] = 0;
		counta(0,0,c);
		ans = max(ans,ppp);
		
		return;
	}
	int tmp[10][10];
	for(int i = 1 ; i <= 6 ; i++){
		rep(x,10)rep(y,10)tmp[x][y] = d[x][y];
		rep(x,10)rep(y,10)done[x][y] = 0;
		dfs(0,0,d[0][0],i);
		bt(p+1);		
		rep(x,10)rep(y,10)d[x][y] = tmp[x][y];
	}
}
int main(){
	while(cin >> h >> w >> c , h || w || c){
		rep(i,h)rep(j,w){
			cin >> d[i][j];
		}
		ans = 0;
		bt(0);
		cout << ans << endl;
	}
}

Measured memory_bytes: 872
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N,Ma,Mb = map(int,input().split())
ABC = [tuple(map(int,input().split())) for _ in range(N)]

# dp[a][b] : Aタイプが ag, Bタイプが bg となる 最小コスト
inf = float("inf")
dp = [[inf for _ in range(401)] for _ in range(401)]
dp[0][0] = 0

for a,b,c in ABC:
    for i in range(400,-1,-1):
        for j in range(400,-1,-1):
            if dp[i][j] != inf:
                # 薬品を使った方が安ければ更新する
                dp[i+a][j+b] = min(dp[i+a][j+b], dp[i][j] + c)

ans = inf
for i in range(1,401):
    for j in range(1,401):
        # i : j == Ma : Mb なら コストを更新
        if i*Mb == j*Ma:
            ans = min(ans, dp[i][j])

print(ans if ans != inf else -1)

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

using ld=long double;

const int OFFSET=50;
const ld INF=1e4;

ld solve(int r,int n,vector<int> &rh){
  ld t=INF;
  for(int i=1;i<OFFSET*2;++i){
    int x=i-OFFSET;
    if(x<=-r || r<=x) continue;
    int h=min(rh[i-1],rh[i]);
    ld y=sqrt(r*r-x*x);


    t=min(h-y,t);
  }
  return t+r;
}
	 
int main(){
  int r,n;
  cout<<setprecision(10)<<fixed;
  while(cin>>r>>n,r){
    vector<int> xl(n);
    vector<int> xr(n);
    vector<int> h(n);
    for(int i=0;i<n;i++){
      cin>>xl[i]>>xr[i]>>h[i];
    }
    vector<vector<int>> f(30,vector<int>(OFFSET*2,0));
    for(int i=0;i<n;i++){
      for(int j=xl[i];j<xr[i];j++){
	for(int k=0;k<h[i];k++){
	  f[k][j+OFFSET]=true;
	}
      }
    }

    vector<int> rh(OFFSET*2,0);
    for(int i=0;i<OFFSET*2;i++){
      for(int j=29;j>=0;j--){
	if(f[j][i]){
	  rh[i]=j+1;
	  break;
	}
      }
    }
    cout<<solve(r,n,rh)<<endl;
  }
  return 0;
}


Measured memory_bytes: 3276
#include<bits/stdc++.h>
using namespace std;
 
int seat[100000];

int ck(string s){
	if (s == "Vacant"){
		return 0;
	}
	if (s == "Male"){
		return 1;
	}
	return 2;
}
 
int main(){
	int n;
	cin >> n;
	int l = 0, r = n - 1, a;
	string ver;
	
	cout << l << endl;
	cout.flush();
	cin >> ver;
	seat[l] = ck(ver);
	if (!seat[l]){
		exit(0);
	}
	
	cout << r << endl;
	cout.flush();
	cin >> ver;
	seat[r] = ck(ver);
	if (!seat[r]){
		exit(0);
	}
	
	while (l != r - 1){
		int mid = (l + r) / 2;
		cout << mid << endl;
		cout.flush();
		cin >> ver;
		seat[mid] = ck(ver);
		
		if (!seat[mid]){
			exit(0);
		}
		if(abs(seat[mid] - seat[l]) != (mid - l) % 2){
			r = mid;
		}
		else{
			l = mid;
		}
	}
	cout << l << endl;
	cout.flush();
	cin >> ver;
	seat[l] = ck(ver);
	if (!seat[l]){
		exit(0);
	}
	
	cout << r << endl;
	cout.flush();
	cin >> ver;
	seat[r] = ck(ver);
	if (!seat[r]){
		exit(0);
	}
}

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

#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int n; cin >> n;
    n %= 10;
    if(n==2||n==4||n==5||n==7||n==9){
        cout << "hon" << endl;
    }else if(n==3){
        cout << "bon" << endl;
    }else{
        cout << "pon" << endl;
    }
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define wi(t) int t;cin>>t;while(t--)
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve()
    {
    ll int n,k;
    cin>>n>>k;
    vl ar(n);
    fo(i,n) cin>>ar[i];
    ll int i=0,j=k;
    ll int lo=n-k;
    while (lo--)
    {
        if(ar[j]>ar[i])
        {
            cout<<"Yes"<<endl;
            j++;i++;
        }
        else
        {
            cout<<"No"<<endl;
            j++;i++;
        }
        
    }
    
  
  
  
  
    }

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

   // wi(t)
    {
      solve();
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}







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

using ll=long long;

using vi=vector<int>;
using vll=vector<ll>;
using vvi=vector<vi>;

int main() {
  ll X,Y; cin >>X >>Y;
  cout <<(X%Y!=0 ? X:-1) <<endl;
  return 0;
}


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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;

int main() {
    lli n;
    cin1(n);
    REP_R(i,(lli)sqrt((double)n), 0) {
        if (n % i == 0) {
            lli x = n/i;
            cout << to_string(x).length() << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
from fractions import gcd
 
def gcdL(L):
    g=L[0]
    for i in range(1,len(L)):
        if g==1:
            return(g)
        g=gcd(g,L[i])
    return g
def play(A,i):
    A[i]-=1
    g=gcdL(A)
    return [x//g for x in A]
def cnt(A):
    odd,even=0,0
    for a in A:
        if a%2:
            odd+=1
        else:
            even+=1
    return odd,even    

n=int(input())
A=list(map(int,input().split()))
First=1
while True:
    odd,even=cnt(A)
    if even%2:
        print('First' if First else 'Second')
        break
    elif odd>1:
        print('Second' if First else 'First')
        break
    else:
        for i in range(n):
            if A[i]%2:
                break
        if A[i]==1:
            print('Second' if First else 'First')
            break
        else:
            A=play(A,i)
            First^=1

Measured memory_bytes: 16308
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int n;
long long a[100005],sum,ans;
int main()
{
	scanf("%d",&n);for(int i=1;i<=n;++i) scanf("%lld",&a[i]);
	for(int i=1;i<=n;++i) if(a[i]<=0) ++sum;
	if(sum%2==0) {
		for(int i=1;i<=n;++i) ans+=abs(a[i]);
	}
	else {
		long long minn=1000000000;
		for(int i=1;i<=n;++i) minn=min(minn,abs(a[i]));
		for(int i=1;i<=n;++i) ans+=abs(a[i]);
		ans-=minn*2;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

ll d,g;
vector<ll> p(12),c(12),sum(12);

ll dfs(ll dep,ll cnt,ll score){
  if(dep==0){
    if(score<g){
      //cout<<' '<<dep<<' '<<cnt<<' '<<score<<'\n';
      return mod;
    }
    //cout<<dep<<' '<<cnt<<' '<<score<<'\n';
    return cnt;
  }
  if(score>=g){
    //cout<<"  "<<dep<<' '<<cnt<<' '<<score<<'\n';
    return cnt;
  }
  ll ret1=dfs(dep-1,cnt,score);//d*100点の問題を解かない
  ll x=(g-score)/(100*dep);
  ll ret2,ret3;
  if(x>=p[dep]){
    ret2=dfs(dep-1,cnt+p[dep],score+sum[dep]);
  }else{
    ret2=dfs(dep-1,cnt+x,score+100*dep*x);
  }
  if(x+1<=p[dep]){
    ret3=dfs(dep-1,cnt+x+1,score+100*dep*(x+1));
  }
  return min(min(ret1,ret2),ret3);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>d>>g;
    FOR(i,1,d+1){
      cin>>p[i]>>c[i];
      sum[i]=100*i*p[i]+c[i];
    }
    ll ans=dfs(d,0,0);
    cout<<ans<<endl;
}

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

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		int[] heap = new int[n];
		for(int i = 0; i < n; i++){
			heap[i] = sc.nextInt();
		}
		
		for(int i = 0; i < n; i++){
			final int index = i + 1;
			System.out.print("node " + index + ": ");
			System.out.print("key = " + heap[i] + ", ");
			
			if(i != 0){
				System.out.print("parent key = " + heap[(i - 1) / 2]);
				System.out.print(", ");
			}
			
			if(i * 2 + 1 < n){
				System.out.print("left key = "  + heap[i * 2 + 1]);
				System.out.print(", ");
			}
			
			if(i * 2 + 2 < n){
				System.out.print("right key = " + heap[i * 2 + 2]);
				System.out.print(", ");
			}
			
			System.out.println();
		}
		
	}

	public static class Scanner {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public void close() throws IOException {
			br.close();
		}
	}

}

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

int main() {
    int N;
    while (cin >> N, N) {
        vector<int> v(N);
        for (auto& i : v) cin >> i;

        int x;
        cin >> x;
        int l = 0, r = N - 1;

        int count = 0;
        while (true) {
            int m = (r + l) / 2;
            count++;
            if (v[m] == x) break;

            if (v[m] < x) {
                l = m + 1;
            } else {
                r = m - 1;
            }

            if (l > r) break;
        }

        cout << count << endl;
    }

    return 0;
}

Measured memory_bytes: 2984
#include<stdio.h>
#include<string.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
static inline void PUT(char c)
{
  static char buf[1<<15],*ptr=buf;
  if(ptr==buf+strlen(buf)||c==0){fwrite(buf,1,ptr-buf,stdout),ptr=buf;}*ptr++=c;
}
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline void OUT(long a)
{
  if(a<0)PUT('-'),a=-a;
  int d[40],i=0;do{d[i++]=a%10;}while(a/=10);
  while(i--){PUT(d[i]+48);}PUT('\n');
}
int main()
{
  int i=0,N=IN(),Q=IN(),H=N,W=N,col[N],row[N];long b=1l*(N-2)*(N-2);
  while(i<N){row[i]=col[i++]=N;}
  while(Q--)
  {
    int type=IN(),x=IN()-1;
    if(type==1){if(x<W){i=x;while(i<W-1){col[i++]=H;}W=x+1;}b-=col[x]-2;}
    else{if(x<H){i=x;while(i<H-1){row[i++]=W;}H=x+1;}b-=row[x]-2;}
  }
  return OUT(b),0;
}

Measured memory_bytes: 3056