akhauriyash/Code-Regression huggingface dataset:
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 100100100100;
const long long MOD = 998244353;
typedef pair<long long,long long> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

int main() {
    int N;cin >> N;
    vector<int> retu(N);
    for(int i = 0;i<N;i++) cin >> retu.at(i);
    sort(retu.begin(),retu.end());
    int ans = 0;
    for(int i = 0;i<N-1;i++){
        if(retu.at(i) == retu.at(i+1)) ans++;
    }
    if(ans % 2 == 0){
        cout << N-ans << endl;
    }
    else{
        cout << N-ans-1 << endl;
    }
}


Measured memory_bytes: 640
fn main() {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    let mut iter = input.split_whitespace();
    let h : usize = iter.next().unwrap().parse().unwrap();
    let w : usize = iter.next().unwrap().parse().unwrap();
    use std::iter::FromIterator;
    let f : Vec<&[u8]> = Vec::from_iter(iter.map(|s| s.as_bytes()));
    let mut c : usize = 0;
    for i in 0..h {
        for j in 0..w {
            if f[i][j] == 46 { c += 1; }
        }
    }
    let inf = 100000;
    let mut d : Vec<Vec<usize>> = vec![vec![inf; w]; h];
    use std::collections::VecDeque;
    let mut q : VecDeque<(usize, usize)> = VecDeque::new();
    d[0][0] = 1;
    q.push_back((0, 0));
    while !q.is_empty() {
        let (x, y) = q.pop_front().unwrap();
        let dist = d[x][y] + 1;
        let mut push = |x : usize, y : usize, dist : usize| {
            if f[x][y] == 46 && d[x][y] > dist {
                q.push_back((x, y));
                d[x][y] = dist;
            }
        };
        if y+1 < w { push(x, y+1, dist); }
        if x+1 < h { push(x+1, y, dist); }
        if 0 < y { push(x, y-1, dist); }
        if 0 < x { push(x-1, y, dist); }
    }
    if d[h-1][w-1] == inf { println!("-1") }
    else { println!("{}", c - d[h-1][w-1]) }
}


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


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

    sort(a.begin(),a.end(),greater<int>());

    int alice = 0, bob = 0;
    for(int i=0;i<N;i++){
        if(i%2==0) alice += a[i];
        else bob += a[i];
    }

    cout << alice-bob << endl;

    return 0;
}


Measured memory_bytes: 256
N,M = map(int, input().split())
A = [[int(a) for a in input().split()] for _ in range(N)]

L = [0]*(M+1) #L[i]:0ならスポーツiを含める、1なら含めない
I = [0]*N #A[i][I[i]]:人iが参加するスポーツ
ans = N
flag = True
while flag:
    cnt = [0]*(M+1)
    for i in range(N):
        while I[i] < N and L[A[i][I[i]]] == 1:
            I[i] += 1
        if I[i] == N:
            flag = False
            break
        cnt[A[i][I[i]]] += 1
    if flag:
        num = max(cnt)
        ans = min(ans, num)
        for i in range(1, M+1):
            if cnt[i] == num:
                L[i] = 1
    if sum(L) == M:
        flag = False

print(ans)

Measured memory_bytes: 4260
class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;
  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n){
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n){
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
}

const o = new AtCoder()
let n=o.n(),arr=[],ans=1
for(let i=0;i<n;i++)arr.push(o.nn(2))
arr.sort((a,b)=>{return a[0]+a[1]-(b[0]+b[1])})
let now=arr[0][0]+arr[0][1]
for(let i=1;i<n;i++){
  if(now<=arr[i][0]-arr[i][1]){
    now=arr[i][0]+arr[i][1]
    ans++
  }
}
o.o(ans)

Measured memory_bytes: 59728
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


int main(){

    ll n,k;
    cin>>n>>k;
    cout<<(n-k+1)<<endl;

    return 0;
}


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

int a,p;

int main(){

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

cin>>a>>p;

a=3*a;
p=p+a;

cout<<p/2<<endl;

}



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

using namespace std;

