akhauriyash/Code-Regression huggingface dataset:
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int n;
  cin >> n;

  vi h(n);
  rep(i,n) cin >> h[i];

  int cnt = 0;
  for(int i = 0; i < n;i++)
  {
    bool b = true;
    for(int j = 0; j < i;j++)
    {
      if(h[i] < h[j])
      {
        b = false;
        break;
      }
    }
    if(b) cnt++;
  }

  cout << cnt;

  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

int main(){
    ll n;
    cin>>n;
    ll t=26;
    int cnt=1;
    while(n>t){
        n-=t;
        t*=26;
        ++cnt;
    }
    --n;
    vector<char> v;
    rep(i,cnt){
        int r=n%26;
        v.push_back('a'+r);
        n/=26;
    }
    for(auto i=v.rbegin();i!=v.rend();++i){
        cout<<*i;
    }
    cout<<endl;
}


Measured memory_bytes: 3612
#include<utility>
#include<vector>
#include<iostream>
#include<string>
using namespace std;

int main(){
/*	int i, g, j, gj, h, gh;
	cin >> i >> g >> j >> gj >> h >> gh;

	if(i + 5*g + 10*j + 50*gj + 100*h + 500*gh >= 1000){
		cout << "1" << endl;
	}

	else{
		cout << "0" << endl;
	}*/

	/*int d, c;
	cin >> d >> c;
	cout << d * c << endl;*/

	int n;
	cin >> n;

	for(int i=0; i<n; i++){
		int k,p;
		cin >> k >> p;
		if(k%p == 0){
			cout << p << endl;
		}
		else cout << k%p << endl;
	}



	return 0;

}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
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; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int n;
vector<ll> a;

