akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int k, n;
    cin >> k >> n;
    int *a = new int[n + 10];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int max = 0;
    for (int i = 0; i < n; i++) {
        if (i == n - 1) {
            max = (max > k - abs(a[n - 1] - a[0])) ? max
                                                   : k - abs(a[n - 1] - a[0]);
        } else {
            max = (max > a[i + 1] - a[i]) ? max : a[i + 1] - a[i];
        }
    }
    cout << k - max << endl;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1'000'000'000'000'007ll;
const llong mod = 1e9+7;

const ldbl eps = 1e-11;
bool cmp(const lpair &l, const lpair &r) {
	return atan2l(l.first+eps, l.second+eps) > atan2l(r.first+eps, r.second+eps);
}

int main() {
	llong N;
	vector<lpair> engine;

	cin >> N;
	engine.resize(N);
	for (auto &en : engine)
		cin >> en.first >> en.second;
	sort(ALL(engine), cmp);
	llong ax = 0, ay = 0;
	for (int i = 0; i < N; ++i) {
		llong cx = 0, cy = 0;
		for (int j = 0; j < N; ++j) {
			cx += engine[(i+j)%N].first;
			cy += engine[(i+j)%N].second;
			if (ax*ax + ay*ay < cx*cx + cy*cy) {
				ax = cx;
				ay = cy;
			}
		}

	}

	cout << fixed << setprecision(50) << sqrtl(ax*ax + ay*ay) << endl;

	return 0;
}


Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()
qn = [list(map(int, input().split())) for _ in range(Q)]
S = "0" + S
cnt = []
cnt.append(0)
for i in range(1, N+1):
    if (S[i-1:i+1] == "AC"):
        cnt.append(cnt[i-1] + 1)
    else:
        cnt.append(cnt[i-1])
for q in qn:
    ans = cnt[q[1]] - cnt[q[0]-1]
    if S[q[0]-1:q[0]+1] == "AC":
        ans -= 1
    print(ans)

