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

Solution code:
def main():
    from sys import stdin, stdout

    def read():
        return stdin.readline().rstrip('\n')

    def read_array(sep=None, maxsplit=-1):
        return read().split(sep, maxsplit)

    def read_int():
        return int(read())

    def read_int_array(sep=None, maxsplit=-1):
        return [int(a) for a in read_array(sep, maxsplit)]

    def write(*args, **kwargs):
        sep = kwargs.get('sep', ' ')
        end = kwargs.get('end', '\n')
        stdout.write(sep.join(str(a) for a in args) + end)

    def write_array(array, **kwargs):
        sep = kwargs.get('sep', ' ')
        end = kwargs.get('end', '\n')
        stdout.write(sep.join(str(a) for a in array) + end)

    N = read_int()
    citites = []
    for i in range(N):
        name, score = read_array()
        score = int(score)
        citites.append((name, -score, i))
    citites.sort()
    for _, _, i in citites:
        write(i+1)


main()

Submission status: Accepted

Solution code:
N = int(input())
rest = []
for i in range(N):
    name, score = input().split()
    rest.append((name, -int(score), i+1))
rest.sort()
for _, _, i in rest:
    print(i)

Submission status: Accepted

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

rs = sorted(rs)
for r in rs:
    print(r[2])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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

Submission status: Accepted

Solution code:
N = int(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: Accepted

Solution code:
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)
for i in l:
        print(i[2])

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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 I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)


def main():
    n = I()
    aa = [LS() for _ in range(n)]
    a = []
    for i in range(n):
        s,t= aa[i]
        t = int(t)
        a.append((s,-t,i+1))
    a.sort()

    return '\n'.join(map(lambda x: str(x[2]), a))


print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

arr.sort()
for s, p, i in arr:
  print(i)

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 = sorted(l,key = lambda x:x[1],reverse=True)
l = sorted(l,key = lambda x:x[0])

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

Submission status: Runtime Error

Solution code:
N=int(input())
place=[0]*N
score=[0]*N
for i in range(N):
  place[i],score[i]=input().split()
  score[i]=int(-score[i])
mylist=[]
for num in range(N):
  mylist.append([place[num],score[num],num])
from operator import itemgetter
mylist.sort(key=itemgetter(0,1))
for num in range(N):
  mylist[num].append(num+1)
mylist.sort(key=itemgetter(2))
for num in range(N):
  print(mylist[num][3])

Submission status: Runtime Error

Solution code:
N=int(input())
place=[]*N
score=[]*N
for i in range(N):
  place[i],score[i]=input().split()
  score[i]=int(-score[i])
mylist=[]
for num in range(N):
  mylist.append([place[num],score[num],num])
from operator import itemgetter
mylist.sort(key=itemgetter(0,1))
for num in range(N):
  mylist[num].append(num+1)
mylist.sort(key=itemgetter(2))
for num in range(N):
  print(mylist[num][3])

Submission status: Runtime Error

Solution code:
N=int(input())
place=[]
score=[]
place_l=[]
score_l=[]
for i in range(N):
  p,s = input().split()
  place.append(p)
  score.append(-int(s))
mylist=[]
for num in range(N):
  mylist.append([place[num],score[num],num])
from operator import itemgetter
mylist.sort(key=itemgetter(0,1))
for num in range(N):
  mylist[num].append(num+1)
mulist.sort(key=itemgetter(2))
for num in range(N):
  print(mylist[num][3])

Submission status: Runtime Error

Solution code:
N=int(input())
A=[list(map(int,input().split())) for i in range(N)]
for num in range(N):
  A[num].append(num+1)
from operator import itemgetter
A.sort(key=itemgetter(1,0))
for num in range(N):
  A[num].append(num+1)
A.sort(key=itemgetter(2))
for num in range(N):
  print(A[num][3])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
l=[input().split() for i in range(n)]
l2=[x for x in range(10)]
base=list(zip(l2,l))
ans=sorted(base, key=lambda x: x[1][1],reverse=True)
ans=sorted(ans,key=lambda x: x[1][0])

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

