akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.buffer.readline
N, M = map(int, input().split())
d = [[float("inf")] * (N + 1) for _ in range(N + 1)]
e = [[0] * (N + 1) for _ in range(N + 1)]
prev = [[-1] * (N + 1) for _ in range(N + 1)]
res = 2 * M
for _ in range(M):
  a, b, c = map(int, input().split())
  d[a][b] = c
  d[b][a] = c
for k in range(1, N + 1):
  for i in range(1, N + 1):
    for j in range(1, N + 1):
      if d[i][j] > d[i][k] + d[k][j]:
        d[i][j] = d[i][k] + d[k][j]
        if prev[k][j] == -1:
          prev[i][j] = k
        else:
          prev[i][j] = prev[k][j]
for i in range(1, N):
  for j in range(i + 1, N + 1):
    s = i
    t = j
    while prev[s][t] != -1:
      p = prev[s][t]
      e[p][t] = 1
      e[t][p] = 1
      t = p
    e[s][t] = 1
    e[t][s] = 1
for i in range(1, N + 1):
  res -= sum(e[i])
print(res // 2)

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

int main(){
  int a,b,c,x;
  cin >> a >> b >> c >> x;
  int counter = 0;
  for(int A = 0;A<=a;A++){
    for(int B = 0;B<=b;B++){
      for(int C = 0;C<=c;C++){
        int total = 500*A + 100*B + 50*C;
        if(total == x){
          counter++;
        }
      }
    }
  }
  cout << counter << endl;
}


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

int main() {
  int a, b, c;
  c = 0;
  cin >>a >>b;
  vector<int> vec(a);
  for (int i = 0; i < a; i++) {
    cin >> vec.at(i);
    }

  
  for(int j=0; j<a; j++){
    if(vec.at(j)>=b){
      c = c+1;
    }
    else{
    }
  }
  cout <<c <<endl;
    
}


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

using namespace std ;

#define ll long long
const int mod = 1e9 + 7 ;

ll n ;
map< ll , ll > f ;

ll dp( ll x ) {
	if( f[ x ] ) return f[ x ] ;
	return f[ x ] = ( dp ( x >> 1 ) + dp( ( x - 1 ) >> 1 ) + dp( ( x - 2 ) >> 1 ) ) % mod; 
}

int main() {
	scanf( "%lld" , &n ) ;
	f[ 0 ] = 1 ; f[ 1 ] = 2 ;
	printf( "%lld\n" , dp( n ) ) ;
} 

Measured memory_bytes: 256
N = gets.to_i
t,a = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)
near_k=10**9
near_i=10**9
h.each_with_index do |x,i|
    k=t-x*0.006
    diff = (a-k).abs
    if diff < near_k
        near_k = diff
        near_i = i
    end
end
puts near_i+1

Measured memory_bytes: 14256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main() {
	int n;
	cin >> n;
	vector<int> v(n), c(n);
	rep(i,n) cin >> v[i];
	rep(i,n) cin >> c[i];
	int ans = 0;
	rep(i,n) {
		if(v[i]>c[i]) ans += v[i]-c[i];
	}
	cout << ans << endl;
}


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

vector< vector<int> > G;
ll n, k;
const int mod = 1000000007;
vector<ll> kids;
vector<int> seen;

// rootを決めた場合の、各頂点のkidsの数を数える
// kids[v] := v の 子の数
ll bfs(int v){

    for(int i = 0; i < n; i++){
        seen[i] = 0;
    }

    queue<int> que;
    que.push(v);
    seen[v] = 1;

    ll ans = k;

    while(!que.empty()){
        int now = que.front();
        que.pop();
        for(auto nv : G[now]){
            if(seen[nv] != 0) continue;
            else{
                que.push(nv);
                seen[nv] = 1;
                kids[now]++;
                if(now == v){
                    ans *= (k - 1 - kids[now] + 1);
                    ans %= mod;
                }
                else{
                    ans *= (k - 2 - kids[now] + 1);
                    ans %= mod;
                }
            }
        }
    }

    return ans;
}


