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

Fixed submission:
a = int(input())

s = input()
ans = s
if (a < 3200):
  ans = 'red'
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

def dfs(graph, start):
    stack = [start]
    visited = []
    while stack:
        label = stack.pop(0)
        if label not in visited:
            visited.append(label)
            stack = graph.get(label, []) + stack
    return visited
  
tree = defaultdict(list)
N,Q = map(int, input().split())

lst1 = [list(map(int, input().split())) for i in range(N-1)]
lst2 = [list(map(int, input().split())) for i in range(Q)]
for i in range(N):
  dict(tree)[i+1] = []
for i in lst1:
  tree[i[0]].append(i[1])
ans = [0] * N
memo = {}
for i in lst2:
  start = i[0]
  visited = []
  if (start == 1):
      ans = list(map(lambda x: x + i[1], ans))
  else:
    if start not in memo.keys():
      memo[start] = dfs(dict(tree), start)
    for j in memo[start]:
      if (start <= j):
        ans[j-1] += i[1]
print(" ".join(list(map(str,ans))))
Problem p02951 (python)

Fixed submission:
A, B, C = map(int, input().split())

if (A - B >= C):
  print(0)
else:
  print(C - (A - B))

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

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

flag = "Yes"
cnt = 0
if (N > 1):
  for i in range(len(lst) - 1):
    if (lst[i+1] - lst[i] < 0):
      cnt += 1
    else:
      cnt = 0
      
    if (cnt > 1):
      flag = "No"

print(flag)
Problem p02984 (python)

Fixed submission:
N = int(input())
lst = list(map(int, input().split()))
S = sum(lst)
ans = []

for i in range(2, N, 2):
  S -= 2 *lst[i-1]
  
ans.append(S)

for i in range(1, N):
  ans.append(2 * lst[i-1] - ans[i-1])

s = " ".join([str(n) for n in ans])
print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst = list(map(int, input().split()))
S = sum(lst)
ans = []

for i in range(2, N, 2):
  S -= 2 *lst[i-1]
  
ans.append(S)

for i in range(1, N):
  ans.append(2 * lst[i-1] - ans[i-1])
print("".join(ans))
Problem p03077 (python)

Fixed submission:
import math
array1 = [int(input()) for i in range(6)]
array2 = array1[1:6]
num = array1[0]
minimum = min(array2)
print(math.ceil(num / minimum) + 4)

