Old Magician

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

Old Magician, from the Google Code Jam Practice Contest 2008. Problem specification here:

http://code.google.com/codejam/contest/dashboard?c=32004#

Options

exec is denied

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

Sample input:_

17
4 3
7 5
7 5
4 2
2 1
2 3
1 3
4 0
0 1
2 6
1 2
1 1
7 0
5 0
0 1
2 6
4 5

Sample output:

Case #1: BLACK
Case #2: BLACK
Case #3: BLACK
Case #4: WHITE
Case #5: BLACK
Case #6: BLACK
Case #7: BLACK
Case #8: WHITE
Case #9: BLACK
Case #10: WHITE
Case #11: WHITE
Case #12: BLACK
Case #13: WHITE
Case #14: WHITE
Case #15: BLACK
Case #16: WHITE
Case #17: BLACK

Sample input:_

42
34 165
957 234
313 956
247 115
233 357
490 550
999 32
528 747
288 764
39 798
402 177
787 535
888 931
803 825
812 290
135 321
988 128
728 480
81 705
382 645
869 650
518 272
1 666
192 770
280 810
293 794
82 894
866 97
903 982
651 116
112 336
862 874
767 695
10 971
322 213
293 69
763 522
693 254
321 815
807 478
273 808
817 528

Sample output:

Case #1: BLACK
Case #2: WHITE
Case #3: WHITE
Case #4: BLACK
Case #5: BLACK
Case #6: WHITE
Case #7: WHITE
Case #8: BLACK
Case #9: WHITE
Case #10: WHITE
Case #11: BLACK
Case #12: BLACK
Case #13: BLACK
Case #14: BLACK
Case #15: WHITE
Case #16: BLACK
Case #17: WHITE
Case #18: WHITE
Case #19: BLACK
Case #20: BLACK
Case #21: WHITE
Case #22: WHITE
Case #23: WHITE
Case #24: WHITE
Case #25: WHITE
Case #26: WHITE
Case #27: WHITE
Case #28: BLACK
Case #29: WHITE
Case #30: WHITE
Case #31: WHITE
Case #32: WHITE
Case #33: BLACK
Case #34: BLACK
Case #35: BLACK
Case #36: BLACK
Case #37: WHITE
Case #38: WHITE
Case #39: BLACK
Case #40: WHITE
Case #41: WHITE
Case #42: WHITE

Sample input:_