Measured memory_bytes: 29780
//"I'll live the focused life, because it's the best kind there is" - Winifred Gallagher
#include<bits/stdc++.h>
using namespace std;
#define debug(a) cout << #a << ": " << a << endl
using namespace std;
#define ll long long
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> pii;
#define sz(a) int(a.size())
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define fast cin.tie(0); ios::sync_with_stdio(false);
int main(){
	char a, b; cin>>a>>b;
	cout<<(a == b ? "H" : "D")<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String args[]){

		Scanner cin = new Scanner(System.in);

		String a1 = cin.next();
		String a2 = cin.next();

		String result="";

		if(a1.length()>a2.length()){
			result = "GREATER";
		}else if(a1.length()<a2.length()){
			result = "LESS";
		}else if(a1.equals(a2)){
			result = "EQUAL";
		}else{
			for(int i=0;i<a1.length();i++){
				if(a1.charAt(i)!=a2.charAt(i)){
					if(Character.getNumericValue(a1.charAt(i))>Character.getNumericValue(a2.charAt(i))){
						result = "GREATER";
						break;
					}else{
						result = "LESS";
						break;
					}
				}
			}
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 23764
N, K = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
Memo = [0] * (K + 1)

for i in range(1, K+1)[::-1]:
    num = K // i
    a = pow(num, N, mod)
    for j in range(2, K+1):
        if j * i > K:
            break
        a -= Memo[j * i]
    Memo[i] = a % mod
    ans += a * i
    ans %= mod

print(ans % mod)

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

int main(){
  int N,N1,N2,N3;
  cin >> N;
  N3=N%10;
  N/=10;
  N2=N%10;
  N/=10;
  N1=N%10;
  if(N1==N3){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int main() {

    int N; cin >> N;
    vector<int> A(N+1, 0);
    vector<int> B(N+1, 0);

    for (uint i = 1; i < A.size(); i++) {
        cin >> A[i];
        B[A[i]] = i;
    }
    for (uint i = 1; i < A.size(); i++) {
        if (i == 1) cout << B[i];
        else cout << ' '  << B[i];
    }
    cout << endl;
}


Measured memory_bytes: 1664
//Daniel Grzegorzewski
#include <bits/stdc++.h>

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

int a[3], k;

int main() {
  init_ios();
  cin >> a[0] >> a[1] >> a[2] >> k;
  sort(a, a+3);
  while (k--)
    a[2] *= 2;
  cout<<a[0]+a[1]+a[2]<<"\n";
}

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

void Main()
{
    int n, m;
    cin >> n >> m;
    vector<int> f(n);
    for (int i = 0; i < n; i++)
    {
        f[i] = i;
    }
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        a--; b--;
        int ra = f[a];
        while(f[ra] != ra) ra = f[ra];
        int rb = f[b];
        while(f[rb] != rb) rb = f[rb];
        if(ra > rb) swap(ra, rb);
        f[rb] = ra;
        f[a] = ra;
        f[b] = ra;
    }

    vector<int> member(n);
    for (int i = 0; i < n; i++)
    {
        int r = f[i];
        while(f[r] != r) {
            r = f[r];
            f[i] = r;
        }
        member[r]++;
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        ans = max(ans, member[i]);
    }
    
    cout << ans << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 4732
#include<cstdio>
#include<cstring>
#define MOD (1000000000+7)

char prime[10000];
int fact[10000];

int main(void) {
    memset(prime, 1, sizeof(prime));
    prime[0] = prime[1] = 0;
    for(int i=2; i<8000; i++)
        if(prime[i])
            for(int j=2; i*j<8000; j++)
                prime[i*j] = 0;

    int n;
    scanf("%d", &n);
    for(int k=2; k<=n; k++) {
        for(int l=2; l<=k; l++) {
            if(prime[l])
                for(int t=k; t%l==0; fact[l]++, t/=l);
        }
    }

    long long int res=1LL;
    for(int i=0; i<=n; i++) {
        if(prime[i])
            res*=(fact[i]+1)%MOD;
        res%=MOD;
    }
    printf("%lld\n", res%MOD);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
using namespace std;
int input(){
  int x;
  cin>>x;
  return x;
}
int abs(int x){
  if(x>=0){
    return x;
  }else{
    return -x;
  }
}
int gcd(int x, int y){
	if(x<y){
    return gcd(y,x);
  }
  if(y==0){
    return x;
  }
  return gcd(y,x%y);
}
int moji(char i){
  if(i=='a'){
    return 1;
  }
  if(i=='b'){
    return 2;
  }
  if(i=='c'){
    return 3;
  }
  if(i=='d'){
    return 4;
  }
  if(i=='e'){
    return 5;
  }
  if(i=='f'){
    return 6;
  }
  if(i=='g'){
    return 7;
  }
  if(i=='h'){
    return 8;
  }
  if(i=='i'){
    return 9;
  }
  if(i=='j'){
    return 10;
  }
  if(i=='k'){
    return 11;
  }
  if(i=='l'){
    return 12;
  }
  if(i=='m'){
    return 13;
  }
  if(i=='n'){
    return 14;
  }
  if(i=='o'){
    return 15;
  }
  if(i=='p'){
    return 16;
  }
  if(i=='q'){
    return 17;
  }
  if(i=='r'){
    return 18;
  }
  if(i=='s'){
    return 19;
  }
  if(i=='t'){
    return 20;
  }
  if(i=='u'){
    return 21;
  }
  if(i=='v'){
    return 22;
  }
  if(i=='w'){
    return 23;
  }
  if(i=='x'){
    return 24;
  }
  if(i=='y'){
    return 25;
  }
  if(i=='z'){
    return 26;
  }
  return 100;
  
}




int main() {
  int N=input();
  int max=0;
  int A[N];
  for(int i=0;i<N;i++){
    A[i]=0;
  }
  for(int i=0;i<N;i++){
    int x;
    cin>>x;
    while(x%2==0){
      x/=2;
      A[i]++;
      

    }

  }
  sort(A,A+N);
  cout<<A[0]<<endl;

  


  

  




  
  
}

  

  

Measured memory_bytes: 256
let split str delim =
  let rec doit s acc =
    match
      try Some (String.rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s1 (s2 :: acc)
  in
  doit str []

let () =
  let open Hashtbl in
  let n = read_int () in
  let tbl = create n in
  let rec doit i =
    if i < n then begin
      match split (read_line ()) ' ' with
      | ["insert"; x] -> (add tbl x true; doit (i + 1))
      | ["find"; x] -> (print_endline (if mem tbl x then "yes" else "no"); doit (i + 1))
      | _ -> exit 1
    end
  in
  doit 0

Measured memory_bytes: 43748
#include <bits/stdc++.h>
using namespace std;
map<long long, long long> divide(long long n){//素因数分解
    map<long long , long long> res;
    for(long long i = 2; i * i <= n; i++){
        while(n % i == 0){
            res[i]++;
            n /= i;
        }
    }
    if(n != 1) res[n] = 1;
    return res;
}
int main(){
    long long N;
    cin >> N;
    map<long long, long long> m;
    m = divide(N);
    long long ans = 0;
    for(auto u: m){
        int i = 1;
        while(u.second >= i){
            ans += 1;
            u.second -= i;
            i++;
        }
    }
    cout<< ans << endl;
}


Measured memory_bytes: 3608
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, X0 = list(map(int, sys.stdin.buffer.readline().split()))
X = list(map(int, sys.stdin.buffer.readline().split()))
X = np.array(X, dtype=int) - X0
X = np.abs(X)

ans = reduce(gcd, X)
print(ans)


Measured memory_bytes: 22532
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    int a,b,m,go;
    cin>>a>>b>>m;
    vector<int> mia(a),mib(b),x(m),y(m),c(m),gokei_kupon(m);
    for(int i=0;i<a;i++){
        cin>>mia[i];
    }
    for(int i=0;i<b;i++){
        cin>>mib[i];
    }
    for(int i=0;i<m;i++){
        cin>>x[i]>>y[i]>>c[i];
        //cout<<x[i]<<y[i]<<c[i]<<endl;
        gokei_kupon[i]=mia[x[i]-1]+mib[y[i]-1]-c[i];
        //cout<<gokei_kupon[i]<<endl;
    }
    sort(mia.begin(),mia.end());
    sort(mib.begin(),mib.end());
    sort(gokei_kupon.begin(),gokei_kupon.end());
    go=mia[0]+mib[0];

    //cout<<"GO="<<go<<" GOKEI="<<gokei_kupon[0]<<endl;

    cout<<min(go,gokei_kupon[0])<<endl;
}

Measured memory_bytes: 2560
# ABC072 D Derangement

n = int(input())
p_list = [int(x) for x in input().split()]

ans = 0
_tmp = False
for i in range(n):
    if i+1 == p_list[i]:
        if _tmp:
            _tmp = False
        else:
            ans += 1
            _tmp = True
    else:
        _tmp = False

print(ans)

Measured memory_bytes: 13880
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++);
int main(){
    char c; cin >> c;
    if(c=='a' || c=='i' || c=='u' || c=='e' || c=='o') cout << "vowel";
    else cout << "consonant";
}

Measured memory_bytes: 256
package main

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

func main() {
	sc := NewScanner()
	N := sc.NextInt()

	P := make([]int, N)
	mx := 0
	S := 0
	for i := 0; i < N; i++ {
		P[i] = sc.NextInt()
		if mx < P[i] {
			mx = P[i]
		}
		S += P[i]
	}
	fmt.Println(S - mx/2)
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
import sys
input = sys.stdin.readline

n = int(input())
mod = pow(10, 9)+7
ct = [1]*(n+1)
for i in range(1, n+1):
  ct[i] = ct[i-1]*i%mod

def comb(n, k):
  res = ct[n]*pow(ct[n-k], mod-2, mod)%mod*pow(ct[k], mod-2, mod)%mod
  return res

def main():
  a = [int(x) for x in input().split()]

  already = [-1]*n
  for i in range(n+1):
    if already[a[i]-1] != -1:
      f, s = already[a[i]-1], n-i
      break
    already[a[i]-1] = i
    
  ans = [0]*(n+1)
  c = 1
  for i in range(n+1):
    c = c*(n+1-i)%mod*pow(i+1, mod-2, mod)%mod
    ans[i] += c%mod

  for i in range(n):
    if s+f >= i:
      ans[i] += mod-(comb(f+s, i))%mod
    ans[i] %= mod
  for a in ans:
    print(a)

if __name__ == "__main__":
  main()

Measured memory_bytes: 25124
#include<bits/stdc++.h>
using namespace std;
int main(){
  long N;cin>>N;
  vector<vector<long>>A(N);
  for(long i=0;i<N-1;i++){
    long a,b;cin>>a>>b;
    A[a-1].push_back(b-1);
    A[b-1].push_back(a-1);
  }
  vector<long>C(N),D(N,-1);
  for(long i=0;i<N;i++)cin>>C[i];
  sort(C.begin(),C.end(),greater<long>());
  
  queue<long>q;q.push(0);//D[0]=C[0];
  long l=0;
  while(q.size()){
    long f=q.front();q.pop();
    D[f]=C[l];l++;
    for(long n:A[f]){
      if(D[n]==-1)q.push(n);
    }
  }
  
  long s=0;for(long i=1;i<N;i++)s+=C[i];
  cout<<s<<endl;
  for(long i=0;i<N;i++)cout<<D[i]<<" ";
}

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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n,m;
    cin >> n >> m;
    vector<vector<int>> dp(m+1,vector<int>(1<<n,INT_MAX));
    dp[0][0] = 0;
    for (int i = 0;i < m;++i) {
        int a,b,c;
        cin >> a >> b;
        int s = 0;
        for (int j = 0;j < b;++j) {
            cin >> c;
            s += (1<<(c-1));
        }
        dp[i+1] = dp[i];
        for (int j = 0;j < (1<<n);++j) if (dp[i][j] < INT_MAX) dp[i+1][j|s] = min(dp[i+1][j|s],dp[i][j]+a); 
    }
    if (dp[m].back() < INT_MAX) cout << dp[m].back() << endl;
    else cout << -1 << endl;
    // for (int i = 0;i < m+1;++i) p_ary(dp[i],0,1<<n);
    return 0;
}

Measured memory_bytes: 16256
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a_sp = [c[a[i] - 1] for i in range(n - 1) if a[i + 1] - a[i] == 1]
print(sum(b + a_sp))

Measured memory_bytes: 9180
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <bitset>
#include <utility>
#include <sstream>
#include <fstream>
#include <stack>
#include <cstdlib>
#include <complex>
#include <set>

using namespace std;

#define INF 1070000000LL
#define pb push_back
#define irep(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) irep(i,0,n)

typedef long long lint;
typedef pair<int, int> pint;
struct Edge{
    int to,weight;
};
typedef vector<vector<Edge> > Graph;


int main(){
    string s;
    cin >> s;
    string a,b;
    rep(i,s.length()){
	if(i%2 == 0){
	    a += '0';
	    b += '1';
	}
	else{
	    a += '1';
	    b += '0';
	}
    }
    int count_a=0,count_b=0;
    rep(i,s.length()){
	if(s[i] != a[i])++count_a;
	else ++count_b;
    }
    cout << min(count_a, count_b) << endl;
}

Measured memory_bytes: 832
#include<iostream>

using namespace std;
typedef long long int lld;
lld gain[60][2];
lld DP[60][2];
lld pow[60];
lld k;
lld compute(int bit,int flag){
	if(bit==-1)return 0;
	if(DP[bit][flag]!=-1)return DP[bit][flag];
	if(flag){
		int BIT=((k&pow[bit])!=0);
		if(BIT==0){
			DP[bit][flag]=gain[bit][0]+compute(bit-1,flag);
			return DP[bit][flag];
		}
		DP[bit][flag]=max(gain[bit][1]+compute(bit-1,flag),gain[bit][0]+compute(bit-1,0));
		return DP[bit][flag];
	}
	DP[bit][flag]=max(gain[bit][1]+compute(bit-1,0),gain[bit][0]+compute(bit-1,0));
	return DP[bit][flag];
}
int main(){
	int n;
	cin>>n;
	cin>>k;
	lld arr[n];
	pow[0]=1;
	for(int i=1;i<60;i++)pow[i]=2*pow[i-1];
	lld zeros[60];
	for(int i=0;i<60;i++)zeros[i]=0;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		for(int j=0;j<60;j++){
			//cout<<((arr[i]&pow[j])!=0);
			zeros[j]+=((arr[i]&pow[j])!=0);
		}//cout<<endl;
	}
	//for(int i=0;i<60;i++)cout<<zeros[i]<<endl;
	
	for(int i=0;i<60;i++){
		gain[i][0]=zeros[i]*pow[i];
		gain[i][1]=(n-zeros[i])*pow[i];
	}
	for(int i=0;i<60;i++)DP[i][0]=-1,DP[i][1]=-1;
	cout<<compute(59,1)<<endl;
	return 0;
}

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


class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String name;
		int num;
		int compare;
		String waku="";

		int[] a=new int[2];
		int i=0;
		while(true){

			try{
				name=br.readLine();
				StringTokenizer st=new StringTokenizer(name," ");
				while (st.hasMoreTokens()) {
					a[i]=Integer.parseInt(st.nextToken());
					i++;
				}i=0;

				if(a[0]==0 && a[1]==0){
					System.exit(0);
				}

				else{
					for(int k=0; k<a[1]; k++){
						waku=waku+"#";
					}


					for(int j=0; j<a[0]; j++){
						System.out.println(waku);
					}
					System.out.println("");
					waku="";
				}
			}

			catch(Exception e){
				System.exit(0);
			}
		}
	}
}

Measured memory_bytes: 25756
import itertools
import math
import fractions
import functools
import copy
s = int(input())
a = set()
index = 0
a.add(s)
for i in range(1,1000000):
    if s % 2 == 0:
        s = s / 2
    else:
        s = 3*s + 1
    if s in a:
        index = i
        break
    a.add(s)
    
print(index+1)

Measured memory_bytes: 63980
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

ll a[500005],s=0,s1[2][500005];

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
rep(i,0,n-1)cin>>a[i],s+=a[i];

s1[0][0]=a[0];

rep(i,1,n-1)
{
	if(i%2==0)
	{
		s1[0][i]=a[i];
	}
	else
	{
		s1[1][i]=a[i];
	}
	s1[0][i]+=s1[0][i-1];
	s1[1][i]+=s1[1][i-1];
}

rep(i,0,n-1)
{
	ll k1=0;
	if(i<n-1)k1=s1[1-i%2][n-1]-s1[1-i%2][i];
	if(i>=2)k1+=s1[i%2][i-2];
	ol(s-2*k1);os;
}

return 0;
}



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

