akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x, long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }
        public static long keta(long x)
        {
            var z = 1;
            while (x > 0)
            {
                x /= 10;
                z++;
            }
            return z;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var abn = Reads();
            var a = abn[0];
            var b = abn[1];
            var n = abn[2];
            long x = 0;
            if (n >= b) x = b - 1;
            else x = n;
           
            WriteLine(Math.Floor((decimal)a * x / b) - a*Math.Floor((decimal)x / b));
            

            Console.Out.Flush();
        }
    }
}



Measured memory_bytes: 19028
using System;
class A_TorT{
	static void Main(string[] args){
		string[] NAB = Console.ReadLine().Split(' ');
		int N = int.Parse(NAB[0]);
		int A = int.Parse(NAB[1]);
		int B = int.Parse(NAB[2]);
		Console.WriteLine(Math.Min(N * A , B));
	}
}

Measured memory_bytes: 13140
using System;

public class Hello{
    public static void Main(){
        string[] str = Console.ReadLine().Split(' ');
       int a = int.Parse(str[0]);
       int b = int.Parse(str[1]);
       
        if(a<b){
           Console.WriteLine("a < b");
        }   
        if(a>b){
           Console.WriteLine("a > b");
        }
        if(a==b){
           Console.WriteLine("a == b");
       }
    }
}　


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

int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  for (int i = sy; i < ty; i++) {
    cout << 'U';
  }
  for (int i = sx; i < tx; i++) {
    cout << 'R';
  }
  for (int i = ty; i > sy; i--) {
    cout << 'D';
  }
  for (int i = tx; i > sx; i--) {
    cout << 'L';
  }

  cout << 'L';
  for (int i = sy; i < ty + 1; i++) {
    cout << 'U';
  }
  for (int i = sx - 1; i < tx; i++) {
    cout << 'R';
  }
  cout << 'D';
  cout << 'R';
  for (int i = ty; i > sy - 1; i--) {
    cout << 'D';
  }
  for (int i = tx + 1; i > sx; i--) {
    cout << 'L';
  }
  cout << 'U';
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
abcd = input()

a = abcd[0]
b = abcd[1]
c = abcd[2]
d = abcd[3]

for i in range(2**(4-1)):
    f = "{a}".format(a=a)
    if i>>0 & 1 == 1:
        f += "+{b}".format(b=b)
    else:
        f += "-{b}".format(b=b)
    
    if i>>1 & 1 == 1:
        f += "+{c}".format(c=c)
    else:
        f += "-{c}".format(c=c)

    if i>>2 & 1 == 1:
        f += "+{d}".format(d=d)
    else:
        f += "-{d}".format(d=d)

    result = eval(f)
    if result == 7:
        print(f + "=7")
        break


Measured memory_bytes: 3064
#include <cstdint>
#include <functional>
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main() {
  int64_t N;
  cin >> N;
  
  map<int64_t, int64_t> count_map;
  vector<int64_t> nums(N);
  for (size_t n = 0; n < N; ++n) {
    int64_t A;
    cin >> A;
    ++count_map[A];
    nums[n] = A;
  }
  int64_t sum = 0;
  map<int64_t, int64_t> diff_map;
  for (auto p : count_map) {
    sum += (p.second * (p.second - 1) / 2);
    diff_map[p.first] = 
      (p.second * (p.second - 1) / 2) - ((p.second - 1) * (p.second - 2) / 2);
  }
  for (int64_t n : nums) {
    cout << (sum - diff_map[n]) << endl;
  }
  
  return 0;
}


Measured memory_bytes: 18944
#include <stdio.h>
int main(int argc, const char * argv[]) {
    int cards[4][13]={0},n,rank,i,j,a;
    char mark;
    
    scanf("%d",&n);
    while(n>0){
        scanf(" %c %d",&mark,&rank);
        if(mark=='S'){
            a=0;
        }
        else if(mark=='H'){
            a=1;
        }
        else if(mark=='C'){
            a=2;
        }
        else{
            a=3;
        }
        cards[a][rank-1]=1;
        n--;
    }
    for(i=0;i<4;i++){
        for(j=0;j<13;j++){
            if(cards[i][j]==0){
                if(i==0){
                    mark='S';
                }
                else if(i==1){
                    mark='H';
                }
                else if(i==2){
                    mark='C';
                }
                else{
                    mark='D';
                }
                printf("%c %d\n",mark,j+1);
            }
        }
    }
    return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> x(N);
  rep(i, N) cin >> x[i];

  int ans = 0;
  rep(i, N) {
    int d = min(x[i], abs(K - x[i]));
    ans += d * 2;
  }

  cout << ans << endl;
}

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

const int maxn=306;
int dis[maxn][maxn],g[maxn][maxn];
int n,m,l,q,a,b,c;

