akhauriyash/Code-Regression huggingface dataset:
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define mp make_pair
#define ll long long
#define reg register
#define inf 0x7fffffff
#define MOD 1000000007
#define clr(a) memset(a,sizeof(a),0);
#define rep(i,l,r) for(reg int i=l;i<=r;i++)
#define dow(i,l,r) for(reg int i=l;i>=r;i--)
inline int read(){int x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}return x*f;}
inline ll readl(){ll x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}return x*f;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}
template<class T>inline T power(T a,T b){T ans=1;while(b){if(b&1){ans=ans*a%MOD;}b>>=1;a=a*a%MOD;}return ans%MOD;}
/*================Header Template==============*/
int main(){
	int n=read(),k=read();
	if(n==k) return writeln(1),0;
	writeln((n-2)/(k-1)+1);
}



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

XS = sorted(X)
XD = []

if N > M:
    print(0)

else:
    for i in range(0, len(XS)-1):
        XD.append(XS[i + 1] - XS[i])

    XD2 = sorted(XD)
    print(sum(XD2[:M-N]))

Measured memory_bytes: 13968
#include <stdio.h>
#include <iostream>
#include <map>
#include <string>
using namespace std;
map<string,int> m2;
int main(){
	int n,m,max=-5005;
   cin >> n ;
   for(int i=0;i<n;i++){
   	string a;
   	cin >> a;
   	m2[a]++;
   }
   cin>>m;
   for(int i=0;i<m;i++){
   	string a;
   	cin>>a;
    m2[a]--;
   }
   for(map<string,int>::iterator it = m2.begin();it!=m2.end();++it){
		max=max>it->second?max:it->second;
	}
   if(max>=0) printf("%d\n",max);
   else printf("0\n");
   return 0;
}

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

int main() {

	std::string N;
	int count = 0;

	std::cin >> N;

	if ((N[0] == N[1] && N[1] == N[2])||(N[1]==N[2] &&N[2]==N[3])) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}
}

Measured memory_bytes: 256
while True:
    a,op,b = input().split()
    if op=='?':
        break
    if op == '+':
        n = int(a) + int(b)
    elif op =='-':
        n = int(a)- int(b)
    elif op=='*':
        n = int(a)*int(b)
    elif op=='/':
        n = int(a)/int(b)
    print(int(n))
    


Measured memory_bytes: 5596
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
	return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
	return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
	int t=*a;
	*a=*b;
	*b=t;
}
long long gcd(long long x,long long y){
	return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
	return x/gcd(x,y)*y;
}

// konoshita kara kaku
		
