def main():
    ll = linkedlist.array2linkedlist([1, 2, 3, 4])
    for i in recursive_reverse(ll):
        print i.data,
    print ''
    ll = linkedlist.array2linkedlist([1, 2, 3, 4])
    for i in reverse(ll):
        print i.data,
    print ''
Beispiel #2
0
def main():
    ll = linkedlist.array2linkedlist([1, 2, 3, 4])
    for i in recursive_reverse(ll):
        print i.data,
    print ''
    ll = linkedlist.array2linkedlist([1, 2, 3, 4])
    for i in reverse(ll):
        print i.data,
    print ''
Beispiel #3
0
def main():
    node1 = linkedlist.array2linkedlist([7, 1, 6])
    node2 = linkedlist.array2linkedlist([5, 9, 2, 3])
    node3 = add(node1, node2)
    for i in node3:
        print i.data
    print ""
    node1 = linkedlist.array2linkedlist([6, 1, 7])
    node2 = linkedlist.array2linkedlist([2, 9, 5])
    node3 = reverseadd(node1, node2)
    for i in node3:
        print i.data
def main():

    node = linkedlist.array2linkedlist([1, 2, 3, 4, 5, 6, 7, 8])
    print kth(node, 1)
    print kth(node, 100)
    print kth(node, 0)
    print kth(node, 5)
    print kth(node, 5)
Beispiel #5
0
def main():

    node = linkedlist.array2linkedlist(
        [1, 2, 3, 4, 5, 6, 7, 8, ])
    print kth(node, 1)
    print kth(node, 100)
    print kth(node, 0)
    print kth(node, 5)
    print kth(node, 5)
            node = node.next
        else:
            if last:
                last.next = node.next
            node = node.next

def remove2(node):
    """without buffer"""
    while node:
        node2 = node.next
        last = node
        while node2:
            if node2.data == node.data:
                last.next = node2.next
            last = node2
            node2 = node2.next
        node = node.next
    pass

if __name__ == '__main__':
    node = linkedlist.array2linkedlist([2,1,2,3,5,7,23,2,6,3,5,7,2])
    remove1(node)
    for i in node:
        print i.data,
    print ""
    node = linkedlist.array2linkedlist([2,1,2,3,5,7,23,2,6,3,5,7,2])
    remove2(node)
    for i in node:
        print i.data,
    print ""
def main(n, m):
    ll = linkedlist.array2linkedlist(range(n), True)
    ll[-1].next = ll[0]  # cycle
    node = loop_delete(ll[0], m)
    print node.data
Beispiel #8
0
def main():
    node = linkedlist.array2linkedlist([1,2,5,6,7,3,2,4,9,24,2,3,54,67,0])
    partition(node, 6)
    for i in node:
        print i.data,
Beispiel #9
0
        runner = head
        while l1 and l2:
            if l1.val > l2.val:
                runner.next = l2
                l2 = l2.next
            else:
                runner.next = l1
                l1 = l1.next
            runner = runner.next
        if l1:
            runner.next = l1
        if l2:
            runner.next = l2
        # print head.next.data
        return head.next

if __name__ == '__main__':
    l1 = array2linkedlist([3, 5])
    l2 = array2linkedlist([1, 2, 4])
    if l1:
        for i in l1:
            i.val = i.data
    if l2:
        for i in l2:
            i.val = i.data
    s = Solution()
    r = s.mergeTwoLists(l1, l2)
    if r:
        for i in r:
            print i.val
def main(n, m):
    ll = linkedlist.array2linkedlist(range(n), True)
    ll[-1].next = ll[0]  # cycle
    node = loop_delete(ll[0], m)
    print node.data
Beispiel #11
0
            node = node.next


def remove2(node):
    """without buffer"""
    while node:
        node2 = node.next
        last = node
        while node2:
            if node2.data == node.data:
                last.next = node2.next
            last = node2
            node2 = node2.next
        node = node.next
    pass


if __name__ == '__main__':
    node = linkedlist.array2linkedlist(
        [2, 1, 2, 3, 5, 7, 23, 2, 6, 3, 5, 7, 2])
    remove1(node)
    for i in node:
        print i.data,
    print ""
    node = linkedlist.array2linkedlist(
        [2, 1, 2, 3, 5, 7, 23, 2, 6, 3, 5, 7, 2])
    remove2(node)
    for i in node:
        print i.data,
    print ""
Beispiel #12
0
        while l1 and l2:
            if l1.val > l2.val:
                runner.next = l2
                l2 = l2.next
            else:
                runner.next = l1
                l1 = l1.next
            runner = runner.next
        if l1:
            runner.next = l1
        if l2:
            runner.next = l2
        # print head.next.data
        return head.next


if __name__ == '__main__':
    l1 = array2linkedlist([3, 5])
    l2 = array2linkedlist([1, 2, 4])
    if l1:
        for i in l1:
            i.val = i.data
    if l2:
        for i in l2:
            i.val = i.data
    s = Solution()
    r = s.mergeTwoLists(l1, l2)
    if r:
        for i in r:
            print i.val
Beispiel #13
0
def main():
    node = linkedlist.array2linkedlist(
        [1, 2, 5, 6, 7, 3, 2, 4, 9, 24, 2, 3, 54, 67, 0])
    partition(node, 6)
    for i in node:
        print i.data,
Beispiel #14
0
    def detectCycle(self, head):
        if not head:
            return

        n1 = head
        n2 = head

        while n1 and n2:
            if not n1.next or not n2.next or not n2.next.next:
                return
            n1 = n1.next
            n2 = n2.next.next
            if n1 == n2:
                # print n1.data
                break

        n2 = head
        while n1 and n2:
            if n1 == n2:
                return n1
            n1 = n1.next
            n2 = n2.next
        return

