TnT/Multi_CodeNet4Repair huggingface dataset:
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):
# ABC128-B

import itemgetter
a = int(input())
book = []
for i in range(a):
    array = input().split()
    book.append((array[0], int(array[1]) * -1, i))

ans = sorted(book, key=itemgetter(0, 1))

for i in range(a):
    print(ans[i][2] + 1)


# ABC128-B

from operator import itemgetter
a = int(input())
book = []
for i in range(a):
    array = input().split()
    book.append((array[0], int(array[1]) * -1, i))

ans = sorted(book, key=itemgetter(0, 1))

for i in range(a):
    print(ans[i][2] + 1)


Verdicts: Runtime Error

Accepted
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):
N = input()
N = int(N)
s = [[ i for i in input().split()] for i in range(N)]
for i in range(N):
    s[i][1] = int(s[i][1])
sorteds = sorted(s, key=lambda x:x[0])
sorteds.sort(key=lambda x:x[1],reverse = True)

for j in s:
    onon = 0
    for k in sorteds:
        onon += 1
        if j[1] == k[1]:
            print(onon)

N = input()
N = int(N)
s = [[ i for i in input().split()] for i in range(N)]
for i in range(N):
    s[i][1] = int(s[i][1])
    s[i].append(i + 1)
sorteds = sorted(s, key=lambda x:x[1],reverse = True)
sorteds.sort(key=lambda x:x[0])


for k in sorteds:
  print(k[2])

Verdicts: Wrong Answer

Accepted
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):
N=int(input())

SP = [list(input().split()) for _ in range(N)]

sp=[]
count=1
for s,p in SP:
    sp.append([s,int(p),count])
    count+=1
    
#sp.sort(key=lambda x:x[1],reverse=True)
sp.sort(key=lambda x:(x[0],-x[1]))

for i in len(sp):
    print(sp[i][2])

N=int(input())

SP = [list(input().split()) for _ in range(N)]

sp=[]
count=1
for s,p in SP:
    sp.append([s,int(p),count])
    count+=1
    
#sp.sort(key=lambda x:x[1],reverse=True)
sp.sort(key=lambda x:(x[0],-x[1]))

for i,j,k in sp:
    print(k)

Verdicts: Runtime Error

Accepted
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):
N = int(input())
A = []
for x in range(N):
  s, p = input().split()
  A.sppend([s, -int(p), x+1])
  
A.sort()

for i in range(N):
  print(A[i][2])
  


N = int(input())
A = []
for x in range(N):
  s, p = input().split()
  A.append([s, -int(p), x+1])
  
A.sort()

for i in range(N):
  print(A[i][2])
  


Verdicts: Runtime Error

Accepted
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):
N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
print(sorted(rest))
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
print(sorted(rest))
cities.sort()
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
print(sorted(rest))
cities.sort()
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
print(sorted(rest))
cities.sort()
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
print(sorted(rest))
for k in cities:
    rest[k].sort(reverse = True)
    for i in range(len(rest[k])):
        print(rest[k][i][1])

N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
cities.sort()
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
n = int(input())
l = []
for i in range(n):
    d = {}
    d["index"] = i+1
    d["city"], d["score"] = input().split()
    l.append(d)
results = []
for city in citys:
    sorted_scores = sorted([l[i]["score"] for i in range(n) if l[i]["city"] == city], reverse=True)
    for score in sorted_scores:
        candidate = [l[i]["index"] for i in range(n) if (l[i]["city"] == city)&(l[i]["score"] == score)][0]
        results.append(candidate)
print(*results, sep="\n")

n = int(input())
l = []
for i in range(n):
    d = {}
    d["index"] = i+1
    d["city"], d["score"] = input().split()
    d["score"] = int(d["score"])
    l.append(d)