Submission status: Runtime Error

Solution code:
n=int(input())
l=[input().split() for i in range(n)]
tmp=sorted(l, key=lambda x: x[1],reverse=True)
tmp=sorted(tmp,key=lambda x: x[0])
l2=[x for x in range(10)]
ans=list(zip(l2,tmp))

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = []
for i in range(N):
    S, P = map(str, input().split())
    P = int(p)
    A.append([S, -P])
A.sort()
for i in A:
    print(A.index(i)+1)

Submission status: Runtime Error

Solution code:
n = int(input())

res = []
for i in range(n):
  city, value = input().split()
  value = int(value)
  res.append([city, value, i])
res_s = sorted(res, key = lambda x: (x[0], -x[1]))
for i in range(n):
  print(ans[i][2])

Submission status: Runtime Error

Solution code:
import pandas as pd
import numpy as np
N = int(input())
df = pd.DataFrame(index = range(1,N+1),columns =['name','score'])
for i in range(N):
    name,score = input().split()
    df['name'].iloc[i] = name
    df['score'].iloc[i] = score
for i in df.sort_values(['name','score'],ascending = [True,False]).index:
    print(i)

Submission status: Runtime Error

Solution code:
import pandas as pd

list_city =[]
list_point = []
list_index = []
N = int(input())
for i in range(N):
    a, b= input().split()
    list_city.append(a)
    list_point.append(int(b) * (-1))
    list_index.append(i+1)

df = pd.DataFrame({'city':list_city, 'point':list_point, 'index':list_index})

df_t = df.sort_values(['city','point'])

i=0

for i in range(N):
    print(df_t.iat[i,2])
    print("\n")

Submission status: Runtime Error

Solution code:
import pandas as pd

list_city =[]
list_point = []
list_index = []
N = int(input())
for i in range(N):
    a, b= input().split()
    list_city.append(a)
    list_point.append(int(b) * (-1))
    list_index.append(i+1)

df = pd.DataFrame({'city':list_city, 'point':list_point, 'index':list_index})

i=0
print(df_t)
for i in range(N):
    print(df_t.iat[i,2])

Submission status: Runtime Error

Solution code:
import pandas as pd

list_city =[]
list_point = []
list_index = []
N = int(input())
for i in range(N):
    a, b= input().split()
    list_city.append(a)
    list_point.append(int(b) * (-1))
    list_index.append(i+1)

df = pd.DataFrame({'city':list_city, 'point':list_point, 'index':list_index})

df_t = df.sort_values(['city','point'])

i=0
print(df_t)
for i in range(N):
    print(df_t.iat[i,2])

Submission status: Runtime Error

Solution code:
import sys
import pandas as pd
list_city =[]
list_point = []
list_index = []
N = int(input())
for i in range(N):
    a, b= input().split()
    list_city.append(a)
    list_point.append(b * (-1))
    list_index.append(i+1)

df = pd.DataFrame({'city':list_city, 'point':list_point, 'index':list_index})

df_t = df.sort_values(['city','point'])

i=0
for i in range(N):
    print(df_t.iat[i,2])

Submission status: Runtime Error

Solution code:
n=int(input())

l=[]
for i in range(n):
  a,b=map(str, input().split())
  b=100-int(b)
  if b<10:
    b=str('0')+str(b)
  elif b==100:
    b=="999"
  else:
    b=str(b)
  a=a+b
  l.append(a)

l2=sorted(l)

