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

Fixed submission:
n = int(input())
graph = [[] for _ in range(n+1)]
for _ in range(n-1):
    a,b=map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)
mod = 10**9 + 7
factorial = [1]*(n+1)
factorial_inv = [1]*(n+1)
for i in range(1,n+1):
    factorial[i] = factorial[i-1]*i%mod
factorial_inv[n] = pow(factorial[n],mod-2,mod)
for i in range(n,0,-1):
    factorial_inv[i-1] = factorial_inv[i]*i%mod

pa = [0]*(n+1)
dp = [1]*(n+1)
size = [1]*(n+1)
checked = []
stack = [i]
while stack:
    a = stack.pop()
    checked.append(a)
    for j in graph[a]:
        if pa[a] == j:   
            continue
        else:
            stack.append(j)
            pa[j] = a

for i in checked[::-1]:
    p = pa[i]
    s = size[i]
    dp[i] *= factorial[s-1]
    dp[i] %= mod
    dp[p] *= dp[i]*factorial_inv[s]
    dp[p] %= mod
    size[p] += s

size_ = [n-i+1 for i in size]
dp_ = [1]*(n+1)
for i in checked[1:]:
    p = pa[i]
    dp_[i] *= dp[p]
    dp_[i] *= factorial_inv[size[p]-1]
    dp_[i] *= pow(dp[i],mod-2,mod)
    dp_[i] *= factorial[size[i]]
    dp_[i] *= dp_[p]
    dp_[i] *= factorial_inv[size_[p]-1]
    dp_[i] *= factorial[size_[i]-2]
    dp_[i] %= mod
    
for i in range(1,n+1):
    ans = factorial[n-1]*dp[i]*dp_[i]*factorial_inv[size[i]-1]*factorial_inv[size_[i]-1]
    ans %= mod
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
graph = [[] for _ in range(n)]
factorial = [1]*(n+1)
for i in range(1,n+1):
    factorial[i] = factorial[i-1]*i
mod = 10**9 + 7
for _ in range(n-1):
    a,b=map(int,input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

for i in range(n):
    ch = [[] for _ in range(n)]
    pa = [[] for _ in range(n)]
    dp = [[1,1] for _ in range(n)]
    checked = []
    stack = [i]
    stack2 = []
    while stack:
        a = stack.pop()
        checked.append(a)
        if a != i and len(graph[a]) == 1:
            stack2.append(a)
        else:
            for j in graph[a]:
                if j in checked:
                    continue
                else:
                    checked.append(j)
                    stack.append(j)
                    pa[j].append(a)
                    ch[a].append(j)
    checked = []
    while stack2:
        a = stack2.pop()
        if a == i:
            print(dp[i][0])
            break
        else:
            p = pa[a][0]
            dp[p][0] *= dp[a][0]*pow(factorial[dp[a][1]],mod-2,mod)
            dp[p][0] %= mod
            dp[p][1] += dp[a][1]
            ch[p].remove(a)
            if len(ch[pa[a][0]]) == 0:
                dp[p][0] *= factorial[dp[p][1]-1]
                dp[p][0] %= mod
                stack2.append(p)
            checked.append(a)
Problem p02761 (python)

Fixed submission:
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for _ in range(m)]

ans = [0]*n
judge_s = 0
judge_c = 0
sc = sorted(sc)

if m == 0:
    if n == 1:
        ans = 0
    else:
        ans = 10**(n-1)
else:
    for i in range(m):
        if judge_s == sc[i][0] and judge_c != sc[i][1]:
            ans = -1
            break
        if n != 1 and sc[i] == [1,0]:
            ans = -1
            break
        judge_s = sc[i][0]
        judge_c = sc[i][1]
        ans[sc[i][0]-1] = sc[i][1]


    if ans != -1:
        ans_ = ans.copy()
        ans = 0
        for i in range(n):
            ans += ans_[i]*10**(n-i-1)
        
        if ans_[0] == 0 and n != 1:
            ans += 10**(n-1)
            
    
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for _ in range(m)]

ans = [0]*n
judge_s = 0
judge_c = 0
sc = sorted(sc)

if m == 0:
    if n == 1:
        ans = 0
    else:
        ans = 10**(n-1)