results = []
citys = list(set([l[i]["city"] for i in range(n)]))
citys.sort()
for city in citys:
    sorted_scores = sorted([l[i]["score"] for i in range(n) if l[i]["city"] == city], reverse=True)
    for score in sorted_scores:
        candidate = [l[i]["index"] for i in range(n) if (l[i]["city"] == city)&(l[i]["score"] == score)][0]
        results.append(candidate)
print(*results, sep="\n")

Verdicts: Runtime Error

Accepted
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):
n = int(input())
guide = [[i+1, list(int(x) if x.isdigit() else x for x in input().split())] for i in range(n)]
print(guide) ##
guide = sorted(guide, key = lambda x:(x[1][0],-x[1][1]))

for i in range(n):
    print(guide[i][0])

n = int(input())
guide = [[i+1, list(int(x) if x.isdigit() else x for x in input().split())] for i in range(n)]
guide = sorted(guide, key = lambda x:(x[1][0],-x[1][1]))

for i in range(n):
    print(guide[i][0])

Verdicts: Wrong Answer

Accepted
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):

N = int(input().strip())


l = []
for i in range(N):
    array = list(input().split())
    array.append(i+1)
    l.append(array)
print(l)    

l.sort(key=lambda x: x[1])
l.sort(key=lambda x: x[0])

for i in range(N):
    print(l[i][2])




N = int(input().strip())


l = []
for i in range(N):
    array = list(input().split())
    array[1]=int(array[1])
    array.append(i+1)
    l.append(array)

l.sort(key=lambda x: x[1], reverse=True)
l.sort(key=lambda x: x[0])

for i in range(N):
    print(l[i][2])



Verdicts: Wrong Answer

Accepted
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):
N = int(input())
shops = []
for i in range(N):
    S, P = input().split()
    shops.append([S, int(P), i])
shops.sort(key=1)
shops.sort()
for shop in shops:
    print(shop[2])

N = int(input())
shops = []
for i in range(N):
    S, P = input().split()
    shops.append([S, int(P), i+1])
shops.sort(key=lambda x: x[1], reverse=True)
shops.sort(key=lambda x: x[0])
for shop in shops:
    print(shop[2])

Verdicts: Runtime Error

Accepted
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):
sp = []
for i in range(n):
    s, p = input().split()
    sp.append((s, int(p), i+1))

sp_sort = sorted(sp, key=lambda x: (x[0], -1 * x[1]))

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


n = int(input())

sp = []
for i in range(n):
    s, p = input().split()
    sp.append((s, int(p), i+1))

sp_sort = sorted(sp, key=lambda x: (x[0], -1 * x[1]))

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


Verdicts: Runtime Error

Accepted
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):
n = int(input())
data =[]
for i in range(n):
  sity, score = input().split()
  data.append([sity, int(score),i+1])
  
data.sort(key=lambda x:x[0], -x[1])
for j in range(n):
  print(data[j][2])
  

  

n = int(input())
data =[]
for i in range(n):
  sity, score = input().split()
  data.append([sity, int(score),i+1])
  
data.sort(key=lambda x:x[0])
data.sort(key=lambda x:x[1], reverse=True)
for j in range(n):
  print(data[j][2])
  

  

n = int(input())
data =[]
for i in range(n):
  sity, score = input().split()
  data.append([sity, int(score),i+1])
  
data.sort(key=lambda x:(x[0], -x[1]))
for j in range(n):
  print(data[j][2])
  

  

Verdicts: Runtime Error

Wrong Answer

Accepted
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):
n = int(input())
review = []
for i in range(n):
    s, p = input().split()
    review.append([s, int(p), i + 1])
rev_sorted = sorted(review, key = lambda x: (x[0], x[1]), reverse = (False, True))
for i in rev_sorted:
    print(i[2])

n = int(input())
review = []
for i in range(n):
    s, p = input().split()
    review.append([s, int(p), i + 1])
rev_sorted1 = sorted(review, key = lambda x: x[0] , reverse = False)
rev_sorted2 = sorted(rev_sorted1, key = lambda x: x[1], reverse = True)
for i in rev_sorted2:
    print(i[2])
    

