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

Fixed submission:
l,r=map(int, input().split())

if r-l > 2019:
    s=list(range(0, 2019))
else:
    s=set()
    for i in range(l, r+1):
        s.add(i%2019)
    s=list(s)

ans=float('inf')
for i in range(len(s)):
    for j in range(i+1, len(s)):
        ans=min(ans, (s[i]*s[j])%2019)

print(ans)

Buggy submission (verdict: Runtime Error):
import math

l,r=map(int, input().split())

if r-l > 2019:
    s=list(range(0, 2019))
else:
    s=set()
    for i in range(l, r+1):
        s.add(i%2019)
    s=list(s)

ans=math.inf
for i in range(len(s)):
    for j in range(i+1, len(s)):
        ans=min(ans, (s[i]*s[j])%2019)

print(ans)

Buggy submission (verdict: Runtime Error):
import math

l,r=map(int, input().split())
s=set()
for i in range(l+1, r):
    s.add(i%2019)
s=list(s)

ans=math.inf
for i in range(len(s)):
    for j in range(i+1, len(s)):
        ans=min(ans, (s[i]*s[j])%2019)

print(ans)
Problem p02995 (python)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

a,b,c,d=map(int, input().split())
cd=lcm(c, d)

cc=b//c - (a-1)//c
dc=b//d - (a-1)//d
cdc=b//cd - (a-1)//cd

print(b-(a-1)-cc-dc+cdc)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a,b,c,d=map(int, input().split())
re=[]
cd=lcm(c, d)

cc=int(b/c - a/c)
dc=int(b/d - a/d)
cdc=int(b/cd - a/cd)

print(b-a-cc-dc+cdc)
Problem p03105 (python)

Fixed submission:
data = input().split()
a = int(data[0])
b = int(data[1])
c = int(data[2])

if b >= (a*c):
    print(c)
else:
    print(int(b/a))

Buggy submission (verdict: Runtime Error):
data = input().split()
n = int(data[0])
m = int(data[1])
edge=[]
for i in range(m):
    tmp = []
    data = input().split()
    tmp.append(int(data[0])-1)
    tmp.append(int(data[1])-1)
    edge.append(tmp)

grp=list(range(0, n))
def group(num):
    if grp[num] == num:
        return num
    return group(grp[num])

def merge(num1, num2):
    grp[num2]=grp[num1]

res=[]
ans = [1]*n
ben = int(n*(n-1)/2)
edge.reverse()
for e in edge:
    #print(e, ans, ben, grp)
    res.append(ben)
    g0 = group(e[0])
    g1 = group(e[1])
    if g0 != g1:
        ben -= ans[g0]*ans[g1]
        sum = ans[g0]+ans[g1]
        merge(g0, g1)
        ans[g0]=sum
        ans[g1]=sum

res.reverse()
for r in res:
    print(r)

#print(int(n*(n-1)/2))
Problem p03106 (python)

Fixed submission:
data = input().split()
a = int(data[0])
b = int(data[1])
k = int(data[2])
 
ans = []
for i in range(1, a+1 if a < b else b+1):
    if a%i == 0 and b%i == 0:
        ans.append(i)

print(ans[len(ans)-k])

Buggy submission (verdict: Runtime Error):
data = input().split()
a = int(data[0])
b = int(data[1])
k = int(data[2])

ans = []
for i in range(1, a if a < b else b):
    if a%i == 0 and b%i == 0:
        ans.append(i)

print(ans[k-1])
Problem p03399 (python)

Fixed submission:
inputs = [int(input()) for _ in range(4)]
print(min(inputs[:2]) + min(inputs[2:]))

Buggy submission (verdict: Runtime Error):
inputs = list(map(int, input().split()))
print(min(inputs[:2]) + min(inputs[2:]))

Buggy submission (verdict: Runtime Error):
inputs = map(int, input().split())
print(min(inputs[:2]) + min(inputs[2:]))
Problem p03693 (python)

Fixed submission:

r, g, b = list(map(int, input().split()))
a = r*100+g*10+b

if a % 4 == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):

r, g, b = list(map(int, input()))
a = r*100+g*10+b

if a % 4 == 0:
    print('Yes')
else:
    print('No')
Problem p03844 (python)

Fixed submission:


a, o, b = input().split()
a = int(a)
b = int(b)

if o == '+':
    print(a+b)
elif o == '-':
    print(a-b)

