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())
list = []
for xi in range(n):
    add1, add2 = input().split()
    add = [add2, add1, xi+1]
    list.append(add)
list.sort(key=lambda list2: list2[1])

print(list)

name = list[0][1]
list2 = [list[0]]
count = 1
for xi in range(1,n):
    if name == list[xi][1]:
        list2.append(list[xi])
        count += 1
    else:
        list2.sort(key=int, reverse=True)
        for yi in range(count-1,-1,-1):
            print(list2[yi][2])
        name = list[xi][1]
        list2 = [list[xi]]
        count = 1

if len(list2)<n:
    list2.sort(key=int, reverse=True)
for yi in range(count-1,-1,-1):
    print(list2[yi][2])
name = list[xi][1]
list2 = [list[xi]]
count = 1


n = int(input())
list = []
for xi in range(n):
    add1, add2 = input().split()
    add = [add2, add1, xi+1]
    list.append(add)
list.sort(key=lambda list2: list2[1])


name = list[0][1]
list2 = [list[0]]
count = 1
for xi in range(1,n):
    if name == list[xi][1]:
        list2.append(list[xi])
        count += 1
    else:
        list2.sort(key=int, reverse=True)
        for yi in range(count-1,-1,-1):
            print(list2[yi][2])
        name = list[xi][1]
        list2 = [list[xi]]
        count = 1

if len(list2)<n:
    list2.sort(key=int, reverse=True)
for yi in range(count-1,-1,-1):
    print(list2[yi][2])
name = list[xi][1]
list2 = [list[xi]]
count = 1


n = int(input())
list = []
for xi in range(n):
    add1, add2 = input().split()
    add = [int(add2), add1, xi+1]
    list.append(add)
list.sort(key=lambda list2: list2[1])


name = list[0][1]
list2 = [list[0]]
count = 1
for xi in range(1,n):
    if name == list[xi][1]:
        list2.append(list[xi])
        count += 1
    else:
        list2.sort()
        for yi in range(count-1,-1,-1):
            print(list2[yi][2])
        name = list[xi][1]
        list2 = [list[xi]]
        count = 1

if len(list2)<n:
    list2.sort()
for yi in range(count-1,-1,-1):
    print(list2[yi][2])
name = list[xi][1]
list2 = [list[xi]]
count = 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):
N = int(input())
S=[0]*N
P=[0]*N 
for i in range(N):
    S[i], P[i] = input().split()
    P[i] = int(P[i])

S_mid = sorted(S, key=lambda x:P[x])
S_fin = sorted(range(len(S_mid)), key=lambda idx:S_mid[idx])

for i in fin:
    print (i)

N = int(input())
sp=[[0]*3 for i in range(N)]
for i in range(N):
    sp[i][0], sp[i][1] = input().split()
    sp[i][1] = int(sp[i][1])
    sp[i][2] = i

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


N = int(input())
sp=[[0]*3 for i in range(N)]
for i in range(N):
    sp[i][0], sp[i][1] = input.split()
    sp[i][1] = int(sp[i][1])
    sp[i][2] = i

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


N = int(input())
sp=[[0]*3 for i in range(N)]
for i in range(N):
    sp[i][0], sp[i][1] = input().split()
    sp[i][1] = int(sp[i][1])
    sp[i][2] = i

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



N = int(input())
S=[0]*N
P=[0]*N 
for i in range(N):
    S[i], P[i] = input().split()
    P[i] = int(P[i])

S_mid = sorted(S, key=lambda idx: P[idx] )
fin = sorted(range(N), key=lambda idx: S_mid[idx])
for i in fin:
print (i)

N = int(input())
sp=[[0]*3 for i in range(N)]
for i in range(N):
    sp[i][0], sp[i][1] = input().split()
    sp[i][1] = int(sp[i][1])
    sp[i][2] = i+1

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


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

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

Submission attempts (in order):
a=[]
for i in range(int(input())):
    s, p = input().split()
    p=int(p)
    a.append((s,p,i+1))
a.sort(key=lambda x:(x[0],-x[1]))
print(a)
[print(x[2])for x in a]

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

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):
    li.append(list(map(str, input().split())))
    li[i].append(i+1)

li.sort( key = lambda li : (li[0], -int(li[1])))
print(li)


