akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
template<typename T, typename V = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, V, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;
// find_by_order(), order_of_key()
#define SZ(v) int((v).size())
#define ALL(vec) (vec).begin(),(vec).end()
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string>) {}
template<typename T1,typename T2> ostream& operator<<(ostream& os, pair<T1,T2> buf) {
  return os << "(" << buf.first << ": " << buf.second << ")"; }
#define DefOut(Con) template<typename T>ostream&operator<<(ostream&os,Con<T>&A){ bool f = false; os << "{"; \
  for (const auto e: A) { if (f) os << ", "; os << e; f = true; } return os << "}"; }
#define DefOut2(Con) template<typename K,typename V>ostream&operator<<(ostream&os,Con<K,V>&A) \
{ bool f = false; os << "{"; for (auto &e: A) { if (f) os << ", "; os << e; f = true; } return os << "}"; }
template<typename T>ostream &operator << (ostream &os,vector<vector<T>>& A) {
  for (auto &B: A) os << '\n' << B; return os; }
DefOut(vector) DefOut(set) DefOut(multiset) DefOut2(map) 
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << a << endl; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18;
/***********************************************************************/

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

  int n;
  cin >> n;
  vector<i64> a(n), b(n);
  for (i64 &z: b) {
    cin >> z;
  }
  a[0] = 0;
  for (int i = 0; i < n; ++i) {
    if (i % 2 == 0) a[0] += b[i];
    if (i % 2 == 1) a[0] -= b[i];
  }
  for (int i = 1; i < n; ++i) {
    a[i] = b[i - 1] - (a[i - 1] / 2);
    a[i] *= 2;
  }
  for (auto z: a) cout << z << ' ';
  
  return 0;
} 


Measured memory_bytes: 2944
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
string s;
ll t[10],ret;
void dfs(vector<int>vec){
	int sum = 0;
	for(int i=0;i<vec.size();i++){
		sum += vec[i];
	}
	if(sum < s.size()){
		for(int i=1;i<=s.size()-sum;i++){
			vec.pb(i);
			dfs(vec);
			vec.pop_back();
		}
	}
	else{
		int sum = 0; 
		for(int i=0;i<vec.size();i++){
			for(int j=sum;j<sum+vec[i];j++){
				ret += (s[j]-'0') * t[sum+vec[i]-1-j];
			} sum += vec[i];
		}
	}
}
int main(){
	cin >> s;
	t[0] = 1; for(int i=1;i<10;i++) t[i] = t[i-1]*10LL;
	vector<int>vi(0);
	dfs(vi);
	cout << ret << endl;
}

Measured memory_bytes: 256
/* it was worth becoming a chemist */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<int, long long> pil;
typedef vector<int> vi;
typedef vector<long long> vll;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
#define NAME "puts"
#define F first
#define S second

const int inf = 1e9;
const ll INF = 1e18;
const int mod = 1e9 + 7;
const int MAXN = 1e5 + 5;

ll a, b, c;

void solve() {
	cin >> a >> b >> c;
	ll mn = min(a, c);
	ll res = mn;
	a -= mn;
	c -= mn;
	if (b >= c) cout << res + b + c;
	else cout << res + b * 2 + 1;
}


main() {
	

	ios_base::sync_with_stdio(0);
	cin.tie(0);            	
	cout.tie(0);

	int times = 1;
	for (int i = 1; i <= times; i++) {
		solve();
	}

	return 0;	
}	

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

