Count the Overlap

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

Each line of input will be the position and size of three rectagles (a, b and c). The task is to count how much each pairing and all three of the rectangles overlap.

Example input:

ax 1 ay 1 aw 5 ah 5 bx 3 by 3 bw 7 bh 5 cx 5 cy 4 cw 7 ch 3

x,y indicates each rectangle's top left corner. w,h it's width and height. So visually ax 1 ay 1 aw 5 ah 5 would be:

aaaaa........
aaaaa........
aaaaa........
aaaaa........
aaaaa........
.............
.............
.............

Adding b(bx 3 by 3 bw 7 bh 5):

aaaaa........
aaaaa........
aa111bbbb....
aa111bbbb....
aa111bbbb....
..bbbbbbb....
..bbbbbbb....
.............

the 1s indicate on how many squares a and b overlap. It's the same with the c rectagle.
Asked output:

ab 9 ac 2 bc 15 abc 2

Options

exec is denied

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

Sample input:_

ax 1 ay 1 aw 1 ah 1 bx 1 by 1 bw 1 bh 1 cx 1 cy 1 cw 1 ch 1

Sample output:

ab 1 ac 1 bc 1 abc 1

Sample input:_

ax 3 ay 4 aw 4 ah 11 bx 1 by 3 bw 3 bh 4 cx 5 cy 2 cw 6 ch 3
ax 2 ay 4 aw 7 ah 10 bx 4 by 1 bw 11 bh 5 cx 3 cy 2 cw 8 ch 5
ax 4 ay 2 aw 5 ah 5 bx 5 by 1 bw 11 bh 10 cx 2 cy 2 cw 6 ch 11
ax 2 ay 4 aw 4 ah 6 bx 1 by 1 bw 11 bh 8 cx 1 cy 4 cw 4 ch 3
ax 1 ay 1 aw 4 ah 4 bx 2 by 4 bw 7 bh 5 cx 1 cy 2 cw 7 ch 8

Sample output:

ab 3 ac 2 bc 0 abc 0
ab 10 ac 18 bc 28 abc 10
ab 20 ac 20 bc 27 abc 15
ab 20 ac 9 bc 12 abc 9
ab 3 ac 12 bc 30 abc 3

Sample input:_

ax 17 ay 20 aw 34 ah 15 bx 13 by 11 bw 19 bh 24 cx 10 cy 19 cw 19 ch 28
ax 18 ay 22 aw 7 ah 8 bx 19 by 19 bw 29 bh 12 cx 15 cy 14 cw 30 ch 19
ax 16 ay 8 aw 29 ah 12 bx 13 by 21 bw 28 bh 28 cx 22 cy 14 cw 5 ch 11
ax 13 ay 9 aw 34 ah 30 bx 21 by 8 bw 12 bh 12 cx 17 cy 8 cw 16 ch 28
ax 8 ay 12 aw 5 ah 27 bx 8 by 6 bw 29 bh 1 cx 10 cy 5 cw 4 ch 25
ax 22 ay 14 aw 26 ah 6 bx 22 by 17 bw 10 bh 3 cx 17 cy 16 cw 20 ch 6
ax 14 ay 17 aw 29 ah 16 bx 15 by 13 bw 19 bh 16 cx 23 cy 10 cw 35 ch 1
ax 9 ay 5 aw 7 ah 23 bx 9 by 6 bw 6 bh 34 cx 14 cy 16 cw 2 ch 22
ax 23 ay 1 aw 5 ah 22 bx 20 by 12 bw 7 bh 19 cx 18 cy 22 cw 37 ch 35
ax 20 ay 5 aw 7 ah 11 bx 18 by 4 bw 35 bh 12 cx 13 cy 15 cw 1 ch 26
ax 14 ay 18 aw 18 ah 30 bx 22 by 3 bw 9 bh 4 cx 10 cy 19 cw 11 ch 13
ax 19 ay 22 aw 36 ah 33 bx 21 by 13 bw 34 bh 17 cx 10 cy 14 cw 18 ch 17
ax 22 ay 13 aw 22 ah 19 bx 17 by 12 bw 19 bh 31 cx 17 cy 8 cw 13 ch 25
ax 16 ay 17 aw 33 ah 35 bx 8 by 14 bw 6 bh 19 cx 9 cy 22 cw 8 ch 16
ax 19 ay 7 aw 7 ah 5 bx 12 by 2 bw 25 bh 10 cx 8 cy 23 cw 5 ch 1
ax 16 ay 18 aw 5 ah 29 bx 19 by 1 bw 31 bh 20 cx 15 cy 8 cw 36 ch 19
ax 17 ay 12 aw 31 ah 33 bx 20 by 8 bw 21 bh 16 cx 19 cy 12 cw 10 ch 31
ax 20 ay 20 aw 15 ah 6 bx 22 by 4 bw 23 bh 3 cx 8 cy 5 cw 25 ch 15
ax 14 ay 8 aw 29 ah 5 bx 23 by 13 bw 28 bh 12 cx 16 cy 22 cw 10 ch 36
ax 16 ay 22 aw 37 ah 14 bx 16 by 19 bw 16 bh 3 cx 15 cy 2 cw 20 ch 29
ax 22 ay 6 aw 32 ah 15 bx 22 by 13 bw 8 bh 28 cx 19 cy 3 cw 31 ch 29
ax 10 ay 23 aw 26 ah 5 bx 22 by 18 bw 6 bh 32 cx 11 cy 10 cw 25 ch 32
ax 19 ay 8 aw 26 ah 1 bx 22 by 18 bw 8 bh 35 cx 21 cy 19 cw 16 ch 19
ax 9 ay 11 aw 4 ah 1 bx 14 by 16 bw 16 bh 17 cx 12 cy 3 cw 24 ch 29
ax 15 ay 6 aw 36 ah 15 bx 19 by 8 bw 5 bh 25 cx 10 cy 13 cw 32 ch 20