n = int(input())

li = []
for i in range(n):
    li.append(list(map(str, input().split())))
    li[i].append(i+1)

li.sort( key = lambda li : (li[0], -int(li[1])))
for i in li:
    print(li[2])


n = int(input())

li = []
for i in range(n):
    li.append(list(map(str, input().split())))
    li[i].append(i+1)

li.sort( key = lambda li : (li[0], -int(li[1])))
for i in li:
    print(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())
s = []
for i in range(n):
    name,point = input().split()
    s.append([name,int(point)])
for i in range(n):
    rank = 1
    for j in range(n):
        if s[i][0] > s[j][0]:
            rank += 1
        elif s[i][0] == s[j][0] and s[i][1] < s[j][1]:
                rank += 1
    print(rank)


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

#include <algorithm>
#include <string>

#include <stdlib.h>

using namespace std;
char in[120];
pair<pair<string, int>, int> p[110];

int main () {
  int N;
  cin >> N;
  for (int i = 0; i< N; i++) {
    int t;
    string tmp;
    cin >> tmp >> t;
    
    p[i]=make_pair(make_pair(tmp,-t),i);
  }  
  sort(p,p+N);
  for (int i = 0; i<N;i++) {
    cout << p[i].second+1 << endl;
  }
}

#from IPython import embed
N=int(input())
n = []

from collections import Counter

c = Counter()

for i in range(N):
    k = input().split()
    k[1] = int(k[1])
    k.append(i+1)
    n.append(k)
    c.update([k[0]])



n.sort()
#n = n[::-1]
prev = ""
l = []
cnt = 0
#print(c)
for a in n:
    #print(a)

    if c[a[0]] > 1:
        l.append(a[1:])
        #print(a[1:])
        cnt+=1
        #print(a[0])
        #embed()
        if cnt == c[a[0]]:
            l.sort()
            #print(l)
            for i in l[::-1]:
                print(i[1])
            cnt = 0
            l = []
    else:
        print(a[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())
r=[]
for i in range(n):
    s,p=input().split()
    r.append((s,int(p),i))

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

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

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

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

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

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

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

n = int(input())

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
import sys
sys.setrecursionlimit(10 ** 5)


def LI(): return [int(x) for x in sys.stdin.readline().split()]


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 LS(): return sys.stdin.readline().split()


def II(): return int(sys.stdin.readline())


def SI(): return input()


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

X = sorted(X.items())
print(X)
for v in X:
    a = sorted(v[1], reverse=True)
    for i in a:
        print(i[1])


import sys
sys.setrecursionlimit(10 ** 5)


def LI(): return [int(x) for x in sys.stdin.readline().split()]


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 LS(): return sys.stdin.readline().split()


def II(): return int(sys.stdin.readline())


def SI(): return input()


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

X = sorted(X.items())
for v in X:
    a = sorted(v[1])
    for i in a:
        print(i[1])


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

Verdicts: Wrong Answer

Wrong Answer

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

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

A = sorted(X, key=lambda X:(X[1],-X[2]))
print (A)

N = int(input())
X =[]
for i in range(N):
  SS,PP = map(str,input().split())
  X.append([int(i+1), SS, int(PP)])

A = sorted(X, key=lambda X:(X[1],-X[2]))

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


n = int(input())
sp = []
for i in range(n):
    s, p = map(str, input().split())
    sp.append([s, int(p), i + 1])
sp = sorted(sp, key=lambda x: x[1], reverse=True)
sp = sorted(sp, key=lambda x: x[0])
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):
import sys
input = sys.stdin.readline
n = int(input())
print(n)
b = [list(map(str,input().split())) for p in [0]*n]
for i in range(n):
	b[i][1] = int(b[i][1])
	b[i].append(i+1)
print(b)
b.sort(key=lambda q:(q[0],-q[1]))
for k in range(n):
	print(b[k][2])

import sys
input = sys.stdin.readline
n = int(input())
b = [list(map(str,input().split())) for p in [0]*n]
for i in range(n):
  b[i][1] = int(b[i][1])
  b[i].append(i+1)