int main() {
    int INF = 100000;
    int a[INF], b[INF], c[INF];
    for (int i = 0; i < INF; ++i) {
        cin >> a[i] >> b[i] >> c[i];
        if (a[i] > b[i]) {
            int t = a[i];
            a[i] = b[i];
            b[i] = t;
        }
        if (b[i] > c[i]) {
            int t = b[i];
            b[i] = c[i];
            c[i] = t;
        }
        if (a[i] > b[i]) {
            int t = a[i];
            a[i] = b[i];
            b[i] = t;
        }
    }

    int tr = 0, ttr = 0, etr = 0, dtr = 0;
    for (int i = 0; i < INF; ++i) {
        if (c[i] >= a[i] + b[i]) {
            cout << tr << " " << ttr << " " << etr << " " << dtr << endl;
            break;
        }
        else if (c[i] * c[i] > a[i] * a[i] + b[i] * b[i]) {
            ++tr;
            ++dtr;
        }
        else if (c[i] * c[i] == a[i] * a[i] + b[i] * b[i]) {
            ++tr;
            ++ttr;
        }
        else if (c[i] * c[i] < a[i] * a[i] + b[i] * b[i]) {
            ++tr;
            ++etr;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3116
import sys
N, K = map(int, input().split())
if K == 0:
    print(N**2)
    sys.exit()
ans = 0
for b in range(K+1,N+1):
    peri, res = divmod(N,b)
    ans += (b-K)*peri + max(0,res-K+1)

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <bits/stdc++.h>
#define pb push_back
#define ob pop_back
#define xx first
#define yy second
#define dob double
#define rin(i,n,k) for(int i=0;i<n;i+=k)
#define int long long int
#define ss size()
using namespace std;
const int M=1e9+7,maxn=100010;
std::vector<int> adj[maxn];
std::vector<int> v1;
int ans,n,k,m,x,y,q,par[maxn],h[maxn],mach[maxn],sk[maxn],dp[maxn];
bool mark[maxn],bpart[maxn];
string s,s1,s2;
map <string ,int> mp;
bool markchaild[maxn];
bool dfsmach(int v){
    if(v==-1) return true;
    if(mark[v]==1) return false;
    mark[v]=1;
    for(int i=0;i<adj[v].ss;i++){
        int u=adj[v][i];
        if(dfsmach(mach[u])){
            bpart[u]=((bpart[v]+1)%2);
            mach[u]=v;
            mach[v]=u;
            return true;
        }
    }
    return false;
}


int32_t main() {
    cin>>n>>m>>k;
    if(k>=n&&k<=m)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


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

using namespace std;

#define int long long
#define ar array
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)

template<class T>
bool umin(T &a, const T &b) {
    return b < a ? a = b, 1 : 0;
}

template<class T>
bool umax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

template<class A>
void read(vt<A> &v);

template<class A, size_t S>
void read(ar<A, S> &a);

template<class T>
void read(T &x) {
    cin >> x;
}

void read(double &d) {
    string t;
    read(t);
    d = stod(t);
}

void read(long double &d) {
    string t;
    read(t);
    d = stold(t);
}

template<class H, class... T>
void read(H &h, T &... t) {
    read(h);
    read(t...);
}

template<class A>
void read(vt<A> &x) {
    EACH(a, x)read(a);
}

template<class A, size_t S>
void read(array<A, S> &x) {
    EACH(a, x)read(a);
}

string to_string(char c) {
    return string(1, c);
}

string to_string(bool b) {
    return b ? "true" : "false";
}

string to_string(const char *s) {
    return string(s);
}

string to_string(string s) {
    return s;
}

string to_string(vt<bool> v) {
    string res;
    FOR(sz(v))res += char('0' + v[i]);
    return res;
}

template<size_t S>
string to_string(bitset<S> b) {
    string res;
    FOR(S)res += char('0' + b[i]);
    return res;
}

template<class T>
string to_string(T v) {
    bool f = 1;
    string res;
    EACH(x, v) {
        if (!f)
            res += ' ';
        f = 0;
        res += to_string(x);
    }
    return res;
}

template<class A>
void write(A x) {
    cout << to_string(x);
}

template<class H, class... T>
void write(const H &h, const T &... t) {
    write(h);
    write(t...);
}

void print() {
    write("\n");
}

template<class H, class... T>
void print(const H &h, const T &... t) {
    write(h);
    if (sizeof...(t))
        write(' ');
    print(t...);
}

template<class T, class U>
void vti(vt<T> &v, U x, size_t n) {
    v = vt<T>(n, x);
}

template<class T, class U>
void vti(vt<T> &v, U x, size_t n, size_t m...) {
    v = vt<T>(n);
    EACH(a, v)vti(a, x, m);
}

int cmp(int a, int b) {
    if (a == b) {
        return 0;
    }
    return a < b ? -1 : 1;
}

void solve() {
    string s;
    read(s);
    string out;
    EACH(x, s) {
        if (x == '1' || x == '0') {
            out += x;
        }
        else {
            if (out.size())
                out.pop_back();
        }
    }
    print(out);
}

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

    int tt = 1;
//    read(tt);
    FOR(tt) {
//        write("Case #", i + 1, ": ");
        solve();
    }

}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 1e18;
double Pi = 3.1415926535897932384626;
 
//vector<ll> G[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 998244353;
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
//ll fact[800005],rfact[800005];
/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,ans,a,b,c,e,g,h,w,i,j,k,q;
ll t,d;
ll x[500005],y[500005],z[500005];
bool ans_table[500005];
string s;

int main(){
    cin >> n;
    ps(double((n + 1) / 2) / n);
    
    return 0;
}


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

int main() {
    int n;
    cin>>n;
    vector<int> vec;
    int a[n];
    for(int i = 0;i<n;i++){
        cin>>a[i];
        vec.push_back(a[i]);
    }
    sort(vec.begin(), vec.end(), greater<int>());
    int one = vec[0];
    int two = vec[1];
    for(int i = 0;i<n;i++){
        if(a[i] == one) cout<<two<<endl;
        else cout<<one<<endl;
    }
    return 0;
}


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

int main(void){
	long long int x;
	int i;
	long long int yen=100;

	scanf("%lld",&x);
	for(i=0;x>yen;i++){
		yen*=1.01;
	}
	printf("%d",i);
	return 0;
}


Measured memory_bytes: 1732
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
	ll howKi = 0;
	ll n, a;
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> a;
		if(a % 2 == 1) howKi++;
	}
	if(howKi % 2 == 1) cout << "NO" << endl;
	else cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>

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


void ABC128D()
{
	int N, K;
	cin >> N >> K;
	vector<int> V(N);
	for (int i = 0; i < N; ++i)
		cin >> V[i];

	int maxSum = 0;
	for (int i = 0; i <= min(N,K); ++i)
	{
		vector<int> X;
		for (int j = 0; j <= i; ++j)
		{
			X.assign(V.begin(), V.begin() + j);
			X.insert(X.end(), V.rbegin(), V.rbegin() + (i - j));
			sort(X.begin(), X.end());
			int m = distance(X.begin(),lower_bound(X.begin(), X.end(), 0));
			int k = min(i, K - i);
			m = min(k, m);
			int sum = accumulate(X.begin() + m, X.end(), 0);
			maxSum = max(sum, maxSum);
		}
	}
	cout << maxSum << endl;
}
int main()
{
	ABC128D();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9+7;
const int MAX = 5100000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
#define INT_MAX 1e9+7

int main(){
    ll n,a,b,c,d; cin >> n >> a >> b >> c >> d; a--; b--; c--; d--;
    string s; cin >> s;
    if(c<d) {
        REP(i, b, d) {
            if (s[i] == '#' && s[i + 1] == '#') {
                puts("No");
                return 0;
            }
        }
        s[d] = '#';
        REP(i, a, c) {
            if (s[i] == '#' && s[i + 1] == '#') {
                puts("No");
                return 0;
            }
        }
        puts("Yes");
    }else{
        REP(i,b,d+1){
            if(s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.'){
                puts("Yes");
                return 0;
            }
        }
        puts("No");
    }
}

Measured memory_bytes: 640
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 time = a + b;
		if (time >= 24) {
			time -= 24;
		}
		System.out.println(time);
		
		scan.close();
	}

}


Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(ll)n;++i)
const ll INF = 999999999999999;
int main(){
  ll n,m,k;cin >> n >> m >> k;
  vector<ll> a(n+1);
  vector<ll> b(m+1);
  a.at(0) = 0;
  b.at(0) = 0;
  for(ll i=1;i<=n;++i){
    cin >> a.at(i);
    a.at(i) += a.at(i-1);
  }
  for(ll i=1;i<=m;++i){
    cin >> b.at(i);
    b.at(i) += b.at(i-1);
  }

  ll ans = 0;
  for(ll i=0;i<=n;++i){
    if( a.at(i) > k ) break;
    //k-a.at(i)より大きいbの値の中で一番左のイテレータitr
    auto itr = upper_bound(b.begin(),b.end(),k-a.at(i));
    ll id = itr - b.begin();
    if( id != 0 ) --id;
    //cout << id << endl;
    ans = max(ans,id+i);
    /*for(ll j=0;j<=m;++j){
      ll sum = a.at(i) + b.at(j);    
      if( sum > k ) break;
      ans = max(ans,i+j);
    }*/
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a + 1 == c)
        cout << 1 << endl;
    else
        cout << 0 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[510][510];
struct move{
	int srx,sry,tx,ty;
}mv[250010];
int main(){
	//freopen("matrix.in","r",stdin);
	//freopen("matrix.out","w",stdout);
	int n,m,k=0,i,j,count=0;
	cin>>n>>m;
	for(i=1;i<=n;i++)
	  for(j=1;j<=m;j++)
	    cin>>a[i][j];
	memset(mv,0,sizeof(mv));
	for(i=1;i<=n;i++)
	  for(j=1;j<=m-1;j++)
	    if(a[i][j] % 2==1){
	    	a[i][j]--;
	    	a[i][j+1]++;
	    	k++;
	    	mv[k].srx=i;mv[k].sry=j;mv[k].tx=i;mv[k].ty=j+1;
	    	count++;
	    }
	for(i=1;i<=n-1;i++)
	  if(a[i][m]%2==1){
	  	a[i][m]--;
	  	a[i+1][m]++;
	  	k++;
	  	mv[k].srx=i,mv[k].sry=m,mv[k].tx =i+1,mv[k].ty=m;
	  	count++;
	  }
	cout<<count<<endl;
	for(i=1;i<=k;i++)
	  cout<<mv[i].srx<<" "<<mv[i].sry<<" "<<mv[i].tx <<" "<<mv[i].ty <<endl;
	return 0;
} 

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

const int N = 1005;

struct Point {
	double x, y;
	void read() {
		scanf("%lf%lf", &x, &y);
	}
};

struct Cir {
	Point o;
	double r;
	void read() {
		o.read();
		scanf("%lf", &r);
	}
} c[N];

int n;
Cir s, t;

double g[N][N];

double dist(Point a, Point b) {
	double dx = a.x - b.x;
	double dy = a.y - b.y;
	return sqrt(dx * dx + dy * dy);
}

double get(Cir a, Cir b) {
	double d = dist(a.o, b.o);
	return max(0.0, d - (a.r + b.r));
}

queue<int> Q;
int vis[N];
double d[N];

int main() {
	s.o.read(); t.o.read();
	scanf("%d", &n); n += 2;
	c[1] = s; c[2] = t;
	for (int i = 3; i <= n; i++) c[i].read();
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			g[i][j] = get(c[i], c[j]);
	for (int i = 1; i <= n; i++) d[i] = 1e20;
	vis[1] = 1;
	d[1] = 0;
	Q.push(1);
	while (!Q.empty()) {
		int u = Q.front(); Q.pop();
		vis[u] = 0;
		for (int v = 1; v <= n; v++) {
			if (d[v] > d[u] + g[u][v]) {
				d[v] = d[u] + g[u][v];
				if (!vis[v]) {
					vis[v] = 1;
					Q.push(v);
				}
			}
		}
	}
	printf("%.12f\n", d[2]);
	return 0;
}


Measured memory_bytes: 8320
#include <iostream>
using namespace std;
int a,h,i,x,s;
int main()
{
    cin>>h>>a;
    for(i=1;i<=a;i++)
    {
        cin>>x;
        s=s+x;
    }
    if(s>=h)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


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

using namespace std;

int main(void) {
  int n;
  cin >> n;
  vector<long long> a(n);


  for(int i = 0;i < n;i++){
    cin >> a[i];
  }
  // long long sum = accumulate(a.begin(), a.end(), 0);
  long long sum = 0;
  for (int j = 0;j < n;j++) {
    sum += a[j];
  }
  int i;
  long long temp_sum = 0;
  
  for (i = 0;sum > temp_sum * 2;i++){
    temp_sum += a[i];
  }
  if(temp_sum * 2 - sum < sum + a[i - 1] * 2 - temp_sum * 2) {
    cout <<temp_sum * 2 - sum<< endl;
  }
  else {
    cout <<sum + a[i - 1] * 2 - temp_sum * 2 << endl;
  }
  return 0;
}


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

int main()
{
    string n;
    cin >> n;
if(n[0]== '9' || n[1]== '9'){
    cout << "Yes" << endl;
}else{
    cout << "No" << endl;
}


}


Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
mula_now=0
tmp=0
mula_prev=a[0]
for i in range(k,n):
    mula_now=a[i]
    if mula_now>mula_prev:
        print('Yes')
    else:
        print('No')
    tmp+=1
    mula_prev=a[tmp]
    

Measured memory_bytes: 31680
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt(), C = sc.nextInt(), K = sc.nextInt();
		sc.close();
		int max = Math.max(A, Math.max(B, C));
		int max2=max;

		for (int i = 0; i < K; i++) {
			max=max*2;
		}
		System.out.println(max-max2 + A + B + C);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
//#include <iostream>
//#include <cstdio>

#define FOR(i, a, b) for(int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)
#define MOD 1000000007
#define INF 2000000000

typedef long long ll;
typedef unsigned long long ull;
//typedef Pair<int,int> P;

using namespace std;

int main(void){
	ll a, b, x;
	cin>>a>>b>>x;
	if(a==0){
		cout<<b/x+1<<endl;
		return 0;
	}
	cout<<b/x-(a - 1)/x<<endl;
	
	return 0;
}

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

int main() {
    string s, t;
    cin >> s >> t;
    priority_queue<string, vector<string>, greater<string>> can;
    for(int i = 0; i < s.size() - t.size() + 1; i++){
        bool flag = true;
        for(int j = 0; j < t.size(); j++){
            if(s[i+j] != t[j] && s[i+j] != '?') flag = false;
        }
        if(!flag) continue;
        string tmp = s;
        copy(begin(t), end(t), begin(tmp) + i);
        replace(begin(tmp), end(tmp), '?', 'a');
        can.push(tmp);
    }

    cout << (can.empty() ? "UNRESTORABLE" : can.top()) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200005
using namespace std;
int val[N];
int n,k;
char s[N];
int main(){
	scanf("%d%d",&n,&k);
	scanf("%s",s+1);
	for(int i=1;i<=n;i++) val[i]=s[i]=='A'? 1:0;
	int p=1,f=0;
	while(p<=n&&k>0){
		if((val[p]^f)==1){
			val[p]^=1;k--;continue;
		}else{
			f^=1;k--;p++;
		}
	}
	if(k!=0){
		if(f==0) for(int i=1;i<=n;i++) putchar(i%2==1? 'B':'A');
		else {
			putchar(k%2==1? 'B':'A');
			for(int i=2;i<=n;i++) putchar(i%2==1? 'A':'B');
		}
		return 0;
	}
	for(int i=p;i<=n;i++) putchar((val[i]^f)==1? 'A':'B');
	for(int i=0;i<p-1;i++) putchar((i^f)%2==1? 'A':'B');
	return 0;
}

Measured memory_bytes: 1408
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let s = read1::<String>().chars().collect::<Vec<char>>();
    let mut c = s[0];
    let mut ans = 0usize;
    for i in 1..s.len() {
        if c != s[i] {
            c = s[i];
            ans += 1;
        }
    }

    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<cstdio>
#include<vector>
#include<queue>
using namespace std;
const int MAXN=200005;

int N,M;
char s[MAXN];
vector<int> adj[MAXN];
int cnt[MAXN][2];
queue<int> Q;
bool del[MAXN];

int main()
{
    scanf("%d%d%s",&N,&M,s+1);
    for(int i=1;i<=M;i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        adj[a].push_back(b);
        adj[b].push_back(a);
        cnt[a][s[b]-'A']++;
        cnt[b][s[a]-'A']++;
    }
    for(int i=1;i<=N;i++)
        if(cnt[i][0]==0||cnt[i][1]==0)
            Q.push(i),del[i]=true;
    int tmp=0;
    while(!Q.empty())
    {
        int u=Q.front();
        Q.pop();
        tmp++;
        for(auto v:adj[u])
            if(!del[v])
            {
                cnt[v][s[u]-'A']--;
                if(cnt[v][s[u]-'A']==0)
                {
                    del[v]=true;
                    Q.push(v);
                }
            }
    }
    if(tmp<N)
        puts("Yes");
    else
        puts("No");

    return 0;
}


Measured memory_bytes: 12544
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

int main(){
  string str="";
  
  while(cin >> str){

    string ans="";

    for(int i=0;i<str.size();i++){
      if(str[i]=='@'){
	int cnt = str[i+1]-'0';
	char c = str[i+2];
	for(int j=0;j<cnt;j++){
	  ans += c;
	}
	i+=2;
      }
      else{
	ans += str[i];
      }
    }

    cout << ans << endl;

  }

  return 0;
  
}

Measured memory_bytes: 1192
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int x,y,c = 0;
    scanf("%d %d",&x,&y);
    switch(x)
    {
        case 1:
            c += 300000;
            break;
        
        case 2:
            c += 200000;
            break;
            
        case 3:
            c += 100000;
            break;
    }
    switch(y)
    {
        case 1:
            c += 300000;
            break;
        
        case 2:
            c += 200000;
            break;
            
        case 3:
            c += 100000;
            break;
    }
    if(x == 1 && y == 1)
        c += 400000;
        
    printf("%d\n",c);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n>999)
    cout<<"ABD"<<endl;
  else
    cout<<"ABC"<<endl;
  system("pause");
  return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;
int res = 0;
string n;
int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> n;
	for (int i = 0; i < n.size(); i++) {
		res += n[i] - 48;
	}
	if (res % 9 == 0) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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 (a>b) { a=b; return 1; } return 0; }

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

	ll a, b, c, k;
	cin >> a >> b >> c >> k;

	if(a + b <= k){
		cout << a - (k - b - a) << endl;
	}else{
		cout << min(a, k) << endl;
	}

}