vector<pair<long long, long long>> prime_factorize(long long N) {
	vector<pair<long long, long long>> res;
	for(long long i = 2; i * i < N; i++) {
		if (N % i != 0) { continue; }
		long long ex = 0;

		while (N % i == 0) {
			++ex;
			N /= i;
		}
		res.push_back({i, ex});
	}
	if (N != 1) {
		res.push_back({N, 1});
	}
	return res;
}


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

	if ( N <= 1) {
		cout << 0 << endl;
		return 0;
	}

	auto list = prime_factorize(N);
	//for (auto a : list) {
	//		cout << "{ " << a.first << " " << a.second << " }" << endl;
	//}
	//cout << endl;

	long res = 0;
	for (auto a : list) {
			int tmp = a.second;
			for (int i = 1; i <= tmp; i += 1) {
					tmp -= i;
					res++;
			}
	}
	cout << res << endl;
}


Measured memory_bytes: 3196
n = gets.to_i
elms = gets.split.map(&:to_i)
cnt = 0

(1...n - 1).each do |i|
  arr = [elms[i - 1], elms[i], elms[i + 1]].sort
  cnt += 1 if arr.index(elms[i]) == 1
end

puts cnt


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

int main()
{
	int N;
  cin >> N;
  
  int A[N];
  for(int i = 0; i < N; i++){
	cin >> A[i];
  }
  
  bool flag;
  bool odd = false;
  bool even = true;
  int count = 0;
  while(A[0]%2 == 0){
    for(int i = 0; i < N; i++){
      if(A[i]%2 == 0){
        A[i] /= 2;
        if(i == N-1)
          count++;
        flag = even;
      }
      else{
        flag = odd;
        break;
      }
    }
    if(!flag)
      break;
  }
	cout << count << endl;
}

Measured memory_bytes: 256
/*
    Author: Jerry Yang C.H. (tico88612)
    Date: 2019/12/20
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
// const ll MAXN = 

/********** Good Luck :) **********/
int main()
{
    IOS();
    ll x, y;
    cin >> x >> y;
    ll ans = 0;
    while(x <= y){
        ans++;
        x *= 2;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

//const long long int MOD = 1000000007;
const int MOD = 1000000007;
//const int MOD = 998244353;
//const long long int MOD = 998244353;

//long long int N, M, K, H, W, L, R;
int N, M, K, H, W, L, R;

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

	while (cin >> N, N) {
		vector<string>s(N);
		for (auto &i : s)cin >> i;
		map<char, int>m;
		for (auto i : s) {
			for (auto j : i)m[j] = 0;
		}
		int cnt = 0;
		for (auto &i : m)i.second = cnt++;
		for (auto &i : s) {
			for (auto &j : i)j = m[j];
		}
		M = m.size();
		vector<int>v(10);
		for (int i = 0; i < 10; i++)v[i] = i;
		int ans = 0;
		do {
			int sum = 0;
			bool flag = true;
			for (int i = 0; i < s.size() - 1; i++) {
				if (s[i].size() > 1 && !v[s[i][0]]) {
					flag = false;
					break;
				}
				int add = 0;
				for (auto j : s[i]) {
					add *= 10;
					add += v[j];
				}
				sum += add;
			}
			int fin = 0;
			if (s.back().size() > 1 && !v[s.back()[0]])flag = false;
			for (auto i:s.back()) {
				fin *= 10;
				fin += v[i];
			}
			if (sum == fin && flag)ans++;
		} while (next_permutation(v.begin(), v.end()));
		for (int i = 1; i <= 10 - m.size(); i++)ans /= i;
		cout << ans << endl;
	}
}



Measured memory_bytes: 3128
i1 = map(int, raw_input().split())
i2 = map(int, raw_input().split())
li = []
n1 = i1[0]; n2 = i2[0];
i = j = 0
while i<n1 and j<n2:
    l1 = (i1[2*i+1], i1[2*i+2])
    l2 = (i2[2*j+1], i2[2*j+2])
    if l1==l2:
        li.append(l1)
        i += 1; j += 1;
    elif l1<l2:
        li.append(l1)
        i += 1
    else:
        li.append(l2)
        j += 1
while i<n1:
    li.append((i1[2*i+1], i1[2*i+2]))
    i += 1
while j<n2:
    li.append((i2[2*j+1], i2[2*j+2]))
    j += 1
print ' '.join(map(lambda x: "%d:%02d"%x, li))

Measured memory_bytes: 4264
#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

//++時計回り --反時計回り
// int dx[4] = {1, 0, -1, 0};
// int dy[4] = {0, 1, 0, -1};

int main() {
  int N = 2000001;
  int K, X;
  cin >> K >> X;
  for (int i = X - (K - 1); i < X + K; i++)
    cout << i << (i < X + K - 1 ? ' ' : '\n');
}


Measured memory_bytes: 256
import java.io.BufferedReader;
//import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
 
public class Main {
 
    public static void main(String[] args) throws NumberFormatException, IOException {
        //System.setIn(new FileInputStream("./input.txt"));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
         
        int n = Integer.parseInt(br.readLine());
        boolean[] dict = new boolean[(int) Math.pow(5, 12)];
        char[] c;
        for(int i = 0; i < n; ++i) {
            c = br.readLine().toCharArray();
            if(c[0] == 'i'){
                // insert
                dict[hash(Arrays.copyOfRange(c, 7, c.length))] = true;
            }else{
                // find
                if(dict[hash(Arrays.copyOfRange(c, 5, c.length))] == true){
                    sb.append("yes\n");
                }else{
                    sb.append("no\n");
                }
            }
        }
        System.out.print(sb);
    }
    public static int hash(char[] c){
        int a;
        int hash = 0;
        for(int i = 0; i < c.length; ++i) {
            switch(c[i]){
            case 'A':
                a = 1;
                break;
            case 'C':
                a = 2;
                break;
            case 'G':
                a = 3;
                break;
            default:
                a = 4;
                break;              
            }
            hash = hash*5 + a;
        }
        return hash;
    }
}

Measured memory_bytes: 311884
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()

#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;





signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	cout << c << " " << a << " " << b << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int len = Integer.parseInt(sc.nextLine());
		int[] bits = new int[len];

		int xored = 0;
		for (int i = 0; i < len; i++) {
			bits[i] = sc.nextInt();
			if (i > 0) {
				xored = xored ^ bits[i];
			}
		}

		System.out.print(xored);

		for (int i = 0; i < len - 1; i++) {
			xored = xored ^ bits[i] ^ bits[i + 1];
			System.out.print(" " + xored);
		}
	}

}

