akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <vector>
#include <set>
#include <algorithm>

int main()
{
    int64_t n, m;
    scanf("%" PRId64 " %" PRId64, &n, &m);

    int64_t k[10];
    int64_t s[10][10] = {};
    for (int64_t i = 0; i < m; i++)
    {
        int64_t kv;
        scanf("%" PRId64, &kv);
        k[i] = kv;

        for (int64_t j = 0; j < kv; j++)
        {
            int64_t sv;
            scanf("%" PRId64, &sv);
            s[i][sv - 1] = 1;
        }
    }
    int64_t p[10];
    for (int64_t i = 0; i < m; i++)
    {
        int64_t pv;
        scanf("%" PRId64, &pv);
        p[i] = pv;
    }

    int64_t numCount = 0;
    for (int64_t i = 0; i < 1 << n; i++)
    {
        // printf(" %" PRId64 ":\n", i);
        
        int64_t numOnLamp = 0;
        for (int64_t j = 0; j < m; j++)
        {
            int64_t numOnSwitch = 0;
            for (int64_t l = 0; l < n; l++)
            {
                int64_t b = (i >> l) & 1;
                numOnSwitch += b & s[j][l];
            }
            auto sw = numOnSwitch % 2;
            // printf("  %" PRId64 "\n", sw);

            if (sw != p[j])
            {
                break;
            }
            numOnLamp++;
        }
        if (numOnLamp == m)
            numCount++;
    }

    printf("%" PRId64 "\n", numCount);
    return 0;
}


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

#define ll  long long
#define pb push_back
#define mp make_pair
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,n) for(int i=1;i<=n;i++)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;
int h[100001];
int dp[100001];
int k;

int go(int n){
    if(n<=0) return INT_MAX;
    else if(n==1)return 0;
    else if(n==2) return abs(h[2]-h[1]);
    else {
        if(dp[n]!=-1){
            return dp[n];
        }else{
            int mi=INT_MAX;
            //dp[n]=min(go(n-1)+abs(h[n-1]-h[n]),go(n-2)+abs(h[n-2]-h[n]));
            for(int i=1;i<=k;i++){
               if(n-i>0) mi=min(mi,go(n-i)+abs(h[n-i]-h[n]));
                

            }
            dp[n]=mi;
            return dp[n];
        }  

    }  
}


int main() {
    
    int t, n, m;
    cin>>n>>k;
    memset(h,-1,sizeof(h));
    memset(dp,-1,sizeof(dp));

    Fo(i,n){
        cin>>h[i];
    }
    dp[1]=0;
    cout<<go(n)<<endl;
    return 0;
}




Measured memory_bytes: 5760
#include<stdio.h>
int A[500001];
 int n;
 int maxh(int i){
       int l=i*2;
       int r=i*2+1;

       int max;
       if(l<=n&&A[l]>A[i]){max=l;}
       else max=i;
       if(r<=n&&A[r]>A[max]){max=r;}

       if(max!=i){
               int tmp=A[i];A[i]=A[max];A[max]=tmp;
               maxh(max);
               }
       }

 int main(){
       int i;
       
       scanf("%d",&n);
       for(i=1;i<=n;i++){
                 scanf("%d",&A[i]);
                 }
       for(i=n/2;i>=1;i--){
                 maxh(i);
                 }
       for(i=1;i<=n;i++){
                 printf(" %d",A[i]);
                 }
       printf("\n");
       return 0;
       }


Measured memory_bytes: 3664
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

int search(const int64 *sum,const int ll,const int rr){
  int64 t=(sum[rr]-sum[ll-1])/2;
  int l=ll;
  int r=rr;
  while(l+1<r){
    int m=(l+r)/2;
    if(sum[m]-sum[ll-1]<=t){
      l=m;
    } else {
      r=m;
    }
  }
  int64 x=ABS(sum[l]-sum[ll-1]-(sum[rr]-sum[l]));
  int64 y=ABS(sum[r]-sum[ll-1]-(sum[rr]-sum[r]));
  return x<=y?l:r;
}

void run(void){
  int n;
  scanf("%d",&n);
  int *a=(int *)malloc(sizeof(int)*(n+1));
  int i;
  for(i=1;i<=n;i++) scanf("%d",a+i);
  int64 *sum=(int64 *)malloc(sizeof(int64)*(n+1));
  sum[0]=0;
  for(i=1;i<=n;i++) sum[i]=sum[i-1]+a[i];
  int64 min=sum[n];
  for(i=2;i<n;i++){
    int bc=search(sum,1,i);
    int de=search(sum,i+1,n);
    int64 b=sum[bc]-sum[0];
    int64 c=sum[i]-sum[bc];
    int64 d=sum[de]-sum[i];
    int64 e=sum[n]-sum[de];
    min=MIN(min,MAX(b,MAX(c,MAX(d,e)))-MIN(b,MIN(c,MIN(d,e))));
  }
  printf("%lld\n",min);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 2560
#14:03(3)
n,q = map(int,input().split())
peer = [[] for _ in range(n)]
for _ in range(n-1):
  a,b = map(lambda x: int(x)-1, input().split())
  peer[a].append(b)
  peer[b].append(a)
ans = [0 for _ in range(n)]
for _ in range(q):
  p,x = map(int,input().split())
  p -= 1
  ans[p] += x
ect = [0 for _ in range(n)]
ect[0] = 1
now = [0]
while now != []:
  last = now
  now = []
  for x in last:
    for y in peer[x]:
      if ect[y] == 0:
        now.append(y)
        ans[y] += ans[x]
        ect[y] = 1
print(' '.join(list(map(str,ans))))

Measured memory_bytes: 66964
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
ll mod = 1000000007;
ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    int n,x,ans=1,z=0;
    cin>>n>>x;
    vector<int> v(n);
    for(int i=0;i < n;i++)
    {
        cin>>v.at(i);
        z+=v.at(i);
        if(x>=z)ans++;
    }
    cout << ans << endl;
}


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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second

