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

Fixed submission:
a = int(input())
if a%2==0:
    n = a/2
else:
    n = (a+1)/2
print(int(n))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
e,d,f=map(int,input().split())
g,h,i=map(int,input().split())
bingo = [a,b,c,d,e,f,g,h,i]
a_list= []
yes = 0
N = int(input())
for i in range(0,N):
    b = int(input())
    if b in bingo:
        a_list.append(bingo.index(b))
if 0 in a_list:
    if 1 in a_list:
        if 2 in a_list:
            yes = 1
    if 3 in a_list:
        if 6 in a_list:
            yes = 1
    if 4 in a_list:
        if 8 in a_list:
            yes = 1
if 1 in a_list:
    if 4 in a_list:
        if 7 in a_list:
            yes = 1
if 2 in a_list:
    if 4 in a_list:
        if 6 in a_list:
            yes = 1
    if 5 in a_list:
        if 8 in a_list:
            yes = 1
if 3 in a_list:
    if 4 in a_list:
        if 5 in a_list:
            yes = 1
if 6 in a_list:
    if 7 in a_list:
        if 8 in a_list:
            yes = 1
if yes == 1:
    print("Yes")
if yes == 0:
    print("No")
Problem p02552 (python)

Fixed submission:
n = int(input())

if n == 1:
  print(0)
elif n == 0:
  print(1)

Buggy submission (verdict: Runtime Error):
a = input().split(" ")

x = [int(a[0]),int(a[1])]
y = [int(a[2]),int(a[3])]

ans = []

for i in x:
  for j in y:
    s = i*j
    
    ans.append(s)
ans.sort(reverse = True)  
print(ans[0])
Problem p02570 (python)

Fixed submission:
d,t,s = input().split(" ")

if int(d) <= int(t)*int(s):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
d,t,s = input().split(" ")

if d <= int(t)*int(s):
  print("Yes")
else:
  print("No")
Problem p02595 (python)

Fixed submission:
n,d = input().split(" ")

count = 0
for i in range(int(n)):
  x,y = input().split(" ")
  
  r = (int(x)**2+int(y)**2)**(1/2)
  
  if r <= int(d):
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n,d = input()

count = 0
for i in range(n):
  x,y = input()
  
  r = (int(x)**2+int(y)**2)**(1/2)
  
  if r <= int(d):
    count += 1
print(count)
Problem p02627 (python)

Fixed submission:
n = input()

s = "abcdefghijklmnopqrstuvwxyz"

if n in s:
  print("a")
else:
  print("A")

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

s = abcdefghijklmnopqrstuvwxyz

if n in s:
  print("a")
else:
  print("A")
Problem p02623 (python)

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

a=list(map(int,input().split()))
b=list(map(int,input().split()))

A=[0]
B=[0]
for i in a:
  A.append(i+A[-1])
for i in b:
  B.append(i+B[-1])
  
ans,j = 0,m
for i in range(n+1):
  if A[i] > k:
    break
  while B[j] + A[i] > k:
    j -= 1
  ans=max(ans,i+j)
print(ans)

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

a=list(map(int,input().split()))
b=list(map(int,input().split()))

dp=[0]*(k+1)

sa=0
cnta=0
for i in a:
  sa=sa+i
  cnta+=1
  if sa > k:
    break
  dp[sa]+=cnta

  sb=0
  cntb=0
  for j in b:
    sb=sb+j
    cntb+=1
    if sa+sb > k:
      break
    dp[sa+sb] = dp[sa] + cntb

print(max(dp))
Problem p02695 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
n,m,q = map(int,input().split())
t=[]
def dfs(l):
  if len(l) == n:
    return [l]

  if len(l) == 0:
    t=1
  else:
    t=l[-1]
  res=[]
  for i in range(t, m+1):
    temp=l+[i]
    for j in dfs(temp):
      res.append(j)
  return res

for i in range(q):
  t.append(list(map(int, input().split())))

ans=0
l=dfs([])
for i in l:
  temp=0
  for a,b,c,d in t:
    if i[b-1]-i[a-1] == c:
      temp+=d
  ans=max(ans,temp)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,q = map(int,input().split())
t=[]
def dfs(s):
  if len(s) == 0:
    t="1"
  else:
    t=s[-1]
  res=[]
  if len(s) == n:
    return [s]
  for i in range(int(t),m+1):
    res+=dfs(s+str(i))
  return res

for i in range(q):
  t.append(list(map(int, input().split())))

