akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
// const int mod=998244353;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    vi a(n+1);
    rep(i,n)cin>>a[i+1];
    rep(i,n)a[i+1]+=a[i];
    int ans=0;
    REP(i,1,n-1)ans+=(a[i]-a[i-1])*((a[n]-a[i])%mod)%mod,ans%=mod;
    cout<<ans<<endl;
}

Measured memory_bytes: 4740
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, M;
  cin >> N >> M;
  vector<int> as(M);
  F0R(i, M) {
    cin >> as[i];
  }
  sort(rng(as));
  F0R(i, M - 1) {
    as[i] = abs(as[i + 1] - as[i]);
  }
  as.resize(as.size() - 1);
  sort(rng(as));
  //Print(as);
  int r = 0;
  F0R(i, M - N) {
    r += as[i];
  }
  cout << r;
}
#endif


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

#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(box) box.begin(), box.end()

using namespace std;

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

const long long INF = LLONG_MAX/3;

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; }

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[a]+=siz[b];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}
const int MOD=1e9+7;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
	int n;
	cin>>n;
	int ans=0;
	int cnt1[10][10]={};
	int cnt2[10][10]={};
	rep(i,1,n+1){
		string st=to_string(i);
		int s=stoi(st.substr(0,1)),t=stoi(st.substr(st.size()-1,1));
		cnt1[s][t]++;
		cnt2[t][s]++;
	}
	rep(i,10){
		rep(j,10){
			ans+=cnt1[i][j]*cnt2[i][j];
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000
int hairetu[MAX],a;
int partition(int,int);
int main(){
    int i,q;
    scanf("%d",&a);
    for(i=0;i<a;i++){
      scanf("%d",&hairetu[i]);
    }
    q=partition(0,a-1);
    for(i=0;i<a;i++){
      if(i)printf(" ");
      if(i==q)printf("[");
      printf("%d",hairetu[i]);
      if(i==q)printf("]");
    }
    printf("\n");
    return 0;
  }
int partition(int p,int r){
  int b,i,j,c;
  b=hairetu[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(hairetu[j]<=b){
      i++;
      c=hairetu[i];
      hairetu[i]=hairetu[j];
      hairetu[j]=c;
    }
  }
  c=hairetu[i+1];
  hairetu[i+1]=hairetu[r];
  hairetu[r]=c;
  return i+1;
}

Measured memory_bytes: 992
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <unordered_map>
#include <queue>
#include <array>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;
//const int mod = ;

int main() {
  //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  //std::ios::sync_with_stdio(false); std::cin.tie(0);
  vi d(5);
  for (int i = 0; i < 3; ++i) {
    int a, b;
    cin >> a >> b;
    ++d[a]; ++d[b];
  }
  for (int i = 0; i < d.size(); ++i) if (d[i] >= 3) {
    cout << "NO\n"; return 0;
  }
  cout << "YES\n";
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
int main() {
	
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int N[4] = { 0 }, M;

	scanf("%d %d %d", &N[0], &N[1], &N[2]);
	
	std::sort(N, N + 3);

	printf("%d", N[2] * 10 + N[1] + N[0]);

}

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

int main(){
	int n;
	cin>>n;
	int k=0;
	cin>>k;
	int a[n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	int sum=0;
	for(int i=1;i<=k;i++){
		sum+=a[i];
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 3624
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int r=sc.nextInt();
        int g=sc.nextInt();
        int b=sc.nextInt();
        int n=sc.nextInt();
        int ans=0;
        for(int i=0;i*r<=n;i++){
            for(int j=0;i*r+j*g<=n;j++){
                if((n-i*r-j*g)%b==0)ans++;
            }
        }
        System.out.println(ans);
    }
}


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

int main(void){
	int A[3][3];
	int N;
	int b;
	for(int a=0;a<3;a++){
		for(int x=0;x<3;x++){
			scanf("%d",&A[a][x]);
		}
	}
	scanf("%d",&N);
	for(int a=0;a<N;a++){
		scanf("%d",&b);
		for(int a=0;a<3;a++){
			for(int x=0;x<3;x++){
				if(b==A[a][x]){
					A[a][x]=0;
				}
			}
		}
	}
	//横
	int ans;
	for(int x=0;x<3;x++){
		ans=A[0][x]+A[1][x]+A[2][x];
		if(ans==0){printf("Yes");return 0;}
	}
	ans=0;
	for(int x=0;x<3;x++){
		ans=A[x][0]+A[x][1]+A[x][2];
		if(ans==0){printf("Yes");return 0;}
	}
	ans=0;
	ans=A[0][0]+A[1][1]+A[2][2];
	if(ans==0){printf("Yes");return 0;}
	ans=0;
	for(int x=0;x<3;x++){
		ans=A[0][2]+A[1][1]+A[2][0];
		if(ans==0){printf("Yes");return 0;}
	}
	printf("No");
}

Measured memory_bytes: 128
#include <iostream>

#define forn(i,n) for(int i=0; i<(n); i++)
#define forr(i,x,n) for(int i=(x); i<(n); i++)

using namespace std;

int divs(int k){
    int res = 0;
    for(int j=1; j*j<=k; j++){
        if( k%j == 0 ) res+=2;
        if(j*j == k) res--;
    }
    return res;
}

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

    int ans = 0;
    forr(i,1,N+1){
        if( i%2 and divs(i)==8 ) ans++;
    }

    cout << ans << endl;

    return 0;
}


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

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

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


def solve(S: str):
    print(S[:3])
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


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

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

int main(){
    int x, y;
    cin >> x >> y;
    cout << (x+1)+(y+1)-gcd(x,y)-1 << endl;
    
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

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

/*-------------------------------------------*/

vector<vector<ll>> solve(int H, int W, int h, int w) {
    vector<ll> sum(W + 1), ret(W);
    sum[W] = 1;
    for(int i = W - w; i >= 0; i -= w)
        sum[i] = sum[i + w] + 1;
    rep(i, W - w) if(W % w != i % w) sum[i + w] = sum[i] - 1;

    rep(i, W) ret[i] = sum[i + 1] - sum[i];
    return vector<vector<ll>>(H, ret);
}

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

    int H, W, h, w;
    cin >> H >> W >> h >> w;

    if(H % h == 0 && W % w == 0) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;

    bool rev = (W % w == 0);
    if(rev) {
        swap(H, W);
        swap(h, w);
    }
    vector<vector<ll>> ret = solve(H, W, h, w);

    if(rev) {
        rep(j, W) {
            rep(i, H) cout << ret[i][j] << " ";
            cout << endl;
        }
    } else {
        rep(i, H) {
            rep(j, W) cout << ret[i][j] << " ";
            cout << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


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

    vvint ans(h, vint(w, 0));
    rep(i, h) {
        rep(j, w) {
            if (i < b && j >= w-a) ans[i][j]++;
            if (i >= b && j < w-a) ans[i][j]++;
            cout << ans[i][j];
            if (j == w-1) cout << endl;
        }        
    }


    return 0;
}

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

void solve(long long A, long long B, long long C){
    cout << max(C - (A - B), (long long)0) << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){

	int w, h, x, y, r;

	scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);

	if (x - r<0 || x + r>w || y - r<0 || y + r>h){
		printf("No\n");
	}
	else{
		printf("Yes\n");
	}

	return 0;
}

Measured memory_bytes: 584
def main():
    n = int(input())
    A = list(map(int, input().split()))
    A.sort()
    ans = [str((m := A.pop())), ]
    m /= 2
    A = [(a, abs(a - m)) for a in A]
    A.sort(key = lambda x: x[1])
    ans.append(str(A[0][0]))
    print(' '.join(ans))

if __name__ == '__main__':
    main()


Measured memory_bytes: 23816
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<long long,long long> > vpll;
typedef vector<vector<ll> > vvll;

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 

bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
} 
int main() {
	ll n,i;cin>>n;
	ll x;
	vll v;
	fr(i,0,n)
	{
		cin>>x;
		v.pb(x);
	}ll c=0;vll v1;
	if(n>1)
{	fr(i,0,n-1)
	{
		if(v[i]>=v[i+1])
		{
			c++;
		}
		else
		{
			v1.pb(c);c=0;
		}
	}
	v1.pb(c);
	cout<<*max_element(v1.begin(),v1.end());
}
else
{
	cout<<0;
}
	
	return 0;
}


Measured memory_bytes: 2548
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<int(n);i++)
#define P pair<int, int>
using namespace std;

int main(void){
	int N,M;cin >> N >> M;
	vector<P> X(M);
	rep(i,M){
		cin >> X[i].first >> X[i].second;
	}
	rep(i,1000){
		int value = i/10;
		vector<int> check(1,i%10);

		while(value){
			check.push_back(value%10);
			value /= 10;
		}

		if(check.size() != N)continue;
		
		bool flag=true;
		reverse(check.begin(), check.end());

		rep(j,M){
			if(check[X[j].first-1] != X[j].second)flag=false;
		}
		if(flag){
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}


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

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

    int x,y;

    x = min({a,b,c});

    if(x == a) y = min(b,c);

    if(x == b) y = min(a,c);

    if(x == c) y = min(a,b);

    cout << x + y << endl;
}

Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
hm=max(h)

ans=0
for i in range(hm,0,-1):
    t=1
    for j in range(n):
        if h[j]>=i:
            ans+=t
            t=0
        else:
            t=1

print(ans)


Measured memory_bytes: 9036
/*
ID: toooooEasy or RafaelSaddatimov
PROG:
*/
#include <bits/stdc++.h>
#define MAX 100005
#define MAXN 100005
#define MOD 1000000007
#define INF 21000000
#define EPS 1e-5
#define ll long long
#define F first
#define S second
#define all(a) a.begin(), a.end()
#define pb push_back
#define io ios_base::sync_with_stdio(false); cin.tie(0)
using namespace std;


int main() {
    io;
    int n;
    ll sum = 0;
    cin >> n;
    ll x;
    for(int i=0; i<n; ++i) {
        cin >> x;
        sum += x;
    }
    cout << (sum -  n);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sz(s)               (int)s.size()
using namespace std;
int main()
{


		string s; cin >> s;
	int l = 0, r = sz(s)- 1;
	int f = 0;
	while (l<r)
	{
		if (s[l] != s[r])f = 1;;
		l++; r--;
	}

	l = 0;	r = ((sz(s) - 1) / 2)-1;
	//cout << l << " " << r << endl;
	while (l <r)
	{
		if (s[l] != s[r])f = 1;
		l++; r--;
	}
	l = ((sz(s) + 3)/2)-1;	r = sz(s) - 1;
//cout << l << " " << r << endl;
	while (l < r)
	{
		if (s[l] != s[r])f = 1;
			
		l++; r--;
	}
	if (f == 1)cout << "No";
	else
	cout << "Yes";

	 
}

Measured memory_bytes: 256
#!/usr/bin/python3
#coding: utf-8

N, M = (int(x) for x in input().split())

S = []
for i in range(M):
    S.append([int(x)-1 for x in input().split()][1:])
P = [int(x) for x in input().split()]

ret = 0
for bit in range(2**N):
    on = [i for i in range(N) if bit & (1 << i)]
    if all(sum(1 for switch in S[i] if switch in on) % 2 == P[i] for i in range(M)):
        ret += 1
print(ret)


Measured memory_bytes: 9016
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	long long int q, h, s, d, n;
	cin >> q >> h >> s >> d >> n;
	h = min(h, 2 * q);
	s = min(s, 2 * h);
	d = min(d, 2 * s);
	cout << d * (n / 2) + s * (n % 2) << endl;
	return 0;
}

Measured memory_bytes: 256
/**
 * @Author: yujirotakahashi
 * @Date:   2020-05-17T20:22:10+09:00
 * @Last modified by:   yujirotakahashi
 * @Last modified time: 2020-05-17T21:05:05+09:00
 */

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

/*******  All Required define Pre-Processors and typedef Constants *******/
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define Dcout(a) cout << setprecision(20) << a << endl
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
//const ll INF = (1LL << 60);
//const double pi=acos(-1.0);
using ll = long long;
using PAIR = pair<int, int>;
#define debug cout << "line : " << __LINE__ << " debug" << endl
/****** Template of some basic operations *****/
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/**************************************/

/******** User-defined Function *******/


/**************************************/

/********** Main()  function **********/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int k;
  string s; cin >> k >> s;

  if(s.size()<=k) cout << s << endl;
  else{
      cout << s.substr(0,k) << "..." << endl;
  }


  return 0;
}
/********  Main() Ends Here *************/


Measured memory_bytes: 3656
#include <stdio.h>
int main(void){
    int x,i,j;
    scanf("%d",&x);
    for(i=1;i<10;i++){
        for(j=1;j<10;j++){
            if(x==i*j){
                printf("Yes");
                return 0;
            }
        }
    }
    printf("No");
    return 0;
}

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

int main(){
    string word, t;
    cin >> word;
    int count = 0;
    while(1){
        cin >> t;
        if (t == "END_OF_TEXT") break;
        if (word.size() != t.size()) continue;
        for (int i = 0; i < word.size(); i++){
            if (word[i] != t[i] && word[i] + 'A' - 'a' != t[i]) break;
            if (i == word.size() - 1) count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int count=0;
    string s;
    cin>>s;
    if (s.size()==1) {
        cout<<0<<endl;
    } else {
        for (int i=0;i<s.size()-1;i++) {
            if (s.at(i)=='0'&&s.at(i+1)=='0') {
                s.at(i+1)='1';
                count++;
            } else if (s.at(i)=='1'&&s.at(i+1)=='1') {
                s.at(i+1)='0';
                count++;
            }
        }
        cout<<count<<endl;
    }
    
}


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

    public class Main {

    void solve(InputReader in, PrintWriter out) {
        double l = in.nextLong();
        double side = l / 3;
        out.printf("%.9f\n", side*side*side);
    }

    

    public static void main(String[] args) throws Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Main solver = new Main();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer st;

        public InputReader(InputStream is) {
        in = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
        try {
            while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
            }
            return st.nextToken();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        }

        public int nextInt() {
        return Integer.parseInt(next());
        }

        public long nextLong() {
        return Long.parseLong(next());
        }
    }
    }


Measured memory_bytes: 23124
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    h1,m1,h2,m2,K = map(int, readline().split())

    wakeup = h1 * 60 + m1
    sleep = h2 * 60 + m2

    ans = sleep - K - wakeup
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9180
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

		int N = sc.nextInt();
		int[] X = new int[N];
		int[] Y = new int[N];

		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
			Y[i] = X[i];
		}

		Arrays.sort(X);

		int ansR = X[N/2];
		int ansL = X[N/2 - 1];

		for(int i = 0; i < N; i++) {
			if(Y[i] > ansL) {
				System.out.println(ansL);
			} else {
				System.out.println(ansR);
			}
		}

	}
}


