Medal Rankings

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

Calculate a medal rankings table for a mini-Olympic Games (data generated randomly by spreadsheet)

Input:
- First line contains the codes for the 20 participating countries, in alphabetical order, separated by spaces
- Next 50 lines contain the winners of 50 events, in order of Gold, Silver, Bronze

Output:
- Display the list of 20 countries and their medal counts (Gold, Silver, Bronze)
- The list should be sorted first by total number of medals, then number of Gold medals, then number of Silver medals, then number of Bronze medals

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

AUS BRA CAN CHN DEN ESP FIN FRA GBR GER GRE HUN ITA JPN KOR NED POL RUS SWE USA
SWE POL RUS
RUS CHN DEN
RUS DEN ESP
CAN SWE CHN
JPN BRA ITA
CHN GBR SWE
NED NED AUS
BRA JPN SWE
JPN HUN GBR
FRA BRA FRA
SWE FRA RUS
FRA BRA POL
CHN NED JPN
HUN ITA GBR
SWE CHN HUN
USA GBR CHN
NED SWE GRE
RUS JPN JPN
CAN GRE SWE
NED HUN FRA
GER NED POL
AUS FIN CAN
FRA DEN GRE
GRE ESP GER
RUS CAN ESP
ITA JPN AUS
GRE SWE USA
DEN DEN HUN
DEN GRE POL
SWE POL NED
SWE DEN HUN
CHN POL ESP
FRA NED KOR
FIN USA JPN
HUN FIN DEN
GRE GBR DEN
RUS DEN GER
ITA JPN NED
RUS NED RUS
POL KOR POL
USA RUS NED
BRA CHN RUS
JPN FIN DEN
NED RUS GER
GBR GRE AUS
ITA ITA POL
FIN DEN BRA
CAN CHN AUS
AUS GBR RUS
HUN ITA GER

Sample output:

RUS 6 2 5
NED 4 5 3
DEN 2 6 4
SWE 5 3 3
JPN 3 4 3
CHN 3 4 2
POL 1 3 5
GRE 3 3 2
HUN 3 2 3
FRA 4 1 2
ITA 3 3 1
GBR 1 4 2
BRA 2 3 1
AUS 2 0 4
CAN 3 1 1
FIN 2 3 0
GER 1 0 4
USA 2 1 1
ESP 0 1 3
KOR 0 1 1

Sample input:_

AUS BRA CAN CHN DEN ESP FIN FRA GBR GER GRE HUN ITA JPN KOR NED POL RUS SWE USA
HUN ESP BRA
CHN HUN HUN
KOR ITA ESP
NED GBR ITA
SWE KOR BRA
NED RUS ITA
USA BRA ITA
HUN FRA JPN
GBR RUS CAN
POL SWE ESP
DEN FRA FRA
SWE CHN AUS
CHN DEN AUS
BRA ITA POL
JPN FIN BRA
ESP ITA RUS
CHN CHN AUS
BRA SWE POL
DEN CAN KOR
GBR FRA BRA
FRA CAN GBR
SWE GER CHN
CAN GRE CHN
SWE SWE FIN
BRA RUS RUS
POL POL FIN
RUS USA CAN
POL GRE RUS
ESP ESP FIN
ESP SWE AUS
HUN NED BRA
AUS ITA CHN
GRE HUN RUS
POL ITA NED
AUS AUS JPN
NED JPN ITA
NED DEN CAN
GER GRE GER
HUN AUS ESP
CHN CAN SWE
JPN RUS CHN
FIN BRA GER
NED USA ITA
GBR CHN CAN
HUN AUS ESP
GER CAN NED
BRA JPN RUS
FRA SWE RUS
CHN AUS GER
NED NED HUN

Sample output:

CHN 5 3 4
BRA 4 2 5
RUS 1 4 6
NED 6 2 2
SWE 4 5 1
AUS 2 4 4
ITA 0 5 5
HUN 5 2 2
ESP 3 2 4
CAN 1 4 4
POL 4 1 2
FRA 2 3 1
JPN 2 2 2
GER 2 1 3
GBR 3 1 1
FIN 1 1 3
DEN 2 2 0
GRE 1 3 0
USA 1 2 0
KOR 1 1 1

Sample input:_

AUS BRA CAN CHN DEN ESP FIN FRA GBR GER GRE HUN ITA JPN KOR NED POL RUS SWE USA
GRE FRA NED
BRA GRE CAN
NED CAN NED
FRA AUS RUS
FIN NED CHN
GBR FIN JPN
USA AUS KOR
POL RUS FRA
NED AUS JPN
ITA JPN GRE
DEN CAN USA
FIN NED GBR
GRE ITA GRE
JPN ESP POL
USA GBR HUN
KOR GER POL
SWE POL AUS
USA KOR HUN
AUS RUS HUN
HUN SWE RUS
AUS FRA BRA
CHN JPN GER
POL AUS FIN
JPN KOR AUS
RUS CAN NED
CAN NED USA
NED JPN JPN
DEN POL FIN
DEN BRA GER
GRE ITA HUN
NED JPN HUN
BRA ESP CAN
JPN NED JPN
GRE ESP POL
RUS AUS GRE
SWE ESP DEN
CHN GER POL
DEN GER CHN
KOR GBR BRA
GER KOR JPN
KOR ITA AUS
AUS JPN ITA
FIN GER GRE
HUN SWE USA
JPN CAN ITA
ESP CAN NED
RUS JPN CAN
DEN GER NED
POL GRE JPN
CHN HUN FRA

Sample output:

JPN 4 6 6
NED 4 4 5
AUS 3 5 3
GRE 4 2 4
POL 3 2 4
CAN 1 5 3
HUN 2 1 5
GER 1 5 2
KOR 3 3 1
RUS 3 2 2
DEN 5 0 1
FIN 3 1 2
USA 3 0 3
ITA 1 3 2
CHN 3 0 2
BRA 2 1 2
ESP 1 4 0
FRA 1 2 2
SWE 2 2 0
GBR 1 2 1

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1yvl1040.05712012/08/21 23:11:560B / 55B / 44B
2clock1190.04842012/08/24 15:32:560B / 56B / 60B
3%20(tails (gs))950.14582016/09/07 22:47:341B / 39B / 53B
4tails (gs)960.15662016/09/07 22:23:261B / 39B / 53B

Python _

RankUserSizeTimeDateStatistics
1hallvabo1320.07082012/08/17 00:44:120B / 74B / 48B
2leonid1320.06762012/09/13 12:29:220B / 75B / 47B
3twobit1380.05802012/08/28 09:05:520B / 77B / 50B
4cornchz1720.05522012/09/02 04:24:530B / 100B / 60B
5leonid (hallvabo)1280.09512012/09/13 13:52:280B / 73B / 45B

J _

RankUserSizeTimeDateStatistics
1I., S.580.08362012/08/16 22:10:280B / 8B / 50B

K _

RankUserSizeTimeDateStatistics
1twobit620.03342012/08/28 23:05:240B / 16B / 45B

sed _

RankUserSizeTimeDateStatistics
1tails3310.41112012/08/22 13:14:380B / 84B / 219B

GolfScript _

RankUserSizeTimeDateStatistics
1tails520.17022012/08/21 20:30:410B / 9B / 41B

Vim _

RankUserSizeTimeDateStatistics
1clock770.29882012/08/18 17:59:0311B / 42B / 17B

Language Ranking_

RankLangUserSizeScore
1GolfScripttails5210000
2JI., S.588965
3Ktwobit628387
4Vimclock776753
5Ruby%20(tails (gs))955473
6Pythonleonid (hallvabo)1284062
7sedtails3311570

return top