ans=0
for i in dfs(""):
  temp=0
  for a,b,c,d in t:
    if int(i[b-1])-int(i[a-1]) == c:
      temp+=d
  ans=max(ans,temp)
print(ans)
Problem p02753 (python)

Fixed submission:
s = input()

if s.count("A") == 3 or s.count("B") == 3:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
s=input()
q=int(input())
dir=True
ans=s
query=[]
for i in range(q):
  temp=input()
  if temp[0] == "1":
    dir = dir ^ True
  if temp[0] == "2":
    t,f,c = temp.split()

    if (f == "1" and dir) or (f=="2" and not dir):
      ans=c+ans
    else:
      ans=ans+c
def reverse(s):
  t=""
  for i in range(len(s)-1,-1,-1):
    t+=s[i]
  return t

if dir:
  print(ans)
else:
  print(reverse(ans))
Problem p02762 (python)

Fixed submission:
# dfs
import collections,sys
sys.setrecursionlimit(10**9)
n,m,k = map(int, input().split())

friend = [[]*(n+1) for _ in range(n+1)]
block = [[]*(n+1) for _ in range(n+1)]
teams = [0]*(n+1)
for _ in range(m):
  a,b = map(int, input().split())
  friend[a].append(b)
  friend[b].append(a)
for _ in range(k):
  c,d = map(int, input().split())
  block[c].append(d)
  block[d].append(c)
  
def dfs(i):
  teams[i] = team
  for j in friend[i]:
    if teams[j] != 0:
      continue
    dfs(j)

team=1
for i in range(1,n+1):
  if teams[i] != 0:
    continue
  dfs(i)
  team+=1

c = collections.Counter(teams)

for i in range(1,n+1):
  temp = c[teams[i]]-len(friend[i])-1
  for j in block[i]:
    if teams[j] == teams[i]:
      temp -= 1
  print(temp, end='')
  if i != n:
    print(" ", end='')

Buggy submission (verdict: Runtime Error):
# dfs
import collections
n,m,k = map(int, input().split())

friend = [[]*(n+1) for _ in range(n+1)]
block = [[]*(n+1) for _ in range(n+1)]
teams = [0]*(n+1)
for _ in range(m):
  a,b = map(int, input().split())
  friend[a].append(b)
  friend[b].append(a)
for _ in range(k):
  c,d = map(int, input().split())
  block[c].append(d)
  block[d].append(c)
  
def dfs(i):
  teams[i] = team
  for j in friend[i]:
    if teams[j] != 0:
      continue
    dfs(j)

team=1
for i in range(1,n+1):
  if teams[i] != 0:
    continue
  dfs(i)
  team+=1

c = collections.Counter(teams)

for i in range(1,n+1):
  temp = c[teams[i]]-len(friend[i])-1
  for j in block[i]:
    if teams[j] == teams[i]:
      temp -= 1
  print(temp, end='')
  if i != n:
    print(" ", end='')

Buggy submission (verdict: Runtime Error):
# dfs
import collections
n,m,k = map(int, input().split())

friend = [[]*(n+1) for _ in range(n+1)]
block = [[]*(n+1) for _ in range(n+1)]
friend_candidate = [[0]*(n+1) for _ in range(n+1)]
teams = [0]*(n+1)
for _ in range(m):
  a,b = map(int, input().split())
  friend[a].append(b)
  friend[b].append(a)
for _ in range(k):
  c,d = map(int, input().split())
  block[c].append(d)
  block[d].append(c)
  
def dfs(i):
  teams[i] = team
  for j in friend[i]:
    if teams[j] != 0:
      continue
    teams[j] = team
    dfs(j)

team=1
for i in range(1,n+1):
  if teams[i] != 0:
    continue
  dfs(i)
  team+=1
c = collections.Counter(teams)
for i in range(1,n+1):
  temp = c[teams[i]]-len(friend[i])-1
  for j in block[i]:
    if teams[j] == teams[i]:
      temp -= 1
  print(temp,end='')
  if i != n:
    print(" ",end='')
Problem p02781 (python)

Fixed submission:
n = input()
k = int(input())
ln = len(n) + 1

dp=[[[0]* (ln) for _ in range(2)] for i in range(ln)]
dp[0][0][0] = 1
for i in range(len(n)):
  for smaller in range(2):
    x = int(n[i])
    t = 9 if smaller else x
    for j in range(t+1):
      for knum in range(ln-1):
        if j == 0:
          dp[i+1][int(smaller or j < x)][knum] += dp[i][smaller][knum]
        else:
          dp[i+1][int(smaller or j < x)][knum+1] += dp[i][smaller][knum]