Sample output:

ab 225 ac 180 bc 256 abc 180
ab 48 ac 56 bc 312 abc 48
ab 0 ac 30 bc 20 abc 0
ab 132 ac 432 bc 144 abc 132
ab 0 ac 54 bc 4 abc 0
ab 30 ac 60 bc 30 abc 30
ab 228 ac 0 bc 0 abc 0
ab 132 ac 24 bc 22 abc 12
ab 44 ac 5 bc 63 abc 4
ab 77 ac 0 bc 0 abc 0
ab 0 ac 91 bc 0 abc 0
ab 272 ac 81 bc 112 abc 56
ab 266 ac 152 bc 273 abc 152
ab 0 ac 16 bc 55 abc 0
ab 35 ac 0 bc 0 abc 0
ab 6 ac 45 bc 403 abc 6
ab 252 ac 310 bc 108 abc 108
ab 0 ac 0 bc 22 abc 0
ab 0 ac 0 bc 9 abc 0
ab 0 ac 171 bc 48 abc 0
ab 64 ac 420 bc 152 abc 64
ab 30 ac 125 bc 144 abc 30
ab 0 ac 0 bc 152 abc 0
ab 0 ac 1 bc 256 abc 0
ab 65 ac 216 bc 100 abc 40

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1Histocrat1650.30292014/10/08 04:26:490B / 83B / 70B

Perl _

RankUserSizeTimeDateStatistics
1tybalt891450.58842014/10/14 01:01:050B / ?B / ?B

Python _

RankUserSizeTimeDateStatistics
1hallvabo1650.09812014/10/13 21:00:4092B / 45B / 28B
2hallvabo (nozip)1940.11532014/10/13 22:10:580B / 105B / 86B
3rolf3480.08882014/10/12 02:42:480B / 170B / 146B
4brandonson5430.40702014/10/10 16:52:020B / 276B / 221B

Forth _

RankUserSizeTimeDateStatistics
1fizzie3570.04522014/10/09 05:01:190B / 175B / 44B

C _

RankUserSizeTimeDateStatistics
1llhuii2380.03522014/10/11 00:26:580B / ?B / ?B
2chocobi3280.03172014/10/09 23:46:190B / 159B / 156B
3b_jonas3780.03402014/10/09 20:03:380B / ?B / ?B

C++ _

RankUserSizeTimeDateStatistics
1b_jonas3780.03502014/10/09 20:02:490B / ?B / ?B

Haskell _

RankUserSizeTimeDateStatistics
1int-e1950.04242014/10/11 10:05:500B / 120B / 66B
2oerjan2110.03862014/10/07 22:43:300B / 104B / 89B

ObjC _

RankUserSizeTimeDateStatistics
1b_jonas3780.03462014/10/09 20:07:330B / ?B / ?B

AWK _

RankUserSizeTimeDateStatistics
1llhuii1440.93592014/10/10 22:59:150B / 55B / 82B

Bash _

RankUserSizeTimeDateStatistics
1llhuii1500.87342014/10/10 23:09:450B / 60B / 82B

Zsh _

RankUserSizeTimeDateStatistics
1llhuii1500.94232014/10/10 23:09:530B / 60B / 82B

Fish _

RankUserSizeTimeDateStatistics
1llhuii1500.96682014/10/10 23:10:050B / 60B / 82B

xgawk _

RankUserSizeTimeDateStatistics
1llhuii1440.96412014/10/10 23:08:570B / 57B / 80B

Language Ranking_

RankLangUserSizeScore
1AWKllhuii14410000
2xgawkllhuii14410000
3Perltybalt891459931
4Bashllhuii1509600
5Zshllhuii1509600
6Fishllhuii1509600
7RubyHistocrat1658727
8Pythonhallvabo1658727
9Haskellint-e1957384
10Cllhuii2386050
11Forthfizzie3574033
12C++b_jonas3783809
13ObjCb_jonas3783809

return top