akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define EPS (1e-7)
#define INF (99999999999L)
#define PI (acos(-1))

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

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(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; }

using ll = long long;

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

int main() {
  int h, w; cin >> h >> w;
  vector<string> s(h); REP(i,h) cin >> s[i];
  if (h == 1 && w == 1) {cout << "Yes" << endl; return 0;}
  REP(i,h) REP(j,w) {
    if (s[i][j] == '.') continue;
    bool f = false;
    REP(k,4) {
      int x = i+dx[k], y = j+dy[k];
      if (0 <= x&& x <h && 0 <= y && y < w) {
        if (s[x][y] == '#') f = true;
      }
    }
    if (!f) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define pb push_back
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;



int main(){
    int n,a,b,c,d;
    string str;
    cin>>n>>a>>b>>c>>d;
    cin>>str;

    reps(i,a-1,c-1){
        if(str[i]=='#' && str[i+1]=='#'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    reps(i,b-1,d-1){
        if(str[i]=='#' && str[i+1]=='#'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(d<c){  
        reps(i,b-2,d-1){
            if(str[i]=='.' && str[i+1]=='.' && str[i+2]=='.'){
                cout<<"Yes"<<endl;
                return 0;
            }
        }   
        cout<<"No"<<endl;
        return 0;         
    }
    else{
        cout<<"Yes"<<endl;
        return 0;
    }
}

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

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int n, e=0; double p, sum=0; cin >> n; vector<int> x(n);
    for(int i=0;i<n;i++) cin >> x[i];
    for(int i=0;i<n;i++) sum += x[i];
    p = nearbyint(sum/n);
    for(int i=0;i<n;i++) e += pow(abs(x[i]-p), 2);
    cout << e << endl;
    return 0;
}



Measured memory_bytes: 3716
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

//Code Short
#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define DSORT(n) sort(n.begin(),n.end())
#define QECHO(n) cout << n
#define QECHOS(n) cout << n << " "

//Define Math
const double EPS = 1e-10;
const double PI  = acos(-1.0);

using namespace std;
typedef long long ll;
/* prototype */
int EDSum(ll);//各桁の和
vector<int> SOE(int,int);//素数 (Min,Max)
int MinCM(int,int);//最小公倍数(num1,num2)
int MaxCD(int,int);//最大公約数(num1,num2)
vector<int> igets(int);//cin * N
ll nPr(ll,ll); //(n,r)
ll nE(ll); //(n)
ll nCr(ll,ll); //(n,r)

void solve(){
    //START
    int n;cin >>n;int ans=0;bool p=false,w=false,g=false,y=false;
    REP(i,n){
      char c;
      cin >> c;
      
      if(c=='P' && p==false){ans++;p=true;}
      if(c=='W' && w==false){ans++;w=true;}
      if(c=='G' && g==false){ans++;g=true;}
      if(c=='Y' && y==false){ans++;y=true;}
    }
    if(ans==3)cout << "Three" <<endl; else cout << "Four" <<endl;
}


int main(void){cin.tie(0);ios::sync_with_stdio(false);solve();}
int EDSum(ll number) {
  int ans = 0;
  while (1) {
    ans += number % 10;
    number /= 10;
    if (number == 0) break;
  }
  return ans;
}

vector < int > SOE(int min, int max) {
  if (min < 2) min = 2;
  vector < int > int_array;
  for (int i = min; i <= max; i++) int_array.push_back(i);
  vector < int > sosu;
  double stop = sqrt(max);
  while (true) {
    sosu.push_back(int_array.front());
    int_array.erase(int_array.begin());
    if (stop < (double)(sosu.back())) break;
    for (int i = 0; i < (int) int_array.size(); i++) {
      if (int_array[i] % sosu.back() == 0)
        int_array.erase(int_array.begin() + i);
    }
  }
  sosu.insert(sosu.end(), int_array.begin(), int_array.end());
  return sosu;
}

int MinCM(int a, int b) {
  int c = a * b;
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return c / b;
}

int MaxCD(int a, int b) {
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
vector < int > igets(int N) {
  vector < int > A;
  int temp;
  for (int i = 0; i < N; ++i) {
    cin >> temp;
    A.push_back(temp);
  }
  return A;
}

ll nPr(ll n, ll r) {
  ll ans = 1;
  r = n - r;
  while (n != r) {
    ans *= n;
    --n;
  }
  return ans;
}

ll nE(ll n) {
  return nPr(n, n);
}

ll nCr(ll n, ll r) {
  if (r == 0) return -1;
  else {
    if (0 != n - r && n - r < r) r = n - r;
    return nPr(n, r) / nE(r);
  }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
const int INF = 100000;

int DP[50][500][500];
int A[50];
int B[50];
int C[50];
int main(){
    int N, Ma, Mb;
    cin >> N >> Ma >> Mb;
    REP(i,N){
        int a,b,c;
        cin >> a >> b >> c;
        A[i] = a;
        B[i] = b;
        C[i] = c;
    }


    for(int i = 0; i < N; i++){
        for(int j = 0; j < 500; j++){
            fill(DP[i][j], DP[i][j]+500, INF);
        }
    }

    for(int i = 0; i < N; i++){
        DP[i][0][0] = 0;
    }

    DP[0][A[0]][B[0]] = C[0];
    for(int i = 1; i < N; i++){
        int a = A[i];
        int b = B[i];
        int c = C[i];
        for(int j = 0; j < 500; j++){
            for(int k = 0; k < 500; k++){
                if(DP[i-1][j][k] != INF)
                    DP[i][j][k] = DP[i-1][j][k];
                if(j-a >= 0 && k-b >= 0 && DP[i][j-a][k-b] != INF)
                    DP[i][j][k] = min(DP[i-1][j-a][k-b] + c, DP[i][j][k]);
            }
        }
    }


    int ans = INF;
    int i = 1;
    while(1){
        int ma = Ma*i;
        int mb = Mb*i;
        if(ma >= 500 || mb >= 500) break;
        int dp = DP[N-1][ma][mb];
        //printf("%d, %d = %d\n", ma, mb, dp);
        ans = min(ans, dp);
        i++;
    }

    if(ans == INF) ans = -1;
    cout << ans << endl;
    return 0;
}


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

using ll = long long;

template <typename T>
class node {
public:
	T val;
	node<T> *l, *r;
	node(T val_) : val(val_), l(nullptr), r(nullptr) {}
	~node() {
		if (l) delete l;
		if (r) delete r;
	}
};

template <typename T>
class DynamicSegmentTree {
private:
	const ll n;
	const T id;
	function<T(T, T)> merge;
	node<T> *root;
private:
	T value(node<T> *t) {
		return t ? t->val : id;
	}
	T sub(ll l, ll r, node<T>* n, ll lb, ll ub) {
		if (n == nullptr || ub <= l || r <= lb) return id;
		if (l <= lb && ub <= r) return n->val;
		ll c = (lb + ub) / 2;
		return merge(sub(l, r, n->l, lb, c), sub(l, r, n->r, c, ub));
	}
	node<T> *suc(ll p, node<T>* t, ll lb, ll ub, T val) {
		if (t == nullptr) t = new node<T>(id);
		if (lb + 1 == ub) {
			t->val = val;
			return t;
		}
		ll c = (lb + ub) / 2;
		if (p < c) {
			t->l = suc(p, t->l, lb, c, val);
		}
		else {
			t->r = suc(p, t->r, c, ub, val);
		}
		t->val = merge(value(t->l), value(t->r));
		return t;
	}
public:
	DynamicSegmentTree(ll n_, T id_, function<T(T, T)> merge_) :
		n(1 << (int)ceil(log2(n_))), id(id_), merge(merge_), root(nullptr) {}
	~DynamicSegmentTree() { if (root) delete root; }
	void update(ll p, T val) {
		root = suc(p, root, 0, n, val);
	}
	T find(ll l, ll r) {
		return sub(l, r + 1, root, 0, n);
	}
};

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, q, com, x, y;
	cin >> n >> q;
	DynamicSegmentTree<int> st(n, INT_MAX, [](int l, int r) { return min(l, r); });
	while (q--) {
		cin >> com >> x >> y;
		if (com) {
			printf("%d\n", st.find(x, y));
		}
		else {
			st.update(x, y);
		}
	}
	return 0;
}

Measured memory_bytes: 7052
N,Q=map(int,input().split())
S=input()
l=[0]*Q
r=[0]*Q
T=[0]

for j in range(0,N-1):
  if S[j]+S[j+1]=="AC":
    T.append(T[-1]+1)
  else:
    T.append(T[-1])
T.append(T[-1])
#print(T)

for i in range(Q):
  l[i],r[i] = map(int,input().split())
  print( T[r[i]-1] - T[l[i]-1] )

Measured memory_bytes: 13996
#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
ll x;
ll cnt;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>x;
    ll r=100;
    while(r<x){
    	r*=1.01;
    	cnt++;
	}
	cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3652
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <climits>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()


struct Edge {
    int to, cost, nm;
    Edge(int to, int cost, int nm): to(to), cost(cost), nm(nm) {}
};

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<Edge>> AdjList;
AdjList graph;
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
const int INF = 100000000;

ll GCD(ll a, ll b){
    if(a < b) swap(a, b);
    if(b == 0) return a;
    return GCD(b, a%b);
}

bool cmp(const pii& a, const pii& b){
    if(a.first == b.first){
        return a.second < b.second;
    }
    return a.first < b.first;
}

double dp[3010][3010];
int main() {
    cout << fixed << setprecision(15);

    int N; cin >> N;

    dp[0][0]=1.0;
    for(int i=0; i<N; ++i){
        double p; cin >> p;
        for(int j=0; j<N; ++j){
            dp[i+1][j] += dp[i][j]*(1-p);
            dp[i+1][j+1] += dp[i][j]*p;
        }
    }
    double ans=0.0;
    for(int i=N/2+1; i<=N; ++i){
         ans += dp[N][i];
    }
    cout << ans << endl;
    return 0;
}

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

int allocate(int n, int w[], int k, int p) {
	int load = 0;
	int cnt = 1;
	for (int i = 0; i < n; i++) {
		if (load + w[i] > p) {
			cnt ++;
			if (cnt > k) return -1;
			load = 0;
		}
		load += w[i];
	}
	return 0;
}

int main() {
	int n,k,w[100000], m;
	cin >> n >> k;
	m = (1<<30) * -1;
	for (int i = 0; i < n; i++) {
		cin >> w[i];
		m = max(m, w[i]);
	}

	int i = m;
	int j = 1 << 30;
	while (i <= j) {
		int guess = i + (j - i) / 2;
		if (allocate(n, w, k, guess) < 0) {
			i = guess + 1;
		} else {
			j = guess - 1;
		}
	}
	cout << i << endl;
	return 0;
}



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

using namespace std;

int main() {
    int a,b;
    cin>>a>>b;
    if(a>b){
        for(int i=0 ; i<a ; i++)
            cout<<b;
    }else{
        for(int i=0 ; i<b ; i++)
            cout<<a;
    }
}

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

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);
#define debug(x) cerr << #x << " = " << x << "\n" ;

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int n ;
vector < int > a ;

int main(){
  cin >> n  ;
  a.resize( n ) ;
  forn( int , i , 0 , n ){
    cin >> a[ i ] ;
  }

  for( int i = n - 2 ; i >= 0 ; i-- ){
    if(a[i] - a[i+1] > 1){
           puts("No") ;
     return 0;
   }

    else if(a[i] - a[i+1] == 1){
     --a[i];
    }
  }

  cout << "Yes\n" ;

  return 0 ;
}


Measured memory_bytes: 640
n, k = map(int, input().split())
a = list(map(lambda ai: int(ai) - 1, input().split()))

visited = [-1] * len(a)

now = 0
visited[0] = 0
while k > 0:
    k -= 1
    old = now
    now = a[now]
    if visited[now] != -1:
        p = visited[old] + 1 - visited[now]
        k %= p
        visited = [-1] * len(a)
    else:
        visited[now] = visited[old] + 1
print(now + 1)


Measured memory_bytes: 32380
import java.math.BigInteger;
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		while(0!=n--){
			BigInteger a = sc.nextBigInteger().add(sc.nextBigInteger());
			System.out.println(a.toString().length() > 80 ?"overflow":a);
		}
	}
}

Measured memory_bytes: 18460
//============================================================================
// Name        : hoba.cpp :)
// Author      : (O_O Diab) (Why_not) (el 3AQ)
// Version     :
// Copyright   : please, Don't touch me :(
// Description : problem in C++
// MAIN IDEA   :
//============================================================================
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define rw freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cerr<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace __gnu_pbds;
using namespace std;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int N = 500 + 5, mod = (int) 1e9 + 7, INF = 0x3f3f3f3f;
int main() {
#ifdef ONLINE_JUDGE
	   FAST;
#endif
	ll n1, n2;
	cin >> n1 >> n2;
	cout << (abs(n1 - n2) <= 1 ? "Brown" : "Alice");
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

    string s;
    cin >> s;

    vector<int> odd(2), even(2);
    REP(i, s.size()) {
        if (i % 2 == 0) {
            if (s[i] == '0')
                odd[0]++;
            else
                odd[1]++;
        } else {
            if (s[i] == '0')
                even[0]++;
            else
                even[1]++;
        }
    }

    int ans = 0;
    if (odd[0] > even[0]) {
        ans += odd[1] + even[0];
    } else
        ans += odd[0] + even[1];
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<sstream>
#include<string>
#include<utility>
#include<vector>

#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 fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000000000+7
using namespace std;
typedef long long ll;

int main(){
  ll N, M; cin >> N >> M;
  vector<pair<ll, ll>> ab(N);
  rep(i, 0, N){
    ll a, b;  cin >> a >> b;
    ab[i] = make_pair(a, b);
  }
  sort(all(ab));
  ll ans = 0;
  rep(i, 0, N){
    if(M-ab[i].second>=0){
      ans += ab[i].first*ab[i].second;
      M -= ab[i].second;
    }
    else{
      ans += ab[i].first*M;
      M -= M;
    }
    if(M==0)  break;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
#define pb(a) push_back(a)

using namespace std; 
const int maxx = 200005; 
vector<int> graph[maxx]; 

void dfs(int curr,int &cnt,int *vis,vector<int> &duringdfs){
    vis[curr]=1;
    ++cnt;
    duringdfs.push_back(curr);
    for(auto& child : graph[curr]){
        if(vis[child]==0){
            dfs(child,cnt,vis,duringdfs);
        }        
    }
}

int maximumvisit(int N){
    int fans=-1;
    int vis[maxx];
    memset(vis,0,sizeof vis);
    vector<int> duringdfs;
    
    int ans[maxx]; 
    memset(ans, 0, sizeof ans); 
    
    for(int i=1;i<=N;i++){
        duringdfs.clear();
        int cnt=0;
        if(vis[i]==0){
            cnt=0;
            dfs(i,cnt,vis,duringdfs);
        }
        fans=max(fans,cnt);
    }

    
    return fans;
}

int substring(string t, string s) {
    int n=t.size(),m=s.size(),i,j;
    int ans = INT_MAX; 
    for(i=0;i<m-n+1;i++){
        int minRemoved=0;
        for(j=0;j<n;j++){
            if(t[j]!=s[i+j]){
                minRemoved++;
            }
        }
        ans=min(ans,minRemoved);
    }
    return ans;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n,m,t=1;
	//cin>>t;
	int i,a,b;
	while(t--){
	  cin>>n>>m;
	  for(i=0;i<m;i++){
	      cin>>a>>b;
	      graph[a].push_back(b);
	      graph[b].push_back(a);
	  }
	  cout<<maximumvisit(n);
	}
	return 0;
}


Measured memory_bytes: 29072
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using ll = long long;
using namespace std;
#define rep(i,n) for(int (i)=0;i<(n);i++)

int main() {
	int n, k;
	cin >> n >> k;
	vector<int>d(k);
	vector<vector<int>> a(k,vector<int>(n));
	for (int i = 0; i < k;i++) {
		cin >> d.at(i);
		for (int j = 0; j < d.at(i);j++) {
			cin >> a.at(i).at(j);
			a.at(i).at(j)--;
		}
	}
	vector<int>count(n,0);
	for (int i = 0; i < k; i++) {
		for (int j = 0; j < d.at(i); j++) {
			count.at(a.at(i).at(j))++;
		}
	}
	int count2 = 0;
	for (int i = 0; i < n;i++) {
		if (count.at(i) == 0)count2++;
	}
	cout << count2 << endl;
	return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,m,i,j,k,l,p;
    cin>>n>>m>>k;
    l=0;
    for(i=n; i<=m; i++)
    {
        if(i%k==0)
        {
            l++;
        }
    }
    cout<<l<<endl;
}


Measured memory_bytes: 3564
function Main(input: string) {
  const params: string[][] =
    input.split('\n')
      .map(line => line.split(' '));
  const [n, m] = params[0].map(x => parseInt(x));
  const a: number[] = params[1].map(x => parseInt(x));

  const sum = a.reduce((x, y) => x + y);

  const b = a.filter(x => 4 * m * x >= sum);

  const msg = (b.length >= m) ? 'Yes' : 'No';

  console.log(msg)
}

const fs = require('fs');
const input = fs.readFileSync('/dev/stdin', 'utf8');
Main(input);


Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define N 5005
using namespace std;
int i,j,k,l,s,n,m,R[N],L[N],q[N],ans,G[N],r;
int a[N],b[N],test,qq[N],f[N];
char c[N];
inline bool cmp(int x,int y){return R[x]<R[y];}
int main() {
	scanf("%s",c+1);n=strlen(c+1);
	for (i=1;i<=n;i++)a[i]=c[i]-48,L[i]=R[i]=100000000;
	scanf("%s",c+1);
	for (i=1;i<=n;i++)b[i]=c[i]-48;
	for (i=1;i<=n;i++)for (j=1;j<=n;j++)if(b[j])L[i]=min(L[i],(i-j+n)%n),R[i]=min(R[i],(j-i+n)%n);
	int s1=0,s2=0;
	for (i=1;i<=n;i++)s1|=a[i],s2|=b[i];
	if (!s2) {
		if (!s1) puts("0");
		else puts("-1");
		return 0;
	}
	ans=100000000;
	for (i=1;i<=n;i++) {
		r=0;k=i;
		for (j=1;j<=n;j++) {
			if(a[k]!=b[j])q[++r]=k;
			k%=n;k++;
		}
		sort(q+1,q+1+r,cmp);
		G[r+1]=0;
		for (k=r;k;k--)G[k]=max(G[k+1],L[q[k]]);
		for (k=0;k<=r;k++){
			ans=min(ans,(R[q[k]]+max((i-j+n)%n,G[k+1]))*2-(i-j+n)%n+r);
			ans=min(ans,(G[k+1]+max((j-i+n)%n,R[q[k]]))*2-(j-i+n)%n+r);
		}
	}
	printf("%d\n",ans);
	
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;

public class Main {
	static List<Integer> path;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int r = Integer.parseInt(sa[0]);
		int g = Integer.parseInt(sa[1]);
		int b = Integer.parseInt(sa[2]);
		int n = Integer.parseInt(sa[3]);
		br.close();

		long ans = 0;
		int rr = n / r;
		int gg = n / g;
		for (int i = 0; i <= rr; i++) {
			int num = r * i;
			for (int j = 0; j <= gg; j++) {
				num += g * j;
				if (num > n) {
					break;
				}
				if ((n - num) % b == 0) {
					ans++;
				}
				num -= g * j;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23252
#include <cstdio>

int n,P,Pow[6001],_mul[6001],invmul[6001],powmul[2][6001];
inline int mul(const int &a,const int &b){return 1ll*a*b%P;}
inline int add(int a,const int &b){a+=b;return(a>=P)?a-P:a;}
inline int sub(int a,const int &b){a-=b;return (a<0)?a+P:a;}
int main(){
	scanf("%d%d",&n,&P);
	Pow[0]=1;
	for(int i=1;i<=3*n;i++)Pow[i]=mul(Pow[i-1],2);
	_mul[0]=_mul[1]=invmul[0]=invmul[1]=1;
	for(int i=2;i<=3*n;i++)_mul[i]=mul(_mul[i-1],i);
	for(int i=2;i<=3*n;i++)invmul[i]=mul(P-P/i,invmul[P%i]);
	for(int i=2;i<=3*n;i++)invmul[i]=mul(invmul[i-1],invmul[i]);
	for(int i=0;i<2;i++){
		powmul[i][0]=1;
		for(int j=1;j<=3*n;j++)powmul[i][j]=mul(powmul[i][j-1],invmul[i+2]);
	}
	int ans=0;
	for(int i=0;i<=3*n;i++)
		for(int j=i;j<=3*n;j++)
			if((n*3-2*i-j)%3==0&&2*i+j<=3*n){
				int v=(n*3-2*i-j)/3;
//				printf("%d %d %d\n",v,i,j);
				ans=add(ans,mul(Pow[v],mul(powmul[0][i],mul(powmul[1][v],mul(invmul[i],mul(invmul[j],invmul[v]))))));
			}
	printf("%d\n",mul(ans,_mul[3*n]));
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(AtCoder: str, s: str, Contest: str):
    ret = 'A' + s[0] + 'C'
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    AtCoder = next(tokens)  # type: str
    s = next(tokens)  # type: str
    Contest = next(tokens)  # type: str
    solve(AtCoder, s, Contest)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
/*************************************************************************
> File Name: test.cpp
> Author: Akira 
> Mail: qaq.febr2.qaq@gmail.com 
************************************************************************/

#include<bits/stdc++.h>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define Sqr(a) ((a)*(a))
#define ALL(a) a.begin(), a.end()
#define mp make_pair
#define pb push_back
using namespace std;

#define MaxN 100005
#define MaxM MaxN*10
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626
const int mod = 1E9+7;
const double eps = 1e-6;
#define bug cout<<88888888<<endl;
#define debug(x) cout << #x" = " << x << endl;
template<typename T> T abs(T val){return val>0?val:-val;}
inline int max2(int a, int b) {return ((a > b)? a : b);}
inline int min2(int a, int b) {return ((a < b)? a : b);}
inline int max3(int a, int b, int c) {return max2(a, max2(b, c));}
inline int min3(int a, int b, int c) {return min2(a, min2(b, c));}
template <class T> inline void read(T &ret) {char c; ret=0;while((c=getchar())<'0'||c>'9');while(c>='0'&&c<='9') ret=ret*10+(c-'0'),c=getchar();}
template <class T> inline void out(T x) {if(x>9) out(x/10);putchar(x%10+'0');}

int N;
struct Edge
{
    int u,v,next;LL w;
    Edge(int u=0, int v=0, LL w=0, int next=0):u(u),v(v),w(w),next(next){}
}edge[MaxM];
int head[MaxN],cont;
void add(int u, int v, LL w)
{
    edge[cont] = Edge(u,v,w,head[u]), head[u] = cont++;
    edge[cont] = Edge(v,u,w,head[v]), head[v] = cont++;
}
void init()
{
    cont = 0, MST(head,-1);
}
const int log2N = 25;
int dep[MaxN], fa[MaxN][30];
LL dis[MaxN];
bool vis[MaxN];
void dfs(const int &u, const int &d, LL w) {
    vis[u]=1; dep[u]=d; dis[u] = w;
    for(int i=head[u]; i!=-1; i=edge[i].next)
        if(!vis[edge[i].v]) { dfs(edge[i].v, d+1,w+edge[i].w); fa[edge[i].v][0]=u; }
}
inline void bz() { 
for(int j=1; j<log2N; ++j) 
    for(int i=1; i<=N; ++i) 
        fa[i][j]=fa[fa[i][j-1]][j-1]; 
}

inline int lca(int u, int v) {
    if(dep[u]<dep[v]) swap(u, v);
    int d=dep[u]-dep[v];
    for(int i=log2N-1; i>=0; --i) if((1<<i)&d) u=fa[u][i];
    if(u==v) return u;
    for(int i=log2N-1; i>=0; --i) if(fa[u][i]!=fa[v][i]) u=fa[u][i], v=fa[v][i];
    return fa[u][0];
}
int main()
{
    //std::ios::sync_with_stdio(false);
    int a,b,c,Q,k,x,y;
    read(N);
    init();
    for(int i=1;i<N;i++) 
    {
        read(a);read(b);read(c);
        add(a,b,c);
    }
    dfs(1, 1, 0); 
    bz();
    read(Q);read(k);
    while(Q--)
    {
        read(x);read(y);
        int xkf = lca(x,k);
        int ykf = lca(y,k);
        LL ans = abs(2*dis[xkf]-dis[x]-dis[k]) + abs(2*dis[ykf]-dis[y]-dis[k]);
        printf("%lld\n", ans);
    }
    // system("pause");
}


Measured memory_bytes: 44928
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
struct edge { ll s, t, x; };
typedef pair<int, int> P;
typedef pair<ll,P> event;
const ll MAX = 510000;
const ll MOD = 1000000007;
#define INF (ll)1000000000000

int main() {
  int N;
  cin>>N;
  vector<ll>A(N);
  rep(i,N){cin>>A[i];}
  ll ans=0ll;
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  priority_queue<ll>pq;
  ans+=A[0];
  pq.push(A[1]);
  pq.push(A[1]);
  rep(i,N-2){
    ll g=pq.top();
    pq.pop();
    ans+=g;
    pq.push(A[i+2]);
    pq.push(A[i+2]);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 6928
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const ll INFS=1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};

int main(){
  int x,n;
  cin>>x>>n;
  vector<int> a(n);
  rep(i,n) cin>>a[i];
  for(int i=0;;i++){
    bool ja=true;
    bool ja2=true;
    rep(j,n){
      if(x+i==a[j]){
        ja=false;
      }
      if(x-i==a[j]){
        ja2=false;
      }
    }
    if(ja2){
      cout<<x-i<<endl;
      return 0;
    }
    if(ja){
      cout<<x+i<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
	int out=0;
	double cx1,cy1,r1;
	double cx2,cy2,r2;

	cin>>cx1>>cy1>>r1;
	cin>>cx2>>cy2>>r2;

	double d=sqrt((cx1-cx2)*(cx1-cx2)+(cy1-cy2)*(cy1-cy2));

	if( d > r1+r2 ) out = 4;
	else if( abs(d-r1-r2) < 1e-10 ) out = 3;
	else if( d>abs(r1-r2)+1e-10 ) out = 2;
	else if( abs(d-abs(r1-r2)) < 1e-10 ) out = 1;

	cout<< out <<endl;
}


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

using namespace std;

int solve(string s)
{
    const int n = s.length();
    int l = 0, r = n - 1;

    int cost = 0;
    while (l < r) {

        if (s[l] == s[r]) {
            l++;
            r--;
            continue;
        }

        cost++;
        if (s[l] == 'x') {
            l++;
            continue;
        }

        if (s[r] == 'x') {
            r--;
            continue;
        }
        return -1;
    }
    return cost;
}

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

    cout << solve(s) << "\n";
    return 0;
}


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

int main(){
  int n;cin>>n;
  vector<int> vec(n);
  rep(i,n){
    int a,b;cin>>a>>b;
    if(a==b)vec[i]=1;
  }
  bool ok=false;
  rep(i,n){
    int cnt=0;
    rep(j,n){
      if(vec[j]==1&&vec[i+1]==1)cnt++;
    else cnt=0;
    if(cnt>=3)ok=true;
    }
  }
  if(ok)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

const int N = 1e5 + 5;

int a[N], n;

int main(void) {
	scanf("%d", &n);
	
	long long ans = 0;
	for (int i = 1; i <= n; ++ i) {
		scanf("%d", &a[i]);
	}
	for (int i = 1; i <= n; ++ i) {
		ans += a[i]/2;
		a[i] %= 2;
		if (a[i] == 0 || i == n) continue;
		if (a[i + 1] > 0) {
			-- a[i + 1];
			-- a[i];
			++ ans;
		}
	}
	printf("%lld\n", ans);
	return 0;
} 

Measured memory_bytes: 640
INF = 10**9

N, K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()] + [0]*100

dp = [INF] * 100200
dp[0] = 0

for i in range(N):
    for j in range(1, K+1):
        dp[i+j] = min(dp[i+j], dp[i]+abs(h[i+j]-h[i]))

print(dp[N-1])

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

int main(){
  int a, b;
  cin >> a >> b;
  int ans;
  ans = (b+a-1-1-1) / (a-1);
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		final int X = sc.nextInt();
		int[] x = new int[N+1];
		x[0] = X;
		for (int i = 1; i <=N; i++) {
			x[i] = sc.nextInt();
		}
		// 最大公約数を求める
		Arrays.sort(x);
		int[] y = new int[N];
		for (int i = 0; i < N; i++) {
			y[i] = x[i+1] - x[i];
		}
		int d = y[0];
		if (y.length != 1) {
			for (int i = 1; i < y.length; i++) {
				d = gcd(d, y[i]);
			}
		}
		System.out.println(d);
	}
	private static int gcd(int m, int n) {
	    if(m < n) return gcd(n, m);
	    if(n == 0) return m;
	    return gcd(n, m % n);
	}
}

Measured memory_bytes: 48512
///بِسْمِ الّٰلهِ الرَّحْمٰنِ الرَحِيْمِ
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi acos(-1.0)
int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
      int i,n,t,p=INT_MAX,j=0,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d;
     string s,st;
     cin>>n>>m;
     int ara[n];
     double pr,sl=0;
     for(i=0;i<n;i++){
        cin>>ara[i];
        sl+=ara[i];
     }
     pr=m*4;
     sort(ara,ara+n,greater<int>());
     double xy; xy=double(sl/pr);
     

     for(i=0;i<m;i++){
       if(xy>ara[i]){
           r=1;
           break;
       }
     }
     if(r==1){
        cout<<"No"<<endl;
     }
     else{
        cout<<"Yes"<<endl;
     }

     return EXIT_SUCCESS;
}



Measured memory_bytes: 256
using namespace std;

#include <iostream>
#include <bits/stdc++.h>

int main(){
    int N;
    cin >> N;
    char a[ N + 7 ];
    for ( int i = 0; i < N; i ++ ){
        cin >> a[ i ];
    }
    bool russkievpered = true;
    if ( N % 2 > 0 ) russkievpered = false;
    else{
        for ( int i = 0; i < N / 2; i ++ ){
            if ( a[ i ] != a[ i + ( N / 2 ) ] ) russkievpered = false;
        }
    }
    if ( russkievpered ) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  int K;
  cin >> K;

  vector<int> v={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << v[K-1] << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define lowbit(x) (x&-x)
using namespace std;
const int N = 1e4+7, M = 1e2+7, p = 1e9+7;
char s[N];
int f[N][M][2];
int main()
{
	int n, d, sum = 0, ans;
	scanf("%s%d", s+1, &d);
	f[0][0][0] = 1;
	n = strlen(s+1);
	for(int i = 1; s[i] != '\0'; i++)
	{
		for(int j = 0; j < d; j++)
		{
			for(int k = 0; k <= 9; k++)
			{
				f[i][(j+k)%d][1] = (f[i][(j+k)%d][1]+f[i-1][j][1])%p;
			}
		}
		for(int j = 0; j < s[i]-'0'; j++)
		{
			f[i][(sum+j)%d][1] = (f[i][(sum+j)%d][1]+f[i-1][sum][0])%p;
		}
		f[i][(sum+s[i]-'0')%d][0] = (f[i][(sum+s[i]-'0')][0]+f[i-1][sum][0])%p;
		sum = (sum+s[i]-'0')%d;
	}
	ans = (f[n][0][0]+f[n][0][1]-1)%p;
	printf("%d\n", (ans+p)%p);
	return 0;
}

Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

void check(vector<bool> &prime,int n){
  for(int i=2;i<=n;i++){
    if(prime.at(i)){
      for(int j=2;i*j<=n;j++){
        prime.at(i*j) = false;
      }
    }
  }
}

int main(){
  int n;
  cin >> n;
  vector<bool> prime(n+1,true);
  prime.at(0) = false;
  prime.at(1) = false;
  check(prime,n);
  vector<int> cnt(n+1,0);
  for(int i=2;i<=n;i++){
    int tmp = i;
    for(int j=2;j<=n;j++){
      if(!prime.at(j)) continue;
      while(tmp % j == 0){
        tmp /= j;
        cnt.at(j)++;
      }
      if(tmp == 1) break;
    }
  }
  vector<int> lis;
  rep(i,cnt.size()){
    if(cnt.at(i) != 0) lis.push_back(cnt.at(i));
  }
  sort(lis.begin(),lis.end());
  int m = lis.size();
  int ans = 0;
  //rep(i,cnt.size()) cout << cnt.at(i) << " ";
  //cout << endl;
  //rep(i,lis.size()) cout << lis.at(i) << " ";
  //cout << endl;
  rep(i,m){
    if(lis.at(i) >= 74) ans++;
    for(int j=0;j<m;j++){
      if(i == j) continue;
      if(lis.at(i) >= 2 && lis.at(j) >= 24) ans++;
      if(lis.at(i) >= 4 && lis.at(j) >= 14) ans++;
      for(int k=0;k<m;k++){
        if(j >= k || i == k) continue;
        if(lis.at(i) >= 2 && lis.at(j) >= 4 && lis.at(k) >= 4) ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int  n, k, ans = 0; 
    cin >> n >> k ;
    for (int b=1;b<=n;b++ ) {
        ans += n/b*max(0LL,b-k); 
        ans += max(0LL,(n%b)-k+1);
      	if (k == 0) ans-- ; 
    } 
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


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

#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )
template <typename Arg1>
void __f( const char* name , Arg1&& arg1 ) {
        cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f( const char* na , Arg1&& arg1 , Args&&... args ) {
        const char* c = strchr( na + 1 , ',' );
        cerr.write( na , c - na ) << " : " << arg1 << " , ";
        __f( c + 1 , args... );
}
#define endl "\n"
#define all(V) V.begin(),V.end()
#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long int LL;
typedef pair <int,int> pii;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const long long INF = 1e18;
const int N = 1e5 + 5;

int n , a[ N ];

int main( ) {
        IO;
        #ifdef LOCAL
            //freopen( "input.txt" , "r" , stdin );
        #endif // LOCAL
        cin >> n;
        for( int i = 1; i <= n; i++ ) cin >> a[i];
        int cnt = 0;
        for( int i = 1; i <= n; i++ ) if( i != a[i] ) cnt++;
        if( cnt == 0 || cnt == 2 ) cout << "YES" << endl;
        else cout << "NO" << endl;
        return 0;
}









Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long s1=0,s=0,n,i,j,x,y,m=1000000007,ans=0;
   cin>>n;
   long long a[n+3];
   
   for(i=0;i<n;i++) 
   {
    cin>>a[i];
    s+=a[i];
   }
   for(i=0;i<n;i++)
   {
    s1+=a[i];
    x=s-s1;
    y=((a[i]%m)*(x%m))%m;
    ans=((ans%m)+(y%m))%m;
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 5148
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

int main() {
	int N, M;
	cin >> N >> M;
	vector<pair<int,int> > p(M);
	for(int i=0; i<M; i++) cin >> p[i].second >> p[i].first;
	sort(p.begin(), p.end());

	int mark=-1, ans=0;
	for (int i = 0; i < M; i++) {
		if (mark == -1) {
			mark = p[i].first;
			ans++;
		}
		else {
			if (p[i].second < mark && mark <= p[i].first) {
			}
			else {
				mark=p[i].first;
				ans++;
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 1152
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	int K = sc.nextInt();
      	int count = 1;
      	while(N >= K){
        	N = N / K;
          	count++;
        }
      	System.out.println(count);
    }
}

Measured memory_bytes: 35632
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i < (n); i++)
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

using namespace std;

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = 1e-9;

namespace std {
  bool operator<(const P a, const P b) {
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
}



D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  return (conj(a)*b).Y;
}

int ccw(P a, P b, P c) {
  b -= a;  c -= a;
  if (cross(b,c) >  EPS) return +1;  // counter clockwise
  if (cross(b,c) < -EPS) return -1;  // clockwise
  if (dot(b,c)   < -EPS) return +2;  // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line or a==b
  return 0;                          // a--c--b on line or a==c or b==c
}

bool isecSS(P a1, P a2, P b1, P b2) {
  return ccw(a1, a2, b1)*ccw(a1, a2, b2) <= 0 &&
         ccw(b1, b2, a1)*ccw(b1, b2, a2) <= 0;
}

P crosspointLL(P a1, P a2, P b1, P b2) {
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  return a1 + d1/d2 * (a2-a1);
}

int main() {
	
	int N;
	cin >> N;
	double xa, ya, xb, yb, xs, ys, xt, yt;
	int n, l, o;
	rep(n2, N) {
		cin >> xa >> ya >> xb >> yb;
		cin >> n;
		vector<pair<double, int>> closspoint;
		P newLines = P(xa, ya);
		P newLinet = P(xb, yb);
		int cnt = 0;
		rep(i, n) {
			cin >> xs >> ys >> xt >> yt >> o >> l;
			if(o) l = 1 - l;
			if(isecSS(newLines, newLinet, P(xs, ys), P(xt, yt))) {
				P cp = crosspointLL(newLines, newLinet, P(xs, ys), P(xt, yt));
				D d = abs(cp - newLines);
				closspoint.push_back(make_pair(d, l));
			}
		}
		sort(closspoint.begin(), closspoint.end());
		for(int i = 1; i < closspoint.size(); i++) {
			if (closspoint[i].second != closspoint[i - 1].second) cnt++ ;
		}
		cout << cnt << endl;
	}
}
					
		
	





Measured memory_bytes: 3240
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9+7;
pair<ll,ll>s4[4]={{-1,0},{1,0},{0,-1},{0,1}};
pair<ll,ll>s8[8]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,1},{1,0},{1,-1}};

void solve() {
    ll s,w;
    cin >> s >> w;
    if(s>w) {
        cout << "safe"<<nl;
    }
    else{
        cout << "unsafe"<<nl;
    }
}

signed main() {
    boost;
    solve();
}

Measured memory_bytes: 3640
N = int(input().strip())
T = [int(input().strip()) for _ in range(N)]

def gcd(a,b):
  if a < b: a,b = b,a
  return b if a % b == 0 else gcd(b, a%b)

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

if len(T) == 1:
  print(T[0])
elif len(T) == 2:
  print(lcm(*T))
else:
  ans = lcm(T[0], T[1])
  for i in range(2, N):
    ans = lcm(ans, T[i])
  print(ans)



Measured memory_bytes: 3064
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons;

alias Pair = Tuple!(int, int);

Pair[10^^5] MS;

void main()
{
    auto nm = readln.split.to!(int[]);
    auto N = nm[0];
    auto M = nm[1];

    foreach (i; 0..M) {
        auto ab = readln.split.to!(int[]);
        MS[i] = Pair(ab[0]-1, ab[1]-1);
    }

    sort(MS[0..M]);

    int cnt, j, near = int.max;
    foreach (i; 0..N) {
        if (i == near) {
            ++cnt;
            near = int.max;
        }
        while (j < M && MS[j][0] == i) {
            near = min(near, MS[j][1]);
            ++j;
        }
    }
    writeln(cnt);
}

Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define PI       3.1415926535897932384626433832795028841971
#define INF      100000000
#define EPS      1e-10
#define MOD      1000000007
using namespace std;
typedef long long ll;

int n;
ll dp[222][222];

int main(){
    cin >> n;
    dp[0][0] = 1;
    rep(i,n){
        char x;
        cin >> x;
        if(x == '-'){
            for(int j = 0; j <= n; j++){
                dp[i+1][j] = dp[i][j];
            }
            continue;
        }
        if(x == 'U'){
            for(int j = 0; j <= n; j++){
                dp[i+1][j+1] = (dp[i+1][j+1]+dp[i][j])%MOD;
                dp[i+1][j] = (dp[i+1][j]+dp[i][j]*j)%MOD;
            }
        } else{
            for(int j = 0; j <= n; j++){
                dp[i+1][j-1] = (dp[i+1][j-1]+dp[i][j]*j*j)%MOD;
                dp[i+1][j] = (dp[i+1][j]+dp[i][j]*j)%MOD;
            }
        }
    }
    cout << dp[n][0] << endl;
}

Measured memory_bytes: 3404
/*
Author:		CraZYali
LANG: 		C++
FileName:	.cpp

CopyRIGHT!!!
*/

#define REP(i, s, e) for(register int i = s; i <= e ;i++)

#include <bits/stdc++.h>

using namespace std;
map<int, bool> m;
int n, k, ans;

int main() {
	cin >> n;
	while (n--) {
		scanf("%d", &k);
		if (m[k]) {
			m[k] = 0;
			ans--;
		}
		else {
			m[k] = 1;
			ans++;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 4864
h,w = map(int, input().split())
index1=0
listForList = []
while index1<h:
    list1 = list(input())
    if "#" in list1:
        listForList.append(list1)
    index1+=1

listForIndex=[]
index2 =0
while index2<w:
    index3=0
    flag =0
    while index3<len(listForList):
        if listForList[index3][index2]=="#":
            flag=1
        index3+=1
    if flag==0:
        listForIndex.append(index2)
    index2+=1

if len(listForIndex)>0:
    for index4 in listForIndex:
        index5=0
        while index5<len(listForList):
            listForList[index5][index4] = ""
            index5+=1

for list2 in listForList:
    print("".join(list2))

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

typedef long long ll;

int main(){
	int N,K;
	cin >> N >> K;
	std::vector<int> h(N);
	int count = 0;

	for (int i = 0; i < N; i++)
	{
		cin >> h[i];
		if (h[i] >= K)
		{
			count ++;
		}
	}
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 640