Problem:


Score : 200 points

Problem Statement

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.

Constraints

1 ≤ N ≤ 100

S is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.

0 ≤ P_i ≤ 100

P_i is an integer.

P_i ≠ P_j (1 ≤ i < j ≤ N)

Input

Input is given from Standard Input in the following format:

N
S_1 P_1
:
S_N P_N

Output

Print N lines. The i-th line (1 ≤ i ≤ N) should contain the identification number of the restaurant that is introduced i-th in the book.

Sample Input 1

6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 60
khabarovsk 40

Sample Output 1

3
4
6
1
5
2

The lexicographical order of the names of the three cities is kazan < khabarovsk < moscow. For each of these cities, the restaurants in it are introduced in descending order of score. Thus, the restaurants are introduced in the order 3,4,6,1,5,2.

Sample Input 2

10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 40
yakutsk 50
yakutsk 60
yakutsk 70
yakutsk 80
yakutsk 90
yakutsk 100

Sample Output 2

10
9
8
7
6
5
4
3
2
1



Sample input:
6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 60
khabarovsk 40


Sample output:
3
4
6
1
5
2

Submission status: Runtime Error

Solution code:
from operator import itemgetter
n=int(input())
s=[]
for i in range(n):
    s,p=map(int,input().split())
    s.append([s,p,i+1])
s.sort()
sub=[]
count=0
for i in range(n):
    if s[i][0]==s[i+1][0]:
        sub.append(s[i])
        count+=1
    else:
        if coount!=0:
            count+=1
            sub.sort(key=itemgetter(1))
            for j in range(count):
                print(sub[j][2])
            sub=[]
            count=0
        else:
            print(s[i][2])

Submission status: Runtime Error

Solution code:
from operator import itemgetter
n=int(input())
s=[]
for i in range(n):
    s,p=map(int,input().split())
    s.append([s,p,i+1])
s.sort()
sub=[]
count=0
for i in range(n):
    if s[i][0]==s[i+1][0]:
        sub.append(s[i])
        count+=1
    else:
        if coount!=0:
            count+=1
            sub.sort(key=itemgetter(1))
            for j in range(count):
                print(sub[j][2])
        else:
            print(s[i][2])

Submission status: Runtime Error

Solution code:
n = int(input())
restaurants_list = []
for _ in range(n):
  s, p = input().split()
  restaurants_list.append([s, p, _])
restaurants_list.sort()
for _ in range(n):
  print(restaurants_list[2])

Submission status: Runtime Error

Solution code:
n = int(input())
x = [list(input().split(""))for i in range(n)]

for i in range(n):
    x[i][1] = int(x[i][1])

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

for i in range(n):
    print(x.index(test2[i])+1)

Submission status: Runtime Error

Solution code:
n=int(input())
sp_lis=[]
for i in range(n):
    s,p=input().split()
    sp_lis.append([s,100-int(p),i+1])
for j in range(n):
    print(sorted(sp_lis[j][2]))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
sp_lis=[]
for i in range(n):
    s,p=input().split()
    sp_lis.append([s,100-p,i+1])
for j in range(n):
    print(sorted(sp_lis[j][2]))

Submission status: Runtime Error

Solution code:
n=int(input())
sp_lis=[]
s,p=input().split()
for i in range(1,n+1):
  sp_lis.append([s,100-p,i])
for j in range(n)
print(sorted(sp_lis[j][2]))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

n = input()

l = []

for i in range(n):
    inpt = raw_input().split()
    l.append((inpt[0], inpt[1]), i)

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

for i in l:
    print (l[2] + 1)

Submission status: Runtime Error

Solution code:
N = int(input())
names = set()
citydict = dict()
for i in range(N):
    S,P = input().split()
    names.add(S)
    if S[i] in citydict:
        citydict[S].append((int(P),i))
    else:
        citydict[S] = [(int(P),i)]

for name in sorted(names):
    for point in sorted(citydict[name],reverse = True):
        print(point[1] + 1)

Submission status: Runtime Error

Solution code:
N = int(input())
names = set()
citydict = dict()
for i in range(N):
    S, P = input().split()
    names.append(S)
    if S[i] in citydict:
        citydict[S].append((int(P),i))
    else:
        citydict[S] = [(int(P),i)]

for name in sorted(names):
    for point in sorted(citydict[name],reverse = True)
        print(point[1] + 1)

Submission status: Runtime Error