256
847869270 625486880
633562893 952161151
122336899 161601644
835532401 584237132
739699259 717097156
111913200 720132269
979054850 438022246
770734637 937195711
835622205 627193481
88717881 855708773
860608271 303655664
284084422 462647678
105362901 864773470
385155858 105158175
546519408 752577164
899925362 991766452
246693709 69338817
746274625 687725076
824840103 46983208
132731619 239156239
159446800 951151517
485541746 905141036
427537840 995979529
770640352 789761169
125179971 107777062
574607941 153656296
518743675 477489514
236940913 412404580
830793629 536210055
161924583 967747027
456402867 352156727
482980202 189287575
342664170 340256986
505430836 879427383
728716202 934609450
820989570 926352501
545487222 957351880
131651472 371431661
442127015 751362221
673868432 554693916
574665283 285325249
971370416 315808674
221572913 360051367
170339543 22879833
265224078 210087890
76226020 526457940
645509655 916896007
21883757 576457556
501328495 537263463
593184446 967289567
329538027 627028390
859960775 94536154
296983976 719634445
788151113 277558067
615592492 103172901
211164526 160215998
401331300 615699592
756978335 437805577
320033037 275191195
596466144 987683391
749942582 422029351
44644452 805244687
560377599 297822933
1399268 396978711
372533699 390384170
208768099 143856680
915615082 601035208
588590416 402107005
171190965 722464451
71655429 495858024
390557399 142213734
267290988 214003694
412731190 233031684
292040961 984318402
729743034 753518612
149735344 541664863
300334740 671932079
388686401 451872569
459652152 874609274
869841627 288275395
708413430 828498653
88238817 469011968
743990007 771690654
837402306 609121916
58937336 300848636
171921823 607991837
568676500 722247521
212291 245946677
758862318 257997091
83696451 913674909
362669655 578910450
437317033 978037990
545187850 673367883
432811934 863251614
757235997 312870972
491979376 300032298
692896987 122228023
735456637 863114301
178546807 398146767
476147037 376088643
813537927 132839462
282116265 216453791
654584603 625671494
260344375 165954148
939858442 626057236
203789657 94954517
239353788 102767138
654641268 692269170
717492024 864882414
315209731 962533917
133398916 329142715
243933800 540427839
258998454 842876413
694835891 676177829
582488772 23361010
117267828 52219666
162713196 253721836
351110047 567906520
93312869 86757792
740045600 552740946
525604984 819299518
368836349 689335328
224066052 12350361
216933787 554427888
478043107 236436201
84693347 606339622
62137750 953038371
55868160 891208843
840639094 641498468
275982590 245735042
631180573 963288700
245506114 135117025
199146038 824701758
228887421 344272969
281081316 176690342
924069733 239585710
385723387 454431396
897345358 330489011
228880415 306915334
180414627 39627188
506235272 897237592
260826125 72061554
296857425 318157761
255557198 545061395
131784869 810355639
212952952 642353651
583676237 364397137
541271459 681871939
481439956 915920692
720442962 937070596
115745572 723578917
135659399 383184778
236310403 14026581
856110215 447182770
750715672 767819115
271151220 932876177
633423209 191250531
804733960 160983393
453303015 972957707
269034489 688527936
136568483 985607866
92846811 469624386
195308065 218656060
889146830 933523267
867104527 74865759
327849155 274192901
712181209 54992110
345018370 758602757
879008602 93610169
32041024 178687663
772629290 558195584
435474045 812056308
810901369 650364025
331686420 994117188
582857446 572419882
498573379 564605844
792369420 849990095
554988765 679085689
906286917 566976204
762049354 518100998
200367562 482240872
684907698 80347633
622565673 779086505
582677998 90392283
889009869 764988607
191352591 806828740
179466480 53346504
938744165 452617333
856262166 196782711
800254997 714059542
576659159 684752919
955446815 21514785
938222980 755294861
548570692 898104281
879761849 917981038
837691530 118418499
608575351 823380138
220785407 757753905
478119519 579376848
135553101 349867730
341831846 918311749
741406680 9405586
588371670 695862264
566987308 743085980
138583273 874077350
951005376 793488055
943367621 816379933
121086270 101701972
680470640 135310549
166811562 844829289
540331807 291836717
943812137 665348823
801110192 178753723
152764224 37804548
546239946 593747395
753002738 307164299
116304783 221642472
669020362 26353901
440267946 358285886
95765853 295805575
577831876 778508288
388911249 679412551
591095509 942847841
944340557 987636829
304382617 326381482
373707869 775278440
882623976 621105952
972642058 90672632
498484648 966502669
619727196 77669882
209180000 883052348
208777843 932108870
640257336 943075497
901827430 17664871
447718978 57313252
147377696 259805708
683898667 313107782
225087716 937033353
543894389 667539547
840161082 637112389
86070582 458302350
231614539 108537639
905538097 733948656
804232581 362591798
977984814 314006003
368559439 348039154
591477714 494598672
927357521 446087154
630759495 483952495
607135963 5906412
378898580 723977199
437599858 553459865
99832945 290302373
903490509 167586045
359538982 934496675
566622183 20032764

Sample output:

