akhauriyash/Code-Regression huggingface dataset:
// A.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int ans = a != c;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=998244353;

// a^n mod を計算する
//ただしmodとaが互いにその時のみ
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    ll N;
    cin >> N;
    vector<ll> D(N,0);
    for(ll i=0;i<N;i++)cin>>D[i];
    if(D[0]!=0){
        print(0)return 0;
    }
    Map M;
    for(ll i=0;i<N;i++)M[D[i]]++;
    ll S=M.size();
    ll ans=1;
    if(M[0]!=1){print(0)return 0;}
    vector<ll> vec(S,0);
    for(ll i=1;i<S;i++){
        if(M[i]==0){
            cout<<0<<endl;return 0;
        }
        vec[i]=M[i];
    }
    vec[0]=1;
    for(ll i=1;i<S;i++){
        ans*=modpow(vec[i-1],vec[i],MOD);
        ans%=MOD;
    }
    print(ans);

    

    return 0;
}

Measured memory_bytes: 8064
#include<stdio.h>
int main(){
  char s[5];
  int c,i;
  c = 0;
  scanf("%s",s);
  for(i=0;i<3;i++){if(s[i]==s[i+1]) c = 1;}
  if(c == 1) printf("Bad");
  else printf("Good");
}

Measured memory_bytes: 128
N=int(input())
H=list(map(int,input().split()))
ans=0
for i in range(N):
  if i==0:
    ans+=1
  else:
    for j in range(i):
      if H[j]<=H[i]:
        continue
      else:
        break
    else:
      ans+=1
