akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <fstream>
#include <iostream>
#include <chrono>

#include <atcoder/lazysegtree>
#include <atcoder/modint>
using namespace atcoder;

using namespace std;

const int DIV = 1000000007;

using mint = modint998244353;

std::vector<mint> precalc[10];

struct S {
    mint a, p;
    int size;
};

struct F {
    mint a, b;
};

S op(S l, S r) {
    if (l.p == 0)
        return r;
    if (r.p == 0)
        return l;
    return S{ l.a * r.p + r.a, l.p * r.p, l.size + r.size };
}

S e() { 
    return S{ 0,0,0 };
}

S mapping(F l, S r) {
    if (l.b == 0) {
        return r;
    }
    return S{ precalc[l.b.val()][r.size], r.p, r.size };
}

F composition(F l, F r) {
    if (l.b == 0)
        return r;
    return l;
}

F id() { return F{ 1, 0 }; }

int main(int argc, char* argv[]) {
#ifdef VLAD_LOCAL
    ifstream in("in.txt");
    auto start = std::chrono::steady_clock::now();
#else
    istream &in = cin;
#endif
    int n, q;
    in >> n >> q;

    vector<S> a(n, S{ 1,10,1 });

    for (int i = 1; i < 10; i++) {
        precalc[i].resize(n + 1);
        precalc[i][0] = 0;
        for (int j = 1; j <= n; j++) {
            precalc[i][j] = precalc[i][j - 1] * 10 + i;
        }
    }
    
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(a);
    S tmp = seg.all_prod();

    for (int i = 0; i < q; i++) {
        int l, r, d;
        in >> l >> r >> d;
        l--;
        seg.apply(l, r, F{ 0, d });
        mint res = seg.all_prod().a;
        printf("%d\n", res.val());
    }
    
#ifdef VLAD_LOCAL
    auto end = std::chrono::steady_clock::now();
    double seconds = (double)std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() / 1000;
    printf("%.3lf\n", seconds);
#endif
	return 0;
}


Measured memory_bytes: 20952
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <string>
#include <deque>
#include <stack>
#include <cmath>

using namespace std;

#define PB push_back
#define MP make_pair
#define f first
#define s second
#define FOR(i,a,b) for (LL i = a; i < b; ++i)
#define RFOR(i, b, a) for (int i = b-1; i>=a; --i)
#define FILL(a, b) memset(a, b, sizeof a)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)a.size()

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<LL> VI;
typedef pair<LL, LL> PLL;

const int INF = 1000 * 1000 * 1000;
const LL LINF = 1LL * INF*INF;
const int MAX = 400040	;
const long double PI = acos(-1.);
const double EPS = 1e-6;
LL mod = 1000LL * 1000 * 1000 + 7;


struct matrix
{
	vector<VI> mtr;
	matrix(int n)
	{
		FOR(i,0,n)
		{
			VI tmp;
			FOR(j,0,n)
				tmp.PB(0LL);
			tmp[i]=1LL;
			mtr.PB(tmp);
		}
	}
	matrix(vector<VI> arr)
	{
		mtr = arr;
	}
	matrix operator%(LL mod)
	{
		FOR(i,0,SZ(mtr))
		{
			FOR(j,0,SZ(mtr))
			{
				mtr[i][j]%=mod;
			}
		}
		return mtr;
	}
	matrix operator*(matrix b)
	{
		matrix ans(SZ(mtr));
		FOR(i,0,SZ(mtr))
		{
			FOR(j,0,SZ(mtr))
			{
				ans.mtr[i][j]=0;
				FOR(k,0,SZ(mtr))
				{
					ans.mtr[i][j]=(ans.mtr[i][j]+mtr[i][k]*b.mtr[k][j])%mod;
				}
			}
		}
		return ans%mod;
	}
};
matrix binpowmod(matrix m1, LL  pow)
{
	matrix ans(SZ(m1.mtr));
	ans=ans%mod;
	while(pow)
	{
		if(pow&1)
			ans = (ans*m1)%mod;

		m1=(m1*m1)%mod;

		pow>>=1;
	}
	return ans%mod;
}

