Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
ar = list(map(int,input().split(" ")))
mi = a
br = set(ar)
count = 0
for r in br:
    if r > ar.count(r):
        count += ar.count(r)
    elif r < ar.count(r):
        count += ar.count(r) - r
print(count)
        

Fixed submission:
import collections
a = int(input())
ar = list(map(int,input().split(" ")))
br = collections.Counter(ar)
cr = set(ar)
count = 0
for r in cr:
    if br[r] < r:
        count += br[r]
    elif br[r] >= r:
        count += br[r] - r
print(count)
Buggy python submission (verdict: Runtime Error):
import collections
a,b = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
br = set(ar)
cr = collections.Counter(ar)
n = len(br) - b
dr = []
for k in cr.keys():
    cr.append(k)
cr.sort()
count = 0
for i in range(n):
    count += cr[i]

Fixed submission:
import collections
a,b = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
br = set(ar)
cr = collections.Counter(ar)
n = len(br) - b
dr = []
for v in cr.values():
    dr.append(v)
dr.sort()
count = 0
for i in range(n):
    count += dr[i]
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
br = set(ar)
n = len(br) - b
cr = []
for r in br:
    cr.append(ar.count(r))
count = 0
cr.sort()
for i in range(n):
    count += cr[i]
print(count)

Fixed submission:
import collections
a,b = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
br = set(ar)
cr = collections.Counter(ar)
n = len(br) - b
dr = []
for v in cr.values():
    dr.append(v)
dr.sort()
count = 0
for i in range(n):
    count += dr[i]
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
br = set(ar)
cr = []
for r in br:
    cr.append(ar.count(r))
cr = sorted(cr,reverse=True)
dr = cr[0:b]
print(sum(cr)-sum(dr))

Fixed submission:
import collections
a,b = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
br = set(ar)
cr = collections.Counter(ar)
n = len(br) - b
dr = []
for v in cr.values():
    dr.append(v)
dr.sort()
count = 0
for i in range(n):
    count += dr[i]
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
br = set(ar)
cr = []
for r in br:
    cr.append(ar.count(r))
cr.sort()
count = 0
for i in range(len(br)-b):
    count += cr[i]
print(count)

Fixed submission:
import collections
a,b = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
br = set(ar)
cr = collections.Counter(ar)
n = len(br) - b
dr = []
for v in cr.values():
    dr.append(v)
dr.sort()
count = 0
for i in range(n):
    count += dr[i]
print(count)
Buggy python submission (verdict: Runtime Error):
a = input()
if len(set(list(a[0:3]))) == 1 or len(set(list(a[1:4]))) = 1:
  print("Yes")
else:
  print("No")

Fixed submission:
a = input()
if len(set(a[0:3])) == 1 or len(set(a[1:4])) == 1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
ar = ["A","B","C","D","E","F"]
a = input().split(" ")
if ar.index(a[0]) > ar.index([1]):
  print(">")
elif ar.index(a[0]) == ar.index(a[1]):
  print("=")
else:
  print("<")

Fixed submission:
ar = ["A","B","C","D","E","F"]
a = input().split(" ")
if ar.index(a[0]) > ar.index(a[1]):
  print(">")
elif ar.index(a[0]) == ar.index(a[1]):
  print("=")
else:
  print("<")
Buggy python submission (verdict: Runtime Error):
a = input()
ar = []
for i in range(len(a)):
  if i % 2 == 0:
    ar.append(i)
print("".join(ar))

Fixed submission:
a = input()
ar = []
for i in range(len(a)):
  if i % 2 == 0:
    ar.append(a[i])
print("".join(ar))
Buggy python submission (verdict: Runtime Error):
a,b= map(int,input().split(" "))
b = int(input())
ar = list(map(int,input().split(" ")))
br = [[0 for i in range(b)] for j in range(a)]
go = "M"
ap = 1
for i in range(a):
    if go == "M":
        for j in range(b):
            if ar[0] == 0:
                del ar[0]
                ap += 1
            br[i][j] = ap
            ar[0] -= 1
        go = "U"
    else:
        for j in range(b-1,-1,-1):
            if ar[0] == 0:
                del ar[0]
                ap += 1
            br[i][j] = ap
            ar[0] -= 1