int main()
{
	scanf("%d %d %d",&n,&m,&l);
	memset(dis,63,sizeof dis);
	for(int i=1;i<=m;++i) {
		scanf("%d %d %d",&a,&b,&c);
		dis[a][b]=dis[b][a]=c;
	}
	for(int k=1;k<=n;++k)
		for(int i=1;i<=n;++i)
			for(int j=1;j<=n;++j) {
				if(dis[i][j]>dis[i][k]+dis[k][j]) dis[i][j]=dis[i][k]+dis[k][j];
			}
	memset(g,-1,sizeof g);
	for(int i=1;i<=n;++i) 
		for(int j=1;j<=n;++j) {
			if(dis[i][j]<=l) g[i][j]=1;
		}
	for(int k=1;k<=n;++k)
		for(int i=1;i<=n;++i)
			for(int j=1;j<=n;++j) {
				if(g[i][k]==-1||g[k][j]==-1) continue;
				if(g[i][j]==-1) g[i][j]=dis[0][0];
				g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
			}
	scanf("%d",&q);
	for(int i=1;i<=q;++i) {
		scanf("%d %d",&a,&b);
		if(g[a][b]==-1) printf("-1\n");
		else printf("%d\n",g[a][b]-1);
	}
}

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

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


int main() {
  int K;
  cin >> K;
  int sum = 0;
  
  for (int i = 1; i < K+1; i++){
    for (int j = 1; j < K+1; j++){
      for (int k = 1; k < K+1; k++){
        int p = gcd (j, k);
        int q = gcd (i, p);
        sum += q;
      }
    }
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using cd = complex <double>;
 
typedef pair <int, int> pii;
const int N = 3e3 + 5;
const long long INF = 1e18;
const int mod = 1e9 + 7;//786433;//998244353;
const double Pi = acos(-1);
const int p = 510200;
 
void Fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int n, w;
long long dp[101][100005];

signed main()
{
	Fastio();
	cin >> n >> w;
	long long ans = 0;
	for(int i = 1; i <= n; i++)
	{
		int ww;
		long long v;
		cin >> ww >> v;
		for(int j = w; j >= 0; j--)
		{
			dp[i][j] = dp[i - 1][j];
		}
		for(int j = w; j >= ww; j--)
		{
			dp[i][j - ww] = max(dp[i - 1][j] + v, dp[i][j - ww]);
		}
		if(i == n)
		{
			for(int j = w; j >= 0; j--)
			{
				ans = max(ans, dp[i][j]);
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 78336
#include "bits/stdc++.h"
using namespace std;
using namespace std;
typedef long long ll;
typedef vector<int> vi; 
typedef vector< vi > vvi; 
/////////////////////////
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define loop(i,a,b) for (int i = a; i < b; i++)
//////////////////////////
#define printvector(n) for(int i=0;i<n.size();i++){cout<<n[i]<<" ";}cout<<'\n'
#define printstack(n) for(int i=0;i<n.size();i++){cout<<n[i]<<" ";}cout<<'\n'
#define PI_val 3.14159265359
#define printpair(n) cout<<n.F<<" "<<n.S
#define printvop(n) loop(i,0,n.size()-1){printpair(n[i])<<endl;}
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
long long int mod=1000000007;
//////////////////////////
int main()
{
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("E:/codes/testcases/input.in", "r", stdin);
    // for writing output to output.txt
    freopen("E:/codes/testcases/output.in", "w", stdout);
    #endif
 
        long long int a,b,x,n,m,k,sum=0,ans=0,res=0;
        cin>>n>>k;
        vector<int> arr(n);
        loop(i,0,n)
        {
            cin>>arr[i];
        }
        
//       printvector(arr);
        sort(arr.begin(),arr.end());
        for(int i=0;i<k;i++){
        	sum+=arr[i];
        }
        cout<<sum;

    
    return 0;
}



Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}


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

    Int n, m, tmp;
    priority_queue<int> q;
    cin >> n >> m;
    for(Int i=0; i<n; i++){
        cin >> tmp;
        q.push(tmp);
    }
    for(Int i=0; i<m; i++){
        Int buf = q.top();
        q.pop();
        q.push(buf/2);
    }
    Int sum = 0;
    for(Int i=0; i<n; i++){
        sum += q.top();
        q.pop();
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1020
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010][1010],res;
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc;

int main(){
    cin>>n>>m>>c;
    res=0;
    for(int i=0;i<m;i++){
        cin>>ab[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>ac[i][j];
        }
    }
    for(int i=0;i<n;i++){
        z=0;
        for(int j=0;j<m;j++){
            z+=ab[j]*ac[i][j];
        }
        if(z+c>0)res++;
    }
    C res E;
}

Measured memory_bytes: 2432
from sys import stdin
import math
n,k=list(map(int,input().split()))
sum1=0
for i in range(1,n+1):
    if i>=k:
        sum1+=1/n
        
    else:
        
        res=math.log(k/i,2)
        res=math.ceil(res)
        sum1+=(1/n)*(0.5**res)
print(sum1)
    

Measured memory_bytes: 3060
#include<stdio.h>

int main(){
  int i, n, a, b, c, d, e, sum, max, min;

  while(1){
    scanf("%d", &n);
    if(n == 0) break;

    for(i=0; i<n; ++i){
      scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
      sum = a + b + c + d + e;

      if(i == 0){
	max = sum;
	min = sum;
      }else{
	if(max < sum) max = sum;
	else if(min > sum) min = sum;
      }
    }

    printf("%d %d\n", max, min);
  }
  return 0;
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#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 long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

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); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//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; }



int main() {
	int N;
	char S[2];
	int ans = 0;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%s", S);
		if (S[0] == 'Y'){
			ans = 1;
			break;
		}
	}
	if (ans) {
		printf("%s\n", "Four");
	}
	else {
		printf("%s\n", "Three");
	}





#ifdef DEBUGF
	getch();
#endif
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())



void init() {

}

void input() {

}

void solve() {
  int a[5];
  REP(i, 5) a[i] = 0;
  REP(i, 6) {
    int b;
    cin >> b;
    a[b]++;
  }
  int c[10];
  REP(i, 10) c[i] = 0;
  FOR(i, 1, 5) {
    c[a[i]]++;
  }
  if (c[1] == 2 &&  c[2] == 2) cout << "YES" << endl;
  else cout << "NO" << endl;
 }

int main() {
	init();
	input();
	solve();
	return 0;
}


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

using namespace std;

int main() {
    vector<int> x(3);
    cin >> x[0] >> x[1] >> x[2];
    sort(x.begin(),x.end());
    cout << x[0] << " " << x[1] << " " << x[2] << endl;
    return 0;
}

Measured memory_bytes: 3112
// ahokusa.cpp
#include <iostream>
using namespace std;

void bubbleSort(int a[],int n){
	int cnt = 0;
	bool flag = 1;
	while(flag){
		flag = 0;
		for(int j=n-1;j>0;j--){
			if(a[j] < a[j-1]){
				swap(a[j],a[j-1]);
				cnt++;
				flag = 1;
			}
		}
	}
	for(int i=0;i<n;i++){
		if(i>0){cout << " ";}
		cout << a[i];
	}
	cout << endl << cnt << endl;
}
int main(){
	int n;
	int a[100];
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	bubbleSort(a,n);
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  int m, d;
  cin >> m >> d;
  int ans = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= d; j++) {
      int d1 = j/10;
      int d10 = j%10;
      if (d1 >= 2 && d10 >= 2 && d1*d10 == i) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
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<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int main() {
  ll N;
  while(cin >> N) {
    if (N % 2== 1) {
      cout << 0 << endl;
      continue;
    }
    ll five = 1;
    ll sum = 0;
    for (int i=0; i<26; i++) {
      sum += N / (10 * five);
      // cout << 10*five << endl;
      five *= 5;
    }
    cout << sum << endl;
  }
}


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

using namespace std;

int main(){

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

    int n;
    cin >> n;
    if(n == 25) cout << "Christmas";
    else if(n == 24) cout << "Christmas Eve";
    else if(n == 23) cout << "Christmas Eve Eve";
    else if(n == 22) cout << "Christmas Eve Eve Eve";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9+7);
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(10000) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};

int h, w, field[8][8];
int si, sj, gi, gj;
int tmin[8][8][7];

void dijkstra(){
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            fill(tmin[i][j], tmin[i][j]+7, IINF);
        }
    }
    tmin[si][sj][6] = 0;
    priority_queue<PP, vector<PP>, greater<PP> > que;
    que.push({{0,6},{si,sj}});
    while(!que.empty()){
        PP p = que.top();
        que.pop();
        int hp, pi, pj;
        hp = p.first.second;
        pi = p.second.first;
        pj = p.second.second;
        if(p.first.first > tmin[pi][pj][hp]) continue;
        if(field[pi][pj] == 4){
            if(tmin[pi][pj][6] > tmin[pi][pj][hp]){
                tmin[pi][pj][6] = tmin[pi][pj][hp];
                que.push({{tmin[pi][pj][6], 6},{pi, pj}});
            }
        }
        if(hp <= 1) continue;
        for(int k=0;k<4;k++){
            int ni = pi+di[k], nj = pj+dj[k];
            if(ni < 0 || ni >= h) continue;
            if(nj < 0 || nj >= w) continue;
            if(field[ni][nj] == 0) continue;
            if(tmin[ni][nj][hp-1] > tmin[pi][pj][hp] + 1){
                tmin[ni][nj][hp-1] = tmin[pi][pj][hp] + 1;
                que.push({{tmin[ni][nj][hp-1], hp-1},{ni,nj}});
            }
        }
    }
}


int main() {
    while(cin >> w >> h, w){
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                cin >> field[i][j];
                if(field[i][j] == 2){
                    si = i;
                    sj = j;
                }
                if(field[i][j] == 3){
                    gi = i;
                    gj = j;
                }
            }
        }
        dijkstra();
        int ans = IINF;
        for(int i=1;i<=6;i++){
            ans = min(ans, tmin[gi][gj][i]);
        }
        cout << (ans < IINF ? ans : -1) << endl;
    }
    return 0;
}



Measured memory_bytes: 3008
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
using namespace std;
using graph = vector<vector<int>>;

int main() {
        int n, m, k;
        cin >> n >> m >> k;
        graph g(n);
        vector<int> v(n, 1);
        for(int i = 0; i < m; i++) {
                int a, b; 
                cin >> a >> b;
                a--; b--;
                g[a].push_back(b);
                g[b].push_back(a);
                v[a]++;
                v[b]++;
        }

        vector<int> w(n, -1);
        queue<int> q;

        int c = 0;
        for(int i = 0; i < n; i++) {
                if(w[i] != -1) continue;
                w[i] = c;
                q.push(i);
                while(!q.empty()) {
                        int v = q.front();
                        q.pop();
                        for(int nv : g[v]) {
                                if(w[nv] != -1) continue;
                                w[nv] = c;
                                q.push(nv);
                        }
                }
                c++;
        }

        map<int, int> mp;
        for(int i = 0; i < n; i++) {
                mp[w[i]]++;
        }       

        for(int i = 0; i < k; i++) {
                int a, b;
                cin >> a >> b;
                a--; b--;
                if(w[a] != w[b]) continue;
                v[a]++;
                v[b]++;
        }

        for(int i = 0; i < n; i++) {
                cout << mp[w[i]] - v[i] << " ";
        }
        cout << endl;
        
        return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
int cnt[100005];

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

    int ans = 1;
    for(int i = 0; i < N; i++) {
        int a;
        cin >> a;
        cnt[a-1] += 1;
        cnt[a] += 1;
        cnt[a+1] += 1;
    }
    for(int i = 0; i < 100000; i++) {
        ans = max(cnt[i],ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
from collections import defaultdict, deque

N, M = [int(x) for x in input().split()]
edges = [[int(x) for x in input().split()] for i in range(M)]

g = defaultdict(list)
for u, v in edges:
    g[u].append(v)
    g[v].append(u)

source = 1
dist = {}
q = deque()
q.append(source)
dist[source] = 0
while q:
    node = q.popleft()
    level = dist[node]
    for nbr in g[node]:
        if nbr not in dist:
            q.append(nbr)
            dist[nbr] = level + 1

if len(dist) != N:
    print("No")
    exit()

print("Yes")
for i in range(2, N + 1):
    for nbr in g[i]:
        if dist[nbr] == dist[i] - 1:
            print(nbr)
            break


Measured memory_bytes: 137356
def mp(h, w) :
	str1 = ''
	for i in range(0, w):
		str1 += '#'
	str2 = '#'
	for i in range(0, w - 2):
		str2 += '.'
	str2 += '#'
	print(str1)
	for i in range(0, h - 2):
		print(str2)
	print(str1)
	print()




while True:
	h, w = map(int, input().split())
	if h == 0 and w == 0 : break
	mp(h, w)


Measured memory_bytes: 5620
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n; i++)
#define P pair<ll, ll>
typedef long long ll;
const ll mod = 1e9+7;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
    ll res;
    res = a[0];
    for(ll i = 1; i < a.size() && res != 1; i++) {
        res = gcd(a[i], res);
    }
    return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  ll n, x;
  cin >> n >> x;
  vector<ll> dis(n);
  rep(i,n){
    ll city;
    cin >> city;
    dis[i] = abs(x - city);
  }

  ll ans = ngcd(dis);
  cout << ans << endl;
}






Measured memory_bytes: 1792
D = int(input())
C = list(map(int, input().split()))
S = []
for _ in range(D):
    s_row = list(map(int, input().split()))
    S.append(s_row)

results = []

# Cを無視して最大値をとる
# for d in range(D):
#     s_row = S[d]
#     max_value = max(s_row)
#     max_index = s_row.index(max_value)
#     results.append(max_index+1)

# 26種類順番にやる
for d in range(D):
    results.append((d % 26) + 1)


for result in results:
    print(result)


Measured memory_bytes: 67840
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  string s;cin>>s;
  if(s == "SUN") cout<<7<<endl;
  if(s == "MON") cout<<6<<endl;
  if(s == "TUE") cout<<5<<endl;
  if(s == "WED") cout<<4<<endl;
  if(s == "THU") cout<<3<<endl;
  if(s == "FRI") cout<<2<<endl;
  if(s == "SAT") cout<<1<<endl;


}