Measured memory_bytes: 61828
N, M = map(int, input().split())
X = list(map(int, input().split()))
xs = sorted(X)
d = []
for i in range(M-1):
  d.append(xs[i+1]-xs[i])
ds = sorted(d)
if M>N:
  print(sum(ds[:(M-N)]))
else:
  print(0)

Measured memory_bytes: 20424
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

using namespace std;
using ll = long long;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<ll>;

void show(mat & m)
{
    for(int i=0;i<m.size();++i)
    {
        for(int j=0;j<m[i].size();++j)
        {
            printf("%2d ",m[i][j]);
        }
        cout << endl;

    }
    cout << endl;
}

int main()
{
    int N,K;cin >> N >> K;
    int SIZE = 2*K+1;

    mat dp(SIZE,vec(SIZE,0));

    for(int i=0;i<N;++i) {
        int x, y;
        cin >> x >> y;
        char c;
        cin >> c;
        int a=1;
        if(c=='B')
        {
            a=-1;
        }

        if(((x%(2*K))<K)^((y%(2*K))<K))
        {
            a*=-1;
            x+=K;
        }

        if(a==-1)
        {
            dp[0][0]+=1;
            dp[0][SIZE-1]+=-1;
            dp[SIZE-1][0]+=-1;
            dp[SIZE-1][SIZE-1]+=1;
        }

        x %= K;
        y %= K;

        int xar[4] = {0, K-x, 2*K-x, 2*K};
        int yar[4] = {0, K-y, 2*K-y, 2*K};
        int aar[4][4]=
                {
                     1,-1, 1,-1,
                    -1, 2,-2, 1,
                     1,-2, 2,-1,
                    -1, 1,-1, 1
                };
        for(int i=0;i<4;++i)for(int j=0;j<4;++j)
            {
                dp[xar[i]][yar[j]]+=a*aar[i][j];
            }
    }

    //show(dp);

    for(int i=1;i<SIZE;++i)for(int j=0;j<SIZE;++j)
        {
            dp[i][j]+=dp[i-1][j];
        }
    //show(dp);
    int ans=0;
    for(int i=0;i<SIZE;++i)for(int j=1;j<SIZE;++j)
        {
            dp[i][j]+=dp[i][j-1];
        }

    //show(dp);
    for(int i=0;i<SIZE;++i)for(int j=0;j<SIZE;++j)
        {
            ans=max(ans,dp[i][j]);
        }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 16000
#include <stdio.h>

char s[200001];
int main(void)
{
	scanf("%s",s);
	int i=0,start=0,count=0,last=0;
	for(i;i <= 199999;i++)
	{
		if(s[i]=='A')
		{
			if(start==0 && count == 0)
			{
				start=i;
				count++;
			}
		}
		else if(s[i]=='Z')
		{last=i;}
	}
	int len=last-start+1;
	printf("%d\n",len);
	return 0;
}


Measured memory_bytes: 384
open Batteries;;
  
let rec combination n r =
  if n = r || r = 0 then 1
  else (combination n (r - 1)) * (n - r + 1) / r
;;
  
let () =
  let n = read_int () in
  let l = Array.to_list @@
      Array.init n
                 (fun _ -> read_line ()) in
  let lhd = List.map (fun x -> String.get x 0) l in
  let m = List.length @@ List.filter (fun x -> 'M'=x) lhd in
  let a = List.length @@ List.filter (fun x -> 'A'=x) lhd in 
  let r = List.length @@ List.filter (fun x -> 'R'=x) lhd in
  let c = List.length @@ List.filter (fun x -> 'C'=x) lhd in
  let h = List.length @@ List.filter (fun x -> 'H'=x) lhd in
  let x = List.length (List.filter (fun x -> x<>0) [m;a;r;c;h]) in
  let ans = m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h
            + a*r*c + a*r*h + a*c*h
            + r*c*h in
          
  let mc = combination m 1 in
  let ac = combination a 1 in
  let rc = combination r 1 in
  let cc = combination c 1 in
  let hc = combination h 1 in
  print_int ans
;;



Measured memory_bytes: 11648
#include <ios>
#include <iostream>

int gcd(int a, int b)
{
    if (a == 0)
        return b;
    else
        return gcd(b%a, a);
}

int main()
{
    int n, k, x, mx = 0, g = 0;
    std::cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        std::cin >> x;
        if (x > mx)
            mx = x;
        g = gcd(g, x);
    }
    if (n == 1 && x != k)
        std::cout << "IMPOSSIBLE\n";
    else if (n == 1 && x == k)
        std::cout << "POSSIBLE\n";
    else if (k % g != 0)
        std::cout << "IMPOSSIBLE\n";
    else if (mx < k)
        std::cout << "IMPOSSIBLE\n";
    else
        std::cout << "POSSIBLE\n";
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

string s;
int main() {
	ios_base::sync_with_stdio(false);

	cin >> s;
	stack<int> st;
	for(auto i : s) 
		if(i == 'T' && !st.empty() && st.top() == 'S')
			st.pop();
		else st.push(i);
	cout << st.size();
}	

	

Measured memory_bytes: 1300
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
ans=0


for i in range(2**n):
    s = [0] * n
    flag=True
    for j in range(n):
        if (i>>j)&1==1:
            s[j]=1

    for k in range(m):
        count=0
        for l in range(a[k][0]):
            if s[a[k][l+1]-1]==1:
                count+=1
        if count%2!=p[k]:
            flag=False
            break
        if not flag:
            break

    if flag:
        ans+=1

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

int modpow(int a, int n) {
    int res=1;
    while(n>0) {
        if(n&1) res=res*a%MOD;
        a=a*a%MOD;
        n>>=1;
    }
    return res;
}

int modinv(int a){
    return modpow(a,MOD-2);
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int s; cin >> s;
    int res=1;
    COMinit();
    if(s<3){ cout<<0<<endl; return 0;}

    for(int i=2; ; i++){
        if(i*3>s) break;
        int t=s-i*3;
        int tmp=1;
        res+=COM(t+i-1,i-1);
        // for(int j=1; j<=t+i; j++) tmp*=j;
        // for(int j=1; j<=i; j++) tmp*=modinv(j);
        // for(int j=1; j<=t; j++) tmp*=modinv(j);
        //res+=tmp;
        res%=MOD;
        
    }
    cout<<res<<endl;
}

Measured memory_bytes: 15592
H, W = map(int, input().split())
Ch, Cw = (map(lambda x:int(x)-1, input().split()))
Dh, Dw = (map(lambda x:int(x)-1, input().split()))
# Ch, Cw
# Dh, Dw
dist = []
for _ in range(H):
  dist.append(list(map(lambda x:-1 if x=='.' else 10**30, input())))

#dist = [[-1] * W for _ in range(H)]
#dist[Ch][Cw] = 0
C = set([(Ch, Cw)])
N = set()
ans = 0
while C or N:
  if C:
    #print(ans, '##', C, '##', N)
    xh, xw = C.pop()
    if dist[xh][xw] >=0:
      continue
    else:
      dist[xh][xw] = ans

    if (xh, xw) == (Dh, Dw):
      print(ans)
      exit()
    
    if xh > 0 and dist[xh-1][xw] < 0:
      C.add((xh-1,xw))
    if xh < H-1 and dist[xh+1][xw] < 0:
      C.add((xh+1,xw))
    if xw > 0 and dist[xh][xw-1] < 0:
      C.add((xh,xw-1))
    if xw < W-1 and dist[xh][xw+1] < 0:
      C.add((xh,xw+1))
    for dh in [-2, -1, 0, 1, 2]:
      for dw in [-2, -1, 0, 1, 2]:
        if 0 <= xh + dh < H and 0 <= xw + dw < W and dist[xh+dh][xw+dw] < 0:
          N.add((xh+dh, xw+dw))
  else:
    C = N
    N = set()
    ans += 1
      
      
print(-1)      




Measured memory_bytes: 111476
import itertools
N,M,Q=map(int,input().split())

A,B,C,D=[0]*Q,[0]*Q,[0]*Q,[0]*Q
for i in range(Q):
    A[i],B[i],C[i],D[i]=map(int,input().split())
    A[i]-=1
    B[i]-=1

num=[i for i in range(1,M+1)]

ans=0
for a in itertools.combinations_with_replacement(num,N):
    tmp_sum=0
    for i in range(Q):
        if a[B[i]]-a[A[i]]==C[i]:
            tmp_sum+=D[i]
    ans=max(ans,tmp_sum)
print(ans)

Measured memory_bytes: 9180
n = int(input())

alphas = "abcdefghij"
init_str = ""

def standard(moji, i):
    if len(moji) == n:
        print(moji)
    else:
        for j in range(i):
            if j == i - 1:
                standard(moji + alphas[j], i + 1)
            else:
                standard(moji + alphas[j], i)
                

standard(init_str, 1)

Measured memory_bytes: 4404
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
 
using namespace std;
using namespace __gnu_pbds;
 
//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!
 
// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(1e9 + 7)
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long
 
//////////////////////
const int N = 100005;


int32_t main() {
 
    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);
	
	int tt = 1;
	// cin >> tt;

	while(tt--) {
		int sum=0;
		rep(i,3) {
			int a;
			cin>>a;
			sum += a;
		}
		if(sum>=22) cout << "bust\n";
		else cout << "win\n";
	}
}

		

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