ll n,k,a[55];

ll solve(ll len)
{
    ll tmp=0 , rem , sum=0 , curSum=0;
    priority_queue<ll , vector<ll> , greater<ll> >q;

    for(int i=0; i<=len; i++)
    {
        while(q.size()) q.pop();
        sum=0;
        for(int j=1; j<=i; j++)
        {
            q.push(a[j]) , sum += a[j];
        }
        rem = len-i;
        for(int j=n; j>n-rem; j--)
        {
            q.push(a[j]) , sum += a[j];
        }
        rem = k-len;
        while(q.size() && q.top() <= 0 && rem)
        {
            rem--;
            sum -= q.top();
            q.pop();
        }
        tmp = max(tmp , sum);
    }
    return tmp;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n >> k;
    for(int i=1; i<=n; i++)
        cin >> a[i];

    ll ans = 0;
    for(int i=1; i<=min(n,k); i++)
    {
        ans = max(ans , solve(i));
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;

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

  string s, t;
  cin >> s >> t;
  cout << t << s << endl;
}


Measured memory_bytes: 256
#include <stack>
#include <queue>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <tuple>
#include <cmath>
#include <random>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <chrono>
#include <numeric>

#define fio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define rng mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count())

#define ri(...) i64 __VA_ARGS__; rx(__VA_ARGS__)
#define rc(...) char __VA_ARGS__; rx(__VA_ARGS__)
#define rs(...) string __VA_ARGS__; rx(__VA_ARGS__)
#define rvi(x, n) vi x(n); cin >> x
#define rvvi(x, n, m) vvi x(n, vi(m)); cin >> x

#ifndef ONLINE_JUDGE
#define dbg(...) cerr << '[' << #__VA_ARGS__ << "]: "; dbg_log(__VA_ARGS__)
#else
#define dbg(...) ;;
#endif

#define fa(i, v) for (auto &i : v)
#define fi(i, n) for (i32 i = 0; i < n; i++)
#define fp(i, n) for (i32 i = 1; i < n; i++)
#define fr(i, n) for (i32 i = n - 1; i >= 0; i--)
#define fu(i) ri(_i); fi(i, _i)

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

typedef uint32_t u32;
typedef int32_t i32;
typedef uint64_t u64;
typedef int64_t i64;
#ifdef __SIZEOF_INT128__
typedef __uint128_t u128;
typedef __int128_t i128;
#endif
typedef vector<i64> vi;
typedef vector<vi> vvi;

template<typename T>
inline istream &operator>>(istream &in, vector<T> &v) {
    fa(x, v) in >> x;
    return in;
}

template<typename T>
inline ostream &operator<<(ostream &out, const vector<T> &v) {
    fa(x, v) out << x << ' ';
    return out;
}

template<typename T>
inline void rx(T &x) {
    cin >> x;
}

template<typename T, typename... R>
inline void rx(T &x, R &... l) {
    cin >> x;
    rx(l...);
}

template<typename T>
inline void dbg_log(const T &x) {
    cerr << x << '\n';
}

template<typename T, typename... R>
inline void dbg_log(const T &x, const R &... l) {
    cerr << x << ", ";
    dbg_log(l...);
}

template<typename T>
inline void wl(const T &x) {
    cout << x << '\n';
}

template<typename T, typename... R>
inline void wl(const T &x, const R &... l) {
    cout << x << ' ';
    wl<R...>(l...);
}

int main() {
    fio;

    ri(n, m, k);
    vi a(n + 1);
    fi(i, n) {
        ri(x);
        a[i + 1] = a[i] + x;
    }
    vi b(m + 1);
    fi(i, m) {
        ri(x);
        b[i + 1] = b[i] + x;
    }

    i32 res = 0;
    i32 i = n;
    i32 j = 0;
    while (i >= 0) {
        while (i >= 0 && a[i] + b[j] > k) i--;
        while (j < m && a[i] + b[j + 1] <= k) j++;
        res = max(res, i + j);
        i--;
    }
    wl(res);

    return 0;
}


Measured memory_bytes: 6308
($A,$B,$C)=<>;
print
"@{[$A+0,$B+0,3*$C-$A-$B]}
@{[4*$C-2*$A-$B,$C+0,2*$A+$B-2*$C]}
@{[$A+$B-$C,2*$C-$B,2*$C-$A]}\n" 

Measured memory_bytes: 512
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld long double
#define   pb push_back
#define  sz(x)  (int)x.size()
#define  ff first
#define  ss second
#define  pii  pair<int,int>
using namespace std;

inline void solve(){ 
    int n;
    cin>>n;
    set <int> s;
    while (n--){
      int in; cin>>in;
      s.insert(in);
    }
    int l=(int)s.size();
    if ((n-l)&1)l--;
    cout << l << endl; 
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


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

typedef long long LL;

#define FOR(i, a, b) for (int i = (a), i##_END_ = (b); i <= i##_END_; i++)
#define DNF(i, a, b) for (int i = (a), i##_END_ = (b); i >= i##_END_; i--)

template <typename Tp> void in(Tp &x) {
	char ch = getchar(), f = 1; x = 0;
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') ch = getchar(), f = -1;
	while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	x *= f;
}

template <typename Tp> void out(Tp x) {
	if (x > 9) out(x / 10);
	putchar(x % 10 + '0');
	return;
}

template <typename Tp> Tp Max(const Tp &x, const Tp &y) {return x > y ? x : y;}
template <typename Tp> Tp Min(const Tp &x, const Tp &y) {return x < y ? x : y;}
template <typename Tp> bool chkmax(Tp &x, Tp y) {return x >= y ? 0 : (x=y, 1);}
template <typename Tp> bool chkmin(Tp &x, Tp y) {return x <= y ? 0 : (x=y, 1);}

const int MAXN = 100010;

int n, A[MAXN];
int tot[MAXN];

void wa()
{
	puts("No"); exit(0);
}

int main()
{
	in(n); FOR(i, 1, n) in(A[i]);

	int pos = -1;
	FOR(i, 2, n) if (A[i] != A[1]) pos = i;

	if (pos != -1) {
		if (A[pos] != A[1] + 1 && A[pos] != A[1] - 1) wa();
		FOR(i, pos + 1, n) if (A[i] != A[pos] && A[i] != A[1]) wa();
	}

	if (pos == -1) {
		if (A[1] + 1 != n) {
			if (A[1] * 2 > n) wa();
		}
	}
	else {
		int all = 0;
		if (A[pos] == A[1] + 1) all = A[pos];
		else all = A[1];

		int tot = 0;
		FOR(i, 1, n) if (A[i] == all - 1) tot++;
		if ((all - tot) * 2 + tot > n || n - tot < 2 || tot > all - 1) wa();
	}

	puts("Yes");
	
	return 0;
}


Measured memory_bytes: 640
import itertools
n,k=map(int,input().split())
bl=[0]*(10**5+1)
for i in range(n):
  a,b=map(int,input().split())
  bl[a]+=b
ans=list(itertools.accumulate(bl))
for i in range(len(ans)+1):
  if k<=ans[i]:
    print(i)
    break



Measured memory_bytes: 10632
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=998244353;
//const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
struct edge{ll from,to,cost;
edge(ll from,ll to,ll cost):from(from),to(to),cost(cost) {}
};
vector<edge> g;
ll d[200000];
int n,m;
void bell(int s=0){
      d[s]=0;
       for(int j=0;j<m;j++){
           edge e=g[j];
           if(d[e.from]!=inf&&d[e.to]>d[e.from]+e.cost){//infならば１から到達できない
               d[e.to]=d[e.from]+e.cost;
           }
       }
}
void check(int s=0){
       for(int j=0;j<m;j++){
           edge e=g[j];
           if(d[e.from]!=inf&&d[e.to]>d[e.from]+e.cost){
               d[e.to]=-inf;
           }
       }
}
int main(){
    ll p;
    cin>>n>>m>>p;
    for(int i=0;i<n;i++)d[i]=inf;
    for(int i=0;i<m;i++){
        ll a,b,c;
        cin>>a>>b>>c;
        g.emplace_back(a-1,b-1,p-c);
    }
    for(int i=0;i<n;i++)bell();
    for(int i=0;i<n;i++)check();
    cout<<(-d[n-1]>(1e16)?-1:(-d[n-1]>0?-d[n-1]:0))<<"\n";
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define il inline
#define sz(x) x.size()
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll min(ll a,ll b){if(a<b)return a;else return b;}
ll lowbit(ll x){return x&(-x);}
ll prime(ll x){
   if(x<=1)return false;
   for(int i=2;i<=int(sqrt(x));i++){
	   if(x%i==0)return false;
   }return true;
}
bool cmp(ll a,ll b){return a>b;}
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline ll read() {
	char c = getchar(); ll w = 1; ll x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar();
	x *= w;
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
		  dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
int main(){
	fast;
	ll a,b;
	cin>>a>>b;
	b*=2;
	if(a<=b)cout<<0<<endl;
	else cout<<a-b<<endl;
	return 0;
}/*『你强归你强，我永不示弱』*/




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 300005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pii pair<int,int>
const int mod = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a, b, k;
    int cur = 0;
    cin >> k >> a >> b;
    while(cur <= b) {
        cur += k;
        //cout << cur << endl;
        if (cur >= a && cur <= b) {
            cout << "OK\n";
            exit(0);
        }
    }
    cout << "NG\n";
}

Measured memory_bytes: 3652
//submitted by Himj
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;


const int mxn=2e3+1;
int loser=0;
string arr[mxn];
int par[mxn][mxn];
int n,m;
bool check(int i,int j)
{
  return i>=0 and j>=0 and i<n and j<m and par[i][j]==0;
}
int nx[]={0,0,1,-1};
int ny[]={1,-1,0,0};
void fill(int i,int j,char c)
{
  par[i][j]=loser;
  int k;
  fr(k,0,4)
  {
    int u=nx[k]+i;
    int v=ny[k]+j;
    if(check(u,v))
    {
      if(c=='.' and arr[u][v]=='#')
        fill(u,v,'#');
      else if(c=='#' and arr[u][v]=='.')
        fill(u,v,'.');
    }
  }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

  int t=1;
  //cin>>t;
    while(t--){
      cin>>n>>m;
      int i,j;
      fr(i,0,n)
        cin>>arr[i];
      loser=0;
      ms(par,0);
        fr(i,0,n)
        {
          fr(j,0,m)
          {
            if(arr[i][j]=='#' and par[i][j]==0)
            {
              loser++;
              fill(i,j,arr[i][j]);
            }
          }
        }
        int black[loser+1]={0},white[loser+1]={0};
        fr(i,0,n)
        {
          fr(j,0,m)
          {
           // cout<<par[i][j]<<" ";
            if(arr[i][j]=='#')
            black[par[i][j]]++;
          else white[par[i][j]]++;
          }
       //   cout<<"\n";
        }
        ll ans=0;
        fr(i,1,loser+1)
        {
          ans+=1ll*black[i]*white[i];
        }
        cout<<ans;
      
       
    }
  return 0;
  }



Measured memory_bytes: 28544
import java.util.Scanner;
import java.util.Arrays;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        long h[] = new long[n];
        for (int i = 0; i < h.length; i++) {
            h[i] = sc.nextLong();
        }
        Arrays.sort(h);
        long tag = n - k;
        sc.close();
        if (tag <= 0) {
            System.out.println(0);
            return;
        }
        long cnt = 0;
        for (int i = 0; i < tag; i++) {
            cnt += h[i];
        }
        System.out.println(cnt);

    }
}


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

vector<vector<char>> transpose(vector<vector<char>> A)
{
    int l = A.size(), m = A.at(0).size();

    vector<vector<char>> ret(m, vector<char>(l));

    rep(i, m)
    {
        rep(j, l)
        {
            ret.at(i).at(j) = A.at(j).at(i);
        }
    }

    return ret;
}

void print_matrix(vector<vector<char>> A)
{
    for (vector<char> row : A)
    {
        for (char ele : row)
        {
            cout << ele;
        }
        cout << endl;
    }
}

int main()
{
    int H, W;
    cin >> H >> W;

    vector<vector<char>> A(H, vector<char>(W));

    rep(i, H)
    {
        rep(j, W)
        {
            cin >> A.at(i).at(j);
        }
    }

    vector<vector<char>> A1;

    // compress row
    rep(i, H)
    {
        bool canCompress = true;

        rep(j, W)
        {
            if (A.at(i).at(j) == '#')
            {
                canCompress = false;
            }
        }

        if (!canCompress)
        {
            A1.push_back(A.at(i));
        }
    }

    // transpose and update sizes
    A1 = transpose(A1);
    H = A1.size();
    W = A1.at(0).size();

    vector<vector<char>> A2;

    // compress column
    rep(i, H)
    {
        bool canCompress = true;

        rep(j, W)
        {
            if (A1.at(i).at(j) == '#')
            {
                canCompress = false;
            }
        }

        if (!canCompress)
        {
            A2.push_back(A1.at(i));
        }
    }

    A2 = transpose(A2);

    print_matrix(A2);
}

Measured memory_bytes: 384
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int M = scan.nextInt();
        long H[] = new long[N];

        for(int i = 0; i < N; i++)
            H[i] = scan.nextLong();

        HashSet<Integer> set = new HashSet<>();
        for(int i = 0; i < N; i++)
            set.add(i);

        for(int i = 0; i < M; i++) {
            int a = scan.nextInt()-1;
            int b = scan.nextInt()-1;

            if(H[a] < H[b])
                set.remove(a);
            else if(H[a] > H[b])
                set.remove(b);
            else if(H[a] == H[b]) {
                set.remove(a);
                set.remove(b);
            }
        }

        os.println(set.size());
    }


}