Measured memory_bytes: 384
N = int(input())

A = [1]*9
for i in range(0, len(A)):
    A[i] += i
    
flag = 0

for a in A:
    if N%a == 0 and N/a <= 9:
        flag = 1
        break
        
if flag == 0:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 38384
using System;
using System.Collections.Generic;

public class CSharp{
    public static void Main(){
        Kyopuro chokudai = new Kyopuro();
	    chokudai.AtCoder();
	}
}

public class Kyopuro{
    public void AtCoder(){
        int n = int.Parse(Console.ReadLine());
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n * 2];
        string[] s;
        for(int i=0; i<n; i++){
            s = Console.ReadLine().Split(' ');
            a[i] = int.Parse(s[0]);
            b[i] = int.Parse(s[1]);
            c[i] = a[i];
            c[n + i] = b[i];
        }
		Array.Sort(c);
		var d = new Dictionary<int, int>();
		for(int i=0; i<n; i++){
		    if(d.ContainsKey(c[i])){
		        d[c[i]]++;
		    } else {
		        d.Add(c[i], 1);
		    }
		}
		bool f = false;
		for(int i=0; i<n; i++){
		    if(d.ContainsKey(a[i]) && d.ContainsKey(b[i])){
		        if(a[i] == b[i]){
    		        if(d[a[i]] > 1) f = true;
    		    } else {
    		        if(d[a[i]] > 0 && d[b[i]] > 0) f = true;
    		    }
		    }
		}
		int g = 0;
		int h = 0;
		if(!f){
		    for(int i=0; i<n; i++){
		        if(a[i] < b[i]) h++;
		        if(a[i] > b[i]) g++;
		    }
		    if(g == 0 || h == 0) f = true;
		}
		long ans = 0;
		for(int i=0; i<n; i++) ans += c[i];
		if(f) Console.WriteLine(ans);
		else{
		    if(n > 2){
		        int x = 0;
		        int y = 0;
		        int z = 0;
		        int u = -1;
		        for(int i=0; i<n; i++){
		            x = Math.Min(a[i], b[i]);
		            y = Math.Max(a[i], b[i]);
		            if(x == c[n-1] && y == c[n]){
		                f = true;
		                z++;
		                u = i;
		            }
		        }
		        if(z == 1){
		            if(a[u] < b[u] && h > 1){
		                f = true;
	                }
	                if(a[u] > b[u] && g > 1){
	                    f = true;
	                }
	                if(a[u] == b[u]){
	                    f = true;
	                }
	                if(f) ans = Math.Min(ans - c[n-1] + c[n+1], ans - c[n-2] + c[n]);
		        }
		    }
		    if(!f) ans = ans - c[n-1] + c[n];
		    Console.WriteLine(ans);
		}
    }
    
    public static void DebugWL(object x){ System.Diagnostics.Debug.WriteLine(x); }
}