int main()
{
	//freopen("input.tXXt", "r", stdin);
	ios_base::sync_with_stdio(0);
//	FILL(dpT,-1);
	LL n,k;
	cin >> n >> k;
	vector<VI> arr;
	FOR(i,0,n)
	{
		VI tmp(n);
		FOR(j,0,n)
			cin >> tmp[j];
		arr.PB(tmp);
	}
	matrix ans(arr);
	ans=binpowmod(ans,k);
	LL A=0;
	FOR(i,0,SZ(ans.mtr))
	{
		FOR(j,0,SZ(ans.mtr))
		{
			A=(A+ans.mtr[i][j])%mod;
		}
	}
	cout<<A;
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>

int main() {
	bool flag=true;
	int n;
	std::cin >> n;

	std::vector<std::string> v(n);

	for (std::string& x : v) {
		std::cin >> x;
	}

	
	//尻とはじめの一致
	for (int i = 0; i < n - 1; i++) {
		//std::cout << v[i][v[i].size() - 1] <<v[i + 1][0] << std::endl;
		if (v[i][v[i].size() - 1] != v[i + 1][0]) {
			flag = false;
			break;
		}
	}

	
	

	
	//文字列の一致
	for (int j = 0; j < n - 1; j++) {
		for (int i = j+1; i < n; i++) {
			if (v[j] == v[i]) {
				flag = false;
				break;
			}
		}
	}
	
	//std::cout << v[i] << v[i + 1] << std::endl;
	



	std::cout <<(flag==true? "Yes":"No")<< std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll modpow(ll a, ll n, ll mod_) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod_;
        a = a * a % mod_;
        n >>= 1;
    }
    return res;
}

const ll MAX_SIZE = 200005;
array<ll, MAX_SIZE> fac, inv, finv;
void finit() {
    // combination init
    fac[0] = 1;
    for (ll i = 1; i < MAX_SIZE; i++) fac[i] = fac[i - 1] * i % MOD;
    finv[MAX_SIZE - 1] = modpow(fac[MAX_SIZE - 1], MOD - 2, MOD);
    for(ll i = MAX_SIZE - 1; i > 0; i--) finv[i - 1] = finv[i] * i % MOD;
    
    //inv init
    repe(i, 1, MAX_SIZE) inv[i] = modpow(i, MOD - 2, MOD);
}

ll perm(ll a, ll b) { return fac[a] * finv[a - b] % MOD; }

ll comb(ll a, ll b) { return fac[a] * finv[b] % MOD * finv[a - b] % MOD; }

int main() {
    init();
    finit();
    ll N;
    cin >> N;
    vl A(N + 1);
    rep(i, N + 1) cin >> A[i];

    vl U(N + 1, -1);
    ll l, r;
    rep(i, N + 1) {
        if (U[A[i]] != -1) {
            l = U[A[i]];
            r = i;
            break;
        }
        U[A[i]] = i;
    }


    repe(k, 1, N + 2) {
        ll ans = 0;
        // 0個選ぶ
        if(k <= N - 1)
            ans += comb(N - 1, k);
        // 2個選ぶ
        if (k >= 2)
            (ans += comb(N - 1, k - 2)) %= MOD;
        
        // 1個選ぶ
        if(k <= N)
            (ans += 2 * comb(N - 1, k - 1)) %= MOD;
        if(l + N - r >= k - 1)
            (ans += MOD - comb(l + N - r, k - 1)) %= MOD;

        cout << ans << '\n';
    }
}

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

double ans[20][3];

void Evaluate( int num, double x1, double x2, double x3, double y1, double y2, double y3 )
{
	double a = 2 * ( -x1 + x2 );
	double b = 2 * ( -y1 + y2 );
	double c = x2*x2 - x1*x1 + y2*y2 - y1*y1;

	double d = 2 * ( -x1 + x3 );
	double e = 2 * ( -y1 + y3 );
	double f = x3*x3 - x1*x1 + y3*y3 - y1*y1;

	ans[num][0] = ( c*e - b*f ) / ( a*e - d*b );
	ans[num][1] = ( c*d - a*f ) / ( b*d - a*e );
	double x = ( ( x1 - ans[num][0] ) * ( x1 - ans[num][0] ) + ( y1 - ans[num][1] ) * ( y1 - ans[num][1] ) ) ;
	ans[num][2] = sqrt( x );
}

int main()
{
	int size, i;
	double x1, x2, x3, y1, y2, y3;


	scanf( "%d", &size );
	for ( i = 0 ; i < size ; i++ )
	{
		scanf( "%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3 );
		Evaluate( i, x1, x2, x3, y1, y2, y3 );
	}

	for ( i = 0 ; i < size ; i++ )
	{
		fprintf( stdout, "%.3f %.3f %.3f\n", ans[i][0], ans[i][1], ans[i][2]);
	}

	return 0;
}

Measured memory_bytes: 664
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define ll              long long 
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             998244353
#define Mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define vpii            vector<pair<int,int> >
#define all(x)          x.begin(),x.end()
#define sort(x)         sort(all(x))
#define umii            unordered_map<int,int>
#define lli             list<int>             
#define gcd(m,n)        __gcd(m,n)   
#define mib             map<int,bool>

#define TRACE
#ifdef TRACE
#define deb(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define deb(...)
#endif

void fast()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif
}
 
//////////////////////////////code//////////////////////////////