Measured memory_bytes: 57492
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;

using int64 = long long;

const int MAX_N = 100000;

struct Interval {
    int64 left;
    int64 right;
    int id;
};

int N;
Interval intervals1[MAX_N], intervals2[MAX_N];

bool used[MAX_N];

int64 simulate(Interval *ivs1, Interval *ivs2) {
    int64 res = 0,
          cur = 0;
    int idx1 = 0,
        idx2 = 0;

    fill(used, used + N, false);

    auto nextPosition = [&](Interval& iv) {
        if (cur < iv.left) return iv.left;
        else if (cur > iv.right) return iv.right;
        else return cur;
    };

    while (true) {
        while (idx1 < N and used[ivs1[idx1].id]) idx1++;
        if (idx1 >= N) break;

        res += abs(cur - nextPosition(ivs1[idx1]));
        cur = nextPosition(ivs1[idx1]);
        used[ivs1[idx1].id] = true;

        // 進ませる
        while (idx2 < N and used[ivs2[idx2].id]) idx2++;
        if (idx2 >= N) break;

        res += abs(cur - nextPosition(ivs2[idx2]));
        cur = nextPosition(ivs2[idx2]);
        used[ivs2[idx2].id] = true;
    }
    res += abs(cur);
    
    return res;
}

int main() {
    cin >> N;

    for (int i = 0; i < N; i++) {
        int L, R;
        cin >> L >> R;

        intervals1[i] = intervals2[i] = { L, R, i };
    }

    sort(intervals1, intervals1 + N, [](const Interval& iv1, const Interval& iv2) {
        return iv1.left > iv2.left;
    });
    sort(intervals2, intervals2 + N, [](const Interval& iv1, const Interval& iv2) {
        return iv1.right < iv2.right;
    });

    /*
    cerr << "区間情報" << endl;
    for (int i = 0; i < N; i++) {
        cerr << intervals2[i].left << " " << intervals2[i].right << endl;
    }
    */

    int64 ans = max(simulate(intervals1, intervals2),
                    simulate(intervals2, intervals1));
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4992
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    String S = "";
    String A[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
    while(N>26){
      long tmp = (N-1L)%26;
      // if(tmp==-1L){
      //   tmp = 25L;
      // }
      S+=A[(int)tmp];
      N = (N -1L) /26L ;
      // System.out.println(N);
    }
    long tmp2 = N-1L;
    // if(tmp2==-1L){
    //   tmp2 = 25L;
    // }
    S+=A[(int)tmp2];
    StringBuffer str = new StringBuffer(S);
    String S2 = str.reverse().toString();
    System.out.println(S2);

  }
}

