akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;

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

Measured memory_bytes: 3612
#include <cstdio>
#include <vector>
#include <iostream>
#define REP(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  int s = 0;
  REP(i, 5) {
    int v;
    cin >> v;
    s += v;
  }
  cout << 15 - s << endl;

  return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

void solve(){
  ll a,b,h;
  cin >> a>> b >> h;
  cout << (a+b)*h/2 << endl;
}

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


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

def solve():
    from collections import defaultdict

    n, c = map(int, input().split())
    dt = [[int(e) for e in input().split()] for _ in range(c)]
    ct = [[int(e) for e in input().split()] for _ in range(n)]

    cd0 = defaultdict(int)
    cd1 = defaultdict(int)
    cd2 = defaultdict(int)
    for i in range(n):
        for j in range(n):
            if (i + 1 + j + 1) % 3 == 0:
                cd0[ct[i][j]] += 1
            if (i + 1 + j + 1) % 3 == 1:
                cd1[ct[i][j]] += 1
            if (i + 1 + j + 1) % 3 == 2:
                cd2[ct[i][j]] += 1

    ans = 500 ** 2 * 1000 * 30
    for c0 in range(1, c + 1):
        base = 0
        for d in cd0:
            if d == c0:
                continue
            base += dt[d - 1][c0 - 1] * cd0[d]
        for c1 in range(1, c + 1):
            if c0 == c1:
                continue
            base2 = 0
            for d in cd1:
                if d == c1:
                    continue
                base2 += dt[d - 1][c1 - 1] * cd1[d]
            base2 += base
            for c2 in range(1, c + 1):
                if c0 == c2 or c1 == c2:
                    continue
                tans = 0
                for d in cd2:
                    if d == c2:
                        continue
                    tans += dt[d - 1][c2 - 1] * cd2[d]
                ans = min(ans, tans + base2)
                
    print(ans)
    
if __name__=="__main__":
    solve()


Measured memory_bytes: 47196
import heapq


def heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap) - 1)


def heappop_max(heap):
    lastelt = heap.pop()
    if heap:
        return_item = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return return_item
    return lastelt


X, Y, Z, K = map(int, input().split())
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
ans = []
heap_queue = [(A[0]+B[0]+C[0], 0, 0, 0)]
arg_hash = {}

for i in range(K):
    maxim, a, b, c = heappop_max(heap_queue)
    print(maxim)
    arg_a = (a+1, b, c)
    arg_b = (a, b + 1, c)
    arg_c = (a, b, c + 1)

    if a + 1 < X and arg_a not in arg_hash:
        heappush_max(heap_queue, (A[a + 1] + B[b] + C[c], a + 1, b, c))
        arg_hash[arg_a] = 1
    if b + 1 < Y and arg_b not in arg_hash:
        heappush_max(heap_queue, (A[a] + B[b+1] + C[c], a, b+1, c))
        arg_hash[arg_b] = 1
    if c + 1 < Z and arg_c not in arg_hash:
        heappush_max(heap_queue, (A[a] + B[b] + C[c+1], a, b, c+1))
        arg_hash[arg_c] = 1


Measured memory_bytes: 4860
#include <bits/stdc++.h>
#define int long long
#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++)
using namespace std;

int n; vector<int> a(20);

bool check(int i, int m){
    if (m == 0) return true;
    else if (i > n) return false;
    else{
        bool res = check(i+1, m) || check(i+1, m-a[i]);
        return res;
    } 
}

signed main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> n;
    rep(i,n) cin >> a[i];
    int q; cin >> q;
    int m;
    rep(i,q){
        cin >> m;
        if (check(0,m)) cout << "yes" << endl;
        else cout << "no" << endl;
    }
    return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set1;
typedef tree<string,null_type,less<string>,rb_tree_tag,tree_order_statistics_node_update> indexed_set2;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main() 
{
	ll n;
	cin>>n;
	map<string,ll> mp;
	REP(i,0,n){
		string s;
		cin>>s;
		mp[s]++;
	}
	cout<<"AC x "<<mp["AC"]<<endl;
	cout<<"WA x "<<mp["WA"]<<endl;
	cout<<"TLE x "<<mp["TLE"]<<endl;
	cout<<"RE x "<<mp["RE"]<<endl;
	return 0;
}

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

using namespace std;

const int MAXN = 1e5 + 5;

int gcd[MAXN], cor[MAXN];

int main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n;
    cin >> n >> cor[0];
    n++;
    for (int i = 1; i < n; i++)
        cin >> cor[i];
    sort(cor, cor + n);
    for (int i = 1; i < n; i++)
        gcd[i - 1] = cor[i] - cor[i - 1];
    int ans = gcd[0];
    for (int i = 0; i < n; i++) {
        ans = __gcd(gcd[i],ans);
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

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


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

    cin >> n;
    cin >> s >> t;

    rep(i, 2*n) cout << (i%2? t[i/2]: s[i/2]);
    cout << endl;
}


Measured memory_bytes: 256
def find(x):#xの親を見つける
  if par[x] < 0:
    return x
  else:
    par[x] = find(par[x])
    return par[x]

