ZhenlongDai/ACPR huggingface dataset:
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,K = map(int, input().split(' '))



res = 0

for k in range(K, n+2):
  first = k * (k-1) / 2
  last = (2 * n - k + 1) * k / 2
  res += (last - first + 1) % (10**9+7)
print(int(res))

Failing test case input:
4096 2759

Expected output:
870712883


Actual output:
2870712897


Fixed submission (verdict: Accepted):
n,K = map(int, input().split(' '))



res = 0

for k in range(K, n+2):
  first = k * (k-1) / 2
  last = (2 * n - k + 1) * k / 2
  res += (last - first + 1) 
print(int(res%(10**9+7)))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K=map(int,input().split())
def wa(N,K):
    return (N+1)*K-K**2
d=0
for i in range(K,N+1):
  d=d+wa(N,i)
print((d+1)%(10**9+7))


Failing test case input:
1000 1

Expected output:
167168001


Actual output:
167167001


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
def wa(N,K):
    return K*(N+1-K)+1
d=0
for i in range(K,N+2):
  d=d+wa(N,i)
print((d)%(10**9+7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

import itertools

def main():
    n, k = map(int, input().split())

    n_li = list(range(n+1))

    ans = 0

    for i in range(k, n+1):
        
        ans += n*k - k**2 + k + 1

    print(ans)

if __name__ == '__main__':
    main()


Failing test case input:
10163 4398

Expected output:
72432465


Actual output:
146219238654


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

def main():
    MOD = 1000000007
    n, k = map(int, input().split())

    n_li = list(range(n+1))

    ans = 0

    while(k <= n+1):
        p = (k - 1) * k / 2
        q = ((n + n - k + 1) * k) / 2

        ans += q - p + 1
        ans %= MOD
        k += 1

    print(int(ans))

if __name__ == '__main__':
    main()

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for k in range(K, N + 2):
    ans = (ans + k * (2 * N - k + 1) / 2 - (k - 1) * k / 2 + 1)
    ans %= MOD
print(ans)


Failing test case input:
6048 4398

Expected output:
747717858


Actual output:
747717858.0


Fixed submission (verdict: Accepted):
N, K = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for k in range(K, N + 2):
    ans = (ans + k * (2 * N - k + 1) / 2 - (k - 1) * k / 2 + 1)
    ans %= MOD
print(int(ans))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

N,K=map(int,input().split())

mod = 10**9 +7







def counts(n,k):
    if k==1:
        return N
    else:
        return k*N -k*(k-1) +1

total =0

for k in range(K,N+2):
    total += counts(N,k)


print(total%mod)

Failing test case input:
1000 1

Expected output:
167168001


Actual output:
167168000


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
mod = (10**9) +7

def counts(n,k):
    if k==1:
        return N+1
    else:
        return k*N - k*( k - 1 ) + 1

total =0
for k in range(K,N+2):
    total += int(counts(N,k))

print(total%mod)
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())
d=0
for i in range(k,n+2):
    b=i*(i-1)/2
    c=i*(2*n-i+1)/2
    d+=(c-b+1)
print(int(d))

Failing test case input:
141421 60408

Expected output:
832536804


Actual output:
286858834544810


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
d=0
for i in range(k,n+2):
    b=i*(i-1)/2
    c=i*(2*n-i+1)/2
    d+=(c-b+1)
print(int(d)%(10**9+7))

Problem: p02708
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N,K=map(int,input().split())



ans=0
for k in range(K,N+2):
  first = k * (k-1) / 2
  final = (N*2-k+1) * k / 2
  ans += final - first + 1
print(int(ans))

Failing test case input:
141421 61260

Expected output:
970705737


Actual output:
282681972684504


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
ans=0
for k in range(K,N+2):
  first = k * (k-1) / 2
  final = (N*2-k+1) * k / 2
  ans += final - first + 1
mod=(10**9)+7
print(int(ans%mod))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

def answer(N:int,K:int) -> int:
    counter = 0
    for i in range(K,N+2):
        counter += i*(N - K + 1) + 1
    return counter % (10**9 + 7)



def main():
    N,K = map(int,input().split())
    
    print(answer(N,K))

if __name__ == '__main__':
   main()

Failing test case input:
4096 2759

Expected output:
870712883


Actual output:
141544393


Fixed submission (verdict: Accepted):


def answer(N:int,K:int) -> int:
    l = [i for i in range(N+1)]
    counter = 0
    for i in range(K,N+2):
        counter += i*(N - i + 1) + 1

    return counter % (10**9 + 7)



def main():
    N,K = map(int,input().split())
    
    print(answer(N,K))

if __name__ == '__main__':
   main()

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())
ans = 0
for i in range(K,N+2):
    ans += N*i -i**2 +i +1
print(ans)

Failing test case input:
141421 61260

Expected output:
970705737


Actual output:
282681972684504


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
ans = 0
for i in range(K,N+2):
    ans += N*i -i**2 +i +1
print(ans%(10**9 + 7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())

sum = 0
for i in range(k, n+2):
    min_sum = i * (i-1) / 2
    max_sum = i * (2 * n - i + 1) / 2
    sum += max_sum - min_sum + 1
print(sum % (10**9 + 7))


Failing test case input:
1100 1

Expected output:
222439801


Actual output:
222439801.0


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())

sum = 0
for i in range(k, n+2):
    min_sum = i * (i-1) / 2
    max_sum = i * (2 * n - i + 1) / 2
    sum += max_sum - min_sum + 1
print(int(sum % (10**9 + 7)))
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())
MOD = 1000000007
small = 0
large = 0
res = 0

for i in range(K-1):
  small += i
  large += N-i

for i in range(K, N+2):
  small += i-1
  large += N - i +1
  gap = large - small +1
  res += gap

print(res)


Failing test case input:
6048 4398

Expected output:
747717858


Actual output:
6747717900


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
MOD = 1000000007
small = 0
large = 0
res = 0

