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

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

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

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

n=int(input())
li=[0]*n
for i in range(n):
    a=input().split()
    li[i]=[a[0], -int(a[1]), i+1]

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

for i in li:
    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):
def make_guide():
    num = int(input())
    lst = [(i + 1, input().split()) for i in range(num)]
    lst = sorted(sorted(lst, key=lambda t: t[1][1]), key=lambda t: t[1][0])
    return lst


def test_display():
    lst = make_guide()
    for i, lst in lst:
        print(str(i) + " " + lst[0] + " " + lst[1])


def display():
    lst = make_guide()
    for i, guides in lst:
        print(i)


if __name__ == "__main__":
    display()

def make_guide():
    num: int = int(input())
    lst = [(i + 1, *input().split()) for i in range(num)]
    lst = sorted(sorted(lst, key=lambda t: t[2]), key=lambda t: t[1])
    return lst


def test_display():
    lst = make_guide()
    for i, lst in lst:
        print(str(i) + " " + lst[0] + " " + lst[1])


def display():
    lst = make_guide()
    for i, city, point in lst:
        print(i)


if __name__ == "__main__":
    display()

def make_guide():
    num: int = int(input())
    lst = [(i, input().split()) for i in range(num)]
    print(lst[0])
    lst = sorted(sorted(lst, key=lambda t: t[1][1]), key=lambda t: t[1][0])
    return lst
 
if __name__ == "__main__":
    display()

def make_guide():
    num = int(input())
    lst = [(i + 1, input().split()) for i in range(num)]
    # TODO fix
    
    
    lst = sorted(lst, key=lambda t: int(t[1][1]), reverse=True)
    lst = sorted(lst, key=lambda t: t[1][0])
    return lst


def test_display():
    lst = make_guide()
    for i, guides in lst:
        print(str(i) + " " + guides[0] + " " + guides[1])


def display():
    lst = make_guide()
    for i, guides in lst:
        print(i)


if __name__ == "__main__":
    display()


Verdicts: Wrong Answer

Runtime Error

Runtime Error

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

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

N = int(input())
X = []
for i in range(N):
	s, p = input()
	X.append([s, p,  i+1])
X.sort()
s = X[0][0]
for i in range(N):
	j = i
	while True:
		if j == len(X) - 1:
			break
		if X[j][0] != s:
			j -= 1
			break
		else j += 1
	for k in range(j-i+1):
		print(X[j][2])
		j -= 1

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

N = int(input())
X = []
for i in range(N):
	s, p = input()
	X.append([s, p,  i+1])
X.sort()
s = X[0][0]
for i in range(N):
	j = i
	while True:
		if j == len(X) - 1:
			break
		if X[j][0] != s:
			j -= 1
			break
	for k in range(j-i+1):
		print(X[j][2])
		j -= 1

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

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

Verdicts: Wrong Answer

Runtime Error

Runtime Error

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):
  p,q=input().split()
  S[i+1]=(p,int(q))
S=sorted(S,key=lambda x:(S[x][0],-S[x][1]))
print(S)

print(*S,sep="\n")

N=int(input())
S={}

for i in range(N):
  p,q=input().split()
  S[i+1]=(p,int(q))
S=sorted(S,key=lambda x:(S[x][0],-S[x][1]))

print(*S,sep="\n")

Verdicts: Wrong Answer

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

Submission attempts (in order):
def main():
    n = int(input())
    store = []
    for i in range(n):
        s, p = input().split()
        
        store.append((i, s, int(p)))

    store.sort(key=lambda x:(x[1],x[2]))
    for i in range(n):
        print(store[i][0])


if __name__ == "__main__":
    main()


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

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


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):
N=int(input())
book1={}
for i in range(1,N+1):
    string,point=input().split()
    point=int(point)
    if  string in book1.keys():
        book1[string][point]=i
    else:
        book1[string]={point:i}
for keys in sorted(book1.keys()):
    for point in reversed(list(book1[keys].keys())):
        print(book1[keys][point])

N=int(input())
book1={}
for i in range(1,N+1):
    string,point=input().split()
    point=int(point)
    if  string in book1.keys():
        book1[string][point]=i
    else:
        book1[string]={point:i}