// 1000000000000001
// 9223372036854775807

Measured memory_bytes: 39792
N, C = map(int, input().split())
D = []
for _ in range(C):
    D.append(list(map(int, input().split())))
c = []
for _ in range(N):
    c.append(list(map(int, input().split())))
colors = [[0]*C for _ in range(3)]
for i in range(N):
    for j in range(N):
        colors[(i+j)%3][c[i][j]-1] += 1
ans = 10**10
for i in range(C):
    for j in range(C):
        if i==j:
            continue
        for k in range(C):
            if j==k or k==i:
                continue
            tmp = 0
            for l in range(C):
                tmp += colors[0][l]*D[l][i]
                tmp += colors[1][l]*D[l][j]
                tmp += colors[2][l]*D[l][k]
            ans = min(ans, tmp)
print(ans)

Measured memory_bytes: 11732
import Foundation

gets()
let a = getiA()
let res = a.lazy.reduce((0, 0)) { acc, num in
  return acc.1 > num ? (acc.0 &+ acc.1 &- num, acc.1) : (acc.0, num)
}
print(res.0)

@discardableResult
@inlinable @inline(__always) func gets() -> String { readLine()! }
@inlinable @inline(__always) func geti() -> Int    { Int(gets())! }
@inlinable @inline(__always) func getd() -> Double { Double(gets())! }