Solution code:
n = int(input())
li = [list(map(input().split())) for _ in range(n)]
print(li)

Submission status: Runtime Error

Solution code:
N = int(input())
S, P = [""], [0]
for _ in range(N):
    s, p = input().split()
    S.append(s)
    P.append(int(p))

I = [*range(1, N + 1)]
I.sort(key=lambda i: P[i], reverse=True)
I.sort(key=lambda i: S[i])

print(*I, sep='\n')

Submission status: Runtime Error

Solution code:
n = int(input())
r = []
for i in range(1, n+1):
  hoge = list(map(int, input().split()))
  hoge.append(i)
  r.append(hoge) 
tmp = sorted(r, key=lambda x:x[1], reverse=True)
res = sorted(tmp, key=lambda x:x[0])
for arr in res:
  print(arr[2])

Submission status: Runtime Error

Solution code:
n = int(input())
for i in range(1, n+1):
  hoge = list(map(int, input().split()))
  hoge.append(i)
  r.append(hoge) 
tmp = sorted(r, key=lambda x:x[1], reverse=True)
res = sorted(tmp, key=lambda x:x[0])
for arr in res:
  print(arr[2])

Submission status: Runtime Error

Solution code:
n = int(input())
r = [list(map(int, input().split())).append(i+1) for i in range(n)] 
tmp = sorted(r, key=lambda x:x[1], reverse=True)
res = sorted(tmp, key=lambda x:x[0])
for arr in res:
  print(arr[2])

Submission status: Runtime Error

Solution code:
n = int(input())
r = [list(map(int, input().split())).append(i+1) for i in range(n)] 
tmp = sorted(data, key=lambda x:x[1], reverse=True)
res = sorted(tmp, key=lambda x:x[0])
for arr in res:
  print(arr[2])

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
using namespace std;
 
int main(void){
    int n;
    cin >> n;
    vector<pair<pair<string,int>,int>> rest(n);
    for(int i = 0;i < n;i++){
        cin >> rest[i].first.first >> rest[i].first.second;
        rest[i].first.second *= -1;
        rest[i].second = i+1;
    }
 
    sort(rest.begin(),rest.end());
 
    for(int i = 0;i < n;i++){
        cout << rest[i].second << endl;
    }
 
    return 0;
}

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
 
int main(void){
    int n;
    cin >> n;
    vector<pair<pair<string,int>,int>> rest(n);
    for(int i = 0;i < n;i++){
        cin >> rest[i].first.first >> rest[i].first.second;
        rest[i].first.second *= -1;
        rest[i].second = i+1;
    }
 
    sort(rest.begin(),rest.end());
 
    for(int i = 0;i < n;i++){
        cout << rest[i].second << endl;
    }
 
    return 0;
}

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<algorithm>
using namespace std;
 
int main(void){
    int n;
    cin >> n;
    vector<pair<pair<string,int>,int>> rest(n);
    for(int i = 0;i < n;i++){
        cin >> rest[i].first.first >> rest[i].first.second;
        rest[i].first.second *= -1;
        rest[i].second = i+1;
    }
 
    sort(rest.begin(),rest.end());
 
    for(int i = 0;i < n;i++){
        cout << rest[i].second << endl;
    }
 
    return 0;
}

Submission status: Runtime Error

Solution code:
n = int(input())
sp = []
for i in range(n):
    sp.append(input().split())
    sp[i].append(i)
    sp[i][1] = int(sp[i][1])
sp = sorted(sp, key = lambda x : x[1], reverse = True)
sp = sorted(sp, key = lambda x : x[0])
fo ri in range(n):
    print(sp[i][2]+1)

Submission status: Runtime Error

Solution code:
n=input()
a=[input().split() + [i+1] for i in range(n)]
for i in range(n):
  a[i][1]= -int(a[i][1])
