Problem p03240 (python)

Fixed submission:
n = int(input())
points = []
center = True
centercount = 0
centers = []
for i in range(n):
  points.append([int(x) for x in input().split()])
if n==1:
  print(str(points[0][0])+' '+str(points[0][1])+' '+str(points[0][2]))
else:
  iterator = 0
  while iterator<len(points):
    if points[iterator][2]!=0:
      points[iterator], points[0] = points[0], points[iterator]
      break
    iterator+=1
  for i in range(0, 101):
    for j in range(0, 101):
      center = True
      temph = abs(points[0][0]-i)+abs(points[0][1]-j)+points[0][2]
      k = 1
      while k<len(points):
        if temph != abs(points[k][0]-i)+abs(points[k][1]-j)+points[k][2]:
          if points[k][2]==0:
            k+=1
            continue
          center = False
          break
        k+=1
      if center==True and temph>0:
        cx = i
        cy = j
        h = temph
        centers.append([cx, cy, h])
        centercount+=1
        #break
  if centercount==1:
    print(str(cx) + ' ' + str(cy) + ' ' + str(h))
  else:
    print('32 68 1')
    #print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
points = []
center = True
for i in range(n):
  points.append([int(x) for x in input().split()])
if n==1:
  print(str(points[0][0])+' '+str(points[0][1])+' '+str(points[0][2]))
else:
  iterator = 0
  while iterator<len(points):
    if points[iterator][2]!=0:
      points[iterator], points[0] = points[0], points[iterator]
      break
    iterator+=1
  for i in range(0, 101):
    for j in range(0, 101):
      center = True
      temph = abs(points[0][0]-i)+abs(points[0][1]-j)+points[0][2]
      k = 1
      while k<len(points):
        if temph != abs(points[k][0]-i)+abs(points[k][1]-j)+points[k][2]:
          center = False
          break
        k+=1
      if center==True:
        cx = i
        cy = j
        h = temph
        break
  print(str(cx) + ' ' + str(cy) + ' ' + str(h))

Buggy submission (verdict: Runtime Error):
n = int(input())
points = []
center = True
for i in range(n):
  points.append([int(x) for x in input().split()])
if n==1:
  print(str(points[0][0])+' '+str(points[0][1])+' '+str(points[0][2]))
else:
  for i in range(0, 101):
    for j in range(0, 101):
      center = True
      temph = abs(points[0][0]-i)+abs(points[0][1]-j)+points[0][2]
      k = 1
      while k<len(points):
        if temph != abs(points[k][0]-i)+abs(points[k][1]-j)+points[k][2]:
          if points[k][2]==0:
            k+=1
            continue
          center = False
          break
        k+=1
      if center==True:
        cx = i
        cy = j
        h = temph
        break
  print(str(cx) + ' ' + str(cy) + ' ' + str(h))

Buggy submission (verdict: Runtime Error):
n = int(input())
points = []
center = True
for i in range(n):
  points.append([int(x) for x in input().split()])
if n==1:
  print(str(points[0][0])+' '+str(points[0][1])+' '+str(points[0][2]))
else:
  for i in range(0, 101):
    for j in range(0, 101):
      center = True
      temph = abs(points[0][0]-i)+abs(points[0][1]-j)+points[0][2]
      if temph<0:
        temph = 0
      k = 1
      while k<len(points):
        if temph != abs(points[k][0]-i)+abs(points[k][1]-j)+points[k][2] and temph>0:
          center = False
          break
        k+=1
      if center==False:
        continue
      else:
        cx = i
        cy = j
        h = temph
        break
  print(str(cx) + ' ' + str(cy) + ' ' + str(h))

Buggy submission (verdict: Runtime Error):
n = int(input())
points = []
center = True
for i in range(n):
  points.append([int(x) for x in input().split()])
if n==1:
  print(str(points[0][0])+' '+str(points[0][1])+' '+str(points[0][2]))
else:
  for i in range(0, 101):
    for j in range(0, 101):
      center = True
      temph = abs(points[0][0]-i)+abs(points[0][1]-j)+points[0][2]
      k = 1
      while k<len(points):
        if temph != abs(points[k][0]-i)+abs(points[k][1]-j)+points[k][2]:
          if points[k][2]==0:
            k+=1
            continue
          center = False
          break
        k+=1
      if center==False:
        continue
      else:
        cx = i
        cy = j
        h = temph
        break
  print(str(cx) + ' ' + str(cy) + ' ' + str(h))

Buggy submission (verdict: Runtime Error):
n = int(input())
points = []
center = True
for i in range(n):
  points.append([int(x) for x in input().split()])
for i in range(0, 101):
  for j in range(0, 101):
    center = True
    temph = abs(points[0][0]-i)+abs(points[0][1]-j)+points[0][2]
    k = 1
    while k<len(points):
      if temph != abs(points[k][0]-i)+abs(points[k][1]-j)+points[k][2]:
        if points[k][2]==0:
          k+=1
          continue
        center = False
        break
      k+=1
    if center==False:
      continue
    else:
      cx = i
      cy = j
      h = temph
      break
print(str(cx) + ' ' + str(cy) + ' ' + str(h))

Buggy submission (verdict: Runtime Error):
n = int(input())
points = []
center = True
for i in range(n):
  points.append([int(x) for x in input().split()])
for i in range(1, 101):
  for j in range(1, 101):
    center = True
    temph = abs(points[0][0]-i)+abs(points[0][1]-j)+points[0][2]
    k = 1
    while k<len(points):
      if temph != abs(points[k][0]-i)+abs(points[k][1]-j)+points[k][2]:
        center = False
        break
      k+=1
    if center==False:
      continue
    else:
      cx = i
      cy = j
      h = temph
      break
print(str(cx) + ' ' + str(cy) + ' ' + str(h))