akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node
{
  int p, l ,r;
};
struct Node T[MAX];
int n;

void pre(int);
void in(int);
void post(int);

int main()
{
  int i, v, l, r, root;

  scanf("%d",&n);

  for(i = 0; i < n; i++)
    {
      T[i].p = NIL;
    }

  for(i = 0; i < n; i++)
    {
      scanf("%d %d %d",&v,&l,&r);
      T[v].l = l;
      T[v].r = r;
      if(l != NIL)T[l].p = v;
      if(r != NIL)T[r].p = v;
    }
  
  
  for(i = 0; i < n; i++)
    {
      if(T[i].p == NIL)root = i;
    }
  
   printf("Preorder\n");
   pre(root);
   printf("\n");
   printf("Inorder\n");
   in(root);
   printf("\n");
   printf("Postorder\n");
   post(root);
   printf("\n");
  
  return 0;
}

void pre(int u)
{
  if(u == NIL)return;
  printf(" %d",u);
  pre(T[u].l);
  pre(T[u].r);

}

void in(int u)
{
  if(u == NIL)return;
  in(T[u].l);
  printf(" %d",u);
  in(T[u].r);

}

void post(int u)
{
  if(u == NIL)return;
  post(T[u].l);
  post(T[u].r);
  printf(" %d",u);
}




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

int main() 
{
    string s;
    cin >> s;

    if (s == "SUN") cout << 7 << endl;
    if (s == "MON") cout << 6 << endl;
    if (s == "TUE") cout << 5 << endl;
    if (s == "WED") cout << 4 << endl;
    if (s == "THU") cout << 3 << endl;
    if (s == "FRI") cout << 2 << endl;
    if (s == "SAT") cout << 1 << endl;

    return 0;
}


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

#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;

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

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

/*****************************************************START******************************************************************/



int main()
{
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	int T = 1;
	 //cin >> T;
	// cin.ignore(); must be there when using getline(cin, s)
	while (T--)
	{
		int a,b; char c; 
		cin >> a >> c >> b ; 
		if(c == '+'){
			cout << a + b << endl;
		}else{
			cout << a - b << endl; 
		}
	}
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define iso ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define clr(x,n) memset((x), n, sizeof(x))
#define mod 1000000007
#define MAX 1000005
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll ,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_tree;*/
ll arr[205];
int main()
{
    iso;
    ll x,k,d,a,cur;
    cin>>x>>k>>d;
    x = abs(x);
    if(x>0)
    {
        a = x/d;
        if(a>=k)
        {
            cout<<x-k*d;
        }
        else
        {
            cur = x-d*a;
            k = k-a;
            if(k%2!=0)
            {
                cout<<abs(cur-d);
            }
            else
                cout<<cur;
        }

    }
    else if(x == 0)
    {
        if(k%2==0)
            cout<<0;
        else
            cout<<d;
    }




    return 0;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define s second
#define f first
long long const mod = 1000000007;
#define inf 1000000000000000000
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod)+mod)%mod;}
inline ll mul(ll a, ll b){ return (((a%mod)*(b%mod))%mod+mod)%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}
#define level 22

ll power(ll x,ll y,ll m)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2, m) % m;
    p = (p * p) % m;
    return (y%2 == 0)? p : (x * p) % m;
}

ll modInv(ll x)
{
    return power(x,mod-2,mod)%mod;
}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
  
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=100000+19;
const int oo=(1<<30)-1;

struct Edge{
	int y,nxt;
} E[N*2];
int las[N],A[N];
int n,cnt,ans;

void Link(int x,int y){
	E[cnt]=(Edge){y,las[x]};las[x]=cnt++;
	E[cnt]=(Edge){x,las[y]};las[y]=cnt++;
}
void dfs(int x,int fa){
	int tmp=0,val=0;
	for (int i=las[x],y;~i;i=E[i].nxt)
		if ((y=E[i].y)!=fa){
			dfs(y,x);
			tmp|=A[x]&A[y];
			A[x]|=A[y];
		}
	while ((1<<val)<=tmp||(A[x]>>val&1)) val++;
	ans=max(ans,val);
	A[x]=(A[x]>>val<<val)|(1<<val);
}

int main(){
	//freopen("01.txt","r",stdin);
	memset(las,-1,sizeof(las));
	n=IN();
	For(i,1,n) Link(IN(),IN());
	dfs(1,-1);
	printf("%d\n",ans);
}

