akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;

const int N = 2437;
ll dp[N][N];
ll ma_fold[N][N]; // row
ll mi_fold[N][N]; // column


const ll inf = 1e16;

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  ll z, w;
  cin >> n >> z >> w;
  VL a(n+2);
  a[0] = z;
  a[1] = w;
  REP(i, 0, n) {
    cin >> a[i+2];
  }
  REP(i, 0, N){
    REP(j, 0, N) {
      mi_fold[i][j] = inf;
    }
  }
  for (int i = n + 1; i >= 0; --i) {
    for (int j = n + 1; j >= 0; --j) {
      if (i == j) { continue; }
      if (i == n + 1 || j == n + 1) {
	dp[i][j] = abs(a[i] - a[j]);
      } else if (i < j) {
	ll ma = ma_fold[j+1][j];
	dp[i][j]= ma;
      } else {
	dp[i][j] = mi_fold[i][i + 1];
      }
      ma_fold[i][j] = max(ma_fold[i+1][j], dp[i][j]);
      mi_fold[i][j] = min(mi_fold[i][j+1], dp[i][j]);
    }
  }
  if (0) {
    cerr << "dp:";
    REP(i, 0, n + 2) {
      REP(j, 0, n + 2) {
	cerr << " " << dp[i][j];
      }
      cerr << endl;
    }
    cerr << "mi_fold:";
    REP(i, 0, n + 2) {
      REP(j, 0, n + 2) {
	cerr << " " << mi_fold[i][j];
      }
      cerr << endl;
    }
  }
  cout << dp[0][1] << endl;
}


Measured memory_bytes: 125184
#include "iostream"
#include <vector>
#include <algorithm>
#include <math.h>
#include <limits.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> P;
    int min=200'001;
    int num=0;
    for (int i=0; i < N; i++) {
        int p;
        cin >> p;
        // P.push_back(p);
        if (p <= min) {
            min = p;
            num++;
        }
        
    }
    cout << num << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
long long ans,x;
priority_queue<long long> pq;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i) scanf("%lld",&x),pq.push(x);
	for(int i=1;i<=m;++i) {
		x=pq.top();
		pq.pop();
		pq.push(x/2);
	}
	for(int i=1;i<=n;++i) ans+=pq.top(),pq.pop();
	printf("%lld",ans);
	return 0;
}

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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    ll A,B,ans;
    scanf("%lld %lld", &A, &B);
    printf("%lld\n", (A-1)*(B-1));
    return 0;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 1e9+7;

int main() {
    int X;
    cin >> X;
    int q = 10 - X/200;
    cout << q << endl;
    return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	double r;
	cin>>r;
	cout<<fixed<<setprecision(20)<<double(2*double(22)/7*r)<<endl;
	return 0;
}

Measured memory_bytes: 3812
import java.io.*;

class Main
{

    public static void main(String args[])
    {
	try
	    {
		int stack[]=new int[100];
		int j=0;
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

		String str = reader.readLine();
		String[] processed = str.split(" ",0);
		//for(int i= 0 ; i <processed.length ; i++)System.out.println(processed[i]);
		for(int i= 0 ; i <processed.length ; i++)
		    {
			if(processed[i].equals("+"))//equals("")はダブルクオーテーション" "の見た目と変数.equals(" ")の変数の中身が一致すればtrue、一致しなければfalse。半角全角とかが違っても見た目同じならtrue。
			    {
				//System.out.println("test");
				//System.out.println(stack[j-1]+" "+stack[j]);
				stack[j-2] = stack[j-2]+stack[j-1];
				/*System.out.println(stack[j]);
				System.out.println(stack[j-1]);
				System.out.println(stack[j+1]);*/
				j--;
			    }
			else if(processed[i].equals("-"))
			    {
				
				stack[j-2] = stack[j-2]-stack[j-1];
				j--;
			    }
			else if(processed[i].equals("*"))
			    {
				stack[j-2] = stack[j-2] * stack[j-1];
				j--;
			    }
			else if(processed[i].equals("/"))
			    {
				stack[j-2] = stack[j-2]/stack[j-1];
				j--;
			    }
			else
			    {
				stack[j] = Integer.parseInt(processed[i]);
				//System.out.println("stack["+j+"]="+stack[j]);
				j++;
				//for(int k = 0 ; k < j ; k++)System.out.println("stack["+k+"]="+stack[k]);
				//System.out.println("j = "+j);
				//System.out.println("");
			    }
		    }
		//for(int i = 0 ; i< processed.length ; i++)System.out.print(processed[i]+" ");

		//for(int k = 0 ; k < j ; k++)System.out.println("stack["+k+"]="+stack[k]);
		System.out.println(stack[0]);
		    
	    }
	catch(IOException e)
	    {
		System.out.println(e);
	    }
    }
    
}



Measured memory_bytes: 24196
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define _ << " _ " <<
#define TRACE(x) cerr << #x << " = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
//#define debug
//#define TRACE(x)

using namespace std;

typedef long long llint;

int main(void) {
  int n, cnt = 0;
  scanf("%d",&n);
  REP(i, n) {
    int x;
    scanf("%d",&x);
    if (x % 2) cnt ^= 1;
  }
  printf(cnt ? "NO\n" : "YES\n");
  return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    s: Chars
    }
    let n = s.len();
    for i in 0..n {
        print!("{}", s[i]);
    }
    if s[n - 1] == 's' {
        print!("es");
    } else {
        print!("s");
    }
}



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

