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 = []
[SP.append(input().split()) for i in range(N)]
for i in range(N):
    SP[i][1] = int(SP[i][1])
SP.sort(reverse=True)
SP.sort(key=lambda x: x[0])
print(SP)

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


[SP.append(input().split() + [i])for i in range(N)]


for i in range(N):
    SP[i][1] = int(SP[i][1])
SP.sort(reverse=True)
SP.sort(key=lambda x: x[0])


for a, b, c in SP:      
	print(c + 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())
l=list()#empty list

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

sortedList = sorted(l,key=lambda item:(item[0],item[1]))

print(sortedList)
for i in range(1,N+1):
    print(sortedList[i-1][2])


N = int(input())
l=list()#empty list

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

sortedList = sorted(l,key=lambda item:(item[0],item[1]))

for i in range(1,N+1):
    print(sortedList[i-1][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())

ss = dict()
sss = dict()
for i in range(N):
    s, p = input().split()
    sss[s, p] = i + 1
    if s in ss:
        ss[s] = ss[s] + ',' + p
    else:
        ss[s] = p

print(ss)
ss_sorted = sorted(ss.items())

for tmp_ss in ss_sorted:
    s = tmp_ss[0]
    ps = list(map(int, tmp_ss[1].split(',')))
    ps.sort(reverse=True)
    for p in ps:
        print(sss[s, str(p)])


N = int(input())


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

ss_sorted = sorted(ss, key = lambda x:(x[0], -x[1]))

print([out[2] for out in ss_sorted])

N = int(input())


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

ss_sorted = sorted(ss, key=lambda x: (x[0], -x[1]))

for out in ss_sorted:
    print(out[2] + 1)

Verdicts: 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):
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[1],reverse=True)
l = sorted(l,key = lambda x:x[0])

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

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[1],reverse=True)
l = sorted(l,key = lambda x:x[0])

for i in range(N):
    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())

d = [input().split() + [i+1] for i in range(N)]
d = sorted(d, key=lambda x:x[1], reverse=True)
d = sorted(d, key=lambda x:x[0], reverse=False)
for s in d:
    print(s[-1])

n = int(input())

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

import numpy

N = int(input())

scores = {}
indexes = {}
for i in range(N):
    s, p = input().split()
    p = int(p)
    if s in scores:
        scores[s].append(p)
        indexes[s].append(i)
    else:
        scores[s] = [p]
        indexes[s] = [i]

print(scores)
print(indexes)



# N = 6

for s in sorted(scores.keys()):
    for i in numpy.argsort(scores[s])[::-1]:
        print(indexes[s][i]+1)


import numpy

N = int(input())

scores = {}
indexes = {}
for i in range(N):
    s, p = input().split()
    p = int(p)
    if s in scores:
        scores[s].append(p)
        indexes[s].append(i)
    else:
        scores[s] = [p]
        indexes[s] = [i]


# print(indexes)



# N = 6