@inlinable @inline(__always) func getsA(_ c: Character = " ") -> [String] { gets().split(separator: c).map(String.init) }
@inlinable @inline(__always) func getiA(_ c: Character = " ") -> [Int]    { getsA(c).map { Int($0)! } }
@inlinable @inline(__always) func getdA(_ c: Character = " ") -> [Double] { getsA(c).map { Double($0)! } }

@inlinable @inline(__always)
func printf(_ format: String, _ args: CVarArg...) -> Void {
  print(String(format: format, arguments: args), terminator: "")
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // cout << fixed << setprecision(10);
    int n;
    cin >> n;
    rep(x, 1, 50000) {
        if (n == (int)(1.08 * (double)x)) {
            cout << x << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}

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

using namespace std;
#define set_precision(ans,l) cout << fixed << setprecision(l)<<ans;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repb(i, a, b) for (int i = a; i >= b; i--)
#define vi vector<int>
#define vl vector<long long int>
#define Vi vector<vector<int>>
#define vpi vector<pair<int,int>>
#define seti set<int>
#define setl set<ll>
#define dseti set<int, greater<int>>
#define dsetl set<ll, greater<ll>>
#define mseti multiset<int>
#define msetl multiset<ll>
#define dmseti multiset<int, greater<int>>
#define dmsetl multiset<ll, greater<ll>>
#define sortA(arr) sort(arr.begin(), arr.end())
#define dsortA(arr) sort(arr.begin(), arr.end(), greater<ll>())
#define ssort(arr) stable_sort(arr.begin(), arr.end())
#define nth(v,n) nth_element(v.begin,v.begin+n-1,v.end())
#define dnth(v,n) nth_element(v.begin,v.begin+n-1,v.end(), greater<ll>())
#define init(a)  memset((a),0,sizeof(a))
#define pi pair<int,int>
#define pb push_back
#define pl pair<ll,ll>
#define ll long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
long double EPS = 1e-9;

/*struct comp {
  bool operator() (const int& lhs, const int& rhs) const
  {return lhs<rhs;}
};*/

ll cel(ll a,ll b){return((a-1)/b+1);} 
ll gcd(ll a, ll b){
    if (a < b)swap(a, b);
    return (b == 0)? a: gcd(b, a % b);
}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll po(ll x,ll y){
    ll ans=1;
    while(y){
        if(y&1){ans=(ans*x)%mod;}
        y>>=1;x=(x*x)%mod;
    }
    return ans;
}

ll chk(string s,string s2,int l){
    ll x=0;
    rep(i,0,l){
        if(s[i]!=s2[i]){x++;}
    }
    return x;
}

int main()
{
    FIO;
    ll n,t,x,y,m=1001,k;
    string s1,s2;
    cin>>s1>>s2;
    x=s1.size(),y=s2.size();
    rep(i,0,x-y+1){
        string s=s1.substr(i,y);
        m=min(m,chk(s,s2,y));
    }
    cout<<m;
    return 0;
}

Measured memory_bytes: 3664
n, k = map(int, input().split())
tlist = list(map(int, input().split()))
check = [1]*n
town = 1
loop =[]
while bool(check[town-1]):
  check[town-1] = 0
  loop.append(town-1)
  town = tlist[town-1]
init = loop.index(town-1)
if k < init:
  print(loop[k]+1)
else:
  print(loop[init+(k-init)%(len(loop)-init)]+1)

Measured memory_bytes: 32204
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

int main() {
   int A, B;
   cin >> A >> B;
   int ans = 0;
   for (int i = A; i <= B; i++) {
      string s = to_string(i);
      if (s[0] == s[4] && s[1] == s[3]) ans++;
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
S = input()
Q = int(input())
turnover = False
suffix = ""
prefix = ""

for i in range(Q):
  TFC = input().split()
  T = int(TFC[0])
  if T == 1:
    # turn over
    turnover = not turnover
  elif T == 2:
    F = int(TFC[1])
    C = TFC[2]
    if turnover:
      if F == 1:
        F = 2
      else:
        F = 1
    if F == 1:
      prefix = prefix + C
      # put C before S
    elif F == 2:
      suffix = suffix + C
      # put C after S
S = prefix[-1::-1]+S+suffix
if turnover:
  S = S[-1::-1]

print(S)

Measured memory_bytes: 4280
<?php
  fscanf(STDIN, "%d %d %d", $x, $y, $z);

$a = $x;
$b = $y;
$c = $z;

//ABの入れ替え
$a = $y;
$b = $x;

//ACの入れ替え
$a = $z;
$b = $x;
$c = $y;
  echo $a.' '.$b.' '.$c;

Measured memory_bytes: 4728
n = int(input())
A = list(map(int, input().split()))

A = [0]+A+[0]

s = 0
for i in range(1, n+2):
    s += abs(A[i]-A[i-1])

for i in range(1, n+1):
    ans = s
    ans -= abs(A[i]-A[i-1])
    ans -= abs(A[i+1]-A[i])
    ans += abs(A[i+1]-A[i-1])
    print(ans)


Measured memory_bytes: 86752
//B - Hina Arare: 
//Assunto: 
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define loop(i, a, b) for(int i = a; i < b; i++)
#define loopBack(i, a, b) for(int i = a; i >= b; i--)
#define INF INT_MAX
#define LINF LLONG_MAX
#define DINF DBL_MAX
#define MAX 100005
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int n;
    set<char> bag;
    char c;
    cin >> n;
    loop(i, 0, n) {
        cin >> c;
        bag.insert(c);
    }
    if(bag.size() == 3) cout << "Three\n";
    else cout << "Four\n";
}

Measured memory_bytes: 256
/*ॐॐ*/
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different.
Change variable names or change some Data structres or anything just make sure MOSS do not
Detect Anything.
Yours Faithfully
Shobhit Yadav */
/*my variables are anime character */

/* I do not fear this new challenge. Rather like a true warrior I will rise to meet it. 
                                       -Prince Vegeta  */

 /* “Strength is the only thing that matters in this world. Everything else is just a delusion for the weak.” – Vegeta */

#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
#define vll vector<ll>
#define pll pair<ll , ll> 
#define vpll vector<pll>
#define umpll unordered_map<ll , ll>
#define mpll map<ll , ll>
#define sll set<ll>
#define stll stack<ll>
#define FIO  ios_base::sync_with_stdio(false);  cin.tie(0); cout.tie(0);

int main() {

  string s;
  cin >> s;

  
  string dream = "dream";
  string dreamer = "dreamer";
  string erase = "erase";
  string eraser = "eraser";

  reverse(s.begin(), s.end());
  reverse(dream.begin(), dream.end());
  reverse(dreamer.begin(), dreamer.end());
  reverse(erase.begin(), erase.end());
  reverse(eraser.begin(), eraser.end());

  string t = "";
  int next = 0;

  while (1) {
    if (next == s.size()) {
      cout << "YES" << endl;
      return 0;
    }
    int i = s.find(dream, next);
    if (i == next) {
      next += dream.size();
      continue;
    }
    i = s.find(dreamer, next);
    if (i == next) {
      next += dreamer.size();
      continue;
    }
    i = s.find(erase, next);
    if (i == next) {
      next += erase.size();
      continue;
    }
    i = s.find(eraser, next);
    if (i == next) {
      next += eraser.size();
      continue;
    }
    cout << "NO" << endl;
    return 0;
  }
}


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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}



int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>x(n);
  vector<ll>tw(32,1);
  rep(i,1,32){
    tw[i]=tw[i-1]*2;
  }
  rep(i,0,n)cin>>x[i];
  ll l,q;cin>>l>>q;
  vector<ll>a(q),b(q);
  rep(i,0,q){
    cin>>a[i]>>b[i];
    a[i]--;b[i]--;
  }
  auto next=vec(n,32,0LL);
  auto prev=vec(n,32,0LL);
  rep(i,0,n){
    next[i][0]=upper_bound(ALL(x),x[i]+l)-x.begin()-1;
    prev[i][0]=lower_bound(ALL(x),x[i]-l)-x.begin();
  }
  rep(i,1,32){
    rep(j,0,n){
      next[j][i]=next[next[j][i-1]][i-1];
      prev[j][i]=prev[prev[j][i-1]][i-1];
    }
  }
  //debug(next,n,5);
  rep(i,0,q){
    ll x=a[i];
    ll ret=0;
    if(a[i]<b[i]){
      while(x<b[i]){
        ll cnt=0;
        while(next[x][cnt]<b[i])cnt++;
        if(cnt>0)cnt--;
        ret+=tw[cnt];
        x=next[x][cnt];
        //cout<<x spa ret spa cnt<<endl;
      }
    }
    else{
      while(x>b[i]){
        ll cnt=0;
        while(prev[x][cnt]>b[i])cnt++;
        if(cnt>0)cnt--;
        ret+=tw[cnt];
        x=prev[x][cnt];

      }
    }
    cout<<ret<<endl;
  }
  return 0;
}

Measured memory_bytes: 61056
from collections import Counter

class UnionFind:
    def __init__(self, N):
        self.p = list(range(N))
        self.rank = [0] * N
        self.size = [1] * N

    def find_root(self, x):
        if self.p[x] != x:
            self.p[x] = self.find_root(self.p[x])

        return self.p[x]

    def same(self, x, y):
        return self.find_root(x) == self.find_root(y)

    def unite(self, x, y):
        u = self.find_root(x)
        v = self.find_root(y)

        if u == v: return

        if self.rank[u] < self.rank[v]:
            self.p[u] = v
            self.size[v] += self.size[u]
            self.size[u] = 0
        else:
            self.p[v] = u
            self.size[u] += self.size[v]
            self.size[v] = 0

            if self.rank[u] == self.rank[v]:
                self.rank[u] += 1

    def get_size(self, x):
        return self.size[self.find_root(x)]


n, K, L = map(int, input().split())
pq = [tuple(int(x)-1 for x in input().split()) for _ in range(K)]
rs = [tuple(int(x)-1 for x in input().split()) for _ in range(L)]

uk = UnionFind(n)
for p, q in pq:
    uk.unite(p, q)

ul = UnionFind(n)
for p, q in rs:
    ul.unite(p, q)

res = [uk.find_root(i) * 1000000 +  ul.find_root(i) for i in range(n)]
c = Counter(res)
ans = [0] * n

for i in range(n):
    ans[i] = c[res[i]]

print(*ans, sep=' ')



Measured memory_bytes: 75540
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <deque>
#include <map>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)
#define eep(i, lo, up) for ((i) = (lo); (i) < (up); ++(i))
#define eepp(i, lo, up) for ((i) = (lo); (i) <= (up); ++(i))

#define rdi(i) ll i; scanf("%lld", &i)
#define rds(s) string s; cin >> s
#define rdc(c) char c; cin >> c

#define INF 10000000000
#define MOD 1000000007

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

int main()
{
    ll n, m, x;
    cin >> n >> m >> x;
    vector<ll> cs(n);
    vector<vector<ll>> as(n);
    rep(i, n) {
        cin >> cs[i];
        as[i].resize(m);
        rep(j, m) {
            cin >> as[i][j];
        }
    }
    ll result = INF;
    rep(i, 1 << n) {
        ll price = 0;
        vector<ll> work(m, 0);
        for (ll j = 1, k = 0; j <= i; j <<= 1, ++k) {
            if (i & j) {
                price += cs[k];
                rep(l, m) {
                    work[l] += as[k][l];
                }
            }
        }
        if (find_if(work.begin(), work.end(), [x](ll w)
                    {
                        return w < x;
                    }) == work.end()) {
            result = min(result, price);
        }
    }
    if (result >= INF) {
        cout << "-1" << endl;
    } else {
        cout << result << endl;
    }
    return 0;
}

Measured memory_bytes: 3200
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        int C = Integer.parseInt(scanner.next());
        boolean a = A == B || B == C || A == C;
        boolean b = A != B || B != C;
        System.out.println((a && b) ? "Yes" : "No");
    }

}



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

