akhauriyash/Code-Regression huggingface dataset:
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
//cout<<setprecision(20)
//cin.tie(0);
//ios::sync_with_stdio(false);
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int LBI(vector<int>&ar,int in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
int UBI(vector<int>&ar,int in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	llint i,n,ans=0;cin>>n;
	vector<llint>a(n);
	for(i=0;i<n;i++){cin>>a[i];}
	for(i=0;i<n;i++){
		if(a[i]>i||(i+1!=n&&a[i+1]>a[i]+1)){cout<<-1<<endl;return 0;}
		if(i+1==n||a[i+1]!=a[i]+1){ans+=a[i];}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PGC
{
	class Program
	{
		static void Main(string[] args)
		{
			var header = Console.ReadLine().Split().Select(int.Parse).ToArray();
			var N = header[0];
			var Q = header[1];

			var queue = new Queue<Process>();
			for (int i = 0; i < N; i++)
			{
				var nq = Console.ReadLine().Split();
				var p = new Process { Name = nq[0], Time = int.Parse(nq[1]) };
				queue.Enqueue(p);
			}

			var t = 0;
			while (0 < queue.Count)
			{
				var p = queue.Dequeue();
				if (p.Time <= Q)
				{
					t += p.Time;
					System.Console.WriteLine($"{p.Name} {t}");
				}
				else
				{
					t += Q;
					p.Time -= Q;
					queue.Enqueue(p);
				}
			}
		}
	}

	class Process
	{
		public string Name { get; set; }
		public int Time { get; set; }
	}
}



Measured memory_bytes: 25040
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define MAX 200001
const int inf = 1e18;

int mn[2][1010], mx[2][1010];
int a[MAX], dp[2][1010];
signed main(){
	int n, m, k;
	fill((int*)dp, (int*)(dp+2), inf);
	fill((int*)mn, (int*)(mn+2), inf);
	scanf("%lld%lld%lld", &n, &m, &k);
	for(int i = 0;i < n;i++)scanf("%lld", &a[i]);
	
	dp[0][0] = k;
	mn[0][0] = mx[0][0] = a[0];
	for(int i = 1;i < n;i++){
		for(int j = 0;j < m;j++){
			mn[1][j] = inf;
			mx[1][j] = 0;
			dp[1][j] = inf;
		}
		for(int j = 1;j < m;j++){
			if(dp[0][j-1] == inf)continue;
			mn[1][j] = min(mn[0][j-1], a[i]);
			mx[1][j] = max(mx[0][j-1], a[i]);
			dp[1][j] = dp[0][j-1];
		}
		for(int j = 0;j < m;j++){
			if(dp[0][j] == inf)continue;
			int sum = dp[0][j]+(j+1)*(mx[0][j]-mn[0][j])+k;
			dp[1][0] = min(dp[1][0], sum);
			mx[1][0] = mn[1][0] = a[i];
		}
		for(int j = 0;j < m;j++){
			mn[0][j] = mn[1][j];
			mx[0][j] = mx[1][j];
			dp[0][j] = dp[1][j];
		}
	}
	
	int ans = dp[0][0];
	for(int i = 1;i < m;i++){
		int sum = dp[0][i]+(i+1)*(mx[0][i]-mn[0][i]);
		ans = min(ans, sum);
	}
	printf("%lld\n", ans);
	return 0;
}



Measured memory_bytes: 3432
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M; cin >> N >> M;
  vector<pair<int, int> > ans;
  int idx1 = 0, idx2 = M+1;
  int step = M;
  REP(i, (M+1)/2){
    ans.push_back({idx1+1, idx1+step+1});
    idx1++;
    step--;
    if(step == 0) continue;
    ans.push_back({idx2+1, idx2+step+1});
    idx2++;
    step--;
  }
  for(auto i : ans){
    cout << i.first << " " << i.second << endl;
  }
}

Measured memory_bytes: 4176
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
      	String T = sc.nextLine();
      	String tmp = T.substring(0,T.length()-1);	
      
        if (S.equals(tmp)){
        	System.out.println("Yes");
        }else{
          	System.out.println("No");
        }
	}
 
}

Measured memory_bytes: 35744
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
    int n, a, b, c, d;
	
	while(cin >> n){
		int count = 0;
		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				for(int k=0;k<10;k++){
				/*
					for(int l=0;l<10;l++){
						if(i+j+k+l==n){
							count++;
						}else if(i+j+k+l>n){
							break;
						}
					}
				*/
				if(n-(i+j+k)>=0 && n-(i+j+k)<10)
					count++;
				}
			}
		}
		cout << count <<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int N;

int count(int n, int used_3, int used_5, int used_7)
{
    int counter;
    
    if(n > N){
        return 0;
    }
    else{
        if(used_3 && used_5 && used_7){
            counter = 1;
        }
        else{
            counter = 0;
        }
        if(n <= (N / 10)){
            counter += count(n*10+3, 1, used_5, used_7);
            counter += count(n*10+5, used_3, 1, used_7);
            counter += count(n*10+7, used_3, used_5, 1);
        }

        return counter;
    }
}