for i in range(n):
  print(l.index(l2[i])+1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
restaurant = [input().split() for i in range(n)]
restaurant_sorted = sorted(restaurant)

for i in range(n):
    print(restaurant.index((restaurant_sorted[i]))

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(list(input().split()) for _ in range(n))
ans = [s.index(i)+1 for i in sorted(s, key=lambda x:(x[0], -int(x[1])))]
print(i) for i in ans

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(input().split() for _ in range(n))
ans = [s.index(i)+1 for i in sorted(s, key=lambda x:(x[0], -int(x[1])))]
print(i) for i in ans

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(i, int(j) for i, j in input().split())
ans = [s.index(i)+1 for i in sorted(s, key=lambda x:(x[0], -x[1]))]
print(i) for i in ans

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(i, int(j) for i, j in input().split()
ans = [s.index(i)+1 for i in sorted(s, key=lambda x:(x[0], -x[1]))]
print(i) for i in ans

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(i, int(j) for i, j in map(input()))
ans = [s.index(i)+1 for i in sorted(s, key=lambda x:(x[0], -x[1]))]
print(i) for i in ans

Submission status: Runtime Error

Solution code:
n = int(input)
for i in range(n):
    std_in = input().split()
    dat.append([std_in[0], int(std_in[1])])

for i, e in enumerate(dat, start=1):
    e[1] = -e[1]  # 点数を降順ソートするために点数をマイナスにする。
    e.append(i)  # ソート前の順序
 
    sorted_list = sorted(dat)  # 都市名と点数のマイナス値で昇順ソート
 
for i, s in enumerate(sorted_list):
    # 順序を出力
    print(sorted_list[i][2])

Submission status: Runtime Error

Solution code:
n = int(input)
for i in range(n):
    std_in = input.split()
    dat.append([std_in[0], int(std_in[1])])

for i, e in enumerate(dat, start=1):
    e[1] = -e[1]  # 点数を降順ソートするために点数をマイナスにする。
    e.append(i)  # ソート前の順序

    sorted_list = sorted(dat)  # 都市名と点数のマイナス値で昇順ソート

for i, s in enumerate(sorted_list):
    # 順序を出力
    print(sorted_list[i][2])

Submission status: Runtime Error

Solution code:
N=int(input())
data=[input().split() for i in range(N)]
data_name=[]
for i in range(N):
    if data[i][0] in data_name:
        continue
    else:
        data_name.append(data[i][0])
data_name_sort=sorted(data_name)
data_point=[]
for i in range(N):
    num=0
    for j in range(len(data_name_sort)):
        if data[i][0]==data_name_sort[j]:
            num+=(len(data_name)-j)*200+int(data[i][1])
        else:
            continue
    data_point.append(num)
data_sort=[i for i, _ in sorted(enumerate(data_point), key=lambda x:x[1])][::-1]
for i in range(N):
    ans=int(data_sort(i))+1
    print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
data=[input().split() for i in range(N)]
data_name=[]
for i in range(N):
    if data[i][0] in data_name:
        continue
    else:
        data_name.append(data[i][0])
data_name_sort=sorted(data_name)
#print(data_name_sort)
data_point=[]
for i in range(N):
    num=0
    for j in range(len(data_name_sort)):
        if data[i][0]==data_name_sort[j]:
            num+=(len(data_name)-j)*200+int(data[i][1])
        else:
            continue
    data_point.append(num)
#print(data_point)
data_sort=[i for i, _ in sorted(enumerate(data_point), key=lambda x:x[1])][::-1]
#print(data_sort)
for i in range(N):
    ans=int(data_sort(i))+1
    print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
data_pre=[input().split() for i in range(N)]
data_name=[]
for i in range(N):
    if data[i][0] in data_name:
        continue
    else:
        data_name.append(data[i][0])
data_name_sort=sorted(data_name)
data_point=[]
for i in range(N):
    num=0
    for j in range(len(data_name_sort)):
        if data[i][0]==data_name_sort[j]:
            num+=(len(data_name)-j)*100+int(data[i][1])
        else:
            continue
    data_point.append(num)
data_sort=[i for i, _ in sorted(enumerate(data_point), key=lambda x:x[1])][::-1]
for i in range(N):
    ans=int(data_sort.index(i))+1
    print(ans)

Submission status: Runtime Error

Solution code:
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

N = int(input())
L = []
for i in range(N):
    c, p = input().split()
    p = int(p)
    L.append([i+1, c, p])
L = sorted(L, lambda x: (x[1], -x[2]))
for i in range(N):
    print(L[i][0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
lst = []
for i in range(n):
  s, p = input().split()
  p = int(p)
  lst.append((s, p, i+1))
lst_sorted = sorted(lst, key:lambda x: (x[0], -x[1]))
for _, _, num in lst_sorted:
  print(num)

Submission status: Runtime Error

Solution code:
n = int(input())
r = []
for i in range(n):
    s,p = input().split()
    p = int(p)
    r.append([s,p,i])
a = sorted(r)
for i in range(n):
    print(a[i][3]+1)

Submission status: Runtime Error

Solution code:
n = int(input())
grid = []
for i in range(n):
    s,p = input().split()
    grid.append([s,p])
min = grid[0][0]
for i in range(n-1):
    if min >= grid[1]:
        min = grid[1]
print(min)

Submission status: Runtime Error

Solution code:
n=int(input())
res=[]
for i in range(n):
    s,p=max(str,input().split())
    res.append([s,int(p)])
res1=res
res=sorted(res,key=lambda x:(x[0], -x[1]))
for i in range(n):
	print(res1.index(res[i])+1)

Submission status: Runtime Error

Solution code:
n=int(input())
res=[]
for i in range(n):
	s,p=max(str,input().split())
    res.append([s,int(p)])
res1=res
res=sorted(res,key=lambda x:(x[0], -x[1]))
for i in range(n):
	print(res1.index(res[i])+1)

Submission status: Runtime Error

Solution code:
n=int(input())
res=[]
for i in range(n):
	s,p=max(str,input().split())
    res.append([s,int(p)])
res1=res
res=sorted(res,key=lambda x:x[0], -x[1])
for i in range(n):
	print(res1.index(res[i])+1)

Submission status: Runtime Error

Solution code:
n = int(input())
rs = []

for i in range(n):
  	rs.append(input().split())
    rs [i][1] = int(rs[i][1])
    rs[i].append(i + 1)
rs_obj = { r[0]: [] for r in rs }

for r in rs:
  rs_obj[r[0]].append(r[1:])
  
print(rs_obj)

Submission status: Runtime Error

Solution code:
n = int(input())
rs = []

for i in range(n):
  	rs.append(input().split())
    rs [i][1] = int(rs[i][1])
    rs[i].append(i + 1)
rs_obj = { r[0]: [] for r in rs }
print(rs_obj)

Submission status: Runtime Error

Solution code:
n = int(input())
rs = []

for i in range(n):
  	rs.append(input().split())
    rs [i][1] = int(rs[i][1])
    rs[i].append(i + 1)
rs_obj = { r[0]: [] fpr r rs }
print(rs_obj)

Submission status: Runtime Error

Solution code:
n = int(input())
rs = []

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

print(rs)

Submission status: Runtime Error

Solution code:
n = int(input())
rs = []

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

print(rs)

Submission status: Runtime Error

Solution code:
n = int(input())
rs = []

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

print(rs)

Submission status: Runtime Error

Solution code:
n = int(input())
rs = []

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

Submission status: Runtime Error

Solution code:
n = int(input())
rs = []

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

Submission status: Runtime Error

Solution code:
n = int(input())
rs = []
for i in range(n):
  	rs.append(input().split())
    rs [i][1] = int(rs[i][1]
                    
rs ::= []

Submission status: Runtime Error

Solution code:
n = int(input())
rs = []
for i in range(n):
  	rs.append(input().split())
    rs [i][1] = int(rs[i][1]

Submission status: Runtime Error

Solution code:
n=in(input())
rs=[]

for i in range(n):  
rs.append(inputU.splitU)
rs[i][1]=int(rs[i][1])

Submission status: Runtime Error

Solution code:
n = int(input())
rs = []
for i in range(n):
  	rs.append(input().split())
    rs [i][1] = int

Submission status: Runtime Error

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

a = sorted(l, key=lambda i: (i[0], -l[1]))

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

Submission status: Runtime Error

Solution code:
import pandas as pd
N = int(input())
city=[]
for n in range(N):
    S = input().split()
    city.append(S)
city=pd.DataFrame(city).sort_values([0,1],ascending=[True, False])

# city=city.sort_index()
for ans in city.index:
    print(ans+1)

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    inlis = []
    namelis = []
    for i in range(n):
        a, b = map(str, input().split())
        b = int(b)
        inlis.append([a,b])
        namelis.append(a)
    namelis.sort()    
    inlis_so = sorted(inlis)
    anslis = []
    for num in inlis:
        #print(num, num[0], inlis_so, inlis_so.count(num[0]))
        kazu = namelis.count(num[0])
        if kazu == 1:
            anslis.append(inlis_so.index(num))
        else:
            kijun = namelis.index(num[0])+1
            kouho = inlis
            kouho_so = sorted(kouho, key = lambda x:x[1], reverse = True)
            suujibun = kouho_so.index(num)
            anslis.append(kijun + suujibun)
    for i in range(1, n+1):
        print(anslis.index(i)+1)

    

        
    
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    inlis = []
    namelis = []
    for i in range(n):
        a, b = map(str, input().split())
        b = int(b)
        inlis.append([a,b])
        namelis.append(a)
    namelis.sort()    
    inlis_so = sorted(inlis)
    anslis = []
    for num in inlis:
        #print(num, num[0], inlis_so, inlis_so.count(num[0]))
        kazu = namelis.count(num[0])
        if kazu == 1:
            anslis.append(inlis_so.index(num))
        else:
            kijun = namelis.index(num[0])+1
            kouho = list(filter(lambda word:True if word[0] == num[0] else False,inlis))
            kouho_so = sorted(kouho, key = lambda x:x[1], reverse = True)
            suujibun = kouho_so.index(num)
            anslis.append(kijun + suujibun)
    for i in range(1, n):
        print(anslis.index(i)+1)

    

        
    
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    inlis = []
    namelis = []
    for i in range(n):
        a, b = map(str, input().split())
        b = int(b)
        inlis.append([a,b])
        namelis.append(a)
    namelis.sort()    
    inlis_so = sorted(inlis)
    anslis = []
    for num in inlis:
        #print(num, num[0], inlis_so, inlis_so.count(num[0]))
        kazu = namelis.count(num[0])
        if kazu == 1:
            anslis.append(inlis_so.index(num))
        else:
            kijun = namelis.index(num[0])+1
            kouho = list(filter(lambda word:True if word[0] == num[0] else False,inlis))
            kouho_so = sorted(kouho, key = lambda x:x[0], reverse = True)
            suujibun = kouho_so.index(num)
            anslis.append(kijun + suujibun)
    for i in range(1, n+1):
        print(anslis.index(i)+1)

    

        
    
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    inlis = []
    namelis = []
    for i in range(n):
        a, b = map(str, input().split())
        b = int(b)
        inlis.append([a,b])
        namelis.append(a)
    namelis.sort()    
    inlis_so = sorted(inlis)
    k = 0
    anslis = []
    for num in inlis:
        #print(num, num[0], inlis_so, inlis_so.count(num[0]))
        kazu = namelis.count(num[0])
        if kazu == 1:
            anslis.append(inlis_so.index(num))
        else:
            kijun = namelis.index(num[0])+1
            kouho = list(filter(lambda word:True if word[0] == num[0] else False,inlis))
            kouho_so = sorted(kouho, key = lambda x:x[1], reverse = True)
            suujibun = kouho_so.index(num)
            #print(kouho, kouho_so, kijun, suujibun)
            anslis.append(kijun + suujibun)
    for i in range(1, n+1):
        print(anslis.index(i)+1)

    

        
    
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
my_list = []
for i in range(1,N+1):
    l = list((input().split()))
    l.append(i)
    my_list.append(l)

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

Submission status: Runtime Error

Solution code:
N = int(input())
lis = [(input() + " " + str(i+1)).split() for i in range(N)]
 
lis = [k for k in lis]
 
lis.sort(key=lambda k: int(k[1]). reverse=True)
lis.sort(key=lambda k: k[0])
 
 
for i in lis:
    print(i[2])

Submission status: Runtime Error

Solution code:
N = int(input())
list1 = [(input() + " " + str(i+1)).split() for i in range(N)]
 
list1 = [a for a in lis]
 
list1.sort(key=lambda a: int(a[1]), reverse=True)
list1.sort(key=lambda a: a[0])
 
 
for i in list1:
    print(i[2])

Submission status: Runtime Error

Solution code:
N = int(input())
lis = [(input() + " " + str(i+1)).split() for i in range(N)]

lis = [k for k in lis]

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


for j in lis:
    print(j[2])
N = int(input())
lis = [(input() + " " + str(i+1)).split() for i in range(N)]

lis = [k for k in lis]

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


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

Submission status: Runtime Error

Solution code:
list = []
N = int(input())
for i in range(N):
  S, P = map(str, input().split())
  list.append((i+1, S, int(P)))
list = sorted(lst, key=lambda x:(x[1], -x[2]))
 
for l in list:
  print(l[0])

Submission status: Runtime Error

Solution code:
N = int(input())
shops = []
for i in range(N):
    S, P = input().split()
    shops.append([S, int(P), i])
shops.sort(key=1)
shops.sort()
for shop in shops:
    print(shop[2])

Submission status: Runtime Error

Solution code:
cities=[]
points=[]
if N>=1 and N<=100:
    for i in range(0,N):
        a=sys.stdin.readline()
        string = re.findall(r'\w+',a)
        number = re.findall('\d+',a)
        if len(string)>1:
            string.pop(len(string)-1)
            b=" ".join(string)
            cities.append(b)
        else:
            city=[i for i in string]
            cities.append(city[0])
        d=int(number[0])
        z=float(number[0])
        if 0<=d<=100 and d==z:
            points.append(int(number[0]))
    tuple = [((i+1),cities[i],points[i]) for i in range(len(cities))]
    def multisort(xs, specs):
        for key, reverse in reversed(specs):
            xs.sort(key=itemgetter(key), reverse=reverse)
        return xs
    s=multisort(list(tuple), ((1, False), (2, True)))
    for i in s:
        print(i[0])

Submission status: Runtime Error

Solution code:
n=int(input())

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

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

Submission status: Runtime Error

Solution code:
_N, *_SP = open(0).read().split()
N = int(_N)

S = {}
P = {}

for i in range(N):
    S[i+1] = _SP[2*i]
    P[i+1] = int(_SP[2*i+1])
    
import pandas as pd

S_df = pd.DataFrame(S.values(), index=S.keys(), columns=["name"])
P_df = pd.DataFrame(P.values(), index=P.keys(), columns=["point"])

df = pd.concat([S_df, P_df], axis=1)
print(*list(df.sort_values(['name', 'point'], ascending=[True, False]).index), sep="\n")

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    ll = list()
    for i in range(n):
        tmp = list(map(str, input().split()))
        tmp[1] = int(tmp[1])
        tmp.append(i+1)
        ll.append(tmp)
    print(ll)
    
    ll_s = sorted(ll, key=lambda x:(x[0],-x[1]))
    print(ll_s)
    for i in ll_s:
        print(i[2][0])
        
if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
dic = {}
for i in range(1,n+1):
    s,p = map(str,input().split())
    dic[i]=s+str(1/int(p))
for s in sorted(dic.items(),key=lambda x:x[1]):
    print(s[0])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n=int(input())
l=[]
for i in range(n):
  s,p=map(int,input().split())
  l.append([i+1,s,p])
l.sort(key=lambda x:x[2],reverse=True)
l.sort(key=lambda x:x[1])
for ll in l:
  print(ll[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
a=[[]*3 for ii in range(n)]
for ii in range(n):
  s=input().split()
  a[ii][0]=s[0]
  a[ii][1]=-int(s[1])
  a[ii][2]=ii
a.sort()
for ii in range(n):
  print(a[ii][2]+1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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