using namespace std;

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

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

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

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

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

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int n, k;
	string s;
	cin>>n>>k>>s;
	REP(i, n){
		if(i+1==k){
			if(s[i]=='A'){
				cout<<'a';
			}
			if(s[i]=='B'){
				cout<<'b';
			}
			if(s[i]=='C'){
				cout<<'c';
			}
		}
		else{
			cout<<s[i];
		}
	}
	cout<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

void furui(char *a){
    int i,j;
    a[0]=0;
    a[1]=0;
    for(i=2;i<55556;i++){
        if(a[i])for(j=2;j*i<55556;j++)a[i*j]=0;
    }
    for(i=1;i<55556;i++)if(i%5!=1)a[i]=0;
}

int main(){
    int i,j,n,tmp;
    char a[55556];
    memset(a,1,sizeof(char)*55556);
    furui(a);
    scanf("%d",&n);
    j=0;
    for(i=2;j<n;i++){
        if(a[i]){
            printf("%d\n",i);
            j++;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H == 0 && W == 0) break;
           
            for(int i = 0; i < W; i++){
            	System.out.print("#");
            }
            System.out.println("");
            
            for(int i=1; i < H-1; i++){
            	System.out.print("#");
            	for(int j=1; j < W-1; j++){
            		System.out.print(".");
            	}
            	System.out.println("#");
            }
            
            if(H > 1){
            	for(int i=0; i < W; i++){
            	System.out.print("#");
            	}
            	System.out.println("");
            }
            System.out.println("");
        }
        sc.close();
    }
}


