akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#include "../include/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("_input.txt");

    string s;
    cin >> s;
    sort(s.begin(), s.end());

    if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;

int main(){
  int n; cin >> n;
  ll a[n];
  rep(i,n) cin >> a[i];

  int ans =0;

  int check = 2;

  for(int i=0;i<n-1;i++){
    if(a[i]==a[i+1]) continue;
    bool pos;
    a[i+1]-a[i]>0 ? pos=true : pos = false;
    if(pos){
      if(check==2){
        check=0;
      }else if(check==1){
        ans++;
        check=2;
      }
    }else{
      if(check==2){
        check=1;
      }else if(check==0){
        ans++;
        check=2;
      }
    }
  }

  cout << ans+1 << endl;
}


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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 

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

    string s, t;
    cin >> s >> t;
int cnt=0;
    rep(i, s.size())
    {
        if(s[i]!=t[i])  cnt++;
    }

    cout << cnt << endl;



    return 0;

}



Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define int long long
#define rng(i, l, r) for (size_t i = (l); i < (r); ++i)
#define rep(i, n) rng(i, 0, n)
#define gnr(i, l, r) for (size_t i = (r)-1; i >= (l); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()    //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend() //...,3,2,1
using namespace std;
const int INF = 1e18;
const int MOD = 1000000007;

void solve()
{

    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    rep(i, m) cin >> x[i];

    sort(ALL(x));
    int maxL = x[m - 1] - x[0];

    vector<int> len;
    rep(i, m - 1) len.push_back(x[i + 1] - x[i]);
    sort(rALL(len));

    if (n >= m)
    {
        cout << 0 << endl;
        return;
    }
    else
    {
        int sum = 0;
        rep(i, n - 1) sum += len[i];
        cout << maxL - sum << endl;
        return;
    }
}

signed main()
{
    solve();
    return 0;
}

Measured memory_bytes: 2168
'use strict'
function main(input) {
  input = input.split('\n')
  const config = input.shift().split(' ')
  input = input.map(row => row.slice(1) + ' ')
  let count = 0
  for (let i = 1; i <= config[1]; i++) {
    let temp = input.filter(row => row.indexOf(' ' + i + ' ') !== -1)
    if (temp.length === Number(config[0])) count++
  }
  console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    ll i,j,n,m,k,cnt=0,ans=0,t=1;
    cin>>n;
    ll a[n],b[n];
    rep(i,0,n) cin>>a[i],b[i]=a[i];
    rep(i,1,n){
        if(a[i]<a[i-1]){
            a[i-1]--;
        }
    }    
    ll fl=0;
    rep(i,1,n){
        if(a[i]<a[i-1]){
            fl=1;
            break;
        }
    }
    if(!fl) ret("Yes")
    fl=0;
    for(i=n-2;i>=0;i--){
        if(b[i]>b[i+1]) b[i]--;
    }
    rep(i,1,n){
        if(b[i]<b[i-1]) ret("No")
    }
    ret("Yes")
    return 0;
}

Measured memory_bytes: 1792
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split.to!(int[]), a = rd[0], b = rd[1];
  writeln(a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0 ? "Possible" : "Impossible");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
  int H, W, X, Y;
  cin >> H >> W >> X >> Y;
  if (H*W%2 == 1 && (X+Y)%2 == 1) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}



Measured memory_bytes: 3088
import copy

n,m = [int(i) for i in input().split()]

common = list(range(1,m+1))
for i in range(n):
  like = [int(i) for i in input().split()][1:]
  for j in common[::-1]:
    if j not in like:
      common.remove(j)
  
