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

#define ll              long long int
#define ull             unsigned long long int
#define pii             pair < int, int>
#define pll             pair < ll, ll>
#define sc              scanf
#define scin(x)         sc("%d",&(x))
#define scln(x)         sc("%lld",&(x))
#define pf              printf
#define NL              pf("\n")
#define ms(a,b)         memset(a,b,sizeof(a))
#define pb(a)           push_back(a)
#define mp              make_pair
#define db              double
#define EPS             10E-10
#define ff              first
#define ss              second
#define sqr(x)          (x)*(x)
#define vi              vector< int >
#define vl              vector< ll >
#define vii             vector<vector< int > >
#define vll             vector<vector< ll > >
#define DBG             pf("HI\n")
#define MOD             1000000007
#define CIN             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define RUN_CASE(t,T)   for(__typeof(t) t=1;t<=T;t++)
#define CASE(t)         printf("Case %d: ",t)
#define CASEL(t)        printf("Case %d:\n",t)
#define intlimit        2147483648
#define longlimit       9223372036854775808
#define infinity        (1<<28)
#define gcd(a, b)       __gcd(a,b)
#define lcm(a, b)       (((a)/gcd(a,b))*b)
#define mx              1234567899
#define TC              int t;scin(t);while(t--)
#define PI              2*acos(0.0)
#define rep(i,a,b)      for( i=a; i<=b; i++)
#define rev(i,a,b)      for( i=a; i>=b; i--)
#define file            freopen("E:\\file.txt", "r", stdin);ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x)          x.begin(),x.end()
#define DEBUG(args...)    do {   cerr << #args << ' ' ;  print(args); } while(0); cerr<< endl ;
using namespace std;
int get(int n,int p){int res = 0;while(n>=p) res+=n/p,n/=p;return res;}
template<class T> T power(T N,T P){ return (P==0)?  1: N*power(N,P-1); }
void VC(vector<ll> &v){for(int i=0;i<v.size();i++) printf("%lld ", v[i]);printf("\n");}

template< typename T > void print(const T& v) {    cerr << v << ' ' ;}
template< typename T1, typename... T2 >
void print( const T1& first, const T2&... rest ){
    print(first);
    print(rest...) ;
}
///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------

long long BigMod(long long int a, long long int b, int M) { long long remainder, answer = 1;remainder = a%M; while(b!=0){if(b%2==1) answer = (answer*remainder)%M;remainder = (remainder*remainder)%M;b/=2;}return answer;}
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    int cnt = 0;
    string s,ss;
    cin  >> s >> ss ;
    for(int i=0;i<3;i++)
    {
        if(s[i]==ss[i])cnt++;
    }
    cout << cnt;
    return 0;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

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

	ll n;cin >> n;
	string str;cin >> str;

	ll ans = 1;
	ll cou = 0;
	REP(i, str.size()){
		int now = ((cou % 2 == 0) + (str[i] == 'B')) % 2;

		if(now){
			ans *= cou;
			ans %= MOD;
			cou--;
		}
		else {
			cou++;
		}

		if(cou < 0){
			cout << 0 << endl;
			return 0;
		}
	}

	if(cou != 0){
		cout << 0 << endl;
		return 0;
	}

	for(int i = 1;i <= n;i++){
		ans = (ans * i) % MOD;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define M1 1000000007
#define M2 998244353

#define fl(i,a,b)  for(ll i=a;i<b;i++)
#define ifl(i,a,b) for(ll i=b-1;i>=a;i--)
#define f(i,n)     for(int i=0;i<n;i++)
#define bf(i,n)    for(int i=n-1;i>=0;i++)


#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define bn "\n"

//------------------------------------------------------------------------ 
// #define V(a) vector<a>
// #define vt() vector< tuple < int ,int ,int > > ;
// #define vector< int ,int > pv;
// vector< pair <int,int> > vect;


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

ll modI(ll a,ll m);
ll gcd(ll a,ll b);
ll powM(ll x,ll y,ll m);
ll swap(ll a,ll b);

void swap(ll& a,ll& b)
{
    ll tp=a;
    a=b;
    b=tp;
}

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

ll powM(ll x,ll y,ll m)
{
    ll ans=1,r=1;
    x%=m;
    while(r>0&&r<=y)
    {
        if(r&y)
        {
            ans*=x;
            ans%=m;
        }
        r<<=1;
        x*=x;
        x%=m;
    }
    return ans;
}
 
ll modI(ll a, ll m)
{
    ll m0=m,y=0,x=1;
    if(m==1) return 0;
    while(a>1)
    {
        ll q=a/m;
        ll t=m;
        m=a%m;
        a=t;
        t=y;
        y=x-q*y;
        x=t;
    }
    if(x<0) x+=m0;
    return x;
}

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

// variable = Expression1 ? Expression2 : Expression3
// max = (n1 > n2) ? n1 : n2; 
// (n>m) ? cout<<"True"<<endl:cout<<"false"<<endl ;

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

// int n;cin>>n;int a[n];for(int i=0;i<n;i++)cin>>a[i];    
// for(int i=0;i<n;i++)cout<<a[i];
// int a,b;cin>>a>>b;   

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

// vector< tuple < int ,int ,int > > tv;
// vector< int ,int > pv;


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


int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
	int tt=1;
   // cin>>tt;
	while(tt--)
	{
	    int a,b,c,d;
	    cin>>a>>b>>c>>d;
	   
	   while(1)
	   {
	       c=c-b;
	       if(c<=0)
	       {cout<<"Yes"<<bn;return 0;}
	       
	       a=a-d;
	       if(a<=0)
	       {cout<<"No "<<bn;return 0;}
	   }
	   
	   
	   
	    
	}
	
	return 0;
}