using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define vll vector<ll> 
#define vpll vector<pair<ll,ll>>
#define tc ll t=0;cin>>t;while(t--)
#define pb push_back
#define pop pop_back
#define all(x) (x).begin(),(x).end()
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define max *max_element
#define min *min_element
#define f first
#define s second
#define vli vll::iterator 
#define mp make_pair
#define max_val 99999999
#define min_val -99999999
#define mod 1000000007

int main()
{
    IOS
    #ifdef LOCAL
            freopen("C:\\Users\\Just Coding Things\\Codeforces\\input.txt","r",stdin);
            freopen("C:\\Users\\Just Coding Things\\Codeforces\\output.txt","w",stdout);
        #endif
    ll n,i,cnt;
    cin>>n;
    vll v(n-1),u(n),x;
    for(i=0;i<n-1;i++)
    {
        cin>>cnt;
        u[cnt-1]++;
    }
    
    
    
    
    for(i=0;i<n;i++)
    {
        cout<<u[i]<<"\n";
    }
    cout<<endl;
    return 0;
}

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

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10
#define M 100000007
#define N 100000

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

char str[N+1];
int dp1[N+1], dp2[N+1];

int main(){
  dp1[1] = 1; dp1[2] = 2; dp1[3] = 4; dp1[4] = 8; dp1[5] = 16;
  REP(i, 6, N+1){
    dp1[i] = 1;
    REP(j, 1, 6) dp1[i] = (dp1[i] + dp1[i-j])%M;
  }

  dp2[1] = 1; dp2[2] = 2; dp2[3] = 4;
  REP(i, 4, N+2){
    dp2[i] = 1;
   REP(j, 1, 4) dp2[i] = (dp2[i] + dp2[i-j])%M;
  }

  while(scanf("%s", str) && str[0] != '#'){
    int c = 0;
    ll res = 1;
    char now = str[0];
    rep(i, strlen(str)){
      if(str[i] == now) c++;
      else{
	//	printf("%d\n", c);
	if(now == '1' || now == '2' || now == '3' || now == '4' || now == '5' || now == '6' || 
	   now == '7' || now == '9') res = (res * dp1[c])%M;
	else res = (res * dp2[c])%M;
	c = 1;
	now = str[i];
      }
    }
    //    printf("%d\n", c);
    if(now == '8' || now == '0') res = (res * dp2[c])%M;
    else res = (res * dp1[c])%M;

    printf("%lld\n", res);
  }
  return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n;
    cin >> n;
    double a = 0;
    for(int i = 1; i <= n; ++i) {
        if(i % 2 == 1) a += 1;

    }

    printf("%.10lf\n", a / (double)n);
    return 0;
}



Measured memory_bytes: 256
from collections import defaultdict
n=int(input())
d=defaultdict(int)