int main(){
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    int ans = 0;
    
    if (A < K){
        ans += A;
        K -= A;
        if (B < K){
            ans -= K - B;
        }
    } else{
        ans += K;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<math.h>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod = 1e9 + 7;
typedef long long ll;

int main(){
   string s;
   cin >> s;
   int c_0 = 0;
   int c_1 = 0;
   rep(i,s.size()){
       if(s[i] == '0') c_0++;
       else c_1++;
   }
   cout << 2 * min(c_0, c_1) << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define SZ(x) ((int)(x).size())
#define VI vector<int>
#define PII pair<int, int>
#define trav(a,x) for (auto& a : x)
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 998244353;



int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, k; cin >> n >> k;
    vector<int> v(n);
    int i = 0, j = 0;
    for (; i < k; i++)
    {
        int a; cin >> a;
        v[i] = a;
    }
    vector<bool> res(n - k);
    for (; i < n; i++)
    {
        int a; cin >> a;
        if (a > v[j]) res[j] = 1;
        else res[j] = 0;
        v[i] = a;
        j++;
    }
    FOR(i, 0, n - k)
    {
        if (res[i]) cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 3976
#include<bits/stdc++.h>
#define ll long long
#define uint unsigned
#define ull unsigned ll
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a))
#define CPY(a,b) memcpy(a,b,sizeof(a))
using namespace std;
int n;
struct P{
	int x,y;
	ll operator *(const P &a)const{
		return 1ll*x*a.y-1ll*y*a.x;
	}
}a[205];
bool op(P a){
	if (a.x!=0) return a.x>0;
	return a.y>0;
}
bool cmp(P a,P b){
	if (op(a)!=op(b)) return op(a);
	//if (a*b!=0) return a*b<0;
	return a*b<0;
}
int main(){
	scanf("%d",&n);
	For(i,1,n){
		scanf("%d%d",&a[i].x,&a[i].y);
		if (!a[i].x&&!a[i].y) --i,--n;
	}
	sort(a+1,a+n+1,cmp);
	For(i,1,n) a[i+n]=a[i];
	ll mx=0;
	For(i,1,n){
		int Sx=0,Sy=0;
		For(j,i,i+n-1){
			Sx+=a[j].x;	Sy+=a[j].y;
			mx=max(mx,1ll*Sx*Sx+1ll*Sy*Sy);
		}
	}
	printf("%.15lf\n",sqrt(mx));
}
/*
(A+B)^2=v;
v-A^2=B^2+2AB

-2A+-b^2
*/

Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))