if __name__ == '__main__':
    s = Solution()
    n = linkedlist.array2linkedlist([7032,15013,6890,8877,11344,320,13037,9414,6817,1566,14907,-2756,9931,-4488,11602,4887,1239,6231,-5366,8501,1142,-1367,-4140,-5460,15554,-4686,12603,1471,5378,15246,11273,13817,5814,3846,12556,1024,3348,13880,14906,14002,9863,8177,-2043,15882,11985,13339,4277,-2059,581,2628,5101,6794,4636,9550,-6947,-5352,1854,3064,5149,-5342,-7716,5203,3842,6401,6644,3565,15758,-1451,4993,13767,7789,9944,5132,-3127,-5734,2149,5437,3967,12988,-5397,8306,-4744,-6542,6952,6653,-7588,-345,7975,-1608,-4125,-108,5960,-56,3410,9927,-7835,-2576,-1390,1154,13654,-6793,14489,14739,15465,12843,14656,9998,-4416,10104,4804,1556,9350,5791,8999,-4762,12242,13264,-7520,10069,4058,-2512,15701,2663,-2845,13834,-7731,2176,6491,16008,10067,1898,15861,9934,10788,3358,6423,-7036,10398,-1460,594,-573,-3391,-3095,-3940,9549,13679,-3841,9564,-4596,10625,8753,-4429,-4085,1421,7715,-3544,6997,5974,6788,7438,7242,2765,10202,13904,-2925,11692,-2441,3938,14650,-2896,-5260,4662,10609,7075,-2022,15907,464,2044,14045,12870,-2546,-4893,13733,13590,14697,-7190,15540,569,10869,15050,-7747,7707,-6871,7459,6402,9260,-6298,1793,10826,9959,2771,-4703,13906,14181,-4960,-2680,-507,7196,15828,-4096,14023,-3265,-4492,12808,-258,11700,-4667,4321,13382,-2940,180,14907,-424,-3093,1215,13189,14936,6161,-1730,6783,1775,9164,-3637,-4981,11420,-5504,13435,-2134,13739,2382,3423,8390,-2107,4178,1808,-387,-4254,667,-973,7616,-6542,6263,10049,-2974,-5952,1479,15631,5470,2588,9579,6108,11561,1425,-6071,5259,4881,11130,15191,3066,6021,7378,-3866,6955,11761,-7086,14383,-7788,15588,-5370,-7198,-3040,1594,8564,5000,11453,10854,1735,15528,13504,4656,10885,10600,3781,11522,12687,9369,259,6835,13900,15690,-4397,6554,583,5555,1544,-6104,5930,4865,-1092,5856,7881,14355,15362,6095,9197,5905,-1736,-7548,15965,10400,2607,-2405,11548,11811,9387,6688,5716,12586,-897,-7593,8834,14696,668,3667,1063,-320,11893,9511,15182,9847,886,8508,-621,-7058,-6554,7779,-3182,3110,14239,7495,3321,3775,10645,-6678,358,1314,10553,7128,277,-1761,-5881,-1190,1912,1987,9058,12597,-7272,9278,7344,-5102,-7637,8801,12405,10816,14672,-1213,-1503,15660,14438,80,7149,-521,-1271,15834,-1456,4490,-588,3291,-1050,-1355,5505,1894,-5996,9716,13403,13135,-1149,4619,-2892,-6492,5752,-2252,-2381,2737,-3156,8401,3737,-6200,-6317,9853,-5430,-2323,14840,98,-3075,8473,-7191,1668,-6515,11492,2692,10903,2177,9093,13891,4648,5719,6209,-387,6609,3886,12638,-6936,12750,3462,14947,-1779,6423,-4305,-1096,-6136,10748,3097,3123,-4575,14325,5639,2898,6758,-1609,-7131,15483,8956,4284,3,-4744,15047,-6248,14096,12473,7661,1676,1011,-7016,-3620,-2627,3463,2012,6899,7050,1087,5070,-1869,8032,-253,11942,1700,-943,1336,3647,9608,13003,9566,1544,7851,-2480,-2597,-413,-1285,15651,9040,7423,2318,8365,762,8463,-81,-1664,11421,9250,-6386,8673,2172,1700,-539,5525,2190,-5696,8021,6499,2539,1803,15442,3181,7661,9269,1921,-1381,-6728,1031,-2056,-7001,1911,10050,7552,10873,15603,-4489,9096,2946,688,-4814,-6338,5387,-3490,-4096,13287,-733,4524,9540,3119,-5535,8398,8905,6603,3182,12521,2590,2351,9181,-7750,-7917,8258,-7843,2127,2641,-5464,9111,14987,-4995,-2476,9175,15247,12566,-1091,8199,-2632,-3310,14244,-6736,-3350,12761,-5108,7886,612,-4078,951,9049,-5646,13100,5665,-1463,15311,-1971,-4359,7707,6418,12968,9069,8523,4413,4573,5212,7233,-3245,-2653,-979,-7419,-336,8608,-1137,15442,11097,-5408,7207,9126,8702,8043,9261,4939,12841,-1369,2433,14381,9192,14239,15544,3077,-1056,-5565,14900,8747,2970,3187,13304,10173,5048,12127,5276,960,12910,4482,-7767,15219,4407,4121,12408,-3473,15187,-4177,1530,1019,706,3592,-934,8538,-7422,9169,-4861,2513,72,-760,-7794,-4267,14775,-5279,9024,248,5187,11962,10602,6297,13704,13940,-1076,4684,-6916,14347,-5737,-5480,3085,15171,-1009,5425,13310,6540,-4022,-5110,-61,-1710,-4470,-3722,7192,8016,-3485,-5251,-2986,11626,-4847,15782,6560,-331,1126,-3068,-1622,12133,12912,7326,7182,10535,-2671,6605,7126,1569,-6421,9763,-4028,-5209,-2777,-89,9841,932,-7642,9941,10136,11877,-4705,14881,-5262,746,314,3268,-740,-5276,14313,11533,10440,15136,-404,-160,7055,4898,4101,9264,-453,11885,260,-979,1989,6581,14864,12119,12382,3182,10638,2382,13449,3430,7888,585,3668,-4482,12238,14721,9882,6050,15844,14141,10276,-2004,-1259,-2040,-6303,-4876,14586,2476,-3168,12976,-5487,-3733,12957,8010,4150,-3217,-2175,10450,5321,-2138,9021,-2084,13804,2610,7353,-4415,-2644,-6334,9884,3488,-6132,-1737,-7495,13690,9862,13249,-5296,6851,12564,-1360,13367,10511,9765,7068,-6927,-5742,-4634,8305,9488,-1382,-2064,-7538,2270,3345,-570,6147,6992,10523,11145,14804,-7392,9237,13358,10956,10976,-558,-1553,-1741,1776,-1021,13577,1738,11201,8287,5787,13112,1652,-6685,4686,-5527,269,-7415,15212,-4788,-4206,9635,5944,-2111,-1651,7219,-5379,-1787,-111,-3976,-2082,13781,15693,-3582,13998,3228,-1691,1549,13248,13317,-6191,-306,3264,14228,15556,-4169,15835,4166,15654,-459,15856,2882,744,10737,-6886,2157,-6533,6876,9557,6,-1424,13425,7789,8489,6616,13522,7693,9833,-4686,13958,13058,-2120,5401,1130,-3186,4837,13934,-153,2557,8475,5581,8669,140,-2525,14958,13121,-3257,15964,-2906,-6801,439,13913,14983,13752,9494,-2934,13579,12250,2467,2545,-7731,-827,1740,-5330,-2858,12118,-1308,7314,9926,-1665,4206,-3576,6302,-2935,13448,9132,7872,-5083,4658,14386,13397,9635,14507,-3907,13037,10043,-275,4117,-630,8841,15444,5323,11935,837,6727,1830,-1862,1971,8320,13540,3904,5268,-5332,4802,12602,7774,378,777,12062,5200,8012,9710,11469,2483,-5497,7395,13882,4489,8486,902,862,-7270,4350,2961,-3558,5989,-2158,-7997,14438,11439,6638,7966,8961,-2067,11610,-1087,10169,9746,-7632,6832,-6472,8232,3583,-1166,4910,6796,-7635,10412,10439,9099,11806,7876,6625,-2168,-4154,10967,15085,15116,11888,1231,12527,12304,13236,10023,13580,-4059,-3912,5637,-7307,10097,11994,10847,-3605,-3210,-2337,-5893,15855,14648,9747,4373,-5510,2254,11024,12316,1287,6406,2073,2571,7901,12785,-5051,-7371,-7582,4715,-6947,6633,9139,3325,3055,-1694,13390,5301,-1482,3099,4826,1122,11974,14061,6270,497,2245,15890,13640,-6825,6499,-6390,11417,11397,5101,4815,1701,10737,-3579,-6571,-710,-4464,-6762,3238,14067,13104,-6190,8484,-3565,5009,651,-4411,5053,3904,-7055,-2564,6080,-7809,11694,4877,11356,15939,14846,-6528,-1305,-1617,10610,3591,14048,2321,11255,15721,752,13368,1028,9357,-3187,2532,7419,9856,7496,12633,1481,12262,9155,6317,12382,8956,15786,15931,12451,-541,4593,-1378,818,11775,15676,-1452,15086,2635,12860,12925,2020,14014,1671,11330,6687,13231,-5033,-1170,-2685,-6128,15223,-616,9434,-847,5230,2040,14199,-3716,-748,-7634,758,-5776,6070,-115,6220,12113,-1306,-3513,-6720,10621,3880,4010,3401,12050,7909,15615,4452,-5725,-736,147,-7525,5067,-3569,3450,-769,281,4480,13913,11434,539,4843,-1637,-4633,8904,14456,-3222,16,10928,1385,-264,7895,-1889,4131,3542,14778,8694,-3435,-6125,-7890,8259,8511,-3954,-2549,-2839,-222,1978,8879,10483,-4367,956,15695,10582,-2538,232,5800,12731,-1023,1324,11426,11933,12754,-4825,11439,1328,3541,-6048,11933,-1664,-6686,-6279,3519,-5536,14445,-2900,11418,-1966,471,-5116,-4255,8997,3584,13584,-3323,15943,6586,138,-1384,5191,6725,-5692,-1710,7046,-3063,6441,2760,-4391,-917,10698,3731,11400,1557,-955,-6260,-1118,8124,13361,15117,-479,5112,-2876,1385,5658,11542,7125,15055,970,1288,10367,316,-6448,15225,12022,12940,-6725,-5995,2502,11901,8253,-855,15078,13740,2781,-1531,-6480,-82,9351,-7563,15476,13692,9183,14092,2176,11718,528,9203,3613,5055,-2766,6746,13199,14138,10592,6086,6207,-5402,14143,-1346,15340,14377,-3649,-3235,-2751,6099,-2372,1294,86,3147,9643,-4833,-979,-2698,-638,-5090,9467,6541,716,3302,4900,7323,-1954,-1915,10104,3833,-4432,3562,5180,8683,11696,11606,16043,1998,-5439,-7194,11714,4581,12659,2295,-561,10374,15726,-182,8774,12370,3979,-4379,-1507,9304,545,6662,-6957,-5083,-2132,4351,10499,-6187,12890,5401,-853,11153,14725,2040,1031,-7086,11283,-1885,-7754,13993,15763,6670,4003,7633,1006,7838,10153,14525,5051,-7545,9523,12078,365,-6502,8310,-3189,9710,8474,6033,-4186,-3532,6978,-261,-1900,12296,12405,-4740,13857,14023,3958,13005,-192,5490,15264,3084,-1081,8449,11014,-4538,-5331,499,421,7092,-2385,15186,15795,14411,15200,8871,1347,7554,-2187,-1656,-7869,4578,-2103,9348,12498,11720,4525,13956,14704,-5625,3616,10138,-200,13488,14592,2748,-2918,3401,11522,12997,-1756,15449,3390,10623,11964,-851,-7511,13245,-2803,-4257,6441,5454,-3372,523,-3301,10434,9456,11205,-4333,-6519,3089,5477,5426,-2330,-6035,10079,-3918,11979,11789,10596,10792,9750,1684,-6986,3985,4690,5395,13556,4985,10071,15508,-7285,5834,14601,12985,-4170,-4661,-5130,10594,14774,12505,15981,-7149,13081,9613,10884,121,-1546,13037,8887,13814,13223,5553,-5327,-7005,-5116,4306,-2462,14840,-5095,-5012,-62,13484,-7004,10518,9459,12131,3850,13754,10479,8572,-7530,9797,4409,1341,-3628,2638,-4738,11406,1206,8741,5157,4074,-8008,-3816,10582,2471,-7832,-361,-4595,7314,-6678,5363,4233,-716,-6029,14637,10180,15776,5705,15957,3216,-4083,14140,12464,3980,1404,-4971,5220,3159,-3734,9632,14620,2943,3509,4844,8474,13332,-2211,5803,5968,9947,-4393,-225,-4371,15148,10604,13629,-3390,13959,5341,12117,1661,9665,-3103,5118,10462,8052,4458,-3006,-7811,195,7787,-252,10781,3535,10797,-3621,5454,-1551,14570,7137,9169,-6532,-4285,5855,8909,-2158,1384,-5877,-3040,7717,9474,-474,-4489,-6068,-7318,-2680,-630,-6443,15584,-4686,424,-2371,10027,1494,11704,13882,11735,8209,3944,8276,-3348,-1929,15682,9993,1367,10456,10015,-1342,14262,-982,-5708,1231,9623,-2771,-5300,7017,-3099,7058,13448,6832,9642,-5050,12977,10754,-1571,15967,12353,12983,2995,724,3573,-484,999,2967,12232,-138,12102,-2757,6511,-2991,14856,5355,-3651,2795,9322,6147,-1236,-7655,3752,436,2257,11458,1269,7622,-5451,11038,13895,1626,5162,14356,11954,9377,10618,-4500,-7928,-7253,-132,7149,14200,-607,-3663,-2886,14418,10457,4742,799,2372,13742,-972,9270,4137,-3672,12992,-4357,-5487,4065,10781,7381,3762,613,3822,-4693,11853,7927,5000,12694,4821,-2670,6152,13862,3665,1902,-4247,-7849,-4387,13794,7885,13010,14714,7666,-3292,9382,-2870,95,10960,9181,14412,-7068,5311,5867,-1098,69,2082,-5537,7108,7265,14994,-760,4406,9099,-473,180,-3662,11749,10743,-6331,-1229,12712,-6156,7111,-93,15639,5660,13757,-7031,15065,6885,10313,11743,-3296,13695,14724,4393,14649,2787,-3300,12064,-1455,-5738,5140,11995,-4975,1639,4981,7412,8740,-5428,14858,-7871,-436,15760,12090,14223,-2934,-1231,11041,-7886,8831,-1446,11651,13122,2817,14590,10909,10601,-1574,-6414,13703,14725,4001,-5735,13020,15541,-6738,6957,13023,8772,4320,-2891,14657,-4437,12533,-1156,-6948,-1958,8155,9228,12422,7764,5249,8669,15042,6708,9990,-7840,1343,9626,14754,1096,-5065,1234,-4116,7694,13561,-511,12896,-833,4921,10592,-2506,-4269,2474,15089,6101,-6350,5352,1175,8809,5306,14248,121,16055,6809,-126,12863,14947,4528,8176,8365,8394,9836,5872,5234,11451,-2273,15757,-2726,4777,3732,-540,-5413,-1939,-4243,8341,-7709,-7539,10673,2320,9877,-3887,10394,4352,11321,-7813,9305,4489,9584,5251,4508,11661,14552,13330,986,9965,-5837,13315,1720,-7425,10548,11194,4772,1485,9452,12281,-6898,-3649,10226,-5089,-7245,-2118,3044,-1321,9120,-489,783,6341,6170,975,3064,9941,13338,4764,14195,2563,-4924,15248,8902,-7348,-4780,2626,6416,4890,-1740,13371,-5354,2621,-5349,2711,7455,15524,13657,12462,7825,11342,13468,1373,-6425,7399,-1532,8084,-6591,9784,4037,4065,8843,-5103,2897,14908,13866,5759,15637,13375,15639,-4636,3094,10441,2389,-3586,1621,12778,2724,-6457,3062,6528,9915,10176,-7126,3751,-7792,15011,-6131,15654,835,4175,4089,7012,4173,-119,13333,-1503,4220,8758,9523,5666,13075,-2896,-2196,-7434,9713,-6112,8395,-3534,-7364,1599,-7148,7374,1284,4431,6115,7206,15755,918,10131,-1866,8410,12432,6463,5542,7100,15469,13145,14506,-5299,6861,14505,-860,11787,14906,13,-6060,14594,-1044,12368,13617,-2131,-5034,-4717,3185,-898,-7304,6269,3003,-6705,8301,9319,2435,4149,3476,-6251,15835,-5126,10431,6306,14615,-6367,7026,5413,910,11340,-768,2789,-6166,10,1132,12911,-5723,15646,5351,4673,214,-3183,9076,8353,-1092,-7459,10294,9371,2964,11043,4406,-394,-1860,-6897,3181,-1514,-2104,1434,-3147,620,13802,8651,-3566,11885,-4852,2176,11016,-3723,2173,8316,-264,11354,7033,15964,14966,946,3099,-3052,5063,-7263,-6229,722,13281,75,-4417,-7402,12648,-94,11188,11664,-5533,444,10224,4503,12235,-6746,12004,-6540,15024,11503,2083,7696,-1251,3224,1814,1230,-1223,-4923,9245,8900,-3770,-1266,-5790,7176,-6332,-5921,-7379,10274,6422,12509,8567,1501,12710,-7860,-856,12004,5357,-2628,-3465,-5800,7496,10074,2553,15531,11574,-2643,9993,6344,4849,1203,15256,2845,10712,-296,16018,10703,14980,10299,-451,5756,13801,9019,-6248,12167,-276,-2466,2019,-3205,7006,2513,946,-146,-3215,-5454,3874,-7698,-7693,15122,-2540,-898,5286,-1675,12616,3775,1412,7549,12623,575,-2990,657,-2073,14946,14040,13333,-6182,4203,-1229,3564,8227,6471,3118,-835,3808,6137,13317,14284,13340,16055,9467,9990,10075,9942,7185,-1011,-1647,12035,9104,10741,6528,14918,-4829,13665,-4965,1214,12573,12810,13264,-6867,5428,6372,2052,6188,11696,12233,15852,-1121,7571,5095,-1124,7287,1677,6358,7824,1743,-4340,10886,-7479,15857,4118,10393,13126,8248,1791,6287,15534,-251,-5494,1989,5451,13869,-545,7613,4604,7125,3856,8670,5496,2648,-3628,-4420,-7816,13647,-1164,3835,-3916,-4273,3781,-4170,1825,9518,-1447,11012,-3737,7770,-4425,-373,14377,12300,-64,-567,-1578,-4117,-4724,-2602,-590,7500,2662,-1384,-6456,-3159,13942,15358,-5351,-3561,2047,3052,-6711,14432,-4475,4984,6293,4089,5257,-3824,12983,8388,12206,-7155,-6074,-4891,11759,-620,5577,4579,15708,12545,6773,13402,9787,1362,4378,-7538,8544,5890,12880,4221,6766,-1857,10842,13011,10846,6027,3653,13761,-1608,6680,14228,10723,13362,566,-3248,-7764,-699,-5306,13626,-5876,11089,-2048,14632,7195,4690,13102,-4716,4162,-7906,-5756,11159,897,11419,3537,16048,6956,13257,9019,5712,4458,-7835,-6816,3594,-1271,4060,6486,-1103,7904,-951,-316,11657,-6090,2286,10439,14080,12274,-3156,-2546,9215,11429,3270,-3792,-5586,13210,9172,10619,4203,8175,4406,-7384,-2678,1345,-5477,8876,-6036,-1590,8516,-3244,1819,8227,11633,7945,13189,-3332,2526,-4371,9801,-447,-2509,3325,-7258,3200,-1522,11130,-4508,-844,-930,387,11832,13803,13824,8359,-6942,-3115,13206,15420,15019,4524,15492,-4616,13142,-4837,1253,5473,3570,-4117,11953,12347,14140,1055,-4590,5358,4098,14174,-4973,8839,15164,-2714,-854,388,7392,9182,8565,10969,-7445,13576,10940,4872,-7724,12241,491,2288,5470,-7214,1349,-4820,4023,-3419,10812,10028,4016,4323,12518,14290,-5587,12149,8557,-4415,15967,-6849,-3467,-1189,3159,2835,3778,4975,-2077,-4268,4053,-4237,13303,7106,-1153,3704,8842,3461,14065,13814,3530,-431,-386,-5541,11895,-5525,-5056,3858,1556,12736,14609,13154,3028,-145,-4729,1345,3370,-1315,13236,-7535,-3066,9253,13288,-3557,11350,10622,-7981,6819,14226,4416,-4097,13523,12851,7426,-6296,13559,15078,-6233,10503,-2633,7923,4769,11949,11682,-5872,2114,3221,6323,4948,2709,10848,7128,9691,12835,7954,3475,4229,8623,2873,7594,13981,1821,12537,-108,-4381,6208,552,-7338,9110,9904,15307,13329,-882,-4525,-4463,4679,10029,1111,4581,-763,10044,5856,12907,9135,7137,8713,-1906,9297,4538,-5391,10956,937,-511,729,14649,5829,-300,2388,-67,3288,4134,13365,-4434,10434,-652,-5388,1777,4593,12230,13832,12081,12515,3666,5953,13508,10595,11466,-2970,5052,2989,4515,12165,15406,6739,-7386,-4735,-1297,3776,15220,7076,7144,7852,-6877,13134,15635,-1895,1729,198,-3745,-4601,-1901,-5755,12958,11956,2385,-2181,3013,-6485,5032,8955,4494,-364,-4076,457,13902,3857,11173,7481,-167,-1565,10143,3089,15013,-1870,9212,8046,11136,-4433,-3531,-5679,-7413,-3058,7155,-4460,1173,2075,2170,15902,12952,8065,-2588,2394,-151,6693,5191,6712,-2100,7534,469,-6719,-4622,-1002,-1220,676,5195,8621,-6566,8635,1989,8003,-6310,-7962,-306,1980,15937,5021,-5661,4680,-4644,14909,-6963,14247,-5104,9473,10558,-4065,-4144,-6432,199,2155,8773,-1832,15116,-3489,-5610,13662,9207,-5999,12428,577,13637,9357,-1407,14756,6349,-4861,11591,-7674,-5476,9373,-3707,13777,1751,1460,5450,4911,5118,12737,-1927,12486,-5713,4304,13330,10160,4585,-2880,-8010,2535,13363,13156,-6304,3756,5764,6422,-7306,2602,3378,2742,3545,11183,12910,-4774,-6797,14973,13915,-7257,11496,13547,7434,6106,9244,10728,11043,14529,4968,2099,-6148,7883,-570,-665,-3237,10084,-82,1046,10701,9023,7059,14305,15914,7748,-6130,2838,-1324,3303,11715,-953,-2723,14296,10847,-4173,14435,-7195,3218,-6580,1253,15102,10056,1205,2571,3066,-6009,14939,6543,-7434,-1960,-5122,12152,14799,3157,127,4562,3858,4968,-1589,-3801,5667,-1060,13638,-2581,3861,9762,11125,14882,2193,3775,-4695,-7270,-5584,13370,9817,6489,3376,-6375,-5616,-3086,-5618,-677,10629,2178,1289,-1568,-146,5650,12096,13341,11894,13536,-5839,-1312,10804,12333,-6247,10404,7586,13898,15089,-3142,7215,-7420,-6846,2203,12267,-1593,15314,9209,2829,-6902,296,7574,9619,3734,15873,-6210,3892,-2926,2743,-759,5237,9178,-4684,-6873,-5304,11984,-3458,-6271,4187,3197,2433,15010,624,3064,-7193,-4580,-4524,-1300,-4794,14637,-1849,6845,167,-1896,13891,1617,-6082,1054,-444,-6619,2613,-681,3196,-854,3987,-1924,-8008,6768,-5162,-5475,11318,9062,-2346,12320,8460,-6914,-6324,-3834,9997,2101,12387,-5150,10544,-2573,-5239,11541,13946,-3462,-7688,-3971,-1738,15466,10033,12998,9015,-7079,6943,-2996,2906,4114,-3732,-2639,-3657,-3841,-6184,13583,1115,13651,7053,13532,8315,10492,4748,5173,-5508,2760,5999,13083,7745,-2671,2028,5899,11227,1827,-5389,6418,4640,11124,3119,-6373,11763,-2768,4158,10741,-4425,9245,-5057,-1912,3642,14821,1704,4332,9673,-7767,12184,13352,-6142,-405,13409,9770,10224,2170,7768,3664,-5531,2453,-541,-1243,1988,7844,-5844,-7345,7440,11466,-5355,9039,6361,-3678,-7564,6284,-5657,-6681,6754,-3009,15491,-4281,5322,-5583,-4957,-4908,10533,-5382,8171,5925,-349,-1030,12890,-1779,-950,-6079,8282,1885,7722,2409,-3284,2194,3128,4746,13379,3799,-2607,7052,10557,-3071,-1764,9877,-2876,-2599,15233,13837,6012,13629,7198,-1396,-862,12698,4964,697,-5660,6619,14637,15460,2548,11134,9248,5858,11090,1781,-8022,12118,3165,3560,-2768,-4706,48,7891,10257,8989,2670,12899,12164,4053,2274,3276,-148,2054,11215,12114,164,6323,-949,12219,-6310,298,9729,8825,-3581,-4031,12652,3678,3392,14008,-3120,2426,7565,15006,-1474,7341,-5670,4863,-2988,12673,5759,10748,-2779,5232,15842,-798,584,10454,6700,1042,4936,-7044,7006,12147,1586,9969,6993,10555,3680,2603,354,-5302,15767,14409,-3741,11901,-7582,14826,5392,-2509,-2678,11939,12033,-1153,1022,15414,6569,6188,9393,4443,-4292,-4640,4451,3374,10637,-2637,-4652,-7075,-6794,15437,8788,-7140,1462,14038,13779,-6041,11933,-3167,530,13960,3337,6976,7379,6779,-5819,1260,953,-729,71,3760,14201,-3146,-950,-1845,9810,-3103,-667,3104,-1988,-7438,-2221,2404,8472,7287,10019,-5280,-1519,15661,5643,5606,8227,-6078,-6010,9349,6131,14849,14736,886,-5257,7068,1791,4876,1378,-4650,12831,-6928,-3833,5375,816,-6058,8873,-5536,12291,9956,-2717,5772,3763,326,224,6189,14785,8647,11123,12655,-2237,-6137,10636,9375,9018,-6387,-4200,6650,2289,8658,11760,3499,-868,-2422,-3177,15781,5778,1453,9887,-2795,-4499,2814,9434,14663,2662,3143,-6787,1862,-968,-7408,9666,-6216,-4209,6477,8953,7737,-7010,8626,-2250,-2259,11252,-5945,8447,-830,-3292,-219,-5778,-439,4968,14203,-1195,3612,4283,-3792,6179,11086,10467,-7932,5877,4908,9900,-2034,5622,-6579,8754,-5525,2268,15879,-5293,4276,4016,-6170,1870,15866,9739,8566,8967,-1086,14603,10794,13556,5987,8221,-1035,11097,-4441,3807,-2793,-1529,109,8360,-6930,5154,6101,3927,11928,9455,-588,-418,4488,10393,-3541,11624,8218,3108,-2192,6852,7378,15389,1570,15076,6142,14245,-1102,3295,-6566,9725,989,6689,936,2536,-1319,-5867,-7625,-3855,14593,-6116,-7985,3981,15698,3532,3779,8844,-5434,-1248,9108,-5006,5039,-7138,-6418,-1902,7456,-6486,11997,9683,-4044,7867,8166,11031,13565,-1261,11939,2410,9936,3113,-5395,-5286,-379,-4949,15075,-7248,-7601,12260,15095,9512,12170,4069,9533,-4818,6542,14009,11354,4221,12762,9356,-5172,4693,9564,8926,12416,3546,13505,9798,5085,378,-2528,13889,12209,7730,1250,2501,-5903,6139,-3664,3828,-5187,-7605,7271,14450,1573,15147,11868,-7384,-1071,-1628,7888,10994,-5284,11622,6347,7123,7552,10157,4615,13838,8199,13013,-6898,12016,4490,8392,8877,9055,7772,12677,-7879,9991,6700,1060,1428,7238,1294,3946,-7785,-7434,13554,-6202,-3569,14399,10939,-4516,7358,-4383,13016,9036,4901,10978,9279,6270,9504,12319,12448,8408,-6628,7482,-5087,2413,8259,1187,15274,4300,5621,10371,-2785,10037,11397,5252,-6265,-6827,10353,13020,5990,6103,15997,11206,-1198,11679,2909,966,4787,3107,5635,8009,14405,-4457,6823,7178,-4648,9142,12906,1279,14066,8948,6344,796,-1652,-6073,6141,7115,12529,10323,-7005,9520,1124,10987,-4959,4222,-2813,-7206,14680,283,13099,14205,-1251,562,11053,3205,10177,8225,-308,-1131,250,-4188,15749,12553,-6732,1897,-7305,-7667,1730,-826,-4145,-4248,6532,13519,7505,4932,-853,12614,5991,6447,15331,6222,-1338,8980,15971,10681,9377,-5361,12710,3351,5820,11300,6230,6992,10815,3528,15712,11800,14161,4679,14980,14437,-2388,4500,-2413,10898,4879,13749,-1942,9374,13705,-4433,12803,4262,-7093,6613,1306,5666,12903,6427,10616,5937,13841,14218,2354,6974,2313,6636,-7711,7964,3293,-3345,7180,-443,10765,11336,12064,14191,8903,-2757,-1824,-6229,4426,1612,376,-5255,11701,158,8940,4710,12821,6332,-291,1091,6722,14071,7564,963,-2359,7779,-3128,5057,-5859,12513,-3292,-1656,12813,3289,10177,-4258,7625,-4259,764,9633,-7176,7308,-7551,13049,-7876,11200,-4940,5261,2883,-2797,-1020,-2779,786,-1346,8544,15802,10044,-3247,-1370,5865,14288,10816,10914,6672,2330,6156,14266,5416,14290,8694,-2894,13492,-3128,13526,2955,11638,9553,-4564,-606,-5860,-4889,15580,12329,-6794,8895,2205,-3880,-715,14840,8401,-8014,-1188,3883,15279,-5791,3204,11255,1170,5566,740,7890,9201,8214,9952,12966,3176,14316,6502,2925,3650,1280,-5360,4529,-7599,2496,4938,2865,9419,13416,-128,-5926,15750,-1756,-275,-5753,14602,-4011,1613,-1480,6865,4761,4755,5068,-3920,-4233,15535,638,-504,5831,14277,2985,8580,3696,10347,11145,3055,8382,11464,14343,8787,6795,15498,1642,14323,8343,5798,10688,-6824,-7452,13721,12085,-4725,11531,-5275,2132,-4230,12370,-6041,-983,-4172,-426,7585,12882,15948,15880,13843,10406,-2823,-1718,727,1266,13784,1411,-5095,1622,9236,9673,13680,12374,12619,12856,11482,6732,6679,-5650,-3288,12041,-1050,-1679,9155,1617,15917,-1754,6557,-728,-1078,12448,3120,11014,-2907,6862,7229,12953,-6007,15384,-1873,2802,10924,-3361,3064,10123,467,3429,5581,5919,762,-2302,-1050,4186,5213,-7085,-4046,3883,5507,1057,-465,8008,3467,-2900,11475,7460,-6861,7008,-7857,9142,-547,11180,15528,10673,5511,-5493,13085,-5742,-5607,4270,-1887,-77,6687,-4422,10010,-4119,5732,-3047,-4954,-6409,10307,7334,12410,5297,10446,4134,9018,14014,15333,10104,14264,15107,6680,-2781,13129,-456,-1893,13181,1977,13029,10134,2455,15744,-1413,5815,8355,7412,5158,-791,10821,8584,1139,4655,12163,3353,12158,-952,2274,-1042,10334,2873,12839,9678,552,13826,14412,1239,-715,8310,8294,5231,6695,-2847,6094,-7325,-5208,154,-3197,13621,14305,2735,1807,7172,14494,15949,9463,13200,11126,11238,11451,9787,-4285,15095,13789,13812,7623,9487,13933,1751,-6052,-4851,2400,-2972,10977,1387,11954,9505,12364,12025,-2759,10201,7381,4158,2925,521,2073,-6138,-3587,3826,13345,14728,12413,10908,9400,-6201,6614,12763,6607,1148,-918,12057,15523,12208,4383,4932,3919,10093,-3719,10562,3742,6400,10204,12247,-6939,14831,8839,13626,-2601,13482,5367,14986,3810,11061,15611,11199,5535,15267,-4438,15712,5355,-2715,12181,-4436,11938,-6954,4858,-22,-6581,-394,11553,-31,-3457,4562,15256,-1143,-4189,7418,-7538,-1528,1176,-1747,-5205,-5476,7248,10208,9205,338,705,1922,4871,3463,-1875,1233,6508,4278,1556,10180,15998,-2060,12553,3669,5620,9359,4149,9914,9181,14629,1647,230,13323,1259,12118,7572,6471,-4388,12863,5428,16011,15624,-5146,2415,6894,10330,-606,-1839,3534,11049,-835,9640,-1828,-1850,6935,15890,-4670,493,6572,8813,-4932,12482,-2202,-690,-1851,8065,-3670,9120,-2596,-3898,15090,4369,6389,2750,-1758,5540,-4709,6155,13716,3049,-125,-147,4254,-5841,9662,3266,10498,-2136,8515,-5183,-7566,7510,-2553,8632,-1418,14894,7012,5279,14007,5180,2539,9390,-485,11847,913,8860,2221,-1,12663,11228,13700,-2203,14482,3926,-2356,15067,15612,-1327,12556,-4857,12402,-5988,2423,-857,14021,-2252,182,3530,9044,-5387,-5418,8277,1440,10255,6047,-943,-5160,15896,-272,11989,-4647,-5127,1858,12448,-3096,6956,-5022,7761,4259,13326,7353,-3257,1191,674,-7902,8686,6609,11418,9419,14649,16049,4750,4357,2518,14374,14344,6454,431,11934,13234,14452,-2711,10842,5908,9766,8577,-838,-6051,14208,-5416,7971,15945,1666,-892,5967,3947,-3220,-1504,2465,-6946,10025,9750,-1518,10761,-4637,-4573,15839,-5173,-3144,6750,9568,12101,-5833,5029,2855,457,13889,2501,-3587,8123,14315,-457,7538,170,-1885,-3956,-6449,6579,-6027,4476,2964,327,-7548,-355,9277,8428,-1744,-1512,4568,-1091,14414,-483,-6136,9609,7920,-6677,-5079,-3746,-407,-1209,-4266,1987,-3860,5778,-7500,-7037,-6603,1407,13916,5508,-5875,13103,-198,8490,13374,-4180,14256,13920,-341,5807,11969,13614,8675,15224,11533,13964,640,2825,-1188,8773,4960,2063,8361,5771,13471,14278,10607,-3484,162,5927,-566,13861,-4374,-3556,2826,5298,1488,2154,15884,13162,2740,7036,15756,-5794,10858,-2304,3965,-3124,3679,2923,4503,11252,4877,13156,6876,-1847,519,1008,-1396,-4831,-330,3768,8920,14016,6258,14214,6285,1057,-2680,-2404,12361,-3136,1421,12585,-4553,-858,6235,1873,11127,-7968,12592,413,-4853,9109,3567,6059,10573,-2816,-6779,5108,-2673,-6914,1562,2002,510,7502,-4022,10628,10494,9005,-1658,7122,11365,10759,-567,5456,3672,-6728,-3408,1339,3290,12904,-534,14487,-1471,-3272,5522,-3549,12743,1914,10953,11636,15187,11621,-539,-1746,-1893,10645,-6305,11286,9506,-3740,14176,-924,-1647,-6675,10408,6769,-3077,-3782,7184,6410,12118,7521,11509,2317,7178,-6286,13906,9273,7391,2470,2611,8789,13680,-951,-5507,-3605,1489,-5567,-41,4480,12957,8406,12148,3843,-2609,-2708,1751,5466,13732,-6324,-5507,15425,3175,4267,10895,2184,12100,-1611,3613,5933,-1763,13068,10368,6880,4118,5893,7444,3323,2323,1708,5482,1872,13729,-7767,4470,11041,8056,4872,13598,5693,-6156,8231,4450,-99,5672,12013,-5447,5933,11108,-5802,-5209,1428,14730,-7031,3513,-6391,4432,6269,-3978,12583,12718,8882,12838,8173,-5148,15878,-6074,-5484,-3253,345,-1911,-1888,4038,4921,6858,-1328,2775,-6322,2279,4078,-5780,2042,3090,6318,-5943,11417,8575,-4449,-4944,12426,14435,14525,6272,13395,-147,14750,7338,4010,2265,11143,-1724,44,8969,-3419,11131,-4340,1738,9118,15300,14548,-4868,6520,1785,16049,1339,8481,1865,15891,15121,634,-5843,-3480,7904,9378,3869,-2632,-6047,9798,-5396,-3056,-4610,-1718,7140,361,7791,-5947,-7800,4318,-5261,-1641,-7259,6159,-1309,7512,4718,-6905,825,-3569,7145,-7358,-6998,-6436,7477,7545,1219,1312,9601,5708,15169,-2903,3865,10294,15360,6065,3397,8143,-7362,-323,-6086,3054,5587,-206,15206,2562,7627,13686,15163,4954,-390,-2660,14675,4178,-3161,673,-79,-6733,5412,397,9913,6834,8433,11254,524,-7428,14144,8149,608,5874,-7056,6389,-6348,-6952,748,-4523,10771,-5400,9090,11620,-5955,14948,-3428,14242,-1478,4324,8629,15842,-1603,15134,-1916,-1197,-5237,7665,3208,3629,5038,-3050,13496,6249,15209,-5903,-5549,-686,14192,13478,9521,15323,-6891,15916,15562,10188,15596,5164,15326,4180,5568,-3677,6570,-5478,15616,15216,437,-2375,-3942,-7848,-7218,-3812,3858,1734,12929,15577,13441,8884,6661,-851,-5120,8432,11599,7557,-7058,-4196,10182,-5606,10651,9745,11238,4500,13642,-6252,-5119,-3633,-4323,7738,-1228,-1695,12895,11000,6593,-4226,-6422,-4800,3395,756,567,12660,11925,-1469,15216,8550,2204,-3751,2623,2023,-2115,5405,-241,10512,-6353,12378,5775,3384,-5730,-7406,-3688,939,2592,13801,4408,6470,-3141,1,15165,5197,-4665,-1361,15039,500,9088,-1399,-4603,6910,3167,-7393,13689,7,7037,-3785,7060,5594,10529,8752,10146,15326,14226,6227,8550,-4358,-2877,-7671,-4382,7483,6935,11316,11722,7036,-266,10203,-6249,11445,5942,9574,6530,-5137,-4950,6489,3224,-5624,2100,-1725,-3175,206,7196,10696,7992,6297,13490,3705,807,-990,6056,12214,-6345,6932,8879,6664,5075,-149,5398,3110,5671,7975,765,5448,11500,8475,4460,15670,7821,8146,-6481,12810,-6226,15561,-6127,10163,10589,1164,15834,402,5286,452,-5089,-2030,9909,8954,-7179,10582,-2475,10913,9329,-7804,-364,12048,11924,159,-1028,-2245,3220,9225,9682,5379,6055,15225,11715,-6490,-943,6451,5396,3864,10746,14615,9472,-1481,15798,-3305,14073,13370,5387,-1259,2680,5677,7900,-5120,525,15001,2595,1158,4988,-4577,3035,-6863,-6833,12363,14885,2294,12469,-2057,11433,-2153,-2279,-5878,-5439,11812,3920,14486,-1181,-5404,-5193,9701,-6401,13906,-4283,-6018,-6928,755,8435,3530,-3307,6518,1599,715,-7209,3373,-4008,15958,14219,3826,4961,-3088,10993,-455,-6238,958,5817,7497,-2644,2644,-4291,15365,2112,2636,-3220,14055,10265,-4326,3897,-5922,-1586,1168,2590,1696,12956,-2257,-5553,228,-7423,-1056,3518,-4001,6669,7810,13648,6978,14579,11276,4943,-1134,-5226,7948,-1417,8701,13794,-5212,14431,11745,-2635,554,3865,14166,12380,-4226,14957,14642,11265,-3388,10592,-7771,4757,14442,7085,2803,12118,4032,2730,8107,12713,534,7923,4629,-3435,2097,-4176,-7808,-7647,1713,-2810,12570,-7021,-501,13998,-2349,536,6300,-3795,15104,1624,-7888,-7326,10366,-7066,3342,4589,-7580,-489,12151,1111,388,12247,-3945,10848,-612,3930,3994,14496,2495,6340,8347,5126,10280,12936,1356,-4782,-2398,-3942,3566,7122,-5128,-613,9843,8571,-6782,14539,13832,11486,2928,2160,10049,-4359,12605,-1647,6785,1213,-4271,660,3705,-1931,1898,9866,-3421,8534,2869,-2639,-7650,8977,6417,4230,-6370,8733,14358,-6133,8882,244,-953,15955,6450,5967,-6980,-989,11990,1880,11528,-5238,7823,3528,3574,2258,11155,13417,9975,-1210,13318,-5188,3165,3930,8204,120,860,11605,-7240,-1325,5603,16052,9623,-6395,-4554,13105,-976,15070,-3722,-3889,15685,4810,-7234,7647,14898,-1544,34,11194,-3016,5799,-6492,10226,-5573,-6935,-3768,-7005,-483,6626,2976,-1926,-7062,1848,-5986,9119,-5141,-6302,14221,14567,9045,12802,10628,9222,5951,8153,8490,-2489,6086,743,7721,-6148,11199,-6988,-1783,8063,-79,-1592,-6447,-6229,3904,8316,10428,-4706,-6495,-5549,8659,-6630,-7716,-7349,6868,5974,-7234,568,12797,14578,13138,7664,-3540,5673,10035,-2323,3524,-2749,-6136,13841,1059,10829,2498,10978,6738,10619,-5238,7131,8444,11386,-5131,13417,6416,14688,1153,5714,3885,14798,-6006,13824,8705,-5450,1782,13329,13731,909,3554,4833,10535,13623,15650,-1012,11860,15136,14995,11462,8302,-1943,737,-3377,7282,-7755,9384,9891,4525,11724,8233,-2873,-1534,8594,1107,-1717,14342,-6570,7629,-897,239,-1224,9426,10108,7402,-2229,9800,-3969,1297,-7546,1233,7422,4312,867,1173,6611,8359,3455,6282,15445,-512,-3088,2029,14771,-5659,-1648,-1850,9822,10081,-2720,15491,1628,14775,5596,-3154,7002,15076,-6314,9003,-4134,-3407,11159,8690,-4788,-5250,5757,9486,8025,-6471,-7799,10786,8264,6402,14169,-1158,4617,6731,13411,15562,12859,-2705,13937,9717,11609,11416,11387,-7855,748,8791,25,5087,-6316,-6845,15997,-4547,8636,6973,14791,8819,2194,4108,-409,-1583,-1693,14647,5712,5593,4616,-5240,12923,-4884,3027,-3158,14366,10554,-4990,12614,12932,1192,13066,11973,-7112,-3655,-408,-2175,-373,12894,-7457,1353,4128,4319,1401,-5145,13480,2440,503,5220,691,-6443,9730,-3859,4656,11723,5021,15371,-414,3915,14144,-7553,-3754,5073,8043,-6584,13534,5487,-7956,2795,6062,9825,-7301,-4016,661,2950,-3907,-4594,3927,1313,3264,-4759,10873,-6339,-5464,6251,-5832,3429,-5259,-2444,2861,-5197,6413,-391,-514,-3847,-4005,13331,5328,-2336,5624,8382,2973,13840,1926,10420,13621,8995,-3166,14084,-2953,13215,-5793,11556,11033,8838,8544,6157,13257,1552,-5690,2433,-2317,13621,10191,-3511,-290,-31,4810,5407,12689,13563,12764,3420,11161,-431,3101,3110,269,3049,-6448,15322,-3219,-6822,14504,16004,15485,-1536,-6412,11461,5635,10744,4399,5292,13476,5890,14368,-6693,6860,5857,-7060,14495,-2251,12976,-5620,11001,-5245,9844,3437,6100,14621,-3450,1845,-4951,-882,-5391,7434,5060,-1186,11716,11220,4258,15546,11618,-4424,12529,13910,552,12913,13335,-3658,-2372,-1248,-7370,14879,-1768,-1887,-7862,3795,14249,-7150,7702,-5345,-6613,13490,15960,9524,-4275,-1369,5122,10368,11276,-4339,-5695,2489,13989,6484,1551,5036,11260,2207,11926,8885,-386,955,-4564,14882,3196,8405,-499,-1428,-1277,935,9111,-5364,-4569,-6883,11062,10634,1164,13304,6584,10078,6263,-2513,11367,-7246,11625,-3303,-3137,13445,10120,10083,2071,9170,7710,8823,10141,12373,8206,1588,-6911,11458,-5867,6729,4194,14524,662,-3270,9626,12188,1823,10020,-3685,6635,7388,922,-1246,14283,696,11478,522,-1453,9890,11436,-5077,-165,-2109,7752,-15,13624,5369,3940,11072,2748,-292,6370,13359,14973,6479,165,-3377,8329,3846,2893,6269,-2936,8072,7583,7550,7600,4953,147,-6721,-5101,-6418,-2057,6414,-1175,13376,4185,-793,-1975,9028,-5445,-6104,-5506,4522,2849,-4490,6982,-3496,-1625,-7430,-5973,-1996,8202,12595,15618,11147,1475,-3039,-3345,3507,4864,1859,-3867,-5538,314,-3837,5081,8529,-2643,-7587,7905,3097,13273,13175,-1744,-790,6671,-2439,4844,-2895,12443,9157,5195,7835,7123,9007,6459,11970,10117,-698,10965,6041,10874,12542,718,-533,13287,-6884,-7731,-384,5654,7174,8750,14387,-6407,12605,6659,326,-4484,1423,5513,-2580,11588,10794,11356,-2941,-3301,8065,5220,-5905,1214,-1443,-1310,-1137,-1177,-1893,-5687,15131,-123,9813,-3319,5731,3927,298,9444,223,10020,6326,14382,13878,9593,15788,-7055,7478,11298,2592,4954,-4540,4040,-4415,10370,14584,-7429,13209,10251,1783,10972,-7799,11142,-2430,-5274,11849,9470,-6782,711,206,6528,1138,8405,2084,-5358,224,10787,-4104,1950,4269,15455,7609,1324,-1913,-1558,11123,13356,105,-4048,2197,-4869,-894,12933,7005,593,15148,-207,10015,-2006,-7755,-2025,2797,5280,11068,-1970,5138,-7502,-6859,5082,4793,3162,-4306,13876,-7329,14749,4930,3581,3569,-3756,11140,7603,1672,412,-6495,11330,-3882,13157,-1622,4046,12388,-7390,9903,10935,2652,-5959,13023,-1978,5573,-7013,10642,13538,4312,16013,3573,6224,200,-5067,6493,-3038,11536,9447,-4955,13974,-2051,-2119,2884,14538,5840,12578,1636,12930,-6041,9494,-5337,10440,15149,14405,11484,-3255,10883,58,1647,-522,7514,-8017,10159,-4416,5042,3093,-814,12889,5815,-7314,-4904,10739,1637,-278,11883,-907,6072,10707,10448,-2526,-1344,-3804,6567,8360,6358,10230,628,6654,-1757,1337,4627,13928,14552,9038,9837,2823,-746,8525,1184,1769,-5478,15559,-6187,7686,-4793,5609,3923,12681,-2480,-3664,3587,-6457,-2453,6288,13852,9836,11839,3193,-815,3515,-2139,-4320,-3666,-2732,14830,6917,14852,5228,-153,2248,894,-1552,-5731,2513,7090,-7736,-721,3417,223,2345,-7632,-2268,-2031,7367,-6209,8878,8200,3418,-2187,-3036,-6891,7372,830,4113,-3661,-4212,6722,-6149,-7610,-1522,4622,10423,9693,14551,9321,12685,-4878,-158,11647,-4488,-5151,-226,9149,9709,14496,4059,3253,13170,6063,-7024,8148,2454,-7646,-4348,-5509,-1585,-5005,-5624,3715,8551,15831,14028,13698,7231,-3100,10923,8707,-7359,-3700,-3600,-6714,-169,15509,21,7356,-3496,5571,9874,-5094,5975,-494,2938,2840,2166,-681,12442,-1748,6565,5392,-7734,-6947,8112,5896,-3034,42,858,3983,11669,-7987,-2236,11327,13384,11501,14079,12347,9723,-3256,-7202,4575,6771,-7791,-2517,-597,6966,15765,-2135,14493,3187,15418,10612,10891,2522,567,14966,11904,-5494,-1064,13694,-149,-408,15868,-7330,-5315,-3023,12296,-4695,13785,5531,13718,13205,10993,-4823,-4476,-7631,779,15317,-880,416,11553,11018,7157,-2141,4846,8320,-4322,15220,-6803,9190,-4210,12241,-5640,-5824,977,4873,2707,8371,16043,11872,4543,10683,14157,4148,9702,-6419,-7094,5274,11934,-5262,-469,-6162,2548,-4135,13447,1841,7096,13403,-2698,-1527,11213,14943,5592,2607,4366,7977,-6503,-7219,15229,11647,-5502,2938,9697,12032,10688,6047,-759,11870,6671,-6108,14750,3502,12445,-4899,3151,527,9444,356,7396,-6804,-1833,-3547,-4733,14760,5773,-1804,3532,8959,15849,1984,-4375,-5033,-34,1694,6621,9213,5649,2901,-2492,-4220,14046,-3576,6025,12951,15167,14306,3357,-2579,7482,13527,-3832,2237,12692,-1021,10062,1619,1031,7868,10225,1146,4793,1696,14484,11074,9480,141,13484,9294,7975,12744,13559,-6013,2760,-6838,14536,13923,8246,-3975,13393,9083,6734,10089,6975,-5751,2761,10043,-4228,-6123,-3824,1355,2214,5044,-1158,1118,-3448,7807,6634,-3517,8716,9954,-7755,2783,9941,15762,4351,12019,1057,12519,772,14304,-2832,4018,439,11275,9010,-2116,-7198,7145,11518,4713,-4122,11672,10842,3122,12095,-4994,13436,-6811,8975,138,10587,53,14820,-6186,5329,-1498,-4963,5120,15782,2024,11881,10374,10802,3090,2113,-7309,1086,-3674,7605,-2370,6071,10377,7217,-1928,1890,-3186,12276,12892,-2121,9576,-7574,-2187,12137,4945,-6645,-4820,11490,2297,2476,11710,-4329,6707,-3783,-2345,5314,-7544,2995,5748,14789,7304,-4485,2176,576,6282,-7481,15256,-2394,444,7591,11462,6167,12409,15059,2996,4863,11544,5986,-3952,-3806,-680,-2687,3961,-1924,-2477,3733,1585,1386,15945,2172,-4698,8274,4745,11703,12065,9870,6160,1012,-6667,3321,1228,-3680,13821,3131,2960,-397,6112,-4879,9367,-4451,9451,14141,-6519,-2211,-3234,8375,9246,-946,10381,8606,8338,12398,-883,-7505,-3956,9992,3417,13294,16008,182,2060,9782,10873,5854,-6257,10859,3833,-5129,7656,10271,6402,2844,4924,-1864,-3341,3510,-2566,2228,-7595,-7979,-5609,6756,14115,1755,-682,-4854,-3197,15530,167,-2764,13550,13170,4031,-5787,-240,14227,2890,-6726,9432,-5226,4541,14829,-5660,14316,8551,-7201,-5824,8802,-6268,5971,3292,-7569,7473,-7900,7053,-640,11121,6988,15319,11299,15016,5447,13562,864,-3649,3167,12174,15103,10539,12379,-1846,-6850,6725,4553,11910,-3970,-7966,1559,4083,1677,-7379,9556,859,-2884,12092,168,-5283,3481,2717,1813,-6611,7190,-1017,-4418,-2586,7538,10076,-1389,-519,5569,-613,2314,6060,-4113,3335,11045,-821,7443,-6416,13992,12958,-6400,634,3870,9891,-7819,7410,-1490,-4973,-3529,10395,8439,-3662,-5894,-7535,-1002,11983,4120,15826,7360,4438,11004,14090,15606,-4015,5369,7295,5117,-5214,13852,-7421,5845,14549,14387,1813,-6553,-1352,2990,-2958,-1046,2438,13657,14444,12192,-6603,2195,8255,4491,6814,9754,-1991,13418,6370,7773,9204,14972,8694,-2816,12942,707,4852,532,14736,1220,998,8544,-946,5886,7218,-7675,-6597,-7653,1984,14084,8656,15302,3034,14735,-5192,13030,6878,-4910,-148,1259,-7556,8022,4224,12458,-4235,4426,10896,4460,13505,10944,2444,14326,10638,9694,11832,3521,6293,14449,5076,-6079,-7709,-7996,4970,7928,9537,8017,5703,14447,-2508,-3460,12504,12092,-2382,15157,-7519,6176,3745,10090,13130,-6620,12372,1809,-6769,-4823,7124,-6511,6352,569,15344,-5501,-7443,14644,468,13445,12614,3394,7489,9497,2333,10564,-594,12386,13170,-4111,-4481,10562,994,2335,-7907,15923,-5590,12811,-5948,786,12728,11908,-6885,-1405,4401,10343,12135,4111,5490,10877,-8022,3649,-4911,14879,8493,-2914,2333,-4274,-794,11849,-1762,-4220,11053,5788,6608,11964,14830,12019,4006,-4915,-1806,2525,-6213,5052,13688,-5153,9183,-7845,11919,11428,13216,3707,9756,-1994,266,11144,14157,-2418,4140,194,14146,13881,5971,-2280,-5125,11497,13429,-5443,-6352,13910,3986,11789,-6822,8054,11759,9988,5737,-6720,4279,14163,9607,6291,-7627,2563,-2311,11913,-3938,9651,11988,621,-1799,-6413,-6836,1521,-3699,8634,-2028,12500,-7033,1024,13711,-90,12023,12329,-987,14971,-3940,13146,15474,10946,12151,-3207,10132,-4540,14585,2366,-3414,8660,14223,4905,14980,2757,7054,7225,12926,13455,5603,2985,-3651,4459,-3364,-4828,15550,12369,4938,-7021,-7777,-7965,11437,-4007,2399,-3416,-3583,-5200,13151,9842,-2700,8092,9013,-3481,2623,10861,-1163,4415,-7245,-1083,-1812,12522,7612,-2941,-7516,15933,-6227,1138,854,14308,10380,15234,4331,12744,8303,12485,7787,7798,469,3562,8029,12220,4626,-6335,-7838,12946,5273,15755,1066,14677,6198,-5669,4017,-6508,-5933,9117,-4908,-6067,559,5978,7103,2958,3506,-3487,-4712,6350,15457,-818,5901,1272,10359,1926,-7541,15225,406,-2945,13704,-6844,8208,5565,7513,-7847,-6394,-967,-4584,-1113,15415,2902,-763,6691,700,12979,4931,-3754,1765,-7372,4584,13308,8340,8749,708,-1180,-3104,13592,8542,10063,9661,759,8124,6098,934,-6464,9671,13707,4628,10890,9667,15202,-6975,-868,-6032,-2118,-206,-3405,7287,10451,3963,-1387,-7817,8494,7013,15245,1081,3608,-4596,12191,-4707,10110,-351,13655,1418,11362,12460,13053,16048,1994,10813,14143,11012,-6493,-5334,-293,1286,9879,1833,7067,10217,12898,3614,-3369,-2760,3865,4990,6260,-2492,9455,2427,-3005,12602,-3252,4136,230,-2786,3386,12524,14574,-1234,-1962,7176,9487,-5856,940,10907,-3484,-2080,15719,1236,1429,1019,4021,15142,3534,6415,1360,12904,11183,15520,1093,237,8533,-5210,9408,4691,13019,10778,3839,10935,13984,1757,14335,5764,1906,13259,6754,5238,5769,-1835,-6430,11842,5483,10026,12548,10846,6783,10589,11137,5888,11432,7630,15377,-5553,8168,-6064,-3272,-2969,3110,5882,5539,9076,-5098,-2302,10200,14797,7943,6300,12728,15094,8039,5850,14973,8621,-1504,-3107,7475,14132,-2714,4124,-6867,-691,-6503,980,-2952,-6570,5474,5840,15777,253,414,-3292,4169,7975,3054,-2004,11860,1681,1286,10536,-2419,3962,-3788,7028,8592,-3016,2546,2840,11425,13234,2577,-4742,12824,11721,14848,4355,6314,5524,11308,-7538,2528,-1699,2824,7681,3784,2775,7790,-4961,11465,3498,-5029,9290,3339,-1285,7669,7262,-1207,4141,-5614,15344,-6763,7467,2362,1250,-3578,1257,13608,957,7543,5119,3867,-843,3415,6443,6535,965,-3347,6727,410,-4514,3635,-7539,6888,31,9734,1006,-4561,15075,14605,10492,12624,4661,-2219,8079,8619,3100,9513,3333,-7011,-6716,9067,981,-6740,4217,15526,11485,14021,12399,6384,7007,-1400,14153,-6618,15930,2660,2280,599,11112,-1661,15935,7022,11694,10448,12689,-6752,6668,5562,-7528,9655,393,4670,8150,5490,8547,11554,7662,3461,3119,9224,-5232,-1489,4319,2011,6664,-2148,14861,4506,-7351,11676,7913,-1693,-4628,15820,-3948,8760,-1042,6238,-834,13536,11774,13865,5461,9211,13342,-5307,2528,-6921,725,14465,13848,5441,4028,-7932,6224,6095,12493,-5394,5358,-5819,11107,23,9890,9730,6585,-3484,12759,3637,-614,15422,-5822,8111,14920,13055,-6576,-7337,-2499,13443,-5256,13314,15919,-7764,5428,-4745,-7711,606,15851,12903,10175,5541,-5493,-5518,8022,-939,-3436,-5428,-4401,10578,-1448,-5492,7566,-1106,-462,10614,4571,7931,14930,-6966,13992,-4511,12958,9182,-7949,1312,3203,15259,746,6629,10747,8171,-6293,2508,10463,13219,2280,5119,-7227,11894,10593,12245,1517,-7608,-5422,14177,-3303,-2395,-2023,11799,7266,7691,-4283,-3040,-113,6945,7267,12898,-5565,13543,-7311,15325,14967,14473,-7063,10012,13853,6218,13175,-5403,5568,10221,-4842,8035,-3010,12793,12034,-6332,-7447,-5000,11272,11774,-4257,425,15528,4178,4002,-7399,11094,2015,15290,-5103,987,-1160,-6298,-2482,-2665,12158,5576,10917,8207,11255,-455,3786,1423,6179,8326,11903,12229,6712,-1923,-229,7984,6070,15572,-1536,-1035,12765,1663,1139,9786,-6782,13383,-1114,-3412,-595,-3633,-229,-6479,-1114,650,-5772,-2176,9078,15398,7672,3607,-6978,5921,-837,5916,493,-2760,-258,14097,-2539,15858,-7501,-183,9053,3457,12224,5091,5231,-1039,12280,-6656,-1525,-3463,4277,7359,-3212,13199,15952,4056,-1350,9167,12871,-3905,-5313,2398,3526,1551,-1481,7561,13370,2299,5811,1492,10345,15102,9350,4332,11570,6945,10426,-1852,2555,9082,6543,15385,12300,-730,-5049,-5175,-5571,-6126,352,-6435,-7314,3201,15278,15948,13500,5560,4928,8593,2727,14750,12147,-390,-3283,-6257,11361,-5310,9842,-6770,15602,12110,-5118,1490,9516,13868,-3647,6286,-2477,6146,-4510,-397,15964,5647,8898,9768,10085,-928,-5946,13066,-4449,11870,15244,1019,11821,11751,2011,11292,9331,4184,-2401,13340,12985,-63,4351,9661,-2084,11661,10137,12752,14322,66,-7398,12636,14341,-2558,-1419,5890,5082,6020,-811,13561,3244,7428,6489,-7119,12489,10414,9500,3486,6251,15631,-6441,5736,8045,10859,11513,-3802,6056,-509,6437,3370,-2254,8104,2093,-990,14141,14691,2784,-1035,-6541,12086,11691,14960,5729,4592,4828,3159,-538,12142,10060,8273,2238,4381,3457,9508,6092,6333,7849,11574,-7843,10822,10503,5643,-3341,9616,7971,-6189,12523,-4396,13551,13663,4495,-5889,11526,-3966,-5567,-8025,13452,9979,9327,13411,12358,11944,10289,1934,8761,-602,14723,811,-2904,12724,8115,-1584,7016,7794,15880,10645,-1231,-3138,-5425,-6944,-5375,-3524,4480,2639,8268,-2120,-2069,14597,-5295,8554,12996,-6662,9587,5822,6155,-6868,13617,60,14299,7348,9932,-1080,7101,11689,-6783,12510,4812,3596,-5387,9182,378,-5386,3832,12660,506,-5015,11656,3137,-1159,2331,-3841,2939,4736,-3115,6015,5723,15817,13637,14609,12298,12115,14995,5757,-5769,7966,6975,-6823,10887,11830,-7518,2885,7678,2021,4076,11270,5789,-3016,11188,14136,2513,-5156,2915,12382,11882,8444,4722,10900,-641,834,-2781,2972,10861,10028,6948,3545,-2600,-4928,13963,3240,1061,9902,4099,1765,7647,-3933,-5113,5617,1252,-4564,12443,-1188,-5855,10396,15589,-1778,6069,12143,4680,-7599,-4732,2806,2700,8760,9617,-3588,5332,15011,2232,6888,13020,-2743,10321,-4296,10131,6897,-3718,4492,9972,-4013,13705,5898,3663,6087,12596,-4608,-150,15333,-1858,-1637,3353,5746,-7381,5797,-1842,4876,14792,14021,10968,5371,6577,5497,1940,15875,8258,-1675,-2274,8180,6602,-2442,-6671,3106,3876,11793,-396,15671,12771,1840,4404,-6567,6787,-2295,9288,13388,4759,-2650,9343,11706,-4597,-4874,12476,1568,10355,-6528,12392,-7717,-80,-6913,12541,-5993,1846,-1558,10796,8184,14182,13208,11609,-2440,607,3204,7151,13249,7701,838,14240,-4421,10779,9799,-1030,6971,-6946,10925,1704,2096,15528,3769,-1009,8262,7419,3045,-5411,-4631,-667,-2529,14728,9337,8628,6792,6670,4845,-1029,4061,15839,8566,12310,13304,13415,10203,4871,2025,14807,20,15143,-2497,14584,-2171,9524,13298,-4751,4964,685,4051,10277,-2604,-7141,10327,7922,-593,-5851,5847,10554,2509,3158,3882,-4438,10054,-6376,9356,-807,8661,10824,-2218], True)
    n[-1].next = n[5902]
    print s.detectCycle(n[0]).data

def reverse(ll):
    head = ll
    if not ll.next:
        return ll
    node1 = ll
    node2 = ll.next
    while node2:
        tmp = node2.next
        node2.next = node1
        node1 = node2
        node2 = tmp
    head.next = None
    return node1


def main():
    ll = linkedlist.array2linkedlist([1, 2, 3, 4])
    for i in recursive_reverse(ll):
        print i.data,
    print ''
    ll = linkedlist.array2linkedlist([1, 2, 3, 4])
    for i in reverse(ll):
        print i.data,
    print ''
ll = linkedlist.array2linkedlist([1, 2, 3, 4])

if __name__ == '__main__':
    main()
Beispiel #16
0
def reverse(ll):
    head = ll
    if not ll.next:
        return ll
    node1 = ll
    node2 = ll.next
    while node2:
        tmp = node2.next
        node2.next = node1
        node1 = node2
        node2 = tmp
    head.next = None
    return node1


def main():
    ll = linkedlist.array2linkedlist([1, 2, 3, 4])
    for i in recursive_reverse(ll):
        print i.data,
    print ''
    ll = linkedlist.array2linkedlist([1, 2, 3, 4])
    for i in reverse(ll):
        print i.data,
    print ''


ll = linkedlist.array2linkedlist([1, 2, 3, 4])

if __name__ == '__main__':
    main()