for keys in sorted(book1.keys()):
    for point in sorted(book1[keys].keys(),reverse=True):
        print(book1[keys][point])

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


def main():
    n = int(input())
    s = [[int(i) if i.isdigit() else i for i in input().split()] for _ in range(n)]
    rank = {
        tuple(review): i
        for i, review in enumerate(
            sorted(sorted(s, key=lambda x: x[1], reverse=True), key=lambda x: x[0]),
            start=1,
        )
    }
    for r in s:
        print(rank[tuple(r)])


if __name__ == "__main__":
    main()


import sys

input = sys.stdin.readline


def main():
    n = int(input())
    s = [
        [-int(i) if i.isdigit() else i for i in input().split()] + [j]
        for j in range(1, n + 1)
    ]
    for _, _, i in sorted(s):
        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):
N = int(input())
S = []

for i in range(N):
    ts,tp = input().split()
    ts = str(ts)
    tp = int(tp)
    S.append([ts,tp])

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

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

N = int(input())
S = []
 
for i in range(N):
    ts,tp = input().split()
    ts = str(ts)
    tp = int(tp)
    S.append([ts,tp,N-i])
    
S.sort(key=lambda x:x[0])

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

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

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

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

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

N = int(input())
S = []
 
for i in range(N):
    ts,tp = input().split()
    ts = str(ts)
    tp = 100-int(tp)
    S.append([ts,tp,i+1])
    
S.sort(key=lambda x:(x[0],x[1]))

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

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):
#from operater import itemgetter
from collections import Counter
import numpy as np
N=int(input())
c=[]
v=[]
ans=[]
c_v={}
for i in range(N):
    tmp=input().split()
    ans.append(tmp)
    c.append(tmp[0])
    v.append(int(tmp[1]))
    if tmp[0] in c_v.keys():
        c_v[tmp[0]].append(int(tmp[1]))
    else:
        c_v[tmp[0]]=[int(tmp[1])]
    
hoge=np.array(list(Counter(c).keys()))
huga=np.argsort(np.array(c))
for i in range(N):
    city=ans[i][0]
    if len(c_v[city])==1:
        print(huga[np.where(hoge==ans[i][0])][0]+1)
    else:
        tmp=np.array(c_v[city])
        h=np.argsort(tmp)[::-1]
        print(huga[np.where(hoge==ans[i][0])][0]+h[c_v[city].index(int(ans[i][1]))]+1)
        

from collections import Counter 
from collections import defaultdict
from collections import deque
import math
import itertools
import heapq
import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
input_list = lambda : list(map(int,input().split()))

n=int(input())

a=[]
for j in range(n):
    v,i=input().split()
    i=int(i)
    a.append([v,i,j])
a.sort(key=lambda x:(x[0],-x[1]))
for each in a:
    print(each[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):
# -*- coding; utf 8 -*-
# Guidebook
# 2019. 5/28





class Guidebook(object):
    def __init__(self, num, city, score):
        self.num = num
        self.city = city
        self.score = score


def print_number(N, guidebook):
    for i in range(N):
        print(guidebook[i].num+1)


def score_sort(N, guidebook):
    for i in range(N-1):
        for j in range(N-1):
            if guidebook[j].score < guidebook[j+1].score:
                guidebook[j], guidebook[j+1] = (
                    guidebook[j+1], guidebook[j] )


def city_sort(N, guidebook):
    for i in range(N-1):
        for j in range(N-1):
            if str(guidebook[j].city) > str(guidebook[j+1].city):
                guidebook[j], guidebook[j+1] = (
                    guidebook[j+1], guidebook[j] )


if __name__ == '__main__':
    N = int(input()) # number of restaurants
    guidebook = []
    for i in range(N):
        s, p = input().split()
        restaurant = Guidebook(i+1, s, int(p))
        guidebook.append(restaurant)

    score_sort(N, guidebook)
    city_sort(N, guidebook)
    print_number(N, guidebook)


# -*- coding; utf 8 -*-
# Guidebook
# 2019. 5/28





class Guidebook(object):
    def __init__(self, num, city, score):
        self.num = num
        self.city = city
        self.score = score


def print_number(N, guidebook):
    for i in range(N):
        print(guidebook[i].num)


def score_sort(N, guidebook):
    for i in range(N-1):
        for j in range(N-1):
            if guidebook[j].score < guidebook[j+1].score:
                guidebook[j], guidebook[j+1] = (
                    guidebook[j+1], guidebook[j] )


def city_sort(N, guidebook):
    for i in range(N-1):
        for j in range(N-1):
            if str(guidebook[j].city) > str(guidebook[j+1].city):
                guidebook[j], guidebook[j+1] = (
                    guidebook[j+1], guidebook[j] )


if __name__ == '__main__':
    N = int(input()) # number of restaurants
    guidebook = []
    for i in range(N):
        s, p = input().split()
        restaurant = Guidebook(i+1, s, int(p))
        guidebook.append(restaurant)

    score_sort(N, guidebook)
    city_sort(N, guidebook)
    print_number(N, guidebook)


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())
ranking = []
for i in range(N):
  si, pi = input().split()
  ranking.append((si,int(pi),i))
  
