akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] xs = {
                -1,
                sc.nextInt(),
                sc.nextInt(),
                sc.nextInt(),
                sc.nextInt(),
                sc.nextInt()
        };
        for (int i = 1; i < xs.length; i++) {
            if (xs[i] == 0) {
                System.out.println(i);
                break;
            }
        }
    }
}

Measured memory_bytes: 35680
#include <iostream>
#include <vector>

using namespace std;

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

int main() {
	int n;
	vector<int> a;
	cin >> n;
	for(int i=0;i<n;i++) {
		int temp;
		cin >> temp;
		a.push_back(temp);
	}

	int lcm = 1;
	for(int i=0;i<n-1;i++) {
		if(lcm % a[i] == 0) continue;
		int g = gcd(a[i], lcm);
		lcm = a[i]*lcm/g;
	}
	if(lcm % a[n-1] != 0) {
		int g = gcd(lcm, a[n-1]);
		lcm = lcm*a[n-1]/g;
	}

	cout << lcm << endl;
	
	return 0;
}

Measured memory_bytes: 3120
#include<iostream>
#include<string>

using namespace std;

int main(){
    string N;
    cin >> N;
    string day = "2019/04/30";
    if(N.compare(day) > 0){
        cout << "TBD" << "\n";
    }
    else{
        cout <<"Heisei"<<"\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

int64_t color_index(char c) {
    switch (c) {
        case 'R':
            return 0;
        case 'G':
            return 1;
        case 'B':
            return 2;
    }
}

main() {
    constexpr auto M = 998244353;

    int64_t n;
    cin >> n;

    string s;
    cin >> s;

    vector<int64_t> nums(8, 0), nums2;
    int64_t k = 1;
    for (auto c : s) {
        auto idx = color_index(c);

        nums2 = nums;
        if (nums[3] == 0 && nums[5] == 0 && nums[6] == 0) {
            if (nums[1] == 0 && nums[2] == 0 && nums[4] == 0) {
                ++nums2[1u << idx];
            } else if (nums[1u << idx] > 0) {
                ++nums2[1u << idx];
            } else {
                for (auto i : {1, 2, 4}) {
                    if (nums[i] > 0) {
                        ++nums2[i + (1u << idx)];
                        --nums2[i];
                        k = (k * nums[i]) % M;
                    }
                }
            }
        } else {
            if (nums[7 - (1u << idx)] > 0) {
                ++nums2[7];
                --nums2[7 - (1u << idx)];
                k = (k * nums[7 - (1u << idx)]) % M;
            } else if (nums[1] == 0 && nums[2] == 0 && nums[4] == 0) {
                ++nums2[1u << idx];
            } else if (nums[1u << idx] > 0) {
                ++nums2[1u << idx];
            } else {
                for (auto i : {1, 2, 4}) {
                    if (nums[i] > 0) {
                        ++nums2[i + (1u << idx)];
                        --nums2[i];
                        k = (k * nums[i]) % M;
                    }
                }
            }
        }

        nums.swap(nums2);
        nums2.clear();
    }

    for (auto i : irange(1L, n + 1)) {
        k = (k * i) % M;
    }

    cout << k << endl;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll m, n, s;
	cin >> m >> n >> s;

	vector<string> a(m);
	FOR(i,0,m) cin >> a[i];
	
	ll res = oo;
	FOR(mask,0,1 << (m-1)) {
		vl bounds = {0};
		FOR(i,0,m-1) if (mask & (1 << i)) bounds.pb(i+1);
		bounds.pb(m);
		ll cur = __builtin_popcount(mask);
		
		ll k = sz(bounds)-1;
		vl cnt(k);
		FOR(j,0,n) {
			ll t = 0;
			vl add(k);
			FOR(i,0,m) {
				if (i == bounds[t+1]) t++;
				add[t] += a[i][j]-'0';
			}
			FOR(i,0,k) cnt[i] += add[i];

			bool ok = true;
			FOR(i,0,k) if (cnt[i] > s) ok = false;

			if (ok) continue;

			cur++;
			FOR(i,0,k) cnt[i] = add[i];

			ok = true;
			FOR(i,0,k) if (cnt[i] > s) ok = false;

			if (!ok) cur = oo;
		}

		res = min(res, cur);
	}
	cout << res << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 2000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define rsort(x) sort(all(x));reverse(all(x))
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 
bool debug=false;
/*---------------------------------------------------*/
 
int main(){
  int n;
  ll x;
  map<ll,int> m;
  cin>>n;
  rep(i,n){
    cin>>x;
    m[x]++;
  }
  int ans=0;
 
  for(auto itr = m.begin(); itr != m.end(); ++itr) {
    if(itr->second%2==1)ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>

using namespace std;

int dfs(
    int n,
    int m,
    int q,
    int p,
    vector<int> A,
    vector<int> a,
    vector<int> b,
    vector<int> c,
    vector<int> d)
{
    if(p == n) {
        int result = 0;
        for(int i = 0; i < q; i++) {
            if(A[b[i]-1] - A[a[i]-1] == c[i]) {
                result += d[i];
            }
        }
        return result;
    }

    int start;
    if(p == 0) {
        start = 1;
    } else {
        start = A[p-1];
    }
    int result = 0;
    for(int i = start; i <= m; i++) {
        A[p] = i;
        int tmp = dfs(n, m, q, p+1, A, a, b, c, d);
        if(tmp > result) {
            result = tmp;
        }
    }

    return result;
}

int main()
{
    int n, m, q;
    cin >> n >> m >> q;

    vector<int> a = vector<int>(q);
    vector<int> b = vector<int>(q);
    vector<int> c = vector<int>(q);
    vector<int> d = vector<int>(q);
    for(int i = 0; i < q; i++) {
        cin >> a[i];
        cin >> b[i];
        cin >> c[i];
        cin >> d[i];
    }
    vector<int> A = vector<int>(n);
    cout << dfs(n, m, q, 0, A, a, b, c, d) << endl;

    return 0;
}


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

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


signed main()
{
  // freopen("in.txt", "r", stdin);
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n, g;
  cin >> n >> g;
  int p[11], c[11];
  for(int i = 1; i <= n; ++i) {
    cin >> p[i] >> c[i];
  }
  int res = inf;
  for(int i = 0; i < (1 << n); ++i) {
    bitset<13> vis = i;
    int tot = 0;
    int cnt = 0;
    for(int j = 0; j < n; ++j) {
      if(vis[j] == 1) {
        tot += (j + 1) * p[j + 1] * 100 + c[j + 1];
        cnt += p[j + 1];
      }
    }
    if(tot >= g) {
      res = min(res, cnt);
    } else {
      for(int j = n; j > 0; --j) {
        if(vis[j - 1]) continue;
        int t = (g - tot + j * 100 - 1) / (j * 100);
        if(t < p[j]) {
          cnt += t;
          res = min(res, cnt);
        }
      }
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 384
def gcd(a,b):
    if b==0:
        return a 
    return gcd(b,a%b)
n,x = map(int,input().split())
l = [int(ele) for ele in input().split()]
l.append(x)
l.sort()
g = 0 
for i in range(1,n+1):
    g = gcd(g,l[i]-l[i-1])
print(g)


Measured memory_bytes: 14252
#include<iostream> 

using namespace std;
int main()
{
	int a;
	cin >> a;
	if (a<105||a>200)
	{
		cout << 0 << "\n";

	}
	else if (a >= 105 && 135>a)
	{
		cout << 1 << "\n";
	}
	else if (a >= 135 && a<165)
	{
		cout << 2 << "\n";
	}
	else  if(a>=165&&a<189)
	{
		cout << 3 << "\n";
	} 
	else if(a>=189&&a<195)
	{
		cout << 4 << "\n";
	} 
	else
	{
		cout << 5 << "\n";
	}
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n,k;cin>>n>>k;
  vl a(k);
  vector<bool>skip(10,false);
  rep(i,k){
    cin>>a[i];
    skip[a[i]]=true;
  }
  for(ll i=n;i<100*n;i++){
    ll x=i;
    bool finished=true;
    while(x>0){
      if(skip[x%10])finished=false;
      x/=10;
    }
    if(finished){
      cout<<i<<endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <stdio.h>

long n[1000001];

int main(void)
{
	int i, j;
	int x;
	int sum;
	
	for (i = 0; i <= 1000000; i++){
		n[i] = 1;
	}
	
	n[1] = 0;
	n[0] = 0;
	for (i = 2; i * i <= 1000000; i++){
		if (n[i] == 1){
			for (j = i * 2; j <= 1000000; j += i){
				n[j] = 0;
			}
		}
	//	printf("n[%d]=%d ", i, n[i]);
	}
/*	for (i = 2; i * i <= 1000000; i++){
		if (n[i] == 1){
			for (j = 2 * i; j <= 1000000; j += i){
					n[j] = 0;
			}
		}
	}
	*/
	for (i = 1; i <= 1000000; i++){
		n[i] +=  n[i - 1];
	}
	while (scanf("%d", &x) != EOF){	
		
		printf("%d\n", n[x]);
	}
	
	return (0);
}

Measured memory_bytes: 8408
#define DEBUG 0

/**
 * File    : D3.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-5-28 12:07:16
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
const ll M = 1000000007;

int N;
ll dp[110][4][4][4];

// A: 0, G: 1, C: 2, T: 3;

int main()
{
  cin >> N;
  // fill(&dp[0][0][0][0], &dp[0][0][0][0] + 110 * 4 * 4 * 4, 0);
  dp[0][3][3][3] = 1;
  for (auto n = 0; n < N; n++)
  {
    for (auto i = 0; i < 4; i++)
    {
      for (auto j = 0; j < 4; j++)
      {
        for (auto k = 0; k < 4; k++)
        {
          if (dp[n][i][j][k] == 0)
          {
            continue;
          }
          for (auto a = 0; a < 4; a++)
          {
            // jia = 012, 102, 021 は continue;
            if ((j == 0 && i == 1 && a == 2) || (j == 1 && i == 0 && a == 2) || (j == 0 && i == 2 && a == 1))
            {
              continue;
            }
            // kjia = 0x12, 01x2 は continue;
            if ((k == 0 && i == 1 && a == 2) || (k == 0 && j == 1 && a == 2))
            {
              continue;
            }
            dp[n + 1][a][i][j] += dp[n][i][j][k];
            dp[n + 1][a][i][j] %= M;
          }
        }
      }
    }
  }
  ll ans = 0;
  for (auto i = 0; i < 4; i++)
  {
    for (auto j = 0; j < 4; j++)
    {
      for (auto k = 0; k < 4; k++)
      {
        ans += dp[N][i][j][k];
        ans %= M;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n; ll x;
    cin >> n >> x;
    VL a(n);
    ll ans = 0;
    FOR(i, 0, n) {
        cin >> a[i];
        ans += a[i];
    }

    vector<VL> Min(n, VL(n));
    Min[0] = a;
    FOR(i, 1, n) {
        ll sum = 0;
        FOR(j, 0, n) {
            Min[i][j] = min(Min[i - 1][j], a[(j - i + n) % n]);
            sum += Min[i][j];
        }
        chmin(ans, sum + x * i);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 31616
N = int(input())
A = list(map(int, input().split()))

A.sort()
A.reverse()

list = []
ans = 0
list.append(A[0])
for i in range(1, len(A)):
        ans += list[i - 1]
        list.append(A[i])
        list.append(A[i])

print(ans)

Measured memory_bytes: 31600
a,b,h,m = map(int,input().split())

long = m * 6
small = h * 30 + m * 0.5

kakudo = min(abs(long - small), 360-abs(small-long))

import math

ans = (a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(kakudo))) ** (1/2)

print(ans)


Measured memory_bytes: 62304
(defun bit-collection-mod (n function) 
  (loop :for k :from 1 :upto (1- (expt 2 n))
        :maximize(funcall function (loop :for j :from 0 :upto (1- n) :collect (logbitp j k)))))


(let* ((n (read))
       (lst (loop :repeat n :collect (loop :repeat 10 :collect (= 1 (read)))))
       (lst-a (loop :repeat n :collect (loop :repeat 11 :collect (read)))))
  (labels ((f (a)
             (reduce #'+ (mapcar (lambda (x y)
                                   (elt y x))
                                 (mapcar (lambda (b)
                                           (count t (mapcar (lambda (k l) (and k l)) a b))) lst)
                                 lst-a))))
    (princ (bit-collection-mod 10 #'f))))


Measured memory_bytes: 42724
#include <stdio.h>

int main(){
    int n, m, x, a[100];
    int i, j, cost1=0, cost2=0;

    scanf("%d %d %d", &n, &m, &x);

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

    for(i=x; i<=n; i++){
        for(j=0; j<m; j++){
            if(a[j] == i)
                cost1++;
        }
    }

    for(i=x; i>=0; i--){
        for(j=0; j<m; j++){
            if(a[j] == i)
                cost2++;
        }
    }

    if(cost1 < cost2)
        printf("%d\n", cost1);
    else
        printf("%d\n", cost2);
    
    return 0;
}

Measured memory_bytes: 128
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
int main() {
    ll n;
    string s;
    std::cin >> n;
    std::cin >> s;
    ll res = 1;
    char now = s[0];
    for (int i = 1; i < n; i++) {
        if(now == s[i]){
            continue;
        }else{
            res++;
            now = s[i];
        }
    }
    std::cout << res << std::endl;
}


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

using namespace std;

int main(){
    int arr[3];
    for(int i = 0; i < 3; ++i){
        cin >> arr[i];
    }
    sort(arr, arr + 3);
    if(arr[0] == 5 && arr[1] == 5 && arr[2] == 7)cout << "YES";
    else cout << "NO";
    return 0;
}


Measured memory_bytes: 256
N, Q = gets.split.map &:to_i
SqN = (N**0.5).to_i
K = N.fdiv(SqN).ceil
a = [0] * SqN * K
sq = [0] * SqN

$<.each{|s|
  com, x, y = s.split.map &:to_i
  x -= 1
  if com == 0
    # add
    a[x] += y
    sq[x / K] += y
  else
    # getSum
    sum = 0
    K.step(SqN * K, K){|r|
      l = r - K
      next if y <= l || r <= x
      if x <= l && r <= y
        sum += sq[r / K - 1]
      else
        # p [a,[x, l].max...[y, r].min]
        sum += a[[x, l].max...[y, r].min].sum
      end
    }
    p sum
  end
  # p [a,sq]
}



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

int main() {
    int n, u, k;
    cin >> n;
    int ans[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            ans[i][j] = 0;
        }
    }
    for (int i = 0; i < n; i++) {
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v;
            cin >> v;
            ans[u-1][v-1] = 1;
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (j) cout << " ";
            cout << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3112
def examA():
    N = I()
    H = LI()
    dp = [inf]*(N)
    dp[0] = 0
    for i in range(N-1):
        dp[i+1] = min(dp[i+1],dp[i]+abs(H[i+1]-H[i]))
        if i<N-2:
            dp[i + 2] = min(dp[i + 2], dp[i]+abs(H[i + 2] - H[i]))
    ans = dp[-1]
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examA()

"""

"""

Measured memory_bytes: 52256
#include<stdio.h>
#include<string.h>
int main(){
	char m[9][9],s[9][9];
	int i,j,k=0;
	for(j=0;j<8;j++){
		scanf("%s",m[j]);
		strcpy(s[j],m[j]);
	}
	for(k=90;k<360;k+=90){
		printf("%d\n",k);
		for(i=0;i<8;i++){
			for(j=0;j<8;j++){
				s[j][7-i]=m[i][j];
			}
		}
		for(j=0;j<8;j++){
			printf("%s\n",s[j]);
			strcpy(m[j],s[j]);
		}
	}
    return 0;
}

Measured memory_bytes: 1800
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int main() {
    stack<int> s1;
    stack<P> s2;
    int sum=0;
    char c;
    for(int i=0;cin>>c;i++) {
        if(c=='\\') {
            s1.push(i);
        }
        else if(c=='/' && s1.size()) {
            int j=s1.top(); s1.pop();
            int d = i-j;
            sum+=d;
            while(s2.size() && s2.top().fr > j) {
                d+=s2.top().sc; s2.pop();
            }
            s2.push(mp(j,d));
        }

    }
    vector<int> ans;
    while(s2.size()) ans.pb(s2.top().sc),s2.pop();
    reverse(all(ans));
    cout<<sum<<endl;
    cout<<ans.size();
    rep(i,ans.size()) cout<<(" ")<<ans[i];
    cout<<endl;
    return 0;
}

Measured memory_bytes: 1284
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include<algorithm>
#include<iomanip>
#include<math.h>
#include <stdlib.h>
#include <string.h>
using namespace std;




int main() {
	
	int N, M;

	int a[100000];
	int d[100001]={0};
  int e[100001]={0};
	char b, c;

	int ac=0, wa=0;

	cin >> N >> M;

	for (int i = 0; i < M; i++) {

		cin >> a[i] >> b >>c;

		if (b == 'A' && d[a[i]] == 0) {
			ac++;
			d[a[i]]++;
			wa = wa + e[a[i]];
		}
		if (b == 'W'&& d[a[i]] == 0) {
			e[a[i]]++;
		}


	}





	cout << ac << " " << wa;
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <string.h>
int main() {
  int A;
  int B;
  int C;
  scanf("%d %d %d",&A, &B, &C);
  int array[4];
  int temp;
  array[0] = A;
  array[1] = B;
  array[2] = C;
  int i,j;

  for (i = 0; i < 2; ++i) {
    for	(j = i + 1; j < 3; ++j) {
      if (array[i] < array[j]) {
        temp = array[i];
        array[i] = array[j];
        array[j] = temp;
      }
    }
  }

  int output = 10*array[0] + array[1] +array[2];
  printf("%d\n",output);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)
// }}} 2

// numerous {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// systems }}} 2

// }}} 1

int main() {

    priority_queue<string,vector<string>,greater<string>> Q;
    char s[103];
    string S;

    int n,l;
    Scd2(n,l);

    Rep(i,n){
        cin >> S;
        Q.push(S);
    }

    Rep(i,n){
        printf ("%s", Q.top().c_str() );
        Q.pop();
    }

    printf("\n");
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ii, ll>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define tam 120000
#define offset 
const ll MOD= 1e9+7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int  main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    ll a,b,n;
    cin>>a>>b>>n;
    n=min(n,b-1);
    ll aux=(a*n)%b;
    ll y=(aux/a);

    ll np=n-y;
    //cout<<y<<" "<<aux<<" "<<np<<endl;
    cout<<((a*np)-(a*np)%b)/b<<endl;

}
// PLUS ULTRA!
    


Measured memory_bytes: 3668
import java.util.*;

class Main {
	public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int tapCount = sc.nextInt();
    int needCount = sc.nextInt();
    float result = (float)(needCount - tapCount) / (float)(tapCount - 1) + 1;
    System.out.println((int)Math.ceil(result));
	}
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
//#include <iostream>
//#include <cstdio>

#define repl(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) repl(i, 0, n)
#define MOD 1000000007
#define INF 2000000000

typedef long long ll;
typedef unsigned long long ull;
//typedef Pair<int,int> P;

using namespace std;

int main(void){
	string s;
	cin>>s;
	rep(i,s.size()){
		if(s[i]=='b' && s[s.size()-1-i]!='d'
			|| s[i]=='d' && s[s.size()-1-i]!='b'
			|| s[i]=='q' && s[s.size()-1-i]!='p'
			|| s[i]=='p' && s[s.size()-1-i]!='q'){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
const double PI = acos(-1);

int main()
{
	string s;
	cin >> s;
	int ans = 0;
	int count = 0;
	bool flag = false;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'R') {
			flag = true;
			count++;
		}
		else {
			flag = false;
			count = 0;
		}
		ans = max(ans, count);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n, a, sum = 0, num = 0, ans = 999999999999; cin >> n;
	int test[223456] = { 0 };
	for (int h = 0; h < n; h++) {
		cin >> a; test[h] = a;
		num += test[h];
	}
	sum += test[0]; num -= test[0];
	ans = min(ans, abs(sum - num));
	for (int h = 1; h < n - 1; h++) {
		sum += test[h];
		num -= test[h];
		ans = min(ans, abs(sum - num));
	}
	cout << ans << endl;
	cin >> n;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
//const int MAX=;

int N;
string S;
void input(){
	cin>>N;
	cin>>S;
}

int ans=0;
void solve(){
	rep1(x,N-1){
		vi cons;
		rep(i,N-1-x+1){
			if(S[i]==S[i+x])cons.pb(1);
			else cons.pb(0);
		}
      	//cons.pb(0);

		int l=0;
		int tmp=0;
		rep(i,sz(cons)){
			if(cons[i]==0){
				l=max(l,tmp);
				tmp=0;
			}
			else tmp++;
		}
		l=max(l,tmp);

		int pa=min(l,x);
		ans=max(ans,pa);
      	//cout<<x<<" "<<l<<endl;
	}

	cout<<ans<<endl;
}

void output(){
  
}

int main(){
  input();
  solve();
  output();
}

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

int main()
{
   string a,b;
   cin>>a>>b;
   int n=a.size();
   int m=b.size();
   int i,j,f=0;
   int dp[n+3][m+3];
   //memset(dp,0,sizeof(dp));
   for(i=0;i<=n;i++)
   {
       for(j=0;j<=m;j++)
       {
           if(i==0||j==0)
           dp[i][j]=0;
           
           else if(a[i-1]==b[j-1])
           dp[i][j]=dp[i-1][j-1]+1;
           else
           dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
       }
   }
//   cout<<"n "<<n<<"f "<<f<<endl;
//   for(i=0;i<=n;i++)
//   {
//       for(j=0;j<=m;j++)
//      cout<<dp[i][j]<<" ";
//      cout<<endl;
//   }
//   cout<<"hbshe ";
   //cout<<dp[n][m]<<endl;
  string s="";
  i=n;
  j=m;
  while(i>0&&j>0)
  {
      if(a[i-1]==b[j-1])
      {
          s=s+a[i-1];
          i--;
          j--;
      }
      else if(dp[i-1][j]>dp[i][j-1])
        i--;
        else
        j--;
  }
  reverse(s.begin(),s.end());
  cout<<s<<endl;
}
 

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

int main(void)
{
    int m,n,o=0,i,j,k;
    int sum=0,range=0;
    double ans=0.0,half;
    //long long int m,n,o,i,j,k=0;
    //vector <int> v;
    //float f,g,h;
    char c,d;
    int pos[2],z=100000;
    string s,a,b;
    cin>>pos[0]>>pos[1];
    for(i=0;i<2;i++)
    {
        if(pos[i]==1) sum+=3*z;
        else if(pos[i]==2) sum+=2*z;
        else if(pos[i]==3) sum+=z;
    }
    if(pos[0]==pos[1])
    {
        if(pos[0]==1) sum+=4*z;
    }
    cout<<sum;
    return 0;
}




Measured memory_bytes: 256
import java.util.*;
public class Main{
 public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int a=sc.nextInt();
  int b=sc.nextInt();
  String c[] =new String[a];
  for(int i=0;i<a;i++){
   c[i]=sc.next();
  }
  Arrays.sort(c);
  for(int i=0;i<a;i++){
   System.out.print(c[i]);
  }
 }
}


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


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, u[N], m;
vector < int > g[N];
vector < int > ans;

void dfs (int v) {
    if(!u[v])
        ans.pb(v);
    u[v] = 1;
    for (auto to : g[v]) {
        if (!u[to]) {
            dfs (to);
            return ;
        }
    }
}

int main () {
    cin >> n >> m;
    For (i, 1, m) {
        int l, r;
        cin >> l >> r;
        g[r].pb(l);
        g[l].pb(r);
    }
    dfs(1);
    reverse(every(ans));
    dfs(1);
    
    cout << ans.size() << '\n';
    for (auto it : ans)
        cout << it << ' ';
	return Accepted;
}

// Coded By OB

Measured memory_bytes: 23672
def main():
    from collections import deque
    import sys
    input = sys.stdin.readline

    N, M = map(int, input().split())
    p = [int(x) - 1 for x in input().split()]

    g = tuple(set() for _ in range(N))
    for _ in range(M):
        x, y = (int(x) - 1 for x in input().split())
        g[x].add(y)
        g[y].add(x)

    roots = [-1] * N
    for r in range(N):
        if ~roots[r]: continue
        dq = deque()
        dq.append(r)
        roots[r] = r
        while dq:
            v = dq.popleft()
            for u in g[v]:
                if ~roots[u]: continue
                roots[u] = r
                dq.append(u)

    cnt = sum(1 for i, pi in enumerate(p) if roots[i] == roots[pi])
    print(cnt)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


Measured memory_bytes: 55580
S = input()
N = len(S)
dp = []
for _ in range(N+1):
    dp.append([0] * 13)
dp[0][0] = 1
p = 10**9+7

for i in range(1, N+1):
    X = S[N-i]
    if X == '?':
        for j in range(10):
            X = (j * pow(10, i-1, 13)) % 13
            for k in range(13):  # 上段の各あまりに対して、xのあまりを加える
                Y = dp[i-1][k]
                Z = (X + k) % 13  # 新たなあまり
                dp[i][Z] += Y % p

    else:
        X = int(X)
        X = (X * pow(10, i-1, 13)) % 13
        for k in range(13):  # 上段の各あまりに対して、xのあまりを加える
            Y = dp[i-1][k]
            Z = (X + k) % 13  # 新たなあまり
            dp[i][Z] += Y % p

print(dp[-1][5] % 1000000007)


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  int n, q;
  int64_t k;
  cin >> n >> k >> q;

  vector<int64_t> sc(n, k - q);
  for (int i = 0; i < q; ++i) {
    int64_t a;
    cin >> a;
    ++sc[a - 1];
  }
  for (int i = 0; i < n; ++i) {
    if (sc[i] <= 0) {
      cout << "No" << '\n';
    } else {
      cout << "Yes" << '\n';
    }
  }

  return 0;
}


Measured memory_bytes: 3988
def main():
    from sys import setrecursionlimit, stdin
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor, gcd
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**9+10
    N = II()
    r = N % 10
    if N % 10 == 3:
        print('bon')
    elif r == 2 or r == 4 or r == 5 or r == 7 or r == 9:
        print('hon')
    else:
        print('pon')

    
main()

Measured memory_bytes: 65164
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int main() {
	fast_cin();
	int n, k;
	cin >> n >> k;
	if (k == 1) {
		cout << 0;
	} else {
		cout << n - k;
	}
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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; }



int main() {
  int n;
  cin >> n;
  int a[n];
  FOR(i,0,n-1){
    int input;
    cin >> input;
    a[input-1] = i+1;
  }

  FOR(i,0,n-1) cout << a[i] << " ";

  cout << endl;





  
  

}



Measured memory_bytes: 1152
#include "iostream"
using namespace std;

int main()
{
	int h, w;
	while (cin >> h >> w &&(h != 0 && w != 0))
	{
		for (int i = 0; i < h; i++)
		{
			if (i % 2 == 0)
			{
				for (int i = 0; i < w; i++)
				{
					if (i % 2 == 0)
					{
						cout << "#";
					}
					else
					{
						cout << ".";
					}
				}
			}
			else
			{
				for (int i = 0; i < w; i++)
				{
					if (i % 2 == 0)
					{
						cout << ".";
					}
					else
					{
						cout << "#";
					}
				}
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3084
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int k, s;
	cin >> k >> s;
	
	int ans = 0;
	for(int x = 0; x <= k; ++x) {
		for(int y = 0; y <= k; ++y) {
			int z = s - x - y;
			
			if( z >= 0 && z <= k ) ans++;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(dead_code)]
use datastructure::*;
use grapth::*;
use math::*;
use string_algorithm::*;
use util::*;
use input_scanner::*;

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};

fn main() {
    let mut scan = Scanner::new();
    let k: usize = scan.next();
    let s:String = scan.next();

    if s.len() <= k{
        println!("{}", s);
    }else{
        println!("{}...", &s[0..k]);
    }
}

mod datastructure {}
mod grapth {}
mod math {}
mod string_algorithm {}
mod util {}
mod input_scanner {
    pub struct Scanner {
        bytes: Vec<u8>,
        begin: usize,
        end: usize,
    }
    
    impl Scanner {
        pub fn new() -> Self {
            use std::io::Read;
            let mut buffer: Vec<u8> = Vec::new();
            std::io::stdin().read_to_end(&mut buffer).unwrap();
            let end = (0..buffer.len())
                .find(|i| buffer[*i].is_ascii_whitespace())
                .unwrap_or(buffer.len());
            Scanner {
                bytes: buffer,
                begin: 0,
                end: end,
            }
        }
        pub fn next<T: std::str::FromStr>(&mut self) -> T {
            let s: &str = unsafe { std::str::from_utf8_unchecked(&self.bytes[self.begin..self.end]) };
            let ret: T = s.parse::<T>().ok().expect("Parse error.");
            self.skip();
            ret
        }
        pub fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
        pub fn next_word(&mut self) -> Vec<u8> {
            let r = Vec::from(&self.bytes[self.begin..self.end]);
            self.skip();
            r
        }
        fn skip(&mut self) {
            self.begin = (self.end..self.bytes.len())
                .find(|i| !self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
            self.end = (self.begin..self.bytes.len())
                .find(|i| self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
        }
    }
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,x;
  int a[100001];
  long long ans = 0;
  
  cin >> n >> x;
  
  for(int i = 0;i < n;i++){
    cin >> a[i];
  }

  for(int i = 0;i < n - 1;i++){
    if(a[i] + a[i + 1] > x){
      ans += (a[i] + a[i + 1] - x);
      a[i + 1] -= (a[i] + a[i + 1] - x);
      if(a[i + 1] < 0){
	a[i] += a[i + 1];
	a[i + 1] = 0;
      }
    }
  }
  
  cout << ans << endl;
  return 0;
}

    


Measured memory_bytes: 640
/**
 * @author torith
 * @date 2018-11-24
 */

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

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

    int N; cin >> N;
    int a[100] = {};
    int sum = 0;
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        sum += a[i];
    }

    double avg = (double)(sum) / N;

    double tmp = 1e9;
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if(tmp > abs(avg - a[i])) {
            tmp = abs(avg - a[i]);
            ans = i;
        }
    }

    cout << ans << "\n";


    return 0;
}



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

int X[16][16],Y[16][16],A[16];
int main(){
	int n;cin>>n;
	for(int i = 0; i < n; i++){
		cin>>A[i];
		for(int j = 0; j < A[i]; j++){
			cin>>X[i][j]>>Y[i][j];
		}
	}

	int ans = 0;
	for(int i=0; i < (1<<n); i++){
		bool ok = 1;
	   for(int j = 0; j < n; j++){
	   	  if(!((i>>j)&1)) continue;
	   	  for(int k = 0; k < A[j]; k++){
	   	  	  if(((i>>(X[j][k]-1))&1)^Y[j][k]) ok = false;
	   	  }
	   }
	   if(ok) ans = max(ans,__builtin_popcount(i));
	}
	cout<<ans;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n;
  cin >> n;
  unordered_map<int, int> mp;
  rep(i, n) {
    int a;
    cin >> a;
    mp[a]++;
  }
  vi32 arr;
  each(m, mp) arr.emplace_back(m.second);
  sort(all(arr));
  reverse(all(arr));
  int m = arr.size();
  vi64 sums(m + 1);
  rep(i, m) sums[i + 1] += sums[i] + arr[i];
  reps(k, n) {
    int ok = 0, ng = n + 1;
    while (ng - ok > 1) {
      int md = (ok + ng) / 2;
      int x = bis<int>(m, -1, [&](int i) { return md > arr[i]; });
      i64 men = (i64) k * md;
      men -= (i64) x * md;
      i64 sum = sums[m] - sums[x];
      (men <= sum ? ok : ng) = md;
    }
    cout << ok << endl;
  }
}


Measured memory_bytes: 19444
import sys
i=input
n =int(i())
r0=int(i())
r1=int(i())
maxv=r1-r0
minv=min(r1,r0)
for i in map(int,sys.stdin.readlines()):
    maxv=max(maxv,i-minv)
    minv=min(minv,i)
print(maxv)

Measured memory_bytes: 19828
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

long long int gcd(long long int x, long long int y)
{
	if (y == 0) { return x; }
	return gcd(y, x % y);
}

int main(void)
{
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++) { cout << 'x'; }
	cout << "\n";
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
X = [[] for _ in range(N)]
Y = [[] for _ in range(N)]
Z = []
for _ in range(M):
    s, t = map(int, input().split())
    X[s-1].append(t-1)
    Y[t-1].append(s-1)
    Z.append((s-1, t-1))

E = [-1] * N
E[-1] = 0
for i in range(N-1)[::-1]:
    a = 0
    for c in X[i]:
        a += E[c] + 1
    E[i] = a/len(X[i])

P = [0] * N
P[0] = 1

for i in range(1, N):
    for p in Y[i]:
        P[i] += P[p]/len(X[p])

ma = 0
for s, t in Z:
    k = len(X[s])
    if k == 1: continue
    a, b = E[s], E[t]
    c = k/(k-1)*(a-1-b/k)
    ma = max(ma, (a-c-1)*P[s])

print(E[0]-ma)

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

int main() {
  int n;
  cin >> n;
  int mi=1000000000;
  int cnt=0;
  for (int i=0; i<n;i++) {
    int num;
    cin >> num;
    if (num <= mi) {
      cnt++;
      mi = num;
    }
  }

  cout << cnt << endl;
}

Measured memory_bytes: 256
n = int(input())
csf = [list(map(int, input().split())) for i in range(n - 1)]
for i in range(n - 1):
    ans = 0
    for j in range(i, n - 1):
        c, s, f = csf[j]
        if ans <= s:
            ans = s
        else:
            while ans % f:
                ans += 1
        ans += c
    print(ans)
print(0)

Measured memory_bytes: 3188
"use strict";
main(
  require("fs")
    .readFileSync("/dev/stdin", "UTF-8")
    .trim()
    .split("\n")
);

function main(input) {
  const num = parseInt(input[0].split(" ")[0]);
  const pick = parseInt(input[0].split(" ")[1]);
  input.shift();
  input = input[0].split(" ").map(Number);

  let exp = [];
  for (let i = 0; i < num; i++) {
    exp.push((1 + input[i]) / 2);
  }

  let expSum = [0];
  for (let i = 1; i <= num; i++) {
    expSum[i] = expSum[i - 1] + exp[i - 1];
  }

  let max = 0;
  for (let i = pick - 1; i < expSum.length; i++) {
    if (max < expSum[i] - expSum[i - pick]) {
      max = expSum[i] - expSum[i - pick];
    }
  }

  console.log(max);
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll R, C, K;
    cin >> R >> C >> K;
    map<pair<ll,ll>,ll> S;
    REP(i,0,K) {
        ll r, c, v;
        cin >> r >> c >> v;
        S[{r, c}] = v;
    }

    vector<vector<vector<ll>>> dp(R+1, vector<vector<ll>>(C+1, vector<ll>(4)));
    REP(i,0,R+1) REP(j,0,C+1) REP(k,0,4) dp[i][j][k] = 0;
    REP(i,1,R+1) {
        REP(j,1,C+1) {
            ll x = 0;
            if(S.count({i, j}) > 0) x = S[{i, j}];
            dp[i][j][0] = MAX(dp[i][j][0],dp[i][j-1][0]);
            REP(k,0,4) dp[i][j][0] = MAX(dp[i][j][0],dp[i-1][j][k]);
            REP(k,1,4) dp[i][j][k] = MAX(dp[i][j][0],dp[i][j-1][k]);
            dp[i][j][1] = MAX(dp[i][j][1],dp[i][j-1][0]+x);
            REP(k,0,4) dp[i][j][1] = MAX(dp[i][j][1],dp[i-1][j][k]+x);
            REP(k,2,4) dp[i][j][k] = MAX(dp[i][j][k],dp[i][j-1][k-1]+x);
        }
    }
    
    ll ans = MAX(dp[R][C][0],dp[R][C][1]);
    ans = MAX(ans,dp[R][C][2]);
    ans = MAX(ans,dp[R][C][3]);
    PR(ans);

    return 0;
}

/*



*/

Measured memory_bytes: 649184