L = sorted(L, reverse=False)
cnt = 0

for i in range(N):
    l_i = L[i]
    for j in range(N-i):
        if L[i+j] != l_i:
            l_j = L[i+j]
            for k in range(N-i-j):
                if (L[i+j+k] != l_j) and (l_i + l_j > L[i+j+k]):
                    l_k = L[i+j+k]
                    cnt += 1
                    # print(i, i+j, i+j+k)
print(cnt)



Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i=0; i<N; i++) cin >> A[i];
  vector<ll> X(N); // 答え
  ll sum = 0; // sum:=A[1]+A[3]+\cdots+A[N-2]
  for (int i=1; i<N; i+=2) sum += A[i];
  X[0] = accumulate(A.begin(), A.end(), 0LL)-2*sum;
  // 漸化式
  for (int i=1; i<N; i++) X[i] = 2*A[i-1]-X[i-1];
  for (int i=0; i<N; i++) {
    if (i!=N-1) cout << X[i] << " ";
    else cout << X[i] << endl;
  }
}

Measured memory_bytes: 2944
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int t = 1; 
    // cin >> t; 
    while (t--) {
        int a[6];
        for(int i = 1; i <= 5; i++) {
            cin >> a[i];
            if(a[i] == 0)
                return cout << i, 0;
        }
        
    }
    
    return 0;
}



