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

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

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

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

for e in sp:
    print(e[2])

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
l = []
for i in range(N):
    a = input().split()
    l.append([a[0], a[1], i + 1])
l.sort()
for i in range(N):
    print(l[i][2])


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

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


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())
SP=[]
for i in range(N):
  a, b=input().split()
  SP+=[[a,int(b)]]
SP.sort()
for i in range(N):
  print(SP[i][0],SP[i][1])

N=int(input())
SP=[]
for i in range(N):
  a, b=input().split()
  SP+=[[a,int(b)]]
SP2=sorted(range(N), key=lambda x: (SP[x][0], -SP[x][1]))
for i in range(N):
  print(SP2[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 = input().split()
    p = int(p)
    res.append([i+1, s, p])

res = sorted(res, key=lambda x: (x[2], x[1]), reverse=True)
for r in res:
    print(r[0])

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

res = sorted(res, key=lambda x: (x[1], x[2]), reverse=True)
for r in res:
    print(r[0])

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

res = sorted(res, key=lambda x:x[2], reverse=True)
res = sorted(res, key=lambda x:x[1], reverse=False)
for r in res:
    print(r[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())
x = [list(map(str,input().split())) for i in range(n)]
for i in range(n):
    x[i][1]=int(x[i][1])
a = [i for i in range(1,n+1)]
a = sorted(a,key=lambda y:(x[y-1][0],x[y-1][1]),reverse=True)
for i in a:
    print(i)

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

s = [list(map(str, input().split())) for _ in range(n)]
for row in s:
    row[1] = int(row[1])
ss = sorted(s)
print(ss)
ins = 0
ans = list()
tmp = 0
for i in ss:
    if i[0] == tmp:
        ans.insert(ins,i)
    else:
        ins = len(ans)
        ans.append(i)
        tmp = i[0]
print(ans)


n = int(input())

s = [list(map(str, input().split())) for _ in range(n)]
for row in s:
    row[1] = int(row[1])
ss = sorted(s)
ins = 0
ans = list()
tmp = 0
for i in ss:
    if i[0] == tmp:
        ans.insert(ins,i)
    else:
        ins = len(ans)
        ans.append(i)
        tmp = i[0]
for j in ans:
    print(s.index(j)+1)


Verdicts: Wrong Answer

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

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

sorted_R=sorted(R,key = itemgetter(1),reverse=True)
sorted_R=sorted(sorted_R, key = itemgetter(0))
print(sorted_R)
for i in range(len(R)):
    for j in range(len(R)):
        if R[j]==sorted_R[i]:
            print(j+1)

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

sorted_R=sorted(R,key = itemgetter(1),reverse=True)
sorted_R=sorted(sorted_R, key = itemgetter(0))

for i in range(len(R)):
    for j in range(len(R)):
        if R[j]==sorted_R[i]:
            print(j+1)

Verdicts: Wrong Answer

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

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

k = []
city = []
point = []
point_city = 500
for i in range(N):
    k.append(list(map(str,input().split())))

for i in range(N):
    city.append(k[i][0])
for i in range(N):
    point.append(0)
city = set(city)
sorted(city)
print(city)
city = list(city)
for i in range(N):
    point[i] += ((city.index(k[i][0]))*100*point_city)
    point[i] += int((k[i][1]))
print(point)

for i in range(N):
    a = max(point)
    print((point.index(max(point)))+1)
    point[point.index(max(point))] = 0


N = int(input())

k = []
city = []
point = []
point_city = 500
for i in range(N):
    k.append(list(map(str,input().split())))

for i in range(N):
    city.append(k[i][0])
for i in range(N):
    point.append(0)
city = set(city)
sorted(city)
print(city)
city = list(city)
for i in range(N):
    point[i] += ((city.index(k[i][0]))*100*point_city)
    point[i] += int((k[i][1]))
print(point)

for i in range(N):
    a = max(point)
    print((point.index(max(point)))+1)
    point[point.index(max(point))] = 0


N = int(input())
ls = []
for i in range(N):
  s,p = input().spiit()
  p = int(p)
  ls.append([s,-p,i+1])
ls.sort()
for i in range(len(ls)):
  print(ls[2])

N = int(input())

k = []
city = []
point = []
point_city = 500
for i in range(N):
    k.append(list(map(str,input().split())))

for i in range(N):
    city.append(k[i][0])
for i in range(N):
    point.append(0)
city = set(city)
sorted(city)
print(city)
city = list(city)
for i in range(N):
    point[i] += ((city.index(k[i][0]))*100*point_city)
    point[i] += int((k[i][1]))
print(point)

for i in range(N):
    a = max(point)
    print((point.index(max(point)))+1)
    point[point.index(max(point))] = 0


N = int(input())
ls = []
for i in range(N):
  s = input().split()
  ls.append([s[0],-int(s[1]),i+1])
ls.sort()
for i in range(N):
  print(ls[i][2])

Verdicts: Wrong Answer

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

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


n=int(input())
s=[]
for i in range(n):
    s.append(input().split()+[str(i+1)])
print(s)
s=sorted(s)
print(s)
for i in range(n):
    print(s[i][-1])


n=int(input())
s=[]
for i in range(n):
    tmp=input().split()
    tmp[1]=100-int(tmp[1])
    s.append(tmp+[str(i+1)])
print(s)
s=sorted(s)
print(s)

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


n=int(input())
s=[]
for i in range(n):
    tmp=input().split()
    tmp[1]=100-int(tmp[1])
    s.append(tmp+[str(i+1)])
s=sorted(s)

for i in range(n):
    print(s[i][-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())

list = []

for i in range(N):
    A, B = input().split()

    A = A + "000000000000"
    A = A[:10]
    B = str(2000-int(B))+str(i+1001)
    list.append(A+B)

list = merge_sort(list)

for i in list:
    print(int(i[-3:]))


def merge_sort(arr):
    if len(arr) <= 1:
        return arr

    mid = len(arr) // 2
    
    left = arr[:mid]
    right = arr[mid:]

    
    left = merge_sort(left)
    right = merge_sort(right)

    
    return merge(left, right)


def merge(left, right):
    merged = []
    l_i, r_i = 0, 0

    
    while l_i < len(left) and r_i < len(right):
        
        if left[l_i] <= right[r_i]:
            merged.append(left[l_i])
            l_i += 1
        else:
            merged.append(right[r_i])
            r_i += 1

    
    if l_i < len(left):
        merged.extend(left[l_i:])
    if r_i < len(right):
        merged.extend(right[r_i:])
    return merged



N = int(input())
 
list = []
 
for i in range(N):
    A, B = input().split()
 
    A = A + "000000000000"
    A = A[:10]
    B = str(2000-int(B))+str(i+1001)
    list.append(A+B)
 
list = merge_sort(list)
 
for i in list:
    print(int(i[-3:]))

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

a = sorted([input().split() + [str(i+1)] for i in range(n)])

a.append(['end', '0', '0'])

tmp = []
ans = []

for i in range(n):
    tmp.append(a[i])
    if a[i][0] != a[i+1][0]:
        ans.append(sorted(tmp, key=lambda x: int(x[1]), reverse=True))
        tmp = []

[print(c[2]) for c in ans[0]]


n = int(input())


def f(n):
    n[1] = int(n[1])
    return n


a = sorted([input().split() + [str(i+1)] for i in range(n)])

a.append(['end', '0', '0'])

tmp = []
ans = []

for i in range(n):
    tmp.append(a[i])
    if a[i][0] != a[i+1][0]:
        ans.append(sorted(tmp, key=lambda x: int(x[1]), reverse=True))
        tmp = []

for c in ans:
    for d in c:
        print(d[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 = []
cnt = 0
for _ in range(N):
    cnt += 1
    i,p = input().split()
    S.append([i,int(p),cnt+1])

S.sort(reverse = True)

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

N = int(input())
S = []
cnt = 0
for _ in range(N):
    cnt += 1
    i,p = input().split()
    S.append([i,int(p),cnt])

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

for i in S:
  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):
my_list = []
for i in range(1,N+1):
    l = list((input().split()))
    l.append(i)
    my_list.append(l)

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



N = int(input())
my_list = []
for i in range(1,N+1):
    l = list((input().split()))
    l.append(i)
    my_list.append(l)
 
my_list2 = sorted(my_list, key=lambda x:(x[0],-int(x[1])))
for i in my_list2:
  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())
rs = [input().split() for _ in range(n)]
rs = [(r, int(p)) for r, p in rs]
srs = sorted(sorted(rs, key=lambda p: p[1]), key=lambda p: p[0])

for p in rs:
  print(srs.index(p)+1)

n = int(input())
rs = [input().split() for _ in range(n)]
rs = [(r, int(p)) for r, p in rs]
srs = sorted(sorted(rs, key=lambda p: p[1], reverse=True), key=lambda p: p[0])
 
for p in srs:
  print(rs.index(p)+1)

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
S_list = []
P_list = []
c = []

for i in range(N):
    S, P = input().split()
    S_list.append(S)
    P_list.append(int(P))

m = S_list
m = list(set(m))
m = sorted(m)
print(m)
n = 0
a = []
b = []
for i in m:
    for j in range(N):
        if i == S_list[j]:
            a.append(j)
    n = len(a)
    if n != 1:
        for o in range(n):
            b.append(P_list[a[o]])
        print(b)
        b = sorted(b, reverse = True)
        for k in b:
            for l in range(N):
                if k == P_list[l]:
                    c.append(l)
    else:
        c.append(a[0])


    a = []
    b = []

for i in c:
    print(i + 1)


        
            



     



N = int(input())
S_list = []
P_list = []
c = []

for i in range(N):
    S, P = input().split()
    S_list.append(S)
    P_list.append(int(P))

m = S_list
m = list(set(m))
m = sorted(m)
print(m)
n = 0
a = []
b = []
for i in m:
    for j in range(N):
        if i == S_list[j]:
            a.append(j)
    n = len(a)
    if n != 1:
        for o in range(n):
            b.append(P_list[a[o]])
        print(b)
        b = sorted(b, reverse = True)
        for k in b:
            for l in range(N):
                if k == P_list[l]:
                    c.append(l)
    else:
        c.append(a[0])


    a = []
    b = []

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


        
            



     



N = int(input())
S_list = []
P_list = []
c = []

for i in range(N):
    S, P = input().split()
    S_list.append(S)
    P_list.append(int(P))

m = S_list
m = list(set(m))
m = sorted(m)

n = 0
a = []
b = []
for i in m:
    for j in range(N):
        if i == S_list[j]:
            a.append(j)
    n = len(a)
    if n != 1:
        for o in range(n):
            b.append(P_list[a[o]])
        b = sorted(b, reverse = True)
        for k in b:
            for l in range(N):
                if k == P_list[l]:
                    c.append(l)
    else:
        c.append(a[0])


    a = []
    b = []

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


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


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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
SP = []
for i in range(N):
    S, P = map(str, input().split())
    SP.append([S, int(P), i+1])

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

for e in SP:
    print(e[2])
    
print(SP)

N = int(input())
SP = []
for i in range(N):
    S, P = map(str, input().split())
    SP.append([S, int(P), i+1])

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

for e in SP:
    print(e[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=[]
for i in range(n):
    a=list(map(str,input().split()))
    a.append(i+1)
    sp.append(a)
    
sp=sorted(sp,key=lambda x:(x[0],x[1]))

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



n=int(input())

sp=[]
for i in range(n):
    a=list(map(str,input().split()))
    a.append(i+1)
    sp.append(a)
    
sp=sorted(sp,key=lambda x:int(x[1]),reverse=True)
sp=sorted(sp,key=lambda x:x[0])

for i in range(len(sp)):
    print(sp[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())
Lis = []
for i in range(N):
	S, P = input().split()
	Lis.append([i+1, S, int(P)])
print (Lis)
Lis = sorted(Lis, key = lambda x: (x[1], -x[2]))
print (Lis)
for i in range(N):
	print(Lis[i][0])

N = int(input())
Lis = []
for i in range(N):
	S, P = input().split()
	Lis.append([i+1, S, int(P)])
Lis = sorted(Lis, key = lambda x: (x[1], -x[2]))
for i in range(N):
	print(Lis[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 = input()
lst = []
for i in range(N):
  s, p = map(int, input().split())
  lst.append([s, p])
  lst_2 = sort(key = lambda x : (x[0], -1 * int(x[1])))
  
for i in lst_2:
  print(i[2] + 1)

N = input()
lst = []
for i in range(N):
  s, p = map(int, input().split())
  lst.append([s, p, i])
  lst_2 = sort(key = lambda x : (x[0], -1 * int(x[1])))
  
for i in lst_2:
  print(i[2] + 1)

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

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

n = int(input())
sp = []
for i in range(n):
    s,p = input().split()
    sp.append([s,int(p),i+1])
sp.sort(key = lambda sp:(sp[0],-sp[1]))
for i in sp: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):
# coding: utf-8
n = int(input())
ll = []
d = {}
in_k = []
for i in range(n):
    s, p = map(str, input().split())
    if not s in d:
        d[s] = [[int(p), i+1]]
    else:
        d[s].append([int(p), i+1])
    if not s in in_k:
        in_k.append(s)
tmp = 1
num = 1
keys = sorted(d.keys())
for k in keys:
    d[k].sort(key=lambda x: x[0], reverse=True)
    for i in range(len(d[k])):
        d[k][i].append(num)
        num += 1
    d[k].sort(key=lambda x: x[1])
for k in d.keys():
    for j in range(len(d[k])):
        ll.append(d[k][j][1:])
ll.sort(key=lambda x: x[0])
for l in ll:
        print(l[1])

# coding: utf-8
n = int(input())
ll = []
d = {}
in_k = []
for i in range(n):
    s, p = map(str, input().split())
    if not s in d:
        d[s] = [[int(p), i+1]]
    else:
        d[s].append([int(p), i+1])
    if not s in in_k:
        in_k.append(s)
tmp = 1
num = 1
keys = sorted(d.keys())
for k in keys:
    d[k].sort(key=lambda x: x[0], reverse=True)
    for i in range(len(d[k])):
        d[k][i].append(num)
        num += 1
    d[k].sort(key=lambda x: x[1])
for k in d.keys():
    for j in range(len(d[k])):
        ll.append(d[k][j][1:])
ll.sort(key=lambda x: x[1])
for l in ll:
        print(l[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())
di = {}
li = []
for x in range(n):
    input_data = list(input().split())
    if input_data[0] not in di:
        di[input_data[0]] = {int(input_data[1]): x}
        li.append(input_data[0])
    else:
        di[input_data[0]][int(input_data[1])] = x

li.sort()
print(di)
for res in li:
    point_di = di[res]
    point_di_sorted = sorted(point_di.items(), key=lambda x:-x[0])
    for _,rank in point_di_sorted:
        print(rank + 1)


n = int(input())
di = {}
li = []
for x in range(n):
    input_data = list(input().split())
    if input_data[0] not in di:
        di[input_data[0]] = {int(input_data[1]): x}
        li.append(input_data[0])
    else:
        di[input_data[0]][int(input_data[1])] = x

li.sort()
for res in li:
    point_di = di[res]
    point_di_sorted = sorted(point_di.items(), key=lambda x:-x[0])
    for _,rank in point_di_sorted:
        print(rank + 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):
  a, b = input().split()
  b = int(b)
  lis = []
  lis.append(a)
  lis.append(b)
  lis.append(i)
  L.append(lis)
L.sort()
for i in L:
  print(i[2])

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

for i in range(N):
  a, b = input().split()
  b = int(b)
  lis = []
  lis.append(a)
  lis.append(0-b)
  lis.append(i)
  L.append(lis)
L.sort()
for i in L:
  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):
N = int(input())
sp = {}
for i in range(N):
    s, p = input().split()
    p = int(p)
    if s not in sp:
        sp[s] = []
    sp[s].append(p)

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

for s in sp:
    for pp in s[1]:
        print("{} {}".format(s[0], pp))

N = int(input())
sp = {}
co = 1
for i in range(N):
    s, p = input().split()
    p = int(p)
    if s not in sp:
        sp[s] = []
    sp[s].append((p,co))
    co = co + 1

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

for s in sp:
    s[1].sort()
    s[1].reverse()
    for pp in s[1]:
        print(pp[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):
    s,p=input().split()
    L.append(s,-int(p),i+1)
for l in sorted(L):
    print(l[2])

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

Verdicts: Runtime Error

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

Submission attempts (in order):
n = int(input())
a = []
for i in range(1, n+1):
    s,p = map(str,input().split())
    a.append((s,int(p),i))
a.sort()
print(a)
ans = [a[0][2]]
k = 0
for i in range(1,n):
    if a[i-1][0] == a[i][0]:
        ans.insert(k,a[i][2])
    else:
        k = i
        ans.append(a[i][2])

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





n = int(input())
a = []
for i in range(1, n+1):
    s,p = map(str,input().split())
    a.append((s,int(p),i))
a.sort()
ans = [a[0][2]]
k = 0
for i in range(1,n):
    if a[i-1][0] == a[i][0]:
        ans.insert(k,a[i][2])
    else:
        k = i
        ans.append(a[i][2])

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())
town_names = dict()
assessments = []
for x in range(N):
  if x!=N:
    SP = input().split()
    assessments.append(SP[1])
    town_names.setdefault(SP[0],[]).append(assessments.index(SP[1])+1)
  else:
    break
result = []
for t in sorted(town_names):
  tmp = []
  for pointer in town_names[t]:
    tmp.append(assessments[pointer-1])
  for x in sorted(tmp, reverse=True,key=int):
    result.append(assessments.index(x)+1)
  tmp = []
print(result)


N = int(input())
town_names = dict()
assessments = []
for x in range(N):
  if x!=N:
    SP = input().split()
    assessments.append(SP[1])
    town_names.setdefault(SP[0],[]).append(assessments.index(SP[1])+1)
  else:
    break
result = []
for t in sorted(town_names):
  tmp = []
  for pointer in town_names[t]:
    tmp.append(assessments[pointer-1])
  for x in sorted(tmp, reverse=True,key=int):
    result.append(assessments.index(x)+1)
  tmp = []
for x in result:
  print(x)


Verdicts: Wrong Answer

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

Submission attempts (in order):
a = [int(input()) for i in range(1)]
n = a[0]
restaurants = [list(input().split()) for i in range(n)]
#print(restaurants)

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

sorted_r = sorted(restaurants, key=lambda x: x[0])


for s in sorted_r:
  print(restaurants.index(s) + 1)

# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
SP = [sr().split() for _ in range(N)]
SP = [(s, 100 - int(p), i) for i, (s, p) in enumerate(SP, 1)]
SP.sort(key=lambda x: (x[0], x[1]))
for s, p, i in SP:
    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())
List=[[i+1]+input().split() for i in range(N)]
List.sort(key=lambda x:(x[1],int(x[2])))
for s,r,t in List:
          print(s)

N=int(input())
List=[[i+1]+input().split() for i in range(N)]
List.sort(key=lambda x:(x[1],-int(x[2])))
for s,r,t in List:
          print(s)

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,m = map(int,input().split())
ls = []
switch = []
for i in range(n):
    switch.append(i+1)
for i in range(m):
    ks = list(map(int,input().split()))
    ls.append(ks)
p = list(map(int,input().split()))


pattern = []
for i in range(2**n):
    pattern.append(list(bin(i)[2:].zfill(n)))

ans = 0

for i in pattern:
    turn = []
    count = 0
    on = 0
    for j in range(n):
        if i[j] == '1':
            turn.append(switch[j])
    for k in range(m):
        for l in range(1,ls[k][0]+1):
            if ls[k][l] in turn:
                count += 1
        if count % 2 == p[k]:
            on += 1
    if on == m:
        ans += 1
            
print(ans)

number = int(input())
review_list = []

for i in range(number):
    review = input().split()
    review_list.append(review)
    
review_lists = sorted(review_list, key=lambda x: x[0])

count = 0
count_list = []
for i in range(number-1):
    if review_lists[i][0] == review_lists[i+1][0]:
        if int(review_lists[i][1]) < int(review_lists[i+1][1]):
            review_lists[i][1], review_lists[i+1][1] = review_lists[i+1][1],review_lists[i][1]
            count_list.append(count)
    count += 1
        
answer = []

for i in review_lists:
    answer.append(number - review_list.index(i))
    
for i in count_list:
    answer[i],answer[i+1]=answer[i+1],answer[i]    
  
for i in answer:
    print(i)

number = int(input())
review_list = []

for i in range(number):
    review = input().split()
    review_list.append(review)
    
review_lists = sorted(review_list, key=lambda x: x[0])

for i in range(number-1):
    if review_lists[i][0] == review_lists[i+1][0]:
        if int(review_lists[i][1]) < int(review_lists[i+1][1]):
            review_lists[i][1], review_lists[i+1][1] = review_lists[i+1][1],review_lists[i][1]

for i in review_lists:
    print(number - review_list.index(i))

n = int(input())
ls = []
for i in range(n):
    s,t = input().split()
    ls.append([s,-int(t),i+1])
    
ls = sorted(ls)
for i in ls:
  print(i[-1])

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N = int(input())
info_list = list()
for i in range(N):
    S, P = input().split()
    info_list.append((i + 1, S, int(P)))

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


N = int(input())
info_list = list()
for i in range(N):
    S, P = input().split()
    info_list.append((i + 1, S, int(P)))

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

for info in info_list:
    print(info[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())

l = []
for i in range(n):
  x,y = map(str,input().split())
  l.append((x,y, i))


L = []

for i in range(n):
  L.append((l[i][0], int(l[i][1]), l[i][2]))

L.sort(key = lambda L:L[1])

L.sort(key = lambda L:L[0])

for i in range(n):
  print(L[n][2] + 1)



n = int(input())

l = []
for i in range(n):
  x,y = map(str,input().split())
  l.append((x,y, i))


L = []

for i in range(n):
  L.append((l[i][0], int(l[i][1]), l[i][2]))

L.sort(key = lambda L:L[1])

L.sort(key = lambda L:L[0])

for i in range(n):
  print(L[i][2] + 1)



n = int(input())

l = []
for i in range(n):
  x,y = map(str,input().split())
  l.append((x,y, i))


L = []

for i in range(n):
  L.append((l[i][0], int(l[i][1]), l[i][2]))

L.sort(key = lambda L:L[2])

L.sort(key = lambda L:L[1])

for i in range(n):
  A = n-i-1
  print(L[A][2] + 1)



n = int(input())

l = []
for i in range(n):
  x,y = map(str,input().split())
  l.append([x,int(y),i+1])

l.sort(key = lambda l:(l[0],-l[1]))
for j in range(n):
  print(l[j][2])

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted