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 _ in range(N):
    SP.append([i for i in input().split()])
for n in range(N):
    SP[n][1] = str(100 - int(SP[n][1])).rjust(3,'0')
SP2 = []
for n in range(N):
    SP2.append(SP[0]+SP[1])
ans = sorted(range(len(SP2)), key=lambda k: SP2[k])
for i in ans:
    print(i+1)

N = int(input())
SP = []
for _ in range(N):
    SP.append([i for i in input().split()])
for n in range(N):
    SP[n][1] = str(100 - SP[n][1]).rjust(3,'0')
SP2 = []
for n in range(N):
    SP2.append(SP[0]+SP[1])
ans = sorted(range(len(SP2)), key=lambda k: SP2[k])
[print(i) for i in ans]

N = int(input())
SP = []
for _ in range(N):
  SP.append(input().split())
ans = sorted(range(len(SP)), key=lambda k: SP[k],reverse=True)
[print(i) for i in ans]

N = int(input())
SP = []
for _ in range(N):
    SP.append([i for i in input().split()])
for n in range(N):
    SP[n][1] = str(100 - int(SP[n][1])).rjust(3,'0')
SP2 = []
for n in range(N):
    SP2.append(SP[0]+SP[1])
ans = sorted(range(len(SP2)), key=lambda k: SP2[k])
[print(i) for i in ans]

N = int(input())
SP = []
for _ in range(N):
  SP.append(input().split())
print(sorted(range(len(s)), key=lambda k: s[k],reverse=True))

N = int(input())
SP = []
for _ in range(N):
  SP.append(input().split())
ans = sorted(range(len(SP)), key=lambda k: SP[k],reverse=True)
[print(i+1) for i in ans]

N = int(input())
SP = []
for _ in range(N):
  SP.append([i for i in input().split()])
for n in range(N):
  SP[n][1] = str(100 - SP[n]).rjust(3,'0')
SP2 = []
for n in range(N):
  SP2.append(SP[0]+SP[1])
ans = sorted(range(len(SP2)), key=lambda k: SP2[k])
[print(i) for i in ans]

N = int(input())
SP = []
for _ in range(N):
    SP.append([i for i in input().split()])
for n in range(N):
    SP[n][1] = str(100 - int(SP[n][1])).rjust(3,'0')
SP2 = []
for n in range(N):
    SP2.append(SP[n][0]+SP[n][1])
ans = sorted(range(len(SP2)), key=lambda k: SP2[k])
for i in ans:
    print(i+1)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

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 collections as cl

N=int(input())

L = []

for i in range(N):
  S,P_ = input().split()
  P = int(P_)
  
  flg = False
  for j in range(len(L)):
    if L[j][0]>S or (L[j][0]==S and L[j][1]>P):
      L.insert(j,(S,P,i))
      flg = True
      break
  if flg==False:
    L.append((S,P,i))
    
I = [0]*N
for i in range(N):
  I[L[i][2]] = i+1

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






import collections as cl

N=int(input())

L = []

for i in range(N):
  S,P_ = input().split()
  P = int(P_)
  
  flg = False
  for j in range(len(L)):
    if L[j][0]>S or (L[j][0]==S and L[j][1]<P):
      L.insert(j,(S,P,i))
      flg = True
      break
  if flg==False:
    L.append((S,P,i))
        
I = [0]*N
for i in range(N):
  I[L[i][2]] = i+1

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






import collections as cl

N=int(input())

L = []

for i in range(N):
  S,P_ = input().split()
  P = int(P_)
  
  flg = False
  for j in range(len(L)):
    if L[j][0]>S or (L[j][0]==S and L[j][1]<P):
      L.insert(j,(S,P,i))
      flg = True
      break
  if flg==False:
    L.append((S,P,i))
        
#I = [0]*N
for i in range(N):
  print(L[i][2]+1)
#  I[L[i][2]] = i+1
      






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):
from operator import itemgetter, attrgetter
N = int(input())
A = []
for i in range(N):
    tmp = input().split()
    A.append([tmp[0],-int(tmp[1]),i])
A.sort()
A.sort(key=itemgetter(0,1))
print([A[i][2]+1 for i in range(N)])