Measured memory_bytes: 3656
from copy import deepcopy
def bubbleSort(C, N):
    for i in range(N):
        for j in range(N - 1, i, - 1):
            if C[j][1] < C[j - 1][1]:
                C[j], C[j - 1] = C[j - 1], C[j]

def selectionSort(C, N):
    for i in range(N):
        minj = i
        for j in range(i, N):
            if C[j][1] < C[minj][1]:
                minj = j
        C[i], C[minj] = C[minj], C[i]

N = int(input())
C = list(map(str, input().split()))
C1 = deepcopy(C)
C2 = deepcopy(C)
bubbleSort(C1, N)
selectionSort(C2, N)
O = [[] for _ in range(9)]
for i in range(N):
    j = int(C[i][1]) - 1
    O[j].append(C[i][0])
O1 = [[] for _ in range(9)]
for i in range(N):
    j = int(C1[i][1]) - 1
    O1[j].append(C1[i][0])
O2 = [[] for _ in range(9)]
for i in range(N):
    j = int(C2[i][1]) - 1
    O2[j].append(C2[i][0])
for i in range(N):
    if i == N - 1:
        print(C1[i])
    else:
        print(C1[i], end=' ')
if O == O1:
    print('Stable')
else:
    print('Not stable')
for i in range(N):
    if i == N - 1:
        print(C2[i])
    else:
        print(C2[i], end=' ')
