akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = input[0];
            var b = input[1];
            var c = input[2];
            var k = input[3];

            int res = 0;
            if (k <= a)
                res = k;
            else
            {
                res = a;
                k -= a;
                if (k <= b)
                { }
                else
                {
                    k -= b;
                    res -= k;
                }
            }

            Console.WriteLine(res);
            
        }

    }
}


Measured memory_bytes: 28308
#include<stdio.h>
int main(){
char ch[1001];
int i=0;
while(scanf("%c",&ch[i])!=EOF){
if('D'<=ch[i] && 'Z'>=ch[i]) ch[i]-=3; else if(ch[i]=='C') ch[i]='Z'; else if(ch[i]=='B') ch[i]='Y';
else if(ch[i]=='A') ch[i]='X'; 
printf("%c",ch[i]);
i++;
}
return 0;
}

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

int main(){
    cin >> a >> b;
    ans = max(0ll, a - 2 * b);
    p(ans);
    return 0;
}











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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e2 + 5);
const ll MOD = (ll)(1e9 + 7);

int n;

int a = 0, c = 1, g = 2, t = 3;
ll dp[MAX_N][4][4][4];

ll ans;

int main(void) {
  // Here your code !
  scanf("%d", &n);

  dp[0][t][t][t] = 1LL;

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 4; ++j)
      for (int k = 0; k < 4; ++k)
        for (int l = 0; l < 4; ++l) {
          for (int m = 0; m < 4; ++m) {
            if (j == a && k == g && l == c) continue;
            if (j == a && k == c && l == g) continue;
            if (j == g && k == a && l == c) continue;
            if (k == a && l == g && m == c) continue;
            if (k == a && l == c && m == g) continue;
            if (k == g && l == a && m == c) continue;
            if (j == a && k == g && m == c) continue;
            if (j == a && l == g && m == c) continue;

            dp[i + 1][k][l][m] += dp[i][j][k][l];
            dp[i + 1][k][l][m] %= MOD;
          }
        }
  }

  ans = 0;

  for (int k = 0; k < 4; ++k)
    for (int l = 0; l < 4; ++l)
      for (int m = 0; m < 4; ++m) {
        ans += dp[n][k][l][m];
        ans %= MOD;
      }

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
using ll=long long;
using ld=long double; 
using namespace std;
//const int INF = 7+(1e+9);
ll GCD(ll x, ll y)
{
    if (y == 0)
    {
        return x;
    }
    else
    {
        return GCD(y, x % y);
    }
}
ll LCM(ll x, ll y)
{
    return x / GCD(x, y) * y;
}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll MOD=1e9+7;

