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

using namespace std;

#define MOD 1000000007

long long int solve() {
  int N;
  cin >> N;

  vector<int> counts(N, 0);

  long long int ans = 1;
  int colors = 0;

  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    counts[A]++;

    if (A == 0) {
      colors++;
    }

    if (A > 0 && counts[A-1] <= 0) {
      return 0;
    }
    if (colors > 3) {
      return 0;
    }

    if (A > 0) {
      ans = (ans * counts[A-1]) % MOD;
      counts[A-1]--;
    }
  }

  if (colors == 1) {
    return (3 * ans) % MOD;
  } else if (colors == 2) {
    return (6 * ans) % MOD;
  } else if (colors == 3) {
    return (6 * ans) % MOD;
  } else {
    return 0;
  }
}

int main() {
  cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#define ABS(x) (((x) < 0)? -(x): (x))
#define MAX(x, y) (((x) > (y))? (x): (y))

int main() {
    int n, i;
    long long z, w, end, end2;
    scanf("%d %lld %lld", &n, &z, &w);
    for (i=0; i<n-1; i++)
        scanf(" %lld", &end2);
    scanf("%lld", &end);
    if (n == 1)
        printf("%lld\n", ABS(end - w));
    else
        printf("%lld\n", MAX(ABS(end-w), ABS(end-end2)));
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        long[] asd = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long N = long.Parse(Console.ReadLine());
        long Q = asd[0];// * 4;
        long H = asd[1];// * 2;
        long S = asd[2];
        long D = asd[3];/// (double)2;
        long price = 0;

        if (N >= 2)
        {
            S *= 2;
            H *= 4;
            Q *= 8;
            price += (long)Math.Min(Math.Min(Math.Min(S, D), H), Q) * (N / 2);
            N = N % 2;
            Q = asd[0];// * 4;
            H = asd[1];// * 2;
            S = asd[2];
        }
        H *= 2;
        Q *= 4;
        price += (long)(Math.Min(Math.Min(Q, H), S)) * N;
        Console.WriteLine(price);
        Console.ReadLine();
    }

    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b)
    {
        return a / gcd(a, b) * b;
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;

        for (long i = 2; i < n; i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }

}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] longs()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] ints()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define endl codeforces
#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)
using ll = std::int64_t;
using ull = std::uint64_t;
using pii = std::pair<int, int>;
using tii = std::tuple<int, int, int>;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, std::size_t s, Tail... tail) { auto v = std::move(make_v(init, tail...)); return vec<decltype(v)>(s, v); }
template <typename T, std::size_t Head, std::size_t ...Tail> struct multi_dem_array { using type = std::array<typename multi_dem_array<T, Tail...>::type, Head>; };
template <typename T, std::size_t Head> struct multi_dem_array<T, Head> { using type = std::array<T, Head>; };
template <typename T, std::size_t ...Args> using mdarray = typename multi_dem_array<T, Args...>::type;
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }

int main() {
    ll n, m;
    std::cin >> n >> m;
    ll sum = 0;
    vec<ll> a(n);
    for (ll &e : a) {
        std::cin >> e;
        sum += e;
    }

    ll cnt = 0;
    for (ll e : a) {
        // 1 / 4m <= e / sum
        cnt += (sum <= e * 4 * m);
    }
    std::cout << (m <= cnt ? "Yes" : "No") << '\n';
    return 0;
}


Measured memory_bytes: 256
def hantei(n,y):
  for i in range(n+1):
    yukichi = i
    for j in range(n-yukichi+1):
      higuchi = j
      noguchi=n-i-j
      
      if 10000*yukichi + 5000*higuchi + 1000*noguchi == y:
        return[yukichi,higuchi,noguchi]
    
  return [-1,-1,-1]
  
n,y=map(int,input().rstrip().split())