Measured memory_bytes: 3652
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
using namespace std;
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_11_D -- connected componenets
//method: check if their have the same component
//https://en.wikipedia.org/wiki/Connected_component_(graph_theory) -- connected component
//follow up : how cal the numbers of component--sorting the array and count
vector<int> neighbors[100005];
//why choose vector, not matrix
int root[100005];
//start is for the root
void dfs(int i, int start){
	root[i] = start;
	//visut all i's neighbors
	//c++ 11
	for(int j = 0; j< neighbors[i].size(); j++){
		int temp = neighbors[i].at(j);
		if(root[temp]==-1){
			dfs(temp,start);
		}
	}
}

int main(){
	int n,m,x,y,q;
	memset(root, -1, sizeof(root));
	scanf("%d %d",&n,&m);
	for(int i = 0; i<m; i++){
		scanf("%d %d",&x,&y);
		neighbors[x].push_back(y);
		neighbors[y].push_back(x);
	}
	for(int i = 0; i<n; i++){
		if(root[i]==-1){
			dfs(i,i);
		}
	}
	scanf("%d", &q);
	for(int i = 0; i<q; i++){
		scanf("%d %d",&x, &y);
		//printf("%d %d\n",root[x],root[y]);
		if(root[x] == root[y]){
			printf("yes\n");
		}else printf("no\n");
	}
	return 0;
}


Measured memory_bytes: 13244
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  set<int> s;
  for(int i=0;i<3;i++){
    int x;
    cin >> x;
    s.insert(x);
  }
  if(s.size()==2){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;


return 0;
}
///....


Measured memory_bytes: 256
from collections import Counter

mod = 10 ** 9 + 7
N, K = map(int, input().split())
A = list(map(int, input().split()))
L = [0] * (max(A) + 1)
ans = 0
for i in A[::-1]:
    L[i] += 1
    ans += sum(L[:i])
Cnt = dict([(0, 0)])
for i in range(1, len(L)):
    Cnt[i] = L[i] + Cnt[i - 1]