Buggy submission (verdict: Runtime Error):

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

A_ = sorted(A)

if len(A_) == 1:
    if A_[0] == 0:
        print(1)
    else:
        print(0)

else:

    if len(A_) % 2 == 0:
        if A_[0] != 0 or A_[1] != 0:
            print(0)
            exit()

    else:
        if A_[0] != 0 or A_[1] == 0:
            print(0)
            exit()





    for i in range(len(A_) // 2):
        if A_[2*i] != A_[2*i+1]:
            print(0)
            exit()


    ans_ = 2 ** (N // 2)
    ans = ans_ % (10**9 + 7)
    print(ans)
Problem p03860 (python)

Fixed submission:

s = input().split()
output = ''

for s_i in s:
    output += s_i[0]

print(output)

Buggy submission (verdict: Runtime Error):

N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0

def need_to_eat(a, i):
    return a[i] + a[i+1] > x


for i in range(N-1):
    while need_to_eat(a, i):
        a[i] -= 1
        ans += 1

print(ans)
Problem p02717 (python)

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

d = int

d = a
a = b
b = d 
d = c 
c = a
a = d
print(a,b,c)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
d = int

d = a
a = b
b = d 
d = c 
c = a
a = d
print(a,b,c)
Problem p02724 (python)

Fixed submission:
X = int(input())

print( (X//500)*1000 + ((X%500)//5)*5 )

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

print( (X//500)*1000 + ((X%500)//5)*5
Problem p02730 (python)

Fixed submission:

S = input()
N = len(S)

S1 = S[:(N-1)//2]
S2 = S[(N+3)//2 - 1:]

print("Yes" if S == S[::-1] and S1 == S1[::-1] and S2== S2[::-1] else "No")

Buggy submission (verdict: Runtime Error):

S = input()
N = len(S)

S1 = S[:(N-1)/2]
S2 = S[(N+3)/2:]

print("Yes" if S1 == sorted(S1)[::-1] and S2== sorted(S2)[::-1] else "No")

Buggy submission (verdict: Runtime Error):

S = input()
N = len(S)

print("Yes" if S[:(N-1)/2]== sorted(S)[:(N-1)/2:-1] and S[(N+3)/2:]== sorted(S)[(N+3)/2::-1] else "No")

Buggy submission (verdict: Runtime Error):

S = input()
N = len(S)

print("Yes" if len(set(S[:(N-1)//2])) == 2 and len(set(S[(N+3)//2:])==2 else "No")
Problem p02811 (python)

Fixed submission:
K, X = map(int, input().split())

print("Yes" if 500*K >= X else "No")

Buggy submission (verdict: Runtime Error):
K, X = map(int, input())

print("Yes" if 500*K >= X else "No")
Problem p02909 (python)

Fixed submission:

S = input()

weather = ["Sunny", "Cloudy", "Rainy"]
print(weather[(weather.index(S)+1)%3])

Buggy submission (verdict: Runtime Error):

S = input()

weather = ["Sunny", "Cloudy", "Rainly"]
print(weather[(weather.index(S)+1)%3 ])

Buggy submission (verdict: Runtime Error):

S = input()

weather = ["Sunny", "Cloudy", "Rainly"]
print(weather[(weather.index(s)+1)%3])
Problem p03136 (python)

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

print("Yes" if max(a) < sum(a)-max(a) else "No")

Buggy submission (verdict: Runtime Error):

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

print("Yes" if max(a) ＜ sum(a)-max(a) else "No")

Buggy submission (verdict: Runtime Error):

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

print("Yes" if max(a) ＜ sum(a)-max(a) else "No")

Buggy submission (verdict: Runtime Error):

N = int(input())
a = [int(input()) for i in range(N)]

print("Yes" if max(a) > sum(a)-max(a) else "No")
Problem p03145 (python)

Fixed submission:
AB, BC, CB = map(int, input().split())
print(AB*BC//2)

Buggy submission (verdict: Runtime Error):
|AB|, |BC|, |CB| = map(int, input().split())
print(|AB|*|BC|//2)
Problem p03220 (python)

Fixed submission:

N = int(input()) # 地点の候補数
T, A = map(int, input().split()) # T:平均気温 A:温度
H = list(map(int, input().split())) #標高(x)

list = [abs(A-(T - i * 0.006)) for i in H]

print(list.index(min(list))+1)

Buggy submission (verdict: Runtime Error):

N = int(input()) # 地点の候補数
T, A = map(int, input().split()) # T:平均気温 A:温度
H = list(map(int, input().split())) #標高(x)

list = [A-(T - i * 0.006) for i in H]

print(list.index(min(abs(list)))+1)
Problem p03337 (python)

Fixed submission:

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

print(max(A+B, A-B, A*B))

Buggy submission (verdict: Runtime Error):

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

print(max(A+B, A-B, A*B))
Problem p03385 (python)

Fixed submission:

S = input()

print("Yes" if set(S)=={"a", "b", "c"} else "No")

Buggy submission (verdict: Runtime Error):

a, b, c = input()

print("Yes" if set(a,b,c)==("a", "b", "c") else "No")

Buggy submission (verdict: Runtime Error):

a, b, c = input()

print("Yes" if set(a,b,c)=("a", "b", "c") else "No")

Buggy submission (verdict: Runtime Error):

S = input()

print("Yes" if set(S)=("a", "b", "c") else "No")
Problem p03448 (python)

Fixed submission:

A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for i in range(A+1) :
    for j in range(B+1) :
        for k in range(C+1) :
            if X == 500*i + 100*j + 50*k :
                count += 1

print(count)

Buggy submission (verdict: Runtime Error):

A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for i in range(A+1) :
    for j in range(B+1) :
        for k in range(C+1) :
            if X%(500*i + 100*j + 50*k) == 0 :
                count += 1

print(count)

Buggy submission (verdict: Runtime Error):

A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for i in range(A+1) :
    for j in range(B+1) :
        for k in range(C+1) :
            if x%(500*i + 100*j + 50*k) == 0 :
                count += 1

print(count)
Problem p03477 (python)

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

print("Left" if (A+B)>(C+D) else "Balanced" if (A+B)==(C+D) else "Right")

Buggy submission (verdict: Runtime Error):

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

print("Left" if (A+B)>(C+D) else "Balanced" if (A+B)==(C+D) else "Right

Buggy submission (verdict: Runtime Error):

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

print("Left" if (A+B)>(C+D) else "Balanced" if (A+B)=(C+D) else "Right
Problem p03478 (python)

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

print(sum(i for i in range(1,N+1) if A<= sum(map(int, str(i))) <= B))

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

print(sum(i for i in range(1,N+1) if A<= sum(map(int, str(i))) <= B)

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

print(sum(i for i in range(1,N+1)) if A<= sum(map(int, str(i))) <= B)
Problem p03493 (python)

Fixed submission:
sss = input()
print(sss.count("1"))

Buggy submission (verdict: Runtime Error):
sss = input()
print(sss.count(1))
Problem p03494 (python)

Fixed submission:

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

count =0
while all(a%2 == 0 for a in A) :
    A = [a/2 for a in A]
    count = count + 1


print(count)

Buggy submission (verdict: Runtime Error):

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

count =0
while all(a%2 == 0 for a in A) :
    A = [a/2 in a in A]
    count = count + 1


print(count)
Problem p03502 (python)

Fixed submission:

N = input()

print("Yes" if int(N) % sum(map(int, N)) == 0 else "No")

Buggy submission (verdict: Runtime Error):

N = input()

print("Yes" sum(map(int, N)) % int(N) == 0 else "No")
Problem p03555 (python)

Fixed submission:

c = input()
d = input()

print("YES" if c==d[::-1] else "NO")

Buggy submission (verdict: Runtime Error):

c = input()
d = input()

print("YES" c==c[::-1] and d==d[::-1] else "NO")
Problem p03573 (python)

Fixed submission:

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

if A == B :
    print(C)
elif B == C :
    print(A)
elif C == A :
    print(B)

Buggy submission (verdict: Runtime Error):

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

print(C if A == B else B if A == C else A if B == C)
Problem p03605 (python)

Fixed submission:
N = input()

if "9" in N :
    print("Yes")
else :
    print("No")

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

if 9 in N :
    print("Yes")
else :
    print("No")
Problem p03636 (python)

Fixed submission:

s = input()

print(s[0] + str(len(s)-2) + s[-1])

Buggy submission (verdict: Runtime Error):

s = input()

print(s[0] + len(s[1,len(s)]) + s[-1])
Problem p03694 (python)

Fixed submission:
input()
a = sorted(map(int, input().split()))
print(a[-1]-a[0])

Buggy submission (verdict: Runtime Error):

N = int(input())

list = []
for i in range(N) :
    a = input()
    list.append(a)

list.sort()

print(int(list[N-1])-int(list[0]))

Buggy submission (verdict: Runtime Error):

N = int(input()) 

list = []
for i in range(N) :
    a = input()
    list.append(a)

list.sort()

print(int(list[N-1])-int(list[0]))

Buggy submission (verdict: Runtime Error):

N = int(input()) 

list = []
for i in range(N) :
    a = input()
    list.append(a)

print(int(list[N-1])-int(list[0]))

Buggy submission (verdict: Runtime Error):

N = int(input()) 

list = []
for i in range(N) :
    a = input()
    list.append(a)

print(int(list[N])-int(list[0]))

Buggy submission (verdict: Runtime Error):

N = int(input()) #家の数

list = []
for i in N :
    a = input()
    list.append(a)

print(int(list[N])-int(list[0]))
Problem p03698 (python)

Fixed submission:

S = input()

print("yes" if len(set(S))==len(S) else "no")

Buggy submission (verdict: Runtime Error):

S = input()

print("yes" if set(len(S))==len(S) else "no")
Problem p03719 (python)

Fixed submission:

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

print("Yes" if C >= A and C <= B else "No")

Buggy submission (verdict: Runtime Error):

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

print("Yes" if C >= A and C =< B else "No")
Problem p03796 (python)

Fixed submission:
import math
N = int(input())
print(math.factorial(N) % (10**9+7))

Buggy submission (verdict: Runtime Error):

import math
N = int(input())
print((math.factorial(N))/(10**9 + 7))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
print((math.factorial(N)/(10**9 + 7)))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
print((math.factorial(N)/(10**9 + 7))
Problem p03852 (python)

Fixed submission:

c = input()
if c in "aiueo" :
    print("vowel")
else :
    print("consonant")

Buggy submission (verdict: Runtime Error):

c = input()
if "a", "i", "u", "e", "o" in c :
    print("vowel")
else :
    print("consonant")
Problem p03943 (python)

Fixed submission:

a, b, c = sorted(map(int, input().split()))

print("Yes" if a+b==c else "No")

Buggy submission (verdict: Runtime Error):

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

print("Yes" if a+b==c else "No")
Problem p02945 (python)

Fixed submission:
A,B=map(int, input().split())
print(max(A+B,A-B,A*B))

Buggy submission (verdict: Runtime Error):
あｓｄｆ

Buggy submission (verdict: Runtime Error):
っっｊ

Buggy submission (verdict: Runtime Error):
hh

Buggy submission (verdict: Runtime Error):
jh

Buggy submission (verdict: Runtime Error):
sfdsad
Problem p02946 (python)

Fixed submission:
K, X = map(int, input().split())
ans =[]
for i in range(X - (K-1), X):
    ans.append(i)
for i in range(X, X + (K)):
    ans.append(i)
print(" ".join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())
ans =[]
for i in range(X - (K-1), X):
    ans.append(i)
for i in range(X, X + (K)):
    ans.append(i)
print(" ".join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())
ans =[]
for i in range(X - (K-1), X):
    ans.append(i)
for i in range(X, X + (K)):
    ans.append(i)
print(" ".join(map(str, ans)))
Problem p02972 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[0] * N
ans = []
for i in reversed(range(1, N+1)):
    a = A[i-1]
    for j in range(1, N+1):
        tmp = i * j
        if tmp > N:
            break
        a += B[tmp-1]
    if a % 2 == 1:
        ans.append(i)
    B[i-1] = a % 2
print(len(ans))
for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans = []
for i in reversed(range(1, N+1)):
    a = A[i-1]
    for j in range(2, N+1):
        tmp = i * j
        if tmp > N:
            break
        a %= A[tmp-1]
    if a % 2 == 1:
        ans.append(i)
    A[i-1] = a % 2
print(len(ans))
for a in ans:
    print(a)
Problem p03000 (python)

Fixed submission:
n,x =map(int,input().split())
L=list(map(int,input().split()))
A = [0] * (n+1)
for i in range(1,n+1):
    A[i] = A[i-1] + L[i-1]
cnt=0
for i in range(n+1):
    if A[i] <= x:
        cnt+= 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,x =map(int,input().split())
L=list(map(int,input().split()))
tmp = 0
cnt = 0
for i in range(n+1):
    if tmp > x:
        break
    tmp += L[i]
    cnt += 1
print(cnt)
Problem p03061 (python)

Fixed submission:
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
n = int(input())
a = list(map(int, input().split()))
left, right = [0] * (n+1), [0] * (n+1)
for i in range(n):
    left[i+1] = gcd(left[i], a[i])
for i in reversed(range(n)):
    right[i] = gcd(right[i+1], a[i])
ans = 0
for i in range(n):
    l = left[i]
    r = right[i+1]
    ans = max(ans, gcd(l, r))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
result = 0
for i in range(n):
    r = a_list[0]
    for j in range(n):
        if i == j: continue
        r = math.gcd(a_list[j], r)
    if r > result: result  = r
print(result)
Problem p03076 (python)

Fixed submission:
L = []
L2 = []
for _ in range(5):
    a = input()
    if a[-1] == "0":
        L.append(int(a))
    else:
        last = int(a[-1])
        L.append(int(a) + 10 - last)
        L2.append(last)
if not L2:
    print(sum(L))
else:
    print(sum(L) + min(L2) - 10)

Buggy submission (verdict: Runtime Error):
L = []
L2 = []
for _ in range(5):
    a = input()
    if a[-1] == "0":
        L.append(int(a))
    else:
        last = int(a[-1])
        L.append(int(a) + 10 - last)
        L2.append(last)
print(sum(L) + min(L2) - 10)
Problem p03282 (python)

Fixed submission:

s = input()
k = int(input())
for i in range(len(s)):
    if s[i] != "1":
        break
if k - 1 < i:
    print(1)
else:
    print(s[i])

Buggy submission (verdict: Runtime Error):

s = input()
k = int(input())
for i in range(len(s)):
    if s[i] != "1":
        break
if k < i:
    pirnt(1)
else:
    print(s[i])
Problem p02718 (python)

Fixed submission:

n, m = input().split()
m = int(m)
n = int(n)
a = input().split()
sum_a = sum(int(i) for i in a) / (4 * m)

yes_num = 0
no_num = 0

ok = m
ng = n - m

for i in a:
    if int(i) < sum_a:
        no_num += 1
    else:
        yes_num += 1
    if no_num > ng:
        break
    if yes_num >= ok:
        print("Yes")
        exit(0)

print("No")

Buggy submission (verdict: Runtime Error):

m, n = input().split()
a = input().split()
sum_a = sum(a) / (4 * m)

yes_num = 0
no_num = 0

ok = m
ng = n - m

for i in a:
    if i < sum_a:
        no_num += 1
    else:
        yes_num += 1
    if no_num > ng:
        break
    if yes_num >= ok:

        exit(0)

print("No")
Problem p02756 (python)

Fixed submission:
t=list(input())
q=int(input())
s=[]

for i in range(q):
  query=list(input().split())
  if query[0]=='1':
    s,t=t,s
  else:
    if query[1]=='1':
      s.extend(query[2])
    else:
      t.extend(query[2])
if s==[]:
  s=t
else:
  s.reverse()
  s.extend(t)

moji=''.join(s)
print(moji)

Buggy submission (verdict: Runtime Error):
S=list(input())
q=int(input())
T=['1' for j in range(10**5)]
for i in range(q):
  query=list(input().split())
  if query[0]=='1':
    p=len(S)
    for k in range(p):
      T[k]=S[p-1-k]
    S=T[:p]  
  else:
    if query[1]=='1':
      S.insert(0,query[2])
    else:
      S.append(query[2])
moji=''.join(S)
print(moji)
Problem p02761 (python)

Fixed submission:
n,m=map(int,input().split())
num=0
array=[99999 for i in range(n)]
for _ in range(m):
  s,c = map(int,input().split())
  if array[s-1]==99999 or array[s-1]==c:
    array[s-1]=c
  else:
    array=[-1 for i in range(n)]
    break

if not n==1:
  for i in range(n):
    if not i==0:
      if array[i]==99999:
        array[i]=0
    else:
      if array[i]==99999:
        array[i]=1
  if array[0]==-1 or array[0]==0:
    num=-1
  else:
    num=int(''.join(list(map(str,array))))
else:
  if array[0]==99999:
    num=0
  else:
    num=array[0]
print(num)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
num=0
array=[99999 for i in range(n)]
for _ in range(m):
  s,c = map(int,input().split())
  if array[s-1]==99999 or array[s-1]==c:
    array[s-1]=c
  else:
    array=[-1 for i in range(n)]
    break

if not n==1:
  for i in range(n):
    if not i==0:
      if array[i]==99999:
        array[i]=0
    else:
      array[i]=1
  if array[0]==0 or array[0]==-1:
    num=-1
  else:
    num=int(''.join(list(map(str,array))))
else:
  if array[0]==99999:
    num=-1
  else:
    num=array[0]
print(num)
Problem p02885 (python)

Fixed submission:
A, B = map(int, input().split())
s = A-2*B
if s>0:
  print(s)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n,m,l = map(int, input().split())
INF = 1001001001
dist = [[INF for i in range(n)] for i in range(n)]
#make graph
for i in range(n):
  dist[i][i] = 0
for i in range(m):
  a, b, c = map(int, input().split())
  dist[a-1][b-1] = dist[b-1][a-1] = c
#warshall-froyd
for k in range(n):
  for i in range(n):
    for j in range(n):
      dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j])
dist2 =  [[INF for i in range(n)] for i in range(n)]
for i in range(n):
  for j in range(n):
    if dist[i][j] <=l:
      dist2[i][j] = 1
#warshall-froyd
for k in range(n):
  for i in range(n):
    for j in range(n):
      dist2[i][j] = min(dist2[i][j], dist2[i][k]+dist2[k][j])
q = int(input())
for i in range(q):
  s,t = map(int, input().split())
  if dist2[s-1][t-1] == INF:
    print(-1)
  else:
    print(dist2[s-1][t-1]-1)
Problem p02741 (python)

Fixed submission:
list1=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a = int(input())
print(list1[a-1])

Buggy submission (verdict: Runtime Error):
list1=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a = int(input())
print(list1[a+1])
Problem p02742 (python)

Fixed submission:
h,w=map(int,input().split())
if h!=1 and w!= 1:
  print(int(h*w/2) + w*h%2)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
print(int(h*w/2) + w*h%2))
Problem p03085 (python)

Fixed submission:
b = input()
if b == 'A':
  print('T')
if b == 'T':
  print('A')
if b == 'C':
  print('G')
if b == 'G':
  print('C')

Buggy submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = input()
for i in range(q):
  l,r = map(int,input().split())
  j = l-1
  AC = 0
  while j < r-1:
    if s[j] == "A" and s[j+1] == "C":
      AC += 1
      j += 1
    j += 1
  print(AC)
Problem p03086 (python)

Fixed submission:
b = input()
len = len(b)
ACGT = 0
MAX = 0
flag = 0
for i in range(len):
  if b[i]=="A" or b[i]=="C" or b[i]=="G" or b[i]=="T":
    ACGT += 1
  else:
    if ACGT > MAX:
      MAX = ACGT
    ACGT = 0
if ACGT > MAX:
  MAX = ACGT
print(MAX)

Buggy submission (verdict: Runtime Error):
b = input()
len = len(b)
ACGT = 0
MAX = 0
for i in range(b):
  if b[i]=="A" or b[i]=="C" or b[i]=="G" or b[i]=="T":
    ACGT += 1
  else:
    MAX = ACGT
    ACGT = 0
print(MAX)

Buggy submission (verdict: Runtime Error):
b = input()
ACGT = 0
for i in range(len(b)):
  if b[i]=="A" or b[i]=="C" or b[i]=="G" or b[i]=="T":
    ACGT += 1
  else:
    MAX = ACGT
    ACGT = 0
print(MAX)
Problem p03136 (python)

Fixed submission:
n = int(input())
a = input().split()
i = 0
while i < n:
  a[i] = int(a[i])
  i = i + 1 
 
i = 0
while i < n:
  j = i + 1
  while j < n:
    if a[i] < a[j]:
      temp = a[i]
      a[i] = a[j]
      a[j] = temp
    j = j + 1
  i = i + 1
 
sums = sum(a)

if(sums - a[0] > a[0]):
  print("Yes")
else:
  print("No")
sum = sum(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = input().split()
i = 0
while i < 4:
  a[i] = int(a[i])
  i = i + 1 

i = 0
while i < 4:
  j = i + 1
  while j < 4:
    if a[i] < a[j]:
      temp = a[i]
      a[i] = a[j]
      a[j] = a[i]
    j = j + 1
  i = i + 1

sum = sum(a)
if(sum-a[0] > a[0]):
  print("Yes")
else:
  print("No")