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

Fixed submission:
import math

a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())

last = 9

all = []

all.append(a%10)
all.append(b%10)
all.append(c%10)
all.append(d%10)
all.append(e%10)

flag = 0
for m, i in enumerate(all):
    # print(i)
    temp = i
    if temp < last and temp !=0:
        last = temp
        index = m
        flag = 1

if flag ==0:
    index = 0

# print("index:" + str(index))
a = a/10
b = b/10
c = c/10
d = d/10
e = e/10

All = []
All.append(a)
All.append(b)
All.append(c)
All.append(d)
All.append(e)

sum = 0
for k, j in enumerate(All):
    # print(k)

    if k == index:
        # print(k)
        sum += j *10
    else:
        sum += math.ceil(j)*10

sum = int(sum)
print(sum)

Buggy submission (verdict: Runtime Error):

import math

a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())

last = 9

all = []

all.append(a%10)
all.append(b%10)
all.append(c%10)
all.append(d%10)
all.append(e%10)


for m, i in enumerate(all):
    # print(i)
    temp = i
    if temp < last and temp !=0:
        last = temp
        index = m

# print("index:" + str(index))
a = a/10
b = b/10
c = c/10
d = d/10
e = e/10

All = []
All.append(a)
All.append(b)
All.append(c)
All.append(d)
All.append(e)

sum = 0
for k, j in enumerate(All):
    # print(k)

    if k == index:
        # print(k)
        sum += j *10
    else:
        sum += math.ceil(j)*10

sum = int(sum)
print(sum)
Problem p03079 (python)

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

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

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
L = [1 for i in range(n)] #カウント用
x = [list(input().split()) for i in range(q)]


for i in range(q):#呪文ループ
  for j in range(n):#マスループ　左から
    if x[i][0] == s[j]:
      if x[i][1]=='L':

        if j-1>=0:
          L[j-1] +=L[j]
          L[j] = 0
        else:
          L[j] = 0

      elif x[i][1]=='R':

        if (j+1)<=(n-1):
          L[j+1] +=L[j]
          L[j] = 0
        else:
          L[j] = 0

sum = 0
for i in range(n):
  sum += L[i]

print(sum)

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
L = [1 for i in range(n)] #カウント用
x = [list(input().split()) for i in range(q)]


for i in range(q):#呪文ループ
  for j in range(n):#マスループ　左から
    if x[i][0] == s[j]:
      if x[i][1]=='L':

        if j-1>=0:
          L[j-1] +=L[j]
          L[j] = 0
        else:
          L[j] = 0

      elif x[i][1]=='R':

        if (j+1)<=(n-1):
          L[j+1] +=L[j]
          L[j] = 0
        else:
          L[j] = 0

sum = 0
for i in range(n):
  sum += L[i]

print(sum)

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
L = [1 for i in range(n+2)] #カウント用
L[0] = -99999
L[n+1] = -99999
x = [list(input().split()) for i in range(q)]
    
S = [c  for c in s] #一文字ずつにわける
    
for i in range(q):
    index = [k for k, X in enumerate(S) if X == x[i][0]]
    for _, j in enumerate(index):
    if x[i][1]=='L':
        L[j+1-1] +=L[j+1]
        L[j+1] = 0
    else:
        L[j+1+1] +=L[j+1]
        L[j+1] = 0
     
print(sum(L[1:n+1]))
Problem p03080 (python)

Fixed submission:
n = int(input())
x= input()

count = 0
me = 0
for i in range(n):
  if x[i] == "R":
    count +=1
  else:
    me +=1
    

if count > me:
  print("Yes")
else:
  print("No")

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

count = 0
me = 0
for i in range(n):
  if x[i] == "R":
    count +=1
  else:
    me +=1
    

if count > me:
  print("Yes")
else:
  print("No")
Problem p03455 (python)

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

if((a*b)%2 == 0):
	print('Even')
else:
	print('Odd')

Buggy submission (verdict: Runtime Error):
    a,b=map(int,input().split())
     
    if((a*b)%2 == 0):
        print('Even')
    else:
        print('Odd')

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

if((a*b)%2 == 0):
  print('Even')
  else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
c = a*b
if c%2 ==0:
  print('Even')
else
  print('Odd')
Problem p03501 (python)

