akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=998244353;


main(){
    int n=in();
    vector<ll> a,b;
    rep(i,n)a.pb(in());
    rep(i,n)b.pb(in());
    ll ans=0;
    int p=0;
    int last=n-1;
    while(1){
        int pre=(p-1+n)%n,next=(p+1)%n;
        if(b[pre]+b[next]<b[p]&&b[p]!=a[p]){
            ll t=(b[p]-a[p])/(b[pre]+b[next]);
            b[p]-=t*(b[pre]+b[next]);
            ans+=t;
            if(t)
            last=p;
            if(t==0&&last==p)break;
            if(b[p]<a[p])break;
        }
        else if(last==p)break;
        p=(p+1)%n;
    }
    if(a==b){
        cout<<ans;
    }
    else cout<<-1;
}


Measured memory_bytes: 6000
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

struct edge{int to,cost;};

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

	int x,y;
	cin >> x >> y;

	int ans=2*INF;
	if(x<=y){
		ans = min(y-x,ans);
	}
	if(x<=-y){
		ans = min(-y-x+1,ans);
	}
	if(-x<=y){
		ans = min(y+x+1,ans);
	}
	if(-x<=-y){
		ans = min(-y+x+2,ans);
	}
	cout << ans << "\n";

	return 0;
}

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

const int INF = 1001001001;
//const ll INF = 1000000000000000000;

ll a, b, v, w, t;

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

	vector<int> diff(102, 1);
	rep(i,n) {
		int p;
		cin >> p;
		diff[p] = 0;
	}
	diff[0] = x;
	diff[101] = 101 - x;
	rep(i, 102) {
		if (i == 0 or i == 101) continue;
		if (diff[i]) { diff[i] = abs(x - i); continue; }
		diff[i] = INF;  
	}
	int ans, tmp = INF;
	for (int i = 101; i >= 0; i--) {
		if (tmp >= diff[i]) {
			tmp = diff[i];
			ans = i;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
using namespace std;
struct Point { long double px, py; };
struct Line { Point p1, p2; };
Point Minus(const Point&a, const Point&b) { return{ a.px - b.px,a.py - b.py }; }
Point Plus(const Point&a, const Point&b) { return{ a.px + b.px,a.py + b.py }; }
Point Times(const Point&a, const long double&b) { return{ a.px *b,a.py *b }; }
long double norm(const Point& a) { return a.px * a.px + a.py * a.py; }
long double abs(const Point& a) { return sqrtl(norm(a)); }
long double arg(const Point& a) { return atan2l(a.py, a.px); }
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
int ccw(const Point& p0, const Point& p1, const Point& p2) {
	Point a = Minus(p1, p0), b = Minus(p2, p0);
	if (crs(a, b) > 1e-10) return 1;
	if (crs(a, b) < -1e-10) return -1;
	if (dot(a, b) < -1e-10) return 2;
	if (norm(a) < norm(b)) return -2;
	return 0;
}
bool its(const Point& p1, const Point& p2, const Point& p3, const Point& p4) {
	return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}
Point crp(Line a, Line b) {
	Point c = Minus(b.p2, b.p1);
	long double d1 = abs(crs(c, Minus(a.p1, b.p1)));
	long double d2 = abs(crs(c, Minus(a.p2, b.p1)));
	return Plus(a.p1, Times((Minus(a.p2, a.p1)), (d1 / (d1 + d2))));
}
int n, o[1000], l[1000]; Line p, x[1000];
vector<tuple<long double, long double, int>>vec;
int main() {
	int t; cin >> t;
	for (int i = 0; i < t; i++) {
		cin >> p.p1.px >> p.p1.py >> p.p2.px >> p.p2.py; vec.clear();
		cin >> n;
		for (int i = 0; i < n; i++) {
			cin >> x[i].p1.px >> x[i].p1.py >> x[i].p2.px >> x[i].p2.py >> o[i] >> l[i];
			if (its(p.p1, p.p2, x[i].p1, x[i].p2) == true) {
				vec.push_back(make_tuple(crp(p, x[i]).px, crp(p, x[i]).py, (o[i] + l[i] + 1) % 2));
			}
		}
		sort(vec.begin(), vec.end());
		int cnt = 0;
		for (int i = 1; i < vec.size(); i++) {
			if (get<2>(vec[i]) != get<2>(vec[i - 1]))cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 3152
#include <stdio.h>
int main(void){
    int n,a[110000],ans=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(int i=0;i<n;i++){
        if(a[a[i]-1]==i+1)ans++;
    }
    printf("%d\n",ans/2);
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void){
	int n, s, a;

	scanf("%d", &n);

	a = n;
	s = 0;
	while(a/10 != 0){
		s += a % 10;
		a = a / 10;
	}
	s += a % 10;
	if(n % s == 0)
		printf("Yes\n");
	else
		printf("No\n");

	return 0;
}


Measured memory_bytes: 128
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
Mod = 1000000007



def main(): #startline-------------------------------------------
    N = int(input())
    P = list(map(int,input().split()))
    Psample = [i for i in range(1,N+1)]
    cnt = 0
    if P == Psample:
        print("YES")
        exit()
    for i in range(N):
        if P[i] != Psample[i]:
            cnt += 1
        else:
            pass
    if cnt != 2:
        print("NO")
        exit()
    else:
        P.sort()
        if set(P) == set(Psample):
            print("YES")
        else:
            print("NO")


if __name__ == "__main__":
    main() #endline===============================================




def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

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

int main() {
	int n;
	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++;
					}		
				}
			}
		}
	cout << count << endl;
	}
	return 0;
}