int main(){
    int n;cin>>n;
    vector<bool> vec(1e9+1,false);
    ll sum=0;
    for(int i=0;i<n;i++){
        int x;cin>>x;
        if(vec[x]){
            sum--;
            vec[x]=false;
        }else{
            sum++;
            vec[x]=true;
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 122368
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		double x=0,y=0,dir=0;
		while(!(line = br.readLine()).equals("0,0")){
			String[] s = line.split(",");
			int a = Integer.parseInt(s[0]);
			int b = Integer.parseInt(s[1]);
			x += a*Math.sin(dir*Math.PI/180);
			y += a*Math.cos(dir*Math.PI/180);
			dir += b;
		}
		System.out.println((int)x+"\n"+(int)y);
	}

}

Measured memory_bytes: 23960
#include<cstring>
#include<cstdio>
#include<iostream>
using namespace std;
int vis[51][51];
int f[101][101];
int a[2555][3];
int ans;
int main(){
   int n,m;ans=0;
   scanf("%d%d",&n,&m);
   for(int i=1;i<=m;i++){
   	  scanf("%d%d",&a[i][1],&a[i][2]);
   }
   for(int i=1;i<=m;i++){
       memset(vis,0x3f3f3f3f,sizeof(vis));
   	   for(int j=1;j<=m;j++){
   	   	  if(j!=i)vis[a[j][1]][a[j][2]]=vis[a[j][2]][a[j][1]]=1;
	   }
	   for(int j=1;j<=n;j++)f[j][j]=0;
	   for(int k=1;k<=n;k++){
	   	  for(int j=1;j<=n;j++){
	   	  	 for(int l=1;l<=n;l++){
	   	  		vis[j][l]=vis[l][j]=min(vis[j][l],vis[j][k]+vis[k][l]);
			 }
		  }
	   }
	   for(int j=1;j<=n;j++){
	   	  for(int k=1;k<=n;k++){
	   	  	if(vis[j][k]==0x3f3f3f3f){
	   	  		ans++;goto haha;
			  }
			}
	   }
	   haha:;
   }
   cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <string>


using namespace std;
using ll = long long;
using P = pair<int, int>;

void view(const vector<int>& v) {
	for (size_t i = 0; i < v.size(); i++) {
		cout << v[i] << " ";
	}
	cout << endl;
}
void view(const vector<vector<long long>>& vv) {
	for (size_t i = 0; i < vv.size(); i++) {
		for (size_t j = 0; j < vv[i].size()-1; j++) {
			cout << vv[i][j] << " ";
		}
		cout << vv[i][vv[i].size()-1];
		cout << endl;
	}
}

int main() {
	int k;
	int A, B;
	string str;
	cin >> k;
	cin >> A >> B;

	for (int i = A; i <= B; i++) {
		int x;
		x = i;
		if (x%k == 0) {
			str = "OK";
			goto a;
		}
	}
	str = "NG";
	
a:
	cout << str;
	return 0;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int N, A;

int main()
{
	in >> N >> A;
	N %= 500;
	if (N <= A)out << "Yes" << std::endl;
	else out << "No" << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>                                             
#include <cmath>                                                
using namespace std;                                            
                                                                
int main(void) {                                                
  int n;                                                        
  cin >> n;                                                     
  int R_t[n];                                                   
  for (int i=0; i<n; i++) {                                     
    cin >> R_t[i];                                              
  }                                                             
  int maxv = (-1)*pow(10,9);                                    
  int minv = R_t[0];                                            
  for (int j=1; j<n; j++) {                                     
    maxv = max(maxv,R_t[j]-minv);                               
    minv = min(minv,R_t[j]);                                    
  }                                                             
  cout << maxv << endl;                                         
}                                                               
                                                                
                                                                
                                                                
                                  

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

int main() {
  int n;
  cin >> n;
  int m = n, f = 0;

  while (m > 0){
    f += m % 10;
    m /= 10;
  }

  if(n % f == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
//* AuThOr GaRyMr *//
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB(a) push_back(a)
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	char las=s[0];
	int OK=0,now=0;
	rep(i,n){
		if(s[i]!=las){
			if(now) s[i]=las;
			else 
			if(k){
				k--;
				now=1;
				s[i]=las;
			}
		}
		else{
			now=0;
		}
	}
//	int OK=0;
//	cout<<s<<endl;
	las='%';
	rb(i,0,n-1){
		if(s[i]!=las){
			las=s[i];
			OK++;
		}
	}
	cout<<n-OK<<endl;
	return 0;
}

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

int main(){
    int n,k,h,ans = 0;
    cin >> n >> k;
    for(int i = 0;i < n; ++i){
        cin >> h;
        if(h >= k)ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		SC sc = new SC(System.in);
		int N = sc.nextInt();
		int[][] F = new int[N][10];
		int[][] P = new int[N][11];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < 10; j++) {
				F[i][j] = sc.nextInt();
			}
		}
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < 11; j++) {
				P[i][j] = sc.nextInt();
			}
		}
		long ans = -1000000000;
		for (int i = 1; i < (1 << 10); i++) {
			long bene = 0;
			for (int j = 0; j < N; j++) {
				int cnt = 0;
				for (int k = 0; k < 10; k++) {
					if ((i >> k & 1) == 1 && F[j][k] == 1)
						cnt++;
				}
				bene += P[j][cnt];
			}
			ans = Math.max(ans, bene);
		}
		System.out.println(ans);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 22356
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7;

int N;
unordered_set<int> visited;
map<int, vector<int>> edges;
map<int, vector<int>> subtree_sizes;

ll mod_exp(ll x, ll exp) {
    ll ans = 1;
    ll base = x % MOD;
    while (exp > 0) {
        if (exp % 2 == 1) {
            ans = (ans * base) % MOD;
        }
        base = (base * base) % MOD;
        exp /= 2;
    }
    return ans;
}

ll mod_inv_prime(ll x) {
    return mod_exp(x, MOD-2);
}

int dfs(int v) {
    // cout << v << endl;
    visited.insert(v);
    int total_size = 0;
    for (int ne : edges[v]) {
        // cout << "attempt visit " << ne << endl;
        if (!visited.count(ne)) { 
            int subtree_size = dfs(ne) + 1;
            // cout << "subtree size " << subtree_size << endl;
            if (subtree_size > 0) {
                subtree_sizes[v].push_back(subtree_size);
            }
            total_size += subtree_size;
        }
    }
    if (N - 1 - total_size > 0) {
        subtree_sizes[v].push_back(N-1-total_size);
    }
    return total_size;
}

int main() {
    cin >> N;
    for (int i = 0; i < N-1; i++) {
        int a, b;
        cin >> a >> b;
        edges[a-1].push_back(b-1);
        edges[b-1].push_back(a-1);
    }

    dfs(0);

    ll two_inv = mod_inv_prime(2);
    vector<ll> two_inv_pow = {1};
    ll curr = 1;
    for (int i = 0; i < N; i++) {
        curr = (curr * two_inv) % MOD;
        two_inv_pow.push_back(curr);
    }

    ll ev = 0;
    for (int i = 0; i < N; i++) {
        if (subtree_sizes[i].size() < 2) continue;
        ll p_all_white = 1;
        for (int subtree_size : subtree_sizes[i]) {
            p_all_white = (p_all_white * two_inv_pow[subtree_size]) % MOD;
        }
        ll p_one_black = 0;
        for (int subtree_size : subtree_sizes[i]) {
            ll p_t_white = two_inv_pow[subtree_size];
            ll p_t_black = (1 - p_t_white + MOD) % MOD;
            ll prob = (p_all_white * ((p_t_black * mod_inv_prime(p_t_white)) % MOD)) % MOD;
            p_one_black = (p_one_black + prob) % MOD;
        }
        ll cond_prob = (1 - ((p_all_white + p_one_black) % MOD) + MOD) % MOD;
        ll total_prob = (two_inv * cond_prob) % MOD;
        ev = (ev + total_prob) % MOD;
    }

    cout << ev << endl;
}


Measured memory_bytes: 68680
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1LL << 61);
const int inf = 1001001001;
//const int mod = 1000000007;
const int mod = 998244353;

struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
	mint operator+(const mint a) const { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(mod - 2); }
	mint& operator/=(const mint a) { return *this *= a.inv(); }
	mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }
struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		assert(n < mod);
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} c(200005);

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, m, k;
	cin >> n >> m >> k;
	mint ans = 0;
	mint col = m;
	for (int i = n - 1; i >= 0; --i) {
		mint now = col;
		now *= c(n - 1, i);
		if (i <= k) ans += now;
		col *= m - 1;
	}
	cout << ans.x << endl;
	return 0;
}

