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

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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i,n){cin>>h[i];}
  sort(h.begin(),h.end());
  int ans=inf;
  for(int i=0; i<n-k+1; i++){
    ans = min(ans,h[i+k-1]-h[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <string>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stdlib.h>
#include <algorithm>
#include <list>
#include <math.h>
#include<string.h>
#define reps(i,j,k) for(int i=(j);i<(k);i++)
#define rep(i,j) reps(i,0,j)

//	rep(i,10)cout << i << endl;
using namespace std;

int main(void){
	string s;
	cin >> s;
	int a = 8;
	rep(i,s.size()){
		if(s[i] == 'x') a--;
	}
	
	cout << (a>0?"YES":"NO") << endl;
	return 0;
}

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

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		char[] O = sc.next().toCharArray();
		char[] C = sc.next().toCharArray();
		
		for(int i = 0; i < C.length; i++) {
			out.print(O[i]);
			out.print(C[i]);
		}
		if (O.length > C.length)
			out.print(O[O.length - 1]);

		out.close();
	}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}



Measured memory_bytes: 22612
n,y=map(int,input().split())
for i in range(n+1):
    for j in range(n+1-i):
        k10=i*10000
        k5=j*5000
        k1=(n-i-j)*1000
        if k10+k5+k1==y:
            print(i,j,n-i-j)
            break
    else:
        continue
    break
else:
    print(-1,-1,-1)

Measured memory_bytes: 3188
// I can

#include<bits/stdc++.h>
using namespace std;

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const ll maxn=1000001,mod=1e9+7;

int main(){
sync


int n,m,c;
cin>>n>>m>>c;
int b[m];
forn(i,m){
    cin>>b[i];
}
int ans=0;
forn(i,n){
    int val=0;
    forn(j,m){
        int x;
        cin>>x;
        val+=(x*b[j]);
    }
    if(val+c>0){
        ans++;
    }
}

cout<<ans;
return 0;
}

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

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

    vector<int> data(n);
    vector<int> count(100001,0);

    int64_t sum = 0;

    for(int i = 0 ; i < n ; i++){
        cin >> data.at(i);
        sum += data.at(i);
        count.at(data.at(i))++;
    }

    int q;
    cin >> q;

    for(int i = 0 ; i < q ; i++){
        int b, c;
        cin >> b >> c;
        int sa = c - b;
        sum += sa * count.at(b);
        count.at(c) += count.at(b);
        count.at(b) = 0;

        cout << sum << endl;
    }
}


Measured memory_bytes: 4052
fun main (args:Array<String>){
    val seqLen = readLine()!!.toInt()
    val seqList = mutableListOf<Int>(0, 0)
    val inputList = mutableListOf<Int>()
    var input = 0
    for(i in 1..seqLen){
        input = readLine()!!.toInt()
        inputList.add(input)
        if(seqList[0] < input) {
            seqList[0] = input
            continue
        }
        if(seqList[1] <= input){
            seqList[1] = input
        }
    }
    for(i in 0..seqLen-1){
        if(inputList[i] == seqList[0]){
            println(seqList[1])
        }
        else {
            println(seqList[0])
        }
    }
}