for i in range(K-1):
  small += i
  large += N-i

for i in range(K, N+2):
  small += i-1
  large += N - i +1
  gap = large - small +1
  res += gap

print(res%MOD)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k = list(map(int, input().split()))
ans = 0
sum_n = (n+1)*n/2

for i in range(k, n+2):
    tmp_b = (i)*(i-1)/2
    tmp_a = sum_n - (n-i+1)*(n-i)/2
    ans += tmp_a - tmp_b + 1
print(int(ans))

Failing test case input:
4096 2759

Expected output:
870712883


Actual output:
2870712897


Fixed submission (verdict: Accepted):
n,k = list(map(int, input().split()))
ans = 0
sum_n = (n+1)*n/2

for i in range(k, n+2):
    tmp_b = (i)*(i-1)/2
    tmp_a = sum_n - (n-i+1)*(n-i)/2
    ans += tmp_a - tmp_b + 1
print(int(ans)%(10**9+7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
M, K = map(int, input().split()) 

sum = 0

for j in range(K,M+2):
    temp = j*(M-j+1) + 1
    if temp > (10^9 + 7):
        temp = temp%(10^9 + 7)
    sum += temp


print(sum)

Failing test case input:
1110 310

Expected output:
185226712


Actual output:
8822


Fixed submission (verdict: Accepted):
M, K = map(int, input().split())

sum = 0

for j in range(K,M+2):
    temp = j*(M-j+1) + 1
    if temp > (10**9 + 7):
        temp = temp%(10**9 + 7)
    sum += temp
if sum > 10**9+7:
    sum = sum%(10**9+7)

print(sum)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
mod=100000007
n,k=list(map(int,input().split(" ")))
sum=0
for i in range(k,n+2):
  sum=sum+i*(n-i+1)+1
print(sum%mod)
  

Failing test case input:
141421 92523

Expected output:
864277115


Actual output:
56080444


Fixed submission (verdict: Accepted):
mod=1000000007
n,k=list(map(int,input().split(" ")))
sum=0
for i in range(k,n+2):
  sum=sum+i*(n-i+1)+1
print(sum%mod)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())
ans = 0
for i in range(K, N+2):
    ans += i * (N-i+1) + 1
print(ans%(10**7+7))

Failing test case input:
1100 1

Expected output:
222439801


Actual output:
2439647


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
ans = 0
for i in range(K, N+2):
    ans += i * (N-i+1) + 1
print(ans%(10**9+7))
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def sum_part(N, k):
  return k*(2*N-k+1)/2-k*(k-1)/2+1
  
N, K = map(int, input().split())
ans = 0
for k in range(K,N+2):
  ans += sum_part(N, k)
  
print(ans)

Failing test case input:
1010 31

Expected output:
171767541


Actual output:
171767541.0


Fixed submission (verdict: Accepted):
def sum_part(N, k):
  return k*(2*N-k+1)/2-k*(k-1)/2+1
  
N, K = map(int, input().split())
ans = 0
for k in range(K,N+2):
  ans += sum_part(N, k)
  
ans = ans % (10**9 + 7)
  
print(int(ans))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())

c = 0

for l in range(k, n+2):
    c += l*(2*n + 1 - l)/2 - l*(l - 1)/2 + 1

print(c%(10**9 + 7))

Failing test case input:
402106 200001

Expected output:
533363909


Actual output:
533363909.0


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())

c = 0

for l in range(k, n+2):
    c += l*(2*n + 1 - l)/2 - l*(l - 1)/2 + 1
    c %= 10**9+7

print(int(c%(10**9 + 7)))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())
q=0
for i in range(K,N+2):
    q+=N*i-i*i+i+1
print(q)

Failing test case input:
107814 81103

Expected output:
472847449


Actual output:
32112473072233


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
q=0
for i in range(K,N+2):
    q+=N*i-i*i+i+1
print(q%(10**9+7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())
ans=0
while k <= n+1:
  ans += k*(n-k+1)+1
  k+=1
print(ans)

Failing test case input:
141421 35623

Expected output:
220280457

Actual output:
396749223057700


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
ans=0
while k <= n+1:
  ans += k*(n-k+1)+1
  k+=1
print(ans%(10**9+7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = [int(i) for i in input().split()]
mod = 10**9 + 7
ans = 0

for i in range(k, n + 2):
    first = i * (i - 1) / 2
    final = (n * 2 - i + 1) * i / 2
    add = final - first + 1
    ans = (ans + add) % mod

print(ans)


Failing test case input:
1010 31

Expected output:
171767541


Actual output:
171767541.0


Fixed submission (verdict: Accepted):
n, k = [int(i) for i in input().split()]
mod = 10**9 + 7
ans = 0

for i in range(k, n + 2):
    first = i * (i - 1) / 2
    final = (n * 2 - i + 1) * i / 2
    add = final - first + 1
    ans = (ans + add) % mod

print(int(ans))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for k in range(K, N + 2):
    ans = (ans + k * (2 * N - k + 1) / 2 - (k - 1) * k / 2 + 1) % MOD
print(ans)


Failing test case input:
402106 200001

Expected output:
533363909


Actual output:
533363909.0


Fixed submission (verdict: Accepted):
N, K = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for k in range(K, N + 2):
    ans = (ans + k * (2 * N - k + 1) / 2 - (k - 1) * k / 2 + 1)
    ans %= MOD
print(int(ans))
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())

sum = 0
for i in range(N - K + 1):
    sum += K * (N - K + 1) + 1
print(sum % (pow(10, 9) + 7))


Failing test case input:
141421 60408

Expected output:
832536804


Actual output:
902489671


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())

sum = 0
for i in range(K, N + 2):
    sum += i * (N - i + 1) + 1
print(sum % (pow(10, 9) + 7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())

ans = 0
for i in range(K, N+2):
  ans += int(K * (N-K+1) + 1)
  
print(ans)

Failing test case input:
1000 1

Expected output:
167168001


Actual output:
1002001


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())

ans = 0
for i in range(K, N+2):
  ans += int(i * (N-i+1) + 1)
  
print(ans % ((10**9)+7))

Problem: p02708
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N,K = map(int,input().split())
counter = 0

for k in range(K,N+2): 
    counter += k*(N-k+1) + 1


print(counter)


Failing test case input:
107814 81103

Expected output:
472847449


Actual output:
32112473072233


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
counter = 0

for k in range(K,N+2): 
    counter += k*(N-k+1) + 1


print(counter%(pow(10,9)+7))

Problem: p02708
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n, k = map(int,input().split())

goukei = 0

for j in range(k,n+2):
    goukei += ((2*n-j)*(j+1)/2) - ((j-1)*j/2) + 1
    
print(goukei)

Failing test case input:
0010 9

Expected output:
31


Actual output:
31.0


Fixed submission (verdict: Accepted):
n, k = map(int,input().split())

goukei = 0
for j in range(k,n+2):
    goukei += ((2*n-j+1)*(j)/2) - ((j-1)*j/2) + 1
    
print(int(goukei % (1e9 + 7)))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())

