Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02720 (python)

Fixed submission:
N = int(input())
R=[["1","2","3","4","5","6","7","8","9"]]
count=9
temp=[]
for i in range(N):
  if count>=N:
    break
  else:
    temp=[]
    for r in R[i]:
      if r[-1]=="9":
        temp.append(str(r)+str(int(r[-1])-1))
        temp.append(str(r)+str(int(r[-1])))
      elif r[-1]=="0":
        temp.append(str(r)+str(int(r[-1])))
        temp.append(str(r)+str(int(r[-1])+1))
      else:
        temp.append(str(r)+str(int(r[-1])-1))
        temp.append(str(r)+str(int(r[-1])))
        temp.append(str(r)+str(int(r[-1])+1))
    R.append(temp)
    count+=len(temp)
N=N-(count-len(temp))
print(R[-1][N-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
R=[["1","2","3","4","5","6","7","8","9"]]
count=9
for i in range(N):
  if count>=N:
    break
  else:
    temp=[]
    for r in R[i]:
      if r[-1]=="9":
        temp.append(str(r)+str(int(r[-1])-1))
        temp.append(str(r)+str(int(r[-1])))
      elif r[-1]=="0":
        temp.append(str(r)+str(int(r[-1])))
        temp.append(str(r)+str(int(r[-1])+1))
      else:
        temp.append(str(r)+str(int(r[-1])-1))
        temp.append(str(r)+str(int(r[-1])))
        temp.append(str(r)+str(int(r[-1])+1))
    R.append(temp)
    count+=len(temp)
N=N-(count-len(temp))
print(R[-1][N-1])
Problem p02732 (python)

Fixed submission:
from collections import Counter
N = int(input())
B = [int(x) for x in input().split()]
A=Counter(B)
V, C = zip(*A.most_common())
count=0
i=0
dict={}
for x in C:
  count+=x*(x-1)/2
  dict[V[i]]=x
  i+=1
for x in B:
  ans=count-dict[x]+1
  print(int(ans))

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
B = [int(x) for x in input().split()]
A=Counter(B)
V, C = zip(*A.most_common())
count=0
i=0
dict={}
for x in C:
  if x==1:
    break
  count+=x*(x-1)/2
  dict[V[i]]=x
  i+=1
for x in B:
  ans=count-dict[x]+1
  print(int(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(x) for x in input().split()]
B = A
count=0
while len(B)!=0:
  b=B[1]
  C=[i for i in B if i != b]
  count+=(len(B)-len(C))*(len(B)-len(C)-1)/2
  B=C
ans=list(map(lambda x: count-(A.count(x)-1),A))
for x in ans:
  print(int(x))
Problem p02845 (python)

Fixed submission:
N = int(input()) 
a = list(map(int, input().split()))
b = [-1, -1, -1]
x=1
for i in range(N):
  x = x*b.count(a[i]-1) % 1000000007
  if b[0]==(a[i]-1):
    b[0]+=1
  elif b[1]==(a[i]-1):
    b[1]+=1
  else:
    b[2]+=1
print(x)

Buggy submission (verdict: Runtime Error):
N = int(input()) 
a = list(map(int, input().split()))
a[0:0] = [-1, -1, -1]
x=1
for i in range(3,N+2):
  b=a[0:i-1]
  x = x*((b.count(a[i]-1)-b.count(a[i])))
  if x=0:x=1
x = x % 1000000007
print(x)
Problem p03047 (python)

Fixed submission:
n,k = map(int,input().split())
print(n-k+1)

Buggy submission (verdict: Runtime Error):
r, g, b, n = map(int, input().split())
counter = 0
for s in range(n+1):
    for t in range(n-i+1):
        u = n - r*s - g*t
        if u >= 0 and u % b == 0:
            counter += 1
print(counter)
Problem p03048 (python)

Fixed submission:
r, g, b, n = map(int, input().split())
counter = 0
for s in range(n+1):
  for t in range(n-s+1):
    u = n - r*s - g*t
    if u >= 0 and u % b == 0:
      counter += 1
print(counter)

Buggy submission (verdict: Runtime Error):
r, g, b, n = map(int, input().split())
counter = 0
for s in range(n+1):
    for t in range(n-i+1):
        u = n - r*s - g*t
        if u >= 0 and u % b == 0:
            counter += 1
print(counter)
Problem p03069 (python)

Fixed submission:
n = int(input())
s = input()
counter = s.count(".")
ans = counter
for i in range(n):
	if s[i] == ".":
		counter -= 1
	else:
		counter += 1
	ans = min(ans, counter)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
count1 = 0
count2 = 0
m = -1
t = n
for x in range(n):
	if s[x] == "#":
		m = x
		break
if m != -1:
	for u in range(m,n):
	    if s[u] == ".":
		    count1 += 1
		else:
			count2 += 1
	while s[t] == "#":
		count2 -= 1
		t = t-1
print(min(count1,count2))
Problem p03076 (python)

Fixed submission:
a = [int(input()) for i in range(5)]
b = []
for i in range(5):
	x = a[i]%10
	if x != 0:
	    b.append(10 - x)
ans = 0
for u in a:
    ans += u // 10 * 10
ans += len(b) * 10
if len(b) != 0:
	ans -= max(b)
print(ans)

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range(5)]
b = []
for i in range(5):
	x = a[i]%10
	if x != 0:
	    b.append(10 - x)
ans = 0
for u in a:
    ans += u // 10 * 10
ans += len(b) * 10
ans -= max(b)
print(ans)

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range(5)]
b = []
for i in range(5):
	x = a[i]%10
	if x != 0:
	    b.append(10 - x)
ans = 0
for u in a:
    ans += u // 10 * 10
ans += len(b) * 10
ans -= max(b)
print(ans)
Problem p03160 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
DP = [0] * n
DP[0] = 0
DP[1] = abs(h[0]-h[1])
for i in range(2,n):
    DP[i] = min(DP[i-2]+abs(h[i-2]-h[i]),DP[i-1]+abs(h[i-1]-h[i]))
print(DP[-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split())
dp = [0]*n
dp[1] = abs(h[0]-h[1])
for i in range(2,n):
    dp[i] = min(dp[i-2]+abs(h[i-2]-h[i]), dp[i-1]+abs(h[i-1]-h[i]))
print(dp[-1])
Problem p03162 (python)

Fixed submission:
n = int(input())
A = []
B = []
C = []
for i in range(n):
    a,b,c = map(int,input().split())
    A.append(a)
    B.append(b)
    C.append(c)
    
dp = [[0 for i in range(3)] for j in range(n)]

dp[0][0] = A[0]
dp[0][1] = B[0]
dp[0][2] = C[0]

for i in range(1,n):
    dp[i][0] = max(dp[i-1][1],dp[i-1][2])+A[i]
    dp[i][1] = max(dp[i-1][0],dp[i-1][2])+B[i]
    dp[i][2] = max(dp[i-1][0],dp[i-1][1])+C[i]

print(max(dp[n-1][0],dp[n-1][1],dp[n-1][2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
for _ in range(n):
    a,b,c = map(int,input().split())
    A.append(a)
    B.append(b)
    C.append(c)
dp = [[0]*3 for i in range(n)]
dp[0][0] = A[0]
dp[0][1] = B[0]
dp[0][2] = C[0]
for i in range(1,n):
    dp[i][0] = max(dp[i-1][1]+A[i],dp[i-1][2]+A[i])
    dp[i][1] = max(dp[i-1][0]+B[i],dp[i-1][2]+B[i])
    dp[i][2] = max(dp[i-1][0]+C[i],dp[i-1][1]+C[i])
print(max(dp[-1]))
Problem p03164 (python)

Fixed submission:
N,W = map(int,input().split())
w_list = []
v_list = []
for _ in range(N):
    w,v = map(int,input().split())
    w_list.append(w)
    v_list.append(v)
dp = [[10**12]*(10**5+1) for i in range(N+1)]
dp[0][0] = 0
for i in range(1,N+1):
    w = w_list[i-1]
    v = v_list[i-1]
    for j in range(10**5+1):
        if j-v >= 0:
            dp[i][j] = min(dp[i-1][j], dp[i-1][j-v]+w)
        else:
            dp[i][j] = dp[i-1][j]
maxer = 0
for j in range(10**5+1):
    if dp[i][j] <= W:
        maxer = j
print(maxer)

Buggy submission (verdict: Runtime Error):
N,W = map(int,input().split())
w_list = []
v_list = []
for _ in range(N):
    w,v = map(int,input().split())
    w_list.append(w)
    v_list.append(v)
dp = [[0]*(W+1) for i in range(N+1)]
for i in range(1,N+1):
    w = w_list[i-1]
    v = v_list[i-1]
    for j in range(1,W+1):
        if j-w >= 0:
            dp[i][j] = max(dp[i-1][j],dp[i-1][j-w]+v)
        else:
            dp[i][j] = dp[i-1][j]
print(dp[N][W])
Problem p03309 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a2 = [a[x] - (x + 1) for x in range(n)]
a2.sort()
c = n // 2
b = a2[c]
ans = 0
for i in range(n):
	ans += abs(a2[i] - b)
print(ans)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
wa = 0
for i in range(n):
	a[i] = a[i] - (i + 1)
	wa += a[i]
b = round(wa/n)
ans = 0
for i in range(n):
	ans += abs(a[i] - b)
print(ans)
Problem p03361 (python)

Fixed submission:
H,W = map(int,input().split())
s = [list(input()) for i in range(H)]
for i in range(H):
	for j in range(W):
		if s[i][j] == "#":
			if s[max(0,i-1)][j] == "." and s[min(H-1,i+1)][j] == "." and s[i][max(0,j-1)] == "." and s[i][min(W-1,j+1)] == ".":
			    print("No")
			    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
s = [list(input()) for i in range(H)]
for i in range(H):
	for j in range(W):
		if s[i][j] == "#":
			if s[i-1][j] == "." and s[i+1][j] == "." and s[i][j-1] == "." and s[i][j+1] == ".":
			    print("No")
			    exit()
print("Yes")
Problem p03377 (python)

Fixed submission:
A,B,X = map(int,input().split())
if 0 <= X - A <= B:
	print('YES')
else:
	print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
w = sorted(x)
l = int(n/2)
a = w[l - 1]
b = w[l]
for i in range(n):
	if x[i] <= a:
		print(b)
	else:
		print(a)
Problem p03386 (python)

Fixed submission:
A,B,K = map(int,input().split())
list_A = list(range(A,min(B,A+K)))
list_B = list(range(max(A,B-K+1),B+1))
list_C = list_A + list_B
set_C = set(list_C)
list_D = sorted(list(set_C))
for i in list_D:
	print(i)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
kazu = list(range(A,B+1))
for i in kazu:
	if i < A+K or B-K < i:
		print(i)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
list1 = list(range(A,B+1))
for i in list1:
	if i < A+K or B-K < i:
		print(i)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
list1 = list(range(A,B+1))
for i in list1:
	if A+K <= i <= B-K:
		pass
	else:
		print(i)
Problem p03574 (python)

Fixed submission:
h,w = map(int,input().split())
a = ["." for i in range(w+2)]
dot_map = [a]
for _ in range(h):
    l = list(input())
    l.insert(0, ".")
    l.append(".")
    dot_map.append(l)
dot_map.append(a)

for i in range(1, h+1):
    for j in range(1,w+1):
        if dot_map[i][j] == ".":
            counter = 0
            if dot_map[i-1][j-1] == "#":
                counter += 1
            if dot_map[i-1][j] == "#":
                counter += 1
            if dot_map[i-1][j+1] == "#":
                counter += 1
            if dot_map[i][j-1] == "#":
                counter += 1
            if dot_map[i][j+1] == "#":
                counter += 1
            if dot_map[i+1][j-1] == "#":
                counter += 1
            if dot_map[i+1][j] == "#":
                counter += 1
            if dot_map[i+1][j+1] == "#":
                counter += 1
            dot_map[i][j] = str(counter)

for i in range(1, h+1):
    ans = dot_map[i]
    print("".join(ans[1:w+1]))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
a = ["." for i in range(w+2)]
dot_map = [a]
for _ in range(h):
    l = list(input())
    l.insert(0, ".")
    l.append(".")
    dot_map.append(l)
dot_map.append(a)

for i in range(1, h+1):
    for j in range(1,w+1):
        if dot_map[i][j] == ".":
            counter = 0
            if dot_map[i-1][j-1] == "#":
                counter += 1
            if dot_map[i-1][j] == "#":
                counter += 1
            if dot_map[i-1][j+1] == "#":
                counter += 1
            if dot_map[i][j-1] == "#":
                counter += 1
            if dot_map[i][j+1] == "#":
                counter += 1
            if dot_map[i+1][j-1] == "#":
                counter += 1
            if dot_map[i+1][j] == "#":
                counter += 1
            if dot_map[i+1][j+1] == "#":
                counter += 1
            dot_map[i][j] = counter

for i in range(1, h+1):
    ans = dot_map[i]
    print("".join(ans[1:w+1]))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
a = ["." for i in range(w+2)]
dot_map = [a]
for _ in range(h):
    l = list(input())
    l.insert(0, ".")
    l.append(".")
    dot_map.append(l)
dot_map.append(a)

for i in range(1, h+1):
    for j in range(1,w+1):
        if dot_map[i][j] == ".":
            counter = 0
            if dot_map[i-1][j-1] == "#":
                counter += 1
            if dot_map[i-1][j] == "#":
                counter += 1
            if dot_map[i-1][j+1] == "#":
                counter += 1
            if dot_map[i][j-1] == "#":
                counter += 1
            if dot_map[i][j+1] == "#":
                counter += 1
            if dot_map[i+1][j-1] == "#":
                counter += 1
            if dot_map[i+1][j] == "#":
                counter += 1
            if dot_map[i+1][j+1] == "#":
                counter += 1
            dot_map[i][j] = counter

for i in range(1, h+1):
    ans = dot_map[i]
    print("".join(ans[1:w+1]))
Problem p03243 (python)

Fixed submission:
import sys
import numpy as np
a=[int(x)for x in list(sys.stdin.readline()[0:3])]+[-1]
print(str(a[0]+(1if(np.trim_zeros(np.diff(a))[0]>0)else 0))*3)

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
a=[int(x)for x in list(sys.argv[1][0:3])]+[-1]
print(str(a[0]+0if(np.trim_zeros(np.diff(a))[0]<0)else 1)*3)

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
a=[int(x)for x in list(sys.argv[1])]+[-1]
print(str(a[0]+0if(np.trim_zeros(np.diff(a))[0]<0)else 1)*3)
Problem p03309 (python)

Fixed submission:
def BinSearch(A, hi, lo):
    b = (hi + lo) // 2
    tmp0 = FindAns(A, b - 1)
    tmp1 = FindAns(A, b)
    if hi == lo:
        tmp2 = FindAns(A, b + 1)
        return min(tmp0, tmp1, tmp2)
    if tmp0 < tmp1:
        return BinSearch(A, b - 1, lo)
    else:
        return BinSearch(A, hi, b + 1)
    
def FindAns(A, b):
    ans = 0
    for a in A:
        ans += abs(a - b)
    return ans

n = int(input())
A = list(map(int, input().split()))
for i in range(n):
    A[i] -= i + 1
    
hi = max(A)
lo = min(A)

print(BinSearch(A, hi, lo))

Buggy submission (verdict: Runtime Error):
def BinSearch(A, hi, lo):
    b = (hi + lo) // 2
    tmp0 = FindAns(A, b - 1)
    tmp1 = FindAns(A, b)
    if hi == lo:
        tmp2 = FindAns(A, b + 1)
        return min(tmp0, tmp1, tmp2)
    if tmp0 < tmp1:
        return BinSearch(A, b - 1, lo)
    else:
        return BinSearch(A, hi, b + 1)
    
def FindAns(A, b):
    ans = 0
    for a in A:
        ans += abs(a - b)
    return ans

n = int(input())
A = list(map(int, input().split()))
for i in range(n):
    A[i] -= i + 1
A = sorted(A)
hi = A[int(len(A) / 2 + 1) if int(len(A) / 2 + 1) <  len(A)  else int(len(A) / 2)]
lo = A[int(len(A) / 2 - 1) if int(len(A) / 2 - 1) >= 0 else int(len(A) / 2)]

print(BinSearch(A, hi, lo))

Buggy submission (verdict: Runtime Error):
def BinSearch(A, hi, lo):
    b = (hi + lo) // 2
    tmp0 = FindAns(A, b - 1)
    tmp1 = FindAns(A, b)
    if hi == lo:
        tmp2 = FindAns(A, b + 1)
        return min(tmp0, tmp1, tmp2)
    if tmp0 < tmp1:
        return BinSearch(A, b - 1, lo)
    else:
        return BinSearch(A, hi, lo + 1)
    
def FindAns(A, b):
    ans = 0
    for a in A:
        ans += abs(a - b)
    return ans

n = int(input())
A = list(map(int, input().split()))
for i in range(n):
    A[i] -= i + 1
A = sorted(A)
hi = A[int(len(A) / 2 + 1)]
lo = A[int(len(A) / 2 - 1)]

print(BinSearch(A, hi, lo))

Buggy submission (verdict: Runtime Error):
def FindAns(A, b):
    ans = 0
    for a in A:
        ans += abs(a - b)
    return ans

n = int(input())
A = list(map(int, input().split()))
for i in range(n):
    A[i] -= i + 1

center = int(sum(A) / len(A))
ans = 100000000000000
for i in range(21):
    ans = min(ans, FindAns(center - 50))
print(ans)
Problem p03436 (python)

Fixed submission:
H, W = map(int, input().split())
s = [list(input()) for x in range(H)]
d = [[None for y in range(W)] for x in range(H)]
q = []
white = 0
for x in range(H):
  for y in range(W):
    if s[x][y] == '.':
      white += 1
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
q.append([0, 0, 0])

def Haba(x_now, y_now, d_now, s, d, q):
  for i in range(4):
    if 0 <= x_now + dx[i] and x_now + dx[i] < H and 0 <= y_now + dy[i] and y_now + dy[i] < W:
      if s[x_now + dx[i]][y_now + dy[i]] == '.':
        s[x_now + dx[i]][y_now + dy[i]] = '#'
        d[x_now + dx[i]][y_now + dy[i]] = d_now + 1
        q.append([x_now+dx[i], y_now+dy[i], d_now + 1])

while(len(q) > 0):
  x_now, y_now, d_now = q.pop(0)
  Haba(x_now, y_now, d_now, s, d, q)
if d[H - 1][W - 1] is not None:
  ans = white - d[H - 1][W - 1]  - 1
else:
  ans = -1
print(ans)

Buggy submission (verdict: Runtime Error):
H, W = (int(_) for _ in input().split())
s = [list(input()) for h in range(H)]

def Haba(q, x, y, move):
        s[x][y]= "#"
        if x == H - 1 and y == W - 1:
            return True
        for i in range(4):
            if 0 <= x + dx[i] and x + dx[i] < H and 0 <= y + dy[i] and y + dy[i] < W and s[x+dx[i]][y+dy[i]] == '.':
                move += 1
                q.append([x + dx[i], y + dy[i], move])
        return False

count = 0
for x in range(H):
    for y in range(W):
        if s[x][y] == '.':
            count += 1
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
q = []
q.append([0, 0, 0])
x = 0
y = 0
move = 0
ans = True
while(True):
    if len(q) == 0:
        ans = False
        break
    x, y, move = q.pop(0)
    if(Haba(q, x, y, move)) :
        break
if ans:
    print(count -move - 1)
else
    print(-1)
Problem p03573 (python)

Fixed submission:
import numpy as np

A, B, C = (list(map(int, input().split())))
if(A == B):
  print(C)
elif(A == C):
  print(B)
else:
  print(A)

Buggy submission (verdict: Runtime Error):
Python Editor 5.2.0.    New   Open   Save   Run   Export  untitle.py [no ads ?]  Snippets    

print(A)
1
import numpy as np
2
​
3
A, B, C = (list(map(int, input().split())))
4
if(A == B):
5
  print(C)
6
elif(A == C):
7
  print(B)
8
else:
9
  print(A)
Problem p03578 (python)

Fixed submission:
import numpy as np

N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
res = True
dic = {}
for i in range(N):
  if D[i] in dic:
    dic[D[i]] += 1
  else:
    dic[D[i]] = 1
for j in range(M):
  if (dic.get(T[j], 0) == 0):
    res = False
    break
  else:
    dic[T[j]] -= 1
if(res):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N = input()
D = map(int, raw_input().split())
M = input()
T = map(int, raw_input().split())
var = []
result = True
for i in range(N):
  var[D[i]] += 1
for j in range(M):
  if(var[T[j]] == 0):
    result = False
    break
  else:
    var[T[j]] -= 1
if(result):
  print("YES")
else:
  print("NO")
Problem p03597 (python)

Fixed submission:
import numpy as np

N = int(input())
A = int(input())

print(N**2 - A)

Buggy submission (verdict: Runtime Error):
#import numpy as np

def FindMaxCon(res, water, C, D, E):
  c = 0
  d = 0
  tmpCon = 0
  dp = list([False] * 3001)
  dp[0] = True
  for i in range(3001):
    if(i - C >= 0 and i - D >= 0):
      dp[i] = dp[i - C] or dp[i - D]
    elif(i - C >= 0):
      dp[i] = dp[i - C]
    elif(i - D >= 0):
      dp[i] = dp[i - D]
  tmpSugar = 0
  for i in range(min(res, int(E * water / 100)) + 1):
    if(dp[i]):
      tmpSugar = i
  ans = tmpSugar
  return ans

A, B, C, D, E, F = (int(_) for _ in input().split())
amax = F / (A * 100)
bmax = F / (B * 100)
amax = int(amax)
bmax = int(bmax)
water = 0
sugar = 0
waterAns= 100 * A
sugarAns = 0
con = 0
conAns = 0
for a in range(1, amax + 1):
  for b in range(bmax + 1):
    water = 100 * (a * A + b * B)
    if(water > F):
      continue
    else:
      res = F - water
      tmp = FindMaxCon(res, water, C, D, E)
      sugar = tmp
      con = sugar / water
      if(con > conAns):
        conAns = con
        waterAns = water
        sugarAns = sugar
answer = str(waterAns + sugarAns) + " " + str(sugarAns)
print(answer)
Problem p02708 (python)

Fixed submission:
def summ(n, nn=0):
  nn = max(nn, 0)
  return n*(n+1)/2 - nn*(nn+1)/2

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

a = 1
for i in range(k, n + 1):
  mmin = summ(i - 1)
  mmax = summ(n, n - i)
  m = mmax - mmin + 1
  a += m

k = 10**9 + 7
print(int(a%k))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())

a = 1
for i in range(k, n + 1):
  mmin = summ(i - 1)
  mmax = summ(n, n - i)
  m = mmax - mmin + 1
  a += m

k = 10**9 + 7
print(int(a%k))

    
def summ(n, nn=0):
  nn = max(nn, 0)
  return n*(n+1)/2 - nn*(nn+1)/2

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())

a = 1
for i in range(k, n + 1):
  mmin = summ(i - 1)
  mmax = summ(n, n - i)
  m = mmax - mmin + 1
  a += m

  k = 10**9 + 7
  print(int(a%k))

    
def summ(n, nn=0):
  nn = max(nn, 0)
  return n*(n+1)/2 - nn*(nn+1)/2

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())

a = 1
for i in range(k, n + 1):
  mmin = summ(i - 1)
  mmax = summ(n, n - i)
  m = mmax - mmin + 1
  a += m
  # print('{},{},{}'.format(i, mmin, mmax))

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

    
def summ(n, nn=0):
  nn = max(nn, 0)
  return n*(n+1)/2 - nn*(nn+1)/2

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())

a = 1
for i in range(k, n + 1):
  mmin = summ(i)
  mmax = summ(n, n - i)
  m = mmax - mmin
  a += m

print(a)

def summ(n, nn=0):
  nn = max(nn, 0)
  return n*(n+1)/2 - nn*(nn+1)/2

Buggy submission (verdict: Runtime Error):
import numpy as np

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

a = 1
for i in range(k, n + 1):
  mmin = summ(i)
  mmax = summ(n, n - i)
  m = mmax - mmin
  a += m
  
def summ(n, nn=0):
  nn = max(nn, 0)
  return n*(n+1)/2 - nn*(nn+1)/2
Problem p02677 (python)

Fixed submission:
import cmath

param = list(map(int,input().split()))

A = param[0]
B = param[1]
h = param[2]
m = param[3]

v = (A*pow(cmath.e, (cmath.pi*m/30)*1j) - B*pow(cmath.e, (cmath.pi*h/6 + cmath.pi*m/360)*1j))

print(abs(v))

Buggy submission (verdict: Runtime Error):
import cmath

param = list(map(int,input().split()))

A = param[0]
B = param[1]
h = param[2]
m = param[3]

print(abs(A*pow(math.e, (math.pi*m/30)*1j) - B*pow(math.e, (math.pi*h/6)*1j))
Problem p02900 (python)

Fixed submission:
#D
from fractions import gcd
#from math import gcd
import collections
a, b = map(int,input().split())
tmp = gcd(a, b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if tmp == 1:
    l = 1
    ans = 1
else:
    l = prime_factorize(tmp) + [1]
    clist = collections.Counter(l)
    ans = len(clist.keys())
print(ans)

Buggy submission (verdict: Runtime Error):
#D
from fraction import gcd
#from math import gcd
import collections
a, b = map(int,input().split())
tmp = gcd(a, b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if tmp == 1:
    l = 1
    ans = 1
else:
    l = prime_factorize(tmp)
    clist = collections.Counter(prime_factorize(840))
    ans = len(clist.keys())
print(ans)
Problem p02681 (python)

Fixed submission:
A = input()
B = input()
print("Yes") if len(A)+1==len(B) and A == B[:len(A)] else print("No")

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
M = list(map(lambda x: int(x)-1, input().split()))
s = 0
order = [s]
sets = set(order)
while True:
  if M[s] in sets:
    #print(order, M[s])
    
    if K < order.index(M[s]):
      print(order[K-1]+1)
    else:
      K -= order.index(M[s])
      order = order[order.index(M[s]):]
      print(order[K%len(order)]+1)
    break
  order.append(M[s])
  sets.add(M[s])
  s = M[s]

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
print("Yes") if A == B[:len(A)] and len(A)+1=len(B) else print("No")