int main(void){
	int n=in(),x=in(),a=0,i,m[100];
	rep(i,n){
		m[i]=in();
		x-=m[i];
	}
	a=n;
	sort(m,n);
	a+=x/m[0];
	print(a);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <climits>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

#define DIV 1000000007

using namespace std;

long long N, Q;
long long state[100005];
long long A[100005];
long long B[100005];

int main(){
	cin >> N >> Q;
	for(int i = 0; i < Q; i++){
		cin >> A[i] >> B[i];
		A[i]--;B[i]--;
	}
	long long pos = 0;
	state[0] = 1;
	state[1] = 1;
	for(int i = 0; i < Q; i++){
		if(pos == A[i]){
			pos = B[i];
		}else if(pos == B[i]){
			pos = A[i];
		}
		swap(state[A[i]], state[B[i]]);
		if(pos > 0){
			state[pos-1] = 1;
		}
		if(pos < N-1){
			state[pos+1] = 1;
		}
	}

	long long ans = 0;
	for(int i = 0; i < N; i++){
		//cout << "i=" << i << " state " << state[i] << endl;
		if(state[i]){
			ans++;
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

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

    double l;
    cin >> l;

    printf("%.19f\n", l*l*l/27.);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
#define inf 2000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;			
	   
int main() {
			fast
			// #ifndef ONLINE_JUDGE
			// freopen("input.txt","r",stdin);
			// freopen("output.txt","w",stdout);
			// #endif
			ll n;
			cin>>n;

			if(n>=400 and n<=599)
			{
				cout<<"8"<<endl;

			}
			if(n>=600 and n<=799)
			{
				cout<<"7"<<endl;
			}
			if(n>=800 and n<=999)
			{
				cout<<"6"<<endl;
			}
			if(n>=1000 and n<=1199)
			{
				cout<<"5"<<endl;
			}
			if(n>=1200 and n<=1399)
			{
				cout<<"4"<<endl;
			}
			if(n>=1400 and n<=1599)
			{
					cout<<"3"<<endl;
			}
			if(n>=1600 and n<=1799)
			{
				cout<<"2"<<endl;
			}
			if(n>=1800 and n<=1999)
			{
				cout<<"1"<<endl;
			}
			
			return 0;
		 }	




Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{int n,x,t;
cin>>n>>x>>t;
int ans=0;
int y=x;
for(int i=t;;i+=t){
if(n<=y){ans=i;break;}
y+=x;
}
cout<<ans<<endl;
return 0;
}



Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <bitset>
#include <time.h>
#include <set>
#include <algorithm>
#define Inf 10000000000ll
#define ll long long
using namespace std;


int main() {
    ll N,A,B;
    cin>>N>>A>>B;
    if (A > B) {
        cout << 0 << endl;
        return 0;
    }
    
    if (N == 1 && A != B) {
        cout << 0 << endl;
        return 0;
    }
    
    // A+...+B
    // (N-1)*A+B to A+(N-1)*B
    ll ans = A+(N-1)*B-(N-1)*A-B+1;
    cout << ans << endl;
}

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

int main() {
  string s;
  map<char, int> table;
  for (char c = 'a'; c <= 'z'; c++) table[c] = 0;
  while (!cin.eof()) {
    getline(cin, s);
    for (int i = 0; i < s.size(); i++) {
      char c = (char)tolower(s.at(i));
      if (c > 'z' || c < 'a') continue;
      table[c]++;
    }
  }
  for (auto x : table) {
    cout << x.first << " : " << x.second << endl;
  }
}



Measured memory_bytes: 3188
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class CHalfAndHalf {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt(), b = in.nextInt(), c = in.nextInt();
            int needA = in.nextInt(), needB = in.nextInt();

            int answer = Integer.MAX_VALUE;
            answer = Math.min(answer, needA * a + needB * b);

            int needAB = Math.min(needA, needB);
            answer = Math.min(answer, (needA - needAB) * a + (needB - needAB) * b + needAB * 2 * c);

            needAB = Math.max(needA, needB);
            answer = Math.min(answer, needAB * 2 * c);

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23380
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

L = str(input())
n = len(L)
dp = [[0,0] for i in range(n+1)]
dp[0][0] = 1
for i in range(n):
    if L[i] == "0": #a+b = 0
        dp[i+1][0] = dp[i][0]
        dp[i+1][1] = dp[i][1]
    else:
        dp[i+1][1] = (dp[i][0] + dp[i][1]) % mod

    if L[i] == "0":
        dp[i+1][1] = (dp[i+1][1] + dp[i][1]*2) % mod
    else:
        dp[i+1][0] = (dp[i+1][0] + dp[i][0]*2) % mod
        dp[i+1][1] = (dp[i+1][1] + dp[i][1]*2) % mod


print(sum(dp[n]) % mod)


Measured memory_bytes: 22732
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        int A = s.nextInt();

        int B = s.nextInt();

        int C = s.nextInt();

        int D = s.nextInt();

        while(true) {
            C= C-B;
            A = A-D;
            if(C <= 0) {
                System.out.println("Yes");
                break;
            }
            if(A <= 0) {
                System.out.println("No");
                break;
            } 
        }
    }
}

Measured memory_bytes: 35568
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

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

int main()
{
	ll n,a;
	cin >> n >> a;
	vector<ll>x(n+1);
	for(int i = 1; i <= n; i++){
		cin >> x[i];
	}

	ll dp[51][51][50*50+1] = {0};

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

	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			for(int k = 50*50; k >=0; k--){
				if(k-x[i] >= 0){
					dp[i][j][k] = dp[i-1][j-1][k-x[i]] + dp[i-1][j][k];
				}else{
					dp[i][j][k] = dp[i-1][j][k];
				}
			}
		}
	}


	ll ans = 0;

	for(int j = 1; j <= n; j++){
		//cout << ans << endl;
		ans += dp[n][j][j*a];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 51072
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
# 文字列の入力
#s = input()
#開業されたN個要素を受け付ける
#input_list = [list(map(int, input().split())) for i in range(N)]

#print()

ans = "NO"
t=0

if W<V:
    if (abs(A-B) / (V-W)) <= T:
        ans = "YES"



print(ans)


Measured memory_bytes: 61784
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
string s,t;
long long n,m,lcm;
map<long long,char> a;
long long gcd(long long A,long long B)
{
    if((!A)||(!B)) return A+B;
    return gcd(B,A%B);
}
bool check()
{
    long long i;
    for(i=0;i<s.size();i++)
    {
        a[1LL*(i)*lcm/n+1]=s[i];
    }
    for(i=0;i<t.size();i++)
    {
        if(a[1LL*(i)*lcm/m+1]&&t[i]!=a[1LL*(i)*lcm/m+1])
            return 0;
    }
    return 1;
}
int main()
{
   // freopen("data.in","r",stdin);
    cin>>n>>m;
    cin>>s>>t;
    lcm=1LL*n*m/gcd(n,m);
    if(check()) cout<<lcm;
    else cout<<"-1";
    return 0;
}


Measured memory_bytes: 10880
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string> 
#include<cstring> 
#include<sstream>
using namespace std;
int main()
{
    int a,b,c,sum=0;
    cin>>a>>b>>c;
    if(a==7) sum++;
    if(b==7) sum++;
    if(c==7) sum++;
    if(sum==1) cout<<"YES"; else cout<<"NO";
    return 0;
}

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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

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

void Main() {
  int r;
  cin >> r;
  cout << r * r << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define one 1.0
#define inf 1e18
#define ret return
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
int main()
{
	ll a,b;
	cin>>a>>b;
	cout<<a*b<<endl;
	return 0;
}

Measured memory_bytes: 3636
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#define MY_DEBUG(s)      
#endif

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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

#define EPS (1e-7)
#define IINF ((int)1e9)


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

	int x, y;
	cin >> x >> y;

	int all_turtle_legs = 4 * x;
	int diff_legs = all_turtle_legs - y;
	if (diff_legs % 2 == 1)
	{
		cout << "No" << "\n";  // odd number of legs
		return 0;
	}

	if (0 <= diff_legs && diff_legs <= 2 * x)
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
	return 0;
}
MY_NAMESPACE_

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef unsigned long long int ull;
int MOD=1000000007;
int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void yes() {cout<<"YES"<<en; exit(0);}
void no() {cout<<"NO"<<en; exit(0);}
inline int rund() {int x576363482791fuweh=rng();return abs(x576363482791fuweh)%RAND_MAX;}
template<class T>
void prVec(vector<T> w)
{
	cout<<w.size()<<endl;
	for (int i=0;i<int(w.size())-1;++i) cout<<w[i]<<' ';
	if (w.size()) cout<<w[w.size()-1]<<endl;
}

void M998()
{
	swap(MOD,MOD2);
}

ll raand()
{
	ll a=rund();
	a*=RAND_MAX;
	a+=rund();
    return a;
}

#define rand raand

ll raaand()
{
	return raand()*(MOD-7)+raand();
}

string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}

string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

ll sti(string a)
{
	ll k=0;
	for (int i=0;i<(int)a.size();++i)
	{
		k*=10;
		k+=a[i]-'0';
	}
	return k;
}

string its(ll k)
{
	if (k==0) return "0";
	string a;
	while (k)
	{
		a.push_back((k%10)+'0');
		k/=10;
	}
	reverse(a.begin(),a.end());
	return a;
}

ll min(ll a,int b)
{
	if (a<b) return a;
	return b;
}

ll min(int a,ll b)
{
	if (a<b) return a;
	return b;
}

ll max(ll a,int b)
{
	if (a>b) return a;
	return b;
}

ll max(int a,ll b)
{
	if (a>b) return a;
	return b;
}

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

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

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

inline int mult(ll a,ll b)
{
	return (a*b)%MOD;
}

inline int pot(int n,int k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

int divide(int a,int b)
{
	return mult(a,pot(b,MOD-2));
}

inline int sub(int a,int b)
{
	if (a-b>=0) return a-b;
	return a-b+MOD;
}

inline int add(int a,int b)
{
	if (a+b>=MOD) return a+b-MOD;
	return a+b;
}

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

ll has(string x)
{
	ll h1=0,h2=0;
	x=to_lower(x);
	for (char a: x)
	{
		h1*=bases[0];
		h1+=a-'a';
		h1%=bases[3];
		h2*=bases[1];
		h2+=a-'a';
		h2%=bases[4];
	}
	return h1*(MOD+13893829)+h2;
}

const int N=300010;
string h;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	for (int i=0;i<10;++i) bases.push_back(rand()%(MOD-13893829)+13893829);
	cin>>h;
	sort(h.begin(),h.end());
	if (h[0]==h[1] && h[1]!=h[2] && h[2]==h[3]) cout<<"Yes";
	else cout<<"No";
}




Measured memory_bytes: 256
n = int(input())
a = list(map(str, input().split()))
b = []
'''
b = [str(a[0])]
if (n == 1):
    print(a[0])
    exit()

a = a[1:]

for i in a:
    b.append(str(i))
    b.reverse()
'''
'''
loop = int(n / 2)
loop_rest = n - loop

for i in range(loop):
    tar_index = (n - 1) - 2 * i
    tar = a[tar_index]

    b.append(str(tar))


if (n % 2 == 0):
    tar_index = 0
else:
    tar_index = 1

for i in range(loop_rest):
    b.append(str(a[tar_index]))
    tar_index += 2
'''

# 一つおきでListを取る場合。
# a[0::2]
# 1つ目：起点。
# 2つ目：Step

# a[::-1]
# > -1step,つまりReverse

if n % 2 == 1:
    print(" ".join((a[0::2][::-1] + a[1::2])))
else:
    print(" ".join((a[1::2][::-1] + a[0::2])))


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

int main()
{
	int N;
	cin >> N;
	rep(i,N)
	{
		cin >> d[i];
	}

	int ans = 0;
	rep(i,N)
	{
		for (int j = i+1; j < N; ++j)
		{
			ans += d[i]*d[j];
		}
	}

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

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(dead_code)]

use std::io::prelude::*;
use std::cmp::{max, min};
use std::collections::{BinaryHeap, HashSet};

fn read<T>() -> T
    where
        T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut heap: BinaryHeap<i64> = BinaryHeap::new();

    for _ in 0..n {
        let a: i64 = read();
        heap.push(a);
    }

    for _ in 0..m {
        let t = heap.pop().unwrap() / 2;
        heap.push(t);
    }

    let mut ans: i64 = 0;

    for a in heap {
        ans += a;
    }

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


Measured memory_bytes: 4476
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define scan(n) scanf("%d",&n)
#define put(n) printf("%d\n",n)
#define SENTINEL 1000000007
typedef long long lli;

int main()
{
    int i, n;
    double ans=0;
    double x[10];
    char u[3];
    scanf("%d",&n);
    for(i=0; i<n; i++) {
        scanf("%lf %s",&x[i],u);
        if(strcmp(u, "JPY")) {
            ans += x[i] * 380000.0;
        } else {
            ans += x[i];
        }
    }
    printf("%lf",ans);

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N , A;
  cin >> N >> A;
 
  if ( N % 500 <= A) {
    cout << "Yes" << endl;
  }
  else if ( N % 500  > A) {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define endl "\n"
typedef long long ll;
#define traceV(v) for(auto x:v)cout<<x<<" ";cout<<endl
#define traceM(mp) for(auto x:mp)cout<<x.first<<" "<<x.second<<endl

const int MOD = 1000000007;

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

  int A,B,C; cin>>A>>B>>C;

  bool can = false;
  reps(i,1, 1000000){
    if(A*i % B == C) can = true;
  }

  if(can) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI acos(-1)
#define eq(x,y) (fabs((x)-(y)) < eps)
#define debug(x) cerr<<x<<endl;
#define endl "\n"
#define pb push_back
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
const int nmax=1e5+10;
const int eps=1e-8;

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.precision(10);
    //cout<<fixed;
    //cout.tie(NULL);
    int n;
    cin>>n;
    vector<int>v(n),pref(n),suff(n);

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

    int c=-inf;

    for(int i=0;i<n;i++)
    {
        c=max(c,v[i]);
        pref[i]=c;
    }

    c=-inf;

    for(int i=n-1;i>=0;i--)
    {
        c=max(c,v[i]);
        suff[i]=c;
    }

    for(int i=0;i<n;i++)
    {
        if(i==0)
            cout<<suff[i+1]<<endl;
        else if(i==n-1)
            cout<<pref[i-1]<<endl;
        else
            cout<<max(pref[i-1],suff[i+1])<<endl;
    }




    return 0;
}


Measured memory_bytes: 3968
T = list(input())

for i in range(len(T)):
    if i!=0 and T[i-1]=="P" and T[i]=="?":
        T[i]="D"
    elif i == 0 and T[i]=="?":
        T[i]="D"
    elif T[i]=="?":
        T[i]="D"
T = "".join(T)
print(T)

Measured memory_bytes: 10572
n = input()

if len(n) == 1:
    print(n)
elif len(n) == 2:
    print(9)
elif len(n) == 3:
    print(int(n) - 90)
elif len(n) == 4:
    print(909)
elif len(n) == 5:
    print(int(n) - 9999 + 909)
elif len(n) == 6:
    print(90909)

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

using namespace  std;
int main(){
    int n;
    cin>>n;
    vector<int>result(3);
    for(int d=0;d<n;d++){
        vector<int>inter(3,0);
        vector<int>h(3);
        for(int a=0;a<3;a++){
            cin>>h[a];
        }
        // cout<<"cool";
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(i!=j){
                inter[j]=max(inter[j],result[i]+h[j]);}
            }
        }
        result=inter;
    }
    cout<<*max_element(result.begin(),result.end());
    // cout<<*max_element(result.begin(),result.end());
    return 0;
}





Measured memory_bytes: 384
#include<iostream>
#include<vector>

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int>p(N);
	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> p[i];
		if (p[i] != i + 1) {
			cnt++;
		}
	}
	if (cnt <= 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
q = int(input())
M = list(map(int, input().split()))

ans_map = {}

for i in range(1, n * 2000 + 1):
    ans_map[i] = 0

for i in range(2 ** n - 1):
    str_i = str(bin(i)[2:]).zfill(n)
    sum_a = 0
    for j, bit in enumerate(str_i):
        if bit == '1':
            sum_a += A[j]
    ans_map[sum_a] = 1

for m in M:
    if ans_map[m]:
        print('yes')
    else:
        print('no')



Measured memory_bytes: 8196
#include<bits/stdc++.h>
using namespace std;
#define INFTY 10000000000
typedef long long int ll;
const int MOD=1000000007;
using Graph = vector<vector<int>>;
using ipair = pair<ll,ll>;
bool operator< (const ipair a, const ipair b){return a.first < b.first;};
#define rep(i,n) for (int i = 0; i < (n); ++i)
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
  int n;cin>>n;
  vector<ll> a(n);
  ll sum = 0;
  rep(i,n){cin>>a[i];sum += a[i];}
  vector<ll> x(n);x[0] = sum;
  for(int i=1;i<=(n-1)/2;i++)x[0]-=2*a[i*2-1];
  cout<<x[0]<<" ";
  for (int i = 1; i < n; i++)
  {
    x[i] = 2*a[i-1]-x[i-1];
    cout<<x[i]<<" ";
  }
  
  return 0;
}

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