Measured memory_bytes: 33936
import Data.Char
import Control.Monad

parseInputLine :: String -> String -> [Int]
parseInputLine val [] = [read val]
parseInputLine val (' ':xs) = [read val] ++ parseInputLine "" xs
parseInputLine val (x:xs) = parseInputLine (val ++ [x]) xs

isBingo :: Int -> Int -> [Int] -> Bool
isBingo base step xs = v1 == 0 && v2 == 0 && v3 == 0
  where i1 = base
        i2 = base + step
        i3 = base + step*2
        v1 = xs!!i1
        v2 = xs!!i2
        v3 = xs!!i3

params = [
           (0, 3)
         , (1, 3)
         , (2, 3)
         , (0, 1)
         , (3, 1)
         , (6, 1)
         , (0, 4)
         , (2, 2)
         ]

check :: [Int] -> Bool
check xs = or [isBingo base step xs | (base, step) <- params]

bingoCard :: [Int] -> [Int] -> [Int]
bingoCard card bs = [if c `elem` bs then 0 else c | c <- card]

solve :: [Int] -> [Int] -> String
solve card bs = if check bc
                   then "Yes"
                   else "No"
                     where bc = bingoCard card bs

main :: IO ()
main = do
  line1 <- getLine
  line2 <- getLine
  line3 <- getLine
  n <- getLine
  bs <- replicateM (read n) getLine
  let card = (parseInputLine "" line1) ++ (parseInputLine "" line2) ++ (parseInputLine "" line3)
      output = solve card (map (read) bs)
  putStrLn output