for s in sorted(scores.keys()):
    for i in numpy.argsort(scores[s])[::-1]:
        print(indexes[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):
from operator import itemgetter

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

sp.sort(key=itemgetter(0, 1))
for index in sp:
    print(index[2])
print(sp)



from operator import itemgetter

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

sp.sort(key=itemgetter(0, 1))
for index in sp:
    print(index[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())

data = dict()

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

for key in sorted(data.keys()):
  for _, num in sorted(data[key], key=lambda x: -x[0]):
    print(num)

n = int(input())

data = dict()

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

for key in sorted(data.keys()):
    for _, num in sorted(data[key], key=lambda x: -x[0]):
        print(num)


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 functools as f

def to_num(a, b):
    if a > b:
        return 1
    if b > a:
        return -1
    return 0

def cmp(a, b):
    if (a[0] == b[0]):
        return to_num(b[1], a[1])
    return to_num(a[0], b[0])

n = int(input())
A = []
for i in range(n):
    a, b = input().split()
    A.append([a, int(b), i + 1])
#print(A)
A.sort(key=f.cmp_to_key(cmp))
for i in range(n):
    A[i].append(i + 1)
#print(A)
A.sort(key=lambda x: x[2])
#print(A)
for i in range(n):
    print(A[i][3])


import functools as f

def to_num(a, b):
    if a > b:
        return 1
    if b > a:
        return -1
    return 0

def cmp(a, b):
    if (a[0] == b[0]):
        return to_num(b[1], a[1])
    return to_num(a[0], b[0])

n = int(input())
A = []
for i in range(n):
    a, b = input().split()
    A.append([a, int(b), i + 1])
#print(A)
A.sort(key=f.cmp_to_key(cmp))
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=input()
N=int(N)
S=[100]*N
P=[100]*N
for num in range(N):
    S[num]=input().split()
    S[num].append(num+1)
    S[num][1]=int(S[num][1])
print(S)
S.sort()
flag=0
flag2=0
while(flag==0):
    flag2=0
    for num in range(0,N-1):
        if(S[num][0]==S[num+1][0]):
            if(S[num][1]<S[num+1][1]):
                S[num],S[num+1]=S[num+1],S[num]
                flag2=1
    if(flag2==0):
        flag=1
    
            
print(S)
for num in range(N):
    print(S[num][2])

N=input()
N=int(N)
S=[100]*N
P=[100]*N
for num in range(N):
    S[num]=input().split()
    S[num].append(num+1)
    S[num][1]=int(S[num][1])

S.sort()
flag=0
flag2=0
while(flag==0):
    flag2=0
    for num in range(0,N-1):
        if(S[num][0]==S[num+1][0]):
            if(S[num][1]<S[num+1][1]):
                S[num],S[num+1]=S[num+1],S[num]
                flag2=1
    if(flag2==0):
        flag=1
    
            

for num in range(N):
    print(S[num][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):
    a=input().split()
    a[1]=int(a[1])
    s.append(a)
s.sort(key=lambda x:(x[0],-x[1]))
print(s)

n=int(input())
s=[]
for i in range(n):
    a=input().split()
    a[1]=int(a[1])
    a.append(i)
    s.append(a)
s.sort(key=lambda x:(x[0],-x[1]))
for i in range(n):
    print(s[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())
rest_dict = {}
city_list = []
for i in range(N):
    city, score = input().split()
    if city not in city_list:
        city_list.append(city)
        rest_dict[city] = [[score, i]]
    else:
        rest_dict[city].append([score, i])

coty_list = sorted(city_list)
for city in city_list:
    rest_list = rest_dict[city]
    rest_list = sorted(rest_list, reverse=True)
    for rest in rest_list:
        print(rest[1]+1)

N = int(input())
rest_dict = {}
city_list = []
for i in range(N):
    city, score = input().split()
    if city not in city_list:
        city_list.append(city)
        rest_dict[city] = [[score, i]]
    else:
        rest_dict[city].append([score, i])

coty_list = sorted(city_list)
for city in city_list:
    rest_list = rest_dict[city]
    rest_list = sorted(rest_list)
    for rest in rest_list:
        print(rest[1])

N = int(input())
rest_dict = {}
city_list = []
for i in range(N):
    city, score = input().split()
    if city not in city_list:
        city_list.append(city)
        rest_dict[city] = [[int(score), i]]
    else:
        rest_dict[city].append([int(score), i])

city_list = sorted(city_list)
for city in city_list:
    rest_list = rest_dict[city]
    rest_list = sorted(rest_list, reverse=True)
    for rest in rest_list:
        print(rest[1]+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):
import numpy as np
N = int(input())
name_list = []
score_list = []
score_list_new = []
for i in range(N):
  name, score =  map(str,input().split())
  name_list.append(name)
  score_list.append(int(score))
index_name = np.argsort(name_list)
for i in range (len(score_list)):
  score_list_new.append(score_list[index_name[i]])
for i in range(len(index_name)):
  for j in range(i,len(index_name)):
  	if (name_list[i] == name_index[j]) and (score_list_new[i] < score_list_new[j]):
      index_name[i], index_name[j] = index_name[j], index_name[i]
    else:
      None  
for i in range(len(index_name)):
  print(index_name[i])

import numpy as np
N = int(input())
restaurants_list = []
for i in range(N):
  name,score = map(str,input().split())
  score = int(score)
  restaurants_list.append([name,score,i+1])
restaurants_list.sort(key = lambda x:x[1],reverse=True) 
restaurants_list.sort(key = lambda x:x[0]) 
for i in range(N):
  print(restaurants_list[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())
T = [input().split() for _ in range(n)]
ans = list(range(1, n + 1))

for i in range(n):
    j = i
    while j > 0:
        if T[j][0] < T[j - 1][0]:
            T[j], T[j - 1] = T[j - 1], T[j]
            ans[j], ans[j - 1] = ans[j - 1], ans[j]
            j = j - 1
        else:
            break

for i in range(n):
    j = i
    while j > 0:
        if int(T[j][1]) > int(T[j - 1][1]) and T[j][0] == T[j - 1][0]:
            T[j], T[j - 1] = T[j - 1], T[j]
            ans[j], ans[j - 1] = ans[j - 1], ans[j]
            j = j - 1
        else:
            break


print(ans)

n = int(input())
T = [input().split() for _ in range(n)]
ans = list(range(1, n + 1))

for i in range(n):
    j = i
    while j > 0:
        if T[j][0] < T[j - 1][0]:
            T[j], T[j - 1] = T[j - 1], T[j]
            ans[j], ans[j - 1] = ans[j - 1], ans[j]
            j = j - 1
        else:
            break

for i in range(n):
    j = i
    while j > 0:
        if int(T[j][1]) > int(T[j - 1][1]) and T[j][0] == T[j - 1][0]:
            T[j], T[j - 1] = T[j - 1], T[j]
            ans[j], ans[j - 1] = ans[j - 1], ans[j]
            j = j - 1
        else:
            break


for i in range(n):
    print(ans[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())
SP = [input().split()+[0] for _ in range(N)]
r = []
for x, y, z in SP:
  r.append([x, int(y), z])

sortV = sorted(r, key = lambda x: -x[1])
sortK = sorted(sortV, key = lambda x: x[0])

g = 1
for i in range(N):
  sortK[i][2] = g
  g += 1

for c in r:
  print(c[2])

N = int(input())
SP = [input().split() for _ in range(N)]
r = []
g= 1
for x, y in SP:
  r.append([x, int(y), g])
  g+=1

sortV = sorted(r, key = lambda x: -x[1])
sortK = sorted(sortV, key = lambda x: x[0])

for x, y,z in sortK:
  print(z)

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):
    a, b=input().split()
    if a in s:
        s[a].append((i+1, int(b)))
    else:
        s[a]=[(i+1, int(b))]

print(s)
for key in sorted(s):
    for i, score in sorted(s[key], key=lambda t:~t[1]):
        print(i)


n = int(input())

s = {}
for i in range(n):
    a, b=input().split()
    if a in s:
        s[a].append((i+1, int(b)))
    else:
        s[a]=[(i+1, int(b))]

for key in sorted(s):
    for i, score in sorted(s[key], key=lambda t:~t[1]):
        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())
l=[input().split() for i in range(n)]
tmp_l = sorted(l, key=lambda x: x[1],reverse=True)
ans=sorted(tmp_l,key=lambda x: x[0])
for i in range(n):
 print(1+ans.index(ans[i]))

n=int(input())
l=[input().split() for i in range(n)]
tmp=sorted(l, key=lambda x: x[1],reverse=True)
tmp=sorted(tmp,key=lambda x: x[0])
l2=[x for x in range(10)]
ans=list(zip(l2,tmp))

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

n=int(input())
l=[input().split() for i in range(n)]
l2=[x for x in range(n)]
base=list(zip(l2,l))
ans=sorted(base, key=lambda x: int(x[1][1]),reverse=True)
ans=sorted(ans,key=lambda x: x[1][0])

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

Verdicts: 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):
n = int(input())
s_p_list = list()
for i in range(n):
    input_ = input().split()
    input_[1] = int(input_[1])
    input_.append(i + 1)
    s_p_list.append(input_)


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

print(s_p_list)

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


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


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

# print(s_p_list)

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

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

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


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

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

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


Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
sp = [[0, 0, 0] for i in range(n)]
for i in range(n):
  sp[i][0], sp[i][1] = list(map(str, input().split()))
  sp[i][1] = int(sp[i][1])
  sp[i][2] = i+1
sp.sort()
print(sp)

c=1
for i in range(n-1):
  if sp[i][0] == sp[i+1][0]:
    c+=1
    i+=1
  else:
    for j in range(c):
      print(sp[i-j][2])
    c=1
for j in range(c):
  print(sp[n-1-j][2])

n = int(input())
sp = [[0, 0, 0] for i in range(n)]
for i in range(n):
  sp[i][0], sp[i][1] = list(map(str, input().split()))
  sp[i][1] = int(sp[i][1])
  sp[i][2] = i+1
sp.sort()

c=1
for i in range(n-1):
  if sp[i][0] == sp[i+1][0]:
    c+=1
    i+=1
  else:
    for j in range(c):
      print(sp[i-j][2])
    c=1
for j in range(c):
  print(sp[n-1-j][2])

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
s = [(lambda x, v: (x, -int(v)))(*input().split()) for i in range(N)]
s2 = s.copy()

s.sort()

print(s)
for i in s:
    print(s2.index(i)+1)


N = int(input())
s = [(lambda x, v: (x, -int(v)))(*input().split()) for i in range(N)]
s2 = s.copy()

s.sort()
for i in s:
    print(s2.index(i)+1)


Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
R = []
for i in range(N):
    s, p = input().split()
    R.append((s, -int(p), i))

R.sort()
print(R)
for i in R:
    print(i[2] + 1)


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

R.sort()
for i in R:
    print(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 functools import cmp_to_key
N = int(input())

my_list = []

for i in range(N):
    t, c = input().split()
    my_list.append((t, int(c), i+1))

def cmp(a, b):
    if a == b: return 0
    return -1 if a < b else 1

my_list.sort(key=cmp_to_key(lambda x, y: cmp(x[0], y[0]) or cmp(x[1], y[1])))

for mi in my_list:
    print(mi[2])

from functools import cmp_to_key
N = int(input())

my_list = []

for i in range(N):
    t, c = input().split()
    my_list.append((t, int(c), i+1))

def cmp(a, b):
    if a == b: return 0
    return -1 if a < b else 1

my_list.sort(key=cmp_to_key(lambda x, y: cmp(x[0], y[0]) or cmp(y[1],x[1])))

for mi in my_list:
    print(mi[2])

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
SP = []
name = []
for i in range(N):
    x = list(input().split())
    x = [x[0], int(x[1]), int(i)]
    name.append(x[0])
    SP.append(x)


# sort on secondary key
s = sorted(SP, key=lambda x: (x[0], x[1]),reverse=True)
# now sort on primary key, descending


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

N = int(input())
SP = []
name = []
for i in range(N):
    x = list(input().split())
    x = [x[0], int(x[1]), int(i)]
    name.append(x[0])
    SP.append(x)

sorted_name = sorted(SP)

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


N = int(input())
SP = []
name = []
for i in range(N):
    x = list(input().split())
    x = [x[0], int(x[1]), int(i)]
    name.append(x[0])
    SP.append(x)


# sort on secondary key
s = sorted(SP, key=lambda x: (x[0], x[1]))
# now sort on primary key, descending


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

N = int(input())
SP = []
name = []
for i in range(N):
    x = list(input().split())
    x = [x[0], int(x[1]), int(i)]
    name.append(x[0])
    SP.append(x)


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

for i in range(N):
    print(s[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())
data = [[i for i in input().split()] for j in range(N)]
for i in range(N):
    data[i].append(i+1)
sort_data = sorted(data)
print(sort_data)
start = sort_data[0][0]
num = [sort_data[0][2]]
for i in range(1,N):
    if sort_data[i][0] == start:
        num.append(sort_data[i][2])
    else:
        start = sort_data[i][0]
        for j in range(len(num)):
            print(num[len(num)-1-j])
        num = [sort_data[i][2]]
for j in range(len(num)):
    print(num[len(num)-1-j])  

N = int(input())
data = [[i for i in input().split()] for j in range(N)]
for i in range(N):
    data[i].append(i+1)
for j in data:
    j[1] = int(j[1])
sort_data = sorted(data)
start = sort_data[0][0]
num = [sort_data[0][2]]
for i in range(1,N):
    if sort_data[i][0] == start:
        num.append(sort_data[i][2])
    else:
        start = sort_data[i][0]
        for j in range(len(num)):
            print(num[len(num)-1-j])
        num = [sort_data[i][2]]
for j in range(len(num)):
    print(num[len(num)-1-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())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(int,input().split()))

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

N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))

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

N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))

B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

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

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

print(A.sort())

N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = map(str,input().split())
for i in range(N):
    A[i].append(str(i))

B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

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

#%%
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(int,input().split()))