Case #1: WHITE
Case #2: BLACK
Case #3: WHITE
Case #4: WHITE
Case #5: WHITE
Case #6: BLACK
Case #7: WHITE
Case #8: BLACK
Case #9: BLACK
Case #10: BLACK
Case #11: WHITE
Case #12: WHITE
Case #13: WHITE
Case #14: BLACK
Case #15: WHITE
Case #16: WHITE
Case #17: BLACK
Case #18: WHITE
Case #19: WHITE
Case #20: BLACK
Case #21: BLACK
Case #22: WHITE
Case #23: BLACK
Case #24: BLACK
Case #25: WHITE
Case #26: WHITE
Case #27: WHITE
Case #28: WHITE
Case #29: BLACK
Case #30: BLACK
Case #31: BLACK
Case #32: BLACK
Case #33: WHITE
Case #34: BLACK
Case #35: WHITE
Case #36: BLACK
Case #37: WHITE
Case #38: BLACK
Case #39: BLACK
Case #40: WHITE
Case #41: BLACK
Case #42: WHITE
Case #43: BLACK
Case #44: BLACK
Case #45: WHITE
Case #46: WHITE
Case #47: BLACK
Case #48: WHITE
Case #49: BLACK
Case #50: BLACK
Case #51: WHITE
Case #52: WHITE
Case #53: BLACK
Case #54: BLACK
Case #55: BLACK
Case #56: WHITE
Case #57: WHITE
Case #58: BLACK
Case #59: BLACK
Case #60: BLACK
Case #61: BLACK
Case #62: BLACK
Case #63: BLACK
Case #64: BLACK
Case #65: WHITE
Case #66: WHITE
Case #67: WHITE
Case #68: BLACK
Case #69: BLACK
Case #70: WHITE
Case #71: WHITE
Case #72: WHITE
Case #73: WHITE
Case #74: WHITE
Case #75: WHITE
Case #76: BLACK
Case #77: BLACK
Case #78: BLACK
Case #79: WHITE
Case #80: BLACK
Case #81: BLACK
Case #82: WHITE
Case #83: WHITE
Case #84: WHITE
Case #85: WHITE
Case #86: BLACK
Case #87: BLACK
Case #88: BLACK
Case #89: BLACK
Case #90: BLACK
Case #91: WHITE
Case #92: WHITE
Case #93: BLACK
Case #94: WHITE
Case #95: WHITE
Case #96: WHITE
Case #97: BLACK
Case #98: BLACK
Case #99: BLACK
Case #100: BLACK
Case #101: WHITE
Case #102: BLACK
Case #103: WHITE
Case #104: WHITE
Case #105: WHITE
Case #106: BLACK
Case #107: WHITE
Case #108: WHITE
Case #109: WHITE
Case #110: BLACK
Case #111: BLACK
Case #112: BLACK
Case #113: BLACK
Case #114: BLACK
Case #115: WHITE
Case #116: WHITE
Case #117: WHITE
Case #118: WHITE
Case #119: WHITE
Case #120: WHITE
Case #121: WHITE
Case #122: WHITE
Case #123: BLACK
Case #124: WHITE
Case #125: BLACK
Case #126: WHITE
Case #127: BLACK
Case #128: BLACK
Case #129: WHITE
Case #130: WHITE
Case #131: WHITE
Case #132: BLACK
Case #133: WHITE
Case #134: BLACK
Case #135: WHITE
Case #136: WHITE
Case #137: WHITE
Case #138: BLACK
Case #139: WHITE
Case #140: WHITE
Case #141: WHITE
Case #142: WHITE
Case #143: BLACK
Case #144: BLACK
Case #145: BLACK
Case #146: BLACK
Case #147: BLACK
Case #148: BLACK
Case #149: WHITE
Case #150: WHITE
Case #151: BLACK
Case #152: WHITE
Case #153: BLACK
Case #154: WHITE
Case #155: BLACK
Case #156: BLACK
Case #157: BLACK
Case #158: BLACK
Case #159: BLACK
Case #160: WHITE
Case #161: WHITE
Case #162: WHITE
Case #163: WHITE
Case #164: BLACK
Case #165: BLACK
Case #166: BLACK
Case #167: WHITE
Case #168: BLACK
Case #169: BLACK
Case #170: BLACK
Case #171: WHITE
Case #172: WHITE
Case #173: BLACK
Case #174: WHITE
Case #175: WHITE
Case #176: WHITE
Case #177: BLACK
Case #178: BLACK
Case #179: WHITE
Case #180: WHITE
Case #181: WHITE
Case #182: BLACK
Case #183: BLACK
Case #184: BLACK
Case #185: BLACK
Case #186: WHITE
Case #187: WHITE
Case #188: BLACK
Case #189: BLACK
Case #190: WHITE
Case #191: BLACK
Case #192: BLACK
Case #193: BLACK
Case #194: BLACK
Case #195: WHITE
Case #196: BLACK
Case #197: WHITE
Case #198: BLACK
Case #199: WHITE
Case #200: WHITE
Case #201: BLACK
Case #202: WHITE
Case #203: WHITE
Case #204: WHITE
Case #205: WHITE
Case #206: BLACK
Case #207: BLACK
Case #208: WHITE
Case #209: BLACK
Case #210: BLACK
Case #211: BLACK
Case #212: BLACK
Case #213: BLACK
Case #214: WHITE
Case #215: BLACK
Case #216: BLACK
Case #217: WHITE
Case #218: BLACK
Case #219: WHITE
Case #220: BLACK
Case #221: WHITE
Case #222: BLACK
Case #223: BLACK
Case #224: BLACK
Case #225: WHITE
Case #226: WHITE
Case #227: WHITE
Case #228: WHITE
Case #229: BLACK
Case #230: WHITE
Case #231: WHITE
Case #232: WHITE
Case #233: BLACK
Case #234: BLACK
Case #235: WHITE
Case #236: WHITE
Case #237: WHITE
Case #238: BLACK
Case #239: BLACK
Case #240: BLACK
Case #241: WHITE
Case #242: BLACK
Case #243: WHITE
Case #244: WHITE
Case #245: BLACK
Case #246: WHITE
Case #247: WHITE
Case #248: WHITE
Case #249: BLACK
Case #250: WHITE
Case #251: BLACK
Case #252: BLACK
Case #253: BLACK
Case #254: BLACK
Case #255: BLACK
Case #256: WHITE

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1yvl560.05692010/12/31 16:51:530B / 33B / 19B
2leonid560.05892011/01/01 19:52:220B / 33B / 20B
3eban620.01542011/01/11 19:16:290B / 31B / 25B
4aglias650.02692011/01/04 14:29:250B / 31B / 28B
5kaki660.02312011/01/13 08:23:490B / 31B / 30B