Fixed submission:
n, a, b = list(map(int, input().split()))
print(min(n*a, b))

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

n = int(input())
f = np.array([list(map(int, input().split())) for i in range(n)])
p = np.array([list(map(int, input().split())) for i in range(n)])

ans = -99999999

openptn=np.array([[int(s) for s in list('{0:010b}'.format(i))] for i in range(1,2**10)])

for i in range(2**10 - 1):
	subans = 0
	for j in range(n):
		count = sum(f[j]*openptn[i])
		print(f[j]*openptn[i])

		subans +=p[j][count]
        count = 0
		
		#print(subans)
	ans = max(ans, subans)

print(ans)
Problem p03262 (python)

Fixed submission:
import numpy as np
import math
from functools import reduce

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

def gcd(a: int, b: int): return gcd(b, a % b) if b else a

N, X = map(int, input().split())
x = list(map(int, input().split()))

d = np.zeros(N, dtype=int)
for n in range(N):
    d[n] = x[n] - X

ret = abs(reduce(gcd, d))

# print(d)
print(ret)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
from functools import reduce

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

N, X = map(int, input().split())
x = list(map(int, input().split()))

d = np.zeros(N, dtype=int)
for n in range(N):
    d[n] = x[n] - X

gcd = reduce(math.gcd, d)

# print(d)
print(gcd)
Problem p03282 (python)

Fixed submission:
import numpy as np
import math

S = input()
K = int(input())

k = 0
#  
while k < len(S) and S[k] == '1' and k < K:
    k += 1

if k == K or k == len(S):
    print('1')
else:
    print(S[k])

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

S = input()
K = int(input())

k = 0
while S[k] == '1' and k < K:
    k += 1

if k == K:
    print('1')
else:
    print(S[k])
Problem p03287 (python)

Fixed submission:
import numpy as np
import math

def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)

N, M = map(int, input().split())

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

# 1 <= N <= 10^5
# 2 <= M <= 10^9
# 1 <= A <= 10^9

S = []
total = 0
S.append(0)
for i in range(N):
    total = (total + A[i]) % M
    S.append(total)

oS = sorted(S)

count = 0

# print(oS)

cur_val = 0
number = 0
for i in range(0, N+1):
    if oS[i] == cur_val:
        number += 1
    if oS[i] > cur_val or i == N:
        if number >= 2:
            count += int(number * (number - 1) / 2)
        # print(cur_val, number)
        number = 1
        cur_val = oS[i]

print(count)

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

def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)

N, M = map(int, input().split())

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

# 1 <= N <= 10^5
# 2 <= M <= 10^9
# 1 <= A <= 10^9

S = []
total = 0
S.append(0)
for i in range(N):
    total = (total + A[i]) % M
    S.append(total)

oS = sorted(S)

count = 0

# print(oS)

cur_val = 0
number = 0
for i in range(0, N+1):
    if oS[i] == cur_val:
        number += 1
    if oS[i] > cur_val or i == N:
        if number >= 2:
            count += int(nCr(number, 2))
        # print(cur_val, number)
        number = 1
        cur_val = oS[i]

print(count)
Problem p03361 (python)

Fixed submission:
import numpy as np

H, W = map(int, input().split())

grid = np.zeros((H, W), dtype=int)

for h in range(H):
    S = input()
    for i, s in enumerate(S):
        if s == '#':
            grid[h][i] = 1

# print(grid)


def is_safe(h, w):
    ns = []
    ns.append((h-1, w))
    ns.append((h, w-1))
    ns.append((h+1, w))
    ns.append((h, w+1))

    safe = False
    for n in ns:
        if 0 <= n[0] and n[0] < H \
           and 0 <= n[1] and n[1] < W \
           and grid[n[0]][n[1]] == 1:
            safe = True

    if safe is False:
        print("No")
        exit(0)

    
for h in range(H):
    for w in range(W):
        if grid[h][w] == 1:
            is_safe(h, w)

print("Yes")
exit(0)

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

H, W = map(int, input().split())

grid = np.zeros((H, W), dtype=int)

for h in range(H):
    S = input()
    for i, s in enumerate(S):
        if s == '#':
            grid[h][i] = 1

# print(grid)