if O == O2:
    print('Stable')
else:
    print('Not stable')


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

using namespace std;
using ll = long long;

const int N = 2e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 20, BL = 400;
const double EPS = 3e-16;

int main(){
//  freopen(".in", "r", stdin);
//  freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
	long long n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	
	long long diff = b - a;
	for(long long i = 0; i < n; i++){
		long long L = a + c * i, R = a + d * i;
		long long l = b + c * (n - i - 1), r = b + d * (n - i - 1);
		if(l <= R && L <= r){
			return cout << "YES", 0;
		}
	}
	
	cout << "NO";
	return 0;
}

Measured memory_bytes: 256
package main

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

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	k, x := nextInt(), nextInt()
	if k*500 >= x {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
n = int(input())
a = [int(input()) for i in range(n)]
i = 1
count = 0

while True:
    i = a[i-1]
    count += 1
    if i == 1 or count == n+1:
        print(-1)
        break
    elif i == 2:
        print(count)
        break

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

int c[8];

class DICE{
public:
    void setdice(char a);
};

void DICE::setdice(char a){
    if(a == 'S'){
        c[7] = c[1];
        c[1] = c[5];
        c[5] = c[6];
        c[6] = c[2];
        c[2] = c[7];
    }
    else if(a == 'W'){
        c[7] = c[1];
        c[1] = c[3];
        c[3] = c[6];
        c[6] = c[4];
        c[4] = c[7];
    }
    else if(a == 'N'){
        c[7] = c[1];
        c[1] = c[2];
        c[2] = c[6];
        c[6] = c[5];
        c[5] = c[7];
    }
    else{
        c[7] = c[1];
        c[1] = c[4];
        c[4] = c[6];
        c[6] = c[3];
        c[3] = c[7];
    }
}

int main(void){
    DICE dice;
    int s[8];
    for(int i = 1; i <= 6; i++){
        cin >> s[i];
    }
    for(int i = 1; i <= 6; i++){
        cin >> c[i];
    }
        if(s[1] == c[3] || s[1] == c[4]){
            for(int k = 0; k < 5; k++){
                dice.setdice('E');
                if(c[1] == s[1] && c[6] == s[6])    break;
            }
        }
            for(int k = 0; k < 5; k++){
                if(c[1] == s[1] && c[6] == s[6])    break;
                dice.setdice('S');
            }
        
        dice.setdice('N');
        for(int j = 0; j < 5; j++){
            dice.setdice('W');
            if(c[1] == s[2] && c[3] == s[3] && c[4] == s[4] && c[6] == s[5])    break;
        }
        if(c[1] == s[2] && c[3] == s[3] && c[4] == s[4] && c[6] == s[5])    cout << "Yes" << endl;
        else    cout << "No" << endl;
    
    
    
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#include "string"
#define endl '\n'
#define ff first
#define int long long
#define pi pair<int,int>
#define ss second 
#define boost ios_base::sync_with_stdio(false);cin.tie(nullptr)
const int  M = 2019;

int mod(int n){
    n %= M;
    return (n+M)%M;
}

int power(int a,int b){
    int ans=1;
    while(b>0){
        if(b&1)
            ans = mod(ans*a);
        a = mod(a*a);
        b/=2;
    }
    return ans;
}

int32_t main() { 
    boost;
    string s;
    cin>>s;
    int n  = s.size();
    map<int,int>mp;
    int ans=0;
    int dp[n];
    mp[0]=1;
    for(int i=0;i<s.size();i++){
        dp[i] = mod((s[i]-'0')*power(10,n-i-1));
        if(i>0)
            dp[i] = mod(dp[i] + dp[i-1]);
        if(mp.find(dp[i])!=mp.end())
            ans+=mp[dp[i]];
        mp[dp[i]]++;
    }
    cout<<ans<<endl;    
}

Measured memory_bytes: 5280
from bisect import bisect_left
n, m = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
A_r = sorted(A, reverse = True)
cumsumA = [0]
total = 0
for i in range(n):
    total += A_r[i]
    cumsumA.append(total)

def func(x):
    ans = 0
    for i in range(n):
        kazu = x - A[i]
        idx = bisect_left(A, kazu)
        cou = n - idx
        ans += cou
    if ans >= m:
        return True
    else:
        return False

mi = 0
ma = 2 * 10 ** 5 + 1
while ma - mi > 1:
    mid = (mi + ma) // 2
    if func(mid):
        mi = mid
    else:
        ma = mid

ans = 0
count = 0

for ai in A_r:
    idx = bisect_left(A, mi - ai)
    ans += ai * (n - idx) + cumsumA[n - idx]
    count += n - idx
print(ans - (count-m) * mi)





Measured memory_bytes: 14268
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int n, k;
vector<ll> a;
ll dp[110][100010];
ll mod = 1000000007;

int main() {
  cin >> n >> k;
  a.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i <= n; ++i) dp[i][0] = 1;  // i人目までに0個配る方法は1通り

  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= k; ++j) {
      dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
      if (j - a[i - 1] - 1 >= 0) {
        dp[i][j] = (dp[i][j] + mod - dp[i - 1][j - a[i - 1] - 1]) % mod;
      }
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}

Measured memory_bytes: 79360
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

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

    static class abc083_b {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int a = in.scanInt();
            int b = in.scanInt();
            int ans = 0;
            for (int i = 1; i <= n; i++) if (smIt(i) >= a && smIt(i) <= b) ans += i;
            out.println(ans);
        }

        private int smIt(int a) {
            int sum = 0;
            while (a > 0) {
                sum += (a % 10);
                a /= 10;
            }
            return sum;
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}



Measured memory_bytes: 22740
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto ni = readints;
    int n = ni[0], i = ni[1];

    writeln(n + 1 - i);
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
  int n,k,s,a,b,c,m,DATA[101][101];
  while(1){
    cin >> n >> m;
    if(n==0&&m==0)break;
    for(int i=0;i<101;i++){
      for(int j=0;j<101;j++){
	DATA[i][j] = 10000000;
      }
      DATA[i][i]=0;
    }
    for(int l=0;l<m;l++){
      cin >> s;
      if(s==1){
	cin >> a >> b >> c;
	if(DATA[a][b]>c){
	  DATA[a][b] = DATA[b][a] = c;
	  for(int i=1;i<=n;i++){
	    for(int j=1;j<=n;j++){
	      for(int k=1;k<=n;k++){
		DATA[j][k]=min(DATA[j][k],DATA[j][i]+DATA[i][k]);
	      }
	    }
	  }
	}
      }else{
	cin >> a >> b;
	cout << (DATA[a][b]==10000000 ?-1:DATA[a][b]) << endl; 
      }
    }
  }
}

