Source stringclasses 1
value | Date int64 2.01k 2.02k | Text stringlengths 22 783k | Token_count int64 20 394k |
|---|---|---|---|
Project_CodeNet | 2,020 | import sys
input = sys.stdin.readline
N, K = map(int, input().split())
if K == 0:
print(N ** 2)
exit(0)
res = 0
for i in range(1, N + 1):
if i <= K: continue
res += i - K
for j in range(i, N + 1, i):
res += min(N + 1, j + i) - min(N + 1, j + K)
print(res) | 111 |
Project_CodeNet | 2,020 | N, K = map(int, input().split())
ans = 0
# bを全探索して組み合わせの数を求める
for b in range(1, N+1):
# 繰り返される数
times = (N//b)
# 最後に付け加える数
last = N % b
ans += times * max(0, b-K) + max(0, last - K + 1)
if K == 0:
print(N*N)
else:
print(ans)
| 128 |
Project_CodeNet | 2,019 | n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
c=(n+1)//i
d=(n+1)%i
ans+=max(0,i-k)*c+max(0,d-k)
if k==0:
ans-=n
print(ans) | 67 |
Project_CodeNet | 2,020 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string impor... | 368 |
Project_CodeNet | 2,020 | def solve():
n,k = map(int,input().split())
res = 0
for i in range(k+1,n+1):
res+=(i-k)*(n//i)
if n%i>=k:
if k==0:
res+=n%i
else:
res+=n%i-k+1
print(res)
if __name__=='__main__':
solve() | 87 |
Project_CodeNet | 2,020 | n, k = map(int,input().split())
num = 0
for b in range(k+1,n+1):
c = n%b
num += (n//b)*(b-k) + max(0,c-k+1)
if k == 0:
num -= 1
print(num)
| 69 |
Project_CodeNet | 2,019 | N, K = map(int, input().split())
ans = 0
if K == 0:
ans = N ** 2
else:
for b in range(1, N + 1):
p, r = divmod(N, b)
ans += p * max(0, b - K) + max(0, r - K + 1)
print(ans) | 84 |
Project_CodeNet | 2,019 | N, K = map(int, input().split())
if K == 0:
print(N**2)
else:
ans = 0
for b in range(K+1, N+1):
q = N // b
r = N % b
if r >= K:
ans += (r-K+1)*(q+1) + (b-r-1)*q
else:
ans += (b-K)*q
print(ans) | 102 |
Project_CodeNet | 2,019 | n, k = map(int, input().split())
ans = 0
for b in range(k + 1, n + 1):
ans += ((n // b) * (b - k)) + max(0, (n % b) - k + 1)
if k == 0:
ans = n ** 2
print(ans)
| 77 |
Project_CodeNet | 2,020 | n, k = map(int, input().split())
print(sum([n // i * (i - k) + max(0, n % i - k + 1)
for i in range(k + 1, n + 1)]) - (k == 0) * n)
| 62 |
Project_CodeNet | 2,020 | import sys
N, K = map(int, sys.stdin.readline().split())
if K == 0:
print(N*N)
sys.exit()
ans = 0
for b in range(K+1, N+1):
r = N // b
# tmp = (b - K) * r
# tmp2 = (N % b + 1 - K)
# print(b, tmp, tmp2)
tmp = (b - K) * r + max(0, N % b + 1 - K)
ans += tmp
print(ans) | 124 |
Project_CodeNet | 2,018 | n, k = map(int, input().split())
ans = 0
if k == 0:
ans = n * n
else:
for b in range(k+1, n+1):
p, r = n // b, n % b
ans += p * max(0, b - k) + max(0, r - k + 1)
print(ans)
| 85 |
Project_CodeNet | 2,019 | import sys
N, K = map(int, input().split())
if K == 0:
print(N ** 2)
sys.exit()
ans = 0
for b in range(1, N + 1):
able_div = N // b
able_div_nums = able_div * max(0, b - K)
remainders = max(0, (N % b) - K + 1)
#print(f'able_div_nums: {able_div_nums}')
#print(f'remainders: {remainders}')
... | 130 |
Project_CodeNet | 2,020 | n,k=map(int,input().split())
if k==0:
print(n**2)
exit(0)
ans=0
for i in range(k+1,n+1):
q,r=divmod(n,i)
ans+=q*(i-k)
if r>=k:
ans+=max(r-k+1,0)
print(ans)
| 77 |
Project_CodeNet | 2,020 | n, k = map(int, input().split())
ans = 0
for i in range(1,n+1):
ans += (n//i)*max(0,i-k)+max(0,n%i-k+1)
if k==0:
ans -= n
print(ans) | 62 |
Project_CodeNet | 2,020 | N, K = map(int, input().split())
if K==0:
print(N**2)
exit()
res = 0
for b in range(1,N+1):
res += (N//b)*max(b-K,0) + max(N%b-K+1, 0)
print(res) | 69 |
Project_CodeNet | 2,018 | N,K=map(int,input().split())
res=0
for b in range(K+1,N+1):
#print((N+1)//b*(b-K),(N+1)%b-K)
res+=(N+1)//b*(b-K)+max(0,(N+1)%b-K)
if(K==0):
res-=N
print(res) | 80 |
Project_CodeNet | 2,020 | n,k=map(int,input().split())
a=0
for i in range(k+1,n+1):a+=max(0,n%i+1-k)+(i-k)*(n//i)
print(n**2if not k else a) | 52 |
Project_CodeNet | 2,020 |
def resolve():
N, K = map(int, input().split())
if K == 0:
print(N ** 2)
return
ans = 0
for b in range(1, N + 1):
ans += N // b * max(0, b - K)
ans += max(0, N % b + 1 - K)
print(ans)
if __name__ == "__main__":
resolve()
| 98 |
Project_CodeNet | 2,020 | import sys
sys.setrecursionlimit(10 ** 7)
N, K = map(int, input().split())
ans = 0
for n in range(N + 1):
# 無理
if n <= K:
continue
if K == 0:
ans += N
continue
# 倍数分
ans += (N // n) * (n - K)
# あまり分
if K <= (N % n):
ans += (N % n) - K + 1
print(ans)
| 126 |
Project_CodeNet | 2,020 | n,k = map(int, input().split())
if k == 0:
print(n**2)
else:
ans = 0
for b in range(k+1,n+1):
ans += (b-k)*((n+1)//b) + max(0,((n+1)%b)-k)
print(ans) | 74 |
Project_CodeNet | 2,018 | def calc(N, K):
if K == 0:
return N**2
result = 0
for b in range(K + 1, N + 1):
n, m = divmod(N, b)
result += (b - K) * n
if m >= K:
result += m - K + 1
return result
N, K = [int(_) for _ in input().split()]
print(calc(N, K))
| 102 |
Project_CodeNet | 2,019 | # -*- coding: utf-8 -*-
def main():
n, k = map(int, input().split())
ans = 0
if k == 0:
print(n ** 2)
exit()
for i in range(k + 1, n + 1):
p, q = divmod(n, i)
ans += p * (i - k)
ans += max(q - k + 1, 0)
print(ans)
if __name__ == '__main__':
main()
| 112 |
Project_CodeNet | 2,020 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')
def main():
N, K... | 172 |
Project_CodeNet | 2,020 | from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))
def main():
N, K = map(int, input().split())
ans = K - N if K == 0 else 0
for b in range(K + 1, N + 1):
c = (N - K) // b
ans += (b - K) * c + min(N - c * b + 1, b... | 130 |
Project_CodeNet | 2,019 | import math
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
input = sys.stdin.readline
N,K ... | 148 |
Project_CodeNet | 2,019 | N, K = map(int, input().split())
ans = 0
for b in range(1, N+1):
p = N // b
r = N % b
ans += p * max(0, b - K) # 繰り返される部分
ans += max(0, r - K + 1) # 最後に付け加えられる部分
if K == 0:
# 1~NのN回 b に関する演算を行なっているから -N
ans -= N # 各bに対して,本来許されない a=0 をカウントしてしまっているから帳尻合わせをする
print(ans)
| 177 |
Project_CodeNet | 2,018 | n,k=input().split()
n,k=int(n),int(k)
if k==0:
print(n*n)
else:
res=n*k
for i in range(k+1,n+1):
res+=n//i*k+min(n%i,k-1)
print(n*n-res) | 64 |
Project_CodeNet | 2,019 | import sys
import numpy as np
def main():
n, k = [int(x) for x in input().split()]
if k == 0:
print(n * n)
sys.exit()
ans = 0
for b in range(k + 1, n + 1):
ans += ((b - k) * (n // b)) + max(0, (n % b) - k + 1)
print(ans)
main()
| 101 |
Project_CodeNet | 2,019 | n,k=map(int,input().split())
ans=0
for i in range(k+1,n+1):#iは割る数
num=i-k#k以上のあまりの種類
c=n//i
ans+=num*c#(c-1)~0まであまりがk~i-1
r=n%i
if r<k:
pass
else:
ans+=r-k+1
if k==0:
print(ans-n)
exit()
print(ans) | 120 |
Project_CodeNet | 2,020 | N, K = map(int,input().split())
total = 0
num = 1
for i in range(K+1,N+1):
total += N//i*num
num += 1
if K == 0:
total += max(N%i-K,0)
else:
total += max(N%i-K+1,0)
print(total) | 81 |
Project_CodeNet | 2,020 | n, k = map(int, input().split())
ans = 0
for i in range(2, n+1):
if i-1 < k:
continue
else:
#print((i-k)*(n//i), n % i-(i-k))
ans += (i-k)*(n//i)
ans += max(0, n % i-(k-1))
if k == 0:
ans+=1
print(ans)
| 99 |
Project_CodeNet | 2,019 | from collections import Counter,defaultdict,deque
import sys
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): # n=1
return int(input())
def inpm(): # x=1,y=2
return map(int,input().split())
... | 303 |
Project_CodeNet | 2,019 | n, k = map(int, input().split())
ans = 0
for b in range(1, n + 1):
ans += ((n // b) * max(0, b - k)) + max(0, (n % b) - k + 1)
if k == 0:
ans = n ** 2
print(ans) | 78 |
Project_CodeNet | 2,020 | #coding:utf-8
import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
input... | 562 |
Project_CodeNet | 2,018 | def getN():
return int(input())
def getNM():
return map(int, input().split())
def getList():
return list(map(int, input().split()))
ans = 0
N, K = getNM()
for i in range(N):
b = i + 1
if b > K:
set = N // b
ans += set*(b-K)
rem = N % b
if K == 0:
ans -=1
... | 116 |
Project_CodeNet | 2,020 | n, k = map(int, input().split())
ans = 0
for b in range(k+1, n+1):
ans += (n // b) * (b - k)
ans += max(0, n % b - k + 1)
if k == 0:
ans -= n
print(ans)
| 72 |
Project_CodeNet | 2,019 | # ARC091D - Remainder Reminder
def main():
N, K = tuple(map(int, input().split()))
if K == 0:
print(N ** 2)
else:
ans = sum(
N // i * (i - K) + max(0, (N % i) - K + 1) for i in range(K + 1, N + 1)
)
print(ans)
if __name__ == "__main__":
main() | 104 |
Project_CodeNet | 2,018 | N,K=map(int,input().split())
if K == 0:
print(N*N)
else:
total = 0
for i in range(1,N+1):
if K <= (i-1):
total += (N//i)*(i-K)
if K <= (N%i):
total += (N%i)-K+1
print(total) | 82 |
Project_CodeNet | 2,020 | N, K = map(int, input().split())
ans = 0
if K == 0:
ans += N**2
else:
for i in range(K+1, N+1):
ans += (N//i)*(i-K)
if N%i > K-1:
ans += (N%i) - (K-1)
print(ans) | 80 |
Project_CodeNet | 2,020 | N,K = map(int,input().split())
ans = 0
for bi in range(K+1,N+1):
ans += (bi-K)*(N//bi)+max(0,N%bi-K+1) - (K==0)
print(ans)
| 55 |
Project_CodeNet | 2,019 | #!/usr/bin/env python3
import sys
def solve(N: int, K: int):
# a, b <= N
# a % b >= K
res = 0
for b in range(K+1, N+1):
m, r = divmod(N, b)
res += N + 1
if K == 0:
res -= 1
res -= m * K # 0 ~ m*b-1
res -= min(r+1, K) # m*b ~ m*b+r (=N)
print(res)... | 248 |
Project_CodeNet | 2,020 | N,K=list(map(int,input().split()))
if K==0:
print(N**2)
exit()
ans=0
for i in range(1,N+1):#割る数
if i<=K:
continue
else:
ans+=(N//i)*(i-K)
ans+=N-(N//i)*i-(K-1) if N-(N//i)*i-(K-1)>0 else 0
print(ans) | 101 |
Project_CodeNet | 2,020 | #!/usr/bin/env python
# coding: utf-8
# In[9]:
N,K = map(int, input().split())
# In[10]:
if K == 0:
ans = N*N
else:
ans = 0
cnt = 1
for b in range(K+1,N+1):
mod = N%b
x = N//b
ans += x*cnt
if mod >= K:
ans += mod-K+1
cnt += 1
print(ans)
# In[ ... | 121 |
Project_CodeNet | 2,020 | 解説AC=True
n,k=map(int,input().split())
cnt=0
if k==0:
print(n*n)
exit()
for b in range(k+1,n+1):
ans=(b-k)*(n//b)+max(0,n%b-k+1)
cnt+=ans
print(cnt) | 71 |
Project_CodeNet | 2,020 | n,k=map(int,input().split())
ans=0
if k==0:
print(n**2)
exit()
for b in range(1,n+1):
if k>b-1:
continue
ans+=n//b*(b-k)
ans+=max(n-n//b*b+1-k,0)
print(ans) | 75 |
Project_CodeNet | 2,020 | # Problem D - Remainder Reminder
# input
N, K = map(int, input().split())
# initialization
class_count = 0
for b in range(1, N+1):
count_1 = (N//b) * max(0, b-K)
count_2 = max(0, (N % b + 1) - K)
class_count += count_1 + count_2
# output
if K==0:
class_count -= N
print(class_count)
| 110 |
Project_CodeNet | 2,020 | n,k = map(int,input().split())
ans = 0
if k == 0:
print(n**2)
exit()
for i in range(k+1,n+1):
a = n // i
b = n % i
tmp = a * (i - k) + max(0, b - k + 1)
ans += tmp
print(ans)
| 84 |
Project_CodeNet | 2,019 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip... | 172 |
Project_CodeNet | 2,019 | n, k = map(int, input().split())
if k==0:
print(n**2)
else:
ans = 0
for i in range(k+1, n+1):
t = (n+1)//i
ans += t*(i-k) + max(0, (n-(t*i+k)+1))
print(ans) | 79 |
Project_CodeNet | 2,019 | N, K = map(int, input().split())
res = 0
for b in range(1, N + 1):
res += max(b - K, 0) * (N // b)
res += max(N % b - K + 1, 0)
if K == 0:
res -= N
print(res) | 77 |
Project_CodeNet | 2,020 | n,k = map(int,input().split())
cnt = 0
if k == 0:
print(n*n)
exit()
for i in range(k+1, n+1):
cnt += n//i * (i-k)
if n % i >= k:
cnt += n%i-k+1
print(cnt)
| 71 |
Project_CodeNet | 2,020 | def main():
n,k = map(int,input().split())
ans = 0
for b in range(k+1,n+1):
ans += ((n//b)*max(0,b-k)+max(0,(n%b)-k+1))
if k == 0:
ans -= n
print(ans)
main() | 75 |
Project_CodeNet | 2,020 | N, K = map(int, input().split())
ans = 0
for b in range(1, N+1):
if K>=b:
continue
if K==0:
ans += N
else:
ans += N//b*(b-K)+max(N%b-K+1, 0)
print(ans) | 74 |
Project_CodeNet | 2,020 | def main():
n,k = map(int,input().split())
ans = 0
if k == 0:
ans = n * n
else:
for i in range(k+1,n+1):
ans += n // i * (i-k)
ans += max(0,n%i-k+1)
print(ans)
if __name__ == '__main__':
main() | 87 |
Project_CodeNet | 2,018 | import sys
N,K = map(int, input().split())
res = 0
if K==0:
print(N*N)
sys.exit(0)
for i in range(N):
i += 1
if i-K<=0:
continue
amari = N % i
amari = amari - K + 1
re = N // i
if amari <= 0:
amari = 0
res += re*(i-K) + amari
print(res) | 113 |
Project_CodeNet | 2,020 | # input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprin... | 517 |
Project_CodeNet | 2,020 | N,K=map(int,input().split())
def f(b):
d=max(b-K,0)*(N//b)+max(N%b-K+1,0)
return d
ans=0
if K==0:
print(N**2)
exit()
for i in range(1,N+1):
ans+=(f(i))
print(ans) | 77 |
Project_CodeNet | 2,020 | N,K=[int(x) for x in input().split()]
counter=0
for b in range(max(1,K),N+1):
tobeadded=(N//b)*(b-K) + max(0,N%b+1-K)
counter+=tobeadded
if K==0:
counter-=N
print(counter) | 70 |
Project_CodeNet | 2,020 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collection... | 236 |
Project_CodeNet | 2,019 | N,K=map(int, input().split())
if K==0:
print(N*N)
else:
count = 0
for b in range(K+1, N+1):
chk = (N//b)*max(0, b-K)+max(N%b-K+1, 0)
count += chk
print(count)
| 73 |
Project_CodeNet | 2,020 | N,K = map(int,input().split())
cnt = 0
for b in range(K+1,N+1):
n = N//b
k = N%b
cnt += n*(b-K)
cnt += max(k-K+1,0)
if K==0:
print(cnt-N)
else:
print(cnt) | 74 |
Project_CodeNet | 2,020 | import sys
N, K = map(int, input().split())
if K == 0:
print(N**2)
sys.exit()
ans = 0
for b in range(K+1,N+1):
peri, res = divmod(N,b)
ans += (b-K)*peri + max(0,res-K+1)
print(ans) | 76 |
Project_CodeNet | 2,019 | n,k=map(int,input().split())
ans=0
for i in range(k+1,n+1):
ans+=(n//i)*(i-k)+max(n%i-k+1,0)
print(n**2 if k==0 else ans)
| 54 |
Project_CodeNet | 2,019 | N,K=map(int,input().split(" "))
if K == 0:
print(N**2)
exit()
b = K + 1
s = 0
while b <= N:
c = N % b
s += (N//b)*(b-K) + max(0,c-K+1)
b += 1
print(s) | 79 |
Project_CodeNet | 2,018 | def big(a,b):
if a >= b:
return a
else:
return b
n,k = map(int,input().split())
ans = 0
b = 1
while b <= n:
p = n//b
ans += p*big(0,b-k)
r = n%b
ans += big(0,r-k+1)
b += 1
if k == 0:
ans += -n
print(ans) | 103 |
Project_CodeNet | 2,020 | import sys
input = sys.stdin.readline
def main():
N, K = map(int, input().split())
ans = 0
for b in range(K + 1, N + 1):
q, r = divmod(N, b)
ans += (b - K) * q
ans += max(0, min(b - 1, r) - max(1, K) + 1)
print(ans)
if __name__ == "__main__":
main()
| 108 |
Project_CodeNet | 2,020 | N,K = list(map(int,input().split()))
ans = 0
if K == 0:
print(N**2)
else:
for i in range(K+1,N+1):
ans += N//i*(i-K)
ans += max(0,N%i-K+1)
print(ans) | 67 |
Project_CodeNet | 2,018 | #!/usr/bin/env python
import math
def main():
N, K = map(int, input().split())
if K == 0:
return N * N
ans = 0
for n in range(1, N + 1):
if n <= K:
pass
else:
ans += (N // n) * (n - K)
ans += (N % n) - K + 1 if (N % n) - K + 1 > 0 else 0
... | 129 |
Project_CodeNet | 2,020 | n, k = [int(i) for i in input().split()]
ans = 0
for i in range(1, n + 1):
ans += (n // i) * (max(0, i - k))
ans += max(n % i- k + 1, 0)
print(ans - (n if k==0 else 0))
| 79 |
Project_CodeNet | 2,018 | n, k = map(int, input().split())
ans = 0
if k == 0:
print(n ** 2)
else:
for i in range(k + 1, n + 1):
div = n // i
ans += (i - k) * div
if n % i != 0:
ans += max(n + 1 - ((n // i) * i + k), 0)
print(ans) | 96 |
Project_CodeNet | 2,020 | N,K=map(int,input().split())
count=0
for b in range(K+1,N+1):
if K==0:
count+=N
else:
x=N//b
y=N%b
count+=(x)*(b-K)
if y>=K:
count+=(y-(K-1))
print(count) | 74 |
Project_CodeNet | 2,020 | N, K = map(int, input().split(" "))
ans = 0
for b in range(K + 1, N + 1):
ans += (b - K) * (N // b) + max(0, N % b - K + 1)
if K == 0:
ans -= 1
print(ans) | 76 |
Project_CodeNet | 2,020 | N,K=map(int,input().split())
ans=0
for b in range(K+1,N+1):
ans+=N//b*(b-K)+max(0,N%b-K+1)
if K==0:
ans-=1
print(ans) | 58 |
Project_CodeNet | 2,020 | N,K=map(int,input().split())
res=0
for b in range(1,N+1):
if(b<=K):
continue
res+=(N//b)*(b-K)
if(K!=0):
res+=max(0,N%b-(K-1))
else:
res+=N%b
print(res) | 75 |
Project_CodeNet | 2,018 | N, K = map(int, input().split())
ans = 0
if K == 0:
print(N**2)
exit()
for b in range(1, N+1):
block_K = max(0, b-K)
#print("b", b, "block_num", (N+1)//b, "block_K", block_K, "remain", (N+1)%b)
ans += block_K * ((N+1)//b) + max(0, (N+1)%b - K)
print(ans) | 120 |
Project_CodeNet | 2,019 | N, K = map(int, input().split())
if K == 0:
print(N**2)
exit()
ans = 0
for b in range(K+1, N+1):
ans += (N//b)*(b-K)
ans += max(0, N-((N//b)*b+K)+1)
# print(b, ans)
print(ans)
| 84 |
Project_CodeNet | 2,020 | import sys
import numpy as np
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())
def main():
n, k = mi()
ans = 0
for i in range(k+1, n+1):
ans += (n//i)*(i-k)
if k == 0:
ans -= 1... | 126 |
Project_CodeNet | 2,020 | n, k = map(int, input().split())
ans = 0
for b in range(1, n+1):
ans += n//b * max(0, b-k) + max(0, n%b -k + 1)
if k == 0:
ans -= 1
print(ans)
| 71 |
Project_CodeNet | 2,020 | import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import redu... | 777 |
Project_CodeNet | 2,020 | import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline(... | 224 |
Project_CodeNet | 2,019 | n,k = map(int,input().split())
ans = 0
if k == 0:
for x in range(1,n+1):
ans += n//x
k += 1
for b in range(k,n+1):
m = int((n+1)/b)
ans += m*(b-k)
ans += max(0,n-m*b-k+1)
print(ans) | 88 |
Project_CodeNet | 2,020 | N, K = map(int, input().split())
ans = 0
for i in range(K+1, N+1):
ans += (N // i)*(i - K) + max(0, (N % i - max(0, (K - 1))))
print(ans)
| 63 |
Project_CodeNet | 2,019 | def main():
n,k = map(int,input().split())
res = 0
if k == 0:
print(n ** 2)
else:
for b in range(k+1,n+1):
res += (b-k) * (n//b)
if n % b != 0:
res +=max(0, n - ((n//b)*b+k) +1)
print(res)
main() | 96 |
Project_CodeNet | 2,020 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, K = mapint()
ans = 0
for b in range(K+1, N+1):
cnt = 0
while b*(cnt+1)<=N:
ans += b*(cnt+1)-(b*cnt+K)
cnt += 1
if K!=0:
ans += max(0, N-b*cnt-K... | 136 |
Project_CodeNet | 2,020 | import sys
N, K = map(int, input().split())
if K == 0:
print(N*N)
sys.exit()
ans = 0
for b in range(K, N+1):
s, r = N//b, N % b
ans += s * (b-K)
ans += max(0, r - K + 1)
print(ans)
| 83 |
Project_CodeNet | 2,019 | N,K=map(int,input().split())
s=0
for b in range(K+1,N+1):s+=(N//b)*(b-K)+max(0,N%b-K+1)
print(s if K!=0 else N*N) | 53 |
Project_CodeNet | 2,019 | N,K=map(int,input().split())
if K==0:
print(N**2)
else:
ans=0
for i in range(K+1,N+1):
ans+=(N-N%i)//i*(i-K)
ans+=N%i-K+1if N%i>=K else 0
print(ans) | 72 |
Project_CodeNet | 2,018 | N, K = map(int, input().split())
if K == 0:
print(N * N)
exit()
ans = 0
for b in range(K + 1, N + 1):
ans += (N // b) * (b - 1 - K + 1)
ans += max(N % b + 1 - K, 0)
print(ans)
| 84 |
Project_CodeNet | 2,020 | n,k = map(int,input().split())
print(n**2 if not k else sum([(i-k)*(n//i)+max(0,n%i-k+1) for i in range(k+1,n+1)])) | 47 |
Project_CodeNet | 2,018 | #!/usr/bin/env python3
def main():
n, k = map(int, input().split())
cnt = 0
for b in range(k + 1, n + 1):
cnt += count_a(n, k, b)
print(cnt)
def count_a(n, k, b):
assert b > k
fulls = (n + 1) // b
rest = (n + 1) % b
cnt = fulls * (b - k)
cnt += max(0, rest - k)
if k == ... | 139 |
Project_CodeNet | 2,020 | import sys
n,k = map(int,input().split())
ans = 0
if k == 0:
print(n**2)
sys.exit()
for b in range(k+1,n+1):
ans_per_loop = b - k
loop, r = divmod(n,b)
new = ans_per_loop*loop
if r >= k:
new += r-k+1
ans += new
print(ans)
| 94 |
Project_CodeNet | 2,020 | # coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisec... | 330 |
Project_CodeNet | 2,018 | N,K = map(int, input().split())
answer = 0
if K == 0:
answer = N*N
else:
for b in range(K+1, N+1):
add = N//b * max(b-K, 0) + max(N%b+1-K, 0)
answer += add
print(answer)
| 74 |
Project_CodeNet | 2,018 | N,K = map(int, raw_input().split())
ans = 0
if K==0:
ans = N*N
else:
for b in range(K+1,N+1):
ans += N/b*(b-K) + max(0, N%b-K+1)
print ans
| 65 |
Project_CodeNet | 2,019 | N, K = map(int, input().split())
ans = 0
for b in range(K + 1, N + 1):
ans += (b - K) * (N // b)
if N % b != 0:
if K != 0:
ans += max(0, N - N // b * b - K + 1)
else:
ans += max(0, N - N // b * b - K)
print(ans) | 103 |
Project_CodeNet | 2,019 | import bisect
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
from operator import mul
import numpy as np
import re
import sys
sys.setrecursionlimit(10000)
INF = float('inf')
N, K ... | 165 |
Project_CodeNet | 2,019 | import sys, os
f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
sys.stdin = open('./input.txt', 'r')
def solve():
n, k = f()
ans = 0
for b in range(k+1, n+1):
if k!=0:
ans += n//b * (b-k) + (n%b - (k-1) if n%b >k-1 else 0)
else:
ans += n
... | 118 |
Project_CodeNet | 2,020 | n, k = map(int, input().split())
ans = 0
if k == 0:
ans = n ** 2
else:
for b in range(k + 1, n + 1):
period = n // b
nokori = n % b
ans += period * (b - k) + max(nokori - k + 1, 0)
print(ans)
| 89 |
Project_CodeNet | 2,020 | n , k = map(int,input().split())
ans = 0
if k == 0:
ans = n**2
else:
for b in range(k+1,n+1):
ans += ((n-b+1)//b + 1)*(b-k)
if k - 1 < n % b < b-1:
ans += n % b - k + 1
print(ans) | 89 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.