int main(void){
    cin >> n >> k;
    G.assign(n, vector<int>());
    for(int i = 0; i < n-1; i++){
        int a, b; cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    kids.resize(n);
    seen.resize(n);

    cout << bfs(0) << endl;
    return 0;
}

Measured memory_bytes: 10612
/*
 *
 *	Author: r3gz3n
 *	Description: 
 *	Difficulty: 
 *
 */

#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define be begin()
#define en end()
#define all(x) (x).begin(),(x).end()
#define alli(a, n, k) (a+k),(a+n+k)
#define REP(i, a, b, k) for(__typeof(a) i = a;i < b;i += k)
#define REPI(i, a, b, k) for(__typeof(a) i = a;i > b;i -= k)
#define REPITER(it, a) for(__typeof(a.begin()) it = a.begin();it != a.end(); ++it)

#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds

#define eps 1e-6
#define pi 3.141592653589793

using namespace std;

template<class T> inline T gcd(T x, T y) { if (!y) return x; return gcd(y, x%y); }
template<class T> inline T mod(T x) { if(x < 0) return -x; else return x; }

typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector< pair<int, int> > VPII;
typedef vector< pair<int, PII > > VPPI;

const int MOD = 1e9 + 7;
const int INF = 1e9;

int main(int argc, char* argv[])
{
	if(argc == 2 or argc == 3) freopen(argv[1], "r", stdin);
	if(argc == 3) freopen(argv[2], "w", stdout);
	ios::sync_with_stdio(false);
	ll a, b;
	char c;
	cin >> a >> c >> b;
	if(c == '-') cout << a-b << endl;
	else cout << a+b << endl;
	return 0;
}


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

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

int main() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll sumC, sumD, sumCD;
    ll lcmCD = lcm(C, D);
    sumC = B / C - (A - 1) / C;
    sumD = B / D - (A - 1) / D;
    sumCD = B / lcmCD - (A - 1) / lcmCD;
    ll ans = B - A + 1 - sumC - sumD + sumCD;
    cout << ans << endl; 
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
using namespace std;
#define LONG_INF 10000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353LL
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	while (true) {
		long long b;
		cin >> b;
		if (b == 0) return 0;
		long long now = 0;
		long long back = 1;
		for (long long i = 1;; ++i) {
			now += i;
			while (now > b) {
				now -= back;
				back++;
			}
			if (now == b) {
				cout << back << " " << i - back+1LL << endl;
				break;
			}
		}
	}
}


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

using ll = long long;

ll gcd(ll a, ll b){
    if (b==0) return a;
    return gcd(b, a%b);
}
//ll lcm(ll a, ll b){
//    ll g = gcd(a, b);
//    return a / g * b
//}

int main(){
    int n; cin >> n;
    long long int t[n+1];
    for (int i=0; i<n; i++) cin >> t[i];
    long long int lcm = t[0];
    for (int i=0; i<n-1; i++){
        lcm = t[i] / gcd(t[i], t[i+1]) * t[i+1];
        t[i+1] = lcm;
    }
    cout << lcm << endl;
}

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

