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

Fixed submission:
from functools import reduce
from operator import mul
n = int(input())
a = list(map(int, input().split()))

m = reduce(mul, a) - 1
ans = 0
for ai in a:
    ans += m % ai
print(ans)

Buggy submission (verdict: Runtime Error):
from functools import reduce
from operators import mul
 
n = int(input())
a = list(map(int, input().strip()))
 
m = reduce(mul, a) - 1
ans = 0
for ai in a:
  ans += m % ai
 
print(ans)

Buggy submission (verdict: Runtime Error):
from functools import reduce
from operators import mul

n = int(input())
a = list(map(int, input().strip()))

m = reduce(mul, a) - 1
ans = 0
for ai in a:
  ans += mul % ai

print(ans)
Problem p03323 (python)

Fixed submission:
a, b = map(int, input().split())
if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if b < a:
  a, b = b, a
if if b <= 8 or 16 - b - 2 <= a:
  print('Yay!')
else:
  print(':(')
Problem p03325 (python)

Fixed submission:
def f(n):
  c = 0
  while n % 2 == 0:
    c += 1
    n = n // 2
  return c
 
n = int(input())
a = list(map(int, input().split()))
print(sum((f(ai) for ai in a if ai % 2 == 0)))

Buggy submission (verdict: Runtime Error):
def f(n):
  c = 0
  while n % 2 == 0:
    c += 1
    n = n // 2
  return c