mod = 10 ** 9 + 7
ans = 0

for i in range(K, N+2):
  ans += ((N + 1) * i - i ** 2 + 1) % mod
  
print(ans)

Failing test case input:
10232 4398

Expected output:
993609367


Actual output:
107993610116


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())

mod = 10 ** 9 + 7
ans = 0

for i in range(K, N+2):
  ans += ((N + 1) * i - i ** 2 + 1) % mod
  
print(ans % mod)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
MOD = 10 ** 9 + 7
n, k = map(int, input().split())

def calc(a):
  smallest = a * (a-1) / 2
  largest = smallest + a * (n-a+1)
  return largest - smallest + 1

ans = 0
for a in range(k, n+2):
  ans += calc(a)
  ans %= MOD
  
print(ans)


Failing test case input:
1010 47

Expected output:
171168805


Actual output:
171168805.0


Fixed submission (verdict: Accepted):
MOD = 10 ** 9 + 7
n, k = map(int, input().split())

def calc(a):
  smallest = a * (a-1) 
  largest = smallest + a * (n-a+1)
  return largest - smallest + 1

ans = 0
for a in range(k, n+2):
  ans += calc(a)
  ans %= MOD
  
print(ans)
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

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



iResult = 0  
for i in range(k, n + 2):

	
	
	
	
	
	
	iResult = iResult + i * (n - i + 1) + 1

print(iResult)


Failing test case input:
10232 8019

Expected output:
471392518


Actual output:
21471392665


Fixed submission (verdict: Accepted):

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



iResult = 0  
for i in range(k, n + 2):

	
	
	
	
	
	

	iResult = iResult + i * (n - i + 1) + 1

print(iResult % (10**9 + 7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())
ans = 0

for i in range(k, n+2):
  l = (i*(i-1))*0.5
  h = (i*(2*n-i+1))*0.5
  ans += (h-l+1)

print(int(ans))

Failing test case input:
200000 24052

Expected output:
297875149


Actual output:
1280143306836150


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
ans = 0

for i in range(k, n+2):
  l = (i*(i-1))*0.5
  h = (i*(2*n-i+1))*0.5
  ans += (h-l+1)

print(int(ans) % (10**9+7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k = map(int, input().split())
t = 0
for i in range(k, n+2):
  up = i*(2*n +1 -i)/2
  down = i*(i-1)/2
  s= up - down + 1 
  t += s
print(int(t))

Failing test case input:
4096 2759

Expected output:
870712883


Actual output:
2870712897


Fixed submission (verdict: Accepted):
n,k = map(int, input().split())
t = 0
for i in range(k, n+2):
  up = i*(2*n +1 -i)/2
  down = i*(i-1)/2
  s= up - down + 1 
  t += s
ans = t % (10**9 +7)
print(int(ans))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())
mod = 1000000007
ans = 0
for i in range(n-k+1):
  k_num = ( k*n - 2 * (k * (k-1) / 2) + 1 ) % mod
  ans += k_num
  ans %= mod

print(int(ans))



Failing test case input:
1001 142

Expected output:
158582711


Actual output:
105024060


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
mod = 1000000007
ans = 0

for i in range(k, n+2):
  i_num = ( i*n - ( i * (i-1) ) + 1 ) % mod
  ans += i_num
  ans %= mod

print(int(ans))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k = map(int,input().split())
ans = 0

for i in range(k,n+2):
    ans += (i*(n-i+1) + 1)

print(ans)

Failing test case input:
141421 79028

Expected output:
333950782


Actual output:
194314335310980


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
ans = 0

for i in range(k,n+2):
    ans += (i*(n-i+1) + 1)

ans %= 1000000007
print(ans)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())

ans = 0

for i in range(k, n+2):
    ans += int((i * (2 * n - i + 1) / 2) - (i * (i - 1) / 2) + 1)
print(ans)


Failing test case input:
4850 976

Expected output:
27110257


Actual output:
17027110376


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())

ans = 0

for i in range(k, n+2):
    ans += ((i * (2 * n - i + 1) / 2) - (i * (i - 1) / 2) + 1) % (10 ** 9 + 7)


print(int(ans % (10 ** 9 + 7)))
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())

c = 0

for l in range(k, n+2):
    c += l*(n + 1 - l + n)/2 - l*(l-1)/2 + 1

print(int(c%(10^9 + 7)))

Failing test case input:
1001 707

Expected output:
35146596


Actual output:
4


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())

c = 0

for l in range(k, n+2):
    c += l*(2*n + 1 - l)/2 - l*(l - 1)/2 + 1
    c %= 10**9+7

print(int(c%(10**9 + 7)))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K=map(int,input().split())
mod = (10**9) +7

def counts(n,k):
    if k==1:
        return N
    else:
        return k*N -k*(k-1) +1