Measured memory_bytes: 86752
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
   int n;
   cin >> n;
   vector<vector<int>> v(n,vector<int> (10));
   rep(i,n){
      rep(j,10){
         cin >> v[i][j];
      }
   }
   int ans = -1e9;
   vector<vector<int>> u(n,vector<int> (11));
   rep(i,n){
      rep(j,11){
         cin >> u[i][j];
      }
   }
   for (int bit = 1;bit < 1 << 10 ;bit++){
      vector<int> p(n,0);
      for (int j = 0; j < 10;j++){
         if (bit & 1 << j){
            for (int w = 0; w < n;w++){
               if (v[w][j] == 1) p[w]++;
            }
         }
      }
      int cnt = 0;

      for (int w = 0; w < n;w++){
            cnt+= u[w][p[w]];
      }
      ans = max(cnt,ans);
      //cout << bit << " " << cnt << endl; 
      
   }
   cout << ans << endl;
   
   

   return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;

const int N = 100010;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 97;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

//OrderedSet
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template < typename T > using ordered_set = tree < T, null_type, greater < T >, rb_tree_tag, tree_order_statistics_node_update >;
//
//typedef uint64_t hash_t;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//const int HASH_COUNT = 2;
//const hash_t HASH_P = (uint32_t)-13337;
//uniform_int_distribution<hash_t> MULT_DIST(0.25 * HASH_P, 0.75 * HASH_P);
//const hash_t HASH_MULT[HASH_COUNT] = {MULT_DIST(rng), MULT_DIST(rng)};