try:
  print(dp[-1][0][k] + dp[-1][1][k])
except:
  print(0)

Buggy submission (verdict: Runtime Error):
n = input()
k = int(input())
ln = len(n) + 1

dp=[[[0]* (ln) for _ in range(2)] for i in range(ln)]
dp[0][0][0] = 1
for i in range(len(n)):
  for smaller in range(2):
    x = int(n[i])
    t = 9 if smaller else x
    for j in range(t+1):
      for knum in range(ln-1):
        if j == 0:
          dp[i+1][int(smaller or j < x)][knum] += dp[i][smaller][knum]
        else:
          dp[i+1][int(smaller or j < x)][knum+1] += dp[i][smaller][knum]
print(dp[-1][0][k]+dp[-1][1][k])
Problem p02862 (python)

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

import sys
sys.setrecursionlimit(200000000)
p = 10**9+7

def exp(y,x):
  xbin=str(bin(x))[2:]
  ans=1
  yl=[0]*(len(xbin)+1)
  yl[0]=y
  yl[1]=y**2
  for d,i in enumerate(xbin[::-1],start=0):
    if d > 1:
      yl[d]=yl[d-1]**2%p
    if i == "1":
      ans=(ans*yl[d])%p
  return ans%p

def ff(n,ca):
  if ca == 0:
    return 1
  if ca == 1:
    return n
  return n*ff(n-1,ca-1)%p

if (y+x)%3 != 0:
  print(0)
elif y/x > 2:
  print(0)
elif y/x < 0.5:
  print(0)
else:
  n=(2*x-y)//3
  m=(2*y-x)//3
  fact=1
  for i in range(2,n+1):
    fact=fact*i%p
  ans=ff(n+m,n)*exp(fact,p-2)%p
  print(ans)

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

import sys
sys.setrecursionlimit(200000000)
p = 10**9+7

def exp(y,x):
  xbin=str(bin(x))[2:]
  ans=1
  yl=[0]*(len(xbin)+1)
  yl[0]=y
  yl[1]=y**2
  for d,i in enumerate(xbin[::-1],start=0):
    if d > 1:
      yl[d]=yl[d-1]**2%p
    if i == "1":
      ans=(ans*yl[d])%p
  return ans%p

def ff(n,ca):
  if ca == 1:
    return n
  return n*ff(n-1,ca-1)%p

if (y+x)%3 != 0:
  print(0)
elif y/x > 2:
  print(0)
elif y/x < 0.5:
  print(0)
else:
  n=(2*x-y)//3
  m=(2*y-x)//3
  fact=1
  for i in range(2,n+1):
    fact=fact*i%p
  ans=ff(n+m,n)*exp(fact,p-2)%p
  print(ans)

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

import sys
sys.setrecursionlimit(200000000)
p = 10**9+7

def exp(y,x):
  xbin=str(bin(x))[2:]
  ans=1
  yl=[0]*(len(xbin)+1)
  yl[0]=y
  yl[1]=y**2
  for d,i in enumerate(xbin[::-1],start=0):
    if d > 1:
      yl[d]=yl[d-1]**2%p
    if i == "1":
      ans=(ans*yl[d])%p
  return ans%p

def ff(n,ca):
  if ca == 1:
    return n
  return n*ff(n-1,ca-1)%p

if (y+x)%3 != 0:
  print(0)
elif y/x > 2:
  print(0)
elif y/x < 0.5:
  print(0)
else:
  n=(2*x-y)//3
  m=(2*y-x)//3
  fact=[0,1]
  for i in range(2,n+m+1):
    fact.append(fact[-1]*i % p)
  ans=ff(n+m,n)*exp(fact[n],p-2)%p
  print(ans)

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

import sys
sys.setrecursionlimit(200000000)
p = 10**9+7
fact=[0,1]
for i in range(2,max(x,y)+1):
  fact.append(fact[-1]*i % p)

def exp(y,x):
  xbin=str(bin(x))[2:]
  ans=1
  yl=[0]*(len(xbin)+1)
  yl[0]=y
  yl[1]=y**2
  for d,i in enumerate(xbin[::-1],start=0):
    if d > 1:
      yl[d]=yl[d-1]**2%p
    if i == "1":
      ans=(ans*yl[d])%p
  return ans%p