Measured memory_bytes: 508
import time
import random


class TreapNode:
    def __init__(self, key, pri):
        self.left = None
        self.right = None
        self.key = key
        self.pri = pri


class Treap:
    def __init__(self):
        self.nil = TreapNode(None, 0)
        self.root = self.nil

    def search_lower(self, key):
        if key == None:
            return None
        ptr = self.root
        ret = None
        nil = self.nil
        while ptr is not nil:
            pk = ptr.key
            if pk < key:
                ret = pk
                ptr = ptr.right
            else:
                ptr = ptr.left
        return ret

    def search_higher(self, key):
        if key == None:
            return None
        ptr = self.root
        ret = None
        nil = self.nil
        while ptr is not nil:
            pk = ptr.key
            if pk > key:
                ret = pk
                ptr = ptr.left
            else:
                ptr = ptr.right
        return ret

    def insert(self, key):
        pri = random.randrange(1, 2**32)
        ptr = self.root
        elem = TreapNode(key, pri)
        if ptr.pri < pri:
            self.root = elem
        else:
            while True:
                if key < ptr.key:
                    left = ptr.left
                    if left.pri < pri:
                        ptr.left = elem
                        ptr = left
                        break
                    ptr = left
                else:
                    right = ptr.right
                    if right.pri < pri:
                        ptr.right = elem
                        ptr = right
                        break
                    ptr = right
        left = elem
        right = elem
        nil = self.nil
        while ptr is not nil:
            if key < ptr.key:
                right.left = ptr
                right = ptr
                ptr = ptr.left
            else:
                left.right = ptr
                left = ptr
                ptr = ptr.right
        left.right = nil
        right.left = nil
        elem.left, elem.right = elem.right, elem.left

# デバッグ用
    def dump(self):
        self.__dump(self.root, 0)

    def __dump(self, idx, dep):
        if idx is not self.nil:
            self.__dump(idx.right, dep + 1)
            for _ in range(0, dep):
                print("   ", end="")
            print([idx.key, idx.pri])
            self.__dump(idx.left, dep + 1)

