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())
info=[input().split() for i in range(N)] 
#print(info)
from operator import itemgetter
dic1={}
for i in range(len(info)):
    dic1[i+1]=info[i]
#print(dic1)
info1=sorted(info,key=lambda x:int(x[1]),reverse=True)
info2=sorted(info1,key=itemgetter(0))
print(info2)
for i in info2:
    for key,value in dic1.items():
        if value==i:
            print(key)


N=int(input())
info=[input().split() for i in range(N)] 
#print(info)
dic1={}
for i in range(len(info)):
    dic1[i+1]=info[i]
#print(dic1)
info1=sorted(info)
#print(info1)
for i in info1:
    for key,value in dic1.items():
        if value==i:
            print(key)


N=int(input())
info=[input().split() for i in range(N)] 
#print(info)
from operator import itemgetter
dic1={}
for i in range(len(info)):
    dic1[i+1]=info[i]
#print(dic1)
info1=sorted(info,key=lambda x:int(x[1]),reverse=True)
info2=sorted(info1,key=itemgetter(0))
#print(info2)
for i in info2:
    for key,value in dic1.items():
        if value==i:
            print(key)


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())
s=[]
for i in range(n):
  s.append(input().split())

spoint=sorted(s,key=lambda x:x[1], reverse=True)
scity=sorted(spoint,key=lambda x:x[0])
print(scity) 

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

anspoint=sorted(ans,key=lambda x:x[1], reverse=True)
anscity=sorted(anspoint,key=lambda x:x[0])

for i in anscity:
    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 _ in range(N):
    tmp = input().split()
    L.append((tmp[0],int(tmp[1])))

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

for i in L:
    print(i[1])

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

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
n=int(input())
data_origin=[input().split() for i in range(n)]
for i in range(n):
  data_origin[i][1] = int(data_origin[i][1])
data = sorted(data_origin, key=lambda x:x[1],reverse=True)
data = sorted(data, key=lambda x:x[0])
print(data)
for i in data:
  print(1+data_origin.index(i))

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
from collections import defaultdict
n = int(input())
restaurants = defaultdict(list)
for i in range(n):
    s, p = input().split()
    p = int(p)
    restaurants[s].append([p, i])

ans = [''] * n
cnt = 0
for k, v in sorted(restaurants.items(), key=lambda x: x[0]):
    for p, i in sorted(v, key=lambda x: -x[0]):
        cnt += 1
        ans[i] = cnt

for a in ans:
    print(a)

from collections import defaultdict
n = int(input())
restaurants = defaultdict(list)
for i in range(n):
    s, p = input().split()
    p = int(p)
    restaurants[s].append([p, i])

cnt = 0
for k, v in sorted(restaurants.items(), key=lambda x: x[0]):
    for p, i in sorted(v, key=lambda x: -x[0]):
        print(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())
l=[]
for i in range(N):
  l.append(list(input().split()))
  l[i][1]=int(l[i][1])
l1=sorted(l,key=lambda x:x[1],reverse=True)
l2=sorted(l,key=lambda x:x[0])
for i in range(N):
  print(l.index(l2[i])+1)

N=int(input())
l=[]
for i in range(N):
  l.append(list(input().split()))
  l[i][1]=int(l[i][1])
