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

        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]

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

Submission status: Runtime Error

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

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]

        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
    
    for i in range(len(answer)):
        print(answer[i][2])
        
        
if __name__ == '__main__':

    main()

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
import collections as cl

N=int(input())

L = cl.deque()

for i in range(N):
  S,P_ = input().split()
  P = int(P_)
  
  flg = False
  for j in range(len(L)):
    if L[j][0]>S or (L[j][0]==S and L[j][1]>P):
      L.insert(j,(S,P,i))
      flg = True
  if flg==False:
    L.append(j,(S,P,i))
    
I = [0]*N
for i in range(N):
  I[L[i][2]] = i+1

for i in range(N):
  print(I[i])

Submission status: Runtime Error

Solution code:
N = int(input())
lst = []
for i in range(N):
  city, score = map(int, input().split())
  lst.append((city, score, i+1))

lst.sort(key=lambda x: x[1], reverse=True)
lst.sort(key=lambda x: x[0])
for tup in lst:
  c, s, i = tup
  print(i)

Submission status: Runtime Error

Solution code:
n = int(input())
lst = [list(input().split())+[i+1] for i in range(n)]

print(lst)

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

for i in range(0, len(lst)):
    print(i[2])

Submission status: Runtime Error

Solution code:
n = int(input())
res = list(enumerate(((s[0], int(s[1])) for s in input().split()), 1))

res.sort(key=lambda r: r[1])

[print(r[0]) for r in res]

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
n=int(input())
A=[]
for i in range(n):
    a=(i+1,)+tuple(input().split())
    A.append(a)
A.sort(key=lambda x:(-x[1],x[2]),reverse=True)
for m in range(n):
    print(A[m][0])

Submission status: Runtime Error

Solution code:
n = int(input())

a = []

for i in range(n):
  	# input as str
	s, p = input().split()
    # p -> integer
	p = int(score)
    # create list
	a.append((s, p, i+1))

# sort
a.sort(key=lambda x:x[1], reverse=True)

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

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

Submission status: Runtime Error

Solution code:
n=int(input())
data=[]
city=[]
sp=[]
for i in range(n):
	data.append(input().rstrip().split(""))
    data[i][1]=int(data[i][1])
	city.append(data[i][0])
city=sorted(city)
n=0
to=0
while n-1==n:
	whlie city[n]==city[to]:
		sp.append(data[to][1])
    	to+=1
    sp=sorted(sp)
    for i in range(len(sp)):
        m=0
      	while sp[i] != data[m]:
        	m+=1
        print(m+1)
    n=to

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
a = []
for i in range(n):
    city,score = input().split()
    score=int(score)
    a.append((city,score,i+1))
a.sort(key=lambda k: (k[0],-k[1]))

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(n):
    city,score = input().split()
    score=int(score)
    a.append((city,score,i+1))
a.sort(key=lambda k: (k[1],-k[0]))

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

Submission status: Runtime Error

Solution code:
n = input()
a = []
for i in range(n):
    city,core = input().split()
    a.append((city,score,i+1))
a.sort(key=lambda k: (k[1],-k[0]))

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

Submission status: Runtime Error

Solution code:
from operator import itemgetter

n = int(input())
e = [[i for i in input().split()] for j in range(n)]
for i in range(n):
    e(i).append(i)
restaurant = sorted(e,key=itemgetter(1),reverse=True)
restaurant.sort(key=itemgetter(0))

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

Submission status: Runtime Error

Solution code:
from operator import itemgetter

n = int(input())
e = [[j for j in input().split()] for i in range(n)] 
f = [[i,e[i]] for i in range(n)]

restaurant.sort(key=itemgetter(0),reverse=True)
restaurant = sorted(f,key=itemgetter(1))

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

Submission status: Runtime Error

Solution code:
P = int(input())
res= []
for i in range(P):
  a, b = input().split(' ')
  res.append((a,b,i+1))
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for j in range(P):
  print(res3[2])

