Buggy python submission (verdict: Time Limit Exceeded):
line=input()
n,k=map(int,line.split())
s=list(range(n+1))
sums=0
while k!=(n+2):
     mini=sum(list(s[0:k]))
     maxi=sum(list(s[(-k):]))
     sums+=(maxi-mini+1)
     sums=sums%((10**9)+7)
     k+=1
#jojo=(sums%)
print(sums)

Fixed submission:
line=input()
n,k=map(int,line.split())
sums=0
while k!=(n+2):
     if k==1:
          mini=0
     if k>=2:
          mini=(((k)*(k-1))/2)#%((10**9)+7)
     maxi=( (((n+1)*(n)) - ((n+1-k)*(n-k)) )/2  )#%((10**9)+7)
     sums+=(maxi-mini+1)
     sums=sums%((10**9)+7)
     k+=1
print(int(sums))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
 
line=input()
n,k=map(int,line.split())
s=set(list(range(n+1)))
sums=list()
while k!=(n+2):
     koko=list()
     sub=list(itertools.combinations(s,k))
     #print(sub)
     for val in sub:
          soso=0
          for i in val:
               soso=(soso%((10**9)+7))+((i+0.2424)%((10**9)+7))
               #soso=(soso%((10**9)+7))
          if soso not in sums:
               sums.append(soso)
               #soso=(soso%((10**9)+7))
          
               
          
     
     
     
     k+=1
#jojo=(%((10**9)+7))
print((len(sums)))

Fixed submission:
line=input()
n,k=map(int,line.split())
sums=0
while k!=(n+2):
     if k==1:
          mini=0
     if k>=2:
          mini=(((k)*(k-1))/2)#%((10**9)+7)
     maxi=( (((n+1)*(n)) - ((n+1-k)*(n-k)) )/2  )#%((10**9)+7)
     sums+=(maxi-mini+1)
     sums=sums%((10**9)+7)
     k+=1
print(int(sums))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

line=input()
n,k=map(int,line.split())
s=set(list(range(n+1)))
sums=list()
while k!=(n+2):
     koko=list()
     sub=list(itertools.combinations(s,k))
     #print(sub)
     for val in sub:
          soso=0
          for i in val:
               soso=(soso%((10**9)+7))+((i+(10**100))%((10**9)+7))
               #soso=(soso%((10**9)+7))
          if soso not in sums:
               sums.append(soso)
               #soso=(soso%((10**9)+7))
          
               
          
     
     
     
     k+=1
#jojo=(%((10**9)+7))
print((len(sums)))


Fixed submission:
line=input()
n,k=map(int,line.split())
sums=0
while k!=(n+2):
     if k==1:
          mini=0
     if k>=2:
          mini=(((k)*(k-1))/2)#%((10**9)+7)
     maxi=( (((n+1)*(n)) - ((n+1-k)*(n-k)) )/2  )#%((10**9)+7)
     sums+=(maxi-mini+1)
     sums=sums%((10**9)+7)
     k+=1
print(int(sums))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

line=input()
n,k=map(int,line.split())
s=set(list(range(n+1)))
sums=list()
while k!=(n+2):
     koko=list()
     sub=list(itertools.combinations(s,k))
     #print(sub)
     for val in sub:
          soso=0
          for i in val:
               soso+=(i+(10**100))
               soso=(soso%((10**9)+7))
          if soso not in sums:
               #soso=(soso%((10**9)+7))
               sums.append(soso)
          
               
          
     
     
     
     k+=1
#jojo=(%((10**9)+7))
print((len(sums)))


Fixed submission:
line=input()
n,k=map(int,line.split())
sums=0
while k!=(n+2):
     if k==1:
          mini=0
     if k>=2:
          mini=(((k)*(k-1))/2)#%((10**9)+7)
     maxi=( (((n+1)*(n)) - ((n+1-k)*(n-k)) )/2  )#%((10**9)+7)
     sums+=(maxi-mini+1)
     sums=sums%((10**9)+7)
     k+=1
print(int(sums))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

line=input()
n,k=map(int,line.split())
s=set(list(range(n+1)))
sums=list()
while k!=(n+2):
     koko=list()
     sub=list(itertools.combinations(s,k))
     #print(sub)
     for val in sub:
          soso=0
          for i in val:
               soso+=(i+(10**100))
          if soso not in sums:
               sums.append(soso)
          
               
          
     
     
     
     k+=1
print(len(sums))


Fixed submission:
line=input()
n,k=map(int,line.split())
sums=0
while k!=(n+2):
     if k==1:
          mini=0
     if k>=2:
          mini=(((k)*(k-1))/2)#%((10**9)+7)
     maxi=( (((n+1)*(n)) - ((n+1-k)*(n-k)) )/2  )#%((10**9)+7)
     sums+=(maxi-mini+1)
     sums=sums%((10**9)+7)
     k+=1
print(int(sums))