Buggy submission (verdict: Runtime Error):
import math
array1 = [int(input()) for i in range(6)]
array2 = array1[1:6]
num = array1[0]
minimum = min(array2)
print(math.ceil(num / minimum + 4)
Problem p03127 (python)

Fixed submission:
import fractions
N = int(input())
lst = list(map(int, input().split()))
ans = lst[0]
for i in range(1, N):
    ans = fractions.gcd(ans, lst[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst = list(map(int, input().split()))
boolean = False
updated_lst = []
minimum = min(lst)
min_num = 0
for i in lst:
  num = i % minimum
  if (i != minimum):
    updated_lst.append(num)
  else:
    updated_lst.append(minimum)
    min_num += 1
  if (num % 2 == 1):
    boolean = True

if (min_num == len(lst)):
  print(minimum)
else:
  if (boolean):
    print(1)
  else:
    print(min(updated_lst)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst = list(map(int, input().split()))
boolean = False
updated_lst = []
minimum = min(lst)
min_num = 0
for i in lst:
  num = i % minimum
  if (i != minimum):
    updated_lst.append(num)
  else:
    updated_lst.append(minimum)
    min_num += 1
  if (num % 2 == 1):
    boolean = True

sum = sum(updated_lst)

if (sum == minimum*min_num):
  print(minimum)
else:
  if (boolean):
    print(1)
  else:
    print(min(updated_lst)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst = list(map(int, input().split()))
boolean = False
updated_lst = []
min = min(lst)
min_num = 0
for i in lst:
  num = i % min
  if (i != min):
    updated_lst.append(num)
  else:
    updated_lst.append(min)
    min_num += 1
  if (num % 2 == 1):
    buulean = True

sum = sum(updated_lst)

if (sum == min*min_num):
  print(min)
else:
  if (boolean):
    print(1)
  else:
    print(min(updated_lst))

Buggy submission (verdict: Runtime Error):
N = int(input())
lst = list(map(int, input().split()))
boolean = False
updated_lst = []
min = min(lst)
min_num = 0
for i in lst:
  num = i % min
  if (i != min):
    updated_lst.append(num)
  else:
    updated_lst.append(min)
    min_num += 1
  if (num % 2 == 1):
    buulean = True

sum = sum(updated_lst)

if (sum == min*min_num):
  print(min)
else:
  if (boolean):
    print(1)
  else:
    print(min(updated_lst))
Problem p03242 (python)

Fixed submission:
s = list(input())
for i in range(len(s)):
    if (s[i] == '1'):
        s[i] = '9'
    else:
        s[i] = '1'
print("".join(s))

Buggy submission (verdict: Runtime Error):
# C
import collections
n = int(input())
lst = list(map(int, input().split()))
lst1 = lst[::2]
lst2 = lst[1::2]
dct1 = sorted(dict(collections.Counter(lst1)).items(), key=lambda x:x[1])
dct2 = sorted(dict(collections.Counter(lst2)).items(), key=lambda x:x[1])

cnt = len(dict(collections.Counter(lst)))
if (cnt == 1):
	print(int(len(lst) / 2))
elif (len(dct1) == 1 and len(dct2) == 1):
	print(0)
elif (len(dct1) == 1 and len(dct2) > 1):
	if (dct1[0][0] == dct2[0][0]):
		print(len(dct2) - dct2[1][1])
	else:
		print(len(dct2) - dct2[0][1])
elif (len(dct2) == 1 and len(dct1) > 1):
	if (dct1[0][0] == dct2[0][0]):
		print(len(dct1) - dct1[1][1])
	else:
		print(len(dct1) - dct1[0][1])
else:
	if (dct1[0][0] == dct2[0][0]):
		print(len(lst) - max(dct1[0][1] + dct2[1][1], dct1[1][1] + dct2[0][1]))
	else:
		print(len(lst) - dct1[0][1] - dct2[0][1])
Problem p03705 (python)

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

if(A > B):
  print(0)
elif (A == B):
    print(1)
else:
  if (N == 1):
    print(0)
  else:
    print((B-A)*(N-2) + 1)

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

if(A > B):
  print(0)
elif (A == B):
    print(1)
  else:
    print(0)
else:
  if (N == 1):
    print(0)
  else:
    print((B-A)*(N-2) + 1)
Problem p02693 (python)

Fixed submission:
k =int(input())
a,b = map(int,input().split())
def judge(k,a,b):
    for i in range(a,b+1):
        if i%k==0:
            return 'OK'
    return 'NG'

print(judge(k,a,b))

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


max=0
for x in range(n+1):
    value=(a*x//b)-a*(x//b)
    if value>max:
        max=value
print(max)
Problem p02753 (python)

Fixed submission:
s = input()
if s[0]=='A' and s[1]=='A' and s[2]=='A':
    print("No")
elif s[0]=='B' and s[1]=='B' and s[2]=='B':
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):

N, A,B = map(int, input().split())
str = []
for j in range(N//(A+B)+1):
    for i in range(A):
        if i==N+1:
            break
        str.append('b')

    for i in range(B):
        if i==N+1:
            break
        str.append('r')
print(str)
count = 0
for k in range(N):
    if str[k] == 'b':
        count+=1
print(count)
Problem p02862 (python)

Fixed submission:
def combination(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
 
 
def main():
    X, Y = map(int, input().split())
 
    if (X + Y) % 3 or X > Y*2 or Y > X*2:
        return 0
 
    n = (X + Y) // 3
    r = Y - n
    return(combination(n, r))
 
 
print(main())

Buggy submission (verdict: Runtime Error):
import math
X,Y = map(int,input().split())

n = 2*Y/3 - X/3
m = 2*X/3 - Y/3


def comb(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r))) % (10**9+7)



if (X+Y)%3 != 0:
    print(0)
else:
    if n<0 or m<0:
        print(0)
    else:
        print(comb(n+m,n))
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()

if a>=3200:
    print(s)
else:
    print('red')

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

ans = 1 / sum(1 / a for a in A)
print(ans)
Problem p02695 (python)

Fixed submission:

lis = []
res = 0


def solve():

    N, M, Q = map(int, input().split())
    e = [list(map(int, input().split())) for i in range(Q)]
    global lis
    lis = [0]*N

    def dfs(x, y):
        global lis, res
        if x == N:
            tmp = 0
            for a, b, c, d in e:
                if lis[b-1]-lis[a-1] == c:
                    tmp += d
            res = max(res, tmp)
            return

        for i in range(y, M+1):
            lis[x] = i
            dfs(x+1, i)

    dfs(0, 1)
    print(res)


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):

list = [0]*Q
res = 0


def solve():

    N, M, Q = map(int, input().split())
    e = [list(map(int, input().split())) for i in range(Q)]

    def dfs(x, y):
        global list, res
        if x == N:
            tmp = 0
            for a, b, c, d in e:
                if list[b-1]-list[a-1] == c:
                    tmp += d
            res = max(res, tmp)
            return

        for i in range(y, M+1):
            w[x] = i
            dfs(x+1, i)

    dfs(0, 1)
    print(res)


if __name__ == "__main__":
    solve()
Problem p02712 (python)

Fixed submission:
def solve():

    N = int(input())

    ans = 0
    for i in range(N+1):
        if i % 3 == 0 and i % 5 == 0:
            pass
        elif i % 3 == 0:
            pass
        elif i % 5 == 0:
            pass
        else:
            ans += i

    print(ans)


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
 
    N = int(input())
 
    ans = 0
    for i in range(N+1):
        if i % 3 == 0 and i % 5 == 0:
            pass
        elif i % 3 == 0:
            pass
        elif i % 5 == 0:
            pass
        else:
            ans += i
 
    print(ans)
 
 
if __name__ == "__main__":
    solve()
def solve():

    N = int(input())

    ans = 0
    for i in range(N):
        if i % 3 == 0 and i % 5 == 0:
            pass
        elif i % 3 == 0:
            pass
        elif i % 5 == 0:
            pass
        else:
            ans += i

    print(ans)


if __name__ == "__main__":
    solve()
提出情報
Problem p02831 (python)

Fixed submission:
import fractions

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

print(A*B//fractions.gcd(A, B))

Buggy submission (verdict: Runtime Error):
import math

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

print(A*B//math.gcd(A, B))

Buggy submission (verdict: Runtime Error):
import math

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

print(int(A*B/math.gcd(A, B)))
Problem p02862 (python)

Fixed submission:
def comb(n, m, p=10**9+7):
    if n < m:
        return 0
    if n < 0 or m < 0:
        return 0
    m = min(m, n-m)
    top = bot = 1
    for i in range(m):
        top = top*(n-i) % p
        bot = bot*(i+1) % p
    bot = pow(bot, p-2, p)
    return top*bot % p


x, y = map(int, input().split())

j = 2*x-y
if j % 3:
    print(0)
    exit()
j //= 3
i = x - 2*j
if i < 0 or j < 0:
    print(0)
    exit()

ans = comb(i+j, i)
print(ans)

Buggy submission (verdict: Runtime Error):
def div_with_mod(x, y, mod):
    # Fermat's little theorem
    return x*pow(y, mod - 2, mod)


def comb(n, r, mod):
    # calculates C(n,r) with mod (assuming mod is prime)
    nc = n
    for rc in range(1, r):
        nc -= 1
        n = n*nc % mod
        r = r*rc % mod

    return div_with_mod(n, r, mod)


x, y = map(int, input().split())

j = 2*x-y
if j % 3:
    print(0)
    exit()
j //= 3
i = x - 2*j
if i < 0 or j < 0:
    print(0)
    exit()

ans = comb(i+j, i)
print(ans)
Problem p03072 (python)

Fixed submission:
N = int(input())
H = list(map(int, (input().split())))
c = 0
nax = 0
for i in range(N):
    nax = max(nax, H[i])
    if H[i] == nax:
        c += 1
print(c)

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

H1 = Hlist[0]
H2 = Hlist[1]

ans = 1
if H2 >= H1:
    ans += 1

for i in range(2, N):
    if Hlist[i] >= H1 and Hlist[i] >= H2 and Hlist[i] >= Hlist[i-1]:
        ans += 1

print(ans)
Problem p03208 (python)

Fixed submission:


def solve():

    N, K = map(int, input().split())
    hlist = [int(input()) for i in range(N)]

    # sortして走破？
    hlist.sort()
    l = []

    for i in range(N-K+1):
        l.append(hlist[i+K-1]-hlist[i])

    print(min(l))


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):


def solve():

    N, K = map(int, input().split())
    hlist = [int(input()) for i in range(N)]

    # sortして走破？
    hlist.sort()
    l = []

    for i in range(N-K+1):
        l.append(hlist(i+K-1)-hlist(i))

    print(min(l))


if __name__ == "__main__":
    solve()
Problem p03307 (python)

Fixed submission:


def solve():
    N = int(input())

    if N % 2 == 0:
        print(N)
    else:
        print(N*2)


# Solve
if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

print(2*N//math.gcd(2, N))
Problem p02701 (python)

Fixed submission:
N=int(input())
S=[]
for i in range(N):
    S.append(input())
print(len(set(S)))

Buggy submission (verdict: Runtime Error):
N=int(input())
S=[]
for i in range(N):
    S.append(int(input()))
print(len(set(S)))

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

e=a//d
f=c//b

if a == d:
    e -= 1
if c == b:
    f -= 1

if e >= f:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=[]
for i in range(N):
    a = int(input())
    if not a in S:
        S.append(a)
print(len(S))
Problem p02723 (python)

Fixed submission:


S = str(input())
if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def INT(): x = int(input()) return x
def LIST(): x = list(map(int, input().split())) return x

S = input()
if S[2]==S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")
Problem p02725 (python)

Fixed submission:
import numpy as np

K,N=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
x=np.array(A[1:])
y=np.array(A[:-1])
B=x-y
C=B.tolist()
C.append(K+A[0]-A[N-1])
print(K-int(max(C)))

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

K,N=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
x=np.array(A[1:])
y=np.array(A[:-1])
B=x-y
B.append(K+A[0]-A[N-1])
print(K-int(max(B))

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

K,N=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
x=np.array(A[1:])
y=np.array(A[:-1])
B=list(map(x-y))
B.append(K+A[0]-A[N-1])
print(K-max(B))

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

K,N=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
x=np.array(A[1:])
y=np.array(A[:-1])
B=x-y
B.append(K+A[0]-A[N-1])
print(K-max(B))

Buggy submission (verdict: Runtime Error):
K,N=map(int,input().split())
A=list(map(int,input().split()))
C = A.sort()
B=C[1:]-C[:-1]
B.append(K+C[0]-C[N-1])
print(K-max(B))

Buggy submission (verdict: Runtime Error):
K,N=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
B=A[1:]-A[:-1]
B.append(K+A[0]-A[N-1])
print(K-max(B))

Buggy submission (verdict: Runtime Error):
K,N=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
B=A[1:]-x[:-1]
B.append(K+A[0]-A[N-1])
print(K-max(B))

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

def distance(x):
    q=x[1:]-x[:-1]
    return q

B=distance(A)
B.append(K+A[0]-A[N-1])
print(K-max(B))
Problem p02753 (python)

Fixed submission:
sta = input()

s1 = sta[0]
s2 = sta[1]
s3 = sta[2]

if s1 == s2 and s2 == s3:
    print("No")
else:
    print("Yes")

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

s1 = sta[0]
s2 = sta[1]
s3 = sta[2]

if :
    pass
if s1 == s2 and s2 == s3:
    print("Yes")
else:
    print("No")
Problem p02754 (python)

Fixed submission:
N , A , B = map(int, input().split())
AB = A + B
a = N // AB
b = N % AB



if b > A:
    print( a * A + A )
else:
    print( a * A + b )

Buggy submission (verdict: Runtime Error):
N , A , B = int(input().split())
a = N // ( A + B )
b = N % ( A + B )

if b >> A:
    print( a * A + A )
else:
    print( a * A + b )
Problem p02790 (python)

Fixed submission:
a,b=(int(x) for x in input().split())
i = 0
if a > b:
  while i < a:
    print(str(b), end="")
    i += 1
else:
  while i < b:
    print(str(a), end="")
    i += 1

Buggy submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())
if a > b:
  while i < b:
    print(str(a))
else:
  while i < a:
    print(str(b))

Buggy submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())
if a > b:
  while i < b:
    print(count(a))
else:
  while i < a:
    print(count(b))

Buggy submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())
if a > b:
  while i == b:
    print(count(a))
else:
  while i == a:
    print(count(b))

Buggy submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())
if a > b:
  print(count(a)).while i == b
else:
  print(count(b)).while i == a
Problem p03107 (python)

Fixed submission:
a = input()
count0 = 0
count1 = 0
b = len(a)
for i in range(b):
    if(a[i] == "0") :
        count0 = count0 + 1
    else:
        count1 = count1 + 1

print(min(count0,count1)*2)

Buggy submission (verdict: Runtime Error):
a = input()
count0 = 0
count1 = 0
a = int(a)
while(a > 0):
    if(a%2 ==0):
        count0 = count0 + 1
        a = a/10
    else:
        count1 = count1 + 1
        a = (a-1)/10

print(min(count0,count1)*2)
Problem p02819 (python)

Fixed submission:
import math

x=int(input())
while 1:
  k=1
  for i in range(2,int(math.sqrt(x))+1):
    if x%i==0:
      k=0
      break
  if k:
    print(x)
    break
  x+=1

Buggy submission (verdict: Runtime Error):
x=input()
while 1:
  k=1
  for i in range(2,x**0.5+1):
    if x%i==0:
      k=0
      break
  if k:
    print(x)
    break
  x+=1

Buggy submission (verdict: Runtime Error):
x=input()
while 1:
  k=1
  for i in range(2,x**2+1):
    if x%i==0:
      k=0
      break
  if k:
    print(x)
    break
  x+=1
Problem p02863 (python)

Fixed submission:
import numpy as np

N,T = map(int, input().split())
item = [None]*N
for i in range(N):
  w,v = map(int,input().split())
  item[i] = [w,v]
item.sort(key=lambda x:x[0])

dp = np.zeros(T, dtype=int)
ans=0
for i in range(N):
    w,v=item[i]
    ans=max(ans,dp.max()+v)
    dp[w:] = np.maximum(dp[w:], dp[:-w] + v)
print(ans)

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().split())
times=[]
values=[]
for i in range(n):
  time,value=map(int,input().split())
  times.append(time)
  values.append(value)
  
def knapsack(i,w):
  if i >= n:
    return 0
  elif w < 0:
    return 0
  else:
    p1 = knapsack(i+1, w)
    p2 = knapsack(i+1, w - times[i]) + values[i]
    return max(p1,p2)

  
print(knapsack(0,t-1))

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().split())
times=[]
values=[]
for i in range(n):
  time,value=map(int,input().split())
  times.append(time)
  values.append(value)
  
def knapsack(i,w):
  if i >= n:
    return 0
  elif w < 0:
    return 0
  else:
    p1 = knapsack(i+1, w)
    p2 = knapsack(i+1, w - times[i]) + values[i]
    if p1>p2:
        return p1
    else:
        return p2

  
print(knapsack(0,t))
Problem p02880 (python)

Fixed submission:
n=int(input())
ans="No"
for i in range(1,10):
  for j in range(1,10):
    if i*j==n:
      ans="Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans="No"
for i in range(100):
  if n%i==0:
    ans="Yes"
    break
print(ans)
Problem p02951 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(max(0,c-(a-b)))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,intpu().split())
print(max(0,c-(a-b)))
Problem p03011 (python)