Measured memory_bytes: 6236
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.max

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val (n, k) = readIntegerList()
    val aList = readIntegerList()
    val tmp = k - 1
    val ans = if (k >= n) 1 else (n - 1 + (tmp - 1)) / tmp
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 49724
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define dump(x)  cout << #x << " = " << (x) << endl;

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(0);
    cout << std::fixed;

    string s;
    cin >> s;
    ll pn = 0;
    rp(i,s.length()) if(s[i]== 'p') ++pn;
    cout << s.length()/2 - pn << "\n";

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <list>
#include <string.h>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <utility>
#include <memory>
#include <sstream>
#include <complex>
#include <cassert>
#include <bitset>
#define rep(i, n) for(int i = 0; i < n; i++)
#define fi first
#define se second
//#include <Windows.h>
//#include "Library.h"
//#include "Math.h"
//#include "Othello.h"
using namespace std;
typedef long long int ll; typedef pair <int, ll> P; typedef vector <int> vecint; typedef pair<int, P> P1; typedef pair<P1, int> P2;
const int inf = 1000000000;
const ll INF = 9000000000000000000;
const double EPS = 10e-9;
ll pos[100001];
vector <P> link[100001];
int n, m;
bool dfs(int v)
{
	rep(i, link[v].size())
	{
		int nv = link[v][i].first;
		ll dis = link[v][i].second;
		if (pos[nv] == INF)
		{
			pos[nv] = dis + pos[v];
			if(!dfs(nv)) return false;
		}
		else
		{
			if (pos[nv] - pos[v] != dis)
				return false;
		}
	}
	return true;
}
int main()
{
	cin >> n >> m;
	rep(i, n)
		pos[i] = INF;
	rep(i, m)
	{
		int a, b; ll d; cin >> a >> b >> d;
		a--, b--;
		link[a].push_back(P(b, d));
		link[b].push_back(P(a, -d));
	}
	rep(i, n)
	{
		if (pos[i] == INF)
		{
			pos[i] = 0;
			if (!dfs(i))
			{
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 16512
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = sc.next()
    val b = sc.next()
    for (i in 0 until n) {
        print(a[i])
        print(b[i])
    }
    println()
}


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

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e18
#define ret return

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

int main(){
	ll n, p;
	cin >> n >> p;
	if(n==1){
		cout << p << endl;
		return 0;
	}
	ll ans = 1;
	for(ll i = 2; i <= 1e6; i++){
		int cnt = 0;
		while(p%i==0){
			p/=i;
			cnt++;
		}
		cnt/=n;
		while(cnt){
			ans*=i;
			cnt--;
		}
	}
	cout << ans;
	return 0;
}


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

struct BipartiteMatching {
	int V;
	vector<vector<bool> > G;
	vector<int> match;
	vector<bool> used;

	BipartiteMatching(int v) {
		V = v;
		G = vector<vector<bool> >(v, vector<bool>(v));
		match = vector<int>(v);
		used = vector<bool>(v);
	}

	void add_edge(int v, int u) {
		G[v][u] = G[u][v] = true;
	}

	void remove_edge(int v, int u) {
		G[v][u] = G[u][v] = false;
	}

	bool dfs(int v) {
		used[v] = true;
		for(int i = 0; i < V; i++) {
			if(!G[v][i]) continue;
			int u = i, w = match[u];
			if(w < 0 || (!used[w] && dfs(w))) {
				match[v] = u;
				match[u] = v;
				return true;
			}
		}
		return false;
	}

	int calc() {
		int res = 0;
		fill(match.begin(), match.end(), -1);
		for(int v = 0; v < V; v++) {
			if(match[v] < 0) {
				fill(used.begin(), used.end(), false);
				if(dfs(v)) {
					res++;
				}
			}
		}
		return res;
	}
};


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

	int N;
	cin >> N;

	BipartiteMatching bp(2 * (N - 1));
	for(int i = 0; i < N - 1; i++) {
		for(int j = 0; j < N - 1; j++) {
			int b;
			cin >> b;
			if(b) bp.add_edge(j, (N - 1) + i);
		}
	}

	if(bp.calc() != N - 1) {
		cout << "no" << endl;
		return 0;
	}

	cout << "yes" << endl;
	for(int i = 0; i < N - 1; i++) {
		int m = bp.match[i];
		bp.match[i] = bp.match[m] = -1;
		fill(bp.used.begin(), bp.used.end(), false);
		bp.dfs(i);

		for(int j = 0; j < N - 1; j++) {
			if(j + N - 1 != bp.match[i]) {
				bp.remove_edge(i, N - 1 + j);
			}
		}

		cout << bp.match[i] - (N - 1) + 1 << endl;
	}
}

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

#define newline '\n'
#define IOS ios_base::sync_with_stdio(false); cin.tie(0)
using ll = long long;
using ull = unsigned long long;

int main() {
    IOS;
    cout.precision(12);
    cout << fixed;

    int a, b, h, m;
    cin >> a >> b >> h >> m;

    double atheta = ((h + (m / 60.0)) / 12.0) * 360;
    double btheta = (m / 60.0) * 360;
    //cout << atheta << " " << btheta << newline;
    double deg = abs(atheta - btheta);
    //cout << deg << newline;

    double pi = 2 * acos(0.0);
    double rad = deg * pi / 180;

    double s = (a * a) + (b * b) - (2 * a * b * cos(rad));
    double ans = sqrt(s);

    cout << ans << newline;

    return 0;
}

Measured memory_bytes: 4244
#include <bits/stdc++.h>
#define rei register int
using namespace std;
int a,b,c;
int main(){
	char s[2000];
	scanf("%s",s + 1);
	int lens = strlen(s + 1);
	for(rei i = 1;i <= lens;++i) printf("%c",s[i]); 
	if(s[lens] == 's') printf("es");
	else printf("s");
	return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h> // Replace needed headers for speed up

// -------------8<------- start of library -------8<------------------------
template <class T>
class FenwickTree {
public:
    FenwickTree(int _n = 0) : n(_n), bit(n + 1, 0) {}

    T sum(int r) const {
        T res = 0;
        for (r = r - 1; r >= 0; r = (r & (r + 1)) - 1) res += bit[r];
        return res;
    }
    T sum(int l, int r) const { return sum(r) - sum(l); }
    void add(int idx, const T &w) { for (; idx < n; idx |= idx + 1) bit[idx] += w; }
    int size() const { return n; }

private:
    const int n;
    std::vector<T> bit;
};
// -------------8<------- end of library ---------8-------------------------

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

    int n, q, com, x, y;

    std::cin >> n >> q;
    FenwickTree<int> tree(n);
    while (q--) {
        std::cin >> com >> x >> y;
        if (com == 0) // add : v[x - 1] += y
            tree.add(x - 1, y);
        else if (com == 1) // get prefix : v[x - 1] + ... + v[y - 1]
            std::cout << tree.sum(x - 1, y) << '\n';
    }

    return 0;
}



Measured memory_bytes: 3332
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;

int main(){
    ll X, Y;;
    cin >> X >> Y;
    vector<ll> a;
    a.push_back(X);
    for(ll i = 1; ; ++i){
        ll tmp = a[i-1]*2;
        if(tmp <= Y) a.push_back(tmp);
        else break;
    }
    
    cout << a.size() << endl;
    return 0;
}

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

/*
偶数なら末尾は0、奇数なら末尾は1
それを取り除いた残りの数について、-2で割って繰り返す
*/

string s;

void base2(ll x){
    if(x==1||x==0) s += (to_string(x));
    else{
        if(x%2==0) {
            s += (to_string(0));
            base2(x/(-2));
        }
        else {
            s += (to_string(1));
            base2((x-1)/(-2));
        }
    }
}

void solve(){
    int n;
    cin >> n;
    base2(n);
    reverse(s.begin(), s.end());
    cout << s << endl;

}

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


Measured memory_bytes: 892
#include<bits/stdc++.h>
#include <unistd.h>
using namespace std;
#define nl cout<<"\n"
#define endl '\n'
#define pb push_back
#define se second
#define fi first
#define int long long 
#define pi pair<int,int>
#define vpi vector<pi>
#define vvpi vector<vpi>
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define For(i,n) for(int i=0;i<n;i++)
#define Forn(i,a,n) for(int i=a;i<n;i++)
#define pie =3.14159265358979323846264338327950;
const int mod= 998244353;

void solve(){
	fio;
	string s;
	cin>>s;
	int sum=0;
	for(int i=0;i<s.length();i++){
		sum+= (s[i]-'0');
	}
	if(sum%9==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

int32_t main(){
	fio;
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int t=1;
	//cin>>t;
	for(int i=1;i<=t;i++){ 
		//cout<<"Case #"<<i<<":\n";
		solve();
	}
	return 0;
}


Measured memory_bytes: 3708
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int out;
        
        for(int i = 0; i < 10; i++){
            out = a * c - b;
            System.out.println(out);
            c = out;
        }
    }
}


Measured memory_bytes: 21972
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <list>
#include <map>
#include <set>
#define lson i<<1
#define rson i<<1|1
#define up(i,x,y) for(i=x;i<=y;i++)
#define down(i,x,y) for(i=x;i>=y;i--)
#define mem(a,x) memset(a,x,sizeof(a))
#define gi(x) scanf("%d",&x)
#define gi2(x,y) scanf("%d%d",&x,&y)
#define gll(x) scanf("%lld",&x)
#define gll2(x,y) scanf("%lld%lld",&x,&y)
#define gc(x) scanf("%c",&x)
#define gc2(x,y) scanf("%c%c",&x,&y)
using namespace std;
const double eps=1e-8; 
typedef long long ll;
const double PI = acos(-1.0); 
const int MAXN=100005;
const ll mod=1e7+9;
const ll llinf = (ll)(1e18) + 500;
const int inf=0x3f3f3f3f;
int a[MAXN];
int main(){
	
	
	int n,m;
	gi2(n,m);
	int sum=0;
	for(int i=1;i<=n;i++){gi(a[i]);sum+=a[i];}
	double x=sum*1.0/(1.0*4*m);
	int cnt=0;
	for(int i=1;i<=n;i++ )if(a[i]>=x)cnt++;
	if(cnt>=m){
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
	
	return 0;
}



















Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }
    else{
      x = x->right;
    }
  }
  z -> parent = y;

  if(y == NIL){
    root = z;
  }
  else if(z->key < y->key){
    y->left =z;
  }
  else{
    y->right =z;
  }
  
}

