Skip to content

Instantly share code, notes, and snippets.

View mym0404's full-sized avatar
๐Ÿ”Š
Loud your code

MJ Studio mym0404

๐Ÿ”Š
Loud your code
View GitHub Profile
from functools import cmp_to_key
arr = [1, 2, 3, 4, 5]
def my_cmp(a, b):
if a == b:
return 0
elif a < b:
return -1
else:
from functools import cmp_to_key
def my_cmp(a, b):
if a[1] != b[1]:
return a[1] - b[1]
return a[0] - b[0]
n = int(input())
arr = [list(map(int, input().split())) for _ in range(n)]
arr.sort(key=cmp_to_key(my_cmp))
from functools import cmp_to_key
def my_cmp(a, b):
if a[1] != b[1]:
return a[1] - b[1]
return a[0] - b[0]
n = int(input())
arr = [list(map(int, input().split())) for _ in range(n)]
arr.sort(key=cmp_to_key(my_cmp))
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
void solve() {
int n;
cin >> n;
vector<pair<int, int>> arr(n);
for (int i = 0; i < n; i++) cin >> arr[i].first >> arr[i].second;
arr.sort(Comparator.reverseOrder());
arr.sort(reverse=True)
sort(arr.begin(), arr.end(), greater<>());
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
ArrayList<Integer> arr = new ArrayList<>();
import java.io.*;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
int[] arr = new int[n];
for(int i = 0; i < n; i++)
n = int(input())
arr = [int(input()) for _ in range(n)]
arr.sort()
for k in arr:
print(k)