print('{0[0]} {0[1]} {0[2]}'.format(hantei(n,y)))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int read(){
	int x=0,f=1; char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1; ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int f[N],d[N];
int find(int x){
	if (x==f[x]) return x;
	int fa=find(f[x]);
	d[x]=d[x]+d[f[x]];
	return f[x]=fa;
}
int main(){
	int n=read(),m=read();
	for (int i=1;i<=n;i++){
		d[i]=0; f[i]=i;
	}
	bool pd=0;
	while (m--){
		int l=read(),r=read(),v=read();
		int fl=find(l),fr=find(r);
		if (fl==fr){
			if (d[l]-d[r]!=v) pd=1;
		}else{
			f[fl]=fr;
			d[fl]=v+d[r]-d[l];
		}
	}
	if (pd==1) printf("No\n");
	else printf("Yes\n");
	return 0;
}

Measured memory_bytes: 1024
from sys import stdin

def main():
    n, m, k = [int(x) for x in stdin.readline().rstrip().split()]

    pileda = 0
    a = [0]
    for x in stdin.readline().rstrip().split():
        x = int(x)
        pileda += x
        a.append(pileda)
    
    piledb = 0
    b = [0]
    for x in stdin.readline().rstrip().split():
        x = int(x)
        piledb += x
        b.append(piledb)

    ans = 0
    bi = m
    for ai, at in enumerate(a):
        if at > k:
            break

        while at + b[bi] > k:
            bi -= 1
        
        ans = max(ans, ai+bi)
    
    print(ans)
            

if __name__ == "__main__":
    main()

Measured memory_bytes: 46272
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		String s = sc.next();
		int[] l = new int[q];
		int[] r = new int[q];
		for(int i = 0; i < q; i++){
			l[i] = sc.nextInt()-1;
			r[i] = sc.nextInt()-1;
		}
		int[] rui = new int[n];
		String ac = "AC";
		rui[0] = 0;
		for(int i = 1; i < n; i++){
			if(ac.equals(s.substring(i-1,i+1))){
				rui[i]++;
			}
			rui[i]+=rui[i-1];
		}
		System.out.println();
		for(int i = 0; i < q; i++){
			System.out.println(l[i]!=0?rui[r[i]]-rui[l[i]]:rui[r[i]]);
		}
	}
}


Measured memory_bytes: 93940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    // Your code here!
    ll n,d;
    cin>>n>>d;
    cout<<(n+2*d)/(2*d+1);
    
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
    int n=0,m=0;
    int num;
    cin>>n>>m>>num;
    if(n<m)
    {
        int t=num/m;
        if(t*m==num)
            cout<<t;
        else
            cout<<t+1;
    }
    else
    {
        int t=num/n;
        if(t*n==num)
            cout<<t;
        else
            cout<<t+1;
    }
}


Measured memory_bytes: 256
sx, sy, tx, ty = map(int,input().split())
dx = tx - sx
dy = ty - sy
a = 'U'*dy + 'R'*dx + 'D'*dy + 'L'*(dx + 1) + 'U'*(dy + 1) + 'R'*(dx + 1) + 'DR' + 'D'*(dy + 1) + 'L'*(dx + 1) + 'U' 
print(a)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{
    int respuesta, digitos[200];
    int a, b, i=0;
    while (cin>>a>>b){
    digitos[i]=1;
    respuesta=a+b;
    while (respuesta>=10){
    respuesta=respuesta/10;
    digitos[i]++;}
    i++;
    }
    for (int j=0;j<i;j++){
    cout<<digitos[j]<<endl;}

    return 0;
}

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


int main() {
	int n;
	cin >> n;
	vector<int> a(200000);
	for(int i=0; i<n; i++){
		cin >> a.at(i);
	}
	int index = 0;
	for(int i=0; i<n; i++){
		if(a.at(i) == index+1){
			index++;
		}
	}
	if(index == 0){
		cout << -1 << endl;
	}else{
		cout << n-index << endl;
	}
}

Measured memory_bytes: 1024
//package atCoder;
//package atCoder;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String a = scan.next();
        int count = 0;
        for(int i = 0; i < a.length()/2; i++)
        {
            if(a.charAt(i) != a.charAt(a.length()-1-i))
            {
                count++;
            }
        }
        System.out.println(count);
        
        scan.close();
    }

}


Measured memory_bytes: 22868
n,m=map(int,input().split())
ab=[]
c=[]

for i in range(m):
    ab.append(list(map(int,input().split())))
    c.append(list(map(int,input().split())))
    
for i in range(m):
    temp=0
    for j in range(len(c[i])):
        temp+=2**(c[i][j]-1)
    c[i]=temp
    #c[i]=(("0"*n)+bin(temp)[2:])[-n:]
   
dp=dict()

for i in range(2**n):
    dp[i]=10**9
    #dp[(("0"*n)+bin(i)[2:])[-n:]]=-1
    
dp[0]=0
    
#print(dp)
for i in range(m):
    for k,item in dp.items():
        dp[c[i]|k]=min(dp[c[i]|k],dp[k]+ab[i][0])

if dp[2**n-1]==10**9:
    print(-1)
else:
    print(dp[2**n-1])