print(ranking)

N = int(input())
D = [list(map(str,input().split())) for _ in range(N)]
for i in range(N):
  D[i].append(i+1)
sorted_d = sorted(D, key = lambda x: (x[0], -int(x[1])))
for i in range(N):
  print(sorted_d[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):
from operator import itemgetter
N=int(input())
hako=[]
for i in range(N):
    A,B=input().split()
    hako.append([A,int(B)*-1])
kari=hako.copy()
#print(kari)
hako.sort()
hako=sorted(hako,key=itemgetter(0,1))
#print(hako)
for i in range(N):
    print(hako.index(kari[i])+1)

from operator import itemgetter
N=int(input())
hako=[]
for i in range(N):
    A,B=input().split()
    hako.append([A,int(B)*-1])
kari=hako.copy()
#print(kari)
hako.sort()
#print(hako)
for i in range(N):
    print(kari.index(hako[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())
s_p = [[i+1]+input().split() for i in range(n)]

s_p.sort(key=lambda x:x[1]+str(100-int(x[2])))

print([x[0] for x in s_p])

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

s_p.sort(key=lambda x:x[1]+str(100-int(x[2])))

print([(x[0]) for x in s_p])

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

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

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

N = int(input())
SPlist = []
for i in range(N):
    buff  = input().split()
    SPlist.append([i+1,str(buff[0]),int(buff[1])])
SPlist = sorted(SPlist,key = lambda x:x[2],reverse=True)
SPlist = sorted(SPlist,key=lambda x:x[1])
[print(i[0]) for i in SPlist]

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, i+1])

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

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

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

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

for e in l:
	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):
# input
N = int(input())
SA = [str(input()) for i in range(N)]

# process
cities = list(set([x.split()[0] for x in SA]))
cities.sort()
print(cities)

for y in cities:
    each_SA = [i for i in SA if y in i]
    each_points = [int(x.split()[1]) for x in each_SA]
    each_points.sort(reverse=True)
    for j in each_points:
        print(SA.index(y + ' ' + str(j)) + 1)


# input
N = int(input())
SA = [str(input()) for i in range(N)]

# process
cities = list(set([x.split()[0] for x in SA]))
cities.sort()

for y in cities:
    each_SA = []
    for i in SA:
        if i.split()[0] == y:
            each_SA.append(i)
    each_points = [int(x.split()[1]) for x in each_SA]
    each_points.sort(reverse=True)
    for j in each_points:
        print(SA.index(y + ' ' + str(j)) + 1)


Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
list=[]
for i in range(N):
    s, p = input().split()
    list.append([s, int(p)])
lis=sorted(key=lambda, list:(list[0], -list[1]))
for i in list:
    print(lis.index(i)+1)

N = int(input())
list=[]
for i in range(N):
    s, p = input().split()
    list.append([s, int(p)])
A=list
list.sort(key=lambda, list:(list[0], -list[1]))
for i in A:
    print(list.index(i)+1)

N = int(input())
list=[]
for i in range(N):
    s, p = input().split()
    list.append([s, int(p)])
A=list
list.sort(key=lambda list:(list[0], -list[1]))
for i in A:
    print(int(list.index(i))+1)

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

Verdicts: Runtime Error