int main(void)
{
    int ans = 0;
    scanf("%d", &N);

    ans += count(3, 1, 0, 0);
    ans += count(5, 0, 1, 0);
    ans += count(7, 0, 0, 1);

    printf("%d", ans);

    return 0;
}


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

#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
using intmap = map<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
const int MOD = 1e9 + 7;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
inline bool bit (ll b, ll i) { return b & (1 << i); }
inline ll ceiv (ll a, ll b) { return (a + b - 1) / b; }
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define debug(x) cerr << #x << ": " << x << '\n'
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()

template <class T>
class FenwickTree {
    vector<T> a;
    
public:
    FenwickTree(){};
    FenwickTree(int size) {
        a = vector<T>(size + 1, 0);
    }
    
    void add(int idx, T value) {
        idx++;
        while(0 <= idx && idx < a.size()){
            a[idx] += value;
            idx += idx & (-idx);
        }
    }
    
    int sum(int idx) {
        int ret = 0;
        idx++;
        while(idx > 0) {
            ret += a[idx];
            idx -= idx & (-idx);
        }
        return ret;
    }
    
    int sum(int l, int r){
        return sum(r-1) - sum(l-1);
    }
};

signed main() {
    int n, Q;
    cin >> n >> Q;
    
    FenwickTree<int> fw(n);
    rep(i,n){
        int a; cin >> a;
        fw.add(i, a);
    }
    
    while(Q--){
        int type; cin >> type;
        if(type == 0){
            int p, x;
            cin >> p >> x;
            fw.add(p, x);
        }else{
            int l, r;
            cin >> l >> r;
            cout << fw.sum(l, r) << endl;
        }
    }
}

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

typedef long long ll;
#define pb push_back
#define ii pair<int ,int >
#define vi vector<int >
#define vii vector < pair<int ,int > >
#define IO ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define IOfiles freopen("input.txt","r+",stdin) ; freopen("output.txt","w+",stdout)
#define PI 3.14159265
const double eps = 1e-9;


int main()
{
	IO;
	int x,y,z;
	cin>>x>>y>>z;
	cout<<z<<" "<<x<<" "<<y<<endl;
	
}



Measured memory_bytes: 256
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <queue>
#include <vector>
#define mod 1000000007
#define ll long long
#define pi acos(-1)
using namespace std;
const double INF = 1e20;

int main(){
	ios::sync_with_stdio(false);
	double m,n,sum=0;
	double a[105];
	cin>>n>>m;
	for(int i = 0; i < n; i++){
		cin>>a[i];
		sum+=a[i];
	}
	double p = sum/4/m;
	int t = 0;
	for(int i = 0; i < n; i++){
		if(a[i]>=p) t++;
	}
	if(t>=m) cout<<"Yes";
	else cout<<"No";
	
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        while(scn.hasNextInt()) {
            System.out.format("3C%02d\n", ((scn.nextInt() - 1) % 39 + 1));
        }
    }
}

Measured memory_bytes: 26508
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
template<typename T> inline void chkmin(T &a, const T &b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T &a, const T &b) { a = a > b ? a : b; }

const int MAXN = 25, MAXM = 1 << 19, MOD = 1e9 + 7;
int f[2][MAXM], g[2][MAXM], nxt[MAXN][MAXN], n, m, K;
inline void add(int &a, int b) { a += b - MOD, a += a >> 31 & MOD; }

int main() {
	scanf("%d%d%d", &n, &m, &K);
	memset(nxt, -1, sizeof(nxt));
	for (int i = 1; i <= K; i++) {
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		nxt[a][b - 1] = c;
	}
	f[0][0] = 1;
	for (int i = 1; i <= m; i++) {
		int *f1 = f[i & 1], *f0 = f[~i & 1];
		memcpy(g[1], f0, sizeof(g[1]));
		for (int j = 0; j < n - 1; j++) {
			int *g1 = g[j & 1], *g0 = g[~j & 1];
			memset(g1, 0, sizeof(g[0]));
			for (int k = 0; k < 1 << (n - 1); k++) if (g0[k]) {
				if (~k >> j & 1 && nxt[i][j] != 1) add(g1[k], g0[k]);
				if (nxt[i][j] != 0) {
					if (~k >> j & 1) {
						int t = k >> j;
						if (!t) { add(g1[k ^ 1 << j], g0[k]); continue; }
						add(g1[k ^ 1 << j ^ ((t & -t) << j)], g0[k]);
					} else add(g1[k], g0[k]);
				}
			}
		}
		memcpy(f1, g[n & 1], sizeof(g[0]));
	}
	int ans = 0;
	for (int i = 0; i < 1 << (n - 1); i++) add(ans, f[m & 1][i]);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    ll X,K,D,Y;
    cin>>Y>>K>>D;
    X=max(Y,-Y);
    ll ans;
    ll n=X/D;
    if(n>=K){ans=X-K*D;}
    else{
        X-=D*n;
        K-=n;
        ans=X;
        if(K%2==1)ans=X-D;
    }

    if(ans<0)ans*=-1;

    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
 
using namespace std;
 
int N, K, A[5000];
bool dp1[5002][5001];
bool dp2[5002][5001];
 
 
int main()
{
  cin >> N >> K;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    A[i] = min(A[i], K);
  }
 
  dp1[0][0] = true;
  for(int i = 0; i < N; i++) {
    for(int j = K; j >= A[i]; j--) {
      dp1[i + 1][j] |= dp1[i][j - A[i]];
    }
    for(int j = K; j >= 0; j--) {
      dp1[i + 1][j] |= dp1[i][j];
    }
  }
 
  dp2[N][0] = true;
  for(int i = N - 1; i >= 0; i--) {
    for(int j = K; j >= A[i]; j--) {
      dp2[i][j] |= dp2[i + 1][j - A[i]];
    }
    for(int j = K; j >= 0; j--) {
      dp2[i][j] |= dp2[i + 1][j];
    }
  }
 
  int ret = N;
  for(int i = 1; i <= N; i++) {
    bool flag = false;
    for(int j = K - A[i - 1]; j < K; j++) {
      for(int k = 0; k <= j; k++) {
        int other = j - k;
        if(0 <= other && other < K) {
          if(dp1[i - 1][k] && dp2[i][other]) {
            flag = true;
            break;
          }
        }
      }
      if(flag) break;
    }
    ret -= flag;
  }
 
  cout << ret << endl;
}