def ff(n,ca):
  if ca == 1:
    return n
  return n*ff(n-1,ca-1)%p

if (y+x)%3 != 0:
  print(0)
elif y/x > 2:
  print(0)
elif y/x < 0.5:
  print(0)
else:
  n=(2*x-y)//3
  m=(2*y-x)//3
  ans=ff(n+m,n)*exp(fact[n],p-2)%p
  print(ans)
Problem p02879 (python)

Fixed submission:
n, m = map(int, input().split())
 
if n <= 9 and m <= 9:
  print(n * m)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input())
 
if n <= 9 and m <= 9:
  print(n * m)
else:
  print(-1)

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

if n <= 9 and m <- 9:
  print(n * m)
Problem p03013 (python)

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

fact=[0,1]
fact_inv=[0]*(n+1)
for i in range(2,n+1):
  fact.append(fact[-1]*i % MOD)

fact_inv[n] = pow(fact[n],MOD-2,MOD)
for i in range(n-1,-1,-1):
  fact_inv[i] = fact_inv[i+1]*(i+1)%MOD

def comb(n,r):
  return fact[n]*fact_inv[r]*fact_inv[n-r]%MOD

def sigmaComb(dis):
  ans=0
  if dis == 1 or dis == 0:
    return 1
  end=dis//2+1
  for i in range(end):
    t=comb(dis-i,i)
    #print(dis-i,i,t)
    ans+=t
  return ans

hole=[0]
ans=1
for i in range(m):
  t = int(input())
  availLeft=hole[-1]
  availRight=t-1
  dis=availRight-availLeft
  if dis <0:
    ans=0
    break

  ans=ans*sigmaComb(dis)%MOD
  #print("dis=",dis,t,ans)
  hole.append(t+1)
else:
  availLeft=hole[-1]
  availRight=n
  dis=availRight-availLeft
  #print("dis=",dis,hole[-1],ans)
  ans=ans*sigmaComb(dis)%MOD

print(ans%MOD)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
temp = [0] * (n + 1)
temp[0] = 0
temp[1] = 1
temp[2] = 2
for i in range(3, n + 1):
  temp[i] = temp[i-1] + temp[i-2]

mod = 10 ** 9 + 7
start = 0
cnt = 1
for i in range(m):
  ko = int(input())
  if ko == 1:
    start = ko + 1
    continue
  end = ko - 1
  diff = end - start
  if diff < 0:
    diff = 0
  if diff == 0:
    start = ko + 1
    continue
  cnt = cnt * temp[diff]
  start = ko + 1

if n - start != 0:
  cnt = cnt * temp[n - start]
print(cnt % mod)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
temp = [0] * (n + 1)
temp[0] = 0
temp[1] = 1
temp[2] = 2
for i in range(3, n + 1):
  temp[i] = temp[i-1] + temp[i-2]

mod = 10 ** 9 + 7
start = 0
cnt = 1
for i in range(m):
  ko = int(input())
  if ko == 1:
    start = ko + 1
    continue
  end = ko - 1
  diff = end - start
  if diff < 0:
    diff = 0
  cnt = cnt * temp[diff]
  start = ko + 1

if n - start != 0:
  cnt = cnt * temp[n - start]
print(cnt % mod)
Problem p03045 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)
n,m = map(int, input().split())

rel = [[] for _ in range(n)]
for i in range(m):
  x,y,z = map(int, input().split())
  rel[x-1].append(y-1)
  rel[y-1].append(x-1)

ans = [-1]*n
def hoge(parent, pos):
  for i in rel[pos]:
    if ans[i] >= 0:
      continue
    ans[i] = pos
    hoge(pos, i)
  return

cnt = 0
for i in range(n):
  if ans[i] < 0:
    hoge(0, i)
    cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
from collections import deque
n,m = map(int, input().split())

rel = [[] for _ in range(n)]
for i in range(m):
  x,y,z = map(int, input().split())
  rel[x-1].append(y-1)
  rel[y-1].append(x-1)

ans = [-1]*n
def hoge(parent, pos):
  for i in rel[pos]:
    if ans[i] >= 0:
      continue
    ans[i] = pos
    hoge(pos, i)
  return

cnt = 0
for i in range(n):
  if ans[i] < 0:
    hoge(0, i)
    cnt += 1

print(cnt)
Problem p03804 (python)

Fixed submission:
n,m = map(int, input().split())
ma = []
for i in range(n):
  ma.append(input())

t = []
for i in range(m):
  t.append(input())