total =0
for k in range(K,N+2):
    total += counts(N,k)

print(total%mod)

Failing test case input:
1000 1

Expected output:
167168001


Actual output:
167168000


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
mod = (10**9) +7

def counts(n,k):
    if k==1:
        return N+1
    else:
        return k*N - k*( k - 1 ) + 1

total =0
for k in range(K,N+2):
    total += int(counts(N,k))

print(total%mod)

Problem: p02708
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
a,b=map(int,input().split(" "))
print(a,b)
min=0
max=0
count=0

for i in range(b,a+2):
    min = int((i-1)*i/2)
    max = int((2*a-i+1)*i/2)
    count+=max-min+1
print(count%1000000007)

Failing test case input:
206306 200001

Expected output:
7746530


Actual output:
206306 200001
7746530


Fixed submission (verdict: Accepted):
a,b=map(int,input().split(" "))

min=0
max=0
count=0

for i in range(b,a+2):
    min = int((i-1)*i/2)
    max = int((2*a-i+1)*i/2)
    count+=max-min+1
print(count%1000000007)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b = map(int, input().split())
mod = pow(10,9) + 7

def cal(a,i):
  min = i*(i-1)/2
  max = a*(a+1)/2 - (a-i)*(a-i+1)/2
  return max - min + 1

count = 0
for i in range(a-b+2):
  count += cal(a,i+b)
print(count % mod)


Failing test case input:
0110 47

Expected output:
141505


Actual output:
141505.0


Fixed submission (verdict: Accepted):
a, b = map(int, input().split())
mod = pow(10,9) + 7

def cal(a,i):
  min = i*(i-1)/2
  max = a*(a-1)/2 - (a-i)*(a-i-1)/2
  return max - min + 1

count = 0
for i in range(a-b+2):
  count += cal(a+1,i+b)
print(int(count % mod))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split(' '))
count = 0
for n in range(K, N+2):
    count += n*(N-n+1) + 1

print(count)

Failing test case input:
223214 200001

Expected output:
534704743


Actual output:
55976535096575


Fixed submission (verdict: Accepted):
N, K = map(int, input().split(' '))
count = 0
for n in range(K, N+2):
    count += n*(N-n+1) + 1
count %= 1000000007
print(count)
Problem: p02708
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n, k = map(int, input().split())

mod = 10 * 9 + 7
ans = 0

for i in range(k, n+2):
  ans += int(n*(n+1)/2 - (n-i)*(n - i + 1)/2 - (i-1)*i/2 + 1)

print(ans%mod)

Failing test case input:
223214 200001

Expected output:
534704743


Actual output:
96


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
 
mod = 10 ** 9 + 7
ans = 0
 
for i in range(k, n+2):
  ans += int(n*(n+1)/2 - (n-i)*(n - i + 1)/2 - (i-1)*i/2 + 1)
 
print(ans%mod)

Problem: p02708
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N, K = map(int, input().split())
mod = 10 ** 9 + 7

ans = 0
min_x, max_x = 0, N
for i in range(1, N+1):
    min_x += i
    max_x += N-i
    if i+1 < K: continue
    ans += max_x - min_x + 1
    ans %= mod

print(ans)


Failing test case input:
0101 1

Expected output:
176953


Actual output:
176851


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
mod = 10 ** 9 + 7

ans = 0
min_x, max_x = 0, 0
for i in range(N+1):
    min_x += i
    max_x += N-i
    if i+1 < K: continue
    ans += max_x - min_x + 1
    ans %= mod

print(ans)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,K = list(map(int,input().split()))

ans = 0
for k in range(K,n+2):
  
  ans += n*k+k-k**2+1
print(ans)

Failing test case input:
206306 200001

Expected output:
7746530


Actual output:
4019007774663


Fixed submission (verdict: Accepted):
n,K = list(map(int,input().split()))
mod = 10**9+7
ans = 0
for k in range(K,n+2):
  
  
  
  
  
  ans += n*k - k**2 + k  + 1
print(ans%mod)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=list(map(int,input().split()))

result = 0
for i in range(k,n+2):
  result += n*i-i*i+i+1


print(result)

Failing test case input:
223214 200001

Expected output:
534704743


Actual output:
55976535096575


Fixed submission (verdict: Accepted):
n,k=list(map(int,input().split()))

result = 0
for i in range(k,n+2):
  result += n*i-i*i+i+1


print(result%1000000007)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = map(int,input().split())
count = 0
for i in range(K,N+2):
    count = count + i*(N-i+1)+1
print(count)

Failing test case input:
141421 35623

Expected output:
220280457

Actual output:
396749223057700


Fixed submission (verdict: Accepted):
N,K = map(int,input().split()) 
count = 0
for i in range(K,N+2):
    count = count + i*(N-i+1)+1
print(count %  (10**9+7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())
ans=0
for i in range(k,n+2):
	miin=i*(i-1)/2
	maax=i*(2*n-i+1)/2
	ans+=maax-miin+1
print(int(ans)%10**9+7)

Failing test case input:
200000 24052

Expected output:
297875149


Actual output:
306836157


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
ans=0
for i in range(k,n+2):
	miin=i*(i-1)/2
	maax=i*(2*n-i+1)/2
	ans+=maax-miin+1
print(int(ans)%(10**9+7))
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int,input().split())
ans = sum([i*N-i*(i-1)+1 for i in range(K,N+2)])
print(ans)

Failing test case input:
141421 60408

Expected output:
832536804


Actual output:
286858834544810


Fixed submission (verdict: Accepted):
N, K = map(int,input().split())
ans = sum([i*N-i*(i-1)+1 for i in range(K,N+2)])
ans%= 1000000007
print(ans)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())
sum=0
for i in range(k,n+2):
    sum=sum+((2*n-i+1)*i)/2-(i*(i-1))/2+1
print(int(sum))

Failing test case input:
141421 118259

Expected output:
52000643