print(A)

input_AP = list(map(int, input().split()))
print(result)

N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))
for i in range(N):
    A[i].append(str(i))


B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

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


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

A.sort()
print(A)


N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))
for i in range(N):
    A[i].append(str(i+1))
for i in range(N):
    A[i][1] = int(A[i][1]) 


B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

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


Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

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):
n = int(input())
sp = [list(input().split()) for _ in range(n)]
for i in range(len(sp)):
    sp[i][1] = int(sp[i][1])
d = sorted(sp, key=lambda x:(x[0],-x[1]))
for i in range(len(sp)):
    print(sp.index(d[i]))

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

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

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

d = sorted(sp, key=lambda x:(x[0],-x[1]))
for i in range(len(sp)):
    print(sp.index(d[i]))

n = int(input())
sp = [list(input().split()) for _ in range(n)]
for i in range(len(sp)):
    sp[i][1] = int(sp[i][1])
d = sorted(sp, key=lambda x:(x[0],-x[1]))
for i in range(len(sp)):
    print(sp.index(d[i])+1)

Verdicts: Wrong Answer

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

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


lst2 = sorted(lst, key=lambda x:(x[0],int(x[1])))
for p in range(n):
    print(lst[p][2])

n = int(input())
lst = [list(input().split())+[i+1] for i in range(n)]

