Tak z _FIXED_

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 input line has 3 numbers, x, y, z.
Please calcurate Tak like functon f(x,y,z) and print it.
f(x,y,z)=z ;for x<=y,
f(x,y,z)=f(f(x-5,y,z),f(y-5,z,x),f(z-5,x,y)) ;for x>y.

Options

exec is denied

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

Sample input:_

903 902 871
972 937 926
327 315 321
437 440 405
683 646 692
80 26 35
164 166 188
1065 1039 1015
653 663 635
554 516 570
597 558 587
356 347 311
75 111 144
219 263 245
69 100 65
306 310 315
326 296 309
515 554 565
494 511 511
312 335 343
757 722 700
900 847 855
397 426 404
730 692 725
470 452 463
555 558 499
181 198 217
643 681 641
469 462 465
628 569 589
163 142 113
1014 1038 1058
767 772 778
642 596 603
184 138 188
115 78 150
234 239 195
716 707 733
99 134 103
134 105 85
585 577 633
1009 1070 1015
1002 1066 1001
18 51 77
228 236 194
395 405 403
747 729 694
374 350 383
806 749 797
899 902 907
1057 1051 1038
732 679 705
907 939 894
654 685 647
378 333 346
300 263 275
289 337 323
507 546 518
336 370 403
362 410 391
699 713 713
715 761 726
464 466 468
397 395 361
746 789 756
940 972 974
602 552 539
714 694 693
599 629 623
790 801 798
1010 1050 984
261 264 222
818 773 819
456 458 444
904 924 877
366 369 369
519 511 544
931 901 903
549 509 518
766 775 738
855 852 895
526 509 507
373 396 398
862 875 901
414 442 446
202 159 156
370 389 386
448 473 501
670 696 718
899 924 933
588 623 591
295 302 270
994 1055 1011
471 472 410
350 362 302
105 127 84
217 279 247
151 123 129
813 813 819
492 512 519
1012 985 1054
1078 1003 1059
178 177 126
271 215 270
309 281 329
470 430 500
537 526 483
64 58 26
681 625 675
902 874 835
977 967 918
194 180 131
118 116 57
441 379 440
965 928 1003
161 143 93
147 87 153
290 223 294

Sample output:

902
937
315
405
683
26
188
1019
635
554
558
312
144
245
65
315
296
565
511
343
722
847
404
692
452
499
217
641
462
569
142
1058
778
596
138
80
195
716
103
90
585
1015
1001
77
194
403
699
374
749
907
1041
679
894
647
333
263
323
518
403
391
713
726
468
395
756
974
542
694
623
798
984
222
773
444
877
369
514
901
509
738
855
509
398
901
446
159
386
501
718
933
591
270
1011
410
302
84
247
123
819
519
987
1003
177
215
309
470
526
28
625
839
922
180
116
379
965
98
147
223

Sample input:_

709 707 764
353 403 381
610 666 638
301 346 276
344 389 401
610 663 640
422 465 468
166 153 105
870 928 912
214 176 205
311 271 288
381 402 408
1021 1050 1037
377 380 382
726 667 713
693 698 707
459 470 453
153 147 200
285 314 268
366 358 409
690 687 627
971 976 975
330 286 313
433 404 445
472 456 438
139 186 164
52 96 92
751 778 735
310 315 338
261 287 297
703 655 637
139 159 162
950 952 957
876 842 811
939 905 916
535 550 544
507 531 471
230 179 230
964 1023 1004
394 415 414
751 739 762
721 704 738
162 129 159
501 459 441
414 416 398
145 164 195
329 290 287
720 766 748
403 471 425
141 173 144
847 893 892
986 971 974
583 599 586
488 493 448
318 346 391
667 695 688
725 673 689
636 603 664
645 656 669
83 109 104
618 560 602
985 1017 963
976 952 932
371 421 424
73 88 86
583 574 637
753 753 754
587 602 628
418 397 433
584 596 608
841 831 900
672 639 678
522 537 519
937 911 917
126 99 153
618 679 667
220 193 233
687 663 728
967 977 944
1018 994 1051
1015 994 985
861 826 859
868 873 891
412 406 393
225 180 226
881 844 856
740 710 763
922 871 896
1005 997 1005
620 635 592
836 890 830
462 474 442
232 185 231
411 461 457
671 692 633
534 522 572
687 681 742
85 71 81
939 915 956
879 949 937
1027 968 1021
159 142 97
184 138 188
286 269 226
325 259 312
498 488 439
539 533 483
640 609 672
750 716 789
949 891 947
1004 981 937
971 934 1003
358 306 364
496 441 505
976 921 984
344 326 279
567 557 499
475 447 398