Measured memory_bytes: 49152
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  let
    f :: Int -> Int -> Int
    f i j = i * ((j - i) * (j + i) + j)
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  print . sum . map (uncurry f) . takeWhile (uncurry (<=)) . map ((,) <$> id <*> div n) $ [1..]

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 3780
#include <stdio.h>

#define abs(x) (((x)>0)?(x):-(x))
#define min(a, b) ((a)>(b)?(b):(a))

int main()
{
  int i, n;
  scanf("%d", &n);
  int h[n+1];
  int cost[n+1];
  for (i=0; i<n; i++)  scanf("%d", &h[i]);
  h[n] = h[n-1];
  cost[n] = cost[n-1] = 0;
  
  for (i=n-2; i>=0; i--)
    cost[i] = min(abs(h[i]-h[i+2])+cost[i+2], abs(h[i]-h[i+1])+cost[i+1]);

  printf("%d\n", cost[0]);

  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */


int main(const int argc, char * argv [])
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  size_t n, k;
  cin >> n >> k;
  vector<int64_t> a(n);
  cin >> a;
  partial_sum(a.begin(), a.end(), a.begin());

  int64_t mask = 0;
  for (int64_t b = 1LL << 40; b; b >>= 1) {
    size_t cnt = 0;
    mask |= b;
    for (size_t i = 0; i < n; ++i) {
      for (size_t j = i; j < n; ++j) {
        const int64_t acc = a[j] - (i ? a[i - 1] : 0);
        cnt += (acc & mask) == mask;
      }
    }
    if (cnt < k) mask ^= b;
  }

  cout << mask;

  return EXIT_SUCCESS;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int64_t INF=999999999;

int main() {
   int K,X;
   cin>>K>>X;
   for(int i=1;i<=2*K-1;i++){
   cout<<X-K+i;
   if(i<2*K-1){cout<<" ";}
   }
   cout<<endl;
return 0;}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  vector<int>s(N, -1);
  for (int i = 0; i < M; i ++) {
    int k, c;
    cin >> k >> c;
    if (s[N - k] != -1 && s[N - k] != c) {
      cout << -1 << endl;
      return 0;
    }
    s[N - k] = c;
  }
  if (s[N - 1] == -1) {
    if (N > 1) s[N - 1] = 1;
    else s[N - 1] = 0;
  }
  if (s[N - 1] == 0) {
    cout << (N == 1 ? 0 : -1) << endl;
    return 0;
  }
  for (int i = 0; i < N - 1; i ++) {
    if (s[i] == -1) s[i] = 0;
  }
  int ans = 0;
  for (int i = N - 1; i >= 0; i --) {
    ans *= 10;
    ans += s[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10,oo=0x3f3f3f3f;
struct data{
	int v,l,r;
	data(){};
	data(int v,int l,int r):v(v),l(l),r(r){};
	friend bool operator < (data a,data b){
		return a.v>b.v;
	}
};
int n,p[maxn];
//int a[2][maxn][18];
priority_queue<data> q;

struct Seg{
	int t[maxn<<2];
	#define mid (l+r>>1)
	#define ls u<<1
	#define rs u<<1|1
	#define lc ls,l,mid
	#define rc rs,mid+1,r
	#define rt 1,1,n
	void clear(){
		memset(t,0x3f,sizeof t);
	}
	void update(int u,int l,int r,int k,int v){
		if(l==r){
			t[u]=v;
			return;
		}
		if(k<=mid)update(lc,k,v);
		else update(rc,k,v);
		t[u]=min(t[ls],t[rs]);
	}
	int query(int u,int l,int r,int ql,int qr){
		if(ql<=l&&r<=qr){
			return t[u];
		}
		int ret=oo;
		if(ql<=mid)ret=min(ret,query(lc,ql,qr));
		if(qr>mid)ret=min(ret,query(rc,ql,qr));
		return ret;
	}
}a[2];

void solve(){
	scanf("%d",&n);
	memset(a,0x3f,sizeof a);
	for(int i=1,x;i<=n;++i){
		scanf("%d",&x);
		a[i&1].update(rt,i,x);
		//a[i&1][i][0]=x;
		p[x]=i;
	}
	//a[1].
	//RMQ_init(n,1);
	//RMQ_init(n,0);
	
	q.push(data(a[1].query(rt,1,n),1,n));
	for(int l,r,v1l,v1r,v2l,v2r,v1,v2,posl,posr;!q.empty();){
		l=q.top().l,r=q.top().r;
		v1=q.top().v;q.pop();
		v2=a[(p[v1]&1)^1].query(rt,p[v1]+1,r);
		//l=q.top().l,r=q.top().r;q.pop();
		//v1=RMQ(l,r,l&1);v2=RMQ(l,r,~l&1);
		//v1=a[l&1].query(rt,l,r);
		//v2=a[~l&1].query(rt,l,r);
		//v1=q.
		printf("%d %d ",v1,v2);
		posl=p[v1];posr=p[v2];
		if(l!=posl){
			q.push(data(a[l&1].query(rt,l,posl-1),l,posl-1));
			//q.push(data(RMQ(l,posl-1,l&1),l,posl-1));
		}
		if(posl+1!=posr){
			q.push(data(a[(posl+1)&1].query(rt,posl+1,posr-1),posl+1,posr-1));
			//q.push(data(RMQ(posl+1,posr-1,(posl+1)&1),posl+1,posr-1));
		}
		if(posr!=r){
			q.push(data(a[(posr+1)&1].query(rt,posr+1,r),posr+1,r));
			//q.push(data(RMQ(posr+1,r,(posr+1)&1),posr+1,r));
		}
	}
}
int main(){
	solve();
	
	return 0;
}


Measured memory_bytes: 9084
import java.io.BufferedReader; 
import java.io.*;
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.util.*;
import java.math.*;
public class Main 
{ 
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader()
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next()
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine();
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
   public static void main(String args[])
    {
        FastReader sc=new FastReader();
        PrintWriter pw=new PrintWriter(System.out);
        int t=1;//sc.nextInt();
        long mod=1000000007;
        while(t-->0)
        {
          int n=sc.nextInt(),k=sc.nextInt(),ans=0;
          long a[]=new long[n];
          for(int i=0;i<n;i++) 
          {
            a[i]=sc.nextLong();
          }
          for(int i=0;i<n-k;i++)
          {
              if(a[i]<a[i+k]) pw.println("Yes");
              else pw.println("No");
          }
        }
           pw.close();
    }
    static int gcd(int a,int b)
    {
        if(b==0) return a;
        return gcd(b,a%b);
    }
}
  

Measured memory_bytes: 56896
#include<iostream>
#define m 52000
using namespace std;

bool ba[m+1] = { true };
int cp(int x) {
	int co = 0;
	for (int i = 0; i < m+1; i++) {
		ba[i] = { true };
	}
	for (int i = 2; i*i <= 52000; i++) {
		if (ba[i]) {
			for (int j = i*i; j <= 52000; j += i) {
				ba[j] = { false };
			}
		}
	}
	for (int i = 2; i <x; i++) {
		if (ba[i]) {
			co = i;
		}
	}
	return co;
}

int main() {
	int n;
	while (cin >> n) {
		int a = cp(n);
		while (ba[n + 1] == false) {
			n++;
		}
		cout << a << ' ' << n + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3028
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll a[211][211];
int h, w;
ll dp[402][202][202];

void amax(ll &x, ll y)
{
	x=max(x,y);
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>h>>w;
	for(int i = 1; i <= h; i++)
	{
		for(int j = 1; j <= w; j++)
		{
			cin>>a[i][j];
		}
	}
	for(int i = 2; i <= h + w; i++)
	{
		for(int j = 1; j <= h; j++)
		{
			for(int k = 1; k <= h; k++)
			{
				if(j>=i||k>=i) continue;
				if(i-j>w||i-k>w) continue;
				dp[i][j][k] = max(max(max(dp[i-1][j-1][k-1], dp[i-1][j][k-1]), dp[i-1][j-1][k]), dp[i-1][j][k]);
				dp[i][j][k] += a[j][i-j] + a[k][i-k];
				if(j==k) dp[i][j][k]-=a[j][i-j];
			}
		}
	}
	cout << dp[h+w][h][h] << '\n';
}


Measured memory_bytes: 65152
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, n) for(int i=n; i>=0; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e18
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> T vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> T adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


map<ll, ll> a;

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

    ll n, aa;
    cin >> n;
    rep(i, n){
        cin >> aa;
        if(a.find(aa) == a.end()){
            a.insert(make_pair(aa, 1));
        }else{
            a[aa]++;
        }
    }

    ll res = 0;
    for(auto const& mp : a){
        if(mp.first != mp.second){
            if(mp.second > mp.first){
                res += mp.second - mp.first;
            }
            if(mp.second < mp.first){
                res += mp.second;
            }
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 6272
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 0xcccccccccccccccLL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

#define N (1<<17)+100
using uint = unsigned int;

//head


uint n, a, b;
uint ans[N];

void print() {
  rep(i, 1<<n) cout << ans[i] << (i == (1<<n)-1?'\n':' ');
}

void dfs(int keta, int l, uint _, uint __) {
  if(!keta) {
    ans[l] ^= __;
    ans[l+1] ^= __^1;
    return;
  }
  bool change = false;
  int z;
  uint x;
  if(~_>>keta&1) {
    change = true;
    rep(i, keta) if(_>>i&1) {
      x = (1<<keta) | (1<<i);
      z = i;
      break;
    }
    _ ^= x;
  }
  uint u = 1;
  if(_ == (1U^(1U<<keta))) u = 2;
  dfs(keta-1, l, u, __);
  l += 1<<keta;
  __ ^= u^(1<<keta);
  _ ^= u^(1<<keta);
  dfs(keta-1, l, _, __);
  if(change) {
    for(int i = l-(1<<keta); i < l+(1<<keta); i++) {
      uint y = ans[i] ^ __^u^(1<<keta);
      if((y>>z&1)^(y>>keta&1)) ans[i] ^= x;
    }
  }
}


int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> a >> b;
  if(~__builtin_popcount(a^b)&1) {
    cout << "NO\n";
    return 0;
  }
  dfs(n-1, 0, a^b, a);
  cout << "YES\n";
  print();
}

Measured memory_bytes: 4068
import java.io.*;
import java.util.*;



public class Main{
    public static void main(String[] args)throws IOException{
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String str;
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[]S = new int[n];
        for(int i=0;i<n;i++){
            S[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i=0;i<q;i++){
            T[i] = sc.nextInt();
        }

        int count = 0;
        for(int i=0;i<q;i++){
            for(int j=0;j<n;j++){
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            }
        }

        System.out.println(count);
    }    
}


Measured memory_bytes: 40236
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int T,D,L;
  while(cin >> T >> D >> L && T) {
    ll d[T+1];
    mem(d);
    rep(i,T) {
      int x;
      cin >> x;
      if(x>=L) {
        d[i+1]++;
        if(i+D+1<=T) d[i+D+1]--;
      }
    }
    REP(i,1,T) d[i+1]+=d[i];
    int ans=0;
    REP(i,1,T) if(d[i]) ans++;
    pr(ans);
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 3896
#include <stdio.h>
int main(){
  int n,i,x;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    x=i;
    if(x%3==0){
      printf(" %d",x);
    }
    else{
      while(x){
      if(x%10==3){ 
	printf(" %d",i);
        break;
      }
      x=x/10;
      }
    }
  }
    printf("\n");
  return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
	LL n,x;
	cin >> n >> x;
	LL ans = n;
	
	LL a = n-x, b = x;
	if(a<b) swap(a,b);
	while(b!=0) {
		LL k = a / b;
		ans += k * b * 2;
		LL tmp = a % b;
		a = b;
		b = tmp;
		
	}
	cout << ans - a << endl;
	
	
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
ll MOD = 1e9+7;
main(){
    ll N,M;
    cin >> N >> M;
    vector<ll> X(N),Y(M),accumX(N+1),accumY(M+1);
    rep(i,0,N){
        cin >> X[i];
        X[i] += 1e9;
        accumX[i+1] = (accumX[i] + X[i]) % MOD;
    }
    rep(i,0,M){
        cin >> Y[i];
        Y[i] += 1e9;
        accumY[i+1] = (accumY[i] + Y[i]) % MOD;
    }
    ll sumx = 0,sumy = 0;
    rep(i,0,N-1){
        sumx += (accumX[N] - accumX[i+1] - X[i] * (N-i-1) + MOD * MOD) % MOD;
        sumx %= MOD;
    }
    rep(i,0,M-1){
        sumy += (accumY[M] - accumY[i+1] - Y[i] * (M-i-1) + MOD * MOD) % MOD;
        sumy %= MOD;
    }
    cout << (sumx * sumy) % MOD << endl;
}

Measured memory_bytes: 3328
import random
import time
start=time.time()
h,w,m=map(int,input().split())
hh=[[0,i]for i in range(h)]
ww=[[0,i]for i in range(w)]
hw=set()
for _ in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  hh[a][0]+=1
  ww[b][0]+=1
  hw.add((a,b))
ww.sort(reverse=1)
s=ww[0][0]
w=[]
for x,j in ww:
  if x==s:w.append(j)
hh.sort(reverse=1)
t=hh[0][0]
hhh=[]
for x,i in hh:
  if x==t:hhh.append((x,i))
ans=[]
random.shuffle(w)
for j in w:
  for x,i in hhh:
    if (i,j) in hw:
      ans.append(s+x-1)
    else:
      exit(print(s+x))
  if time.time()-start>=1.7:
    m=ans[0]
    if h-50000<=len(hhh)<=h-random.randint(1,30):m+=1
    exit(print(m))
print(ans[0])

Measured memory_bytes: 187980
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
//#define biGinf 9e+18
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define inpv(v) for(auto &x:v) cin>>x
#define otpv(v) for(auto &x:v) cout<<x<<nwl
#define otpv2(v) for(auto &x:v) cout<<x<<" "
#define CASES int tt;cin>>tt; while(tt--)
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define sz(v) (int)(v).size()
#define vec(x) vector < x >
using vi = vector < int >;
using vvi = vector < vi >;
using pii = pair < int , int >;
using vpii = vector < pii >;
using int64 = long long;
//const int64 biGinf = 9e+18;
//const string yo = "YES", no = "NO";
const int inf = 2e9 + 7;
const char nwl = '\n';

int main() {
// #ifndef ONLINE_JUDGE
// 	if (fopen("input.txt", "r")) {
// 		freopen("input.txt", "r", stdin);
// 		freopen("output.txt", "w", stdout);
// 	}
// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ur code
	int n,k;
	cin>>n>>k;
	vi v(n);
	inpv(v);
	sort(all(v));
	int s=0;
	for0(i,k){
		s += v[i];
	}
	cout<<s;

	return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define rg register
#define ll long long
char s[101];
int main()
{
    cin>>s;
    int a,b;
    a=(s[5]-'0')*10+s[6]-'0';
    b=(s[8]-'0')*10+s[9]-'0';
    if(a<4||a==4&&b<=30) printf("Heisei");
    else printf("TBD");
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
const int maxn=100010;
int n,a[maxn],m,b[maxn],sum;
typedef long long ll;
int read(){
	char ch=getchar();
	int f=1,x=0;
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}
int lowbit(int x){
	return x&(-x);
}
int main(){
	cin>>n>>m;
	for(int i=1;i<=m;i++) cin>>a[i];
	sort(a+1,a+m+1);
	for(int i=1;i<=m-1;i++) b[i]=a[i+1]-a[i];
	sort(b+1,b+m);
	for(int i=1;i<=m-n;i++) sum+=b[i];
	cout<<sum<<endl;
	return 0;
}


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

int N;
int A[100000];
int main()
{
    //ifstream in("subtask_1_02.txt");
    //cin.rdbuf(in.rdbuf());
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    int counter = 0;
    for (int i = 0; i < N; i++){
        while (i+1 < N && A[i] == A[i+1]) i++;

        if (i+1 < N && A[i] < A[i+1]){
            while (i+1 < N && A[i] <= A[i+1]) i++;
        }

        else if (i+1 < N && A[i] > A[i+1]){
            while (i+1 < N && A[i] >= A[i+1]) i++;
        }

        counter++;
    }
    cout << fixed << setprecision(10) << counter << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n;
        while ((n = scanner.nextInt()) != 0) {
            int data[] = new int[n];
            for (int i = 0; i < n; i++) {
                data[i] = scanner.nextInt();
            }
    
            int sum = 0;
            for (int i = 0; i < n; i++) {
                sum += data[i];
            }
            double m = (double)sum / n;
            double a2 = 0;
            for (int i = 0; i < n; i++) {
                double d = data[i] - m;
                a2 += d*d;
            }
            a2 /= n;
            double a = Math.sqrt(a2);
            System.out.println(a);
        }
    }
}


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

#define ll long long
#define ld long double
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
//#define int long long

using namespace std;
const int INF = 1e15;
const int MB = 30;
const int MOD = 1e9 + 7;

void solve() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int cnt1 = 0, cnt2 = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'W') cnt2++;
		else cnt1++;
	}

	int bad1 = 0, bad2 = 0;
	for (int i = 0; i < n; i++) {
		if (i < cnt1 && s[i] == 'W') bad1++;
		if (i >= cnt1 && s[i] == 'R') bad2++;
	}
	if (bad1 < bad2) swap(bad1, bad2);
	cout << bad1;
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	srand(time(0));
	int t = 1;
	//int t;
	//cin >> t;
	while (t--) solve();
}

Measured memory_bytes: 3772
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
int main() {
	int c[3][3];
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) cin >> c[i][j];
	}
	if (c[0][1] - c[0][0] == c[1][1] - c[1][0] && c[2][1] - c[2][0] == c[1][1] - c[1][0] && c[0][2] - c[0][1] == c[1][2] - c[1][1] && c[2][2] - c[2][1] == c[1][2] - c[1][1]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll    long long
#define F     first
#define S     second
#define pb    push_back
#define mp    make_pair
#define mod   1000000007
#define vlli  vector<ll>
#define vi    vector<int>
#define vs    vector<string>
#define vplli vector< pair< ll, ll> >
#define plli  pair< ll, ll >
#define vps   vector< pair< string, string> >
#define vpi   vector< pair< int, int> >
#define all(x)           x.begin(), x.end()
#define fast  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define forn(i, a, n)    for (ll i = a; i < n; i++)
#define scan(arr, a, n)  for (ll i = (a); i < (n); i++) cin >> (arr)[i];
#define print(arr, a, n) for (ll i = (a); i < (n); i++) cout << (arr)[i] << " ";

ll add(ll x, ll y) {
    ll res = x + y; return (res >= mod ? res - mod : res);
}
ll mul(ll x, ll y) {
    ll res = x * y; return (res >= mod ? res % mod : res);
}
ll sub(ll x, ll y) {
    ll res = x - y; return (res < 0 ? res + mod : res);
}
ll power(ll x, ll y) {
    ll res = 1; x %= mod; while (y) {

        if (y & 1) res = mul(res, x); y >>= 1; x = mul(x, x);
    }
    return res;
}
ll mod_inv(ll x) {
    return power(x, mod - 2);
}


int main(){
    fast;

    #ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif
    ll n, m;
    cin >> n >> m;
    ll a[n], x = 0;
    for (int i = 0; i < m; i++) {
        cin >> a[i];
        x += a[i];
    }
    ll z = n - x;
    cout << max(z, -1ll) << endl;

}

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

long t1,t2,a1,a2,b1,b2,ans=0;


int main() {
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
  if(a1>b1) {
    swap(a1,b1);
    swap(a2,b2);
  }
  if((t1*a1)+(t2*a2)>(t1*b1)+(t2*b2)) {
    ans=((b1-a1)*t1)/((a1-b1)*t1+(a2-b2)*t2)*2;
    if(((b1-a1)*t1)%((a1-b1)*t1+(a2-b2)*t2)!=0) ans++;
  }
  if((t1*a1)+(t2*a2)==(t1*b1)+(t2*b2)) {
    ans=-1;
  }
  if(ans>=0) cout << ans << endl;
  else cout << "infinity" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int N=2e5+5;
unordered_map<string,int> cnt;
int n;
string s[N];

bool cmp(string x,string y){
	if(cnt[x]==cnt[y]) return x<y;
	return cnt[x]>cnt[y];
}

signed main(){
	read(n);
	for(int i=1;i<=n;i++){
		cin>>s[i];
		cnt[s[i]]++;
	}
	sort(s+1,s+1+n,cmp);
	for(int i=1;i<=n;i++) if(s[i]!=s[i-1]&&cnt[s[i]]==cnt[s[1]]) cout<<s[i]<<endl;
}

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

typedef long long ll;
#define endl "\n"
#define deb(x) cerr << #x << ":" << x << "\n"

void solve(){
    ll n,k;
    cin>>n>>k;
    vector<ll> v(n);
    for(auto &x:v)cin>>x;
    vector<ll> dp(n,INT64_MAX);
    dp[0]=0;
    for(int i=1;i<n;i++){
        for(int j=i-1;j>=max(i-k,0LL);j--){
            dp[i]=min(dp[j]+abs(v[j]-v[i]),dp[i]);
        }
    }
    cout<<dp[n-1];
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.nextLine());
		if (n % 2 == 0) {
			System.out.println(n);
		} else {
			System.out.println(n * 2);
		}
		in.close();
	}

}

Measured memory_bytes: 23252
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;

using namespace std;

int main() 
{
    int a, b, x;
    cin >> a >> b >> x;

    if((a<=x) && (x <= a+b)) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}
    



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

int main() {
  int a, b, c;// a:支払金額、b:一円玉の枚数、c:端数
  cin >> a >> b;
  
  c = a % 500;
  if (c <= b) {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<math.h>
#include<queue>
#include<stdio.h>
#include<stdlib.h>
#include<stack>
#include<string>
#include<vector>

using namespace std;
int main(void) {
	char str[3] = "\0";
	scanf("%s", str);
	printf("%s\n", str[0] == str[2] ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 504
using System;
using System.Collections;
 
namespace myApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int cnt = int.Parse(Console.ReadLine());
            ArrayList input = new ArrayList();
            int max = 0;

            for (int i = 0; i < cnt;i++)
            {
                int a = int.Parse(Console.ReadLine());
                input.Add(a);

                if (max < a)
                {
                    max = a;
                }
            }

            int sumAmt = 0;
            bool useFlg = false;
            foreach (int p in input)
            {
                if (max == p && !useFlg)
                {
                    sumAmt = sumAmt + (p / 2);
                    useFlg = true;
                }
                else
                {
                    sumAmt = sumAmt + p;
                }
            }
          Console.WriteLine(sumAmt);
        
        }
    }
}

Measured memory_bytes: 13140
#include "bits/stdc++.h"
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define sz(a) int((a).size())
	#define pb push_back
	#define mod 1000000007
	#define inf 1000000000000000001
	#define all(c) (c).begin(),(c).end()
	#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
	#define present(c,x) ((c).find(x) != (c).end())
	#define cpresent(c,x) (find(all(c),x) != (c).end())
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	#define FOR(i, a, b) for (int i=a; i<(b); i++)
	#define F0R(i, a) for (int i=0; i<(a); i++)
	
	using namespace std;
	
	int main()
	{
		ios::sync_with_stdio(0);
    	cin.tie(0);
    	cout.tie(0);

		ll a,b;
		cin >> a >> b;
		ll ans=0;
		if(a<(b*2)) ans=0;
		else ans = a-(b*2);
		cout << ans << endl;
		
		return 0;
	}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    int N, K;
    cin >> N >> K;
    ll h[N];
    REP(i, N) cin >> h[i];

    sort(h, h + N);

    ll m = h[K - 1] - h[0];

    FOR(i, K, N) {
        ll t = h[i] - h[i - (K - 1)];
        if (t < m) m = t;
    }

    cout << m << endl;

    return 0;
}


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

using namespace std;

const int N = 55;

int n, a[N], b[N];
long long res;
vector<int> del[N];
vector< vector<int> > vec[N];
vector<int> buffer;

void backtrack(int id, int current) {	
	if (current < b[id]) return;
	if (current == b[id]) {
		vec[id].push_back(buffer); return;
	}
	for (int i = current; i >= 1; --i) {
		buffer.push_back(i);
		backtrack(id, current % i);
		buffer.pop_back();
	}
}

int main() {
	cin >> n;
	for (int i = 0; i < n; ++i) cin >> a[i];
	for (int i = 0; i < n; ++i) cin >> b[i];
	for (int i = 0; i < n; ++i) {
		backtrack(i, a[i]);
		if (!vec[i].size()) {
			cout << -1; return 0;
		}
		del[i].assign(vec[i].size(), 0);
	}
	for (int i = 50; i >= 1; --i) {
		bool flag = 0;
		for (int j = 0; j < n; ++j) {
			int cnt = 0;
			for (int k = 0; k < vec[j].size(); ++k) {
				del[j][k] = 0;
				for (auto l : vec[j][k]) del[j][k] |= l == i;
				cnt += del[j][k];
			}
			flag |= cnt == vec[j].size();
		}
		if (flag) {
			res += 1LL << i; continue;
		}
		for (int j = 0; j < n; ++j) {
			vector< vector<int> > tmp = vec[j];
			vec[j].clear();
			for (int k = 0; k < tmp.size(); ++k) {
				if (del[j][k]) continue;
				vec[j].push_back(tmp[k]);
			}
		}
	}
	cout << res;
}

Measured memory_bytes: 1152
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        char c = s.toCharArray()[0];

        if (Character.isUpperCase(c)) {
            System.out.println("A");
        } else {
            System.out.println("a");
        }
    }
}

Measured memory_bytes: 35448
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
int A,B,C,D,p;
int main()
{
	cin >> A;
	cin >> B;
	cin >> C;
	cin >> D;
	cin >> p;
	int X=0,Y=0;
	X = A*p;
	Y = B;
	if(p>C)Y += (p-C)*D;
	cout << min(X,Y) << endl;
	return 0;
}

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

int main() {
	int N;
    string S;
    int count=0;
    cin>>N>>S;
    for(int i=0;i<N-2;i++){
    	if(S.at(i)=='A'&&S.at(i+1)=='B'&&S.at(i+2)=='C'){
    		count++;
    	}
    	
    }
    cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
def gcd(a, b):
        while b:
                a, b = b, a % b
        return a
def lcm(a, b):
    return a * b // gcd (a, b)

x,y = map(int, input().split())
temp = x
if x == y:
    print(-1)
    sys.exit()
while True:
    temp += x
    if temp % y != 0:
        print(temp)
        sys.exit()
    elif temp > lcm(x, y):
        print(-1)
        sys.exit()

Measured memory_bytes: 3064
import Control.Monad
import Control.Applicative
import Data.List


-- [a] <- map read . words <$> getLine => [1] -> a == 1
-- 1
-- a <- readLn
-- 1 2 3
-- lst <- map read . words <$> getLine => [1, 2, 3]
-- 1 2 3
-- [l, m, n] <- map read . words <$. getLine :: IO [Int] => [1, 2, 3]
-- 'a'
-- c <- getChar => c == 'a'
--
-- slst <- replicateM h getLine

-- getBysplit = map read . words <$> getLine

main :: IO()
main = do
  n <- readLn :: IO Int
  plst <- replicateM n readLn :: IO [Int]
  let x:xs = (reverse . sort) plst
  let ans = x `div` 2 + sum xs
  print ans


Measured memory_bytes: 508
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: ty),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n: usize, q: usize, s: String, mut td: [(String, String); q]);
    td.reverse();
    let mut s = s
        .chars()
        .map(|x| x.to_string())
        .collect::<std::collections::VecDeque<_>>();
    s.push_front("a".into());
    s.push_back("a".into());
    let mut l = 0;
    for i in 0..q {
        let (t, d) = td[i].clone();
        if t == s[l] && d == "R" {
            l -= 1;
        }
        if t == s[l + 1] && d == "L" {
            l += 1;
        }
    }
    let mut r = n + 1;
    for i in 0..q {
        let (t, d) = td[i].clone();
        if t == s[r] && d == "L" {
            r += 1;
        }
        if t == s[r - 1] && d == "R" {
            r -= 1;
        }
    }
    println!("{}", r - l - 1);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 28924