Perl _

RankUserSizeTimeDateStatistics
1teebee520.03622010/12/31 19:08:180B / 28B / 19B
2nai520.00462011/01/08 01:53:170B / 25B / 24B

Python _

RankUserSizeTimeDateStatistics
1hallvabo820.12562010/12/31 06:21:180B / 49B / 32B
2KirarinSnow820.12562010/12/31 17:56:150B / 48B / 32B
3notogawa820.12652010/12/31 21:22:540B / 48B / 33B
4recursive840.12032011/01/01 13:07:060B / 47B / 35B
5wrongrook870.08732010/12/31 05:58:400B / ?B / ?B

Scheme _

RankUserSizeTimeDateStatistics
1kaki750.10162011/01/04 11:45:370B / 39B / 31B

Common LISP _

RankUserSizeTimeDateStatistics
1kozima810.22282011/01/07 17:53:050B / 48B / 28B

Arc _

RankUserSizeTimeDateStatistics
1pooq706.04412011/01/02 19:21:470B / 39B / 27B
2pooq676.65092011/01/13 18:40:480B / 39B / 23B

LilyPond _

RankUserSizeTimeDateStatistics
1KirarinSnow904.18522010/12/31 18:33:040B / 45B / 38B

Io _

RankUserSizeTimeDateStatistics
1pooq1140.53112011/01/02 08:09:140B / 77B / 31B

JavaScript _

RankUserSizeTimeDateStatistics
10mg760.07692010/12/31 13:03:380B / 36B / 38B
2nn760.07332010/12/31 14:43:160B / 37B / 37B