def is_safe(h, w):
    ns = []
    ns.append((h-1, w))
    ns.append((h, w-1))
    ns.append((h+1, w))
    ns.append((h, w+1))

    safe = False
    for n in ns:
        if 0 <= n[0] and n[0] < H \
           and 0 <= n[1] and n[1] < H \
           and grid[n[0]][n[1]] == 1:
            safe = True

    if safe is False:
        print("No")
        exit(0)

    
for h in range(H):
    for w in range(W):
        if grid[h][w] == 1:
            is_safe(h, w)

print("Yes")
exit(0)
Problem p03280 (python)

Fixed submission:
a,b=(int(i) for i in input().split())
print((a-1)*(b-1))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print((a-1)*(b-1))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
s=(a-1)*(b-1)
print(s)
Problem p03284 (python)

Fixed submission:
n,k=(int(i) for i in input().split())
if n%k==0:
    print(0)
else:
    print(1)

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

if n==0:
    string="0"
while n!=0:
    if n%2==1:
        string="1"+string
        n=n-1
    else:
        string="0"+string
    n=n//(-2)
    
print(string)

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

if n==0:
    string="0"
while n!=0:
    if n%2==1:
        string="1"+string
        n=n-1
    else:
        string="0"+string
    n=n/(-2)
    
print(string)

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

while n!=0:
    if n%2==1:
        string="1"+string
        n=n-1
    else:
        string="0"+string
    n=n/(-2)
if n==0:
    string="0"+string
    
print(string)

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

while n!=0:
    if n%2==1:
        string="1"+string
        n=n-1
    else:
        string="0"+string
    n=n/(-2)
if n==0:
    string="0"
    
print(string)
Problem p03292 (python)

Fixed submission:
from statistics import median

task=[int(i) for i in input().split()]
    
b=median(task)
sum=0

for i in range(3):
    sum+=abs(b-task[i])
    
print(sum)

Buggy submission (verdict: Runtime Error):
from statistics import median

task=[0,0,0]

for i in range(3):
    a=input()
    task[i]=int(a)
    
b=median(task)
sum=0

for i in range(3):
    sum+=abs(b-task[i])
    
sum
Problem p02866 (python)

Fixed submission:
import collections
import sys
sys.setrecursionlimit(10**6+10)
N=int(input()) 
d=list(map(int, input().split())) 

  
  
c = collections.Counter(d)
c = dict(collections.Counter(d))

if d[0] != 0 or c[0]>1:
  print(0)
  sys.exit()
max_key = max(c.keys())


count = 1
for i in range(2,max_key+1):
  a = c.get(i, -1)
  b = c.get(i-1, -1)
  if a == -1 or b == -1:
    print(0)
    sys.exit()
  count = (count * (b**a))%998244353

print(count)

Buggy submission (verdict: Runtime Error):
import collections
import sys
N=int(input()) 
d=list(map(int, input().split())) 

c = collections.Counter(d)
if d[0] != 0:
  print(0)
  sys.exit()
c = dict(collections.Counter(d))
max_key = max(c.keys())

count = 1
for i in range(1,max_key):
  a = c.get(i, -1)
  b = c.get(i+1, -1)
  if a == -1:
    print(0)
    sys.exit()
  count = count * (a**b)

print(count)
Problem p02882 (python)

Fixed submission:
import math
a,b,x=map(int, input().split()) 

threshold = (a*a*b)/2
if x <= threshold:
  rad = math.atan(2*x/(a*b*b))
  print(90-math.degrees(rad))
elif x == 2 * threshold:
  print(0)
else:
  at = (a*a*a)/(2*(a*a*b-x))
  rad = math.atan(at)
  print(90-math.degrees(rad))

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

threshold = (a*a*b)/2
if x <= threshold:
  rad = math.atan(2*x/(a*b*b))
  print(90-math.degrees(rad))
else:
  at = (a*a*a)/(2*(a*a*b-x))
  rad = math.atan(at)
  print(90-math.degrees(rad))

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

threshold = (a*a*b)/2
if x <= threshold:
  rad = math.atan(2*x/(a*b*b))
  print(90-math.degrees(rad))
else:
  at = (a*a*a)/(2*(a*a*b-x))
  print(at)
  rad = math.atan(at)
  print(90-math.degrees(rad))
Problem p02888 (python)