void inorder(Node u){

  if( u != NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }   
}
void preorder(Node u){

  if( u != NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  } 
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 24040
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
#include <thread>
#include <chrono>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N; cin >> N;
    ll on = (N+1)/2;
    cout << fixed << setprecision(20) << (double)on / N << endstr;
    return 0;
}


Measured memory_bytes: 256
use std::cmp;

const MOD: usize = 1e9 as usize + 7;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let m: usize = sc.read();

    let mut lx = vec![vec![]; n + 1];
    for _ in 0..m {
        let l = sc.read::<usize>();
        let r: usize = sc.read();
        let x: usize = sc.read();
        lx[r].push((l, x));
    }

    let count = |j: usize, k: usize, left: usize| {
        if cmp::min(j, k) >= left {
            3
        } else if cmp::max(j, k) >= left {
            2
        } else {
            1
        }
    };

    let mut dp = vec![vec![vec![0; n + 1]; n + 1]; n + 1];
    dp[0][0][0] = 1;

    for i in 0..n {
        for j in 0..n {
            for k in 0..n {
                if dp[i][j][k] == 0 {
                    continue;
                }
                let next = cmp::max(cmp::max(i, j), k) + 1;
                if lx[next].iter().all(|&(left, x)| x == count(j, k, left)) {
                    dp[next][j][k] += dp[i][j][k];
                    dp[next][j][k] %= MOD;
                }
                if lx[next].iter().all(|&(left, x)| x == count(i, j, left)) {
                    dp[i][j][next] += dp[i][j][k];
                    dp[i][j][next] %= MOD;
                }
                if lx[next].iter().all(|&(left, x)| x == count(i, k, left)) {
                    dp[i][next][k] += dp[i][j][k];
                    dp[i][next][k] %= MOD;
                }
            }
        }
    }

    let mut ans = 0;
    for i in 0..n {
        for j in 0..n {
            ans += dp[i][j][n];
            ans += dp[i][n][j];
            ans += dp[n][j][i];
            ans %= MOD;
        }
    }
    println!("{}", ans);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 237820