Measured memory_bytes: 23872
n, m = (int(x) for x in input().split())
l = [0]*m
r = [0]*m
for i in range(m):
    l[i], r[i] = [int(x) for x in input().split()]
lmax = max(l)
rmin = min(r)
if rmin >= lmax:
    print(rmin-lmax+1)
else:
    print(0)

Measured memory_bytes: 10868
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

int main() {
  kyun;
  int n,a,b;
  cin >> n >> a >> b;
  cout << min(n*a,b);
  hinata;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

template<class T>inline bool chmax(T& a, T b) { if (a <= b) { a = b; return true; } else return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } else return false; }

int main() {
  string _s; cin >> _s;
	vector<ll> s(_s.size());
	ll n = s.size();
	rep(i,n) s[i] = _s[i] - '0';

	reverse(all(s));

	vector<ll> sum(n + 1);
	sum[0] = 0;
	ll pow10 = 1;
	rep(i, n) {
		sum[i + 1] = (sum[i] + pow10 *s[i] %2019) % 2019;
		pow10 *= 10;
		pow10 %= 2019;
	}

	map<ll,ll> mp;
	for(ll a : sum) mp[a]++;

	ll ans = 0;
	for (auto m : mp) {
		ans += m.second * (m.second-1) / 2;
	}


	cout << ans << endl;
}

Measured memory_bytes: 6768
import java.util.*;