for r in br:
    for i in range(b-1):
        print(r[i],end=" ")
    print(r[b-1])

Fixed submission:
a,b= map(int,input().split(" "))
c = int(input())
ar = list(map(int,input().split(" ")))
br = [[0 for i in range(b)] for j in range(a)]
go = "M"
ap = 1
for i in range(a):
    if go == "M":
        for j in range(b):
            if ar[0] == 0:
                del ar[0]
                ap += 1
            br[i][j] = ap
            ar[0] -= 1
        go = "U"
    else:
        for j in range(b-1,-1,-1):
            if ar[0] == 0:
                del ar[0]
                ap += 1
            br[i][j] = ap
            ar[0] -= 1
        go = "M"
for r in br:
    for i in range(b-1):
        print(r[i],end=" ")
    print(r[b-1])
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split(" "))
c = 1
d = 1
for i in range(2,a+1):
    c *= i % (10 ** 9 + 7)
for i in range(2,b+1):
    d *= i % (10 ** 9 + 7)
if abs(a - b) >= 2:
    print(0)
elif a == b:
    print(((c * d) * 2) % (10 ** 9 + 7))
else:
    print((c * d) % (10 ** 9 + 7))

Fixed submission:
a,b = map(int,input().split(" "))
c = 1
d = 1
for i in range(2,a+1):
    c = (c * i) % (10 ** 9 + 7)
for i in range(2,b+1):
    d = (d * i) % (10 ** 9 + 7)
if abs(a - b) >= 2:
    print(0)
elif a == b:
    print(((c * d) * 2) % (10 ** 9 + 7))
else:
    print((c * d) % (10 ** 9 + 7))
Buggy python submission (verdict: Runtime Error):
a = list(input())
b = list(input())
ar = []
if len(a) == len(b):
	for i in range(len(a)):
      ar.append(a[i])
      ar.append(b[i])
else:
  	for i in range(len(b)):
      ar.append(a[i])
      ar.append(a[i])
    ar.append(a[len(a)-1])
print("".join(ar))
   

Fixed submission:
a = list(input())
b = list(input())
ar = []
if len(a) == len(b):
    for i in range(len(a)):
        ar.append(a[i])
        ar.append(b[i])
else:
    for i in range(len(b)):
        ar.append(a[i])
        ar.append(b[i])
    ar.append(a[len(a)-1])
print("".join(ar))
Buggy python submission (verdict: Runtime Error):
a = int(input())
ar = []
l = 50
t = ''
for i in range(a):
    j = input()
    ar.append(j)
    if len(j) < l:
        l = len(j)
        t = j
ar.remove(t)
br = []
for i in range(l):
    count = 0
    for r in ar:
        if t[i] in r:
            count += 1
    if count == len(ar):
        br.append(t[i])
br.sort()
print("".join(br))

Fixed submission:
a = int(input())
ar = []
for i in range(a):
    l = input()
    ar.append(l)
br = set(list(ar[0]))
dr = []
for r in br:
    cr =[]
    count = 0
    for rr in ar:
        if rr.count(r) > 0:
            cr.append(rr.count(r))
            count += 1
        if count == a:
            for i in range(min(cr)):
                dr.append(r)
print("".join(sorted(dr)))
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input()))
if a[0] == 1 and a[1] == 1:
  print("Draw")
elif a[0] == 1:
  print("Alice")
elif a[1] == 1:
  print("Bob")
else:
  if a[0] > a[1]:
    print("Alice")
  elif a[0] == a[1]:
    print("Draw")
  else:
    print("Bob")

  
  
         

Fixed submission:
a = list(map(int,input().split(" ")))
if a[0] == 1 and a[1] == 1:
  print("Draw")
elif a[0] == 1:
  print("Alice")
elif a[1] == 1:
  print("Bob")