n = int(input())
r = []
for i in range(n):
    s, p = input().split()
    r.append((i + 1, s, int(p)))
r.sort(key=lambda x: (x[1], -x[2]))
for ri in r:
    print(ri[0])

Verdicts: Runtime Error

Wrong Answer

Accepted
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 functools import cmp_to_key
def cmp(x, y):
  if x[0] < y[0]:
    return -1
  elif x[0] > y[0]:
    return 1
  else:
    return int(y[1]) - int(x[1])
n = int(input())
d = [input().split() for _ in range(n)]
for i in range(n):
  d[i].append(i + 1)
d.sort(key = cmp_to_key(cmp))
for i in range(n):
print(d[i][2])


from functools import cmp_to_key
def cmp(x, y):
  if x[0] < y[0]:
    return -1
  elif x[0] > y[0]:
    return 1
  else:
    return int(y[1]) - int(x[1])
n = int(input())
d = [input().split() for _ in range(n)]
for i in range(n):
  d[i].append(i + 1)
d.sort(key = cmp_to_key(cmp))
for i in range(n):
  print(d[i][2])


Verdicts: Runtime Error

Accepted
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):
n = int(input())
l = [list(input().split()) for i in range(n)]
s,p = [list(i) for i in zip(*l)]
p = [int(i) for i in p]
z = list(set(s))
z.sort()
m = list(p)
m.sort(reverse = True)
l = []

k = 0
for i in range(len(z)):
    l.append(k)
    k += 200

o = []
for i in range(n):
    w = l[z.index(s[i])]
    w += m.index(p[i])
    o.append(w)

r = list(o)
r.sort()
for i in range(n):
    print(r.index(o[i]) + 1) 

n = int(input())
l = []
for i in range(1,n+1):
    s,p = input().split()
    t = [s,int(p),i]
    l.append(t)
l.sort()
def check(m,i):
    z = list(l[m:i])
    z.sort(key = lambda x: x[1] , reverse = True)
    for j in range(i-m):
        print(z[j][2])
m = 0
for i in range(1,n):
    if l[m][0] != l[i][0]:
        check(m,i)
        m = i
check(m,n)

Verdicts: Wrong Answer

Accepted
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):
N=int(input())
restaurants={}
for i in range(N):
  S,P=input().split()
  restaurants[S]=[int(P),i+1]
restaurants=sorted(restaurants.items(),key=lambda x:x[1][0])
restaurants=sorted(restaurants.items(),key=lambda x:x[0])
for i in restaurants.values():
  print(i[1])

N=int(input())
restaurants=[]
for i in range(N):
  S,P=input().split()
  restaurants.append([S,int(P),i+1])
restaurants=sorted(restaurants,key=lambda x:-x[1])
restaurants=sorted(restaurants,key=lambda x:x[0])
for i in restaurants:
	print(i[2])

Verdicts: Runtime Error

Accepted
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())
sp = [list(map(str, input().split())) for i in range(n)]

for i in range(n):
    sp[i].append(i + 1)
    sp[i][1] = int(sp[i][1])

sp.sort()

t = []

t.append(sp[0])

for i in range(n - 1):
    i += 1
    if sp[i][0] == sp[i-1][0]:
        t.append(sp[i])
        print(t)
    else:
        t.sort(key=lambda t: t[1], reverse=True)
        for j in t:
            print(j[2])
        t = []
        t.append(sp[i])

t.sort(key=lambda t: t[1], reverse=True)
for j in t:
    print(j[2])


from operator import itemgetter

n = int(input())
sp = [list(map(str, input().split())) for i in range(n)]

for i in range(n):
    sp[i].append(i + 1)
    sp[i][1] = int(sp[i][1])

sp.sort()

t = []

t.append(sp[0])