ans = ans * K % mod
for i in A:
    ans = (ans + Cnt[i - 1] * (K - 1) * K // 2) % mod
print(ans)


Measured memory_bytes: 3700
#include<iostream>
using namespace std;
int main()
{
  string a,b,c;
  
  cin >> a >> b  >> c;
 	int lenA,lenB,lenC;
  	lenA = a.size();
    lenB = b.size();
    lenC = c.size();
	if(a.at(lenA-1) == b.at(0) && b.at(lenB-1)== c.at(0))
  		cout << "YES";
  		else cout << "NO";
  //cout << (a + b + c) << " " << s ;
  
}
  


Measured memory_bytes: 3632
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
const int C=3001;

int n;
ll a[C], dp[C][C];

int main(){
	int i, j;
	scanf ("%d", &n);
	for (i=0;i<n;i++)	scanf ("%lld", &a[i]);
	
	for (i=0;i<n;i++){
		for (j=0;j<n;j++){
			if (j+i>=n)	break;
			if (i==0)	dp[j][j]=a[j];
			else dp[j][j+i]=max(a[i+j]-dp[j][i+j-1], a[j]-dp[j+1][i+j]);
		}
	}
	printf ("%lld\n", dp[0][n-1]);
	
return 0;}

Measured memory_bytes: 69888
#include <iostream>

#define REP(i,n) for(int i=0; i<n; i++)

using namespace std;

int main(){
	int n;
	long long int a[10004], ans;

	cin >> n;
	REP(i,n){
		cin >> a[i];
	}
	ans = 0;

	REP(i,n){
		while(a[i]>=2){
			if (a[i]%2==0){
				ans++;
				a[i] /= 2;
			}else{
				break;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{   
        int n;
        int k;
        cin>>n>>k;
        vector<int> losses(n);
        vector<int> cost(n,INT_MAX);
        for(int i = 0 ; i < n ; i++)
        {
            cin>>losses[i];
        }
        cost[0] = 0;
        cost[1] = abs(losses[1] - losses[0]);
        for(int i = 2 ; i < n ; i++)
        {   
            for(int j = 1 ; j<= k ; j++){
                if(i-j>=0)
                    cost[i] =  min(cost[i] , (cost[i-j] + abs(losses[i]-losses[i-j]) ));
                else break;
            }
        }
        cout<<cost[n-1]<<endl;
        
}

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

class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String[] args) throws IOException {
        int x = Integer.parseInt(br.readLine());
        System.out.println(x * x * x);
    }
}

Measured memory_bytes: 24160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const ll INF = numeric_limits<ll>::max();
int main()
{
    int n; cin >> n;
    VI x(n), y(n); rep(i,n) cin >> x[i] >> y[i];
    VI xx(n), yy(n); rep(i, n){
        xx[i] = x[i] - y[i];
        yy[i] = x[i] + y[i];
    } 
    sort(ALL(xx));
    sort(ALL(yy));
    cout << max((yy[n-1] - yy[0]),(xx[n-1] - xx[0])) << endl;
    return 0;
}

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

#define ll long long
#define ull unsigned long long 
#define endl '\n'
#define pii pair<int, int>
#define all(a) a.begin(),a.end()

template <typename T>
inline T gcd(T a, T b) { while (b != 0) swap(b, a %= b); return a; }

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    map<int, int> m;
    for(int i=0; i<n; ++i){
        cin >> a[i];
    }

    int t=1, ans=0;
    for(int i=0; i<n; ++i){
        if(a[i]==t){
            ans++;
            ++t;
        }
    }

    if(ans==0)
        cout << -1;
    else
        cout << n-ans;
    return 0;
}


Measured memory_bytes: 3976
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

# なんこか入力
n,x = map(int, input().split())

# 空白区切りの数列をリストに代入
a = [int(i) for i in input().split()]

a=sorted(a)

#print(a)
answer=0
for i in range(n-1):
    if x >= a[i]:
        answer += 1
        x -= a[i]
#        print(x,a[i])
    else:
        break
if x == a[n-1]:
    answer += 1
print(answer)



Measured memory_bytes: 21704
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

void Solve()
{
    int64_t N, K;
	std::cin >> N >> K;
	std::vector<int64_t>x(N);
	for (int64_t i = 0; i < N; i++) {
		std::cin >> x[i];
	}
	int64_t ans = 1e9;
	for (int64_t i = 0; i < N - K + 1; i++) {
		int64_t left = i;
		int64_t right = i + K - 1;
		int64_t ans_left = abs(x[left]) + abs(x[right] - x[left]);
		int64_t ans_right = abs(x[right]) + abs(x[left] - x[right]);
		ans = std::min({ans, ans_left, ans_right});
	}
	std::cout << ans << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Solve();
}


Measured memory_bytes: 1024
# coding: utf-8
# Your code here!
l=list(map(int,input().split()))
l.sort()

dic=2*l[-1]-l[0]-l[1]

if dic%2==0:
    if l[0]%2==1 and l[1]%2==1 and l[-1]%2==0 or l[0]%2==0 and l[1]%2==0 and l[-1]%2==1:
        print((l[-1]-l[0])//2+(l[-1]-l[1])//2+1)
    else:
        print((l[-1]-l[0])//2+(l[-1]-l[1])//2)
    
else:
    print((l[-1]-l[0])//2+(l[-1]-l[1])//2+2)



Measured memory_bytes: 3316
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    ll counter = 0;
    if (S.length() % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < S.length() / 2; i++) {
        if (S[2 * i] == 'h' && S[2 * i + 1] == 'i') {
        } else {
            counter++;
        }
    }
    debug(counter);
    if (counter > 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}


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

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()
#define pi					3.14159265359
ll INF=1e18+10;
ll MOD=998244353;

const int N=1e6+10;
bool p[N];
int main()
{
    p[0]=1,p[1]=1;
    vector<int> prime;
    for(int i=2;i<N;i++)
    {
        if(!p[i])
        {
            for(int j=2;(i*j)<N;j++)
                p[i*j]=true;
            prime.pb(i);
        }
    }
    //for(auto x: prime)cout<<x<<" ";
    int y;cin>>y;
    auto x=lower_bound(all(prime),y);
    cout<<(*x);
}


Measured memory_bytes: 1916
/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define ull       unsigned long long
#define sd(x)     scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)
#define MAX       100005
#define maxn 	  200002
#define pb 		  push_back
#define mk 		  make_pair
#define endl	  "\n"
#define INF 	  1000000000
#define MOD		  1000000007
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "



int main ()
{
		ios::sync_with_stdio(0);
		cin.tie(0);
		//CODE TONOY
		string s1,s2;
		cin >> s1 >> s2;
		cout << s2+s1 << endl;
		return 0;
}  


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main() {

    long long H, W;
    cin >> H >> W;
    long long ans;

    if(H % 2 == 0){
        ans = (H / 2) * W;
    }else{
        if(W % 2 == 0){
            ans = ((H / 2) + 1) * (W / 2) + (H / 2) * (W / 2);
        }else{
            ans = ((H / 2) + 1) * ((W / 2) + 1) + (H / 2) * (W / 2);
        }
    }

    if(H == 1 || W == 1){
        ans = 1;
    }

    cout << ans << endl;

}

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

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

}

int main() {
    int k,d;
    ll sol=0;
    cin >> k;
    for (int a=1;a<=k;a++) {
        for (int b=1;b<=k;b++) {
            for (int c=1;c<=k;c++) {
                d=gcd(max(a,b),min(a,b));
                sol+=gcd(max(d,c),min(d,c));
            }
        }
    }
    cout << sol;

}



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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    set<ll> A;
    cin >> N;
    rep(i, N) {
        ll temp;
        cin >> temp;
        A.insert(temp);
    }
    if(A.size() == N) cout << "YES";
    else cout << "NO";
    cout << endl;
    return 0;
}


Measured memory_bytes: 13012
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;

string disp(bool x){
    return x ? "Yes" : "No";
}

int main(){
    double x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    
    double ans = sqrt(pow(x1-x2,2)+pow(y1-y2,2));
    
    cout << fixed;
    cout << setprecision(6) << ans << endl;
}
    
    







Measured memory_bytes: 3264
n = int(input())
h = list(map(int,input().split()))
check = True
for i in range(1,n):
    if h[i] >= h[i-1]:
        continue
    elif h[i] + 1 == h[i-1]:
        h[i] += 1
    else:
        check = False
        break
print("Yes" if check else "No")

Measured memory_bytes: 20564
import sys

N, K = [int(_) for _ in input().split()]
list = [int(_) for _ in input().split()]

l1 = []
l2 = []
t = 0
for i in list:
    if i < 0:
        l1.append(i)
    elif i == 0:
        t = 1
    else:
        l2.append(i)
l1 = [abs(_) for _ in l1]
l1.sort()

if t == 1 and K == 1:
    print(0)
    sys.exit()

K = K - t
a = float('inf')
b = float('inf')
if len(l1) >= K:
    a = l1[K-1]
if len(l2) >= K:
    b = l2[K-1]

c = float('inf')
d = float('inf')
for i in range(len(l2)):
    if len(l1)-1 >= K-i-2 >= 0:
        c_new = l2[i] * 2 + l1[K-i-2]
        c = min(c, c_new)
for j in range(len(l1)):
    if len(l2)-1 >= K-j-2 >= 0:
        d_new = l1[j] * 2 + l2[K-j-2]
        d = min(d, d_new)

print(min(a, b, c, d))



Measured memory_bytes: 14252
#include <iostream>
using namespace std;
#define gram_a 200
#define gram_b 300
#define gram_c 500
#define yen_a 380
#define yen_b 550
#define yen_c 850
#define set_a 5
#define set_b 4
#define set_c 3
#define dis_a 0.8
#define dis_b 0.85
#define dis_c 0.88
/*
int main() {
	int n,a, b, c;
	a = 0;
	b = 0;
	c = 0;
	while (1) {
		cout << "a = " << a << " b = " << b << " c = "<<c << endl;
		cout << "g = " << gram_a * a + gram_b * b + gram_c * c << endl;
		cout <<"y = "<< set_a * ((int)(a / set_a))*yen_a*dis_a + (a%set_a)*yen_a +
			set_b * ((int)(b / set_b))*yen_b*dis_b + (b%set_b)*yen_b +
			set_c * ((int)(c / set_c))*yen_c*dis_c + (c%set_c)*yen_c
			<< endl;
		cin >> n;
		if (n == 1)
			c++;
		if (n == 2) {
			b++;
			c = 0;
		}
		if (n == 3) {
			a++;
			b = 0;
			c = 0;
		}
	}

}
*/

int main() {
	int n;
	while (cin >> n) {
		if (n == 0)
			break;
		int i, a = 0, b = 0, c = 0, min = 0, y, g;
		bool f=true, brk=false;
		for (a = 0;; a++) {
			for (b = 0;; b++) {
				for (c = 0;; c++) {
					brk = false;
					g = gram_a * a + gram_b * b + gram_c * c;
					if (n == g) {
						y = set_a*((int)(a / set_a))*yen_a*dis_a + (a%set_a)*yen_a +
							set_b*((int)(b / set_b))*yen_b*dis_b + (b%set_b)*yen_b +
							set_c*((int)(c / set_c))*yen_c*dis_c + (c%set_c)*yen_c;
						if (min > y || f) {
							min = y;
							f = false;
						}
						break;
					}
					if (n<g) {
						if (c == 0)
							brk = true;
						break;
					}
				}
				if (brk) {
					if (b > 0)
						brk = false;
					break;
				}
			}
			if (brk)
				break;
		}
		cout << min << endl;
	}
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a)  (a).begin(),(a).end()
 
const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;
 
template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}
 
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main(){
  ll n,m,v,p;
  cin >> n >>m>>v>>p;
  vector<ll> a(n);
  cin >> a;
  sort(a.begin(),a.end()); // 昇順
  reverse(a.begin(),a.end());

  // 少なくとも上からPこは採用
  // 
  ll ans = 0;
  ans = p;

  ll psum = a[p-1];

  for (ll i = p; i < n; i++){
    if (a[p-1] - a[i] <=m){//一つ前との差がm以下
      // 自分より後ろの数
      ll lastnum = n-i-1;
      // p-1より前の数
      ll fastnum = p-1;
      //自分より前の数
      ll uppernum = i-p+1;

      //前の人らに与えてよい余裕ポイント
      ll amari = (a[i] + m)*uppernum - psum;
      // 勝敗に関係あるポイント
      ll nopoint = (v- (lastnum + fastnum +1) ) * m;

      // cerr << "lastnum :" << lastnum << "  fastnum: " <<fastnum<<  " amaari:" << amari<<  endl;
      // cerr << "nopoint :" << nopoint <<endl;
      if (nopoint <=0){
        ans++;
      }else{
        if (nopoint <=amari)ans++;
      }

    }
    psum+=a[i];
  }
  


  cout << ans;

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
/*
g++ -std=c++11 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG keyence/a.cpp
*/
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);//おまじないでcin, cout早くする
    int a[4];
    int b[4];
    cin >> a[0] >> a[1] >> a[2] >> a[3];
    rep(i, 4){
        b[i] = 0;
    }
    rep(i, 4){
        if(a[i] == 1){
            b[0] = 1;
        }else if(a[i] == 9){
            b[1] = 1;
        }else if(a[i] == 7){
            b[2] = 1;
        }else if(a[i] == 4){
            b[3] = 1;
        }
    }

    bool flag = true;
    rep(i, 4){
        if(b[i] == 0){
            flag = false;
        }
    }

    if(flag) cout << "YES" << "\n";
    else cout << "NO" << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 500010
#define ll long long
using namespace std;
int n, d, w[N], m, x, ans[N], pos[N];
ll now;
inline char gc(){
	static char now[1<<16], *S, *T;
	if(S==T){T=(S=now)+fread(now, 1, 1<<16, stdin); if(S==T)return EOF;}
	return *S++;
}
inline int read(){
	int x=0, f=1; char ch=gc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=gc();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=gc();}
	return x*f;
}
int ABS(int x){return max(x, -x);}
int main(){
	n=read(); d=read();
	for(int i=1; i<=n; i++)w[i]=read();
	pos[0]=d;
	for(int i=1; i<=n; i++)pos[i]=min(pos[i-1], ABS(pos[i-1]-w[i]));
	now=1;
	for(int i=n; i; i--){
		ans[i]=now<=pos[i-1]?1:0;
		if(now>w[i]/2)now+=w[i];
	}
	m=read();
	for(int i=1; i<=m; i++){x=read(); if(ans[x])printf("YES\n"); else printf("NO\n");}
	return 0;
}

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



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

int main()
{
	int a[5];
	for (int i{}; i < 5; i++)
		scanf("%d", a + i);
	int k;
	scanf("%d", &k);
	if (a[4] - a[0] <= k) puts("Yay!");
	else puts(":(");

	return 0;
}

Measured memory_bytes: 256
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            double p = 1.0 ;
            for (int i = 1; i <= n; i++)
            {
                p = i * p  % (Math.Pow(10, 9) + 7);
            }
            double ans = p;
            //double ans = p % (Math.Pow(10,9) + 7);
            Console.WriteLine(ans);
            //Console.ReadKey();
        }
    }
}

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