#print(lst)

lst = sorted(lst, key= lambda x:(x[0],-int(x[1])))
print(lst)
for i in range(n):
   print(lst[i][2])


n = int(input())
lst = [list(input().split())+[i+1] for i in range(n)]


lst = sorted(lst, key= lambda x:(x[0],-int(x[1])))

for i in range(n):
   print(lst[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())
list1 = [(input() + " " + str(i+1)).split() for i in range(N)]
 
list1 = [a for a in lis]
 
list1.sort(key=lambda a: int(a[1]), reverse=True)
list1.sort(key=lambda a: a[0])
 
 
for i in list1:
    print(i[2])


N = int(input())
lis = [(input() + " " + str(i+1)).split() for i in range(N)]
 
lis = [k for k in lis]
 
lis.sort(key=lambda k: int(k[1]))
lis.sort(key=lambda k: k[0])
 
 
for i in lis:
    print(i[2])

N = int(input())
lis = [(input() + " " + str(i+1)).split() for i in range(N)]
 
lis = [k for k in lis]
 
lis.sort(key=lambda k: int(k[1]). reverse=True)
lis.sort(key=lambda k: k[0])
 
 
for i in lis:
    print(i[2])


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


Verdicts: 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):
package main

import (
	"fmt"
	"sort"
	"strconv"
)