else:
    for i in range(m):
        if judge_s == sc[i][0] and judge_c != sc[i][1]:
            ans = -1
            break
        if n != 1 and sc[i] == [1,0]
            ans = -1
            break
        judge_s = sc[i][0]
        judge_c = sc[i][1]
        ans[sc[i][0]-1] = sc[i][1]


    if ans != -1:
        ans_ = ans.copy()
        ans = 0
        for i in range(n):
            ans += ans_[i]*10**(n-i-1)
        
        if ans_[0] == 0 and n != 1:
            ans += 10**(n-1)
            
    
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for _ in range(m)]

ans = [0]*n
judge_s = 0
judge_c = 0
sc = sorted(sc)
for i in range(m):
    if judge_s == sc[i][0] and judge_c != sc[i][1]:
        ans = -1
        break
    judge_s = sc[i][0]
    judge_c = sc[i][1]
    ans[sc[i][0]-1] = sc[i][1]


if ans != -1:
    if ans[0] == 0:
        ans = -1
    else:
        ans = 0
        for i in range(n):
            ans += ans[i]*10**(n-i-1)
    
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for _ in range(m)]

ans = [0]*n
judge_s = 0
judge_c = 0
sc = sorted(sc)
for i in range(m):
    if judge_s == sc[i][0] and judge_c != sc[i][1]:
        ans = -1
        break
    judge_s = sc[i][0]
    judge_c = sc[i][1]
    ans[sc[i][0]-1] = sc[i][1]


if ans != -1:
    if ans[0] == 0:
        ans = -1
    else:
        ans = ans[0]*100+ans[1]*10+ans[2]
    
print(ans)
Problem p02765 (python)

Fixed submission:
N,R=map(int,input().split())
if N >= 10:
    print(R)
else:
    print(R+100*(10-N))

Buggy submission (verdict: Runtime Error):
N,R=map(int,input().split())
if N >= 10:
    print(R)
else:
    print(R+100*(10-K))
Problem p02767 (python)

Fixed submission:
import numpy as np
N = int(input())
x = np.array(sorted(list(map(int, input().split()))),dtype = 'int64')

s = []
for p in range(x[0],x[-1]+1):
    s.append(np.sum((x-p)*(x-p)))
    
print(min(s))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
x = np.array(sorted(list(map(int, input().split()))),dtype = 'int64')

s = []
for p in range(x[0],x[-1]):
    s.append(np.sum((x-p)*(x-p)))
    
print(min(s))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
x = np.array(sorted(list(map(int, input().split()))))

s = []
for p in range(x[0],x[-1]):
    s.append(np.sum((x-p)*(x-p)))
    
print(min(s))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
x = np.array(list(map(int, input().split())))

s = []
for p in range(x[0],x[-1]):
    s.append(np.sum((x-p)*(x-p)))
    
print(min(s))
Problem p02770 (python)

Fixed submission:
import numpy as np

k,q = map(int,input().split())
d = np.array(list(map(int,input().split())))
n = [0]*q
x = n.copy()
m = n.copy()
for i in range(q):
    n[i],x[i],m[i] = map(int,input().split())
    