char s[20];

int main(){
  scanf("%s", s);
  printf("%c%c%c", s[0], s[1], s[2]);
}


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

const ll INF=1e18;

int main() {
  int n; cin>>n;
  vector<ll> p(n+1);
  rep(i, n) cin>>p[i]>>p[i+1];

  vector<vector<ll>> dp(n+1, vector<ll>(n+1, INF));
  rep(i, n+1) dp[i][i]=0;

  for (int l=1; l<n; l++) {
    for (int i=0; i<n-l; i++) {
      int j=i+l;
      for (int k=i; k<j; k++) {
        ll cost=p[i]*p[k+1]*p[j+1];
        dp[i][j]=min(dp[i][j], dp[i][k]+dp[k+1][j]+cost);
      }
    }
  }
  cout<<dp[0][n-1]<<endl;
}



Measured memory_bytes: 3172
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<algorithm>
#include<iostream>
#include<cstring>
#include<fstream>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#define INF 0X3F3F3F3F
#define N 100005
#define M 2000005
#define LL long long
#define FF(i, a, b) for(int i = a; i <= b; ++i)
#define RR(i, a, b) for(int i = a; i >= b; --i)
#define FJ(i, a, b) for(int i = a; i < b; ++i)
#define SC(x) scanf("%d", &x)
#define SCC(x, y) scanf("%d%d", &x, &y)
#define SCCC(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define SS(x) scanf("%s", x)
#define PR(x) printf("%d\n", x)
#define CL(a, x) memset(a, x, sizeof(a))
#define _P fd[rt]
#define _L fd[rt << 1]
#define _R fd[rt << 1 | 1]
#define MID int mid = ((l + r) >> 1)
#define lson rt<<1 ,l, mid
#define rson rt<<1 | 1, mi d + 1, r
#define PII pair<int, int>
#define PLL pair<long long, long long>
#define MP make_pair
#define PB push_back
#define IN freopen("in.txt", "r", stdin)
#define OUT freopen("out.txt", "w", stdout)
using namespace std;
const int MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-8;
inline void II(int &n){char ch = getchar(); n = 0; bool t = 0;
for(; ch < '0'; ch = getchar()) if(ch == '-') t = 1;
for(; ch >= '0'; n = n * 10 + ch - '0', ch = getchar()); if(t) n =- n;}
inline void OO(int a){if(a < 0) {putchar('-'); a = -a;}
if(a >= 10) OO(a / 10); putchar(a % 10 + '0');}
inline int sgn(double x){return (x > EPS) - (x < -EPS);}
int vis[10000005], pri[M], prn;
void init(){
    for(int i = 2; i < 10000000; ++i){
        if(vis[i] == 0) pri[++prn] = i;
        for(int j = 1; j <= prn && i * pri[j] <= 10000000; ++j){
            vis[i * pri[j]] = 1;
            if(i % pri[j] == 0) break;
        }
    }
}
int n, a[300], c[300], cnt, l[300], r[300], ln, rn;
bool mp[300][300];
int vv[300], link[300], ii;
bool dfs(int u){
    FF(v, 1, cnt) if(mp[u][v]){
        if(vv[v] != ii){
            vv[v] = ii;
            if(!link[v] || dfs(link[v])){
                link[v] = u;
                return 1;
            }
        }
    }
    return 0;
}
int main(){
 //   IN;
    init();
    vis[0] = vis[1] = vis[2] = 1;
    SC(n);
    FF(i, 1, n) SC(a[i]);
    int p = 1;
    while(p <= n){
        c[++cnt] = a[p];
        int pp = p;
        while(pp < n && a[pp + 1] == a[pp] + 1) ++pp;
        c[++cnt] = a[pp] + 1;
        p = pp + 1;
    }
    FF(i, 1, cnt){
        if(c[i] & 1) l[++ln] = c[i];
        else r[++rn] = c[i];
    }
    FF(i, 1, cnt) FF(j, i + 1, cnt){
        if(vis[abs(c[i] - c[j])] == 0) mp[i][j] = mp[j][i] = 1;
    }
    int s = 0;
    for(ii = 1; ii <= cnt; ++ii){
        if(dfs(ii)){
            ++s;
        }
    }
    s /= 2;
    int ans = s;
    ans += ((ln - s) / 2 + (rn - s) / 2) * 2;
    ans += (ln - s) % 2 ? 3 : 0;
    printf("%d\n", ans);
    return 0;
}


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