for i in range(n - 1):
    i += 1
    if sp[i][0] == sp[i - 1][0]:
        t.append(sp[i])
    else:
        t.sort(key=lambda t: t[1], reverse=True)
        for j in t:
            print(j[2])
        t = []
        t.append(sp[i])

t.sort(key=lambda t: t[1], reverse=True)
for j in t:
    print(j[2])


Verdicts: Wrong Answer

Accepted
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):
P = int(input())
res= []
for i in range(P):
  a, b = input().split(' ')
  res.append((a,b,i+1))
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for j in range(P):
  print(res3[2])

P = int(input())
res= []
for i in range(P):
    a, b = input().split()
    res.append((a,b))
    print(res)
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for i in range(P):
    print(res.index(res3[i])+1)

P = int(input())
res= []
for i in range(P):
    a, b = input().split()
    res.append((a,b))
    print(res)
res2 = sorted(res, key = lambda x:(x[0],x[1]))
for i in range(P):
    print(int(index(res2[i])+1)

P = int(input())
res= []
for i in range(P):
    a, b = input().split()
    res.append((a,b))
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for i in range(P):
    print(res3.index(res[i])+1)

P = int(input())
res= []
for i in range(P):
    a, b = input().split()
    res.append((a,b))
    print(res)
res2 = sorted(res, key = lambda x:(x[0],x[1]))
for i in range(P):
    print(res.index(res2[i]))
  

P = int(input())
res= []
for i in range(P):
  a, b = input().split()
  res.append((a,int(b)))
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for j in range(P):
  print(str(res.index(res3[j])+1))

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
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):
n=int(input())
rest=[0]*n
for i in range(n):
  a,b=map(str,input().split())
  b=int(b)
  rest[i]=[i,a,b]
rest.sort(key=lambda x:x[1])
rest.sort(key=lambda x:x[2])

for i in range(n):
  print(rest[i][0])

n=int(input())
rest=[0]*n
for i in range(n):
  a,b=map(str,input().split())
  b=int(b)
  rest[i]=[i+1,a,b]


rest.sort(key=lambda x:x[2],reverse=True)
rest.sort(key=lambda x:x[1])



for i in range(n):
  print(rest[i][0])

Verdicts: Wrong Answer

Accepted
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):
10
9
8
7
6
5
4
3
2
1

n = int(input())
spi = {}
for i in range(n):
    t = input().split()
    if t[0] in spi:
        spi[t[0]] += [(int(t[1]), i+1)]
    else:
        spi[t[0]] = [(int(t[1]), i+1)]

for e in spi:
    spi[e] = sorted(spi[e], key=lambda x: x[0], reverse=True)

spi = sorted(zip(*[spi.keys(), spi.values()]), key=lambda x: x[0])

for e in spi:
    for r in e[1]:
        print(r[1])


Verdicts: Wrong Answer

Accepted
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):
#abc128_b.py

n = int(input())
rs = []
for i in range(n):
    s, p = input().split()
    p = int(p)
    rs.append((s, -p, i+1))
print(rs)
rs = sorted(rs)
print(rs)
for r in rs:
    print(r[2])


n = int(input())
rs = []
for i in range(n):
    s, p = input().split()
    p = int(p)
    rs.append((s, -p, i+1))
rs = sorted(rs)
for r in rs:
    print(r[2])

Verdicts: Wrong Answer

Accepted
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):
n=int(input())

list2=[]

for i in range(n):
    list=[j for j in input().split()]
    list[1]=int(list[1])
    list2.append(list)

#print(list2)

list3=sorted(list2, key=lambda x:(x[0],-x[1]))

#print(list3)

for i in list2:
    print(list3.index(i)+1)


n=int(input())

list2=[]

for i in range(n):
    list=[j for j in input().split()]
    list[1]=int(list[1])
    list2.append(list)

#print(list2)

list3=sorted(list2, key=lambda x:(x[0],-x[1]))

#print(list3)

for i in list3:
    print(list2.index(i)+1)