else:
  if a[0] > a[1]:
    print("Alice")
  elif a[0] == a[1]:
    print("Draw")
  else:
    print("Bob")
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
ar = list(map(int,input().split(" ")))
br = set(ar)
count = 0
for r in br:
    count += ar.count(r) - 1
if count % 2 == 0:
    print(a - count)
else:
    print(a - count - 1)

Fixed submission:
a = int(input())
ar = list(map(int,input().split(" ")))
br = set(ar)
count = len(ar) - len(br)
if count % 2 == 0:
    print(a - count)
else:
    print(a - count - 1)
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
ar = []
for i in range(a):
    l = list(map(int,input().split(" ")))
    ar.insert(0,l)
count = 0
for r in ar:
    x = r[0] + count
    y = r[1]
    m = x % y
    if m != 0:
        count += y - m
print(count)

Fixed submission:
a = int(input())
ar = []
for i in range(a):
    l = list(map(int,input().split(" ")))
    ar.append(l)
ar.reverse()
count = 0
for r in ar:
    x = r[0] + count
    y = r[1]
    m = x % y
    if m != 0:
        count += y - m
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
ar = []
for i in range(a):
    l = list(map(int,input().split(" ")))
    ar.insert(0,l)
count = 0
for r in ar:
    x = r[0] + count
    y = r[1]
    while True:
        if x % y == 0:
            break
        x += 1
        count += 1
print(count)# 

Fixed submission:
a = int(input())
ar = []
for i in range(a):
    l = list(map(int,input().split(" ")))
    ar.append(l)
ar.reverse()
count = 0
for r in ar:
    x = r[0] + count
    y = r[1]
    m = x % y
    if m != 0:
        count += y - m
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
ar = []
for i in range(a):
    l = list(map(int,input().split(" ")))
    ar.insert(0,l)
count = 0
for r in ar:
    i = r[0] + count
    j = r[1]
    while True:
        if i % j == 0:
            break
        else:
            i += 1
            count += 1
print(count)
            

Fixed submission:
a = int(input())
ar = []
for i in range(a):
    l = list(map(int,input().split(" ")))
    ar.append(l)
ar.reverse()
count = 0
for r in ar:
    x = r[0] + count
    y = r[1]
    m = x % y
    if m != 0:
        count += y - m
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
count = 0
for i in range(N):
    if ar[i] > M:
        count += ar[i] - M
        ar[i] = M
for i in range(N-1):
    if ar[i] + ar[i+1] > M:
        while ar[i] + ar[i+1] > M:
            if ar[i+1] == 0:
                ar[i] -= 1
                count += 1
            else:
                ar[i+1] -= 1
                count += 1
print(count)

Fixed submission:
n,m = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
a = sum(ar)
for i in range(n-1):
    if ar[i] + ar[i+1] > m:
        b = (ar[i] + ar[i+1]) - m
        if ar[i+1] >= b:
            ar[i+1] -= b 
        else:
            ar[i] -= b - ar[i+1]
            ar[i+1] = 0
print(a - sum(ar))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
count = 0
for i in range(N-1):
    if ar[i] + ar[i+1] > M:
        while ar[i] + ar[i+1] > M:
            if ar[i+1] == 0:
                ar[i] -= 1
                count += 1
            else:
                ar[i+1] -= 1
                count += 1
print(count)

Fixed submission:
n,m = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
a = sum(ar)
for i in range(n-1):
    if ar[i] + ar[i+1] > m:
        b = (ar[i] + ar[i+1]) - m
        if ar[i+1] >= b:
            ar[i+1] -= b 
        else:
            ar[i] -= b - ar[i+1]
            ar[i+1] = 0