Measured memory_bytes: 7168
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	int N; cin >> N;
	set<string>dangers;
	for (int i = 0; i < N; ++i) {
		string st; cin >> st;
		for (int asize = 1; asize <= 4; ++asize) {
			for (int l = 0; l <= int(st.size()) - asize; ++l) {
				dangers.emplace(st.substr(l, asize));
			}
		}
	}
	int num = 1;
	bool flag = false;
	string ans = "dd";
	for (int asize = 1; asize <= 4; ++asize) {
		num *= 26;
		for (int j = 0; j < num; ++j) {
			string pass(asize, ' ');
			int n(j);
			for (int i = 0; i < asize; ++i) {
				pass[asize-i-1] = n % 26 + 'a';
				n /= 26;
			}
			if (dangers.find(pass) == dangers.end()) {
				ans = pass;
				flag = true;
				break;
			}
		}
		if (flag)break;
		
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 42464
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    cin>>S;
    ll ans = 0;
    rep(i,4){
        if(S[i] == '+') ++ans;
        else --ans;
    }
    cout<<ans<<endl;
}


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

const int MAX = 2100;
const int MOD = 1000000007;
long long 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;
    }
}

// 二項係数計算
long long COM(int n, int 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(void){
    int N,K;
    cin >> N >> K;
    COMinit();
    for(int i=1;i<=K;i++){
        cout <<(COM(K-1,i-1)*COM(N-K+1,i))%MOD <<endl;
    }
    return 0;
}

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

using namespace std;

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

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	int x, t;
	cin >> x >> t;
	cout << max(0, x - t) << endl;

	return 0;
}

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

vector<int> col;
vector<vector<P>> g;

void dfs(int a, int b, int c){
  col[a] = c;
  for(auto v: g[a]){
    if(v.first == b) continue;
    if(v.second % 2 == 0){
      dfs(v.first,a,c);
    }else{
      dfs(v.first,a,1-c);
    }
  }
}

int main(){
  int n; cin >> n;
  col.resize(n);
  g.resize(n);
  for(int i = 0; i < n-1; i++){
    int a,b,w; cin >> a >> b >> w;
    a--; b--;
    g[a].push_back(P(b,w));
    g[b].push_back(P(a,w));
  }
  col.assign(n,-1);
  dfs(0,-1,1);
  for(auto v: col) cout << v << endl;
  return 0;
}

Measured memory_bytes: 8960
#include <iostream>