int main() {
	ll N,K,r=0,mn=0,mx=0;
	cin >> N >> K;

	rep(i,K) {
		mn += i;
		mx += N-i;
	}

	rep(i,N-K+2) {
		r += mx-mn+1;
		r %= MOD;

		mx += N-K-i;
		mn += K+i;
	}

	cout << r << endl;
}

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

int main(){
  ll N;
  cin>>N;
  bool plus=true;
  if(N<0){
    N=-N;
    plus=false;
  }

  if(N==0){
    cout<<0;
  }

  vector<ll> a(100,0);
  int k=0;
  while(1){
    a.at(k)+=N%2;
    if(plus&&k%2==1&&N%2==1){
      a.at(k+1)++;
    }
    if(!plus&&k%2==0&&N%2==1){
      a.at(k+1)++;
    }
    a.at(k+1)+=a.at(k)/2;
    a.at(k+2)+=a.at(k)/2;
    a.at(k)=a.at(k)%2;
    //cout<<a.at(k)<<" ";
    N/=2;
    k++;
    if(k==80){
      break;
    }
    //cout<<k<<endl;
  }
  /*
  cout<<endl;
  for(int i=0;i<80;i++){
    cout<<a.at(i)<<" ";
  }
  cout<<endl;
  */

  bool flag=false;
  for(int i=80;i>=0;i--){
    if(a.at(i)==1){
      flag=true;
    }
    if(flag){
      cout<<a.at(i);
    }
  }
  cout<<endl;
}


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