Fixed submission:
import bisect
n=int(input()) 
L=list(map(int, input().split())) 
L.sort()

count = 0        
for i in range(n-2):
  a = L[i]
  for k in range(i+1,n-1):
    b = L[k]

    count += bisect.bisect_left(L, a + b) - k -1
print(count)

Buggy submission (verdict: Runtime Error):
=int(input()) 
L=list(map(int, input().split())) 
L.sort()
 
def binary_search(list, item):
    low = 0
    high = len(list) - 1
    
    while low <= high:
        if item > list[high]:
          return high+1
          break
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
          return mid
        elif guess > item:
          high = mid -1
          if list[mid-1] < item:
            return mid-1
            break
        elif guess < item:
          low = mid + 1
          if list[mid+1] > item:
            return mid+1
            break
        else:
          print('error')
 
    return 0
 
 
count = 0        
for i in range(n-1):
  for k in range(i+1,n-1):
    a,b =L[i],L[k]
    L_temp = L[k+1:]
    binary_search(L_temp, a+b)
    count = count + binary_search(L_temp, a+b)
    
print(count)
Problem p02901 (python)

Fixed submission:
N, M = map(int, input().split())
Inf = 10**8
Dp = [Inf]*(2**N)
Dp[0] = 0

for i in range(M): #カギiで
    a,_=map(int, input().split())
    c = list(map(int, input().split()))
    d = sum((1<<p-1) for p in c) #iで開けられる宝箱の2bit表記
    for j in range(2**N):
        ope = j|d
        Dp[ope] = min(Dp[ope], Dp[j] + a)

if Dp[-1] == Inf:
    print(-1)
else:
    print(Dp[-1])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
Inf = 10**8
Dp = [Inf]*(2**N)
Dp[0] = 0
 
for i in range(M): #カギiで
    a,_=map(int, input().split())
    d = sum((1<<p-1) for p in list(map(int, input().split()))) #iで開けられる宝箱の2bit表記
    for j in range(2**N):
        ope = j|d
        Dp[ope] = min(Dp[ope], Dp[j] + a)
 
if Dp[-1] == Inf:
    print(-1)
else:

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

def main():
    N, M=map(int, input().split())
    a =[]
    c = []
    for i in range(2*M):
      if i%2 == 0:
        temp,_=map(int, input().split()) 
        a.append(temp)
      else:
        temp=list(map(int, input().split()))
        c.append(temp)
    a = np.array(a) 

    row = 2**M 
    boo = np.array([[int(j[i]) for i in range(M)] for j in  [bin(i)[2:].zfill(M) for i in range(row)]])
    table = np.zeros((row,N), dtype = 'int8')

    for i in range(row):
        ind_temp = np.array(list(set(itertools.chain.from_iterable(c*boo[i]))),dtype = int) -1
        table[i][ind_temp] = 1

    ind = np.where(np.all(table, axis=1))
    price = np.array([np.sum(a*boo[ind], axis = 1)])

    if price:
        print(np.min(price))
    else:
        print(-1)


if __name__ == "__main__":
    main()

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


N, M=map(int, input().split())
a =[]
c = []
for i in range(2*M):
  if i%2 == 0:
    temp,_=map(int, input().split()) 
    a.append(temp)
  else:
    temp=list(map(int, input().split()))
    c.append(temp)
a = np.array(a) 

row = 2**M 
con = [bin(i)[2:].zfill(M) for i in range(row)]
boo = np.array([[int(j[i]) for i in range(M)] for j in con])
table = np.zeros((row,N), dtype = 'int8')

for i in range(row):
    ind_temp = np.array(list(set(itertools.chain.from_iterable(c*boo[i]))),dtype = int) -1
    table[i][ind_temp] = 1

ind = np.where(np.all(table, axis=1))
price = np.array([np.sum(a*boo[ind], axis = 1)])
if price:
    print(np.min(price))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools
N, M=map(int, input().split())
a =[]
c = []
for i in range(2*M):
  if i%2 == 0:
    temp,_=map(int, input().split()) 
    a.append(temp)
  else:
    temp=list(map(int, input().split()))
    c.append(temp)
a = np.array(a) 
mini = -1
for n in range(M):
    for l in list(itertools.combinations(range(M),n+1)):
        temp = []
        for nn in l:
            temp = temp +c[l[nn]]
        temp = set(temp)
        temp = list(temp)
        if len(temp) == N:
            cost = sum(a[[np.array(l)]])
            if mini == -1 or mini > cost:
                mini = cost