void input(){
    cin >> n;
    a.resize(n);
    for(int i=0;i<n;i++) cin >> a[i];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    ll ans = 0;
    for(int i=0;i<n;i++){
        ans += (a[i] - 1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline

def main():
    N = int(input())
    a = [0] + list(map(int, input().split()))

    box = [0] * (N+1)
    for i in range(N, 0, -1):
        tmp = sum(box[i::i])
        if tmp%2 == a[i]:
            continue
        else:
            box[i] = 1
    ans = []
    for i in range(1, N+1):
        if box[i] == 1:
            ans.append(i)
    print(sum(box))
    if len(ans) != 0:
        print(*ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 14096
N = gets.to_i
Ss = $<.map &:chomp
ba = _a = b_ = 0
ans = 0
Ss.each{|s|
  ans += s.scan('AB').size

  f1 = s[/^B/]
  f2 = s[/A$/]
  ba += 1 if f1 && f2
  _a += 1 if !f1 && f2
  b_ += 1 if f1 && !f2
}
ans += [0, ba - 1].max
if ba > 0
  if _a > 0
    ans += 1
    _a -= 1
  end
  if b_ > 0
    ans += 1
    b_ -= 1
  end
end
ans += [_a, b_].min
p ans

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

using namespace std;

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

  int sum = INT_MAX;
  int cn_max = max(x, y) * 2;
  for (int cn = 0; cn <= cn_max; cn++) {
    int an = max(x - cn / 2, 0);
    int bn = max(y - cn / 2, 0);

    // printf("an=%d, bn=%d, cn=%d\n", an, bn, cn);
    sum = min(an*a + bn*b + cn*c, sum);
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
#include <numeric>
using namespace std;

int main()
{
    int n;
    vector<int> a;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    int x = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            x += a[i];
        } else {
            x -= a[i];
        }
    }

    cout << x / 2 * 2 << " ";
    int tmp = x / 2;
    for (int i = 0; i < n - 1; i++) {
        tmp = a[i] - tmp;
        cout << tmp * 2 << " ";
    }
    cout << endl;
}


Measured memory_bytes: 1784
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N,M = map(int,input().split())
fr = [[] for _ in range(N)]

AB = [list(map(int,input().split())) for _ in range(M)]
for i in range(M):
    a,b = AB[i]
    a,b = a-1,b-1
    fr[a].append(b)
    fr[b].append(a)
def dfs(fr,cur,parent,index,li):
    children = fr[cur]
    for chi in children:
        if chi == parent or used[chi] != -1:
            continue
        used[chi] = index
        li.append(chi)
        dfs(fr,chi,cur,index,li)
cnt = 0
for i in range(M):
    a,b = AB[i]
    a,b = a-1,b-1
    used = [-1]*N #-1なら未探索。数字はrenketuのindex
    renketu = []
    index = 0
    fr[a].remove(b)
    fr[b].remove(a)
    for j in range(N):
        if used[j] != -1:
            continue
        li = [j]
        used[j] = index
        dfs(fr,j,-1,index,li)
        index += 1
        renketu.append(li)
    if len(renketu) != 1:
        cnt += 1
    fr[a].append(b)
    fr[b].append(a)
print(cnt)

Measured memory_bytes: 10568
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int n, a, b, ans = 0;
  cin >> n >> a >> b;
  for (int i = 1; i <= n; i++) {
    int tmp = i;
    int sum = 0;
    while (tmp > 0) {
      sum += tmp % 10;
      tmp /= 10;
    }
    if (a <= sum && sum <= b) ans += i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

const int Max = 30;
int N, M, C;
int B[Max];
int A[Max][Max];

int main(int argc, const char * argv[]) {
    N = inputValue();
    M = inputValue();
    C = inputValue();
    inputArray(B, M);
    rep(i, N) {
        inputArray(A[i], M);
    }

    int ans = 0;
    rep(i, N) {
        int val = C;
        rep(j, M) {
            val += A[i][j] * B[j];
        }

        if (val > 0) ans += 1;
    }

    output(ans);



    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main()
{
    int a,b,h;
    cin >> a >> b >> h;
    cout << (a+b)*h/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll,ll> ii; 
typedef pair <ii,int> iii;
 
const int inf = 0x3F3F3F3F;
const ull mod = 998244353;

void solve(){
	ll n, x = 5, ans = 0;
	cin >> n;
	if(n%2 == 1)
		cout << 0 << endl;
	else{
		while(x <= n){
			ans += (n/x)/2;
			x *= 5;
		}
		cout << ans << endl;
	}
}

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


Measured memory_bytes: 384
#include <iostream>
#include <math.h>
#include <queue>
#include <map>
#include <string>
using namespace std;
typedef pair <int, int>P;
map<int, int> d;
queue<P> que;
int t[8] = { 1,10,100,1000,10000,100000,1000000,10000000 };
int bfs() {
	queue<P> que;
	que.push(P(81234567,7));
	d[81234567] = 0;
	while (que.size()) {
		P p = que.front(); que.pop();
		//if (p.first == 81234567)  break; 
	    int a1;
		if (p.second!=7&&p.second!=3) {
		a1 = p.first + (8 - (p.first / t[p.second+1]) % 10)*(t[p.second + 1] - t[p.second + 1] / 10);
			if (d[a1] == 0) {
				que.push(P(a1, p.second + 1));
				d[a1] = d[p.first] + 1;
			}
		}
	    int b1;
		if (p.second != 0&&p.second != 4) {
		b1 = p.first + (8 - (p.first / t[p.second - 1]) % 10)*(-10* t[p.second - 1] + t[p.second - 1]);
			if (d[b1] == 0) {
				que.push(P(b1, p.second - 1));
				d[b1] = d[p.first] + 1;
			}
		}
	    int c1;
		if (p.second<4) {
		c1 = p.first + (8 - (p.first / (t[p.second] * t[4])) % 10)*(t[p.second] *t[4]- t[p.second]);
			if (d[c1] == 0) {
				que.push(P(c1, p.second + 4));
				d[c1] = d[p.first] + 1;
			}
		}
	    int e1;
		if (p.second > 3) {
		e1 = p.first - (8 - (p.first / (t[p.second] /t[4])) % 10)*(t[p.second] - t[p.second] /t[4]);
			if (d[e1] == 0) {
				que.push(P(e1, p.second - 4));
				d[e1] = d[p.first] + 1;
			}
		}
	}
}
int main() {
	bfs();
	int  x = 0, y = 0, z = 0; int a[8]; bool flag = true;
	while (flag) {
		x = 0;
		for (int i = 0; i < 8; i++) {
			cin >> a[i];
			if (a[i] == 0) { a[i] = 8; y = 7 - i; }
			x += a[i] * t[7 - i];
		}
		if (z == x) {
			break;
		}
		else {
			z = x;
		}
		if (x == 81234567) { cout << 0 << endl; }
		else { cout << d[x] << endl; }
	}
}

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

int main() {
	int N, K, A;
	cin >> N >> K;
	cout << (N + K - 3) / (K - 1);
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

全てのマスを網羅するには、全ての区間が他の区間を1個だけ含む必要があるので
*/

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	int n, m;
	cin >> n >> m;
	vector<vector<int>> c(m);
	while (n--) {
		int a, b;
		cin >> a >> b;
		if (a <= m)
			c[a - 1].push_back(b);
	}
	int r = 0;
	priority_queue<int> q;
	for (auto const& l : c) {
		for (int x : l) {
			q.push(x);
		}
		if (!q.empty()) {
			r += q.top();
			q.pop();
		}
	}
	cout << r << '\n';
	return 0;
}


Measured memory_bytes: 5632
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>

using namespace std;

static long long A, B, C, D;
long long solve();
long long gcd(long long a, long long b);
long long lcm(long long a, long long b);

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

long long solve() {
  long long X = B / C;
  if (A > 0) {
    X -= (A - 1) / C;
  }
  long long Y = B / D;
  if (A > 0) {
    Y -= (A - 1) / D;
  }
  long long CD = lcm(C, D);
  long long Z = B / CD;
  if (A > 0) {
    Z -= (A - 1) / CD;
  }
  return B - A + 1LL - X - Y + Z;
}

int main() {
  cin >> A >> B >> C >> D;
  cout << solve() << endl;
  return 0;
}


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

int main() {

    int N, K;
    cin >> N >> K;

    int l[N];
    rep(i, N) cin >> l[i];
    sort(l, l+N, greater<int>());

    int ans = 0;
    for (int i = 0; i < K; ++i) {
        ans += l[i];
    }
    
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>

#define rep(x,to) for(x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;


int main(void){

int i;
vector<int> yama(10,0);
	rep(i,10) cin >> yama[i];
	sort(yama.begin(),yama.end(),greater<int>());
	rep(i,3) cout << yama[i] << endl;
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
int a[100005];
long long f[100005];
const long long D=1e9+7;
int n,k;
long long ans;

long long pow2(long long x,long long y){
    if(y==1)return x;
    long long t=pow2(x,y/2);
    long long ret=t*t%D;
    if(y%2==1)ret*=x;
    return ret%D;
}
int main(){
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);

    int i,j;
    cin>>n>>k;
    f[0]=1;
    for(i=1 ; i<=k ; i++)f[i]=f[i-1]*i%D;
    for(i=1 ; i<n ; i++){
        int u,v;
        cin>>u>>v;
        a[u]++;
        a[v]++;
        if(a[u]>k-1 || a[v]>k-1){
            cout<<0;
            return 0;
        }
    }
 ///   cout<<k*f[k-1]%D;
    ans=k*f[k-1]%D*pow2(f[k-1-a[1]],D-2)%D;
    for(i=2 ; i<=n ; i++){
    ///    cout<<ans<<endl;
        if(a[i]>1)
        ans*=f[k-2]*pow2(f[k-1-a[i]],D-2)%D;
        ans%=D;
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 1408
import math
N, D = map(int, input().split())
X = [0]*N
for i in range(N):
    X[i] = list(map(int, input().split()))
# print(N, D, X)

def distance(A, B):
    d = 0
    for i in range(D):
        d += (A[i] - B[i])**2
    return math.sqrt(d)

ans = 0

for i in range(N):
    for j in range(i + 1, N):
        d = distance(X[i], X[j])
        if int(d) == d:
            ans += 1

print(ans)


Measured memory_bytes: 38256
from math import cos, sqrt, radians


A, B, H, M = map(int, input().split())
Md = M * 6
Hd = (H * 30) + ((M/60) * 30)
Cd = (Hd - Md)
As = A ** 2
Bs = B ** 2
D = 2 * A * B
X = sqrt(As + Bs - (D * cos(radians(Cd))))
print(X)

Measured memory_bytes: 9512
#include<bits/stdc++.h>
#define M 1046527
using namespace std;
long long h1(long long key){
	return key%M;
}
long long h2(long long key){
	return 1+(key%(M-1));
}
long long getNum(char c){
	if(c=='A')return 1;
	if(c=='C')return 2;
	if(c=='G')return 3;
	if(c=='T')return 4;
	return 0;
}
long long getValue(char* s){
	long long i=0,value=0;
	while(s[i]){
		value=value*10+getNum(s[i]);
		i++;
	}
	return value;
}
char s[1046527][13],word[13],order[10];
long long n,key,value;
int main(){
		cin>>n;
		for(long long i=0;i<1000006;i++)s[i][0]=0;
		for(long long i=0;i<n;i++){
			scanf("%s %s",order,word);
			value=getValue(word);
			if(order[0]=='i'){
				long long k=0;
				while(true){
					key=(h1(value)+k*h2(value))%M;
					if(strcmp(s[key],word)==0){
						break;
					}else if(strlen(s[key])==0){
						strcpy(s[key],word);
						break;
					}
					k++;
				}
			}else{
				long long k=0;
				while(true){
					key=(h1(value)+k*h2(value))%M;
					if(strcmp(s[key],word)==0){
						cout<<"yes\n";
						break;
					}else if(strlen(s[key])==0){
						cout<<"no\n";
						break;
					}
					k++;
				}
			}
		}
	
	return 0;
} 


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


#define ONSPEED ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define f(i,x,n) for(i=x;i<n;i++)
#define rf(i,x,n) for(i=n;i>x;i--)
#define ll long long
#define GCD(a,b) __gcd(a,b)
#define ff first
#define ss second
#define adios return 0;

/*
tacet aquilae
*/

int main()
{
    ONSPEED;
    ll t,n,k,a,b,c,d,s=0,i,j,flag;
    string x,y;
    cin>>n;
    std::vector<ll> V(n), C(n);
    f(i,0,n) cin>>V[i];
	f(i,0,n) cin>>C[i];
	f(i,0,n)
	{
		if(V[i]>C[i])
		{
			s+=V[i]-C[i];
		}
	}
	cout<<s<<endl;




    adios;
}
	


Measured memory_bytes: 3544
#include <iostream>
#include <algorithm>
#include <cassert>
#include <vector>
#include <cmath>
#include <stdio.h>

using namespace std;

//-------------------------------------------------------------------------
// geometric library

namespace geometry {

#define EPS 1E-10 ///< 0とみなすサイズ。適当

	struct point {
		double x;
		double y;

		point& operator += (const point& rhs) { x += rhs.x; y += rhs.y; return *this; }
		point& operator -= (const point& rhs) { x -= rhs.x; y -= rhs.y; return *this; }
		point& operator /= (double factor) { x /= factor; y /= factor; return *this; }
		point& operator *= (double factor) { x *= factor; y *= factor; return *this; }
		bool operator == (const point& rhs) const { return (std::abs(x - rhs.x) < EPS) && (std::abs(y - rhs.y) < EPS); }
		bool operator != (const point& rhs) const { return !(*this == rhs); }
		bool operator <= (const point& rhs) const { return x < rhs.x || (x == rhs.x && y <= rhs.y); }
		bool operator >= (const point& rhs) const { return x > rhs.x || (x == rhs.x && y >= rhs.y); }
		bool operator < (const point& rhs) const { return !(*this >= rhs); }
		bool operator > (const point& rhs) const { return !(*this <= rhs); }
	};

	struct circle {
		point center;
		double radius;
	};

	struct line {
		// ax + by + c = 0
		double a;
		double b;
		double c;
	};

	enum rotate_dir {
		rotate_None = 0,
		rotate_CW = 1,
		rotate_CCW = -1
	};

	point operator + (const point& p1, const point& p2)
	{
		point p(p1);
		p += p2;
		return p;
	}

	point operator / (const point& p1, double factor)
	{
		point p(p1);
		p /= factor;
		return p;
	}

	point operator - (const point& p1, const point& p2)
	{
		point p(p1);
		p -= p2;
		return p;
	}

	std::istream& operator >> (std::istream& is, point& p)
	{
		is >> p.x >> p.y;
		return is;
	}

} // namespace geometry

//-------------------------------------------------------------------------
// solution

using namespace geometry;

int main(void) {
	point pA1, pA2, pB1, pB2;

	while (cin >> pA1 >> pA2 >> pB1 >> pB2) {
		if (max(pA1.x, pB1.x) <= min(pA2.x, pB2.x) && max(pA1.y, pB1.y) <= min(pA2.y, pB2.y)) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

void input() {
  ;
  ;
  cin >> N >> M;
  // rep(i, 1, 9999) {
  //   N -= M;
  //   if (N <= 0) {
  //     cout << i << endl;
  //     return;
  //   }
  // }
  cout << (N - 1) / M + 1 << endl;
}
void solve() {
  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pw(x) (1ll << (x))
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(l);i<(r);++i)
#define per(i,l,r) for(int i=(r)-1;i>=(l);--i)
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl

//-----
ll mul(ll a, ll b) { return a * min(b, LLONG_MAX / a); }
ll f(ll b, ll n) {
	ll r = 0;
	while (n) { r += n % b; n /= b; }
	return r;
}
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll n, s; cin >> n >> s;
  rep(b, 2, 1000001) if (f(b, n) == s) { cout << b; return 0; }
	per(x, 1, 100000) {
		if ((n + x - s) < 2 || (n + x - s) % x != 0) continue;
		ll b = (n + x - s) / x;
		if (mul(x, b) > n || mul(x + 1, b) <= n) continue;
		cout << b; return 0;
	}
	if (n == s) cout << n + 1;
	else cout << -1;
	return 0;
}

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

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

    long ans = 1;
    ans *= K;
    for (int i = 0; i < N - 1; i++) {
        ans *= K - 1;
    }

    cout << ans << endl;
}

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

int main(){
    int N;cin >> N;
    vector<int> d(N);
    rep(i,N)cin >> d[i];
    sort(d.begin(),d.end());
    int res = d[N/2] - d[N/2-1];
    cout << res << endl;
    return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x, y;
  cin >> n >> x >> y;
  --x; --y;
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int cur = abs(i - j);
      cur = min(cur, abs(i - x) + 1 + abs(j - y));
      cur = min(cur, abs(i - y) + 1 + abs(j - x));
      ans[cur] += 1;
    }
  }
  for (int i = 1; i < n; i++) {
    cout << ans[i] << '\n';
  }
  return 0;
}


Measured memory_bytes: 3624
#include<stdio.h>
int main()
{
	int n;
char a[100008];
	while(~scanf("%d",&n)){
        scanf("%s",a);
        char pa=a[0];
        int s=1;
        for(int i=1;i<n;i++){
        	if(pa!=a[i]){
        		s++;
        		pa=a[i];
			}
		}
		printf("%d\n",s);
	}
}


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

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))
#define OUT(P) cout << (P) << endl
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)
typedef long long ll;

int sum_digits(int num);
template <class T>
vector<T> copy_vector(vector<T> vec);
int gcd(int a, int b);

int main() {
    int a, b, t;
    cin >> a >> b >> t;
    cout << (int) (t+0.5)/a * b;

    return 0;
}

/******************************/
/***** DECRARED FUNCTIONS *****/
/******************************/

int sum_digits(int num) {
    int rtn = 0;
    while(num != 0) {
        int tmp = num % 10; 
        rtn += tmp;
        num /= 10; 
    }   
    return rtn;
}
//int sum_digits(int num) {
//    int rtn = 0;
//    string num_str = to_string(num);
//    for(int i=0; i<num_str.size(); i++) {
//        rtn += num_str[i] - '0';
//    }   
//    return rtn;
//}

// vectorのコピー
template <class T>
vector<T> copy_vector(vector<T> vec) {
    vector<T> rtn;
    rtn.reserve(vec.size());
    copy(vec.begin(), vec.end(), back_inserter(rtn));
    return rtn;
}

// ユークリウッドの互除法
int gcd(int a, int b) {
    if(b==0) return a;
    else return gcd(b, a % b);
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N, M = MAP()
L = [MAP()[1:] for _ in range(M)]
P = MAP()

#print(N,M,L,P)

switches = []
for i in range(2**N):
	switch = [0]*N
	for j in range(N):
		if ((i>>j) & 1):
			switch[N-j-1] = 1
	switches.append(switch)

ans = 0
for s in switches:
	for idx,l in enumerate(L):
		count = 0
		#print(s, P[idx], l)
		for ll in l:
			count+=s[ll-1]
		if count%2!=P[idx]: break
	else:
		ans += 1

print(ans)	

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

using namespace std;


int main() {
    long long k, a, b;
    cin >> k >> a >> b;
    if(b - a <= 2 || k <= a) {
        cout << k + 1 << "\n";
        return 0;
    } 
    long long ans = a, t = k - a + 1;
    if(t % 2 == 1) {
        ans++;
    }
    cout << ans + t / 2 * (b - a) << "\n";
    return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
int main() {
	lli t,n,m,a,b,c,ans;
	string s1,s2;
	cin >> s1 >> s2;
	n=s1.length();
	ans=0;
	for(lli i=0;i<n;i++){
		if(s1[i]!=s2[i]){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}

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

typedef long long ll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define yes "Yes"
#define yse "Yes"
#define no "No"

#define pb push_back
#define rep(i, l, n) for (int i = (l); i < n; i++)
#define rep_cs(i, l, n) for (int i = (l); i <= n; i++)
#define rep_d(j, n) for (int j = n; j >= 0; j--)
#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}

const int MOD = 1000000007;
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const ll INF = 1LL << 60;

// int max = *std::max_element(vec.begin(), vec.end());
// int sum = accumulate(list, list + size, 0);

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

using Graph = vector<vector<int>>;
Graph G;
vector<bool> seen;
void dfs(const Graph &G, int v)
{
    seen[v] = true;

    for (auto next_v : G[v])
    {
        if (seen[next_v])
            continue;
        dfs(G, next_v);
    }
}

int main()
{
    string s;
    cin >> s;
    if (s[0] == s[1] && s[1] == s[2])
    {
        cout << no << endl;
    }
    else
    {
        cout << yes << endl;
    }
}

Measured memory_bytes: 256
N = int(input())
sX = input()

origin_count = sX.count('1')
one_r_count = origin_count -1
zero_r_count = origin_count +1

one_mod = 0
zero_mod =0
for b in sX:
    if one_r_count != 0:
        one_mod = (one_mod * 2 + int(b) )% one_r_count
    zero_mod = (zero_mod * 2  + int(b) )% zero_r_count

f = [0] * 220000
pop = [0]* 220000

for i in range(1,220000):
    pop[i] = pop[i//2] + i % 2
    f[i] = f[i % pop[i]] + 1

onepow = [1] * 220000
zeropow = [1]* 220000

for i in range(1,220000):
    if one_r_count != 0:
        onepow[i] = onepow[i-1] * 2 % one_r_count
    zeropow[i] = zeropow[i-1] * 2 % zero_r_count

for i in range(1,N+1):
    if sX[i-1] == '1':
        if one_r_count != 0:
            Xi_n = one_mod - onepow[N-i]
            Xi_n %= one_r_count
            print(f[Xi_n]+1)
        else:
            print(0)
    else:
        Xi_n = zero_mod + zeropow[N-i]
        Xi_n %= zero_r_count
        print(f[Xi_n]+1)

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

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

	vector<int> av(n);
	for (auto& a: av) {
		cin >> a;
	}

	bool yes = true;
	int prev = av[n-1];
	for (int i = n-2; 0 <=i; --i) {
		if (av[i] - prev == 1) {
			av[i]--;
		}
		else if (av[i] - prev > 1) {
			yes = false;
			break;
		}
		prev = av[i];
	}

	if (yes) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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


#define ll long long


//gcdやり直す

void swap (int *x, int *y) {
  int temp;    

  temp = *x;
  *x = *y;
  *y = temp;
}




/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}

const ll mod = 1000000007ll;
 
ll n, a, b, ans = 1, tmp = 2;
 
ll power(ll x, ll y){
  if(y == 0ll)return 1ll;
  ll res = 1, tmp = x;
  while(y){
      if(y&1){
          res *= tmp;
          res %= mod;
      }
      tmp *= tmp;
      tmp %= mod;
      y >>= 1;
  }
  return res;
}
 
ll COM(ll x, ll y){
  if(x < y) return 0;
  if(x < 0 || y < 0) return 0;
  ll res = 1;
  for(int i=0; i<y; i++){
    res *= x - i;
    res %= mod;
    res *= power(y-i, mod-2);
    res %= mod;
  }
  return res;
}




/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  long int n;
  scanf("%ld",&n);
  long int A[n+100];
  //A[i]:=iの約数が何個あるか

  for(int i=0;i<n+100;i++){
    A[i]=0;
  }
  long int ans=0;

  for(long int i=1;i<=n;i++){
    for(long int j=i;j<=n+10;j+=i){
      A[j]++;
    }
    //N/i回見てる
  }

  for(int i=1;i<=n;i++){
    ans+=A[i]*i;
  }

  printf("%ld\n",ans);
}



/*

N/1 + N/2 + N/3 + N/4 +...+ N/N
N*(H_N)
~N*log(N)


H_n ~ log(n)

f(x)=1/xの積分をすると，下から評価できる

H_n>log(x) [0,infty]

*/

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

#define vec              vector<int>
#define vecll            vector<ll>
#define vecd             vector<double>
#define vecst            vector<string>
#define vecb             vector<bool>
#define v2(v,n,m,init)   vector<vector<int>>  v(n, vector<int>(m, init))
#define vb2(v,n,m,init)  vector<vector<bool>> v(n, vector<bool>(m, init))
#define vll2(v,n,m,init) vector<vector<ll>>   v(n, vector<ll>(m, init))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
template <typename T>
bool chmax(T &a, const T& b){if(a<b){a=b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a>b){a=b; return true;} return false;}
//------------------------------------------------------------------

int main(void){
	int h, w;
	cin >> h >> w;
	arrst(a,h);

	vb2(v, h, w, false);
	vector<pair<int, int>> q;
	int ct=0;
	rep(i,h){
		rep(j,w){
			if(a[i][j]=='.') ct++;
			else q.push_back(make_pair(i,j)), v[i][j]=true;
		}
	}

	int ans=0;
	while(ct){
		ans++;
		vector<pair<int, int>> nextq;
		for(auto k : q){
			int i = k.first;
			int j = k.second;
			if(i!=0){
				if(!v[i-1][j]) ct--, v[i-1][j]=1, nextq.push_back(make_pair(i-1, j));
			}
			if(i!=h-1){
				if(!v[i+1][j]) ct--, v[i+1][j]=1, nextq.push_back(make_pair(i+1, j));
			}
			if(j!=0){
				if(!v[i][j-1]) ct--, v[i][j-1]=1, nextq.push_back(make_pair(i, j-1));
			}
			if(j!=w-1){
				if(!v[i][j+1]) ct--, v[i][j+1]=1, nextq.push_back(make_pair(i, j+1));
			}
		}

		q=nextq;
	}

	prt(ans);
}


Measured memory_bytes: 15048
#include <bits/stdc++.h>
using namespace std;
unordered_map<char,long long> mp;
long long solve(){
	long long ans = 0;
	ans+= (mp['A']*mp['M']*mp['R']);// A M R
	ans+= (mp['A']*mp['M']*mp['C']);// A M C
	ans+= (mp['A']*mp['M']*mp['H']);// A M H
	ans+= (mp['A']*mp['R']*mp['C']);// A R C
	ans+= (mp['A']*mp['R']*mp['H']);// A R H
	ans+= (mp['A']*mp['C']*mp['H']);// A C H
	ans+= (mp['M']*mp['R']*mp['C']);// M R C
	ans+= (mp['M']*mp['R']*mp['H']);// M R H
	ans+= (mp['M']*mp['C']*mp['H']);// M C H
	ans+= (mp['R']*mp['C']*mp['H']);// R C H
	return ans;
}
int main() {
	int n; string s;
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> s;
		mp[s[0]]++;
	}
	cout << solve();
	return 0;
}

Measured memory_bytes: 384
#pragma region head
    #include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
    using vi = vector<int>;
    using vll = vector<ll>;
    using pi = pair<int, int>;
    using pll = pair<ll,ll>;
    template <class T> using vv = vector<vector<T>>;
    #define rep(i,n) for(int i = 0; i < (int)(n); i++)
    #define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
    #define rrep(i,n) for(int i = (int)(n)-1; i >= 0; i--)
    #define rrepi(i,a,b) for(int i = (int)(b)-1; i >= (int)(a); i--)
    const int INF = 1002003004;
    const ll LINF = 1002003004005006007ll;
    struct preprocess{preprocess()
    {cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}}____;
#pragma endregion head

#pragma region library
// Time Complexity: faster than O(logN)[O(ArkInv(N))]
// UnionFind.data: if minus -> size of subtree (node is root)
// if plus -> parent of the node
template <typename T>
struct WeightedUnionFind {
    vector<int> data;
    vector<T> diff_weight;
    WeightedUnionFind(int sz){
        data.assign(sz,-1);
        diff_weight.assign(sz,0);
    }
    int find(int x){
        if(data[x]<0) return x;
        int r=find(data[x]);
        diff_weight[x]+=diff_weight[data[x]];
        return data[x]=r;
    }
    bool unite(int x, int y, T w){
        // weight(y)-weight(x)=w
        w+= weight(x); w-= weight(y);
        x = find(x); y = find(y);
        if(x==y) return false;
        if(data[x]>data[y]) swap(x,y),w=-w;
        data[x]+=data[y];
        data[y]=x;
        diff_weight[y]=w;
        return true;
    }
    int size(int x){
        return (-data[find(x)]);
    }
    int same(int x,int y){
        return find(x)==find(y);
    }
    T weight(int x){
        find(x);
        return diff_weight[x];
    }
    T diff(int x,int y){
        return weight(y)-weight(x);
    }
};
#pragma endregion library

int main(){
    int n,m; cin >> n >> m;
    WeightedUnionFind<int> uf(n);
    rep(i,m){
        int l,r,d; cin >> l >> r >> d;
        l--; r--;
        if(!uf.unite(l,r,d)){
            if(uf.diff(l,r)!=d){
                cout << "No" << '\n';
                return 0;
            }
        }
    }
    cout << "Yes" << '\n';
}


Measured memory_bytes: 1024
using System;

namespace A___Connection_and_Disconnection
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int Odds = 0;
            for (int i = 1; i <= N; i++)
            {
                if (i % 2 != 0)
                {
                    Odds++;
                }
            }

            double ans = (double) Odds / (double) N;
            Console.WriteLine("{0:F10}",ans);

        }
    }
}


Measured memory_bytes: 13268
#include<stdio.h>
int main()
  {
    int n,a,b,c;
    scanf("%d",&n);
    scanf("%d",&a);
    scanf("%d",&b);
    c=n*a;
    if(c>=b)
      printf("%d",b);
    else
      printf ("%d",c);
  return 0;
  }
  

Measured memory_bytes: 128
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <complex>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define EPS 1e-8
#define DEB 0

/*
  x : ~üðxª
  y : }XÚÌÂ
  z : Cxg}XÚÌÂ
  */

class Masu{
  public:
	int e,a;
	bool f;
};

const double inf = 999999999.0;
double dp[5010][64];

int main(){
	int x,y,z;
	int rolet[8];
	Masu masu[64];

	while(scanf("%d%d%d",&x,&y,&z),x|y|z){
		rep(i,5010)rep(j,64)dp[i][j]=inf;
		rep(i,64)masu[i].f=false;
		rep(i,x)scanf("%d",rolet+i);
		rep(i,z){
			int n,e,a; scanf("%d%d%d",&n,&e,&a);
			masu[n].e = e;
			masu[n].a = a;
			masu[n].f = true;
		}
		dp[0][0] = 1.0;
		rep(i,y){
			rep(j,5010)if( dp[j][i]!=inf ){
#if DEB
				printf("i:%d  j:%d   dp[j][i]:%lf\n",i,j,dp[j][i]);
#endif				
				rep(k,x){
					int mm = min(y,rolet[k]+i);
					int money = j;
					if( masu[mm].f == true ){
#if DEB
						printf("event:%d  mm:%d  , money:%d\n",masu[mm].e,mm,money);
#endif						
						if( masu[mm].e==1 ){
							mm = min(y, mm+masu[mm].a);
						}else if( masu[mm].e==2 ){
							money = j + masu[mm].a;
						}else if( masu[mm].e==3 ){
							money = max(0, j - masu[mm].a);
						}
					}
					if( dp[money][mm]==inf ){
						dp[money][mm] = dp[j][i] * 1.0/(double)x;
					}else{
						dp[money][mm] += dp[j][i] * 1.0/(double)x;
					}
#if DEB
					printf("update:  dp[%d][%d]:%lf\n",money,mm,dp[money][mm]);
#endif					
				}
			}
		}

		double ans = 0.0;
		rep(i,5010)if( dp[i][y]!=inf ){
			ans += (double)i*dp[i][y];
		}
		printf("%d\n",(int)floor(ans));
	}
	return 0;
}

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

using namespace std;

#define uint unsigned int
#define llong long long int
#define ullong unsigned long long int
#define rep(i, n) for (int i = 0; i < n; ++i)

const static long long int MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    int k = 1;
    while(k * (k + 1) / 2 < n) {
        ++k;
    }

    int target = n - k;
    vector<int> Ans;
    Ans.push_back(k);
    for (int i = k - 1; i > 0; --i) {
        if (target == 0) break;
        if (target - i < 0) {
            continue;
        } else {
            Ans.push_back(i);
            target -= i;
        }
    }

    for (auto itr = Ans.begin(); itr != Ans.end(); ++itr) {
        cout << *itr << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>

int main() {
	int r, c;
	int i, j;
	int sum;
	int table[102][102] = {0};

	scanf("%d %d", &r, &c);

	for (i = 0; i < r; i++) {
		for (j = 0; j < c; j++) {
			scanf("%d", &table[i][j]);
		}
	}

	for (i = 0; i < r + 1; i++) {
		for (j = 0; j < c; j++) {
			printf("%d " ,table[i][j]);
			table[i][c + 1] += table[i][j];
			table[r][j] += table[i][j];
		}
		printf("%d\n",table[i][c + 1]);
	}

	return 0;
}


Measured memory_bytes: 2108
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=5e5+50;
const ll mod=1e9+7;
using namespace std;
int n,q,i,rs[nmax],a[nmax],l,r,j,fw[nmax],ls[nmax];
vector<pair<pair<int,int>,int> >vc;
void upd(int i,int v)
{
    for(;i<=n;i+=i&(-i))fw[i]+=v;
}
int qry(int i)
{
    int ans=0;
    for(;i>=1;i-=i&(-i))ans+=fw[i];
    return ans;
}
int qry(int l,int r)
{
    int ans=qry(r);
    if(l>1)ans-=qry(l-1);
    return ans;
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n>>q;
    for(i=1;i<=n;i++)cin>>a[i];
    for(i=1;i<=q;i++)
    {
        cin>>l>>r;
        vc.pb(mkp(mkp(r,l),i));
    }
    sort(all(vc));
    j=1;
    for(i=0;i<q;i++)
    {
        for(;j<=vc[i].fr.fr;j++)
        {
            if(ls[a[j]])upd(ls[a[j]],-1);
            upd(j,1);
            ls[a[j]]=j;
        }
        rs[vc[i].sc]=qry(vc[i].fr.sc,vc[i].fr.fr);
    }
    for(i=1;i<=q;i++)cout<<rs[i]<<'\n';
	return 0;
}


Measured memory_bytes: 17580
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <time.h>
#include <chrono>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(ll i=a;i>b;i--)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,l,r) for(int i=(1);i<(r);i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;



int K, N;
int p[1000];

int main() {

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

	cin >> N >> K;
	FOR(i, 0, N)cin >> p[i];
	sort(p, p + N);

	int ans = 0;
	FOR(i, 0, K)ans += p[i];
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 3560
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = 2e9;
const int MAX_N = 1;
int N, M;
ll ans = 0;
vi x, y, z;

ll calc(ll s1, ll s2, ll s3) {
  vi sums;
  ll res = 0;
  for (int i = 0; i < N; i++) {
    sums.pb(s1*x[i] + s2*y[i] + s3*z[i]);
  }
  sort(sums.begin(), sums.end(), greater<ll>());
  for (int i = 0; i < M; i++) {
    res += sums[i];
  }
  return res;
}

int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    ll a, b, c; cin >> a >> b >> c;
    x.pb(a); y.pb(b); z.pb(c);
  }
  ans = max(ans, calc(1, 1, 1));
  ans = max(ans, calc(-1, 1, 1));
  ans = max(ans, calc(1, -1, 1));
  ans = max(ans, calc(1, 1, -1));
  ans = max(ans, calc(-1, -1, 1));
  ans = max(ans, calc(-1, 1, -1));
  ans = max(ans, calc(1, -1, -1));
  ans = max(ans, calc(-1, -1, -1));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type edge struct {
	v, w int
}

func solve() {
	n := getInt()
	graph := make([][]edge, n)
	for i := 0; i < n-1; i++ {
		u, v, w := getInt()-1, getInt()-1, getInt()
		graph[u] = append(graph[u], edge{v, w})
		graph[v] = append(graph[v], edge{u, w})
	}

	ans := make([]int, n)
	for i := range ans {
		ans[i] = -1
	}
	ans[0] = 0

	var dfs func(int)
	dfs = func(now int) {
		for _, next := range graph[now] {
			if ans[next.v] != -1 {
				continue
			}

			if next.w%2 == 0 {
				ans[next.v] = ans[now]
			} else {
				ans[next.v] = (ans[now] ^ 1)
			}
			dfs(next.v)
		}
	}
	dfs(0)

	for _, a := range ans {
		fmt.Fprintln(wr, a)
	}
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


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

int main(){
    int n,a,m0=0,m1=0,m2=0;
    
    cin >> n;
    for (int i=0;i<n;i++){
        cin >> a;
        if (a%3==0) m0++;
        else if (a%3==1) m1++;
        else m2++;
    }
    
    if (m1<m2) {
        a=m1;
        m1=m2;
        m2=a;
    }
    if (m1==0 && m2==0){
        cout << 1 << endl;
        return 0;
    }
    if (m1-m2<4){
        cout << (m0+m1+m2) << endl;
    }else{
        cout << (m0+m2+(m2+3)) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1164
n,k=map(int, input().split())
s=input()

def rle(string):
    _rle_str = string[0]
    _rle_cnt = 1
    _ans_l = []
    for _i in range(1, len(string)):
        if _rle_str == string[_i]:
            _rle_cnt += 1
        else:
            _ans_l.append([_rle_str, _rle_cnt])
            _rle_str = string[_i]
            _rle_cnt = 1
    _ans_l.append([_rle_str, _rle_cnt])
    return _ans_l

rle_s=rle(s)

ans=-1

left=0
wa=0

if rle_s[0][0]=="0":
    cnt=1
    wa=rle_s[0][1]
    right=1
else:
    cnt=0
    right=0

if len(rle_s)==1 and k>=1:
    print(rle_s[0][1])
    exit()

while right<len(rle_s):
    # print(right, left, wa, cnt)
    if cnt==k:
        if rle_s[right][0]=="0":
            if rle_s[left][0]=="0":
                wa-=rle_s[left][1]
                cnt-=1
            else:
                wa-=rle_s[left][1]
            left+=1

        else:
            wa+=rle_s[right][1]
            right+=1
            ans=max(ans, wa)

    elif cnt<k:
        if rle_s[right][0]=="0":
            cnt+=1
            wa+=rle_s[right][1]
        else:
            wa+=rle_s[right][1]
        right+=1
        ans=max(ans, wa)

    else:
        if rle_s[left][0]=="0":
            wa-=rle_s[left][1]
            cnt-=1
        else:
            wa-=rle_s[left][1]
        left+=1

print(ans)


Measured memory_bytes: 17724