int32_t main()
{
  fast();
  
  int n,k;
  cin>>n>>k;
 int ans=0;
 
 for(int i=k;i<=n+1;i++)
 {
 	int minsum=((i-1)*i)/2;
 	int maxsum = (n*(n+1))/2 - ((n-i+1)*(n-i))/2;
 	ans+=(maxsum-minsum+1);
 	ans%=Mod;
 //	deb(i,maxsum,minsum);
 }
 cout<<ans;


}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstdio>
#include <queue>
using namespace std;

int a[2000];
int n, m;

bool rec(int val, int num){
  if(val == 0){
    return true;
  }else if(val < 0){
    return false;
  }

  for(int i=num;i<n;i++){
    if(rec(val-a[i], i + 1)){
      return true;
    }
  }
  return false;
}

int main(void){
  cin >> n;
  for(int i=0;i<n;i++)
    cin >> a[i];
  cin >> m;
  vector<bool> out(m);
  for(int i=0;i<m;i++){
    int val;
    cin >> val;
    out[i] = rec(val, 0);
  }


  for(int i=0;i<m;i++){
    if(out[i]){
      cout << "yes"  << endl;
    }else{
      cout << "no" << endl;
    }
  }
  return 0;
}

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

string s;
int k;
vector <string> V;
 
int main()
{
	cin >> s;
	cin >> k;
	for (int i = 0; i < s.length(); i++) {
		string cur;
		for (int j = i; j < s.length() && j < i + k; j++) {
			cur += s[j];
			V.push_back(cur);
		}
	}
	sort(V.begin(), V.end()); V.erase(unique(V.begin(), V.end()), V.end());
	cout << V[k - 1] << endl;
	return 0;
}


Measured memory_bytes: 1660
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

#define MAX_N (2000)
#define INF (1000000000)

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  int N, Z, W, as[MAX_N];
  scanf("%d %d %d", &N, &Z, &W);
  for (int i = 0; i < N; i++) {
    scanf("%d", &as[i]);
  }

  // solve
  int dp[MAX_N][2];
  for (int i = N - 1; i >= 0; i--) {
    dp[i][0] = -INF;
    for (int j = i + 1; j < N; j++) {
      dp[i][0] = max(dp[i][0], dp[j][1]);
    }
    dp[i][0] = max(dp[i][0], abs(as[N - 1] - (i > 0 ? as[i - 1] : W)));
    dp[i][1] = INF;
    for (int j = i + 1; j < N; j++) {
      dp[i][1] = min(dp[i][1], dp[j][0]);
    }
    dp[i][1] = min(dp[i][1], abs(as[N - 1] - (i > 0 ? as[i - 1] : Z)));
  }
  // for (int i = 0; i < N; i++) {
  //   printf("%d ", dp[i][0]);
  // }
  // printf("\n");
  // for (int i = 0; i < N; i++) {
  //   printf("%d ", dp[i][1]);
  // }
  // printf("\n");
  printf("%d\n", dp[0][0]);

  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        int odd = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (a[i] % 2 != 0) {
                odd++;
            }
        }
        // odd の時1通り
        int even = n - odd;
        // evenの時2通り
        long ans = (long) Math.pow(3, n);
        long dame = (long) Math.pow(2, even);
        ans -= dame;
        System.out.println(ans);

        sc.close();
    }
}


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