type Restaurant struct {
	S string
	P int
	Idx int
}

func solve() {
	var ts string
	var N int
	fmt.Scan(&N)

	var restaurants []Restaurant
	for i := 0; i < N; i++ {
		var s string
		fmt.Scan(&s, &ts)
		p, _ := strconv.Atoi(s)
		restaurants = append(restaurants, Restaurant{s, p, i+1})
	}
	sort.SliceStable(restaurants, func(i, j int) bool {
		if restaurants[i].S != restaurants[j].S {
			return restaurants[i].S < restaurants[j].S
		}
		return restaurants[i].P > restaurants[j].P
	})
	for _, r := range restaurants {
		println(r.Idx)
	}
}

func main() {
	solve()
}


def main():
    N = int(input())
    data = []
    for i in range(N):
        s, p = input().split()

        data.append((s, 100 - int(p), i+1))

    for s, p, i in sorted(data):
        print(i)


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):
import numpy as np
N = int(input())
a = []
for i in range(N):
  S, P = input().split()
  a.append((S, 100-P, i+1))
a.sort()
for i in a:
  print(i[2])

  

import numpy as np
N = int(input())
a = []
for i in range(N):
  S, P = input().split()
  a.append((S, 100-int(P), i+1))
a.sort()
for i in a:
  print(i[2])

  

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
S = []
for n in range(N):
    S.append(input())
