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

Fixed submission:
import math
n = int(input())
A = list(map(int, input().split()))
A = [A[i]-(i+1) for i in range(n)]
#print(A)
A.sort()
i = n/2
a = A[math.floor(i)]
b = A[math.ceil(i)] if i>1 else a
ans,ans1=0,0
for i in A:
    ans += abs(i-a)
    ans1 += abs(i-b)
print(min(ans,ans1))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
A = list(map(int, input().split()))
A = [A[i]-(i+1) for i in range(n)]
#print(A)
A.sort()
i = n/2
a,b = A[math.floor(i)], A[math.ceil(i)]
ans,ans1=0,0
for i in A:
    ans += abs(i-a)
    ans1 += abs(i-b)
print(min(ans,ans1))
Problem p03449 (python)

Fixed submission:
n = int(input())
a = [list(map(int,input().split())) for i in range(2)]
ans = 0
su1 = [0]*n
su2 = [0]*n
su1[0],su2[0] = a[0][0],a[1][0]
for i in range(n):
    if i>0:
        su1[i] = su1[i-1]+a[0][i]
        su2[i] = su2[i - 1] + a[1][i]
#print(su1)
#print(su2)
for i in range(n):
    temp = su1[i]+su2[n-1]-(su2[i-1] if i>0 else 0)
    ans = max(ans, temp)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [list(map(int,input().split())) for i in range(2)]
ans = 0
su1 = [0]*n
su2 = [0]*n
su1[0],su2[0] = a[0][0],a[1][0]
for i in range(n):
    if i>0:
        su1[i] = su1[i-1]+a[0][i]
        su2[i] = su2[i - 1] + a[1][i]
#print(su1)
#print(su2)
for i in range(n):
    temp = su1[i]+su2[n-1]-(su2[i-1] if i>0 else 0)
    ans = max(ans, temp)
print(ans)n = int(input())
a = [list(map(int,input().split())) for i in range(2)]
ans = 0
su1 = [0]*n
su2 = [0]*n
su1[0],su2[0] = a[0][0],a[1][0]
for i in range(n):
    if i>0:
        su1[i] = su1[i-1]+a[0][i]
        su2[i] = su2[i - 1] + a[1][i]
#print(su1)
#print(su2)
for i in range(n):
    temp = su1[i]+su2[n-1]-(su2[i-1] if i>0 else 0)
    ans = max(ans, temp)
print(ans)
Problem p03495 (python)

Fixed submission:
from collections import Counter
n,k = map(int,input().split())
a = list(map(int,input().split()))
cnt = Counter(a)
mo = cnt.most_common()[::-1]
#print(mo)
ans = 0
for i in range(max(0,len(mo)-k)):
    ans += mo[i][1]
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n,k = map(int,input().split())
a = list(map(int,input().split()))
cnt = Counter(a)
mo = sorted(cnt,reverse=True)
#print(mo)
ans = 0
for i in range(max(0,len(mo)-k)):
    ans += mo[i][1]
print(ans)
Problem p03555 (python)

Fixed submission:
import numpy as np
l = [list(input()) for i in range(2)]
arr = np.array(l)
if np.all(arr == np.rot90(arr,k=2)):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import numpy as np
l = [list(input()) for i in range(2)]
arr = np.array(l)
if arr == np.rot90(arr,k=2):
    print("YES")
else:
    print("NO")
Problem p02952 (python)

Fixed submission:
n = input()
l = len(n)

# print(l)
temp=''
ans=0

if l==1:
	print(int(n))
else:
	for i in range(1,l):
		if i%2==1:
			temp='9'
			temp+='0'*(i-1)
			ans+=int(temp)
			# print(ans)

	if l%2==1:
		ans+=(int(n)-int('9'*(l-1)))

	print(ans)

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

# print(l)
temp=''
ans=0

if l==1:
	# print(int(n))
else:
	for i in range(1,l):
		if i%2==1:
			temp='9'
			temp+='0'*(i-1)
			ans+=int(temp)
			# print(ans)

	if l%2==1:
		ans+=(int(n)-int('9'*(l-1)))

print(ans)
Problem p03035 (python)

Fixed submission:
a,b = map(int,input().split())
if a>=13:
	print(b)
elif a>=6:
	print(int(b/2))
else:
	print(0)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a>=13:
	print(b)