def main():
    n = int(input())
    p = list(map(int, input().split()))
    idx = [0] * n
    for i in range(0, n):
        idx[i] = i
    idx.sort(key=lambda i: - p[i])
    t = Treap()
    t.insert(-1)
    t.insert(n)
    ans = 0
    for i in idx:
        nex = t.search_higher(i)
        nexnex = t.search_higher(nex)
        pre = t.search_lower(i)
        prepre = t.search_lower(pre)
        if prepre != None:
            ans += p[i] * (pre - prepre) * (nex - i)
        if nexnex != None:
            ans += p[i] * (i - pre) * (nexnex - nex)
        t.insert(i)
    print(ans)


main()


Measured memory_bytes: 83432
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=200005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int a=0,b=0,c=0,d=0;
    while(n--)
    {
        string s;
        cin>>s;
        if(s[0]=='A')
        a++;
        else if(s[0]=='W')
        b++;
        else if(s[0]=='T')
        c++;
        else
        d++;
    }
    cout<<"AC x "<<a<<"\n";
    cout<<"WA x "<<b<<"\n";
    cout<<"TLE x "<<c<<"\n";
    cout<<"RE x "<<d<<"\n";
}

Measured memory_bytes: 3644
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;


public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>(10);
		List<Integer> sub_list = new ArrayList<Integer>(10);
		
		for(int i = 0;i<n;i++){
			list.clear();
			sub_list.clear();
			
			for(int j=0;j < 10;j++){
				list.add(sc.nextInt());
			}
			
			
			for(Iterator<Integer> ite = list.iterator(); ite.hasNext();){
				int tmp = ite.next();
				if(sub_list.isEmpty()){
					sub_list.add(tmp);
					ite.remove();
				}else{
					if(sub_list.get(sub_list.size()-1) < tmp){
						sub_list.add(tmp);
						ite.remove();
					}
				}
			}
			
			boolean check = true;
			int pre_num = 0;
			for(Iterator<Integer> ite = list.iterator(); ite.hasNext();){
				int tmp = ite.next();
				if(pre_num >= tmp){
					check = false;
					break;
				}else{
					pre_num = tmp;
				}
			}
			
			System.out.println("" + (check ? "YES" : "NO"));
			
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <stdio.h>
#include <vector>
#include<algorithm>
using namespace std;



int main()
{
	int K, N,i,ans = 0;
	int a[200000];
	int tmp1, tmp2, a0, an;

	cin >> K >> N;

	for (auto i = 0; i < N; i++) {
		cin >> a[i];
	}
	a0 = a[0];
	an = a[N - 1];


	for (i = 0; i < N - 1; i++) {
		tmp1 = a[i];
		tmp2 = a[i + 1];
		a[i] = a[i + 1] - a[i];

	}

	a[N - 1] = K - an + a0;

	sort(a, a + N);


	for (i = 0; i < N -1; i++) {
		ans = ans + a[i];
	}

	cout << ans;




}



Measured memory_bytes: 1024
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }
}