Fixed submission:
p=list(map(int,input().split()))
print(sum(p)-max(p))

Buggy submission (verdict: Runtime Error):
p,q,r=map(int,input().split())
print(sum(p,q,r)-max(p,q,r))
Problem p03012 (python)

Fixed submission:
n=int(input())
w=list(map(int,input().split()))
for i in range(n-1):
  w[i+1]+=w[i]
ans=100000
for i in range(n-1):
  ans=min(ans,abs(w[i]-(w[n-1]-w[i])))
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
w=list(map(int,input().split()))
for i in range(n-1):
  w[i+1]+=w[i]
ans=100000
for i in range(n-1):
  ans=min(ans,abs(w[i],w[n-1]-w[i]))
print(ans)

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int w[n];
  for(int i=0;i<n;i++)cin>>w[i];
  int s1=0,s2=0;
  for(int i=0;i<n;i++)s1+=w[i];
  int ans=abs(s1-s2);
  for(int i=0;i<n;i++){
    s1-=w[i];
    s2+=w[i];
    ans=min(ans,abs(s1-s2));
  }
  cout<<ans<<endl;
}
Problem p03017 (python)

Fixed submission:
n,a,b,c,d=map(int,input().split())
a-=1
b-=1
c-=1
d-=1
s=input()
m=[0 for i in range(n)]
#a-c,b-d
#abcd
#abdc
for i in range(n):
  if s[i]=="#":
    m[i]=1