Measured memory_bytes: 46424
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

 int main(){


  long long n,d = INT_MIN;
  cin>>n;

  for(long long i=1;i<=sqrt(n);i++)
 {
    if(n%i == 0){
        if(i>d)
            d = i;
    }
  }

  long long b = n/d;

  cout<<b-1+d-1<<endl;

 return 0;
 }


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <random>
#include <fstream>
#include <time.h>
#define int long long
#define debug(x) cerr << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1000000007;
const ll LINF = 1e18;
const double EPS = 1e-9;


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

  ll n,m;
  cin>>n>>m;
  pair<ll, ll> pr[n];
  rep(i,n) {
    cin>>pr[i].first>>pr[i].second;
  }
  sort(pr, pr + n);
  ll ans = 0;
  ll cnt = 0;
  rep(i,n) {
    if(cnt >= m) break;
    if(cnt + pr[i].second <= m) {
      ans += pr[i].first * pr[i].second;
      cnt += pr[i].second;
    } else if (cnt < m) {
      ans += pr[i].first * (m - cnt);
      cnt = m;
    }
  }
  cout << ans << endl;



  return 0;
}


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

int main(){
    int N,m=0;
    cin >> N;
    m=N%10;
    switch(m){
        case 0:
            cout << "pon" <<endl;
            break;
        case 1:
            cout << "pon" <<endl;
            break;
        case 2:
            cout << "hon" <<endl;
            break;
        case 3:
            cout << "bon" <<endl;
            break;
        case 4:
            cout << "hon" <<endl;
            break;
        case 5:
            cout << "hon" <<endl;
            break;
        case 6:
            cout << "pon" <<endl;
            break;
        case 7:
            cout << "hon" <<endl;
            break;
        case 8:
            cout << "pon" <<endl;
            break;
        case 9:
            cout << "hon" <<endl;
            break;
    }
}

Measured memory_bytes: 3636
//A,Elebereth Gilthoniel mantae!
//For Temeria!
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<cstdio>
#include<map>
#include<stack>
#include<queue>
#include<cstring> 
using namespace std;
map<int,int> m;int v[200008],x[200008];
int id[200008];int pre[2][200008];
int tree[800008];int nn;
bool cmp(int a,int b)
{
	return x[a]<x[b];
}
pair<int,int> p[200008];int at=1;
int dp[200008];int mo=1e9+7;
void update(int a,int b)
{
	a=a+nn-1;
	tree[a]+=b;if(tree[a]>mo) tree[a]-=mo;
	while(a>0)
	{
		a=a/2;tree[a]+=b;if(tree[a]>mo) tree[a]-=mo;
	}
}
int query(int a,int b,int l,int r,int id)
{ 
	if(a>r or b<l) return 0;
	if(l>=a and r<=b) return tree[id];
	int u=query(a,b,l,(l+r)/2,id*2)+query(a,b,(l+r+1)/2,r,id*2+1);if(u>mo) u-=mo;return u;
}
int vv[200008];
int main()
{
 	//freopen("","r",stdin);
	//freopen("","w",stdout);
	nn=1;
	int n;cin>>n;for(int i=1;i<=n;i++)
	{
		scanf("%d %d",&x[i],&v[i]);id[i]=i;vv[i]=v[i];
	}
	sort(id+1,id+n+1,cmp);
	sort(vv+1,vv+n+1);
	for(int i=1;i<=n;i++)
	{
		if(m.count(vv[i])==0) m[vv[i]]=++at;
	}
	for(int i=1;i<=n;i++)
	{
		pre[0][i]=max(pre[0][i-1],v[id[i]]);
	}
	pre[1][n+1]=1e9+132654;
	for(int i=n;i>=1;i--)
	{
		pre[1][i]=min(pre[1][i+1],v[id[i]]);
	}
	for(int i=1;i<=n;i++)
	{
		int t=id[i];
		int l=pre[0][i],r=pre[1][i];swap(l,r);
		p[i]=make_pair(m[l],m[r]);
	}
	sort(p+1,p+n+1);
	while(250000>nn) nn=nn*2;
	update(1,1);
	for(int i=1;i<=n;i++)
	{
		dp[i]=query(p[i].first-1,at+2,1,nn,1);if(dp[i]>mo) dp[i]-=mo;
		update(p[i].second,dp[i]);
	}
	cout<<tree[nn+at-1]<<endl;
	return 0;
}

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

using namespace std;

int a[100000 + 5];