Measured memory_bytes: 65828
#include <stdio.h>
int main(){
	int a,b,c,d;
	int m;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	int x[a];
	int y[b];
	//scanf("%d",&m);
	for(int i=0;i<a;i++){
		scanf("%d",&x[i]);
	}
	//scanf("%d",&m);
	for(int i=0;i<b;i++){
		scanf("%d",&y[i]);
	}
	
	int p=x[0];
	for(int i=0;i<a-1;i++){
		if(p<x[i+1]){
			p=x[i+1];
		}
	}
	//printf("%d",p);
	
	int q=y[0];
	for(int i=0;i<b-1;i++){
		if(q>y[i+1]){
			q=y[i+1];
		}
	}
	//printf("%d",q);
	
	if(p<q&&p<d&&q>c){
		printf("No War");
	}else{
		printf("War");
	}
	
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <unistd.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
vector<ll> G[550010];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 998244353;
 
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[800005],rfact[800005];
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,a,b,c,d,e,g,h,w,i,j,q,r,l;
ll k,ans;
ll x[500005],y[500005],z[500005];
ll dp1[505][505], dp2[505][505];
ll times[505][505];

int main(){
    cin >> n >> m >> l;
    for(int i=0;i<n;i++){
    	for(int j=0;j<n;j++){
    		dp1[i][j] = INF;
    	}
    }
    for(int i=0;i<m;i++){
    	cin >> a >> b >> c;
    	a--;
    	b--;
    	if(c <= l){
	    	dp1[a][b] = c;
	    	dp1[b][a] = c;
    	}
    }
    for(int k=0;k<n;k++){
    	for(int i=0;i<n;i++){
    		for(int j=0;j<n;j++){
    			dp1[i][j] = min(dp1[i][j], dp1[i][k] + dp1[k][j]);
    		}
    	}
    }
    for(int i=0;i<n;i++){
    	for(int j=0;j<n;j++){
    		if(dp1[i][j] <= l){
    			dp2[i][j] = 1;
    		}else{
    			dp2[i][j] = INF;
    		}
    	}
    }
    for(int k=0;k<n;k++){
    	for(int i=0;i<n;i++){
    		for(int j=0;j<n;j++){
    			dp2[i][j] = min(dp2[i][j], dp2[i][k] + dp2[k][j]);
    		}
    	}
    }
    cin >> q;
    for(int i=0;i<q;i++){
    	cin >> a >> b;
    	a--;
    	b--;
    	if(dp2[a][b] == INF){
    		p(-1);
    	}else{
    		p(dp2[a][b] - 1);
    	}
    }
    return 0;
}











Measured memory_bytes: 18944
#coding: utf-8

sx, sy, tx, ty = map(int,input().split())
ans = ''
for i in range(tx-sx):
    ans += 'R'
for i in range(ty-sy):
    ans += 'U'
for i in range(tx-sx):
    ans += 'L'
for i in range(ty-sy):
    ans += 'D'

ans += 'D'
for i in range(tx-sx+1):
    ans += 'R'
for i in range(ty-sy+1):
    ans += 'U'
ans += 'L'

ans += 'U'
for i in range(tx-sx+1):
    ans += 'L'
for i in range(ty-sy+1):
    ans += 'D'
ans += 'R'

print(ans)

Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        
        int H = sc.nextInt();
        int N = sc.nextInt();
        int sum = 0;
        int[] A = new int[N];
        for(int i=0;i<N;i++){
            A[i]=sc.nextInt();
            sum+=A[i];
        }
        System.out.println((sum>=H)?"Yes":"No");
    }

    public static void main(String[] args) {
        new Main();
    }
}


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

int main(){
    int a,b;
    cin >> a >> b;
    if(a*b % 2 == 0) cout << "Even ";
    else cout << "Odd ";
    
    return 0;
}


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

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

    int n; cin >> n;
    string s; cin >> s;

    int w = 0, e = 0;
    for (char c : s) {
        if (c == 'W') ++w;
        else ++e;
    }

    int lw = 0, le = 0, ans = 1e6;
    for (char c : s) {
        int change = c == 'W' ? lw + e : lw + e - 1;
        ans = min(change, ans);
        if (c == 'W') {
            ++lw; --w;
        } else {
            ++le; --e;
        }
    }

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

Measured memory_bytes: 720
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=Counter(a)
mina=min(a)
maxa=max(a)
d=sum([x-1 for x in c.values() if x>1])
ans=n-2*max((d+1)//2,(c[mina]-1)//2,(c[maxa]-1)//2)
print(ans)

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

#define int long long
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vii vector<pi>
#define ps(x,y) fixed<<setprecision(y)<<x
#define w(t) int t;cin>>t;while(t--)solve()
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define f(n) for (int i=0;i<n;++i)
#define init(arr,m,n,value) std::fill(*arr,*arr+m*n,value)
#define low(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define up(s) transform(s.begin(),s.end(),s.begin(),::toupper)
//debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);

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

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void solve(){
	
}

int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	//clock_t z = clock();
	int x;
	cin>>x;
	cout<<abs(x-1);

}


Measured memory_bytes: 3596
import sys
import itertools

def is_prime(x):
    if x == 2:
        return True

    pred = lambda v: v * v <= x
    it = itertools.chain((2,), itertools.count(3, 2))
    return not any(not (x % i) for i in itertools.takewhile(pred, it))
        

def resolve(in_):
    X = int(next(in_))
    for i in itertools.count(X):
        if is_prime(i):
            return i


def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9156
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

int a[4], ans = 0, count = 0;
char op[4];

void dfs(int i, int sum)
{
  if(i == 3){
    if(sum == 7){
      for(i = 0; i < 4; i++){
        cout << a[i] << op[i];
      } 
      cout << 7 << endl;
      exit(0);
    }
    count++;
    return;
  }else{
    op[i] = '+';
    dfs(i + 1, sum + a[i + 1]);
    
    op[i] = '-';
    dfs(i + 1, sum - a[i + 1]);

    return;
  }
}