#include <iostream>
#include <algorithm>
using namespace std;
int a[1000];

bool cmp(int a,int b)//bool函数，用于把sort改成从大到小排
{
    return a>b;
}

int main()
{
	int m,n;
	cin>>m>>n;
	for(int i=1;i<=m;++i)
	cin>>a[i];
	sort(a+1,a+1+m,cmp);
	int num=0;
	for(int i=1;i<=n;++i)
	{
		num+=a[i];
	}
	cout<<num;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,m,a[111];
  cin>>n>>m;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int k=1;k<=m;k++)for(int i=0;i<n-1;i++)if(a[i]%k>a[i+1]%k)swap(a[i],a[i+1]);
  for(int i=0;i<n;i++)cout<<a[i]<<endl;
  return 0;
}


Measured memory_bytes: 1160
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

const ll mod = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

class combination{
private:
    vector<mint> fact,finv;
public:
    combination(int N){
        fact = finv = vector<mint>(N+1);
        fact[0] = fact[1] = 1;
        finv[0] = finv[1] = 1;
        for(ll i=2;i<=N;i++){
            fact[i] = fact[i-1]*i;
            finv[i] = fact[i].inv();
        }
    }
    mint f(int i){
        return fact[i];
    }
    mint comb(int n,int k){
        if(n<k) return 0;
        if(n<0 || k<0) return 0;
        return fact[n]*finv[k]*finv[n-k];
    }
    mint hcomb(int n,int k){
        if(n==0 && k==0) return 1;
        return comb(n+k-1,k);
    }
};