from operator import itemgetter, attrgetter
N = int(input())
A = []
for i in range(N):
    tmp = input().split()
    A.append([tmp[0],-int(tmp[1]),i])
A.sort()
A.sort(key=itemgetter(0,1))
for i in range(N):
    print(A[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):
n = int(input())
data = []
for i in range(n):
    tw, sc = input().split()
    data.append([tw, int(sc), i+1])

data.sort()

for d in data:
    print (d[2])

n = int(input())
data = []
for i in range(n):
    tw, sc = input().split()
    data.append([tw, -int(sc), i+1])

data.sort()

for d in data:
    print (d[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 operator import itemgetter

n = int(input())
A = []
city = []
for _ in range(n):
    s,p = input().split()
    city.append([s,-int(p)])
    A.append([s,-int(p)])

A = sorted(A, key=itemgetter(0,1))
for c in city:
    print(A.index(c)+1)

from operator import itemgetter

n = int(input())
A = []
city = []
for _ in range(n):
    s,p = input().split()
    city.append([s,-int(p)])
    A.append([s,-int(p)])

A = sorted(A, key=itemgetter(0,1))
for a in A:
    print(city.index(a)+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())
S, P = ['0']*N, [0]*N
SP = []
for i in range(N):
    tmp_s, tmp_p = map(str, input().split())
    S[i], P[i] = tmp_s, tmp_p
    SP.append((tmp_s,int(tmp_p)))


SSP = sorted(SP, key=itemgetter(1), reverse=True)

SSP = sorted(SSP, key=itemgetter(0))

answer = [0]*N
for i in range(N):
    for j in range(N):
        if SSP[i] == SP[j]:
            answer[i] = j+1

for i in answer:
    print(i)

from operator import itemgetter

# input
N = int(input())
S, P = ['0']*N, [0]*N
SP = []
for i in range(N):
    tmp_s, tmp_p = map(str, input().split())
    S[i], P[i] = tmp_s, tmp_p
    SP.append((tmp_s,int(tmp_p)))


SSP = sorted(SP, key=itemgetter(1), reverse=True)

SSP = sorted(SSP, key=itemgetter(0))

answer = [0]*N
for i in range(N):
    for j in range(N):
        if SSP[i] == SP[j]:
            answer[i] = j+1

for i in answer:
    print(i)


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):
# ABC 128: B – Guidebook
from operator import itemgetter

n = int(input(0))

s = []
p = []

for _ in range(n):
    tmp = [s for s in input().split()]
    s.append(tmp[0])
    p.append(int(tmp[1]))

restaurants = []
for i in range(n):
    restaurants.append([i + 1, s[i], p[i]])

restaurants.sort(key=itemgetter(2), reverse=True)
restaurants.sort(key=itemgetter(1))

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

# ABC 128: B – Guidebook
from operator import itemgetter

n = int(input(0))

s = []
p = []

for _ in range(n):
    tmp = [s for s in input().split()]
    s.append(tmp[0])
    p.append(int(tmp[1]))

restaurants = []
for i in range(n):
    restaurants.append([i + 1, s[i], p[i]])

restaurants.sort(key=itemgetter(2), reverse=True)
restaurants.sort(key=itemgetter(1))

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

# ABC 128: B – Guidebook
N = int(input())

shops = []
for i in range(N):
    s = input().split()
    shops.append([i + 1, s[0], int(s[1])])

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

for k in [shop[0] for shop in shops]:
    print(k)

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):
number=int(input())
book=[]
for i in range(0,number):
  book.append((input().split()).append(i+1))
book1=list.sort(book,key=lambda x: x[1],reverse=True)
book2=book2.sort()
for i in range(0,len(book2)):
  print(book[i][2],'\n')
  

number=int(input())
book=[]
for i in range(0,number):
  book.append(input().split())
for i in range(0,len(book)):
    book[i][1]=int(book[i][1])
    book[i].append(i+1)
book1=sorted(book,key=lambda x: -x[1])
book2=sorted(book1,key=lambda x: x[0])
for i in range(0,len(book2)):
  print(book[i][2])

number=int(input())
book=[]
for i in range(0,number):
  book.append(input().split())
for i in range(0,len(book)):
    book[i][1]=int(book[i][1])
    book[i].append(i+1)
book1=sorted(book,key=lambda x: -x[1])
book2=sorted(book1,key=lambda x: x[0])
for i in range(0,len(book2)):
  print(book2[i][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())
SP = []
for i in range(n):
    s,p = input().split()
    SP.append([i+1,s,int(p)])
    
from operator import itemgetter

SP.sort(key = itemgetter(2))
SP.sort(key = itemgetter(1))
for j,s,p in SP:
    print(j)

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

SP.sort(key = itemgetter(2),reverse = True)
SP.sort(key = itemgetter(1))
for j,s,p in SP:
    print(j)

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())
l = [0] * n
for i in range(n):
    l[i] = list(map(str, input().split()))
    l[i][1] = int(l[i][1])
l_sorted = sorted(l, key=lambda l: l[1], reverse=True)
l_sorted = sorted(l_sorted, key=lambda l: l[0])
print(l_sorted)
for i in range(len(l)):
    print(l.index(l_sorted[i]) + 1)

n = int(input())
l = [0] * n
for i in range(n):
    l[i] = list(map(str, input().split()))
    l[i][1] = int(l[i][1])
l_sorted = sorted(l, key=lambda l: l[1], reverse=True)
l_sorted = sorted(l_sorted, key=lambda l: l[0])

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


N = int(input())
L = []
for i in range(N):
    S,P = input().split()
    L.append([S,-int(P),i+1])
for l in sorted(L):
    print(l[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(list(input().split()) for i in range(n))
a = sorted(l)
print(a)
for i in range(n-1):
  if a[i][0]==a[i+1][0]:
    x = a[i][1]
    a[i][1] = a[i+1][1]
    a[i+1][1]= x
print(a)

n = int(input())
l = list(list(input().split()) for i in range(n))
a = sorted(l)
for i in range(n):
  l[i][1]= -int(l[i][1])
a = sorted(l)
for i in range(n):
  l[i][1]= -int(l[i][1])
for q in a:
  print(l.index(q)+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())
    SP = []
    for _ in range(N):
        temp = input().split()
        SP.append((temp[0], int(temp[1])))

    sorted_SP = sorted(SP, key=lambda x: x[1], reverse=True)
    sorted_SP = sorted(sorted_SP, key=lambda x: x[0])

    indices = [SP.index(x)+1 for x in sorted_SP]
    
    print(indices)

if __name__ == '__main__':
    main()

def main():
    N = int(input())
    SP = []
    for _ in range(N):
        temp = input().split()
        SP.append((temp[0], int(temp[1])))

    sorted_SP = sorted(SP, key=lambda x: x[1], reverse=True)
    sorted_SP = sorted(sorted_SP, key=lambda x: x[0])

    indices = [SP.index(x)+1 for x in sorted_SP]
    
    for i in indices:
        print(i)

if __name__ == '__main__':
    main()

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 OrderedDict

N = int(input())
X = {}
tmp1 = []
for i in range(N):
    tmp1.append(input())
    tmp2 = tmp1[i].split()
    if tmp2[0] in X:
        X[tmp2[0]].append(int(tmp2[1]))
    else:
        X[tmp2[0]] = [int(tmp2[1])]

X_sorted = OrderedDict(sorted(X.items(), key=lambda x:x[0]))
print(X_sorted)
for i in X_sorted.keys():
    X_sorted[i] = sorted(X_sorted[i],reverse=True)

res = []
for i in X_sorted.keys():
    for j in range(len(X_sorted[i])):
        res.append(i+" "+str(X_sorted[i][j]))

for i in range(len(res)):
    print(tmp1.index(res[i])+1)

from collections import OrderedDict

N = int(input())
X = {}
tmp1 = []
for i in range(N):
    tmp1.append(input())
    tmp2 = tmp1[i].split()
    if tmp2[0] in X:
        X[tmp2[0]].append(int(tmp2[1]))
    else:
        X[tmp2[0]] = [int(tmp2[1])]

X_sorted = OrderedDict(sorted(X.items(), key=lambda x:x[0]))
for i in X_sorted.keys():
    X_sorted[i] = sorted(X_sorted[i],reverse=True)

res = []
for i in X_sorted.keys():
    for j in range(len(X_sorted[i])):
        res.append(i+" "+str(X_sorted[i][j]))

for i in range(len(res)):
    print(tmp1.index(res[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):
from operator import itemgetter
i = int(input())

data = []

def chg(x,y):
	print("hoge")
	if x[0] == y[0]:
		return x[1] > y[1]
	else:
		return x[0] > y[0]

for i in range(i):
	ip = input().split(' ')
	dt = [ip[0],int(ip[1])]
	data.append(dt)


ls = sorted(data,key=itemgetter(1),reverse=True)
ls = sorted(ls,key=itemgetter(0))

print(ls)

for i in ls:
	cnt = 0
	for j in data:
		if i == j:
			break
		cnt += 1
	
	print(cnt + 1)
	
	



from operator import itemgetter
i = int(input())

data = []

def chg(x,y):
	print("hoge")
	if x[0] == y[0]:
		return x[1] > y[1]
	else:
		return x[0] > y[0]

for i in range(i):
	ip = input().split(' ')
	dt = [ip[0],int(ip[1])]
	data.append(dt)


ls = sorted(data,key=itemgetter(1),reverse=True)
ls = sorted(ls,key=itemgetter(0))

for i in ls:
	cnt = 0
	for j in data:
		if i == j:
			break
		cnt += 1
	
	print(cnt + 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())

wrap = []

for i in range(n):
    input_data = input()
    wrap.append([i+1, input_data.split()[0], int(input_data.split()[1])])

wrap.sort(key=itemgetter(2), reverse=True)
wrap.sort(key=itemgetter(1))
print(wrap)

for i in wrap:
    print(i[0])

from operator import itemgetter

n = int(input())

wrap = []

for i in range(n):
    input_data = input()
    wrap.append([i+1, input_data.split()[0], int(input_data.split()[1])])

wrap.sort(key=itemgetter(2), reverse=True)
wrap.sort(key=itemgetter(1))

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

lst = sorted(lst,key=lambda x:(x[0],x[1]))
for i in range(N):
  print(i)

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

lst = sorted(lst,key=lambda x:(x[0],x[1]))
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())
L = [[]*4]*N
S = ''
P = ''
for i in range(N):
  S, P = input().split()
  L[i] = [0, S, int(P)*-1, i, 0]
L.sort()
for i in range(N):
  L[i][0] = L[i][3]
  L[i][4] = i+1

L.sort()
for i in range(N):
  print(L[i][4])

N = int(input())
L = [[]*4]*N
S = ''
P = ''
for i in range(N):
  S, P = input().split()
  L[i] = [0, S, int(P)*-1, i, 0]
L.sort()
for i in range(N):
  print(L[i][4])

N = int(input())
L = [[]*3]*N
S = ''
P = ''
for i in range(N):
  S, P = input().split()
  L[i] = [S, int(P)*-1, i+1]

L.sort()

for i in range(N):
  print(L[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())
l = [input().split() for _ in range(N)]
for i in range(N):
  l[i][1] = int(l[i][1])

l = sorted(l, key=lambda x:(x[0], -x[1]))
for i in range(N):
  print(l[i][0])

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


l = sorted(l, key=lambda x:(x[0], -x[1]))
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())
S=[]
for i in range(N):
    S.append(list(input().split()))
    S[i][1]=-int(S[i][1])
for i in range(N):
    print(sorted(range(N),key=lambda k : S[k])[i])

N=int(input())
S=[]
for i in range(N):
    S.append(list(input().split()))
    S[i][1]=-int(S[i][1])
for i in range(N):
    print(sorted(range(N),key=lambda k : S[k])[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):

#include<algorithm>
using namespace std;
 
int main(void){
    int n;
    cin >> n;
    vector<pair<pair<string,int>,int>> rest(n);
    for(int i = 0;i < n;i++){
        cin >> rest[i].first.first >> rest[i].first.second;
        rest[i].first.second *= -1;
        rest[i].second = i+1;
    }
 
    sort(rest.begin(),rest.end());
 
    for(int i = 0;i < n;i++){
        cout << rest[i].second << endl;
    }
 
    return 0;
}


#include<algorithm>

#include<stdio.h>
using namespace std;
 
int main(void){
    int n;
    cin >> n;
    vector<pair<pair<string,int>,int>> rest(n);
    for(int i = 0;i < n;i++){
        cin >> rest[i].first.first >> rest[i].first.second;
        rest[i].first.second *= -1;
        rest[i].second = i+1;
    }
 
    sort(rest.begin(),rest.end());
 
    for(int i = 0;i < n;i++){
        cout << rest[i].second << endl;
    }
 
    return 0;
}


#include<algorithm>

#include<string>
using namespace std;
 
int main(void){
    int n;
    cin >> n;
    vector<pair<pair<string,int>,int>> rest(n);
    for(int i = 0;i < n;i++){
        cin >> rest[i].first.first >> rest[i].first.second;
        rest[i].first.second *= -1;
        rest[i].second = i+1;
    }
 
    sort(rest.begin(),rest.end());
 
    for(int i = 0;i < n;i++){
        cout << rest[i].second << endl;
    }
 
    return 0;
}

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

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())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

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

for j in range[len(book)]:
    print(book[j][3])

n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

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

for j in range(len(book)):
    print(book[j][2])

n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

book.sort(key = lambda x:x[1], reverce = True)
book.sort(key = lambda x:x[0])

for j in range(len(book)):
    print(book[j][2])

n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

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

for j in range(len(book)):
    print(book[j][3])

n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

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

for j in range(len(book)):
    print(book[j][2])


n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

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

for j in range[len(book)]:
    print(book[j][3])

n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

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

for j in range(len(book)):
    print(book[j][2])


n = int(input())
l = [input().split()+[i] for i in range(n)]

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

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

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

xy = []
for i in range(N):
    x, y = map(str, input().split())
    y = int(y)
    xy.append([x, y])

sort_xy = sorted(sorted(xy), key=lambda x: x[1], reverse=True)

for i in range(N):
    for j in range(N):
        if xy[i][0] == sort_xy[j][0]:
            if xy[i][1] == sort_xy[j][1]:
                print(j + 1)
                

N = int(input())

xy = []
for i in range(N):
    xy.append(input().split())

sort_xy = sorted(xy)

for i in range(N):
    for j in range(N):
        if xy[i][0] == sort_xy[j][0]:
            if xy[i][1] == sort_xy[j][1]:
                print(j + 1)
                

N = int(input())

xy = []
for i in range(N):
    x, y = map(str, input().split())
    y = int(y)
    xy.append([x, y])

sort_xy = sorted(sorted(xy), key=lambda x: (x[0],-x[1]))
print(sort_xy)

for i in range(N):
    for j in range(N):
        if xy[i][0] == sort_xy[j][0]:
            if xy[i][1] == sort_xy[j][1]:
                print(j + 1)
                

N = int(input())

xy = []
for i in range(N):
    x, y = map(str, input().split())
    y = int(y)
    xy.append([x, y])

print(xy)

sort_xy = sorted(sorted(xy), key=lambda x: x[1], reverse=True)

for i in range(N):
    for j in range(N):
        if xy[i][0] == sort_xy[j][0]:
            if xy[i][1] == sort_xy[j][1]:
                print(j + 1)
                

N = int(input())

xy = []
for i in range(N):
    x, y = map(str, input().split())
    y = int(y)
    xy.append([x, y])

sort_xy = sorted(sorted(xy), key=lambda x: (x[0],-x[1]))

for i in range(N):
    for j in range(N):
        if xy[i][0] == sort_xy[j][0]:
            if xy[i][1] == sort_xy[j][1]:
                print(j + 1)
                

N = int(input())

xy = []
for i in range(N):
    x, y = input().split()
    xy.append([i + 1, x, int(y)])

sort_xy = sorted(sorted(xy), key=lambda x: (x[1],-x[2]))

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


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

for _, _, i in a:
    print(i + 1)


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

for _, _, i in a:
    print(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())
t=[]
for i in range(n):
  a=input().split()
  b=[i+1,a[0],(-1)*a[1]]
  t.append(b)

t.sort(key=lambda x:(x[1],x[0]))
print(t[0])


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

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

l.sort()
for i in l:
    print(i[2])

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

l.sort()
for i in l:
    print(i[2])

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

l.sort()
for i in l:
    print(i[2])

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())
SP = {}
for i in range(N):
    line = input().split()
    SP[i] = [line[0], int(line[1])]
    
ans = []
for i, index in enumerate(sorted(SP.items(), key= lambda x: (x[1][0], -x[1][1]))):
    ans.append([index, i])
print(ans)

for ls in ans:
    print(ls[0][0] + 1)

N = int(input())
SP = {}
for i in range(N):
    line = input().split()
    SP[i] = [line[0], int(line[1])]
    
ans = []
for i, index in enumerate(sorted(SP.items(), key= lambda x: (x[1][0], -x[1][1]))):
    ans.append([index, i])

for ls in ans:
    print(ls[0][0] + 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())
SP_1 = [list(input().split()) for i in range(N)]
for i in range(N) :
    SP_1[i][1] = int(SP_1[i][1])
buf = 0
SP_2 = SP_1
SP_1 = sorted(SP_1,key = itemgetter(0))
# print(SP_1)
for i in range(1,N) :
    if SP_1[i][0] != SP_1[i-1][0] :
        print(SP_1[buf:i])
        SP_1[buf:i] = sorted(SP_1[buf:i],key = itemgetter(1),reverse = True)
        buf = i
SP_1[buf:N] = sorted(SP_1[buf:N],key=itemgetter(1),reverse = True)
# print(SP_1) 
for i in range(N) :
    for j in range(N) :
        if SP_1[i] == SP_2[j] :
            print(j+1)
            break

from operator import itemgetter
N = int(input())
SP_1 = [list(input().split()) for i in range(N)]
for i in range(N) :
    SP_1[i][1] = int(SP_1[i][1])
buf = 0
SP_2 = SP_1
SP_1 = sorted(SP_1,key = itemgetter(0))
# print(SP_1)
for i in range(1,N) :
    if SP_1[i][0] != SP_1[i-1][0] :
        
        SP_1[buf:i] = sorted(SP_1[buf:i],key = itemgetter(1),reverse = True)
        buf = i
SP_1[buf:N] = sorted(SP_1[buf:N],key=itemgetter(1),reverse = True)
# print(SP_1) 
for i in range(N) :
    for j in range(N) :
        if SP_1[i] == SP_2[j] :
            print(j+1)
            break

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
d = defaultdict(list)
n = int(input())
for i in range(n):
    city, point = input().split()
    d[city].append((int(point), i))

d2 = sorted(d.items())
for i in range(len(d2)):
    sorted(d2[i][1])
    for j in range(len(d2[i])):
        print(d2[i][1][j][1] + 1)



from collections import defaultdict
d = defaultdict(list)
n = int(input())
for i in range(n):
    city, point = input().split()
    d[city].append((int(point), i+1))

d2 = sorted(d.items())
for i in range(len(d2)):
    d2[i] = list(d2[i])
    d2[i][1] = sorted((d2[i][1]), reverse = True)
    for j in range(len(d2[i][1])):
        print(d2[i][1][j][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())
res = list(enumerate(((s[0], int(s[1])) for s in input().split()), 1))

res.sort(key=lambda r: r[1])

[print(r[0]) for r in res]


n = int(input())

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

res.sort(key=lambda r: r[0])

for r in res:
    print(r[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):
from operator import itemgetter
n = int(input())
l = []
for i in range(n):
    pair = input().split()
    l.append([pair[0], pair[1]])
l2 = l[:]
print(l)

sub = sorted(l2, key=itemgetter(1), reverse=True)
# name sort
l_sorted = sorted(sub, key=itemgetter(0))
print(l_sorted)
for i in range(n):
    for j in range(n):
        if (l[j] == l_sorted[i]):
            print(j+1)


from operator import itemgetter
n = int(input())
l = []
for i in range(n):
    pair = input().split()
    l.append([pair[0], int(pair[1])])
l2 = l[:]

sub = sorted(l2, key=itemgetter(1), reverse=True)
# name sort
l_sorted = sorted(sub, key=itemgetter(0))
for i in range(n):
    for j in range(n):
        if (l[j] == l_sorted[i]):
            print(j+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())
l = [list(input().split())+[i+1] for i in range(n)]
 
l.sort(key = itemgetter(0))
l = sorted(l, key = lambda x:(x[1]),reverse = True)
print(l)

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

Verdicts: Wrong Answer

Accepted