a.sort()
for i in range(n):
  print(a[i][2])

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(list(input().split() for i in range(2)) for j in range(n))
w = s.sort(key = itemgetter(0,1)
for i in range(n):
  for j in range(n):
    if w[i][0] == s[j][0]:
      if w[i][1] == s[j][1]:
         print(j + 1)

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(list(input().split() for i in range(2)) for j in range(n))
w = s.sort(key = itemgetter(0,1)
for i in range(n):
  for j in range(n):
    if w[i, 0] == s[j, 0]:
      if w[i, 1] == s[j, 1]:
         print(j + 1)

Submission status: Runtime Error

Solution code:
N = int(input())
mydict = []
for i in range(1, N+1):
  a, b=input().split()
  mydict.append([str(a), int(b), i])
mydict = sorted(mydict, key=lambda x:(x[0][1]))
for i in mydict:
  print(i[2])

Submission status: Runtime Error

Solution code:
N = int(input())
mydict = []
for i in range(N):
  a, b=input().split()
  mydict.append([str(a), int(b)])
mydict.sort()
fot i in range(N):
  print(mydict[i][1])

Submission status: Runtime Error

Solution code:
N = int(input())
mydict = []
for i in range(N):
  a, b=input().split()
  mydict.append([str(a), int(b)])
mydict.sort()
print(mydict[0], mydict[1])

Submission status: Runtime Error

Solution code:
from functools import cmp_to_key
def cmp(x, y):
  if x[0] < y[0]:
    return -1
  elif x[0] > y[0]:
    return 1
  else:
    return int(y[1]) - int(x[1])
n = int(input())
d = [input().split() for _ in range(n)]
for i in range(n):
  d[i].append(i + 1)
d.sort(key = cmp_to_key(cmp))
for i in range(n):
print(d[i][2])

Submission status: Runtime Error

Solution code:
print(*sorted(range(1,int(input())+1),key=lambda _:[(s,-int(p))for s,p in input().split()]))

Submission status: Runtime Error

Solution code:
from collections import defaultdict
n=int(input())

def guidebook(n):
    SPlist=defaultdict(list)
    for i in range(n):
        s,p=input().split()
        SPlist[s].append((int(p), i+1))

    if n==1:
        print(1)
        return

    ans=[]
    SPlist=[(k, v) for k, v in SPlist.items()]
    SPlist.sort()
    ans=[]
    count=1
    for sp in SPlist:
        p=sp[1]
        if len(p)>1:
            p.sort(reverse=True)
            for i in p:
                ans.append((count, i[1]))
                count+=1
        else:
            ans.append((count, p[1]))

    for i in ans:
        print(i[1])
    return

guidebook(n)

Submission status: Runtime Error

Solution code:
from collections import defaultdict
n=int(input())

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

ans=[]
SPlist=[(k, v) for k, v in SPlist.items()]
SPlist.sort()
ans=[]
count=1
for sp in SPlist:
    p=sp[1]
    if len(p)>1:
        p.sort(reverse=True)
        for i in p:
            ans.append((count, i[1]))
            count+=1
    else:
        ans.append((count, p[1]))

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

Submission status: Runtime Error

Solution code:
N = int(input())
s = {}
for _, i in zip(range(N), range(N)):
    p, q = map(str, input().split)
    s[q] = i
    
s.sort()

for i in range(N):
    print(s[i])aN = int(input())
j = []
for _, i in zip(range(N), range(N)):
    p, q = map(str, input().split())
    j.append(int(q))

for i in range(N):
    p = max(j)
    q = j.index(p)
    print(q+1)
    j[q] = 0

Submission status: Runtime Error

Solution code:
n = int(input())

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

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

for a in ans:
  print(a[2])

Submission status: Runtime Error

Solution code:
n = int(input())

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

for i in range(n):
	s[i][1] = int(s[i][1])

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

for a in ans:
  print(a[2])

Submission status: Runtime Error

Solution code:
N = int(input())
S = sorted((map(lambda y: (y[0], -int(y[1]), x), input().split()) for x in range(1, N+1)))
for x in S:
  print(x[2])

Submission status: Runtime Error

Solution code:
#炎の3段lambda
n = int(input())
li = [list(map(str, input().split())) for i in range(n)]
[li[i].append(str(i+1)) for i in range(n)]
li = sorted(li, key=lambda x:x[0])
rest = []
ans = []
for j in range(n-1):
    if li[j][0] == li[j+1][0]:
        rest.append(li[j])

    else:
        rest.append(li[j])
        ans.append(sorted(rest, key=lambda x:x[1], reverse = True))
        rest = []
rest.append(li[j+1])
ans.append(sorted(rest, key=lambda x:x[1], reverse = True))
ans = [flatten for inner in ans for flatten in inner]
for k in range(n):
    print(int(ans[k][2]))

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
 if __name__ == "__main__":
    n = int(input())
    work = {}
    i = 1;
    lines = [input().split() for i in range(n)]
    for (city,score) in lines:
        if city not in work:
            work[city] = []
        work[city].append((int(score),i))
        i += 1

    for city in sorted(work.keys()):
        tuple = work[city]
        for restaurant in sorted(tuple, reverse=True):
            print(restaurant[1])

Submission status: Runtime Error

Solution code:
    
 if __name__ == "__main__":

  	count = input()
    work = {}
    i = 1;
    for line in input():
        (city, score) = line.split(' ')
        if city not in work:
            work[city] = []
        work[city].append((int(score),i))
        i += 1

    for city in sorted(work.keys()):
        tuple = work[city]
        for restaurant in sorted(tuple, reverse=True):
            print(restaurant[1])

Submission status: Runtime Error

Solution code:
    lines = input().split('\n')

    count = lines[0]
    work = {}
    i = 1;
    for line in lines[1:]:
        (city, score) = line.split(' ')
        if city not in work:
            work[city] = []
        work[city].append((int(score),i))
        i += 1

    for city in sorted(work.keys()):
        tuple = work[city]
        for restaurant in sorted(tuple, reverse=True):
            print(restaurant[1])

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    count = input()
    work = {}
    i = 1;
    for line in input():
        (city, score) = line.split(' ')
        if city not in work:
            work[city] = []
        work[city].append((int(score),i))
        i += 1

    for city in sorted(work.keys()):
        tuple = work[city]
        for restaurant in sorted(tuple, reverse=True):
            print(restaurant[1])

Submission status: Runtime Error

Solution code:
n = int(input())
# a, p = list(map(int, input().split()))
# a = list(map(int, input().split()))
# S = [list(map(int, input().split())) for i in range(n)]
S = [list(input().split()) for i in range(n)]

# for i, s in enumerate(S):
#     s.append(i+1)

S = sorted(S, key=lambda x: x[1], reverse=True)
S = sorted(S, key=lambda x: x[0], reverse=False)

for s, p, n in S:
    print(n)

Submission status: Runtime Error

Solution code:
package main

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

type Restaurant struct {
	S string
	P int
	Idx int
}

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

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

func main() {
	solve()
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

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

Submission status: Runtime Error

Solution code:

N = int(input())
res = []
for i in range(N):
    S, P = list(input().split())
    bisect.insort(res, (S, -int(P), i + 1))
for i in range(len(res)):
    print(res[i][2])

Submission status: Runtime Error

Solution code:
from operator import itemgetter
n = int(input())
rest = []
for i in range(n):
    s, p = map(str, input().split())
    rest.append([i+1, s, int(p)])

    rest.sort(key=itemgetter(2), reverse=True)
    rest.sort(key=itemgetter(1))
    for i in range(n):
      print(rest[i][0])

Submission status: Runtime Error

Solution code:
from operator import itemgetter
n = int(input())
rest = []
for i in range(n):
  s, p = map(str, input().split())
  rest.append([i+1, s, int(p)])

  rest = sorted(rest, key=itemgetter(2), reverse=True)
  rest = sorted(rest, key=itemgetter(1))
  for i in range(n):
    print(rest[i][0])

Submission status: Runtime Error

Solution code:
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])

Submission status: Runtime Error

Solution code:
n = int(input())
s = []
p = []
for i in range(n):
    S,P = map(str,input().split())
    P = int(P)
    s.append(S)
    p.append(P)
i = s.sorted()
result = [0 for i in range(n)]
for i in range(n):
    num = i.index(s[i])
    for j in range(n):
        if s[num] == s[num + 1]:
            m
        
    result = []

Submission status: Runtime Error

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

l.sort()
for i in l:
    print(i[2])

Submission status: Runtime Error

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

l.sort()
for i in l:
    print(i[2])

Submission status: Runtime Error

Solution code:
N = int(input())
SP = [list(input().split())) for i in range(N)]