b.sort(key=lambda q:(q[0],-q[1]))
for k in range(n):
  print(b[k][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())
A=[]
for i in range(n):
    a=(i+1,)+tuple(input().split())
    A.append(a)
A.sort(key=lambda x:(-x[1],x[2]),reverse=True)
for m in range(n):
    print(A[m][0])

# -*- coding: utf-8 -*-
N=int(input())
restaurant=[]
for i in range(N):
    s,p=input().split()
    restaurant.append((i+1,s,int(p)))
restaurant.sort(key=lambda x:(x[1],-x[2]))
for j in range(N):
    print(restaurant[j][0])

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):
if __name__ == '__main__':
    N = int(input())
    S = []
    P = []
    num = []
    for i in range(N):
        s = input().rstrip().split(' ')
        S.append(s[0])
        P.append(int(s[1]))
        num.append(i+1)

    Z = list(zip(S,P,num))
    print(Z)

    Z.sort(key=lambda k:k[1],reverse=True)
    Z.sort(key=lambda k:k[0])

    for elem in Z:
        print(elem[2])

if __name__ == '__main__':
    N = int(input())
    S = []
    P = []
    num = []
    for i in range(N):
        s = input().rstrip().split(' ')
        S.append(s[0])
        P.append(int(s[1]))
        num.append(i+1)

    Z = list(zip(S,P,num))

    Z.sort(key=lambda k:k[1],reverse=True)
    Z.sort(key=lambda k:k[0])

    for elem in Z:
        print(elem[2])

Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
l = []
for i in  range():
    s, p = input().split()
    l.append([s, int(p), i+1])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for j in range(n):
    print(l_sorted[j][2])

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

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

n = int(input())
l = []
for i in  range():
    s, p = input().split()
    l.append([s, int(p), i])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for out in l_sorted:
    print(out[2]+1)

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

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


Shop_List_Sorted = sorted(Shop_List, key=lambda x:(x[0], x[1]))
for k in range(N):
    print(Shop_List_Sorted[k][2])



N = int(input())
Shop_List=[]
for i in range(N):
    Temp_List=list(input().split())
    Temp_List[1]=int(Temp_List[1])
    Temp_List.append(i+1)
    Shop_List.append(Temp_List)