for i in range(q):
    d_ = d%m[i]
    j = np.sum(d_ * ((n[i]-1)//k)) + np.sum(d_[:(n[i]-1)%k])
    s = np.sum(np.sum(d_==0) * ((n[i]-1)//k)) + np.sum(d_[:(n[i]-1)%k]==0)
    count = n[i] - 1 - (j+x[i]%m[i])//m[i] - s
    print(count)

Buggy submission (verdict: Runtime Error):
k,q = map(int,input().split())
d = list(map(int,input().split()))
n = [0]*q
x = n.copy()
m = n.copy()
for i in range(q):
    n[i],x[i],m[i] = map(int,input().split())
    
for i in range(q):
    a = [x[i]%m[i]]*n[i]
    count = 0
    for j in range(n[i]-1):
        a[j+1] = (a[j] + d[j%k])%m[i]
        if a[j+1] > a[j]:
            count+=1
    print(count)
Problem p02774 (python)

Fixed submission:
import numpy as np
N,K = map(int,input().split())
a = np.array(input().split(),np.int64)
a = np.sort(a)
zero = a[a==0]
pos = a[a>0]
neg = a[a<0]

def f(x):
    count = 0
    c = x // pos
    count += np.searchsorted(a, c, side='right').sum()
    count += N*len(zero) if x >= 0 else 0
    c = -(-x // neg)
    count += (N - np.searchsorted(a, c, side='left')).sum()
    count -= a[a*a <= x].size
    count //= 2
    return count

right = 10**18
left = -10**18
while right-left>1:
    mid = (right + left)//2
    if f(mid)<K:
        left = mid
    else:
        right = mid
        
print(right)

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

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

b = np.tile(a,N).reshape(N,-1).astype('float128')
c = np.tril(b * b.T, k=-1)
d = c + np.tri(N).T * np.max(c)

print(int(sorted(d.flatten())[K-1]))

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

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

b = np.tile(a,N).reshape(N,-1).astype('float128')
c = np.tril(b * b.T, k=-1)
d = c + np.tri(N).T * np.max(c)

print(d)
print(int(sorted(d.flatten())[K-1]))

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

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

b = np.tile(a,N).reshape(N,-1)
c = b * b.T * np.tri(N, k=-1)
d = c + np.tri(N).T * np.max(c)

print(int(sorted(d.flatten())[K-1]))

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

d_plus = sorted([i for i in a if i>=0])
d_minus = sorted([i for i in a if i<0])

d = []
if len(d_plus)*len(d_minus) <= K:
  for i in d_plus:
    for j in d_minus:
      d.append(i*j)
  print(sorted(d)[K-1])
else:
  for i in range(len(d_plus)):
    for j in range(len(d_plus)):
      if i==j:
        continue
      else:
        d.append(d_plus[i]*d_plus[j])
  for i in range(len(d_minus)):
    for j in range(len(d_minus)):
      if i==j:
        continue
      else:
        d.append(d_minus[i]*d_minus[j])
  print(sorted(d)[K-1-len(d_plus)*len(d_minus)])

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

d = []
for i in range(N):
  for j in range(N):
    if j == i:
      continue
    else:
      d.append(a[i]*a[j])
      
print(sorted(d)[K-1])

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

d = []
for i in range(N):
  for j in range(N):
    if j == i:
      continue
    else:
      d.append(a[i]*a[j])
      
print(sorted(d)[K-1])
Problem p02782 (python)

Fixed submission:
r1,c1,r2,c2 = map(int,input().split())

n = [1]*(r2+c2+3)
mod = 10**9 + 7
for i in range(r2+c2+2):
    n[i+1] = (n[i]*((i+1)%mod))%mod

def calc(r,c):
    x = n[r+c]%mod
    y = (n[r]*n[c])%mod
    return (x*(pow(y,mod-2,mod)%mod))%mod

ans = calc(r2+1,c2+1)-calc(r2+1,c1)-calc(r1,c2+1)+calc(r1,c1)
ans %= mod

print(ans)

Buggy submission (verdict: Runtime Error):
r1,c1,r2,c2 = map(int,input().split())
n = [[1]*(c2+1) for i in range(r2+1)]
mod = 10**9 + 7
ans = 0
for r in range(r2):
    for c in range(c2):
        n[r+1][c+1] = (n[r][c+1] + n[r+1][c])%mod
        if r >= r1-1 and c >= c1-1:
            ans += n[r+1][c+1]
            ans %= mod
            
print(ans)
Problem p02788 (python)

Fixed submission:
from collections import deque
from math import ceil

n,d,a = map(int,input().split())
xh = sorted([list(map(int,input().split())) for _ in range(n)])

q = deque()
ans = 0
count = 0
total = 0
for x,h in xh:
    while q:
        if q[0][0] < x:
            total -= q.popleft()[1]
        else:
            break
    
    if total < ceil(h/a):
        count = ceil(h/a)-total
        ans += count
        total += count
        q.append((x+2*d,count))

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,d,a = map(int,input().split())
x = np.zeros(n)
h = x.copy()
for i in range(n):
    x[i],h[i] = map(int,input().split())
    
ind = np.argsort(x)
ind2 = np.arange(n)
x = np.sort(x)
h[ind2] = h[ind]

def calc(x,h):
    if 2*d >= x[-1]-x[0]:
        b = np.max(h)
        ans = b//a + min(1,b%a)
    else:
        ans1 = h[0]//a + min(1,h[0]%a)
        ans2 = h[-1]//a + min(1,h[-1]%a)
        ans = ans1 + ans2
        h[:np.searchsorted(x,x[0]+2*d,side='right')] -= ans1*a
        h[np.searchsorted(x,x[-1]-2*d,side='left'):] -= ans2*a
        c = np.where(h > 0)[0]
        if len(c) > 0:
            x_ = x[c[0]:c[-1]+1]
            h_ = h[c[0]:c[-1]+1]
            ans += calc(x_,h_)
    
    return ans

print(int(calc(x,h)))

Buggy submission (verdict: Runtime Error):
import numpy as np
n,d,a = map(int,input().split())
x = np.zeros(n)
h = x.copy()
for i in range(n):
    x[i],h[i] = map(int,input().split())
    
ind = np.argsort(x)
ind2 = np.arange(n)
x = np.sort(x)
h[ind2] = h[ind]

def calc(x,h):
    if 2*d >= x[-1]-x[0]:
        b = np.max(h)
        ans = b//a + min(1,b%a)
    else:
        ans1 = h[0]//a + min(1,h[0]%a)
        ans2 = h[-1]//a + min(1,h[-1]%a)
        ans = ans1 + ans2
        h[:np.searchsorted(x,x+2*d,side='right')] -= ans1*a
        h[np.searchsorted(x,x[-1]-2*d,side='left'):] -= ans2*a
        c = np.where(h > 0)[0]
        if len(c) > 0:
            x_ = x[c[0]:c[-1]+1]
            h_ = h[c[0]:c[-1]+1]
            ans += calc(x_,h_)
    
    return ans

print(int(calc(x,h)))
Problem p02803 (python)

Fixed submission:
h,w = map(int,input().split())
x = [''.join(["#"]*(w+2))]
s = x+["#"+input()+"#" for _ in range(h)]+x
ans = 0

for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j]=="#":
            continue
        checked = [[False]*(w+2) for _ in range(h+2)]
        checked[i][j]=True
        stack=[[i,j]]
        stack_=[]
        count = 1
        while stack:
            pair=stack.pop()
            for x,y in [[1,0],[-1,0],[0,1],[0,-1]]:
                if s[pair[0]+x][pair[1]+y]=="." and checked[pair[0]+x][pair[1]+y] == False:
                    stack_.append([pair[0]+x,pair[1]+y])
                    checked[pair[0]+x][pair[1]+y] = True
            if stack==[]:
                stack = stack_.copy()
                stack_ = []
                count += 1

        ans = max(ans,count)
        
print(ans-2)

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
x = [''.join(["#"]*(w+2))]
s = x+["#"+input()+"#" for _ in range(h)]+x
ans = 0
checked_ = [[False]*(w+1) for _ in range(h+2)]

for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j]=="#":
            continue
        checked=checked.copy()
        checked[i][j]=True
        stack=[[i,j]]
        stack_=[]
        count = 1
        while stack:
            pair=stack.pop()
            for x,y in [[1,0],[-1,0],[0,1],[0,-1]]:
                if s[pair[0]+x][pair[1]+y]=="." and [pair[0]+x,pair[1]+y] == False:
                    stack_.append([pair[0]+x,pair[1]+y])
                    checked[pair[0]+x][pair[1]+y] = True
            if stack==[]:
                stack = stack_.copy()
                stack_ = []
                count += 1

        ans = max(ans,count)
        
print(ans-2)
Problem p02805 (python)

Fixed submission:
import math
n = int(input())
xy = [list(map(int,input().split())) for _ in range(n)]
point = []
r = 0
for i in range(n-1):
    x1,y1=xy[i]
    for j in range(i+1,n):
        x2,y2=xy[j]
        d = ((x1-x2)/2)**2+((y1-y2)/2)**2
        if r**2 > d:
            if y1-y2 != 0:
                a = -(x1-x2)/(y1-y2)
                x = math.sqrt((r**2-d)/(a**2+1))//10**(-6)*10**(-6)
                point.append([(x1+x2)/2+x,(y1+y2)/2+a*x])
                point.append([(x1+x2)/2-x,(y1+y2)/2-a*x])
            else:
                x = math.sqrt(r**2-d)//1//10**(-6)*10**(-6)
                point.append([(x1+x2)/2,(y1+y2)/2+x])
                point.append([(x1+x2)/2,(y1+y2)/2-x])
        elif r**2 == d:
            point.append([(x1+x2)/2,(y1+y2)/2])

r_o = 800
r_i = 0
while r_o-r_i > 10**(-8):
    judge = 0
    while point:
        x,y = point.pop()
        c = 0
        for i,j in xy:
            if (x-i)**2+(y-j)**2 > r**2:
                c = 1
                break
        if c == 0:
            judge = 1
            break
            
    if judge == 1:
        r_o = r
    else:
        r_i = r
    r = (r_o+r_i)/2
    point = []
    for i in range(n-1):
        x1,y1=xy[i]
        for j in range(i+1,n):
            x2,y2=xy[j]
            d = ((x1-x2)/2)**2+((y1-y2)/2)**2
            if r**2 > d:
                if y1-y2 != 0:
                    a = -(x1-x2)/(y1-y2)
                    x = math.sqrt((r**2-d)/(a**2+1))//10**(-6)*10**(-6)
                    point.append([(x1+x2)/2+x,(y1+y2)/2+a*x])
                    point.append([(x1+x2)/2-x,(y1+y2)/2-a*x])
                else:
                    x = math.sqrt(r**2-d)//10**(-6)*10**(-6)
                    point.append([(x1+x2)/2,(y1+y2)/2+x])
                    point.append([(x1+x2)/2,(y1+y2)/2-x])
            elif r**2 == d:
                point.append([(x1+x2)/2,(y1+y2)/2])
    
print(r)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = sorted(list(map(int,input().split())))
mod = 10**9+7
x = 10**10
count = 0
c=[]
for i in range(n):
    if a[i]!=x:
        if i != 0:
            c.append([x,count])
        x=a[i]
        count = 1
    else:
        count += 1
    
    if i==n-1:
        c.append([x,count])

fact = [1]*(n+1)
inv_fact = [1]*(n+1)
for i in range(n):
    fact[i+1] = fact[i]*(i+1)
    fact[i+1] %= mod
for i in range(n,0,-1):
    if i == n:
        inv_fact[i] = pow(fact[i],mod-2,mod)
    else:
        inv_fact[i] = inv_fact[i+1]*(i+1)
        inv_fact[i] %= mod
        
sum_min = 0
sum_max = 0
b = 0
for i,j in c:
    if n-b < k:
        break
    b += j
    for l in range(max(1,k-n+b),min(k,j)+1):
        d = i*fact[j]*inv_fact[j-l]*inv_fact[l]%mod
        d *= fact[k-j]*fact[n-b]*inv_fact[n-b-k+l]*inv_fact[k-l]%mod
        sum_min += d
        sum_min %= mod
b = 0
for i,j in c[::-1]:
    if n-b < k:
        break
    b += j
    for l in range(max(1,k-n+b),min(k,j)+1):
        d = i*fact[j]*inv_fact[j-l]*inv_fact[l]%mod
        d *= fact[k-j]*fact[n-b]*inv_fact[n-b-k+l]*inv_fact[k-l]%mod
        sum_max += d
        sum_max %= mod
        
print((sum_max-sum_min)%mod)
Problem p02681 (python)

Fixed submission:
S = input()
T = input()

if S == T[0:-1] and len(S) + 1 == len(T):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A, B, C, K = input().split()
# A=1 B=0 C=-1 K
ans = 0

for a in range(int(K)):
    if int(A) == int(K):
        ans = A
        break
    elif int(A) <= int(K):
        ans = A

    elif int(B) <= int(K):
        ans = A

    elif int(C) <= int(K):
        ans = (-1 * C)
        break
if int(A) == int(K):
    print(K)
else:
    print(int(A) + int(B) - int(C))
Problem p02910 (python)

Fixed submission:
import re

S = input()
A = re.compile(r'^([^L][^R])*[^L]?$')

if A.match(S):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import re

S = input()
P = re.compile()

if P.match(S):
    print("Yes")
else:
    print("No")
Problem p03125 (python)

Fixed submission:
list1 = [int(a) for a in input().split()]
list1_0 = list1[0] #A
list1_1 = list1[1] #B

if (list1_1 % list1_0) == 0:
    print(list1_0 + list1_1)
else:
    print(list1_1 - list1_0)

Buggy submission (verdict: Runtime Error):
list1 = [int(a) for a in input().split()]
list1_0 = list1[0] #AB
list1_1 = list1[1] #BC
list1_2 = list1[2] #CA

if (list1_0 * list1_1 // 2) > 1:
    print(list1_0 * list1_1 // 2)
else:
    print(list1)
Problem p03415 (python)

Fixed submission:
# Rows and columns(行と列)
rac_count = 3
rac_all = [input() for a in range(rac_count)]

rac_0 = rac_all[0]
rac_1 = rac_all[1]
rac_2 = rac_all[2]

rac_0_0 = list(rac_0)
rac_1_1 = list(rac_1)
rac_2_2 = list(rac_2)

rac_0_0.extend(rac_1_1)
rac_0_0.extend(rac_2_2)

print(str(rac_0_0[0] + rac_0_0[4] + rac_0_0[8]))

Buggy submission (verdict: Runtime Error):
# Rows and columns(行と列)
rac_count = 3
rac_all = [input().split() for a in range(rac_count)]

rac_0 = rac_all[0]
rac_1 = rac_all[1]
rac_2 = rac_all[2]

rac_0.extend(rac_1)
rac_0.extend(rac_2)

print(str(rac_0[0] + rac_0[4] + rac_0[8]))

Buggy submission (verdict: Runtime Error):
# Rows and columns(行と列)
rac_count = 3
rac_all = [input().split() for a in range(rac_count)]

rac_0 = rac_all[0]
rac_1 = rac_all[1]
rac_2 = rac_all[2]

rac_0.extend(rac_1)
rac_0.extend(rac_2)

print(str(rac_0[0] + rac_0[4] + rac_0[8]))
Problem p02700 (python)

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

for i in range(100):
    c -= b
#    print('c', c)
    if c < 1:
        print('Yes')
        break

    a -= d
 #   print('a',a)
    if a < 1:
        print('No')
        break

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())

for i in range(100): # 繰り返し処理したい、とりあえず100回以上の繰り返しはないから100回繰り返す
    c -= b # 青木くんの体力cから高橋くんの攻撃力bぶん引く
#    print('c', c) # 残り体力確認用
    if c <= 0>: # 青木くん体力が0以下になったら
        print('Yes') # 高橋くんの勝ちなのでYes
        break # 体力が0になったら繰り返しも終了

    a -= d # 次に高橋くんの体力aから青木くんの攻撃力dを引く
 #   print('a',a) # 残り体力確認用
    if a < 1: # 高橋くん体力が0以下になったら
        print('No') # 青木くん勝利でNo
        break # 体力が0になったら繰り返しも終了
# どちらの体力も残ってたら次の繰り返し
Problem p02909 (python)

Fixed submission:
weather = input()

if weather == 'Sunny':
    print('Cloudy')

if weather == 'Cloudy':
    print('Rainy')

if weather == 'Rainy':
    print('Sunny')

Buggy submission (verdict: Runtime Error):
weather = input()

if weather == 'Sunny':
    print 'Cloudy'

if weather == 'Cloudy':
    print 'Rainy'
    
if weather == 'Rainy':
    print 'Sunny'

Buggy submission (verdict: Runtime Error):
weather = input()

if (weather == 'Sunny'):
    print 'Cloudy'

if (weather == 'Cloudy'):
    print 'Rainy'
    
if (weather == 'Rainy'):
    print 'Sunny'

Buggy submission (verdict: Runtime Error):
weather = input()

if (weather == 'Cloudy'):
    print 'Rainy'

if (weather == 'Cloudy'):
    print 'Rainy'
    
if (weather == 'Cloudy'):
    print 'Rainy'

Buggy submission (verdict: Runtime Error):
weather = imput()

if (weather == 'Sunny')
    print 'Cloudy'
if (weather == 'Cloudy')
    print 'Rainy'
if (weather == 'Rainy')
    print 'Sunny'
Problem p03351 (python)

Fixed submission:
data = input()
data1,data2,data3,data4 = data.split()
data1 = int(data1)
data2 = int(data2)
data3 = int(data3)
data4 = int(data4)


if abs(data1 - data3) <= data4:
    print('Yes')
elif abs(data1 - data2) <= data4 and abs(data2 - data3) <= data4:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
data = input()

dataa,datab,datac,datad = data.split(' ')

dataa = int(dataa)
datab = int(datab)
datac = int(datac)
datad = int(datad)

length1 = dataa - datab
length2 = datab - datac
length11 = abs(length1) + abs(length2)
length3 = dataa - datac

if abs(length1) <>= datad:
    print('Yes')
elif abs(length2) <= datad:
    print('Yes')
elif abs(length11) <= datad:
    print('Yes')
else:
    print('No')
Problem p03607 (python)

Fixed submission:
from collections import Counter

n = int(input())
a = [int(input()) for _ in range(n)]

a_c = Counter(a).most_common() 
ans = 0
for i in a_c: 
    if i[1] % 2 == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n))]

paper = []
for i in a:
    if i in paper:
        paper.remove(i)
    else:
        paper.append(i)
print(len(paper))