l1=sorted(l,key=lambda x:x[1],reverse=True)
l2=sorted(l1,key=lambda x:x[0])
for i in range(N):
  print(l.index(l2[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())
res = []
for i in range(n):
    s,p=map(str, input().split())
    res += [(s,int(p))]
res1=res
res.sort(key=lambda x:(x[0],-x[1]))
for i in range(n):
    print(res1.index(res[i])+1)



n=int(input())
res = []
for i in range(n):
    s,p=map(str, input().split())
    res += [(s,int(p))]
res1=res
res = sorted(res, key=lambda x:(x[0],-x[1]))
for i in range(n):
    print(res1.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):
N = int(input())
li = []
for i in range(N):
    si, pi = input().split()
    pi = int(pi)
    li +=[ [i, si, pi]]
li.sort(key=lambda x:x[2], reverse=True)
li.sort(key=lambda x:x[1], reverse=False)
for j in li:
    print(j[0])

N = int(input())
li = []
for i in range(N):
    si, pi = input().split()
    pi = int(pi)
    li +=[ [i+1, si, pi]]
li.sort(key=lambda x:x[2], reverse=True)
li.sort(key=lambda x:x[1], reverse=False)
for j in li:
    print(j[0])

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())

S, P = [], []
t = []
for i in range(N):
    s, p = input().split()
    S.append(s), P.append(int(p))
    t.append((s, int(p)))

ss = list(set(S))
ss.sort()

a = []
b = []
for i in ss:
    for s, p in t:
        if i == s:
            a.append(p)
    b.extend(sorted(a, reverse=True))
    a = []

print(P)
print(b)
for i in range(len(b)):
    for j in range(len(P)):
        if b[i] == P[j]:
            print(j+1)
            break

N = int(input())

S, P = [], []
t = []
for i in range(N):
    s, p = input().split()
    S.append(s), P.append(int(p))
    t.append((s, int(p)))

ss = list(set(S))
ss.sort()

a = []
b = []
for i in ss:
    for s, p in t:
        if i == s:
            a.append(p)
    b.extend(sorted(a, reverse=True))
    a = []

for i in range(len(b)):
    for j in range(len(P)):
        if b[i] == P[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):
N = int(input())
l = []
for i in range(N):
    a,b = input().split()
    l.append((a,-int(b),i+1))
    print(l)
l.sort()
for a,b,k in l:
    print(k)

N = int(input())
l = []
for i in range(N):
    a,b = input().split()
    l.append((a,-int(b),i+1))
l.sort()
for a,b,k in l:
    print(k)

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

sList = []
for i in range(n):
  sList.append(list(input().split())+[i+1])
  sList[i][1] = -1*int(sList[i][1])
sList.sort()

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


n = int(input())

sList = []
for i in range(n):
  sList.append(list(input().split())+[i+1])
  sList[i][1] = -1*int(sList[i][1])
sList.sort()

for i in sList:
  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 = input()
list = []

for i in range(n):
    print("str: ")
    sp = input().split()
    s = str(sp[0])
    p = int(sp[1])

    #s, p = sp[0], int(sp[1])
    list.append([i+1, s, p])
"""
list.append([1, "test2", 3])
list.append([2, "test3", 1])
list.append([3, "test1", 5])
list.append([4, "test1", 4])
"""

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



n = int(input())
list = []

for i in range(n):
    print("str: ")
    sp = input().split()
    s = str(sp[0])
    p = int(sp[1])

    #s, p = sp[0], int(sp[1])
    list.append([i+1, s, p])
"""
list.append([1, "test2", 3])
list.append([2, "test3", 1])
list.append([3, "test1", 5])
list.append([4, "test1", 4])
"""

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



n = int(input())
list = []

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

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



n = input()
list = []

for i in range(n):
    print("str: ")
    s,p = input().split()
    
    #s, p = sp[0], int(sp[1])
    list.append([i+1, s, p])
"""
list.append([1, "test2", 3])
list.append([2, "test3", 1])
list.append([3, "test1", 5])
list.append([4, "test1", 4])
"""

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



n = input()
list = []

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

list.sort(key=lambda x:(x[0],x[1]))
for l in list:
    print(l[0])



n = input()
list = []

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

list.sort(key=lambda x:(x[0],x[1]))
for l in list:
    print(l[0])



n = input()
list = []

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

list.sort(key=lambda x:(x[0],x[1]))
for l in list:
    print(l[0])



n = input()
list = []

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

list.sort(key=lambda x:(x[0],x[1]))
for l in list:
    print(l[0])



n = int(input())
list = []

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

list.sort(key=lambda x:(x[1],-x[2]))
for l in list:
    print(l[0])


Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

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())
s =[]
l =[]
ans = []
count = 1
for i in range(n):
    s1,p = map(str,input().split())
    p1 = int(p)
    l.append(s1)
    s.append(list([s1,p1]))