Submission status: Runtime Error

Solution code:
from operator import itemgetter
restaurant = [[]]
inp = input().split("n/")[1:]
for i in range(input().split("n/")[0]):
      restaurant[i] = inp[i].split()
      restaurant[i].insert(0,i)
print(restaurant)

restaurant.sort(key=itemgetter(1,2))

Submission status: Runtime Error

Solution code:
P = int(input())
res= []
for i in range(P):
    a, b = input().split()
    res.append((a,b))
    print(res)
res2 = sorted(res, key = lambda x:(x[0],x[1]))
for i in range(P):
    print(int(index(res2[i])+1)

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(n):
    s, p = input().split()
# pを数値に
    p = int(p)
# i,s,pの並びで入れる
    a.append([i+1, s, p])

# 点数の高い順に並べる
a.sort(key=lambda x:x[2], reverse=True)
# レストラン名の辞書順に並べる
a.sort(key=lambda x:x[1])
# それぞれの市について、辞書順に点数の高い順に並べる
for i in range(n):
    print(book[i][0])

Submission status: Runtime Error

Solution code:

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

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

Submission status: Runtime Error

Solution code:
n = int(input())

data = dict()

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

for key in sorted(data.keys()):
  for _, num in sorted(data[key], key=lambda x: -x[0]):
    print(num)

Submission status: Runtime Error

Solution code:
N=int(input())
restaurants={}
for i in range(N):
  S,P=input().split()
  restaurants[S]=[int(P),i+1]
restaurants=sorted(restaurants.items(),key=lambda x:x[1][0])
restaurants=sorted(restaurants.items(),key=lambda x:x[0])
for i in restaurants.values():
  print(i[1])

Submission status: Runtime Error

Solution code:

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
list = [None]*N
for i in range(N):
  s, P = input().split()
  list[i]=(i,s,int(p)*-1)
for i in sorted(list, key = lamda x: (x[1],x[2])):
  print(i[0]+1)

Submission status: Runtime Error

Solution code:
n = int(input())
arr = [0]*n

for i in range(n):
	city, score = input().split()
    arr[i] = [city, int(score), i+1]
arr.sort(key = lambda x: (x[0], -x[1]))
for ele in arr:
  print(arr[2])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
for*_,i in sorted((t[:5],-int(t[-4:]),i)for i,t in enumerate(open(0)))[1:]:print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for _, _, i in a:
    print(i + 1)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stdlib.h>

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

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

Submission status: Runtime Error

Solution code:
import math as pd
N=int(input())

print(df)

Submission status: Runtime Error

Solution code:
import pandas as pd
N=int(input())
df=pd.DataFrame(N)

print(df)

Submission status: Runtime Error

Solution code:
import pandas as pd
N=int(input())
print(N)

Submission status: Runtime Error

Solution code:
n = int(input())
h = dict(map(int,input().split()))

Submission status: Runtime Error

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

for i in range(N):
    tmp = input().split(" ")
    tmp[1]=100-int(tmp[1]) #数字が小さい方が先に表示されるので点数を反転
    tup=[tmp,i]
    ret.append(tup)
tup.sort()
for i in range(N):
    print(tup[i][1])

Submission status: Runtime Error

Solution code:
from operator import itemgetter

def input_list(num,args):
    for i in range(num):
        S,P = input().split()
        if 1<=len(S)<=10 and S.islower==1 and 0<=P<=100 and type(P) is int :
            args.append([S,P])
        else :
            print("ERROR")
            exit()

            
def sort_list(*args):
    tmp=sorted(args,key=itemgetter(1),reverse=1)
    dict_sorted=sorted(tmp,key=itemgetter(0))

    return dict_sorted


def check_list(seq):
    seen = []
    uniequ_list = [x for x in seq if x not in seen and not seen.append(x)]
    if len(seq) != len(unique_list):
	print("ERORR")
	exit()
    # else :                                                                                         
    #     print("restaurant is ok.")                                                                 


def main():
    num=int(input())
    if 1<=num<=100:
        restaurant=[]
        input_list(num,restaurant)

        check_list(restaurant)

        restaurant_sorted=sort_list(*restaurant)

        for i in range(num):
            for j in range(num):
                if restaurant_sorted[i][1]==restaurant[j][1]:
                    print(j+1)
    else :
        print("ERORR")
        exit()

if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

for (s,p) in sorted(a,key=lambda x: (x[0],-int(x[1]))):
    print(index[(s,p)])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
SP = []
for _ in range(N):
    SP.append([i for i in input().split()])
for n in range(N):
    SP[n][1] = str(100 - int(SP[n][1])).rjust(3,'0')
SP2 = []
for n in range(N):
    SP2.append(SP[0]+SP[1])
ans = sorted(range(len(SP2)), key=lambda k: SP2[k])
for i in ans:
    print(i+1)

Submission status: Runtime Error

Solution code:
N = int(input())
SP = []
for _ in range(N):
    SP.append([i for i in input().split()])
for n in range(N):
    SP[n][1] = str(100 - int(SP[n][1])).rjust(3,'0')
SP2 = []
for n in range(N):
    SP2.append(SP[0]+SP[1])
ans = sorted(range(len(SP2)), key=lambda k: SP2[k])
[print(i) for i in ans]

Submission status: Runtime Error

Solution code:
N = int(input())
SP = []
for _ in range(N):
    SP.append([i for i in input().split()])
for n in range(N):
    SP[n][1] = str(100 - SP[n][1]).rjust(3,'0')
SP2 = []
for n in range(N):
    SP2.append(SP[0]+SP[1])
ans = sorted(range(len(SP2)), key=lambda k: SP2[k])
[print(i) for i in ans]

Submission status: Runtime Error

Solution code:
N = int(input())
SP = []
for _ in range(N):
  SP.append([i for i in input().split()])
for n in range(N):
  SP[n][1] = str(100 - SP[n]).rjust(3,'0')
SP2 = []
for n in range(N):
  SP2.append(SP[0]+SP[1])
ans = sorted(range(len(SP2)), key=lambda k: SP2[k])
[print(i) for i in ans]

Submission status: Runtime Error

Solution code:
N = int(input())
SP = []
for _ in range(N):
  SP.append(input().split())
print(sorted(range(len(s)), key=lambda k: s[k],reverse=True))

Submission status: Runtime Error

Solution code:
import numpy as np
import pandas as pd
n = int(input())

df = pd.DataFrame([], columns=['num','city','score'],index=range(n))
for i in range(n):
    s, p = input().split()
    df.iloc[i,:] = np.array([i + 1, s, int(p)])

for i in df.sort_values(['city','score'], ascending=[True,False])['num']:
    print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    L = [0] * N
    for i in range(N):
        s, p = i2s().split()
        L[i] = (s, int(p), i)

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

main()

Submission status: Runtime Error

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

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    L = [0] * N
    for i in range(N):
        s, p = i2s().split()
        L[i] = (s, inr(p), i)

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

main()

Submission status: Runtime Error

Solution code:
import numpy as np

n = int(input())


splist1 = []
splist2 = []
for i in range(n):
    tmp,tmp2 = input().split()
    tmp2 = int(tmp2)
    splist1.append([tmp,i+1])
    splist2.append([tmp2,i+1])

splist1 = np.array(splist1)
splist2 = np.array(splist2)
splist1 = splist1[np.argsort(splist2[:, 0])[::-1]]

ans = splist1[np.argsort(splist1[:, 0],kind="stable")]

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

Submission status: Runtime Error

Solution code:
print('\n'.join([l[2] for l in sorted(sorted([[l[1][0], int(l[1][1]), l[0] + 1] for l in enumerate(input().split() for _ in range(int(input())))], key=lambda l: l[1], reverse=True), key=lambda l: l[0])]))

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
a = []
for i in range(N):
  S, P = input().split()
  a.append((S, 100-P, i+1))
a.sort()
for i in a:
  print(i[2])

Submission status: Runtime Error

Solution code:
#include<stdio.h>
#include<string.h>

int main(){
    int n,i,j,d[100],t,x[100];
    char s[100][100];
    scanf("%d",&n);
    for(i=0;i<n;++i){
        scanf("%s %d",s[i],&d[i]);
        for(j=i;j>0;--j){
            t=strcmp(s[i],s[x[j-1]]);
            if(t<0 || (t==0&&d[i]>d[x[j-1]])){
                x[j] = x[j-1];
            }else{
                break;
            }
        }
        x[j]=i;
    }
    for(i=0;i<n;++i){
        printf("%d\n",x[i]+1);
    }
    return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=[]
b=[i+1 for i in range(n)]
for i in range(n):
  m,l=(j for j in input().split())
  a.append([m,l])
for i in range(n):
  for j in range(n-1):
    if a[j+1][0]<a[j][0] or (a[j+1][0]==a[j][0] and a[j][1]<a[j+1][1]):
                 c=a[j]
                 a[j]=a[j+1]
                 a[j+1]=c
                 d=b[j]
                 b[j]=b[j+1]
                 b[j+1]=d
for i in range(n):
  for j in range(n):
    if b[j]==i+1:
      print(j+1)

Submission status: Runtime Error

Solution code:
n=int(input())
a=[]
b=[i for i in range(n)]
for i in range(n):
  m,n=(int(j) for j in input().split())
  a.append([m,n])
for i in range(n):
  for j in range(n):
    if a[j[1]]<a[j+1[1]] or (a[j[1]]=a[j+1[1]] and a[j[2]]):
                 c=a[j]
                 a[j]=a[j+1]
                 a[j+1]=c
                 d=b[j]
                 b[j]=b[j+1]
                 b[j+1]=d
for i in range(n):
  print(b[i]+1)

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))
l.sort(key = lambda x:(x[0],x[1]), reverse = True)
for _ in l:
    print(l[2])