int main(){
    int N, Y; cin >> N >> Y;
    for(int i = 0;i <= Y/10000; i++){
        for(int j = 0; j <= (Y-i*10000)/5000; j++){
            int tmp = i * 10000 + j * 5000;
            int tmp2 = (Y - tmp) / 1000;
            if(tmp2+i+j == N){
                cout << i << " " << j << " " << tmp2 << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
    return 0;
}


Measured memory_bytes: 3576
#include <stdio.h>

int main(void);

int main(void)
{
    int a, b;

    scanf("%d", &a);
    scanf("%d", &b);

    if (a < b){
        printf("a < b\n");
    }
    else if (a > b){
        printf("a > b\n");
    }
    else{
        printf("a == b\n");
    }
    
    return(0);
}


Measured memory_bytes: 2120
/* 	* In the name of GOD 
	* Thanks God */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second

void solve() {
	int x;
	cin >> x;
	cout << 1 - x;
}

int32_t main() {
	int t = 1;
//	cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

    vector<ll> T(N);
    for (int i = 0; i < N; i++) {
        cin >> T[i];
    }

    sort(begin(T), end(T));

    ll i = 0;
    ll ans = 0;
    while (i < N) {
        ll end = T[i] + K;
        ++i;

        ll count = 1;
        while (i < N && T[i] <= end && count < C) {
            ++i;
            ++count;
        }

        ++ans;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    float a, b;
    cin >> a >> b;
    cout << ceil((a+b)/2.0) << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma region Macros

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

using ll = long long;
#define int ll
using vi = vector<int>;
using vvi = vector<vi>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
ostream &operator<<(ostream &out, vector<T> const &v) {
    for (auto &&a : v) out << a << " ";
    out << endl;
    return out;
}

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

#pragma endregion

void Main() {
    int D;
    cin >> D;

    vi c(26);
    REP(i, 26) {
        cin >> c[i];
    }
    vvi s(D, vi(26));
    REP(i, D) {
        REP(j, 26) {
            cin >> s[i][j];
        }
    }
    REP(i, D) {
        cout << i % 26 + 1 << "\n";
    }
}

#pragma region main
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    cout << flush;
}
#pragma endregion


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

using namespace std;
using llint = long long;

const int N = 2e5 + 10;

char A[N];

/*
llint manacher(const char *s, int n) {
  vector <int> u(n + n - 1, 1);
  for (int i = 1, x = 0; i < n + n - 1; ++i) {
    u[i] = max(x + u[x] - i, 1 - i % 2);
    if (x + x >= i) u[i] = min(u[i], u[x + x - i]);
    int a = (i - 1 - u[i]) >> 1, b = (i + 1 + u[i]) >> 1;
    while (a >= 0 && b < n && s[a] == s[b]) a--, b++, u[i] += 2;
    if (i + u[i] > x + u[x]) x = i;
  }
  for (auto i : u) cout << i << " "; cout << endl;
  llint ret = 0;
  for (int i = 0; i < u.size(); ++i) {
    ret += (u[i] + 1) / 2;
  }
  return ret;
}*/

int main() {
  scanf("%s", A);
  int n = strlen(A);
  int mp[30];
  memset(mp, 0, sizeof(mp));
  for (int i = 0; i < n; ++i) {
    mp[A[i] - 'a'] ++;
  }
  llint ret = 0;
  for (int i = 0; i < 26; ++i) {
    int z = mp[i];
    if (z) {
      ret += 1ll * (z + 1) * z / 2;
    }
  }
  printf("%lld\n", 1ll * (n + 1) * n / 2 - ret + 1);
  return 0;
}


Measured memory_bytes: 384
//Subhash Suman
//Description :

#include <bits/stdc++.h>
#define ll long long int
#define pll pair<ll, ll>
#define pii pair<int, int>

using namespace std;
const int N = 2e5 + 5;

struct line
{
    ll m, c;
    ll eval(ll x) { return (m * x + c); }
    ll intersectX(line l) { return (c - l.c) / (l.m - m); }
};

ll H[N];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    ll C;
    cin >> C;
    for (int i = 0; i < n; i++)
    {
        cin >> H[i];
        if (i == 0)
        {
            continue;
        }
        H[i] -= H[0];
    }

    deque<line> dq;
    dq.push_front({0, 0});
    ll ans = 0;
    for (int i = 1; i < n; i++)
    {
        while (dq.size() >= 2 && dq.back().eval(H[i]) <= dq[dq.size() - 2].eval(H[i]))
        {
            dq.pop_back();
        }
        ans = (-dq.back().eval(H[i])) + C + H[i] * H[i];
        ll c = ans + H[i] * H[i];
        line cur = {2 * H[i], -c};
        while (dq.size() >= 2 && cur.intersectX(dq[0]) <= dq[0].intersectX(dq[1]))
        {
            dq.pop_front();
        }
        dq.push_front(cur);
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 4096
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
#include <queue>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

const int N=101000;
int n,ret;
PII a[N];
int main() {
	scanf("%d",&n);
	rep(i,0,n) scanf("%d",&a[i].fi),a[i].se=i;
	sort(a,a+n);
	rep(i,0,n) if (a[i].se%2!=i%2) ret++;
	printf("%d\n",ret/2);
}


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

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>

using namespace std;

typedef pair<int,int> Paint;

bool Pairsecond(const Paint& pf,Paint&ps){//sortCompare
  return pf.second < ps.second;
}

#define anyfill(n,s) setw(n) << setfill(s)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define pb push_back
#define MAX 1000000000
#define MOD 1000000007

/*
確認ポイント
cout<< (char)数値 //数値にあった文字に置き換えられる
cout<< (double)int型/(2など)//小数になる
length(),size()に括弧をつけ忘れてないか;
sort()が使える型//vector,string...
YesNo大文字小文字間違えてないか
cout << fixed << 小数計算//正しい小数表記になる(基本6桁)(e記法回避にも使える)
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
sqrt(数値型)でrootが取れる
vector.unique()は隣接した同じ要素を削除するので先にソートをする
*/



int main(){
  string s;cin>>s;
  int mxclc = 0;
  int clc = 1;
  vector<int> arr;
  for(int i = 1; s.size() > i; i++){
    if(s[i-1]!=s[i]){
      arr.pb(clc);
      clc = 1;
    }else{
      clc++;
    }
  }
  arr.pb(clc);
  vector<int> ans;
  
  for(int i = 0; arr.size() > i; i+=2){
    int l = min(arr[i],arr[i+1]);
    int r = min(arr[i],arr[i+1]);
    int sm = arr[i]+arr[i+1];
    if(arr[i] < arr[i+1]){
      l = sm/2;
      r = sm/2+(sm%2==1?1:0);
    }else if(arr[i] > arr[i+1]){
      l = sm/2+(sm%2==1?1:0);
      r = sm/2;
    }
    if(max(arr[i],arr[i+1])%2 == 0){
      swap(l,r);
    }
    ans.pb(l);
    ans.pb(r);
  }
  int nw = 0;
  for(int i = 0; s.size() > i; i++){
    if(i+1 == s.size())cout << 0;
    else{
      if(s[i]=='R'&&s[i+1]=='L'){
        cout << ans[nw*2] << " " << ans[nw*2+1];
        if(i+2!=s.size()) cout << " ";
        i++;
        nw++;
      }else{
        cout << 0;
        if(i+1 != s.size()) cout << " ";
      }
    }
  }
  cout << endl;
}

Measured memory_bytes: 1592
#include <cstring>
#include <iostream>
#include <cstdio>
const int INF=100005;
using namespace std;
int prime[1100000],primesize,phi[11000000];
bool isprime[1100000];
int cnt[INF];
void getlist(int listsize)
{
    memset(isprime,1,sizeof(isprime));//³õÊ¼»¯ 
    isprime[1]=false;
    for(int i=2;i<=listsize;i++)
    {
        if(isprime[i])
		prime[++primesize]=i;
         for(int j=1;j<=primesize&&i*prime[j]<=listsize;j++)
         {
            isprime[i*prime[j]]=false;
            if(i%prime[j]==0)break;
        }
    }
}

void solve(){
	for(int i=3;i<INF;i++){
		if(isprime[i]&&isprime[(i+1)/2]){
			cnt[i]++;
		}
	}
	for(int i=1;i<INF;i++){
		cnt[i]+=cnt[i-1];
	}
} 
int main()
{
	int t;
	getlist(INF);
	solve();
	//cout<<isprime[2018]<<endl;
	scanf("%d",&t);
	for(int i=0;i<t;i++){
		int l,r;
		scanf("%d%d",&l,&r);
		printf("%d\n",cnt[r]-cnt[l-1]);
	}
	return 0;
}

Measured memory_bytes: 4096
fun main(args: Array<String>) {
    val (s1, s2) = readLine()!!.split(" ")
    var (a, b) = getInts()
    readLine()?.let {
        if (it == s1) a--
        else b--
        println("$a $b")
    }
}

fun getInt() = readLine()!!.toInt()
fun getInts() = readLine()!!.split(" ").map { it.toInt() }
fun getLong() = readLine()!!.toLong()
fun getLongs() = readLine()!!.split(" ").map { it.toLong() }

Measured memory_bytes: 35976
#include<iostream>
#include<queue>
#include<algorithm>
#include<functional>
#include<vector>

using namespace std;

struct Edge{
	int to, cost;
	Edge(int a, int b) { to = a, cost = b; }
};

int N, M, R;
int target[8];
int d[200][200];

int main() {
	for (int i = 0; i < 200; i++)for (int j = 0; j < 200; j++) {
		if (i == j)d[i][j] = 0;
		else d[i][j] = 100000000;
	}
	cin >> N >> M >> R;
	for (int i = 0; i < min(8, R); i++) {
		cin >> target[i];
		target[i]--;
	}
	sort(target, target + min(8, R));
	for (int i = 0; i < M; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		d[a][b] = min(d[a][b],c);
		d[b][a] = min(d[b][a],c);
	}
	for (int k = 0; k < N; k++) {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (d[i][j] > d[i][k] + d[k][j])d[i][j] = d[i][k] + d[k][j];
			}
		}
	}

	

	int ans = 100000000;
	do {
		int res = 0;
		for (int i = 1; i < min(8, R); i++) {
			res += d[target[i - 1]][target[i]];
		}
		ans = min(res, ans);
	} while (next_permutation(target, target + min(8, R)));

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

Measured memory_bytes: 384
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
	ll n, m, a; cin >> n >> m;
	if (n == 1 && m == 1) a = 1;
	else if (m == 1) a = n - 2;
	else if (n == 1) a = m - 2;
	else a = (n - 2)*(m - 2);
	cout << a << endl;
	return 0;
}

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

int main()
{
  int H, W, A, B;
  cin >> H >> W >> A >> B;
  int ans[1000][1000] = {0};

  for (int i = 0; i < B; ++i)
  {
    for (int j = 0; j < A; ++j)
    {
      ans[i][j] = 1;
    }
  }
  for (int i = B; i < H; ++i)
  {
    for (int j = A; j < W; ++j)
    {
      ans[i][j] = 1;
    }
  }
  for(int i=0;i<H;++i){
    for (int j = 0;j<W;++j){
      cout << ans[i][j];
    }
    cout << "\n";
  }
}

Measured memory_bytes: 5120
n,k = map(int, input().split()) 

p = [int(x) for x in input().split()]
p_kitaiti=[float((x+1)/2) for x in p]

ruisekiwa=[p_kitaiti[0]]

for i in range(1,len(p_kitaiti)):
    ruisekiwa.append(ruisekiwa[-1]+p_kitaiti[i])

ans=ruisekiwa[k-1]

for i in range(1,len(ruisekiwa)-k+1):
    ans=max(ans,ruisekiwa[i+k-1]-ruisekiwa[i-1])

print(ans)

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

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

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

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    ll n,k;
    cin >>n>>k;
    if(k==0){
        cout<<n*n<<endl;
        return 0;
    }

    rep1(i,k+1,n+1){
        int div=0,rem=0;
        div = (n/i)*(i-k);
        if(n%i!=0)rem=max(0LL,(n%i)-k+1);
        //db3(i,div,rem);ln;
        ans += div+rem;
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    cout<<ans<<endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var a=sc.Ia;
		int m=1000000;
		var b=new int[m+1];
		var c=new int[m+1];
		for(int i = 0;i<n;i++) {
			b[a[i]]++;
		}
		int ans=0;
		for(int i = 0;i<n;i++) {
			var bo=true;
			if((c[a[i]]&2)==2){
				ans++;
				continue;
			}
			if((c[a[i]]&4)==4){
				continue;
			}
			Pn(a[i],(e)=>{
				if(b[e]>1||(b[e]==1&&a[i]!=e)){
					bo=false;
				}
			});
			if(bo){
				ans++;
				c[a[i]]|=2;
			}
			else{
				c[a[i]]|=4;
			}
		}
		Console.WriteLine("{0}",ans);
	}
	static void Pn(int n,Action<int> f){
		var q=Sqrt(n);
		for(int i = 1;i<q;i++) {if(n%i==0){f(i);f(n/i);}}
		if(n%q==0){f((int)q);}
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 58096
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Printer{
    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T>
    void print(T x, T y){
        cout << x << "," << y << endl;
    }

    template<class T>
    void print(vector<T> v){
        rep(i, v.size()){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class T>
    void print(vector<vector<T> > vv){
        rep(i, vv.size()){
            rep(j, vv[i].size()){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void print(pair<int, int> p){
        cout << "(" << p.first << ", " << p.second << ")" << endl;
    }
};
using namespace Printer;

//--global--//

ll vv[10][10];
ll a[200][200];
ll c[10][10];

//----------//

ll calc(ll s, ll v){
    if(s >> 1 & 1) return 0;
    ll res = INTINF;
    rep(i, 10){
        if(s >> i & 1 || i == v) continue;
        res = min(res, calc(s | 1 << i, i) + c[v][i]);
    }

    return res;
}

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    ll h, w; cin >> h >> w;
    rep(i, 10) rep(j, 10) cin >> c[i][j];
    rep(i, h) rep(j, w) cin >> a[i][j];

    vector<ll> bestc(10);
    rep(i, 10){ 
        bestc[i] = calc(1 << i, i);
    }
    ll res = 0;
    rep(i, h){
        rep(j, w){
            if(a[i][j] != -1) res += bestc[a[i][j]];
        }
    }
    
    cout << res << endl;
    
    return 0;
}


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

bool solve() {
    int N;
    string S;
    cin >> N >> S;
    if(N&1) return false;
    for(int i = 0; i < N / 2; ++i) {
        if(S[i] != S[i + N / 2]) return false;
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << (solve() ? "Yes" : "No") << '\n';
    return 0;
}


Measured memory_bytes: 256
N = gets.to_i
MOD = 10 ** 9 + 7

wk = N/3
DP = Array.new(N+1).map{Array.new(wk+1, 0)}
(3..N).each{|i| DP[i][1] = 1}

(2..wk).each{|d|
  s = 0
  (3*d..N).each{|n|
    s += DP[n-3][d-1]
    DP[n][d] = s % MOD
  }
}

puts DP[N].inject(:+) % MOD


Measured memory_bytes: 24584
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  string s,t;
  cin>>s>>t;
  vector<vector<int>> dp(s.size()+1,vector<int>(t.size()+1));
  rep(i,s.size()+1) dp[i][0]=0;
  rep(i,t.size()+1) dp[0][i]=0;
  repeat(i,1,s.size()+1) {
    repeat(j,1,t.size()+1) {
      dp[i][j]=max(dp[i-1][j-1]+(s[i-1]==t[j-1]),max(dp[i-1][j],dp[i][j-1]));
    }
  }
  //cout << dp[s.size()][t.size()] << endl;
  stringstream ss;
  int i=s.size();
  int j=t.size();
  while(i!=0&&j!=0) {
    if(s[i-1]==t[j-1]&&dp[i-1][j-1]+(s[i-1]==t[j-1])==dp[i][j]) {
      ss<<s[i-1];
      i--;
      j--;
      continue;
    }
    if(dp[i-1][j]==dp[i][j]) {
      i--;
      continue;
    }
    if(dp[i][j-1]==dp[i][j]) {
      j--;
      continue;
    }
  }
  string ans=ss.str();
  reverse(ans.begin(),ans.end());
  cout << ans<< endl;
  return 0;
}


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

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")

typedef long long ll;
typedef long double ld;

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define fast() {ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
#define eb emplace_back
#define pb push_back
#define deb(a) cerr << #a << " = " << a << '\n';

ll n, m, q, a[50], b[50], c[50], d[50], ans = 0;
vector<ll> t;

void rec(ll idx) {
    if(idx == n) {
        ll sum = 0;
        for(int i = 0; i < q; i++)
            if(t[b[i]-1] - t[a[i]-1] == c[i])
                sum += d[i];
        ans = max(ans, sum);
        return;
    }
    for(int i = t[(idx ? idx - 1 : 0)]; i <= m; i++) {
        t[idx] = i;
        rec(idx + 1);
    }
}

int main()
{
    fast();
    cin >> n >> m >> q;
    t = vector<ll> (n, 1);
    for(int i = 0; i < q; i++)
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    rec(0);
    cout << ans;
    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
	// your code goes here
	ll n;
	cin>>n;
	ll arr[100000];
	map<ll,ll>mp;
	ll sum=0;
	for(ll i=0;i<n;i++)
	{
	cin>>arr[i];
	mp[arr[i]]++;
	}
	for(auto i: mp)
	sum+=i.first*i.second;
	
	ll q;
	cin>>q;
	while(q--)
	{
		ll a,b;
		cin>>a>>b;
		mp[b]+=mp[a];
		sum+=(b-a)*mp[a];
		mp[a]=0;
		cout<<sum<<"\n";
		
	}
	return 0;
}


Measured memory_bytes: 10200