l = sorted(list(set(l)))
for i in l:
    t =[]
    index_num = [n for n, v  in enumerate(s) if v[0] == i]
    for k in index_num:
        t.append(list([s[k][1],k]))
    t=sorted(t,reverse=True)
    for z in t:
        ans.append(list([z[1],count]))
        count+=1
ans = sorted(ans)
[print(ans[i][1]) for i in range(len(ans))]

n=int(input())
s =[]
l =[]
ans = []
for i in range(n):
    s1,p = map(str,input().split())
    p1 = int(p)
    l.append(s1)
    s.append(list([s1,p1]))
l = sorted(list(set(l)))
for i in l:
    t =[]
    index_num = [n for n, v  in enumerate(s) if v[0] == i]
    for k in index_num:
        t.append(list([s[k][1],k]))
    t=sorted(t,reverse=True)
    for z in t:
        ans.append(z[1]+1)
[print(i) for i in ans]

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
def solve():
    n = input()
    s = []
    p = []
    m = defaultdict(list)
    mm = {}
    for i in range(0, int(n)):
        si, pi = map(str, input().split())
        s.append(si)
        p.append(int(pi))
        m[si].append(int(pi))
        mm[int(pi)] = i + 1
    s.sort()
    ss = set(s)
    sss = list(ss)
    sss.sort()
    for i in range (len(sss)):
        s2 = sss[i]
        pd = m[s2]
        pd.reverse()
        for j in range (len(pd)):
            
            print(mm[pd[j]])


if __name__ == "__main__":
    solve()

    


from collections import defaultdict
def solve():
    n = input()
    s = []
    m = defaultdict(list)
    mm = {}
    for i in range(0, int(n)):
        si, pi = map(str, input().split())
        s.append(si)
        m[si].append(int(pi))
        mm[int(pi)] = i + 1
    ss = set(s)
    sss = list(ss)
    sss.sort()
    for i in range (len(sss)):
        s2 = sss[i]
        pd = m[s2]
        pd.sort()
        pd.reverse()
        for j in range (len(pd)):
            print(mm[pd[j]])


if __name__ == "__main__":
    solve()

    


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


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


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


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


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


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

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

Submission attempts (in order):
N=int(input())

SP=[]
for i in range(N):
    SP.append(input().split())
    SP[i][1] = int(SP[i][1])
    SP[i].append(i)
    print(SP)

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

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


N=int(input())

SP=[]
for i in range(N):
    SP.append(input().split())
    SP[i][1] = int(SP[i][1])
    SP[i].append(i)
    #print(SP)

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

for j in range(N):
    print(SP[j][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 sys import stdin
from collections import defaultdict
from collections import OrderedDict

N = int(input())
lines = stdin.readlines()

dic = defaultdict(dict)

for i, line in enumerate(lines):
    line = line.strip().split()
    dic[line[0]][i+1] = int(line[1])


#    print(i,":",dic[i])

sorted(dic, key=str.lower)
for k in dic.keys():
    dick = dic[k]
#    print(dick)
    dick = OrderedDict(sorted(dick.items(), key = lambda x:x[1]))
#    print(dick)
    for i in dick.keys():
        print(i)


from sys import stdin
from collections import defaultdict

lines = stdin.readlines()

dic = defaultdict(dict)

for i, line in enumerate(lines):
    line = line.strip().split()
    if i > 0:
        dic[line[0]][i] = (int(line[1]))
sorted(dic, key=str.lower)
for k in dic.keys():
        for i in dic[k].keys():
                print(i)




from sys import stdin
from collections import defaultdict

N = int(input())
lines = stdin.readlines()

dic = defaultdict(dict)

for i, line in enumerate(lines):
    line = line.strip().split()
    if i==0:
        tuple1 = ([i+1, line[0], int(line[1])],)
    else:
        tuple1 = tuple1 + ([i+1, line[0], int(line[1])],)


#print(tuple1)

tuple1 = sorted(tuple1, key = lambda x:x[2], reverse=True)
result = sorted(tuple1, key = lambda x:x[1])
print(result)

from sys import stdin
from collections import defaultdict

N = int(input())
lines = stdin.readlines()

dic = defaultdict(dict)

for i, line in enumerate(lines):
    line = line.strip().split()
    if i==0:
        tuple1 = ([i+1, line[0], int(line[1])],)
    else:
        tuple1 = tuple1 + ([i+1, line[0], int(line[1])],)


#print(tuple1)

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

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):
def Guide():
    N = int(input())
    lst = []
    for i in range(1, N + 1):
        city, score = input().split()
        lst.append([city, int(score), i])
    sorted_lst = sorted(lst, key=lambda x:(x[0], x[1]))

    for l in sorted_lst:
        print(l[2])


Guide()


def Guide():
    N = int(input())
    lst = []
    for i in range(1, N + 1):
        city, score = input().split()
        lst.append([city, int(score), i])
    sorted_lst = sorted(lst, key=lambda x:(x[0], -x[1]))

    for l in sorted_lst:
        print(l[2])


Guide()


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())
listA=[[] for i in range(N)]
listANS=[]
for i in range(N):
  S,P=input().split()
  listA[i]+=[S,int(P),i+1]