Verdicts: Wrong Answer

Accepted
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):
n = int(input())

lst = []

for i in range(n):
    s, p = input().split()
    lst.append([s, 100 - int(p), i + 1])
    
# print(lst)



lst.sort()


print(lst)
for i in lst:
    print(i[2])

n = int(input())

lst = []

for i in range(n):
    s, p = input().split()
    lst.append([s, 100 - int(p), i + 1])
    
# print(lst)



lst.sort()


# print(lst)
for i in lst:
    print(i[2])

Verdicts: Wrong Answer

Accepted
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):
n = int(input())
sp = [input().split() for _ in range(n)]

for i in range(n):
    sp[i][1] = int(sp[i][1])
    sp[i] = sp[i]+[i+1]
    
sp_s0 = sorted(sp, key=lambda x:(x[0], -x[1]), reverse=False)
print(sp_s0)

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

n = int(input())
sp = [input().split() for _ in range(n)]

for i in range(n):
    sp[i][1] = int(sp[i][1])
    sp[i] = sp[i]+[i+1]
    
sp_s0 = sorted(sp, key=lambda x:(x[0], -x[1]), reverse=False)

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

Verdicts: Wrong Answer

Accepted
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):

#input
N = int(input())
X = [[input().split(), i + 1] for i in range(N)]
X = sorted(X, key = lambda x:(x[0][0], int(-x[0][1])) )

for i in range(N):
    print(X[i][0])

N = int(input())
X = [[input().split(), i + 1] for i in range(N)]
X = sorted(X, key = lambda x:(x[0][0], -int(x[0][1])))
for i in range(N):
	print(X[i][1])

Verdicts: Runtime Error

Accepted
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):
n = int(input())

s = []
for i in range(n):
	s.append(list(input().split()))

for i in range(n):
	s[i][1] = int(s[i][1])

ans = sorted(s,key=lambda x : (x[0],x[1]))
print(ans)

n = int(input())

s = []
for i in range(n):
	s.append(list(input().split()))

for i in range(n):
	s[i][1] = int(s[i][1])

ans = sorted(s,key=lambda x : (x[0],x[1]))

for a in ans:
  print(a)

n = int(input())

s = []
for i in range(n):
	S,P=input().split()
	s.append((S,int(P),i+1))

ans = sorted(s,key=lambda x : (x[0],x[1]))

for a in ans:
  print(a[2])

n = int(input())

s = []
for i in range(n):
	s.append(list(input().split()))
print(s)
    

n = int(input())

s = []
for i in range(n):
	s.append(list(input().split()) + i+1)

for i in range(n):
	s[i][1] = int(s[i][1])

ans = sorted(s,key=lambda x : (x[0],x[1]))

for a in ans:
  print(a[2])

n = int(input())

s = []
for i in range(n):
	S,P=input().split()
	s.append([S,-int(P),i+1])

ans = sorted(s,key=lambda x : (x[0],x[1]))

print(ans)

for a in ans:
  print(a[2])

n = int(input())

s = []
for i in range(n):
	S,P=input().split()
    s.append(S,int(P),i+1)

ans = sorted(s,key=lambda x : (x[0],x[1]))

for a in ans:
  print(a[2])

n = int(input())

s = []
for i in range(n):
	s.append(list(input().split()))

for i in range(n):
	s[i][1] = int(s[i][1])

n = int(input())

s = []
for i in range(n):
	S,P=input().split()
	s.append([S,-int(P),i+1])

ans = sorted(s,key=lambda x : (x[0],x[1]))

for a in ans:
  print(a[2])

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Accepted
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):
# -*- coding: utf-8 -*-
import copy

N = int(input())
list = [input().split() for i in range(N)]
list2 = copy.deepcopy(list)
list2.sort(key=lambda x:(x[0],-int(x[1])))
print(list2)

for i in range(N):
    a = list2[i]
    b = list.index(a)
    print(int(b + 1))

