// File: noizebox[P]zipfsong/zipfsong.cpp
// Function: main
int main()
{
    std::chrono::steady_clock::time_point startTime = std::chrono::steady_clock::now();

    std::ios::sync_with_stdio (false);
    std::string input;
    std::getline(std::cin, input);
    int pos = input.find(" ");
    int no_songs = atoi(input.substr(0, pos).c_str());
    int no_outputs = atoi(input.substr(pos + 1).c_str());

    std::vector<Song> song_list;
    parse_songs(no_songs, song_list);
    stable_sort(song_list.begin(), song_list.end(), std::greater<Song>());
    print_songs(song_list, no_outputs);
    
    std::chrono::steady_clock::time_point endTime = std::chrono::steady_clock::now();
    std::cout << "Ex. time: " << std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count() << " ms\n";
    return 0;
}

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movl $0x0, 0x144(%rsp)
callq 0x21a0
movq %rax, 0x138(%rsp)
xorl %edi, %edi
callq 0x20a0
leaq 0x118(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x21b0
movq 0x68(%rsp), %rsi
movq 0x899c(%rip), %rdi      # 0xafe0
callq 0x2040
jmp 0x264b
leaq 0x59bb(%rip), %rsi      # 0x800d
xorl %eax, %eax
movl %eax, %edx
movq %rdx, 0x60(%rsp)
leaq 0x118(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x2250
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movl %eax, 0x108(%rsp)
movslq 0x108(%rsp), %rcx
leaq 0xe0(%rsp), %rdi
callq 0x2150
jmp 0x2695
leaq 0xe0(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x2090
movq %rax, %rdi
callq 0x2200
movq 0x48(%rsp), %rdi
movl %eax, 0x54(%rsp)
callq 0x20e0
movl 0x54(%rsp), %eax
movl %eax, 0x104(%rsp)
movl 0x108(%rsp), %eax
incl %eax
movslq %eax, %rdx
leaq 0xb8(%rsp), %rdi
leaq 0x118(%rsp), %rsi
movq $-0x1, %rcx
callq 0x2150
jmp 0x26f2
leaq 0xb8(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x2090
movq %rax, %rdi
callq 0x2200
movq 0x30(%rsp), %rdi
movl %eax, 0x3c(%rsp)
callq 0x20e0
movl 0x3c(%rsp), %eax
movl %eax, 0xdc(%rsp)
leaq 0xa0(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x2b70
movq 0x40(%rsp), %rsi
movl 0x104(%rsp), %edi
callq 0x23b0
jmp 0x274a
leaq 0xa0(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x2bc0
movq 0x28(%rsp), %rdi
movq %rax, 0x98(%rsp)
callq 0x2bf0
movq %rax, 0x90(%rsp)
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x2b80
jmp 0x278d
movl 0xdc(%rsp), %esi
leaq 0xa0(%rsp), %rdi
callq 0x2590
jmp 0x27a3
callq 0x21a0
movq %rax, 0x80(%rsp)
movq 0x8819(%rip), %rdi      # 0xafd0
leaq 0x5846(%rip), %rsi      # 0x8004
callq 0x2120
movq %rax, 0x20(%rsp)
jmp 0x27ca
leaq 0x80(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x2c50
movq %rax, 0x18(%rsp)
jmp 0x27e6
movq 0x18(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x2c20
movq %rax, 0x10(%rsp)
jmp 0x2801
movq 0x10(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x2ca0
movq %rax, 0x8(%rsp)
jmp 0x281c
movq 0x8(%rsp), %rsi
movq 0x20(%rsp), %rdi
callq 0x2240
movq %rax, (%rsp)
jmp 0x2831
movq (%rsp), %rdi
leaq 0x57d3(%rip), %rsi      # 0x800f
callq 0x2120
jmp 0x2843
movl $0x0, 0x144(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x2cb0
leaq 0x118(%rsp), %rdi
callq 0x20e0
movl 0x144(%rsp), %eax
addq $0x148, %rsp            # imm = 0x148
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
jmp 0x28ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x2cb0
leaq 0x118(%rsp), %rdi
callq 0x20e0
movq 0x110(%rsp), %rdi
callq 0x2220
nopl (%rax,%rax)