def unite(x,y):#要素xとｙを併合させる
  x,y=find(x),find(y)#xとyの親の検索
  if x!=y:#親が異なる場合併合させる
    if x>y:
        x,y=y,x#小さい方をxとする. これにより要素の値が小さいものを優先して木の根とする. 
    par[x]+=par[y] #値を無向木の要素数の和にする.
    par[y]=x #枝側は根の位置を格納

def same(x, y):#要素xと要素yが同じ無向木に所属しているかを判定する
  return find(x) == find(y)#同じ値を持つか否か

def size(x):#要素xが所属する無向木の大きさを返す
  return-par[find(x)]

N, M = map(int, input().split())
par = [-1] * N
def shokika():
  for i in range(N):
    par[i] = -1
    
def main():
  edge = []
  for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edge.append([a, b])
  ans = 0
  for i in range(M):
    shokika()
    for j in range(M):
      if i == j:continue
      else:
        unite(edge[j][0], edge[j][1])
    top =  find(0)
    for j in range(1, N):
      if top != find(j):
        ans += 1
        break
  print(ans)
  
if __name__ == "__main__":
  main()
      
      
    

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define size_of(a) (int)a.size()
#define allof(a) (a).begin(),(a).end()

class BibMatch {
private:
	int V;
	vector< vector< int > > adj;
	vector< int > match;
	vector< bool > used;
	
public:
	BibMatch(int n_) : V(n_), adj(n_, vector< int >()), match(n_, -1), used(n_, 0) {}
	
	void addEdge(int u, int v) {
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	
	bool dfs(int v) {
		used[v] = 1;
		
		for_(i,0,size_of(adj[v])) {
			int u = adj[v][i], w = match[u];
			
			if (w < 0 || (!used[w] && dfs(w))) {
				match[v] = u;
				match[u] = v;
				return 1;
			}
		}
		
		return 0;
	}
	
	int bibMatch() {
		int res = 0;
		fill(allof(match), -1);
		
		for_(v,0,V) {
			if (match[v] < 0) {
				fill(allof(used), 0);
				if (dfs(v)) ++res;
			}
		}
		
		return res;
	}
};

int gcd(int _a, int _b) {
	return _b != 0 ? gcd(_b, _a % _b) : _a;
}

int m, n;

int main() {
	while (cin >> m >> n, m) {
		BibMatch bib(n + m);
		
		vector< int > b(m), r(n);
		for_(i,0,m) cin >> b[i];
		for_(i,0,n) cin >> r[i];
		
		for_(i,0,m) for_(j,0,n) if (gcd(b[i], r[j]) > 1) bib.addEdge(i, j + m);
		
		cout << bib.bibMatch() << endl;
	}
}

Measured memory_bytes: 2712
n = str(input())
chkval = n[-1:]

if (chkval == '2' or chkval == '4' or chkval == '5' or chkval == '7' or chkval == '9'):
    print('hon')
elif (chkval == '0' or chkval == '1' or chkval == '6' or chkval == '8'):
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9044
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  string x;
  cin >> x;

  ll len = x.size();

  stack<ll> s;

  ll ans = 0;
  for (int i = 0; i < len; i++) {
    if (x[i] == 'S') {
      s.push(i);
    } else if(!s.empty()) {
      s.pop();
    } else {
      ans++;
    }
  }

