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

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

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

l.sort(key=lambda x:x[1],reverse = True)
print(l)
l.sort(key=lambda x:x[0])
print(l)
for i in l:
    print(i[2])

n = int(input())
s = [0]*n
p = [0]*n
l = [[] for i in range(n)]

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

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

for i in l:
    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())
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 = sorted(S)

for i in range(N):
    print(s.index(s[i]) + 1)


N = int(input())
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 = sorted(S)

for i in range(N):
    print(S.index(s[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())
d = {}
for i in range(n):
    s, p = input().split()
    p = int(p)
    if s not in d:
        d[s] = [[p, i+1]]
    else:
        d[s] += [[p, i+1]]

for v in d.values():
    v.sort(reverse=True)
    for a in v:
        print(a[1])

n = int(input())
d = {}
for i in range(n):
    s, p = input().split()
    p = int(p)
    if s not in d:
        d[s] = [[p, i+1]]
    else:
        d[s] += [[p, i+1]]

for key in sorted(d.keys()):
    for dk in sorted(d[key], reverse=True):
        print(dk[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())
x = [list(input().split(""))for i in range(n)]

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

test2 = sorted(x,key = lambda k :(k[0],-k[1]))

for i in range(n):
    print(x.index(test2[i])+1)

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())
arr = [0]*n

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

n = int(input())

arr= [0]*n

for i in range(n):
	city, score = input().split()
	arr[i] = [city, int(score), i+1]

arr.sort(key = lambda x:(x[0],-x[1]))

for ele in arr:
	print(ele[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):
import pandas as pd
n = int(input())
shops = [0]*n
points = [0]*n
nums = [i for i in range(1,n+1)]
for i in range(n):
    shops[i],points[i] = input().split()
d = pd.DataFrame({'shops':shops,'points':points,'nums':nums})    
l = d.sort_values('shops').sort_values('points', ascending=False)['nums'].tolist()
for i in range(len(l)):
    print(l[i])

n = int(input())
l = []
for i in range(1,n+1):
    a, b = input().split()
    l += [[a,int(b),i]]
l = sorted(sorted(l, key=lambda x:x[1], reverse=True), key=lambda x:x[0])
for i in range(len(l)):
    print(l[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())
w = list(map(int, input().split()))
s = float("inf")
for i in range(1,n):
    x = abs(sum(w[0:i])-sum(w[i:n]))
    if x < s:
        s = x
print(s)

n = int(input())
s = list()
for i in range(n):
    a,b = input().split()
    b = int(b) * -1
    s.append([a,b])
h = sorted(s)
for i in range(n):
    print(s.index(h[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())
li = list()

for i in range(N):
  res,score = input().split()
  score = int(score)
  li.append([res,score,i+1])
  
li.sort()

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

N= int(input())
li = list()

for i in range(N):
  res,score = input().split()
  score = int(score)
  li.append([res,-score,i+1])
  
li.sort()

for i in li:
  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):
# ABC 128, B - guidebook
from operator import itemgetter

n = int(input())

X = []
for i in range(n):
    tmp = input().split(' ')
    X.append((tmp[0], -int(tmp[1])))

Y = sorted(X, key=itemgetter(0,1))
for x in X:
    print(Y.index(x)+1)


# ABC 128, B - guidebook
from operator import itemgetter

n = int(input())

X = []
for i in range(n):
    tmp = input().split(' ')
    X.append((i+1, tmp[0], -int(tmp[1])))
X.sort(key=itemgetter(1, 2))

for i in range(n):
    print(X[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())
S = []
P = []
for i in range(N):
    tmp_S, tmp_P = input().split()
    S.append(tmp_S)
    P.append(int(tmp_P)*(-1))

index = [i for i in range(1,N+1)]

ZIP = zip(P, index, S)

ZIP = sorted(ZIP)

P, index, S = zip(*ZIP)

for i in range(N):
    print(index[i])
    print(S[i])

ZIP = zip(S, index)

ZIP = sorted(ZIP)

S, index = zip(*ZIP)

for i in range(N):
    print(index[i])

N = int(input())
S = []
P = []
for i in range(N):
    tmp_S, tmp_P = input().split()
    S.append(tmp_S)
    P.append(int(tmp_P)*(-1))

index = [i for i in range(1,N+1)]

ZIP = zip(S, P, index)

ZIP = sorted(ZIP)

S, P, index = zip(*ZIP)

for i in range(N):
    print(index[i])

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):
    index = i + 1
    S, P = input().split()

    restaurants.append( (index, str(S), int(P)) )

restaurants = sorted(restaurants, key=lambda x:(x[1], x[2]))

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


N = int(input())
restaurants = []

for i in range(N):
    idx = i + 1
    S, P = input().split()
    tuple = ( (idx, str(S), int(P)) )

    restaurants.append(tuple)

restaurants = sorted(restaurants, key=lambda x:x[2], reverse = True)  
restaurants = sorted(restaurants, key=lambda x:x[1])

for i in range(N):
    print (restaurants[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):
input1 = int(input())

LIST = []

for i in range(input1):
    input2 = input()
    TOWN = input2.split()[0]
    SCORE = int(input2.split()[1])
    NUM = i
    LIST.append([TOWN,SCORE,NUM])

LIST.sort()

LIST_TOWN = []
for i in range(input1):
    LIST_TOWN.append(LIST[i][0])
LIST_TOWN = list(set(LIST_TOWN))



LIST_N = []

for t in range(len(LIST_TOWN)):
    
    LIST_A = []
    for i in range(input1):
        if LIST_TOWN[t] in LIST[i]:
            LIST_A.append(LIST[i])
    LIST_A.sort(reverse=True)
    LIST_N.append(LIST_A)


for a in range(len(LIST_TOWN)):
    for b in range(len(LIST_N[a])):
        print(LIST_N[a][b][2] + 1)
    

# coding cell (SUBMIT ONLY THIS CELL)

N = int(input())
scores  = []

for i in range(N):
    temp = input().split()
    scores.append([temp[0], -1 * int(temp[1]), i + 1])

scores.sort()

for i in range(N):
    print(scores[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):
from collections import defaultdict

N = int(input())
S = [0] * N
P = [0] * N

city_point = {}

for i in range(N):
    inp = input().split()
    S[i] = inp[0]
    P[i] = inp[1]
    city_point[i] = {'city': S[i], 'point': int(P[i])}
    
sorted_list = sorted(city_point.items(), key=lambda x: (x[1]['city'], x[1]['point']))

for item in sorted_list:
    print(item[0] + 1)


from collections import defaultdict

N = int(input())
S = [0] * N
P = [0] * N

city_point = {}

for i in range(N):
    inp = input().split()
    S[i] = inp[0]
    P[i] = inp[1]
    city_point[i] = {'city': S[i], 'point': int(P[i])}
    
sorted_list = sorted(city_point.items(), key=lambda x: (x[1]['city'], x[1]['point']))

for key in sorted_list:
    print(key + 1)


N = int(input())
S = [0] * N
P = [0] * N
 
city_point = {}
 
for i in range(N):
    inp = input().split()
    S[i] = inp[0]
    P[i] = inp[1]
    city_point[i] = {'city': S[i], 'point': int(P[i])}
    
sorted_list = sorted(city_point.items(), key=lambda x: (x[1]['city'], x[1]['point']), reverse=True)
 
for item in sorted_list:
    print(item[0] + 1)

from collections import defaultdict

N = int(input())
S = [0] * N
P = [0] * N

city_point = {}

for i in range(N):
    inp = input().split()
    S[i] = inp[0]
    P[i] = inp[1]
    city_point[i] = [S[i], P[i]]

score_sorted = sorted(city_point.items(), key=lambda x:x[1][0])

for l in score_sorted:
    print(l[0] + 1)

N = int(input())

cookbook = [0] * N

for n in range(N):
    line = input().split()
    s = line[0]
    p = int(line[1])
    cookbook[n] = (n + 1, s, p)

l = sorted(cookbook, key = lambda x: (x[1], -x[2]))
for item in l:
    print(item[0])

Verdicts: 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())
SP = []
for i in range(n):
  sp = input().split()
  sp.append(i+1)
  SP.append(sp)
sortedSP = sorted(SP, key = lambda x:x[0])
for i in range(n-1):
  for j in range(n-1-i):
    if sortedSP[j][0] == sortedSP[j+1][0] and int(sortedSP[j][1]) < int(sortedSP[j+1][1]):
      sortedSP[j], sortedSP[j+1] = sortedSP[j+1], sortedSP[j]
print(sortedSP)
for i in range(n):
  print(sortedSP[i][2])

n = int(input())
SP = []
for i in range(n):
  sp = input().split()
  sp.append(i+1)
  SP.append(sp)
sortedSP = sorted(SP, key = lambda x:x[0])
for i in range(n-1):
  for j in range(n-1-i):
    if sortedSP[j][0] == sortedSP[j+1][0] and int(sortedSP[j][1]) < int(sortedSP[j+1][1]):
      sortedSP[j], sortedSP[j+1] = sortedSP[j+1], sortedSP[j]
for i in range(n):
  print(sortedSP[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):
A=[]
p = int(input())
for i in range(p):
  j,k = input().split()
  A.append([j,k,i+1])
A = sorted(A)
for j,k,l in A:
  print(l)

A=[]
p = int(input())
for i in range(p):
  j,k = input().split()
  A.append([j,i+1,k])
A = sorted(A,reverse = False)
for j,k,l in A:
  print(k)

A=[]
p = int(input())
for i in range(p):
  j,k = input().split()
  A.append([j,-int(k),i+1])
A = sorted(A)
for j,k,l in A:
  print(l)

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())
x=[]
for i in range(n):
    key,val=map(str,input().split())
    x.append([key,-int(val),i+1])
dic_sort=sorted(x, key=lambda x:(x[0],x[1]))
print(dic_sort)
for i in range(n):
    print(dic_sort[i][2])

n=int(input())
x=[]
for i in range(n):
    key,val=map(str,input().split())
    x.append([key,-int(val),i+1])
dic_sort=sorted(x, key=lambda x:(x[0],x[1]))
for i in range(n):
    print(dic_sort[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())
list = [None]*N
for i in range(N):
  s, P = input().split()
  list[i]=(i,s,int(p)*-1)
for i in sorted(list, key = lambda x: (x[1],x[2])):
  print(i[0]+1)

N = int(input())
list = [None]*N
for i in range(N):
  s, P = input().split()
  list[i]=(i,s,int(p)*-1)
for i in sorted(list, key = lamda x: (x[1],x[2])):
  print(i[0]+1)

N = int(input())
list = [None]*N
for i in range(N):
  s, P = input().split()
  list[i]=(i,s,int(p)*-1)
for i in sorted(list, key = lamda x: (x[1],x[2])):
  print(i[0]+1)

N = int(input())
list = [None]*N
for i in range(N):
  s, p = input().split()
  list[i]=(i,s,int(p)*-1)
for i in sorted(list, key = lambda x: (x[1],x[2])):
  print(i[0]+1)

Verdicts: Runtime Error

Runtime Error

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())
lis = []
for i in range(n):
    s,p = input().split()
    lis.append((s,int(p),i))
from operator import itemgetter
lis = sorted(lis,key=itemgetter(0))
lis = sorted(lis,key=itemgetter(1),reverse=True)
for i in range(n):
    print(lis[i][2])

n = int(input())
lis = []
for i in range(1,n+1):
    s,p = input().split()
    lis.append((s,int(p),i))
from operator import itemgetter
lis = sorted(lis,key=itemgetter(0))
lis = sorted(lis,key=itemgetter(1),reverse=True)
for i in range(n):
    print(lis[i][2])

n = int(input())
lis = []
for i in range(1,n+1):
    s,p = input().split()
    lis.append((s,int(p),i))
from operator import itemgetter
lis = sorted(lis,key=itemgetter(1),reverse=True)
lis = sorted(lis,key=itemgetter(0))
for i in range(n):
    print(lis[i][2])

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

N = int(input())
di = {}

for i in range(N):
    tmp = input().split()
    di[i] = tmp

di_sorted = sorted(di.items(), key=lambda x: x[1][0])
di_sorted = sorted(di.items(), key=lambda x: x[1][1])

for i, j in di_sorted:
    print(i+1)

# -*- coding: utf-8 -*-

N = int(input())
di = {}

for i in range(N):
    tmp = input().split()
    di[i] = tmp

di_sorted = sorted(di.items(), reverse=True, key=lambda x: x[1][1])
di_sorted = sorted(di.items(), key=lambda x: x[1][0])

for i, j in di_sorted:
    print(i+1)


# -*- coding: utf-8 -*-

N = int(input())
di = []
tmp =[]

for i in range(N):
    si, pi = input().split()
    pi = int(pi) * (-1)
    tmp = [si, pi, i]
    di.append(tmp)


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

print(di)

for i in range(N):
    print(di[i][2]+1)






# -*- coding: utf-8 -*-

N = int(input())
di = []
tmp =[]

for i in range(N):
    si, pi = input().split()
    pi = int(pi) * (-1)
    tmp = [si, pi, i]
    di.append(tmp)
di = sorted(di, key=lambda x: (x[0], x[1]))    

for i in range(N):
    print(di[i][2]+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):
n = int(input())
# a, p = list(map(int, input().split()))
# a = list(map(int, input().split()))

S = [list(input().split()) for i in range(n)]

# for i, s in enumerate(S):
#     s.append(i+1)

S = sorted(S, key=lambda x: x[1], reverse=True)
S = sorted(S, key=lambda x: x[0], reverse=False)

for s, p, n in S:
    print(n)

n = int(input())
# a, p = list(map(int, input().split()))
# a = list(map(int, input().split()))

S = [list(input().split()) for i in range(n)]

for i, s in enumerate(S):
    s.append(i+1)

S = sorted(S, key=lambda x: int(x[1]), reverse=True)
S = sorted(S, key=lambda x: x[0], reverse=False)

for s, p, n in S:
    print(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())

lists = []
for _ in range (N):
    S = input().split(' ')
    lists.append(S)

list_sorted = lists.copy()
list_sorted.sort()
for result in range(N):
    for sorted in range (N):
        if lists[result] == list_sorted[sorted]:
            print(sorted+1)

N = int(input())

lists = []
for _ in range (N):
    S = input().split(' ')
    lists.append(S)

list_sorted = lists.copy()

list_sorted.sort()
list_sorted.sort(key=lambda x:(x[0],x[1]),reverse =True)
for result in range(N):
    for sorted in range (N):
        if lists[result] == list_sorted[sorted]:
            print(sorted+1)


N = int(input())

lists = []
for _ in range (N):
    S = input().split(' ')
    lists.append(S)

list_sorted = lists.copy()
list_sorted.sort()
list_sorted.sort(key=lambda x: x[1],reverse =True)
for result in range(N):
    for sorted in range (N):
        if lists[result] == list_sorted[sorted]:
            print(sorted+1)


N = int(input())

lists = []
for _ in range (N):
    S = input().split(' ')
    lists.append([S[0],int(S[1])])

list_sorted = lists.copy()

list_sorted.sort()
list_sorted.sort(key=lambda x:(x[0],-x[1]),reverse =False)
for sorted in range (N):
    for result in range(N):
        if lists[result] == list_sorted[sorted]:
            print(result+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):
n=int(input())
a=[]

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


N=int(input())
a=[]
for i in range(N):
    s,p=input().split()
    p=int(p)
    
    a.append((s,-p,i+1))
a.sort()
for i in range(N):
    print(a[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())
a=[list(input().split())+[i] for i in range(n)]
for i in range(n):
  a[i][1]=-int(a[i][1])
a.sort()
ans=[0]*n
for i in range(n):
  ans[a[i][2]]=i+1
print(*ans,sep='¥n')

n=int(input())
a=[list(input().split())+[i] for i in range(n)]
for i in range(n):
  a[i][1]=-int(a[i][1])
a.sort()
ans=[0]*n
for i in range(n):
  ans[a[i][2]]=i+1
print(*ans,sep='\n')

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

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())

SP = []
for i in range(N):
    str = input().split()
    SP.append([str[0] ,int(str[1])*-1,i])

SP.sort()

print(SP)
for i in range(N):
    print(SP[i][2]+1)

N = int(input())

SP = []
for i in range(N):
    str = input().split()
    SP.append([str[0] ,int(str[1])*-1,i])

SP.sort()

for i in range(N):
    print(SP[i][2]+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())
X=[]
S=[]
P=[]

for n in range(N):
    X.append([n+1])

for n in range(N):
    s, p = map(str, input().split())
    S.append(s)
    P.append(p)

for n, s in enumerate(S):
    X[n].append(s)

for n, p in enumerate(P):
    X[n].append(p)

Y =sorted(X, key=lambda x:x[1])
sorted(Y, key=lambda x:x[2], reverse=True)

for n in range(N):
    print(Y[n][0])


from operator import itemgetter

N = int(input())
X=[]
S=[]
P=[]

for n in range(N):
    X.append([n+1])

for n in range(N):
    s, p = map(str, input().split())
    S.append(s)
    P.append(int(p))

for n, m in enumerate(S):
    X[n].append(m)

for n, m in enumerate(P):
    X[n].append(m)

X.sort(key=lambda x:(x[1], -x[2]))

for n in range(N):
    print(X[n][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())
rows=sorted([input().split() for i in range(n)])
rows.sort(key=lambda x: x[1], reverse=True)
print(rows)

n=int(input())
rows=sorted([input().split() for i in range(n)])
rows.sort(key=lambda x: x[1], reverse=True)
print(rows)

n=int(input())
rows=[input() for i in range(n)] 
print(sorted(rows))

n=int(input())
rows=[input().split() for i in range(n)]
new_rows=sorted(rows)
new_rows.sort(key=lambda x: x[1], reverse=True)
for i in range(n):
    print(rows.index(new_rows[i])+1)

n=int(input())
rows=[input().split() for i in range(n)]
new_rows=sorted(rows)
new_rows.sort(key=lambda x: (x[0],-int(x[1])))
for i in range(n):
    print(rows.index(new_rows[i])+1)

Verdicts: 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())
A = []
for i in range(N) :
    S, P = input().split()
    A.append([S])
    A[i].append(100-int(P))
new_A_list = sorted(A)
for i in range(N) :
    print(new_A_list.index(A[i])+1)

N = int(input())
A = []
for i in range(N) :
    S, P = input().split()
    A.append([S])
    A[i].append(100-int(P))
new_A_list = sorted(A)
for i in range(N) :
    print(A.index(new_A_list[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())
l1=[]
l2=[]
for i in range(n):
    sp=input().rstrip().split()
    l1.append(sp[0])
    l2.append(-int(sp[1]))
l=list(zip(l1,l2))

ans=sorted(l)
print(ans)
for i in range(len(ans)):
    print(l.index(ans[i])+1)





n=int(input())
l=[]
for i in range(n):
  s,p=[x for x in input().rstrip().split()]
  l.append([s,int(p),i+1])
l.sort(key=lambda x:x[1],reverse=True)
l.sort(key=lambda x:x[0])

for s,p,i in l:
  print(i) 

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())
A = [input().split() for _ in range(N)]
a = []
for i in range(N):
  a.append([A[i][0], 100 - int(A[i][1])])
A = sorted(a)
print(a)
print(A)

for i in range(N):
  print(a.index(A[i])+1)

n = int(input())
spi = []
for i in range(n):
    s,p = input().split()
    p = 100-int(p)
    spi.append([s,p,i+1])
spi.sort()
for x in spi:print(x[-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):
def main():
    n = int(input())
    ll = list()
    for i in range(n):
        tmp = list(map(str, input().split()))
        tmp[1] = int(tmp[1])
        tmp.append(i+1)
        ll.append(tmp)
    print(ll)
    
    ll_s = sorted(ll, key=lambda x:(x[0],-x[1]))
    print(ll_s)
    for i in ll_s:
        print(i[2][0])
        
if __name__ == '__main__':
    main()

def main():
    n = int(input())
    ll = list()
    for i in range(n):
        tmp = list(map(str, input().split()))
        tmp[1] = int(tmp[1])
        tmp.append(i+1)
        ll.append(tmp)
    ll_s = sorted(ll, key=lambda x:(x[0],-x[1]))
    for i in ll_s:
        print(i[2])

if __name__ == '__main__':
    main()

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 collections import defaultdict

N = int(input())
di = defaultdict(list)

for n in range(1, N + 1):
    S, P = input().split()
    P = int(P)
    di[S].append({n: P})

li = sorted(di.items(), key=lambda x: x[0])

print(li)

di2 = {}

for tu in li:
    for mini_dict in tu[1]:
        for k, v in mini_dict.items():
            di2[k] = v
    sorted_di2 = sorted(di2.items(), key=lambda x: x[1], reverse=True)
    for tup2 in sorted_di2:
        print(tup2[0])

    sorted_di2 = []
    di2 = {}


from collections import defaultdict

N = int(input())
di = defaultdict(list)

for n in range(1, N + 1):
    S, P = input().split()
    P = int(P)
    di[S].append({n: P})

li = sorted(di.items(), key=lambda x: x[0])

di2 = {}

for tu in li:
    for mini_dict in tu[1]:
        for k, v in mini_dict.items():
            di2[k] = v
    sorted_di2 = sorted(di2.items(), key=lambda x: x[1], reverse=True)
    for tup2 in sorted_di2:
        print(tup2[0])

    sorted_di2 = []
    di2 = {}


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

  rest = sorted(rest, key=itemgetter(2), reverse=True)
  rest = sorted(rest, key=itemgetter(1))
  for i in range(n):
    print(rest[i][0])

from operator import itemgetter
n = int(input())
rest = []
for i in range(n):
    s, p = map(str, input().split())
    rest.append([i+1, s, int(p)])

    rest.sort(key=itemgetter(2), reverse=True)
    rest.sort(key=itemgetter(1))
    for i in range(n):
      print(rest[i][0])

def Guidebook():
    n = int(input())
    rest = []
    for i in range(n):
        s, p = map(str, input().split())
        rest.append([i+1, s, int(p)])

    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])
if __name__ == "__main__":
    Guidebook()

Verdicts: Runtime Error

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())
dic = []
for _ in range(n):
  name, point = input().split()
  dic.append((name, int(point)))

srt = sorted(dic, reverse=True, key=lambda x: x[1])
srt = sorted(range(n), key=lambda x: srt[x][0])

for i in srt:
  print(str(i+1))
             

n = int(input())
dic = []
for _ in range(n):
  name, point = input().split()
  dic.append((name, int(point)))

srt = sorted(dic, reverse=True, key=lambda x: x[1])
srt_ind = sorted(range(n), reverse=True, key=lambda x: dic[x][1])
srt = sorted(srt_ind, key=lambda x: srt[x][0])

for i in srt:
  print(str(i+1))
             

n = int(input())
dic = []
for i in range(n):
  name, point = input().split()
  dic.append((name, int(point), i+1))

srt = sorted(dic, reverse=True, key=lambda x: x[1])
srt = sorted(srt, key=lambda x: x[0])

for x in srt:
  print(x[2])
             

Verdicts: Wrong Answer

Wrong Answer

Accepted