Sample output:

709
381
638
276
401
640
468
153
912
176
271
408
1037
382
667
707
453
153
268
361
687
975
286
408
441
164
92
735
338
297
640
162
957
842
905
544
471
179
1004
414
741
721
129
459
398
195
290
748
425
144
892
971
586
448
391
688
673
636
669
104
560
963
952
424
86
578
754
628
398
608
841
672
519
911
126
667
195
667
944
998
994
826
891
396
180
844
715
871
997
592
830
442
185
457
633
534
682
71
939
937
968
102
138
229
259
443
488
610
750
891
981
936
358
496
976
281
502
402

Sample input:_

596 592 578
354 330 296
931 895 913
243 251 226
44 12 29
218 178 203
174 178 203
267 267 275
123 109 106
324 327 370
20 59 25
943 875 921
869 892 871
481 484 466
302 272 278
50 59 108
51 66 61
246 271 288
73 36 19
865 871 846
592 573 523
534 516 500
534 508 541
516 529 512
915 971 919
1011 965 965
604 639 636
291 237 278
679 724 730
149 172 119
862 847 844
584 613 611
1049 1022 1028
71 92 100
817 818 793
323 307 253
903 833 862
683 687 720
89 105 94
486 455 501
287 291 314
611 656 600
875 889 935
980 922 921
447 495 448
50 89 60
891 920 895
1001 1041 1039
427 394 359
295 304 316
312 316 340
583 659 606
437 410 453
916 900 912
52 53 66
955 955 996
893 897 945
279 262 276
102 111 98
909 938 943
379 420 423
492 527 473
515 524 561
836 839 848
698 695 703
452 446 426
776 735 738
877 932 920
609 566 582
940 947 940
396 447 384
874 903 877
503 461 487
847 830 863
937 889 911
238 258 184
735 743 720
812 877 812
207 231 267
364 345 319
892 888 908
611 589 647
370 345 356
379 391 386
591 615 636
127 146 154
506 474 517
146 112 141
724 746 708
1019 1052 1053
102 133 141
131 120 84
987 981 994
835 846 858
483 443 501
628 638 644
640 639 672
798 807 759
267 261 301
873 887 869
1065 1000 1056
173 121 178
210 152 203
296 230 282
392 361 411
503 474 434
553 502 556
674 634 600
812 756 812
973 915 970
115 78 150
104 68 32
397 358 435
712 687 645
649 604 676
627 573 640
498 446 515

Sample output:

592
330
895
226
12
178
203
275
109
370
25
875
871
466
272
108
61
288
21
846
528
501
534
512
919
965
636
237
730
119
847
611
1022
100
793
257
833
720
94
456
314
600
935
922
448
60
895
1039
394
316
340
606
437
900
66
996
945
262
98
943
423
473
561
848
698
431
735
920
566
940
384
877
461
847
889
184
720
812
267
320
892
611
345
386
636
154
476
112
708
1053
141
120
987
858
483
644
640
759
262
869
1000
121
152
230
392
439
502
604
756
915
80
33
397
687
649
577
498

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1ksk1010.75742009/03/21 14:59:230B / 46B / 45B
2leonid1071.36502009/03/18 03:59:450B / 47B / 54B
3zetamatta1191.25262009/03/20 10:06:030B / 61B / 50B

Perl _

RankUserSizeTimeDateStatistics
1zetamatta1110.72492009/03/20 10:14:430B / 44B / 65B
2teebee(zetamatta)1010.30892014/08/24 02:08:590B / 35B / 63B
3jonathan camacho2710.22362014/08/24 02:16:570B / 96B / 101B