  ans += s.size();

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 1300
#include<iostream>
#include<cstdlib>
#include<stack>
#include<string>
using namespace std;
int main(){
  string s;
  cin>>s;
  stack<int>st;
  st.push(-1); 
  int ans=0,tmp;
  for(int i=0;i<s.size();i++){
    if(s[i]=='1')tmp=1;
    else tmp=0; 
    if(st.top()!=tmp&&st.top()!=-1){
      ans+=2;
      st.pop();
    }else st.push(tmp);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, k;
	cin>>n>>k;
	vector<int> dis;
	for(int i=0;i<k;i++)
	{
		int a;
		cin>>a;
		dis.push_back(a);
	}
	while(true)
	{
		bool ok = true;
		vector<int> dig;
		int pom = n;
		while(pom>0)
		{
			dig.push_back(pom%10);
			pom/=10;
		}
		for(int i = 0;i<dig.size();i++)
		{
			for(int j =0;j<dis.size();j++)
			{
				if(dig[i]==dis[j])
				{
					ok=false;
					break;
				}
				else
					continue;
			}
		}
		if(ok==true)
		{
			cout<<n<<endl;
			return 0;
		}
		else
		n++;
	}
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
#include <cstdio>
#include <cmath>
#include <cstring> 
#include <algorithm>
#include <stack> 
#define ll long long
int l,r,d;
int main()
{
	cin>>l>>r>>d;
	int ans=0;
	for(int i=l/d;d*i<=r;i++)
	{
		if(d*i>=l&&d*i<=r)
		{
			ans++;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
struct {int n, d;} a[2][1000], x;
int main()
{
	string s;
	char t[1025];
	int i=0, j, k=0, l, n[2]={0, 0};
	while (getline(cin, s))
	{
		if (s.empty())
		{
			k++, i=0;
			continue;
		}
		sprintf(t, "%s", s.c_str());
		sscanf(t, "%d,%d", &a[k][i].n, &a[k][i].d);
		i++, n[k]++;
	}
	for (k = 0; k < 2; k++)
		for (i = 0; i < n[k]; i++)
			for (j = 0; j < n[k]; j++)
				if (a[k][i].n < a[k][j].n)
					x = a[k][i], a[k][i] = a[k][j], a[k][j] = x;
	for (i = 0; i < n[0]; i++)
	{
		if (0 < i && i < n[0]-1 && a[0][i-1].n == a[0][i].n)
			i++;
		else if (i > n[0]-1)
			break;
		for (j = k = 0; j < n[0]; j++)
			if (a[0][i].n == a[0][j].n)
				k++;
		for (j = l = 0; j < n[1]; j++)
			if (a[0][i].n == a[1][j].n)
				l++;
		if (k > 0 && l > 0)
			cout << a[0][i].n << " " << k+l << endl;
	}
}

Measured memory_bytes: 0
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define MAXN 200005
#define P 1000000007
#define INF 0x3f3f3f3f
#define rint register int
#define LL long long
#define LD long double
using namespace std;

int n, c[MAXN], f[MAXN], last[MAXN];

inline int add(int x, int y) {return x+y>=P?x+y-P:x+y;}
inline int sub(int x, int y) {return x>=y?x-y:x-y+P;}

int main()
{
    scanf("%d", &n);
    for(rint i=1; i<=n; ++i) scanf("%d", &c[i]);
    f[0]=1;
    for(rint i=1; i<=n; ++i)
    {
        if(last[c[i]]!=0 && last[c[i]]!=i-1) f[i]=add(f[last[c[i]]], f[i]);
        f[i]=add(f[i-1], f[i]);
        last[c[i]]=i;
    }
    printf("%d\n", f[n]);
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <set>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#define INF 10000005

typedef long long ll;

using namespace std;

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

    if(a == b) cout << 'H';
    else cout << 'D';
    cout << "\n";
}

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

int main(){
  int n,m,p;
  int x;
  int sum;
  int winner;
  
  while(1){
    
    cin >> n >> m >> p;

    if(n+m+p == 0)break;
    sum=0;

    for(int i=0;i < n;i++){
      cin >> x;
      sum += x;
      if(i == m-1){
	winner = x;
      }
    }

    if(winner == 0){
      printf("0\n");
    }
    else{
      printf("%d\n",sum*(100-p)/winner);
    }
  }
  return 0;
}

    



Measured memory_bytes: 3052
#include<bits/stdc++.h>
#define rep(i,n,k) for(long long int i=k; i<n; ++i)
#define drep(i,n,k) for(long long int i=n-1; i>=k; --i)
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<long long int> a(n), b(n-1);
  rep(i,n-1,0) cin >> b[i];
  a[0] = b[0];
  a[n-1] = b[n-2];
  rep(i,n-2,0){
    a[i+1] = min(b[i], b[i+1]);
  }
  long long int ans = 0;
  rep(i,n,0) ans += a[i];
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{
    int A,B;
    cin >> A >> B;
    ve<ve<char>> ans(40,ve<char>(100));
    
    reps(i,20,40) rep(j,100){
        if(i%2==1) ans[i][j] = (j%2==0 ? '.':'#');
        else ans[i][j] = '.';
    }
    rep(i,20) rep(j,100){
        if(i%2==0) ans[i][j] = (j%2==0 ? '#':'.');
        else ans[i][j] = '#';
    }
    
    int a = 501,b = 501;

    rep(i,20) rep(j,100) if(ans[i][j] == '.' && a > A) ans[i][j] = '#',a--;
    reps(i,20,40) rep(j,100) if(ans[i][j] == '#' && b > B) ans[i][j] = '.',b--;
    
    cout << 40 csp 100 << endl;
    rep(i,40){
        rep(j,100) cout << ans[i][j];
        cout << endl;
    }
    
    

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

static const int N = 100;

int main(){
    ll N,P[107],m[107][107];
    cin >> N;
    REP(i,1,N+1){
        cin >> P[i-1] >> P[i];
    }
    REP(i,1,N+1){
        m[i][i]=0;
    }
    REP(l,2,N+1){
        REP(i,1,N-l+2){
            int j=i+l-1;
            m[i][j]=MOD;
            REP(k,i,j+1){
                m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+P[i-1]*P[k]*P[j]);
            }
        }
    }
    cout << m[1][N] << endl;
}


Measured memory_bytes: 3164
#include <cstdio>
int H, K, N;

int main() {
  scanf(" %d%d", &N, &K);
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    scanf("%d", &H);
    if (H >= K) ++ans;
  }
  printf("%d\n", ans);
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> A(n), B(n+1);
    int k = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        A.at(i) = a;
        if (a > k) k = a;
    }
    vector<int> C(k+1);

    for (int i = 0; i < k+1; i++) {
        C.at(i) = 0;
    }
    for (int i = 0; i < n; i++) {
        C.at(A.at(i))++;
    }
    for (int i = 1; i < k+1; i++) {
        C.at(i) = C.at(i) + C.at(i-1);
    }

    for (int i = n-1; i >= 0; i--) {
        int a = A.at(i);
        int t = C.at(a);
        B.at(t) = a;
        C.at(a)--;
    }

    for (int i = 1; i < n+1; i++) {
        if (i != 1) cout << " ";
        cout << B.at(i);
    }
    cout << endl;

    return 0;
}


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

int main(){
	int n;
	double pi=2*acos(0);
	while(cin>>n&&n!=-1){
		double x=1,y=0,rad=pi;
		for(int i=0;i<n-1;i++){
			rad -= pi/2;
			x += cos(rad);
			y += sin(rad);
			rad = atan2(-y,-x);
		}
		printf("%.2f\n%.2f\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 1276
#include <stdio.h>

int main(void) {

  long n,k;
  scanf("%ld %ld", &n, &k);
  long a[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }
  long imos[n];
  long cur;
  int flag;
  for (long i = 0; i < k; i++) {
    for (long j = 0; j < n; j++) {
      imos[j] = 0;
    }
    for (long j = 0; j < n; j++) {
      cur = j-a[j];
      if (cur < 0) {
        cur = 0;
      }
      imos[cur]++;
      cur = j+a[j]+1;
      if (cur <= n-1) {
        imos[cur]--;
      }
    }
    a[0] = imos[0];
    for (long j = 1; j < n; j++) {
      a[j] = a[j-1]+imos[j];
    }
    flag = 0;
    for (long j = 0; j < n; j++) {
      if (a[j] != n) {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      break;
    }
  }
  for (long i = 0; i < n-1; i++) {
    printf("%ld ", a[i]);
  }
  printf("%ld\n", a[n-1]);

  return 0;
}

Measured memory_bytes: 4812
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 1000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
ll solve(ll a,ll b,ll c){
	if(a%2ll==0ll)return 0ll;
	else return b*c;
}
int main(){
	ll a,b,c;
	cin >> a >> b >> c;
	cout << min(min(solve(a,b,c),solve(b,c,a)),solve(c,a,b)) << endl;
	return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  string s;
  cin >> s;
  int n = sz(s);
  vector<int> ans(n, 0);

  int idx = 0;
  while (idx < n) {
    int l = idx;
    int lcnt = 0;
    while (s[l] == 'R') {
      l++;
      lcnt++;
    }
    int r = l;
    int rcnt = 0;
    while (r < n && s[r] == 'L') {
      r++;
      rcnt++;
    }
    ans[l - 1] = (lcnt - 1) / 2 + rcnt / 2 + 1;
    ans[l] = lcnt / 2 + (rcnt - 1) / 2 + 1;
    idx = r;
  }

  rep(i, n) {
    if (i != 0) cout << ' ';
    cout << ans[i];
  }
  cout << endl;
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REP2(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void chmax(T& a, T b) { if(a < b) a = b; }
template<class T> void chmin(T& a, T b) { if(a > b) a = b; }
typedef long long ll;
const ll INF = 1LL << 60;

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

    vector<ll> dp(n);
    rep(i, n) dp[i] = INF;
    dp[0] = 0;
    REP(i, 1, n){
        ll tmp = abs(h[i] - h[i - 1]);
        chmin(dp[i], dp[i - 1] + tmp);
        if(i > 1){
            tmp = abs(h[i] - h[i - 2]);
            chmin(dp[i], dp[i - 2] + tmp);
        }
    }
    OP(dp[n - 1]);
}


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

int main(){
  int a[3], k;

  cin >> a[0] >> a[1] >> a[2] >> k;

  sort(a, a+3);

  for(int i=0; i<k; ++i){
    a[2] *= 2;
  }


  cout << a[0] + a[1] + a[2] << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>

#define N 1000

int G[N][N];

int main() {
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            G[i][j] = 0;
        }
    }

    int n, u, k, v;
    std::cin >> n;
    for(int i = 0; i < n; i++) {
        std::cin >> u >> k;
        for(int j = 0; j < k; j++) {
            std::cin >> v;
            G[u][v] = 1;
        }
    }

    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            if(j != 1) std::cout << " ";
            std::cout << G[i][j];
        }
        std::cout << std::endl;
    }
    return 0;
}


Measured memory_bytes: 6996
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,k;
	cin>>a>>b>>k;
	if(a>=k){
		a-=k;
		cout<<a<<" "<<b;
		return 0;
	}
	else if(a<k){
		k-=a;
		a=0;
		if(b>=k){
			b-=k;
		}
		else
			b=0;
		cout<<a<<" "<<b;
		return 0;
	}	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

int ceil(int x, int y) { return (x % y == 0) ? x / y : x / y + 1; }

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

int lcm(int x, int y) { return x / gcd(x, y) * y; }

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

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

  string t;
  for (char c : s) {
    t.push_back(((c - 'A') + n) % 26 + 'A');
  }

  cout << t << endl;

  return 0;
}


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

int main(){
	long long N, X, min = 1000000000;
	cin >> N >> X;

	map<int, int> diff;
	for(int cnt = 0; cnt < N; cnt++){
		long long x, result;
		cin >> x;
		result = x - X;
		if(result < 0) result *= -1;
		diff[result] = result; 
	}
	for(int result = diff.begin()->second ;result > 1; result--){
		bool flag = true;
		for(auto itr = diff.begin(); itr != diff.end(); ++itr){
			if(itr->second % result != 0){
				flag = false;
				break;
			}
		}
		if(flag){
			cout << result;
			return 0;
		}
	}
	cout << 1;
	return 0;
}


Measured memory_bytes: 4864
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

ll gcd(ll a, ll b) {
  while (b > 0) {
    ll rem = a % b;
    a = b;
    b = rem;
  }
  return a;
}

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

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

  int n;
  cin >> n;
  vector<ll> t(n), a(n);
  for (int i = 0; i < n; i++) cin >> t[i] >> a[i];

  ll takahashi = t[0];
  ll aoki = a[0];
  for (int i = 1; i < n; i++) {
    ll tmul = (takahashi + t[i] - 1) / t[i];
    ll amul = (aoki + a[i] - 1) / a[i];
    ll maxmul = max(tmul, amul);
    takahashi = t[i] * maxmul;
    aoki = a[i] * maxmul;
  }

  ll ans = takahashi + aoki;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
from queue import PriorityQueue

def sub():
    lines = [input() for _ in range(4)]
    X, Y, Z, K = [int(e) for e in lines[0].split(" ")]
    As = [int(e) for e in lines[1].split(" ")]
    Bs = [int(e) for e in lines[2].split(" ")]
    Cs = [int(e) for e in lines[3].split(" ")]

    As = sorted(As, reverse=True)
    Bs = sorted(Bs, reverse=True)
    Cs = sorted(Cs, reverse=True)
    nb_A = len(As)
    nb_B = len(Bs)
    nb_C = len(Cs)
    
    memSet = set()
    pq = PriorityQueue()
    pq.put_nowait(( -(As[0]+Bs[0]+Cs[0]), (0,0,0)))
    memSet.add((0,0,0))
    
    for i in range(K):
        v, q = pq.get_nowait()
        print(-v)

        a, b, c = q
        if a+1 < nb_A:
            qTmp = (a+1, b, c)
            if qTmp not in memSet:
                memSet.add(qTmp)
                item = (-(As[qTmp[0]] + Bs[qTmp[1]] + Cs[qTmp[2]]), qTmp)
                pq.put_nowait(item)
        if b+1 < nb_B:
            qTmp = (a, b+1, c)
            if qTmp not in memSet:
                memSet.add(qTmp)
                item = (-(As[qTmp[0]] + Bs[qTmp[1]] + Cs[qTmp[2]]), qTmp)
                pq.put_nowait(item)
        if c+1 < nb_C:
            qTmp = (a, b, c+1)
            if qTmp not in memSet:
                memSet.add(qTmp)
                item = (-(As[qTmp[0]] + Bs[qTmp[1]] + Cs[qTmp[2]]), qTmp)
                pq.put_nowait(item)

sub()


Measured memory_bytes: 5616
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long ,long long>
#define gcd __gcd
using namespace std;
int main()
{
	ll l,r,d;
	ll ct=0;
	cin>>l>>r>>d;
	for(ll i=l;i<=r;i++){
		if(i%d==0)
			ct++;
	}
	cout<<ct<<"\n";
}

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

# from numba import njit

# from collections import Counter
# from itertools import accumulate
# import numpy as np
# from heapq import heappop,heappush
# from bisect import bisect_left

# @njit
def solve(n):
  for x in range(50000):
    if x * 108 // 100 == n:
      return x
  return ":("



def main():
  N = int(input())
  # N,M = map(int,input().split())
  # a = list(map(int,input().split()))
  print(solve(N))
  return

if __name__ == '__main__':
  main()


Measured memory_bytes: 9108
#pragma region includes, macros
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>
#include <cassert>
#include<iomanip>

using namespace std;
 
typedef int64_t i64;
typedef pair<i64, i64> P;

template<class T>
const T INF = numeric_limits<T>::max();
template<class T>
const T SINF = numeric_limits<T>::max() / 10;
static const i64 MOD = 1000000007;

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//int dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//int dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge {
	i64 from, to, cost;
	edge(i64 to, i64 cost) : from(-1), to(to), cost(cost) {}
	edge(i64 src, i64 to, i64 cost) : from(src), to(to), cost(cost) {}
};

// 多重vectorを可変引数テンプレートで http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}
//

#pragma endregion

int main(){
    cout<<std::defaultfloat<<std::setprecision(6);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	i64 n, k;
    cin >> n >> k;
    vector<i64> p(n);
    for(i64 i = 0; i < n; ++i) cin >> p[i];
    vector<i64> wa(n + 1);
    for(i64 i = 0; i < n; ++i) wa[i + 1] = wa[i] + p[i];
    i64 ans = 0;
    for(i64 i = 0; i < n - k + 1; ++i){
        ans = max(ans, wa[i + k] - wa[i] + k);
    }
    double anss = (double) ans / 2.0;
    printf("%.10f\n", anss);
}

Measured memory_bytes: 3456
import java.util.*;

public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        long sum[] = new long[n];
        for(int i=0;i<n;i++)a[i]=sc.nextInt();
        sum[0]=a[0];
        for(int i=1;i<n;i++)sum[i]=sum[i-1]+a[i];
        long ans = Long.MAX_VALUE;
        for(int i=0;i<n-1;i++){
            long x= sum[i];
            long y = sum[n-1]-sum[i];
            //System.out.println(x+" "+y);
            ans = Math.min(ans,Math.abs(x-y));
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 85384
import java.util.*;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String A = keyboard.next();	
		
		String OMOJI = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		
		int Olong = OMOJI.length();
		
		String ans = "a";
		
		for (int i=0; i<Olong; i++) {
			if(OMOJI.charAt(i) == A.charAt(0)) {
				ans = "A";
			}
		}
										
		System.out.println(ans);
		keyboard.close();	
	}
}

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

int main(){
    int N; cin >> N;
    int num = N, sum = 0;

    while (num > 0){
        int dig = num % 10;
        sum += dig;
        num = num / 10;
    }

    if (N % sum == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
       


    return 0;
}

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


int main ()
{
    int n;
    cin>>n;
    vector<pair<string,ll>>v1;
    map<string,ll>v;
    ll mx=0;
    while(n--)
    {
        string a;
        cin>>a;
        v[a]++;
        if(v[a]>mx)
            mx=v[a];
    }
    for(auto it=v.begin();it!=v.end();it++)
    {
        v1.push_back({it->first,it->second});
    }
    sort(v1.begin(),v1.end());
    for(int i=0;i<v1.size();i++)
    {
        if(v1[i].second==mx)
        {
            cout<<v1[i].first<<endl;
        }
    }

    return 0;

}


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

// 定義
typedef long long         ll;
typedef pair<ll, ll>      P;
#define ALL(x)            (x).begin(),(x).end()
#define REP(i, n)         for(ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)     for(ll i = m ; i < (ll)n ; ++i)
#define VL                vector<ll>
#define VVL               vector<vector<ll>>
#define VVVL              vector<vector<vector<ll>>>
#define VC                vector<char>
#define VVC               vector<vector<char>>
#define INF               (ll)2e9
#define INF_LL            1LL<<60
//#define MOD             998244353
#define MOD               1000000007

ll Ceil(ll val, ll div)   { return (val + div - 1) / div; }
ll CeilN(ll val, ll div)  { return Ceil(val, div) * div; }
ll FloorN(ll x, ll n)     { return (x - x % n); }
bool IsOdd(ll x)          { return ((x & 1) == 1); }
bool IsEven(ll x)         { return ((x & 1) == 0); }
template<class T> bool chmax(T& a, T b) { if (a <= b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }

/* 最大公約数 */
ll gcd(ll a, ll b)
{
	if (b == 0) return a;
	return gcd(b, a % b);
}

/* 最小公倍数 */
ll lcm(ll a, ll b)
{
	ll gcdRes = gcd(a, b);
	return (a * (b / gcdRes));
}

/* 素数判定 */
bool isPrime(ll p)
{
	for (ll i = 2; i <= sqrt(p); i++) if (p % i == 0) return false;
	return p > 1;
}

/* 素因数分解 */
void primeFactor(ll n, map<ll, ll> &factMap)
{
	if ((n % 2) == 0){
		while ((n % 2) == 0) {
			n = n / 2;
		}
		factMap[2]++;
	}

	VL isFind(1000005, 0);
	for (ll i = 3; i <= sqrt(n); i += 2){
		while ((n % i) == 0){
			if (!isFind[n]) {
				isFind[n] = true;
				factMap[i]++;
			}
			n = n / i;
		}
	}

	if (n != 1) {
		if (!isFind[n]) {
			factMap[n] = 1;
		}
	}
}

void Solve()
{
	ll N;
	cin >> N;
	VL A(N);
	VL val(1000005, 0);
	REP(i, N) {
		cin >> A[i];
		val[A[i]]++;
	}
	sort(ALL(A));
	
	ll ans = 0;
	ll maxVal = A.back();
	VL isFin(1000005, 0);
	for (ll a = 2; a <= maxVal; a++) {
		if (isFin[a]) {
			continue;
		}
		ll ansOne = 0;
		ll nowVal = a;
		while (nowVal <= maxVal) {
			ansOne += val[nowVal];
			isFin[nowVal] = 1;
			nowVal += a;
		}
		ans = max(ansOne, ans);
	}

	if (ans == N) {
		cout << "not coprime" << endl;
	} else {
		if (1 < ans) {
			cout << "setwise coprime" << endl;
		} else {
			cout << "pairwise coprime" << endl;
		}
	}
	return;
}

// メイン
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Solve();
	return 0;
}


Measured memory_bytes: 26696
#include <bits/stdc++.h>
#define rep(i , n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int x, y;
char ch;
bool bj[5001][5001];
int main (){
	cin >> x >> y;
	for(int i = 1; i <= x; i++)
		for(int j = 1; j <= y; j++){
			cin >> ch;
			bj[i][j] = (ch == '#');
		}
	for(int i = 1; i <= x; i++){
		for(int j = 1; j <= y; j++){
            if(bj[i][j]==0){
                cout << bj[i - 1][j] + bj[i + 1][j] + bj[i][j - 1] + bj[i][j + 1] + bj[i - 1][j - 1] + bj[i + 1][j - 1] + bj[i - 1][j + 1] + bj[i + 1][j + 1];
            }
            else{
                cout << '#';
            }

		}
		cout << endl;
	}
	return 0;
}

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


int main() {
  int n ; cin >> n ;
  vector<int> b(n);
  vector<int> a(n);
  for ( int i = 0 ; i < n ; i++ ) 
    cin >> b[i] ;
   
  int ans = 0 ; 
  if ( n ==2 ) 
  ans = b[0]*2 ;
  
  else if ( n >=3 ) {
  a[0] = b[0]; a[n-1] = b[n-2];
  for ( int i = 1 ; i <n-1 ; i++ )
    a[i] = min(b[i],b[i-1]);
    
    for ( int i = 0 ; i <n ; i++ ) 
      ans += a[i];
  }
 
  cout <<  ans << endl ; 

}





Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

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

		try {
			List<String> lines = new ArrayList<String>();

			int rows = sc.nextInt();
			int cols = sc.nextInt();

			for (int i = 0; i < rows; i++) {
				lines.add(sc.next());
			}

			lines.sort((o1, o2) -> o1.compareTo(o2));

			StringBuffer sb = new StringBuffer();

			for (String str : lines) {
				sb.append(str);
			}

			System.out.println(sb.toString());
		} catch (Throwable t) {
			t.printStackTrace();
		} finally {
			sc.close();
		}
	}
}


Measured memory_bytes: 15308
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int lu;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> v;
typedef vector<v> vv;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<set<ll>> vsll;
typedef set<pair<ll, ll>> spll;
typedef vector<spll> vspll;
typedef vector<pll> vpll;
const ll MOD = 1e9 + 7;
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define yesno(f) \
    if (f)       \
        yes else no;
#define noo \
    { no return; }
#define round(x, y) ((2 * x + y) / (2 * y))
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define sz(x) (ll) x.size()
#define sq(x) ((x) * (x))
 
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
 
template <typename T = ll>
vector<T> ga(ll n, bool oneIndexed = false) {
    vector<T> a = vector<T>(n + oneIndexed);
 
    for (ll i = 0; i < n; i++) {
        T p;
        cin >> p;
        a[i + oneIndexed] = p;
    }
 
    return move(a);
}
 
template <typename T, typename A>
void pa(vector<T, A> const &a, ll begin = 0, ll end = -1) {
    if (end == -1)
        end = sz(a) - 1;
    for (ll i = begin; i <= end; i++) {
        cout << a[i] << " ";
    }
    cout << endl;
}
 
void solve() {
    ll h,a;
    cin >>h>>a;
    if(h%a==0)
    {
        cout <<h/a<<"\n";
    }
    else{
        cout <<h/a +1 <<"\n";
    }
}
 
int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // freopen("file", "r", stdin);
    // freopen("file", "w", stdout);

    solve();
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;

const int MAX_N = 100000;

int N;
double pw;
double vw[MAX_N], pf[MAX_N], vf[MAX_N], th[MAX_N];

double sumofcost(double w){
	double s = pw * w;
	for(int i = 0; i < N; i++){
		double f = (th[i] - w * vw[i]) * pf[i] / vf[i];
		s += max(0.0, f);
	}
	return s;
}

int main(){
	while(scanf("%d", &N) && N){
		scanf("%lf", &pw);
		for(int x = 0; x < N; x++){
			scanf("%lf%lf%lf%lf", vw+x, pf+x, vf+x, th+x);
		}
		double left = 0;
		double w1, w2;
		double right = 100;
		for(int n = 200; n--;){
			w1 = (2 * left + right) / 3;
			w2 = (left + 2 * right) / 3;
			if(sumofcost(w1) < sumofcost(w2)){
				right = w2;
			}else{
				left = w1;
			}
		}
		printf("%f\n", sumofcost(left));
	}
	return 0;
}

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

int main() {
  int x;
  cin >> x;
  if(x >= 400 && x < 600) {
    cout << 8 << endl;
  }else if(x < 800){
    cout << 7 << endl;
  }else if(x < 1000){
    cout << 6 << endl;
  }else if(x < 1200){
    cout << 5 << endl;
  }else if(x < 1400){
    cout << 4 << endl;
  }else if(x < 1600){
    cout << 3 << endl;
  }else if(x < 1800){
    cout << 2 << endl;
  }else {
    cout << 1 << endl;
  }
  
  return(0);
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
using ll = long long;

int main(){
 int a, b, x;
 double theta;
 const double PI = acos(-1);
 cin >> a>> b >> x;
  if(a*a*b>=2*x){
 theta = atan( a*b*b/(2.0*x)) * 360.0 / (2.0*PI);
  printf("%.10f\n", theta);
  return 0;
 }else{
  theta = atan( (2.0*(a*a*b-x))/(1.0*a*a*a)) * 360.0 / (2.0*PI);
  printf("%.10f\n", theta);
  return 0;
 }
}
 

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
#define pb push_back
typedef vector<int> vi;
#define mod 1000000007
int32_t main() {
    int n;
    cin>>n;
    int dp[n+1][3],a[n+1],b[n+1],c[n+1];
    for(int i=0;i<n;i++)
    cin>>a[i]>>b[i]>>c[i];
    dp[0][0]=a[0],dp[0][1]=b[0],dp[0][2]=c[0];
    for(int i=1;i<n;i++)
    {
     dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
     dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
     dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
    }
    cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);
    return 0;
}


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

int N, A[110], B[110], ans=0, temp;

int main () {
	cin >> N;
	for(int i=1; i<=N; i++)
		cin >> A[i];
	for(int i=1; i<=N; i++)
		cin >> B[i];
	for(int i=1; i<=N; i++) {
		int temp = A[i]-B[i];
		if (temp > 0) ans += temp;
	}
	cout << ans << endl;
		
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

int n;
int a[112345];
bool used[112345];
int ans;
int main(){
  cin>>n;
  FOR(i,1,n+1){
    cin>>a[i];
  }
  rep(i,112345)used[i]=false;
  int next=1;
  while(1){
    ans++;
    if(used[next]){
      cout<<"-1"<<endl;
      return 0;
    }
    used[next]=true;

    next=a[next];
    if(next==2){
      cout<<ans<<endl;
      return 0;
    }
  }


}


Measured memory_bytes: 768
//#include <cmath>
//#include <cstdio>
//#include <vector>
//#include <map>
//#include <iostream>
//#include <algorithm>
//#include <set>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vb = vector<bool>;
using pli = pair<ll,int>; 		
#define fi first
#define v vector
#define se second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
int INF = 1e9+7;
ll inf = 1e18+7;

const int N = 100010;

void add_self(int &a, int b){
	a += b;
}

void max_self(int &a, int b){
	if(b > a)	a = b;
}

void topsort(int i, v<vi>& graph, vb& visit, stack<int>& res){
	visit[i] = true;
	
	for(int x : graph[i]){
		if(!visit[x])
		topsort(x,graph,visit,res);
	}
	res.push(i);
}


int dp[N];

int find(int i, v<vi>& graph){
	if (dp[i] != -1)	return dp[i];
	int res = 0;
	for(int v : graph[i]){
		max_self(res, 1 + find(v, graph));
	}
	dp[i] = res;
	return res;
}


void solve(){
	for(int i = 0 ; i<N; ++i){
		dp[i]  = -1;
	}
	int n,m;
	scanf("%d%d",&n,&m);
	v<vi> graph(n);
	for(int i =0 ;i < m; ++i){
		int a,b;
		scanf("%d%d",&a,&b);
		graph[a-1].pb(b-1);
	}
	int ans = 0;
	
	for(int i = 0; i < n; ++i){
		max_self(ans,find(i,graph));
	}
	printf("%d\n", ans);
}	


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t = 1;
	//cin >> t;
	//scanf("%d",&t);
	while(t--){
		solve();
	}
		
			
}


Measured memory_bytes: 10936
N = int(input())
H = list(map(int,input().split()))

for i in range(N-1,0,-1):
    if H[i]+1 < H[i-1]:
        print('No')
        exit(0)
    elif H[i]+1 == H[i-1]:
        H[i-1] -= 1
    
print('Yes')

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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

bool check(vector<int> &ans, vector<int> &A) {
    int N = ans.size();
    bool ret = true;
    for(int i = 0; i < N; i++) {
        int d = i + 1;
        int s = 0;
        for(int j = i; j < N; j += d) {
            s += ans[j];
        }
        if (s % 2 != A[i]) {
            ret = false;
        }
    }

    return ret;
}

vector<int> solveNaive(vector<int> &A) {
    int N = A.size();
    for (int i = 0; i < 1 << N; i++) {
        vector<int> cand(N);
        for (int j = 0; j < N; j++) {
            if (i >> j & 1) {
                cand[j] = 1;
            }
        }
        if (check(cand, A)) {
            return cand;
        }
    }
    return vector<int>();
}

vector<int> solve(vector<int> &A) {
    int N = A.size();
    vector<int> ans(N);
    for (int i = N - 1; i >= 0; i--) {
        int d = i + 1;
        int s = 0;
        for(int j = i + d; j < N; j += d) {
            s += ans[j];
        }
        if ((s % 2) ^ (A[i])) {
            ans[i] = 1;
        }
    }
    return ans;
}

void solve() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    vector<int> ans = solve(A);
    assert(check(ans, A));


    vector<int> out;
    for (int i = 0; i < ans.size(); i++) {
        if (ans[i]) {
            out.push_back(i + 1);
        }
    }

    cout << out.size() << endl;
    for (int i = 0; i < out.size(); i++) {
        cout << out[i] << " ";
    }
    cout << endl;


}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Measured memory_bytes: 3192
def f(a,b):
  if a == b:
    return a
  elif a%2 == 1:
    return a^f(a+1,b)
  elif b%2 == 0:
    return f(a,b-1)^b
  else:
    return (b-a+1)//2%2

x,y = map(int,input().split())
print(f(x,y))

Measured memory_bytes: 3060