class Main{
	static Scanner s=new Scanner(System.in);
	static int gInt(){
		return Integer.parseInt(s.next());
	}
	public static void main(String[]A){
		long[]a={gInt(),gInt(),gInt()};
		Arrays.sort(a);
		for(int i=gInt();i>0;--i)
			a[2]*=2;
		System.out.println(a[0]+a[1]+a[2]);
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define cinf(x,n) for(int i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(int i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int main(){
	ull a;
	ld b;
	cin >> a >> b;
	cout << static_cast<ll>(a*b) << endl;
}

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

using namespace std;

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

#define ALL(obj)	(obj).begin(),(obj).end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define VEC vector

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				Vint;
typedef vector<Vint>			VV;

template<typename T>string join(const v(T)&v)
{stringstream s;REP(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		100010
#define MAX_V 		102
#define MAX_E 		10101

const ll LINF = (ll)1e18+7;		//
const int INF = 100100100;			//2,147,483,647 (Max int)
const ll MOD = 1e9+7;
// テンプレ終了
//====================================================================//

int DP[2<<12];

//
int main(){
	int N,M;cin>>N>>M;
	Vint A(M),B(M);
	VEC<VEC<int>> C(M);
	VEC<ll> D(M,0);
	REP(i,M){
		cin>>A[i]>>B[i];
		C[i].resize(B[i]);
		REP(j,B[i]){
			cin >> C[i][j];
			D[i] += (1<<(C[i][j]-1));
		}
	}

	fill(DP,DP+(2<<12),INF);

	DP[0] = 0;
	REP(i,M){
		// cout << i << endl;
		REP(j,(1<<N) ){
			// cout << "\t" << j << " " << (D[i]|j) << endl;
			DP[D[i]|j] = min( DP[D[i]|j] , DP[j]+A[i] );
		}
	}

	// REP(i, (1<<N) )cout << DP[i] << " ";cout << endl;

	cout << (DP[(1<<N)-1] != INF ? DP[(1<<N)-1] : -1 ) << endl;

	return 0;
}




Measured memory_bytes: 384
import java.util.*;
import java.lang.*;
import java.io.*;


class Main {
    public static void main(String[] args) throws java.lang.Exception {
        Scanner in = new Scanner(System.in);

        String m = in.nextLine();
        for (int i = 0; i < m.length(); i++) {
            char s = m.charAt(i);
            if (s == '9') {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");

    }
}

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

#define FOR(i, a, b) for(int i = a; i < b; i ++)
#define FORS(i, a, b, c) for(int i = a; i < b; i += c)
#define FORN(i, a, b) for(int i = a; i <= b; i ++)
#define FORD(i, a, b) for(int i = a-1; i >= b; i --)
#define FORE(i, b) for(auto &i:b)
#define REP(i, b) FOR(i, 0, b)
#define REPN(i, b) FORN(i, 0, b)
#define SQ(i) (i*i)
#define ALL(a) a.begin(), a.end()
#define ALLA(a,n) a, a+n
#define SORT(a) sort(ALL(a))
#define SORTA(a, n) sort(ALLA(a, n))
#define REV(a) reverse(ALL(a))
#define REVA(a, n) reverse(ALLA(a, n))
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define IN(a, b) (a.find(b) != a.end())
#define BACK(a) a.back(); a.RB()
#define QBACK(a) a.top(); a.pop()
#define PRINT(a) FORE(i, a) cout << i << " "; cout << endl

#define PB  push_back
#define RB  pop_back
#define RF  pop_front
#define INS insert
#define F   first
#define S   second
#define UM  unordered_map
#define US  unordered_set
#define PQ  priority_queue

#define IO ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<ll,ll> pll;
typedef queue<int> qi;
typedef queue<double> qd;
typedef queue<ll> qll;
typedef US<int> si;
typedef US<double> sd;
typedef US<ll> sll;
typedef vector<vi> mi;
typedef vector<vd> md;
typedef vector<vll> mll;
typedef vector<pi> vpi;
typedef vector<pd> vpd;
typedef vector<pll> vpll;


int main(){
  IO; int A, B, C, D; cin >> A >> B >> C >> D;
  while(A>0||C>0){
    C-=B;
    if(C<=0){
      cout<<"Yes";break;
    }
    A-=D;
    if(A<=0){
      cout<<"No";break;
    }
  }
}


Measured memory_bytes: 3652
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int N;
    cin>>N;
    for(int i=0;i<N;i++){
        double h,m;
        scanf("%lf:%lf",&h,&m);
        double totalm=h*60+m;
        double hh=totalm/2,mm=m*6;
        while(359.999999<hh)hh-=360;
        //printf("[%f][%f]\n",hh,mm);
        double ans=min(fabs(hh-mm),min(fabs(hh+360-mm),fabs(hh-360-mm)));
        if(ans<30)puts("alert");
        else if(ans<90)puts("warning");
        else puts("safe");
    }
    return 0;
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>//本当は必要なヘッダファイルだけインクルードするべきです
using namespace std;//本当は個別にusingするか変数や関数ごとにstd::をつけるべきです
//本当は関数内に宣言し明示的に初期化するべきです
int n,x,i,j,k,cnt;
int main(void){
  while(cin>>n>>x){
    if(n==0&&x==0)break;
    cnt=0;
    for(i=1;i<=n;i++){
      for(j=i+1;j<=n;j++){
        for(k=j+1;k<=n;k++){
          if(i+j+k==x){
            cnt++;
            break;
          }
        }
      }
    }
    cout<<cnt<<endl;
  }
  return 0;
}



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

int main() {
  int a, b;
  cin >> a >> b;
  
  if (a == b)
  {
    cout << "Draw" << endl;
  }
  else
  {
    if (a == 1)
    {
      cout << "Alice" << endl;
    }
    else if (b == 1)
    {
      cout << "Bob" << endl;
    }
    else if (a > b)
    {
      cout << "Alice" << endl;
    }
    else if (a < b)
    {
      cout << "Bob" << endl;
    }
  }
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define fr first
# define sc second
# define mk make_pair
# define pb push_back
# define ll long long

using namespace std;


main()
{
     long long a,b,c=0,h;
     cin>>a>>b;
     if (a==b){
        cout<<0;
        return 0;
     }
     if (a==0)
     {
         if (b>a)
         {
             cout<<abs(b-a);
             return 0;
         }
         else if (a>b)
         {
             cout<<abs(b-a)+1;
             return 0;
         }
     }
     if (b==0&&a<0)
     {
         cout<<abs(a-b);
         return 0;
     }
     if (a==-b){
       cout<<1;
       return 0;
     }
         if (a<=0&&b<=0){
         if (a>b){
         a=-a;
         c++;
         }
        while (a!=b){
            a++;
         c++;
        if (-a==b){
                c++;
            a=-a;
        break;
        }
        }
        cout<<c;
        return 0;
     }
     if (b>a&&a>=0&&b>=0&&-a!=b)
     {
         cout<<b-a;
         return 0;
     }
     if ((b>a&&b<=0||a<=0&&b>a)){
        c+=abs(abs(a)-abs(b))+1;
        cout<<c;
        return 0;
     }
     if (a>b&&b<=0&&a>=0)
     {
         cout<<abs(abs(a)-abs(b))+1;
         return 0;
     }
    if (a>b)
    {
        a=-a;
        c++;
        while (a!=b){
            c++;
            a++;
            if (-a==b){
                a=-a;
            c++;
            }
        }
        cout<<c;
        return 0;
    }
     /*if (a>b)
     {
         a=-a;
         while (a!=b)
         {
             if (abs(-a-abs(b))<=abs(a+1-abs(b))||a==-b){
                a=-a;
                c++;
             }
               if (a==b)
             {
                 break;
             }
             if (-(a+(abs(abs(a)-abs(b))))==b&&a>0)
             {
                 c+=(abs(abs(a)-abs(b)))+1;
                 a=-(a+(abs(abs(a)-abs(b))));
             }
       if (a==b)
             {
                 break;
             }
             if (abs(-a-abs(b))>=abs(a+1-abs(b))||-a>b){
                a++;
                c++;
             }
         }
         cout<<c+1;
         return 0;
     }
*/
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public void main(Scanner sc) {
        long n = sc.nextLong();
        long k = sc.nextLong();
        
        long sum = 0;
        for (int b = 1;b <= n;b++) {
        	if (b <= k) {
        	    continue;
        	}
        	
        	sum += (b - k) * (n / b) + Math.max(n % b - Math.max(k - 1, 0), 0);
        }
        
        System.out.println(sum);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


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

int main() {
   string O, E;
   cin >> O >> E;
   rep(i,E.size()) {
      cout << O.at(i) << E.at(i);
   }
   if(O.size()!=E.size()) cout << O.back();
   cout << endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define all(a)  (a).begin(),(a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

const ll INF = 1LL << 60;

int main() {
  int N, M;
  cin >> N >> M;
  vi P(M), Y(M);
  vector<vector<int>> ans(N);
  rep(i,M){
    cin >> P[i] >> Y[i];
    P[i]--;
    ans[P[i]].push_back(Y[i]);
  }

  rep(i,N){
  	sort(ans[i].begin(),ans[i].end());
  }

  rep(i,M){
    cout<< setfill('0') << setw(6) << P[i]+1;
    //"lower_bound(all(配列), key) - 配列.begin()" でkeyの先頭からの距離（0-index）
    //"lower_bound(all(配列), key)" はkey以上の要素の値（型はイテレータ）を返す
    int num = lower_bound(ans[P[i]].begin(),ans[P[i]].end(),Y[i])-ans[P[i]].begin();
    cout<< setfill('0') << setw(6) << num+1 <<endl;
  }
}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i,j,k,l,a,b,c,flag;
    cin>>n>>k;
    long long arr[n+100];
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr+0,arr+n);
    c=10000000000;
    flag=-1;
    for(i=0;(i+k-1)<n;i++)
    {
        j=i+k-1;
        l=arr[j]-arr[i];
        if(l<c)
        {
            c=l;
            flag=1;
        }
    }
    for(i=n-1;(i-k+1)>=0;i--)
    {
        j=i-k+1;
        l=arr[i]-arr[j];
        if(l<c)
        {
            c=l;
            flag=1;
        }
    }
    if(flag==1)
    {
    cout<<c<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
long fact(int n){
  if(n <= 1){
    return 1;
  }
  else{
    return n * fact(n - 1);
  }
}

vector<long*> makePath(int n){
  vector<long*> tmp;
  set<long> s;

  long ii,jj;
  long *val;
  string* str;
  vector<int>* test;
  test = new vector<int>();
  str = new string();
  long mod,v;
  for(ii=0;ii<pow(n,n);ii++){
    val = (long*)malloc(sizeof(long)*n);
    v = ii;
    s.clear();
    for(jj=0;jj<n;jj++){
      val[jj] = (v % n) + 2;
      v = v / n;
      if(s.find(val[jj]) != s.end()){
	break;
      }
      else{
	s.insert(val[jj]);
      }
    }
    if(jj == n){
      tmp.push_back(val);
    }
  }

//  for(ii=0;ii<pow(n,n);ii++){
//    for(jj=0;jj<n;jj++){
//
//    }
//  }
  return tmp;
}

int main(){
  int n,m,ii,jj;
  vector<int> path1,path2;

  vector<long*> vv;


  vv = makePath(3);
  n = 6;
  //cout << "makePath end" << endl;

  cin >> n >> m;

  vv = makePath(n-1);

//  for(ii=0;ii<fact(n-1);ii++){
//    for(jj=0;jj<n-1;jj++){
//      cout << vv[ii][jj] ;
//    }
//    cout << endl;
//  }
  
  path1.resize(m);
  path2.resize(m);

  for(ii=0;ii<m;ii++){
    cin >> path1[ii] >> path2[ii];
  }

  long graph[n+1][n+1];
  memset(graph,0,sizeof(long)*(n+1)*(n+1));
  for(ii=0;ii<m;ii++){
    graph[path1[ii]][path2[ii]] = 1;
    graph[path2[ii]][path1[ii]] = 1;
  }
//  for(ii=1;ii<=n;ii++){
//    for(jj=1;jj<=n;jj++){
//      cout << graph[ii][jj] ;
//    }
//    cout << endl;
//  }
  
//  cout << "graph make end" << endl;

  long sum = 0,from,to;
  for(ii=0;ii<fact(n-1);ii++){
    //cout << ii << endl;
    for(jj=0;jj<n-1;jj++){
      if(jj == 0){
	from = 1;
      }
      else{
	from = vv[ii][jj-1];
      }
      to = vv[ii][jj];
      if(graph[from][to] == 1 ||
	 graph[to][from] == 1){
	//cout << "ok" <<endl;
      }
      else{
	break;
      }
    }
    if(jj == (n-1)){
      sum++;
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 51712
#include<stdio.h>
int main(void){
    int a,b,c;
    int n,x,max;
    int ans;
    while(1){
        scanf("%d%d",&n,&x);
        if(n==0&&x==0)break;
        ans=0;
        max=x;if(max>n)max=n;
        for(a=1;a<=max;a++){
            for(b=a+1;b<=max;b++){
                c=x-a-b;
                if(c>b&&c<=n)ans++;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 2104
# -*- coding: utf-8 -*-
"""
C - Traveling Plan
https://beta.atcoder.jp/contests/abc092/tasks/arc093_a

"""
import sys
from sys import stdin

input = stdin.readline


def solve(spots, N):
    total_cost = 0
    cp = 0
    for s in spots:
        total_cost += abs(s - cp)
        cp = s
    total_cost += abs(spots[-1])

    ans = []
    spots.append(0)
    spots.insert(0, 0)
    for i in range(1, N):
        if spots[i-1] <= spots[i] <= spots[i+1] or spots[i-1] >= spots[i] >= spots[i+1]:
            ans.append(total_cost)
        else:
            if spots[i] <= spots[i-1] <= spots[i+1]:
                t = abs(spots[i] - spots[i-1]) * 2
            elif spots[i-1] <= spots[i+1] <= spots[i]:
                t = abs(spots[i] - spots[i+1]) * 2
            elif spots[i-1] >= spots[i+1] >= spots[i]:
                t = abs(spots[i] - spots[i+1]) * 2
            else:
                t = abs(spots[i] - spots[i-1]) * 2
            ans.append((total_cost - t))

    spots = spots[:-2]
    total_cost = 0
    cp = 0
    for s in spots:
        total_cost += abs(s - cp)
        cp = s
    total_cost += abs(spots[-1])
    ans.append(total_cost)

    return ans


def main(args):
    N = int(input())
    spots = [int(x) for x in input().split()]
    ans = solve(spots, N)
    print(*ans, sep='\n')


if __name__ == '__main__':
    main(sys.argv[1:])
    


Measured memory_bytes: 14048