Python _

RankUserSizeTimeDateStatistics
1Mark Byers1410.68562009/02/23 07:11:280B / 71B / 63B
2kt3k1420.74882009/02/25 11:38:540B / 77B / 58B
3recursive1450.76722009/02/23 05:52:590B / 79B / 60B
4hallvabo1470.82942009/03/21 20:59:510B / 84B / 54B
5zetamatta1580.60722009/03/16 03:43:280B / 89B / 56B
6doodoori21830.36552009/09/15 09:28:545B / ?B / ?B

Common LISP _

RankUserSizeTimeDateStatistics
1kozima1630.58922009/03/19 08:52:170B / 73B / 68B
2youz1831.51772009/02/25 12:48:120B / 95B / 68B

Arc _

RankUserSizeTimeDateStatistics
1murky-satyr1244.49672009/12/31 22:38:380B / 53B / 53B

JavaScript _

RankUserSizeTimeDateStatistics
1nn1401.46012009/03/17 10:27:310B / 76B / 61B
2murky-satyr1280.11612009/12/31 22:26:450B / 68B / 58B

Lua _

RankUserSizeTimeDateStatistics
1zetamatta1861.08092009/03/20 04:14:240B / 96B / 74B
2murky-satyr1520.41992009/12/31 22:55:070B / 86B / 56B

J _

RankUserSizeTimeDateStatistics
1pooq1720.27292009/03/25 00:12:460B / 98B / 56B

C _

RankUserSizeTimeDateStatistics
1letter1282.27602009/02/23 07:50:230B / 62B / 65B
251b1282.23342009/02/27 04:27:590B / 62B / 65B
3komono1282.24212009/03/06 02:41:110B / 62B / 65B
4inaniwa1282.09832009/12/14 11:22:130B / 62B / 65B

D _

RankUserSizeTimeDateStatistics
151b1570.06452009/02/28 18:29:120B / 83B / 71B
2komono1642.46312009/03/06 02:43:410B / 94B / 62B

OCaml _

RankUserSizeTimeDateStatistics
1ksk1560.21902009/09/19 12:44:370B / 87B / 54B
2xsd1720.20662009/09/14 02:25:270B / 95B / 58B

Pascal _

RankUserSizeTimeDateStatistics
1pooq1632.38752009/02/28 16:51:420B / 104B / 50B
2uru1662.38782009/02/28 19:07:290B / 104B / 54B

Fortran _

RankUserSizeTimeDateStatistics
1pooq1352.77262009/02/28 17:49:390B / 82B / 43B

AWK _

RankUserSizeTimeDateStatistics
1nn1010.46752009/03/21 16:39:400B / 51B / 47B
2yamaya1040.60502009/02/23 02:47:100B / 52B / 51B
3zetamatta1170.57582009/02/26 22:20:070B / 59B / 55B

Postscript _

RankUserSizeTimeDateStatistics
1Mark Byers1131.57972009/03/11 07:26:0841B / 35B / 35B
2yshl(bin)1261.28912009/03/15 23:12:0456B / 41B / 28B
3yshl2271.41652009/03/15 22:53:360B / 164B / 21B

goruby _

RankUserSizeTimeDateStatistics
1murky-satyr910.51032009/12/31 22:25:310B / 37B / 51B

Groovy _

RankUserSizeTimeDateStatistics
1murky-satyr1296.20242009/12/31 22:29:150B / 70B / 56B
2nn1385.41162009/11/20 07:33:310B / 73B / 61B

Language Ranking_

RankLangUserSizeScore
1gorubymurky-satyr9110000
2Rubyksk1019009
3AWKnn1019009
4Perlteebee(zetamatta)1019009
5PostscriptMark Byers1138053
6Arcmurky-satyr1247338
7Cletter1287109
8JavaScriptmurky-satyr1287109
9Groovymurky-satyr1297054
10Fortranpooq1356740
11PythonMark Byers1416453
12Luamurky-satyr1525986
13OCamlksk1565833
14D51b1575796
15Pascalpooq1635582
16Common LISPkozima1635582
17Jpooq1725290

return top