Lua _

RankUserSizeTimeDateStatistics
1yamaya840.00582011/01/07 01:16:200B / 43B / 35B
2pooq840.00602011/01/13 15:11:170B / 43B / 35B

Xtal _

RankUserSizeTimeDateStatistics
1pooq1370.08432011/01/13 05:25:400B / 75B / 59B
2teebee910.09442012/01/02 09:03:180B / 47B / 41B

Icon _

RankUserSizeTimeDateStatistics
1KirarinSnow910.05482012/03/23 12:02:020B / 54B / 29B

Prolog _

RankUserSizeTimeDateStatistics
1pooq1240.23862011/01/02 13:01:330B / 65B / 52B
2teebee(pooq)1070.23802012/03/13 07:32:320B / 51B / 48B
3pooq1120.15832012/03/05 10:49:470B / 58B / 47B

BASIC _

RankUserSizeTimeDateStatistics
1*yuko*800.04872010/12/31 01:19:180B / 50B / 24B
2pooq800.00792011/01/13 15:36:590B / 50B / 22B

J _

RankUserSizeTimeDateStatistics
1pooq760.18952011/01/02 00:21:050B / 25B / 48B

K _

RankUserSizeTimeDateStatistics
1teebee590.03082012/07/04 09:22:030B / 21B / 36B

C _

RankUserSizeTimeDateStatistics
1nn880.03402010/12/31 10:08:520B / 42B / 43B
2inaniwa880.03682010/12/31 18:32:080B / 44B / 42B
3notogawa880.03752010/12/31 20:10:560B / 42B / 43B
4nai880.03542011/01/01 16:19:100B / 44B / 42B
5not880.03602011/01/03 23:53:220B / 44B / 42B
6aglias880.03662011/01/04 01:30:540B / 44B / 42B
7kaki880.00222011/01/12 10:38:370B / 42B / 43B

C++ _

RankUserSizeTimeDateStatistics
1c|mell 01480.07182011/01/03 10:17:120B / 85B / 52B

OCaml _

RankUserSizeTimeDateStatistics
1m.ukai1160.13742011/01/11 15:37:490B / 72B / 32B

Haskell _

RankUserSizeTimeDateStatistics
1notogawa1060.04352010/12/30 22:26:020B / 63B / 32B
2rst761060.01062011/01/11 12:34:120B / 63B / 32B
3koyama411070.01042011/01/12 12:10:460B / 64B / 33B

Java _

RankUserSizeTimeDateStatistics
1teebee1560.69552011/01/08 00:12:400B / 88B / 62B
2hallvabo1790.64522010/12/30 23:41:220B / 114B / 57B

Pascal _

RankUserSizeTimeDateStatistics
1*yuko*1180.00402011/01/07 22:25:040B / 79B / 31B
2uru1180.00392011/01/11 19:36:570B / 80B / 30B

Fortran _

RankUserSizeTimeDateStatistics
1*yuko*900.04602010/12/30 20:35:050B / 54B / 33B
2*yuko*860.03872011/11/26 23:56:080B / 53B / 30B

Maxima _

RankUserSizeTimeDateStatistics
1pooq820.52312011/01/02 19:32:550B / 40B / 39B

AWK _

RankUserSizeTimeDateStatistics
1yamaya440.00312011/01/07 17:51:490B / 19B / 23B
2eban450.02012011/01/11 10:29:530B / 20B / 23B

sed _

RankUserSizeTimeDateStatistics
1KirarinSnow1350.06792011/01/01 14:17:240B / 53B / 68B
2narb1450.04982011/01/01 14:20:130B / 52B / 74B
3tails (%20)1140.67252016/03/17 16:41:310B / 47B / 53B
4%201330.05092016/03/17 08:29:180B / 48B / 72B

jq _

RankUserSizeTimeDateStatistics
1teebee(eban)830.03792014/12/16 05:47:540B / 36B / 44B
2eban860.03732014/12/15 14:59:100B / 34B / 49B