int main() {
    int k;
    cin >> k;
    for (int i = 0; i < k; ++i) cin >> a[i];

    long long left = 2, right = 2;
    for (int i = k - 1; i >= 0; i--) {
        left = ((left + a[i] - 1) / a[i]) * a[i];
        right = (right / a[i]) * a[i] + a[i] - 1;
        if (right < left) {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << left << " " << right << endl;
    return 0;
}


Measured memory_bytes: 640
def findTrailingZeros(n): 
    if (n & 1): 
        return 0
    else: 
        ans = 0
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
        return ans 

  
n = int(input())
  
print(findTrailingZeros(n)) 

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int read() {
	int x; scanf("%d", &x); return x;	
}
const int maxn = 3e5 + 10;
const int INF = 1e9;
int mod = 1e9 + 7;
using namespace std;

#define ll long long 
int n, a[maxn], b[maxn];
ll ans;
bool cmp(pair<int,int> a, pair<int,int> b) {
	return a.first == b.first ? a.second > b.second : a.first > b.first;	
}
void Solve(vector<pair<int,int> >&a) {
	set<int>X;
	for (int i = 1; i <= n; ++i) X.insert(i);
	for (int i = 0; i < a.size(); ++i) {
		pair<int,int>u = a[i];
		set<int>::iterator It = X.upper_bound(u.second);
		if (It != X.begin()) {
			X.erase(--It);
			ans += u.first;
		}
	}
}
int main() {
	#ifdef LOCAL
		freopen("1.in", "r", stdin);
	#endif
	int T = read(); 
	while (T--) {
		vector<pair<int,int> >L, R;
		n = read(); ans = 0;
		for (int i = 1; i <= n; ++i) {
			int k = read(), l = read(), r = read();
			ans += min(l, r);
			if (l > r) L.push_back(make_pair(l - r, k));
			else R.push_back(make_pair(r - l, n - k));
		}
		sort(L.begin(), L.end(), cmp);
		sort(R.begin(), R.end(), cmp);
		Solve(L); Solve(R);
		cout << ans << endl;
	}

	return 0;	
}


Measured memory_bytes: 14352
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const [L, R] = next().split(" ").map(el => BigInt(el))
    let min = 2018n
    for(let i = L; i<R; i++){
        for(let j = i+1n; j<=R; j++){
            let div = i*j%2019n
            if(div == 0n){
                console.log(0)
                return
            } 
            min = min < div ? min : div
        }
    }
    console.log(Number(min))
}
Main()

Measured memory_bytes: 35104
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
vector<vector<bool>>road(100,vector<bool>(100,false));
vector<bool>tuna(100);
int n;
void search(int x){
    tuna[x]=true;
    rep(i,n){
        if(road[x][i]&&(!tuna[i])){
            //cout<<1;
            search(i);
        }
    }
    return;
}
int main() {
	int m;//ここのint nを消したら動いた　なんで？
	cin>>n>>m;
	int s,g,cnt=0;
	rep(i,m){
	    cin>>s>>g;
	    road[s-1][g-1]=true;
	    road[g-1][s-1]=true;
	}
	rep(i,n)rep(j,n)if(i<j){
	    rep(k,n)tuna[k]=false;
        if(road[i][j]){
	        road[i][j]=road[j][i]=false;
	        search(i);
	        if(tuna[j]==false)cnt++;
	        road[i][j]=road[j][i]=true;
	    }
	}
	cout<<cnt;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
C = []
S = []
F = []
for i in range(N-1):
    c,s,f = map(int,input().split())
    C.append(c)
    S.append(s)
    F.append(f)


ans = []
for i in range(N-1):
    time = S[i] + C[i]
    for j in range(i+1,N-1):
        if time <= S[j]:
            time += S[j] - time + C[j]
        else:
            time += C[j] + (F[j] - time % F[j] if time % F[j] else 0)
    ans.append(time)

ans.append(0)
[print(i) for i in ans]

Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int main(){
  int a[5];
  cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
  
  int sita=10;
  
  for(int i=0;i<5;i++){
    int n=a[i]%10;
    if(n==0)n=10;
    if(n<sita)sita=n;
  }
  
  int time=sita-10;
  
  for(int i=0;i<5;i++){
    int t=((int)(a[i]/10))*10;
    if(a[i]%10!=0)t+=10;
    time+=t;
  }
  
  cout<<time;
  
  return 0;
}

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



int main() {
    int N;
    cin >> N;
    
    vector<ll> A(N);
    for (int i=0; i<N; i++) {
        cin >> A[i];
    }
    
    ll count = 0;
    for (int i=0; i<N; i++) {
        if (A[i] < 0) count++;
    }
    
    ll ans = 0;
    ll mini = 1000000000;
    
    if (count % 2 == 0) {
        for (int i=0; i<N; i++) {
            ans += abs(A[i]);
        }
        cout << ans << endl;
        return 0;
    }
    else {
        for (int i=0; i<N; i++) {
            if (A[i] < 0) A[i] = -A[i];
            ans += A[i];
            mini = min(mini, A[i]);
        }
        cout << ans - 2 * mini << endl;
    }
}


Measured memory_bytes: 1024
// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF  1023456789LL
#define INF16 10000000000000000LL
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
#define N 101010
void build(){

}
LL n , a[ N ] , sum , ans[ N ];
void init(){
  n = getint();
  for( int i = 1 ; i <= n ; i ++ ){
    a[ i ] = getint();
    sum += a[ i ];
  }
}
void solve(){
  LL pre = 0 , res = sum;
  priority_queue< LL , vector<LL> , greater<LL> > heap;
  for( int i = 1 ; i <= n ; i ++ )
    heap.push( a[ i ] );
  for( int i = 1 ; i <= n ; i ++ ){
    if( a[ i ] <= pre ) continue;
    while( heap.size() and heap.top() <= a[ i ] ){
      sum -= heap.top(); heap.pop();
    }
    LL dlt = sum - (LL)heap.size() * a[ i ];
    ans[ i ] = res - dlt;
    res = dlt;
    pre = a[ i ];
  }
  for( int i = 1 ; i <= n ; i ++ )
    printf( "%lld\n" , ans[ i ] );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 3572
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        while True:
            t, n = map(int, raw_input().split())
            if t == n == 0:
                break
            obs = []
            for i in range(n):
                x, y = map(int, raw_input().split())
                obs.append((x, y))
            sx, sy = map(int, raw_input().split())
            q = [(sx, sy, 0)]
            visited = set([(sx, sy)])
            d = [(1, 0), (1, 1), (0, 1), (-1, 0), (-1, -1), (0, -1)]
            while q:
                x, y, turn = q.pop(0)
                if turn >= t:
                    break
                for dx, dy in d:
                    if not (x + dx, y + dy) in obs and not (x + dx, y + dy) in visited:
                        visited.add((x + dx, y + dy))
                        q.append((x + dx, y + dy, turn + 1))
            # print visited
            print len(visited)
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()

Measured memory_bytes: 5160
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
int n;
double v[55];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++) cin>>v[i];
	sort(v+1,v+n+1);
	for(int i=2;i<=n;i++) v[i]=(v[i-1]+v[i])/2;
	cout<<v[n]<<endl;
	return 0;
}

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

typedef pair<int,int> pii;

int N;
int ne[100010];
int dp[100010];
queue<pii> Q;

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N; i++)scanf("%d",&ne[i + 1]);
    for(int i = 0; i < N; i++)dp[i + 1] = -1;
    Q.push(make_pair(1,0));
    while(Q.size())
    {
        pii now = Q.front();Q.pop();
        if(dp[now.first] != -1)continue;
        dp[now.first] = now.second;
        Q.push(make_pair(ne[now.first],now.second + 1));
    }
    printf("%d\n",dp[2]);
    return 0;
}


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