def factorization(m):
    temp = m
    f=True
    for i in range(2, int(-(-n**0.5//1))+1):
        t=str(temp)
        if temp%i==0:
            f=False
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            d[i]=cnt
    if temp!=1:
        d[temp]=1

    return f
if n==1:
    print(0)
elif factorization(n):
    print(1)
else :
    count=0
    for key in d.keys():
        l=d[key]
        i=1
        while l>=i:
            l-=i
            i+=1
            count+=1
    print(count)

Measured memory_bytes: 68832
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,r=-1;
    string s;
    map<string,int>m;
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>s;
        m[s]++;
    }
    for(auto & it:m)
        r=max(r,it.second);
    for(auto & it: m)
    {
        if(it.second==r)
            cout<<it.first<<endl;
    }
}


Measured memory_bytes: 19124
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {

	COMinit();

	ll N, A, B, K;
	cin >> N >> A >> B >> K;

	ll ans = 0;

	rep(i, N + 1) {
		if ((K - i * A) % B != 0) { continue; }

		ll j = (K - i * A) / B;

		ll X = COM(N, i)*COM(N, j) % MOD;
		ans = (ans + X) % MOD;
	}
	cout << ans;
	
	system("PAUSE");

}





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

int main(){
	int x,y;
	cin>>x>>y;
	
	if(y%2!=0){
		cout<<"No"<<endl;
	}
	else if(y<2*x){
		cout<<"No"<<endl;
	}
	else if(y>4*x){
		cout<<"No"<<endl;
	}
	else{
		cout<<"Yes"<<endl;
	}
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
#define bit(n) (1ll<<(n))


const ll MAXD = 40;

void mainsolve(){

	ll n,k;
	cin >> n >> k;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];

	vector<vector<ll>> dp(MAXD+5,vector<ll>(2,-1)); // max(f(x))

	// 最初のk,a[i]のビットは確実に0
	dp[0][0] = 0;
	rep(i,MAXD){
		ll mask = 1ll<<(MAXD-1-i); // MAXD-2 -> 0
		ll flugnum = 0;
		rep(j,n) if(mask & a[j]) flugnum++;
		ll score0 = mask * flugnum; // 0を選んだ場合のscore
		ll score1 = mask * (n - flugnum); // 1を選んだ場合のscore

		// 1 -> 1
		if(dp[i][1] != -1) dp[i+1][1] = max(dp[i+1][1], dp[i][1] + max(score0, score1));

		// 0 -> 1
		if((k & mask) && dp[i][0] != -1) dp[i+1][1] = max(dp[i+1][1], dp[i][0] + score0);

		// 0 -> 0
		if(dp[i][0] != -1){
			if(k & mask) dp[i+1][0] = max(dp[i+1][0], dp[i][0] + score1); // kが1
			else dp[i+1][0] = max(dp[i+1][0], dp[i][0] + score0); // kが0
		}
		
	}

	cout << max(dp[MAXD][0], dp[MAXD][1]) << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 1024
sx, sy, tx, ty = map(int , input().split())
ans = ""

# 往路1:x
ans += (tx - sx) * "R"
# 往路1:y
ans += (ty - sy) * "U"
# 復路1:x
ans += (tx - sx) * "L"
# 復路1:y
ans += (ty -sy) * "D"

# 往路2:x
ans += "D"
ans += ((tx - sx)+1) * "R"

# 往路2:y
ans += ((ty - sy)+1) * "U"
ans += "L"

#　復路2:x
ans += "U"
ans += ((tx - sx)+1) * "L"

#復路2:y
ans += ((ty -sy)+1) * "D"
ans += "R"

print(ans)

Measured memory_bytes: 3064
#!/usr/bin/env python3
import collections
N = int(input())
V = list(map(int, input().split()))

V1 = V[::2]
V2 = V[1::2]


C1 = collections.Counter(V1)
C2 = collections.Counter(V2)

C1_s = C1.most_common()
C2_s = C2.most_common()

max1 = C1_s[0][1]
index1 = C1_s[0][0]

max2 = C2_s[0][1]
index2 = C2_s[0][0]

max1_2 = 0
max2_2 = 0
if len(C1_s) > 1:
    max1_2 = C1_s[1][1]

if len(C2_s) > 1:
    max2_2 = C2_s[1][1]


nokori1 = len(V1) - max1
nokori2 = len(V2) - max2

nokori1_2 = len(V1) - max1_2
nokori2_2 = len(V2) - max2_2

ans = 0
if index1 == index2:
    ans = min(nokori1_2 + nokori2, nokori1 + nokori2_2)
else:
    ans = nokori1 + nokori2
print(ans)


Measured memory_bytes: 21952
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
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;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
char s[maxn];

int main()
{
    //freopen("D:\\code\\text\\input.txt","r",stdin);
    //freopen("D:\\code\\text\\output.txt","w",stdout);
    scanf("%s", s + 1);
    int isok = 0;
    repd(i, 2, 3)
    {
        if (s[i] != s[i - 1])
        {
            isok = 1;
        }
    }
    if (isok)
    {
        printf("Yes\n");
    } else
    {
        printf("No\n");
    }

    return 0;
}




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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	double PI = acos(-1);
	double r; cin >> r;
	printf("%.10f\n", 2 * r * PI);
	return 0;
}

Measured memory_bytes: 3708
fun main() {
    val n = readInt()
    val a = readInts()

    fun gcd(a: Int, b: Int): Int {
        if (b == 0) return a
        return gcd(b, a % b)
    }

    val g = a.reduce { acc, i -> gcd(acc, i) }
    val maxN = 1000000
    val isPrime = BooleanArray(maxN + 1) { true }
    val nums = a.toMutableSet()
    if (1 in nums) nums.remove(1)

    if (g != 1) println("not coprime")
    else {
        var pairwise = true
        for (i in 2..maxN) {
            var howMany = 0
            if (isPrime[i]) {
                for (j in i..maxN step i) {
                    isPrime[j] = false
                    if (j in nums) howMany++
                }
            }
            if (howMany > 1) {
                pairwise = false
                break
            }
        }
        println(if (pairwise) "pairwise coprime" else "setwise coprime")
    }
}

// Input Reader
private fun readLn() = readLine()!!

private fun readStrings() = readLn().trim().split(" ")
private fun readInt() = readLn().toInt()
private fun readInts() = readStrings().map { it.toInt() }


Measured memory_bytes: 191712
import java.util.HashMap;
import java.util.Scanner;

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

		while (sc.hasNextLine() == true) {
			String line = sc.nextLine();
			String[] nico = line.split(" ");

			int p = Integer.parseInt(nico[0]) * 10;
			int q = Integer.parseInt(nico[1]);
			
			HashMap<Integer, Integer> pmap = new HashMap<Integer, Integer>();
			
			int index = 0;
			String ans = "";
			while (p != 0) {
				int div = p / q;
				
				if (pmap.containsKey(p) == true) {
					int lim = ans.length();
					ans = ans + "\n";
					
					for (int i = 0; i < pmap.get(p); i++) {
						ans = ans + " ";
					}
					for (int i = 0; i < (lim - pmap.get(p)); i++) {
						ans = ans + "^";
					}
					break;
				}
				
				pmap.put(p, index);
				ans = ans + div;
				index++;

				p = (p - div * q) * 10;
			}

			System.out.println(ans);
		}
	}
}

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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    int n;cin >> n;
    vector<int> a(n);rep(i,n)cin >> a[i];
    sort(all(a), greater<int>());
    priority_queue<P> q;
    ll comfort = 0;
    rep(i,n)
    {
        if(i==0)
        {
            q.push(P(a[i],a[i]));
            continue;
        }
        else
        {
            P temp = q.top();
            comfort+= (ll)(q.top().first);
            q.pop();
            q.push(P(a[i], temp.first));
            q.push(P(a[i], temp.second));
        }
        
    }
    cout << comfort << endl;

}