Bash _

RankUserSizeTimeDateStatistics
1yamaya690.10912011/01/08 20:10:570B / 31B / 33B
2eban730.05722011/01/11 09:49:240B / 44B / 17B

Bash (builtins) _

RankUserSizeTimeDateStatistics
1tails550.12622017/07/07 14:28:480B / 27B / 19B

bc _

RankUserSizeTimeDateStatistics
1teebee890.26202011/07/02 18:53:290B / 49B / 34B

dc _

RankUserSizeTimeDateStatistics
1tails550.08992016/03/17 11:18:510B / 34B / 18B

R _

RankUserSizeTimeDateStatistics
1pooq1010.96012011/01/02 01:42:060B / 50B / 49B
2pooq980.57062012/10/25 06:55:290B / 50B / 46B

Befunge _

RankUserSizeTimeDateStatistics
1kaki770.01532011/01/04 11:14:060B / 22B / 48B

GolfScript _

RankUserSizeTimeDateStatistics
1narb440.32102010/12/30 17:00:520B / ?B / ?B
2KirarinSnow440.32392010/12/31 03:59:260B / 17B / 24B
3nooodl570.27362010/12/30 20:56:570B / ?B / ?B

gs2 _

RankUserSizeTimeDateStatistics
1tails (whio)320.27862017/07/07 16:44:207B / 20B / 3B
2whio330.28062017/07/07 05:18:537B / 21B / 3B

FerNANDo _

RankUserSizeTimeDateStatistics
1%206770.36112016/03/17 07:17:170B / 339B / 0B

Unlambda _

RankUserSizeTimeDateStatistics
1KirarinSnow36030.19322012/03/04 13:24:280B / 1775B / 1823B

z80 _

RankUserSizeTimeDateStatistics
1*yuko*700.04052010/12/31 11:21:1430B / 23B / 12B

Piet _

RankUserSizeTimeDateStatistics
1KirarinSnow9530.06442012/03/21 13:55:06524B / 286B / 128B

Vim _

RankUserSizeTimeDateStatistics
1nn660.84372010/12/30 23:21:264B / 40B / 19B

Groovy _

RankUserSizeTimeDateStatistics
1teebee866.66712011/01/02 12:55:230B / 44B / 39B
2nn866.61142011/01/02 16:23:240B / 44B / 38B

Scala _

RankUserSizeTimeDateStatistics
1pooq8411.15922011/02/27 21:04:480B / 54B / 26B

Logo _

RankUserSizeTimeDateStatistics
1KirarinSnow740.02632011/03/19 04:42:110B / 49B / 15B
2teebee760.02802011/03/19 04:26:470B / 51B / 15B

Language Ranking_

RankLangUserSizeScore
1gs2tails (whio)3210000
2GolfScriptnarb447272
3AWKyamaya447272
4Perlteebee526153
5dctails555818
6Bash (builtins)tails555818
7Rubyyvl565714
8Kteebee595423
9Vimnn664848
10Arcpooq674776
11Bashyamaya694637
12z80*yuko*704571
13LogoKirarinSnow744324
14Schemekaki754266
15JavaScript0mg764210
16Jpooq764210
17Befungekaki774155
18BASIC*yuko*804000
19Common LISPkozima813950
20Pythonhallvabo823902
21Maximapooq823902
22jqteebee(eban)833855
23Luayamaya843809
24Scalapooq843809
25Groovyteebee863720
26Fortran*yuko*863720
27Cnn883636
28bcteebee893595
29LilyPondKirarinSnow903555
30Xtalteebee913516
31IconKirarinSnow913516
32Rpooq983265
33Haskellnotogawa1063018
34Prologteebee(pooq)1072990
35Iopooq1142807
36sedtails (%20)1142807
37OCamlm.ukai1162758
38Pascal*yuko*1182711
39C++c|mell 01482162
40Javateebee1562051
41FerNANDo%20677472
42PietKirarinSnow953335
43UnlambdaKirarinSnow360388

return top