Problem: You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score.  You want to introduce the restaurants in the following order:    * The restaurants are arranged in lexicographical order of the names of their cities.   * If there are multiple restaurants in the same city, they are arranged in descending order of score.  Print the identification numbers of the restaurants in the order they are introduced in the book.

Submission attempts (in order):
from operator import itemgetter

n = int(input())
e = [[i for i in input().split()] for j in range(n)]
for i in range(n):
    e(i).append(i)
restaurant = sorted(e,key=itemgetter(1),reverse=True)
restaurant.sort(key=itemgetter(0))

for i in range(n):
    print(restaurant[i][2]+1)
    

n = input()
a = []
for i in range(n):
    city,score = input().split()
    score=int(score)
    a.append((city,score,i+1))
a.sort(key=lambda k: (k[0],-k[1]))

for i in range(n):
    print(a[i][2])

n = input()
a= []
for i in range(n):
	city, score = input().split()
	score = int(score)
	a.append((city, score, i+1))
a.sort(key=lambda k : (k[0], -k[1]))
for i in range(n):
	print(a[i][2])

from operator import itemgetter
restaurant = [[]]
inp = input().split("n/")[1:]
for i in range(input().split("n/")[0]):
      restaurant[i] = inp[i].split()
      restaurant[i].insert(0,i)
print(restaurant)

restaurant.sort(key=itemgetter(1,2))


from operator import itemgetter

n = int(input())
e = [[j for j in input().split()] for i in range(n)] 
f = [[i,e[i]] for i in range(n)]

restaurant = sorted(f,key=itemgetter(1))
restaurant.sort(key=itemgetter(0),reverse=True)
for i in range(n):
    print(restaurant[i][0]+1)

from operator import itemgetter

n = int(input())
e = [[j for j in input().split()] for i in range(n)] 
f = [[i,e[i]] for i in range(n)]

restaurant = sorted(e,key=itemgetter(0,1))
print(restaurant)

n = int(input())
a = []
for i in range(n):
    city,score = input().split()
    score=int(score)
    a.append((city,score,i+1))
a.sort(key=lambda k: (k[1],-k[0]))

for i in range(n):
    print(a[i][2])

from operator import itemgetter

n = int(input())
e = [[j for j in input().split()] for i in range(n)] 
f = [[i,e[i]] for i in range(n)]

restaurant = sorted(f,key=itemgetter(0),reverse=True)
restaurant.sort(key=itemgetter(1))

for i in range(n):
    print(restaurant[i][0]+1)

from operator import itemgetter

n = int(input())
e = [[j for j in input().split()] for i in range(n)] 
f = [[i,e[i]] for i in range(n)]

restaurant = sorted(f,key=itemgetter(0),reverse=True)
restaurant.sort(key=itemgetter(1))

for i in range(n):
    print(restaurant[i][0]+1)

from operator import itemgetter

n = int(input())
e = [[j for j in input().split()] for i in range(n)] 
f = [[i,e[i]] for i in range(n)]

restaurant.sort(key=itemgetter(0),reverse=True)
restaurant = sorted(f,key=itemgetter(1))

for i in range(n):
    print(restaurant[i][0]+1)

n = input()
a = []
for i in range(n):
    city,core = input().split()
    a.append((city,score,i+1))
a.sort(key=lambda k: (k[1],-k[0]))

for i in range(n):
    print(a[i][2])

n = input()
n = int(n)
a= []
for i in range(n):
	city, score = input().split()
	score = int(score)
	a.append((city, score, i+1))
a.sort(key=lambda k : (k[0], -k[1]))
for i in range(n):
	print(a[i][2])

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Accepted