Close
Topic list
Iruka And Marks
EASY
Strings
Sorting
Arrays
Topics (Covered in this problem)
Problem solved
Skill meter
Strings
-
-
Sorting
-
-
Arrays
-
-
Other topics
Problem solved
Skill meter
Matrices (2D Arrays)
-
-
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Iruka And Marks

Contributed by
Easy
0/40
Share

## Problem Statement

#### You have to organize the list of students in such a way that students with higher marks come first and in the case of students with equal marks, the student with lexicographically smaller names comes first.

##### Example:-
``````Input: ‘N’ = 3, ‘STUDENTS’ = [[‘naruto’, 50], [‘sasuke’, 95], [‘sakura’, 65]]

Output: [[‘sasuke’, 95], [‘sakura’, 65], [‘naruto’, 50]]

In the example above you can see that ‘sasuke’ got the highest marks so he came first in the output followed by ‘sakura’ and ‘naruto’ with the lowest marks.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1 :
``````2
3
naruto 50
sakura 65
sasuke 95
2
kiba 70
shikamaru 78
``````
##### Sample Output 1 :
``````sasuke 95
sakura 65
naruto 50
shikamaru 78
kiba 70
``````
##### Explanation Of Sample Input 1 :
``````For the first case:-
You can see that ‘sasuke’ got the highest marks so he came first in the output followed by ‘sakura’ and ‘naruto’ with the lowest marks.

For the second case-
Here ‘shikamaru’ got 78 marks greater than 70 so he comes first followed by ‘kiba’ with 70 marks.
``````
##### Sample Input 2 :
``````2
5
minato 92
sakumo 87
itachi 99
ino 80
3
minato 90
hiruzen 90
``````
##### Sample Output 2 :
``````itachi 99