Measured memory_bytes: 1196
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
	    InputStreamReader input = new InputStreamReader (System. in);
	    BufferedReader buffer = new BufferedReader(input);
	    String read = buffer.readLine();
	    int amount = Integer.parseInt(read);
	    ArrayList<Integer> tempList = new ArrayList<Integer>();
	    tempList.add(1);
	    int[][] scanInt = new int[amount][100];	//N?????°???100????¶??????????
	    for(int i=0; i<amount; i++){
	    	read = buffer.readLine();
	    	String[] scan = read.split(" ");
	    	for(int j=0; j<scan.length; j++){
	    		scanInt[i][j] = Integer.parseInt(scan[j]);
	    	}
	    }

    	int nowDepth = 0;
    	int[] foundPosition = new int[amount];
//    	for(int i=0; i<amount; i++){
//    		foundPosition[i] = amount;
//    	}
    	boolean visitBranch[] = new boolean[amount];
    	visitBranch[0] = true;

    	while(true){
    		boolean existBranch = false;
    		ArrayList<Integer> list = new ArrayList<Integer> (tempList);
    		tempList.clear();
    		
    		for(int i=0; i<list.size(); i++){
    			foundPosition[list.get(i) -1 ] = nowDepth;
    		}
    		for(int i=0; i<list.size(); i++){
    			for(int j=0; j<scanInt[list.get(i)-1][1]; j++){
    				if(visitBranch[ scanInt[list.get(i)-1][j+2] -1] == false){
//    					System.out.println("found "+(scanInt[list.get(i)-1][j+2])+" depth= "+nowDepth );
    					visitBranch[ scanInt[list.get(i)-1][j+2] -1] = true;
    					existBranch = true;
    					tempList.add(scanInt[list.get(i)-1][j+2]);
    				}
    			}
    		}
    		if(existBranch == false){
    			for(int i=0; i<amount; i++){
    				if(visitBranch[i] == false){
    					foundPosition[i] = -1;
    				}
    			}
    			break;
    		}
    		nowDepth += 1;
	    }
    	for(int i=0; i<amount; i++){
    		System.out.println((i+1)+" "+foundPosition[i]);
    	}
	}
}