Submission status: Runtime Error

Solution code:
import math
import numpy as np


def main():
    N = int(input())
    SP = [list(input().split()) + [i + 1] for i in range(N)]
    SP.sort(key=lambda x: (x[0], -int(x[1])))
    SP = np.array(SP)
    for i in SP[:, 2]:
        print(i)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
lst=[]
for i in range(n):
  s=input().split()
  lst.append((s[0],-int(s[1]),i+1))
lst_2=sorted(key=lambda x:(x[0],x[1],x[2]))
for j in range(n):
  tuple_=lst_2[j]
  a=tuple_[2]
  print(a)

Submission status: Runtime Error

Solution code:
n=int(input())
lst=[]
for i in range(n):
  s=input().split()
  s_=s[0]
  q=int(s[1])
  lst.append((s_,(-1)*q,i+1))
lst=lst.sort(key=lambda x:x[0])
lst=lst.sort(key=lambda x:x[1])
for j in range(n):
  tuple_=lst[j]
  a=tuple_[2]
  print(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

sp.sort()
for i in range(n):
    print(sp[i][2])

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,(-1)*p,i+1))
lst=lst.sort(key=lambda x:x[0])
lst=lst.sort(key=lambda x:x[1])
for j in range(n):
  print(lst[j][2])

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,-1*p,i+1))
lst=lst.sort(key=lambda x:x[0])
lst=lst.sort(key=lambda x:x[1])
for j in range(n):
  print(lst[j][2])

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vec> vec2;
typedef map<ll,ll> MPll;
typedef set<ll> setl;