Measured memory_bytes: 3512
/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog ender-zzm.enbar.cn
*/
#include <bits/stdc++.h>
using namespace std;

inline int Isdigit(char c) {
	if (c < '0' || c > '9') return 0;
	return 1;
}
inline int readint(){
    register int x = 0, flag = 1;
    register char ch;
    while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), Isdigit(ch = getchar()));
	return x * flag;
}

inline long long readlong() {
	register long long x = 0, flag = 1;
	register char ch;
	while (!Isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), Isdigit(ch = getchar()));
	return x * flag;
}
template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10); 
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define For(i, x, y) for (int i = (x); i <= (y); i++) 
#define Rep(i, x, y) for (int i = (x); i >= (y); i--) 
#define ri readint
#define rl readlong

#define int long long
const int maxn = 2e5 + 30;
int n, d;
int ans = 0;
signed main() {
	 n = ri(), d = ri();
	 for (int i = 1; i <= n; i++) {
		 int x, y;
		 x = ri(), y = ri();
		 if (x * x + y * y <= d * d)  ans++;
		}
	 cout << ans;
}


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

using namespace std;

#define INF 10000

int main(void)
{
	int n, l;
	cin >> n >> l;
	/* int sum = 0;
	int ans = 0;
	int sub = INF;
	for (int i = l; i < l + n; ++i)
	{
		sum += i;
	}
	for (int i = l; i < l + n; ++i)
	{
		int bufn, bufn1;
		bufn = sum, bufn1 = sum - i;
		if (abs(bufn - bufn1) < sub)
		{
			sub = abs(bufn - bufn1);
			ans = bufn1;
		}
	}
	cout << ans << endl;*/
	int m = INF;
	int minus = 0;
	int sum = 0;
	for (int i = l; i < l + n; ++i)
	{
		sum += i;
		if (m > abs(i))
		{
			m = abs(i);
			minus = i;
		}
	}
	cout << sum - minus << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long int
#define lld double
#define vi vector<int>
#define pii pair<int,int>
#define piii pair<pii, ll>
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define ppb pop_back
#define d0(x) cout<<x<<" "
#define d1(x) cout<<x<<"\n"
#define d2(x,y) cout<<x<<" "<<y<<"\n"
#define d3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"
#define d5(x,y,z,w,s) cout<<x<<" "<<y<<" "<<z<<" "<<w<<" "<<s<<endl
using namespace std;
const ll mod = 1e9+7;
 

void init();
void solve(int T);
int main(int argc, char* argv[])
{
    ios_base::sync_with_stdio ( false );cin.tie(0);cout.tie(0);
    int t1=1;
    init();
    //cin>>t1;
    for(int T=1;T<=t1;T++)
    {
        solve(T);
    }
}



void init()
{

}
void solve(int T)
{
    ll N,K;
    cin>>N>>K;
    ll ans = 1;
    ll mlt = K;
    while(N>=mlt)
    {
        ans++;mlt*=K;
    }
    d1(ans);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a>b){
        cout << "a > b" << endl;
    }else if (a==b){
        cout << "a == b" << endl;
    }else{
        cout << "a < b" << endl;
    }
    return 0;
}


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

using namespace std;

int main() {
    long N, middle, answer;
    cin >> N;

    vector<long> A(N);

    for (long i = 0; i < N; ++i) {
        cin >> A[i];
        A[i] -= (i + 1);
    }

    sort(A.begin(), A.end());

    middle = A[N / 2];

    answer = 0;

    for (long i = 0; i < N; ++i) {
        answer += abs(A[i] - middle);
    }

    cout << answer << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

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

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

	auto y = x;
	sort(y.begin(), y.end());
	int b1 = y[n/2 - 1];
	int b2 = y[n/2];

	for (int i = 0; i < n; i++) {
		cout << (x[i] <= b1 ? b2 : b1) << endl;
	}


	return 0;
}


Measured memory_bytes: 3712