print(a - sum(ar))
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split(" ")))
print((a[0] + a[1]) * a[2] // 2)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
print((a + b) * c // 2)
Buggy python submission (verdict: Runtime Error):
ar = list(input())
br = set(ar)
if br.count("N") == br.count("S") and br.count("W") == br.count("E"):
  print("Yes")
else:
  print("No")

Fixed submission:
ar = list(input())
br = set(ar)
if len(br) == 4:
    print("Yes")
elif len(br) == 1 or len(br) == 3:
    print("No")
else:
    if "N" in br and "S" in br:
        print("Yes")
    elif "E" in br and "W" in br:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
ar = list(map(int,input().split(" ")))
while True:
    count = 0
    br = list(str(a))
    for r in br:
        if int(r) in ar:
            count += 1
    if count == 0:
        print(a)
        break
    else:
        a += 1

Fixed submission:
a,b = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
while True:
    count = 0
    br = list(str(a))
    for r in br:
        if int(r) in ar:
            count += 1
    if count == 0:
        print(a)
        break
    else:
        a += 1
Buggy python submission (verdict: Runtime Error):
n=int(input())
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    ct+=1
    if ct==3:
      print("Yes")
      break
  else:
    ct=0
else:
  print("No")

Fixed submission:
n=int(input())
ct=0
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    ct+=1
    if ct==3:
      print("Yes")
      break
  else:
    ct=0
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n=int(input())
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    ct+=1
    if ct==3:
      print("Yes")
      break
  else:
    ct==0
else:
  print("No")

Fixed submission:
n=int(input())
ct=0
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    ct+=1
    if ct==3:
      print("Yes")
      break
  else:
    ct=0
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
A.insert(0,0)
B=list(map(int,input().split()))
B.insert(0,0)
best=0
for a in range(len(A)):
    atime=0
    btime=0
    for i in range(a+1):
        atime=atime+A[i]
        if atime>K:
          break
    else:
        for b in range(len(B)):
            btime=btime+B[b]
            if atime+btime>K:
                book=a+b-1
                if book>best:
                    best=book
                break
        else:
            book=a+b
            if book>best:
                best=book
print(best)

Fixed submission:
a=int(input())
ans=a+a**2+a**3
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
i=1
s0=s[0]
ct=1
while i<len(s)-1:
  if s0==s[i]:
    s0=s[i:i+2]
    i+=2
  else:
    s0=s[i]
    i+=1
  ct+=1
if i>len(s):
  print(ct)
elif s0==s[i]:
  print(ct)
else:
  print(ct+1)

Fixed submission:
s=input()
i=1
s0=s[0]
ct=1
while i<len(s)-1:
  if s0==s[i]:
    s0=s[i:i+2]
    i+=2
  else:
    s0=s[i]
    i+=1
  ct+=1
if i>=len(s):
  print(ct)
elif s0==s[i]:
  print(ct)
else:
  print(ct+1)

Buggy python submission (verdict: Runtime Error):
s=input()
i=1
s0=s[0]
ct=1
while i<len(s)-1:
  print(s0)
  if s0==s[i]:
    s0=s[i:i+2]
    i+=2
  else:
    s0=s[i]
    i+=1
  ct+=1
if i>len(s):
  print(ct)
elif s0==s[i]:
  print(ct)
else:
  print(ct+1)

Fixed submission:
s=input()
i=1
s0=s[0]
ct=1
while i<len(s)-1:
  if s0==s[i]:
    s0=s[i:i+2]
    i+=2
  else:
    s0=s[i]
    i+=1
  ct+=1
if i>=len(s):
  print(ct)
elif s0==s[i]:
  print(ct)
else:
  print(ct+1)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=n//2019
b=m//2019
if n*m%2019==0 or b-a>=1:
  print(0)
else:
  best=2018
  for c in range(n%2019,m%2019):
    for d in range(c+1,m%2019+1):
      if c*d%2019<best:
        best=c*d%2019
print(best)

Fixed submission:
n,m=map(int,input().split())
a=n//2019
b=m//2019
if n*m%2019==0 or b-a>=1:
  print(0)
else:
  best=2018
  for c in range(n%2019,m%2019):
    for d in range(c+1,m%2019+1):
      if c*d%2019<best:
        best=c*d%2019
  print(best)
Buggy python submission (verdict: Runtime Error):
5
1 1 1 1 1n=int(input())
l=list(map(int,input().split()))
a=l[0]
b=0
c=[]
for i in range(1,n):
  if l[i]==a:
    b+=1
  else:
    c.append(b)
    b=0
  a=l[i]
c.append(b)
for i in range(len(c)):
  c[i]=(c[i]+1)//2
print(sum(c))

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
a=l[0]
b=0
c=[]
for i in range(1,n):
  if l[i]==a:
    b+=1
  else:
    c.append(b)
    b=0
  a=l[i]
c.append(b)
for i in range(len(c)):
  c[i]=(c[i]+1)//2
print(sum(c))
Buggy python submission (verdict: Runtime Error):
n=int(input())
print(n if n%2==0 else 2n)

Fixed submission:
n=int(input())
print(n if n%2==0 else 2*n)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
A=[]
B=[]
for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    A.append(b)
  if b==n:
    B.append(a)
for i in A:
  if i in B:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Fixed submission:
n,m=map(int,input().split())
A=[]
B=[]
for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    A.append(b)
  if b==n:
    B.append(a)
if len(set(A) & set(B))>0:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
s=input()
print("yes" if len(s)==len(set(s) else "no")

Fixed submission:
s=input()
print("yes" if len(s)==len(set(s)) else "no")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=[0 for _ in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  ans[a-1]+=1
  ans[b-1]+=1
for i in range(n):
  print(a[i])

Fixed submission:
n,m=map(int,input().split())
ans=[0 for _ in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  ans[a-1]+=1
  ans[b-1]+=1
for i in range(n):
  print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=1
for i in range(1,n+1):
  ans=ans*i
print(ans%1000000007)

Fixed submission:
n=int(input())
ans=1
for i in range(1,n+1):
  ans=ans*i
  if ans>1000000007:
    ans=ans%1000000007
print(ans)
Buggy python submission (verdict: Runtime Error):
print("ABC" if input()<1200 else "ARC")


Fixed submission:
print("ABC" if int(input())<1200 else "ARC")
Buggy python submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
print(b//x-(a-1)//x)

Fixed submission:
s=input()
print(f"A{s[8]}C")

Buggy python submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
print(b//x-(a-1)//x)

Fixed submission:
s=input()
print(f"A{s[8]}C")
Buggy python submission (verdict: Runtime Error):
s=set(int(input().split()))
print(len(s))

Fixed submission:
s=set(map(int,input().split()))
print(len(s))
Buggy python submission (verdict: Runtime Error):
mb=input()
mc=input()
mdic={"a":ma,"b":mb,"c":mc}
m="a"
ndic={"a":0,"b":-1,"c":-1}
while ndic[m]<len(mdic[m]):
  m=mdic[m][ndic[m]]
  ndic[m]+=1
print(m.upper())

Fixed submission:
ma=input()
mb=input()
mc=input()
mdic={"a":ma,"b":mb,"c":mc}
m="a"
ndic={"a":0,"b":-1,"c":-1}
while ndic[m]<len(mdic[m]):
  m=mdic[m][ndic[m]]
  ndic[m]+=1
print(m.upper())

Buggy python submission (verdict: Runtime Error):
ma=input()
mb=input()
mc=input()
mdic={"a":ma,"b":mb,"c":mc}
m="a"
i=0
ndic={"a":0,"b":0,"c":0}
while ndic[m]=<len(mdic[m]):
  m=mdic[m][ndic[m]]
  ndic[m]+=1
print(m.upper())

Fixed submission:
ma=input()
mb=input()
mc=input()
mdic={"a":ma,"b":mb,"c":mc}
m="a"
ndic={"a":0,"b":-1,"c":-1}
while ndic[m]<len(mdic[m]):
  m=mdic[m][ndic[m]]
  ndic[m]+=1
print(m.upper())
Buggy python submission (verdict: Runtime Error):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n=<k:
  ans=n*x
else:
  ans=k*x+y*(n-k)
print(ans)

Fixed submission:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
  ans=n*x
else:
  ans=k*x+y*(n-k)
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
d={}
for i in s:
  d.get(i,0)+=1
for i in set(s):
  if d[i]%2==1:
    print("No")
    break
else:
  print("Yes")


Fixed submission:
s=input()
d={}
for i in s:
  d[i]=d.get(i,0)+1
for i in set(s):
  if d[i]%2==1:
    print("No")
    break
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
s=input()
d={}
for i in s:
  d.get(i,0)+=1
for i in set(s):
  if i%2==1:
    print("No")
    break
else:
  print("Yes")

Fixed submission:
s=input()
d={}
for i in s:
  d[i]=d.get(i,0)+1
for i in set(s):
  if d[i]%2==1:
    print("No")
    break
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n=int(input())
res=[]
for i in range(n):
    s,p=max(str,input().split())
    res.append([s,int(p)])
res1=res
res=sorted(res,key=lambda x:(x[0], -x[1]))
for i in range(n):
	print(res1.index(res[i])+1)

Fixed submission:
n=int(input())
res = []
for i in range(n):
    s,p=map(str, input().split())
    res += [(s,int(p))]
res1=res
res = sorted(res, key=lambda x:(x[0],-x[1]))
for i in range(n):
    print(res1.index(res[i])+1)

Buggy python submission (verdict: Runtime Error):
n=int(input())
res=[]
for i in range(n):
	s,p=max(str,input().split())
    res.append([s,int(p)])
res1=res
res=sorted(res,key=lambda x:(x[0], -x[1]))
for i in range(n):
	print(res1.index(res[i])+1)

Fixed submission:
n=int(input())
res = []
for i in range(n):
    s,p=map(str, input().split())
    res += [(s,int(p))]
res1=res
res = sorted(res, key=lambda x:(x[0],-x[1]))
for i in range(n):
    print(res1.index(res[i])+1)

Buggy python submission (verdict: Runtime Error):
n=int(input())
res=[]
for i in range(n):
	s,p=max(str,input().split())
    res.append([s,int(p)])
res1=res
res=sorted(res,key=lambda x:x[0], -x[1])
for i in range(n):
	print(res1.index(res[i])+1)

Fixed submission:
n=int(input())
res = []
for i in range(n):
    s,p=map(str, input().split())
    res += [(s,int(p))]
res1=res
res = sorted(res, key=lambda x:(x[0],-x[1]))
for i in range(n):
    print(res1.index(res[i])+1)
Buggy python submission (verdict: Runtime Error):
import os
import io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline


n, q = list(map(int, input().split()))
count = (n - 2) ** 2
c = [n] * n
r = [n] * n
mc = n
mr = n
for _ in range(q):
  m,q = list(map(int, input().split()))
  if m == 1:
    pos = r[q-1]
    if q < mc:
        mc = q
        for p in range(pos):
            c[p] = q
    if q not in [1,n]:
      count -= max(0, pos - 2)
  else:
    pos = c[q-1]
    if q < mr:
        mr = q
        for p in range(pos):
            r[p] = q
    if q not in [1,n]:
      count -= max(0, pos-2)
print(count)



Fixed submission:
word = input()

if word[-1] == 's':
  print(word+'es')
else:
  print(word+'s')
Buggy python submission (verdict: Runtime Error):
rolls = int(input())
dices = []
for _ in range(rolls):
  dices.append(list(map(int, input().split())))

doubles = [d1 == d2 for d1,d2 in dices]

for i in range(1,rolls):
  doubles[i] *= (doubles[i] + doubles[i-1])
  if double[i] == 3:
    print('Yes')
    exit()

print('No')




Fixed submission:
rolls = int(input())
dices = []
for _ in range(rolls):
  dices.append(list(map(int, input().split())))
 
doubles = [d1 == d2 for d1,d2 in dices]
 
for i in range(1,rolls):
  doubles[i] *= (doubles[i] + doubles[i-1])
  if doubles[i] == 3:
    print('Yes')
    exit()
 
print('No')