int main(){
    ll N,M;
    cin >> N >> M;
    combination c(N+3*M);
    mint ans = c.hcomb(N,3*M);
    for(int k=M+1;k<=min(N,3*M);k++){
        if((3*M-k)%2==0){
            ans -= c.comb(N,k)*c.hcomb(N,(3*M-k)/2);
        }
    }
    mint n;
    n.x = N;
    ans -= c.hcomb(N,M-1)*n;
    cout << ans.x << endl;
}

Measured memory_bytes: 39296
import sys
input = sys.stdin.readline
N = int(input())
pira = [[] for i in range(N)]
for i in range(N):
	pira[i] = list(map(int, input().split()))
	if pira[i][2] != 0:
		k = pira[i]

for x in range(101):
	for y in range(101):
		tmp = k[2] + abs(x-k[0]) + abs(y-k[1])
		for i in range(len(pira)):
			if pira[i][2] != max(tmp-abs(x-pira[i][0])-abs(y-pira[i][1]),0):
				break
			if i == len(pira)-1:
				print(x,y,tmp)
				exit()


Measured memory_bytes: 42864
#include <sys/time.h>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <cctype>

using namespace std;

using ll = long long;
using P = pair<double, double>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
ll mod = 1000000007LL;

void solve(int n) {
	cout << "Yes" << endl;
	cout << n + 1 << endl;

	int a[n + 1][n];

	int cur = 1;
	rep(i, n) {
		for(int j = 0; j < n - i; j++) {
			a[i][i + j] = cur + j;
			a[i+ j + 1][i] = cur + j;
		}
		cur += n - i;
	}

	rep(i, n + 1) {
		cout << n;
		rep(j, n) {
			cout << " " << a[i][j]; 
		}
		cout << endl;
	}
}


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

	for(ll i = 1; i < 1000; i++) {
		if (i * (i + 1) == n * 2) {
			solve(i);
			return 0;
		}
	}
	cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3916