int main() {
  std::string S;
  std::cin >> S;
  int ret = 0;
  std::string codefes = "CODEFESTIVAL2016";
  for(int i = 0; i < 16; ++i) {
    if(S[i] != codefes[i]) {
      ++ret;
    }
  }
  std::cout << ret;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priotity_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ld PI=abs(acos(-1));
int n;
char a, b;

int main(){
	cin >> a >> b;
	
	
	
	cout << (a<b?'<':(a==b?'=':'>')) << endl;
	return 0;
}


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

#define int LL

typedef long long LL;
const int N = 2010, INF = 0x3f3f3f3f3f3f3f3fll;

struct Edge {
	int nex, v, c, len;
	Edge(){}
	Edge(int N, int V, int C, int L) {
		nex = N, v = V, c = C, len = L;
	}
}edge[2000010]; int tp = 1;

int e[N], n, tot, d[N], pre[N], flow[N], Time, vis[N];
std::queue<int> Q;

inline void add(int x, int y, int z, int w) {
	edge[++tp] = Edge(e[x], y, z, w);
	e[x] = tp;
	edge[++tp] = Edge(e[y], x, 0, -w);
	e[y] = tp;
	return;
}

inline bool SPFA(int s, int t) {
	memset(d, 0x3f, sizeof(d));
	Q.push(s);
	++Time;
	d[s] = 0;
	vis[s] = Time;
	flow[s] = INF;
	while(Q.size()) {
		int x = Q.front();
		Q.pop();
		vis[x] = 0;
		for(int i = e[x]; i; i = edge[i].nex) {
			int y = edge[i].v;
			if(edge[i].c && d[y] > d[x] + edge[i].len) {
				d[y] = d[x] + edge[i].len;
				pre[y] = i;
				flow[y] = std::min(flow[x], edge[i].c);
				if(vis[y] != Time) {
					vis[y] = Time;
					Q.push(y);
				}
			}
		}
	}
	return d[t] < INF;
}

inline void update(int s, int t) {
	int f = flow[t];
	while(s != t) {
		int i = pre[t];
		edge[i].c -= f;
		edge[i ^ 1].c += f;
		t = edge[i ^ 1].v;
	}
	return;
}

inline int solve(int s, int t, int &cost) {
	cost = 0;
	int ans = 0;
	while(SPFA(s, t)) {
		//printf("!");
		ans += flow[t];
		cost += flow[t] * d[t];
		update(s, t);
	}
	return ans;
}

signed main() {
	
	scanf("%lld", &n);
	int s = 2 * n + 5, t = s + 1, x, y, z;
	for(int i = 1; i <= n; i++) {
		scanf("%lld%lld%lld", &x, &y, &z);
		add(s, i, z, 0);
		add(i, 2 * n + 1, z, x + y);
		add(i, 2 * n + 2, z, y - x);
		add(i, 2 * n + 3, z, x - y);
		add(i, 2 * n + 4, z, -x - y);
	}
	for(int i = 1; i <= n; i++) {
		scanf("%lld%lld%lld", &x, &y, &z);
		add(n + i, t, z, 0);
		add(2 * n + 1, n + i, z, -x - y);
		add(2 * n + 2, n + i, z, x - y);
		add(2 * n + 3, n + i, z, y - x);
		add(2 * n + 4, n + i, z, x + y);
	}
	//puts("OVER");
	int cost = 0;
	solve(s, t, cost);
	printf("%lld\n", -cost);
	return 0;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#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++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;

int main(){
    int n;cin>>n;
    vin a(n);
    rep(i,n)cin>>a[i];
    vin b(n);
    ll ans=0;
    rep(i,n){
        if(a[i]+i+1<n)b[a[i]+i+1]++;
        if(i+1-a[i]>=0)ans+=(ll)b[i+1-a[i]];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4856
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

void reader(int &a) { scanf("%d", &a); }
void reader(double &a) { scanf("%lf", &a); }
void reader(char a[]) { scanf("%s", a); }
void reader(char &a) { scanf(" %c", &a); }
void reader(ll &a) { scanf("%lld", &a); }
void reader(ull &a) { scanf("%llu", &a); }
// void reader(string& a){cin >> a;};
template<class T, class U> void reader(T& t, U& u) { reader(t); reader(u); }
template<class T, class U, class V> void reader(T& t, U& u, V& v) { reader(t); reader(u); reader(v); }

void writer(const int a, char c) { printf("%d", a); putchar(c); }
void writer(const ll a, char c) { printf("%lld", a); putchar(c); }
void writer(const ull a, char c) { printf("%llu", a); putchar(c); }
void writer(const double a, char c) { printf("%.20lf", a); putchar(c); }
void writer(const char a[]) { printf("%s", a); };
void writer(const char a[], char c) { printf("%s", a); putchar(c); };
void writer(const char a, char c) { putchar(a); putchar(c); };
template<class T> void writerLn(T t) { writer(t, '\n'); }
template<class T, class U> void writerLn(T t, U u) { writer(t, ' '); writer(u, '\n'); }
template<class T, class U, class V> void writerLn(T t, U u, V v) { writer(t, ' '); writer(u, ' '); writer(v, '\n'); }
template<class T> void writerArr(T x[], int n) { int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }
template<class T> void writerVec(vector<T> x) { int n = x.size(); int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }

vector<string> split(const string &str, char sep) { vector<string> v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) { v.push_back(buffer); }return v; }
// #define int ll
bool test = 1;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define MAX 300000
//.....................
ull mod = (int)1e9 + 7;

struct Rectangle {
	int h, w;
	bool operator < (const Rectangle& r) const {
		if (h*h + w*w < r.h*r.h + r.w*r.w) return true;
		if (h*h + w*w == r.h*r.h + r.w*r.w) {
			if (h < r.h) return true;
		}
		return false;
	}
};
signed main(void)
{
	int i, j, k;
	while (1) {
		Rectangle a;
		cin >> a.h >> a.w;
		if (a.h == 0) return 0;
		Rectangle res = { 350,350 };
		Rectangle now;
		REP(now.h, 1, 160) {
			REP(now.w, now.h + 1, 160) {
				if (a < now && now < res) {
					res = now;
				}
			}
		}
		writerLn(res.h, res.w);
	}
	return 0;
}

Measured memory_bytes: 1148
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#include<cstdio>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<string>
#include<iostream>
#include<map>
#include<set>
#include<queue>
#include<set>
#define READ                freopen("in.txt", "r", stdin)
#define WRITE               freopen("out.txt", "w", stdout)
#define INF9                1000000010
#define INF18               1000000000000000010
#define dist(ax,ay,bx,by)   sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by))
#define gcd(a,b)            __gcd(a,b)
#define lcm(a,b)            (a*b)/__gcd(a,b)
#define m_p(a,b)            make_pair(a,b)
#define sqr(a)              ((a)*(a))
#define pb                  push_back
#define bpll(a)             __builtin_popcountll(a)
#define MX                  1000000
#define PI                  acos(-1)
#define mod                  1000000007
#define cnt_bin(n)          __builtin_clzll(0ll) - __builtin_clzll(n)

typedef long long lli;
using namespace std;

vector<lli>ara;

int main()
{
    lli x, k, d;
    cin>>x>>k>>d;

    x= abs(x);

    lli div= x/d;

    div= min(div, k);

    x-= (d*div);

    k-=div;

    lli ans= x;

    if(k%2) ans= abs(x-d);

    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 3632
import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N = int(input())
CAB = []
for _ in range(N):
    A, B = inpl()
    CAB.append((A+B,A,B))
CAB.sort(reverse=True)
ans = sum(CAB[i][1] for i in range(0,N,2)) - sum(CAB[i][2] for i in range(1,N,2))
print(ans)

Measured memory_bytes: 58076
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb push_back
#define pii pair<ll,ll>
#define pi pair<int ,int> 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i,a,n) for(int i=a;i>=n;i-- )
int main() {

int h,a;
cin>>h>>a;
int ans=0;
 while(h>0)
 {
   h-=a;
   ans++;
 }
 cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>

#define all(c) (c).begin(),(c).end()
#define x second
#define y first
#define a first
#define b second
#define Bottom 0
#define Left 1
#define Right 2
#define Top 3
#define PUSH 0
#define SUM 1
#define POP 2

using namespace std;

typedef pair<int,int> pii;
typedef pair<pii,int>piii;
typedef pair<pii,pii> segment;

const int MAX_N = 1<<17;
int n,dat[2*MAX_N];

void init(int n_){
  n=1;
  while(n<n_)n*=2;
  fill(dat,dat+2*MAX_N,0);
}

void update(int k,int a){
  k+=n-1;
  dat[k]=a;
  while(k>0){
    k=(k-1)/2;
    dat[k]=dat[k*2+1]+dat[k*2+2];
  }
}

int sum(int a,int b,int k=0,int l=0,int r=n){
  if(r<=a || b<=l)return 0;
  if(a<=l && r<=b)return dat[k];
  
  int m=(l+r)/2;
  int vl=sum(a,b,k*2+1,l,m);
  int vr=sum(a,b,k*2+2,m,r);
  return vl+vr;
}

map<int,int> xmp,ymp;

struct Q{
  int y,x1,x2,q;
  Q(){}
  Q(int y,int x1,int x2,int q):y(y),x1(x1),x2(x2),q(q){}
};

bool cmp(Q p,Q q){
  if(p.y!=q.y)return p.y<q.y;
  return p.q<q.q;
}

int main(void){

  int m;
  cin >> m;
  
  vector<int>xv,yv;
  vector<segment>v(m);
  vector<Q>query;
  
  for(int i=0;i<m;i++){
    cin >> v[i].a.x >> v[i].a.y >> v[i].b.x >> v[i].b.y;

    if(v[i].a.x>v[i].b.x)swap(v[i].a.x,v[i].b.x);
    if(v[i].a.y>v[i].b.y)swap(v[i].a.y,v[i].b.y);

    xv.push_back(v[i].a.x);
    xv.push_back(v[i].b.x);
  }
  
  sort(all(xv));

  for(int i=0;i<m;i++){
    if(v[i].a.x==v[i].b.x){
      query.push_back(Q(v[i].a.y,v[i].a.x,-1,PUSH));
      query.push_back(Q(v[i].b.y,v[i].b.x,-1,POP));
    }
    if(v[i].a.y==v[i].b.y){
      query.push_back(Q(v[i].a.y,v[i].a.x,v[i].b.x,SUM));
    } 
  }
  
  sort(all(query),cmp);

  xv.erase(unique(all(xv)),xv.end());

  for(int i=0;i<xv.size();i++)xmp[xv[i]]=i;

  init(xv.size());
  
  int cnt=0;
  for(int i=0;i<query.size();i++){
    if(query[i].q==PUSH)update(xmp[query[i].x1],1);
    if(query[i].q==POP)update(xmp[query[i].x1],0);
    if(query[i].q==SUM)cnt+=sum(xmp[query[i].x1],xmp[query[i].x2]+1);
  }
  cout << cnt << endl;
  
  return 0;
}

Measured memory_bytes: 10456
n,m=map(int,input().split())
a=[0]*n
b=[0]*n
c=[0]*m
d=[0]*m
for i in range(n):
    a[i],b[i]=map(int,input().split())
for i in range(m):
    c[i],d[i]=map(int,input().split())
for i in range(n):
    #brute force over all checkpoints
    dist=float('inf')
    for j in range(m):
        dist=min(dist,abs(a[i]-c[j])+abs(b[i]-d[j]))
    for j in range(m):
        if dist==abs(a[i]-c[j])+abs(b[i]-d[j]):
            print(1+j)
            break



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int>A(N);
    for(int i=0;i<N;i++)cin>>A[i];
    sort(A.begin(), A.end());
    vector<int>fact(1000001,0);
    for(int i = 0; i < N; i++)
    {
        if(fact[A[i]] > 1)  continue;
        for(int j = A[i]; j<=1000000; j+=A[i])
        {
            fact[j]++;
        }
    }
    int ans = 0;
    for(int i:A)if(fact[i]==1)ans++;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 7956
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		int[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
		Array.Sort(nums);
		if(nums[0] == 1 && nums[1] == 4 && nums[2] == 7 && nums[3] == 9)
		{
			Console.WriteLine("YES");
		}else Console.WriteLine("NO");
	}
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define ll  long long
#define ff first
#define ss second
#define pb push_back
#define pp pair<ll,ll>
#define maxn 3005
#define db double
#define mod 998244353
using namespace std;
ll arr[maxn];
ll dp[maxn][maxn];
void solve()
{
	ll n,s;
	cin >> n >> s;
	memset(dp,0,sizeof(dp));
	for(ll i=1;i<=n;i++)
		cin >> arr[i];
	for(ll i=0;i<=n;i++)
		dp[i][0]=i;
	ll ans=0;
	for(ll i=1;i<=n;i++){
		for(ll j=1;j<=s;j++)
		{
			dp[i][j] = dp[i-1][j];
			if(arr[i] == j)
				dp[i][j]=(dp[i][j]+i)%mod;
			else if(arr[i] < j)
				dp[i][j]= (dp[i][j]+dp[i-1][j-arr[i]])%mod;
		}
		ans = (ans+dp[i][s])%mod;
	}
	cout << ans;
}
int main()
{
	ll t=1,i=1;
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
    std::cout.precision(10);
    std::cout.setf( std::ios::fixed, std:: ios::floatfield ); 
	//cin >> t;
	//cin >> n;
	while(i<=t)
	{
		solve();
		i++;
	}
	return 0;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<ll>
#define vvll vector<vll>
#define mll map<ll,ll>
#define f(i,m,n) for(i=m;i<n;i++)
#define ee endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define take(v,n) for(i=0;i<n;i++) cin>>v[i];
#define NO() cout<<"IMPOSSIBLE"<<endl
#define YES() cout<<"Yes"<<endl
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sot(v) sort(v.begin(),v.end());
bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}

ll findMaxGCD(vll &arr, ll n) 
{ 
    ll high = 0; 
    for (int i = 0; i < n; i++) 
        high = max(high, arr[i]); 
  
    // Maintaining count array 
    int count[high + 1] = {0}; 
    for (int i = 0; i < n; i++) 
        count[arr[i]]++; 
    int counter = 0; 
  
    for (int i = high; i >= 1; i--) 
    { 
        int j = i; 
       counter = 0; 

        while (j <= high) 
        { 
  
            if(count[j] >=2) 
               return j; 
  
           else if (count[j] == 1)          
                counter++;          
            j += i; 
            if (counter == 2)          
                return i; 
        } 
    } 
} 

void solve()
{
    ll i,j,n,k,w,q;
    cin>>n;
    vll v(n);
    take(v,n);
    ll ans=__gcd(v[0],v[1]);
    for(i=2;i<n;i++)
    ans=__gcd(ans,v[i]);
    if(ans>1)
    {
        cout<<"not coprime"<<ee;
        return;
    }
    k=findMaxGCD(v,n);
    if(k==1)
    {
        cout<<"pairwise coprime"<<ee;
        return;
    }
    else
    {
        cout<<"setwise coprime"<<ee;
    }
    
    
}
int main() {
    fast;
    ll i,j,l,k,t,n;
    t=1;
    for(i=1;i<=t;i++)
    {
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

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

#define endl "\n"
#define ll long long
#define ios ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);

using namespace std;

int main() {
    ios
    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    ll c = (ll)(abs(x) / d);
    if (c > k) {
        cout << abs(x) - k * d;
        return 0;
    }
    else {
        k -= c;
        x = x - (d * c);
        if (k % 2) {
            cout << abs(x - d);
        }
        else cout <<  x;
    }
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
typedef long long ll;
#define  rep(i,a,b)for(long long i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
const ll INF=1000000000000LL;
const ll r197=1000000007;
typedef pair<ll,ll>P;
typedef pair<int,P>Pa;
bool Inframe(int a,int b,int c,int d,int h,int w){
	if(a+b>=0&&a+b<h&&c+d>=0&&c+d<w)return true;
	return false;
}
vector<int> v[601];
int n;
ll ans=1;
string s;
multiset<ll> lset,rset;
ll d[100005];
ll a[100005]={};
ll myPow(ll x, ll m){
	x%=998244353;
  if(m== 0)
    return 1;
  if(m % 2 == 0)
    return (myPow((x * x)%998244353, m / 2))%998244353;
  else
    return (x * myPow(x, m - 1))%998244353;
}
int main() {
	cin>>n;
	ll ma=0;
	rep(i,0,n){
		cin>>d[i];
		a[d[i]]++;
		ma=max(ma,d[i]);
	}
	if(a[0]!=1||d[0]!=0){
		cout<<0<<endl;
		return 0;
	}
	rep(i,1,ma+1){
		ans=(ans*myPow(a[i-1],a[i]))%998244353;

	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int s;
  double w, h;
  char c;
  while (cin >> s >> c >> w >> c >> h) {
    double bmi = w / (h * h);
    if (bmi - 25 > -1e-10) cout << s << endl;
  }

  return 0;
}


Measured memory_bytes: 3188
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_CUP_MAX		100005									// 最大カップ数

// 内部変数
static FILE *szpFpI;											// 入力
static int si1Cup[D_CUP_MAX];									// カップ
static int siCCnt;												// カップ数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 値 - 入れ替え
int
fSwap(
	int *pipVal1				// <IO> 値１
	, int *pipVal2				// <IO> 値２
)
{
	int liWork = *pipVal1;
	*pipVal1 = *pipVal2;
	*pipVal2 = liWork;

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// カップ数・操作数 - 取得
	int liOCnt;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d", &siCCnt, &liOCnt);

	// ボール位置
	int liBNo = 1;
	si1Cup[liBNo] = 1;

	for (i = 0; ; i++) {

		// 超能力 - 実行
		si1Cup[liBNo - 1] = 1;
		si1Cup[liBNo + 1] = 1;

		// 操作 - 取得
		if (i >= liOCnt) {
			break;
		}
		int liNo1, liNo2;
		fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
		sscanf(lc1Buf, "%d%d", &liNo1, &liNo2);
		fSwap(&si1Cup[liNo1], &si1Cup[liNo2]);

		// ボール位置
		if (liBNo == liNo1) {
			liBNo = liNo2;
		}
		else if (liBNo == liNo2) {
			liBNo = liNo1;
		}
	}

	// ボール数 - 取得
	int liSum = 0;
	for (i = 1; i <= siCCnt; i++) {
		liSum += si1Cup[i];
	}

	return liSum;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// データ - 初期化
	memset(si1Cup, 0, sizeof(si1Cup));							// カップ

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define en '\n'
#define pb push_back
#define mp make_pair

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;

struct aaa {
	aaa() {
		cin.tie(0);
		ios::sync_with_stdio(0);
		cout << fixed << setprecision(20);
	};
}aaaaa;


int main() {
	ll n, p;
	cin >> n >> p;

	if (p == 1) {
		cout << 1 << endl;
		return 0;
	}

	if (n == 1) {
		cout << p << endl;
		return 0;
	}

	map<ll, ll> a;
	ll tmp = p;
	for (ll i = 2; i <= sqrt(tmp); i++) {
		while (p % i == 0) {
			a[i]++;
			p /= i;
		}
	}

	ll ans = 1LL;

	for (auto it = a.begin(); it != a.end(); it++) {
		if (it->second >= n) {
			int c = it->second / n;
			ans *= pow(it->first, c);
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
int main(){
  int n,t;
  scanf("%d %d",&n,&t);
  int from=0;
  int ans=0;
  for(int i=0;i<n;i++){
    int ti;
    scanf("%d",&ti);
    ans+=ti+t-max(from,ti);
    from=ti+t;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 256
N = int(input())
p = 10**9 + 7
A = [int(i) for i in input().split()]
S = sum(A)%p
ans = S**2 % p
B = [(i**2%p) for i in A]
ans -= sum(B)%p
if ans < 0:
    ans += p
if ans % 2 == 0:
    print(ans//2)
else:
    print((ans+p)//2)

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

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

  sort(s, s+n);
  int sum = 0;
  for(int i = 0; i < n-1; i++) sum += s[i];
  cout << sum + s[n-1]/2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 998244353;
const int inf = mod*mod;
const int d5 = 100005;
template <int mod>
struct ModInt{
    int x;
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p){
        if ((x += p.x) >= mod)
            x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p){
        if ((x += mod - p.x) >= mod)
            x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p){
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p){
        *this *= p.inverse();
        return *this;
    }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while (b > 0){
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }

    ModInt pow(int e){
        long long a = 1, p = x;
        while (e > 0){
            if (e % 2 == 0){
                p = (p * p) % mod;
                e /= 2;
            }
            else{
                a = (a * p) % mod;
                e--;
            }
        }
        return ModInt(a);
    }

    friend ostream &operator<<(ostream &os, const ModInt<mod> &p){
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a){
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

using modint = ModInt<mod>;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    if(a[0]!=0){
        cout<<0<<endl;
        return 0;
    }
    sort(All(a));
    int M=a[n-1];
    vector<int> cnt(d5,0);
    for(auto it:a)cnt[it]++;
    modint res=(cnt[0]==1);
    for(int i=1;i<=M;i++)res*=modint(cnt[i-1]).pow(cnt[i]);
    cout<<res<<endl;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

#define INF (INT_MAX/2-1)
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

int main(){
  /*
  int N,K;
  cin>>N>>K;
  */
  string S;
  cin>>S;
  string us={S[0],S[1]};
  int u=atoi(us.c_str());
  string ds={S[2],S[3]};
  int d=atoi(ds.c_str());
  bool uM=false;
  bool dM=false;
  if(1<=u&&u<=12)uM=true;
  if(1<=d&&d<=12)dM=true;
  if(uM&&dM)cout<<"AMBIGUOUS"<<endl;
  else if(uM)cout<<"MMYY"<<endl;
  else if(dM)cout<<"YYMM"<<endl;
  else cout<<"NA"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <string>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define f first
#define s second
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define eb emplace_back
#define in insert
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define FOR(i, n, x) for(int i = x; i < n; i++)
#define OUT(a, e) FOR(i, e, 0) cout << a[i] << ' '
#define OUTV(a) for(auto i : a) cout << i << ' ';
#define maxim(a, n, mx) FOR(i, n, x)mx = max(mx, a[i]);
using namespace std;
const int N = 1e5 + 2;
ll ansmax = 1e9 + 7, ansmin = -1e9;

ll a[N + 2], tmin[4 * N], tmax[4 * N];
void buildmin(int v, int l, int r)
{
    if(l == r)
    {
        tmin[v] = a[l - 1];
        return;
    }
    int mid = (l + r) / 2;
    buildmin(2 * v, l, mid);
    buildmin(2 * v + 1, mid + 1, r);
    tmin[v] = min(tmin[2 * v], tmin[2 * v + 1]);
}
void buildmax(int v, int l, int r)
{
    if(l == r)
    {
        tmax[v] = a[l - 1];
        return;
    }
    int mid = (l + r) / 2;
    buildmax(2 * v, l, mid);
    buildmax(2 * v + 1, mid + 1, r);
    tmax[v] = max(tmax[2 * v], tmax[2 * v + 1]);
}

void get_min(int v, int l, int r, int nl, int nr)
{
   // cout << v << ' ' << l << ' ' << r << endl;
    if(l > r || r < nl || l > nr)return;
    if(l >= nl && r <= nr)
    {
        ansmin = min(tmin[v], ansmin);
        return;
    }
    int mid = (l + r) / 2;
    get_min(2 * v, l, mid, nl, nr);
    get_min(2 * v + 1, mid + 1, r, nl, nr);
    return;
}
void get_max(int v, int l, int r, int nl, int nr)
{
   // cout << v << ' ' << l << ' ' << r << endl;
    if(l > r || r < nl || l > nr)return;
    if(l >= nl && r <= nr)
    {
        ansmax = max(tmax[v], ansmax);
        return;
    }
    int mid = (l + r) / 2;
    get_max(2 * v, l, mid, nl, nr);
    get_max(2 * v + 1, mid + 1, r, nl, nr);
    return;
}

void updatemin(int v, int tl, int tr, int pos, int new_val) {
	if (tl == tr)
		tmin[v] = new_val;
	else {
		int tm = (tl + tr) / 2;
		if (pos <= tm)
			updatemin(v*2, tl, tm, pos, new_val);
		else
			updatemin(v*2+1, tm+1, tr, pos, new_val);
		tmin[v] = min(tmin[v*2], tmin[v*2+1]);
	}
}
void updatemax(int v, int tl, int tr, int pos, int new_val) {
	if (tl == tr)
		tmax[v] = new_val;
	else {
		int tm = (tl + tr) / 2;
		if (pos <= tm)
			updatemax(v*2, tl, tm, pos, new_val);
		else
			updatemax(v*2+1, tm+1, tr, pos, new_val);
		tmax[v] = max(tmax[v*2], tmax[v*2+1]);
	}
}


int main() {
    fast;
    int n; cin >> n;
    string s; cin >> s;
    int ans = 1;
    FOR(i, n, 1)
    {
        if(s[i] == s[i - 1])continue;
        else ans ++;
    }
    if(s[n - 1] != s[n - 2])ans+9;
    cout << ans;
	return 0;
}
/*
6 4
1 4 2 0 5 3
2 5
*/


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

using namespace std;
using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define rep(i, N) for (ll i = 0; i < (N); i++)
#define For(i, a, b) for (ll i = (a); i < (b); i++)
#define all(A) (A).begin(), (A).end()

int main(){
    int N;
    cin >> N;
    ll A[N + 1];
    rep(i, N + 1) cin >> A[i];
    ll B[N];
    rep(i, N) cin >> B[i];
    ll ans = 0;

    rep(i, N) {
        if (B[i] <= A[i]) {
            ans += B[i];
        }
        else {
            ans += A[i];
            ll left = B[i] - A[i];
            if (left <= A[i + 1]) {
                ans += left;
                A[i + 1] -= left;
            }
            else {
                ans += A[i + 1];
                A[i + 1] = 0;
            }
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	string st;
	cin>>st;
	for(int i=0;i<st.size();i++)
		if(st[i]=='9')cout<<'1';
		else cout<<'9';
	cout<<endl;	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{

    int n, x, i, k, j;
    int count;

    while (1){
        scanf("%d %d", &n, &x);

        count = 0;

        if (n == 0 && x == 0) break;

        for (i = 1; i <= n; i++){
            for (k = i + 1; k <= n; k++){
                for (j = k + 1; j <= n; j++){
                    if (i + k + j  == x){
                        count++;
                    }
                }
            }
        }

        printf("%d\n", count);
    }

    return (0);
}



Measured memory_bytes: 2056
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#pragma GCC optimize("Os")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
using namespace std;
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
void vok()
{
    FAST
    FO
    FI
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("error.txt","w",stderr);
    #endif
}
int main()
{
    vok();
    ld n;
  IN n;
  ll nn=n;
  ld temp=n/1000.0;
  ll haha=ceil(temp);
  ll change=(haha*1000)-n;
  OUT change<<endl
    return 0;
}

Measured memory_bytes: 3800
#include<bits/stdc++.h>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i,x) for(int (i)=0;(i)<(x);(i)++)
inline int getint(){
    int x=0,p=1;char c=getchar();
    while (c<=32)c=getchar();
    if(c==45)p=-p,c=getchar();
    while (c>32)x=x*10+c-48,c=getchar();
    return x*p;
}
using namespace std;
//ruogu
const ull e=65436534565367ull;
int n;
string s;
map<ull,int>Mp;
ll res;
//
int main(){
	n=getint();
	rep(i,n){
		cin>>s;
		sort(s.begin(),s.end());
		ull ans=0;
		rep(j,s.size()){
			ans*=e;
			ans+=s[j];
		}
		res+=1ll*Mp[ans];
		Mp[ans]++;
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
	int n; cin >> n;
	vector<ll> a(n+1);
	for(int i = 0; i < n; ++i){
		cin >> a[i+1];
    }
    a.push_back(0);
    ll cost;
    for(int i = 0; i < n+1; ++i){
    	cost += abs(a[i+1]- a[i]);
    }
    for(int i = 0; i < n; ++i){
    	ll ans = cost;
        if((a[i+1]>a[i] && a[i+1] > a[i+2]) ||
            (a[i+1]<a[i] && a[i+1] < a[i+2])){
        	ans -= abs(a[i+1]-a[i]);
        	ans -= abs(a[i+2]-a[i+1]);
                ans += abs(a[i+2]-a[i]);
        }
        else{
        }
        cout << ans << endl;
    }
    return 0;
}

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

#define MOD 1000000007
#define PI 3.141592653589793

typedef unsigned long long ull;
typedef long long ll;
using namespace std;

void testCase() {
	ll a, v, b, w, t;
	cin >> a >> v >> b >> w >> t;
	if(w >= v) {
		cout << "NO\n";
		return;
	}
	if((double) abs(a - b) / (double) (v - w) <= (double) t) cout << "YES\n";
	else cout << "NO\n";
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int T = 1;
	//cin >> T;
	while(T--) {
		testCase();
	}
}


Measured memory_bytes: 3652
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int X = scan.nextInt();
        int Y = scan.nextInt();
        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();
        PriorityQueue<Holder> q = new PriorityQueue<>(Comparator.reverseOrder());
        for (int i = 0; i < A; i++) {
            q.add(new Holder(scan.nextInt(), 0));
        }
        for (int i = 0; i < B; i++) {
            q.add(new Holder(scan.nextInt(), 1));
        }
        for (int i = 0; i < C; i++) {
            q.add(new Holder(scan.nextInt(), 2));
        }
        long ans = 0;
        int[] remain = {X, Y};
        int ate_white = 0;
        while (remain[0] + remain[1] > ate_white) {
            Holder h = q.poll();
            if (h.type == 2) {
                ans += h.value;
                ate_white += 1;
                continue;
            }
            if (0 < remain[h.type]) {
                ans += h.value;
                remain[h.type] -= 1;
            }
        }
        System.out.println(ans);
    }
    class Holder implements Comparable<Holder> {
        int value;
        int type;
        Holder(int value, int type) {
            this.value = value;
            this.type = type;
        }

        @Override
        public int compareTo(Holder o) {
            if (this.value != o.value) {
                return Integer.compare(this.value, o.value);
            }
            return Integer.compare(this.type, o.type);
        }
    }
}


Measured memory_bytes: 102340
#!/usr/bin/env python3
import sys


def solve(N: int, R: int):
    if N >= 10:
        print((R))
    else:
        print(R + 100 * (10 - N))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(N, R)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include<stdio.h>
#include<stdlib.h>
#define N 1e5

int partition(int*, int, int);

int partition(int *A, int p, int r){

  int x=A[r], i=p-1, j, tmp;

  for(j=p;j<r;j++){

    if(A[j]<=x){

      i++;

      tmp=A[i];

      A[i]=A[j];

      A[j]=tmp;

    }

  }tmp=A[i+1];

  A[i+1]=A[r];

  A[r]=tmp;

  return i+1;

}

int main(){

  int i, n, q;

  int *A=(int*)malloc(sizeof(int)*N);

  scanf("%d", &n);

  for(i=0;i<n;i++) scanf("%d", &A[i]);

  q=partition(A, 0, n-1);

  printf("%d", A[0]);

  for(i=1;i<n;i++){

    if(i==q) printf(" [%d]",A[i]);

    else printf(" %d", A[i]);

  }printf("\n");

  free(A);

  return 0;

}



Measured memory_bytes: 2108
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;

int main(){
  string S;
  cin >> S;

  if(S=="ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
  
  return 0;
}


Measured memory_bytes: 3620