Actual output:
33797052237222


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
sum=0
M=1000000007
for i in range(k,n+2):
    sum=(2*n-i+1)*i/2-(i*(i-1))/2+1+sum
    sum=sum%M
print(int(sum)%M)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())
ans=0
aaa=0
for i in range(k,n+2):
	miin=i*(i-1)/2
	maax=i*(2*n-i+1)/2
	aaa=maax-miin+1
	ans+=aaa
print(int(ans))

Failing test case input:
206306 200001

Expected output:
7746530


Actual output:
4019007774663


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
ans=0
for i in range(k,n+2):
	miin=i*(i-1)/2
	maax=i*(2*n-i+1)/2
	ans+=maax-miin+1
print(int(ans)%(10**9+7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k = (int(x) for x in input().split())
M = 10**9+7
s = 0

for i in range(n+2-k):
    ad = 1 + (n+1-k-i)*(k+i)
    s += ad
    if s >= M:
        s -= M
        
print(s)

Failing test case input:
141421 118259

Expected output:
52000643


Actual output:
10633052075074


Fixed submission (verdict: Accepted):
n,k = (int(x) for x in input().split())
M = 10**9+7
s = 0

for i in range(n+2-k):
    ad = 1 + (n+1-k-i)*(k+i)
    s += ad


        
print(s%M)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())
ans = 0
mod = 10 ** 9 + 7
l=1
r=n
for i in range(k):
  ans += (r - l + 1) % mod
  ans %= mod
  l += i + 2
  l %= mod
  r += n - i - 1
  r %= mod
print(ans)

Failing test case input:
1000 692

Expected output:
38060870


Actual output:
129081182


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
ans = 0
mod = 10 ** 9 + 7
l=0
r=n
for i in range(n+1):
  if i >= k-1:
    ans += (r - l + 1) % mod
    ans %= mod
  l += i + 1
  l %= mod
  r += n - i - 1
  r %= mod
print(ans)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = map(int,input().split())
number = N+1-K+1
W = 0
for i in range(number):
    min = (K+i)*(K+i-1)/2
    max = (K+i)*(2*N-K-i+1)/2
    W += (max-min+1)
print(int(W))

Failing test case input:
4096 2759

Expected output:
870712883


Actual output:
2870712897


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
number = N+1-K+1
W = 0
for i in range(number):
    min = (K+i)*(K+i-1)/2
    max = (K+i)*(2*N-K-i+1)/2
    W += (max-min+1)
w = W % (1000000007)
print(int(w))
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K=map(int,input().split())
ans=0
for k in range(K,N+2):
  ans+=k*(k-1)
print(ans)

Failing test case input:
200000 24052

Expected output:
297875149


Actual output:
2662069228339800


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
ans=0
MOD=10**9+7
for k in range(K,N+2):
  ans+= ((k*(2*N+1-k)
print(ans%MOD)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = list(map(int, input().split()))
MOD = 1e9 + 7
ans = 0
for k in range(K, N + 2):
    ans = (ans + k * (2 * N - k + 1) / 2 - (k - 1) * k / 2 + 1) % MOD
print(ans)


Failing test case input:
1110 31

Expected output:
228048841


Actual output:
228048841.0


Fixed submission (verdict: Accepted):
N, K = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for k in range(K, N + 2):
    ans = (ans + k * (2 * N - k + 1) / 2 - (k - 1) * k / 2 + 1)
    ans %= MOD
print(int(ans))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = [int(i) for i in input().split()]
res = 0

for i in range(K, N + 2) :
	sum_lasti = i * (2 * N + 1 - i)/2 
	sum_firsti = ( i * i - i )/ 2 
	
	res += sum_lasti - sum_firsti + 1

print(res%1000000007)

Failing test case input:
1011 5

Expected output:
172729704


Actual output:
172729704.0


Fixed submission (verdict: Accepted):
N, K = [int(i) for i in input().split()]
res = 0

for i in range(K, N + 2) :
	sum_lasti = i * (2 * N + 1 - i)/2 
	sum_firsti = ( i * i - i )/ 2 
	
	res += sum_lasti - sum_firsti + 1

print(int(res%1000000007))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b=(int(x) for x in input().split())
z=0
for i in range(b,a+2):
  z=(z+(a-i+1)*i+1)%(1e9+7)
print(z)

Failing test case input:
1010 31

Expected output:
171767541


Actual output:
171767541.0


Fixed submission (verdict: Accepted):
a,b=(int(x) for x in input().split())
z=0
for i in range(b,a+2):
  z=(z+(a-i+1)*i+1)%int(1e9+7)
print(z)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

N,K=map(int,input().split())








def counts(n,k):
    if k==1:
        return N
    else:
        return k*N -k*(k-1) +1

total =0

for k in range(K,N+2):
    total += counts(N,k)


print(total)

Failing test case input:
10163 4398

Expected output:
72432465


Actual output:
105072433200


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
mod = (10**9) +7

def counts(n,k):
    if k==1:
        return N+1
    else:
        return k*N - k*( k - 1 ) + 1

total =0
for k in range(K,N+2):
    total += int(counts(N,k))

print(total%mod)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = map(int,input().split())
num2 = 0
for i in range(K,N+2): 
    num2 += i*N-i*(i-1)/2-i*(i-1)/2+1
print(num2%(10**9+7))

Failing test case input:
1010 24

Expected output:
171953496


Actual output:
171953496.0


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
num2 = 0
for i in range(K,N+2): 
    num2 += i*N-i*(i-1)/2-i*(i-1)/2+1
print(int(num2%(10**9+7)))
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = map(int,input().split())
a =0
for i in range(K,N+2):
    a = a + ((N+N-i+1)*i/2-(i-1)*(i)/2+1)
print(int(a%10**9+7))

Failing test case input:
1110 47

Expected output:
227388505


Actual output:
227388512


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
a =0
for i in range(K,N+2):
    a = a + ((N+N-i+1)*i/2-(i-1)*(i)/2+1)
print(int(a % (10**9+7)))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K=map(int,input().split())
num_list=[x for x in range(3+1)]
answer=0
count=N-K+2
for y in range(K,N+2):
    min=sum(num_list[:y])
    max=sum(num_list[-y:])
    answer+=max-min+1

print(answer)


Failing test case input:
1001 295

Expected output:
132731474


Actual output:
708


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
answer=0
count=N-K+2
for y in range(K,N+2):
    min=int(y*(0+y-1)/2)
    max=int(y*(N-y+1+N)/2)
    answer+=(max+1-min)
print(answer%(10**9+7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())

ans = 0
for i in range(K, N+2):
  ans += int(i * (N-i+1) + 1)
  
print(ans)

Failing test case input:
10232 9261

Expected output:
532378949


Actual output:
4532378977


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())

ans = 0
for i in range(K, N+2):
  ans += int(i * (N-i+1) + 1)
  
print(ans % ((10**9)+7))

Problem: p02708
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n, k = map(int, input().split())
n += 1
sum_n = sum(range(n))
ans = 0
for i in range(k, n+1):
    mi = i*(i-1) / 2
    ma = sum_n - ((n-i)*(n-i-1) / 2)
    ans += ma - mi + 1

print(ans%(7+10**9))

Failing test case input:
1000 142

Expected output:
158091220


Actual output:
158091220.0


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
n += 1
sum_n = sum(range(n))
ans = 0
for i in range(k, n+1):
    mi = i*(i-1) / 2
    ma = sum_n - ((n-i)*(n-i-1) / 2)
    ans += ma - mi + 1

print(int(ans%(7+10**9)))

Problem: p02708
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N,K=map(int,input().split())
a=0
for i in range(K,N+2):
  minn=0
  maxx=0
  minn=int((1/2)*(i-1)*i)
  maxx=int(((1/2)*N*(N+1))-((1/2)*(N-i)*(N-i+1)))
  
  a+=maxx-minn+1
  
print(a)

Failing test case input:
6048 4398

Expected output:
747717858


Actual output:
6747717900


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
a=0
for i in range(K,N+2):
  minn=0
  maxx=0
  minn=int((1/2)*(i-1)*i)
  maxx=int(((1/2)*N*(N+1))-((1/2)*(N-i)*(N-i+1)))
  
  a+=maxx-minn+1
  a=int(a%(pow(10,9)+7))
 
  
print(a)
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k = list(map(int, input().split()))
ans = 0
sum_n = (n+1)*n/2

for i in range(k, n+2):
    tmp_b = (i)*(i-1)/2
    tmp_a = sum_n - (n-i+1)*(n-i)/2
    ans += tmp_a - tmp_b + 1
print(ans)

Failing test case input:
223214 200001

Expected output:
534704743


Actual output:
55976535096575.0


Fixed submission (verdict: Accepted):
n,k = list(map(int, input().split()))
ans = 0
sum_n = (n+1)*n/2

for i in range(k, n+2):
    tmp_b = (i)*(i-1)/2
    tmp_a = sum_n - (n-i+1)*(n-i)/2
    ans += tmp_a - tmp_b + 1
print(int(ans)%(10**9+7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
list = input().split()
N = int(list[0])
K = int(list[1])
i = K
s = 0

def sum(a,b):
    i=0
    i = (a + b)*(b - a + 1)/2
    return i

while i <= N + 1:
    
    s = s + sum(N-i+1,N) - sum(0,i-1) + 1
    i += 1
print(s)

Failing test case input:
200000 46420

Expected output:
365138950


Actual output:
1151216373197462.0


Fixed submission (verdict: Accepted):
list = input().split()
N = int(list[0])
K = int(list[1])
i = K
s = 0

def sum(a,b):
    i=0
    i = (a + b)*(b - a + 1)/2
    return i

while i <= N + 1:
    
    s = s + sum(N-i+1,N) - sum(0,i-1) + 1
    i += 1
print(int(s % (10**9+7)))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int,input().split())
ans = 0
for i in range(K,N+2):
  ans = ans +(2*N+3-i)*i/2-i*(i+1)/2+1
print(int(ans))


Failing test case input:
10232 4398

Expected output:
993609367


Actual output:
107993610116


Fixed submission (verdict: Accepted):
import math
N, K = map(int,input().split())
ans = 0
for i in range(K,N+2):
  ans = ans +(2*N+3-i)*i/2-i*(i+1)/2+1
print(int(ans%(pow(10,9)+7)))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):



def solve(*args: str) -> str:
    n, k = map(int, args[0].split())
    ret = 1
    for i in range(k, n+2):
        ret += k*(k+1)

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Failing test case input:
1110 770

Expected output:
51508392


Actual output:
203035141


Fixed submission (verdict: Accepted):



def solve(*args: str) -> str:
    n, k = map(int, args[0].split())
    ret = 1
    p = 10**9+7
    for i in range(k, n+1):
        ret += (n+(n-i+1))*i
        ret -= (i*(i-1)
        ret %= p

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())
a = [i for i in range(n+1)]
mod = 10**9+7
ans = 0
for i in range(k, n+1):
  L = i * (i - 1) / 2
  R = n * i - i * (i - 1) / 2
  ans += R - L + 1
print(ans)

Failing test case input:
1000 230

Expected output:
144835692


Actual output:
144835691.0


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
a = [i for i in range(n+1)]
mod = 10**9+7
ans = 0
for i in range(k, n+2):
  L = i * (i - 1) / 2
  R = n * i - i * (i - 1) / 2
  ans += R - L + 1
  ans %= mod
print(int(ans))
Problem: p02708
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N, K = map(int, input().split())
ans = 0
for i in range(K, N+1):
  ans += i*(N-i+1)+1
print(ans)

Failing test case input:
1011 1

Expected output:
172739798


Actual output:
172739797


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
ans = 0
for i in range(K, N+2):
  ans += i*(N-i+1)+1
print(ans % (10**9+7))

Problem: p02708
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N, K = map(int, input().split())

res = 0

for k in range(K, N+2):
    res += k * (N - k + 1) + 1
    
print(res)

Failing test case input:
141421 118259

Expected output:
52000643


Actual output:
33797052237222


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
mod = 10**9 + 7

res = 0

for k in range(K, N+2):
    res += k * (N - k + 1) + 1

res = res % mod

print(res)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = map(int,input().split())
ans = 0
temp_max = N
temp_min = 0
for i in range(2,N+2):
  temp_max += N-i+1
  temp_min += i-1
  if i >= K:
    ans += (temp_max - temp_min + 1)
print(ans%(10**9+7))

Failing test case input:
0101 1

Expected output:
176953


Actual output:
176851


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
ans = 0
temp_max = 0
temp_min = 0
for i in range(1,N+2):
  temp_max += N-i+1
  temp_min += i-1
  if i  >= K:
    ans += (temp_max - temp_min + 1)
print(ans%(10**9+7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import itertools
def main():
    N,K = map(int, input().split())
    MOD = pow(10,9)+7

    
    
    
    
    
    
    
    
    

    ans  = 0
    for m in range(K,N+2):
        ans += (N-m+1)*m%MOD
    print(ans%MOD)


main()


Failing test case input:
1000 410

Expected output:
106128432


Actual output:
106127840


Fixed submission (verdict: Accepted):
import itertools
def main():
    N,K = map(int, input().split())
    MOD = pow(10,9)+7

    
    
    
    
    
    
    
    
    

    ans  = 0
    for m in range(K,N+2):
        ans += ((N-m+1)*m+1)%MOD
    print(ans%MOD)


main()

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())

ans = 0
for i in range(k, n+1):
    ans += i * (n - i + 1) + 1
    ans %= 1000000007

print(ans)

Failing test case input:
1101 598

Expected output:
97439245


Actual output:
97439244


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())

ans = 0
for i in range(k, n+2):
    ans += i * (n - i + 1) + 1
    ans %= 1000000007

print(ans)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m = map(int, input().split())
ans = 0
for i in range(m,n+2):
    ans+=(n-i+1)*i+1
print(ans)

Failing test case input:
141421 60408

Expected output:
832536804


Actual output:
286858834544810


Fixed submission (verdict: Accepted):
n,m = map(int, input().split())
ans = 0
for i in range(m,n+2):
    ans+=(n-i+1)*i+1
    ans = ans%(10**9+7)
print(ans)
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
MOD = 10 ** 9 + 7

def calc(a):
    smallest = a * (a-1) 
    largest = smallest + a * (n-a+1)
    return largest - smallest + 1 

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

ans = 0
for a in range(k, n+2):
    ans += calc(a)
    ans % MOD

print(ans)

 



Failing test case input:
223214 200001

Expected output:
534704743


Actual output:
55976535096575


Fixed submission (verdict: Accepted):
MOD = 10 ** 9 + 7

def calc(a):
    smallest = a * (a-1) 
    largest = smallest + a * (n-a+1)
    return largest - smallest + 1 

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

ans = 0
for a in range(k, n+2):
    ans += calc(a)
    ans %= MOD

print(ans)

Problem: p02708
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n,k = map(int,input().split())
count = 0
for i in range(k,n+1):
  count += i*(2*n-i+1)
print(count % (10**9+7))

Failing test case input:
0110 47

Expected output:
141505


Actual output:
694080


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
count = 0
for i in range(k,n+2):
  count += i*(n-i+1) +1
print(count % (10**9+7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())
cnt = []
minimum = sum([i for i in range(K-1)])
maximum = sum([i for i in range(N-(K-2), N+1)])

for n in range(K-1, N+1):
    minimum += n
    maximum += (N-n)
    diff = maximum - minimum +1
    cnt.append(diff)
print(sum(cnt))

Failing test case input:
141421 118259

Expected output:
52000643


Actual output:
33797052237222


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
cnt = []
minimum = sum([i for i in range(K-1)])
maximum = sum([i for i in range(N-(K-2), N+1)])

for n in range(K-1, N+1):
    minimum += n
    maximum += (N-n)
    diff = maximum - minimum +1
    cnt.append(diff)
ans = sum(cnt) % (10**9+7)
print(ans)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())

a = 0

for i in range(k, n+2):
    a += n*k + k - k**2 + 1

ans = a % (10**9+7)
print(ans)

Failing test case input:
1001 295

Expected output:
132731474


Actual output:
147664728


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())

a = 0
for i in range(k, n+2):
    a += (n*i + i - i**2 + 1)

ans = a % (10**9+7)
print(ans)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())


def sub_sum(l, r):
    return (l + r) * (r - l + 1) / 2


ans = 0

for i in range(K, N+2):
    l = sub_sum(0, i-1)
    r = sub_sum(N-i+1, N)
    ans += r - l + 1

print(int(ans))


Failing test case input:
3981 131

Expected output:
490150888


Actual output:
10490150958


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())