int main(){

	int N;
	cin >> N;
	vector<int> a(110);
	for(int i = 0; i < N; i++){
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	int A=0, B=0;
	for(int i = 0; i < N; i+=2)
	{
		A+=a[i];
		B+=a[i+1];
	}
	cout << A - B << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
using namespace std;
typedef long long ll;

const ll MOD = 1e9+7;


int main()
{
	int a,b;
	ll ans=0;
	cin>>a>>b;
	if(a>=13)
		ans=b;
	else if(a<6)
		ans=0;
	else
		ans=b/2;
	cout<<ans<<endl;
	return 0;
}

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

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

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

ull gcd(const ull& a, const ull& b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}

int main() {
  ull A, B, C, D;
  cin >> A >> B >> C >> D;

  ull N = B - A + 1;
  ull a = (B/C) - ((A-1)/C);
  ull b = (B/D) - ((A-1)/D);

  ull CD_prime = C*D/gcd(C, D);

  ull ab = (B/CD_prime) - ((A-1)/CD_prime);

  cout << (N+ab-a-b) << '\n';
}


Measured memory_bytes: 888
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);


int main()
{
    //IOS();
    string s;
    cin>>s;
    if(SZ(s)>=4&&s.substr(0,4)=="YAKI")puts("Yes");
    else puts("No");
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
using namespace std;
typedef pair<int,int>P;
int h[310000],w[310000];
int H,W,m,x,y,maxh,maxw;
map<P,int>f;
int main(void)
{
    scanf("%d %d %d",&H,&W,&m);
    while(m--)
    {
        scanf("%d %d",&x,&y);
        f[P(x,y)]=1;
        h[x]++;
        w[y]++;
    }
    for(int i=1;i<=H;i++)maxh=max(maxh,h[i]);
    for(int i=1;i<=W;i++)maxw=max(maxw,w[i]);
    vector<int>hh,ww;
    for(int i=1;i<=H;i++)
        if(h[i]==maxh)hh.push_back(i);
    for(int i=1;i<=W;i++)
        if(w[i]==maxw)ww.push_back(i);
    for(int i=0;i<hh.size();i++)
        for(int j=0;j<ww.size();j++)
            if(f[P(hh[i],ww[j])]==0)
            {
                printf("%d\n",maxw+maxh);
                return 0;
    }
    printf("%d\n",maxh+maxw-1);
    return 0;
}

Measured memory_bytes: 28568
#include "iostream"
using namespace std;
int main()
{
    int t = 1;
    //cin >> t;
    while(t--){
        string str;
        cin >> str;
        string s1 = "AAA", s2 = "BBB";
        if(str == s1 || str == s2)
            cout << "No" << endl;
        else
            cout << "Yes" << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
	int n;
	cin >> n;

	for (int i = 1; i < 10; i++) {
		for (int j = 1; j < 10; j++) {
			if (i * j != n) {
				continue;
			}

			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long X, K, D, n;
  cin >> X >> K >> D;
  X = abs(X);  // X >= 0で考える(絶対値なので)
  n = X / D;
  if (n > K) {  // XがD以下になるために、K回より多く移動しないといけないとき
    X -= D * K;  // マイナス方向にDだけ移動をK回だけ繰り返す(これが一番近づけられる)
  }
  else {  // K回以下でXがD以下になれるとき
    X -= n * D;  // XをD以下にする
    K -= n;  // XがD以下になるまでの回数を引く
    if (K % 2 == 1) {  //残り回数が奇数回のとき
      X = abs(X - D);
    }
//--(X-2D)----------(X-D)----(0)------(X)----------(X+D)----------(X+2D)
//                         4       6
// 残り奇数回→(X-(奇数)D)に動く→最も絶対値が小さいのは(X-D)(←負なので絶対値に直すことに注意)
// 残り偶数回→(X-(偶数)D)に動く→最も絶対値が小さいのは(X)
  }
  cout << X << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

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

struct roulette
{
    int i, num;
    roulette(int i, int num): i(i), num(num) {}

    bool operator < (const roulette& rhs) const { return num > rhs.num; }
};

int main()
{
    int N, M;
    cin >> N >> M;
    string S;
    cin >> S;

    // dp[i] := 後ろから i 番目にn到達するのに必要な最小の手数
    vector<int> dp(N+1, 0);
    priority_queue<roulette> q;
    q.emplace(roulette(N, 0));
    for(int i = N-1; i >= 0; --i){
        if(S[i] == '1') continue;
        auto top = q.top();
        while(!q.empty() and top.i-i > M){
            q.pop();
            top = q.top();
        }
        dp[i] = top.num+1;
        q.push(roulette(i, top.num+1));
    }

    vector<int> ans;
    int curr = 0;
    bool ok = true;
    REP(i, N+1){
        if(S[i] != '1' and dp[curr] != dp[i]){
            if(i - curr > M){
                ok = false;
                break;
            }
            ans.push_back(i-curr);
            curr = i;
        }
    }
    if(ok) for(auto n: ans) cout << n << " ";
    else cout << -1;
    cout << endl;

    return 0;
}

Measured memory_bytes: 1912
X, N = gets.strip.split(' ').map(&:to_i)
P = gets.strip.split(' ').map(&:to_i)

res = []

s = 0
while res.empty? do
    res.push(X - s) unless P.include?(X - s)
    res.push(X + s) unless P.include?(X + s)
    s += 1
end
puts res.min

Measured memory_bytes: 14396
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int 	     	  long long   // [9,223,372,036,854,775,807 to -9.....808] 19 digits
#define pb                push_back 
#define all(x)            (x).begin(),(x).end()
#define mp                make_pair
#define vi                vector<int> 
#define vpi               vector<pair<int,int>>
#define mii               map<int,int>
#define x                 first
#define y                 second 
#define mem(a,x)          memset(a,x,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define sz(x)             (int)((x).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order()  // order_of_key

//const int32_t hellhsh = 444440583533; const double pi=2*acos(0.0); 
const int32_t mod = 1e9+7;
const int32_t maxn=2e5+5;
int inf=1e18;

void solve(){
    int n,k;cin>>n>>k;
    bool dp[k+1]={0};
    int a[n];rep(i,0,n) cin>>a[i];

    rep(x,1,k+1){
        bool res=0;
        rep(i,0,n){
            if(a[i]>x) continue;
            res|=!dp[x-a[i]];
        }
        dp[x]=res;
    }
    if(dp[k]) cout<<"First";
    else cout<<"Second"; 
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tc=1,k=1;                                                                                                                  
    //cin>>tc;
    while(tc--){
        //cout<<"Case #"<<k++<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n, m;
  cin >> n >> m;
  string a[55], b[55];
  rep(i, n){
    cin >> a[i];
  }
  rep(i, m){
    cin >> b[i];
  }
  for(int i = 0;i <= n - m;i ++){
    for(int j = 0;j <= n - m;j ++){
      if(a[i][j] == b[0][0]){
	bool out = false;
	rep(x, m){
	  rep(y, m){
	    if(a[i + x][j + y] != b[x][y]){
	      out = true;
	    }
	  }
	}
	if(!out){
	  cout << "Yes\n";
	  return 0;
	}
      }
    }
  }
  cout << "No\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=600000+10;
int n,k,c;
char s[N];
int pre[N], suf[N], las[N];
int val[N], mx[(400000)<<2];
void build(int l,int r,int rt){
	if(l==r){
		mx[rt]=val[l]; return;
	}
	int mid=(l+r)>>1;
	build(l,mid,rt<<1);
	build(mid+1,r,rt<<1|1);
	mx[rt]=max(mx[rt<<1],mx[rt<<1|1]);
}
int C=0;
int query(int l,int r,int rt,int L,int R){
	//printf("que %d %d %d %d %d\n", l,r,rt,L,R); ++C; if(C>=40) return 0;
	if(L<=l&&r<=R) return mx[rt];
	int mid=(l+r)>>1;
	int ans=0;
	if(L<=mid) ans=max(ans,query(l,mid,rt<<1,L,R));
	if(R >mid) ans=max(ans,query(mid+1,r,rt<<1|1,L,R));
	return ans;
}
int main() {
	scanf("%d%d%d%s",&n,&k,&c,s+1);
	if(c==0) {
		int cnt=0;
		for(int i=1;i<=n;i++) if(s[i]=='o') cnt++;
		//printf("cnt = %d\n", cnt);
		if (cnt > k) {
			return 0;
		} 
		for(int i=1;i<=n;i++) {
			if(s[i]=='o')printf("%d\n", i);
		}
		return 0;
	}
	for(int i=1;i<=2*n;i++){
		if(s[i]=='o') las[i]=i;
		else las[i]=las[i-1];
	}
	for(int i=1;i<=2*n;i++){
		pre[i]=pre[i-1];
		if(i>=c+1){
			int pos=las[i-c];
			//printf("i=%d, pos=%d\n", i,pos);
			if(pos>=1) pre[i]=max(pre[pos-1]+1, pre[pos]);
		}
		//printf("pre[%d]=%d\n", i,pre[i]);
	}
	//printf("# %d\n", pre[10]);
	for(int i=2*n;i>=1;i--){
		suf[i]=suf[i+1];
		if(s[i]=='o'){
			suf[i]=max(suf[i+c+1]+1, suf[i]);
		}
		//printf("suf[%d]=%d\n", i,suf[i]);
	}
	for(int i=0;i<=2*n;i++) {
		val[i]=pre[i]+suf[i+1];
		//printf("val[%d] = %d\n", i,val[i]);
	}
	build(0,2*n,1);
	for(int i=1;i<=n;i++){
		// pre[i] + suf[i+1], .... pre[i+c-1] + suf[i+c]
		if(s[i]=='o') {
			//printf("[%d, %d] %d\n", i,min(i+c-1,n),query(0,n,1,i,min(i+c-1,n)));
		}
  		if(query(0,2*n,1,i,i+c-1)<k && s[i]=='o') {
			//printf("%d %d %d\n", i,pre[i],suf[i+1]);
			printf("%d\n", i);
		}
	}
}

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

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

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    int A, B;
    std::cin >> A >> B;

    if((B / (double)(A)) == floor(B / (double)(A))) {
        std::cout << A + B << std::endl;
    }
    else {
        std::cout << B - A << std::endl;
    }

    return 0;
}


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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef tree<long double, null_type, less<long double>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAXN = 200 * 1000 + 23;
const long double E = 1e-6;






int n, k;
ll ps[MAXN], ans;
long double tav;

int main() {
    ordered_set os;
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> ps[i], ps[i] -= k - ps[i - 1];
    os.insert(0);
    for (int i = 1; i <= n; i++) {
        ans += os.order_of_key(ps[i] + 1);
        tav += E;
        os.insert(ps[i] + tav);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 17536
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var s string
	fmt.Scan(&s)
	
	ans := 0
	for _, v := range s {
		i, _ := strconv.Atoi(string(v))
		ans += i
	}
	
	fmt.Print(ans)
}

Measured memory_bytes: 1772
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a,b,c;
  a=n%10;
  b=((n-a)%100)/10;
  c=((n-a-b)%1000)/100;
  if(a==7||b==7||c==7){
cout<<"Yes";
  }
else{
cout<<"No";
}
}
  

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
typedef long long ll;
int comb2(int n){
  if(n<2){
    return 0;
  }else{
    return n*(n-1)/2;
  }
}

int main() {
  int n,m;
  cin >> n >> m;
  cout << comb2(n)+comb2(m)<< endl;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
int n,a[222][222],y,x,t,d[6],b[222][222],f;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
vector<P>v;
void make_dice(){
  d[0]=t;
  d[1]=f;
  d[3]=7-f;
  d[5]=7-t;
  if(t==1){
    if(f==3)d[2]=5,d[4]=2;
    if(f==5)d[2]=4,d[4]=3;
    if(f==4)d[2]=2,d[4]=5;
    if(f==2)d[2]=3,d[4]=4;
  }
  if(t==2){
    if(f==1)d[2]=4,d[4]=3;
    if(f==4)d[2]=6,d[4]=1;
    if(f==6)d[2]=3,d[4]=4;
    if(f==3)d[2]=1,d[4]=6;
  }
  if(t==3){
    if(f==1)d[2]=2,d[4]=5;
    if(f==2)d[2]=6,d[4]=1;
    if(f==6)d[2]=5,d[4]=2;
    if(f==5)d[2]=1,d[4]=6;
  }
  if(t==4){
    if(f==1)d[2]=5,d[4]=2;
    if(f==2)d[2]=1,d[4]=6;
    if(f==6)d[2]=2,d[4]=5;
    if(f==5)d[2]=6,d[4]=1;
  }
  if(t==5){
    if(f==3)d[2]=6,d[4]=1;
    if(f==6)d[2]=4,d[4]=3;
    if(f==4)d[2]=1,d[4]=6;
    if(f==1)d[2]=3,d[4]=4;
  }
  if(t==6){
    if(f==3)d[2]=2,d[4]=5;
    if(f==5)d[2]=3,d[4]=4;
    if(f==4)d[2]=5,d[4]=2;
    if(f==2)d[2]=4,d[4]=3;
  }
}
void rot1(){
  swap(d[1],d[0]);
  swap(d[0],d[3]);
  swap(d[3],d[5]);
}
void rot2(){
  swap(d[2],d[0]);
  swap(d[0],d[4]);
  swap(d[4],d[5]);
}
void rot3(){
  swap(d[4],d[0]);
  swap(d[0],d[2]);
  swap(d[2],d[5]);
}
void rot4(){
  swap(d[3],d[0]);
  swap(d[0],d[1]);
  swap(d[1],d[5]);
}
void rot(int p){
  if(p==0)rot1();
  if(p==1)rot2();
  if(p==2)rot4();
  if(p==3)rot3();
}
void v_set(){
  r(i,4)v.push_back(P(d[i+1],i));
}
int main(){
  while(cin>>n,n){
    memset(a,0,sizeof(a));
    memset(b,0,sizeof(b));
    while(n--){
      y=x=100;
      cin>>t>>f;
      make_dice();
      while(1){
	int flag=0;
	v.clear();
        v_set();
	sort(v.begin(),v.end());
	for(int i=3;i>=0;i--)if(v[i].first>3){
	  int xx=x+dx[v[i].second];
	  int yy=y+dy[v[i].second];
	  if(a[yy][xx]<a[y][x]){
	    x=xx,y=yy;
	    rot(v[i].second);
	    flag++;
	    break;
	  }
	}
	if(!flag){
	  a[y][x]++;
	  b[y][x]=d[0];
	  break;
	}
      }
    }
    int ans[6]={};
    r(i,222)r(j,222)if(b[i][j])ans[b[i][j]-1]++;
    cout<<ans[0];
    r(i,5)cout<<' '<<ans[i+1];
    cout<<endl;
  }
}

Measured memory_bytes: 3496
#include <iostream>

using namespace std;

int main()
{
    int n;
    long s;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s;
        cout << "Case " << i + 1 << ":\n" ;

        long long tmp;
        for (int j = 0; j < 10; j++) {
            s *= s;
            s /= 100;
            s %= 10000;
            
            cout << s << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1160
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


n = onem()

a = l()

a.sort()

a = s(a)

if len(a) == 1:
    if a[0][0] == 0:
        print("Yes")
        exit()
elif len(a) == 2:
    if a[0][0] == 0:
        if a[0][1] == n//3 and a[1][1] == (2*n)//3:
            print("Yes")
            exit()

elif len(a) == 3:
    if not (a[0][0] ^ a[1][0] ^ a[2][0]):
        if (a[0][1] == n//3 and a[1][1] == n//3 and a[2][1] == n//3):
            print("Yes")
            exit()
            
print("No")


Measured memory_bytes: 14764
#include<iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2],R[MAX/2+2];
int cnt;

void merge(int A[],int n,int left,int mid,int right){
  int n1 = mid - left;
  int n2 = right - mid;
  for(int i = 0; i < n1; i++)L[i] = A[left + i];
  for(int i = 0; i < n2; i++)R[i] = A[mid + i];
  L[n1]= R[n2] = SENTINEL;
  int i = 0, j = 0;
  for(int k = left; k < right; k++){
    cnt++;
    if(L[i] <= R[j]){
      A[k] = L[i++];
    }else{
      A[k] = R[j++];
    }
  }
}

void mergeSort(int A[], int n,int left,int right){
  if(left+1 < right){
    int mid = (left + right) /2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid,right);
    merge(A,n,left,mid,right);
  }
}

int main(){
  int A[MAX],n,i;
  cnt = 0;

  cin >> n;
  for(i =0;i<n;i++)cin >> A[i];

  mergeSort(A,n,0,n);

  for(i = 0; i < n; i++){
    if(i) cout << " ";
    cout << A[i];
  }
  cout << endl;

  cout << cnt << endl;

  return 0;

}

Measured memory_bytes: 5060
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(b-a==c-b)printf("YES");
    else printf("NO");
    return 0;
}


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

int main(){
	int H, W;
	cin >> H >> W;
	int i, j, B[H][W];;
	char A[H][W];
	for(i=0; i<H; i++){
		for(j=0; j<W; j++){
			cin >> A[i][j];
			if(A[i][j]=='#')	B[i][j] = 1;
			else			B[i][j] = 0;
		}
	}
	
	//行列ごとの計算
	int sumH[H], sumW[W];
	for(i=0; i<H; i++){
		sumH[i]=0;
		for(j=0; j<W; j++){
			sumH[i] += B[i][j];
		}
	}
	for(j=0; j<W; j++){
		sumW[j]=0;
		for(i=0; i<H; i++){
			sumW[j] += B[i][j];
		}
	}
	
	//移動
	int k, countH=0, countW=0;
	for(i=H-1; i>=0; i--){
		if(sumH[i]==0){
			countH++;
			for(j=0; j<W; j++){
				for(k=i; k<H; k++){
					A[k][j] = A[k+1][j];
				}
			}
		}
	}
	H -= countH;

	for(j=W-1; j>=0; j--){
		if(sumW[j]==0){
			countW++;
			for(i=0; i<H; i++){
				for(k=j; k<W; k++){
					A[i][k] = A[i][k+1];
				}
			}
		}
	}
	W -= countW;
	
	for(i=0; i<H; i++){
		for(j=0; j<W; j++){
			cout << A[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Date;

class Main{
  public static void main(String[] args)throws IOException{
	
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
	
	int x = Integer.parseInt(str);
    int h = x/3600;
    int m = x%3600/60;
    int s = x%60;

	System.out.println(h + ":" + m + ":" + s);
  }
}

Measured memory_bytes: 24248
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;
ll n,m,sum=0;
ll a[110000];
pair<ll,ll>x[110000];
int main(){
    cin>>n>>m;
    ll ps1=0,ps2=m-1;//降順ソート出来ればps2=0
    rep(i,0,n){cin>>a[i];sum+=a[i];}
    rep(i,0,m)cin>>x[i].second>>x[i].first;
    sort(x,x+m);
    //sort(x,x+m,greater<ll>());これでコンパイルエラー;;
    //８行目をvector<pair>>x;にして　sort(x.rbegin(),x.rend());でセグフォ;;
    sort(a,a+n);
    bool p=true;
    while(p&&ps2>=0&&ps1<n){
        if(x[ps2].first>a[ps1] && x[ps2].second>0){sum+=x[ps2].first-a[ps1];ps1++;x[ps2].second--;}
        else if(x[ps2].first<=a[ps1])p=false;
        else if(x[ps2].second==0)ps2--;//降順ソート出来たらps2++;の予定だった..
    }
    cout<<sum;
}


Measured memory_bytes: 2560
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		scan.close();
		if(a < b && b < c && a < c) {
			System.out.println("Yes");
			
		}else {
			System.out.println("No");
		}
		
		// TODO 自動生成されたメソッド・スタブ

	}

}


Measured memory_bytes: 26220
/*
	*	Created By: 'Present_Sir'
	*	Created On: Sunday 16 August 2020 11:59:59 AM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define int long long
using namespace std;


void solve(){   
    string s;
    cin>>s;

    if(s[0] == 'R' and s[1] == 'R' and s[2] == 'R'){
        cout<<"3"<<endl;
        return;
    }
    if(s[0] == 'R' and s[1] == 'R'){
        cout<<"2"<<endl;
        return;
    }
    if(s[1] == 'R' and s[2] == 'R'){
        cout<<"2"<<endl;
        return;
    }
    if(s[0] == 'R' or s[1] == 'R' or s[2] == 'R'){
        cout<<"1"<<endl;
        return;
    }
    cout<<"0"<<endl;
}

int32_t main(){
    IOS;
    //int t; cin>>t; while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3600
n,W = map(int,input().split())
w,v = [0] * n ,[0] * n
for i in range(n):
    w[i] ,v[i] = map(int,input().split())

import numpy as np
ndp = np.zeros(W+1,dtype= np.int64)
for w,v in zip(w,v):
    np.maximum(ndp[:-w] + v, ndp[w:], out = ndp[w:])
print(ndp[-1])

Measured memory_bytes: 14680
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <iomanip>

using namespace std;
#define LOCAL  1
#define UPLOAD 2
#define ll long long
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
  int a1 = input();
  int a2 = input();
  int a3 = input();

  if(a1 + a2 + a3 >= 22){
    output("bust");
  }
  else{
    output("win");
  }

  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC_109_B solver = new ABC_109_B();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC_109_B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            List<String> list = new ArrayList<String>();

            for (int i = 0; i < n; i++) {
                String str = in.next();
                if (list.contains(str)) {
                    out.print("No");
                    return;
                }
                list.add(str);
            }
            for (int i = 0; i < n - 1; i++) {
                String str1 = list.get(i);
                String str2 = list.get(i + 1);

                if (str1.charAt(str1.length() - 1) != str2.charAt(0)) {
                    out.print("No");
                    return;
                }
            }

            out.print("Yes");

        }

    }
}



Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main () {
  long long a;
  cin >> a;
  string key = "0123456789";
  string b;
  cin >> b;
  int n = (int)b.size();
  int c = 0;
  for (int i = 0; i < n; i ++) {
    if (b[i] == '.') continue;
    c *= 10;
    for (int j = 0; j < 10; j ++) {
      if (b[i] == key[j]) c += j;
    }
  }
  //cout << c << endl;
  long long d = c;
  cout << (a * d) / 100 << endl;
}



Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

typedef long long ll;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define vec_all(vec) vec.begin(), vec.end()

int main()
{
    int n;
    cin >> n;

    vector<int> x(n);
    rep(i, n) {
        cin >> x[i];
    }

    vector<pair<int, int>> prosecced_x(n);
    rep(i, n) {
        prosecced_x[i] = pair<int, int>(i, x[i]);
    }

    sort(vec_all(prosecced_x), [](pair <int, int> p1, pair <int, int> p2) {
        return p1.second < p2.second;
    });

    vector<int> half_vec(n);
    int half = n / 2;
    rep(i, n) {
        if (i < half) {
            half_vec[prosecced_x[i].first] = prosecced_x[half].second;
        } else {
            half_vec[prosecced_x[i].first] = prosecced_x[half - 1].second;
        }
    }

    rep(i, n) {
        cout << half_vec[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 5376
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const ll MOD = 1000000007;
// const int INF = 2000000000;

int H, W, N;
int sr, sc;
string S, T;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> H >> W >> N;
  cin >> sr >> sc;
  sr--;
  sc--;
  cin >> S >> T;

  int max_l = sc;
  int max_r = sc;
  int max_u = sr;
  int max_d = sr;

  bool flag = true;
  for (int i = 0; i < N; i++) {
    // takahashi
    if (S[i] == 'L') {
      max_l--;
    }
    if (S[i] == 'R') {
      max_r++;
    }
    if (S[i] == 'U') {
      max_u--;
    }
    if (S[i] == 'D') {
      max_d++;
    }

    // result
    if (max_l < 0 || max_r >= W || max_u < 0 || max_d >= H) {
      flag = false;
      break;
    }

    // aoki
    if (T[i] == 'L' && max_r - 1 >= 0) {
      max_r--;
    }
    if (T[i] == 'R' && max_l + 1 < W) {
      max_l++;
    }
    if (T[i] == 'U' && max_d - 1 >= 0) {
      max_d--;
    }
    if (T[i] == 'D' && max_u + 1 < H) {
      max_u++;
    }
  }

  if (flag) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 920
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
typedef long long ll;
typedef pair<int, int> P;

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

int main() {
    ll a, b;
    int c, d;
    cin >> a >> b >> c >> d;

    ll tmp = 0; //割り切れるもの
    tmp += b/c + b/d;
    tmp -= a/c + a/d;
    if (a%c == 0) tmp++;
    if (a%d == 0) tmp++;
    ll e = (ll)c*d/gcd(c, d);
    tmp -= b/e;
    tmp += a/e;
    if (a%e == 0) tmp--;

    ll ans = b-a+1-tmp;

    cout << ans << endl;

}

Measured memory_bytes: 256
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h,a;
    cin>>h>>a;
    if(h%a==0){
        cout << h / a << endl;
    }else{
        cout << h / a + 1 << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    ll a;
    ld b;
    cin >> a >> b;
    cout << (ll)(a*b) << endl;
}

Measured memory_bytes: 3728
# -*- coding: utf-8 -*-       

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()

p1,p2 = 0,0

bnum = [0 for i in range(n)]
cnum = [0 for i in range(n)]
d = [0 for i in range(n)]

for i in range(n):
    while(b[i]>a[min(p1,n-1)] and p1<n):
        p1 += 1
    bnum[i] = p1
for i in range(n):
    while(c[i]>b[min(p2,n-1)] and p2<n):
        p2 += 1
    cnum[i] = p2

d[0] = sum(bnum[0:max(0,cnum[0])])
for i in range(n-1):
    d[i+1] = d[i]+sum(bnum[cnum[i]:cnum[i+1]])
print(sum(d))

Measured memory_bytes: 28384
using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using static System.Math;

class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] sort = x.OrderBy(y => y).ToArray();
        foreach (var item in x)
        {
            if (sort[n / 2] <= item) Console.WriteLine(sort[(n / 2) - 1]);
            else Console.WriteLine(sort[n / 2]);
        }
    }
}


Measured memory_bytes: 42232
#include <stdio.h>

int main(){
  int h,w;
  scanf("%d%d", &h, &w);
  char c[h][w+1];
  int i;
  for(i=0;i<h;i++){
    scanf("%s", c[i]);
  }
  for(i=0;i<h;i++){
    printf("%s\n%s\n", c[i], c[i]);
  }

  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int64_t ans=0;
  for(int i=1;i<=n;i++){
    if(i%3==0||i%5==0){
      continue;
    }
    ans+=i;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3640
#include <iostream>
#include <algorithm> 
#include <cmath>
#include <string>
#include <iomanip>
using namespace std;
int main() {
	int a,b,c,x,z=0;
	cin>>a>>b>>c>>x;
	for (int i=0; i<=a; i++){
		for (int l=0; l<=b;l++)
		{
			for (int k=0 ; k<=c; k++){
				 if (((k*50)+(l*100)+(i*500))==x)
					z++;
			}
		}
	}
	cout<<z<<endl;
	return 0;
}


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

using namespace std;

int main()
{
  string s;
  int n;
  cin >> n>> s;
  for (int i=0;i<s.length();i++)
  {
    s[i]=s[i]-'A';
	s[i]=(s[i]+n)%26;
    s[i]=s[i]+'A';
  }
  cout <<s;
}  
  

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

odd = 0
n2 = 0
n4 = 0

for a in A:
  r = a % 4
  if r == 0:
    n4 += 1
  elif r == 2:
    n2 = 1
  else:
    odd += 1

if n4 + 1 >= odd + n2:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    ll n, m;
    cin >> n >> m;
    if (n == 1 && m == 1){
        cout << 1 << endl;
    }
    else if (n == 1){
        cout<< m-2 << endl;
    }else if (m == 1){
        cout << n-2 << endl;
    }else{
        cout << (n-2)*(m-2) << endl;
    }
    return 0;
}

Measured memory_bytes: 3616
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.min;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void sort(int a[]) {
		int n = a.length;
		if (n == 0) {
			return;
		}
		for (int i = 1; i < n; i++) {
			int j = i;
			int ca = a[i];
			do {
				int nj = (j - 1) >> 1;
				int na = a[nj];
				if (ca <= na) {
					break;
				}
				a[j] = na;
				j = nj;
			} while (j != 0);
			a[j] = ca;
		}
		int ca = a[0];
		for (int i = n - 1; i > 0; i--) {
			int j = 0;
			while ((j << 1) + 2 + Integer.MIN_VALUE < i + Integer.MIN_VALUE) {
				j <<= 1;
				j += (a[j + 2] > a[j + 1]) ? 2 : 1;
			}
			if ((j << 1) + 2 == i) {
				j = (j << 1) + 1;
			}
			int na = a[i];
			a[i] = ca;
			ca = na;
			while (j != 0 && a[j] < ca) {
				j = (j - 1) >> 1;
			}
			while (j != 0) {
				na = a[j];
				a[j] = ca;
				ca = na;
				j = (j - 1) >> 1;
			}
		}
		a[0] = ca;
	}

	static void solve() throws Exception {
		int n = scanInt();
//		int n = 2000;
		int a[] = new int[n];
		int sum = 0;
		for (int i = 0; i < n; i++) {
			a[i] = scanInt();
//			a[i] = 2000;
			sum += a[i];
		}
		sort(a);
		long have[] = new long[(sum >> 7) + 1];
		have[0] = 1;
		sum = 0;
		for (int i: a) {
			sum += i;
			if ((i & 63) == 0) {
				for (int j = min(have.length - 1, sum >> 6); j >= i >> 6; j--) {
					have[j] |= have[j - (i >> 6)];
				}
			} else {
				for (int j = min(have.length - 1, sum >> 6); j > i >> 6; j--) {
					have[j] |= (have[j - (i >> 6)] << i) | (have[j - (i >> 6) - 1] >>> -i);
				}
				if (i >> 6 < have.length) {
					have[i >> 6] |= have[0] << i;
				}
			}
		}
		for (int i = sum / 2;; i--) {
			if ((have[i >> 6] & (1L << i)) != 0) {
				out.print(sum - i);
				return;
			}
		}
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

Measured memory_bytes: 23764
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define sz size()
#define mk make_pair
#define clr clear()
#define B begin()
#define E end()
#define EM empty()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define all(cont) cont.begin(),cont.end()
#define pb push_back
string en="\n";
string t="hello";
#define sqr(a) ((a) * (a))
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
#define LB(a,x) (lower_bound(aov(a),x)-a.begin())
#define UB(a,x) (upper_bound(aov(a),x)-a.begin())
typedef long long LL;
typedef unsigned long long ULL;
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
//    LL i,j,k,n,m,l,s=0,x,y,tc=1,c=0;
      LL m,a,r,c,h,n,i;
      while(cin>>n)
      {
          m=a=r=c=h=0;
          rep(i,n)
          {
              string s;
              cin>>s;
              if(s.at(0)=='M') m++;
              if(s.at(0)=='A') a++;
              if(s.at(0)=='R') r++;
              if(s.at(0)=='C') c++;
              if(s.at(0)=='H') h++;
          }
          LL x=0;
          x+=m*a*r;
          x+=m*a*c;
          x+=m*a*h;
          x+=m*r*c;
          x+=m*r*h;
          x+=a*r*c;
          x+=a*r*h;
          x+=a*c*h;
          x+=m*c*h;
          x+=r*c*h;
          cout<<x<<en;
      }
}



Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <set>
#include <string>
#include <iterator>
#include <queue>
#include <cmath>
#include <cassert>

typedef long long ll;
using namespace std;
#define REP(i,n) for (int i = 0; i < n; i++)

int main ()
{
    ll N,K;
    cin >> N >> K;

    if (N < K) {
        cout << 0 << endl;
        return 0;
    }

    cout << N - K + 1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#define pai 3.1415926535


int main(void){

	char S[11];
	scanf("%s", S);
	int count = 0;
	char S1[] = "YAKI";
	S[4] = '\0';
	if (strcmp(S, S1) == 0) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}



	return 0;


}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main(){
	long long a;
	long long po=1;
	scanf("%lld",&a);
	for(long long i=1;i<=a;i++){
		po=po*i;
		po=po%1000000007;
	}
	printf("%d\n",po);
}

Measured memory_bytes: 256