listA.sort()
for i in range(1,N):
  before=0
  if listA[i-1][0]!=listA[i][0] or i==N-1:
    listN=listA[before:i+1]
    listN.sort(key=itemgetter(1),reverse=True)
    listANS+=listN
    before=i
for i in range(N):
  print(listANS[i][2])

from operator import itemgetter
N=int(input())
listA=[[] for i in range(N)]
listANS=[]
for i in range(N):
  S,P=input().split()
  listA[i]+=[S,int(P),i+1]
listA.sort()
print(listA)
before=0
for i in range(1,N):
  if listA[i-1][0]!=listA[i][0]:
    listN=listA[before:i]
    listN.sort(key=itemgetter(1),reverse=True)
    listANS+=listN
    before=i

  if i==N-1:
    listN=listA[before:N]
    listN.sort(key=itemgetter(1),reverse=True)
    listANS+=listN

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

N = int(input())
a = [input().split() +[i+1] for i in range(N)]
a = sorted(a ,key=lambda x:(x[0], -int(x[1])))
 
for i in range(N):
  print(a[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):
from operator import itemgetter, attrgetter

a = int(input())
b = []
for i in range(a):
    c = input().split()
    b.append((c[0], int(c[1]), i+1))
s = sorted(b, key=itemgetter(0))
sorted(s, key=itemgetter(1), reverse=True)
for i in s:
    print(i[-1])



from operator import itemgetter, attrgetter

a = int(input())
b = []
for i in range(a):
    c = input().split()
    b.append((c[0], int(c[1]), i+1))
s = sorted(b, key=itemgetter(0))
s = sorted(s, key=itemgetter(1), reverse=True)

for i in s:
    print(i[-1])



from operator import itemgetter, attrgetter

a = int(input())
b = []
for i in range(a):
    c = input().split()
    b.append((c[0], int(c[1]), i+1))
s = sorted(b, key=itemgetter(1), reverse=True)
#print(s)
f = sorted(s, key=itemgetter(0), reverse=False)
#print(f)

for i in f:
    print(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):
n = int(input())
*a, = [input().split() for i in range(n)]

for i in range(n):
    a[i].append(i+1)

a_point = sorted(a, key = lambda x: int(x[1]), reverse = True)
print(a_point)
a_name = sorted(a_point, key = lambda x: x[0])
print(a_name)
ans = []

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

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

for i in range(n):
    a[i].append(i+1)

b = sorted(a, key = lambda x:int(x[1]), reverse = True)
c = sorted(b, key = lambda x:x[0])

for i in c:
    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):
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

def main():
    N = II()
    li = []
    for i in range(N):
        S, P = LS()
        li.append([S, int(P), i])

    li = sorted(li, key= lambda x: (x[0], -x[1]))
    print(li)
    for j in li:
        print(j[2]+1)

main()

import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