ans = False
for i in range(n - m + 1):
  for j in range(n - m + 1):
    for k in range(m):
      ll = ma[i + k][j : j + m]
      if ll != t[k]:
        break
    else:
      ans = True

if ans:
  print("Yes")
else:
  print("No")

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

t = []
for i in range(m):
  t.append(input())

ly = len(t[0])
lt = m
ans = False
for i in range(n):
  for j in range(n):
    for k in range(lt):
      if ma[i + k][j : j + ly + 1] != t[k]:
        break
    else:
      ans = True

if ans:
  print("Yes")
else:
  print("No")
Problem p03805 (python)

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

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

ans = 0
def dfs(i):
  global ans
  if all(reach[1:]):
    ans += 1
  for j in ma[i]:
    if reach[j] == 1:
      continue
    reach[j] = 1
    dfs(j)
    reach[j] = 0

reach=[0]*(n+1)
reach[1] = 1
dfs(1)
print(ans)

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

ma = [[] for i in range(n+1)]
for i in range(n):
  a,b = map(int, input().split())
  ma[a].append(b)
  ma[b].append(a)

ans = 0
def dfs(i):
  global ans
  if all(reach[1:]):
    ans += 1
  for j in ma[i]:
    if reach[j] == 1:
      continue
    reach[j] = 1
    dfs(j)
    reach[j] = 0

reach=[0]*(n+1)
reach[1] = 1
dfs(1)
print(ans)
Problem p02571 (python)

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

ls = len(S)
lt = len(T)
ans = lt

for i in range(ls-lt+1):
    cnt = 0
    for j in range(lt):
        if S[j+i] != T[j]:
            cnt += 1
    ans = min(ans, cnt)

print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

L = 0
judge = False

for i in range(len(T), 0, -1):
    # print(i)
    for j in range(len(T)-i+1):
        print(S[j:])
        if T[j:j+i] in S[j:]:
            L = i
            # print(T[j:j+i])
            judge = True
            # print(i, j)
            break
    if judge:
        break

print(len(T)-L)
Problem p02707 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))

dict={}

for a in A:
    if a in dict.keys():
        dict[a]+=1
    else:
        dict[a]=1
dict[N]=0

for i in range(1,N+1):
    if i in dict.keys():
        print(dict[i])
    else:
        print(0)

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

dict={}
dict[max(A)+1]=0
dict[1]=0
for a in A:
    if a in dict.keys():
        dict[a]+=1
    else:
        dict[a]=1
        if a+1 not in dict.keys():
            dict[a+1]=0

print(dict[1])
for a in A:
    print(dict[a+1])
    dict[a+1]=0

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

dict={}
dict[max(A)+1]=0
for a in A:
    if a in dict.keys():
        dict[a]+=1
    else:
        dict[a]=1
        if a+1 not in dict.keys():
            dict[a+1]=0

print(dict[1])
for a in A:
    print(dict[a+1])
    dict[a+1]=0

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

dict={}
dict[max(A)+1]=0
for a in A:
    if a in dict.keys():
        dict[a]+=1
    else:
        dict[a]=1
        if a+1 in dict.keys():
            dict[a+1]=0

print(dict[1])
for a in A:
    print(dict[a+1])
    dict[a+1]=0

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

dict={}
dict[max(A)+1]=0
for a in A:
    if a in dict.keys():
        dict[a]+=1
    else:
        dict[a]=1

print(dict[1])
for a in A:
    print(dict[a+1])
    dict[a+1]=0
Problem p02735 (python)

Fixed submission:
H,W=map(int,input().split())
s=[list(input()) for _ in range(H)]

dp=[]
blacks=[]
whites=[]
black=0
white=0
#DP=[]
#print(s)