typedef long long ll;
const int maxn=1e5+10;
int n,ans,cnt[maxn];

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define all(a) begin(a),end(a)
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define sz(x) ((int)x.size())
#define ins insert
#define rep(i,l,u) for(int i=l;i<=u;++i)
#define reb(i,l,u) for(int i=l;i>=u;--i)
using namespace std;
const int maxn=2e5+10;
const int mod=1e9+7;
int gcd(int a,int b){
    return b==0?a:gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
main(){
    int n,m;
    cin>>n>>m;
    int ans=0;
    for(int i=1;i<=n;++i){
        int x,y;
        cin>>x>>y;
        if(x*x+y*y<=m*m)ans++;
    }
    cout<<ans<<endl;
}


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

int main(){
    int N;
    cin >> N;
    int c[10][10] = {{0}};
    for(int i = 1; i <= N; i++){
        int top, bottom;
        bottom = i%10;
        top = i;
        while(top >= 10) top/=10;
        c[top][bottom] ++;
    }
    long long ans = 0;
    for(int i = 1; i < 10; i++){
        for(int j = 1; j < 10; j++){
            ans += c[i][j]*c[j][i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' && ch > '9') && (ch != '-')) ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int main() {

#ifdef LOCAL
  FILEIO("a");
#endif

  int n; read(n);
  if ((n & (n - 1)) == 0) return puts("No"), 0;
  puts("Yes");
  printf("%d %d\n", 1 + n, 3);
  for (RI i = 2; i < n; i += 2) {
    printf("%d %d\n", i, 1);
    printf("%d %d\n", i + 1, i);
    printf("%d %d\n", i + 1 + n, 1);
    printf("%d %d\n", i + n, i + 1 + n);
  }
  if (!(n & 1)) {
    for (RI i = 1; i < n; ++i) {
      int j = n ^ i ^ 1;
      if (1 <= j && j < n) {
        printf("%d %d\n", i + (i & 1 ? 1 : 0) * n, n);
        printf("%d %d\n", j + (j & 1 ? 1 : 0) * n, n + n);
        break;
      }
    }
  }

  cerr << (double)(clock()) / CLOCKS_PER_SEC * 1000 << "ms" << endl;

  return 0;
}

// created by Daniel yuan

Measured memory_bytes: 2304
#include<string>
#include<cstdio>
#include<iostream>

using namespace std;
 
int main(){
	int a[101]={0};
	int i, max=0;

	while(scanf("%d",&i)!=EOF)
		if(max<++a[i]) max=a[i];

	for(int j=0; j<101; j++){
		if(max==a[j]) printf("%d\n",j);
	}

    return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> cnt(m,0);
    for(int i = 0; i < n; i++){
        int k;
        cin >> k;
        for(int j = 0; j < k; j++){
            int a;
            cin >> a;
            a--;
            cnt[a]++;
        }
    }
    int ans = 0;
    for(int i = 0; i < m; i++){
        if(cnt[i] == n){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

vector<int> l;
int n, a, b, c;
int mn = 1001001001;

void dfs(vector<int>& choose) {
    if (sz(choose) == n) {
        int cost = 0;
        vector<int> length(3);
        rep(i, n) {
            if (choose[i] != 0) {
                if (length[choose[i]-1] != 0) cost += 10;
                length[choose[i]-1] += l[i];
            }
        }
        rep(i, 3) if (length[i] == 0) return;
        cost += abs(a - length[0]) + abs(b - length[1]) + abs(c - length[2]);
        chmin(mn, cost);
        return;
    }
    rep(i, 4) {
        choose.push_back(i);
        dfs(choose);
        choose.pop_back();
    }
}


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

    cin >> n >> a >> b >> c;
    l.resize(n);
    rep(i, n) cin >> l[i];

    vector<int> choose;
    dfs(choose);
    
    cout << mn << endl;
}


Measured memory_bytes: 3604
# -*- coding:utf-8 -*-
import sys
def main():
  n = int(input().strip())
  l = list(map(int, input().split()))
  sum = 1
  if 0 in l :
    print (0)
    return

  for i in l:
    sum *= i
    if sum - 1000000000000000000 > 0:
      print (-1)
      return
  print (sum)
main()

Measured memory_bytes: 21720
n,k = map( int, input().split() )
h = list( map( int, input().split() ) )

dp = [0]*n
for i in range(1,n):
    min_cost = 10**9+7
    for j in range(1,min(k+1,i+1)):
        min_cost = min( dp[i-j]+abs(h[i]-h[i-j]), min_cost )
    dp[i] = min_cost

print(dp[n-1])

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

using namespace std;

int main()
{
  int a, b, c, x, ans = 0;
  scanf("%d %d %d %d", &a, &b, &c, &x);

  for (int i = 0; i <= a; i++)
  {
    for (int j = 0; j <= b; j++)
    {
      for (int k = 0; k <= c; k++)
      {
        if (i * 500 + j * 100 + k * 50 == x)
          ans++;
      }
    }
  }

  printf("%d", ans);
}

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


def solve(xs):
    num_neg = sum(x < 0 for x in xs)
    ys = sorted(abs(x) for x in xs)
    if num_neg % 2 == 0:
        res = sum(ys)
    else:
        res = -ys[0] + sum(ys[1:])
    return res


def main():
    _ = int(input())
    xs = [int(z) for z in input().split()]
    print(solve(xs))


if __name__ == "__main__":
    main()

Measured memory_bytes: 14332
#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 || y - r < 0 || x + r > W || y + r > H) {
    puts("No");
  }
  else {
    puts("Yes");
  }

  return 0;
}

Measured memory_bytes: 584
#include <stdio.h>
#include <algorithm>

#define LIM_S 200002
#define LIM_N 100001

char str[LIM_S];

int len;
int tile[LIM_N];

void receive_input() {
	fgets(str, sizeof(str), stdin);
	sscanf(str, "%s", str);

	// for (size_t i = 0; i < N; i++) {
	// 	scanf("%d", &H[i]);
	// }
}

void initialize() {
	int i;
	for (i = 0; str[i]; i++) {
		tile[i] = str[i] - '0';
	}
	len = i;
}

int en10(int len) {
	int n = 1;
	int count = 0;
	for (size_t i = 0; i < len; i++, n = (n + 1) % 2) {
		if (tile[i] != n) {
			count++;
		}
	}
	return count;
}

int en01(int len) {
	int n = 0;
	int count = 0;
	for (size_t i = 0; i < len; i++, n = (n + 1) % 2) {
		if (tile[i] != n) {
			count++;
		}
	}
	return count;
}

int solve() {

	int ans01 = en01(len);
	int ans10 = en10(len);

	return (ans01 < ans10) ? ans01 : ans10;
}

int main(void) {
	receive_input();
	initialize();

	printf("%d\n", solve());

	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>

using namespace std;

int main(void)
{
    int N;
    long double x;
    string u;
    long double SUM=0;

    //input and calc
    cin>>N;
    for(int j=0; j<N; j++)
    {
        cin>>x>>u;
        if(u=="JPY") SUM += x;      //JPY
        else SUM += 380000.0 * x;     //BTC
    }

    //output
    cout<<SUM<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <cstdio>
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORq(i, m, n) for(int i = m;i <= n;i++)
using namespace std;

int main() {
	long long int L[87];
	int N;
	scanf("%d",&N);
	
	L[0] = 2;
	L[1] = 1;
	
	FORq(i,2,N){L[i] = L[i-2] + L[i-1];}
	printf("%lld\n",L[N]);
	return 0;
}



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

int main() {
  int N;
  cin >> N;
  string ans="No";
  for(int i=0;i<26;++i){
    for(int j=0;j<15;++j){
      if((4*i+7*j) == N){
        ans = "Yes";
        break;
      }
    } 
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
import java.math.*

fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    val a = readInputLine().split(" ").map { it.toLong() }
    
    var x = a[0]
    var y = a.sum() - a[0]
    
    var ans = Math.abs(x - y)
    
    for (i in 1 until (N - 1)) {
        x += a[i]
        y -= a[i]
        
        ans = Math.min(ans, Math.abs(x - y))
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 82664
s = input()
if s == "KIHBR" or s == "AKIHBR" or s == "KIHABR" or s == "KIHBAR" or s == "KIHBRA" or s == "AKIHABR" or s == "AKIHBAR"or s == "AKIHBRA"or s == "KIHABAR"or s == "KIHABRA"or s == "KIHBARA"or s == "AKIHABAR"or s == "AKIHABRA"or s == "AKIHBARA"or s == "KIHABARA"or s == "AKIHABARA":
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
from math import ceil

def f1(n,a,b,c,d,e):
    m = min(a,b,c,d,e)
    if m==1:
        s = n
    elif n>m:
        s = ceil(n/m)
    else:
        s = 1
    return 5+s-1

def f2(n,a,b,c,d,e):
    op = [a,b,c,d,e]
    l = [0]*6
    l[0] = n
    res = 0
    flag = True
    while flag:
        flag = False
        for i in [4,3,2,1,0]:
            if l[i]>0:
                m = min(op[i],l[i])
                l[i] -= m
                l[i+1] += m
                flag = True
        res += 1
        if l[5]==n:
            flag = False
    return res

if __name__ == '__main__':
    n = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    print(f1(n,a,b,c,d,e))

    # from random import randint
    # for _ in range(100):
    #     n = randint(1,100)
    #     a = randint(1,20)
    #     b = randint(1,20)
    #     c = randint(1,20)
    #     d = randint(1,20)
    #     e = randint(1,20)
    #
    #     r1 = f1(n,a,b,c,d,e)
    #     r2 = f2(n,a,b,c,d,e)
    #     if r1!=r2:
    #         print(r1,r2)
    #         print(n,a,b,c,d,e)
    #         break


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

int main() {
  ll n, a;
  cin >> n;
  map<ll, ll> mp;
  rep(i, n) {
    cin >> a;
    mp[a]++;
  }

  ll ans = 0;
  for (auto x : mp) {
    ans += (x.first > x.second ? x.second : x.second - x.first);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6272
import java.io.*;
import java.lang.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String[] str=br.readLine().split(" ");
        int A=Integer.parseInt(str[0]);
        int B=Integer.parseInt(str[1]);
        int C=Integer.parseInt(str[2]);
        /* int[] f=new int[N+1];
        int[] arr=new int[N];
        StringTokenizer st=new StringTokenizer(br.readLine()," ");
        for(int i=0;i<N;i++){
        arr[i]=Integer.parseInt(st.nextToken());
        f[arr[i]]++;
        }
        long count=0;
        for(int i=1;i<=N;i++){
        long n=f[i];
        count=count+n*(n-1)/2;
        }
        for(int i=0;i<N;i++){
        int n=arr[i];
        int freq=f[n];
        System.out.println(count+1-freq);*/
        System.out.println(C+" "+A+" "+B);
    }
}


Measured memory_bytes: 21332
/*
                            Author: Ankit Kaul
*******Code Belongs to Respective Author Only*************
*/
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/
/*freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
*/
#include <bits/stdc++.h>
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
        {   if(n % 2 ==1)
            result=(result * x)%M;
            x=(x*x)%M;
            n=n/2;
        }
    return result%M;
}
bool isPrime(int n)
    {
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
    }
int inv(int a,int m)
{   return power(a,m-2);
}   
int lcm(int a,int b)
{   return a*b/(gcd(a,b));
}
signed main()
{   jaldi
    int n;
    cin>>n;
    if(n==7)
    cout<<1<<endl;
    else if(n%10!=1 && n%10!=3 && n%10!=7 && n%10!=9)
    cout<<-1<<endl;
    else
    {   int i=1,x=7%n;
        mi mp;
        while(x!=0)
        {   if(mp[x]!=0)
            break;
            mp[x]++;
            i++;
            x=x*10+7;
            x=x%n;
        }   
        if(x==0)
        cout<<i<<endl;
        else
        cout<<-1<<endl;
    } 
}


Measured memory_bytes: 66096
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,m,n,ans;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
	if(a<=b&&a<=c){
		m=a-25;
	}
	else if(b<=a&&b<=c){
		m=b-25;
	}
	else{
		m=c-25;
	}
	if(d<=e){
		n=d-25;
	}
	else{
		n=e-25;
	}
	ans=m+n;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 2700
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)
#define rrep(i, j, n) for(int i = (n) - 1; (j) <= i; --i)
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;

int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	ll n, m, v, p; cin >> n >> m >> v >> p;
	vector<ll> a(n), s(n + 1);
	rep(i, 0, n) cin >> a[i];
	sort(a.rbegin(), a.rend());
	rep(i, 0, n) s[i + 1] = s[i] + a[i];

	ll ans = p;
	rep(i, p, n) {
		if (a[i] + m < a[p - 1]) continue;
		ll mx = a[i] + m;
		ll sm = mx * (i - p + 1) - (s[i] - s[p - 1]);
		sm += (p - 1) * m + (n - i) * m;
		if (m * v <= sm) ++ans;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 4752
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//const int mod = 998244353;
const int N = 700005;
const int K = 1000000;
vector < int > ls[N], rs[N];
pair < pair <int, int >, pair <int, int > > a[N];
int n, x, s;
bool ok(int h){
    int fe = h / x;
    fe = min(fe, n);
    int res = 0;
    int c = 0;
    for (int i = 1; i <= fe; i++){
        res += a[i].F.F;
    }
    h = h % x;
    if (fe == n) return (res >= s);
    for (int i = fe + 1; i <= n; i++){
        if (h <= a[i].F.S){
            c = max(c, a[i].S.F * h);
        } else{
            c = max(c, a[i].S.F * a[i].F.S + a[i].S.S * (h - a[i].F.S));
        }
    }
    for (int i = 1; i <= fe; i++){
        if (h <= a[i].F.S){
            c = max(c, a[i].S.F * h - a[i].F.F + a[fe + 1].F.F);
        } else{
            c = max(c, a[i].S.F * a[i].F.S + a[i].S.S * (h - a[i].F.S) - a[i].F.F + a[fe + 1].F.F);
        }
    }
    //cout << res << " -- " << c << endl;
    res += c;
    return (res >= s);
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);

    cin >> n >> x;
    for (int i = 1; i <= n; i++){
        cin >> a[i].F.S >> a[i].S.F >> a[i].S.S;
        a[i].F.F = a[i].F.S * a[i].S.F + (x - a[i].F.S) * a[i].S.S;
       // cout << a[i].F.F << endl;
        s += a[i].F.S * a[i].S.F;
    }
   // cout << s << endl;
    sort(a + 1, a + n + 1);
    reverse(a + 1, a + n + 1);
    int l = -1;
    int r = 1e15;
    while(r - l > 1){
        int mid = (r + l) / 2;
        if (ok(mid)) r = mid; else l = mid;
    }
    //cout << ok(115) << endl;
    cout << r;
}


Measured memory_bytes: 38656
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<" ";

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    cout << n*(n-1)/2<<endl;
    return 0;
}


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

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int ans=0;
  if(a<b){
    ans+=a;
  }else{
    ans+=b;
  }
  if(c<d){
    ans+=c;
  }else{
    ans+=d;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 256