#define int long long
#define endl "\n"
#define Endl "\n"
#define in(n) int n;cin>>n;
#define take(v,n) vector<int> v(n);for(int i=0;i<n;i++)cin>>v[i];
#define print(v,n) for(int i=0;i<n;i++)cout<<v[i]<<" ";cout<<endl;
#define all(v) v.begin(), v.end()


void fastio()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

void solve()
{
	int n, x, t;
	cin >> n >> x >> t;
	if (n % x == 0)cout << (t * (n / x)) << endl;
	else
		cout << (t * (n / x + 1)) << endl;
}

int32_t main()
{
	//fastio();
	// int t;cin>>t;
	// while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 3616
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>

using namespace std;
int main() {
    int n;
    cin>>n;
    vector<int>p(n);
    for(int i = 0;i < n;i++)cin>>p[i];
    int ans =0;

    for(int i = 0;i < n-2;i++){
        if(p[i] < p[i+1] && p[i+1] < p[i+2]) ans++;
        else if(p[i] > p[i+1] && p[i+1] > p[i+2]) ans++;
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int n, m, k;
int a[99], b[99], c[99];
void push (int x, int y, int z) {
	a[m] = x;
	b[m] = y;
	c[m] = z;
	m++;
}

int main () {
	int i;
	scanf("%d", &k);
	while ((1 << n) <= k) n++;
	for (i = n - 1; i > 0; i--) {
		push(i, i - 1, 0);
		push(i, i - 1, 1 << (i - 1));
	}
	for (i = n - 2; i >= 0; i--) {
		if ((1 << i) & k) {
			push(n - 1, i, (k >> (i + 1)) << (i + 1));
		}
	}
	printf("%d %d\n", n, m);
	for (i = 0; i < m; i++) {
		printf("%d %d %d\n", n - a[i], n - b[i], c[i]);
	}
	return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main { // Main
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String string = scanner.nextLine();
		int nOperations = string.length() - 1;
		for(char c = 'a'; c <= 'z'; c ++) {
			int max = 0;
			int n = 0;
			for(int i = 0; i < string.length(); i ++) {
				if(string.charAt(i) == c) {
					n = 0;
				} else {
					n ++;
					max = Math.max(max, n);
				}
			}
			nOperations = Math.min(nOperations, max);
		}
		System.out.println(nOperations);
		
		scanner.close();
	}
		
}

Measured memory_bytes: 21844
def count_bit(target):
    result, tmp = 0, target
    while tmp > 0:
        result += tmp & 1
        tmp = tmp >> 1
    return result


N = int(input())
mask_list = []
a_list = []
for i in range(N):
    A = int(input())
    mask, a = 0, 0
    for j in range(A):
        x, y = map(lambda z: int(z), input().split())
        mask += (1 << (x - 1))
        a += (y << (x - 1))
    mask_list.append(mask)
    a_list.append(a)
count = 0
for i in range(1, 2 ** N):
    is_ok = True
    for j, (m, a) in enumerate(zip(mask_list, a_list)):
        if i & (1 << j) == 0:
            continue
        if (i & m) ^ a > 0:
            is_ok = False
            break
    if is_ok:
        bit_count = count_bit(i)
        if count < bit_count:
            count = bit_count
print(count)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <limits>
using namespace std;
typedef long long ll;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define FOREACH(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
 
template<class T> struct BellmanFord {
  struct Edge {
    int from,to;
    T cost;
    Edge (int f, int t, T c) : from(f), to(t), cost(c) {}
  };
  const T INF = numeric_limits<T>::max() / 2;
  vector< vector<T> > d;
  vector<Edge> edge;
  BellmanFord (int n) : d(2,vector<T>(n)) {}
  void add_directed_edge(int from, int to, T cost) {
    edge.push_back(Edge(from,to,cost));
  }
  void add_undirected_edge(int a, int b, T cost) {
    edge.push_back(Edge(a,b,cost));
    edge.push_back(Edge(b,a,cost));
  }
  void init(int s) {
    for (int i=0; i<d[0].size(); i++) d[0][i] = INF;
    d[0][s] = 0;
    for (int k=0; k<2; k++) {
      for (int j=0; j<d[0].size(); j++) {
        for (int i=0; i<edge.size(); i++) {
          Edge e = edge[i];
          if (d[k][e.from] != INF && d[k][e.to] > d[k][e.from] + e.cost) {
            d[k][e.to] = d[k][e.from] + e.cost;
          }
        }
      }
      if (k == 0) d[1] = d[0];
    }
  }
  bool find_negative_loop(int v) { 
    return d[0][v] != d[1][v]; 
  }
  T dist(int v) { 
    return d[0][v]; 
  }
};

BellmanFord<ll> inst(1010);

int main() {

  int N,M; cin >> N >> M;
  REP(i,M) {
    int a,b;
    ll c;
    cin >> a >> b >> c;
    inst.add_directed_edge(a,b,-1*c);
  }

  inst.init(1);
  if(inst.find_negative_loop(N)) cout << "inf" << endl;
  else cout << -inst.dist(N) << endl;

  return 0;
}

Measured memory_bytes: 384
#!/usr/bin/env python

from collections import deque
import itertools as ite
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

A, B = map(int, raw_input().split())

if A >= 13:
    print B
elif 6 <= A <= 12:
    print B / 2
else:
    print 0

Measured memory_bytes: 2812
#![allow(unused_imports)]

use std::cmp::{max, min, Ordering};
use std::collections::*;
#[cfg(debug_assertions)]
include! {"./debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

macro_rules! read {
    ([$t:ident] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ([$t:ident]) =>
        (rl().split_whitespace().map(|w| read_type!(w, $t)).collect::<Vec<_>>());
    (_, [$t:ident] ; $n:expr) =>
        ((0..$n).map(|_| read!(_, [$t])).collect::<Vec<_>>());
    (_, [$t:ident]) =>
        (rl().split_whitespace().skip(1).map(|w| read_type!(w, $t)).collect::<Vec<_>>());
    ($($t:ident),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ($t:ident) => (read_type!(rl(), $t));
    ($($t:ident),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(read_type!(w.next().unwrap(), $t)),*)
    }};
}

macro_rules! read_type {
    ($s:expr, chars) => {
        $s.chars().collect::<Vec<char>>()
    };
    ($s:expr, usize1) => {
        read_type!($s, usize) - 1
    };
    ($s:expr, $t:ty) => {
        $s.parse::<$t>().unwrap()
    };
}

fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

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

fn main() {
    let n = read!(usize);
    let w = read!([i32]);

    let ans: i32 = (1..n)
        .map(|i| {
            let a: i32 = w[..i].iter().sum();
            let b: i32 = w[i..].iter().sum();
            let c: i32 = a - b;
            c.abs()
        })
        .min()
        .unwrap();

    println!("{:?}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define mkp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
int main()
{
	ll ci;
	cin>>ci;
	ll k = 100;
	ll cnt = 0;
	while(k<ci)
	{
		k+=k/100;
		cnt++;	
	}
	cout<<cnt<<endl;
	return 0; 
}

Measured memory_bytes: 3636
//By Akshay Koshy

#include <iostream>

using namespace std;

int main()
{
    char a[2][3];
    int i,j;
    for(i=0;i<2;i++)
    {
        for(j=0;j<3;j++)
        cin>>a[i][j];
        
    }
    if(a[0][0]==a[1][2] && a[0][1]==a[1][1] && a[0][2]==a[1][0])
     cout<<"YES";
     else
     cout<<"NO";
     
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });

            int a;int b;int c;
            Multi(out a, out b, out c);
            var ans = YesNo(a + b == c || a + c == b || a == b + c);

            Console.WriteLine(ans);


            Console.Out.Flush();
            Console.ReadKey();
        }


        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public char GetChar() { return Console.ReadLine().Trim()[0]; }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public char[] GetCharArray() { return Console.ReadLine().Split(' ').Select(char.Parse).ToArray(); }
        static public Double[] GetDoubleArray() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
        static void Multi<T, U, V,W>(out T a, out U b, out V c, out W d)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]);
        }
        static void Multi<T, U, V, W,X>(out T a, out U b, out V c, out W d,out X e)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]);e = cv<X>(ar[4]);
        }
    }
}

