Quizzes and Assignments
Quizzes and Assignments
Input
Output
Test Case 1
3
5
4
yes
Test Case 2
5
8
2
no
Test Case 3
5
12
13
yes
Test Case 4
50
130
120
yes
Test Case 5
120
130
50
yes
Test Case 6
9999
9801
1980
yes
Test Case 7
5
8
12
no
Input
Output
Test Case 1
17
Test Case 2
Test Case 3
12
60710
Test Case 4
22
1151403
Test Case 5
34
9768353
Test Case 6
40
21781332
Input
Output
Test Case 1
0
00
Test Case 2
0
00
000
0000
00000
000000
Test Case 3
22
0
00
000
0000
00000
000000
0000000
00000000
000000000
0000000000
00000000000
000000000000
0000000000000
00000000000000
000000000000000
0000000000000000
00000000000000000
000000000000000000
0000000000000000000
00000000000000000000
000000000000000000000
0000000000000000000000
Test Case 4
40
0
00
000
0000
00000
000000
0000000
00000000
000000000
0000000000
00000000000
000000000000
0000000000000
00000000000000
000000000000000
0000000000000000
00000000000000000
000000000000000000
0000000000000000000
00000000000000000000
000000000000000000000
0000000000000000000000
00000000000000000000000
000000000000000000000000
0000000000000000000000000
00000000000000000000000000
000000000000000000000000000
0000000000000000000000000000
00000000000000000000000000000
000000000000000000000000000000
0000000000000000000000000000000
00000000000000000000000000000000
000000000000000000000000000000000
0000000000000000000000000000000000
00000000000000000000000000000000000
000000000000000000000000000000000000
0000000000000000000000000000000000000
00000000000000000000000000000000000000
000000000000000000000000000000000000000
0000000000000000000000000000000000000000
Triangular Matrix
Due on 2014-09-16, 23:59 IST
Level:Medium
In this assignment, you will be given an NxN matrix. You have to determine whether the
matrix is a triangular matrix.
The diagonal of the matrix M of size NxN is the set of entries M(0,0), M(1,1), M(2,2), ...,
M(N,N).
A matrix is upper triangular if every entry below the diagonal is 0. For example,
111
001
002
is an upper triangular matrix. (The diagonal itself, and the entries above and below the
diagonals can be zeroes or non-zero integers.)
A matrix is lower triangular if every entry above the diagonal is 0. For example,
200
310
422
is a lower triangular matrix.
A matrix is triangular if it is either upper triangular or lower triangular.
You may not use arrays for this program.
Input
First, you will be given N, which is the size of the matrix.
Then you will be given N rows of integers, where each row consists of N integers
separated by spaces.
Output
If the input matrix is triangular, then print yes. Otherwise, print no.
Sample Test Cases
Input
Output
Test Case 1
2
1 1
0 1
yes
Test Case 2
3
1 0 0
0 1 0
1 1 2
yes
Test Case 3
3
1 0 1
0 1 0
no
1 1 2
Test Case 4
Test Case 5
Test Case 6
7
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
yes
7
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
7
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
0
1
1
yes
no
Input
Output
Test
Case 1
-261
Test
Case 2
-840 -335 -1
-840
Test
Case 3
471 -288 -366 488 -335 -420 -840 465 -337 413 -261 458 -1
471
Test
Case 4
593 -588 -93 -288 512 -513 168 -146 -366 -335 180 -49 -266 -840 129
423 458 64 488 32 475 -295 413 193 471 -586 -337 133 -488 394 -420
465 -128 497 -261 55 -615 -40 -888 -507 -1
512
Test
Case 5
-146 -288 -266 133 -840 423 -93 64 -335 -513 -366 471 413 488 -420
497 475 -507 129 -615 465 -295 55 -261 -128 593 180 -40 512 458 488 193 168 -586 -49 -337 32 -888 -588 -1
512
Quiz
Due on 2014-09-26, 23:59 IST
The due date for submitting this assignment has passed.
State whether the following expression is valid. If the expression is valid, evaluate the value of the
expression; if the expression is not valid state the reason.
(3>5-2)
Expression is Valid Expression evaluates to 1
Expression is Valid Expression evaluates to 0
Expression is Valid Expression evaluates to -2
Expression is Valid Expression evaluates to -1
Expression is In-Valid Operation is not clearly defined
1 point
State whether the following expressions is valid. If the expression is valid, evaluate the value of the
expression; if the expression is not valid state the reason. Assume i=3 , j=2
Tick all that apply
((i>j)&&(i=j))
Expression is Valid Expression evaluates to 0
Expression is In-Valid Expression gives a compiler-error
Expression is Valid Expression evaluates to 1
Expression is In-Valid Single = can't be used in the expression
1 point
State whether the following expression is valid. If the expression is valid, evaluate the value of the
expression; if the expression is not valid state the reason.
Tick all that apply
(++3*5)
Expression is valid Expression evaluates to 16
Expression is valid Expression evaluates to 20
Expression is valid Expression evaluates to 25
Expression is valid Expression evaluates to 17
Expression is invalid Increment operator requires a variable to perform its operation
1 point
State whether the following expressions is valid.If the expression is valid, evaluate the value of the
expression; if the expression is not valid state the reason. Assume i=3 , j=2
Tick all that apply
(! i | | j)
Expression is valid Expression evaluates to 1
Expression is valid Expression evaluates to 0
sum = 0;
while(n > 0)
{
digit = n%10;
n = n/10;
sum = sum + digit;
}
}
if(sum == 1)
{
printf("%d is a CS101 quiz number ",i);
}
}
return 0;
}
Write down the the output of the code when the input is
10 30
2 points
Question : AlphaNumeric
Complete the following function that returns 1 if the input is alphanumeric else it returns 0 to the calling
function
int isalphanum(char c)
{
int result;
if (c>= ____1_____ && c <= 'z')
return 1;
if (c>=___2_____ && c<= 'Z')
return 1;
if (c>=___3____ && c<=____4____)
return ___5____;
return ____6____;
}
Response to Alphanumeric (Question 8) Blank 1
1 point
Response to Alphanumeric (Question 8) Blank 2
1 point
Response to Alphanumeric (Question 8) Blank 3
1 point
Input
Output
Test Case 1
4
2
Test Case 2
2
4
-1
Test Case 3
2
3
-1
Test Case 4
4
2
Test Case 5
4
0
-1
Test Case 6
0
6
Test Case 7
1234
1234
Input
Output
Test Case 1
4
2
Test Case 2
2
1
Test Case 3
5
2
10
Test Case 4
7
0
Test Case 5
4
100000
Test Case 6
10
5
252
Test Case 7
10
10
Input
Output
Test
Case
1
3
1 2
Test
Case
2
4
1 3 4
Test
Case
3
4
2 1 4
Test
Case
4
5
1 4 5 3
Test
Case
5
10
10 9 7 3 2 1 4 5 8
Test
Case
10000
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49
542
51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95
97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131
133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165
167 169 171 173 175 177 179 181 183 185 187 189 191 193 195 197 199
201 203 205 207 209 211 213 215 217 219 221 223 225 227 229 231 233
235 237 239 241 243 245 247 249 251 253 255 257 259 261 263 265 267
269 271 273 275 277 279 281 283 285 287 289 291 293 295 297 299 301
303 305 307 309 311 313 315 317 319 321 323 325 327 329 331 333 335
337 339 341 343 345 347 349 351 353 355 357 359 361 363 365 367 369
371 373 375 377 379 381 383 385 387 389 391 393 395 397 399 401 403
405 407 409 411 413 415 417 419 421 423 425 427 429 431 433 435 437
439 441 443 445 447 449 451 453 455 457 459 461 463 465 467 469 471
473 475 477 479 481 483 485 487 489 491 493 495 497 499 501 503 505
507 509 511 513 515 517 519 521 523 525 527 529 531 533 535 537 539
541 543 545 547 549 551 553 555 557 559 561 563 565 567 569 571 573
575 577 579 581 583 585 587 589 591 593 595 597 599 601 603 605 607
609 611 613 615 617 619 621 623 625 627 629 631 633 635 637 639 641
643 645 647 649 651 653 655 657 659 661 663 665 667 669 671 673 675
677 679 681 683 685 687 689 691 693 695 697 699 701 703 705 707 709
711 713 715 717 719 721 723 725 727 729 731 733 735 737 739 741 743
745 747 749 751 753 755 757 759 761 763 765 767 769 771 773 775 777
779 781 783 785 787 789 791 793 795 797 799 801 803 805 807 809 811
813 815 817 819 821 823 825 827 829 831 833 835 837 839 841 843 845
847 849 851 853 855 857 859 861 863 865 867 869 871 873 875 877 879
881 883 885 887 889 891 893 895 897 899 901 903 905 907 909 911 913
915 917 919 921 923 925 927 929 931 933 935 937 939 941 943 945 947
949 951 953 955 957 959 961 963 965 967 969 971 973 975 977 979 981
983 985 987 989 991 993 995 997 999 1001 1003 1005 1007 1009 1011 1013
1015 1017 1019 1021 1023 1025 1027 1029 1031 1033 1035 1037 1039 1041
1043 1045 1047 1049 1051 1053 1055 1057 1059 1061 1063 1065 1067 1069
1071 1073 1075 1077 1079 1081 1083 1085 1087 1089 1091 1093 1095 1097
1099 1101 1103 1105 1107 1109 1111 1113 1115 1117 1119 1121 1123 1125
1127 1129 1131 1133 1135 1137 1139 1141 1143 1145 1147 1149 1151 1153
1155 1157 1159 1161 1163 1165 1167 1169 1171 1173 1175 1177 1179 1181
1183 1185 1187 1189 1191 1193 1195 1197 1199 1201 1203 1205 1207 1209
1211 1213 1215 1217 1219 1221 1223 1225 1227 1229 1231 1233 1235 1237
1239 1241 1243 1245 1247 1249 1251 1253 1255 1257 1259 1261 1263 1265
1267 1269 1271 1273 1275 1277 1279 1281 1283 1285 1287 1289 1291 1293
1295 1297 1299 1301 1303 1305 1307 1309 1311 1313 1315 1317 1319 1321
1323 1325 1327 1329 1331 1333 1335 1337 1339 1341 1343 1345 1347 1349
1351 1353 1355 1357 1359 1361 1363 1365 1367 1369 1371 1373 1375 1377
1379 1381 1383 1385 1387 1389 1391 1393 1395 1397 1399 1401 1403 1405
1407 1409 1411 1413 1415 1417 1419 1421 1423 1425 1427 1429 1431 1433
1435 1437 1439 1441 1443 1445 1447 1449 1451 1453 1455 1457 1459 1461
1463 1465 1467 1469 1471 1473 1475 1477 1479 1481 1483 1485 1487 1489
1491 1493 1495 1497 1499 1501 1503 1505 1507 1509 1511 1513 1515 1517
1519 1521 1523 1525 1527 1529 1531 1533 1535 1537 1539 1541 1543 1545
1547 1549 1551 1553 1555 1557 1559 1561 1563 1565 1567 1569 1571 1573
1575 1577 1579 1581 1583 1585 1587 1589 1591 1593 1595 1597 1599 1601
1603 1605 1607 1609 1611 1613 1615 1617 1619 1621 1623 1625 1627 1629
1631 1633 1635 1637 1639 1641 1643 1645 1647 1649 1651 1653 1655 1657
1659 1661 1663 1665 1667 1669 1671 1673 1675 1677 1679 1681 1683 1685
1687 1689 1691 1693 1695 1697 1699 1701 1703 1705 1707 1709 1711 1713
1715 1717 1719 1721 1723 1725 1727 1729 1731 1733 1735 1737 1739 1741
1743 1745 1747 1749 1751 1753 1755 1757 1759 1761 1763 1765 1767 1769
1771 1773 1775 1777 1779 1781 1783 1785 1787 1789 1791 1793 1795 1797
1799 1801 1803 1805 1807 1809 1811 1813 1815 1817 1819 1821 1823 1825
1827 1829 1831 1833 1835 1837 1839 1841 1843 1845 1847 1849 1851 1853
1855 1857 1859 1861 1863 1865 1867 1869 1871 1873 1875 1877 1879 1881
1883 1885 1887 1889 1891 1893 1895 1897 1899 1901 1903 1905 1907 1909
1911 1913 1915 1917 1919 1921 1923 1925 1927 1929 1931 1933 1935 1937
1939 1941 1943 1945 1947 1949 1951 1953 1955 1957 1959 1961 1963 1965
1967 1969 1971 1973 1975 1977 1979 1981 1983 1985 1987 1989 1991 1993
1995 1997 1999 2001 2003 2005 2007 2009 2011 2013 2015 2017 2019 2021
2023 2025 2027 2029 2031 2033 2035 2037 2039 2041 2043 2045 2047 2049
2051 2053 2055 2057 2059 2061 2063 2065 2067 2069 2071 2073 2075 2077
2079 2081 2083 2085 2087 2089 2091 2093 2095 2097 2099 2101 2103 2105
2107
2135
2163
2191
2219
2247
2275
2303
2331
2359
2387
2415
2443
2471
2499
2527
2555
2583
2611
2639
2667
2695
2723
2751
2779
2807
2835
2863
2891
2919
2947
2975
3003
3031
3059
3087
3115
3143
3171
3199
3227
3255
3283
3311
3339
3367
3395
3423
3451
3479
3507
3535
3563
3591
3619
3647
3675
3703
3731
3759
3787
3815
3843
3871
3899
3927
3955
2109
2137
2165
2193
2221
2249
2277
2305
2333
2361
2389
2417
2445
2473
2501
2529
2557
2585
2613
2641
2669
2697
2725
2753
2781
2809
2837
2865
2893
2921
2949
2977
3005
3033
3061
3089
3117
3145
3173
3201
3229
3257
3285
3313
3341
3369
3397
3425
3453
3481
3509
3537
3565
3593
3621
3649
3677
3705
3733
3761
3789
3817
3845
3873
3901
3929
3957
2111
2139
2167
2195
2223
2251
2279
2307
2335
2363
2391
2419
2447
2475
2503
2531
2559
2587
2615
2643
2671
2699
2727
2755
2783
2811
2839
2867
2895
2923
2951
2979
3007
3035
3063
3091
3119
3147
3175
3203
3231
3259
3287
3315
3343
3371
3399
3427
3455
3483
3511
3539
3567
3595
3623
3651
3679
3707
3735
3763
3791
3819
3847
3875
3903
3931
3959
2113
2141
2169
2197
2225
2253
2281
2309
2337
2365
2393
2421
2449
2477
2505
2533
2561
2589
2617
2645
2673
2701
2729
2757
2785
2813
2841
2869
2897
2925
2953
2981
3009
3037
3065
3093
3121
3149
3177
3205
3233
3261
3289
3317
3345
3373
3401
3429
3457
3485
3513
3541
3569
3597
3625
3653
3681
3709
3737
3765
3793
3821
3849
3877
3905
3933
3961
2115
2143
2171
2199
2227
2255
2283
2311
2339
2367
2395
2423
2451
2479
2507
2535
2563
2591
2619
2647
2675
2703
2731
2759
2787
2815
2843
2871
2899
2927
2955
2983
3011
3039
3067
3095
3123
3151
3179
3207
3235
3263
3291
3319
3347
3375
3403
3431
3459
3487
3515
3543
3571
3599
3627
3655
3683
3711
3739
3767
3795
3823
3851
3879
3907
3935
3963
2117
2145
2173
2201
2229
2257
2285
2313
2341
2369
2397
2425
2453
2481
2509
2537
2565
2593
2621
2649
2677
2705
2733
2761
2789
2817
2845
2873
2901
2929
2957
2985
3013
3041
3069
3097
3125
3153
3181
3209
3237
3265
3293
3321
3349
3377
3405
3433
3461
3489
3517
3545
3573
3601
3629
3657
3685
3713
3741
3769
3797
3825
3853
3881
3909
3937
3965
2119
2147
2175
2203
2231
2259
2287
2315
2343
2371
2399
2427
2455
2483
2511
2539
2567
2595
2623
2651
2679
2707
2735
2763
2791
2819
2847
2875
2903
2931
2959
2987
3015
3043
3071
3099
3127
3155
3183
3211
3239
3267
3295
3323
3351
3379
3407
3435
3463
3491
3519
3547
3575
3603
3631
3659
3687
3715
3743
3771
3799
3827
3855
3883
3911
3939
3967
2121
2149
2177
2205
2233
2261
2289
2317
2345
2373
2401
2429
2457
2485
2513
2541
2569
2597
2625
2653
2681
2709
2737
2765
2793
2821
2849
2877
2905
2933
2961
2989
3017
3045
3073
3101
3129
3157
3185
3213
3241
3269
3297
3325
3353
3381
3409
3437
3465
3493
3521
3549
3577
3605
3633
3661
3689
3717
3745
3773
3801
3829
3857
3885
3913
3941
3969
2123
2151
2179
2207
2235
2263
2291
2319
2347
2375
2403
2431
2459
2487
2515
2543
2571
2599
2627
2655
2683
2711
2739
2767
2795
2823
2851
2879
2907
2935
2963
2991
3019
3047
3075
3103
3131
3159
3187
3215
3243
3271
3299
3327
3355
3383
3411
3439
3467
3495
3523
3551
3579
3607
3635
3663
3691
3719
3747
3775
3803
3831
3859
3887
3915
3943
3971
2125
2153
2181
2209
2237
2265
2293
2321
2349
2377
2405
2433
2461
2489
2517
2545
2573
2601
2629
2657
2685
2713
2741
2769
2797
2825
2853
2881
2909
2937
2965
2993
3021
3049
3077
3105
3133
3161
3189
3217
3245
3273
3301
3329
3357
3385
3413
3441
3469
3497
3525
3553
3581
3609
3637
3665
3693
3721
3749
3777
3805
3833
3861
3889
3917
3945
3973
2127
2155
2183
2211
2239
2267
2295
2323
2351
2379
2407
2435
2463
2491
2519
2547
2575
2603
2631
2659
2687
2715
2743
2771
2799
2827
2855
2883
2911
2939
2967
2995
3023
3051
3079
3107
3135
3163
3191
3219
3247
3275
3303
3331
3359
3387
3415
3443
3471
3499
3527
3555
3583
3611
3639
3667
3695
3723
3751
3779
3807
3835
3863
3891
3919
3947
3975
2129
2157
2185
2213
2241
2269
2297
2325
2353
2381
2409
2437
2465
2493
2521
2549
2577
2605
2633
2661
2689
2717
2745
2773
2801
2829
2857
2885
2913
2941
2969
2997
3025
3053
3081
3109
3137
3165
3193
3221
3249
3277
3305
3333
3361
3389
3417
3445
3473
3501
3529
3557
3585
3613
3641
3669
3697
3725
3753
3781
3809
3837
3865
3893
3921
3949
3977
2131
2159
2187
2215
2243
2271
2299
2327
2355
2383
2411
2439
2467
2495
2523
2551
2579
2607
2635
2663
2691
2719
2747
2775
2803
2831
2859
2887
2915
2943
2971
2999
3027
3055
3083
3111
3139
3167
3195
3223
3251
3279
3307
3335
3363
3391
3419
3447
3475
3503
3531
3559
3587
3615
3643
3671
3699
3727
3755
3783
3811
3839
3867
3895
3923
3951
3979
2133
2161
2189
2217
2245
2273
2301
2329
2357
2385
2413
2441
2469
2497
2525
2553
2581
2609
2637
2665
2693
2721
2749
2777
2805
2833
2861
2889
2917
2945
2973
3001
3029
3057
3085
3113
3141
3169
3197
3225
3253
3281
3309
3337
3365
3393
3421
3449
3477
3505
3533
3561
3589
3617
3645
3673
3701
3729
3757
3785
3813
3841
3869
3897
3925
3953
3981
3983
4011
4039
4067
4095
4123
4151
4179
4207
4235
4263
4291
4319
4347
4375
4403
4431
4459
4487
4515
4543
4571
4599
4627
4655
4683
4711
4739
4767
4795
4823
4851
4879
4907
4935
4963
4991
5019
5047
5075
5103
5131
5159
5187
5215
5243
5271
5299
5327
5355
5383
5411
5439
5467
5495
5523
5551
5579
5607
5635
5663
5691
5719
5747
5775
5803
5831
3985
4013
4041
4069
4097
4125
4153
4181
4209
4237
4265
4293
4321
4349
4377
4405
4433
4461
4489
4517
4545
4573
4601
4629
4657
4685
4713
4741
4769
4797
4825
4853
4881
4909
4937
4965
4993
5021
5049
5077
5105
5133
5161
5189
5217
5245
5273
5301
5329
5357
5385
5413
5441
5469
5497
5525
5553
5581
5609
5637
5665
5693
5721
5749
5777
5805
5833
3987
4015
4043
4071
4099
4127
4155
4183
4211
4239
4267
4295
4323
4351
4379
4407
4435
4463
4491
4519
4547
4575
4603
4631
4659
4687
4715
4743
4771
4799
4827
4855
4883
4911
4939
4967
4995
5023
5051
5079
5107
5135
5163
5191
5219
5247
5275
5303
5331
5359
5387
5415
5443
5471
5499
5527
5555
5583
5611
5639
5667
5695
5723
5751
5779
5807
5835
3989
4017
4045
4073
4101
4129
4157
4185
4213
4241
4269
4297
4325
4353
4381
4409
4437
4465
4493
4521
4549
4577
4605
4633
4661
4689
4717
4745
4773
4801
4829
4857
4885
4913
4941
4969
4997
5025
5053
5081
5109
5137
5165
5193
5221
5249
5277
5305
5333
5361
5389
5417
5445
5473
5501
5529
5557
5585
5613
5641
5669
5697
5725
5753
5781
5809
5837
3991
4019
4047
4075
4103
4131
4159
4187
4215
4243
4271
4299
4327
4355
4383
4411
4439
4467
4495
4523
4551
4579
4607
4635
4663
4691
4719
4747
4775
4803
4831
4859
4887
4915
4943
4971
4999
5027
5055
5083
5111
5139
5167
5195
5223
5251
5279
5307
5335
5363
5391
5419
5447
5475
5503
5531
5559
5587
5615
5643
5671
5699
5727
5755
5783
5811
5839
3993
4021
4049
4077
4105
4133
4161
4189
4217
4245
4273
4301
4329
4357
4385
4413
4441
4469
4497
4525
4553
4581
4609
4637
4665
4693
4721
4749
4777
4805
4833
4861
4889
4917
4945
4973
5001
5029
5057
5085
5113
5141
5169
5197
5225
5253
5281
5309
5337
5365
5393
5421
5449
5477
5505
5533
5561
5589
5617
5645
5673
5701
5729
5757
5785
5813
5841
3995
4023
4051
4079
4107
4135
4163
4191
4219
4247
4275
4303
4331
4359
4387
4415
4443
4471
4499
4527
4555
4583
4611
4639
4667
4695
4723
4751
4779
4807
4835
4863
4891
4919
4947
4975
5003
5031
5059
5087
5115
5143
5171
5199
5227
5255
5283
5311
5339
5367
5395
5423
5451
5479
5507
5535
5563
5591
5619
5647
5675
5703
5731
5759
5787
5815
5843
3997
4025
4053
4081
4109
4137
4165
4193
4221
4249
4277
4305
4333
4361
4389
4417
4445
4473
4501
4529
4557
4585
4613
4641
4669
4697
4725
4753
4781
4809
4837
4865
4893
4921
4949
4977
5005
5033
5061
5089
5117
5145
5173
5201
5229
5257
5285
5313
5341
5369
5397
5425
5453
5481
5509
5537
5565
5593
5621
5649
5677
5705
5733
5761
5789
5817
5845
3999
4027
4055
4083
4111
4139
4167
4195
4223
4251
4279
4307
4335
4363
4391
4419
4447
4475
4503
4531
4559
4587
4615
4643
4671
4699
4727
4755
4783
4811
4839
4867
4895
4923
4951
4979
5007
5035
5063
5091
5119
5147
5175
5203
5231
5259
5287
5315
5343
5371
5399
5427
5455
5483
5511
5539
5567
5595
5623
5651
5679
5707
5735
5763
5791
5819
5847
4001
4029
4057
4085
4113
4141
4169
4197
4225
4253
4281
4309
4337
4365
4393
4421
4449
4477
4505
4533
4561
4589
4617
4645
4673
4701
4729
4757
4785
4813
4841
4869
4897
4925
4953
4981
5009
5037
5065
5093
5121
5149
5177
5205
5233
5261
5289
5317
5345
5373
5401
5429
5457
5485
5513
5541
5569
5597
5625
5653
5681
5709
5737
5765
5793
5821
5849
4003
4031
4059
4087
4115
4143
4171
4199
4227
4255
4283
4311
4339
4367
4395
4423
4451
4479
4507
4535
4563
4591
4619
4647
4675
4703
4731
4759
4787
4815
4843
4871
4899
4927
4955
4983
5011
5039
5067
5095
5123
5151
5179
5207
5235
5263
5291
5319
5347
5375
5403
5431
5459
5487
5515
5543
5571
5599
5627
5655
5683
5711
5739
5767
5795
5823
5851
4005
4033
4061
4089
4117
4145
4173
4201
4229
4257
4285
4313
4341
4369
4397
4425
4453
4481
4509
4537
4565
4593
4621
4649
4677
4705
4733
4761
4789
4817
4845
4873
4901
4929
4957
4985
5013
5041
5069
5097
5125
5153
5181
5209
5237
5265
5293
5321
5349
5377
5405
5433
5461
5489
5517
5545
5573
5601
5629
5657
5685
5713
5741
5769
5797
5825
5853
4007
4035
4063
4091
4119
4147
4175
4203
4231
4259
4287
4315
4343
4371
4399
4427
4455
4483
4511
4539
4567
4595
4623
4651
4679
4707
4735
4763
4791
4819
4847
4875
4903
4931
4959
4987
5015
5043
5071
5099
5127
5155
5183
5211
5239
5267
5295
5323
5351
5379
5407
5435
5463
5491
5519
5547
5575
5603
5631
5659
5687
5715
5743
5771
5799
5827
5855
4009
4037
4065
4093
4121
4149
4177
4205
4233
4261
4289
4317
4345
4373
4401
4429
4457
4485
4513
4541
4569
4597
4625
4653
4681
4709
4737
4765
4793
4821
4849
4877
4905
4933
4961
4989
5017
5045
5073
5101
5129
5157
5185
5213
5241
5269
5297
5325
5353
5381
5409
5437
5465
5493
5521
5549
5577
5605
5633
5661
5689
5717
5745
5773
5801
5829
5857
5859
5887
5915
5943
5971
5999
6027
6055
6083
6111
6139
6167
6195
6223
6251
6279
6307
6335
6363
6391
6419
6447
6475
6503
6531
6559
6587
6615
6643
6671
6699
6727
6755
6783
6811
6839
6867
6895
6923
6951
6979
7007
7035
7063
7091
7119
7147
7175
7203
7231
7259
7287
7315
7343
7371
7399
7427
7455
7483
7511
7539
7567
7595
7623
7651
7679
7707
5861
5889
5917
5945
5973
6001
6029
6057
6085
6113
6141
6169
6197
6225
6253
6281
6309
6337
6365
6393
6421
6449
6477
6505
6533
6561
6589
6617
6645
6673
6701
6729
6757
6785
6813
6841
6869
6897
6925
6953
6981
7009
7037
7065
7093
7121
7149
7177
7205
7233
7261
7289
7317
7345
7373
7401
7429
7457
7485
7513
7541
7569
7597
7625
7653
7681
7709
5863
5891
5919
5947
5975
6003
6031
6059
6087
6115
6143
6171
6199
6227
6255
6283
6311
6339
6367
6395
6423
6451
6479
6507
6535
6563
6591
6619
6647
6675
6703
6731
6759
6787
6815
6843
6871
6899
6927
6955
6983
7011
7039
7067
7095
7123
7151
7179
7207
7235
7263
7291
7319
7347
7375
7403
7431
7459
7487
7515
7543
7571
7599
7627
7655
7683
7711
5865
5893
5921
5949
5977
6005
6033
6061
6089
6117
6145
6173
6201
6229
6257
6285
6313
6341
6369
6397
6425
6453
6481
6509
6537
6565
6593
6621
6649
6677
6705
6733
6761
6789
6817
6845
6873
6901
6929
6957
6985
7013
7041
7069
7097
7125
7153
7181
7209
7237
7265
7293
7321
7349
7377
7405
7433
7461
7489
7517
7545
7573
7601
7629
7657
7685
7713
5867
5895
5923
5951
5979
6007
6035
6063
6091
6119
6147
6175
6203
6231
6259
6287
6315
6343
6371
6399
6427
6455
6483
6511
6539
6567
6595
6623
6651
6679
6707
6735
6763
6791
6819
6847
6875
6903
6931
6959
6987
7015
7043
7071
7099
7127
7155
7183
7211
7239
7267
7295
7323
7351
7379
7407
7435
7463
7491
7519
7547
7575
7603
7631
7659
7687
7715
5869
5897
5925
5953
5981
6009
6037
6065
6093
6121
6149
6177
6205
6233
6261
6289
6317
6345
6373
6401
6429
6457
6485
6513
6541
6569
6597
6625
6653
6681
6709
6737
6765
6793
6821
6849
6877
6905
6933
6961
6989
7017
7045
7073
7101
7129
7157
7185
7213
7241
7269
7297
7325
7353
7381
7409
7437
7465
7493
7521
7549
7577
7605
7633
7661
7689
7717
5871
5899
5927
5955
5983
6011
6039
6067
6095
6123
6151
6179
6207
6235
6263
6291
6319
6347
6375
6403
6431
6459
6487
6515
6543
6571
6599
6627
6655
6683
6711
6739
6767
6795
6823
6851
6879
6907
6935
6963
6991
7019
7047
7075
7103
7131
7159
7187
7215
7243
7271
7299
7327
7355
7383
7411
7439
7467
7495
7523
7551
7579
7607
7635
7663
7691
7719
5873
5901
5929
5957
5985
6013
6041
6069
6097
6125
6153
6181
6209
6237
6265
6293
6321
6349
6377
6405
6433
6461
6489
6517
6545
6573
6601
6629
6657
6685
6713
6741
6769
6797
6825
6853
6881
6909
6937
6965
6993
7021
7049
7077
7105
7133
7161
7189
7217
7245
7273
7301
7329
7357
7385
7413
7441
7469
7497
7525
7553
7581
7609
7637
7665
7693
7721
5875
5903
5931
5959
5987
6015
6043
6071
6099
6127
6155
6183
6211
6239
6267
6295
6323
6351
6379
6407
6435
6463
6491
6519
6547
6575
6603
6631
6659
6687
6715
6743
6771
6799
6827
6855
6883
6911
6939
6967
6995
7023
7051
7079
7107
7135
7163
7191
7219
7247
7275
7303
7331
7359
7387
7415
7443
7471
7499
7527
7555
7583
7611
7639
7667
7695
7723
5877
5905
5933
5961
5989
6017
6045
6073
6101
6129
6157
6185
6213
6241
6269
6297
6325
6353
6381
6409
6437
6465
6493
6521
6549
6577
6605
6633
6661
6689
6717
6745
6773
6801
6829
6857
6885
6913
6941
6969
6997
7025
7053
7081
7109
7137
7165
7193
7221
7249
7277
7305
7333
7361
7389
7417
7445
7473
7501
7529
7557
7585
7613
7641
7669
7697
7725
5879
5907
5935
5963
5991
6019
6047
6075
6103
6131
6159
6187
6215
6243
6271
6299
6327
6355
6383
6411
6439
6467
6495
6523
6551
6579
6607
6635
6663
6691
6719
6747
6775
6803
6831
6859
6887
6915
6943
6971
6999
7027
7055
7083
7111
7139
7167
7195
7223
7251
7279
7307
7335
7363
7391
7419
7447
7475
7503
7531
7559
7587
7615
7643
7671
7699
7727
5881
5909
5937
5965
5993
6021
6049
6077
6105
6133
6161
6189
6217
6245
6273
6301
6329
6357
6385
6413
6441
6469
6497
6525
6553
6581
6609
6637
6665
6693
6721
6749
6777
6805
6833
6861
6889
6917
6945
6973
7001
7029
7057
7085
7113
7141
7169
7197
7225
7253
7281
7309
7337
7365
7393
7421
7449
7477
7505
7533
7561
7589
7617
7645
7673
7701
7729
5883
5911
5939
5967
5995
6023
6051
6079
6107
6135
6163
6191
6219
6247
6275
6303
6331
6359
6387
6415
6443
6471
6499
6527
6555
6583
6611
6639
6667
6695
6723
6751
6779
6807
6835
6863
6891
6919
6947
6975
7003
7031
7059
7087
7115
7143
7171
7199
7227
7255
7283
7311
7339
7367
7395
7423
7451
7479
7507
7535
7563
7591
7619
7647
7675
7703
7731
5885
5913
5941
5969
5997
6025
6053
6081
6109
6137
6165
6193
6221
6249
6277
6305
6333
6361
6389
6417
6445
6473
6501
6529
6557
6585
6613
6641
6669
6697
6725
6753
6781
6809
6837
6865
6893
6921
6949
6977
7005
7033
7061
7089
7117
7145
7173
7201
7229
7257
7285
7313
7341
7369
7397
7425
7453
7481
7509
7537
7565
7593
7621
7649
7677
7705
7733
7735
7763
7791
7819
7847
7875
7903
7931
7959
7987
8015
8043
8071
8099
8127
8155
8183
8211
8239
8267
8295
8323
8351
8379
8407
8435
8463
8491
8519
8547
8575
8603
8631
8659
8687
8715
8743
8771
8799
8827
8855
8883
8911
8939
8967
8995
9023
9051
9079
9107
9135
9163
9191
9219
9247
9275
9303
9331
9359
9387
9415
9443
9471
9499
9527
9555
9583
7737
7765
7793
7821
7849
7877
7905
7933
7961
7989
8017
8045
8073
8101
8129
8157
8185
8213
8241
8269
8297
8325
8353
8381
8409
8437
8465
8493
8521
8549
8577
8605
8633
8661
8689
8717
8745
8773
8801
8829
8857
8885
8913
8941
8969
8997
9025
9053
9081
9109
9137
9165
9193
9221
9249
9277
9305
9333
9361
9389
9417
9445
9473
9501
9529
9557
9585
7739
7767
7795
7823
7851
7879
7907
7935
7963
7991
8019
8047
8075
8103
8131
8159
8187
8215
8243
8271
8299
8327
8355
8383
8411
8439
8467
8495
8523
8551
8579
8607
8635
8663
8691
8719
8747
8775
8803
8831
8859
8887
8915
8943
8971
8999
9027
9055
9083
9111
9139
9167
9195
9223
9251
9279
9307
9335
9363
9391
9419
9447
9475
9503
9531
9559
9587
7741
7769
7797
7825
7853
7881
7909
7937
7965
7993
8021
8049
8077
8105
8133
8161
8189
8217
8245
8273
8301
8329
8357
8385
8413
8441
8469
8497
8525
8553
8581
8609
8637
8665
8693
8721
8749
8777
8805
8833
8861
8889
8917
8945
8973
9001
9029
9057
9085
9113
9141
9169
9197
9225
9253
9281
9309
9337
9365
9393
9421
9449
9477
9505
9533
9561
9589
7743
7771
7799
7827
7855
7883
7911
7939
7967
7995
8023
8051
8079
8107
8135
8163
8191
8219
8247
8275
8303
8331
8359
8387
8415
8443
8471
8499
8527
8555
8583
8611
8639
8667
8695
8723
8751
8779
8807
8835
8863
8891
8919
8947
8975
9003
9031
9059
9087
9115
9143
9171
9199
9227
9255
9283
9311
9339
9367
9395
9423
9451
9479
9507
9535
9563
9591
7745
7773
7801
7829
7857
7885
7913
7941
7969
7997
8025
8053
8081
8109
8137
8165
8193
8221
8249
8277
8305
8333
8361
8389
8417
8445
8473
8501
8529
8557
8585
8613
8641
8669
8697
8725
8753
8781
8809
8837
8865
8893
8921
8949
8977
9005
9033
9061
9089
9117
9145
9173
9201
9229
9257
9285
9313
9341
9369
9397
9425
9453
9481
9509
9537
9565
9593
7747
7775
7803
7831
7859
7887
7915
7943
7971
7999
8027
8055
8083
8111
8139
8167
8195
8223
8251
8279
8307
8335
8363
8391
8419
8447
8475
8503
8531
8559
8587
8615
8643
8671
8699
8727
8755
8783
8811
8839
8867
8895
8923
8951
8979
9007
9035
9063
9091
9119
9147
9175
9203
9231
9259
9287
9315
9343
9371
9399
9427
9455
9483
9511
9539
9567
9595
7749
7777
7805
7833
7861
7889
7917
7945
7973
8001
8029
8057
8085
8113
8141
8169
8197
8225
8253
8281
8309
8337
8365
8393
8421
8449
8477
8505
8533
8561
8589
8617
8645
8673
8701
8729
8757
8785
8813
8841
8869
8897
8925
8953
8981
9009
9037
9065
9093
9121
9149
9177
9205
9233
9261
9289
9317
9345
9373
9401
9429
9457
9485
9513
9541
9569
9597
7751
7779
7807
7835
7863
7891
7919
7947
7975
8003
8031
8059
8087
8115
8143
8171
8199
8227
8255
8283
8311
8339
8367
8395
8423
8451
8479
8507
8535
8563
8591
8619
8647
8675
8703
8731
8759
8787
8815
8843
8871
8899
8927
8955
8983
9011
9039
9067
9095
9123
9151
9179
9207
9235
9263
9291
9319
9347
9375
9403
9431
9459
9487
9515
9543
9571
9599
7753
7781
7809
7837
7865
7893
7921
7949
7977
8005
8033
8061
8089
8117
8145
8173
8201
8229
8257
8285
8313
8341
8369
8397
8425
8453
8481
8509
8537
8565
8593
8621
8649
8677
8705
8733
8761
8789
8817
8845
8873
8901
8929
8957
8985
9013
9041
9069
9097
9125
9153
9181
9209
9237
9265
9293
9321
9349
9377
9405
9433
9461
9489
9517
9545
9573
9601
7755
7783
7811
7839
7867
7895
7923
7951
7979
8007
8035
8063
8091
8119
8147
8175
8203
8231
8259
8287
8315
8343
8371
8399
8427
8455
8483
8511
8539
8567
8595
8623
8651
8679
8707
8735
8763
8791
8819
8847
8875
8903
8931
8959
8987
9015
9043
9071
9099
9127
9155
9183
9211
9239
9267
9295
9323
9351
9379
9407
9435
9463
9491
9519
9547
9575
9603
7757
7785
7813
7841
7869
7897
7925
7953
7981
8009
8037
8065
8093
8121
8149
8177
8205
8233
8261
8289
8317
8345
8373
8401
8429
8457
8485
8513
8541
8569
8597
8625
8653
8681
8709
8737
8765
8793
8821
8849
8877
8905
8933
8961
8989
9017
9045
9073
9101
9129
9157
9185
9213
9241
9269
9297
9325
9353
9381
9409
9437
9465
9493
9521
9549
9577
9605
7759
7787
7815
7843
7871
7899
7927
7955
7983
8011
8039
8067
8095
8123
8151
8179
8207
8235
8263
8291
8319
8347
8375
8403
8431
8459
8487
8515
8543
8571
8599
8627
8655
8683
8711
8739
8767
8795
8823
8851
8879
8907
8935
8963
8991
9019
9047
9075
9103
9131
9159
9187
9215
9243
9271
9299
9327
9355
9383
9411
9439
9467
9495
9523
9551
9579
9607
7761
7789
7817
7845
7873
7901
7929
7957
7985
8013
8041
8069
8097
8125
8153
8181
8209
8237
8265
8293
8321
8349
8377
8405
8433
8461
8489
8517
8545
8573
8601
8629
8657
8685
8713
8741
8769
8797
8825
8853
8881
8909
8937
8965
8993
9021
9049
9077
9105
9133
9161
9189
9217
9245
9273
9301
9329
9357
9385
9413
9441
9469
9497
9525
9553
9581
9609
9611 9613 9615 9617 9619 9621 9623 9625 9627 9629 9631 9633 9635 9637
9639 9641 9643 9645 9647 9649 9651 9653 9655 9657 9659 9661 9663 9665
9667 9669 9671 9673 9675 9677 9679 9681 9683 9685 9687 9689 9691 9693
9695 9697 9699 9701 9703 9705 9707 9709 9711 9713 9715 9717 9719 9721
9723 9725 9727 9729 9731 9733 9735 9737 9739 9741 9743 9745 9747 9749
9751 9753 9755 9757 9759 9761 9763 9765 9767 9769 9771 9773 9775 9777
9779 9781 9783 9785 9787 9789 9791 9793 9795 9797 9799 9801 9803 9805
9807 9809 9811 9813 9815 9817 9819 9821 9823 9825 9827 9829 9831 9833
9835 9837 9839 9841 9843 9845 9847 9849 9851 9853 9855 9857 9859 9861
9863 9865 9867 9869 9871 9873 9875 9877 9879 9881 9883 9885 9887 9889
9891 9893 9895 9897 9899 9901 9903 9905 9907 9909 9911 9913 9915 9917
9919 9921 9923 9925 9927 9929 9931 9933 9935 9937 9939 9941 9943 9945
9947 9949 9951 9953 9955 9957 9959 9961 9963 9965 9967 9969 9971 9973
9975 9977 9979 9981 9983 9985 9987 9989 9991 9993 9995 9997 9999 2 4 6
8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54
56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100
102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134
136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168
170 172 174 176 178 180 182 184 186 188 190 192 194 196 198 200 202
204 206 208 210 212 214 216 218 220 222 224 226 228 230 232 234 236
238 240 242 244 246 248 250 252 254 256 258 260 262 264 266 268 270
272 274 276 278 280 282 284 286 288 290 292 294 296 298 300 302 304
306 308 310 312 314 316 318 320 322 324 326 328 330 332 334 336 338
340 342 344 346 348 350 352 354 356 358 360 362 364 366 368 370 372
374 376 378 380 382 384 386 388 390 392 394 396 398 400 402 404 406
408 410 412 414 416 418 420 422 424 426 428 430 432 434 436 438 440
442 444 446 448 450 452 454 456 458 460 462 464 466 468 470 472 474
476 478 480 482 484 486 488 490 492 494 496 498 500 502 504 506 508
510 512 514 516 518 520 522 524 526 528 530 532 534 536 538 540 544
546 548 550 552 554 556 558 560 562 564 566 568 570 572 574 576 578
580 582 584 586 588 590 592 594 596 598 600 602 604 606 608 610 612
614 616 618 620 622 624 626 628 630 632 634 636 638 640 642 644 646
648 650 652 654 656 658 660 662 664 666 668 670 672 674 676 678 680
682 684 686 688 690 692 694 696 698 700 702 704 706 708 710 712 714
716 718 720 722 724 726 728 730 732 734 736 738 740 742 744 746 748
750 752 754 756 758 760 762 764 766 768 770 772 774 776 778 780 782
784 786 788 790 792 794 796 798 800 802 804 806 808 810 812 814 816
818 820 822 824 826 828 830 832 834 836 838 840 842 844 846 848 850
852 854 856 858 860 862 864 866 868 870 872 874 876 878 880 882 884
886 888 890 892 894 896 898 900 902 904 906 908 910 912 914 916 918
920 922 924 926 928 930 932 934 936 938 940 942 944 946 948 950 952
954 956 958 960 962 964 966 968 970 972 974 976 978 980 982 984 986
988 990 992 994 996 998 1000 1002 1004 1006 1008 1010 1012 1014 1016
1018 1020 1022 1024 1026 1028 1030 1032 1034 1036 1038 1040 1042 1044
1046 1048 1050 1052 1054 1056 1058 1060 1062 1064 1066 1068 1070 1072
1074 1076 1078 1080 1082 1084 1086 1088 1090 1092 1094 1096 1098 1100
1102 1104 1106 1108 1110 1112 1114 1116 1118 1120 1122 1124 1126 1128
1130 1132 1134 1136 1138 1140 1142 1144 1146 1148 1150 1152 1154 1156
1158 1160 1162 1164 1166 1168 1170 1172 1174 1176 1178 1180 1182 1184
1186 1188 1190 1192 1194 1196 1198 1200 1202 1204 1206 1208 1210 1212
1214 1216 1218 1220 1222 1224 1226 1228 1230 1232 1234 1236 1238 1240
1242 1244 1246 1248 1250 1252 1254 1256 1258 1260 1262 1264 1266 1268
1270 1272 1274 1276 1278 1280 1282 1284 1286 1288 1290 1292 1294 1296
1298 1300 1302 1304 1306 1308 1310 1312 1314 1316 1318 1320 1322 1324
1326 1328 1330 1332 1334 1336 1338 1340 1342 1344 1346 1348 1350 1352
1354 1356 1358 1360 1362 1364 1366 1368 1370 1372 1374 1376 1378 1380
1382 1384 1386 1388 1390 1392 1394 1396 1398 1400 1402 1404 1406 1408
1410 1412 1414 1416 1418 1420 1422 1424 1426 1428 1430 1432 1434 1436
1438 1440 1442 1444 1446 1448 1450 1452 1454 1456 1458 1460 1462 1464
1466 1468 1470 1472 1474 1476 1478 1480 1482 1484 1486 1488 1490 1492
1494 1496 1498 1500 1502 1504 1506 1508 1510 1512 1514 1516 1518 1520
1522 1524 1526 1528 1530 1532 1534 1536 1538 1540 1542 1544 1546 1548
1550 1552 1554 1556 1558 1560 1562 1564 1566 1568 1570 1572 1574 1576
1578 1580 1582 1584 1586 1588 1590 1592 1594 1596 1598 1600 1602 1604
1606 1608 1610 1612 1614 1616 1618 1620 1622 1624 1626 1628 1630 1632
1634 1636 1638 1640 1642 1644 1646 1648 1650 1652 1654 1656 1658 1660
1662 1664 1666 1668 1670 1672 1674 1676 1678 1680 1682 1684 1686 1688
1690
1718
1746
1774
1802
1830
1858
1886
1914
1942
1970
1998
2026
2054
2082
2110
2138
2166
2194
2222
2250
2278
2306
2334
2362
2390
2418
2446
2474
2502
2530
2558
2586
2614
2642
2670
2698
2726
2754
2782
2810
2838
2866
2894
2922
2950
2978
3006
3034
3062
3090
3118
3146
3174
3202
3230
3258
3286
3314
3342
3370
3398
3426
3454
3482
3510
3538
1692
1720
1748
1776
1804
1832
1860
1888
1916
1944
1972
2000
2028
2056
2084
2112
2140
2168
2196
2224
2252
2280
2308
2336
2364
2392
2420
2448
2476
2504
2532
2560
2588
2616
2644
2672
2700
2728
2756
2784
2812
2840
2868
2896
2924
2952
2980
3008
3036
3064
3092
3120
3148
3176
3204
3232
3260
3288
3316
3344
3372
3400
3428
3456
3484
3512
3540
1694
1722
1750
1778
1806
1834
1862
1890
1918
1946
1974
2002
2030
2058
2086
2114
2142
2170
2198
2226
2254
2282
2310
2338
2366
2394
2422
2450
2478
2506
2534
2562
2590
2618
2646
2674
2702
2730
2758
2786
2814
2842
2870
2898
2926
2954
2982
3010
3038
3066
3094
3122
3150
3178
3206
3234
3262
3290
3318
3346
3374
3402
3430
3458
3486
3514
3542
1696
1724
1752
1780
1808
1836
1864
1892
1920
1948
1976
2004
2032
2060
2088
2116
2144
2172
2200
2228
2256
2284
2312
2340
2368
2396
2424
2452
2480
2508
2536
2564
2592
2620
2648
2676
2704
2732
2760
2788
2816
2844
2872
2900
2928
2956
2984
3012
3040
3068
3096
3124
3152
3180
3208
3236
3264
3292
3320
3348
3376
3404
3432
3460
3488
3516
3544
1698
1726
1754
1782
1810
1838
1866
1894
1922
1950
1978
2006
2034
2062
2090
2118
2146
2174
2202
2230
2258
2286
2314
2342
2370
2398
2426
2454
2482
2510
2538
2566
2594
2622
2650
2678
2706
2734
2762
2790
2818
2846
2874
2902
2930
2958
2986
3014
3042
3070
3098
3126
3154
3182
3210
3238
3266
3294
3322
3350
3378
3406
3434
3462
3490
3518
3546
1700
1728
1756
1784
1812
1840
1868
1896
1924
1952
1980
2008
2036
2064
2092
2120
2148
2176
2204
2232
2260
2288
2316
2344
2372
2400
2428
2456
2484
2512
2540
2568
2596
2624
2652
2680
2708
2736
2764
2792
2820
2848
2876
2904
2932
2960
2988
3016
3044
3072
3100
3128
3156
3184
3212
3240
3268
3296
3324
3352
3380
3408
3436
3464
3492
3520
3548
1702
1730
1758
1786
1814
1842
1870
1898
1926
1954
1982
2010
2038
2066
2094
2122
2150
2178
2206
2234
2262
2290
2318
2346
2374
2402
2430
2458
2486
2514
2542
2570
2598
2626
2654
2682
2710
2738
2766
2794
2822
2850
2878
2906
2934
2962
2990
3018
3046
3074
3102
3130
3158
3186
3214
3242
3270
3298
3326
3354
3382
3410
3438
3466
3494
3522
3550
1704
1732
1760
1788
1816
1844
1872
1900
1928
1956
1984
2012
2040
2068
2096
2124
2152
2180
2208
2236
2264
2292
2320
2348
2376
2404
2432
2460
2488
2516
2544
2572
2600
2628
2656
2684
2712
2740
2768
2796
2824
2852
2880
2908
2936
2964
2992
3020
3048
3076
3104
3132
3160
3188
3216
3244
3272
3300
3328
3356
3384
3412
3440
3468
3496
3524
3552
1706
1734
1762
1790
1818
1846
1874
1902
1930
1958
1986
2014
2042
2070
2098
2126
2154
2182
2210
2238
2266
2294
2322
2350
2378
2406
2434
2462
2490
2518
2546
2574
2602
2630
2658
2686
2714
2742
2770
2798
2826
2854
2882
2910
2938
2966
2994
3022
3050
3078
3106
3134
3162
3190
3218
3246
3274
3302
3330
3358
3386
3414
3442
3470
3498
3526
3554
1708
1736
1764
1792
1820
1848
1876
1904
1932
1960
1988
2016
2044
2072
2100
2128
2156
2184
2212
2240
2268
2296
2324
2352
2380
2408
2436
2464
2492
2520
2548
2576
2604
2632
2660
2688
2716
2744
2772
2800
2828
2856
2884
2912
2940
2968
2996
3024
3052
3080
3108
3136
3164
3192
3220
3248
3276
3304
3332
3360
3388
3416
3444
3472
3500
3528
3556
1710
1738
1766
1794
1822
1850
1878
1906
1934
1962
1990
2018
2046
2074
2102
2130
2158
2186
2214
2242
2270
2298
2326
2354
2382
2410
2438
2466
2494
2522
2550
2578
2606
2634
2662
2690
2718
2746
2774
2802
2830
2858
2886
2914
2942
2970
2998
3026
3054
3082
3110
3138
3166
3194
3222
3250
3278
3306
3334
3362
3390
3418
3446
3474
3502
3530
3558
1712
1740
1768
1796
1824
1852
1880
1908
1936
1964
1992
2020
2048
2076
2104
2132
2160
2188
2216
2244
2272
2300
2328
2356
2384
2412
2440
2468
2496
2524
2552
2580
2608
2636
2664
2692
2720
2748
2776
2804
2832
2860
2888
2916
2944
2972
3000
3028
3056
3084
3112
3140
3168
3196
3224
3252
3280
3308
3336
3364
3392
3420
3448
3476
3504
3532
3560
1714
1742
1770
1798
1826
1854
1882
1910
1938
1966
1994
2022
2050
2078
2106
2134
2162
2190
2218
2246
2274
2302
2330
2358
2386
2414
2442
2470
2498
2526
2554
2582
2610
2638
2666
2694
2722
2750
2778
2806
2834
2862
2890
2918
2946
2974
3002
3030
3058
3086
3114
3142
3170
3198
3226
3254
3282
3310
3338
3366
3394
3422
3450
3478
3506
3534
3562
1716
1744
1772
1800
1828
1856
1884
1912
1940
1968
1996
2024
2052
2080
2108
2136
2164
2192
2220
2248
2276
2304
2332
2360
2388
2416
2444
2472
2500
2528
2556
2584
2612
2640
2668
2696
2724
2752
2780
2808
2836
2864
2892
2920
2948
2976
3004
3032
3060
3088
3116
3144
3172
3200
3228
3256
3284
3312
3340
3368
3396
3424
3452
3480
3508
3536
3564
3566
3594
3622
3650
3678
3706
3734
3762
3790
3818
3846
3874
3902
3930
3958
3986
4014
4042
4070
4098
4126
4154
4182
4210
4238
4266
4294
4322
4350
4378
4406
4434
4462
4490
4518
4546
4574
4602
4630
4658
4686
4714
4742
4770
4798
4826
4854
4882
4910
4938
4966
4994
5022
5050
5078
5106
5134
5162
5190
5218
5246
5274
5302
5330
5358
5386
5414
3568
3596
3624
3652
3680
3708
3736
3764
3792
3820
3848
3876
3904
3932
3960
3988
4016
4044
4072
4100
4128
4156
4184
4212
4240
4268
4296
4324
4352
4380
4408
4436
4464
4492
4520
4548
4576
4604
4632
4660
4688
4716
4744
4772
4800
4828
4856
4884
4912
4940
4968
4996
5024
5052
5080
5108
5136
5164
5192
5220
5248
5276
5304
5332
5360
5388
5416
3570
3598
3626
3654
3682
3710
3738
3766
3794
3822
3850
3878
3906
3934
3962
3990
4018
4046
4074
4102
4130
4158
4186
4214
4242
4270
4298
4326
4354
4382
4410
4438
4466
4494
4522
4550
4578
4606
4634
4662
4690
4718
4746
4774
4802
4830
4858
4886
4914
4942
4970
4998
5026
5054
5082
5110
5138
5166
5194
5222
5250
5278
5306
5334
5362
5390
5418
3572
3600
3628
3656
3684
3712
3740
3768
3796
3824
3852
3880
3908
3936
3964
3992
4020
4048
4076
4104
4132
4160
4188
4216
4244
4272
4300
4328
4356
4384
4412
4440
4468
4496
4524
4552
4580
4608
4636
4664
4692
4720
4748
4776
4804
4832
4860
4888
4916
4944
4972
5000
5028
5056
5084
5112
5140
5168
5196
5224
5252
5280
5308
5336
5364
5392
5420
3574
3602
3630
3658
3686
3714
3742
3770
3798
3826
3854
3882
3910
3938
3966
3994
4022
4050
4078
4106
4134
4162
4190
4218
4246
4274
4302
4330
4358
4386
4414
4442
4470
4498
4526
4554
4582
4610
4638
4666
4694
4722
4750
4778
4806
4834
4862
4890
4918
4946
4974
5002
5030
5058
5086
5114
5142
5170
5198
5226
5254
5282
5310
5338
5366
5394
5422
3576
3604
3632
3660
3688
3716
3744
3772
3800
3828
3856
3884
3912
3940
3968
3996
4024
4052
4080
4108
4136
4164
4192
4220
4248
4276
4304
4332
4360
4388
4416
4444
4472
4500
4528
4556
4584
4612
4640
4668
4696
4724
4752
4780
4808
4836
4864
4892
4920
4948
4976
5004
5032
5060
5088
5116
5144
5172
5200
5228
5256
5284
5312
5340
5368
5396
5424
3578
3606
3634
3662
3690
3718
3746
3774
3802
3830
3858
3886
3914
3942
3970
3998
4026
4054
4082
4110
4138
4166
4194
4222
4250
4278
4306
4334
4362
4390
4418
4446
4474
4502
4530
4558
4586
4614
4642
4670
4698
4726
4754
4782
4810
4838
4866
4894
4922
4950
4978
5006
5034
5062
5090
5118
5146
5174
5202
5230
5258
5286
5314
5342
5370
5398
5426
3580
3608
3636
3664
3692
3720
3748
3776
3804
3832
3860
3888
3916
3944
3972
4000
4028
4056
4084
4112
4140
4168
4196
4224
4252
4280
4308
4336
4364
4392
4420
4448
4476
4504
4532
4560
4588
4616
4644
4672
4700
4728
4756
4784
4812
4840
4868
4896
4924
4952
4980
5008
5036
5064
5092
5120
5148
5176
5204
5232
5260
5288
5316
5344
5372
5400
5428
3582
3610
3638
3666
3694
3722
3750
3778
3806
3834
3862
3890
3918
3946
3974
4002
4030
4058
4086
4114
4142
4170
4198
4226
4254
4282
4310
4338
4366
4394
4422
4450
4478
4506
4534
4562
4590
4618
4646
4674
4702
4730
4758
4786
4814
4842
4870
4898
4926
4954
4982
5010
5038
5066
5094
5122
5150
5178
5206
5234
5262
5290
5318
5346
5374
5402
5430
3584
3612
3640
3668
3696
3724
3752
3780
3808
3836
3864
3892
3920
3948
3976
4004
4032
4060
4088
4116
4144
4172
4200
4228
4256
4284
4312
4340
4368
4396
4424
4452
4480
4508
4536
4564
4592
4620
4648
4676
4704
4732
4760
4788
4816
4844
4872
4900
4928
4956
4984
5012
5040
5068
5096
5124
5152
5180
5208
5236
5264
5292
5320
5348
5376
5404
5432
3586
3614
3642
3670
3698
3726
3754
3782
3810
3838
3866
3894
3922
3950
3978
4006
4034
4062
4090
4118
4146
4174
4202
4230
4258
4286
4314
4342
4370
4398
4426
4454
4482
4510
4538
4566
4594
4622
4650
4678
4706
4734
4762
4790
4818
4846
4874
4902
4930
4958
4986
5014
5042
5070
5098
5126
5154
5182
5210
5238
5266
5294
5322
5350
5378
5406
5434
3588
3616
3644
3672
3700
3728
3756
3784
3812
3840
3868
3896
3924
3952
3980
4008
4036
4064
4092
4120
4148
4176
4204
4232
4260
4288
4316
4344
4372
4400
4428
4456
4484
4512
4540
4568
4596
4624
4652
4680
4708
4736
4764
4792
4820
4848
4876
4904
4932
4960
4988
5016
5044
5072
5100
5128
5156
5184
5212
5240
5268
5296
5324
5352
5380
5408
5436
3590
3618
3646
3674
3702
3730
3758
3786
3814
3842
3870
3898
3926
3954
3982
4010
4038
4066
4094
4122
4150
4178
4206
4234
4262
4290
4318
4346
4374
4402
4430
4458
4486
4514
4542
4570
4598
4626
4654
4682
4710
4738
4766
4794
4822
4850
4878
4906
4934
4962
4990
5018
5046
5074
5102
5130
5158
5186
5214
5242
5270
5298
5326
5354
5382
5410
5438
3592
3620
3648
3676
3704
3732
3760
3788
3816
3844
3872
3900
3928
3956
3984
4012
4040
4068
4096
4124
4152
4180
4208
4236
4264
4292
4320
4348
4376
4404
4432
4460
4488
4516
4544
4572
4600
4628
4656
4684
4712
4740
4768
4796
4824
4852
4880
4908
4936
4964
4992
5020
5048
5076
5104
5132
5160
5188
5216
5244
5272
5300
5328
5356
5384
5412
5440
5442
5470
5498
5526
5554
5582
5610
5638
5666
5694
5722
5750
5778
5806
5834
5862
5890
5918
5946
5974
6002
6030
6058
6086
6114
6142
6170
6198
6226
6254
6282
6310
6338
6366
6394
6422
6450
6478
6506
6534
6562
6590
6618
6646
6674
6702
6730
6758
6786
6814
6842
6870
6898
6926
6954
6982
7010
7038
7066
7094
7122
7150
7178
7206
7234
7262
7290
5444
5472
5500
5528
5556
5584
5612
5640
5668
5696
5724
5752
5780
5808
5836
5864
5892
5920
5948
5976
6004
6032
6060
6088
6116
6144
6172
6200
6228
6256
6284
6312
6340
6368
6396
6424
6452
6480
6508
6536
6564
6592
6620
6648
6676
6704
6732
6760
6788
6816
6844
6872
6900
6928
6956
6984
7012
7040
7068
7096
7124
7152
7180
7208
7236
7264
7292
5446
5474
5502
5530
5558
5586
5614
5642
5670
5698
5726
5754
5782
5810
5838
5866
5894
5922
5950
5978
6006
6034
6062
6090
6118
6146
6174
6202
6230
6258
6286
6314
6342
6370
6398
6426
6454
6482
6510
6538
6566
6594
6622
6650
6678
6706
6734
6762
6790
6818
6846
6874
6902
6930
6958
6986
7014
7042
7070
7098
7126
7154
7182
7210
7238
7266
7294
5448
5476
5504
5532
5560
5588
5616
5644
5672
5700
5728
5756
5784
5812
5840
5868
5896
5924
5952
5980
6008
6036
6064
6092
6120
6148
6176
6204
6232
6260
6288
6316
6344
6372
6400
6428
6456
6484
6512
6540
6568
6596
6624
6652
6680
6708
6736
6764
6792
6820
6848
6876
6904
6932
6960
6988
7016
7044
7072
7100
7128
7156
7184
7212
7240
7268
7296
5450
5478
5506
5534
5562
5590
5618
5646
5674
5702
5730
5758
5786
5814
5842
5870
5898
5926
5954
5982
6010
6038
6066
6094
6122
6150
6178
6206
6234
6262
6290
6318
6346
6374
6402
6430
6458
6486
6514
6542
6570
6598
6626
6654
6682
6710
6738
6766
6794
6822
6850
6878
6906
6934
6962
6990
7018
7046
7074
7102
7130
7158
7186
7214
7242
7270
7298
5452
5480
5508
5536
5564
5592
5620
5648
5676
5704
5732
5760
5788
5816
5844
5872
5900
5928
5956
5984
6012
6040
6068
6096
6124
6152
6180
6208
6236
6264
6292
6320
6348
6376
6404
6432
6460
6488
6516
6544
6572
6600
6628
6656
6684
6712
6740
6768
6796
6824
6852
6880
6908
6936
6964
6992
7020
7048
7076
7104
7132
7160
7188
7216
7244
7272
7300
5454
5482
5510
5538
5566
5594
5622
5650
5678
5706
5734
5762
5790
5818
5846
5874
5902
5930
5958
5986
6014
6042
6070
6098
6126
6154
6182
6210
6238
6266
6294
6322
6350
6378
6406
6434
6462
6490
6518
6546
6574
6602
6630
6658
6686
6714
6742
6770
6798
6826
6854
6882
6910
6938
6966
6994
7022
7050
7078
7106
7134
7162
7190
7218
7246
7274
7302
5456
5484
5512
5540
5568
5596
5624
5652
5680
5708
5736
5764
5792
5820
5848
5876
5904
5932
5960
5988
6016
6044
6072
6100
6128
6156
6184
6212
6240
6268
6296
6324
6352
6380
6408
6436
6464
6492
6520
6548
6576
6604
6632
6660
6688
6716
6744
6772
6800
6828
6856
6884
6912
6940
6968
6996
7024
7052
7080
7108
7136
7164
7192
7220
7248
7276
7304
5458
5486
5514
5542
5570
5598
5626
5654
5682
5710
5738
5766
5794
5822
5850
5878
5906
5934
5962
5990
6018
6046
6074
6102
6130
6158
6186
6214
6242
6270
6298
6326
6354
6382
6410
6438
6466
6494
6522
6550
6578
6606
6634
6662
6690
6718
6746
6774
6802
6830
6858
6886
6914
6942
6970
6998
7026
7054
7082
7110
7138
7166
7194
7222
7250
7278
7306
5460
5488
5516
5544
5572
5600
5628
5656
5684
5712
5740
5768
5796
5824
5852
5880
5908
5936
5964
5992
6020
6048
6076
6104
6132
6160
6188
6216
6244
6272
6300
6328
6356
6384
6412
6440
6468
6496
6524
6552
6580
6608
6636
6664
6692
6720
6748
6776
6804
6832
6860
6888
6916
6944
6972
7000
7028
7056
7084
7112
7140
7168
7196
7224
7252
7280
7308
5462
5490
5518
5546
5574
5602
5630
5658
5686
5714
5742
5770
5798
5826
5854
5882
5910
5938
5966
5994
6022
6050
6078
6106
6134
6162
6190
6218
6246
6274
6302
6330
6358
6386
6414
6442
6470
6498
6526
6554
6582
6610
6638
6666
6694
6722
6750
6778
6806
6834
6862
6890
6918
6946
6974
7002
7030
7058
7086
7114
7142
7170
7198
7226
7254
7282
7310
5464
5492
5520
5548
5576
5604
5632
5660
5688
5716
5744
5772
5800
5828
5856
5884
5912
5940
5968
5996
6024
6052
6080
6108
6136
6164
6192
6220
6248
6276
6304
6332
6360
6388
6416
6444
6472
6500
6528
6556
6584
6612
6640
6668
6696
6724
6752
6780
6808
6836
6864
6892
6920
6948
6976
7004
7032
7060
7088
7116
7144
7172
7200
7228
7256
7284
7312
5466
5494
5522
5550
5578
5606
5634
5662
5690
5718
5746
5774
5802
5830
5858
5886
5914
5942
5970
5998
6026
6054
6082
6110
6138
6166
6194
6222
6250
6278
6306
6334
6362
6390
6418
6446
6474
6502
6530
6558
6586
6614
6642
6670
6698
6726
6754
6782
6810
6838
6866
6894
6922
6950
6978
7006
7034
7062
7090
7118
7146
7174
7202
7230
7258
7286
7314
5468
5496
5524
5552
5580
5608
5636
5664
5692
5720
5748
5776
5804
5832
5860
5888
5916
5944
5972
6000
6028
6056
6084
6112
6140
6168
6196
6224
6252
6280
6308
6336
6364
6392
6420
6448
6476
6504
6532
6560
6588
6616
6644
6672
6700
6728
6756
6784
6812
6840
6868
6896
6924
6952
6980
7008
7036
7064
7092
7120
7148
7176
7204
7232
7260
7288
7316
7318
7346
7374
7402
7430
7458
7486
7514
7542
7570
7598
7626
7654
7682
7710
7738
7766
7794
7822
7850
7878
7906
7934
7962
7990
8018
8046
8074
8102
8130
8158
8186
8214
8242
8270
8298
8326
8354
8382
8410
8438
8466
8494
8522
8550
8578
8606
8634
8662
8690
8718
8746
8774
8802
8830
8858
8886
8914
8942
8970
8998
9026
9054
9082
9110
9138
9166
7320
7348
7376
7404
7432
7460
7488
7516
7544
7572
7600
7628
7656
7684
7712
7740
7768
7796
7824
7852
7880
7908
7936
7964
7992
8020
8048
8076
8104
8132
8160
8188
8216
8244
8272
8300
8328
8356
8384
8412
8440
8468
8496
8524
8552
8580
8608
8636
8664
8692
8720
8748
8776
8804
8832
8860
8888
8916
8944
8972
9000
9028
9056
9084
9112
9140
9168
7322
7350
7378
7406
7434
7462
7490
7518
7546
7574
7602
7630
7658
7686
7714
7742
7770
7798
7826
7854
7882
7910
7938
7966
7994
8022
8050
8078
8106
8134
8162
8190
8218
8246
8274
8302
8330
8358
8386
8414
8442
8470
8498
8526
8554
8582
8610
8638
8666
8694
8722
8750
8778
8806
8834
8862
8890
8918
8946
8974
9002
9030
9058
9086
9114
9142
9170
7324
7352
7380
7408
7436
7464
7492
7520
7548
7576
7604
7632
7660
7688
7716
7744
7772
7800
7828
7856
7884
7912
7940
7968
7996
8024
8052
8080
8108
8136
8164
8192
8220
8248
8276
8304
8332
8360
8388
8416
8444
8472
8500
8528
8556
8584
8612
8640
8668
8696
8724
8752
8780
8808
8836
8864
8892
8920
8948
8976
9004
9032
9060
9088
9116
9144
9172
7326
7354
7382
7410
7438
7466
7494
7522
7550
7578
7606
7634
7662
7690
7718
7746
7774
7802
7830
7858
7886
7914
7942
7970
7998
8026
8054
8082
8110
8138
8166
8194
8222
8250
8278
8306
8334
8362
8390
8418
8446
8474
8502
8530
8558
8586
8614
8642
8670
8698
8726
8754
8782
8810
8838
8866
8894
8922
8950
8978
9006
9034
9062
9090
9118
9146
9174
7328
7356
7384
7412
7440
7468
7496
7524
7552
7580
7608
7636
7664
7692
7720
7748
7776
7804
7832
7860
7888
7916
7944
7972
8000
8028
8056
8084
8112
8140
8168
8196
8224
8252
8280
8308
8336
8364
8392
8420
8448
8476
8504
8532
8560
8588
8616
8644
8672
8700
8728
8756
8784
8812
8840
8868
8896
8924
8952
8980
9008
9036
9064
9092
9120
9148
9176
7330
7358
7386
7414
7442
7470
7498
7526
7554
7582
7610
7638
7666
7694
7722
7750
7778
7806
7834
7862
7890
7918
7946
7974
8002
8030
8058
8086
8114
8142
8170
8198
8226
8254
8282
8310
8338
8366
8394
8422
8450
8478
8506
8534
8562
8590
8618
8646
8674
8702
8730
8758
8786
8814
8842
8870
8898
8926
8954
8982
9010
9038
9066
9094
9122
9150
9178
7332
7360
7388
7416
7444
7472
7500
7528
7556
7584
7612
7640
7668
7696
7724
7752
7780
7808
7836
7864
7892
7920
7948
7976
8004
8032
8060
8088
8116
8144
8172
8200
8228
8256
8284
8312
8340
8368
8396
8424
8452
8480
8508
8536
8564
8592
8620
8648
8676
8704
8732
8760
8788
8816
8844
8872
8900
8928
8956
8984
9012
9040
9068
9096
9124
9152
9180
7334
7362
7390
7418
7446
7474
7502
7530
7558
7586
7614
7642
7670
7698
7726
7754
7782
7810
7838
7866
7894
7922
7950
7978
8006
8034
8062
8090
8118
8146
8174
8202
8230
8258
8286
8314
8342
8370
8398
8426
8454
8482
8510
8538
8566
8594
8622
8650
8678
8706
8734
8762
8790
8818
8846
8874
8902
8930
8958
8986
9014
9042
9070
9098
9126
9154
9182
7336
7364
7392
7420
7448
7476
7504
7532
7560
7588
7616
7644
7672
7700
7728
7756
7784
7812
7840
7868
7896
7924
7952
7980
8008
8036
8064
8092
8120
8148
8176
8204
8232
8260
8288
8316
8344
8372
8400
8428
8456
8484
8512
8540
8568
8596
8624
8652
8680
8708
8736
8764
8792
8820
8848
8876
8904
8932
8960
8988
9016
9044
9072
9100
9128
9156
9184
7338
7366
7394
7422
7450
7478
7506
7534
7562
7590
7618
7646
7674
7702
7730
7758
7786
7814
7842
7870
7898
7926
7954
7982
8010
8038
8066
8094
8122
8150
8178
8206
8234
8262
8290
8318
8346
8374
8402
8430
8458
8486
8514
8542
8570
8598
8626
8654
8682
8710
8738
8766
8794
8822
8850
8878
8906
8934
8962
8990
9018
9046
9074
9102
9130
9158
9186
7340
7368
7396
7424
7452
7480
7508
7536
7564
7592
7620
7648
7676
7704
7732
7760
7788
7816
7844
7872
7900
7928
7956
7984
8012
8040
8068
8096
8124
8152
8180
8208
8236
8264
8292
8320
8348
8376
8404
8432
8460
8488
8516
8544
8572
8600
8628
8656
8684
8712
8740
8768
8796
8824
8852
8880
8908
8936
8964
8992
9020
9048
9076
9104
9132
9160
9188
7342
7370
7398
7426
7454
7482
7510
7538
7566
7594
7622
7650
7678
7706
7734
7762
7790
7818
7846
7874
7902
7930
7958
7986
8014
8042
8070
8098
8126
8154
8182
8210
8238
8266
8294
8322
8350
8378
8406
8434
8462
8490
8518
8546
8574
8602
8630
8658
8686
8714
8742
8770
8798
8826
8854
8882
8910
8938
8966
8994
9022
9050
9078
9106
9134
9162
9190
7344
7372
7400
7428
7456
7484
7512
7540
7568
7596
7624
7652
7680
7708
7736
7764
7792
7820
7848
7876
7904
7932
7960
7988
8016
8044
8072
8100
8128
8156
8184
8212
8240
8268
8296
8324
8352
8380
8408
8436
8464
8492
8520
8548
8576
8604
8632
8660
8688
8716
8744
8772
8800
8828
8856
8884
8912
8940
8968
8996
9024
9052
9080
9108
9136
9164
9192
9194
9222
9250
9278
9306
9334
9362
9390
9418
9446
9474
9502
9530
9558
9586
9614
9642
9670
9698
9726
9754
9782
9810
9838
9866
9894
9922
9950
9978
Test
Case
7
9196
9224
9252
9280
9308
9336
9364
9392
9420
9448
9476
9504
9532
9560
9588
9616
9644
9672
9700
9728
9756
9784
9812
9840
9868
9896
9924
9952
9980
9198
9226
9254
9282
9310
9338
9366
9394
9422
9450
9478
9506
9534
9562
9590
9618
9646
9674
9702
9730
9758
9786
9814
9842
9870
9898
9926
9954
9982
9200
9228
9256
9284
9312
9340
9368
9396
9424
9452
9480
9508
9536
9564
9592
9620
9648
9676
9704
9732
9760
9788
9816
9844
9872
9900
9928
9956
9984
9202
9230
9258
9286
9314
9342
9370
9398
9426
9454
9482
9510
9538
9566
9594
9622
9650
9678
9706
9734
9762
9790
9818
9846
9874
9902
9930
9958
9986
9204
9232
9260
9288
9316
9344
9372
9400
9428
9456
9484
9512
9540
9568
9596
9624
9652
9680
9708
9736
9764
9792
9820
9848
9876
9904
9932
9960
9988
9206
9234
9262
9290
9318
9346
9374
9402
9430
9458
9486
9514
9542
9570
9598
9626
9654
9682
9710
9738
9766
9794
9822
9850
9878
9906
9934
9962
9990
9208
9236
9264
9292
9320
9348
9376
9404
9432
9460
9488
9516
9544
9572
9600
9628
9656
9684
9712
9740
9768
9796
9824
9852
9880
9908
9936
9964
9992
9210
9238
9266
9294
9322
9350
9378
9406
9434
9462
9490
9518
9546
9574
9602
9630
9658
9686
9714
9742
9770
9798
9826
9854
9882
9910
9938
9966
9994
9212
9240
9268
9296
9324
9352
9380
9408
9436
9464
9492
9520
9548
9576
9604
9632
9660
9688
9716
9744
9772
9800
9828
9856
9884
9912
9940
9968
9996
9214
9242
9270
9298
9326
9354
9382
9410
9438
9466
9494
9522
9550
9578
9606
9634
9662
9690
9718
9746
9774
9802
9830
9858
9886
9914
9942
9970
9998
9216 9218
9244 9246
9272 9274
9300 9302
9328 9330
9356 9358
9384 9386
9412 9414
9440 9442
9468 9470
9496 9498
9524 9526
9552 9554
9580 9582
9608 9610
9636 9638
9664 9666
9692 9694
9720 9722
9748 9750
9776 9778
9804 9806
9832 9834
9860 9862
9888 9890
9916 9918
9944 9946
9972 9974
10000
2
2
9220
9248
9276
9304
9332
9360
9388
9416
9444
9472
9500
9528
9556
9584
9612
9640
9668
9696
9724
9752
9780
9808
9836
9864
9892
9920
9948
9976
1
LCM of n numbers
Due on 2014-09-28, 23:59 IST
Level: Medium
Write a C program that calculates the least common multiple (LCM) of 'n' numbers.
Input Format:
First line contains the number of numbers that are input 'n', where n>1
Second line contains 'n' positive integers whose LCM is to be calculated
Output Format:
One line containing the LCM of the 'n' numbers
Sample Test Cases
Input
Output
Test Case 1
4
3 4 7 11
924
Test Case 2
3
4 6 10
60
Test Case 3
30
3 2 10 15
Test Case 4
3
1 10 1
10
Test Case 5
1
4
Test Case 6
4
1031 53 47 139
356982719
Test Case 7
6
643 4 12 3 101 1
779316
Input
Output
Test Case 1
10
Test Case 2
23
22
Test Case 3
11
10
Test Case 4
30
Test Case 5
Test Case 6
1331
1210
Test Case 7
10000
4000
Input
Output
Test Case 1
3
1 3 2
1 2 3
Test Case 2
4
3 1 2 4
2 4 3 1
Test Case 3
7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
Test Case 4
5
5 1 2 4 3
5 1 2 3 4
Test Case 5
12
3 1 2 4 5 6 7 8 9 10 11 12
2 12 11 10 9 8 7 6 5 4 3 1
Input
Output
Test Case 1
mississippi
issi
Test Case 2
ouagadougou
ou
Test Case 3
banana
ana
Test Case 4
a
banana
Test Case 5
ghhana
ha
Print Subarray
Due on 2014-10-19, 23:59 IST
Level: Easy
Given an input character array of A and start index S and end index E, write a function
that prints the sub array starting from S (including S) and ending at index E (including
E). The character array may contain spaces and tabs.
Note: You are given the main function. Just write the subroutine 'void
printSubarray(char *a, int start, int end)'.
Input Format:
First line is the input array A s.t. 1 <= |A| <= 8192
Second line is the start index S s.t. 0 <= S <= |A|-1
Third line is the ending index E s.t. 0 <= E <= |A|-1
Output Format:
A single line containing the sub array of A from start index S to end index E.
Sample Test Cases
Input
Output
Test
Case
1
t wa
Test
Case
2
boneywasawarrior
0
12
boneywasawarr
Test
Case
3
Test
Case
4
vocal music.
0
0
01234567 89
0
8
Test
Case
5
01234567
Input
Output
Te
st
Ca
se
1
I love programming
_______________________I love
programming_______________________
Te
st
Ca
se
2
Pneumonoultramicroscopicsilicovolcanoco
niosis
__________Pneumonoultramicroscopicsilic
ovolcanoconiosis_________
Te
st
Ca
se
3
123456789012345678901234567890123456789
0123456789012345678901234
123456789012345678901234567890123456789
0123456789012345678901234
Te
st
Ca
________________________________1______
_________________________
se
4
Te
st
Ca
se
5
________________________This is too
easy________________________
Te
st
Ca
se
6
P=NP ?
_____________________________P=NP
?_____________________________
Te
st
Ca
se
7
Always
_____________________________Always____
_________________________
Test
Case
Input
Output
2
1 1
1
Test
Case
2
3
1 -1 -1
Test
Case
3
2
-1 -1
Test
Case
4
8
1 1 -1 1 1 1 -1 1
Test
Case
5
10
1 -1 1 1 -1 1 -1 1 -1 -1
Test
Case
6
100
-1 -1 -1 -1 1
1 -1 1 1 1 -1
-1 -1 -1 1 -1
-1 -1 1 1 1 1
Test
Case
7
1000
1 1 1 -1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1
1 1 1 1 -1 1 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 1 -1 1 -1 -1 1 -1 1 -1 -1 1
-1 1 -1 -1 1 -1 1 1 1 -1 -1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 -1 -1 1 -1 -1
-1 -1 -1 -1 -1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 1 1 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
1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 -1 1 1 -1 -1 1 1 1 -1 1 1 -1 -1 -1 -1 -1
1 1 1 1 -1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 -1 1
-1 -1 -1 1 -1 -1 -1 1 -1
52
-1
-1
-1
-1
-1 1 -1 1 -1
1 -1 -1 -1 1
-1 -1 1 1 -1
1 1 -1 -1 -1
1 1 -1 -1 -1 1 -1 1 1 1 -1 1 1 1 -1 1 -1
-1 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 1 -1 -1
-1 1 1 -1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1
-1 1 1 -1
493
Output Format:
Output a single string that is the last resulting word of the given dictionary
Example Output:
zggurat
Explanation:
The dictionary actually is:
zebra
zebu
(3 first characters are common with zebra)
zenith (2 first characters are common with zebu)
zggurat (1 first character is common with zenith)
Sample Test Cases
Input
Output
Test Case 1
4
zebra
3 u
2 nith
1 iggurat
ziggurat
Test Case 2
3
cool
4 er
2 mmon-man
common-man
Test Case 3
1
batman
batman
Test Case 4
10
apple
2 titude
0 bail
3 t
2 hool
1 hoopla
4 newmist
5 oliberstein
2 diem
6 mon
bhdiemmon
Test Case 5
10
moonwalk
7 vfsetzqwuhskb
6 tpcu
4 c
0 cbeiusyxj
7 psrtzgky
0 efzipsko
3 wy
1 l
1 fqnhgfi
efqnhgfi
Test Case 6
100
numismatic
4 qenarvwwdoxwe
1 orlx
0 gtwkuwpuk
5 afncdsjlvts
5 yvnazxhxwm
8 yyv
0 vvbgiwwzxk
2 zqdjmesk
8 sswst
2 uptpvoqgyxk
3 oykyiyejf
9 zgazbxgiow
9 tgskpeomy
0 kh
1 fffnwyfxwkl
6 qyyyi
5 bna
wvmhjoaffvfwpvdjn
0
2
7
2
1
0
5
6
4
3
1
3
0
0
0
2
8
4
1
4
2
3
0
4
0
8
1
3
8
5
3
4
8
2
8
8
2
0
5
0
0
7
8
3
0
3
5
8
4
0
4
1
9
2
1
1
0
7
4
3
7
2
3
2
0
7
6
roabn
atxaasdvn
udxmrx
mj
sujhmdvttldmmk
hxpunh
fyuakn
qdzcoygommz
atsrwrqreqqrd
cvq
yitw
milrqnvt
smgxam
nbzewrl
sn
jvnumiltnksx
yroag
qgzdprulkbabj
znjxhkon
asxkl
uosqlpwvmjdkg
p
qfeksdde
jxrh
pvjscrxlcp
bhvt
hkxkjzynpsr
bejsrdmgoqh
fqcvz
mgoiaq
zqdc
kcccxcwkwnclju
zqwds
pdzrugtzmdnpo
lpxveuprlo
xhgecpybcwhhm
z
iydegboizv
bmr
vwwrdnbx
ihfbpzuhoeab
obsdzfakstbwb
xeqchqkpvqghrv
hc
cvfbzhdrxswh
rnxhonihtbwur
kggsjwengcpj
mqicx
ivcbk
iqlxz
not
oabgsoeeo
cbtoajd
brjyglonjkludw
c
bqcis
pllddbpnp
tazs
pfhwfq
tkenatmlnbwkg
hlhthxpqx
fvv
mwdomqd
zdy
wfqdyxvuxj
hlobzyokl
loyma
3
2
1
1
1
4
3
7
7
4
4
7
4
7
8
Test Case 7
jv
c
t
o
vmypta
ncxqk
hcfvzevwgvacxn
enzvegnlnofuju
xecqhwgw
sggymtupoffiky
undcjrjsmcsqb
sjihyjv
joadarnwee
fucsmwtwvjkwby
fvfwpvdjn
200
kleptomaniac
6 dcad
3 k
0 oapciiocvrj
9 xlft
0 vecrreglymwk
8 shkownf
4 nfqpkpohnjexx
9 jzzpllqnzwwwai
9 irq
2 plympr
4 vrpgiewhgyyul
9 padg
0 wmhihff
5 udhnk
5 zrwtihvtbbzgf
9 kv
1 yewqcmvksxkao
1 utcxdjzwnhoek
0 uwwsuyoopvdvvq
3 dooktiaxhvg
3 cjltljcfq
2 zyivo
1 xzeybxoung
3 hterpypz
6 xdocdlrmx
0 csoenhqauwyx
3 vlatymegwqxzh
9 wnekazvf
2 vjlrjuyhgn
9 orz
0 gdipe
5 oibwt
4 nsenupifo
0 czqffvdicpou
3 ugqzw
5 gvqrfdv
4 oivdcrbo
6 fmjwavomvwc
6 ebqib
1 zjmt
2 lfhy
4 kt
2 wjnhdc
6 oq
0 cwctkwxrym
4 hytsozrgjliz
0 nvbmffvxgudeyz
9 iufqq
1 qq
mhwkqlsdvwkdhj
0
1
0
4
5
2
7
1
5
8
4
0
5
4
2
0
1
3
2
5
5
4
2
3
7
9
0
6
1
1
6
1
3
0
7
5
1
5
1
8
7
5
6
1
0
4
1
3
3
3
5
2
0
5
6
4
9
1
4
9
7
8
6
3
3
4
4
oaetsdrjgubw
uivxqpxhwyfl
taneb
npfdtuswilim
pjq
rptxcgkbrxj
pn
figbmspqlj
fzkxvdjv
dmirtamjccgnkd
ms
xnxxlwgdbhfwla
rhgcl
esirgn
fej
rqrybkfs
lxt
wq
krqpvbqdqmhma
gfokk
pfcktyp
ztxuimsml
wkl
xcsxjepl
iueofppwdlsbh
lcgh
twkfmo
qrmder
qlkobgcxfr
alhldkeabnqm
ts
zes
enwhvzkdthk
voaxazqmlsnwd
lreqeftkrlkdq
gvlt
hrogvrlv
uv
qryycsdban
jkoqbkxkorgz
wbjtpjpctlslqb
kzzgbfoap
mt
vfdvnipispis
rmscpdsypahjs
xivmhdt
wvaonuzcq
vmxpwqinygo
qpndyv
qgdoszdoagcnqh
vgd
lqqpkwsaqsic
tesdh
gwwjlmun
dsmrpe
rakundoyxgtyx
gxjufmownjpjpi
lkuxajch
bugzdzvaakvnol
heacujg
faoemjzaaut
kgcjafdng
ihfiu
zhxtwccibvm
wsfyxfwfuum
sxetw
pqeuvtpxzfldlm
7
3
2
0
0
2
3
4
0
2
8
2
1
7
0
6
1
4
1
8
5
6
3
3
0
0
0
1
2
0
1
4
2
0
2
6
5
7
6
2
3
4
1
5
0
5
2
0
5
1
3
9
0
3
0
1
4
5
0
3
4
4
3
5
8
1
2
uztaq
ip
w
makxrplzme
yjxfvzseeoydu
wop
qdubdimxoaff
bgj
hc
qcywauvnidjfj
zqnomdsmwzt
xenykjkpsheuak
eavwlky
ukxlmcbcivbnpj
owtadxydfo
bbb
rrjqq
rtamlt
sqcalqra
tdpvmpfen
ovxkgj
cbjhjw
sdzt
sgw
s
ov
rnqaqbn
bkzfsvpqv
x
i
nbgco
rpzkbbquisyt
ur
lbpaih
mpofmbcspr
vcvozqfrvm
juqthvx
ytumqml
sw
pozkq
lgscln
va
iccbamgjqzzi
thjystpxqocr
lsflooyw
xwgwczb
ucir
sbuve
rmd
sesurmpuaha
ywatrteccmgjw
hifjcstm
nmdgjeu
z
uehvuqs
bztuvwggbyotm
iwswln
hjrswaiddhz
jbkoevtjhhdzy
mqdjek
hkbbywc
hkio
qhobzwp
bfcfvgdm
wimxgfwk
vavcirvdf
svsdy
0
2
2
3
6
1
7
3
7
1
6
3
1
3
6
2
mgjzykhnedvnx
lee
okxefdhxtgvd
nwuinyioa
bdpywodiegtwg
ozxlxhsm
vefckzsau
ulpivhfnfxc
qauluczrmj
twelwqi
gqcrkmgjafasx
zeoothu
htmbjscixj
uccikwto
oreqyje
wkqlsdvwkdhj
12345
2345
23456
None of These
1 point
In C, if you pass an array as an argument to a function, what actually gets passed?
Value of elements in array
First element of the array
What is the valid statement that you can make about the output of the following code?
#include<stdio.h>
void fun(int * a)
{
int ** x=&a;
printf("%u\n",x);
return ;
}
int main(){
int a[5]={1,2,3,4,5};
int * b = a;
int ** y=&b;
printf("%u\n",y);
fun(b);
return 0;
}
Both the printed values are necessarily the same
Both the printed values are necessarily different
Both the printed values may be same
None of these
1 point
What will be output if you will execute following C code?
#include<stdio.h>
void main(){
char arr[20]="MysticRiver";
printf("%d",sizeof(arr));
}
11
20
44
80
1 point
What is the output of the following code?
#include<stdio.h>
int main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
}
2 2 15
3 2 20
3 1 20
3 2 15
1 point
Which of the following are correct ways to initialize an array? (There may be multiple answers.)
int num[]={1,2,3,4};
int num{}={1,2,3,4};
int num[4]={1,2,3,4};
int num()={1,2,3,4};
1 point
What will be the output of the following program?
#include<stdio.h>
int main(){
int a = 330;
char *p;
p =( char *)&a;
printf("%d ",*p);
return 0;
}
330
74
54
331
1 point
Collatz function
Input
Output
Test Case 1
Test Case 2
Test Case 3
16
Test Case 4
1000
111
Test Case 5
1001
142
Test Case 6
2463
208
Test Case 7
100
25
Test Case 8
101
25
Example:
For n = 151 and k = 1 the minimum number of steps in which we can find the height
from which eggs can break(considering the worst case) is 151. This is because since
we have only 1 egg we have no choice but to start from the first floor and throw the egg
from each floor and check whether it breaks or not. In worst case this might require 151
steps.
For n = 100 and k = 2 the minimum number of steps in which we can find the height
from which eggs can break(considering again the worst case) is 14. This is because
suppose we throw the FIRST egg from 14th floor and it breaks then we will have to try
each of the remaining 13 floors using the remaining egg. So in this case number of
trials required is 14. Suppose the first egg doesn't break then we can drop it from 27th
floor (13 + 14). We have chosen 27th floor because suppose if the first egg breaks from
27th floor then we will have to test floors from 15-26 (=12). So, the total number of trials
required in this case is: 12 + 1(from 14th floor) + 1(from 27th floor) = 14 trials. Suppose
the first egg doesn't break even now, drop it from 39(12 + 13 + 14) floor for same
reason.
Sample Test Cases
Input
Output
Test Case 1
4
10 1
10 2
100 2
104 3
10
4
14
9
Test Case 2
3
923 8
23 9
101 2
10
5
14
Test Case 3
5
42
35
70
79
63
6
35
7
7
7
8
1
5
9
5
Test Case 4
10
42 8
335 1
170 5
479 9
963 5
706 6
282 8
962 2
996 3
828 7
6
335
8
9
11
10
9
44
19
10
Test Case 5
20
42 8
335 1
170 5
479 9
963 5
706 6
282 8
962 2
996 3
828 7
392 5
903 4
293 3
422 7
719 6
448 7
772 9
870 3
668 10
36 5
6
335
8
9
11
10
9
44
19
10
10
13
12
9
10
9
10
18
10
6
Test Case 6
100
42 8
335 1
170 5
479 9
963 5
706 6
282 8
962 2
996 3
828 7
392 5
903 4
293 3
422 7
719 6
448 7
6
335
8
9
11
10
9
44
19
10
10
13
12
9
10
9
10
772 9
870 3
668 10
36 5
704 2
323 4
674 5
142 2
254 9
548 5
663 8
38 10
724 2
530 9
317 6
191 3
289 7
41 3
265 9
447 6
891 10
371 1
7 2
394 9
630 4
85 5
757 1
967 7
932 9
945 10
627 4
538 9
119 3
930 2
834 6
640 9
705 1
978 7
674 7
22 6
925 3
271 10
778 4
98 3
987 1
162 7
356 8
656 5
32 3
351 1
942 5
967 1
108 2
8 8
458 8
754 4
946 10
210 9
222 9
423 7
507 1
414 9
901 2
763 6
411 10
625 8
549 4
18
10
6
38
10
11
17
8
10
10
6
38
10
9
11
9
6
9
9
10
371
4
9
12
7
757
10
10
10
12
10
9
43
10
10
705
11
10
5
18
9
12
9
987
8
9
11
6
351
11
967
15
4
9
12
10
8
8
9
507
9
42
10
9
10
11
35
596 2
603 1
292 7
375 1
597 2
349 10
669 5
282 5
54 10
419 9
901 9
128 8
729 4
649 4
808 2
311 8
814 5
603
9
375
35
9
11
9
6
9
10
8
12
12
40
9
11
MinInsertPalindorme
Due on 2014-11-03, 23:59 IST
MinInsert-Palindrome Problem
Difficulty : Medium
You are given a string of characters, or numbers. Find the minimum number of
characters to be inserted into the string in order to obtain a palindrome.
A palindrome is a word, phrase, number, or other sequence of symbols or elements
that reads the same forward or reversed.
For example, the string abcbd can be transformed into a palindrome ("dabcbad" or
"adbcbda"). However, inserting fewer than 2 characters will not produce a palindrome.
Input Format:
First line contains an integer 'n' specifying the length of the string, where 3<=n<=20
Second line contains a string of length n.
Note: Upper-case and lower-case characters are considered as different. Elements of
the string are either English alphabets or numerals.
Output Format
One line containing the minimum number of insertions required to make the string a
palindrome
Sample Test Cases
Input
Output
Test Case 1
5
nitin
Test Case 2
7
aabbaab
Test Case 3
20
WbHRKhSxoS18CnGxola3
17
Test Case 4
20
eeeeeeeeeeeeeeeeeeee
Test Case 5
20
0ziG30WBD79ow1E0fu1X
17
Test Case 6
20
OGJ2gg5J5VXLRc4fye7g
15
Test Case 7
20
Yka081R3gN0O5XK00xN2
15
Coin Counting
Due on 2014-11-03, 23:59 IST
Curious Coin-Counting Problem
Difficulty : Medium
Given an amount A, we want you to compute the number of ways in which you
can gather A rupees if you have an infinite supply of each of C = {1, 3, 5} valued rupee
coins.
Input:
First line contains T, the number of test-cases. This is followed by T lines, where each
line consists of the amount A.
Output:
For each test case, print the number of ways in which A can be formed using an infinite
supply of 1, 3 and 5 rupee coins.
Sample Input:
2
5
10
Sample Output:
3
7
Constraints
T < 100
A < 101
Explanation (for first test case):
A=5
Ways this amount can be achieved: {1,1,1,1,1}, {1,1,3}, {5}
Hence, the answer is 3.
Sample Test Cases
Input
Output
Test Case 1
2
5
10
3
7
Test Case 2
100
84
87
78
16
94
36
87
93
50
22
63
28
91
60
64
27
41
27
73
37
12
69
68
30
83
31
63
24
68
36
30
3
23
59
70
68
94
57
12
43
30
74
22
20
85
38
99
25
16
71
14
27
92
81
57
74
63
71
97
82
261
279
227
14
323
55
279
317
99
23
152
35
304
139
156
33
69
33
200
57
9
180
175
40
255
42
152
27
175
55
40
2
25
134
185
175
323
126
9
75
40
205
23
20
267
60
357
29
14
190
11
33
310
244
126
205
152
190
343
249
4
Test Case 3
6
26
85
28
37
6
47
30
14
58
25
96
83
46
15
68
35
65
44
51
88
9
77
79
89
85
4
52
55
100
33
61
77
69
40
13
27
87
95
40
31
267
35
57
4
88
40
11
130
29
337
255
85
13
175
52
161
78
103
285
6
221
232
291
267
2
106
118
364
47
143
221
180
66
10
33
279
330
66
100
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
1
1
1
2
2
3
4
4
5
6
7
8
9
10
11
13
14
15
17
18
20
22
23
25
27
29
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
31
33
35
37
40
42
44
47
49
52
55
57
60
63
66
69
72
75
78
82
85
88
92
95
99
103
106
110
114
118
122
126
130
134
139
143
147
152
156
161
166
170
175
180
185
190
195
200
205
211
216
221
227
232
238
244
249
255
261
267
273
279
285
291
298
304
310
Test Case 4
92
93
94
95
96
97
98
99
317
323
330
337
343
350
357
1
0
PA5_Student_Database
Due on 2014-11-17, 23:59 IST
Create a database of students using structures, where in each entry of the database
will have the following fields:
1. a name, which is a string with at most 128 characters
2. their marks in physics which is an int between 0 and 100
3. their marks in chemistry which is an int number between 0 and 100
4. their marks in mathematics which is an int number between 0 and 100
You have to output a list of students in the following order.
1. if a student 'A' has lower marks in physics than a student 'B', then A's data is listed
before B.
2. If A and B have the same physics marks and A has lower chemistry marks than B,
then A is listed before B.
3. If A and B have the same marks in physics and chemistry, and A has lower marks in
mathematics than B, then A is listed before B.
4. If all marks are equal and A's name precedes B's name in the dictionary order, then
A is listed before B.
.
Input Format :
First line contains the number of students n, where 1<=n<=100.
In following n lines each line contains(space separated) a name and their respective
marks in physics, chemistry, maths, where 0<=marks<=100.
Output Format :
Sorted database of n lines.
Input
Output
Test Case 1
2
kanu 84 74 88
parvez 69 78 85
parvez 69
kanu
84
78
74
85
88
Test Case 2
4
apurva 72 78 84
mayank 83 76 86
abha 72 79 75
jyoti 83 76 92
apurva
abha
mayank
jyoti
72
72
83
83
78
79
76
76
84
75
86
92
Test Case 3
1
ankita 72 76 85
ankita 72
76
85
Test Case 4
7
Abhimanyu 100 94 90
Akshay 90 91 83
Akshay 100 88 88
Aman 70 94 88
Amendra 80 95 85
Amit 70 82 89
Amit 80 82 70
Amit
70
Aman
70
Amit
80
Amendra 80
Akshay 90
Akshay 100
Abhimanyu
82
94
82
95
91
88
100
89
88
70
85
83
88
94
50
Ankit 90 89 86
Ankush 80 92 92
Anshu 90 98
96
Arihant 90 92 95
Arpit 90 93 92
Ashok 70 77 63
Ashwini 80 89 89
Ayush
80 86
80
Bhupendra 70 91 88
Ch 80 85 88
Chandra 80 97 89
Devendra 80 89 86
Dheeraj 80
93 89
Dhruv
90
91 92
Dhruv 90
93 88
Divyanshu 90
97 94
Gaganpreet 100 91 94
Ganesh 90
96 97
Gidijala 80
90 96
Guddu 80 65 69
Harsha 80 87 94
Harshad 90 94 94
Harshit 90 89 92
Harshvardhan 80 95 95
Jitendra 80 86 92
Karan 100 95 91
Kaustubh 100 92 91
Lohit 80 93 89
Manav 90 95 92
Massand 80 89 82
Mohd 80 91
88
Mohit 90
94
Mohit 90
94
Nikunj 90
93
Nittala 90 93 96
Pankaj 90
95
Parth 90
95
Pranjal 80
92
Prashant 90
94
Prashant 80
93
Prashant 70
92
Praveen 90
91
Rabi 80 96
97
Ashok
70
Bhupendra
Prashant
Guddu
80
Ch
80
Ayush
80
Jitendra
Harsha 80
Massand 80
Devendra
Ashwini 80
Rohun
80
Gidijala
Mohd
80
Ankush 80
Pranjal 80
Dheeraj 80
Lohit
80
Prashant
Harshvardhan
Rabi
80
Chandra 80
Rishika 80
Ankit
90
Harshit 90
Praveen 90
Dhruv
90
Arihant 90
Dhruv
90
Arpit
90
Nikunj 90
Nittala 90
Mohit
90
Prashant
Harshad 90
Mohit
90
Parth
90
Pankaj 90
Manav
90
Rohan
90
Rohit
90
Ganesh 90
Divyanshu
Samyak 90
77
70
70
65
85
86
80
87
89
80
89
89
80
91
92
92
93
93
80
80
96
97
97
89
89
91
91
92
93
93
93
93
94
90
94
94
95
95
95
95
96
96
90
97
63
91
92
69
88
80
86
94
82
89
89
95
90
88
92
96
89
89
93
95
97
89
93
86
92
87
92
95
88
92
95
96
89
94
94
94
90
91
92
94
92
97
97
95
Test Case 5
89
94
95
91
90
96
92
91
90
87
90
88
90
92
86
96
91
95
92
94
Rishika 80 97
Rohan 90
Rohit 90
Rohun 80
Sakaar 100
Samyak 90
Shaik 90 97 96
93
95
96
89
94
97
94
92
95
93
95
4
Kamna 80 87 94
Jaimita 80 87 94
Harsha 80 87 94
Harshad 80 87 94
Test Case 6
Shaik
90
Anshu
90
Gaganpreet
Kaustubh
Sakaar 100
Karan
100
97
98
100
100
94
95
96
96
91
92
93
91
Kamna
Jaimita
Harsha
Harshad
87
87
87
87
94
94
94
94
80
80
80
80
94
91
PA5_Matrix_Exponentiation
Due on 2014-11-17, 23:59 IST
Level: Difficult
In this problem, you will be given a square matrix M and a ppsitive integer power N.
You will have to compute M raised to the power N. (that is, M multiplied with itself N
times.)
Input
First line of input if T ( number of test-cases) First line of each test-case contains two
integer M , N where M is size of square array that we have to exponent and N is the
power to which we have to exponent
Next M lines describe the input matrix. Each line contains exactly M elements
corresponding to each array
Limits
1<=T<=10
1<=M<=50
1<=N<=100000
Output
Output M line corresponding to each row of resultant matrix Each line must have M
integers where jth element of ith line is jth element of resultant matrix taken modulo with
1000000007 (10^9+7)
Sample Test Cases
Test
Case
1
Input
Output
3
2
1
1
3
1
1
0
3
1
1 0
3 1
17 112 116
15 88 100
28 144 160
41 101 102
32 89 108
54 132 132
3
0
1
3
0
2
4
3
3
4
2
4
2
0 1 4
2 4 2
Test
Case
2
4
2
2
1
2
3
0
3
0
4
2
2
2
3
Test
Case
3
5
30 20513
204620 3591043 3941022 7902548
6267606 9590319 5738172 1095087
1370638 2696983 8515601 8131235
2906656 4820533 1873442 6956566
6793174 2242783 9841501 1617268
8267851 8974531 4920120 3625178
1457912 4568114 1625664 1179675
8305880 6977845
2400187 1026852 568889 8857561
1445753 6836495 964232 9700277
7931583 2334870 2397261 8963536
2982458 7820269 6300422 7372252
4776835 3093596 9615036 4618336
7227216 399239 3592867 4663688
6540769 7567132 9231802 8166433
8746807 54035
5144279 3663346 3597239 5713168
5037259 5042992 5066015 6001491
7259622 5513950 852714 2173235
6993839 3835172 9993504 3294261
1207424 4770339 8904209 3338812
1905028 8647777 3738051 8014247
3311466 278820 5581379 5059620 961606
6844538
7630007 6105885 3024236 1227247
4335405 8061495 8786591 1917772
6579339 6046213 7431723 7432053
8219448 4425562 1267225 8212952
236175 4991001 5499644 1656736
8329814 7404672 304513 4584217
5418919 3615979 7379390 1000299
1191952 8340996
7844837 8821959 6963233 869074 49206
1298638 1446921 1352150 5732762
8026260 7398363 3164485 5458313
8134164 106399 9241890 8863468 342574
4232892 4363112 1999310 2562706
1767784 2303824 7146923 9703056
8436155 4526313 3219707 9628107
5383661 3580896 966419 2346894
6966322 3531977 6161884 8413244
4884127 1894647 8955856 4798843
5059132 4414170 2933007 5165532
3656060 1796475 8024458 7888952
8675940 23769 2968010 2960076 4843945
2631286 2663132 5796452 9673951
8399191
3
0
4
3
1
0
3
3 1
3 2
3 2
2
3
2
8 0
28 64
27 9
0 0
64 102 54
136 171 98
108 147 82
13 12
12 13
408090682
720923265
562106929
261576964
394216660
599377403
918779553
809998617
326934116
948188893
830923760
957509275
560498122
532775865
256200935
128942581
958460774
317453518
630190730
937125735
285615528
344953860
697343272
568111902
209718686
930013001
858494901
492395616
964127646
740358791
490855072
854214082
464356612
636580083
963427659
359838888
535937481
658565035
772606773
523558922
935774817
770152126
207947536
162642394
640103713
572358438
362573722
871439460
289259178
693239879
489134926
399590306
346913236
177371072
767972599
270077346
321846676
798143543
785232313
558868433
833694903
855821964
897274197
700739301
199980689
688525787
608871436
458376199
424715528
863297635
938987814
489246967
874933250
152454243
462592083
18920550
462930993
913163013
462410562
259314431
925910237
999702339
230197397
388059716
798017187
256705213
445161075
883894577
63087524 902358330
170254515
799927980
963452846
442176000
274454353
919476210
488009092
749287912
941023535
277838454 82187475
72869222 836367543
747576669
456910908
438009981 875772191
223651586 676238816
875278744 779015442
177942260 80516503 379303373
58675752 813647232 860055409
872555530 911648515
730332437 409220711
518108340 38211682 730731111
695804235 665309056
927725806 796258556
219142017 576797150
529377980 576488940
804290902 14789933 13548818
301584223 878513289
364380415 674108617
507402130 585920788
401871983 435732481
663194394 559145884
853127311
417076220 159829325
175958051 524405689
303874715 156313852
124515561 556227705
865908865 63759965 628296444
283235245 406474576
932303765 679400994
819803075 132238038
893359920 525642928
199664857
256416854 625878389
209632206 585986817
415459564 262329061
826555209 338288553
906746189 964252276
683000288 828932488
192024115 851713247
712830368 579285369
868796100 94351458 793646080
580913057
234184319 270634186
385743258 267213170
52628312 996615003 412831106
507807789 83573318 502252687
685667195 323744752
189312765 270463746
156246767 313939090
114311610 290895190
271670136 495262061
578979633
573676444 165353333 583129511
755856691 269272441 714063442
590567089 257123862 788968468
639982149 397644270 75184203 592278212
622991015 253140065 829072367
686865421 319818805 582398200
107944964 223345481 549792774 85997139
700075383 110822337 404253296
144117128 578520244 339645542
858609886
151213185 970678903 89945167 443859194
117826190 442964425 509434994 51624867
43880760 314486824 924313187 825916390
674197719 793494147 496148558
371840827 836922473 214009596
528652478 398575927 352588289
509350486 563568447 753173753
957691933 358063616 423094849
688291722 905297260 67501728
945804815 9268527 751483287 320099812
975098798 893898128 889136417
348784211 818394272 965849535
304813297 275772057 842223196
965757942 612189852 837880625
127264946 604930127 116234395
447050528 274272905 734944461
752872341 766473929 217769789
196642621 720816854 827902787
517571280 398235309
44707330 960574655 866474288 699477944
98972124 723689247 924695661 383317926
657611669 879920782 645366987
910175857 319076242 690035104
215976237 331737712 523390406
698028157 87460636 969611967 594088389
470102790 973687500 980358452
964628977 908811598 317237697
897123548 676511333 113157004
498390600 914409193 291345228
950463247 850042116 612041570
788201748 925647308 835347138
535825978 901570029 409088713
725498731 74601369 12271036 370534533
11934336 29836794 799020294 465238969
166010617 595145312 433533932
563303667 372338147 529632813
569999466 412315269 760543316
718770229
622578576 534107371 330401972
131114186 218582718 507443171
825104517 379973973 521062547
164913216 386126259 733948908 36917566
200554745 543628761 575384162 40706423
41674514 846941062 558537000 851790291
15140213 818802033 247332074 531900573
313281174 350060277 450676600
221443594 779127765
90775507 857076020 215248590 953104303
658831847 31645132 933080231 995434195
260256850 708218764 964352761
915293852 801477600 987849918
699107265 492302212 960218307
491176773 282841813 669009254
341167398 37285757 730605795 386589291
68506183 289072411 134778598 25814075
151594417 788102266
9847661 6938319
6593727 6809166 2693879 4292956
2957038 1397992 3892640 7308882
9116112 3300171 9258514 6890525
6305212 5436873 5840438 4788580
8107037 4987093 6358963 3774469
6554124 3925953 2185903 811989
8560399 1802191
8617538 9729925 449659 8465199
9184596 7043386 7790717 4394827
3852694 747755 5792819 261686 572989
7425284 3561858 2347856 6832161
2383422 7784729 2672599 9688354
8408118 176044 6047317 4698939
6730169
9973271 9401194 7542158 8533670
1203385 6159696 779947 4169396
7141247 9964543 3729134 4931965
4359370 7581828 8196072 2668541
7843515 8769062 2610177 3921725
3633270 1958690 6305147 3934351
4631289 8509853
2342469 4807334 4557171 9557760
4053855 4530442 8958954 1596013
5580464 2678692 272061 6360411
6848088 9929660 8841306 577223
4861625 5717028 8159051 3057698
901921 8518918 4343112 6028451
2440643 492734
7987141 1262142 4427085 2618431
9771996 6769554 9942117 6845519
6327314 3995972 3892313 7802620
8108337 9472777 481312 896750 8349540
7329401 826410 7190846 7906624
5688036 5424226 8582027 1262086
6326147
49 21551
2354598 4574293 8614284 2858092
8352788 3041369 5476523 8124784
2327275 7934992 7486655 1170941
4447316 1378968 8973561 2555653
851745 1971226 3452403 9201285
9300627 6795165 8908483 9723603
4999553 4332709 821982 6261639 658856
2955632 6899541 5529807 7529926
8030177 8387899 5882714 3587898
6380774 6523850 5915173 4315766
4010505 7086114 8763082 5389473
8576028 3835087 8757570 547254
9803842 475207 2364233 6599007
9383690 4604188 1598561 3716399
7942522 376552 6891607 898155 9792446
2421414 8428081 7822623 3325665
6827147 1410522 9706439 3350997
7325695 6538557 9877854 6928162
5301639 7783679 8020542 1653078
6541249 1084148 1456920 9532808
5964733 572280 8916498 568921 2170841
5149249 8511443 5063745 2040856
1925950 4856191 6978623 354031
2678815 304288 9697530
4089337 10728 5564879 3931384 6549285
5442733 3375898 4367277 5742764
1396440 6020355 4800365 4996940
9993628 4333173 961673 565908 3249671
1530594 5253101 8398920 2558390
316846 2956129 4484340 5173038
322733631
984012420
141048543
374517145
267949723
471105199
504167682
109868674
887047305
760987536
783414272
597425346
486113474
110975375
775934654
503429484
318125849
833139626
689881934
602596316
801858528
288275092
103149487
744763639
179731613
678474356
901448608
686981525
713292143
615453023
814481915
614848667
475618682
905621393
452600948
355854491
582874326
897038030
134336010
428847464
412252993
811722471
177586061
907792019
486851211
162454885
308734715
733137687
892850465
769257771
348637221
665393252
444298084
876798881
780506923
207239579
104236594
477757803
958524805
746500889
564027667
285161016
899655685
655358226
839377633
727289204
798506760
142239758 391243519
114425144 823532679
541299861 423593864
666026881
915176974 796258404
529645809 555395364
886006002 486143831
707857810 308758324
198443026 318513690
662383724 661952521
884421141 182922413
320585937 554766377
247186460 527916381
634302083 995770677
972605529 740473450 65509215
779634604 405611180
173017603 261052106
750866406 443901969
375773914 394189438
712211608 665968036
386399402 341204534
175439430 492272162
762111755 27540643 486562479
232684444 419015306
261921188 349015964
357420877 608875646
130757181 100845633
355213787 538788397
976953363 876679845
87409756 440516472 56992046
925031071 281925501
444397727 596403678
833735052 984989142
976144672 574161686
109513300 542617120
6698765
910326578 96418544 724898590
831708831 368403226
561225663 264275673
669374307 630021684
719422775 67195722 875378935
44910857 671527002 383850905
729276404 388066427
198008761 444997575
348302942 122100150
887923373 8709310 371269251
259904098 401650901
338002711 480101488
207568388 208307013
420533367 834302796 48088620
490781684
340659199 625702367
81829604 967626119 769491779
269973334 917239425
545623396 482438723
254105361 416364245
258493631 736820068
35152687 482221984 811255810
420566121 718662756
379394162 230713897
153341831
570264970 538303780 92028380
501631210 340911515
981798765 543717315 8642189
370366125 700649643
214083234 250191984
12400166 641788501 658362455
206571198
947851608
359973660
198184847
988938178
354463382
Test
Case
4
3
8 57332
6637194 5323890 3758230 3119509
7288424 8404539 4408286 7177462
6419669 7529066 5352554 3740970
2060595 969461 1560469 2882056
6077824 2794292 1124173 1418184
5324234 7912854 3818583 9652527
4988518 4805117 3365574 1382317
2052482 9343581 4356000 8689676
7183823 8114231 4325537 6988599
6518770 1250176 4166062 5454791
8779242 9518616 1712114 3356190
488078 3272583 8754598 9082254
6066875 2395124 500439 1391110 307978
6835374 3559989 5296496
4156843 9441916 9195165 6209325
1301849 6067518 7415353 8485673
50 40892
5474272 3216871 2991067 2156686
1188014 4286661 4191655 2900128
7642851 7196085 8689064 8913802
6278339 4755939 1308926 9295130
8663401 1616904 8646856 4739743
9429753 5320052 4181659 1141270
1529377 5483508 7208788 8944731
3969181 3906889 3201974 1959806
9640112 6193041 6632844 828127 479702
824499 6244607 638906 8020584 4933671
9552708 6815276 2205963 3377986
6110406 869364 7511242 7273615
5609107 6940995 2593667 2307118
8082266 6639396 7790627 7807406
8100479 4276160 1714296 1302453
8752318 1354408 11846 5385163 4698887
491549 6209662 943495 3646807 6746599
8393518 5715867 3561875 599481
9093853 2188633 3985198 6605095
1978600 2110657 6062443 4572267
4417776 6661061 3728016 4724755
6984819 1828495 9000915 8699115
5647301 7753234 2569876 5659147
3138397 9785115 6150696 1864411
3244962 2313855 8611010 1638481
8029722 4689237 4754314 9639927
6877871 8739512 8761375 8856471
3366522 4823818 5945091 7784298
4001231 9673107 2509053 986050
4017954 4026320 2201518 9665255
1779554 4771394 5324403 7434303
7072861 3991451 1815067 317824
6305307 426077 1956305 6851381
7631667 9226971 6491309 7025890
7966484 5252684 5882361 1333006
2592854 4343804 1633656 6594085
6533263 4142709
96487 3067570 8169029 2298005 2732825
2464936 9585751 573580 2415591
6658613 7081384 4230658 6976437
5903043 7173088 1449094 2754424
669785117
959192370
514797632
153950374
996919586
727693184
493946949
359593871
541055421
324512699
368992706
360080119
639510137
380932802
317720877
696614456
963825970
167607501
721134587
664664265
502513198
467117342
304800745
495553493
843139666
873684151
840265665
710286847
282167712
861785870
193901040
504725972
415360071
190861254
859554244
588987914
302337068
494447528
878666716
601934159
585779447
731646521
191862176
180377725
983095161
506648094
330141750
505678244
498520248
131232240
364670637
392987365
752382362
293814924
554709367
694898271
694789008
146972996
627787901
184610502
943891578
854548607
797736576
487419901
163190095
278974258
703693285
522899027
260409117
378485630
382614083
986637062
331705870
965880617
323801427
636493207
928905384
837511493
799285168 163973210
73210100 446573601 215739364
766911146 875155323
279878246 742373790
109615692 365640854
35520702 360059122 642220831
705616630 582729952
269441463 820435428
931862309 57653790 604266488
526899893 556961785
692826563 419793664
255831200 435241223 39986787
599877384 530240895
288656117 93188271 238456730
87007364 623245850 801654496
819291317 657223808
531852859 335532071
690005443 710574195
94518345 985778001 926720887
807974008 665994421
87290353 747539015 584769916
255322150 250956170
411824331 693527836
355917807 327407537
799674628 980327791
748892270 448130566
440240904 896847039
921595030 917184733
67605472 310049667 490913172
464902893 810929658 52313115
959448533 647104801 88074791
446992416 821115457 72156625
786105148 856436322
949839007 290648426 55835311
542069257 390025528 45531557
693311017 949390688
119152197 218906649 5783495
912465753 872052828
54667515 116798997 83426545
94878654 879965408
32425643 13036610 349898471
566229093 741081868
915609482 513939467
513507104 104994416
211669652 688741552
958724815 393226954
239810860 434308217
504525829 763674721 55691051
548518460 106435394
479660353 476909531
495348327 225591438 25135254
727018398 513512706
911873673 791193260
16089339 457027912 434786774
163106038 115595202
152418433
984730230
109801419
328057476
439486551
665388220
855938945
258480813
185420578
724008063
986099320
213433730
483893128
575277220 14516635
237389809
511953678
169051454
109559527
4902974 772433203
201181111
974974909
467077778
823701761
644510151
118298639
308985079
518195539
769095601
867557586
519424160
594782829
645775472
912046315
671908287
568453469
729632720
589684935
879094049
624034596
176953033
483136755
777055198
700939085
663620015
214012992
964958962
216437353
639129923
427154080
735988222
586625145
328722579
272396983
503466858
972093680
931421728
738254043
331784326
225685125
660033506
396548165
288972018
462178526
110475524
873533068
959063359
748482911
849371710
197883473
797000572
653571052
534915258
526474692
415163514
513122713
541037176
527952047
866804200
628920859
825647646
808323946
833286993
488755719
305025576
935069904
281511523
974098045
969021148
505207384
356893672 600515843
379830112 62996298 340895067
392533830 127755049
408320439 104300516
494312034 851806091
22111009 582661739 641592817
392535073 944969311
542607032 726271948
800354928 820806244
232617594 582986868
875005014 911120862
83265109 790032648 686174522
539339719 837146867
939901131 58642461 610775961
180764450 270979712
89373261 960775804 358743246
706047694 979134595
699540136 371399233
350616913 417689781
672397153 594434950
116871620 871419714
916167558 187223657
929094498 652401335
832175030 311750681 48297498
43786456 930212188 272719008
159414459 897013968
250625400 560945368
835321297 719427009
717104294 744665366
68640297 402868895 323616358
400462730 505805874 54369567
891959627 913445450
239576021 986387427
289819654 75083525 807662263
220425452 769196366
174598289 93820499 163958227
833708974 197907584
283556001 488756301
84026236 994530377 2629106
696091092 411225754
946603260 260752800
750319763 617983624
344247348 841976939
133088738 902710365
828916872 962758289
665038205 121592505
589722394 178262030
379626902 913967663
995304118 133125435
301718236 306377768
909090828 118373181 99492697
290945512 626906064
782520684 2986924 740401383
122897328 855388326
232955620 151378283
773339093 59915718 432377157
946119251 61689395 635464401
983797500 123967719
317798445 490171290
745496039 644496984
521552749 792819108
411742656 671974681
39308349 716779376 441370628
641388742 805626934
581808073 232367860 20077297
1118302 7063321
8318262 8588960 5790079 79144 4161424
3258375 336798 6072805 9073160
4348841 1396069 628977 9893348
2901990 2050890 7404559 3596466
1853651 4060991 4180789 7145078
5851814 6042015 3340483 3283437
2508965 8521536 6573964 2169230
2156190 6153637 3003844 745151
1943717 3082988 7422927 5202092
3419786 6012085 6791605 284980
7408154 9936934 178328 2826496
1987824 7582887 8939314 6357827
4160230
5636455 3502906 2528397 1678471
9359741 5811834 4187436 397629
4902151 8873018 2553819 1055788
1876863 3298970 2999505 7476203
3238250 717950 3412342 9250335
7509555 3697322 6658489 7446489
3875650 2001337 1950665 3974889
3457004 824845 651471 9093459 4327751
3179868 3288282 6203844 1508055
9992070 6601473 6410206 8865089
9155292 7465994 3258304 4970615
2981852 734507 8208865 3699802
4146849
7459200 1209357 7844171 6634041
1172198 4236173 1151730 3122863
727414 4608734 3947708 3895238
6218546 791811 7075106 9506828
9512007 1099513 9498899 8629832
7509719 880340 301477 7492066 4138644
5272092 473918 7389503 5997309
6690072 1536353 5972861 415781
1896876 2606902 1587979 8649402
6274984 7227194 1893168 883719
1174903 5788406 7102265 4483066
2863513 6609093 3995074 6479378
8624344
2624906 3989098 9504684 2926383
3997516 3643328 714827 6987786
1032832 6712136 3677858 5085537
5201349 4093639 9498765 7808251
5681618 8148167 4083236 2908812
2557688 7483307 6600067 8346094
7101924 1083134 3725959 3711017
7594560 205338 4851714 2735818
6710788 4356398 8178554 708304 516079
8893381 7696090 4065263 8121870
1373948 1667152 3323219 7983939
1165917 3647823 6181909 1830437
247411
24 88126
7730718 723493 2734219 4832642
1806627 8976531 1060011 1917539
9181869 8428077 4653357 5892657
2784476 2831911 9117313 5816907
4241645 9329755 9882170 4879867
3220055 1549322 8203086 1203994
5231591 4367261 7385903 7062028
4614672 1509328 3966505 4861742
2232821 9217077 2210736 6555800
8193608 5787100 8473339 9891829
4215177 5643049 8300838 6999653
8474960 7418151 2816560 5232957
6747906 5215082 112824 9967961
556149065
757614339
966056641
644515291
110327770
273623723
366904295
637216800
864692573
147222695
326689761
596101754
715304247
672437703
137676351
236029293
471642094
743600660
104983124
826030924
577470649
319165810
812075633
203614935
643404921
687330375
390878721
561212315
138872647
663632843
459887914
893273814
622337880
817845483
349354203
509458388
308592004
120419833
836101927
302343476
841247742
596743242
434294882
163964678
577670567
484156679
826984828
621437257
973878656
994420070
415211459
659550883
571589945
576304155
256537367
210011791
315228009
675756914
428060086
545954984
103658775
734424086
913802704
882674878
586186807
508144952
641919110
650833500 194615562
62714474 921516462 914578585
370662624 910121314
809215010 669450634
536136904 762729589
15551094 874310708 609035641
672609407 732486421
120704672 382035528
344974011 198165289
490358560 273135699
608298815 189633690
166893658 291954082
301865861 14880004 727104376
799315825 273541578
731255256 913150591
871785464 31460628 904551805
587603889 158393974
379347355 467216000
877420619
125465279 829900158
192866723 16409417 530900083
78949952 595862033 257061448
665993508 214350082
45630988 86905989 922710477
812799440 410068609
694058603 178666224
498658592 603645148
191255657 251064792 4703320
489607644 161229437 16120232
208510339 973109645
779836352 366252758
690005265 932822892 51645823
588518448 395341478
320399281
41597482 843361993 829336117
414194300 146255788
260860667 432851260
439039736 86891888 492993454
888352208 749153311
388992271 671861727
593477649 392471974
784095298 644648741
963933231 474009646
5015609 581906256 640227811
970468203 704751701
328007119 550181034
533212374 652044180
463580233 145013658
565530230 75760381 330830979
815185739 653735818
839465466 510144474
540005522 303825274
906562607 277034973
921321056 114133225
394852048 554817554
324317879 235726299
200958603 43891117 744558393
847351260 267678129
482956628 406522882 90257167
944614930 742015722
938887217 179931447
512082597 561839443
574560610 388250276
787337955 863045422
49255390 492448124
658103798 188262912
Test
Case
5
5
17 96269
2871214 4163927 8636774 5138407
3301518 1030500 8719372 8514242
2073041 485638 7739488 568441 3177601
5390153 5149464 5457881 8123130
8725152 6385466 2225023 655669
1784031 3721282 1039099 1809331
4154932 9470936 1189279 4690100
3905255 6685548 7561315 8069182
7838674
5216074 3887052 1385527 6451799
2401295 3458568 9453789 2657135
4027009 2631390 563640 1692825 605623
8686771 2934330 6991090 3428146
3589999 1291473 9665780 4629098
3100804 3820712 4100035 6806436
1027165 8005290 6008336 8588480
8590824 3847010 3804554 4994228
7748889
2772705 7395523 1207457 2226494
2569010 5234467 7374236 3132651
9443644 7979860 4335774 2377974
7487302 7763920 5967973 8778775
7429700
822479676
572272781
351866338
334557918
585864540
295573421
767863319
226924020
638587917
704939742
495537548
782861031
121279824
975609089
634823570
449065389
687908852
563825961
449392269
929806356
815859356
982910008
256862936
737017477
723936428
914074702
880573225
953220645
775929361
969992046
297845783
159003818
506359559
304897648
788159419
889735082
555793227
609450017
123208754
784033293
483863695
684235087
977844021
968836323
672355044
285661020
724634849
573841872
419161410
470070430
704697589
685182826
114934341
361725789
665397735
670682683
333633637
748163414
495722079
285588992
245021850
516901302
879569431
788400991
940673632
800223790
439486494
880283211 694142682
698877106 438846120
950563878 509596566
755336024 728750442
889858820 704922514
138019375 232081628
641553033 237427373
330427044 550911542
35946053 423680772 62979351
402234402 578285855
418180765 638190192
82174575 671693862 359722443
787655190 427829619
806476424 998057470
715991656 876544062
813962454 905603747
270157669 973409401
307007375 794404581
648845948 826482689
321730557 36596585 869012508
696774419 946017957
537457484 567613931
673690619 280691269
576383028 699572025
563411543 293157781
720431856 937368684
516380848 793813253
552047465 614548090
238507811 487145672
430586805 659776206
123840957 364018585
246312016 969833992 38640831
211091473 180192789 97979678
609563213 182959270
483365131 905292929
908429408 512447526 19533968
553799917
478680722 773425265
582510070 820284633
796300487 661072219
316174569 412831149
909567533 971849714
139623789 674245078
455778248 57136346 124446125
688702937 2879076 933128364
995889136 368754040 93244790
210249602 490519789
918042038 7000077 660114166
196581513 95747834 102997117
910376962 843663547
576811064 974194105
815911338 102167610
601373787 511202149 94302717
87666484 478634973 63043087
447293854 117155474 33937192
689787755 201646752
709995648 871836223
144889785 247604497
267795111 556638836 47018490
914597924 671313063
903367606 218215124
246158913
905998436
236114359
501615211
833609625
701286155
920150555
279056296
297768092
536541561
535839587
331842489
592453904
681776775
294321412
317645501
944596740
787644262
900794233
532876667
495486433
678382509
233495525
636813217
329556562
333256774
102239820
169820167
730820862
405302906
301967295
993562597
333128951
554759066
965657917
975314248
401575346
235128114
507409185
849423754
254770915
940227271
405902575
847438194
948600483
401911201
272270900
229342681
920170339
370132528
300132394
242230986
329001299
970460482
479832340
288478902
458511937
583705096
829077848
879501624
513487000
236691382
254689249
890782162
606038559
842732966
424216355
416613343
479710274
899987552
927845009
369452971
261622209
523168718
133424693
120197749
245902192
PA5_MazeProblem
Due on 2014-11-17, 23:59 IST
Maze Problem
You are provided a matrix of size N*N with source position at (0,0) and
destination at (N-1,N-1) in a 2D array. Some of the positions in the array are marked as
0 which are blocked cells, rest being marked 1.
A path is a connected sequence of elements from (0,0) to (N-1,N-1) which consists of
1. A sequence of 1s in the 2D array is connected if every 1 in the sequence is adjacent
(the above or left neighbour) to the next 1 in the sequence.
For example, in the following matrix,
110
011
101
the 1s marked in blue is a connected path from (0,0) to (2,2)
Note that cells at (0,0) and (N-1,N-1) are always 1. You can either make
movement towards right or down, i.e., from position (x,y), you can go to either the
position (x,y+1) or (x+1,y).
Input
First line consists of the size of the input array N (<=50), following that would
be the state of NxN maze which would consist of 0s and 1s.
Output
You have to print "POSSIBL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1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
0
1
10
1 0
0 0
1 1
1 0
1 0
1 1
0 0
1 1
1 0
1 0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
1
1
0
0
1
0
0
0
1
1
1
1
0
1
0
1
1
1
0
0
0
0
0
1
0
0
0
0
1
1
0
0
0
0
1
0
1
0
0
1
1
0
1
NOT POSSIBLE
Adjacency List
Due on 2014-11-17, 23:59 IST
A graph is abstractly a collection of vertices which are labelled by
non-negative integers, and a collection of edges. A graph called an
undirected graph if we talk of merely the presence of an edge between
vertices i and j, rather than its direction.
For example, the following is a graph:
Output
You have to output the list of nodes to which n has an edge, in the
order in which the edges were input, one line for each vertex.
Sample Test Cases
Test Case 1
Input
Output
4
1
2
3
4
4
3
5
2
3
4
5
Test Case 2
10
1 2
1 3
1 4
2 3
2 4
5 1
5 2
5 3
5 4
6 1
1
2
3
4
5
6
Test Case 3
13
0 4
0 7
0 10
1 8
1 9
3 6
3 10
4 8
4 10
5 9
6 9
7 10
8 10
8
1
4
10
Test Case 4
325
0 44
0 59
0 100
1 71
1 72
1 93
1 96
1 100
2 14
2 86
2 98
2 99
3 43
3 47
3 87
3 99
4 28
4 49
4 94
13
22
37
54
56
59
63
68
75
95
100
4 99
5 60
5 93
5 99
6 74
6 86
6 87
6 88
6 92
6 93
6 100
7 30
7 85
7 89
7 98
7 99
10 20
10 98
10 100
11 63
11 81
11 100
12 58
12 77
12 87
12 89
12 94
12 99
13 60
13 90
13 91
13 93
13 95
13 98
13 100
14 78
14 80
15 86
15 100
16 72
16 90
16 95
17 63
17 92
17 93
17 97
17 98
17 100
18 80
18 95
18 98
18 100
19 68
19 86
19 93
19 95
19 98
19 100
20 64
20 100
21 42
21 75
21 94
21 99
22 91
22 97
22 99
23
23
23
24
24
24
24
25
25
25
25
25
26
26
26
26
27
27
27
28
28
28
29
29
29
29
29
30
30
30
30
31
31
31
32
32
32
32
33
33
33
34
34
34
34
34
34
35
35
35
35
35
35
36
36
36
37
37
37
37
38
38
38
38
38
38
38
78
97
99
50
76
83
100
38
84
88
98
100
49
88
94
99
50
98
100
49
74
99
42
76
77
90
99
46
80
89
100
70
98
99
76
81
95
99
64
94
100
57
71
95
96
98
99
42
49
72
97
98
99
43
67
100
51
91
96
99
43
48
57
76
83
88
92
38
38
38
39
39
39
40
40
40
40
41
41
42
42
42
43
43
43
44
44
44
44
45
45
45
45
45
45
46
46
46
47
47
47
47
48
49
49
50
50
50
50
50
51
51
51
51
51
52
52
52
52
52
53
54
55
55
55
55
55
55
56
56
56
57
57
58
94
97
100
76
89
99
76
87
97
99
51
100
93
95
99
60
61
100
81
87
93
95
66
88
94
97
98
100
84
98
99
96
97
98
100
100
79
99
78
81
90
95
99
65
76
83
84
99
95
96
97
98
100
99
91
84
89
96
97
98
100
60
91
99
69
100
88
58
58
58
59
59
59
59
60
60
61
61
61
62
62
63
63
63
63
63
63
64
64
64
65
65
65
65
65
66
66
66
66
66
67
67
67
68
68
68
68
69
69
69
69
69
69
70
70
70
72
72
73
73
73
73
73
74
74
74
74
75
75
75
76
76
76
77
96
97
99
89
90
91
97
61
99
97
98
100
86
88
74
91
94
97
98
100
66
98
99
88
94
95
98
100
72
88
94
98
99
75
96
100
91
93
96
100
70
89
93
97
98
99
92
98
100
95
100
92
93
96
97
100
81
96
98
100
88
91
100
92
98
100
90
77
78
78
79
79
79
79
80
80
80
81
81
81
82
82
82
82
83
83
84
85
85
86
86
86
87
87
87
87
88
88
90
90
90
91
91
95
96
91
Test Case 5
99
86
100
80
85
98
99
92
97
100
94
98
99
90
93
98
100
84
100
100
97
100
95
98
99
88
89
95
100
92
99
95
98
99
95
100
99
99
325
32000
32000
32000
32001
32001
32001
32001
32001
32002
32002
32002
32002
32003
32003
32003
32003
32004
32004
32004
32004
32005
32005
32005
32006
32006
32006
32044
32059
32100
32071
32072
32093
32096
32100
32014
32086
32098
32099
32043
32047
32087
32099
32028
32049
32094
32099
32060
32093
32099
32074
32086
32087
32013
32022
32037
32054
32056
32059
32063
32068
32075
32095
32100
32006
32006
32006
32006
32007
32007
32007
32007
32007
32010
32010
32010
32011
32011
32011
32012
32012
32012
32012
32012
32012
32013
32013
32013
32013
32013
32013
32013
32014
32014
32015
32015
32016
32016
32016
32017
32017
32017
32017
32017
32017
32018
32018
32018
32018
32019
32019
32019
32019
32019
32019
32020
32020
32021
32021
32021
32021
32022
32022
32022
32023
32023
32023
32024
32024
32024
32024
32088
32092
32093
32100
32030
32085
32089
32098
32099
32020
32098
32100
32063
32081
32100
32058
32077
32087
32089
32094
32099
32060
32090
32091
32093
32095
32098
32100
32078
32080
32086
32100
32072
32090
32095
32063
32092
32093
32097
32098
32100
32080
32095
32098
32100
32068
32086
32093
32095
32098
32100
32064
32100
32042
32075
32094
32099
32091
32097
32099
32078
32097
32099
32050
32076
32083
32100
32025
32025
32025
32025
32025
32026
32026
32026
32026
32027
32027
32027
32028
32028
32028
32029
32029
32029
32029
32029
32030
32030
32030
32030
32031
32031
32031
32032
32032
32032
32032
32033
32033
32033
32034
32034
32034
32034
32034
32034
32035
32035
32035
32035
32035
32035
32036
32036
32036
32037
32037
32037
32037
32038
32038
32038
32038
32038
32038
32038
32038
32038
32038
32039
32039
32039
32040
32038
32084
32088
32098
32100
32049
32088
32094
32099
32050
32098
32100
32049
32074
32099
32042
32076
32077
32090
32099
32046
32080
32089
32100
32070
32098
32099
32076
32081
32095
32099
32064
32094
32100
32057
32071
32095
32096
32098
32099
32042
32049
32072
32097
32098
32099
32043
32067
32100
32051
32091
32096
32099
32043
32048
32057
32076
32083
32088
32092
32094
32097
32100
32076
32089
32099
32076
32040
32040
32040
32041
32041
32042
32042
32042
32043
32043
32043
32044
32044
32044
32044
32045
32045
32045
32045
32045
32045
32046
32046
32046
32047
32047
32047
32047
32048
32049
32049
32050
32050
32050
32050
32050
32051
32051
32051
32051
32051
32052
32052
32052
32052
32052
32053
32054
32055
32055
32055
32055
32055
32055
32056
32056
32056
32057
32057
32058
32058
32058
32058
32059
32059
32059
32059
32087
32097
32099
32051
32100
32093
32095
32099
32060
32061
32100
32081
32087
32093
32095
32066
32088
32094
32097
32098
32100
32084
32098
32099
32096
32097
32098
32100
32100
32079
32099
32078
32081
32090
32095
32099
32065
32076
32083
32084
32099
32095
32096
32097
32098
32100
32099
32091
32084
32089
32096
32097
32098
32100
32060
32091
32099
32069
32100
32088
32096
32097
32099
32089
32090
32091
32097
32060
32060
32061
32061
32061
32062
32062
32063
32063
32063
32063
32063
32063
32064
32064
32064
32065
32065
32065
32065
32065
32066
32066
32066
32066
32066
32067
32067
32067
32068
32068
32068
32068
32069
32069
32069
32069
32069
32069
32070
32070
32070
32072
32072
32073
32073
32073
32073
32073
32074
32074
32074
32074
32075
32075
32075
32076
32076
32076
32077
32077
32078
32078
32079
32079
32079
32079
32061
32099
32097
32098
32100
32086
32088
32074
32091
32094
32097
32098
32100
32066
32098
32099
32088
32094
32095
32098
32100
32072
32088
32094
32098
32099
32075
32096
32100
32091
32093
32096
32100
32070
32089
32093
32097
32098
32099
32092
32098
32100
32095
32100
32092
32093
32096
32097
32100
32081
32096
32098
32100
32088
32091
32100
32092
32098
32100
32090
32099
32086
32100
32080
32085
32098
32099
32080
32080
32080
32081
32081
32081
32082
32082
32082
32082
32083
32083
32084
32085
32085
32086
32086
32086
32087
32087
32087
32087
32088
32088
32090
32090
32090
32091
32091
32095
32096
32091
32092
32097
32100
32094
32098
32099
32090
32093
32098
32100
32084
32100
32100
32097
32100
32095
32098
32099
32088
32089
32095
32100
32092
32099
32095
32098
32099
32095
32100
32099
32099
Dec 14 Question 1
Due on 2014-12-23, 05:30 IST
A directed graph is a graph where the edges have a direction - The edge (i,j) represents an edge from i to j only. To
specify an edge in the backward direction, there must be an edge of the form (j,i). If this is absent, then there is an
edge only in the first direction.
You will be given a directed graph as a sequence of edges. You have to see whether for every vertex, whether the
number of incoming edges is the same as the number of outgoing edges.
If every vertex has equal number of incoming and outgoing edges, then print yes, otherwise print the smallest vertex
index which has unequal number of incoming and outgoing edges.
Input
The input consists of a single line with several numbers.
The first number e says how many edges there are. 1<=e<=3000.
This is followed by 2*e non-negative edges. Each edge is represented by an adjacent pair i j representing that there is
an edge from i to j. (1<i<30000 and 1<j<30000) i is different from j, but may be lesser than or greater than j.
Output
If every vertex has equal number of incoming and outgoing edges, then print yes. Otherwise, print the smallest
vertex which has unequal number of incoming and outgoing edges.
Sample Input 1
401021220
Sample Output 1
0
<i<j<="" body=""></i
Sample Test Cases
Input
Output
Test
Case
1
142 0 1 0 2 0 4 0 5 0 6 0 8 0 9 0 10 0 11 0 12 1 2 1 3 1 4 1 5 1 6 1 7
1 9 1 10 1 12 2 0 2 1 2 3 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 3 1 3 4 3
5 3 6 3 7 3 8 3 9 3 10 3 11 3 12 4 0 4 1 4 2 4 3 4 5 4 6 4 7 4 8 4 9 4
10 4 11 4 12 5 0 5 1 5 2 5 3 5 4 5 8 5 9 5 10 5 11 5 12 6 0 6 1 6 2 6
3 6 4 6 5 6 7 6 8 6 9 6 10 6 11 6 12 7 0 7 1 7 2 7 3 7 5 7 6 7 8 7 9 7
10 7 11 7 12 8 0 8 1 8 2 8 3 8 4 8 6 8 7 8 10 8 11 8 12 9 0 9 1 9 2 9
3 9 4 9 5 9 6 9 7 9 8 9 10 9 11 9 12 10 0 10 1 10 2 10 3 10 4 10 5 10
6 10 7 10 9 10 11 10 12 11 0 11 1 11 2 11 3 11 4 11 5 11 6 11 7 11 8
11 9 11 10 11 12 12 0 12 1 12 2 12 3 12 4 12 5 12 6 12 7 12 8 12 9 12
10 12 11
Test
Case
2
380 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15
0 16 0 17 0 18 0 19 1 0 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12
1 13 1 14 1 15 1 16 1 17 1 18 1 19 2 0 2 1 2 3 2 4 2 5 2 6 2 7 2 8 2 9
2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 3 0 3 1 3 2 3 4 3 5
3 6 3 7 3 8 3 9 3 10 3 11 3 12 3 13 3 14 3 15 3 16 3 17 3 18 3 19 4 0
4 1 4 2 4 3 4 5 4 6 4 7 4 8 4 9 4 10 4 11 4 12 4 13 4 14 4 15 4 16 4
17 4 18 4 19 5 0 5 1 5 2 5 3 5 4 5 6 5 7 5 8 5 9 5 10 5 11 5 12 5 13 5
14 5 15 5 16 5 17 5 18 5 19 6 0 6 1 6 2 6 3 6 4 6 5 6 7 6 8 6 9 6 10 6
11 6 12 6 13 6 14 6 15 6 16 6 17 6 18 6 19 7 0 7 1 7 2 7 3 7 4 7 5 7 6
7 8 7 9 7 10 7 11 7 12 7 13 7 14 7 15 7 16 7 17 7 18 7 19 8 0 8 1 8 2
8 3 8 4 8 5 8 6 8 7 8 9 8 10 8 11 8 12 8 13 8 14 8 15 8 16 8 17 8 18 8
19 9 0 9 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 10 9 11 9 12 9 13 9 14 9 15 9
16 9 17 9 18 9 19 10 0 10 1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10
11 10 12 10 13 10 14 10 15 10 16 10 17 10 18 10 19 11 0 11 1 11 2 11 3
11 4 11 5 11 6 11 7 11 8 11 9 11 10 11 12 11 13 11 14 11 15 11 16 11
17 11 18 11 19 12 0 12 1 12 2 12 3 12 4 12 5 12 6 12 7 12 8 12 9 12 10
12 11 12 13 12 14 12 15 12 16 12 17 12 18 12 19 13 0 13 1 13 2 13 3 13
4 13 5 13 6 13 7 13 8 13 9 13 10 13 11 13 12 13 14 13 15 13 16 13 17
13 18 13 19 14 0 14 1 14 2 14 3 14 4 14 5 14 6 14 7 14 8 14 9 14 10 14
11 14 12 14 13 14 15 14 16 14 17 14 18 14 19 15 0 15 1 15 2 15 3 15 4
15 5 15 6 15 7 15 8 15 9 15 10 15 11 15 12 15 13 15 14 15 16 15 17 15
18 15 19 16 0 16 1 16 2 16 3 16 4 16 5 16 6 16 7 16 8 16 9 16 10 16 11
16 12 16 13 16 14 16 15 16 17 16 18 16 19 17 0 17 1 17 2 17 3 17 4 17
5 17 6 17 7 17 8 17 9 17 10 17 11 17 12 17 13 17 14 17 15 17 16 17 18
17 19 18 0 18 1 18 2 18 3 18 4 18 5 18 6 18 7 18 8 18 9 18 10 18 11 18
12 18 13 18 14 18 15 18 16 18 17 18 19 19 0 19 1 19 2 19 3 19 4 19 5
19 6 19 7 19 8 19 9 19 10 19 11 19 12 19 13 19 14 19 15 19 16 19 17 19
18
yes
Test
Case
3
868 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15
0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29
1 0 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16
1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 2 0 2
1 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17
2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 3 0 3 1 3
2 3 4 3 5 3 6 3 7 3 8 3 9 3 10 3 11 3 12 3 13 3 14 3 15 3 16 3 17 3 18
3 19 3 20 3 21 3 22 3 23 3 24 3 25 3 26 3 27 3 28 3 29 4 0 4 1 4 2 4 3
4 5 4 6 4 7 4 8 4 9 4 10 4 11 4 12 4 13 4 14 4 15 4 16 4 17 4 18 4 19
4 20 4 21 4 22 4 23 4 24 4 25 4 26 4 27 4 28 4 29 5 0 5 1 5 2 5 3 5 4
5 6 5 7 5 8 5 9 5 10 5 11 5 12 5 13 5 14 5 15 5 16 5 17 5 18 5 19 5 20
5 21 5 22 5 23 5 24 5 25 5 26 5 27 5 28 5 29 6 0 6 1 6 2 6 3 6 4 6 5 6
7 6 8 6 9 6 10 6 11 6 12 6 13 6 14 6 15 6 16 6 17 6 18 6 19 6 20 6 21
6 22 6 23 6 24 6 25 6 26 6 27 6 28 6 29 7 0 7 1 7 2 7 3 7 4 7 5 7 6 7
8 7 9 7 10 7 11 7 12 7 13 7 14 7 15 7 16 7 17 7 18 7 19 7 20 7 21 7 22
7 23 7 24 7 25 7 26 7 27 7 28 7 29 8 0 8 1 8 2 8 3 8 4 8 5 8 6 8 7 8 9
8 10 8 11 8 12 8 13 8 14 8 15 8 16 8 17 8 18 8 19 8 20 8 21 8 22 8 23
27
8 24 8 25 8 26 8 27 8 28 8 29 9 0 9 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 10
9 11 9 12 9 13 9 14 9 15 9 16 9 17 9 18 9 19 9 20 9 21 9 22 9 23 9 24
9 25 9 26 9 27 9 28 9 29 10 0 10 1 10 2 10 3 10 4 10 5 10 6 10 7 10 8
10 9 10 11 10 12 10 13 10 14 10 15 10 16 10 17 10 18 10 19 10 20 10 21
10 22 10 23 10 24 10 25 10 26 10 27 10 28 10 29 11 0 11 1 11 2 11 3 11
4 11 5 11 6 11 7 11 8 11 9 11 10 11 12 11 13 11 14 11 15 11 16 11 17
11 18 11 19 11 20 11 21 11 22 11 23 11 24 11 25 11 26 11 27 11 28 11
29 12 0 12 1 12 2 12 3 12 4 12 5 12 6 12 7 12 8 12 9 12 10 12 11 12 13
12 14 12 15 12 16 12 17 12 18 12 19 12 20 12 21 12 22 12 23 12 24 12
25 12 26 12 27 12 28 12 29 13 0 13 1 13 2 13 3 13 4 13 5 13 6 13 7 13
8 13 9 13 10 13 11 13 12 13 14 13 15 13 16 13 17 13 18 13 19 13 20 13
21 13 22 13 23 13 24 13 25 13 26 13 27 13 28 13 29 14 0 14 1 14 2 14 3
14 4 14 5 14 6 14 7 14 8 14 9 14 10 14 11 14 12 14 13 14 15 14 16 14
17 14 18 14 19 14 20 14 21 14 22 14 23 14 24 14 25 14 26 14 27 14 28
14 29 15 0 15 1 15 2 15 3 15 4 15 5 15 6 15 7 15 8 15 9 15 10 15 11 15
12 15 13 15 14 15 16 15 17 15 18 15 19 15 20 15 21 15 22 15 23 15 24
15 25 15 26 15 27 15 28 15 29 16 0 16 1 16 2 16 3 16 4 16 5 16 6 16 7
16 8 16 9 16 10 16 11 16 12 16 13 16 14 16 15 16 17 16 18 16 19 16 20
16 21 16 22 16 23 16 24 16 25 16 26 16 27 16 28 16 29 17 0 17 1 17 2
17 3 17 4 17 5 17 6 17 7 17 8 17 9 17 10 17 11 17 12 17 13 17 14 17 15
17 16 17 18 17 19 17 20 17 21 17 22 17 23 17 24 17 25 17 26 17 27 17
28 17 29 18 0 18 1 18 2 18 3 18 4 18 5 18 6 18 7 18 8 18 9 18 10 18 11
18 12 18 13 18 14 18 15 18 16 18 17 18 19 18 20 18 21 18 22 18 23 18
24 18 25 18 26 18 27 18 28 18 29 19 0 19 1 19 2 19 3 19 4 19 5 19 6 19
7 19 8 19 9 19 10 19 11 19 12 19 13 19 14 19 15 19 16 19 17 19 18 19
20 19 21 19 22 19 23 19 24 19 25 19 26 19 27 19 28 19 29 20 0 20 1 20
2 20 3 20 4 20 5 20 6 20 7 20 8 20 9 20 10 20 11 20 12 20 13 20 14 20
15 20 16 20 17 20 18 20 19 20 21 20 22 20 23 20 24 20 25 20 26 20 27
20 28 20 29 21 0 21 1 21 2 21 3 21 4 21 5 21 6 21 7 21 8 21 9 21 10 21
11 21 12 21 13 21 14 21 15 21 16 21 17 21 18 21 19 21 20 21 22 21 23
21 24 21 25 21 26 21 27 21 28 21 29 22 0 22 1 22 2 22 3 22 4 22 5 22 6
22 7 22 8 22 9 22 10 22 11 22 12 22 13 22 14 22 15 22 16 22 17 22 18
22 19 22 20 22 21 22 23 22 24 22 25 22 26 22 27 22 28 22 29 23 0 23 1
23 2 23 3 23 4 23 5 23 6 23 7 23 8 23 9 23 10 23 11 23 12 23 13 23 14
23 15 23 16 23 17 23 18 23 19 23 20 23 21 23 22 23 24 23 25 23 26 23
27 23 28 23 29 24 0 24 1 24 2 24 3 24 4 24 5 24 6 24 7 24 8 24 9 24 10
24 11 24 12 24 13 24 14 24 15 24 16 24 17 24 18 24 19 24 20 24 21 24
22 24 23 24 25 24 26 24 27 24 28 24 29 25 0 25 1 25 2 25 3 25 4 25 5
25 6 25 7 25 8 25 9 25 10 25 11 25 12 25 13 25 14 25 15 25 16 25 17 25
18 25 19 25 20 25 21 25 22 25 23 25 24 25 26 25 27 25 28 25 29 26 0 26
1 26 2 26 3 26 4 26 5 26 6 26 7 26 8 26 9 26 10 26 11 26 12 26 13 26
14 26 15 26 16 26 17 26 18 26 19 26 20 26 21 26 22 26 23 26 24 26 25
26 27 26 28 26 29 27 0 27 1 27 2 27 3 27 4 27 5 27 6 27 7 27 8 27 9 27
10 27 11 27 12 27 13 27 14 27 15 27 16 27 17 27 18 27 19 27 20 27 21
27 22 27 23 27 24 27 25 27 26 27 28 27 29 28 0 28 1 28 2 28 3 28 4 28
5 28 6 28 7 28 8 28 9 28 10 28 11 28 12 28 13 28 14 28 15 28 16 28 17
28 18 28 19 28 20 28 21 28 22 28 23 28 24 28 25 28 26 28 27 28 29 29 0
29 1 29 2 29 3 29 4 29 5 29 6 29 7 29 8 29 9 29 10 29 11 29 12 29 13
29 14 29 15 29 16 29 17 29 18 29 19 29 20 29 21 29 22 29 23 29 24 29
25 29 26
Test
Case
4
98
38
22
31
15
40
25
32
0 24 0 31 0
2 39 3 22 3
7 31 7 40 8
11 36 11 38
39 16 40 17
21 23 21 34
39 26 33 26
30 35 30 38
37
24
29
11
23
21
40
30
0 38 0 39 1
3 32 3 37 3
8 32 8 38 8
39 12 23 12
17 27 17 35
39 22 40 23
27 31 27 37
40 31 32 31
26
40
39
34
17
31
27
36
1 29 1 32 1 40 2 14 2 28 2 29 2 37 2
4 12 4 38 4 39 5 20 5 32 5 36 5 39 7
9 21 9 33 10 18 10 36 10 40 11 14 11
12 39 14 38 14 39 15 23 15 32 15 38
40 18 21 19 26 19 39 20 34 20 38 20
23 33 23 35 23 38 23 40 25 37 25 38
39 28 32 28 39 29 30 29 38 29 40 30
31 40 32 39 33 37 33 40 34 40 35 36
Test
Case
5
129 0 44 0 47 0 50 1 28 1 41 1 45 1 47 1 49 2 50 3 16 3 29 3 38 3 45 3
47 3 50 4 18 4 42 4 47 4 50 5 49 6 35 6 45 6 50 7 47 7 49 8 18 8 43 8
50 9 13 9 46 9 50 10 41 10 42 10 47 10 48 10 50 11 43 11 49 13 30 13
36 13 42 13 49 14 41 14 42 14 49 15 16 15 28 15 37 15 47 16 25 16 39
16 45 16 50 17 21 17 45 17 50 18 34 18 44 18 47 18 48 18 50 19 32 20
36 20 42 20 45 21 36 21 45 21 46 21 50 22 40 22 41 22 48 22 50 23 43
23 50 24 44 24 49 25 44 25 49 26 41 26 47 26 49 27 29 27 32 27 46 27
47
31
48
43
27
50
36
48
48
32
49
43
27
44
37
49
50
32
45
44
28
46
37
45
30
32
47
44
28
49
37
46
49
33
48
44
29
41
37
47
45
33
49
45
29
49
38
46
48
34
46
45
29
42
39
47
50
34
44
46
30
48
39
47
46
34
50
46
30 49 31 40 31 43
49 35 49 36 38 36
41 44 41 50 43 45
50
December 14 Question 2
Due on 2014-12-23, 05:30 IST
Given a number, print it in the Indian way of
writing the numbers with commas. In the
Indian system the rightmost comma is placed
after three rightmost digits, and then a comma
is placed after every two digits from the right.
If a number has less than or equal to 3 digits,
then do not put any commas.
For example:
1001921900000 -----> Indian System:
10,01,92,19,00,000
31000 -----> Indian System: 31,000
100 -----> Indian System: 100
12000000 -----> Indian System: 1,20,00,000
Input:
A number with at most 50 digits.
Output:
A single line with the Indian style of writing
the number with commas.
Sample Input 1
1021111
Sample Output 1
10,21,111
Sample Test Cases
Input
Output
Test
Cas
e1
21323141124124
2,13,23,14,11,24,124
Test
Cas
e2
93184915910001
9,31,84,91,59,10,001
Test
Cas
e3
3241738742310515910510951059105
10
32,41,73,87,42,31,05,15,91,05,10,95,10,59,10,
510
Test
Cas
e4
2143413415151513515
21,43,41,34,15,15,15,13,515
Test
Cas
e5
1000
1,000
December 14 Question 3
Due on 2014-12-23, 05:30 IST
n prisoners, numbered 1 to n, are standing in a circle to be executed by the Roman army. The centurion will start with
start with a prisoner, skip the current one, and execute the next. The execution proceeds in a clockwise manner. At
every point, the next live prisoner is skipped, and the prisoner after that is executed. You have to print the prisoner
who will survive at the end.
When n=4, the execution proceeds as follows. First 2 will be executed, then 4. After this, the next prisoner, 1 will be
skipped and 3 will be executed. So the survivor is 1.
Input
A single positive integer <= 1000 representing the number of prisoners.
Output
The number of the surviving prisoner.
Sample Input 1
4
Sample Output 1
1
Sample Input 2
3
Sample Output 2
3
Input
Output
Test Case 1
Test Case 2
Test Case 3
123
119
Test Case 4
89
51
Test Case 5
742
461
December 14 Question 4
Input
Output
Test Case 1
2 17
Test Case 2
311 313
Test Case 3
43 907
yes
Test Case 4
971 977
yes
Test Case 5
3 79
yes