Measured memory_bytes: 2996
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N , K, x = 1;
  cin >> N >> K;
 for (int i = 0; i < N ; i++ ) {
   if (x < K){
  x*=2;
 }
   else {
     x+=K;         
  }
 }
   cout << x << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

def main():
    h, w, d = map(int, input().split())
    a = [list(map(int, input().split())) for i in range(h)]
    loc = [None for i in range(h * w + 1)]
    for i in range(h):
        for j in range(w):
            loc[a[i][j]] = (i, j)

    f = [None for i in range(h * w + 1)]
    for x0 in range(h * w):
        x1 = x0 + 1
        if x1 <= d:
            f[x1] = 0
        else:
            r1, l1 = loc[x1]
            r2, l2 = loc[x1 - d]
            f[x1] = f[x1 - d] + abs(r1 - r2) + abs(l1 - l2)

    q = int(input())
    for i in range(q):
        l, r = map(int, input().split())
        print(f[r] - f[l])

if __name__ == "__main__":
    main()


Measured memory_bytes: 18088
#include <stdio.h>
int main (void)
{
    int a , b;
 
    scanf("%d %d",&a,&b);/*1 2???????????????????????????????????§%d,%d??§???????????????????????¨1,2??£???????????\????????????*/
     
    printf("%d " , a * b);/*???????????????????????????????????£?????????????????????????????¨?????????1??¨4??????14??£?????¨?????????????????????*/
    printf("%d\n" , 2 * (a + b));
    /*????????????printf("%d %d\n",a+b,2*(a+b));??§?????£?§£*/
 
    return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
const ll inf=5e18;

int main() {
  ll n,K;
  cin >> n >> K;
  vec x(n),y(n);
  for(ll i=0;i<n;i++) {
    cin >> x[i] >> y[i];
  }
  ll ans=inf;
  for(ll i=0;i<n;i++) {
    for(ll j=i+1;j<n;j++) {
      for(ll k=0;k<n;k++) {
        for(ll l=k+1;l<n;l++) {
          ll count=0;
          ll hh=max(y[i],y[j]);
          ll lh=min(y[i],y[j]);
          ll hw=max(x[k],x[l]);
          ll lw=min(x[k],x[l]);
          for(ll m=0;m<n;m++) {
            if(hh>=y[m]&&lh<=y[m]&&hw>=x[m]&&lw<=x[m]) count++;
          }
          if(count>=K) {
            ans=min(ans,(hh-lh)*(hw-lw));
          }
        }
      }
    }
  }
  cout << ans << endl;
}

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

using namespace std;

using i64 = int_fast64_t;

template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = vector<akari<yuzuki>>;
using seika = string;

void solve()
{
    int n, m;
    cin >> n >> m;
    yukari<int> g(n);
    while (m--)
    {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
    }
    int ans = n + 1, goal = -1;
    akari<int> best;
    for (int s = 0; s < n; s++)
    {
        akari<int> dis(n, -1), pre(n, -1);
        queue<int> q;
        q.push(s);
        dis[s] = 1;
        int done = 0;
        while (!q.empty() && !done)
        {
            int v = q.front();
            q.pop();
            for (int nv : g[v])
            {
                if (dis[nv] != -1)
                {
                    if (nv == s)
                    {
                        if (ans > dis[v])
                        {
                            ans = dis[v];
                            goal = v;
                            swap(best, pre);
                        }
                        done = 1;
                        break;
                    }
                    continue;
                }
                pre[nv] = v;
                dis[nv] = dis[v] + 1;
                q.push(nv);
            }
        }
    }
    if (ans == n + 1)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << ans << endl;
        int now = goal;
        while (now != -1)
        {
            cout << now + 1 << '\n';
            now = best[now];
        }
    }
}

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#include <regex>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    int cnta = 0, cntb = 0;
    int n;
    cin >> n;
    int a, b;
    cin >> a >> b;
    char c;
    REP(i,n) {
        cin >> c;
        if (c == 'a') {
            if (cnta + cntb < a + b) {
                cout << "Yes" << endl;
                cnta++;
            } else {
                cout << "No" << endl;
            }
        } else if (c == 'b') {
            if (cnta + cntb < a + b && cntb < b) {
                cout << "Yes" << endl;
                cntb++;
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 640
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*n
        self.rank = [0]*n

    def find(self, x):
        if self.root[x-1] < 0:
            return x
        else:
            self.root[x-1] = self.find(self.root[x-1])
            return self.root[x-1]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return
        elif self.rank[x-1] > self.rank[y-1]:
            self.n-=1
            self.root[x-1] += self.root[y-1]
            self.root[y-1] = x
        else:
            self.n-=1
            self.root[y-1] += self.root[x-1]
            self.root[x-1] = y
            if self.rank[x-1] == self.rank[y-1]:
                self.rank[y-1] += 1

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

    def count(self, x):
        return -self.root[self.find(x)-1]

    def size(self):
        return self.n

N,M=map(int,input().split())
B=[tuple(map(int,input().split())) for i in range(M)]
s=N*(N-1)//2
ans=[0]*M
uf=UnionFind(N)
for i in range(M-1,-1,-1):
    ans[i]=s
    a,b=B[i]
    if uf.find(a)!=uf.find(b):
        t1,t2=uf.count(a),uf.count(b)
        uf.unite(a,b)
        s-=(t1+t2)*(t1+t2-1)//2-(t1*(t1-1)//2+t2*(t2-1)//2)
print(*ans,sep='\n')

Measured memory_bytes: 101032
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N, Q; cin >> N >> Q;
    string S; cin >> S;
    vec c(N + 1, 0);
    FOR(i, 1, N){
        c[i + 1] = c[i];
        if(S[i - 1] == 'A' && S[i] == 'C') c[i + 1]++;
    }
    int l, r;
    REP(i, Q){
        cin >> l >> r;
        l--; r--;
        int ans = c[r + 1] - c[l];
        if(l >= 1 && S[l] == 'C' && S[l - 1] == 'A') ans--;
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 1872
from bisect import bisect_left, bisect_right
n = int(input())
INF = 1010101010
dp = [INF] * n
a = [int(input()) for _ in range(n)]
a.reverse()
for i in a:
    dp[bisect_right(dp, i)] = i
print(bisect_left(dp, INF))

Measured memory_bytes: 81508
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var inputs = Console.ReadLine().Split(' ');

        var hs = inputs.Select(i => int.Parse(i)).ToList();

        List<int> dp = new List<int>();
        dp.Add(0);
        dp.Add(Math.Abs(hs[0] - hs[1]));
        for(int i = 2; i < n; i++)
        {
            int a = dp[i - 1] + Math.Abs(hs[i - 1] - hs[i]);
            int b = dp[i - 2] + Math.Abs(hs[i - 2] - hs[i]);
            dp.Add(a > b ? b : a);
        }
        Console.Write(dp.Last());
    }
}


Measured memory_bytes: 20448
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;

int main() {
    rep(i, 5) {
        int a; cin >> a;
        if(a == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }  
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdlib>
#include <cmath>
#include<stdio.h>
#include<queue>
#include<stack>
#include<set>
#define int long long
#define MAX 1000000000000000000LL
int inf=100000000000007;
using namespace std;
typedef pair<int,int> P;
string alph="abcdefghijklmnopqrstuvwxyz";
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

signed main(){
    int n;cin>>n;
    int key[100005]={};
    for(int i=0; i<n; i++){
        cin>>key[i];
        key[i]--;
    }
    int count=0;
    for(int i=0; i<n; i++){
        if(key[i]==i){
            count++;
            swap(key[i],key[i+1]);
            i++;
        }
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

long long int f (long long int n, long long int x)
{
    if (n < 0) {
        return 0;
    }
    return 1 + n/x;
}

int main (int argc, char **argv)
{
    long long int a, b, x, n;
    scanf("%lld %lld %lld", &a, &b, &x);

    n = f(b, x) - f(a-1, x);
    printf("%lld\n", n);
    return 0;
}

Measured memory_bytes: 128
using System;
class Program{
	static void Main(){
		string s;
		while((s = Console.ReadLine()) != null){
			int d = int.Parse(s), sum = 0;
			for(int i = 0; i < 600; i+=d) sum += i*i*d;
			Console.WriteLine(sum);
		}
	}
}

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

using namespace std;

typedef long long ll;

int n;
vector<int> h;

int main() {
    cin >> n;
    h.resize(n);
    int mx = 0;
    for (int i = 0; i < n; i++) {
        cin >> h[i];
        mx = max(mx, h[i]);
    }
    int ans = 0;
    for (int i = 1; i <= mx; i++) {
        int cnt = 0;
        bool con = false;
        for (int& x : h) {
            if (con) {
                if (x < i)
                    con = false;
            } else {
                if (x >= i) {
                    con = true;
                    cnt++;
                }
            }
        }
        ans += cnt;
    }
    cout << ans;
    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	int n,q;
	cin>>n;
	int a[n];
	int i;
	for(i=0;i<n;i++)
	cin>>a[i];
	cin>>q;
	long long int sum=0;
	map<int,int> m;
	for(i=0;i<n;i++)
	{
		sum+=a[i];
		m[a[i]]++;
	}
	for(i=0;i<q;i++)
	{
		int b,c;
		cin>>b>>c;
		if(m[b]==0)
		{
			cout<<sum<<endl;
		}
		else
		{
			m[c]+=m[b];
			sum+=(c-b)*m[b];
			m[b]=0;
			cout<<sum<<endl;
		}
	}
	return 0;
}



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

int include3(int n) {
    if(n%10 == 3) return 1;

    else if(n >= 10) {
        include3(n/10);
    }
  
  	else return 0;
}

int main() {
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++) {
        if(i%3 == 0) cout << ' ' << i;
        else {
            if(include3(i)) cout << ' ' << i;
            }
        }

    cout << endl;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<"------\n"<<#a<<" = "<<a<<endl<<"------"<<endl
#define debug2(a,b) cout<<"--------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<endl<<"--------------"<<endl
#define debug3(a,b,c) cout<<"----------------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<" ; "<<#c<<" = "<<c<<endl<<"----------------------"<<endl
#define sz(a) (ll)(a.size())
#define debug4(a) cout<<"chu "<<a<<endl
#define endl "\n"

ll cutsneeded(ll x, ll m){
  if(x%m==0)
    return x/m-1;
  else
    return x/m;
}

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll n,k,mx=1;
  cin>>n>>k;
  vector<ll> a(n);
  forn(i,0,n){
    cin>>a[i];
    mx=max(mx,a[i]);
  }
  ll lo=1, hi=mx, ans=-1;
  while(lo<=hi){
    ll m=lo+(hi-lo)/2;
    ll cnt=0;
    forn(i,0,n){
      cnt += cutsneeded(a[i],m);
      if(cnt>k)
        break;
    }
    // debug3(m,cnt,k);
    if(cnt<=k){
      ans=m;
      hi=m-1;
    }else{
      lo=m+1;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4780
#include<stdio.h>

int main(void){

    int N,a[100]={};
    int i,count=0;

    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&a[i]);
    }

    for(i=1;i<=N;i++){
        if(i%2==1 && a[i-1]%2==1){
            count++;
        }
    }

    printf("%d\n",count);

    return 0;
}

Measured memory_bytes: 1724
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#define ll long long

using namespace std;
ll war(ll h)
{
    if(h==1)
     return 1;
    ll y=war(h/2);
    return 2*y+1;
}

int main()
{
   
 ll h;
 cin>>h;
 cout<<war(h)<<endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n,t;
	int ans=INF;
	cin >>n>>t;
	//cout<<ans<<endl;
	vector<pair<int,int>>ct(n);
	rep(i,n){
		cin>>ct[i].S>>ct[i].F;
	}
	sort(all(ct));
	for(auto itr=ct.begin();itr!=ct.end() and (itr->F) <=t;itr++){
		chmin(ans,itr->S);
	}
	if(ans==INF){
		cout<<"TLE"<<endl;
	}else{
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(container) container.begin(), container.end()
#define debug(var) std::cout << #var << " : " << var;
using ll = long long;
using ull = unsigned long long;
ll mod = 1e9 + 7;


int main(){


	int ans = 700;
	std::string S; std::cin >> S;

	rep(i, 3){
		if(S[i] == 'o')ans += 100;
	}

	std::cout << ans;


	return 0;
}


Measured memory_bytes: 256
S=input().split()
operand=[]
cnt=0

# 1 2 + 3 4 - *
# -> (1 + 2) * (3 - 4)
for s in S:
  if s in '+-*':
    a=operand.pop()
    b=operand.pop()
    x=eval(b+s+a)
    #tmp=operand.pop()+s+operand.pop()
    #print(tmp)
    #x=eval(tmp)
    operand.append(str(x))
  else:
    operand.append(s)

print(operand.pop())



Measured memory_bytes: 5564
//#pragma GCC optimize "trapv"
//-D_GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define all(x) x.begin(),x.end()
#define Max 100000+5
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f first
#define s second
#define pb push_back
int mod = 1000000007;
vector<int> g[Max];
bool vis[Max];
int d, x, y;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
void ex(int A, int B) {
    if(B == 0) {
        d = A;
        x = 1;
        y = 0;
    }
    else {
        ex(B, A%B);
        int temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
}


void dfs(int u){

	vis[u]=1;
	for(int i=0;i<g[u].size();i++){
		int v=g[u][i];
		if(vis[v]!=1)
			dfs(v);
	}
}



int power(int a,int b){
    if(b==1)return a;
    if(a>mod)a%=mod;
    int r=1;
    while(b){
        if(b&1)r=r%mod*a%mod;
        a=a%mod*a%mod;
        b/=2;
    }
    return r;
}
class uf{
    vector<int> v;
    vector<int> sz;
    
    
    public :
    uf(int n){
        v.resize(n+1);
        iota(v.begin()+1,v.end(),1);
        sz.resize(n+1,1);
        //1 to sz
    }
    int root(int b){
        while(v[b]!=b){
            b = v[b];
        }   
        return b;
    }
    void u(int a, int b){
        //combine a and b
        
        int ra=root(a);
        int rb=root(b);
        if(ra==rb)return ;
        if(sz[ra]<sz[rb]){
            v[ra] = v[rb];
            sz[rb]+=sz[ra];
        }else{
            v[rb]=v[ra];
            sz[ra]+=sz[rb];
        }
    }
    bool f(int a,int b){
        //same set
        return (root(a)==root(b));
    }
   
    
};


int32_t main(){
	IO
	int k,n;
  cin>>k>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++){
      cin>>v[i];
  }
  int mx=0;
  sort(v.begin(),v.end());
  for(int i=1;i<v.size();i++){
    mx=max(v[i]-v[i-1],mx);
    
  }
  mx = max(mx,k-v[n-1]+v[0]);
  cout<<k-mx;
  
  
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

void solve()
{
  int k;
  cin >> k;

  if (k % 2 == 0)
  {
    cout << -1;
    return;
  }

  ll num = 0;
  for(int i = 0; i < 1000000; ++i)
  {
    num = num * 10 + 7;
    num %= k;
    if (num == 0)
    {
      cout << i + 1;
      return;
    }
  }  
  cout<< -1;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3624
import copy

def main():
  L, R, d = map(int, input().split())
  multiply = copy.copy(d)
  nums = []
  n = 1
  ans = []
  while d < R + 1:
      d = multiply * n 
      nums.append(d)
      n = n + 1
  for i in range(len(nums)):
      if nums[i] < L:
          continue
      elif nums[i] > R:
          continue
      else:
        ans.append(nums[i])
  print(len(ans))
main()

Measured memory_bytes: 9340
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

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

    for (ll i = N - 2; i >= 0; i--) {
        if (H[i] <= H[i + 1]) {
            //ok
        } else if (H[i] == H[i + 1] + 1) {
            H[i]--;
        } else {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	ll a, b, c;
	cin>>a>>b>>c;
	if(c-a-b<=0){
		cout<<"No"<<endl;
		return 0;
	}
	if(4*a*b<(c-a-b)*(c-a-b)){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		//		new Main().solveB();
		new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		String s = "";

		try {
			scanner = new Scanner(System.in);
			s = scanner.next();

			char[] wk = s.toCharArray();

			int cntA = 0;
			int cntB = 0;
			int cntC = 0;

			for (int i = 0; i < wk.length; i++) {
				char c = wk[i];
				if (c == 'a' && cntA == 0) {
					cntA++;
				} else if (c == 'b' && cntB == 0) {
					cntB++;
				} else if (c == 'c' && cntC == 0) {
					cntC++;
				}
			}

			System.out.println((cntA + cntB + cntC) == 3 ? "Yes" : "No");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;
		int numK = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();
			numK = scanner.nextInt();

			List<Integer> wk = new ArrayList<Integer>();
			for (int i = numA; i <= numB; i++) {
				if (i < numA + numK || numB - numK < i) {
					wk.add(i);
				}
			}

			for (int i = 0; i < wk.size(); i++) {
				System.out.println(wk.get(i));
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;

		try {
			scanner = new Scanner(System.in);
			int[] wk = new int[3];
			wk[0] = scanner.nextInt();
			wk[1] = scanner.nextInt();
			wk[2] = scanner.nextInt();

			Arrays.sort(wk);

			/*
			 * 基準となる値の計算
			 * 全て最大値に合わせる前提
			 */
			int m3 = wk[2] * 3;
			/*
			 * 最大値に合わせてよいのか？
			 * 現在の総計と最大値に全てあわせた場合の偶奇が同じなら、
			 * 埋めなくてはいけない数値は偶数
			 * 違う場合は、埋めなくてはいけない数値が奇数
			 *  - 奇数に偶数を足しても奇数/偶数に偶数を足しても偶数
			 */
			boolean isEqual = (wk[0] + wk[1] + wk[2]) % 2 == m3 % 2;

			int targetNum = 0;
			int res = 0;
			/*
			 * 埋める数値が奇数の場合、そのままでは埋められないので
			 * 合わせる数値を+1する
			 */
			if (isEqual) {
				targetNum = wk[2];
			} else {
				targetNum = wk[2] + 1;
			}

			for (int i = 0; i < wk.length; i++) {
				res += (targetNum - wk[i]);
			}

			//			boolean isPlusOne = false;
			//			for (int i = 0; i < wk.length; i++) {
			//				res += (targetNum - wk[i]) / 2;
			//				if (!isPlusOne) {
			//					isPlusOne = (targetNum - wk[i]) % 2 != 0;
			//				}
			//			}
			//
			//			if (isPlusOne) {
			//				res++;
			//			}

			System.out.println(res / 2);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 23252
#define NOT_FOUND 200000

#include <stdio.h>

int binarySearch(int n, int key, int *s);

int main(void) {
	int n = 0;
	int s[100000] = {};
	int q = 0;
	int t[50000] = {};
	int k = 0;				//?????´????????°.

	int i = 0;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &s[i]);

	scanf("%d", &q);
	for (i = 0; i < q; i++)
		scanf("%d", &t[i]);

	for (i = 0; i < q; i++) {
		if (binarySearch(n, t[i], s) != NOT_FOUND)
			k++;
	}

	printf("%d\n", k);

	return 0;
}

int binarySearch(int n, int key, int *s) {
	int left = 0;
	int right = n;
	int mid = 0;

	while (left < right) {
		mid = (left + right) / 2;
		if (s[mid] == key)
			return mid;
		else if (key < s[mid])
			right = mid;
		else
			left = mid + 1;
	}

	return NOT_FOUND;
}

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

typedef pair<int,int> pii;
const int N = 3e3;

int n,t;
pii li[N+5];

int memo[N+5][N+5];

int dp(int x, int sisa){
	if(sisa <= 0) return 0;
	if(x > n) return 0;
	int &ret = memo[x][sisa];
	if(ret!=-1) return ret;
	ret = max(dp(x+1,sisa),dp(x+1,sisa-li[x].first) + li[x].second);
	return ret;
}

int main(){
	memset(memo,-1,sizeof(memo));
	scanf("%d%d",&n,&t);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&li[i].first,&li[i].second);
	}
	sort(li+1,li+n+1);
	int ans = dp(1,t);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 35712
#include<bits/stdc++.h>
#define lli long long int
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define ou(S) cout << S << endl
using namespace std;
int main(){
  int x;
  cin>>x;
  while(1){
    bool ok=true;
    rep(i,2,x){
      if(x%i==0)ok=false;
    }
    if(ok){
      ou(x);
      break;
    }
    ++x;
  }
}

Measured memory_bytes: 256
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
#include <array>
using namespace std;
using lint = long long;
using ld = long double;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
#pragma endregion

const lint INF = 1ll << 60;
const int mod = 1000000007;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m; cin >> n >> m;
	vector<pair<int, int>> d(n);
	for (int i = 0; i < n; i++)cin >> d[i].first >> d[i].second;
	sort(d.begin(), d.end());
	lint ans = 0;
	priority_queue<int> pq;
	int cnt = 0;
	for (int i = 1; i <= m; i++) {
		while (true) {
			if (cnt >= n) break;
			if (d[cnt].first <= i)
				pq.push(d[cnt].second), cnt++;
			else break;
			if (cnt >= n) break;
		}
		if (pq.empty()) continue;
		ans += pq.top();
		pq.pop();
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4648
#include <bits/stdc++.h>
using namespace std;
int x11, y11, x22, y22, x33, y33, x44, y44;
int main() {
    ios::sync_with_stdio(false);
    cin >> x11 >> y11 >> x22 >> y22;
    int x, y;
    x = x22 - x11;
    y = y22 - y11;

    x33 = x22 - y;
    y33 = y22 + x;

    x44 = x11 - y;
    y44 = y11 + x;
    printf("%d %d %d %d\n", x33, y33, x44, y44);
    return 0;
}




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


 int main(){
 long long x,n,v,sum=0;
 
 cin >> x >> n;
 
 while(n-->0)
 {
	  cin >> v;
	  sum= sum+v;
 }
 
 if(x-sum>=0)
 {
 	cout << x-sum << endl;
 }
 else
 {
 	cout << "-1" << endl;
 }
 
 
 return 0;
 }









Measured memory_bytes: 3148
/*"You can do anything you set your mind to,man" - Eminem*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define llpow(a,b) (ll)(pow(a,b)+0.5)
#define l_b(a,val) min((int)a.size()-1, (int)(lower_bound(a.begin(),a.end(),val)-a.begin()))
#define f first
#define up(a,b) max(a,b)
#define s second
#define INF 9223372036854775807
const  int mod = 1000000007;
template <typename T> T add(T& a, T b){a+=b;while(a>=mod)a-=mod;while(a<0)a+=mod;}
template <typename T> T mul(T& a, T b){a*=b;while(a>=mod)a-=mod;while(a<0)a+=mod;}
template <typename T> T up_self(T& a, T b){a = up(a,b);}
template <typename T> T min_self(T& a, T b){a = min(a,b);}
ll binexpomodulo(ll x, ll y){ll res =1;x%=mod;if(!x)return 0;while(y){if(y&1){mul(res, x);}mul(x,x);y>>=1;}return res;}
ll nCrInOr(ll n, ll r){ll res = 1;if(r>n-r)r = n-r;ll rin = 1;for(ll i = 1; i <=r ; i++)rin = (rin*i)%mod;rin = binexpomodulo(rin,mod-2);for(ll i = 1; i <= r; i++)res = (res*(n-i+1))%mod;res = (res*rin)%mod;return res;}
int msb(ll n){int ans;for(int i = 0 ; i < 64;  i++)if(n&(1LL<<i))ans = i+1;return ans;}
/*All the macros below are copied from nik_y(OG)*/
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define all(c) c.begin(),c.end()
#define endl "\n"
#define get(a,n) fl(i,0,n)  cin>>a[i];
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
int main()
{
	Shazam;
	int n; cin>>n;
	int base = 1;
	while(base<=n){
		base*=2;
	}
	vector<ll> tree(2*base);
	vector<ll> h(n),a(n);
	vector<ll> dp(n+1);
	for(int i = 0 ; i < n; i++)cin>>h[i];
	for(int i = 0 ; i < n ;i++)cin>>a[i];
	for(int i = 0 ; i < n; i++){
		int x = base + h[i];
		ll best = 0;
		while(x>1){
			if(x%2==1)
				up_self(best,tree[x-1]);
			x/=2;
		}
		up_self(dp[h[i]], best+a[i]);
		for(int x = base+h[i]; x>=1; x/=2)
			up_self(tree[x],dp[h[i]]);
	}
	cout<<*max_element(dp.begin(),dp.end())<<endl;
  	return 0;
}

Measured memory_bytes: 9088
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T> void dbg(T x) { cout << x << "\n"; }
template<typename T, typename U> static void chmin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void chmax(T &x, U y) { if (x < y) x = y; }


int main() {
    string s; cin >> s;
    s[3] = '8';
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
/*input
15 7
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9
*/

#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#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 vpll vector < pair<long long,long long> >
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define fill(a)  memset(a, 0, sizeof (a))
#define mp make_pair
#define pb push_back
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define pdd pair<double, double>
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define forstl(i,v) for(auto &i: v)
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl(v) cout<<#v<<" = \n"; { int c=0; forstl(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it<<endl;} cerr<<endl
#define dbgstlp(v) cout<<#v<<" = \n"; { int c=0; forstl(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it.f<<" , "<<it.s<<endl;} cerr<<endl
#define PI           3.14159265358979323846

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define pdd pair<double, double>
#define in(v,n) vll v(n);rep(i,n) cin>>v[i]


using namespace std;


int main(){
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    cin.exceptions(cin.failbit);
    int T;
	// cout<<std::fixed<<std::setprecision(35);
	// cin>>T;while(T--)
	{
		ll t,n,i,j,x,y,m,l,d,k;
		cin>>n>>k;
		ll arr[n];
		rep(i,n) cin>>arr[i];
		for(int i=k;i<n;i++){
			if(arr[i]>arr[i-k]){
				cout<<"Yes\n";
			}
			else{
				cout<<"No\n";
			}
		}
	}
}

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

int main() {
    ll s;
    cin >> s;
    ll a[1000001];
    a[0] = s;

    ll ans;
    bool end = false;
    for (ll m = 1; m < 1000001; m++) {
        ll last = a[m - 1];
        if (last & 1) {
            a[m] = 3 * last + 1;
        } else {
            a[m] = last / 2;
        }

        for (ll i = 0; i < m; i++) {
            if (a[m] == a[i]) {
                ans = m;
                ans++;
                end = true;
                break;
            }
        }

        if (end) break;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<cctype>
#include<string.h>

#define PI 3.1415926

int main(){
    	int n, s[2000];
		double sum = 0;
		double a2 = 0;
	while (1) {
	
		scanf("%d", &n);
		if (n == 0) {
			break;
		}
		for (int i = 1; i <= n; i++) {
			scanf("%d", &s[i]);
			sum += s[i];
		}

		sum /= n;

		for (int i = 1; i <= n; i++) {
			a2 += (s[i] - sum)*(s[i] - sum);
		}
		printf("%f\n", sqrt(a2 / n));
		sum = 0;
		a2 = 0;
	}
	return 0;
}

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

#define int long long int 

int32_t main()
{
  int n;
  cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)
  cin>>v[i];
  sort(v.begin(),v.end());
  int l=lower_bound(v.begin(),v.end(),v[n-1]/2)-v.begin();
 //cout<<v[l]<<" "<<l<<" "<<v[n-1]/2<<" "<<abs(v[l]-(v[n-1]+1)/2)<<" "<<abs(v[l-1]-(v[n-1]+1)/2)<<endl;
  cout<<v[n-1]<<" "<<(abs(v[l]-(v[n-1]+1)/2)<abs(v[l-1]-(v[n-1]+1)/2)?v[l]:v[l-1])<<endl;
}

Measured memory_bytes: 4024
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n;
	ll a=0,ans=INF,x,y;
	cin >> n;
	vector<ll>arr(n + 1,0);
	rep(i, n) {
		cin >> a;
		arr[i + 1] = arr[i] + a;
	}

	REP(i, n-1) {
		x = arr[i];
		y = arr[n] - arr[i];
		ans = min(ans, abs(x - y));
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 4704
using System;

public class Test
{
	
	public static void Main()
	{
		int N = int.Parse(Console.ReadLine());
		long[] factors = new long[999];
		long ans = 1;
		for (int i = 2; i <= N; i++)
		{
			int temp = i;
			for (int j = 2; j <= i; j++)
			{
				while (temp % j == 0)
				{
					temp /= j;
					factors[j - 2]++;
				}
			}
		}
		foreach (var item in factors)
		{
			ans = ans * (item + 1) % (long)(1e9 + 7);
		}
		Console.WriteLine(ans);
	}
}

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

using namespace std;
#define INF 99999999
int main(){
    
    int n, a;
    scanf("%i", &n);
    
    vector<int> inn(3);
    vector< vector<int> > DP(n, vector<int> (3, 0));
    for (int& x : inn){ scanf("%i", &x); }
    DP[0] = inn;
    
    for (int i = 1; i < n; i++){
        for (int k = 0; k < 3; k++){
            scanf("%i", &a);
            inn[k] = a;
        }
        DP[i][0] = inn[0] + max(DP[i-1][1], DP[i-1][2]);
        DP[i][1] = inn[1] + max(DP[i-1][2], DP[i-1][0]);
        DP[i][2] = inn[2] + max(DP[i-1][0], DP[i-1][1]);
    }
    cout << max(max(DP[n-1][0], DP[n-1][1]), DP[n-1][2]);
}

Measured memory_bytes: 5760
#include <iostream>
#include<iomanip>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#include<ctime>
#include<cstdlib>
#define INF 1001001001001001001
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;

int main() {
	int n;
	cin >> n;
	cout << n * n << endl;

}


Measured memory_bytes: 3608
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
#define foreach(x,a) for(auto &x:a)
typedef long long ll;
const ll MOD = 1e9+7;
//}}}

const int maxVal = 100000;
int a[maxVal];
int X[maxVal];
int main(){
  int N;
  cin >> N;
  rep(i, N) cin >> a[i];
  rep(i, N){
    if(a[i] != 0) X[a[i] - 1]++;
    X[a[i]]++;
    if(a[i] != maxVal-1) X[a[i] + 1]++;
  }
  int ans = 0;
  rep(i, maxVal){
    ans = max(ans, X[i]);
  }

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


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
using namespace std;
typedef long long int ll;
const int prime=1000000007;
int N;
int nums[100001];
int BIT[100001];
ll DP[100001];
ll fact(int n){
	if(n==0)
		return 1;
	if(DP[n])
	return DP[n];
	return DP[n]=n*fact(n-1)%prime;
}
void reset(){
	REP(i,100001){
		BIT[i]=0;
		nums[i]=0;
		
	}
}
int add(int n,int s){
	while(n<=N){
		BIT[n]+=s;
		n+=n&-n;
	}
}
int sums(int n){
	int sum=0;
	while(n>0){
		sum+=BIT[n];
		n-=n&-n;
	}
	return sum;
}
void swap(int i,int j){
	int a=nums[i];
	nums[i]=nums[j];
	nums[j]=a;
}
int main() {
	int R,a,b;
	while(cin >> N && N){
		cin >>R;
		reset();
	REP(i,N+1)
	nums[i]=i;
	ll sum=0;
	REP(i,R){
		cin >> a >> b;
		swap(a,b);
	}
	FOR(i,1,N+1){
		int now=nums[i];
		sum+=((now-1-sums(now-1))*fact(N-i))%prime;
	//	cout <<((now-1-sums(now-1))) << endl;
		add(now,1);
	}
	cout << sum%prime << endl;
	// your code goes here
	}
	return 0;
}

Measured memory_bytes: 4276
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

int main(){
	int n, m, max=0;
	cin >> n;
	map<string, int> score;
	vector<string> s(n);
	for(int i=0; i<n; i++){
		cin >> s[i];
		score[s[i]]++;
	}
	cin >> m;
	for(int i=0; i<m; i++){
		string tmp;
		cin >> tmp;
		score[tmp]--;
	}
	for(int i=0; i<n; i++){
		if(score[s[i]]>max)
			max=score[s[i]];
	}
	cout << max << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cassert>
#include <algorithm>    
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define int long long
using namespace std;

typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef tuple<int, int, int> tiii;
typedef unsigned long long ull; 
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const int INF = 1e18;
const int M = 1e9 + 7;
//__int128


signed main() {
  // freopen("in.txt", "r", stdin);
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int w, h, a, b;
  cin >> h >> w >> a >> b;
  for(int i = 0; i < h; ++i) {
    for(int j = 0; j < w; ++j) {
      if((i < b) ^ (j < a)) {
        cout << 0;
      } else {
        cout << 1;
      }
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<string>
using namespace std;
int main(){
 int n,s;
 while(true){
 cin>>n>>s;
 if(n==0&&s==0)
 break;
 int count=0;
 for(int i=0;i<1024;i++){
  int bit=i;
  int ncount=0,scount=0;
  for(int j=0;j<10;j++){
      if(bit>>j&1==1){
       ncount++;
       scount+=j;
      }
  }
  if(ncount==n&&scount==s)
  count++;
 }
 cout<<count<<endl;
 }
 return 0;   
}

Measured memory_bytes: 1160