if c<d:#abcd
  if "##" in s[a:d]:
    print("No")
  else:
    print("Yes")
else:#d<c abdc
  if "##" in s[a:c]:
    print("No")
  else:
    if "..." in s[b-1:d+2]:
      print("Yes")
    else:
      print("No")

Buggy submission (verdict: Runtime Error):
n,a,b,c,d=map(int,input().split())
a-=1
b-=1
c-=1
d-=1
s=input()
m=[0 for i in range(n)]
#a-c,b-d
#abcd
#abdc
for i in range(n):
    if s[i]=="#":
        m[i]=1
if c<d:#abcd
    if "##" in s[a:d]:
        print("NO")
            else:
print("YES")
else:#d<c abdc
    if "##" in s[a:c]:
        print("NO")
            else:
if "..." in s[b-1:d+1]:
    print("YES")
    else:
        print("NO")
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
ans=""
for i in range(n):
  if k==i+1:
    ans+=str.lower(s[i])
  else:
    ans+=s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=input().split()
s=input()
ans=""
for i in range(n):
  if k+1==i:
    ans+=str.lower(s[i])
  else:
    ans+=s[i]
print(ans)
Problem p03137 (python)

Fixed submission:
n,m=map(int,input().split())
x=list(map(int,input().split()))
if n>=m:
  n=m