n = int(input())
a = list(map, int, input().split())
print(sum((f(ai) for ai in a if ai % 2 == 0)))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [n // 2 for n in map(int, input().split() if n % 2 == 0)]
print(sum(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = (n // 2 in map(int, input().split() if n % 2 == 0))
print(sum(a))
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, intput().split())
print(max(a + b, a - b, a * b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, intpu().split())
print(max(a + b, a - b, a * b))
Problem p03352 (python)

Fixed submission:
x = int(input())
if x < 4:
  print(1)
else:
  ans = 2
  for i in range(2, x):
    for j in range(2, x):
      if i ** j <= x:
        ans = max(ans, i ** j)
      else:
        break
  print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
if x = 1:
  print(1)
else:
  ans = 2
  for i in range(2, x):
    for j in range(2, x):
      if i ** j <= x:
        ans = max(ans, i ** j)
  print(ans)
Problem p03370 (python)

Fixed submission:
n, x = map(int, input().split())
costs = [int(input()) for _ in range(n)]
print(len(costs) + (x - sum(costs)) // min(costs))

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
costs = [int(input()) for _ in range(n)]
print(len(costs) + (x - sum(costs)) // min(consts))
Problem p03378 (python)

Fixed submission:
n, m, x = map(int, input().split())
c = [0] * (n + 1)
for i in (map(int, input().split())):
  c[i] = 1
print(min(sum(c[0:x]), sum(c[x:-1])))

Buggy submission (verdict: Runtime Error):
n, m, x = map(int, input().split())
c = [0] * (n + 1)
for i in (map(int, input().split())):
  c[i] = 1
print(min(sum(c[0:x], c[x:-1])))
Problem p03485 (python)

Fixed submission:
from math import ceil
a, b = map(int, input().split())
print(ceil((a + b) / 2))

Buggy submission (verdict: Runtime Error):
from math import ceil
a, b = map(int, input())
print(ceil((a + b) / 2))
Problem p03543 (python)

Fixed submission:
s = input().rstrip()
if all((s[0] == i for i in s[:-1])) or all((s[1] == i for i in s[1:])):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
from collections import Counter
c = Counter(input())
if c.most_commons(1)[0][1] >= 3:
  print('YES')
else:
  print('NO')
Problem p03671 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, c = int(input().split())
print(sum((a,b,c)) - max(a, b, c))

Buggy submission (verdict: Runtime Error):
a, b, c = int(input().split())
print(sum(a,b,c) - max(a, b, c))
Problem p03720 (python)

Fixed submission:
n, m = map(int, input().split())
r = [0] * n
for _ in range(m):
  a, b = map(int, input().split())
  r[a - 1] += 1
  r[b - 1] += 1
for i in range(n):
  print(r[i])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
r = [0] * n
for _ in range(m):
  a, b = map(int, input().split())
  r[a] += 1
  r[b] += 1
for i in range(n):
  print(r[i])
Problem p03760 (python)

Fixed submission:
o = input().rstrip()
e = input().rstrip()
 
ans = ''
for l1, l2 in zip(o, e):
  ans = ''.join([ans, l1, l2])
 
if len(o) > len(e):
  ans += o[-1]
 
print(ans)

Buggy submission (verdict: Runtime Error):
o = input().rstrip()
e = input().rstrip()
if len(e) < len(o):
  e.append('')

ans = ''
for l1, l2 in zip(o, e):
  ans = ''.join([ans, l1, l2])

print(ans)
Problem p03826 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input())
print(max(a * b, c * d))
Problem p03852 (python)

Fixed submission:
s = input().rstrip()
if s in "aeiou":
  print('vowel')
else:
  print('consonant')

Buggy submission (verdict: Runtime Error):
s = input().split()
if s in "aeiou":
  print('vowel')
else:
  print('consonant')
Problem p03957 (python)

Fixed submission:
s = input()
ans = 'No'
c = s.find('C')
if c != -1:
  f = s[c:].find('F')
  if f != -1:
    ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 'No'
c = s.find('C')
if c != -1:
	f = s[c:].find('F')
    if f != -1:
      ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 'No'
c = s.find('C')
if c != -1:
	f = s.find('F', c)
    if f != -1:
      ans = 'Yes'
print(ans)
Problem p04043 (python)

Fixed submission:
from collections import Counter
abc = input().rstrip()
c = Counter(abc)
if c['5'] == 2 and c['7'] == 1:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
from collections import Counter
abc = input().rstrip()
c = COunter(abc)
if c['5'] == 2 and c['7'] == 1:
  print('YES')
else:
  print('NO')
Problem p02684 (python)

Fixed submission:
n,k=(int(i) for i in input().split())
r=[0 for i in range(n)]
l=[int(i) for i in input().split()]
wazap=[]
count=1
saver=None
temp=0
while r[temp]==0:
  r[temp]=count
  wazap.append(temp)
  temp=l[temp]-1
start=l[wazap[-1]]
left=None
for i in range(len(wazap)):
  if wazap[i]==start-1:
    left=i
    break
loop=len(wazap)-left
if k<left:
  print(wazap[k]+1)
else:
  print(wazap[(k-left)%loop+left]+1)

Buggy submission (verdict: Runtime Error):
n,k=(int(i) for i in input().split())
r=[0 for i in range(n)]
l=[int(i) for i in input().split()]
wazap=[]
count=1
saver=None
temp=0
while r[temp]==0:
  r[temp]=count
  wazap.append(temp)
  temp=l[temp]-1
start=wazap[-1]
for i in range(len(wazap)):
  if wazap[i]==start-1:
    left=i
    break
loop=len(wazap)-left
if k<left:
  print(wazap[k]+1)
else:
  print(wazap[(k-left)%loop+left]+1)
Problem p02690 (python)

Fixed submission:
import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
x=int(input())
l=make_divisors(x)
if x==0:
  answer=[0,0]
for i in range(math.ceil(2*pow(x,0.2))):
  for j in l:
    if pow(i,5)-pow(i-j,5)==x:
      answer=[i,i-j]
      break
print(answer[0],answer[1])

Buggy submission (verdict: Runtime Error):
import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
x=int(input())
l=make_divisors(x)
if x==0:
  answer=[0,0]
for i in range(math.ceil(pow(x,0.2))):
  for j in l:
    if pow(i,5)-pow(i-j,5)==x:
      answer=[i,i-j]
      break
print(answer[0],answer[1])

Buggy submission (verdict: Runtime Error):
import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
x=int(input())
l=make_divisors(x)
for i in range(math.ceil(pow(x,0.2))):
  for j in l:
    if pow(i,5)-pow(i-j,5)==x:
      answer=[i,i-j]
      break
print(answer[0],answer[1])
Problem p02691 (python)

Fixed submission:
n=int(input())
l=[0 for i in range(2*10**5+1)]
r=[0 for i in range(2*10**5+1)]
c=1
a=0
if n!=0:
  k=[int(i) for i in input().split()]
for i in range(n):
  if k[i]+c<=2*10**5:
    l[k[i]+c]+=1 
  if -k[i]+c>=0 and -k[i]+c<=2*10**5:
    r[-k[i]+c]+=1
  c+=1
for i in range(n):
  a+=l[i]*r[i]
print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[0 for i in range(2*10**5)]
r=[0 for i in range(2*10**5)]
c=1
a=0
if n!=0:
  k=[int(i) for i in input().split()]
for i in range(n):
  if k[i]+c<=2*10**5:
    l[k[i]+c]+=1 
  if -k[i]+c>=0 and -k[i]+c<=2*10**5:
    r[-k[i]+c]+=1
  c+=1
for i in range(n):
  a+=l[i]*r[i]
print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[0 for i in range(2*10**5)]
r=[0 for i in range(2*10**5)]
c=1
a=0
if n!=0:
  k=[int(i) for i in input().split()]
for i in range(n):
  l[k[i]+c]+=1 
  if -k[i]+c>=0 and -k[i]+c<=2*10**5:
    r[-k[i]+c]+=1
  c+=1
for i in range(n):
  a+=l[i]*r[i]
print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[0 for i in range(2*n)]
r=[0 for i in range(2*n)]
c=1
a=0
if n!=0:
  k=[int(i) for i in input().split()]
for i in range(n):
  l[abs(c-k[i])]+=1
  r[c+k[i]]+=1
  c+=1
for i in range(2*n):
  a+=l[i]*r[i]
print(a)
Problem p02705 (python)

Fixed submission:
import math
print(math.pi*2*int(input()))

Buggy submission (verdict: Runtime Error):
import math
print(math.pi()*int(input()))
Problem p02706 (python)

Fixed submission:
n,m=(int(i) for i in input().split())
a=[int(i) for i in input().split()]
s=sum(a)
if n-s>=0:
  print(n-s)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
n,m=(int(i) for i in input().split())
a=[int(i) for i in input().split()]
s=sum(a)
if n-a>=0:
  print(n-a)
else:
  print(-1)
Problem p02713 (python)

Fixed submission:
import math
  
k=int(input())
r=0
ls=[]

for i in range(k):
  for j in range(k):
    a=math.gcd(i+1,j+1)
    for l in range(k):
      r+=math.gcd(a,l+1)
print(r)

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

def gcd(*numbers):
    return reduce(math.gcd, numbers)
  
k=int(input())
r=0
l=[]

for i in range(k):
  for j in range(k):
    for l in range(k):
      if i<=j and j<=k:
        l.append([i+1,j+1,k+1])
for s in l:
  r+=gcd(s[0],s[1],s[2])
print(r)

Buggy submission (verdict: Runtime Error):
import math
k=int(input())
r=0
for i in range(k):
  for j in range(k):
    for l in range(k):
      r+=math.gcd(i+1,j+1,l+1)
print(r)
Problem p02761 (python)

Fixed submission:
n,m=(int(i) for i in input().split())
l=[None,None,None]
answer='unknown'
for i in range(m):
  a,b=(int(i) for i in input().split())
  if l[n-a]==None:
    l[n-a]=b
  elif l[n-a]!=b:
    answer='-1'
    break
if l[0]==None:
  l[0]=0
for i in range(3):
  if l[i]==None:
    if i!=n-1:
      l[i]=0
    else:
      l[i]=1
r=l[2]*10**2+l[1]*10+l[0]
if len(str(r))!=n:
  answer='-1'
if answer=='-1':
  print('-1')
else:
  print(r)

Buggy submission (verdict: Runtime Error):
n,m=(int(i) for i in input.split())
l=[None,None,None]
answer='unknown'
for i in range(m):
  a,b=(int(i) for i in input().split())
  if l[a-1]==None:
    l[a-1]=b
  elif l[a-1]!=b:
    answer='-1'
    break
for i in range(3):
  if l[i]==None:
    if i!=3-n:
      l[i]=0
    else:
      l[i]=1
r=l[0]*10**2+l[1]*10+l[2]
if len(str(r))!=n:
  answer='-1'
if answer=='-1':
  print('-1')
else:
  print(r)
Problem p02778 (python)

Fixed submission:
s=input()
a=""
for i in range(len(s)):
  a+="x"
print(a)

Buggy submission (verdict: Runtime Error):
s=input()
a=""
for i i range(len(s)):
  a+="x"
print(a)
Problem p02780 (python)

Fixed submission:
n,m=(int(i) for i in input().split())
l=[]
for i in input().split():
  l.append((int(i)+1)/2)
s=sum(l[0:m])
maxe=s
for i in range(n-m):
  s+=l[m+i]
  s-=l[i]
  if s>maxe:
    maxe=s
print(maxe)

Buggy submission (verdict: Runtime Error):
n,m=(int(i) for i in input().split())
a=[0 for i in range(n-m+1)]
for i in input().split():
  a[i:i+m]+=((int(i)+1)/2)
print(max(a))
Problem p02783 (python)

Fixed submission:
h,a=(int(i) for i in input().split())
if h//a==h/a:
  print(h//a)
else:
  print(h//a+1)

Buggy submission (verdict: Runtime Error):
h,a=int(input().split())
if h//a==h/a:
  prinnt(h//a)
else:
  print(h//a+1)
Problem p02784 (python)

Fixed submission:
h,n = (int(i) for i in input().split())
a=[]
for i in input().split():
  a.append(int(i))
if sum(a)>=h:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
h,n = (int(i) for i in input().split())
a=input().split()
if sum(a)>=h:
  print('Yes')
else:
  print('No')
Problem p02923 (python)

Fixed submission:
n=int(input())
h=[int(i) for i in input().split()]
r=0
k=0
for i in range(n-1):
  if h[i+1]<=h[i]:
    k+=1
  else:
    r=max(k,r)
    k=0
r=max(k,r)
print(r)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=[int(i) for i in input().split()]
r=0
k=0
for i in range(n):
  if h[i+1]>=h[i]:
    k+=1
  else:
    r=max(k,r)
    k=0
print(r)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=[int(i) for i in input().split()]
r=0
k=0
for i in range(n):
  if h(i+1)>=h(i):
    k+=1
  else:
    r=max(k,r)
    k=0
print(r)
Problem p02945 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b)
c=a*b
d=a+b
e=a-b
print(max(c,d,e))

Buggy submission (verdict: Runtime Error):
a,b=(int(input().split()))
c=a*b
d=a+b
e=a-b
print(max(c,d,e))

Buggy submission (verdict: Runtime Error):
a,b=(int(input().split()))
c=a＊b
d=a+b
e=a-b
print(max(c,d,e))
Problem p02947 (python)

Fixed submission:
n=int(input())
s=[]
r=[]
c=0
for i in range(n):
    a=input()
    b=[]
    for k in a:
      b.append(k)
    b.sort()
    s.append(b)
s.sort()
for i in range(n-1):
    if s[i]==s[i+1]:
        c+=1
        r.append(c)
    else:
        c=0
        r.append(c)
print(sum(r))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[[] for i in range n]
r=0
for i in range(n):
  a=input()
  for j in a:
    s[i].append(j)
    s[i].sort()
s.sort()
k=0
for i in range (n-1):
  if s[i]==s[i+1]:
    k+=1
  else:
    r+=k*(k-1)/2
    k=0
print(r)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[]
r=[]
c=0
for i in range(n):
    a=input()
    a.sorted()
    s.append(a)
for i in range(n):
    if a[i]==a[i+1]:
        c+=1
        r.append(c)
    else:
        c=0
        r.append(c)
print(sum(r))
Problem p02995 (python)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def unchi(x,m,n):
  r=x//m+x//n-x//(m*n//(gcd(m,n)))
  return r
a,b,c,d=(int(i) for i in input().split())
print(b-a+1-(unchi(b,c,d)-unchi(a-1,c,d)))

Buggy submission (verdict: Runtime Error):
import math
def unchi(x,m,n):
  r=x//m+x//n-x//(m*n//math.gcd(m,n))
  return r
a,b,c,d=(int(i) for i in input().split())
print(b-a+1-(unchi(b,c,d)-unchi(a-1,c,d)))

Buggy submission (verdict: Runtime Error):
import math
def unchi(x,m,n):
  r=x//m+x//n-x//math.lcm(m,n)
  return r
a,b,c,d=(int(i) for i in input().split())
print(b-a+1-(unchi(b,c,d)-unchi(a-1,c,d)))

Buggy submission (verdict: Runtime Error):
def unchi(x,m,n):
  r=x//m+x//n-x//(m＊n)
  return r
a,b,c,d=(int(i) for i in input().split())
print(unchi(b,c,d)-unchi(a,c,d))

Buggy submission (verdict: Runtime Error):
def unchi(x,m,n):
  a=x//m+x//n-x//(m＊n)
  return a
a,b,c,d=(int(i) for i in input().split())
print(unchi(b,c,d)-unchi(a,c,d))
Problem p02996 (python)

Fixed submission:
l=int(input())
a=[]
for i in range(l):
  m,n=(int(i) for i in input().split())
  a.append([n,m])
a.sort()
r="Yes"
s=0
for i in range(l):
  s=s+a[i][1]
  if s>a[i][0]:
    r="No"
    break
print(r)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
  m,n=(int(i) for i in input().split())
  a.append([n,m])
a.sort()
r="Yes"
s=0
for i in range(n):
  s=s+a[i][1]
  if s>a[i][0]:
    r="No"
    break
print(r)
Problem p02999 (python)

Fixed submission:
x,a=(int(i) for i in input().split())
if x>=a:
  print(10)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
x,a=(int(i) for i in input().split())
t=if(x>=a)
print(t*10)

Buggy submission (verdict: Runtime Error):
x,a=(int(i) for i in input().split())
print((if(x>=a))*10)
Problem p03000 (python)

Fixed submission:
n,x=(int(i) for i in input().split())
d=0
c=1
l=[int(i) for i in input().split()]
for i in range(n):
  d=d+l[i]
  if d<=x:
    c=c+1
  elif d>x:
    break
print(c)

Buggy submission (verdict: Runtime Error):
n,x=(int(i) for i in input().split())
d=0
c=0
for i in range(n):
  l=int(input())
  d=d+l
  if d<=x:
    c=c+1
  elif d>x:
    print(c)
    break
Problem p03006 (python)

Fixed submission:
n=int(input())
r=[]
a=[]
for i in range(n):
  b,c=(int(j) for j in input().split())
  for k in range(i):
    d=a[k][0]-b
    e=a[k][1]-c
    if d<0:
      d=-d
      e=-e
    elif d==0:
      if e<0:
        e=-e
    r.append([d,e])
  a.append([b,c])
r.sort()
if n>1:
  p=r[0]
x=1
z=0
t=0
q=[]
for i in range(len(r)-1):
  if r[i]==r[i+1]:
    x=x+1
    if x>z:
      p=r[i]
      z=x
  else:
    x=1
for j in range(n-1):
  for i in range(n-1):
    if a[i][0]>a[i+1][0]:
      w=a[i]
      a[i]=a[i+1]
      a[i+1]=w
    elif a[i][0]==a[i+1][0]:
      if (a[i][1]-a[i+1][1])*p[1]>0:
        w=a[i]
        a[i]=a[i+1]
        a[i+1]=w
if n==1:
  print(1)
else:
  for i in range(n):
    if a[i] not in q:
      t=t+1
    q.append([a[i][0]+p[0],a[i][1]+p[1]])
  print(t)

Buggy submission (verdict: Runtime Error):
n=int(input())
r=[]
a=[]
for i in range(n):
  b,c=(int(j) for j in input().split())
  for k in range(i):
    d=a[k][0]-b
    e=a[k][1]-c
    if d<0:
      d=-d
      e=-e
    elif d=0:
      if e<0:
        e=-e
    r.append([d,e])
  a.append([b,c])
r.sort()
if n>1:
  p=r[0]
x=1
z=0
t=0
q=[]
for i in range(len(r)-1):
  if r[i]==r[i+1]:
    x=x+1
    if x>z:
      p=r[i]
      z=x
  else:
    x=1
for j in range(n-1):
  for i in range(n-1):
    if a[i][0]>a[i+1][0]:
      w=a[i]
      a[i]=a[i+1]
      a[i+1]=w
    elif a[i][0]==a[i+1][0]:
      if (a[i][1]-a[i+1][1])*p[1]>0:
        w=a[i]
        a[i]=a[i+1]
        a[i+1]=w
if n==1:
  print(1)
else:
  for i in range(n):
    if a[i] not in q:
      t=t+1
    q.append([a[i][0]+p[0],a[i][1]+p[1]])
  print(t)

Buggy submission (verdict: Runtime Error):
n=int(input())
r=[]
a=[]
for i in range(n):
  b,c=(int(j) for j in input().split())
  for k in range(i):
    d=a[k][0]-b
    e=a[k][1]-c
    if d<0:
      d=-d
      e=-e
    r.append([d,e])
  a.append([b,c])
for j in range(n):
  for i in range(n):
    if a[i][0]>a[i+1][0]:
      w=a[i]
      a[i]=a[i+1]
      a[i+1]=w
    elif a[i][1]>a[i+1][1]:
      w=a[i]
      a[i]=a[i+1]
      a[i+1]=w
sortsecond = lambda val: val[1]
a.sort(key=sortsecond)
r.sort()
if n>1:
  p=r[0]
x=1
z=0
t=0
q=[]
for i in range(len(r)-1):
  if r[i]==r[i+1]:
    x=x+1
    if x>z:
      p=r[i]
      z=x
  else:
    x=1
if n==1:
  print(1)
else:
  for i in range(n):
    if a[i] not in q:
      t=t+1
    q.append([a[i][0]+p[0],a[i][1]+p[1]])
    q.append([a[i][0]-p[0],a[i][1]-p[1]])
  print(t)

Buggy submission (verdict: Runtime Error):
n=int(input())
r=[]
a=[]
for i in range(n):
  b,c=(int(j) for j in input().split())
  for k in range(i):
    d=abs(a[k][0]-b)
    e=abs(a[k][1]-c)
    r.append([d,e])
  a.append([b,c])
r.sort()
p=r[0]
x=1
z=1
t=0
q=[]
for i in range(len(r)-1):
  if r[i]==r[i+1]:
    x=x+1
  else:
    if x>z:
      p=r[i]
    x=1
for i in range(n):
  if a[i] not in q:
    t=t+1
  q.append([a[i][0]+p[0],a[i][1]+p[1]])
  q.append([a[i][0]-p[0],a[i][1]-p[1]])
print(t)
Problem p03007 (python)

Fixed submission:
n=int(input())
a=[]
r=[]
for i in input().split():
  a.append(int(i))
a.sort()
t=a.pop(-1)
b=a.pop(0)
for i in a:
  if i>=0:
    r.append([b,i])
    b=b-i
  else:
    r.append([t,i])
    t=t-i
print(t-b)
r.append([t,b])
for i in r:
  print(i[0],i[1])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
r=[]
for i in input().split():
  a.append(int(i))
a.sort()
t=a.pop(-1)
b=a(0)
for i in a:
  if i>=0:
    r.append([b,i])
    b=b-i
  else:
    r.append([t,i])
    t=t-i
print(t-b)
r.append([t,b])
for i in r:
  print(r[0],r[1])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
r=[]
for i in input().split():
  a.append(int(i))
a.sort()
t=a[-1]
b=a[0]
for i in a[1:-1]:
  if i>=0:
    r.append([b,i])
    b=b-i
  else:
    r.append([t,i])
    t=t-i
print(t-b)
for i in r:
  print(r[0],r[1])
Problem p03030 (python)

Fixed submission:
n=int(input())
a=[]
b=[i+1 for i in range(n)]
for i in range(n):
  m,l=(j for j in input().split())
  a.append([m,int(l)])
for i in range(n):
  for j in range(n-1):
    if a[j+1][0]<a[j][0] or (a[j+1][0]==a[j][0] and a[j][1]<a[j+1][1]):
                 c=a[j]
                 a[j]=a[j+1]
                 a[j+1]=c
                 d=b[j]
                 b[j]=b[j+1]
                 b[j+1]=d
for i in range(n):
  print(b[i])

Buggy submission (verdict: Runtime Error):
a=[]
b=[i+1 for i in range(n)]
for i in range(n):
  m,l=(j for j in input().split())
  a.append([m,l])
for i in range(n):
  for j in range(n-1):
    if a[j+1][0]<a[j][0] or (a[j+1][0]==a[j][0] and a[j][1]<a[j+1][1]):
                 c=a[j]
                 a[j]=a[j+1]
                 a[j+1]=c
                 d=b[j]
                 b[j]=b[j+1]
                 b[j+1]=d
for i in range(n):
  for j in range(n):
    if b[j]==i+1:
      print(j+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
b=[i for i in range(n)]
for i in range(n):
  m,n=(int(j) for j in input().split())
  a.append([m,n])
for i in range(n):
  for j in range(n):
    if a[j[1]]<a[j+1[1]] or (a[j[1]]=a[j+1[1]] and a[j[2]]):
                 c=a[j]
                 a[j]=a[j+1]
                 a[j+1]=c
                 d=b[j]
                 b[j]=b[j+1]
                 b[j+1]=d
for i in range(n):
  print(b[i]+1)