Shop_List_Sorted = sorted(Shop_List, key=lambda x:(x[0], -x[1]))
for k in range(N):
    print(Shop_List_Sorted[k][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 -*-
from operator import itemgetter
n = int(input())
restList = []
for i in range(n):
    city, p = map(str, input().split())
    restList.append([i + 1, city, int(p)])
restList.sort(key=itemgetter(1))

city = restList[0][1]
same_list = []
for R in restList:
    if R[1] == city:
        same_list.append(R)
    else:
        if same_list:
            same_list.sort(key=itemgetter(2), reverse=True)
            for s in same_list:
                print(s[0])
            same_list = []
            same_list.append(R)
    city = R[1]
if same_list:
    for s in same_list:
        print(s[0])


# -*- coding: utf-8 -*-
from operator import itemgetter
n = int(input())
restList = []
for i in range(n):
    city, p = map(str, input().split())
    restList.append([i + 1, city, int(p)])
restList.sort(key=itemgetter(1))

city = restList[0][1]
same_list = []
for R in restList:
    if R[1] == city:
        same_list.append(R)
    else:
        if same_list:
            same_list.sort(key=itemgetter(2), reverse=True)
            for s in same_list:
                print(s[0])
            same_list = []
            same_list.append(R)
    city = R[1]
if same_list:
    same_list.sort(key=itemgetter(2), reverse=True)
    for s in same_list:
        print(s[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):
#coding:utf-8
from collections import OrderedDict

N = int(input())
li = []
lipay = []
linum = []
cnt = 1


datalist =[ list(map(str, input().split())) for i in range(N) ]

for i in range(0,N):
    datalist[i].append(cnt)
    cnt += 1

datalist.sort(key=lambda x:x[0] or int(x[1]))
# print(datalist)
# datalist.sort(key=lambda x:int(x[1]), reverse=True)


for i in range(0,N):

    print(datalist[i][2])

#coding:utf-8
N = int(input())
cnt = 1

datalist =[ list(map(str, input().split())) for i in range(N) ]

for i in range(0,N):
    datalist[i].append(cnt)
    cnt += 1

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

for i in range(0,N):
    print(datalist2[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())
hoge=[]
for i in range(n):
  a,b=map(str,input().split())
  c=int(b)
  hoge.append([a,c,i+1])
hoge=sorted(hoge,key=lambda x:(x[1]),reverse=True)
hoge=sorted(hoge,key=lambda x:(x[0]),reverse=False)

print(hoge)
for i in range(n):
  print(hoge[i][2])

n=int(input())
hoge=[]
for i in range(n):
  a,b=map(str,input().split())
  c=int(b)
  hoge.append([a,c,i+1])
hoge=sorted(hoge,key=lambda x:(x[1]),reverse=True)
hoge=sorted(hoge,key=lambda x:(x[0]),reverse=False)
for i in range(n):
  print(hoge[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, p])
    
lis.sort(key=lambda x: x[1])

names =[]

for i in lis:
    if i[1] not in names:
        names.append(i[1])
        
score = 100000


for name in names:
    for l in lis:
        if name in l:
            l[2] = int(l[2]) + score
        else:
            score -= 200
            
for i in lis:
    print(i[0])

n = int(input())

lis = []

for i in range(n):
    s, p = input().split()
    lis.append([i+1, s, p])
    
lis.sort(key=lambda x: x[1])

names =[]

for i in lis:
    if i[1] not in names:
        names.append(i[1])
        
score = 100000


for name in names:
    for l in lis:
        if name in l:
            l[2] = int(l[2]) + score
        else:
            score -= 200
            
lis.sort(key=lambda x: x[2], reverse=True)
            
for i in lis:
    print(i[0])

Verdicts: Wrong Answer

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

Submission attempts (in order):
from functools import cmp_to_key


def cmp(xx,yy):
    x = xx[1]
    y = yy[1]
    print(x,y)
    print(x[0],x[1],y[0],y[1])
    if x[0] != y[0]:
        return -1 if x[0] < y[0] else 1
    return -1 if int(x[1]) > int(y[1]) else 1

n = int(input())
items = [input().split() for _ in range(n)]
items = list(enumerate(items))
items = sorted(items, key=cmp_to_key(cmp))
for res, *_ in items:
    print(res+1)


from functools import cmp_to_key


def cmp(xx,yy):
    x = xx[1]
    y = yy[1]
    print(x,y)
    print(x[0],x[1],y[0],y[1])
    if x[0] != y[0]:
        return -1 if x[0] < y[0] else 1
    return -1 if int(x[1]) > int(y[1]) else 1

n = int(input())
items = [input().split() for _ in range(n)]
items = list(enumerate(items))
items = sorted(items, key=cmp_to_key(cmp))
for res, *_ in items:
    print(res+1)


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

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):

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

n = int(input())
s = []
for i in range(n):
    s.append(list(input().split()))

s2=sorted(s,key=lambda x: (x[1]),reverse = True)
s2=sorted(s2,key=lambda x: (x[0]))
print(s2)
for i in s2:
    for j in range(n):
        if i==s[j]:
            print(j+1)


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

n = int(input())
s = []
for i in range(n):
    x,y=input().split()
    y = int(y)
    s.append([x,y])

s2=sorted(s,key=lambda x: (x[1]),reverse = True)
s2=sorted(s2,key=lambda x: (x[0]))
for i in s2:
    for j in range(n):
        if i==s[j]:
            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())

L = []

for i in range(N):
  S, P = input().split()
  P = int(P)
  L.append([S, P])
  
n_s = ""
n_p = -1

for i in range(N):
  t_s = "Z"
  t_p = -1
  v = -1
  for j in range(N):
    if t_s > L[i][0] and L[i][0] > n_s:
      t_s = L[i][0]
      t_p = L[i][1]
      v = i
    elif t_s == L[i][0] and L[i][0] > n_s and t_p < L[i][1]:
      t_p = L[i][1]
      v = i
  print(v)
  n_s = t_s
  n_p = t_p

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

for i in range(N):
  a, b = input().split()
  L.append((a, int(b), i))
  
L.sort(key = lambda x: (x[0], -x[1]) )

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())
L = []
for Resturant_number in range(N):
    tmp = [Resturant_number]
    tmp += input().split()
    tmp[2] = int(tmp[2])
    L.append(tmp)
L.sort(reverse=True, key=lambda x:x[1])

for _ in range(len(L)):
    print(L.pop()[0])

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

for _ in range(len(L)):
    print(L.pop()[0])

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

for _ in range(len(L)):
    print(L.pop()[0])

N = int(input())
L = []
for Resturant_number in range(1, N+1):
    tmp = [Resturant_number]
    tmp += input().split()
    tmp[2] = int(tmp[2])
    L.append(tmp)
L.sort(key=lambda x:(x[1],-x[2]))
for Restaurant_data in L:
    print(Restaurant_data[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):
print(1)

N,que=int(input()),[]
for i in range(N):
    s,p=list(input().split())
    que.append((s,int(p),i+1))
que.sort()
for x in que:
    print(x[-1])

N,que=int(input()),[]
for i in range(N):
    s,p=list(input().split())
    que.append((s,-int(p),i+1))
que.sort()
for x in que:
    print(x[-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):
print(*sorted(range(1,int(input())+1),key=lambda _:[(s,-int(p))for s,p in input().split()]))

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


Verdicts: Runtime Error

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

Submission attempts (in order):

a = int(input())
l = []
for i in range(a):
    ta,tb = map(int,input().split())
    l.append([ta,tb,i+1])
l.sort()
for i, j , k in l:
    print(k)




a = int(input())
l = []
for i in range(a):
    ta,tb = map(str,input().split())
    l.append([ta,-int(tb),i+1])
l.sort()
for i, j , k in l:
    print(k)



Verdicts: Runtime Error

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

Submission attempts (in order):
import sys
input = sys.stdin.readline
inf = float('inf')
mod = 10**9+7


def INT_(n): return int(n)-1


def MI(): return map(int, input().split())


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [input() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')


def main():
    N = I()
    #city = []
    city = set()
    sp = []
    for i in range(N):
        i += 1
        s, p = input().split()
        p = int(p)
        sp.append([s, p, i])
        city.add(s)
    city = list(city)
    city.sort()
    ans = [[] for i in range(len(city))]
    sp.sort(reverse=True, key=lambda x: x[1])
    for s, p, i in sp:
        for j, c in enumerate(city):
            if s == c:
                ans[j].append(i)

    print(city)

    for a in ans:
        print(*a, sep="\n")


if __name__ == '__main__':
    main()


import sys
input = sys.stdin.readline
inf = float('inf')
mod = 10**9+7


def INT_(n): return int(n)-1


def MI(): return map(int, input().split())


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [input() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')


def main():
    N = I()
    city = set()
    sp = []
    for i in range(N):
        i += 1
        s, p = input().split()
        p = -int(p)
        sp.append([s, p, i])
    sp.sort()
    for s, p, i in sp:
        print(i)


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

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

Submission attempts (in order):
import pandas as pd
import numpy as np

N = input()
N = int(N)
a_np = np.ones((N,1))
a_pd = pd.DataFrame(a_np,columns=['A'])
a_pd['B']=None
a_pd['C']=None
for i in range(0,N):
    S, P = map(str, input().split())
    P = int(P)
    a_pd.loc[i,:] = [i,S,P]
    #print(i,S,P)
b_pd = a_pd.sort_values(['B','C'],ascending=[True, False])
b_pd = b_pd.reset_index()
print(b_pd)
c = b_pd.loc[:,'A']
for j in range(0,N):
    print(int(c[j]+1))
    

import numpy as np

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

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

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

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

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

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

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

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())
Ss, Ps = [ [], [] ]
for i in range(N):
    s, p = input().split(" ")
    Ss.append(s)
    Ps.append(int(p))
rests = list(zip(range(1, N+1), Ss, Ps))
rests.sort(key=lambda x: (x[1], -x[2]))
print(rests)
print('\n'.join([str(i) for i,_,_ in rests]))


N = int(input())
Ss, Ps = [ [], [] ]
for i in range(N):
    s, p = input().split(" ")
    Ss.append(s)
    Ps.append(int(p))
rests = list(zip(range(1, N+1), Ss, Ps))
rests.sort(key=lambda x: (x[1], -x[2]))
print('\n'.join([str(i) for i,_,_ in rests]))


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

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

Verdicts: Wrong Answer

Accepted