# -*- coding: utf-8 -*-
import copy

N = int(input())
list = [input().split() for i in range(N)]
list2 = copy.deepcopy(list)
list2.sort(key=lambda x:(x[0],-int(x[1])))
print(list2)

for i in range(N):
    a = list2[i]
    b = list.index(a)
    print(b + 1)

# -*- coding: utf-8 -*-
import copy

N = int(input())
list = [input().split() for i in range(N)]
list2 = copy.deepcopy(list)
list2.sort(key=lambda x:(x[0],-int(x[1])))
print(list2)

for i in range(N):
    a = list[i]
    b = list2.index(a)
    print(b + 1)

# -*- coding: utf-8 -*-
import copy

N = int(input())
list = [input().split() for i in range(N)]
list2 = copy.deepcopy(list)
list2.sort(key=lambda x:(x[0],-int(x[1])))

for i in range(N):
    a = list2[i]
    b = list.index(a)
    print(int(b + 1))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#import fractions
#S=input()
#import math
#lis=list(map(int,input().split()))

n=int(input())
sp={}
for i in range(n):
    li=input().split()
    li.append(i+1)
    if li[0] not in sp:
        sp[li[0]]=[li]
    else:
        sp[li[0]].append(li)
        sp[li[0]].sort(reverse=True)
items_sorted = sorted(sp.items())
print(items_sorted)
for i in range(n):
    for j in range(len(items_sorted[i])):
        print(items_sorted[i][j+1][2])


#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#import fractions
#S=input()
#import math
#lis=list(map(int,input().split()))

n=int(input())
sp={}
for i in range(n):
    li=input().split()
    li.append(i+1)
    li[1]=int(li[1])
    if li[0] not in sp:
        sp[li[0]]=[li]
    else:
        sp[li[0]].append(li)
        sp[li[0]].sort(reverse=True)
items_sorted = sorted(sp.items())

for i in range(len(items_sorted)):
    for j in range(len(items_sorted[i][1])):
        print(items_sorted[i][1][j][2])


Verdicts: Runtime Error

Accepted
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())
s = [input().split() for i in range(n)]
for i in range(len(s)):
    s[i].append(i+1)
    s[i][1] = int(s[i][1])
s.sort(key = itemgetter(1))
s.sort(key = itemgetter(0))

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


from operator import itemgetter
n = int(input())
s = [input().split() for i in range(n)]
for i in range(len(s)):
    s[i].append(i+1)
    s[i][1] = int(s[i][1])
s = sorted(s,key=lambda x:(x[0],-x[1]))

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

Verdicts: Wrong Answer

Accepted
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):
N = int(input())
bag = []
shi = []
for i in range(N):
    s, p = input().split()
    p = int(p)
    shi.append(s)
    
    bag.append((s, p, i))

sorted_bag = sorted(bag, key=lambda x:x[0])
sorted_shi = sorted(list(set(shi)))


dic = {}
for s, p, i in bag:
    if s not in dic.keys():
        dic[s] = [[p, i]]
    else:
        dic[s].append([p, i])

for s in sorted_shi:
    if len(dic[s]) == 1:
        print(dic[s][0][1])
    else:
        so = sorted(dic[s], key=lambda x:x[0])[-1::-1]
        for e in so:
            print(e[1])

N = int(input())
bag = []
shi = []
for i in range(N):
    s, p = input().split()
    p = int(p)
    shi.append(s)
    
    bag.append((s, p, i))

sorted_bag = sorted(bag, key=lambda x:x[0])
sorted_shi = sorted(list(set(shi)))


dic = {}
for s, p, i in bag:
    if s not in dic.keys():
        dic[s] = [[p, i+1]]
    else:
        dic[s].append([p, i+1])

for s in sorted_shi:
    if len(dic[s]) == 1:
        print(dic[s][0][1])
    else:
        so = sorted(dic[s], key=lambda x:x[0])[-1::-1]
        for e in so:
            print(e[1])

Verdicts: Wrong Answer

Accepted
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):
n = int(input())
ls = [[_ for _ in input().split()] for _ in range(n)]

lss = sorted(ls, key=lambda x: int(x[1]), reverse=True)

ans = sorted(lss, key=lambda x: x[0])
print(ans) 

for i in range(n):
	print(1 + ls.index(ans[i]))

n = int(input())
ls = [[_ for _ in input().split()] for _ in range(n)]

lss = sorted(ls, key=lambda x: int(x[1]), reverse=True)

ans = sorted(lss, key=lambda x: x[0])
print(ans) 

for i in range(n):
	print(1 + ls.index(ans[i]))

n = int(input())
ls = [[_ for _ in input().split()] for _ in range(n)]

lss = sorted(ls, key=lambda x: int(x[1]), reverse=True)

ans = sorted(lss, key=lambda x: x[0])

for i in range(n):
	print(1 + ls.index(ans[i]))

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):

N = int(input())
R_list = []
for i in range(N):
    S, P=map(str, input().split())
    R_list.append([S , int(P)*-1 , i])
R_list.sort()
for i in range(N):
    R_list[i].append(i+1)
R_list.sort(key=lambda x:x[2])
for i in range(N):
    print(R_list[i][3])

    


N = int(input())
R_list = []
for i in range(N):
    S, P=map(str, input().split())
    R_list.append([S , int(P)*-1 , i+1])
R_list.sort()
for i in range(N):
    R_list[i].append(i+1)
R_list.sort(key=lambda x:x[3])
for i in range(N):
    print(R_list[i][2])

    

Verdicts: Wrong Answer

Accepted
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):
N = int(input())
array = []
for i in range(N):
    array.append(list(map(str, input().split())))
array_new = sorted(array, key=lambda x: (x[0], -x[1]))
for i in range(N):
    print(int(array.index(array_new[i])+1))

N = int(input())
array = []
for i in range(N):
    array.append(list(map(str, input().split())))
array_new = sorted(array, key=lambda x: (x[0], x[1]))
for i in range(N):
    print(int(array.index(array_new[i])+1))




N = int(input())
array = []
for i in range(N):
    array.append(list(map(str, input().split())))
array_new = sorted(array, key=lambda x: (x[0], -int(x[1])))
for i in range(N):
    print(int(array.index(array_new[i])+1))

Verdicts: Runtime Error

Wrong Answer

Accepted
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):
n = int(input())
s =  [input().split() for i in range(n)]
temp = s
data = sorted(s,key=lambda x:(x[0],-int(x[1])))


for i in range(n):
    y = temp[i]
    result = data.index(y)
    print(result+1)


n = int(input())
s =  [input().split() for i in range(n)]
temp = s
data = sorted(s,key=lambda x:(x[0],-int(x[1])))


for i in range(n):
    y = data[i]
    result = temp.index(y)
    print(result+1)


Verdicts: Wrong Answer

Accepted
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())
A=[0]*N
for i in range(N):
    A[i]=input().split()

i=0
while i<N:
    A[i][1]=int(A[i][1])
    i+=1

i=0
while i<N:
    A[i]=tuple(A[i])
    i+=1

B1 = sorted(A, key=itemgetter(1),reverse=True)
B2 = sorted(B1,key=itemgetter(0))

print(B2)

for i in B2:
    print(A.index(i)+1)    

from operator import itemgetter

N=int(input())
A=[0]*N
for i in range(N):
    A[i]=input().split()

i=0
while i<N:
    A[i][1]=int(A[i][1])
    i+=1

i=0
while i<N:
    A[i]=tuple(A[i])
    i+=1

B1 = sorted(A, key=itemgetter(1),reverse=True)
B2 = sorted(B1,key=itemgetter(0))

for i in B2:
    print(A.index(i)+1)    

Verdicts: Wrong Answer

Accepted