elif a>=6:
	print(int(b/2)
else:
	print(0)
Problem p03047 (python)

Fixed submission:
n,k = map(int, input().split())
print(n-k+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [input() for i in range(n)]
a = 0
b = 0
ba = 0
ab = 0
for i in range(n):
    if 'AB' in l[i]:
        for j in range(len(l[i])-1):
            if l[i][j] == 'A' and l[i][j+1] == 'B':
                ab += 1
    if l[i][0] =='B' and l[i][-1] == 'A':
        ba += 1
    elif l[i][-1] == 'A':
        a += 1
    elif l[i][0] == 'B':
        b += 1
if max(a,b) == 0　and ba <= 1:
    print(ab)
elif max(a,b) == 0:
    print(ab+ba-1)
else:
    print(min(a,b)+ab+ba)

Buggy submission (verdict: Runtime Error):
n,k = int(input().split())
print(n-k+1)
Problem p03049 (python)

Fixed submission:
n = int(input())
l = [input() for i in range(n)]
a = 0
b = 0
ba = 0
ab = 0
for i in range(n):
    if 'AB' in l[i]:
        for j in range(len(l[i])-1):
            if l[i][j] == 'A' and l[i][j+1] == 'B':
                ab += 1
    if l[i][0] =='B' and l[i][-1] == 'A':
        ba += 1
    elif l[i][-1] == 'A':
        a += 1
    elif l[i][0] == 'B':
        b += 1
if max(a,b) == 0 and ba <= 1:
    print(ab)
elif max(a,b) == 0:
    print(ab+ba-1)
else:
    print(min(a,b)+ab+ba)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [input() for i in range(n)]
a = 0
b = 0
ba = 0
ab = 0
for i in range(n):
    if 'AB' in l[i]:
        for j in range(len(l[i])-1):
            if l[i][j] == 'A' and l[i][j+1] == 'B':
                ab += 1
    if l[i][0] =='B' and l[i][-1] == 'A':
        ba += 1
    elif l[i][-1] == 'A':
        a += 1
    elif l[i][0] == 'B':
        b += 1
if max(a,b) == 0　and ba <= 1:
    print(ab)
elif max(a,b) == 0:
    print(ab+ba-1)
else:
    print(min(a,b)+ab+ba)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [input() for i in range(n)]
a = 0
b = 0
ba = 0
ab = 0
for i in range(n):
    if 'AB' in l[i]:
        for j in range(len(l[i])-1):
            if l[i][j] == 'A' and l[i][j+1] == 'B':
                ab += 1
    if l[i][0] =='B' and l[i][-1] == 'A':
        ba += 1
    elif l[i][-1] == 'A':
        a += 1
    elif l[i][0] == 'B':
        b += 1
if max(a,b) == 0　and ba <= 1:
    print(ab)
elif max(a,b) == 0:
    print((ab+ba-1))
else:
    print(min(a,b)+ab+ba)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [input() for i in range(n)]
a = 0
b = 0
ba = 0
ab = 0
for i in range(n):
    if 'AB' in l[i]:
        for j in range(len(l[i])-1):
            if l[i][j] == 'A' and l[i][j+1] == 'B':
                ab += 1
    if l[i][0] =='B' and l[i][-1] == 'A':
        ba += 1
    elif l[i][-1] == 'A':
        a += 1
    elif l[i][0] == 'B':
        b += 1
if max(a,b) == 0　and ba <= 1:
    print(ab)
elif max(a,b) == 0
    print((ab+ba-1))
else:
    print(min(a,b)+ab+ba)
Problem p03050 (python)

Fixed submission:
n = int(input())

ans = 0
for i in range(1,n):
    if (n-i)/i > i:
        if (n-i)%i == 0:
            ans += (n-i)/i
    else:
        break
print(int(ans))

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

ans = 0
for i in range(1,n):
    if (n-i)/i > i:
        if (n-i)%i == 0:
            ans += (n-i)/i
    else:
        break
print(int(ans)
Problem p03071 (python)

Fixed submission:
a,b = map(int, input().split())
if a == b:
    print(a*2)
elif a > b:
    print(a*2-1)
else:
    print(b*2-1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
m = 0
c = 0
for i in A:
    if m <= i:
        c += 1
        m = i
 
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
sum = 0
m = 0
for i in h:
    if m <= i:
        sum += 1
        m = i
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
sum = 0
max = 0
for i in h:
    if max <= i:
        sum += 1
        max = i
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
sum = 0
max = 0
for i in range(n):
    if max <= h[i]:
        sum += 1
        max = h[i]
print(sum)
Problem p03076 (python)

Fixed submission:
l = [int(input())for i in range(5)]
l1 = ['']*5
ans = 0
for i in range(5):
    l1[i] = l[i]%10
    if l1[i] == 0:
        l1[i] = 10
for i in range(5):
    ans += -(-l[i]//10)
print(ans*10 - 10 + min(l1))

Buggy submission (verdict: Runtime Error):
l = [int(input())for i in range(5)]
l1 = []*5
ans = 0
for i in range(5):
    l1[i] = l[i]%10
for i in range(5):
    ans += -(-l[i]//10)
print(ans*10 + min(l1))

Buggy submission (verdict: Runtime Error):
l = [int(input())for i in range(5)]
num = l.index(min(l))
sum = 0
for i in range(5):
    if i != num:
        ans += -(-l[i] // 10)
print(ans*10 + l[num])

Buggy submission (verdict: Runtime Error):
l = [int(input())for i in range(5)]
num = l.index(min(l))
sum = 0
for i in range(5):
    if i != num:
        ans += -(-l[i] // 10)
print(ans*10)
Problem p03085 (python)

Fixed submission:
l = ['A', 'C', 'T', 'G']
b = input()
for i in range(4):
    if l[i] == b:
        print(l[(i+2)%4])
        break

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

for _ in range(q):
	l,r=map(int,input().split())
	# list_=[s[l-1:r]]
	# print(s[l-1:r])
	ans=0
	for i in range(l-1,r-1):
		if s[i] == 'A' and s[i+1] == 'C':
			ans +=1



	print(ans)

Buggy submission (verdict: Runtime Error):
l = ['A', 'C', 'T', 'G']
b = input()
for i in range(3):
    if l[i] == b:
        print(l[(i+2)/4])
        break
Problem p03086 (python)

Fixed submission:
l = ['A', 'C', 'T', 'G']
s = input()
max = 0
max_temp = 0
for i in s:
    if i in l:
        max_temp += 1
        if max < max_temp:
            max = max_temp
    else:
        max_temp = 0
print(max)

Buggy submission (verdict: Runtime Error):
l = ['A', 'C', 'T', 'G']
s = input()
max = 0
max_temp = 0
for i in len(s):
    if str(s[i]) in l:
        max_temp += 1
        if max < max_temp:
            max = max_temp
    else:
        max_temp = 0
print(max)

Buggy submission (verdict: Runtime Error):
l = ['A', 'C', 'T', 'G']
s = input()
max = 0
max_temp = 0
for i in len(s):
    if s[i] in l:
        max_temp += 1
        if max < max_temp:
            max = max_temp
    else:
        max_temp = 0
print(max)
Problem p03102 (python)

Fixed submission:
n, m, c = map(int, input().split())
b = list(int(x) for x in input().split())
ans = 0

for j in range(n):
    a = list(int(x) for x in input().split())
    sum = 0
    for i in range(m):
        sum += a[i]*b[i]
    if sum > -c:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n, m, c = map(int, input().split())
b = input().split()
ans = 0

for j in range(n):
    a = list(int(x) for x in input().split())
    for i in range(m):
        sum = 0
        sum += a[i]*b[i]
        if sum > -c:
            ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n, m, c = map(int, input().split())
b = input().split()
ans = 0

for j in range(n):
    a = input().split()
    for i in range(m):
        sum = 0
        sum += a[i]*b[i]
    if sum > -c:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n, m, c = map(int, input().split())
b = input().split()
ans = 0

for j in range(n):
    a = input().split()
    for i in range(m):
        sum = 0
        sum += a[i]*b[i]
    if sum > -c:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n, m, c = map(int, input().split())
b = [int(x) for x in range(m)]
ans = 0

for j in range(n):
    a = input().split()
    for i in range(m):
        sum = 0
        sum += a[i]*b[i]
    if sum > -c:
        ans += 1

print(ans)
Problem p03105 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c = int(input().split())
ans = 0
for i in range(c):
    b = b - a
    if b < 0:
        break
    ans += 1

print(c)
Problem p03109 (python)

Fixed submission:
s = input()
s = s.replace('/','')
if int(s) <= 20190430:
	print('Heisei')
else:
	print('TBD')

Buggy submission (verdict: Runtime Error):
s = input()
s = s.remove('/').remove('/')
if int(s) <= 20190430:
	print('Heisei')
else:
	print('TBD')
Problem p03110 (python)

Fixed submission:
n = int(input())
money = 0
for i in range(n):
	x,u = input().split()
	if u == 'JPY':
		money += int(x)
	else:
		money += float(x)*380000.0
 
print(money)

Buggy submission (verdict: Runtime Error):
n = int(input())
money = 0
for i in range(n):
	x,u = input().split()
	if u = 'JPY':
		money += int(x)
	else:
		money += int(x)*10000
print(money)
Problem p03125 (python)

Fixed submission:
*l, = map(int, open(0).read().split())
if l[1] % l[0] == 0:
	print(l[0] + l[1])
else:
	print(l[1] - l[0])

Buggy submission (verdict: Runtime Error):
*l = map(int, open(0).read().split())
if l[1] % l[0] == 0:
	print(l[0] + l[1])
else:
	print(l[1] - l[0])
Problem p03136 (python)

Fixed submission:
n = int(input())
l = [int(x) for x in input().split()]
l.sort()
# print(l)
l_sum = 0
for i in range(n-1):
	l_sum += l[i]
if l[n-1] < l_sum:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
# l = sort(map(int, input().split()))
l = (int(x) for x in input().split()).sort()
l_sum = 0
for i in range(n-1):
	l_sum += l[i]
if l_sum > l[n-1]:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
# l = sort(map(int, input().split()))
l = sort(int(x) for x in input().split())
l_sum = 0
for i in range(n-1):
	l_sum += l[i]
if l_sum > l[n-1]:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
l = sort(map(int, input().split()))
l_sum = 0
for i in range(n-1):
	l_sum += l[i]
if l_sum > l[n-1]:
	print('Yes')
else:
	print('No')
Problem p03145 (python)

Fixed submission:
l = list(map(int, input().split()))
print(int(l[0]*l[1]/2))

Buggy submission (verdict: Runtime Error):
l = map(int, input().split())
print(l[0]*l[1]/2)
Problem p03146 (python)

Fixed submission:
s = [int(input())]
for i in range(1000000):
	if s[i]%2==0:
		
		# print(s)
		if s[i]/2 in s:
			print(i+2)
			break
		s.append(s[i]/2)
	else:
		
		if 3*s[i]+1 in s:
			print(i+2)
			break
		s.append(3*s[i]+1)
	# print(s)

Buggy submission (verdict: Runtime Error):
s = []
s.append(int(input()))
for i in range(1, 1000000):
	if s %2:
		s.append(3*s+1)
	else:
		s.append(s/2)
	for j in range(i):
		if s[j] == s[i]:
			print(i)
Problem p03219 (python)

Fixed submission:
x,y = map(int, input().split())
print(int(x+y/2))

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

for i in range(n):
	h[i] = abs(a-(t - h[i]*0.006))

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

Buggy submission (verdict: Runtime Error):
x,y = map(int, input().split())
print(int(x+y/2)
Problem p03434 (python)

Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[::2]) - sum(a[1::2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[::2]) - sum(a[1::2])))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[::2] - sum(a[1::2])))

Buggy submission (verdict: Runtime Error):
n = input()
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[::2] - a[1::2]))
Problem p03448 (python)

Fixed submission:
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in (a+1):
    for j in (b+1):
        for k in (c+1):
            if i*500 + j*100 + k*50 == x:
                ans += 1
print(ans)
Problem p03470 (python)

Fixed submission:
n = int(input())
print(len(set(map(int, [input() for i in range(n)]))))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(len(set(map(int, [input for i in range(n)]))))
Problem p02923 (python)

Fixed submission:
N=int(input())
l1=list(map(int,input().split()))
l1.append(max(l1)+1)
l2=[-1]
l3=[]
for i in range(N):
  if l1[i]<l1[i+1]:
    l2.append(i)
for i in range(len(l2)-1):
  if l2[i+1]-l2[i] >= 2:
    l3.append(l2[i+1]-l2[i]-1)
print(max(l3) if l3 else 0)

Buggy submission (verdict: Runtime Error):
N=int(input())
l1=list(map(int,input().split()))
l2=[]
l3=[]
for i in range(N-1):
  if l1[i]<l1[i+1]:
    l2.append(i)
l2.append(N)
for i in range(len(l2)-1):
  if l2[i+1]-l2[i] >= 2:
    l3.append(l2[i+1]-l2[i]-2)
print(max(l3))

Buggy submission (verdict: Runtime Error):
N=int(input())
l1=list(map(int,input().split()))
l2=[]
l3=[]
for i in range(N-1):
  if l1[i]<l1[i+1]:
    l2.append(i)
l2.append(N-2)
for i in range(len(l2)-1):
  l3.append(l2[i+1]-l2[i])
print(max(l3))

Buggy submission (verdict: Runtime Error):
N=int(input())
l1=list(map(int,input().split()))
l2=[]
l3=[]
for i in range(N-1):
  if l1[i]<l1[i+1]:
    l2.append(i)

for i in range(len(l2)-1):
  l3.append(l2[i+1]-l2[i])
print(max(l3))
Problem p02947 (python)

Fixed submission:
N=int(input())
l=[]
from collections import Counter
for i in range(N):
  l.append(''.join(sorted(input())))
l1=Counter(l).values()
from math import factorial
ans=0
for a in l1:
  if a >= 2:
    ans+=int(factorial(a)/(factorial(a-2)*factorial(2)))
print(ans)

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

from collections import Counter
ans = 0
for w1,w2 in l:
  if Counter(w1) == Counter(w2):
    ans += 1
print(ans)
Problem p02952 (python)

Fixed submission:
N = int(input())
if N == 10**5:
  res = 90909
elif 10**4 <= N < 10**5:
  res = N-9090
elif 10**3 <= N < 10**4:
  res = 909
elif 10**2 <= N < 10**3:
  res = N-90
elif 10 <= N < 10**2:
  res = 9
elif 1 <= N < 10:
  res = N
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N == 10**5:
  res = 90909
elif 10**4 <= N < 10**5:
  res = N-9089
elif 10**3 < N < 10**4:
  res = 910
elif 10**2 < N < 10**3:
  res = N-90
elif 1 <= N < 10**2:
  res = N
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N = 10**5:
  print(90909)
elif 10**4 <= N < 10**5:
  print(N-9089)
elif 10**3 < N < 10**4:
  print(910)
elif 10**2 < N < 10**3:
  print(N-90)
elif 1 <= N < 10**2:
  print(N)
Problem p02953 (python)

Fixed submission:
import sys
N = int(input())
l = list(map(int,input().split()))
for n in range(N-2,0,-1):
  if l[n] > l[n+1]:
    l[n] -= 1
  if l[n] > l[n+1]:
    print('No')
    sys.exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
l = list(map(int,input().split()))
for n in range(N-2,0,-1):
  if l[n] > l[n+1]:
    l[n] -= 1
  if l[n] > l[n+1]:
    print('No')
    sys.exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
l = list(map(int,input().split()))
for n in range(N):
  if l[N-n-1] - l[N-n] > 1:
    print('No')
    break
  elif 0 < l[N-n-1] - l[N-n] <= 1:
    l[N-n-1] -= 1
  else:
print('Yes')
Problem p02957 (python)

Fixed submission:
x,y=map(int,input().split())
if (x+y)%2==0:
  print(int((x+y)/2))
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
N=int(input())
l=list(map(int,input().split()))
l1=sorted(l)
ans=0
for i in range(N):
  if l[i]!=l1[i]:
    ans+=1
if ans==0 or ans==2:
  print('YES')
else:
  print('NO')
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)

N = int(input())
tree = [[] for i in range(N)]
color = [-1] * N
for i in range(N-1):
  u, v, w = map(int, input().split())
  tree[u-1].append((v-1, w))
  tree[v-1].append((u-1, w))


def dfs(u):
  for v, w in tree[u]:
    if color[v] == -1:
      color[v] = color[u] ^ (w % 2)
      dfs(v)


color[0] = 0
dfs(0)
print('\n'.join(map(str, color)))

Buggy submission (verdict: Runtime Error):
N = int(input())
tree = [[] for i in range(N)]
color = [-1] * N
for i in range(N-1):
  u, v, w = map(int, input().split())
  tree[u-1].append((v-1, w))
  tree[v-1].append((u-1, w))


def dfs(u):
  for v, w in tree[u]:
    if color[v] == -1:
      color[v] = color[u] ^ (w % 2)
      dfs(v)


color[0] = 0
dfs(0)
print('\n'.join(map(str, color)))
Problem p03061 (python)

Fixed submission:
import fractions
N=int(input())
l1=list(map(int,input().split()))
l2=[0]*(N+1)
l3=[0]*(N+1)
for i in range(N):
  l2[i+1]=fractions.gcd(l2[i],l1[i])
for j in range(N-1,0,-1):
  l3[j-1]=fractions.gcd(l3[j],l1[j])
ans=1
for k in range(N):
  ans=max(ans,fractions.gcd(l2[k],l3[k]))
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
import fractions
N=int(input())
s=deque(list(map(int,input().split())))
ans=1
for i in range(N):
  a=s.popleft()
  b=fractions.gcd(s[0],s[1])
  for j in range(2,N-2):
    b=fractions.gcd(b,s[j])
  ans=max(ans,b)
  s.append(a)
print(ans)
Problem p03062 (python)

Fixed submission:
N=int(input())
l=list(map(int,input().split()))
l2=sorted([num for num in l if num<0])
l3=sorted([num for num in l if num>=0])
if len(l2)%2==0:
  ans=sum([abs(n) for n in l])

elif l3!=[]:
  if abs(l2[-1]) < l3[0]:
    x=l2.pop()
  else:
    x=l3.pop(0)
  ans=sum([abs(n) for n in l2])+sum(l3)-abs(x)
else:
  x=l2.pop()
  ans=sum([abs(n) for n in l2])-abs(x)
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
l=list(map(int,input().split()))
l2=sorted([num for num in l if num<0])
l3=sorted([num for num in l if num>=0])
if len(l2)%2==0:
  ans=sum([abs(n) for n in l])

else:
  if abs(l2[-1]) < l3[1]:
    x=l2.pop()
  else:
    x=l3.pop(0)
  ans=sum([abs(n) for n in l2])+sum(l3)-abs(x)
print(ans)
Problem p03085 (python)

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

Buggy submission (verdict: Runtime Error):
b=int(input())
print('A' if b=='T'
      else 'T' if b=='A'
      else 'G' if b=='C'
      else 'C')
Problem p03086 (python)

Fixed submission:
l=[c for c in input()]
l1=[-1]
l2=[]
for i,j in enumerate(l):
  if j not in 'ACGT':
    l1.append(i)
l1.append(len(l))
for i in range(len(l1)-1):
  l2.append(l1[i+1]-l1[i]-1)
print(max(l2))

Buggy submission (verdict: Runtime Error):
l=[c for c in input()]
l1=[-1]
l2=[]
for i,j in enumerate(l):
  if j not in 'ACGT':
    l1.append(i)
for i in range(len(l1)-1):
  l2.append(l1[i+1]-l1[i]-1)
print(max(l2))
Problem p03037 (python)

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

lans = 1
rans = n
for i in range(m):
  l,r = map(int,input().split())
  lans = max(lans,l)
  rans = min(rans,r)
if lans <= rans:
  print(len(list(range(lans,rans+1))))
else:
  print(0)

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

li = np.array([i for i in range(1,n+1)])
for i in range(m):
  l,r = map(int,input().split())
  li = li[l <= li]
  li = li[li <= r]
  if len(li)==0:
    break
else:
  print(len(li))
  exit()
print(0)
Problem p03059 (python)

Fixed submission:
a,b,t = map(int,input().split())
ans = ((t - t%a)/a)*b
print(int(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
list_v = map(int,input().split())
list_c = map(int,input().split())
 
ans = 0
for i in range(n):
  if list_v[i] - list_c[i] > 0:
    ans += list_v[i] - list_c[i]
print(int(ans))

Buggy submission (verdict: Runtime Error):
a,b,t = map(int,input().split())
ans = math.floor(t/a) * b
print(ans)
Problem p03060 (python)

Fixed submission:
n = int(input())
list_v = list(map(int,input().split()))
list_c = list(map(int,input().split()))
 
ans = 0
for i in range(n):
  if list_v[i] - list_c[i] > 0:
    ans += list_v[i] - list_c[i]
print(int(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
list_v = map(int,input().split())
list_c = map(int,input().split())
 
ans = 0
for i in range(n):
  if list_v[i] - list_c[i] > 0:
    ans += list_v[i] - list_c[i]
print(int(ans))

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

ans = 0
for i in range(n):
  if list_v[i] - list_c[i] > 0:
    ans += list_v[i] - list_c[i]
return(int(ans))