sorted_SP = sorted(SP, key=lambda x:x[1], reverse=True)
sorted_SP = sorted(sorted_SP, key=lambda x:x[0])

for i in range(N):
  for j in range(N):
    if SP[i][0] == sorted_SP[j][0] and SP[i][1] == sorted_SP[j][1]:
      print(j+1)
      break

Submission status: Runtime Error

Solution code:
N = int(input())
SP = [list(map(int, input().split())) for i in range(N)]

sorted_SP = sorted(SP, key=lambda x:x[1], reverse=True)
sorted_SP = sorted(sorted_SP, key=lambda x:x[0])

for i in range(N):
  for j in range(N):
    if SP[i][0] == sorted_SP[j][0] and SP[i][1] == sorted_SP[j][1]:
      print(j+1)
      break

Submission status: Runtime Error

Solution code:
N = int(input())
SP = [list(map(int, input().split())) for i in range(N)]

sorted_SP = sorted(SP, key=lambda x:x[1], reverxe=True)
sorted_SP = sorted(sorted_SP, key=lambda x:x[0])

for i in range(N):
  for j in range(N):
    if SP[i][0] == SP[j][0] and SP[i][1] == SP[j][1]:
      print(j+1)
      break

Submission status: Runtime Error

Solution code:
from collections import defaultdict
d = defaultdict(list)
n = int(input())
for i in range(n):
    city, point = input().split()
    d[city].append((int(point), i))