using namespace std;
using lld = long long;

const lld oo = 1LL << 40;

lld gauss(lld n) {
        return n * (n + 1) >> 1;
}

int main() {
        lld x, i;
        cin >> x;
        for(i = 0; gauss(i) < x; ++i);
        cout << i << endl;
        return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

struct Edge{
	int src,dst;
	Edge(){}
	Edge(int s,int d):src(s),dst(d){}
};
typedef vector<vector<Edge> > Graph;

bool BFS(const Graph& g,const vi& side,const vi& match,vi& level)
{
	int n=g.size();
	level.assign(n,n);
	queue<pii> q;
	rep(i,n) if(side[i]==0 && match[i]==-1)
		q.push(mp(i,0));
	bool res=false;
	while(!q.empty()){
		pii cur=q.front(); q.pop();
		int u=cur.first,l=cur.second;
		if(level[u]<=l) continue;
		level[u]=l;
		rep(i,g[u].size()){
			int v=g[u][i].dst;
			if(match[v]==-1)
				res=true;
			else
				q.push(mp(match[v],l+2));
		}
	}
	return res;
}

bool DFS(const Graph& g,const vi& side,int u,vi& match,vi& level)
{
	rep(i,g[u].size()){
		int v=g[u][i].dst;
		if(match[v]==-1 || level[match[v]]>level[u] && DFS(g,side,match[v],match,level)){
			match[u]=v;
			match[v]=u;
			return true;
		}
	}
	level[u]=-1;
	return false;
}

int HopcroftKarp(const Graph& g,const vi& side,vi& match)
{
	int n=g.size();
	match.assign(n,-1);
	int res=0;
	for(vi level;BFS(g,side,match,level);)
		rep(i,n) if(side[i]==0 && match[i]==-1)
			res+=DFS(g,side,i,match,level);
	return res;
}

int MinPathCover(const Graph& g)
{
	int n=g.size();
	Graph bg(2*n);
	rep(i,n) foreach(e,g[i])
		bg[e->src].push_back(Edge(e->src,n+e->dst));
	vi side(2*n),match(2*n);
	fill(n+all(side),1);
	return n-HopcroftKarp(bg,side,match);
}

int main()
{
	for(int n,m,l;cin>>n>>m>>l,n|m|l;){
		vvi dist(n,vi(n,INFTY));
		rep(i,n) dist[i][i]=0;
		rep(i,m){
			int u,v,d; cin>>u>>v>>d;
			dist[u][v]=dist[v][u]=d;
		}
		vi ps(l),ts(l);
		rep(i,l) cin>>ps[i]>>ts[i];
		
		rep(k,n) rep(i,n) rep(j,n)
			dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
		
		Graph g(l);
		rep(i,l) rep(j,l) if(i!=j){
			int u=ps[i],v=ps[j];
			if(ts[i]+dist[u][v]<=ts[j])
				g[i].push_back(Edge(i,j));
		}
		cout<<MinPathCover(g)<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 14460
n=int(input())
s=input()
w=[]
l=0
for i in range(n):
  if s[i]=="W":
    l+=1
  w.append(l)
m=min(w[n-1],n-w[n-1])
for i in range(1,n):
  m=min(m,w[i-1]+n-1-i-w[n-1]+w[i])
print(m)

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

int main(){

  while(1){
    int a,b;
    int G[101]={0};
    while(1){
      if(scanf("%d%d",&a,&b)<2)return 0;
      if(a == 0)break;
      G[b]++,G[a]++;
    }
    bool flag = true;
    if(G[1]%2 != 1 || G[2]%2 != 1)flag = false; 
    for(int i = 3 ; i <= 100 ; i++ ){
      if(G[i]%2 == 1){
	flag = false;
	break;
      }
    }

    if( flag ) cout << "OK" << endl;
    else cout << "NG" << endl;
  }
  return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
#define inf INFINITY
#define file freopen( "input.txt" , "r" , stdin) ; freopen( "output.txt" , "w" , stdout) ;
#define Gamed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define _3102_ main()
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
const int N = 1e5 + 100;
const ll MX = 1e18;
const ll mod = 1e9 + 7;
const double eps = 1e-9 ;
int n , m , dp[N] ;
vector < int > adj[N] ; 

int solve( int node ){
    //cout << node << endl ; 
    if ( dp[node] != -1 ) return dp[node] ;
    int maxi = 0 ; 
    for ( auto j : adj[node]){
        maxi = max ( maxi , solve(j) + 1 ) ;
    }
    return dp[node] = maxi ; 
} 

int _3102_{
	Gamed
    cin >> n >> m ; 
    for ( int i = 0 ; i < m ; i ++){
        int u , v ; 
        cin >> u >> v ;
        adj[v].push_back(u) ; 
    }
    //for ( int i = 1 ; i <= n ; i ++){
    //    cout << i << ": " ; 
    //    for ( auto j : adj[i] ){
    //        cout << j << " " ;
    //    }
    //    cout << endl ; 
    //}
    memset ( dp , -1 , sizeof dp ) ;
 
    for ( int i = 1 ; i <= n ; i ++){
        if ( dp[i] == -1 ){
            //cout << "--" << i << "--" << endl  ;
            solve (i) ;
            //cout << "------\n";
            //for ( int j = 1 ; j <= n ; j ++ ) cout << dp[j] << " " ;
            //cout << "\n------\n" ;  
        }  
    }
    int ans= 0 ; 
    for ( int i = 1 ; i <= n ; i ++ ){
        ans = max ( ans , dp[i]) ;
    }
    cout << ans << endl ; 
    return 0;
}



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


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if (c >= a && c <= b) {
			pr.println("Yes");
		} else {
			pr.println("No");
		}
	}

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

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21840
import java.util.Scanner;
 class Main {
	public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt();
        int[] x = new int[w];
        for(int i = 0;i < w;i++){
            x[i] = i+1;
        }
        int n = scan.nextInt();
        for(int i = 0;i < n;i++){
            String str = scan.next();
            String[] strAry = str.split(","); 
            int a = Integer.parseInt(strAry[0]) - 1;
            int b = Integer.parseInt(strAry[1]) - 1;
            int t = x[a];
            x[a] = x[b];
            x[b] = t;
        }
        for(int i = 0;i < w;i++){
            System.out.println(x[i]);
        }
    }
}

Measured memory_bytes: 17216
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    string S; cin >> S;
    rep(i, S.length()) {
        cout << (char)(((S[i] - 'A') + N) % 26 + 'A');
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
vector<l_l> v;
 
int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    if((N - 1) * (N - 2) / 2 < K) {
        cout << -1 << endl;
        return 0;
    }
    for(int i = 2; i <= N; i++) v.emplace_back(1, i);
    int rest = (N - 1) * (N - 2) / 2 - K;
    for(int i = 2; i <= N; i++) {
        for(int j = i + 1; j <= N; j++) {
            if(rest == 0) break;
            rest--;
            v.emplace_back(i, j);
        }
    }
    cout << v.size() << endl;
    for(int i = 0; i < v.size(); i++) {
        cout << v[i].first << " " << v[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>

#define INF (int)1e09

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::fixed;
using std::pair;
using std::make_pair;
using std::min;
using std::max;
using std::string;
using std::vector;
using std::list;
using std::map;
using std::set; // insert erase find count
using std::queue;
using std::priority_queue;
using std::stack;

template <typename T> using Vec = vector<T>; // c++11
typedef pair<int, int> PII;
typedef pair<int, pair<int, int> > PIII;

int main(void) {
    int n;
    cin >> n;
    while (n != 0) {
        int i = 1;
        while (1) {
            if (i * (i + 1) >= 2 * n) {
                cout << i << endl;
                n -= i;
                break;
            } else {
                i++;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<set>
#include<bitset>
#define rep(i,a,b)  for(i=a;i<b;i++)
#define itrep(at)	for(auto it=at.begin();it!=at.end();it++)
#define lli long long int
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vb vector<bool>
#define vc vector<char>
#define vvll vector<vector<long long int> >
#define sll set<long long int>
#define mll map<long long int,long long int>
#define sllit set<long long int>::iterator
#define pll pair<long long int,long long int>
#define vpll vector<pair<long long int,long long int> >
#define db double
#define M 1000000007
#define pi 3.1415926535897932384626433832795028841971
using namespace std;
lli min(lli a,lli b){return a<b?a:b;}
lli min(lli a,lli b,lli c){a=min(a,b);a=min(a,c);return a;}
lli max(lli a,lli b){return a>b?a:b;}
lli max(lli a,lli b,lli c){a=max(a,b);a=max(a,c);return a;}
lli power(lli a,lli b){lli res=1;while(b){if(b&1) res=res*a;a=a*a;b>>=1;}return res;}
lli mpower(lli a,lli b,lli m){lli res=1;a=a%m;while(b){if(b&1){res=(res*a)%m;}a=((a%m)*(a%m))%m;b>>=1;}return res;}
lli gcd(lli a,lli b){if(b==0) return a;if(a==0) return b;if(a>=b) return gcd(b,a%b);else return gcd(a,b%a);}
lli lcm(lli a,lli b){lli p=a*b;return p/gcd(a,b);}
lli dsum(lli n){lli ans=0;while(n){ans+=(n%10);n/=10;}return ans;}
lli ndigit(lli n){lli count=0;if(n==0)	return 1;while(n){count++;n/=10;}return count;}

/******************************START********************************/
int main()
{
	char ch1,ch2,ch3;
	string s1,s2,s3,str;
    lli i,j,k,a,b,c,t,d,n,m,sum=0,ans=0,temp;
    cin >> n;
    vll v(n);
    rep(i,0,n)	cin >> v[i];
    rep(i,0,n){
    	if(v[i]%2==0){
    		if(v[i]%3==0)	continue;
    		else if(v[i]%5==0)	continue;
    		else{
    			ans=1;
    			break;
			}
		}
	}
	if(ans)	cout << "DENIED" << endl;
	else	cout << "APPROVED"  << endl;
    
    
    
    
    return 0;
}





















/* UJJWAL KESHRI */

Measured memory_bytes: 256
program main
  implicit none
  integer :: n, i, j, m, res
  integer, allocatable :: s(:)
  character(4) :: si
  character(1), allocatable :: c(:)
  read (*, *) n, m
  allocate (s(m), c(m))
  do i = 1, m
    read (*, *) s(i), c(i)
  end do

  res = -1
  iloop: do i = 0, 999
    write (si, "(i0)") i
    if (len(trim(si)) /= n) cycle iloop
    do j = 1, m
      if (si(s(j):s(j)) /= c(j)) cycle iloop
    end do
    res = i
    exit iloop
  end do iloop
  write (*, "(i0)") res
end program main


Measured memory_bytes: 256
def rev(str):
    ans = ''
    for i in list(str):
        if i =='R':
            ans += 'L'
        elif i == 'L':
            ans += 'R'
        elif i =='U':
            ans += 'D'
        else:
            ans += 'U'
    return ans
def main():
    sx,sy,tx,ty = map(int,input().split(' '))
    ans_1 =''
    ans_2 = ''
    if sx-tx <0:
        ans_1 += 'R'*(tx-sx)
        ans_2 += 'L'
        mid = 'R'
    elif sx-tx >0:
        ans_1 += 'L'*(sx-tx)
        ans_2 += 'R'
        mid = 'L'
    if sy-ty <0:
        ans_1 += 'U'*(ty-sy)
        ans_2 += 'U'*(ty-sy+1)
        last = 'D'
    elif sy-ty >0:
        ans_1 += 'D'*(sy-ty)
        ans += 'D'*(sy-ty+1)
        last = 'D'
    ans_2 += mid*(abs(sx-tx)+1)+last
    ans = ans_1+rev(ans_1)+ans_2+rev(ans_2)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

bool solve() {
  string S, T;
  cin >> S >> T;
  rep(i, 0, S.size()) {
    bool ok = true;
    rep(j, 0, S.size()) {
      if(S[(i+j)%S.size()] != T[j]) ok = false;
    }
    if(ok) return true;
  }
  return false;
}

int main() {
  cout << (solve() ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
/*
On a gathering storm comes
A tall handsome man
In a dusty black coat with
A red right hand
*/

#pragma GCC optimize(2)
#pragma GCC optimize(3)   
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
#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 < pair < ll, ll > > vpll;
#define kill freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define all(c) c.begin(), c.end()
#define go(c,it) for(auto it=(c).begin(); it!=(c).end(); it++)
#define back(c,it) for(auto it=(c).rbegin(); it!=(c).rend(); it++)
#define fi first
#define se second
//#define MOD 998244353
#define Boost() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD1 1000000007
ll power(ll a, ll b,ll MOD){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;}a=(a*a)%MOD;b>>=1;}return res;}
//ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
#define oo LLONG_MAX

int f(int x){
    if(x == 0) return 0;
    int cnt = __builtin_popcount(x);
    x %= cnt;
    return f(x) + 1;
}
 
void solve(){
    
    int n; cin >> n;
    string s; cin >> s;
    reverse(all(s));
    int tmp1[n], tmp2[n], sum1 = 0, sum2 = 0, mod = 0;
    for(char c : s){
        mod += c == '1';
    }
    for(int i = 0; i < n; i++){
        if(mod > 1)tmp1[i] = power(2, i, mod - 1);
        tmp2[i] = power(2, i, mod + 1);
        if(s[i] == '1'){
            if(mod > 1)sum1 = (sum1 + tmp1[i]) % (mod - 1);
            sum2 = (sum2 + tmp2[i]) % (mod + 1);
        }
    }
    int ans[n];
    for(int i = 0; i < n; i++){
        if(s[i] == '0'){
            if(mod == 0){
                ans[i] = 1;
                continue;
            }
            int _sum2 = (sum2 + tmp2[i]) % (mod + 1);
            ans[i] = f(_sum2) + 1;
        }
        else{
            if(mod == 1){
                ans[i] = 0;
                continue;
            }
            int _sum1 = ((sum1 - tmp1[i]) % (mod - 1) + (mod - 1)) % (mod - 1);
            ans[i] = f(_sum1) + 1;
        }
    }
    for(int i = n - 1; i >= 0; i--)
        cout << ans[i] << '\n';
}
   

int main(){
    Boost();
    #ifndef ONLINE_JUDGE 
    kill
    #endif
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();
    }
    return 0;
}
 
 
/*-By the order of the peaky blinders*/

Measured memory_bytes: 6056