def sub_sum(l, r):
    return (l + r) * (r - l + 1) / 2


ans = 0

for i in range(K, N+2):
    l = sub_sum(0, i-1)
    r = sub_sum(N-i+1, N)
    ans += r - l + 1

ans = ans % (10**9+7)

print(int(ans))
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K=map(int,input().split())
mod = (10**9) +7

def counts(n,k):
    if k==1:
        return N
    else:
        return k*N -k*(k-1) +1

total =0
for k in range(K,N+2):
    total += int(counts(N,k))

print(total%mod)

Failing test case input:
0101 1

Expected output:
176953


Actual output:
176952


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
mod = (10**9) +7

def counts(n,k):
    if k==1:
        return N+1
    else:
        return k*N - k*( k - 1 ) + 1

total =0
for k in range(K,N+2):
    total += int(counts(N,k))

print(total%mod)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K=map(int,input().split())
num_list=[x for x in range(3+1)]
answer=0
count=N-K+2
for y in range(K,N+2):
    min=sum(num_list[:y])
    max=sum(num_list[-y:])
    answer+=max-min+1

print(answer%(10**9+7))


Failing test case input:
1010 230

Expected output:
149632572


Actual output:
782


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
answer=0
count=N-K+2
for y in range(K,N+2):
    min=int(y*(0+y-1)/2)
    max=int(y*(N-y+1+N)/2)
    answer+=(max+1-min)