d2 = sorted(d.items())
for i in range(len(d2)):
    sorted(d2[i][1])
    for j in range(len(d2[i])):
        print(d2[i][1][j][1] + 1)

Submission status: Runtime Error

Solution code:
n=int(input())
a=[[0,0,0] for i in range(n)]
for i in range(n):
    a[i][0],a[i][1],a[i][2]=map(int,input().split())
a.sort(key = lambda x:x[1])
for i in range(n):
    print(a[i][2])

Submission status: Runtime Error

Solution code:
n=int(input())
a=[[0,0,0] for i in range(n)]
for i in range(n):
    a[i][0],a[i][1],a[i][2]=map(int,input().split())
a.sort(key = lambda x:x1)
for i in range(n):
    print(a[i][2])

Submission status: Runtime Error

Solution code:
n=int(input())
a=[[0,0,0] for i in range(n)]
for i in range(n):
    a[i][0],a[i][1],a[i][2]=map(int,input().split())
a.sort(key = lamda x:x1)
for i in range(n):
    print(a[i][2])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

book.reverse(key = lambda x:x[1])
book.sort(key = lambda x:x[0])

for j in range(len(book)):
    print(book[j][2])

Submission status: Runtime Error

Solution code:
n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

book.reverse(key = lambda x:x[1])
book.sort(key = lambda x:x[0])

for j in range(len(book)):
    print(book[j][2])

Submission status: Runtime Error

Solution code:
n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

book.sort(key = lambda x:x[1], reverce = True)
book.sort(key = lambda x:x[0])

for j in range(len(book)):
    print(book[j][2])

Submission status: Runtime Error

Solution code:
n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

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

for j in range(len(book)):
    print(book[j][3])

Submission status: Runtime Error

Solution code:
n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

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

for j in range[len(book)]:
    print(book[j][3])

Submission status: Runtime Error

Solution code:
for j in sorted([[(s,-int(p),i+1) for s,p,i in enumerate(input().split())] for _ in range(int(input()))]):print(j[2])

Submission status: Runtime Error

Solution code:
n = int(raw_input)
restaurants = []
for i in range(n):
    line = raw_input().split()
    restaurants.append((line[0], int(line[1]), i+1))
restaurants.sort(key=lambda x: (x[0], x[1]))
for i in range(n):
    print resutaurants[i][2]

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
        N = int(input())
        q=[input().split()+[i]for i in range(N)]
         
          for i in range(N):
            q[i][1]=int(q[i][1])
            q.append((c,int(p)*-1,i+1))
        a = sorted(q)
        for s,t,r in q:
            print(r+1)

Submission status: Runtime Error

Solution code:
    N = int(input())
    q=[input().split()+[i]for i in range(N)]
     
      for i in range(N):
        q[i][1]=int(q[i][1])
        q.append((c,int(p)*-1,i+1))
    a = sorted(q)
    for i in range(N):
        print(a[i][2])

Submission status: Runtime Error

Solution code:
    N = int(input())
    q=[input().split()+[i]for i in range(n)]
     
      for i in range(N):
        q[i][1]=int(q[i][1])
        q.append((c,int(p)*-1,i+1))
    a = sorted(q)
    for i in range(N):
        print(a[i][2])

Submission status: Runtime Error

Solution code:
            n=int(input())
            q=[input().split()+[i]for i in range(n)]
                for i in range(n):
                    q[i][1]=int(q[i][1])
                  
                p =  sorted(q,key=lambda x:x[1],reverse=True)
            for s,t,r in p:
            	print(r+1)

Submission status: Runtime Error

Solution code:
n=int(input())
q=[input().split()+[i]for i in range(n)]
	for i in range(n):
    	q[i][1]=int(q[i][1])