print(mini)
Problem p03032 (python)

Fixed submission:
from collections import deque

N, K =map(int, input().split())
V=list(map(int, input().split()))
Vd = deque(V)
score = 0

for a in range(min(K,N)+1):
  for b in range(min(K-a+1,N-a+1)):
    hou = []
    Vd = deque(V)
    for _ in range(a):
      hou.append(Vd.popleft())
    for _ in range(b):
      hou.append(Vd.pop())
    hou.sort()
    for _ in range(K-a-b):
      if hou:
        if hou[0]>0:
          break
        hou.pop(0)
    score = max(score,sum(hou))
    
print(score)

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

N, K =map(int, input().split())
V=list(map(int, input().split()))
Vd = deque(V)

score = 0

for a in range(min(K,N)+1):

  for b in range(K-a+1):
    hou = []
    Vd = deque(V)
    for _ in range(a):
      hou.append(Vd.popleft())
    for _ in range(b):
      hou.append(Vd.pop())
    hou.sort()
    for _ in range(K-a-b):
      if hou:
        if hou[0]>0:
          break
        hou.pop(0)
    score = max(score,sum(hou))
    
print(score)
Problem p03379 (python)

Fixed submission:
import numpy as np

N = int(input())
xl = [int(x) for x in input().split()]

xlsorted = np.sort(xl)
m1 = xlsorted[int(N/2)-1]
m2 = xlsorted[int(N/2)]

for i in range(N):
    if xl[i] <= m1:
        print(m2)
    else:
        print(m1)

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

N = int(input())
xl = [int(x) for x in input().split()]

xlsorted = np.sort(xl)
m1 = xlsorted[int(N/2)-1]
m2 = xlsorted[int(N/2)]

for i in range(N):
    if xl[i] <= m1:
        print(m2)
    else:
        print(m1)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
print("Even" if a*b % 2 == 0 else "Odd")

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

a = input()
b = input()
c = int(a) * int(b)
 
if 1 < c and c < 1000:
  if c%2 == 0:
    print("Even")
  else:
    print("Odd")

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

a = input()
b = input()
c = int(a) * int(b)
 
if 1 < c and c < 1000:
  if c%2 == 0:
    print("Even")
  else:
    print("Odd")

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

args = sys.argv
a = args[0]
b = args[1]
c = a * b

if 1 < c and c < 1000:
  if c%2 == 0:
    print("Even")
  else:
    print("Odd")
Problem p02813 (python)

Fixed submission:
from itertools import permutations
N=int(input())
P=tuple(map(int,input().split()))
Q=tuple(map(int,input().split()))

for i,p in enumerate(permutations(range(1,N+1))):
    if p==P:
        a=i
    if p==Q:
        b=i
print(abs(a-b))

Buggy submission (verdict: Runtime Error):
from itertools import permutations
N=int(input())
P=tuple(map(int,input().split()))
Q=tuple(map(int,input().split()))

for i,p in enumerate(permutations(range(1,N+1))):
    if p==P:
        a=i
    if p=Q:
        b=i
print(abs(a-b))
Problem p03086 (python)

Fixed submission:
s=input()
n=len(s)
 
res=0
for i in range(n):
  for j in range(i,n):
    sub=s[i:j+1]
    flg=True
    for k in sub:
      if(k not in ['A','G','C','T']):
        flg=False
    if(flg):
      res=max(res,len(sub))
      
print(res)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(i)
 
res=0
for i in range(n):
  for j in range(i,n):
    sub=s[i:j+1]
    flg=True
    for k in sub:
      if(k not in ['A','G','C','T']):
        flg=False
    if(flg):
      res=max(res,len(sub))
      
print(res)

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

res=0
for i in range(n):
  for j in range(i,n):
    sub=s[i:j+1]
    flg=True
    for k in sub:
      if(k not in ['A','G','C','T']):
        flg=False
    if(flg):
      res=max(res,len(sub))
      
print(res)
Problem p03220 (python)

Fixed submission:
N=int(input())
T,A=map(int,input().split())
mylist=list(map(int,input().split()))
mymin=10**6
index=0