Measured memory_bytes: 24236
#include<iostream>

using namespace std;

int main(){

    int n,a,b;
    int num = 0, sum = 0, ans = 0;

    cin >> n >> a >> b;

    for(int i = 1; i <= n; i++){
        num = i;
        sum = 0;
        while(num){
            sum += num % 10;
            num /= 10;
        }
        if(sum >= a && sum <= b){
            ans += i;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import math
import sys
from operator import itemgetter

# N, K = map(int, input().split())
# h = list(map(int, input().split()))
# S = [input() for _ in range(H)]
# X = [[0 for j in range(100)] for i in range(200)]


### input
input()
h = list(map(int, input().split()))

## solve
ans = 0

while (max(h) > 0):
	k = 0
	j = 0
	for i in range(len(h)):
		if (h[i] > 0):
			k = i
			break
	j = 0
	for i in range(k, len(h)):
		if (h[i] != 0):
			j += 1
		else:
			break

	for i in range(k, k+j):
		h[i] -= 1
	ans += 1
print(ans)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

    // test
    
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        @SuppressWarnings("unchecked")
        List<LR> list[] = new ArrayList[m + 1];
        for (int i = 1; i <= m; i++) {
            list[i] = new ArrayList<>();
        }
        for (int i = 1; i <= n; i++) {
            st = new StringTokenizer(in.readLine());
            int start = Integer.parseInt(st.nextToken());
            int end = Integer.parseInt(st.nextToken());
            list[end - start + 1].add(new LR(start, end));
        }
        int[] fen = new int[m + 1];
        int accum = n;
        StringBuilder sb = new StringBuilder();
        for (int i = 1; i <= m; i++) {
            int ans = 0;
            for (int j = i; j <= m; j += i) {
                ans += accum(fen, j);
            }
            for (LR temp : list[i]) {
                add(temp.l, 1, fen);
                add(temp.r + 1, -1, fen);
            }
            sb.append(ans + accum);
            sb.append('\n');
            accum -= list[i].size();
        }
        System.out.println(sb);
    }

    static class LR {
        final int l, r;

        LR(int start, int end) {
            this.l = start;
            this.r = end;
        }
    }

    static int accum(int[] fen, int i) {
        int ans = 0;
        while (i > 0) {
            ans += fen[i];
            i -= (i & -i);
        }
        return ans;
    }

    static void add(int i, int a, int[] fen) {
        while (i < fen.length) {
            fen[i] += a;
            i += (i & -i);
        }
    }
}

Measured memory_bytes: 61540
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef long double ld;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;
#define MOD 1000000007
#define INF 1000000
#define PI 3.14159265358979323846264338327950L
#define MAX_N 200010

int main()
{
  ll A,B,C,D;cin>>A>>B>>C>>D;
  
  //B以下でCで割れるもの B/C
  //(A-1)以下でCで割れるもの (A-1)/C
  //lcm(A,B)で割れるもの
  
  ll L = C*D/__gcd(C,D);
  //cout<<L<<endl;
  
  ll divc = B/C - (A-1)/C;
  ll divd = B/D - (A-1)/D;
  
  ll divcd = B/L - (A-1)/L;
  
  //cout<<divc<<" "<<divd<<" "<<divcd<<endl;
  
  ll ans = (B-(A-1)) - divc - divd + divcd;
  cout<<ans<<endl;
}

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

int main(void)
{
  double bmi;
  double height, weight;
  int num;
  int over_num[100];
  int i=0;
  char c, d;

  while(cin >> num >> c >> weight >> c >> height)
    {
      bmi = weight / (height * height);
      if(bmi >= 25.0) 
	{
	  over_num[i] = num;
	  i++;
	}
    }
  for(int j = 0 ; j < i ; j++)
    {
      cout << over_num[j] << endl;
    }
  return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
#define iter(v,ite) for(auto ite=(v).begin();ite!=(v).end();ite++)
#define mimunum(v,x) distance((v).begin(),lower_bound((v).begin(),(v).end(),x))

int n,k;
int main(void){
	scanf("%d%d",&n,&k);
	lli ans=0;
	reg(b,k+1,n){
		ans += (n/b)*(b-k)+max(n%b-k+1,0);
	}
	if(k==0)ans -= n;
	printf("%lld\n",ans);
	return 0;
}






Measured memory_bytes: 256
[n,m] = list(map(int,input().split()))
ds = []
for i in range(n):
  ds.append(int(input()))
cs = []
for i in range(m):
  cs.append(int(input()))
dp = [[0 for i in range(n+1)] for j in range(m+1)]
dp[0][0] = 0
for i in range(m):
  for j in range(n):
    if(i == j):
      dp[i][j] = dp[i-1][j-1] + ds[j] * cs[i]
    else:
      dp[i][j] = min(dp[i-1][j], dp[i-1][j-1] + ds[j] * cs[i])
print(dp[m-1][n-1])

Measured memory_bytes: 21240
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
    int i, ans=0;
    char W[11], T[1001];
      
    scanf("%s",W);
    while(1) {
        scanf("%s",T);
        if(strcmp(T,"END_OF_TEXT") == 0) break;
        for (i=0; i<strlen(T); i++) {
            T[i] = tolower(T[i]);
        }
        if(strcmp(W,T) == 0) ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
const ll N = 2e5 + 10;
string str;
int n,k,r,s,p;
int vis[N];
int get(char c){
    if(c=='r') return p;
    if(c=='s') return r;
    return s;
}

int main() {
    cin>>n>>k;
    cin>>r>>s>>p;
    cin>>str;
    ll ans = 0;
    for(int i=0,t;i<k;i++){
//       t = get(str[i]);
//       last+=str[i];
       vis[i]=1;
       ans+=get(str[i]);
    }
    for(int i=k;i<n;i++){
        if(str[i]==str[i-k]){
            if(vis[i-k]==0){
                ans+=get(str[i]);
                vis[i]=1;
            }else{
                vis[i]=0;
            }

        }else{
            ans+=get(str[i]);
            vis[i]=1;
        }
    }
    cout<<ans;


    return 0;
}

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

int main() {
	int a, b;
	cin >> a >> b;
    
    int socket = 1;
    int ans = 0;
    while (socket < b) {
        socket--;
        socket += a;
        ans++;
    }
    cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define PI acos(-1)
#define ld long double
//mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
const int mod = 1e9+7, N = 2e5+5;
 
int a[N], n, k;
void solve(int test_case){
	int i, j;
	cin >> n;
	if(n%2==0||n%5==0){
		cout << -1;
		return;
	}
	int k = 7%n;
	for(i=1;i<=n;i++){
		if(k==0){
			cout << i;
			return;
		}
		k = k*10+7;
		k %=n;
	}
	cout << -1;
}
 
signed main(){
	FASTIO;
#define MULTITEST 0
#if MULTITEST
	int ___T;
	cin >> ___T;
	for(int T_CASE = 1; T_CASE <= ___T; T_CASE++)
		solve(T_CASE);
#else
	solve(1);
#endif
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef long long ll;
typedef pair<ll,ll> pint;
int main(){
    int n; cin>>n;
    vector<string> s(n*2);
    rep(i,n){
        string u;cin>>u;
        s[i]=u+u;
        s[i+n]=s[i];
      //cout<<s[i][3]<<endl;
      //cout<<s[i+n]<<endl;
    }
    bool flag=true;
    int ans =0;
        rep(b,n){
            flag=true;
            rep(i,n){
                REP(j,i+1,n){
                    if(s[i][b+j]!=s[j][b+i]){
                        flag=false;
                        break;
                    }
                }
                if(flag==false){
                    break;
                }
            }
            if(flag==true){
                ans+=1;
            }
    }
    cout<<ans*n<<endl;
}

Measured memory_bytes: 768
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	double a_d,b_d;
	scanf("%d %d",&a,&b);
	a_d = static_cast<double>(a);
	b_d = static_cast<double>(b);
	printf("%d %d %.5f\n",a/b,a%b,a_d/b_d);
}


Measured memory_bytes: 2712