from bisect import bisect_left

N = int(input())
A = list(map(int, input().split()))

lst = [0] * (N)
for a in A:
    lst[a - 1] += 1
lst.sort() #頻度列

s = [0] * (N + 1)
for i in range(N):
    s[i + 1] = s[i] + lst[i]

# print (lst)
# print (s)

# def check(x, k):
#     i = bisect_left(lst, x) - 1
#     total = x * (N - i) + s[i]
#     return total >= x * k


ans = N
i = N
for k in range(1, N + 1):
    while True:
        while  i >= 1 and lst[i - 1] >= ans:
            i -= 1
        total = ans * (N - i) + s[i]
        if total >= ans * k:
            break
        ans -= 1
    # print ('i =', i)
    print (ans)
        

Measured memory_bytes: 37724
using System;
using System.Collections.Generic;
using System.Text;

namespace ABC109_D___Make_Them_Even
{
    static class Program
    {
        static void Main(string[] args)
        {
            var HW = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var H = HW[0];
            var W = HW[1];
            var map = new int[H + 1, W + 1];
            for (int i = 0; i < H; i++)
            {
                var read = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                for (int j = 0; j < W; j++)
                {
                    map[i + 1, j + 1] = read[j];
                }
            }

            var moveCount = 0;
            var moveLog = new StringBuilder();
            for (int h = 1; h < H + 1; h++)
            {
                if (h.isOdd())
                {
                    if (map[h - 1, 1].isOdd())
                    {
                        moveCount++;
                        moveLog.AppendLine($"{h - 1} {1} {h} {1}");
                        map[h - 1, 1]--;
                        map[h, 1]++;
                    }
                    for (int w = 1; w < W; w++)
                    {
                        if (map[h, w].isOdd())
                        {
                            moveCount++;
                            moveLog.AppendLine($"{h} {w} {h} {w + 1}");
                            map[h, w]--;
                            map[h, w + 1]++;
                        }
                    }
                }
                else
                {
                    if (map[h - 1, W].isOdd())
                    {
                        moveCount++;
                        moveLog.AppendLine($"{h - 1} {W} {h} {W}");
                        map[h - 1, W]--;
                        map[h, W]++;
                    }
                    for (int w = W; w > 1; w--)
                    {
                        if (map[h, w].isOdd())
                        {
                            moveCount++;
                            moveLog.AppendLine($"{h} {w} {h} {w - 1}");
                            map[h, w]--;
                            map[h, w - 1]++;
                        }
                    }
                }
            }
            Console.WriteLine(moveCount);
            Console.Write(moveLog.ToString());
        }
        public static bool isOdd(this int n)
        {
            return n % 2 == 1;
        }
    }
}