def main():
    N = II()
    li = []
    for i in range(N):
        S, P = LS()
        li.append([S, int(P), i])

    li = sorted(li, key= lambda x: (x[0], -x[1]))
    for j in li:
        print(j[2]+1)

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

L = [[] for _ in range(N)]

for i in range(N):
    a, b = input().split()
    b = int(b)
    L[i].append(a)
    L[i].append(b)


sort_L = sorted(L)

for i in range(N-1):
    for j in range(i+1, N):
        if sort_L[i][0] == sort_L[j][0]:
            if sort_L[i][1] <= sort_L[j][1]:
                sort_L[i], sort_L[j] = sort_L[j], sort_L[i]

for i in range(N):
    for j in range(N):
        if L[i] == sort_L[j]:
            print(sort_L.index(L[i])+1)

N = int(input())
table = []
for i in range(N):
    tmp = list(input().split())
    tmp[1] = int(tmp[1]) * (-1)
    tmp_table = [tmp, i+1]
    table.append(tmp_table)
table.sort()
for i in range(N):
    print(table[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 sys import stdin
from copy import deepcopy


n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
for i, list in enumerate(data):
    list[1] = int(list[1])
    list.append(i+1)

sortdata = sorted(data, key=lambda x: (x[0], -x[1]))
print(sortdata)

for i, list in enumerate(sortdata):
    print(list[2])


from sys import stdin
from copy import deepcopy


n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
for i, list in enumerate(data):
    list[1] = int(list[1])
    list.append(i+1)

sortdata = sorted(data, key=lambda x: (x[0], -x[1]))

for i, list in enumerate(sortdata):
    print(list[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 = [0]*n
p = [0]*n

list_2d = [[] for _ in range(n)]

for i in range(n):
    s, p = input().split()
    list_2d[i].append(s)
    list_2d[i].append(p)
list_2d_sorted = sorted(list_2d, key = lambda x: (x[0],x[1]))
for i in range(n):
    print(list_2d.index(list_2d_sorted[i])+1)

n = int(input())
list_2d = [[] for _ in range(n)]

for i in range(n):
    s, p = input().split()
    list_2d[i].append(s)
    list_2d[i].append(p)
list_2d_sorted = sorted(list_2d, key = lambda x: (x[0],-int(x[1])))
for i in range(n):
    print(list_2d.index(list_2d_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):
import numpy as np

n = int(input())
num_list = [i for i in range(n)]
city_list = []
point_list = []

for _ in range(n):
  temp = input().split()
  city_list.append(temp[0])
  point_list.append(int(temp[1]))
  
city_set = list(set(city_list))
city_set.sort()

ans=[]
for name in city_set:
  temp = list(filter(lambda x:city_list[x]==name,range(n)))
  temp_num = [num_list[i] for i in temp]
  temp_point = [point_list[i] for i in temp]
  #print(temp_num)
  #print(temp_point)
  while len(temp_num)!=0:
    ans.append(temp_num[np.argmax(temp_point)]+1)
    #print(temp_num[np.argmax(temp_point)])
    del temp_num[np.argmax(temp_point)]
    del temp_point[np.argmax(temp_point)]
for i in ans:
  print(ans)

import numpy as np

n = int(input())
num_list = [i for i in range(n)]
city_list = []
point_list = []

for _ in range(n):
  temp = input().split()
  city_list.append(temp[0])
  point_list.append(int(temp[1]))
  
city_set = list(set(city_list))
city_set.sort()

ans=[]
for name in city_set:
  temp = list(filter(lambda x:city_list[x]==name,range(n)))
  temp_num = [num_list[i] for i in temp]
  temp_point = [point_list[i] for i in temp]
  #print(temp_num)
  #print(temp_point)
  while len(temp_num)!=0:
    ans.append(temp_num[np.argmax(temp_point)]+1)
    #print(temp_num[np.argmax(temp_point)])
    del temp_num[np.argmax(temp_point)]
    del temp_point[np.argmax(temp_point)]
for i in ans:
  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):
count = int(input())

sonomama = []
city = {}
for i in range(count):
    score = input().split()
    sonomama.append(' '.join(score))
    if score[0] not in city:
        city[score[0]] = []
    city[score[0]].append(score[1])

city = sorted(city.items())
print(city)

for item in city:
    holder = sorted(item[1], reverse=True)
    print(holder)
    for i in range(len(item[1])):
        print(sonomama.index(item[0]+' '+holder[i])+1)


count = int(input())

sonomama = []
city = {}
for i in range(count):
    score = input().split()
    sonomama.append(' '.join(score))
    if score[0] not in city:
        city[score[0]] = []
    city[score[0]].append(score[1])

city = sorted(city.items())

for item in city:
    holder = sorted(map(int, item[1]), reverse=True)
    for i in range(len(item[1])):
        print(sonomama.index(item[0]+' '+str(holder[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())
SP = []
for i in range(N):
    s, p = input().split()
    p = int(p)
    SP.append((s, -n, i))
SP.sort()

for s, n, i in SP:
    print(i+1)



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

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

print(guide)


from operator import itemgetter
N = int(input())
guide = []
for i in range(N):
  lst = input().split(' ')
  guide.append([i+1,lst[0],int(lst[1])])
guide = sorted(guide, key=itemgetter(2),reverse=True)
guide = sorted(guide, key=itemgetter(1))
for i in range(N):
  print(guide[i][0])


Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
restraunt = [[] for i in range(n)]
for i in range(n):
    s, p = input().split()
    p = int(p)
    restraunt[i] = [i, s, p]
restraunt.sort(key = lambda restraunt: (restraunt[1], restraunt[2]), reverse = True)
for i in range(n):
    print(restraunt[i][0])

n = int(input())
restraunt = [[] for i in range(n)]
for i in range(n):
    s, p = input().split()
    p = int(p)
    restraunt[i] = [i, s, p]
restraunt.sort(key = lambda restraunt: (restraunt[1], restraunt[2]), reverse = True)
print(restraunt)

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

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())
inp = [input() for i in range(N)]

import numpy as np

s_list = []
p_list = []
#sp_list = []
for i in inp:
    s_list.append(i.split()[0])
    p_list.append(int(i.split()[1]))
    #sp_list.append(i.split())
sp_list = []
for i in range(N):
    sp_list.append([s_list[i],p_list[i]])


sort_sp_list = sorted(sp_list)


s_type = sorted(list(set(s_list)))
tmp_list = []
for type in s_type:
    tmp_list.append(sorted([s for s in sort_sp_list if s[0] == type],reverse=True))
rank_list = np.array(tmp_list).reshape(N,2).tolist()

for i in [i.split() for i in inp]:
    print(rank_list.index(i)+1)


N = int(input())
inp = [input() for i in range(N)]

import numpy as np

s_list = []
p_list = []
for i in inp:
    s_list.append(i.split()[0])
    p_list.append(int(i.split()[1]))

sp_list = []
for i in range(N):
    sp_list.append([s_list[i],p_list[i]])


sort_sp_list = sorted(sp_list)


s_type = sorted(list(set(s_list)))
tmp_list = []
for type in s_type:
    tmp_list.append(sorted([s for s in sort_sp_list if s[0] == type],reverse=True))

rank_list = []
for tmp in tmp_list:
    for l in tmp:
        rank_list.append(l)

for sp in sp_list:
    print(rank_list.index(sp)+1)

N = int(input())
inp = [input() for i in range(N)]

import numpy as np

s_list = []
p_list = []
for i in inp:
    s_list.append(i.split()[0])
    p_list.append(int(i.split()[1]))

sp_list = []
for i in range(N):
    sp_list.append([s_list[i],p_list[i]])


sort_sp_list = sorted(sp_list)


s_type = sorted(list(set(s_list)))
tmp_list = []
for type in s_type:
    tmp_list.append(sorted([s for s in sort_sp_list if s[0] == type],reverse=True))

rank_list = []
for tmp in tmp_list:
    for l in tmp:
        rank_list.append(l)

for rank in rank_list:
    print(sp_list.index(rank)+1)


Verdicts: Runtime Error

Wrong Answer

Accepted