Measured memory_bytes: 6140
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x,y; cin >> x >> y;
    cout << (y%2== 0 && y - 2*x >= 0 && 4*x-y >= 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vi H(N);
  rep(i,N) {
    cin >> H[i];
  }
  H[0]--;
  srep(i,1,N) {
    if(H[i-1]<H[i]) {
      H[i]--;
    }
    if(H[i-1]>H[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef pair<string,string> P;
int bnf();
set<P> used;
map<char,int> M;
string S;
int idx,valid;
char ch[8]={'0','1','+','-','*','(',')','='};
int ord[8];
  
bool check(string a){//???????????????????°????¨????????????????????????¢????
  int par=0;
  for(char s:a){
    par += (s == '(') - (s == ')');
    if(s == '=') return 0;
    if(par < 0) return 0;
  }
  return par==0;
}
  
int getNum(){ //????????????????°????????????
  int res = 0;
  if(S[idx] == '0' && isdigit(S[idx+1])) valid  = 0;
  while(isdigit(S[idx]))res = res*2 + S[idx++]-'0';
  return res;
}
  
int cal(){
  char ch = S[idx];
  int res = 0,sign = 1;
  if(ch=='+'||ch=='*'||ch==')'){ valid = 0;return 0;}
  
  while(S[idx] == '-') idx++, sign *= -1;
  ch = S[idx];
  
  if(isdigit(ch)){
    res = sign*getNum();
    if(S[idx] == '*'){idx++; return res * cal();}
    return res;
  }
  else if(ch == '(') {
    idx++;res = sign*bnf();idx++;
    return res;
  }
  
  valid = 0;
  return 0;
}
  
int bnf(){
  int res = cal();
  while(idx<(int)S.size()){
    if(valid == 0) return -1;
    char ch = S[idx];
    if(ch == '('){valid = 0;}
    else if(ch == '*'){idx++;res *= cal();}
    else if(ch == '+'){idx++;res += cal();}
    else if(ch == '-'){idx++;res -= cal();}
    else if(ch != ')') valid = 0;
    else break;
  }
  if(valid ==0) return -1;
  return res;
}
  
string mkS(string a){
  string res;
  for(char s:a){
    if(isalpha(s))res += ch[ ord[ M[s] ] ];
    else res += s;
  }
  return res;
}
  
int calc(string A,string B){
  if(A.size()==0 || B.size()==0) return 0;
  if(used.count(P(A,B)))return 0;
  used.insert(P(A,B));
  valid = check(A) && check(B);
  idx = 0;
  S = A;
  int ra = bnf();
  idx = 0;
  S = B;
  int rb = bnf();
  //if(valid)cout<<A<<"="<<B<<" "<<valid<<" "<<ra<<" "<<rb<<endl;
  return ra == rb && valid;
}
  
int calc(string s){
  s = mkS(s);
  for(int i=0;i<(int)s.size();i++)
    if(s[i]=='=') return calc(s.substr(0,i),s.substr(i+1,s.size()-i-1));
  return 0;
}
  
int dfs(int num,string &s){
  if(num == 8) return calc(s);
    
  int res = 0;
  for(int i=0;i<8;i++){
    if(ord[i] != -1)continue;
    ord[i] = num;
    res +=dfs(num+1,s);
    ord[i] = -1;
  }
  return res;
}
  
  
int main(){
  string str;
  cin>>str;
  if(str.size()<3)cout<<0<<endl,exit(0);
  
  map<char,int> cnt;
  for(int i=0;i<(int)str.size();i++)if(isalpha(str[i]))cnt[str[i]]++;
  if(cnt.size()>8)cout<<0<<endl,exit(0);
  
  int c = 0;
  for(pair<char,int> p:cnt)if(isalpha(p.first)) M[p.first] = c++;
    
  memset(ord,-1,sizeof(ord));  
  cout<<dfs(0,str)<<endl;
  return 0;
}

Measured memory_bytes: 10004
($N,$M)=glob<>;
push@A,[glob]for<>;
$X=$N;
for(1..$M-1){
	@c=();
	$x=0;
	for$i(0..$N-1){
		++$j[$i]while$v[$A[$i][$j[$i]]];
		if(++$c[$A[$i][$j[$i]]]>$x){$x=$c[$J=$A[$i][$j[$i]]]}
	}
	$v[$J]=1;
	if($x<$X){$X=$x}
}
print$X,$/


Measured memory_bytes: 10112
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i= a ; i < b ; ++i)
#define rep(i,n) fo(i,0,n)
#define pln(n) printf("%lld\n",n)
#define sll(n) scanf("%lld",&n)
#define ss(n) scanf("%s",n)
#define vi vector < int >
#define pii pair < int , int >
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define dbg(x) { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define dbg3(x,y,z) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) <<" , "<< #z <<": "<<(z)<<endl; }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<int>
#define tr(c, it) \
for(decltype(c.begin()) it = c.begin(); it!= c.end(); it++)
#define pis pair<int,string>
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c),x) != c.end())
using namespace std;
int main(){
    int n, W;
    cin >> n >> W;
    long long k[n][W+1];
    for(int i = 0; i < n; i++){
    	k[i][0] = 0;
    }
    for(int i = 0; i < n; i++){
    	long long wt, val;
    	cin >> wt >> val;
    	for(int j = 1; j <= W; j++){
    		if(i == 0){
    			if(j >= wt)k[i][j] = val;
    			else k[i][j] = 0;
    			continue;
    		}
    		if(j >= wt)k[i][j] = max(k[i-1][j], k[i-1][j - wt] + val);
    		else k[i][j] = k[i-1][j];
    	}
    }
    
    cout << k[n-1][W] << endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  int ans = 0;
  for(int i=0; i<N-1; i++){
    if(vec.at(i) == i+1){
      swap(vec.at(i),vec.at(i+1));
      ans++;
    }
  }
  if(vec.at(N-1) == N){
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, a[N];

int main() {
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    int up = 1, down = 1, ans = 1;
    for(int i = 1; i < n; i++) {
        if(a[i] == a[i-1]) continue;
        if(a[i] < a[i-1]) {
            up = 0;
            if(!down) {
                ans++;
                up = down = 1;
            }
        }else {
            down = 0;
            if(!up) {
                ans++;
                up = down = 1;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 640
//https://atcoder.jp/contests/abc146/tasks/abc146_e
//https://img.atcoder.jp/abc146/editorial.pdf
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e6 + 3;
int n, k, a[N];

void init() {
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
}

int s[N];

int get(int x) {
	int ret = x % k;
	if (ret < 0) {
		ret += k;
	}
	return ret;
}

int v[N];

void solve() {
	s[0] = a[0] % k;
	for (int i = 1; i < n; i++) {
		s[i] = (s[i - 1] + a[i]) % k;
	}
	for (int i = 0; i < n; i++) {
		v[i] = get(s[i] - i - 1);
	}
	ll ans = 0;
	map<int, int> ma;
	for (int i = 0; i < n; i++) {
		ans += ma[v[i]];
		if (i >= k - 1) {
			//cerr << i << " " << v[i] << "\n";
			//cerr << ans << "\n";
			ma[v[i - k + 1]]--;
		} else if (s[i] % k == i + 1) {
			ans++;
		}
		ma[v[i]]++;
	}
	printf("%lld\n", ans);
}

int main() {
	init();
	solve();
	return 0;
}

Measured memory_bytes: 18560
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
typedef pair<int, int> pii;
int main(){
    int n; cin >> n;
    vector<int> a(n-1), b(n-1);
    vector<vector<int>> g(n);
    vector<pii> ep;
    rep(i,n-1){
        cin >> a[i] >> b[i]; a[i]--; b[i]--;
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
        ep.emplace_back(a[i],b[i]);
    }
    int k = 0;
    map<pii, int> m;
    vector<int> col(n);
    vector<bool> used(n);
    queue<int> que;
    used[0] = true;
    que.push(0);
    while(!que.empty()){
        int v = que.front(); que.pop();
        if(k < (int)g[v].size()) k = g[v].size();
        int c = 1;
        for(int u : g[v]){
            if(used[u]) continue;
            if(c == col[v]) c++;
            col[u] = m[make_pair(u,v)] = m[make_pair(v,u)] = c++;
            used[u] = true;
            que.push(u);
        }
    }
    cout << k << endl;
    for(auto w : ep) cout << m[w] << endl;
}

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

struct StExpr
{
  StExpr() : m_nPerson(0), m_nAttr(0) { }

  int m_nPerson;
  int m_nAttr;
};

void fnInput(vector<vector<StExpr>>& rvvoExpr)
{
  int nPersonSiz;
  cin >> nPersonSiz;
  rvvoExpr.resize(nPersonSiz + 1);

  for (int i = 1; i < rvvoExpr.size(); i++)
  {
    int nAttrSiz;
    cin >> nAttrSiz;
    rvvoExpr[i].resize(nAttrSiz);

    for (int j = 0; j < rvvoExpr[i].size(); j++)
      cin >> rvvoExpr[i][j].m_nPerson >> rvvoExpr[i][j].m_nAttr;
  }
}
  
int fnHonestCheck(const vector<vector<StExpr>>& cnrvvoExpr, 
                  const vector<int>& cnrvnHonest, int nMan)
{
  if (cnrvnHonest[nMan])               
  {
    for (int j = 0; j < cnrvvoExpr[nMan].size(); j++)
      if (cnrvvoExpr[nMan][j].m_nAttr  !=
          cnrvnHonest[ cnrvvoExpr[nMan][j].m_nPerson ] )
        return 0;

    return 1;
  }
  else                                 
  {
    for (int j = 0; j < cnrvvoExpr[nMan].size(); j++)
      if (cnrvvoExpr[nMan][j].m_nAttr  !=
          cnrvnHonest[ cnrvvoExpr[nMan][j].m_nPerson ] )
        return 1;

    return 0;
  }
}
  
int fnMaxHonestGet(const vector<vector<StExpr>>& cnrvvoExpr)
{
  vector<int> vnHonest(cnrvvoExpr.size());
  int nMaxHonestCnt = 0;
  
  for (int n = 1; n < ( 1 << (cnrvvoExpr.size() - 1) ); n++)
  {
    int nHonestCnt = 0;

    for (int i = 0; i < cnrvvoExpr.size() - 1; i++)
      if (n & (1 << i))
      {
        vnHonest[i + 1] = 1;           
        nHonestCnt++;
      }
      else
        vnHonest[i + 1] = 0;          

    bool bTrue = true;
    for (int nMan = 1; nMan < vnHonest.size(); nMan++)
      if (!fnHonestCheck(cnrvvoExpr, vnHonest, nMan))
      {
        bTrue = false;
        break;
      }

    if (bTrue) nMaxHonestCnt = max(nMaxHonestCnt, nHonestCnt);
  }
  return nMaxHonestCnt;
}
  
int main()
{
  vector<vector<StExpr>> vvoExpr;

  fnInput(vvoExpr);
  cout << fnMaxHonestGet(vvoExpr) << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    int a,b,ans;
    char op;
    
    while(1){
        
        cin >> a >> op >> b;
        
        if (op == '?') break;
        
        if (op == '+') {
            
            ans = a + b;
            
        } else if (op == '-') {
            
            ans = a - b;
            
        } else if (op == '*') {
            
            ans = a * b;
            
        } else {
            
        ans = a / b;
        
        }
            
            
        
        cout << ans << endl;
        
    }
    
    return 0;
    
    
}


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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}
int main(void){
    int n,x;
    cin>>n>>x;
    vector<ll> a(n);
    ll mindist=INF;
    rep(i,0,n){
        cin>>a[i];
        mindist=min(mindist,abs(x-a[i]));
    }

    for(int i=mindist;i>0;i--){
        bool ok;
        rep(j,0,n){
            if(abs(x-a[j])%i==0)ok=true;
            else {ok=false;break;}
        }
        if(ok){
            cout<<i<<endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 1024
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
# arrA = list(map(int,input().split()))
arrA = np.array(input().split(),dtype=np.int64)

arrA = arrA.cumsum()
high = arrA[-1]
ans = 2020202020*200000+2

for i in arrA[:-1]:
    num = abs(high - i*2)
    ans = min(ans,num)

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


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

int main(){
	int Nx;
	cin >> Nx;
    int Ny;
    cin >> Ny;
	vector<string> X(Nx);

	for(int i=0;i < Nx; i++){
		cin >> X.at(i);
	}
    
  	for(int j=0;j < Ny+2; j++){
     	cout << "#"; 
    }
  	cout << ""<<endl;
  
  	for(int k=0; k< Nx; k++){
     	cout << "#" + X.at(k) + "#" <<endl; 
    }
  	  	
  	for(int j=0;j < Ny+2; j++){
     	cout << "#"; 
    }
}

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

using namespace std;

const int MX = 200002;

template<typename T> void cmax(T &x, const T &y)
{
	if(y > x) x = y;
}

template<typename T> void read(T &x)
{
	x = 0;
	char c = getchar();
	bool f = 0;
	while(!isdigit(c) && c!='-') c = getchar();
	if(c == '-') f = 1, c = getchar();
	while(isdigit(c)) x = x*10+c-'0', c = getchar();
	if(f) x = -x;
}

int deg[MX];
int fst[MX], nxt[MX], v[MX], lnum;
int n, m;

void addeg(int nu, int nv)
{
	nxt[++lnum] = fst[nu];
	fst[nu] = lnum;
	v[lnum] = nv;
	deg[nv]++;
}

void input()
{
	read(n), read(m);
	for(int i=1; i<=m; i++)
	{
		int nu, nv;
		read(nu), read(nv);
		addeg(nu, nv);
		addeg(nv, nu);
	}
}

void out_no()
{
	puts("No");
	exit(0);
}

void out_yes()
{
	puts("Yes");
	exit(0);
}

void check(int x, int y)
{
	queue<int> que;
	static int way[MX];
	memset(way, 0, sizeof(way));
	que.push(x);
	way[x] = 1;
	while(!que.empty())
	{
		int a = que.front();
		que.pop();
		if(a == y) continue;
		for(int i=fst[a]; i; i=nxt[i])
		{
			int b = v[i];
			if(!way[b]) que.push(b);
			way[b] += way[a];
		}
	}
	if(way[y] == 2) out_yes();
	else if(way[y] == 4) out_no();
	else assert(0);
}

void work()
{
	for(int i=1; i<=n; i++) if(deg[i]&1) out_no();
	for(int i=1; i<=n; i++) if(deg[i] >= 6) out_yes();
	vector<int> v4;
	for(int i=1; i<=n; i++) if(deg[i] == 4) v4.push_back(i);
	if(v4.size() <= 1) out_no();
	else if(v4.size() == 2) check(v4[0], v4[1]);
	else out_yes();
}

int main()
{
	input();
	work();
	return 0;
}

Measured memory_bytes: 3328
// AOJ 2446: Enumeration
// 2017.11.26 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

long long a[22];
int p[22];

long long gcd(long long a, long long b)
{
	long long r;
	while (b != 0) r = a % b, a = b, b = r;
	return a;
}

int main()
{
	int n, i, j, f, lim;
	long long m, t;
	double ans, pp;

	scanf("%d%lld", &n, &m);
	for (i = 0; i < n; i++) scanf("%lld", a+i);
	for (i = 0; i < n; i++) scanf("%d", p+i);
	
	ans = 0;
	for (lim = 1 << n, i = 1; i < lim; i++) {
		f = 0, pp = 1;
		for (t = 1, j = 0; j < n; j++) if ((i >> j) & 1) {
			f++, pp *= p[j] / 100.0;
			t /= gcd(t, a[j]);
			if (t > (1LL<<62)/a[j]) { t = -1; break; }
			t *= a[j];
		}
		if (t > 0) {
			if (f & 1) ans += pp * (m / t);
			else       ans -= pp * (m / t);
		}
	}
	printf("%.10lf\n", ans);
	return 0;
}

Measured memory_bytes: 1812
import java.util.Scanner;

public class Main {
    public static int gcd(int a, int b){
        if(a%b != 0) b = gcd(b, a%b);
        return b;
    }

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        System.out.println(gcd(a, b));
        scanner.close();
    }
}


Measured memory_bytes: 26336
#include <iostream>
#include <map>
using namespace std;
long long n,a[200005],sum[200005],ans;
map <long long,long long> mp;
int main()
{
	cin>>n;
	for (int i=1;i<=n;++i) cin>>a[i],sum[i]=sum[i-1]+a[i],mp[sum[i]]++;
	for (auto &x:mp) ans+=(x.second-1)*x.second/2+x.second*(x.first==0);
	cout<<ans<<endl;
	return 0;
}

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

public class Main {

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

        int h=gi();
        int a=gi();
        
	    
	    
        System.out.println((int)Math.ceil((double)h/(double)a));
//        if (xo>w || yo>h) {
//        	System.out.print(0);
//        }else {
//        	System.out.print((h-yo)*(w-xo));
//        }


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
	
	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

typedef long long ll;
ll L, R;
const ll BASE = 2019;
ll Res = 1ll << 60;

int main() {
  cin >> L >> R;
  if (L <= R / BASE * BASE)
    cout << 0 << endl;
  else {
    for (ll i = L; i <= R; ++i) {
      for (ll j = i + 1; j <= R; ++j) {
        Res = min(Res, i * j % BASE);
      }
    }
    cout << Res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, cnt;
ll M = 1e9, A[int(1e5)], sum;

int main(){
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", A + i);
    if (A[i] < 0) cnt++;
    sum += abs(A[i]);
    M = min(M, abs(A[i]));
  }

  if (cnt % 2 == 0){
    printf("%lld\n", sum);
  }else{
    printf("%lld\n", sum - 2 * M);
  }

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N,M;
  string S;
  cin >> N >> M >> S;
  reverse(S.begin(),S.end());
  vi s(N+2);
  rep(i,N+1) s[i+1]=s[i]+(int)(S[i]-'0');
  
  int now=0;
  vi ans;
  bool flag=true;
  while(now<N) {
    if(now+M>=N) {
      ans.push_back(N-now);
      break;
    }
    if(S[now+M]==0) {
      ans.push_back(M);
      continue;
    }
    int l=now-1,r=now+M;
    while(r-l>1) {
      int m=(l+r)/2;
      if(s[now+M+1]-s[m+1]==now+M-m) r=m;
      else l=m;
    }
    if(r==now) {
      flag=false;
      break;
    }
    ans.push_back(r-now);
    now=r;
  }
  
  if(flag) {
    reverse(ans.begin(),ans.end());
    for(int x:ans) cout << x << ' ';
    cout << endl;
  }
  else cout << -1 << endl;
}

Measured memory_bytes: 4248
using System;
using System.Collections.Generic;

class Program
{
    #region library
    static int n = 0;
    static int m = 0;
    static int r = 0;
    static int c = 0;
    static int x = 0;
    static int y = 0;
    static int[] arr;
    static string s = "";
    static string[] ss;
    static string alpha = "abcdefghijklmnopqrstuvwxyz";
    static long sum = 0;
    static long cnt = 0;
    static long max = -1;
    static long min = 2147483647;
    static bool flg = false;
    static bool flg2 = false;
    static char[,] map;
    static int[,] imap;
    static string rl()
    {
        return Console.ReadLine();
    }
    static string[] rls()
    {
        return Console.ReadLine().Split();
    }
    static void wl(object obj = null)
    {
        Console.WriteLine(obj);
    }
    static void w(object obj)
    {
        Console.Write(obj);
    }
    static int Int(string s)
    {
        return int.Parse(s);
    }
    static long Max(long a, long b)
    {
        return Math.Max(a, b);
    }
    static long Min(long a, long b)
    {
        return Math.Min(a, b);
    }
    static long Abs(long a)
    {
        return Math.Abs(a);
    }
    static void yes()
    {
        wl("YES");
    }
    static void no()
    {
        wl("NO");
    }
    static void Sum()
    {
        wl(sum);
    }
    static void Cnt()
    {
        wl(cnt);
    }
    static void setmap(char def = '@')
    {
        if (r == 0 && c == 0)
        {
            ss = rls();
            r = Int(ss[0]);
            c = Int(ss[1]);
        }
        map = new char[r, c];
        for (int i = 0; i < r; i++)
        {
            if (def == '@') s = rl();
            for (int j = 0; j < c; j++)
            {
                map[i, j] = (def == '@') ? s[j] : def;
            }
        }
    }
    static void setimap(int def = -1)
    {
        if (r == 0 && c == 0)
        {
            ss = rls();
            r = Int(ss[0]);
            c = Int(ss[1]);
        }
        imap = new int[r, c];
        for (int i = 0; i < r; i++)
        {
            if (def == -1) s = rl();
            for (int j = 0; j < c; j++)
            {
                imap[i, j] = (def == -1) ? Int(s[j].ToString()) : def;
            }
        }
    }
    #endregion

    static void Main(string[] args)
    {
        s = rl();
        int a = 0;
        for (int i = 0; i < 4; i++)
        {
            switch (s[i])
            {
                case '+':
                    a += 1;
                    break;
                case '-':
                    a -= 1;
                    break;
            }
        }
        wl(a);
    }
}



Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define ls  (n<<1)
#define rs  (ls|1)
using namespace std;

const int N=300010;
struct point{int x,y;}a[N];
int w,h,n,ans,st1[N],st2[N],top1,top2,t[4*N],tag[4*N];

bool cmp(point x,point y){return x.x<y.x;}

void build(int n,int l,int r)
{
	if (l==r)  t[n]=-a[l-1].x;
	else
		{
			int mid=(l+r)>>1;
			build(ls,l,mid),build(rs,mid+1,r);
			t[n]=max(t[ls],t[rs]);
		}
}

void modify(int n,int l,int r,int L,int R,int k)
{
	if ((L<=l)&&(r<=R))  t[n]+=k,tag[n]+=k;
	else
		{
			int mid=(l+r)>>1;
			if (L<=mid)  modify(ls,l,mid,L,R,k);
			if (mid<R)  modify(rs,mid+1,r,L,R,k);
			t[n]=max(t[ls],t[rs])+tag[n];
		}
}

void solve()
{
	memset(t,0,sizeof(t)),memset(tag,0,sizeof(tag)),top1=top2=0;
	sort(a+1,a+n+1,cmp);
	if (a[n].x!=w)  a[++n]=(point){w,-1};
	build(1,1,n);
	for (int i=1; i<=n; i++)
		if (a[i].y>h/2)
			{
				modify(1,1,n,i,i,h);
				ans=max(ans,2*(a[i].x+t[1]));
				modify(1,1,n,st1[top1]+1,i,a[i].y-h);
				while ((top1)&&(a[st1[top1]].y>a[i].y))
					modify(1,1,n,st1[top1-1]+1,st1[top1],a[i].y-a[st1[top1]].y),top1--;
				st1[++top1]=i;
			}else
			{
				modify(1,1,n,i,i,h);
				ans=max(ans,2*(a[i].x+t[1]));
				modify(1,1,n,st2[top2]+1,i,-a[i].y);
				while ((top2)&&(a[st2[top2]].y<a[i].y))
					modify(1,1,n,st2[top2-1]+1,st2[top2],a[st2[top2]].y-a[i].y),top2--;
				st2[++top2]=i;
			}
	n-=(a[n].y<0);
}

void work()
{
	scanf("%d %d %d",&w,&h,&n);
	for (int i=1; i<=n; i++)  scanf("%d %d",&a[i].x,&a[i].y);
	solve();
	for (int i=1; i<=n; i++)  swap(a[i].x,a[i].y);
	swap(w,h);
	solve();
	printf("%d",ans);
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define srt(x) sort((x).begin(), (x).end());
#define rsrt(x) sort((x).rbegin(), (x).rend());
#define deb(x) cout<<#x<<" = "<<(x)<<" (L"<<LINE<<")"<<endl;
#define vdeb(x) {cout<<#x<<" = { "; rep(i, x.size()) cout<<x[i]<<' '; cout <<'}'<<" (L"<<LINE<<")"<<endl;}
using namespace std;
using ll = long long;
using vi = vector<int>;
using vivi = vector<vi>;
using vll = vector<long long>;
using vllvll = vector<vll>;
using vs = vector<string>;
using um = unordered_map<long long, long long>;

int main()
{
    string S;
    cin >> S;
    if (S == "ABC") {
        cout << "ARC" << endl;
    }
    else {
        cout << "ABC" << endl;
    }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int a[100000][3];
int main()
{
	int f=1, i, j, n;
	cin >> n;
	for(int  i=1;i<=n;i++)
	{
		cin >> a[i][0]>> a[i][1]>>a[i][2];
		if((a[i][1]+a[i][2])>a[i][0]||a[i][0]%2!=(a[i][1]+a[i][2])%2)
		{
			f=0;	
		}	
	}
	if(f==1)
	{
		cout << "Yes"<< endl;
		return 0;
	}
	else
	{
		cout << "No"<<endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 1408
n, m = [int(item) for item in input().split()]
ab = [[int(item) for item in input().split()] for _ in range(m)]
ab.reverse()

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * n
        self.size = [1] * n

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        return self.size[self.find(x)]

inconv = n*(n-1) // 2 
UF = UnionFind(n)

inconv_list = []
inconv_list.append(inconv)
for a, b in ab:
    if not UF.same_check(a-1, b-1):
        inconv -= UF.get_size(a-1) * UF.get_size(b-1)
        UF.union(a-1, b-1)
    inconv_list.append(inconv)
for item in inconv_list[::-1][1:]:
    print(item)

Measured memory_bytes: 30984