print(ans)


Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
    int n,k,l[51],i,j,tem,sum=0;
    scanf("%d",&n);
    scanf("%d",&k);
    for(i=0; i<n; i++)
    {
        scanf("%d",&l[i]);
    }
    for(i=0; i<n-1; i++)
    {
        for(j=0; j<n-1-i; j++)
        {
            if(l[j] < l[j+1])
            {
                tem = l[j];
                l[j] = l[j+1];
                l[j+1] = tem;
            }
        }
    }
    for(i=0; i<k; i++)
    {
        sum = sum+l[i];
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = 92233720368547758;
#[allow(dead_code)]
static INF_I32: i32 = 21474836;
#[allow(dead_code)]
static INF_USIZE: usize = 18446744073709551;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

fn main() {
    use itertools_num::ItertoolsNum as _;
    input! {
       N: usize,
    }

    let mut ans: usize = 0;
    let a = (N + 1000 - 1) / 1000;
    let b = 1000 * a - N;
    ans = b;

    echo!(ans);
}


Measured memory_bytes: 2144
// BISMILLAHIR RAHMANIR RAHEEM
// ALLAH IS WATCHING ME
// ALLAH save us from COVID-19.Amin.

//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp> //order_of_key return number of elements less than x, find_by_order return index (pointer use kora lgbe)

using namespace std;
using namespace __gnu_pbds;

#define ull    unsigned long long
#define ll     long long
#define ios    ios::sync_with_stdio(0);cin.tie(0);
#define ses    "\n"
#define all(x) (x).begin(), (x).end()
//#define INF   ((int)2e18)
#define ii pair<ll, ll>

string digit="0123456789";
string small="abcdefghijklmnopqrstuvwxyz";
string capital="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8-direction.......
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[]= {1,-1,0,0}; // 4-direction...........
int dy4[]= {0,0,1,-1};

const int N=1e6+5;
const ll M=1e18;

typedef tree< ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

struct Edge
{
    int u, vv;
    bool operator<(Edge const& other)
    {
        return vv > other.vv;
    }
}; // eta joss jinis.krsukal er jnno and sort 1 out of 3 or more er jnno better

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

////////////////////////////////////////////////////////////////////////////
//main function is here.........
int main()
{
   // ios
  ll n,sum=0,m;
  cin>>n>>m;
  ll arr[n];
  for(ll i=0;i<n;i++){
                cin>>arr[i];
                sum+=arr[i];
  }
 sort(arr,arr+n,greater<ll>());
  for(ll i=0;i<m;i++){
         if(((double)sum/(4.0*m))>arr[i]){
                cout<<"No";return 0;
         }
  }
 cout<<"Yes";

}


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

int main() {

    unsigned int L, R;
    std::cin >> L >> R;

    int ans = INT_MAX;

    if (L + 2019 < R) {
        int l1 = 0;
        int r1 = R % 2019;
        int l2 = L % 2019;
        int r2 = 2019;
        for (int i = l1; i <= r1; ++i) {
            for (int j = l1; j <= r1; ++j)
                if (i != j)ans = std::min(ans, (i * j) % 2019);
            for (int j = l2; j <= r2; ++j)
                if (i != j)ans = std::min(ans, (i * j) % 2019);
        }
        for (int i = l2; i <= r2; ++i) {
            for (int j = l1; j <= r1; ++j)
                if (i != j)ans = std::min(ans, (i * j) % 2019);
            for (int j = l2; j <= r2; ++j)
                if (i != j)ans = std::min(ans, (i * j) % 2019);
        }
    }
    else {
        int l = L % 2019;
        int r = R % 2019;
        for (int i = l; i <= r; ++i) {
            for (int j = l; j <= r; ++j) {
                if (i != j)ans = std::min(ans, (i * j) % 2019);
            }
        }
    }

    std::cout << ans << std::endl;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <bitset>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10


int main() {
	vector<int>a(3); cin >> a[0] >> a[1] >> a[2];
	sort(a.begin(), a.end());
	if (a[0] == a[1]) {
		print(a[2] - a[1]);
	}
	else if (a[1] == a[2]) {
		if (a[0] % 2 == a[1] % 2) {
			print((a[1] - a[0]) / 2);
		}
		else {
			print((a[1] + 1 - a[0]) / 2 + 1);
		}
	}
	else {
		// all three has different value
		int cnt = 0;
		if (a[1] % 2 == a[0] % 2) {
			cnt += (a[1] - a[0]) / 2;
			cnt += a[2] - a[1];
			print(cnt);
		}
		else {
			cnt += (a[1] - 1 - a[0]) / 2;
			cnt += 1;
			cnt += (a[2] + 1 - a[1]);
			print(cnt);
		}

	}

	return 0;
}


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

int main()
{
    long long q, h, s, d, n;
    std::cin >> q >> h >> s >> d >> n;
    h = std::min(2 * q, h);
    s = std::min(std::min(2 * h, 4 * q), s);
    d = std::min(std::min(8 * q, 4 * h), std::min(2 * s, d));
    unsigned long long ans = 0;
    ans += (n / 2) * d;
    ans += (n % 2) * s;
    std::cout << ans << std::endl;

    return 0;
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main()
{
	string s;
	while(getline(cin,s),s!="."){
		stack<char> t;
		bool flag=true;
		for(char c:s){
			if(c=='['||c=='(')t.push(c);
			if(c==']'){
				if(t.empty()||t.top()!='['){
					flag=false;
					break;
				}else t.pop();
			}
			if(c==')'){
				if(t.empty()||t.top()!='('){
					flag=false;
					break;
				}else t.pop();
			}
			if(c=='.'&&!t.empty())flag=false;
		}
		// reverse(all(s));
		// while(!t.empty())t.pop();
		// for(char c:s){
		// 	if(c==']'||c==')')t.push(c);
		// 	if(c=='['){
		// 		if(t.empty()||t.top()!=']'){
		// 			flag=false;
		// 			break;
		// 		}else t.pop();
		// 	}
		// 	if(c=='('){
		// 		if(t.empty()||t.top()!=')'){
		// 			flag=false;
		// 			break;
		// 		}else t.pop();
		// 	}
		// }
		cout<<(flag?"yes":"no")<<endl;
	}
	return 0;
}



Measured memory_bytes: 3144
/// Author: Sarfaraz Alam
# include <bits/stdc++.h>
# define pb push_back
# define ll long long

# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define DEBUG
typedef unsigned long long int ull;
using namespace std;
#include<string>
#include<cmath>
const int N = 1e5 + 7;
const int mod = 1e9 + 7;


int main()
{
    speed;
    #ifdef DEBUGfd
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif // DEBUG

    //Code begins
    int n;
    cin>>n;
    int a[n];
    for(int i = 0; i<n; i++)
    cin>>a[i];

    int rating[9] = {0, 0, 0, 0, 0 , 0, 0 , 0 , 0};
    // for(int i = 0; i<9; i++)
    // cout<<rating[i]<<" ";
    // cout<<endl;
    for(int i = 0;i<n;i++)
    {
      if(a[i]>=0 && a[i]<=399)
      rating[0] = 1;
      else if(a[i]>=400 && a[i]<=799)
      rating[1] = 1;
      else if(a[i]>=800 && a[i]<=1199)
      rating[2] = 1;
      else if(a[i]>=1200 && a[i]<=1599)
      rating[3] =1;
      else if(a[i]>=1600 && a[i]<=1999)
      rating[4] = 1;
      else if(a[i]>=2000 && a[i]<=2399)
      rating[5] = 1;
      else if(a[i]>=2400 && a[i]<=2799)
      rating[6] = 1;
      else if(a[i]>=2800 && a[i]<=3199)
      rating[7] = 1;
      else if(a[i]>=3200)
      rating[8] += 1;

    }
    // for(int i = 0; i<9; i++)
    // cout<<rating[i]<<" ";
    // cout<<endl;
    ll c = 0;
    for(int i = 0; i<8; i++)
    {
      c += rating[i];
    }


  //   if (rating[8] == 0) cout <<c << " " << c << endl;
  // else {
  //   if (c == 0){ cout << 1 << " " << rating[8] << endl;}
  //   else{ cout << c<< " " << c + rating[8] << endl;}
  // }

    if(c == 0 && rating[8] > 0)
    {
      c = 1;
    	cout<<c<<" "<<rating[8]<<endl;
    }
    else if(c == 0 && rating[8] == 0)
    cout<<"0"<<" "<<"0"<<endl;
    else  if(c != 0)
    {cout<<c<<" ";
      cout<<c+rating[8]<<endl;
    }





















    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define F first
#define S second
#define INF ll(1e18)
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 100005

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	string s; cin>>s;
	int n=s.length();
	
	forn(i,0,n){
		if(s[i]=='?') s[i]='D';
	}
	cout<<s<<'\n';
	
	return 0;
}


Measured memory_bytes: 3780
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<deque>

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

using namespace std;

#define vvint(vec,n,m,l) vector<vector<int>> vec(n,vector<int>(m,l));
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>;
#define pint pair<int,int>;
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")

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

	ll a, b;
	char op;
	cin >> a >> op >> b;

	if (op == '+')
	{
		cout << a + b << endl;
	}
	else
	{
		cout << a - b << endl;
	}

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<map>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 300000
typedef long long ll;


int main(){
  ll count=0;
  vector<string> S;
  string s;
  int K;
  cin>>s>>K;
  for(int i=1;i<=5;i++){
    for(int j=0;j+i<=s.size();j++){
      S.push_back(s.substr(j,i));
      count++;
    }
  }
  sort(S.begin(),S.end());
  S.erase(unique(S.begin(),S.end()),S.end());
  cout<<S[K-1]<<endl;
  
  
}


Measured memory_bytes: 1660
import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }




void main() {
  try {
    for (; ; ) {
      const N = readInt();
      auto S = new string[N];
      auto T = new long[N];
      foreach (i; 0 .. N) {
        S[i] = readToken();
        T[i] = readLong();
      }
      const X = readToken();
      
      long ans;
      foreach (i; 0 .. N) {
        if (S[i] == X) {
          foreach (j; i + 1 .. N) {
            ans += T[j];
          }
          break;
        }
      }
      writeln(ans);
    }
  } catch (EOFException e) {
  }
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const string YAKI = "YAKI";
string s;

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


Measured memory_bytes: 256
from heapq import heappop, heappush

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
S = [input() for _ in range(H)]
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1

a = [(-1, 0), (1, 0), (0, -1), (0, 1)]
b = [(i % 5 - 2, i // 5 - 2) for i in range(25) if (i % 5 - 2, i // 5 - 2) not in a]

d = [[H * W] * W for _ in range(H)]
d[Ch][Cw] = 0
Q = [(0, Ch, Cw)]
while Q:
    now_d, h, w = heappop(Q)
    if now_d > d[h][w]:
        continue
    if (h, w) == (Dh, Dw):
        break
    for ah, aw in a:
        nh, nw = h + ah, w + aw
        if 0 <= nh < H and 0 <= nw < W and S[nh][nw] == ".":
            if d[nh][nw] > d[h][w]:
                d[nh][nw] = d[h][w]
                heappush(Q, (d[nh][nw], nh, nw))
    for ah, aw in b:
        nh, nw = h + ah, w + aw
        if 0 <= nh < H and 0 <= nw < W and S[nh][nw] == ".":
            if d[nh][nw] > d[h][w] + 1:
                d[nh][nw] = d[h][w] + 1
                heappush(Q, (d[nh][nw], nh, nw))

if d[Dh][Dw] == H * W:
    ans = -1
else:
    ans = d[Dh][Dw]
print(ans)



Measured memory_bytes: 119232
from collections import defaultdict
import heapq
INF = 10**6


def dijkstra(N, adj_nodes, start_node, non_use_node):
    assert start_node != non_use_node
    d = [INF for _ in range(N)]
    d[start_node] = 0
    frontier = [(0, start_node)]
    while len(frontier) > 0:
        dist, node = heapq.heappop(frontier)
        for next_node in adj_nodes[node]:
            if next_node == non_use_node:
                continue
            if d[next_node] > dist + 1:
                d[next_node] = dist + 1
                heapq.heappush(frontier, (d[next_node], next_node))
    return d


def main():
    N = int(input())
    adj_nodes = defaultdict(list)
    for _ in range(N - 1):
        a, b = list(map(int, input().split(' ')))
        a -= 1
        b -= 1
        adj_nodes[a].append(b)
        adj_nodes[b].append(a)
    fen_node, snu_node = 0, N - 1
    d_fen = dijkstra(N, adj_nodes, fen_node, snu_node)
    d_snu = dijkstra(N, adj_nodes, snu_node, fen_node)
    fen_score = 0
    for f, s in zip(d_fen, d_snu):
        fen_score += 1 if f <= s else 0
    snu_score = N - fen_score
    # answer
    if fen_score <= snu_score:
        print('Snuke')
    else:
        print('Fennec')


if __name__ == '__main__':
    main()

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

int main() {
  int n; cin >> n;
  double sum_of_inverse = 0;
  for (int i = 0; i < n; i++) {
    int a; cin >> a;
    sum_of_inverse += 1. / a;
  }
  double ans = 1. / sum_of_inverse;
  cout << scientific << setprecision(10) << ans << endl;
}

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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'

int a, b, c = 0;

signed main()
{
	IOS;
	cin >> a >> b;
	int k = 1;
	while (k < b) {
		k = k - 1 + a;
		c++;
	}
	cout << c << endl;
	return 0;
}


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

using namespace std;

void dfs(vector <vector <int>>&adj,int k,vector <int>&order,vector <int> &visited){
    if(visited[k]) return;
    visited[k] = 1;
    for(auto i:adj[k]){
        if(!visited[i]){
            dfs(adj,i,order,visited);
        }
    }
    order.push_back(k);
}

int main(){
 int n;
 cin >> n;
 vector <vector <int>> adj(n),adj2(n);
 int m;
 cin >> m;
 for(int i = 0;i < m;i++){
     int u,v;
     cin >> u >> v;
     adj[u - 1].push_back(v - 1);
     adj2[v- 1].push_back(u - 1);
 }
 vector <int> order;
 vector <int> visited(n,0);
 for(int i = 0;i < n;i++){
     dfs(adj,i,order,visited);
 }
 visited = vector<int>(n,0);
 vector <int> topoOrder;
 for(int i = 0;i < n;i++){
     if(!visited[order[n - 1 - i]]){
         dfs(adj2,order[n - 1 - i],topoOrder,visited);
     }
 }
 vector <int> dp(n + 1,0);
 int ans = 0;
 dp[topoOrder[0]] = 0;
 for(int i = 0;i < n;i++){
     for(int j:adj[topoOrder[i]]){
         dp[j] = max(dp[j],dp[topoOrder[i]] + 1);
         ans = max(ans,dp[j]);
     }
 }
 cout << ans;
 return 0;
}

Measured memory_bytes: 15732
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i > 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int main() {
  ll x;
  cin >> x;
  abs(x);
  ll position = 0;
  ll count = 0;
  while (position < x) {
    count++;
    position += count;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
long nCr(int n, int r) {
	long ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};

signed main() {
	int n;
	cin >> n;
	n -= 1;
	cout << (n * (1 + n)) / 2 << endl;
}

Measured memory_bytes: 256
//解説に倣ってイベントソート
#include<bits/stdc++.h>
using namespace std;

void happen(int flag, int x, set<int> &s){
  if(flag==1) s.insert(x);
  else if(flag==-1) s.erase(x);
}

int main(){
  int n,q;
  cin>> n >> q;
  vector<vector<int>> event(2*n,vector<int>(3));
  vector<int> d(q);
  for(int i=0; i<n; i++){
    int s,t,x;
    cin>> s >> t >> x;
    event[i]={s-x,1,x};
    event[i+n]={t-x,-1,x};
  }
  for(int i=0; i<q; i++) cin>> d[i];
  
  sort(event.begin(),event.end());
  auto itr=event.begin();
  set<int> close;
  for(auto t:d){ //dはもともとソート済み
    while(itr!=event.end() && (*itr)[0]<=t){
      happen((*itr)[1],(*itr)[2],close);
      itr++;
    }
    if(close.empty()) cout<< -1 <<endl;
    else cout<< *close.begin() <<endl;
  }
}
//自力とかむり

Measured memory_bytes: 34936
s=input()
a=int('0b'+s, 0)
b=int('0b'+''.join(['0' if i%2==0 else '1' for i in range(len(s))]), 0)
c=b^int('0b'+'1'*len(s), 0)
print(min(bin(a^b).count('1'),bin(a^c).count('1')))


Measured memory_bytes: 4120
#-swank
(unless (member :child-sbcl *features*)
  (quit
	:unix-status
	(process-exit-code
	  (run-program *runtime-pathname*
				   `("--control-stack-size" "128MB"
					 "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
					 "--eval" "(push :child-sbcl *features*)"
					 "--script" ,(namestring *load-pathname*))
				   :output t :error t :input t))))

(let ((a (read)) (b (read)))
  (princ (if (= a b) "Yes" "No")))


Measured memory_bytes: 11576
def examA():
    S, T = LSI()
    A, B = LI()
    U = SI()
    if S==U:
        print(A-1,B)
    else:
        print(A,B-1)
    return

def examB():
    S = SI()
    N = len(S)
    ans = ""
    for i in range(N):
        ans += "x"
    print(ans)
    return

def examC():
    N = I()
    A = LI()
    d = defaultdict(int)
    for a in A:
        d[a] += 1
        if d[a]>=2:
            print("NO")
            return
    print("YES")
    return

def examD():
    N, K = LI()
    P = LI()
    S = [0]*(N+1)
    for i in range(N):
        S[i+1] = S[i]+(P[i]+1)/2
    ans = 0
    for i in range(N-K+1):
        cur = S[i+K]-S[i]
        ans = max(ans,cur)
    print(ans)
    return

def examE():
    def ketadp(a,K):
        n = len(a)
        C = [i for i in range(K+1)]
        dp = defaultdict(int)
        dp[0, 0, 0] = 1
        for i, less, k in itertools.product(range(n), (0, 1), C):
            max_d = 9 if less else int(a[i])
            for d in range(max_d + 1):
                less_ = less or d < max_d
                if d==0:
                    dp[i + 1, less_, k] += dp[i, less, k]
                elif k<K:
                    dp[i + 1, less_, k+1] += dp[i, less, k]

        ans = sum(dp[n, less, K] for less in (0, 1))
        return ans
    N = SI()
    K = I()
    ans = ketadp(N,K)
    print(ans)
    return

def examF():
    class combination():
        # 素数のmod取るときのみ　速い
        def __init__(self, n, mod):
            self.n = n
            self.fac = [1] * (n + 1)
            self.inv = [1] * (n + 1)
            for j in range(1, n + 1):
                self.fac[j] = self.fac[j - 1] * j % mod

            self.inv[n] = pow(self.fac[n], mod - 2, mod)
            for j in range(n - 1, -1, -1):
                self.inv[j] = self.inv[j + 1] * (j + 1) % mod

        def comb(self, n, r, mod):
            if r > n or n < 0 or r < 0:
                return 0
            return self.fac[n] * self.inv[n - r] * self.inv[r] % mod
    r1, c1, r2, c2 = LI()
    C = combination(r2+c2+2,mod)
    H = [0]*(c2+2)
    W = [0]*(c2+2)
    for i in range(c2+1):
        H[i+1] = H[i] + C.comb(r2+i+1,i+1,mod)
        W[i + 1] = W[i] + C.comb(r1-1 + i + 1, i + 1, mod)

#    print(H,W)
    ans = H[c2+1] - H[c1] - W[c2+1] + W[c1]
    ans = (ans+mod)%mod
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examF()

"""

"""

Measured memory_bytes: 252636
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<long long int> a(n);
    for(int i = 0 ; i < n ; i++){
        cin >> a[i];
    }
    vector<long long int> sum(n+1);
    sum[0] = 0;
    for(int i = 1 ; i <= n ; i++){
        sum[i] = sum[i-1] + a[i-1];
    }
    map<long long int, long long int> mp;
    long long int ans = 0;
    for(int i = 0 ; i <= n ; i++){
        ans += mp[sum[i]];
        mp[sum[i]]++;
    }
    cout << ans << endl;
    return 0;
}

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

public class Main {
	public static void main(String[] args){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String tes = null;

		List<Double> al = new ArrayList<Double>();
		try {
			tes = br.readLine();
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
		
		double a = Double.parseDouble(tes);
		al.add(a);

		while(true){
			try {
				tes = br.readLine();
			} catch (IOException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
			if(tes == null){
				break;
			}
			
			try{
				a = Double.parseDouble(tes);
			}catch(NumberFormatException e){
				break;
			}
			
			al.add(a);
		}
		
		for(int i=0;i<al.size();i++){
			for(int j=i+1;j<al.size();j++){
				if(al.get(i) < al.get(j)){
					double tmp = al.get(i);
					al.set(i, al.get(j));
					al.set(j, tmp);
				}
			}
		}
		System.out.println(al.get(0) - al.get(al.size() - 1));
		
	}

}

Measured memory_bytes: 15080
#include <cstdio>
typedef long long ll;
inline int rd(){
    int x=0,p=1;
    char a=getchar();
    while((a<48||a>57)&&a!='-')a=getchar();
    if(a=='-')p=-p,a=getchar();
    while(a>47&&a<58)x=(x<<1)+(x<<3)+(a&15),a=getchar();
    return x*p;
}
ll x;
int main(){
	x=rd();
	for(ll a=0;a<=1000;a++)
		for(ll b=-1000;b<=1000;b++)
			if((1ll*a*a*a*a*a-1ll*b*b*b*b*b)==x)return printf("%lld %lld\n",a,b),0;
    return 0;
}

Measured memory_bytes: 1604
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 1 ;count = 0 ;pro = 1
def gcd(a, b):
    while(b != 0):
        a, b = b, a % b
    return a
    
def lcm(m,n):
    return (m*n)//gcd(m,n)

n = int(input())
def make_key0(a,b):
  if a == 0 and b != 0:
    return(0,1)
  elif a != 0 and b == 0:
    return(1,0)
  if (a < 0 and b > 0) or (a > 0 and b < 0):hugou = 1
  else: hugou = -1
  a = abs(a)
  b = abs(b)
  G = gcd(a,b)
  return (hugou*(abs(a)//G),abs(b)//G)

C0 = collections.Counter()

for i in range(n):
  a,b = map(int,input().split())
  if (a,b) == (0,0) :count += 1
  else:
    a0,b0 = make_key0(a,b)
    C0[(a0,b0)] += 1

S = set()
for key,val in C0.items():
  a0,b0 = key
  S.add((a0,b0))
  a1,b1 = make_key0(b0,a0)
  if (a1,b1) in S:continue
  ans *= pow(2,val,mod) + pow(2,C0[(a1,b1)],mod) -1
  ans %= mod
ans += count 
print((ans-1)%mod)

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

int main(){
  int N,a,b;
  int p_index,length,index;
  while(cin >> N && N != 0){
    //    cout << N << endl;
    int sum = 0;int temp = 0;
    for(int k=0;k<N;k++){
      cin >> p_index >> a >> b;
      //      cout << p_index << endl;
      temp = a + b;
      index = temp> sum? p_index : index;
      sum = temp>sum ? temp : sum;

      //      cout << p_index << " " << index << " " << temp << " " << sum << endl;
    }
    cout << index << " " << sum << endl;

  }
}

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

struct data{
  int l,r,c;
  bool operator < (const data &d) const {
    return r == d.r ? c > d.c : r < d.r;
  }
};

const int N = 1000;
const int M = 365;
data v[N];
int dp[2][M+1][M+1];
int n;

void solve(){
  fill(dp[0][0],dp[2][0],0);
  sort(v,v+n);

  for(int i=0;i<n;i++){
    for(int j=0;j<=M;j++){
      for(int k=0;k<=M;k++){
        dp[0][j][k] = dp[1][j][k];
      }
    }
    
    for(int j=v[i].r+1;j<=M;j++){
      for(int k=0;k<=M;k++){
        dp[1][j][k] = max(dp[1][j][k], dp[0][v[i].l][k] + v[i].c);
        dp[1][k][j] = max(dp[1][k][j], dp[0][k][v[i].l] + v[i].c);
      }
    }    
  }

  cout << dp[1][M][M] << endl;
}

int main(){
  while(cin >> n && n){
    for(int i=0;i<n;i++){
      cin >> v[i].l >> v[i].r >> v[i].c;
      v[i].l--; v[i].r--;
    }
    solve();
  }
}

Measured memory_bytes: 2236
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct node{
	int l;
	int r;
	int h;
}a[200000];
ll c[200000]={0};
bool cmp(struct node a1,struct node a2)
{
	return a1.l<a2.l;
}
int main(void)
{
	int n,d,health;
	scanf("%d%d%d",&n,&d,&health);
	int i;
	for(i=0;i<n;i++)
	{
		int x,h;
		scanf("%d%d",&x,&h);
		a[i].l=x-d;
		a[i].r=x+d;
		int c=h/health;
		if(h%health!=0)
		{
			c++;
		}
		a[i].h=c;
	}
	sort(a,a+n,cmp);
	ll sum=0;
	int j=0;
	for(i=0;i<n;i++)
	{
		while(j<n&&a[i].r>=a[j].l)
		{
			j++;
		}
		ll ok;
		ok=a[i].h-c[i];
		if(ok<0) ok=0;
		sum+=ok;
		c[j]-=ok;
		c[i+1]+=(c[i]+ok);
		int i1;
//		for(i1=0;i1<n;i1++) printf("%2d ",c[i1]);
//		printf("%d %d\n",ok,a[i].h);
	}
	printf("\n%lld",sum);
}

Measured memory_bytes: 4096
#include <bits/stdc++.h> // Tomasz Nowak
using namespace std;     // XIII LO Szczecin
using LL = long long;    // Poland
#define FOR(i, l, r) for(int i = (l); i <= (r); ++i)
#define REP(i, n) FOR(i, 0, (n) - 1)
template<class T> int size(T &&x) {
	return int(x.size());
}
template<class A, class B> ostream& operator<<(ostream &out, const pair<A, B> &p) {
	return out << '(' << p.first << ", " << p.second << ')';
}
template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
	out << '{';
	for(auto it = x.begin(); it != x.end(); ++it)
		out << *it << (it == prev(x.end()) ? "" : ", ");
	return out << '}';
}
void dump() {}
template<class T, class... Args> void dump(T &&x, Args... args) {
	cerr << x << ";  ";
	dump(args...);
}
#ifdef DEBUG
  struct Nl{~Nl(){cerr << '\n';}};
# define debug(x...) cerr << (strcmp(#x, "") ? #x ":  " : ""), dump(x), Nl(), cerr << ""
#else
# define debug(...) 0 && cerr
#endif
mt19937_64 rng(0);
int rd(int l, int r) {
	return uniform_int_distribution<int>(l, r)(rng);
}
// end of templates

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

	string s;
	cin >> s;
	int n = size(s);
	REP(i, n)
		if(s[i] == '?')
			s[i] = 'D';
	for(char c : s)
		cout << c;
	cout << '\n';
}


Measured memory_bytes: 3792
#include <iostream>

using namespace std;

int main() {
    int n;
    cin>>n;
    if(n%10==2 || n%10==4 || n%10==5 || n%10==7 || n%10==9) cout<<"hon"<<endl;
    else if(n%10==0 || n%10==1 || n%10==6 || n%10==8) cout<<"pon"<<endl;
    else if(n%10==3) cout<<"bon"<<endl;
    return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200005;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,fa[N],f[N],h[N];
ll ans;
struct node{int i,x,y;}a[N];
void operator+=(node &x,node y){x.x+=y.x;x.y+=y.y;}
bool operator<(node x,node y){ll t=(ll)x.x*y.y-(ll)x.y*y.x;return (t) ? (t>0) : (x.i<y.i);}
int find(int x){return (x==f[x]) ? x : f[x]=find(f[x]);}
void merge(int x,int y){
	x=find(x);y=find(y);
	ans+=(ll)a[x].x*a[y].y;
	f[y]=x;a[x]+=a[y];
}
priority_queue<node> g;
int main(){
	n=read();
	for (int i=2;i<=n;i++) fa[i]=read();
	for (int i=1;i<=n;i++){
		f[i]=i;
		if (read()) a[i]=(node){i,1,0};
		else a[i]=(node){i,0,1};
	}
	for (int i=2;i<=n;i++) g.push(a[i]);
	for (int i=2;i<=n;i++){
		while (h[g.top().i]) g.pop();
		int x=g.top().i,y=find(fa[x]);
		g.pop();h[x]=1;
		merge(y,x);
		if (y!=1) g.push(a[y]);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 9588
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
#define INF 2000000000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメaモ
  数値型から文字列に変換　to_string(number);これは簡単
  文字列から数値型に変換　stoi(number)
  文字列からllに変換　stoll(number)*/

//ここから書き始める
int main(){
	ll k, a, b;
	cin >> k >> a >> b;

	//交換してお得じゃねえなら割るだけでいんだわ ノウキンなので
	if(b - 2 <= a) {
		cout<< k + 1 << endl;
		return 0;
	}
	else {//交換してもいいとき
		//まず、A枚を作って残りの操作可能回数を見る
		ll ans = k+1 ;
		k -= a-1;
		if( k <= 1 ) {
			cout<<ans<<endl;
			return 0;
		}
		else{
			if( k % 2 == 0){//ちょうどk/2回交換できる
				ans = (b-a)*(k/2);
			}
			else {
				ans = (b-a)*(k/2) +1;
			}
			cout<<ans+a<<endl;
			return 0;
		}
	}
}


Measured memory_bytes: 256
def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

a, b, c, d = map(int, input().split())
print(b - a + 1 - (b // c + b // d - b // (lcm(c, d)) - ((a - 1) // c + (a - 1) // d - (a - 1) // lcm(c, d))))

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;

int main() {
	int n;
	cin >> n;
	if (n == 1) {
		cout << "Hello World";
	}
	else {
		int a, b;
		cin >> a >> b;
		cout << a + b;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	ll ans=0;
	if(k==0) {
		cout<<n*n<<endl;
		return 0;
	}
	FOR(i,k+1,n+1) {
		ll a=n/i, b=n%i;
		ans+=(i-k)*a+max(0ll,b-k+1);
	}
	cout<<ans<<endl;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &e : a)
    cin >> e;
  int color[8] = {};
  int crown = 0;
  for (int i = 0; i < n; ++i)
  {
    if (a[i] < 3200)
      color[a[i] / 400]++;
    else
      crown++;
  }
  int cnt = 0;
  for (int i = 0; i < 8; ++i)
  {
    if (color[i] > 0)
      cnt++;
  }
  cout << (cnt == 0 && crown > 0 ? 1 : cnt) << ' ' << cnt + crown << endl;

  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.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * 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);
        OneorTwo solver = new OneorTwo();
        solver.solve(1, in, out);
        out.close();
    }

    static class OneorTwo {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            UnionFind uf = new UnionFind(n);
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < m; i++) {
                int x = Integer.parseInt(in.next()) - 1;
                int y = Integer.parseInt(in.next()) - 1;
                int z = Integer.parseInt(in.next());
                uf.unite(x, y);
            }
            for (int i = 0; i < n; i++) {
                set.add(uf.findSet(i));
            }
            out.print(set.size());
        }

        public class UnionFind {
            int[] ranks;
            int[] parents;

            public UnionFind() {
            }

            public UnionFind(int size) {
                ranks = new int[size];
                parents = new int[size];
                for (int i = 0; i < size; i++) {
                    makeSet(i);
                }
            }

            public void makeSet(int x) {
                parents[x] = x;
                ranks[x] = 0;
            }

            public int findSet(int x) {
                if (x != parents[x]) {
                    parents[x] = findSet(parents[x]);
                }
                return parents[x];
            }

            public boolean same(int x, int y) {
                return findSet(x) == findSet(y);
            }

            public void link(int x, int y) {
                if (same(x, y)) {
                    return;
                }
                if (ranks[x] > ranks[y]) {
                    parents[y] = parents[x];
                } else {
                    parents[x] = parents[y];
                    if (ranks[x] == ranks[y]) {
                        ranks[y]++;
                    }
                }
            }

            public void unite(int x, int y) {
                link(findSet(x), findSet(y));
            }

        }

    }
}



Measured memory_bytes: 63564
def cumsum(a):
    res = [0] * (len(a) + 1)
    for i in range(len(a)):
        res[i + 1] += res[i] + a[i]
    return res


n, k = map(int, input().split())
s = list(map(int, input()))

t = []
x = 1
x_repeats = 0
i = 0
while i < n:
    if s[i] == x:
        x_repeats += 1
    else:
        t.append(x_repeats)
        x ^= 1
        x_repeats = 1
    i += 1
t.append(x_repeats)


cumsum_t = cumsum(t)

ans = 0
for left in range(0, len(cumsum_t), 2):
    right = min(2 * k + left + 1, len(cumsum_t) - 1)
    ans = max(ans, cumsum_t[right] - cumsum_t[left])

print(ans)

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

char s[5];

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%s",s);
	if(strlen(s)==3) {
		for(int i=2;i>=0;i--)
			putchar(s[i]);
		puts("");
	} else puts(s);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#define N_MAX 10000000000
using namespace std;

int main(){
  std::vector<long long int> s,t;
  long long int c,x,dp;
  int i,A,B,Q,sp[2],tp[2];
  
  cin >> A >> B >> Q;
  for(i=0;i<A;i++){
    cin>>c;
    s.push_back(c);
  }
  for(i=0;i<B;i++){
    cin>>c;
    t.push_back(c);
  }
  for(i=0;i<Q;i++){
    cin>>x;
    //sp[]の決定
    sp[0]=0;sp[1]=A-1;
    while(sp[1]-sp[0]>1){
      if(s[(sp[0]+sp[1])/2]>=x)sp[1]=(sp[0]+sp[1])/2;
      else sp[0]=(sp[0]+sp[1])/2;
    }
    //tp[]の決定
    tp[0]=0;tp[1]=B-1;
    while(tp[1]-tp[0]>1){
      if(t[(tp[0]+tp[1])/2]>=x)tp[1]=(tp[0]+tp[1])/2;
      else tp[0]=(tp[0]+tp[1])/2;
    }
        
    //x,sp[0],tp[0]
    dp=abs(x-s[sp[0]])+abs(s[sp[0]]-t[tp[0]]);
    //x,sp[0],tp[1]
    if(dp>abs(x-s[sp[0]])+abs(s[sp[0]]-t[tp[1]]))
      dp=abs(x-s[sp[0]])+abs(s[sp[0]]-t[tp[1]]);
    //x,sp[1],tp[0]
    if(dp>abs(x-s[sp[1]])+abs(s[sp[1]]-t[tp[0]]))
      dp=abs(x-s[sp[1]])+abs(s[sp[1]]-t[tp[0]]);
    //x,sp[1],tp[1] 
    if(dp>abs(x-s[sp[1]])+abs(s[sp[1]]-t[tp[1]]))
      dp=abs(x-s[sp[1]])+abs(s[sp[1]]-t[tp[1]]);
    //x,tp[0],sp[0]
    if(dp>abs(x-t[tp[0]])+abs(t[tp[0]]-s[sp[0]]))
      dp=abs(x-t[tp[0]])+abs(t[tp[0]]-s[sp[0]]);
    //x,tp[0],sp[1]
    if(dp>abs(x-t[tp[0]])+abs(t[tp[0]]-s[sp[1]]))
      dp=abs(x-t[tp[0]])+abs(t[tp[0]]-s[sp[1]]);
    //x,tp[1],sp[0]
    if(dp>abs(x-t[tp[1]])+abs(t[tp[1]]-s[sp[0]]))
      dp=abs(x-t[tp[1]])+abs(t[tp[1]]-s[sp[0]]);
    //x,tp[1],sp[0]
    if(dp>abs(x-t[tp[1]])+abs(t[tp[1]]-s[sp[1]]))
      dp=abs(x-t[tp[1]])+abs(t[tp[1]]-s[sp[1]]);

    cout << dp <<endl;
  }
  
  return 0;
}

Measured memory_bytes: 3060
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")
#pragma GCC target("sse4")

#include <bits/stdc++.h>
using namespace std;

#define deb(x) cout << #x << " is " << x << "\n"
#define int long long
#define mod 1000000007
#define PI acos(-1)

void solve() {
	int d, n, k, ans;
	cin >> n >> k >> d;
	
	if (n < 0) n = -n;
	
	if (n / d < k) {
		int rest = k - n / d;
		if (rest % 2 == 0) ans = n % d;
		else ans = d - n % d;
	} else {
		ans = n - d * k;
	}
	cout << ans << '\n';
}

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int tc = 1;
	// cin >> tc;
	while(tc--) {
	    solve();
	}
	return 0;
}


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

#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

signed main(){
    string s; cin >> s;
    if(s[1]=='B') cout<<"ARC"<<endl;
    else cout<<"ABC" <<endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define sec second
#define fir first
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
typedef vector<int> Vec;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



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

	string s;
	cin >> s;
	sort(all(s));
	rep(i, s.size()-1) {
		if(s[i] != s[i+1]) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256