for i in range(N):
  if(mymin>abs(A-(T-0.006*mylist[i]))):
    mymin=abs(A-(T-0.006*mylist[i]))
    index=i
print(index+1)

Buggy submission (verdict: Runtime Error):
N=int(input())
T,A=map(int,input().split())
mylist=list(map(int,input().split()))
ans=[abs(A-(T-x*0.006)) for x in mylist]
print(ans.index(min(mylist))+1)

Buggy submission (verdict: Runtime Error):
N=int(input())
T,A=map(int,input().split())
mylist=list(map(int,input().split()))
min=T
index=0

for i in range(N):
  if(min>abs(T-0.006*mylist[i])):
    min=mylist
    index=i
print(index)
Problem p03308 (python)

Fixed submission:
n=int(input())
mylist=list(map(int,input().split()))
mymax=max(mylist)
mymin=min(mylist)
print(abs(mymax-mymin))

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

Max=0
Min=10**9

for i in range(n):
  if(Max<a[i]):
    Max=a[i]
  if(min>a[i]):
    Min=a[i]

print(abs(Max-Min))

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

Max=0
Min=10**9

for i in a:
  if(Max<i):
    Max=i
  if(min>i):
    Min=i
print(abs(Max-Min))

Buggy submission (verdict: Runtime Error):
N=int(input())
mylist=list(map(int,input().split))
mymax=max(mylist)
mymin=min(mylist)
print(abs(mymax-mymin))
Problem p03545 (python)

Fixed submission:
from itertools import product
a=list(input())

for b in product(["+","-"],repeat=3):
  if(eval(a[0]+b[0]+a[1]+b[1]+a[2]+b[2]+a[3])==7):
    print(str(a[0]+b[0]+a[1]+b[1]+a[2]+b[2]+a[3]+"=7"))
    break

Buggy submission (verdict: Runtime Error):
import itertools import product
a=list(map(str,input().split()))

for b in product(["+","-"],repeat=3):
  if(eval(a[0]+b[0]+a[1]+b[1]+a[2]+b[2]+a[3])==7):
    print(str(a[0]+b[0]+a[1]+b[1]+a[2]+b[2]+a[3]=7))
    break:
Problem p03644 (python)

Fixed submission:
n=int(input())
i=1
while i*2<=n:
  i*=2
print(i)

Buggy submission (verdict: Runtime Error):
n=int(input)
i=1
while i*2<=n:
  i*=2
print(i)

Buggy submission (verdict: Runtime Error):
n=input()
maxn=0
maxcount=0
 
for i in range(n+1):
  count=0
  now=i
  while n%2==0:
    now=now/2
    count+=1
  if maxcount < count:
    maxn=now
    maxcount=count
 
print(maxn)

Buggy submission (verdict: Runtime Error):
n=input()
maxn=0
maxcount=0
 
for i in range(n+1):
  count=0
  while n%2==0:
    n=n/2
    count+=1
  if maxcount < count:
    maxn=i
    maxcount=count
 
print(maxn)

Buggy submission (verdict: Runtime Error):
n=input()
maxn=0
maxccount=0

for i in range(n+1):
  count=0
  while n%2==0:
    n=n/2
    count+=1
  if maxcount < count:
    maxn=i
    maxcount=count

print(maxn)

Buggy submission (verdict: Runtime Error):
n=input()
maxn=0
maxccount=0

for i in range(n+1):
  count=0
  while n-i%2==0:
    n=n/2
    count+=1
  if maxcount < count:
    maxn=i
    maxcount=count

print(maxn)
Problem p03434 (python)

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

A.sort(reverse=True)
print(sum([A[i] for i in range(len(A)) if i % 2 == 0]) - sum([A[i] for i in range(len(A)) if i % 2 == 1]))

Buggy submission (verdict: Runtime Error):
input()
A = list(map(int, input().split())).sort(reverse=True)
print(sum([A[i] * ((-1) ** (i % 2)) for i in range(len(A))]))
Problem p03455 (python)

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

if (v[0] * v[1]) % 2 == 0:
    print('Even')
else:
    print('Odd')

Buggy submission (verdict: Runtime Error):


v = map(int, input().split())

if (v[0] * v[1]) % 2 == 0:
    print('Even')
else
    print('Odd')