int main() 
{
	int h, w, n;
	cin >> h >> w >> n;

	int maxhw = max(h,w);
	if (n % maxhw == 0) {
		cout << n / maxhw << endl;
	}
	else {
		cout << n / maxhw + 1<< endl;
	}

	return 0;
}

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

#define F first 
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 310, M = 1010;

int n;
int f[N][N];
bool st[N][N];

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i ++ )
		for (int j = 1; j <= n; j ++ )
			cin >> f[i][j];
			
	for (int k = 1; k <= n; k ++ )
		for (int i = 1; i <= n; i ++ )
			for (int j = 1; j <= n; j ++ )
				if (f[i][j] > f[i][k] + f[k][j])
				{
					puts("-1");
					return 0;
				}

	for (int i = 1; i <= n; i ++ )
		for (int j = 1; j <= n; j ++ )
			for (int k = 1; k <= n; k ++ )
				if (k != i && k != j && f[i][j] == f[i][k] + f[k][j])
					st[i][j] = true;
	
	LL res = 0;
	for (int i = 1; i <= n; i ++ )
		for (int j = i + 1; j <= n; j ++ )
			if (!st[i][j])
				res += f[i][j];
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 4100
n=int(input())
m=[0,0,0,0,0]
for i in range(n):
  s=input()
  if s[0]=="M":
    m[0]+=1
  if s[0]=="A":
    m[1]+=1
  if s[0]=="R":
    m[2]+=1
  if s[0]=="C":
    m[3]+=1
  if s[0]=="H":
    m[4]+=1
ans=0
for i in range(3):
  for j in range(i+1,4):
    for k in range(j+1,5):
      ans+=m[i]*m[j]*m[k]