print(sorted(q,key=lambda x:x["no"],reverse=True))

Submission status: Runtime Error

Solution code:
N = int(input())
jisyo = {}
for i in range(N):
        lists = []
        a,b = list(input().split())
        lists.append(int(b))
        lists.append(i+1)
        jisyo[a] = lists
jisho.sort()
for v in jisho.values():
        print(v[1])

Submission status: Runtime Error

Solution code:
list_SP = []
N = int(input())

for i in range(N):
  S, P = input().split()
  list_SP.append([S, 100 - int(P), i+1])
  
  
sorted_listSP = sorted(list_SP)
print(sorted_listSP[2])

Submission status: Runtime Error

Solution code:
# ABC128-B
# ソートが大事な問題
import itemgetter
a = int(input())
book = []
for i in range(a):
    array = input().split()
    book.append((array[0], int(array[1]) * -1, i))

ans = sorted(book, key=itemgetter(0, 1))

for i in range(a):
    print(ans[i][2] + 1)

Submission status: Runtime Error

Solution code:
n = int(input())

SP = []

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

print(SP[2])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
number=int(input())
book=[]
for i in range(0,number):
  book.append((input().split()).append(i+1))
book1=list.sort(book,key=lambda x: x[1],reverse=True)
book2=book2.sort()
for i in range(0,len(book2)):
  print(book[i][2],'\n')

Submission status: Runtime Error

Solution code:
def main():

    N = int(input())
    if 0 > N or N > 100:
        print("input N error")
        exit()
        
    a = []
    for i in range(N):
        b = input().split()
        if len(b[0]) > 10 or len(b[0]) < 1:
            print("input S error")
            exit()

        if int(b[1]) < 0 or int(b[1]) > 100:
            print("input P error")
            exit()

        b.append(i + 1)
        a.append(b)
        
    a.sort()
    c = []
    answer = []
    
    for i in range(len(a)):
        c.append(a[i])
        
        if a[i][0] != a[i+1][0] and i != len(a) - 2:
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            c = []

        elif a[i][0] != a[i+1][0] and i == len(a) - 2:
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            answer += a[i + 1]
            break

        elif a[i][0] == a[i+1][0] and i == len(a) - 2:
            c.append(a[i + 1])
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            break
        
    for i in range(len(answer)):
        print(answer[i][2])
        
        
if __name__ == '__main__':

    main()

Submission status: Runtime Error

Solution code:
def main():

    N = int(input())
    if 0 > N or N > 100:
        print("input N error")
        exit()
        
    a = []
    for i in range(N):
        b = input().split()
        if len(b[0]) > 10 or len(b[0]) < 1:
            print("input S error")
            exit()

        if int(b[1]) < 0 or int(b[1]) > 100:
            print("input P error")
            exit()

        b.append(i + 1)
        a.append(b)
        
    a.sort()
    c = []
    answer = []
    
    for i in range(len(a) - 1):
        c.append(a[i])
        
        if a[i][0] != a[i+1][0] and i != len(a) - 2:
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            c = []

        elif a[i][0] != a[i+1][0] and i == len(a) - 2:
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            answer += a[i + 1]
            c = []
            
        elif a[i][0] == a[i+1][0] and i == len(a) - 2:
            c.append(a[i + 1])
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            break
            
    for i in range(len(answer)):
        print(answer[i][2])
        
        
if __name__ == '__main__':

    main()

Submission status: Runtime Error

Solution code:
def main():

    N = int(input())
    #if 0 > N or N > 100:
    #    print("input N error")
    #    exit()
        
    a = []
    for i in range(N):
        b = input().split()
        if len(b[0]) > 10 or len(b[0]) < 1:
            print("input S error")
            exit()

        if int(b[1]) < 0 or int(b[1]) > 100:
            print("input P error")
            exit()

        b.append(i + 1)
        a.append(b)
        
    a.sort()
    c = []
    answer = []
    
    for i in range(len(a)):
        c.append(a[i])
        
        if a[i][0] != a[i+1][0] and i != len(a) - 2:
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            c = []

        elif a[i][0] != a[i+1][0] and i == len(a) - 2:
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            answer += a[i + 1]
            break

        elif a[i][0] == a[i+1][0] and i == len(a) - 2:
            c.append(a[i + 1])
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            break
        
    for i in range(len(answer)):
        print(answer[i][2])
        
        
if __name__ == '__main__':

    main()