print(answer%(10**9+7))

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())

s=0
for i in range(k,n+2):
    s+=(n-i+1)*i+1
    
    
print(s)

Failing test case input:
206306 200001

Expected output:
7746530


Actual output:
4019007774663


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())

s=0
for i in range(k,n+2):
    s+=i*(n-i+1)+1
    
print(s%1000000007)

Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b = map(int, input().split())
mod = pow(10,9) + 7

def cal(a,i):
  min = i*(i-1)/2
  max = a*(a-1)/2 - (a-i)*(a-i-1)/2
  return max - min + 1

count = 0
for i in range(a-b+2):
  count += cal(a+1,i+b)
print(count % mod)

Failing test case input:
200000 24052

Expected output:
297875149


Actual output:
297875149.0


Fixed submission (verdict: Accepted):
a, b = map(int, input().split())
mod = pow(10,9) + 7

def cal(a,i):
  min = i*(i-1)/2
  max = a*(a-1)/2 - (a-i)*(a-i-1)/2
  return max - min + 1

count = 0
for i in range(a-b+2):
  count += cal(a+1,i+b)
print(int(count % mod))

Problem: p02708
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n,k = map(int,input().split())
ans = 0
for i in range(k,n+2):
    ans += (n-i+1)*i+1
print(ans)