print(ans)

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

int compare_int(const void *a, const void *b){
  return *(int *)a - *(int *)b;
}

int main(int argc, char const *argv[]) {

  int N;
  int sum = 0;
  scanf("%d", &N);

  int s[N];
  int a[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", s + i);
    sum += s[i];
    if (s[i] % 10 != 0) {
      a[i] = s[i];
    }else{
      a[i] = 200;
    }
  }

  // printf("合計点数は%d\n", sum);

  if (0 == sum % 10) {

    // printf("ソート前\n");
    // for (int i = 0; i < N; i++) {
    //   printf("a[i] = %d\n", a[i]);
    // }

    qsort(a, N, sizeof(int), compare_int);

    // printf("ソート後\n");
    // for (int i = 0; i < N; i++) {
    //   printf("a[i] = %d\n", a[i]);
    // }

    if (a[0] == 200) {
      // printf("点数が引けないよ！\n");
      printf("0\n");
    }else{
      // printf("点数を引くよ！\n");
      printf("%d\n", sum - a[0]);
    }

  }else{
    printf("%d\n", sum);
  }

  return 0;
}


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

using namespace std;

int main() {
    int n = 0; cin >> n;
    vector<int> costs(n);
    for (int i = 0; i < n; i++) {
        cin >> costs[i];
    }
    int dp[n + 1];
    dp[0] = 0;
    dp[1] = 0;
    dp[2] = abs(costs[1] - costs[0]);
    for (int i = 3; i <= n; i++) {
        int option1 = dp[i - 2] + abs(costs[i - 1] - costs[i - 3]);
        int option2 = dp[i - 1] + abs(costs[i - 1] - costs[i - 2]);
        dp[i] = min(option1, option2);
    }
    cout << dp[n] << '\n';
    return 0;
}

Measured memory_bytes: 4000
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

const int ten = 100000;

int main(){
    int n;cin>>n;
    map<int,int> odd,even;
    rep(i,n){
        int a;
        cin >> a;
        if(i%2==0) even[a]++;
        else odd[a]++;
    }
    int ema=0,ema2=0,oma=0,oma2=0;
    int oi,ei;
    rep(i,ten){
        if(ema<even[i]){
            ema = even[i];
            ei = i;
        }
    }
    rep(i,ten){
        if(ema2<even[i] && ei!=i){
            ema2 = even[i];
        }
    }
    rep(i,ten){
        if(oma<odd[i]){
            oma2 = oma;
            oma = odd[i];
            oi = i;
        }
    }
    rep(i,ten){
        if(oma2<odd[i] && oi!=i){
            oma2 = odd[i];
        }
    }
    int ans = n - ema - oma;
    if(oi==ei){
        ans = min(n - ema - oma2,n - ema2 - oma);
    }
    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
#define MOD 1000000007
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;}

int main() {
    int n;
    string s, t;
    cin >> n >> s >> t;

    string ans = "";
    for(int i=0; i<n; i++) {
        ans += s[i];
        ans += t[i];
    }

    cout << ans << endl;

    return 0;
}

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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int H, W, D;
int A[330][330];
pint pos[99000];
map<int, int> mp[99000];
int d(pint a, pint b) { return abs(a.first - b.first) + abs(a.second - b.second); }
signed main() {
    cin >> H >> W >> D;
    rep(i, H) {
        rep(j, W) {
            cin >> A[i][j];
            pos[A[i][j]] = {i, j};
        }
    }
    reps(i, D) {
        mp[i][i] = 0;
        for (int j = i; j <= H * W; j += D) {
            mp[i][j + D] = mp[i][j] + d(pos[j - D], pos[j]);
        }
    }
    int Q;
    cin >> Q;
    rep(i, Q) {
        int L, R;
        cin >> L >> R;
        int s = (L - 1) % D + 1;
        cout << mp[s][R + D] - mp[s][L + D] << endl;
    }

}


Measured memory_bytes: 18560
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

int a[100000];
int lef;
int rig;

int ans;

bool binary_search_2(int num){
	if(lef > rig){
		return false;
	}
	int middle = (lef + rig) / 2;
	ans++;
	if(a[middle] > num){
		rig = middle - 1;
		binary_search_2(num);
	}else if(a[middle] < num){
		lef = middle + 1;
		binary_search_2(num);
	}else if(a[middle] == num){
		return true;
	}
}

bool binary_search(int num, int n){
	lef = 0;
	rig = n - 1;
	binary_search_2(num);
}

