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

Fixed submission:
s = input()
t = input()
ans = []
for i in range(len(s)-len(t)+1):
    S = s[i:i+len(t)]
    cnt = 0
    for j in range(len(t)):
        if t[j] == S[j]:
            cnt += 1
    ans.append(cnt)

a = ans.index(max(ans))
b = s[a:a+len(t)]
count = 0
for k in range(len(t)):
    if t[k] != b[k]:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
ans = []
for i in range(len(s)-len(t)):
    S = s[i:i+len(t)]
    cnt = 0
    for j in range(len(t)):
        if t[j] == S[j]:
            cnt += 1
    ans.append(cnt)

a = ans.index(max(ans))
b = s[a:a+len(t)]
count = 0
for k in range(len(t)):
    if t[k] != b[k]:
        count += 1
print(count)
Problem p02550 (python)

Fixed submission:
n,x,m = map(int, input().split())

chk = [0 for i in range(m)]
a = x
s = x
c = 0
ary = [x]
flg = False
while True:
  if c == n:
    break
  x = (x**2)%m
  s += x
  c += 1
  if chk[x]:
    flg = True
    break
  ary.append(x)
  chk[x] = c
if flg == False:
  print (sum(ary[:-1]))
  exit()
cyc = ary[chk[x]:]
l1 = len(cyc)
ss = ary[:chk[x]]
l2 = len(ss)
tot = sum(ss) + sum(cyc)*((n-l2)//l1) + sum(cyc[:((n-l2)%l1)])
print (tot)

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

chk = [0 for i in range(m)]
a = x
s = x
c = 1
ary = [x]
flg = False
while True:
  if c == n:
    break
  x = (x**2)%m
  s += x
  c += 1
  if chk[x]:
    flg = True
    break
  ary.append(x)
  chk[x] = c
if flg == False:
  print (s)
  exit()
cyc = ary[chk[x]:]
l1 = len(cyc)
ss = ary[:chk[x]]
l2 = len(ss)
tot = sum(ss) + sum(cyc)*((n-l2)//l1) + sum(cyc[:(n-l2)%l1])
print (tot)
Problem p02598 (python)

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

def check(x):
  c = 0
  for i in range(n):
    c += a[i]//x
    if a[i]%x == 0:
      c -= 1
  if c <= k:
    return True
  else:
    return False

mx = max(a)
mn = 0
ans = [mx]
while mn <= mx:
  m = (mx+mn)//2
  if m == 0:
    if check(1):
      ans.append(1)
    break
  if check(m):
    mx = m - 1
    ans.append(m)
  else:
    mn = m + 1
print (min(ans))

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

def check(x):
  c = 0
  for i in range(n):
    c += a[i]//x
  if c <= k:
    return True
  else:
    return False

mx = max(a)
mn = 0
ans = [mx]
while mn <= mx:
  m = (mx+mn)//2
  if check(m):
    mx = m - 1
    ans.append(m)
  else:
    mn = m + 1
print (min(ans))

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

def check(x):
  c = 0
  for i in range(n):
    c += a[i]//x
  if c <= k:
    return True
  else:
    return False

mx = max(a)
mn = 0
ans = [mx+mn//2]
while mn <= mx:
  m = (mx+mn)//2
  if check(m):
    mx = m - 1
    ans.append(m)
  else:
    mn = m + 1
print (min(ans))
Problem p02676 (python)

Fixed submission:
k = int(input())
s = input()
if len(s) <= k:
	print (s)
else:
	print (s[:k] + "...")

Buggy submission (verdict: Runtime Error):
import math
a, b, h, m = map(int, input().split())
x = 360*(h/12)+30*(m/60)
y = 360*(m/60)
d = math.cos(math.radians(abs(x-y)))
z = a**2 + b**2 -2*a*b*d
print (math.sqrt(z))
Problem p02762 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 9)

n, m, k = map(int, input().split())
ab = [[] for i in range(n)]

for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  ab[a].append(b)
  ab[b].append(a)

block = [set() for i in range(n)]
for i in range(k):
  c, d = map(int, input().split())
  c -= 1
  d -= 1
  block[c].add(d)
  block[d].add(c)

ans = [0 for i in range(n)]

def dfs(s):
  if vis[s] == False:
    vis[s] = True
    r[cnt].add(s)
    for i in ab[s]:
      dfs(i)

vis = [False for i in range(n)]
r = []
cnt = 0
for i in range(n):
  if vis[i] == False:
    r.append(set())
    dfs(i)
    cnt += 1

ans = [0 for i in range(n)]
for i in r:
  l = len(i)
  for j in i:
    ans[j] = l - len(ab[j]) - len(i&block[j]) - 1

print (*ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
ab = [[] for i in range(n)]

for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  ab[a].append(b)
  ab[b].append(a)

block = [[] for i in range(n)]
for i in range(k):
  c, d = map(int, input().split())
  c -= 1
  d -= 1
  block[c].append(d)
  block[d].append(c)

ans = [0 for i in range(n)]

def dfs(s):
  vis[s] = True
  ary.append(s)
  for i in ab[s]:
    if vis[i] == False:
      dfs(i)

for i in range(n):
  vis = [False for i in range(n)]
  vis[i] = True
  x = ab[i]
  for j in x:
    vis[j] = True
  c = 0
  for j in x:
    ary = []
    dfs(j)
    ary.pop(0)
    blo = set(block[i])
    cnt = set(ary) - blo
    c += len(cnt)
  ans[i] = c
print (*ans)
Problem p02836 (python)

Fixed submission:
s = input()
cnt = 0
flg = 0
i = 0
j = -1
if len(s) == 1:
	print (0)
	exit()
while flg == 0:
	if s[i] != s[j]:
		cnt += 1
	#print (s[i],s[j])
	if len(s)//2 == i+1:
		flg =1
	i += 1
	j += -1
print (cnt)

Buggy submission (verdict: Runtime Error):
s = input()
cnt = 0
flg = 0
i = 0
j = -1
while flg == 0:
	if s[i] != s[j]:
		cnt += 1
	#print (s[i],s[j])
	if len(s)//2 == i+1:
		flg =1
	i += 1
	j += -1
print (cnt)
Problem p02847 (python)

Fixed submission:
n = input()

if n == "SAT":
	print (1)
elif n == "SUN":
	print (7)
elif n == "MON":
	print (6)
elif n == "TUE":
	print (5)
elif n == "WED":
	print (4)
elif n == "THU":
	print (3)
else:
	print (2)

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
q = x//a
k = len(str(q))
ary = []
for i in range(k-1, k+1):
	if len(str((x-b*i)//a)) == i:
		if (x-b*i)//a > 10**9:
			if a * 10**9 + b * 10 <= x:
				ary.append(10**9)
		else:
			ary.append(min((x-b*i)//a, 10 ** i - 1))
if len(ary) == 0:
	print (0)
else:
	print (max(ary))
Problem p02873 (python)

Fixed submission:
s = input()
a = [0]*(len(s)+1)

for i in range(len(s)):
  if s[i] == '<':
    a[i+1] = max(a[i+1],a[i]+1)

for i in range(len(s)-1,-1,-1):
  if s[i] == '>':
    a[i] = max(a[i],a[i+1]+1)
print (sum(a))

Buggy submission (verdict: Runtime Error):
s = input()
b = []
sho = 0
dai = 0
for i in range(len(s)):
	if(i == 0 and s[i+1] == ">"):continue
	if s[i] == "<":
		dai = 0
		sho += 1
		b.append(sho)
	else:
		sho = 0
		if(s[i-1] == "<" and i != 1):continue
		dai += 1
		b.append(dai)
#print(b)
print (sum(b))

Buggy submission (verdict: Runtime Error):
s = input()
b = []
sho = 0
dai = 0
for i in range(len(s)):
	if(i == 0 and s[i+1] == ">"):continue
	if s[i] == "<":
		dai = 0
		sho += 1
		b.append(sho)
	else:
		oldsho = sho
		sho = 0
		if(oldsho >= 2):
			dai = -1
		elif(s[i-1] == "<"):
			dai = 0
		dai += 1
		b.append(dai)
print (sum(b))
Problem p02912 (python)

Fixed submission:
import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = [-i for i in a]
heapq.heapify(b)
for i in range(m):
	c = heapq.heappop(b)
	c *= -1
	c //= 2
	heapq.heappush(b,-c)
s = -sum(b)
print (s)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
dp = [[0 for i in range(5001)] for j in range(5001)]

for i in range(n-1,-1,-1):
	for j in range(n-1,-1,-1):
		if s[i] != s[j]:
			dp[i][j] = 0
		else:
			dp[i][j] = dp[i+1][j+1] + 1

res = 0
for i in range(n):
	for j in range(n):
		if i >= j:
			continue
		x = min(dp[i][j], j-i)
		res = max(x,res)
print (res)
Problem p02984 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
x1 = 0
x1 = sum(a)-sum(a[1::2])*2
x = []
x.append(x1)
for i in range(n-1):
	xx = a[i]*2 - x[-1]
	x.append(xx)
print (*x)

Buggy submission (verdict: Runtime Error):
l, r = map(int, input().split())
if r-l >= 2017:
	print (0)
	exit()
else:
	for i in range(l,r+1):
		for j in range(i+1,r+1):
			a = min(a,i*j%2019)
print (a)
Problem p03011 (python)

Fixed submission:
a = list(map(int, input().split()))
a.sort()
print (a[0] + a[1])

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = []
a = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
	ss = input()
	s.append(ss)
	b = 0
	for j,k in enumerate(ss):
		if k == "#":
			b = 0
			a[i][j] == 0
		else:
			b += 1
			a[i][j] = b
	mx = 0
	for j in range(w-1,-1,-1):
		if a[i][j] == 0:
			mx = 0
			continue
		else:
			mx = max(a[i][j],mx)
			a[i][j] = mx

c = [[0 for i in range(h)] for j in range(w)]
for i in range(w):
	v = ""
	b = 0
	for j in range(h):
		v += s[j][i]
	for j,k in enumerate(v):
		if k == "#":
			b = 0
			c[i][j] == 0
		else:
			b += 1
			c[i][j] = b
	mx = 0
	for j in range(h-1,-1,-1):
		if c[i][j] == 0:
			mx = 0
			continue
		else:
			mx = max(c[i][j],mx)
			c[i][j] = mx

wk = 0
ans = 0
for i in range(h):
	for j in range(w):
		wk = a[i][j] + c[j][i] -1
		ans = max(ans,wk)
print (ans)
Problem p03307 (python)

Fixed submission:
n = int(input())
if n%2 == 0:
	print (n)
else:
	print (n*2)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n%2 == 0:
	print (n):
else:
	print (n*2)
Problem p02699 (python)

Fixed submission:
S, W = map(int, input().split())

if S>W:
    print('safe')
else:
    print('unsafe')

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

n = int(A/D)
m = int(C/B)

if n<=m:
    print('No')
elif n>m:
    print('Yes')

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

n = int(A/D)
m = int(C/B)

if n>m:
    x = n
else :
    x = m
    
for i in range(1, x+1):
    a = C - B
    t = A - D
    if a <= 0:
        print('Yes')
        break
    elif t <= 0:
        print('No')
        break
Problem p02753 (python)

Fixed submission:
S = list(input())
ans = 0

for i in range(0,2):
    if(S[i] != S[i+1]):
        ans = 1
        break
    else :
        ans = 0

if(ans == 1):
    print('Yes')
elif(ans == 0):
    print('No')

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
N = a[0]
blue = a[1]
red = a[2]
ans = 0
A = blue + red
X = N // A
Y = N % A
if Y <= blue:
    ans = blue * X + Y
else:
    ans = blue * X + blue
print(ans)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
ans = 0
S = A+B
T = N//S
U = N%S


if(A == 0):
    ans = 0
else :
    if(0< U < A):
        ans = A*T+U
    elif(U == 0):
        ans = A*T
    elif(U >= A):
        ans = A*T+A
    
print(ans)
Problem p02679 (python)

Fixed submission:
import math
n = int(input())
mod = 10**9 + 7
cou = 0
pdic = {}
kan = []
betu = [0,0,0]

for i in range(n):
    a , b = map(int,input().split())
    if a*b != 0:
        g = math.gcd(abs(a),abs(b))
        if a*b > 0:
            m = 1
        elif a*b < 0:
            m = -1
        p = (m*abs(a)//g,abs(b)//g)
        q = ((-m)*abs(b)//g,abs(a)//g)
        if pdic.get(q,-1) != -1:
            kan[pdic[q]][1] += 1
        elif pdic.get(p,-1) == -1:
            pdic[p] = cou
            kan.append([1,0])
            cou += 1
        elif pdic.get(p,-1) != -1:
            kan[pdic[p]][0] += 1
    elif a*b == 0:
        if a == 0 and b == 0:
            betu[2] += 1
        elif a == 0:
            betu[0] += 1
        elif b == 0:
            betu[1] += 1
        
        
ans = 1
for i in range(len(kan)):
    ans *= (pow(2,kan[i][0],mod) + pow(2,kan[i][1],mod) - 1) % mod
    ans %= mod
ans *= (pow(2,betu[0],mod) + pow(2,betu[1],mod) - 1) % mod
print((ans-1+betu[2])%mod)

Buggy submission (verdict: Runtime Error):
n = int(input())
mod = 10**9 + 7
cou = 0
pdic = {}
kan = []
for i in range(n):
    a , b = map(int,input().split())
    p = a/b
    q = -b/a
    if pdic.get(q,-1) != -1:
        kan[pdic[q]][1] += 1
    elif pdic.get(p,-1) == -1:
        pdic[p] = cou
        kan.append([1,0])
        cou += 1
    elif pdic.get(p,-1) != -1:
        kan[pdic[p]][0] += 1
        
ans = 1
for i in range(len(kan)):
    if kan[i][1] == 0:
        ans *= pow(2,kan[i][0],mod)
    elif kan[i][1] != 0:
        ans *= (pow(2,kan[i][0],mod) + pow(2,kan[i][1],mod)-1) % mod
    ans %= mod

print(ans-1)
Problem p02695 (python)

Fixed submission:
n , m , q = map(int,input().split())
p = []
for i in range(q):
    a , b , c , d = map(int,input().split())
    p.append([a,b,c,d])
ans = 0
for a1 in range(1,m+1):
    for a2 in range(a1,m+1):
        for a3 in range(a2,m+1):
            for a4 in range(a3,m+1):
                for a5 in range(a4,m+1):
                    for a6 in range(a5,m+1):
                        for a7 in range(a6,m+1):
                            for a8 in range(a7,m+1):
                                for a9 in range(a8,m+1):
                                    for a10 in range(a9,m+1):
                                        tyu = [0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10]
                                        kar = 0
                                        for x,y,z,w in p:
                                            if tyu[y] - tyu[x] == z:
                                                kar += w
                                        ans = max(kar,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n , m , q = map(int,input().split())
p = []
for i in range(q):
    a , b , c , d = map(int,input().split())
    p.append([a,b,c,d])
ans = 0
for a1 in range(1,m+1):
    for a2 in range(a1,m+1):
        for a3 in range(a2,m+1):
            for a4 in range(a3,m+1):
                for a5 in range(a4,m+1):
                    for a6 in range(a5,m+1):
                        for a7 in range(a6,m+1):
                            for a8 in range(a7,m+1):
                                for a9 in range(a8,m+1):
                                    for a10 in range(a9,m+1):
                                        tyu = [a1,a2,a3,a4,a5,a6,a7,a8,a9,a10]
                                        kar = 0
                                        for x,y,z,w in p:
                                            if tyu[y] - tyu[x] == z:
                                                kar += w
                                        ans = max(kar,ans)
print(ans)
Problem p02726 (python)

Fixed submission:
n , x , y = map(int,input().split())
p = [0 for i in range(n)]
for i in range(1,n+1):
    for j in range(1,i+1):
        p[min(abs(i-j),abs(i-x)+1+abs(j-y),abs(j-x)+1+abs(i-y))] += 1
for i in range(1,n):
    print(p[i])

Buggy submission (verdict: Runtime Error):
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    #return d
a , b , c = map(int,input().split())

n = a
w = a #n:頂点数　w:辺の数

d = [[float("inf")]*n for i in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(n-1):
    x = i
    y = i+1
    d[x][y] = 1
    d[y][x] = 1
d[b-1][c-1] = 1
d[c-1][b-1] = 1

for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０
    
warshall_floyd(d)

for i in range(1,n):
    ans = 0
    if i >= b + a - c + 1:
        print(ans)
        continue
    for j in range(n):
        ans += def[j].count(i)
    print(ans)
Problem p02763 (python)

Fixed submission:
def main():
    from bisect import bisect_left,bisect
    n = int(input())
    s = list(input())
    q = int(input())
    al=[[] for i in range(26)]
    for i in range(n):
        al[ord(s[i])-97].append(i)
    ans = []
    for i in range(q):
        a , b , x = input().split()
        if a == "1":
            al[ord(s[int(b)-1])-97].pop(bisect_left(al[ord(s[int(b)-1])-97],int(b)-1))
            al[ord(x)-97].insert(bisect_left(al[ord(x)-97],int(b)-1),int(b)-1)
            s[int(b)-1] = x
        elif a == "2":
            b = int(b)-1
            x = int(x)-1
            cou = 0
            for j in range(26):
                l = bisect_left(al[j],b)
                r = bisect(al[j],x)
                if l != r:
                    cou += 1
            ans.append(cou)
    for i in ans:
        print(i)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left,bisect
n = int(input())
s = list(input())
q = int(input())
al=[[] for i in range(26)]
for i in range(n):
    al[ord(s[i])-ord("a")].append(i)

for i in range(q):
    a , b , x = input().split()
    if a == "1":
        al[ord(s[int(b)-1])-ord("a")].pop(al[ord(s[int(b)-1])-ord("a")],int(b)-1)
        al[ord(x)-ord("a")].insert(bisect_left(al[ord(x)-ord("a")],int(b)-1),int(b)-1)
        s[int(b)-1] = x
    elif a == "2":
        b = int(b)-1
        x = int(x)-1
        cou = 0
        for j in range(26):
            l = bisect_left(al[j],b)
            r = bisect(al[j],x)
            if l != r:
                cou += 1
        print(cou)

Buggy submission (verdict: Runtime Error):
import heapq
from bisect import bisect_left,bisect
n = int(input())
s = list(input())
q = int(input())
al=[[] for i in range(26)]
for i in range(26):
    heapq.heapify(al[i])

for i in range(n):
    heapq.heappush(al[ord(s[i])-ord("a")],i)

for i in range(q):
    a , b , x = input().split()
    if a == "1":
        al[ord(s[int(b)-1])-ord("a")].remove(int(b)-1)
        heapq.heappush(al[ord(x)-ord("a")],int(b)-1)
    elif a == "2":
        b = int(b)-1
        x = int(x)-1
        cou = 0
        for j in range(26):
            l = bisect_left(al[j],b)
            r = bisect(al[j],x)
            if l != r:
                cou += 1
        print(cou)

Buggy submission (verdict: Runtime Error):
import heapq
from bisect import bisect_left,bisect
n = int(input())
s = list(input())
q = int(input())
al=[[] for i in range(26)]
for i in range(26):
    heapq.heapify(al[i])

for i in range(n):
    heapq.heappush(al[ord(s[i])-ord("a")],i)

for i in range(q):
    a , b , x = input().split()
    if a == "1":
        al[ord(s[int(b)-1])-ord("a")].remove(int(b)-1)
        heapq.heappush(al[ord(x)-ord("a")],int(b)-1)
    elif a == "2":
        b = int(b)-1
        x = int(x)-1
        cou = 0
        for j in range(26):
            l = bisect_left(al[j],b)
            r = bisect(al[j],x)
            if l != r:
                cou += 1
        print(cou)
Problem p02833 (python)

Fixed submission:
n = int(input())
if n % 2 == 1:
    print(0)
    exit()
elif n % 2 == 0:
    ans = n//10
    kar = n//10
    while True:
        if kar // 5 >= 1:
            ans += kar // 5
            kar = kar// 5
        elif kar // 5 < 1:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n % 2 == 1:
    print(0)
elif n % 2 == 0:
    ans = n//10
    kar = n//10
    while True:
        if kar // 5 >= 1:
            ans += kar // 5
            kar = kar// 5
        elif kar // 5 < 1:
            break
print(ans)
Problem p02891 (python)

Fixed submission:
s = list(input())
k = int(input())
ans = []
now = s[0]
cou = 0
if len(s) == 1:
    print(k//2)
    exit()

for i in range(len(s)):
    if now == s[i]:
        cou += 1
    elif now != s[i]:
        ans.append(cou)
        cou = 1
        now = s[i]
if cou > 0:
    ans.append(cou)
if ans[0] == len(s):
    print((ans[0]*k)//2)
    exit()
    
p = 0
for i in ans:
    p += (i//2)*k

if s[0] == s[-1]:
    p -= (ans[0]//2 + ans[-1]//2)*(k-1)
    p += ((ans[0]+ans[-1])//2)*(k-1)

print(p)

Buggy submission (verdict: Runtime Error):
s = list(input())
k = int(input())
cou = 0
p = 0
if s[0] == s[-1]:
    p = 1
    
for i in range(1,len(s)-2):
    if s[i] == s[i+1]:
        cou += 1
        s[i+1] = "V"
if s[-2] == s[-1]:
    cou += 1
    if p == 1:
        p = 0


print(cou*k + p * (k-1))
Problem p02948 (python)

Fixed submission:
import heapq
n , m = map(int,input().split())
kouho = [[] for i in range(m)]
for i in range(n):
    a , b = map(int,input().split())
    if a <= m:
        kouho[a-1].append(-b)
ans = 0
p = []
heapq.heapify(p)

for i in range(m):

    for j in kouho[i]:
        heapq.heappush(p,j)
    if p:
        ans -= heapq.heappop(p)
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq
n , m = map(int,input().split())
kouho = [[] for i in range(m)]
hosyu = [0 for i in range(m)]
for i in range(n):
    a , b = map(int,input().split())
    kouho[a-1].append(-b)
for i in range(m):
    now = i
    p = 0
    heapq.heapify(kouho[i])
    while kouho[i]:
        if now == m:
            break
        if p == 0:
            p = heapq.heappop(kouho[i])
        if hosyu[now] > p:
            hosyu[now] = p
            p = 0
        now += 1
print(abs(sum(hosyu)))

Buggy submission (verdict: Runtime Error):
import heapq
n , m = map(int,input().split())
kouho = [[] for i in range(m)]
hosyu = [0 for i in range(m)]
for i in range(n):
    a , b = map(int,input().split())
    kouho[a-1].append(-b)
for i in range(m):
    now = i
    p = 0
    heapq.heapify(kouho[i])
    while kouho[i]:
        if now == m:
            break
        if p == 0:
            p = heapq.heappop(kouho[i])
        if hosyu[now] > p:
            hosyu[now] = p
            p = 0
        now += 1
print(abs(sum(hosyu)))
Problem p02577 (python)

Fixed submission:
N = int(input())
if N%9 ==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = 0
for i in range(2*10**5)
  digit = N%10
  S += digit
  N = N//10
T = 0
while S > 0:
  digit = S%10
  T += digit
  S = S//10
if T%9 == 0:
  print('Yes')
else:
  print('No')
Problem p02688 (python)

Fixed submission:
N, K = map(int, input().split())
L = [1 for i in range(N)]
for k in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for i in range(d):
    L[A[i] - 1] = 0
print(sum(L))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
L = [1 for i in range(N)]
for k in range(K):
  d = int(input())
  A = list(map(int, input().spit()))
  for i in range(d):
    L[A[i] - 1] = 0
print(sum(L))
Problem p02712 (python)

Fixed submission:
N = int(input())
S = 0
for i in range(N+1):
  if i%3 != 0 and i%5 != 0:
    S += i
print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [0 if x//3==0 or x//5==0 else x for x in range(1,16)]
Q = N//15
R = N%15
S = 30 * Q * (Q+1) + sum(L[R-1])
print(S)
Problem p02831 (python)

Fixed submission:
a, b = map(int, input().split())
m = 0
for i in range(1, min(a, b)+1):
    if a%i==0 and b%i==0:
        m = i
print(int(a*b/m))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
m = 0
for i in range(1, min(a, b)):
    if a%i==0 and b%i==0:
        m = i
print(int(a*b/m))
Problem p03127 (python)

Fixed submission:
n = int(input())

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

t = max(A)

from fractions import gcd

for i in A:
    t = gcd(t, i)
print(t)

Buggy submission (verdict: Runtime Error):
n = int(input())

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

t = max(A)

import math

for i in A:
    t = math.gcd(t, i)
print(t)

Buggy submission (verdict: Runtime Error):
n = int(input())

A = list(set(list(map(int, input().split()))))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

m = max(A)
if len(A) == 1:
    print(A[0])
else:
    for i in range(n-1):
        for j in range(i+1, n):
            m = min(m, gcd(A[i], A[j]))
    print(m)

Buggy submission (verdict: Runtime Error):
n = int(input())

A = list(set(list(map(int, input().split()))))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
m = max(A)
if len(A) == 1:
    print(A[0])
else:
    for i in range(n):
        for j in range(i+1, n):
            m = min(m, gcd(A[i], A[j]))
    print(m)

Buggy submission (verdict: Runtime Error):
n = int(input())

A = list(set(list(map(int, input().split()))))

from fractions import gcd
m = max(A)
if len(A) == 1:
    print(A[0])
else:
    for i in range(n):
        for j in range(i+1, n):
            m = min(m, gcd(A[i], A[j]))
    print(m)

Buggy submission (verdict: Runtime Error):
n = int(input())

A = list(set(list(map(int, input().split()))))

from fractions import gcd
m = max(A)
for i in range(n):
    for j in range(i+1, n):
        m = min(m, gcd(A[i], A[j]))
print(m)
Problem p03272 (python)

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

print(a-b+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
h, w = map(int, input().split())

A = []
for i in range(h):
    s = list(input())
    if len(set(s)) == 1 and s[0] == ".":
        continue
    else:
        A.append(s)
B = A
c = 0
for i in range(w):
    s = []
    for j in range(len(A)):
        s.append(A[j][i])
    if len(set(s)) == 1 and s[0] == '.':
        B = np.delete(B, i-c, 1)
        c += 1


for i in B:
    a = ""
    for j in i:
        a += j
    print(a)