for h in range(H):
    dp.append([0]*W)
    #DP.append([0]*W)
    for w in range(W):
        #print(s[h][w],dp[h][w])
        if s[h][w]==".":
            if h!=0 and w==0:
                dp[h][w]=dp[h-1][w]
                #DP[h][w]=DP[h-1][w]+1
            elif h==0 and w!=0:
                dp[h][w]=dp[h][w-1]
                #DP[h][w]=DP[h][w-1]+1
            elif h==0 and w==0:
                dp[h][w]=0
                #DP[h][w]=1
            else:
                dp[h][w]=min(dp[h-1][w],dp[h][w-1])
                #DP[h][w]=min(DP[h-1][w],DP[h][w-1])+1
        else:
            if h!=0 and w==0:
                if s[h-1][w]=="#":
                    dp[h][w]=dp[h-1][w]
                else:
                    dp[h][w]=dp[h-1][w]+1
                #DP[h][w]=DP[h-1][w]
            elif h==0 and w!=0:
                if s[h][w-1]=="#":
                    dp[h][w]=dp[h][w-1]
                else:
                    dp[h][w]=dp[h][w-1]+1
                #DP[h][w]=DP[h][w-1]
            elif h==0 and w==0:
                dp[0][0]=1
                #DP[0][0]=0
            else:
                if s[h-1][w]=="." and s[h][w-1]=="#":
                    dp[h][w]=min(dp[h-1][w]+1,dp[h][w-1])
                elif s[h-1][w]=="#" and s[h][w-1]==".":
                    dp[h][w]=min(dp[h-1][w],dp[h][w-1]+1)
                elif s[h-1][w]=="#" and s[h][w-1]=="#":
                    dp[h][w]=min(dp[h-1][w],dp[h][w-1])
                elif s[h-1][w]=="." and s[h][w-1]==".":
                    dp[h][w]=min(dp[h-1][w]+1,dp[h][w-1]+1)
        #print(dp)
                
print(dp[H-1][W-1])

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

dp=[[0]*H]*W
#print(s)
answer=[]



for h in range(H):
    for w in range(W):
        #print(s[h][w],dp[h][w])
        if s[h][w]==".":
            if h!=0 and w==0:
                dp[h][w]=dp[h-1][w]
            elif h==0 and w!=0:
                dp[h][w]=dp[h][w-1]
            elif h==0 and w==0:
                pass
            else:
                dp[h][w]=min(dp[h-1][w],dp[h][w-1])
        else:
            if s[h][w]=="#":
                if h!=0 and w==0:
                    dp[h][w]=dp[h-1][w]+1
                elif h==0 and w!=0:
                    dp[h][w]=dp[h][w-1]+1
                elif h==0 and w==0:
                    dp[h][w]=1
                else:
                    dp[h][w]=min(dp[h-1][w],dp[h][w-1])+1
        #print(s[h][w],dp[h][w])
#print(dp)
print(dp[H-1][W-1])
Problem p02773 (python)

Fixed submission:
N=int(input())
S=[input() for _ in range(N)]

S_d={}
A=[]

for i in range(N):
    if S[i] not in S_d.keys():
        S_d[S[i]]=1
    else:
        S_d[S[i]]+=1

max_co=max(S_d.values())

for j in S_d.keys():
    if S_d[j]==max_co:
        A.append(j)

B=sorted(A)

for k in B:
    print(k)

Buggy submission (verdict: Runtime Error):
import collections as col
N=int(input())
S=[]
answer=[]

for _ in range(N):
    S.append(input())
T=sorted(S)
s=col.Counter(T)
values, counts = zip(*s.most_common())
#print(values,counts)
print(values[0])
t=1

for i in range(N):
    if counts[i]==max(counts):
        answer.append(values[i])
answer.sort()
for j in answer:
    print(j)

Buggy submission (verdict: Runtime Error):
import collections as col
N=int(input())
counts=[]
A=[]
S=[]
T=[]
U=[]
for _ in range(N):
    S.append(input())
T=sorted(S)
s=col.Counter(T)
values, counts = zip(*s.most_common())

print(values[0])
t=1

while t<=len(values) and counts[t]==counts[t-1]:
    print(values[t])
    t+=1

Buggy submission (verdict: Runtime Error):
import collections as col
N=int(input())
counts=[]
A=[]
S=[]
T=[]
U=[]
for _ in range(N):
    S.append(input())
T=sorted(S)
s=col.Counter(T)
values, counts = zip(*s.most_common())

print(values[0])
t=1
while counts[t]==counts[t-1]:
    print(values[t])
    t+=1
Problem p02847 (python)

Fixed submission:
S=input()

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

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

A=["SAT","FRI","THU","WED","TUE","MON","SUM"]

print(A.index(S)+1)
Problem p02859 (python)

Fixed submission:
r=int(input())

print(r**2)

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

print(r**2)
Problem p02897 (python)

Fixed submission:
N=int(input())

if  N%2==1:
    print((N//2+1)/N)

else:
    print(1/2)

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

if  N%2=1:
    print((N//2+1)/N)

else:
    print(1/2)

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

if  N%2=1
    print((N//2+1)/N)

else  print(1/2)

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

if  N%2=1
    print(N//2+1/N)

else  print(1/2)