print(len(common))
  


Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define mod 1000000007
////////////////////////////////////////////////////////////
#define INF 1LL<<60
typedef long long ll;
int N;
ll x;
int a[2010];
int b[2010];
//-----------------------------------------------------------------
int main() {
	cin >> N >> x;
	rep(i, 0, N) cin >> a[i];
 
	ll ans = INF;
	rep(i, 0, N) b[i] = a[i];
	rep(k, 0, N) {
		ll can = k * x;
		
		rep(i, 0, N) b[i] = min(b[i], a[(i - k + N) % N]);
		rep(i, 0, N) can += b[i];
 
		ans = min(ans, can);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=4999999996000000001;


int main(){
    int n;
    ll k;
    cin>>n>>k;
    vector<P> p(n);
    for(int i=0;i<n;i++){
        cin>>p[i].first>>p[i].second;
    }
    sort(p.begin(), p.end());
    int i=0;
    int ans;
    while(true){
        k-=p[i].second;
        if(k<=0) break;
        i++;
    }
    cout<<p[i].first<<endl;

}

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

namespace Atcoder
{
    class AtCodeeeeeeeeeeeeeeeeeeeer
    {
        static void Main(string[] args)
        {
            int[] s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int N = s[0];
            int M = s[1];
            int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            List<int> ls = new List<int>();
            for (int i = 1; i < a.Length; i++)
            {
                ls.Add(a[i]);
            }//先頭を除いたリスト

            List<int> tmp = new List<int>();
            for (int i = 1; i < N; i++)//一本除く
            {
                int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                for (int j = 1; j < input.Length; j++)
                {
                    tmp.Add(input[j]);
                }//与えられたやつの先頭を除いてリスト化

                //残リストを比較
                for (int j = 0; j < ls.Count(); j++)
                {

                    if (tmp.Contains(ls[j]) == false)
                    {
                        ls.Remove(ls[j]);
                        j--;
                    }
                }
                tmp.Clear();
            }
            Console.WriteLine(ls.Count());
        }
    }
}


Measured memory_bytes: 13396
#include<stdio.h>
int a[300]={0};
int main ()
{  char s[7];
    int ans=0,flag=1;
   for(int i=1;i<=6;i++)
     {
	 scanf("%c",&s[i]);
	     if(a[s[i]]==0) 
	       {ans++;a[s[i]]++;}
	    //if(s[i]>='A'&&s[i]<='Z')
	       //flag=0;
      }
      if(s[3]==s[4]&&s[5]==s[6])
         printf("Yes");
    else   printf("No");
    return 0;
}

Measured memory_bytes: 128
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE BangPatterns          #-}
{-# LANGUAGE CPP                   #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE RecordWildCards       #-}
{-# LANGUAGE TupleSections         #-}
{-# LANGUAGE TypeFamilies          #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    [n, k] <- map read.words <$> getLine :: IO [Int]
    xs <- U.unfoldrN n (B.readInt.B.dropWhile isSpace) <$> B.getLine
    print $ solve n k xs

solve :: Int -> Int -> U.Vector Int -> Int
solve n k xs = go 0 sums 40
  where
    sums :: U.Vector Int
    sums = U.concatMap (U.scanl1' (+) . flip U.drop xs) $ U.generate n id

    go !res !acc i
        | i < 0 = res
        | U.length acc' >= k = go (setBit res i) acc' (i - 1)
        | otherwise = go res acc (i - 1)
      where
        !acc' = U.filter (flip testBit i) acc


Measured memory_bytes: 11644
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    prev='ryouhou'
    cnt=0
    for i in range(n-1):
        if l[i+1]-l[i]>0:
            if prev=='-':
                cnt+=1
                prev='ryouhou'
            else:
                prev='+'
        elif l[i+1]-l[i]<0:
            if prev=='+':
                cnt+=1
                prev='ryouhou'
            else:
                prev='-'
    print(cnt+1)
resolve()

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

int main() {
    double r;
    const double PI=3.141592653589;
    cin >> r;
    cout << r*2*PI << endl;
    return 0;
}

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

int main() {
	long N, sum = 0, prod, M[5] = {0};
	char S[11];
    cin >> N;
	for(int i=0;i<N;i++){
		cin >> S;
		switch(S[0]){
		case 'M':
			M[0]++;
			break;
		case 'A':
			M[1]++;
			break;
		case 'R':
			M[2]++;
			break;
		case 'C':
			M[3]++;
			break;
		case 'H':
			M[4]++;
			break;
		}
	}
	for(int i=0;i<4;i++){
		for(int j=i+1;j<5;j++){
			prod = 1;
			for(int k=0;k<5;k++){
				if(k==i || k==j)continue;
				prod *= M[k];
				
			}
			sum += prod;
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
a = parse.(split(chomp(readline()),""))
b = parse.(split(chomp(readline()),""))
if length(a) >length(b)
  print("GREATER")
elseif length(a) < length(b)
  print("LESS")
else
  flg = 0
  for i in 1:length(a)
    if a[i] > b[i]
      flg = 1
      print("GREATER")
      break
    elseif a[i] < b[i]
      flg=1
      print("LESS")
      break
    end
  end
  if flg == 0
    print("EQUAL")
  end
end


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, char, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

const ll mod = 1000000007;

static const ll INF = 1e15;

int main(void)
{
	int n, w;
	cin >> n >> w;
	vector<P> vs(n);
	rep(i, n) {
		cin >> vs[i].first >> vs[i].second;
	}
	vector<vector<ll>> dp(1, vector<ll>(w + 1, 0));
	rep(i, n) {
		ll v = vs[i].first;
		ll we = vs[i].second;
		rep(j, w + 1) {
			ll p = j - we;
			if (p >= 0) {
				dp[0][j] = max(dp[0][j], dp[0][p] + v);
			}
		}
	}
	ll m = 0;
	rep(j, w + 1) {
		m = max(m, dp[0][j]);
	}
	cout << m << endl;
	return 0;
}




Measured memory_bytes: 3296
#include <iostream>
#include <cstdio>

int main() {
	int a, b;
	
	scanf("%d %d", &a, &b);
	if(a<b) {
		std::cout << "a < b" << std::endl;
	}
	else if (a>b) {
		std::cout << "a > b" << std::endl;
	}
	else {
		std::cout << "a == b" << std::endl;
	}
}

Measured memory_bytes: 1204
fn main() {
    let r = std::io::stdin();
    let mut sc = Scanner::new(r.lock());

    let v = sc.read_line();
    let (s, t) : (&String, &String) = (&v[0], &v[1]);

    let v = sc.read_line();
    let (a, b) : (usize, usize) = (v[0].parse().unwrap(), v[1].parse().unwrap());

    let v = sc.read_line();
    let u: &String = &v[0];

    if u == s {
        println!("{} {}", a - 1, b);
    } else {
        println!("{} {}", a, b - 1);
    }

}
 
fn solve(n: usize, v: Vec<String>) -> bool {
    for i in 0..n {
        let x: usize = v[i].parse().unwrap();
        if x % 2 == 0 { // 偶数
            if x % 3 != 0 && x % 5 != 0 { // 3 でも 5 でも割れない
                return false;
            }
        }
    }

    true
}

pub struct Scanner<R: std::io::Read> (std::io::BufReader<R>);
 
impl<R: std::io::Read> Scanner<R> {
    pub fn new(r: R) -> Scanner<R> {
        Scanner (std::io::BufReader::new(r))
    }
 
    pub fn read_line(&mut self) -> Vec<String> {
        use std::io::BufRead;
        let mut line = String::new();
        self.0
            .read_line(&mut line)
            .unwrap();
 
        line.split_whitespace()
            .map(|b| b.to_string())
            .collect::<Vec<String>>()
    }
}

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

typedef struct {
	int l;
	int r;
}pair_t;

int main(void) {
	int n, q;
	char s[100001] = { 0 };
	pair_t pair[100001] = { 0 };
	int posi[100001] = { 0 };
	int ans = 0;

	scanf("%d %d", &n, &q);
	scanf("%s", s);
	for (int i = 0; i < q; i++) scanf("%d %d", &pair[i].l, &pair[i].r);

	for (int i = 1; i < n ; i++) {
		posi[i] = posi[i - 1];
		if (s[i - 1] == 'A' && s[i] == 'C') posi[i]++;
	}
	for (int i = 0; i < q; i++) {
		ans = posi[pair[i].r - 1];
		ans -= posi[pair[i].l - 1];
		printf("%d\n", ans);
	}
	return 0;
}

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

int main(void){
    int n;
    cin>>n;
    map<int,int> mp;
    rep(i,n){
        int x;
        cin>>x;
        mp[x]++;
    }
    ll sum = 0;
    for(auto itr:mp){
        int num = itr.first;
        int cnt = itr.second;
        if(num < cnt) sum += cnt-num;
        else if (num > cnt) sum += cnt;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define N 2010
#define ll long long
#define For(i,x,y) for(int i=(x);i<=(y);++i)
#define Rof(i,x,y) for(int i=(x);i>=(y);--i)
#define Edge(x) for(int i=head[x];i;i=e[i].nxt)
#define mset(x,y) memset(x,y,sizeof(x))
#define strL strlen
#define p_b push_back
#define mcpy(x,y) memcpy(x,y,sizeof(x))
#define lson l,mid,(o<<1)
#define rson mid+1,r,((o<<1)|1)
#define Ls (t[o].ls)
#define Rs (t[o].rs)
#define mod 1000000007
#define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
using namespace std;
int _2[N],f[N][N],sub[N][N];
void init(int n){_2[0]=1;For(i,1,n) _2[i]=(_2[i-1]+_2[i-1])%mod;}
int main(){
	int n,k,ans=0;
	scanf("%d%d",&n,&k);
	init(n);
	For(i,2,n+1) sub[0][i]=1;
	For(i,1,k-1) Rof(j,n-i+1,2){
		if(j<=n-i+1) (f[i][j]+=sub[i-1][j])%=mod;
		sub[i][j]=(sub[i][j+1]+f[i][j])%mod;
	}
	For(i,2,n-k+2) (ans+=1ll*f[k-1][i])%=mod;
	if(k==1) ans=1;
	if(k!=n) ans=1ll*ans*_2[n-k-1]%mod;
	printf("%d\n",ans); 
}


Measured memory_bytes: 31360
fun main(args: Array<String>) {
    val (N, K) = readLine()!!.split(" ").map{it.toInt()}
    val V = readLine()!!.split(" ").map{it.toLong()}

    val sum = V.sum()
    var res = 0L

    for (numPoll in 0.. Math.min(N, K)) {
        for (lPoll in 0..numPoll) {
            val list = V.take(lPoll) + V.takeLast(numPoll - lPoll)
            val negList = list.filter { it < 0 }.sorted().take(K - numPoll)

            val ans = list.sum() - negList.sum()
            res = Math.max(res, ans)
        }
    }

    println(res)
}


Measured memory_bytes: 40280
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  N = 1e6 + 5;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x;cin>>x;
	cout<<(x>=30?"Yes":"No")<<'\n';
	return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<vector>

typedef long long int ll;

using namespace std;

int main(){
    int N;
    cin >> N;
    ll l[90];
    l[0] = 2;
    l[1] = 1;
    for (int i = 2; i < 90;i++){
        l[i] = l[i - 1] + l[i - 2];
    }
    cout << l[N];
}

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

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    int amax=0;
    int imax;
    rep(i,n){
        cin>>a[i];
        if(a[i]>amax){
            amax=a[i];
            imax=i;
        }
    }
    int pre=0;
    ll ans=0;
    rep(i,imax){
        if(pre>a[i]){
            ans+=pre-a[i];
        }
        else pre=a[i];
    }
    for(int i=imax;i<n;i++){
        ans+=amax-a[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	ll a, b, x; cin >> a >> b >> x;
	if( a == 0 ) {
		cout << b/x + 1 << endl;
	} else {
		cout << b/x - (a-1)/x << endl;
	}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;


class Program
{
    static void Main(string[] args)
    {
        int m = int.Parse(Console.ReadLine());
        for(int i = 0; i < m; i++)
        {
             string train = Console.ReadLine();
            Console.WriteLine(count(train));
        }
    }

    public static int count(string train)
    {
        HashSet<string> hsTable = new HashSet<string>();
        string sbstr1, sbstr2, sbstr3, sbstr4;
        for(int i = 1; i < train.Length ; i++)
        {
            sbstr1 = train.Substring(0, i);
            sbstr2 = train.Substring(i, train.Length - i);
            sbstr3 = reverse(sbstr1);
            sbstr4 = reverse(sbstr2);
            hsTable.Add(sbstr1 + sbstr2);
            hsTable.Add(sbstr1 + sbstr4);
            hsTable.Add(sbstr3 + sbstr2);
            hsTable.Add(sbstr3 + sbstr4);
            hsTable.Add(sbstr2 + sbstr1);
            hsTable.Add(sbstr4 + sbstr1);
            hsTable.Add(sbstr2 + sbstr3);
            hsTable.Add(sbstr4 + sbstr3);

        }
            return hsTable.Count;
    }

    public static string reverse(string orstr)
    {
        char[] chars = orstr.ToCharArray();
        Array.Reverse(chars);
        orstr = new string(chars);
        return orstr;
    }

}

Measured memory_bytes: 9936
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}

int ans[110];
int b[110];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		scanf("%d",b+i);b[i]--;
	}
	for(int i=a-1;i>=0;i--){
		int at=-1;
		int cnt=0;
		int t=0;
		for(int j=0;j<a;j++){
			if(b[j]==-1)continue;
			if(b[j]==cnt){
				at=j;
				t=cnt;
			}
			cnt++;
		}
		if(at==-1){
			printf("-1\n");return 0;
		}
		ans[i]=t;
		b[at]=-1;
	}
	for(int i=0;i<a;i++){
		printf("%d\n",ans[i]+1);
	}
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	
	public static void main (String args[]) {
		
		//input array length/initialize array S of length n
		Scanner scan = new Scanner(System.in);
		int arrayLenS = scan.nextInt();
		int[] arrayS = new int[arrayLenS];
				
		//create first array S
		for(int i = 0; i < arrayLenS; i++) {
			int arrayNumsS = scan.nextInt();
			arrayS[i] = arrayNumsS;
		}
		
		//initialize length of array T -- enter array length q
		int arrayLenT = scan.nextInt();
		int[] arrayT = new int[arrayLenT];
		
		//create second array T
		for(int i = 0; i < arrayLenT; i++) {
			int arrayNumsT = scan.nextInt();
			arrayT[i] = arrayNumsT;
		}	
		
		//call the binary function and add to counter when its true
		int matchCount = 0;
		for(int i = 0; i < arrayLenT; i++) {
			if(binarySearch(arrayS, arrayT[i])) {
				matchCount += 1;
			}
		}
		System.out.println(matchCount);
	}
	
	public static boolean binarySearch(int[] arr, int target){
		int right = arr.length - 1;
		int left = 0;
		
		//loop to set new middle value and check to see if its equal
		while(left <= right) {
			int middle = (right + left)/2;
			if(arr[middle] == target) {
				return true;
			}
			
			// if the middle is > target then iterate to left side of array
			else if(arr[middle] > target){
				right = middle - 1;
			}
			
			//if the middle is  less than target loop to right
			else {
				left = middle + 1;
			}
		}
		return false;
	}
}


Measured memory_bytes: 66908
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int A,B;
  cin>>A>>B;
  rep(i,20000){
    if(i*8/100==A&&i/10==B){
      cout<<i<<endl;
      break;
    }else if(i==19800){
      cout<<-1<<endl;
      break;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool isStable(string in[], string out[], int N){
  for (int i = 0; i < N; i++) {
    for (int j = i+1; j < N; j++) {
      for (int a = 0; a < N; a++) {
        for (int b = a+1; b < N; b++) {
          if(in[i][1] == in[j][1] && in[i] == out[b] && in[j] == out[a]) {
            return false;
          }
        }
      }
    }
  }

  return true;
}

void bubbleSort(int N, string* A) {
  int flag = 1;
  while (flag) {
    flag = 0;
    for (int j = N-1; j > 0; j--) {
      if(A[j][1] < A[j-1][1]) {
        swap(A[j], A[j-1]);
        flag = 1;
      }
    }
  }
}

void selectionSort(int N, string* A) {
  for (int i = 0; i < N; i++) {
    int minj = i;
    for (int j = i; j < N; j++) {
      if (A[j][1] < A[minj][1]){
        minj = j;
      }
    }
    if (i != minj) {
      swap(A[i], A[minj]);
    }
  } 
}

int main() {
  int N;
  string A[36];

  cin >> N;
  for (int i = 0; i < N; i++)  cin >> A[i];

  string bubbleSortA[N];
  for (int i = 0; i < N; i++) bubbleSortA[i] = A[i];

  bubbleSort(N, bubbleSortA);

  cout << bubbleSortA[0];
  for (int i = 1; i < N; i++) cout << " " << bubbleSortA[i];
  cout << endl;

  if (isStable(A, bubbleSortA, N)) {
    cout << "Stable";
  } else {
    cout << "Not stable";
  }
  cout << endl;

  string selectionSortA[N];
  for (int i = 0; i < N; i++) selectionSortA[i] = A[i];

  selectionSort(N, selectionSortA);

  cout << selectionSortA[0];
  for (int i = 1; i< N; i++) cout << " " << selectionSortA[i];
  cout << endl;

  if (isStable(A, selectionSortA, N)) {
    cout << "Stable";
  } else {
    cout << "Not stable";
  }
  cout << endl;
}



Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);++i)
#define rep1(i, n) for(int i=1;i<=(int)(n);++i)
#define irep(i, a, n) for(int i=a;i<(int)(n);++i)
#define rrep(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define rrep1(i, n) for(int i=(int)(n);i>=1;--i)
#define allrep(V, v) for(auto&& V:v)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const int INF=1<<29;
const double EPS=1e-9;
using namespace std;

int main (void)
{
  string s; cin>>s;
  lint k; cin>>k;
  int cnt_1=0, n;
  allrep(S,s){
    if(S == '1') ++cnt_1;
    else{
      n=S-'0';
      break;
    }
  }
  cout << (cnt_1>=k ? 1 : n) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main(){

	int pasta[3] , juice[2];
	int sum = 0;

	for(int i = 0; i < 3; i++){
		cin >> pasta[i];
	}for(int i = 0; i < 2; i++){
		cin >> juice[i];
	}

	sort(pasta , pasta + 3 , less<int>());
	sort(juice , juice + 2 , less<int>());

	sum = (pasta[0] + juice[0]) - 50;

	cout << sum << endl;

	return 0;
}

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

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

	int N, M, Q; cin >> N >> M >> Q;
	vector<int> a[550];
	int l, r;
	for (int i = 0; i < M; i++) {
		cin >> l >> r;
		a[l].push_back(r);
	}
	for (int i = 1; i <= N; i++) {
		sort(a[i].begin(),a[i].end());
	}
	int ans[110000];
	fill(ans, ans + N, 0);
	for (int d = 0; d < Q; d++) {
		cin >> l >> r;
		for (int i = l; i <= r; i++) {
			int n = a[i].size();
			int cnt = 0;
			while (cnt+100 < n && a[i][cnt+100] <= r) {
				ans[d] += 100;
				cnt += 100;
			}
			while (cnt + 10 < n && a[i][cnt+10] <= r) {
				ans[d] += 10;
				cnt += 10;
			}
			while (cnt < n && a[i][cnt] <= r) {
				ans[d]++;
				cnt++;
			}
		}
	}
	for (int i = 0; i < Q; i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int n,w[200]={0},s[200]={0},W=0,m;

signed main(){
    cin>>n;
    for(int i=0;i<n;++i){
        cin>>w[i];
        W+=w[i];
    }

    int x=w[0];
    W-=w[0];
    m=abs(x-W);
    for(int i=1;i<n-1;++i){
        x+=w[i];
        W-=w[i];
        m=min(m,abs(x-W));
    }

    cout<<m<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <vector>
#include <iostream>
using namespace std;
int main(){
  char S[10];
  cin >>S;
 int ans=0 ,l=0;
  for(int i=0;i<10;i++){
    if(S[i]=='G'||S[i]=='A'||S[i]=='T'||S[i]=='C'){
      l++;
      ans=max(l,ans);
    }else{
      
      l=0;
    }
  }
cout <<ans <<endl;
}

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

const int MAXN = 610;
const int mod = 1000000007;
typedef long long LL;
void reduce(int & x) { x += x >> 31 & mod; }
int mul(int a, int b) { return (LL) a * b % mod; }
int fastpow(int a, int b, int res = 1) {
	for (; b; b >>= 1, a = mul(a, a)) if (b & 1) res = mul(res, a);
	return res;
}
int dp[2][MAXN][MAXN];
int n, hav[MAXN], A[MAXN];
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n; int em = 0;
	for (int i = 1; i <= n * 2; ++i)
		std::cin >> A[i];
	int tar = n;
	for (int i = 1; i <= n; ++i) {
		int l = A[i * 2 - 1], r = A[i * 2];
		if (l == -1 && r == -1) ++em;
		if (l == -1 || r == -1) {
			if (l != -1) hav[l] = 1;
			else hav[r] = 1;
		} else if (l != -1 && r != -1) hav[l] = hav[r] = -1, --tar;
	}
	int now = 1, lst = 0;
	dp[now][0][0] = 1;
	const int up = n * 2;
	int suc = 0;
	for (int i = up; i; --i) {
		if (hav[i] == -1) continue;
		++suc;
		std::swap(lst, now);
		memset(dp[now], 0, sizeof(dp[now]));
		for (int j = 0; j <= up; ++j)
			for (int k = 0; k <= up; ++k)
				if (int t = dp[lst][j][k]) {
					int m = suc - 1 - j * 2 - k;
					if (hav[i] == 0) {
						reduce(dp[now][j][k] += t - mod);
						if (m)
						reduce(dp[now][j + 1][k] += t - mod);
						if (k)
						reduce(dp[now][j + 1][k - 1] += mul(t, k) - mod);
					} else {
						reduce(dp[now][j][k + 1] += t - mod);
						if (m)
						reduce(dp[now][j + 1][k] += t - mod);
					}
				}
	}
	int ans = dp[now][tar][0];
	for (int i = 1; i <= em; ++i) ans = mul(ans, i);
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define rep(i,s,e) for(int i = s; i < e; i++)
#define test(t) int t; cin >> t; while(t--) 
#define iterate(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define MOD 1000000007

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef set<int> si;
typedef long long ll;

int findp(int * parent, int n) {
  if(parent[n] == n) return n;
  parent[n] = findp(parent,parent[n]);
  return parent[n];
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n,len;
  cin >> n >> len;
  int parent[n*len];
  long blacks[n*len];
  long whites[n*len];
  rep(i,0,n*len) {
    parent[i] = i;
    blacks[i] = whites[i] = 0;
  }
  string s[n];
  rep(i,0,n) {
    cin >> s[i];
  }
  rep(i,0,n) {
    rep(j,0,len) {
      if(i != 0) {
        if(s[i-1][j] != s[i][j]) {
          int p = findp(parent,i*len+j);
          parent[p] = findp(parent,(i-1)*len + j);
        }
      }
      if(j!=0) {
        if(s[i][j] != s[i][j-1]) {
          int p = findp(parent,i*len+j);
          parent[p] = findp(parent,(i*len + j - 1));
        }
      }
      if(i != (n-1)) {
        if(s[i][j] != s[i+1][j]) {
          int p = findp(parent,i*len+j);
          parent[p] = findp(parent,((i+1)*len + j));
        }
      }
      if(j != (len-1)) {
        if(s[i][j] != s[i][j+1]) {
          int p = findp(parent,i*len+j);
          parent[p] = findp(parent,(i*len + j + 1));
        }
      }
    }
  }
  rep(i,0,n) {
    rep(j,0,len) {
      int p = findp(parent,i*len + j);
      if(s[i][j] == '#') blacks[p]++;
      else whites[p]++;
    }
  }
  long ways = 0;
  rep(i,0,n) {
    rep(j,0,len) {
      ways += (long)(whites[i*len + j] * blacks[parent[i*len+j]]);
    }
  }
  cout << ways << endl;
  return 0;
}


Measured memory_bytes: 3584
#pragma GCC optimize(2)
#pragma warning(disable:4996)
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include<cstring>
#include <stack>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include <string>
#define itn int
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define F2(i,a,b) for(int i=a;i<(b);++i)
#define dF(i,a,b) for(int i=a;i>=(b);--i)
const int maxn = 2000 * 100 + 6;
const int maxa = 1000 * 1000 * 1000 + 7;
typedef long long ll;
const int mod = 1000 * 1000 * 1000 + 7;
using namespace std;
int t, n, m, T;
int a[maxn];


int f(int l, int r) {
	//return (r - l) * (r - l - 1) / 2 + r - l;
	return (r - l);
}
int main()
{
#ifdef _DEBUG
	freopen("D:\\input.txt", "r", stdin);
	//	freopen("E:\\output.txt", "w", stdout);
#endif
	int i, j;
	
	std::ios::sync_with_stdio(false); cin.tie(0);	cout.tie(0);
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int l = 0, r =0;
	int sum = 0;
	ll res = 0;
	while (r<n) {

		if ((sum ^ a[r] )== sum + a[r]) {
			sum ^= a[r];
			r++;
			res += f(l, r);


		}
		else {
			sum ^= a[l];
			l++;
			
		}
	}
	cout << res << "\n";
	return 0;
}

Measured memory_bytes: 1024
my $N = <STDIN>;
chomp($N);
foreach my $i (1..9) {
    my $m = $N % $i;
    if ($m == 0) {
        my $a = $N/$i;
        if ( $a < 10 and $a > 0 ) {
            print "Yes";
            exit 0;
        }
    }
}
print "No";

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main()
{
	while(true){
	int N,M;
	scanf("%d%d",&N,&M);
	if(N==0&&M==0)return 0;
	int C[1000];
	for(int i=0;i<N;i++)scanf("%d",&C[i]);
	int B=0;
	int S[1000];
	for(int i=0;i<M;i++)
		scanf("%d",&S[i]);
		for(int i=0;i<M;i++){
		B+=S[i];
		if(B>=N-1){
			printf("%d\n",i+1);
			break;
		}
		B+=C[B];
		if(B>=N-1){
			printf("%d\n",i+1);
			break;
		}
	}
	}
}

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

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    for (auto &a : A) cin >> a;
    int tot = accumulate(A.begin(), A.end(), 0);
    sort(A.rbegin(), A.rend());
    printf(A[M - 1] * 4LL * M >= tot ? "Yes\n" : "No\n");
}


Measured memory_bytes: 256
# Edige Weighted Digraph


from collections import namedtuple


WEIGHT_MAX = 10 ** 10
WeightedEdge = namedtuple('WeightedEdge', ('src', 'dest', 'weight'))


class Digraph:
    def __init__(self, v):
        self.v = v
        self.edges = [[] for _ in range(v)]

    def add(self, edge):
        self.edges[edge.src].append(edge)

    def adj(self, v):
        return self.edges[v]


def sp_bellmanford(graph, s):
    def relax(edge):
        s, t, w = edge
        if dists[t] > dists[s] + w:
            dists[t] = dists[s] + w
            srcs[t] = s
            _nodes.append(t)

    dists = [WEIGHT_MAX] * graph.v
    dists[s] = 0
    srcs = [-1] * graph.v
    nodes = []

    nodes.append(s)
    for _ in range(graph.v):
        _nodes = []
        for v in nodes:
            for e in graph.adj(v):
                relax(e)
        nodes = _nodes

    if len(nodes) > 0:
        return None
    else:
        return [None if dists[v] == WEIGHT_MAX else dists[v]
                for v in range(graph.v)]


def run():
    v, e = [int(i) for i in input().split()]

    graph = Digraph(v)
    for _ in range(e):
        edge = WeightedEdge(*[int(i) for i in input().split()])
        graph.add(edge)

    paths = []
    for r in range(v):
        ws = sp_bellmanford(graph, r)
        if ws is None:
            print("NEGATIVE CYCLE")
            break
        else:
            paths.append(ws)
    else:
        for ws in paths:
            print(" ".join("INF" if w is None else str(w) for w in ws))


if __name__ == '__main__':
    run()



Measured memory_bytes: 7476
# Problem C - Rectangle Cutting

# input
W, H, x, y = map(int, input().split())

# initialization
ans = (W * H) / 2
is_ok = (x*2==W) and (y*2==H)

if is_ok:
    print("%f %d"%(ans, 1))
else:
    print("%f %d"%(ans, 0))


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

int main()
{
    int count = 0;
    string str;
    cin >> str;
    vector<int> n(26);
    for (int i = 0; i < 26;i++){
        n.at(i) = 0;
    }

        for (int i = 0; i < str.size(); i++)
        {
            if (str.at(i) == 'a')
            {
                n.at(0)++;
            }
            else if (str.at(i) == 'b')
            {
                n.at(1)++;
            }
            else if (str.at(i) == 'c')
            {
                n.at(2)++;
            }
            else if (str.at(i) == 'd')
            {
                n.at(3)++;
            }
            else if (str.at(i) == 'e')
            {
                n.at(4)++;
            }
            else if (str.at(i) == 'f')
            {
                n.at(5)++;
            }
            else if (str.at(i) == 'g')
            {
                n.at(6)++;
            }
            else if (str.at(i) == 'h')
            {
                n.at(7)++;
            }
            else if (str.at(i) == 'i')
            {
                n.at(8)++;
            }
            else if (str.at(i) == 'j')
            {
                n.at(9)++;
            }
            else if (str.at(i) == 'k')
            {
                n.at(10)++;
            }
            else if (str.at(i) == 'l')
            {
                n.at(11)++;
            }
            else if (str.at(i) == 'm')
            {
                n.at(12)++;
            }
            else if (str.at(i) == 'n')
            {
                n.at(13)++;
            }
            else if (str.at(i) == 'o')
            {
                n.at(14)++;
            }
            else if (str.at(i) == 'p')
            {
                n.at(15)++;
            }
            else if (str.at(i) == 'q')
            {
                n.at(16)++;
            }
            else if (str.at(i) == 'r')
            {
                n.at(17)++;
            }
            else if (str.at(i) == 's')
            {
                n.at(18)++;
            }
            else if (str.at(i) == 't')
            {
                n.at(19)++;
            }
            else if (str.at(i) == 'u')
            {
                n.at(20)++;
            }
            else if (str.at(i) == 'v')
            {
                n.at(21)++;
            }
            else if (str.at(i) == 'w')
            {
                n.at(22)++;
            }
            else if (str.at(i) == 'x')
            {
                n.at(23)++;
            }
            else if (str.at(i) == 'y')
            {
                n.at(24)++;
            }
            else if (str.at(i) == 'z')
            {
                n.at(25)++;
            }
        }
    for (int i = 0; i < 26;i++){
        if(n.at(i)%2==1){
            count++;
        }

    }
    if(count==0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
//BISMILLAH
#include <bits/stdc++.h>
using namespace std;
#define sz 109
long long int weight[sz];
long long int profit[sz];
long long int dp[sz][100003],n;
    long long int solve(long long int i,long long int p){
       if(i == n){
           if(p == 0) return 0;
           else return INT_MAX;
       }
        if(dp[i][p] != -1) return dp[i][p];
        long long int x = INT_MAX,y = INT_MAX;
        if(p - profit[i] >= 0){
              x = weight[i] + solve(i + 1,p - profit[i]);
        }
         y = solve(i+1,p);
         return dp[i][p] = min(x,y);
    }
int main(){
    memset(dp,-1,sizeof(dp));
    long long int w,v,i,j;
    long long int sum = 0;
    cin >> n >> w;
    for(i = 0;i<n;i++) {
        cin >> weight[i] >> profit[i];
        sum += profit[i];
    }
    for(i = sum;i>=0;i--)
    {
        if(solve(0,i) <= w){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 88732
#include <stdio.h>
int main(){
  
 int a, b, c;
 scanf("%d%d%d",&a,&b,&c);
 if(a <= b && a <= c) {
 if(b <= c) {
 printf("%d %d %d\n", a, b, c);
 goto OUT;
 } else if(c <= b) {
 printf("%d %d %d\n", a, c, b);
 goto OUT;
 }
 } else if(b <= a && b <= c) {
 if(a <= c) {
 printf("%d %d %d\n", b, a, c);
 goto OUT;
 } else if(c <= a) {
 printf("%d %d %d\n", b, c, a);
 goto OUT;
 }
 } else if(c <= a && c <= b) {
 if(a <= b) {
 printf("%d %d %d\n", c, a, b);
 goto OUT;
 } else if(b <= a) {
 printf("%d %d %d\n", c, b, a);
 goto OUT;
 }
 }
 OUT:
  
 return 0;
}

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

tmp=0

ans=[]
for i in range(n):
    if i>=k:
        if a[i]>a[i-k]:
            ans.append("Yes")
        else:
            ans.append("No")




for item in ans:
    print(item)




Measured memory_bytes: 102220
def cross(a,b):return a[0]*b[1] - a[1]*b[0]
        
n = int(input())
P =[]
s = 0
for i in range(n):P.append([int(i) for i in input().split()])
P = P*2
for i in range(n):s += cross(P[i],P[i+1])
print(abs(s)/2)

Measured memory_bytes: 7732
package main

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

func exec(stdin *Stdin, stdout *Stdout) {
	n := stdin.ReadInt()
	k := stdin.ReadInt()
	a := []int{}
	for i := 0; i < n; i++ {
		a = append(a, stdin.ReadInt())
	}

	ans := 0

	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	for i := 0; i < n; i++ {
		s := n - i - 1
		if k-1 <= s {
			ans = (ans + (a[i] * C(s, k-1) % MOD)) % MOD
		}
	}

	sort.Sort(sort.IntSlice(a))
	for i := 0; i < n; i++ {
		s := n - i - 1
		if k-1 <= s {
			ans = (ans - (a[i] * C(s, k-1) % MOD)) % MOD
		}
	}

	if ans < 0 {
		ans += MOD
	}

	stdout.Println(ans)
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), int(math.MaxInt32))
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

const MOD = 1000000007

var FCT = []int{1}

func ModPow(x, y int) int {
	z := 1
	for y > 0 {
		if y%2 == 0 {
			x = (x * x) % MOD
			y /= 2
		} else {
			z = (z * x) % MOD
			y--
		}
	}
	return z
}

func ModInv(x int) int {
	return ModPow(x, MOD-2)
}

func C(n, r int) int {
	for i := len(FCT); i <= n; i++ {
		FCT = append(FCT, FCT[i-1]*i%MOD)
	}
	return FCT[n] * (ModInv(FCT[n-r]) * ModInv(FCT[r]) % MOD) % MOD
}


Measured memory_bytes: 7680
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;


int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  ll ans=0;
  vector<ll> x(n);
  rep(i,n){
    cin >> x[i];
  }
  rep(i,n-1){
    ans += min((x[i+1]-x[i])*a,b);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
L, R = map(int, input().split())

memoL = [False]*2019
memoR = [False]*2019

if R-L+1 >= 2019:
    print(0)
else:
    ans = 10**9
    for i in range(L,R):
        for j in range(i+1,R+1):
            ans = min(ans, i*j%2019)
    print(ans)

Measured memory_bytes: 40812
#include <bits/stdc++.h>
using namespace std;
#define rep(k,nu)    for(int i=k; i<nu;  i++)
#define rep2(k,n)   for(int j=k; j<n;  j++)
#define size_a(array) sizeof(array) / sizeof(array[0])
#define INF 1000000000000 //1e+12
#define MOD 10000007 //1e9+7
#define ll long long
#define pb pop_back
template<typename T> inline void chMin(T* a, T* b) {if(*a>*b) *a=*b;}
template<typename T> inline void chMax(T* a, T* b) {if(*a<*b) *a=*b;}
template<typename T> inline int  divUp(T a, T b)   {return ((a+b-1)/b);}
const double PI = acos(-1);


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

    rep(0,s.length()){
        if(s[i] == '7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}
/*

*/


Measured memory_bytes: 3520
from itertools import accumulate
from copy import deepcopy

n,k = map(int,input().split())
a = list(map(int,input().split()))
b = [0]*(n+1)

if k > 41:
    k = 41

for _ in range(k):
    b = [0]*(n+1)
    for i,j in enumerate(a):
        b[max(0,i-j)] += 1
        b[min(n,i+j+1)] -= 1
    a = list(accumulate(b))
    for i in range(n+1):
        if a[i] >= n:
            a[i] = n

print(*a[:-1])

Measured memory_bytes: 186048
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#pragma warning(disable: 4996)
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;


int main() {
	

	int N;
	int ans = 0;
	int max = 0;
	int min = 1000000;
	cin >> N;
	vector<int> P(N);
	
	rep(i, N) {
		cin >> P[i];
		if (i == 0) {
			min = P[0];
		}

			if (min>=P[i]) {
			ans++;
		}
		if (P[i] < min) {
			min = P[i];
		}
	}

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

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main() {
  int n,m;
  cin >> n >> m;
  int div;
  if(n==1){
    cout << m << endl;
    return 0;
  }
  bool* prime = new bool[330000];
  bool mDived = false;
  for(int i=0;i<330000;i++) prime[i] = true;
  prime[1] = false;
  for(int i=2;i<330000;i++) {
    if(prime[i]){
      int j=i*2;
      while(j<330000){
        prime[j] = false;
        j += i;
      }
      if(m%i==0){
        mDived = true;
      }
      if(sqrt(m)<i && !mDived){
        cout << 1 << endl;
        return 0;
      }
    }
  }
  for(int i=n;i<=m;i++){
    if(m%i==0) {
      cout << m/i << endl;
      return 0;
    }
  }
}


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

int main()
{  
  int n,d;
  cin >> n >> d;
  int x[n][d];
  for(int i=0;i<n;++i){
    for(int j=0;j<d;++j){
      cin >> x[i][j];
    }
  }
  
  int y=0;
  int ans=0;
  for(int i=0;i<n-1;++i){
    for(int j=i+1;j<n;++j){
      for(int k=0;k<d;++k){
        y+=pow(x[i][k]-x[j][k],2);
      }
      for(int l=1;l*l<=y;++l){
        if(y==l*l){
          ++ans;
        }
      }
      y=0;
    }
  }
  
  cout << ans;
  return 0;
}

Measured memory_bytes: 256