int main() {

  int64_t N,c=0, ans=0;
    cin >> N;
 while(N>0){N=N/2;
            c++;}
    for(int i=0; i<c; i++){
      ans+=pow(2,i);}
  
    cout<<ans<<endl;
   /*vector<int>A(N);
    for (int i = 0; i < N; i++) { cin >> A[i]; }*/
    
    //cout<<
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define pb push_back
#define mp make_pair
bool isPrime(ll n) 
{ 
    
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
   
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
ll minthis(ll a, ll b){
if(a < b){
return a;
}
return b;
}
ll maxthis(ll a, ll b){
if(a > b){
return a;
}
return b;
}
int gcd(int a, int b){
    if( a<0 ) a = -a;
    if( b<0 ) b = -b;
    while( b!=0 ){
        a %= b;
        if( a==0 ) return b;
        b %= a;
    }
    return a;
}
 
int findLargestDivisor(int n) 
{ 
	int max = 1;
    for (int i = 2; i < n; i++) {        
        if(n %(i) == 0) { 
            max = i;
        } 
    }
    return max;     
} 
 
 
ll power(ll x, ll y)  
{  
    ll temp;  
    if(y == 0)  
        return 1;  
    temp = power(x, y / 2);  
    if (y % 2 == 0)  
        return temp * temp;  
    else
    {  
        if(y > 0)  
            return x * temp * temp;  
        else
            return (temp * temp) / x;  
    }  
} 

void solve(){	
int n;
cin >> n;
int arr[n+1] = {};
arr[n] = INT_MAX;
for(int i = 0 ; i < n ; i++){
    cin >> arr[i];
}
ll ans = 0;
for(int i = 0 ; i < n; i++){
    if(arr[i] > arr[i+1]){
        ans += abs(arr[i]-arr[i+1]);
        arr[i+1] = arr[i];
    }   
}
cout << ans << "\n";
}
 
int main(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
	solve();
    }
    return 0; 
}



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

int main() {
    long N;
    cin >> N;
    long H[N];
    for(int i = 0;i < N;i++)
    {
        cin >> H[i];
    }

    long number = 0;
    for(int i = 0;i < N - 1; i++)
    {
        if(H[i] - H[i + 1] == 1)
        {
            if(number == H[i])
            {
                cout << "No" << endl; 
                return 0;
            }
            number = H[i] - 1;
        }
        else if(H[i] - H[i + 1] > 1)
        {
            cout << "No" << endl; 
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#define NIL -1
#define max 26
typedef struct {
	int node, left, right, depth, parent, height, sub, deg;
}tre;

tre tree[30];

int getheight(int i) {
	int h1 = 0, h2 = 0;
	if (tree[i].left != NIL)
		h1 = getheight(tree[i].left) + 1;
	if (tree[i].right != NIL)
		h2 = getheight(tree[i].right) + 1;
	return tree[i].height = (h1 > h2 ? h1 : h2);
}

int getsib(int i) {
	if (tree[i].parent == NIL) return NIL;
	if (tree[tree[i].parent].left != i && tree[tree[i].parent].left != NIL)
		return tree[tree[i].parent].left;
	if (tree[tree[i].parent].right != i && tree[tree[i].parent].right != NIL)
		return tree[tree[i].parent].right;
	return NIL;
}

void getdepth(int i, int j) {
	if (i == NIL) return;
	tree[i].depth = j;
	getdepth(tree[i].left, j + 1);
	getdepth(tree[i].right, j + 1);
}


int main() {
	int i, size, base;
	scanf("%d", &size);

	//set all to NIL
	for (i = 0; i != size; i++) {
		tree[i].node = tree[i].left = tree[i].right =
			tree[i].depth = tree[i].parent = tree[i].height =
			tree[i].sub = tree[i].deg = NIL;
	}

	//reading input
	int node, left, right;
	for (i = 0; i != size; i++) {
		scanf("%d %d %d", &node, &left, &right);
		tree[node].left = left;
		tree[node].right = right;
		if (left != -1) tree[left].parent = node;
		if (right != -1) tree[right].parent = node;
	}

	//processing
	for (int i = 0; i != size; i++)
		if (tree[i].parent == NIL) base = i;
	getdepth(base, 0);
	getheight(base);

	//printing
	for (i = 0; i != size; i++) {
		printf("node %d: ", i);
		printf("parent = %d, ", tree[i].parent);
		printf("sibling = %d, ", getsib(i));
		int deg = 0;
		if (tree[i].left != NIL) deg++;
		if (tree[i].right != NIL) deg++;
		printf("degree = %d, ", deg);
		printf("depth = %d, ", tree[i].depth);
		printf("height = %d, ", tree[i].height);

		if (tree[i].parent == NIL) {
			printf("root\n");
		}
		else if (tree[i].left == NIL && tree[i].right == NIL) {
			printf("leaf\n");
		}
		else {
			printf("internal node\n");
		}
	}

	return 0;
}


Measured memory_bytes: 2044
#include<iostream>
#include<algorithm>
#include<map>
#include<cmath>
#include<cstdio>
using namespace std;
int lu[3][101],n;
long long lj,a,b,ma;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a;
		lj+=a;
		lu[1][i]=lj;
	}
	lj=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a;
		lj+=a;
		lu[2][i]=lj;
	}
	for(int i=1;i<=n;i++)
	{
		b=lu[1][i]+(lu[2][n]-lu[2][i-1]);
		ma=max(b,ma);
	}
	cout<<ma<<endl;
	return 0;
}

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

int main() {
	long double a,b,c,i,j,k,n,m,x,y,ans = 0;
	long double aa,bb;
	
	cin >> a >> b >> c;

	
	aa = 4*a*b;
	bb = (c - a - b)*(c - a - b);
	
	if (( aa < bb ) && ( c - a - b > 0 )) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

}


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

const ll mod = 1e9+7;

int main(){
    int n; cin >> n;
    int f = 1;
    vector<ll> alis(n, 0), blis(n, 0), flag(n, 0), maxlis(n, 0);
    ll k = 0;
    REP(i, 0, n){
        cin >> alis[i];
        if(k < alis[i]){
            flag[i] = 1;
        }
        k = alis[i];
        maxlis[i] = k;
    }
    REP(i, 0, n){
        cin >> blis[i];
    }
    k = 0;
    for(int i = n-1; i >= 0; i--){
        int ff = 0;
        if(k < blis[i]){
            ff = 1;
            k = blis[i];
        }
        if(flag[i] == 1){
            if(ff == 1 && maxlis[i] != k){
                f = 0;
            }else if(ff == 0 && maxlis[i] > blis[i]){
                f = 0;
            }
        }else{
            if(ff == 1 && maxlis[i] < k){
                f = 0;
            }
        }
        if(ff == 1){flag[i] = 1;}
        maxlis[i] = min(k, maxlis[i]);
    }
    if(f == 0){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1;
    REP(i, 0, n){
        if(flag[i] == 1){continue;}
        else{
            ans = (ans * maxlis[i]) % mod;
        }
    }
    cout << ans << endl;
}

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

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	int a,b;
	cin >> a >> b;
	int c;
	
	for(c=1;c<=3;c++){
		if((a*b*c)%2 == 1){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int a;
int cnt = 0;
int cnt2 = 0;
cin >> a;
    for(int i=1;i<a+1;i+=2){
        for(int j=1;j<i+1;j++){
            if(i%j==0)cnt++;
        }
        if(cnt == 8) cnt2++;
        cnt = 0;
    }
    cout << cnt2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

bool is_number(char c)
{
    const char numbers[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

    for (int i = 0; i < 10; ++i) {
        if (c == numbers[i]) {
            return true;
        }
    }

    return false;
}

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

    string S;
    cin >> S;

    if (S[A] != '-') {
        cout << "No" << endl;
        return 0;
    }

    for (int i = 0; i < S.size(); ++i) {
        if (i == A) {
            continue;
        }

        if (!is_number(S[i])) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
    int N,d[110];
    cin >> N;
    for (int i = 0;i < N;i++){
        cin >> d[i];
    }

    int num[110];

    for (int i = 0;i <= 99;i++){
        num[i] = i + 1;
    }
    int p = 0;
    for (int i = 0;i <= 99;i++){
        for (int j = 0;j < N;j++){
            if (d[j] == num[i]){
                p = p + 1;
                break;
            }
        }
    }
    cout << p << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,a,b,i=0;
  cin>>n;
  for(a=0;a<1000;a++){
    if(i==1){
      break;
    }for(b=-1000;b<1000;b++){
      if(pow(a,5)-pow(b,5)==n){
        cout<<a<<" "<<b<<endl;
        i=1;
        break;
      }
    }
  }
}

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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main(){
  string s, t;
  cin >> s >> t;
  s += s;
  YesorNo(s.find(t) != string::npos);
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
const ll mod = 1000000007;
// const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"
#define TO_STRING(VariableName) # VariableName

template <typename T>ostream &operator<<(ostream &out,const vector<T> &v) {rep(i,(int)v.size()-1)cout<<v[i]<<" ";cout<<v[(int)v.size()-1];return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const map<T1, T2> &p) {out << "(" << p.first << ", " << p.second << ")";return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const pair<T1, T2> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template<class T>void debag(const T &obj){cout<<obj<<endl;}

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

ll f(ll x){
	ll ret=1;
	while(1){
		if(ret*(ret+1)/2<=x)ret++;
		else break;
	}
	return ret-1;
}

bool solve(){
	ll n;cin>>n;
	auto mp=prime_factor(n);
	ll ans=0;
	if(n==1){
		
	}
	
	for(auto&& p:mp){
		ll a=p.second;
		ans+=f(a);
	}
	cout<<ans<<endl;
  return false;
}




signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed<<setprecision(30);
  solve();
}


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

typedef unsigned long long ll;

ll md = 1000000007;

int main(int, char**) 
{
	ll n, ans = 0;
	cin >> n;
	for(ll i = 1; i <= n; i++) {
		ll x;
		cin >> x;
		if (i != x) ans++;
	}

	if (ans < 3)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
l=[int(i) for i in input().split()]
l.sort()
ans=[0]
for i in range(m-1):
    ans.append(l[i+1]-l[i])
ans.sort()
for i in range(n-1):
    if len(ans)==1: break
    ans.pop()
print(sum(ans))

Measured memory_bytes: 57256
def SolveCakesAndDonuts(N):
    for m in range(N/7 + 1):
        r = N - 7*m
#        print "r = ",r
        if r%4 == 0:
            print  "Yes"
            break
        if m == N/7:
            print "No"
            
n = input()
SolveCakesAndDonuts(n)

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

def main():
    S = input().strip()
    if len(S) < 26:
        used = [0]*26
        for c in S:
            used[ord(c)-ord("a")] = 1
        print(S+chr(ord("a")+used.index(0)))
        return
    used = []
    while len(S)>0:
        c = S[-1]
        S = S[:-1]
        nxt = []
        for c2 in used:
            if c < c2:
                nxt.append(c2)
        if nxt:
            print(S+min(nxt))
            return
        used.append(c)
    print("-1")

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
    typedef long long ll;

  const ll hell = 1000000007;
    inline ll gcd(ll a, ll b)
    {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }
    inline ll power(ll a, ll n, ll m)
    {
        if (n == 0)
            return 1;
        ll p = power(a, n / 2, m);
        p = (p % m * p % m) % m;
        if (n % 2)
            return (p % m * a % m) % m;
        else
            return p;
    }
    void modulo()
    {
          int n;
    cin>>n;
    int ans=power(10,n,hell);
    ans=(ans-(2*power(9,n,hell))%hell+hell)%hell;
    ans=(ans+(power(8,n,hell)))%hell;
    cout<<ans<<endl;

    }
int main()
{
    IOS;
    int t=1;
   // cin >> t;
    while (t--)
    {
        modulo();
    }
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<complex>
int n;
using namespace std;
int recurse(string now){
  bool a = false, b = false , c = false;
  int kaisu;
  if(stol(now) > n){
    return 0;
  }

  kaisu = recurse("3" + now) + recurse("5" + now) + recurse("7" + now);

  for(int i = 0; i < now.size(); i++){
    if(now.at(i) == '3'){
      a = true;
    } else if(now.at(i) == '5'){
      b = true;
    } else if(now.at(i) == '7'){
      c = true;
    }
  }
  if(a && b && c){
    return kaisu + 1;
  } else {
    return kaisu;
  }
}

int main(){

  cin >> n;
  int sum = 0;
  sum = recurse("3") + recurse("5") + recurse("7");
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int x = sc.nextInt();

        //猫がAに満たない場合
        if(a > x){
            System.out.println("NO");
        }
        else{
            //X-A匹の猫がBより大きい場合
            if(b < (x - a)){
                System.out.println("NO");
            }
            else{
                System.out.println("YES");
            }
        }
    }
}

Measured memory_bytes: 22612
#include <iostream>
#include <cmath>

using namespace std;

#define v2d Vector2D

struct Vector2D	{
	double x, y;
};

Vector2D sub_vector2D(const Vector2D& a, const Vector2D& b) {
	Vector2D ret;
	ret.x = a.x - b.x; ret.y = a.y - b.y;
	return ret;
}

double out_mul(v2d a, v2d b) {
	return a.x*b.y - a.y*b.x;
}

bool point_in_triangle_2D(v2d a, v2d b, v2d c, v2d p) {
	v2d ab = sub_vector2D(b, a);
	v2d bp = sub_vector2D(p, b);
	
	v2d bc = sub_vector2D(c, b);
	v2d cp = sub_vector2D(p, c);
	
	v2d ca = sub_vector2D(a, c);
	v2d ap = sub_vector2D(p, a);
	
	double c1 = out_mul(ab, bp), c2 = out_mul(bc, cp), c3 = out_mul(ca, ap);
	
	if ( (c1>0 && c2>0 && c3>0) || (c1<0 && c2<0 && c3<0) ) return true;
	return false;
}

int main() {
	v2d a, b, c, p;
	
	while (cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y) {
		if (point_in_triangle_2D(a, b, c, p)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

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

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

int n;
string s;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  vector<int> dp(n + 1);
  const int md = (int) 1e9 + 7;
  const int N = 26;
  vector<int> cnt(N);
  range(i, 0, n) cnt[s[i] - 'a']++;
  long long res = 1;
  range(i, 0, N) {
    res *= cnt[i] + 1;
    res %= md;
  }
  cout << res - 1;
  return 0;
}


Measured memory_bytes: 848
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,-1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,D;
    cin >> N>> D;
    cout << (N+2*D+1-1)/(1+2*D) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    int ans = 1e8;
    rep(i, n - m + 1) {
        int cnt = 0;
        rep(j, m) {
            if (s[i+j] != t[j]) {
                ++cnt;
            }
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;

int main() {
	string S;
	static long long ANS[100000] = {};
	cin >> S;
	long long RC = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'R') {
			RC++;
		}
		else {
			if (RC % 2 == 0) {
				ANS[i - 1] += RC / 2;
				ANS[i] += RC / 2;
			}
			else {
				ANS[i - 1] += (RC + 1) / 2;
				ANS[i] += (RC - 1) / 2;
			}
			RC = 0;
		}
	}
	long long LC = 0;
	for (int i = S.size() - 1; i >= 0; i--) {
		if (S[i] == 'L') {
			LC++;
		}
		else {
			if (LC % 2 == 0) {
				ANS[i + 1] += LC / 2;
				ANS[i] += LC / 2;
			}
			else {
				ANS[i + 1] += (LC + 1) / 2;
				ANS[i] += (LC - 1) / 2;
			}
			LC = 0;
		}
	}
	for (int i = 0; i < S.size(); i++) {
		if (i != 0) cout << " ";
		cout << ANS[i];
	}
	cout << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(std::unique(all(x)), x.end());
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
const double PI = acos(-1);
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    string s, t;
    cin >> s >> t;
    int n = sz(s), m = sz(t);
    vector<int> sa(n + 1), ta(m + 1);
    rep(i, n) sa[i + 1] = sa[i] + (s[i] == 'A');
    rep(i, m) ta[i + 1] = ta[i] + (t[i] == 'A');
    int q;
    cin >> q;
    while (q--) {
        int l1, r1, l2, r2;
        cin >> l1 >> r1 >> l2 >> r2;
        l1--;
        l2--;
        int A = (sa[r1] - sa[l1]) - (ta[r2] - ta[l2]);
        int B =
            ((r1 - l1) - (sa[r1] - sa[l1])) - ((r2 - l2) - (ta[r2] - ta[l2]));
        cout << ((A + 2 * B) % 3 == 0 && (2 * A + B) % 3 == 0 ? "YES" : "NO")
             << endl;
    }
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int count=0;
  int a,b; cin>>a>>b;
  string s; cin>>s;
  for(int i=0;i<a;i++){
   if(s[i]!='-') count++;
  }
  if(s[a]=='-') count++;
  
  for(int i=a+1;i<a+1+b;i++){
   if(s[i]!='-') count++;
  }
 
  if(count==a+b+1) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNextInt()){
			int a,b,c,d,e,f;
			double x,y,det;
			a=sc.nextInt();
			b=sc.nextInt();
			c=sc.nextInt();
			d=sc.nextInt();
			e=sc.nextInt();
			f=sc.nextInt();
			det=a*e-b*d;
			x=(1/det)*(e*c-b*f);
			y=(1/det)*(-c*d+a*f);
			if((x*1000)%1>=2/1){
				x=((x*1000-(x*1000)%1)+1)/1000;
			}else if((x*1000)%1<2/1){
				x=(x*1000-(x*1000)%1)/1000;
			}
			if((y*1000)%1>=2/1){
				y=((y*1000-(y*1000)%1)+1)/1000;
			}else if((y*1000)%1<2/1){
				y=(y*1000-(y*1000)%1)/1000;
			}
			System.out.println(String.format("%.3f %.3f",x,y));
		}
		sc.close();
	}
}

Measured memory_bytes: 26332
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	s := getNextInt(scanner)
	aa := make([]int, n)
	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
	}
	l := -1
	sum := 0
	var ans cint
	ans = cint(n + 1)
	for r := 0; r < n; r++ {
		sum += aa[r]
		for r > l && sum >= s {
			ans.minAs(cint(r - l))
			l++
			sum -= aa[l]
		}
	}
	if ans == cint(n+1) {
		fmt.Fprintln(writer, 0)
		return
	}
	fmt.Fprintln(writer, ans)
}

type cint int64

func (ct *cint) minAs(x cint) *cint {
	*ct = ct.min(x)
	return ct
}
func (ct *cint) maxAs(x cint) *cint {
	*ct = ct.max(x)
	return ct
}
func (ct cint) min(x cint) cint {
	if ct > x {
		return x
	}
	return ct
}
func (ct cint) max(x cint) cint {
	if ct < x {
		return x
	}
	return ct
}



Measured memory_bytes: 2844
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <math.h>
#include <tuple>
using namespace std;
#define fio ios::sync_with_stdio(0),cin.tie(0);
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



ll A, B, C;
int main() {
	scanf("%lld %lld %lld", &A,&B,&C);
	ll ans = 0;
	ans += min(C, B);
	C -= ans;
	B -= ans;
	ans *= 2;
	ll k = min(C, A);
	ans += k;
	C -= k;
	if (C) ans++;
	ans += B;
	printf("%lld", ans);
}

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

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

int main() {
    int h, a;
    cin >> h >> a;
    cout << h / a + (h % a > 0) << endl;

    return 0;
}

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

#define DEBUG if(0)
#define lli long long int
const int maxN = 1e5 + 1, INF = 1e9 + 5;
int cost[maxN], n, k;

int main()
{
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++)
    scanf("%d", &cost[i]);
  vector<int> dp(n, INF);
  dp[0] = 0;
  for (int i = 0; i < n; i++)
    for (int j = 1; j <= k; j++)
      if (i + j < n)
        dp[i + j] = min(dp[i + j], dp[i] + abs(cost[i] - cost[i + j]));
  printf("%d\n", dp[n - 1]);      
  return 0;
}

Measured memory_bytes: 1024
N, A, B, C, D = map(int,input().split())
import math
X1 = math.ceil(N/A)
Y1 = math.ceil(N/C)
X2 = B*X1
Y2 = D*Y1
if X2<Y2 :
    print(X2)
else:
    print(Y2)


Measured memory_bytes: 5664
# coding: utf-8
# Your code here!
n,a,b = map(int,input().split())
zyu = n // (a+b)
ans = 0
ans += a * zyu
nok = n - zyu * (a+b)
if nok >= a:
    ans += a
elif nok < a:
    ans += nok
print(ans)

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

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

void solve(long long N, long long M, multimap<int,int> tab){
   REP(i, N) {
     long long count = 0;
     auto p = tab.equal_range(i+1);
     for (auto it = p.first; it != p.second; ++it) {
       count++;
     }

     cout << count << endl;
   }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long M;
  scanf("%lld",&M);

  multimap<int,int> tab;
  long long a;
  long long b;
  for(int i = 0 ; i < M ; i++){
    cin >> a >> b;

    tab.emplace(a, b);
    tab.emplace(b, a);
  }
    solve(N, M, std::move(tab));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N, K;
  cin >> N >> K;
  vector<int> x(N);
  for (int i=0; i<N; i++){
  	cin >> x.at(i);
  }
  int sum=0;
 
 for (int i=0; i<N;i++){
 	sum += min(2*x.at(i), 2*(K-x.at(i)));
 }

               cout << sum << endl;
  
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef unordered_set<ll> uset;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=0;i<=n;i++)
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define all(x) x.begin(),x.end()
#pragma gcc optimize("O3")
#pragma gcc optimize("unroll-loops")
#pragma gcc target("avx2,see4")

int main(){
	ll a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	ll k;
	cin>>k;
	cout<<a[k-1]<<endl;
}


Measured memory_bytes: 256
#![allow(unused)]

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
//入力マクロここまで

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;
//use std::collections::VecDeque;

fn main() {
    input! {
        k: usize,
    }

    let v = vec![
        1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4,
        1, 51,
    ];
    println!("{}", v[k - 1]);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
using ll = long long;
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>=22) cout<<"bust";
    else cout<<"win";
}

Measured memory_bytes: 256
//it was hard to write
//so it should be hard to read
#include <bits/stdc++.h>
#define sz size
#define pb push_back
#define ll long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define last(x) (x).size() - 1
#define mp make_pair

using namespace std;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef double ld;

const int MAXN = 1e5 + 5;
const ll INF = 1e18 + 7;
const int inf = 1e9 + 7;
const double EPS = 1e-9;

int n, l;
string s[MAXN];

bool comp(string a, string b) {
    for (int i = 0; i < l; i++) {
        if (a[i] > b[i]) return 0;
        else if (a[i] < b[i]) return 1;
    }
    return 0;
}

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    cin >> n >> l;
    for (int i = 1; i <= n; i++) {
        cin >> s[i];
    }
    sort (s + 1, s + 1 + n, comp);
    for (int i = 1; i <= n; i++) {
        cout << s[i];
    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, P; cin >> A >> P;
  cout << (A * 3 + P) / 2 << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  string S;
  cin >> S;
  for(int i=0; i<S.length()-1; i++){
    if(S[i]==S[i+1]){
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int N;
  int k;
  cin>>N;
  int A[N+1]={0};
  for(int i=1;i<=N-1;i++)
  {
      
      cin>>k;
      A[k]++;
  }
  for(int j=1;j<=N;j++)
  cout<<A[j]<<endl;
  
  
  return 0;
}

Measured memory_bytes: 4412
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;


public class Test
{	
    public static void Main()
	{
	    string[] s = Console.ReadLine().Split(' ');
	    string s1 = s[0];
	    string s2 = s[1];
	    string s3 = s[2];
	    string ans = (s1[0] +""+ s2[0] +""+ s3[0]).ToString();
	    
	    Console.WriteLine(ans.ToUpper());
	    
	    
	} 
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MAX=5e5+5;
bool a[MAX];


int main()
{
        LL r,d,x;
        cin>>r>>d>>x;
        for(int i=0;i<10;i++)
        {
                x=r*x-d;
                cout<<x<<endl;
        }
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    ll N, K;
    cin >> N >> K;

    for(ll i = 0; i < N; i++){
        ll t; cin >> t;
        vec.push_back(t);
    }

    sort(vec.rbegin(), vec.rend());

    ll ans = 0;
    for(ll i = K; i < N; i++){
        ans += vec[i];
    }

    cout << ans << endl;

}

Measured memory_bytes: 2420
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,m,i,ans = 0,now = 0;cin >> n >> m;
  pair<int,int> a[m];
  for(i=0;i<m;i++) cin >> a[i].second >> a[i].first;
  sort(a,a+m);
  for(i=0;i<m;i++){
    if(a[i].second >= now){
      ans++;now = a[i].first;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024