Measured memory_bytes: 27564
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int h, a;
    cin >> h >> a;
    cout << (h + a - 1) / a << "\n";
    return 0;
}

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

int main(){
	int a,b ;
	cin >> a >> b ;
	cout << "a" << " " ;
	if(a>b) cout << ">" ;
	else if(a<b) cout << "<" ;
	else cout << "==" ;
	cout << " " << "b" << endl ;
}



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

int main(){
int K,A,B;
cin >> K;
cin >> A >> B;

for(int i=A;i<=B;i++){
  if(i%K==0){
    cout << "OK" << endl;
    return 0;
  }
}
cout << "NG" << endl;
}

Measured memory_bytes: 3624
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        String ans = "No";
    
		// 文字列の入力
        ArrayList<String> sList = new ArrayList<>();
        sList.addAll(Arrays.asList(sc.next().split("")));
        String t = sc.next();
      
        for(int i = 0; i < sList.size(); i++) {
          String value = sList.get(0);
          sList.remove(0);
          sList.add(value);
          StringBuilder builder = new StringBuilder();
          for(String s : sList) {
            builder.append(s);
          }
          String s = builder.toString();
          if (s.equals(t)) {
            ans = "Yes";
            break;
          }
        }
    
		// 出力
		System.out.println(ans);
	}
}

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

int n, cnt;

int main() {
    scanf("%d", &n);
    for(int i = 0, val; i < n; ++i) {
        scanf("%d", &val);
        while(~val & 1) val >>= 1, cnt++;
    }
    printf("%d\n", cnt);
}

Measured memory_bytes: 256