int main()
{ 
  op[3] = '=';
  string S;
  cin >> S;
  for(int i = 0; i < 4; i++){
    a[i] = S[i] - '0';
  }
  dfs(0, a[0]);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
typedef long long li;
#define chmax(a,b) (a<(b)?a=(b),1:0)
#define chmin(a,b) (a>(b)?a=(b),1:0)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// vector 型
template<class T>
std::ostream& operator<<(std::ostream& os, const vector<T>& v){
  // ここでストリームに obj を書き込みます。
  for(const T& t:v) cout << t << " ";
  return os;
}

int main(){
  int h,w; cin >>h >>w;
  vector<string> vec(h);
  rep(i,h){
    string s; cin >>s;
    vec[i]=s;
  }
  if(df)print(vec,"\n");
  vector<vector<int>> ans(h,vector<int>(w,h+w));
  rep(i,h)rep(j,w) if(vec[i][j]=='#') ans[i][j]=0;
  if(df) {rep(i,h) print(ans[i]);print("\n");}
  
  repa(i,1,h)rep(j,w) chmin(ans[i][j],ans[i-1][j]+1);
  if(df) {rep(i,h) print(ans[i]);print("\n");}
  repa(j,1,w)rep(i,h) chmin(ans[i][j],ans[i][j-1]+1);
  if(df) {rep(i,h) print(ans[i]);print("\n");}
  repa(i,1,h)rep(j,w) chmin(ans[h-i-1][j],ans[h-i][j]+1);
  if(df) {rep(i,h) print(ans[i]);print("\n");}
  repa(j,1,w)rep(i,h) chmin(ans[i][w-j-1],ans[i][w-j]+1);
  if(df) {rep(i,h) print(ans[i]);print("\n");}

  int ret=0;
  rep(i,h)rep(j,w) chmax(ret,ans[i][j]);
  print(ret);
}


Measured memory_bytes: 5248
import numpy as np
# マスに書かれている数字を入力する
c = np.empty((3, 3), dtype = int)
for i in range(3):
    c[i] = list(map(int, input().split()))
# 判定を初期化
judge = "Yes"
# 0〜1行目および0〜1列目について探索する
for i in range(2):
    # i行目からi+1行目を引いたものが等しくない場合
    if len(set(c[i] - c[i + 1])) != 1:
        # 判定を更新する
        judge = "No"
        # 繰り返しを抜ける
        break
    # i列目からi+1列目を引いたものが等しくない場合
    if len(set(c[:, i] - c[:, i + 1])) != 1:
        # 判定を更新する
        judge = "No"
        # 繰り返しを抜ける
        break
# 判定を出力する
print(judge)

Measured memory_bytes: 17952
# -*- coding: utf-8 -*-

import sys
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def lcm(x, y): return (x * y) // gcd(x, y)

A, B = MAP()

print(lcm(A, B))


Measured memory_bytes: 5040
a=[26, 702, 18278, 475254, 12356630, 321272406, 8353082582, 217180147158, 5646683826134, 146813779479510, 3817158266467286]
n=int(input())
k=0
for i in range(10):
    if n<=a[i]:
        k=i+1
        break
else:
    k=11
if k==1:
    print(chr(n+96))
else:
    ans=""
    n=n-a[k-2]-1
    for i in range(k):
        if i!=k-1:
            ans+=chr(n//(26**(k-1-i))+97)
            n=n%(26**(k-1-i))
        else:
            ans+=chr(n%26+97)
    print(ans)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll md = 1000000007;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
vl p, fac(2, 1), ifac(2, 1);

ll add(ll a, ll b) {
    return (a%md + b%md + md) % md;
}

ll mul(ll a, ll b) {
    return ( (a%md) * (b%md) ) % md;
}

ll power(ll x, ll n, ll mod = md) {
    ll res = 1;
    x %= mod;
    while (n) {
        if (n & 1)  res = ((res%mod) * (x%mod))%mod;
        n = (n >> 1);
        x = ((x%mod) * (x%mod))%mod;
    }
    return res;
}

void cachefact(ll lim, ll mod = md) {
    for(int i = 2; i <= lim; i++) {
        ifac.push_back((ifac[mod%i] * (mod - mod/i) % mod)%mod);
    }
    for(ll i = 2; i <= lim; i++) {
        fac.push_back((fac[i-1] * i)%mod);
        ifac[i] = (ifac[i-1] * ifac[i])%mod;
    }
}

ll C(int n, int r) {
    if(n < r) return 0;
    return mul(fac[n], mul(ifac[r], ifac[n-r]));
}

ll P(int n, int r) {
	if(n < r) return 0;
	return mul(fac[n], ifac[n-r]);
}

ll mod_fac(ll n, ll p) {
	return fac[n] * power(power(p, n/p), md - 2) % md * power(fac[n/p], md - 2) % md;
}

void multiply(vvl &F, vvl &R, ll N) {
	vvl temp(N, vl (N, 0));
	for(int i = 0; i < N; i++) {
		for(int j = 0; j < N; j++) {
			for(int k = 0; k < N; k++) {
				temp[i][j] = add(temp[i][j], mul(F[i][k], R[k][j]));
			}
		}
	}
	F = temp;
}

void mpow(vvl &F, ll N, ll n) {
	vvl res(N, vl (N, 0));
	for(int i = 0; i < N; i++) res[i][i] = 1;
	while(n) {
		if(n & 1) multiply(res, F, N);
		multiply(F, F, N);
		n /= 2;
	}
	F = res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x;
    cin >> x;
    if(x >= 30) {
    	cout << "Yes\n";
    } else {
    	cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <chrono>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;

constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {std::make_pair(1, 0), std::make_pair(-1, 0), std::make_pair(0, 1), std::make_pair(0, -1)};
constexpr char BR = '\n';

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(ele, vec) for(auto &(ele) : (vec))
#define vREPcopy(ele, vec) for(auto (ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())



template <class T> inline int argmin(std::vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(std::vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}
inline int toInt(string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline int toInt(const string s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res = "";
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;}
  std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




int main(void){
  int n, a, b; scanf("%d %d %d", &n, &a, &b); a -= b;
  Vlli A(n); REP(i, n) scanf("\n%lld", &A[i]);
  SORT(A);
  int cannot = 0, can = (A[n-1] - 1) / b + 1;
  while(can - cannot > 1){
    int t = (can + cannot) / 2;
    lli bt = b * (lli)t, cnt = 0;
    auto itr = upper_bound(A.begin(), A.end(), bt);
    while(cnt <= t and itr != A.end()){
      cnt += (*itr - bt - 1) / a + 1;
      itr++;
    }
    if(cnt <= t) can = t;
    else cannot = t;
  }
  printf("%d\n", can);
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#define _USE_MATH_DEFINES
#include<math.h>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<map>
#include<unordered_map>
#include<set>
#include <algorithm>
#include <utility>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

typedef unsigned long long ull;
typedef long long ll;

#define Prime1 1000000007
#define Prime2 9999973

int i, j, k, l, m, n;
int H, W, N, M, Q;
int a, b, c;

int main()
{
	cin >> N;
	i = 0;
	while (N>1)
	{
		N >>= 1;
		i++;
	}
	cout << (N << i) << '\n';
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while(true){
			int n = sc.nextInt();
			
			if(n == 0){
				break;
			}
			
			double[] s = new double[n];
			double sum = 0;
			for(int i=0; i<n; i++){
				s[i] = sc.nextDouble();
				sum += s[i];
			}
			
			double ave = sum / n;
			double psum = 0;
			for(int i=0; i<n; i++){
				psum += Math.pow(s[i] - ave, 2);
			}
			
			double std = Math.sqrt(psum / n);
			System.out.println(std);
			
		}
	}

}

Measured memory_bytes: 40272
/*==============================================*\
ID:          shahidul_brur
 
Name:     Md. Shahidul Islam
Study:      CSE, BRUR
Address:  Rangpur, Bangladesh
 
 mail: shahidul.cse.brur@gmail.com
 FB  : fb.com/shahidul.brur
 Blog: shahidul-brur.blogspot.com(in Bengali),
       shahidul-brur-en.blogspot.com(in English)
\*===============================================*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};

const double pi = acos(-1.0);
const double eps = 1e-6;
const int mod = (int)1e9+7;
const int maxn = (int)2e5+5;
const int logn = 20;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s; cin>>s;
    int n = s.size();
    f0(i,n)
    {
        if((i%2==0 && s[i]=='L')||(i%2==1 && s[i]=='R')){
            cout << "No"; return 0;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 10005;
const int mod = 1000000007;


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int k,a,b;
  cin>>k>>a>>b;
  int tt = (a+k-1)/k*k;
  if(tt<=b)cout<<"OK"<<endl;
  else cout<<"NG"<<endl;
  return 0;
}

Measured memory_bytes: 3592
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;

void main ()
{
	long [] a;
	while ((a = readln.splitter.map !(to !(long)).array) != [])
	{
		auto n = readln.strip.to !(long);
		foreach (i, c; a)
		{
			if (i > 0)
			{
				a[i] = min (a[i], a[i - 1] * 2);
			}
		}
		writeln (a[3] * (n / 2) + a[2] * (n % 2));
	}
}


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

int main() {
    int N;
    while (cin >> N, N) {
        int id = 1000000000;
        double bmi = 2000.0;
        for (int i = 0; i < N; i++) {
            int d;
            double h, w;
            cin >> d >> h >> w;
            h /= 100.0;

            if (bmi > abs(22.0 - (w / (h * h)))) {
                id = d;
                bmi = abs(22.0 - (w / (h * h)));
            } else if (bmi == abs(22.0 - (w / (h * h)))) {
                id = min(d, id);
            }
        }

        cout << id << endl;
    }

    return 0;
}

Measured memory_bytes: 3088
/**   Created by: Humberto Yusta
          Codeforces User: humbertoyusta
          Country: Cuba
          Copyright��                    */
#include<bits/stdc++.h>
using namespace std;
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 200010;
const int mod = 1000000007;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = (((1ll<<59ll)-1ll)*2ll)+1ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Template ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b % mod;
    int pwur = qpow(b,e>>1);
    return pwur * pwur % mod;
}
/// My Code -------------------------------------------------

int n;
set<int> s;

void can(int p){
    if( p == 0 ) return;
    if( p == 1 ) return;
    int m = n;
    while( m % p == 0 ) m /= p;
    if( m % p == 1 ) s.insert(p);
}

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));

    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);

    cin >> n;

    for(int i=1; i*i<=n; i++)
        if( n % i == 0 ){
            can(i);
            can(n/i);
        }

    for(int i=1; i*i<=(n-1); i++)
        if( (n-1) % i == 0 ){
            can(i);
            can((n-1)/i);
        }

    cout << s.size() << '\n';

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

		static void solve(){
			Scanner sc = new Scanner(System.in);
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int k = sc.nextInt();
			int max = Integer.MIN_VALUE;
			max = Math.max(a, b);
			max = Math.max(max, c);
			int max1 = max*2;
			sc.close();
			for(int i = 0;i<k;i++) {
				max*=2;
			}
			System.out.println(a+b+c+max-max1/2);
		}
	public static void main(String[] args) {
		solve();

	}

}


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

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

using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main(){
    ll n;
    cin >> n;
    vector<ll> P(n);
    rep(i, n){
        cin >> P[i];
    }
    ll res = 1;
    ll min = P[0];
    for(ll i = 1; i < n; i++){
        if(P[i] < min){
            res++;
            min = P[i];
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
using namespace std;
#define N 200010
int a[N];
struct {
	int x, s;
}st[N];
int main() {
	int n, i;
	scanf("%d", &n);
	for(i = 1; i <= n; i++) scanf("%d", &a[i]);
	int l = 1, r = n, ans;
	while(l <= r) {
		int mid = (l + r) / 2;
		int s = 0, t = 0, ok = 1;
		for(i = 1; i <= n; i++) {
			if(a[i] > s) {
				st[++t].x = 1, st[t].s = a[i] - s;
				s = a[i];
			}
			else {
				int p = 0;
				while(s > a[i]) {
					if(s - st[t].s > a[i]) s -= st[t].s, st[t].s--, t--;
					else {
						st[t].s -= s - a[i];
						s = a[i];
					}
				}
				while(st[t].s == 0) t--;
				p = st[t].x;
				int j = t; 
				while(st[j].x == mid && j) j--;
				if(j == 0) {
					ok = 0;
					break;
				}
				if(st[j].s == 1) {
					j = t;
					while(st[j].x == mid && j) {
						st[j].x = 1;
						j--;
					}
					st[j].x++;
				}
				else {
					j = t, t++;
					while(st[j].x == mid && j) {
						st[j + 1] = st[j];
						st[j + 1].x  = 1;
						j--;
					}
					st[j + 1].x = st[j].x + 1, st[j + 1].s = 1;
					st[j].s--;
				}
				
			}
		}
		if(ok) ans = mid, r = mid - 1; else l = mid + 1;
	}
	printf("%d", ans);
	return 0;
}

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

int main() {
	cin >> s;
	while(s != "#") {
		int Ls = (int)(s.size());
		vector<string> V1 = {s};
		for (char c = 'z' - 1; c >= 'a'; c--) {
			vector<string> V2 = {};
			for (auto v : V1) {
				bool f = false;
				for (int i = 0; i < Ls; i++) {
					if (v[i] == c + 1) {
						f = true;
						break;
					}
					if (v[i] == c) {
						string s2 = v;
						s2[i] ++;
						V2.push_back(s2);
					}
				}
				if (!f) {
					V2.push_back(v);
				}
			}
			V1 = V2;
		}
		sort(V1.begin(), V1.end());
		int Lv = (int)(V1.size());
		if (Lv <= 10) {
			cout << Lv << endl;
			for (int i = 0; i < Lv; i++) {
				cout << V1[i] << endl;
			}
		} else {
			cout << Lv << endl;
			for (int i = 0; i < 5; i++) {
				cout << V1[i] << endl;
			}
			
			for (int i = Lv - 5; i < Lv; i++) {
				cout << V1[i] << endl;
			}
		}
		cin >> s;
	}
}
	


Measured memory_bytes: 5044
#include <stdio.h>
#define N 500000
#define INFTY 1000000000
int L[N],R[N];
int count=0,n;
void merge(int * ,int ,int ,int );
void mergeSort(int *,int ,int );
int main()
{
  int A[N],i;

  
  scanf("%d",&n);

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

  mergeSort(A,0,n);
  for(i=0;i<n;i++)
    {
      printf("%d",A[i]);
      if(i!=n-1)printf(" ");


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




  
return 0;
}


void  merge(int A[],int left,int mid,int right)
{
  int  n1 = mid - left,n2=right - mid,i=0,j=0,k=0;
 
  for( i = 0;i<n1;i++)   L[i] = A[left + i];
  for (i = 0;i<n2;i++)   R[i] = A[mid + i];
  
  L[n1] = INFTY;
  R[n2] = INFTY;
  i=0;
  j=0;


  for (k = left; k< right;k++)
    {
      count++;
      if( L[i] <= R[j])
	{
	A[k] = L[i];
	i = i + 1;
	}
      else
	{
	  A[k] = R[j];
	  j = j + 1;

	}
    }
}



void mergeSort(int A[],int  left,int right)
{
  
  if (left+1 < right)
    {
      int  mid = (left + right)/2;
      mergeSort(A, left, mid);
      mergeSort(A, mid, right);
      merge(A, left, mid, right);
    }
}



Measured memory_bytes: 5676
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

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

        final int N = Integer.parseInt(sc.next());
        int[] a = IntStream.range(0,N).map(i -> Integer.parseInt(sc.next())).toArray();
        long ans = 0;
        for (int i = 0; i < N; i++) {
            ans += (a[i] - 1);
        }
        
        out.println(ans);
        
        out.flush();
    }
}

Measured memory_bytes: 28492
/*
   AUTHOR :- Gaurang_Kothiya
   
   Quote:-" Great things never come from comfort zones."                                                                                                                
*/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>
 
using namespace std;
using namespace __gnu_pbds;  

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> data_set; 
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long  
#define ld long double
#define f(i,x,n) for(ll i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(ll i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define b_s(a,b)   binary_search( all(a),b)
#define lb(v,n)  lower_bound(all(v) ,n )
#define ub(v,n)  upper_bound( all(v) , n)
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846
#define MOD 1000000007



void Solve()
{
	string s;
	cin>>s;
	
	if(s[0]=='7' || s[1]=='7' ||s[2]=='7')cout<<"Yes";
	else cout<<"No";
	
	
}


signed main() 
{
	speed		
		
	ll q=1;	
	//cin>>q;	
	
	while(q--)	
	Solve();	
	
	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}

 
 

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
	ll N, A, B;
	scanf("%lld %lld %lld", &N, &A, &B);
	ll ans = (N - 1) * B + A - (N - 1) * A - B + 1;
	if(ans < 0) printf("0\n");
	else printf("%lld\n", ans);
	return 0;
}


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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

signed main(){
    int N,M;
    cin>>N>>M;
    vint b(N);
    vint p(M);
    rep(i,N)cin>>b[i];
    rep(i,M)cin>>p[i];
    int cnt=count(all(b),0);
    int ans=1<<25;
    rep(i,1<<M){
        int hoge=0;
        rep(j,M)if(i>>j&1)hoge+=p[j];
        for(int j=0;j<M-1;j++){
            int x=i>>j&1;
            int y=i>>(j+1)&1;
            if(x==y)hoge=111111;
        }
        if(cnt!=hoge)continue;
        vint bb(N);
        int cur=0;
        rep(j,M){
            rep(k,p[j]){
                if(i>>j&1)bb[cur+k]=0;
                else bb[cur+k]=1;
            }
            cur+=p[j];
        }
        int foo=0;
        rep(j,N){
            int idx=j;
            while(b[j]!=bb[idx])idx++;
            while(j!=idx){
                swap(bb[idx],bb[idx-1]);
                foo++;
                idx--;
            }
        }
        chmin(ans,foo);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll r = -(1LL<<62);
	vector<ll> aa = {a, b}, bb = {c, d};
	if (a <= 0 && 0 <= b) aa.push_back(0);
	if (c <= 0 && 0 <= d) bb.push_back(0);
	for (auto x : aa) for (auto y : bb) {
		r = max(r, x*y);
	}
	cout << r << endl;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include<algorithm>

using namespace std;

int main(){
	long long  a[3],b=0;
	scanf("%lld %lld %lld",&a[0],&a[1],&a[2]);
	sort(a,a+3);
	b=(a[2]%2)*(a[1]*a[0]);
	printf("%lld",b);
	return 0;
}

Measured memory_bytes: 128
class Queue {
    constructor(data, length) {
        // 最大値はレングスの倍くらいが望ましい
        this.max = parseInt(length, 10) * 2;
        this.head = 0;
        this.tail = 0;
        this.q = [];
        for(const d of data){
            this.enqueue(d);
        }
    }

    isEmpty() {
        return this.head === this.tail;
    }

    isFull() {
        return this.head === (this.tail + 1) % this.max;
    }

    dequeue() {
        if (this.isEmpty()) {
            return;
        }
        const q = this.q[this.head];
        this.head = this.head + 1 === this.max ? 0 : this.head + 1;
        return q;
    }

    enqueue(process) {
        if (this.isFull()) {
            return;
        }
        this.q[this.tail] = process;
        this.tail = this.tail + 1 === this.max ? 0 : this.tail + 1;
    }
}


function main(stdin) {
    const _inputs = stdin.split("\n");
    let inputs = _inputs.map(ele => ele.split(' '));
    let [length, quantum] = inputs.shift();
    quantum = parseInt(quantum, 10);
    inputs = inputs.map(ele => [ele[0], parseInt(ele[1], 10)]);
    inputs = inputs.filter((e, i) => i < length);
    const q = new Queue(inputs, length);
    let process;
    let total = 0;
    while (process = q.dequeue()) {
        const cost = process[1];
        process[1] -= quantum;
        if (process[1] <= 0) {
            total += cost;
            console.log(`${process[0]} ${total}`);
        } else {
            total += quantum;
            q.enqueue(process);
        }
    }
}



main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 70400
#include <cstdio>
#include <algorithm>

using std::sort;
using std::swap;
using std::lower_bound;
using std::reverse;

const int MAXN=3e5+5;
int n,a,b;
int p[MAXN];

/*inline void construct(){
	static int tmp[MAXN<<1];
	int i=1;
	for(int k=1;k<=a;i+=2,++k)
		tmp[i]=i;
	int lim=i-2;
	i-=2+1;
	if(a+b==n+1) --b;
	for(int k=1;k<=b;i-=2,++k)
		tmp[i]=tmp[i+1]+1;
	for(int i=1;i<=n;++i)
		p[i]=tmp[i];
	sort(tmp+1,tmp+lim+1);
	for(int i=1;i<=n;++i)
		p[i]=lower_bound(tmp+1,tmp+lim+1,p[i])-tmp;
	for(int i=1;(i<<1)<=n;++i)
		tmp[i]=i<<1;
	if(n&1) tmp[(n>>1)+1]=1;
	for(int i=(n>>1)+1+(~n&1),j=n>>1<<1;i<=n;++i)
}*/

int main(){
	scanf("%d%d%d",&n,&a,&b);
	for(int i=1;i<=n;++i)
		p[i]=i;
	if(a+b>n+1 || (n+a-1)/a>b){
		printf("-1");
		return 0;
	}
	if(a==1){
		for(int i=n;i;--i)
			printf("%d ",i);
		return 0;
	}
	int len=(n-b)/(a-1),rest=(n-b)%(a-1);
	//lds:len=b
	reverse(p+1,p+b+1);
	for(int i=2,l=b+1;i<=a;++i){
		if(rest){
			reverse(p+l,p+l+len+1);
			--rest;
			l+=len+1;
		}
		else{
			reverse(p+l,p+l+len);
			l+=len;
		}
	}
	for(int i=1;i<=n;++i)
		printf("%d ",p[i]);
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

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

string N;

int main()
{
    cin >> N;

    ll ans = 0;
    ll c = 0;
    REP(i, N.size())
    {
        ll x = N[N.size() - 1 - i] - '0' + c;
        if (x < 5)
        {
            ans += x;
            c = 0;
        }
        else if (x == 5)
        {
            if (i < N.size() - 1 and N[N.size() - 2 - i] - '0' >= 5)
            {
                ans += 5;
                c = 1;
            }
            else
            {
                ans += x;
                c = 0;
            }
        }
        else
        {
            ans += 10 - x;
            c = 1;
        }
    }
    if (c == 1)
    {
        ++ans;
    }

    OUT(ans);
}

Measured memory_bytes: 1412
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
const long long mod = 1e9 + 7;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> l(m);
    vector<int> r(m);
    rep(i, m) cin >> l[i] >> r[i];
    sort(l.begin(), l.end());
    sort(r.begin(), r.end());
    int ans = -l[m - 1] + r[0] + 1;
    if (ans < 0)
        cout << 0 << endl;
    else
        cout << ans << endl;
    return 0;
}


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

int main() {
    int N; cin >> N;
    vector<int> A(N);
    vector<int> B1(N);
    vector<int> B2(N);
    rep(i, N){
        cin >> A[i];
    }

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

    int cnt = 0;
    int n = N / 2;
    int l = 0;
    int r = N-1;
    B1[n] = A[r];
    r--;
    cnt++;
    int d = 1;
    while(cnt < N){
        B1[n-d] = A[l];
        l++; cnt++;
        if(cnt == N)break;

        B1[n+d] = A[l];
        l++; cnt++;
        if(cnt == N)break;

        d++;

        B1[n-d] = A[r];
        r--; cnt++;
        if(cnt == N)break;

        B1[n+d] = A[r];
        r--; cnt++;
        if(cnt == N)break;

        d++;

    }

    cnt = 0;
    l = 0;
    r = N-1;
    B2[n] = A[l];
    l++;
    cnt++;
    d = 1;

    while(cnt < N){
        B2[n-d] = A[r];
        r--; cnt++;
        if(cnt == N)break;

        B2[n+d] = A[r];
        r--; cnt++;
        if(cnt == N)break;

        d++;

        B2[n-d] = A[l];
        l++; cnt++;
        if(cnt == N)break;

        B2[n+d] = A[l];
        l++; cnt++;
        if(cnt == N)break;

        d++;

    }

    ll ans1 = 0;
    ll ans2 = 0;
    for (int i = 1; i < N; i++){
        ans1 += abs(B1[i] - B1[i-1]);
        ans2 += abs(B2[i] - B2[i-1]);
    }

    cout << max(ans1, ans2) << endl;

    return 0;
}

Measured memory_bytes: 4584
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
typedef long long int ll;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef vector<double> vecd;
typedef vector<string> vecstr;
typedef vector<char> vecchar;
typedef vector<bool> vecbool;
typedef vector<vector<bool>> vec2bool;
typedef vector<vector<int>> vec2int;
typedef vector<vector<double>> vec2d;
////////////////////////////////////////////////
void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
////////////////////////////////////////////////
int main() {
  init();
  int n;
  cin >> n;
  vecint a(n + 1);
  REP(i, n) cin >> a[i + 1];
  vecint ans(n + 1, -1);  // 1-indexed
  vecint out;
  for (int i = n / 2 + 1; i <= n; i++) ans[i] = a[i];
  // REP(i, n) { cout << ans[i + 1] << endl; }
  for (int i = n / 2; i >= 1; i--) {
    int sum = a[i];
    for (int j = n / i; j >= 2; j--) {
      sum += ans[i * j];
    }
    ans[i] = sum % 2;
  }
  // REP(i, n) { cout << ans[i + 1] << endl; }
  REP(i, n) {
    if (ans[i + 1] == 1) out.push_back(i + 1);
  }
  if (out.size() == 0) {
    cout << 0 << endl;
  } else {
    cout << out.size() << endl;
    REP(i, out.size() - 1) cout << out[i] << " ";
    cout << out.back() << endl;
  }
}


Measured memory_bytes: 3192
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;


ll dp[205][100005];

int main(int argc, char* argv[])
{
    long n, x;
    scanf("%ld%ld", &n, &x);

    vector<long> s(n);
    long i,j;
    for(i=0; i<n; i++) {
        scanf("%ld", &s[i]);
    }
    sort(s.rbegin(), s.rend());

    dp[0][x]=1;
    for(i=0; i<n; i++) {
        for(j=0; j<=x; j++) {
            if(dp[i][j]) {
                if(i<n-1) dp[i+1][j] = (dp[i+1][j] + (dp[i][j]* (n-i-1)))%MOD;
                dp[i+1][j%s[i]] = (dp[i+1][j%s[i]] + dp[i][j])%MOD;
            }
        }
    }

    ll ans=0;
    for(i=0; i<s[n-1]; i++) {
        ans = (ans + i*dp[n][i])%MOD;
    }
    printf("%lld\n", ans);

    return 0;
}


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

int main() {
	int n, m; cin >> n >> m;
	vector<int>a(m);
	for (auto &e : a)cin >> e;
	vector<int>p(n + 1, 0);
	p[0] = 1;
	std::vector<int>::iterator t;
	if (m != 0)t = a.begin();
	if (m == 0 or a[0] != 1) {
		p[1] = 1;
	} else {
		if (m != 0)t++;
	}
	if (m != 0) {
		for (int i = 2; i < n + 1; i++) {
			if (*t == i) {
				p[i] = 0;
				t++;
			} else {
				p[i] = (p[i - 1] + p[i - 2]) % 1000000007;
			}
		}
	} else {
		for (int i = 2; i < n + 1; i++) {
			p[i] = (p[i - 1] + p[i - 2]) % 1000000007;
		}
	}
	cout << p[n] << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>

using namespace std;

// ユークリッドの互除法
// 最大公約数を求める
int CalcGCD(int a, int b)
{
	if (a < b) swap(a, b);
	if (b == 0) return a;
	return CalcGCD(a % b, b);
}

int main() {

	int A, B;
	cin >> A >> B;

	if (B % A == 0)
	{
		cout << A+B << endl;
	}
	else
	{
		cout << B - A << endl;
	}

	return 0;
}

Measured memory_bytes: 256