int main(){
	
	int n, k;
	
	while(true){
		
		cin >> n;
		
		if(n == 0){
			break;
		}
		
		for(int i = 0; i < n; i++){
			cin >> a[i];
		}
		
		cin >> k;
		
		ans = 0;
		
		binary_search(k, n);
		
		cout << ans << endl;
		
	}
	
	return 0;
}

Measured memory_bytes: 2940
using System;
using System.Linq;

class abc123_A
{
    static void Main(string[] args)
    {
        var firstPoint = readInt();
        readInt();
        readInt();
        readInt();
        var lastPoint = readInt();
        var k = readInt();

        if(lastPoint - firstPoint > k) {
            Console.WriteLine(":(");
        } else {
            Console.WriteLine("Yay!");
        }
    }

    static int readInt() {
        return int.Parse(Console.ReadLine());
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
    using namespace std;
     
    int main()
    {
     	string s; cin >> s;
      int c = 0;
      if(s[1]=='R'){
        if(s[0]=='R')c++;
        if(s[2]=='R')c++;
        c++;
      }
      else if( s[0]=='R' || s[2]=='R' )c++;
      
      cout << c << endl;
      return 0;
    }

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.nextLine();
		String s = sc.nextLine();
		String[] sarray = s.split("");
		int count = 0;

		for(int i = 0;i<n-2;i++){
			if(sarray[i].equals("A")&&sarray[i+1].equals("B")&&sarray[i+2].equals("C")){
				count++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 23764
#include <iostream>
int main(){

  int a,b;

  scanf("%d %d",&a,&b);

  if(a == 1) a=14;
  if(b == 1) b=14;

  if(a > b) printf("Alice\n");
  else if(a < b) printf("Bob\n");
  else printf("Draw\n");

  return 0;

}


















Measured memory_bytes: 256
#奇数文字目がすべて R, U, D のいずれか。
#偶数文字目がすべて L, U, D のいずれか。


s = gets.chomp.split("")
d = []

i = 0
while i <= s.size-1
  	#p s[i]
  	if s[i] == "R" || s[i] == "U" || s[i] == "D" 	
  		a = "yse"
      	d.push(a)
    else
      	a = "no"
      	d.push(a)
      
    end
    i += 2
end

j = 1
while j <= s.size-1
  	#p s[j]
  	if s[j] == "L" || s[j] == "U" || s[j] == "D" 	
  		a = "yse"
      	d.push(a)
    else
      	a = "no"
      	d.push(a)
      
    end
    j += 2
end

if d.include?("no")
  puts "No"
else
  puts "Yes"
end

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

int main(){
    int N, sum = 0;
    int C[55];
    int V[55];


    cin >> N;

    for(int i = 0; i < N; i ++){
        cin >> V[i];
    }
    for(int i = 0; i < N; i ++){
        cin >> C[i];
    }

    //いくつ選ぶか
    for(int i = 0; i < N; i++){
        if(V[i] > C[i]){
            sum += V[i] - C[i];
        }

    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,a[101],max=1,min=1000000000,i;
	scanf("%d\n",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&a[i]);
		if(a[i]<min)min=a[i];
		if(a[i]>max)max=a[i];
	}
	printf("%d",max-min);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ll n;
    cin >> n;
    vector<pair<ll,ll> > v(n);
    for(ll i = 0;i < n;i++){
        ll x,l;
        cin >> x >> l;
        v[i] = (make_pair(x+l,x-l));
    }
    sort(v.begin(),v.end());
    ll ans = 1;
    ll end = v[0].first;
    for(ll i = 1;i < n;i++){
        if(v[i].second >= end){
            ans++;
            end = v[i].first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long

using namespace std;


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    vector <int> data(n);
    for (int i = 0; i < n; ++i) cin >> data[i];
    vector <vector <int> > g(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int ans = 0;
    vector <int> used(n, 0);
    for (int i = 0; i < n; ++i) {
        if (used[i] == 0) {
            int good = 1;
            used[i] = 1;
            for (auto v : g[i]) {
                if (data[v] == data[i]) {
                    good = 0;
                    used[v] = 1;
                    break;
                }
                else if (data[v] > data[i]) {
                    good = 0;
                    break;
                }
                else {
                    used[v] = 1;
                }
            }
            if (good) ++ans;
        }
    }
    cout << ans;
    return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String IN =br.readLine(); 
		
		for(int i=0; i<IN.length(); i++){
			System.out.print("x");
        }
	}
}

Measured memory_bytes: 32596
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,sum;
     cin>>a>>b>>c>>d;
     if(a>b && c>d)
        sum=b+d;
     else if(a>=b && c<=d)
        sum=b+c;
        else if(a<=b && c<=d)
        sum=a+c;
        else if(a<=b && c>=d)
        sum=a+d;
         cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 3468
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double r=sc.nextDouble();
    double area=r*r*Math.PI;
    double length=2*r*Math.PI;
    System.out.printf("%f %f",area,length);
    sc.close();
  }
}


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

void solve()
{
    int k,n;
    cin>>n>>k;
    
    cout<<n*k<<endl;
}


int main()
{
    solve();
}


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

long long int dp[21005];

int N;
int w[1003], s[1003];
long long int v[1003];

vector<pair<int, pair<int, long long int>> > V;

int main(void) {

	cin >> N;

	for (int i = 1; i <= N; i++) {
		cin >> w[i] >> s[i] >> v[i];
		V.push_back(make_pair(s[i]+w[i], make_pair(w[i], v[i])));
	}

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

	for (int i = 1; i <= N; i++) {
		int vs = V[i - 1].first-V[i-1].second.first;
		int vw = V[i - 1].second.first;

		long long int val = V[i - 1].second.second;
		for (int W = 20000; W >= 0; W--) {
			if (dp[W] > 0 && W <= vs) { dp[W + vw] = max(dp[W + vw], dp[W] + val); }
		}
		dp[vw] = max(dp[vw], val);
	}

	long long int ans = 0;

	for (int W = 20000; W >= 0; W--) {
		ans = max(ans, dp[W]);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 764
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



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

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

    const int A = 10;
    vector<vector<int>> next(n + 1, vector<int>(A, n + 123));

    for (int i = n - 1; i >= 0; --i) {
        next[i] = next[i + 1];
        next[i][s[i] - '0'] = i;
    }

    auto ok = [&](vector<int>& T) {
        int m = T.size();

        for (int i = 0, j = 0; i < m; ++i) {
            int nj = next[j][T[i]];
            if (nj < n) {
                j = nj + 1;
            } else {
                return false;
            }
        }

        return true;
    };

    vector<int> D(3, 0);

    int res = 0;
    for (int i = 0; i < 1000; ++i) {
        int x = i;
        D[0] = x / 100, D[1] = x / 10 % 10, D[2] = x % 10;
        if (ok(D)) {
            // cout << x << endl;
            ++res;
        }

    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 2432
import java.util.Arrays;

public class Main {


  private static void solve() {
    int n = ni();
    int[] a = na(n);

    dp = new long[n][n + 1];
    for (long[] v : dp) Arrays.fill(v, -1);
    
    long[] sum = new long[n + 1];
    for (int i = 0; i < n; i ++) {
      sum[i + 1] = sum[i] + a[i];
    }
    
    System.out.println(rec(0, n, a, sum));
  }

  static long[][] dp;
  private static long rec (int i, int j, int[] a, long[] sum) {
    if (j == i + 1) {
      return 0;
    }
    if (dp[i][j] >= 0)
      return dp[i][j];
    
    long ret = Long.MAX_VALUE;
    for (int k = i + 1; k < j; k ++) {
      ret = Math.min(ret, rec(i, k, a, sum) + rec(k, j, a, sum));
    }
    ret += sum[j] - sum[i];
    
    dp[i][j] = ret;
    return ret;
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 26300
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
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; }
ll MOD = 1000000007;
int INF = 1001001001;

void solve()
{
	double a, b; cin >> a >> b;
	rep(i,1050)
	{
		if(int(double(i) * 0.08)==a 
			&& int(double(i) * 0.1)==b)
		{
			cout << i << endl;
			return;
		}
	}
	cout << -1 << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


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

using ll = long long;
#define repi(n) for (int i = 0; i < (n); i++)
#define repj(n) for (int j = 0; j < (n); j++)
#define repk(n) for (int k = 0; j < (n); k++)
#define rep(i, n) for (int i = 0; (i) < (n); i++)
#define repr(i, a, b) for (auto i = (a); i < (b); i++)
#define repv(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = max((t), (v)))
#define updatemin(t, v) (t = min((t), (v)))
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}
template <typename T>
class segtree {
 private:
  int n;
  vector<T> data, lazy;

 public:
  segtree(int n_) {
    n = pow(2, ceil(log2(n_)));
    data.resize(n);
    lazy.resize(n);
    auto __x = data[0];
    repi(n) {
      data[i] = __vmin(__x);
      lazy[i] = 0;
    }
  }
};

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(n * a, b) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();
		
		int time = 0;
		int sum = 0;
		
		while(true) {
			time++;
			sum += time;
			if(X <= sum) {
				break;
			}
		}
		
		System.out.println(time);
		
	}
}



Measured memory_bytes: 35836