const ll INF = 1ll << 60;
const ld EPS = 1e-10;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};

//for文
#define FOR(i,a,b) for(ll i = (ll)a;i < (ll)b;i++)
#define FORE(i,a,b) for(ll i = (ll) a;i <= (ll) b;i++ )
#define REP(i,size_of_array)  for(ll i =(ll)0;i<size_of_array;i++)
#define REPE(i,size_of_array)  for(ll i =(ll)0;i<=size_of_array;i++)
#define REPR(i,size_of_array)  for(ll i =(ll)size_of_array;i>=0;i--)
#define FOREACH(it, vec) for (auto it = vec.begin(); it != vec.end(); it++)

//ソート
#define ALL(vec) (vec).begin(),(vec).end()
#define SORT(vec) sort(ALL(vec))
#define SORTA(arr) sort(arr,arr + (sizeof(arr) / sizeof(ll)))
#define INVSORT(vec) sort((vec).rbegin(),(vec).rend())
#define REV(vec) reverse(ALL(vec))
#define REVA(arr) reverse(arr,arr + (sizeof(arr) / sizeof(ll)))
#define INVSORTA(arr) sort(arr,arr + (sizeof(arr) / sizeof(ll))),REVA(arr)

//最大値最小値
#define MAX(vec) *max_element(ALL(vec))
#define UNIQ(vec) SORT(vec);vec.erase(unique(ALL(vec)),vec.end())
#define MIN(vec) *min_element(ALL(vec))