Measured memory_bytes: 11476
//not answered
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#include <algorithm>

int main() {
  int n;
  cin >> n;
  
  vector<int> h(n);
  for(int i = 0; i < n; i++)
    cin >> h[i];
  
  int mizu_count = h[0];
  for(int i = 1; i < n; i++){
    if(h[i] > h[i-1])
      mizu_count += h[i] - h[i-1];
  }
  
  cout << mizu_count << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		int N=sc.nextInt();
		
		Map<Integer, Integer> map = new HashMap<>(N);
		
		for(int i=0;i<N;i++) {
			int a=sc.nextInt();
			int b=sc.nextInt();
			if(map.containsKey(b)) {
				map.replace(b, map.get(b)+a);
			}
			else map.put(b, a);
		}
		Object[] mapkey = map.keySet().toArray();
        Arrays.sort(mapkey);
        int sum=0;
        boolean x=true;
        for(Object a:mapkey) {
        	int s=map.get(a);
        	sum+=s;
        	int t=Integer.parseInt(a.toString());
        	if(t<sum) {
        		p("No");
        		x=false;
        		break;
        	}
        	
        }if(x)p("Yes");
        
	}
	

	
	
	
	

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 137460
#include<iostream>
#include<cstdio>
#include<cmath>
#include<stack>
#include<queue>
#include<algorithm>