if m==1:
  print(0)
else:
  x.sort()
  ans=x[m-1]-x[0]
  l=[]
  for i in range(m-1):
    l.append(x[i+1]-x[i])
  l.sort(reverse=1)
  for i in range(n-1):
    ans-=l[i]
  print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=list(map(int,input().split()))
if m==1:
  print(0)
else:
  x.sort()
  ans=x[m-1]-x[0]
  l=[]
  for i in range(m-1):
    l.append(x[i+1]-x[i])
  l.sort(reverse=1)
  for i in range(n-1):
    ans-=l[i]
  print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
ans=x[m-1]-x[0]
l=[]
for i in range(m-1):
  l.append(x[i+1]-x[i])
l.sort(reverse=1)
for i in range(n-1):
  ans-=l[i]
print(ans)
Problem p03250 (python)

Fixed submission:
a,b,c=map(int,input().split());print(max(a,b,c)*9+a+b+c)

Buggy submission (verdict: Runtime Error):
print(eval('+'.join(input().sort())+'*10'))
Problem p03252 (python)

Fixed submission:
s=input()
n=input()
d=dict()
dd=dict()
ans="Yes"
for i in range(len(s)):
  if s[i] not in d:
    d[s[i]]=n[i]
  elif d[s[i]]!=n[i]:
    ans="No"
  if n[i] not in dd:
    dd[n[i]]=s[i]
  elif dd[n[i]]!=s[i]:
    ans="No"
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=input()
d=dict()
ans="Yes"
for i in range(len(s)):
  if s[i] not in d:
    d[s[i]]=n[i]
  elif d[s[i]]!=n[i]:
    ans="No"
if s!=n and len(s)=26:
  ans="No"
print(ans)
Problem p03327 (python)

Fixed submission:
print('ABD'if int(input())>999else'ABC')

Buggy submission (verdict: Runtime Error):
print('ABD'if input()>999 else'ABC')
Problem p03329 (python)

Fixed submission:
n=int(input())
ans=1000000000
for i in range(0,n+1,6):
  j=n-i
  a=0
  while j:
    a+=j%9
    j//=9
  while i:
    a+=i%6
    i//=6
  ans=min(a,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=1000000000
for i in range(0,n+1,6):
  j=n-i
  while j:
    a=j%9
    j//=9
  while i:
    a+=i%6
    i//=6
  ans=min(a,ans)
prgnt(ans)
Problem p03631 (python)

Fixed submission:
a=input()
ans=0
for i in range(len(a)):
  if not a[i]==a[len(a)-1-i]:
    ans=1
if ans==1:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a=input()
for i in range(len(a)):
  if not a[i]==a[len(a)-1-i]:
    ans=1
if ans==1:
  print("No")
else:
  print("Yes")