Failing test case input:
402106 200001

Expected output:
533363909


Actual output:
5460622571588263


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
ans = 0
for i in range(k,n+2):
    ans += (n-i+1)*i+1
print(ans%1000000007)
Problem: p02708
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
if __name__ == '__main__':
    a,b= map(int,input().split())
    maxnum =0
    minnum =0

    for i in range(0,b):
        minnum+=i
    for i in range(0,b):
        maxnum+=(a-i)
    ans = maxnum-minnum
    ans = int(ans*(ans+1)/2)

    print(ans)


Failing test case input:
0110 47

Expected output:
141505


Actual output:
4525536


Fixed submission (verdict: Accepted):
if __name__ == '__main__':
    a,b= map(int,input().split())
    maxnum =0
    minnum =0
    diff = 10**9 +7
    ans = 0

    for i in range(b,a+2):
        max = (i * (2*a+1-i)) / 2
        min = (i* (i - 1) / 2)
        ans += max-min+1
        ans = ans % diff
    print(int(ans))
Problem: p03555
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
C1 = input()
C2 = input()

if C1[0] == C2[2] and\
    C1[1] == C2[1] and\
    C1[2] == C2[0]:
        print("Yes")
else:
    print("No")

Failing test case input:
pot
top

Expected output:
YES

Actual output:
Yes


Fixed submission (verdict: Accepted):
C1 = input()
C2 = input()

if C1[0] == C2[2] and\
    C1[1] == C2[1] and\
    C1[2] == C2[0]:
        print("YES")
else:
    print("NO")

Problem: p03555
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
data1 = input()
data2 = input()

count = len(data1) -1
sw = 0
i = 0
j = len(data2)-1
while i <= count:
    if data1[i] == data2[j]:
        sw += 1
    i += 1
    j -= 1
if sw == len(data1):
    print("Yes")
else:
    print("No")

Failing test case input:
{cf
nhg

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
data1 = input()
data2 = input()

count = 3 -1
sw = 0
i = 0
j = len(data2)-1
while i <= count:
    if data1[i] == data2[j]:
        sw += 1
    i += 1
    j -= 1
if sw == 3:
    print("YES")
else:
    print("NO")

Problem: p03555
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
C1 = input()
C2 = input()
if(C1[0]==C2[2] and C2[0]==C1[2]):
  print('YES')
else:
  print('NO')

Failing test case input:
tab
bet

Expected output:
NO

Actual output:
YES


Fixed submission (verdict: Accepted):
C1 = input()
C2 = input()
if(C1[0]==C2[2] and C2[0]==C1[2] and C1[1]==C2[1]):
  print('YES')
else:
  print('NO')

Problem: p03555
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
x=input()
y=input()
x1=list(x)
x2=list(y)

if x[0]==y[2] and x[1]==y[1] and x[2]==y[0]:
  print('Yes')
else:
  print('NO')


Failing test case input:
spp
pps

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
x=input()
y=input()
x1=list(x)
x2=list(y)

if x1[0]==x2[2] and x1[1]==x2[1] and x1[2]==x2[0]:
  print('YES')
else:
  print('NO')

Problem: p03555
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
c1 = list(input())
c2 = list(input())

if c1[0] == c2[2] and c1[1] == c2[1] and c1[2] == c2[0]:
    print("Yes")
else:
    print("No")
    



Failing test case input:
ruo
ssp

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
c1 = list(input())
c2 = list(input())

if (c1[0] == c2[2]) and (c1[1] == c2[1]) and (c1[2] == c2[0]):
    print("YES")
else:
    print("NO")

Problem: p03555
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
C11C12C13=input()
C21C22C23=input()
if (C11C12C13[0]==C21C22C23[2] and C11C12C13[2]==C21C22C23[0] and C11C12C13[1]==C21C22C23[1]):
    print("Yes")
else:
    print("No")

Failing test case input:
atb
bet

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
C11C12C13=input()
C21C22C23=input()
if (C11C12C13[0]==C21C22C23[2] and C11C12C13[2]==C21C22C23[0] and C11C12C13[1]==C21C22C23[1]):
    print("YES")
else:
    print("NO")