Runtime Error

Wrong Answer

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

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

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

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

LS = sorted(L)

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

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

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

LS = sorted(L)

for i in range(N):
  print(LS[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())
R=[list(input().split()) + [i+1] for i in range(n)]
R.sort(key=lambda x: (x[0],-int(x[1])))
print(R)
for r in R:
    print(r[2])

n=int(input())
R=[list(input().split()) + [i+1] for i in range(n)]
R.sort(key=lambda x: (x[0],-int(x[1])))
for r in R:
    print(r[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())
lists_S = []
lists_P = []
for i in range(N):
    S,P = map(str,str(input()).split())
    lists_S.append(S)
    lists_P.append(int(P))
c = list(zip(lists_S,lists_P))
c = sorted(c,key=lambda x:(x[0],-x[1]))
s,p = zip(*c)
print(s,p)
lists_index = []
for i in range(N):
    for j in range(N):
        if s[i] == lists_S[j] and p[i] == lists_P[j]:
            print(lists_S[i],s[j],p[j],lists_P[i])
            lists_index.append(p.index(p[j]) + int(1))
print(lists_index)

N = int(input())
lists_S = []
lists_P = []
for i in range(N):
    S,P = map(str,str(input()).split())
    lists_S.append(S)
    lists_P.append(int(P))
c = list(zip(lists_S,lists_P))
c = sorted(c,key=lambda x:(x[0],-x[1]))
s,p = zip(*c)
lists_index = []
for i in range(N):
    for j in range(N):
        if s[i] == lists_S[j] and p[i] == lists_P[j]:
            lists_index.append(p.index(p[j]) + int(1))
for i in range(len(lists_index)):
    print(lists_index[i])

Verdicts: Wrong Answer

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

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

SP.sort(key = lambda x:x[0])
idx = 0
init = SP[idx][0]
while idx < N:
    D = []
    while idx  < N and SP[idx][0] == init:
        D += [SP[idx]]
        idx += 1
    D.sort(reverse = True,key = lambda x:int(x[1]))
    for i in range(len(D)):
        print(D[i][2])
    idx += 1
    init = SP[min(idx,N-1)][0]
        

    
    

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

SP.sort(key = lambda x:x[0])
idx = 0
init = SP[idx][0]
while idx < N:
    D = []
    while idx  < N and SP[idx][0] == init:
        D += [SP[idx]]
        idx += 1
    D.sort(reverse = True,key = lambda x:int(x[1]))
    for i in range(len(D)):
        print(D[i][2])
    init = SP[min(idx,N-1)][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 _ in range(N):
  S,P = input().split()
  SP.append([S,-int(P)])
  
sort_SP = sorted(SP)

for i in SP:
  print(sort_SP.index(i)+1)

N = int(input())

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

for j in sort_SP:
  print(j[2])

Verdicts: Wrong Answer

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

Submission attempts (in order):
import sys

def main():
    num = int(sys.stdin.readline())
    
    input = [None] * num

    for i in range(num):
        read = sys.stdin.readline().split()
        input[i] = [i+1, read[0], int(read[1])]

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

    for restaurant in input:
        print(restaurant[0])

if __name__ == "__main__":
    main()


import sys

def main():
    num = int(sys.stdin.readline())
    
    input = [None] * num

    for i in range(num):
        read = sys.stdin.readline().split()
        input[i] = [i, read[0], int(read[1])]

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

    for restaurant in input:
        print(restaurant[0])

if __name__ == "__main__":
    main()


import sys

def main():
    num = int(sys.stdin.readline())
    
    input = [None] * num

    for i in range(num):
        read = sys.stdin.readline().split()
        input[i] = [i+1, read[0], int(read[1])]

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

    for restaurant in input:
        print(restaurant[0])

if __name__ == "__main__":
    main()


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, x = map(int,input().split())
n = int(input())
ls = [["",[[]]]]
for i in range(n):
  s, p = input().split()
  p = int(p)
  for j in ls:
    if s == j[0]:
      j[1].append([i+1,p])
      break
    elif j == ls[-1]:
      ls.append([s,[[i+1,p]]])
      break
#ls = list(map(int,input().split()))
#s = input()
ls.remove(ls[0])
print(ls)
ls.sort()
for i in ls:
  i[1].sort(key=lambda x: x[1],reverse=True)
  for j in i[1]:
    print(j[0])


#n, x = map(int,input().split())
n = int(input())
ls = [["",[[]]]]
for i in range(n):
  s, p = input().split()
  for j in ls:
    if s == j[0]:
      j[1].append([i+1,int(p)])
      break
    elif j == ls[-1]:
      ls.append([s,[[i+1,int(p)]]])
      break
#ls = list(map(int,input().split()))
#s = input()
ls.remove(ls[0])
ls.sort()
for i in ls:
  i[1].sort(key=lambda x: x[1],reverse=True)
  for j in i[1]:
    print(j[0])


Verdicts: Wrong Answer

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

Submission attempts (in order):
n=int(input())
cityLst=[]
for i in range(n):
	s,p=map(str,input().split(" "))
	cityLst.append(["{:<10}".format(s),p])
sCityLst=sorted(cityLst,key=lambda x:x[0]+"a"+chr(int(x[1])+97))
for o in sCityLst:
	print(cityLst.index(o)+1)

n=int(input())
cityLst=[]
for i in range(n):
	s,p=map(str,input().split(" "))
	cityLst.append(["{:<10}".format(s),p])
sCityLst=sorted(cityLst,key=lambda x:x[0]+"a"+chr(-1*(int(x[1])-100)+97))
for o in sCityLst:
	print(cityLst.index(o)+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())

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

  table.append([i+1, city, score])

sorted_table = sorted(table, key=lambda x:(x[1], -x[2]))

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

n =  int(input())

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

  table.append([i+1, city, score])

sorted_table = sorted(table, key=lambda x:(x[1], -x[2]))

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

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

a.sort()
for aa in a:
	print(aa[2])

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

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

a.sort()
for aa in a:
	print(aa[2]+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):
# B
# 2020/3/9  17:57-
n = int(input())
l = []
for i in range(n):
    ss, pp = map(str, input().split())
    l.append([ss, int(pp), i])
    
l.sort()
for v in l:
    print(v[2]+1)

# B
# 2020/3/9  17:57-
n = int(input())
l = []
for i in range(n):
    ss, pp = map(str, input().split())
    l.append([ss, int(pp), i])
    
l.sort(key=lambda x: x[1], reverse=True)
l.sort(key=lambda x: x[0])

for v in l:
    print(v[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):
#128 b
n=int(input())
res=[]
for i in range(n):
    a,b=list(input().split())
    b=-1*int(b)
    res.append([a,b,i+1])
res=sorted(res)
for i in n:
    print(x[2])


#128 b
n=int(input())
res=[]
for i in range(n):
    a,b=list(input().split())
    b=-1*int(b)
    res.append([a,b,i+1])
res=sorted(res)
for x in res:
    print(x[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):
from operator import itemgetter

city_point_list = []
N = int(input())
for i in range(N):
    c, p = input().split()
    city_point_list.append(c, int(p))

cp_num_dict = {}
for i in range(city_point_list):
    cp_num_dict[city_point_list[i]] = i + 1

point_sort_rev = sorted(city_point_list, key=itemgetter(1), reverse=True)
city_sort = sorted(point_sort_rev, key=itemgetter(0))

for cp in city_sort:
    print (cp_num_dict[cp])

from operator import itemgetter

N = int(input())
city_point_list = []
for i in range(N):
    c, p = input().split()
    pair = (c, int(p))
    city_point_list.append(pair)

cp_num_dict = {}
for i in range(len(city_point_list)):
    cp_num_dict[city_point_list[i]] = i + 1

point_sort_rev = sorted(city_point_list, key=itemgetter(1), reverse=True)
city_sort = sorted(point_sort_rev, key=itemgetter(0))

for cp in city_sort:
    print (cp_num_dict[cp])


Verdicts: Runtime Error

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

Submission attempts (in order):
import numpy as np
from nltk.classify.maxent import calculate_empirical_fcount
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)


import numpy as np
from nltk.classify.maxent import calculate_empirical_fcount
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)

import numpy as np
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)

Verdicts: Runtime Error

Runtime Error

Accepted