#define MAX 100000

using namespace std;

int n,A[MAX+1],L[MAX];

int lis(){
	L[0]=A[0];
	int length=1;
	for(int i=1;i<n;i++){
		if(L[length-1]<A[i]){
			L[length++]=A[i];
		}else{
			*lower_bound(L,L+length,A[i])=A[i];
		}
	}
	return length;
}

int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&A[i]);
	printf("%d\n",lis());
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
vector<ll> divisor(ll n){
  vector<ll> res;
  for(ll i=1; i*i<=n ; i++){
    while(n%i==0){
      ++res[i];
      n /= i;
    }
  }
  if(n!=1) res[n]=1;
  return res;
}
int main(){
  int N,K;  cin>>N>>K;
  vector<ll> v(N);
  rep(i,0,N) cin>>v[i];
  rep(i,K,N){
    if(v[i-K]<v[i]){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4844
mod = 10**9+7
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
dp = [0]*(1 << n)
dp[0] = 1
for i in range(1, 1 << n):
    k = bin(i).count("1")
    for j in range(n):
        if i >> j & 1 and a[k-1][j]:
            dp[i] += dp[i ^ (1 << j)]
    dp[i] %= mod
print(dp[(1 << n)-1])


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

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> height(n);
    for (int i = 0; i < n; i++) {
        cin >> height[i];
    }

    vector<int> desk(n, 1);
    for (int j = 0; j < m; j++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        // cout << "(a, b): " << a << ", " << b << endl;
        if (height[a] > height[b]) {
            desk[b] = 0;
        } else if (height[a] < height[b]) {
            desk[a] = 0;
        } else {
            desk[a] = 0;
            desk[b] = 0;
        }
        // for(auto e: desk) {
        //     cout << e << ", ";
        // }
    }
    int ans = accumulate(desk.begin(), desk.end(), 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4052
a,b,c,x,y = map(int,input().split())
if x>y:
  a,b,x,y = b,a,y,x
res = a*x +b*y
for i in range(x):
  p_res = res
  res += 2*c-(a+b)
  if p_res<res:
    res = p_res
    break
for i in range(y-x):
  p_res = res
  res += 2*c-b
  if p_res < res:
    res = p_res
    break
print(res)

Measured memory_bytes: 3064
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N, M = MAP()
    A = [INT() for i in range(M)]

    dp = [1] * (N + 1)
    for a in A:
        dp[a] = 0

    for i in range(N-1):
        dp[i+2] = dp[i+2] * (dp[i] + dp[i+1]) % mod
     
    print(dp[N])


if __name__ == '__main__':
    main()

Measured memory_bytes: 44892
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ll long long
#define ull unsigned long long
#define ii pair<ll, ll>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls signed
#define give main()
const int mod = 1000000007;
#pragma endregion

const int N = 105;

int n, m, arr[N], tot, ans;
double val;

pls give {
    AC; 
    cin >> n >> m;
    for (int i=0; i<n; i++) {
        cin >> arr[i];
        tot += arr[i];
    }
    val = tot * (1.0/(4*m));
    for (int i=0; i<n; i++) {
        if (arr[i] >= val) ans++;
    }
    cout << (ans >= m ? "Yes" : "No") << nl;
}
    

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;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] arr = new int[1 << n];
            for (int i = 0; i < 1 << n; i++) {
                arr[i] = in.nextInt();
            }
            for (int i = 0; i < n; i++) {
                int[] nxt = new int[1 << (n - i - 1)];
                for (int j = 0; j < nxt.length; j++) {
                    nxt[j] = Math.abs(arr[2 * j] - arr[2 * j + 1]);
                }
                arr = nxt;
            }
            out.println(arr[0]);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 29608
var
    s:string;
    l,i:longint;
begin
    readln(s);
    l:=length(s);
    for i:=1 to l-2 do
        if (s[i]=s[i+1]) and (s[i+1]=s[i+2]) then
        begin
            writeln('Yes');
            halt;
        end;
    writeln('No');
end.

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};

int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n;
    string s;
    cin>>n>>s;
    if(n%2){
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=0,j=n/2;i<n/2;i++,j++){
        if(s[i]!=s[j]){
              cout<<"No"<<endl;
        return 0;
        }
    }
   cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 3624
//
//  main.cpp
//  ALDS54
//

#include <vector>
#include <iostream>
using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i=0; i<N; i++) {
        cin >> A.at(i);
        if (i>0) {
            cout << " ";
        }
        cout << A.at(i);
    }
    cout << endl;
    
    int TMP;
    for (int j=1; j<N; j++) {
        TMP=A.at(j);
        for (int k=j-1; k>=0; k--) {
            if (A.at(k)>TMP) {
                A.at(k+1)=A.at(k);
                A.at(k)=TMP;
            }
        }
        for (int m=0; m<N; m++) {
            if (m>0) {
                cout << " ";
            }
            cout << A.at(m);
        }
        cout << endl;
    }
    return 0;
    /*
     6
     5 2 4 6 1 3
     
     3
     1 2 3
     */
}



Measured memory_bytes: 3124