//出力
#define printl(a) cout << a << "\n"
#define print(a) cout << a
#define OUT(a) printf("%lld\n",a)
#define OUTA(array) REP(i,sizeof(array)/sizeof(ll)) printf("%lld\n",array[i])
#define OUTV(vec) REP(i,vec.size()) printf("%lld\n",vec[i])
#define SP printf(" ")

//入力
#define IN(x) scanf("%lld",&x)
#define INV(vec) REP(i,vec.size()) scanf("%lld",&vec[i])
#define INA(array) REP(i,sizeof(array)/sizeof(ll)) scanf("%lld",array + i)
#define INS(x) cin >> x

//型
#define P pair<ll,ll>
#define vp vector<P>
#define F first
#define S second

//その他
#define PB push_back
#define MP make_pair
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,-1,sizeof(a))
#define INFI(a) memset(a,INF,sizeof(a))
#define MEM(a,b) memset(a,(b),sizeof(a))

//関数
template<class T> inline void amax(T &a,const T &b) { if(a < b) a = b; }
template<class T> inline void amin(T &a,const T &b) { if(a > b) a = b; }

//特殊
//#define int ll

#define DEBUG

#ifdef DEBUG
#define debug(x) cerr << #x << ":" << x<<"\n"
    #define  debugV(V) REP(i,V.size()){cerr << i << ":" << V[i]<<endl;}
    #define  debugA(A) REP(i,sizeof(A)/sizeof(ll)){cerr << i << ":" << V[i]<<endl;}
#else
#define debug(x)
#define debugV(x)
#define debugA(x)
#endif


signed main(){
    ll N;IN(N);
    vector<pair<pair<string,int>,int>> v(N);
    FOR(i,0,N) {
        INS(v[i].F.F);
        IN(v[i].F.S);
        v[i].F.S *= -1;
        v[i].S=i;
    }

    SORT(v);

    FOR(i,0,N){
        OUT(v[i].S + 1);
    }
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#import fractions
#S=input()
#import math
#lis=list(map(int,input().split()))

n=int(input())
sp={}
for i in range(n):
    li=input().split()
    li.append(i+1)
    if li[0] not in sp:
        sp[li[0]]=[li]
    else:
        sp[li[0]].append(li)
        sp[li[0]].sort(reverse=True)
items_sorted = sorted(sp.items())
#print(items_sorted)
for i in range(len(items_sorted)):
    for j in range(len(items_sorted[i])):
        print(items_sorted[i][1][j][2])