fn enumerate_divisors(n: i64) -> Vec<i64> {
    let mut ret = Vec::new();
    let mut i = 1;
    while i * i <= n {
        if n % i == 0 {
            ret.push(i);
            if i * i != n {
                ret.push(n / i);
            }
        }
        i += 1;
    }
    ret
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n: i64 = sc.input();

    let mut count = 0;
    for i in 1..n + 1 {
        if i % 2 == 1 && enumerate_divisors(i).len() == 8 {
            count += 1;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 4352
a, b, c, x = map(int, [input() for _ in range(4)])

n_selection = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500 * i + 100 * j + 50 * k == x:
                n_selection += 1

print(n_selection)

Measured memory_bytes: 3060
#include<iostream>

int main()
{
  int a[3]={0}, buf;
  std::cin >> a[0] >> a[1] >> a[2];
  for(int i=0; i<2; i++){
    if(a[i] > a[i+1]){
      buf=a[i];
      a[i]=a[i+1];
      a[i+1]=buf;
    }
  }
  if(a[0] > a[1]){
    buf=a[0];
    a[0]=a[1];
    a[1]=buf;
  }
  std::cout << a[0] << ' '<< a[1] << ' '<< a[2] << std::endl;
  return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
/*vector<Type> v;
vector<Type> v();
vector<Type> v(n);
vector<Type> v(n, d);
vector<vector<Type>> vv;
vector<vector<Type>> vv();
vector<vector<Type>> vv(n);
vector<vector<Type>> vv(n, vector<Type>(m));
vector<vector<Type>> vv(n, vector<Type>(m, d));*/

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
  }
  int past_score = a[0];
  int now_score = a[k-1];
  for(int i=k;i<n;i++){
    past_score = a[i-k];
    now_score = a[i];
    if(now_score > past_score){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 4000
import copy

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


m = int(input())
px = []
for i in range(m):
    px.append([int(n) for n in input().split()])

for p, x in px:
    t_ = copy.copy(t)
    t_[p-1] = x
    print(sum(t_))

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


#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;

ll mod = 1e9 + 7ll;
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; }
const ll inf = 1ll << 60;

int main(){
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;
    if(e-a<=k) cout << "Yay!" << endl;
    else cout << ":(" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int H = sc.nextInt();
        int W = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();

        int black = 0;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (i < h || j < w) {
                    black++;
                }
            }
        }

        System.out.println(H * W - black);
    }
}


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

int main() {
  int W, H, N;
  cin >> W >> H >> N;
  int xs = 0, xe = W, ys = 0, ye = H;
  for (int i = 0; i < N; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    if (a == 1) xs = x > xs ? x : xs;
    else if (a == 2) xe = x < xe ? x : xe;
    else if (a == 3) ys = y > ys ? y : ys;
    else ye = y < ye ? y : ye;
  }
  int in_w, in_h;
  if (xs >= xe) in_w = 0;
  else in_w = xe - xs;
  if (ys >= ye) in_h = 0;
  else in_h = ye - ys;
  cout << in_w * in_h << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int mod=1e9+7;
int dp[50][1<<17];
int fow,S,ans;
int x,y,z;
int n;
int main()
{
    scanf("%d",&n);
    scanf("%d%d%d",&x,&y,&z);
    ans=1;
    for(int i=1;i<=n;i++)
        ans=1ll*ans*10%mod;
    S=(1<<x+y+z)-1;
    fow=(1<<x-1)|(1<<x+y-1)|(1<<x+y+z-1);
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=S;j++)
        {
            for(int k=1;k<=10;k++)
            {
                int T=(j<<k)|(1<<k-1);
                T&=S;
                if ((T&fow)!=fow) dp[i][T]=(dp[i][T]+dp[i-1][j])%mod;
            }
        }
    }
    for(int i=0;i<=S;i++)
        ans=(ans-dp[n][i]+mod)%mod;
    printf("%d\n",ans);
}


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

#define ll long long

signed main()
{
  int x,y,ok=0; cin>> x >> y;
  for(int i=0; i<x; ++i){
    if(2*i + 4*(x-i) == y){++ok; break;}
  }
  for(int i=0; i<x; ++i){
    if(4*i + 2*(x-i) == y){++ok; break;}
  }
  if(ok>0){
    cout<< "Yes";
  }else{
    cout<< "No";
  }
}

Measured memory_bytes: 3636
import Control.Monad
import Data.Maybe
import Data.Array
import Data.List
import Text.Printf
import qualified Data.IntMap.Strict as M
import qualified Data.ByteString.Char8 as C

getInts :: IO [Int]
getInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  [n, m] <- getInts
  hs <- getInts
  es <- replicateM m getInts
  let update v (Just vs) = Just (v : vs)
      graph = foldl' (\mp [u, v] -> M.alter (update u) v $ M.alter (update v) u mp) (M.fromList $ zip [1..n] $ repeat [])  es
      as = array (1, n) $ zip [1 .. n] hs
      ans = M.foldlWithKey' (\c u vs -> if all (< as ! u) (map (as !) vs) then c + 1 else c) (0 :: Int) graph
  printf "%d\n" ans


Measured memory_bytes: 64300
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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;}
const int P = 1000000007;
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z main.cpp
//.\a.exe

int main(void){ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////////////////
double w,h,x,y,a=0;
cin >> w >> h >> x >> y;
a=w*h/2;
if(w/2==x && h/2==y){
    cout << a << " " << 1 << endl; 
}
else{
    cout << a << " " << 0 << endl;
}
////////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256