d={}
for s in S:
    s=s.split(" ")
    c=s[0]
    n=s[1]
    if c not in d:
        d[c]=[]
    d[c].append(n)
d_sorted=sorted(d.items(), key=lambda x:x[0])
for k in d_sorted:
    for p in k[1]:
        key = k[0] + " " + p
        print(S.index(key)+1)


N = int(input())
S = []
for n in range(N):
    S.append(input())
d={}
for s in S:
    s=s.split(" ")
    c=s[0]
    n=int(s[1])
    if c not in d:
        d[c]=[]
    d[c].append(n)

d_sorted=sorted(d.items(), key=lambda x:x[0])
for k in d_sorted:
    k[1].sort(reverse=True)
    for p in k[1]:
        key = k[0] + " " + str(p)
        print(S.index(key)+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())
lists=[list(input().split()) for x in range(n)]
for x in range(n):
  lists[x].append(x+1)
lists.sort(key=lambda x:x[1] reverse=True)
lists.sort(key=lambda x:x[0])
for x in range(n):
  print(lists[x][2])
           

n=int(input())
lists=[list(input().split()) for x in range(n)]
for y in range(n):
  lists[y].append(y+1)
lists.sort(key=lambda t:t[1] reverse=True)
lists.sort(key=lambda t:t[0])
for z in range(n):
  print(lists[z][2])

n=int(input())
lists=[list(input().split()) for x in range(n)]
for x in range(n):
  lists[x].append(x+1)
lists.sort(key=lambda t:t[1] reverse=True)
lists.sort(key=lambda t:t[0])
for x in range(n):
  print(lists[x][2])

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

n=int(input())
lists=[list(input().split()) for x in range(n)]
for x in range(n):
  a,b=input().split()
  lists.append([a,int(b),x+1])
lists.sort(key=lambda t:t[1],reverse=True)
lists.sort(key=lambda t:t[0])
for x in range(n):
  print(lists[x][2])

n=int(input())
for x in range(n):
  a,b=input().split()
  lists.append([a,int(b),x+1])
lists.sort(key=lambda t:t[1],reverse=True)
lists.sort(key=lambda t:t[0])
for x in range(n):
  print(lists[x][2])

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted