Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
525
23.5k
conversation_id
int64
129
108k
embedding
sequence
cluster
int64
6
6
Provide tags and a correct Python 3 solution for this coding contest problem. This problem is different from the easy version. In this version Ujan makes at most 2n swaps. In addition, k ≤ 1000, n ≤ 50 and it is necessary to print swaps themselves. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems. After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first. Ujan has two distinct strings s and t of length n consisting of only of lowercase English characters. He wants to make them equal. Since Ujan is lazy, he will perform the following operation at most 2n times: he takes two positions i and j (1 ≤ i,j ≤ n, the values i and j can be equal or different), and swaps the characters s_i and t_j. Ujan's goal is to make the strings s and t equal. He does not need to minimize the number of performed operations: any sequence of operations of length 2n or shorter is suitable. Input The first line contains a single integer k (1 ≤ k ≤ 1000), the number of test cases. For each of the test cases, the first line contains a single integer n (2 ≤ n ≤ 50), the length of the strings s and t. Each of the next two lines contains the strings s and t, each having length exactly n. The strings consist only of lowercase English letters. It is guaranteed that strings are different. Output For each test case, output "Yes" if Ujan can make the two strings equal with at most 2n operations and "No" otherwise. You can print each letter in any case (upper or lower). In the case of "Yes" print m (1 ≤ m ≤ 2n) on the next line, where m is the number of swap operations to make the strings equal. Then print m lines, each line should contain two integers i, j (1 ≤ i, j ≤ n) meaning that Ujan swaps s_i and t_j during the corresponding operation. You do not need to minimize the number of operations. Any sequence of length not more than 2n is suitable. Example Input 4 5 souse houhe 3 cat dog 2 aa az 3 abc bca Output Yes 1 1 4 No No Yes 3 1 2 3 1 2 3 Tags: strings Correct Solution: ``` for _ in range(int(input())): n = int(input()) a = list(input()) b = list(input()) ml = [] for i in range(n-1): if a[i] != b[i]: if a[i] in a[i+1:]: ind = i+1+a[i+1:].index(a[i]) b[i], a[ind] = a[ind], b[i] ml.append((ind+1, i+1)) elif a[i] in b[i+1:]: ind1 = i+1+b[i+1:].index(a[i]) a[i+1], b[ind1] = b[ind1], a[i+1] b[i], a[i+1] = a[i+1], b[i] ml.append((i+2, ind1+1)) ml.append((i+2, i+1)) else: break if a == b: print('Yes') print(len(ml)) for i in ml: print(*i) else: print("No") ```
129
[ 0.28955078125, -0.09613037109375, -0.1514892578125, -0.057098388671875, -0.62646484375, -0.5537109375, 0.038604736328125, -0.0033721923828125, 0.071533203125, 1.01953125, 0.978515625, 0.06304931640625, 0.2388916015625, -1.1875, -0.63916015625, -0.00443267822265625, -0.4404296875, -0.497314453125, -0.415283203125, -0.288330078125, 0.1864013671875, -0.291259765625, -1.4765625, -0.1077880859375, -0.293701171875, 0.7734375, 0.32421875, -0.142822265625, 0.79736328125, 1.1728515625, 0.034332275390625, -0.037689208984375, 0.369873046875, -1.111328125, -0.15087890625, -0.40234375, 0.50634765625, -0.453125, -0.298828125, -0.53515625, 0.31787109375, -0.85595703125, 0.30517578125, -0.658203125, -1.115234375, 0.11724853515625, -0.5478515625, -0.31640625, -0.09149169921875, -0.5546875, 0.38427734375, -0.287353515625, 0.74609375, 0.0259552001953125, 0.10565185546875, 0.37109375, -0.1683349609375, -0.2379150390625, -0.6650390625, 0.1639404296875, 0.201416015625, 0.1649169921875, -0.2064208984375, -0.61572265625, -0.1292724609375, 0.006328582763671875, 0.0188751220703125, -0.34326171875, 0.0814208984375, -1.0888671875, -0.3544921875, 0.269287109375, -0.31982421875, -0.413330078125, -0.388671875, 0.308349609375, 0.26904296875, -0.347412109375, -0.7685546875, 0.80029296875, -0.1287841796875, 1.0234375, 0.139404296875, 0.00463104248046875, -0.71728515625, -0.37255859375, 0.245361328125, 0.337646484375, 0.31982421875, -0.01922607421875, -0.0472412109375, 0.62890625, -0.513671875, 0.0716552734375, 0.5888671875, 0.568359375, -0.256103515625, 0.369140625, 0.43896484375, -0.09429931640625, 0.64697265625, 0.646484375, -0.5966796875, 1.1181640625, -0.485107421875, -0.160400390625, 0.052001953125, -0.148193359375, -0.160888671875, 0.04840087890625, -0.14013671875, -0.29736328125, 0.982421875, 0.40283203125, -0.474365234375, 0.623046875, 0.160888671875, 0.4384765625, -0.76513671875, 0.402099609375, 0.69677734375, -0.1361083984375, 0.67431640625, -0.1473388671875, -0.05010986328125, -0.22119140625, -0.382080078125, 0.89306640625, -0.50537109375, 0.041473388671875, 0.333251953125, -0.2275390625, -0.0165252685546875, 0.33251953125, -0.342529296875, 1.072265625, -0.26025390625, 0.71240234375, 0.382568359375, -0.416259765625, 0.4697265625, -0.2423095703125, 0.039703369140625, 1.6279296875, 0.484375, -0.036712646484375, 0.9677734375, 0.44580078125, -0.64892578125, 0.09979248046875, -0.94287109375, 0.5986328125, 0.14306640625, 0.51513671875, -0.1693115234375, -0.08648681640625, -0.3515625, 0.33154296875, 0.309814453125, 0.2496337890625, -0.25439453125, 0.113525390625, -0.11273193359375, 0.69287109375, -0.07489013671875, 1.138671875, -0.4482421875, -0.2069091796875, -0.10089111328125, -0.4658203125, 0.1990966796875, -0.339111328125, -0.34375, 0.72900390625, 0.6689453125, 1.01953125, 0.9677734375, -0.1910400390625, 0.04498291015625, 0.2059326171875, -0.3349609375, 0.373046875, 0.0738525390625, 0.6552734375, 0.125244140625, 0.06671142578125, 0.281005859375, -0.257080078125, -0.481689453125, -0.416259765625, 0.14892578125, 0.791015625, -0.494140625, -0.0284576416015625, 0.269775390625, 0.25390625, -0.73193359375, 0.0214691162109375, -0.331787109375, -0.7705078125, -0.486572265625, 0.245849609375, -0.18115234375, 0.57861328125, -0.439697265625, -0.75, 0.445556640625, 0.67333984375, -0.3076171875, -0.22265625, 0.40869140625, 0.4423828125, -0.379150390625, 0.315673828125, -0.076416015625, 0.03582763671875, -0.372802734375, 0.8955078125, -0.313720703125, 0.042816162109375, 0.42431640625, 0.75830078125, 0.5498046875, 0.486572265625, -0.2432861328125, -0.1485595703125, 0.94287109375, 1.2294921875, -0.003391265869140625, 0.428466796875, 0.147705078125, 0.88330078125, 0.9853515625, 0.9365234375, 0.919921875, -0.0026092529296875, 0.66357421875, 0.87841796875, 0.2239990234375, 0.1536865234375, 0.46728515625, 0.3896484375, 0.406005859375, 0.677734375, -0.00873565673828125, 0.293212890625, -0.31982421875, 0.490234375, -0.324951171875, 0.240234375, -0.261474609375, 0.775390625, 0.25537109375, 0.4248046875, -0.3828125, -0.474365234375, 0.331298828125, 0.884765625, -0.88330078125, -0.619140625, -0.2476806640625, 0.0826416015625, 0.0985107421875, -0.288818359375, 0.49560546875, 0.3037109375, 0.21435546875, 0.482421875, -0.278564453125, -0.495361328125, -1.328125, -0.8603515625, -0.9892578125, -0.41650390625, -0.916015625, 0.124267578125, 0.35009765625, -0.8115234375, 0.294189453125, -0.41943359375, -0.237548828125, 0.1826171875, -0.64794921875, 0.59521484375, 0.0143890380859375, 0.498779296875, -0.5087890625, 0.76220703125, 0.54248046875, 0.94287109375, -0.7412109375, -0.11431884765625, -0.396240234375, -0.53369140625, 0.186767578125, 0.13330078125, 0.468017578125, -0.08514404296875, -0.61962890625, -0.6083984375, -0.80126953125, -0.51953125, -0.65771484375, -0.09912109375, -0.328369140625, 0.84716796875, 0.5263671875, -0.67431640625, 0.43115234375, 1.0927734375, -0.28173828125, 0.263916015625, 0.0018148422241210938, 0.0060272216796875, -0.73291015625, 1.0712890625, 0.1822509765625, 0.5927734375, -0.38330078125, -0.267822265625, -0.2490234375, 0.2120361328125, 0.1536865234375, -0.45556640625, -0.24462890625, 0.335693359375, -0.0263671875, -1.0009765625, 0.45068359375, -0.87890625, -0.46435546875, -0.2474365234375, -0.68603515625, 0.5, 0.92919921875, -0.08306884765625, -0.1705322265625, 0.06671142578125, 0.08599853515625, 0.67724609375, 0.38330078125, -0.55322265625, 0.11932373046875, 0.279296875, 0.17138671875, -0.263671875, 0.435546875, -0.568359375, -0.0297698974609375, -0.0679931640625, 0.49755859375, 0.68994140625, 0.1962890625, 0.57861328125, 0.492919921875, 0.9091796875, -0.492431640625, -0.279296875, -0.035675048828125, 0.623046875, 0.38037109375, 0.662109375, 0.3515625, -0.439697265625, -0.78369140625, -1.287109375, 0.45947265625, 0.2471923828125, 0.82373046875, -0.859375, 0.7119140625, 0.05029296875, -0.446044921875, 0.263916015625, -0.61767578125, -0.08978271484375, 1.078125, -0.1929931640625, 0.83740234375, -0.64697265625, 0.384033203125, -0.1923828125, -0.038818359375, 0.5927734375, 0.340087890625, 0.46826171875, -0.498046875, -0.54443359375, -0.58349609375, 0.25830078125, -0.2393798828125, -0.39306640625, 0.1536865234375, -0.464599609375, -0.14892578125, -0.87939453125, 0.6279296875, 0.58740234375, 0.57470703125, -0.11962890625, 0.564453125, 0.53662109375, 0.51318359375, 0.4267578125, -0.6328125, 0.302734375, -0.810546875, 0.5908203125, 0.217041015625, -0.35107421875, -0.42626953125, -0.45263671875, -0.444580078125, 0.2052001953125, 0.2301025390625, -0.218994140625, -0.93212890625, 0.57421875, -0.1793212890625, 0.58740234375, -0.42431640625, -0.240966796875, -0.63720703125, 0.419921875, 0.60986328125, -0.89501953125, 0.53466796875, -0.6572265625, 0.7998046875, 0.4541015625, -0.181640625, -0.2171630859375, -0.4560546875, -0.6474609375, -0.492431640625, 0.0482177734375, 0.99560546875, -0.04327392578125, 0.087646484375, -1.0322265625, 0.25439453125, 0.2437744140625, -0.47705078125, 0.10113525390625, -0.181640625, 0.38427734375, 0.1453857421875, 0.705078125, -0.360107421875, -0.311279296875, 0.124267578125, -1.34375, 0.401123046875, -0.51806640625, 0.5029296875, -0.316650390625, -0.0947265625, 0.12371826171875, 0.51953125, -0.428955078125, -0.33447265625, -0.278076171875, 0.5859375, -0.92333984375, -0.79345703125, 0.389404296875, -0.311767578125, -0.2113037109375, 0.92431640625, -0.369140625, -0.2841796875, 0.286376953125, 0.8671875, -0.456787109375, 0.3134765625, -0.4033203125, 0.465087890625, -0.52734375, -0.7177734375, -0.2041015625, -0.65576171875, 0.966796875, 0.06689453125, -0.671875, -0.3544921875, -1.1240234375, -0.156494140625, 0.1876220703125, -0.63818359375, 0.158203125, 0.2431640625, 0.0106048583984375, -0.3291015625, -0.421875, -0.3330078125, -0.2734375, -0.81396484375, -0.36474609375, 0.341064453125, 0.59912109375, 0.47119140625, -0.354248046875, -0.54052734375, -0.06396484375, -0.2197265625, 0.0360107421875, -0.3720703125, -0.431884765625, -0.235595703125, -0.07244873046875, -0.302490234375, 0.1182861328125, 0.020782470703125, 0.07135009765625, 0.6455078125, -0.1256103515625, 0.51953125, 0.1602783203125, -0.69482421875, 1.029296875, -0.04766845703125, -1.0283203125, -0.378662109375, 0.16748046875, 0.1739501953125, 0.54541015625, 0.3154296875, -0.771484375, -0.80224609375, -1.0146484375, 0.1500244140625, -0.666015625, -0.074951171875, -0.892578125, -0.01439666748046875, -0.6318359375, 0.630859375, -0.1673583984375, -0.6787109375, 0.13427734375, -0.9755859375, 0.152587890625, -0.68359375, -0.232177734375, -0.75, -0.517578125, -0.56005859375, 0.865234375, 0.23681640625, 0.484130859375, -0.178955078125, -0.2335205078125, 0.29638671875, -0.06390380859375, -0.5859375, -0.331787109375, -0.07672119140625, 0.46435546875, -0.51806640625, -0.249755859375, -0.469970703125, 0.67724609375, -0.8603515625, 0.2783203125, -0.293701171875, -0.377685546875, -0.05657958984375, -0.1854248046875, 1.181640625, -0.158203125, 0.3486328125, -0.420654296875, 0.87158203125, 0.7197265625, -0.54052734375, -0.65869140625, -0.904296875, -0.86376953125, -0.8251953125, 0.450927734375, -0.671875, 0.22509765625, -0.66796875, -0.1658935546875, 1.0625, -0.53857421875, 0.27783203125, 1.109375, 0.2125244140625, 0.64599609375, -0.802734375, 0.58056640625, 0.20068359375, -0.787109375, 0.0073394775390625, 0.2305908203125, -0.5888671875, 0.033538818359375, -0.1719970703125, -0.8583984375, -0.6708984375, 0.370849609375, 1.3828125, -0.369873046875, 0.63427734375, -0.058441162109375, -0.8896484375, -0.7314453125, 0.71923828125, 0.276611328125, 0.33837890625, 1.0390625, -0.2088623046875, 0.07501220703125, -0.376953125, 0.18359375, -0.206298828125, -0.5595703125, 0.9599609375, -0.1632080078125, -0.6142578125, 0.87451171875, 0.90576171875, -1.0556640625, -0.724609375, -0.09893798828125, -0.03448486328125, -0.20849609375, -0.634765625, -0.255615234375, 0.49951171875, -0.51220703125, 0.14892578125, 0.5126953125, -0.1190185546875, 0.324462890625, -0.050140380859375, 0.0751953125, -0.486328125, 0.60546875, 0.525390625, -0.425537109375, -0.1278076171875, -1.0771484375, -0.5068359375, -0.3759765625, 0.046142578125, 0.54833984375, -0.422607421875, 0.321044921875, 0.49755859375, -0.035858154296875, 0.703125, -0.329345703125, -0.51123046875, 0.425537109375, -0.90185546875, -0.51953125, -0.0946044921875, 0.10833740234375, -0.2239990234375, 0.230224609375, -0.376220703125, 0.44677734375, -0.008575439453125, 0.51513671875, -0.389404296875, -1.1474609375, -0.251953125, -1.2177734375, -0.30908203125, -0.60595703125, -0.337158203125, -0.0654296875, 0.2230224609375, 0.27490234375, -0.43701171875, 0.09161376953125, 0.459716796875, -0.5556640625, 0.69384765625, -0.5537109375, 0.307373046875, -0.7373046875, -0.456787109375, -0.7177734375, 0.12286376953125, -0.5791015625, -0.01486968994140625, -0.6455078125, 0.21875, -0.0450439453125, 0.420654296875, -0.06683349609375, 0.52001953125, -0.22314453125, -0.591796875, 0.21337890625, 0.0404052734375, -0.1343994140625, 0.490966796875, 0.54638671875, -0.12109375, 0.3896484375, -0.07470703125, -0.239501953125, -0.64208984375, 0.662109375, 0.43115234375, -0.00144195556640625, -0.21875, -0.0244293212890625, 0.360107421875, -0.927734375, 0.583984375, -0.1585693359375, 0.00012552738189697266, -0.02777099609375, -0.410888671875, 0.3623046875, 1.2763671875, -0.14013671875, 0.62353515625, -0.1910400390625, 0.1009521484375, 0.27734375, 0.056549072265625, -0.1444091796875, 0.4638671875, -0.08258056640625, -0.15869140625, -0.009613037109375, 0.52880859375, 0.046844482421875, 0.6962890625, -0.3427734375, -0.87890625, -0.88720703125, -0.4326171875, 0.10009765625, 0.25439453125, 0.53466796875, -0.28857421875, -0.01666259765625, -0.2061767578125, -0.193359375, 0.449462890625, -1.0830078125, -1.048828125, 0.3046875, -0.080810546875, -0.662109375, -0.2391357421875, -0.75341796875, -0.53759765625, -0.0017499923706054688, 0.318603515625, -0.61572265625, 0.474609375, 0.027801513671875, 0.85791015625, -0.4833984375, 0.286865234375, 0.060577392578125, 0.56591796875, -0.53955078125, -0.441650390625, -0.040374755859375, 1.0703125, 0.1668701171875, -0.296142578125, -0.49072265625, 0.43603515625, 0.010040283203125, 0.288330078125, -0.1439208984375, 0.07098388671875, -0.40234375, 0.73046875, -1.0830078125, 0.037445068359375, -0.175048828125, 0.38037109375, -0.0782470703125, -0.5478515625, -0.47412109375, 1.1298828125, 0.6513671875, -0.156982421875, 0.5810546875, 0.0276641845703125, 0.47119140625, -0.1917724609375, 0.06683349609375, -0.33447265625, 0.8251953125, 0.484130859375, 0.9619140625, -0.359619140625, 0.09954833984375, 0.56982421875, 0.07568359375, -0.388671875, 0.03375244140625, -0.013427734375, -0.06256103515625, 0.453125, -0.2685546875, -0.089111328125, -0.016326904296875, -0.74365234375, 0.439697265625, -0.42333984375, -0.036041259765625, -0.171630859375, -0.95361328125, 0.92724609375, -0.450439453125, 0.0308074951171875, 0.6591796875, -0.368896484375, -0.05450439453125, 0.63134765625, -0.0902099609375, -0.4404296875, 0.7333984375, 0.724609375, 0.469482421875, 0.5732421875, 0.61669921875, 0.47119140625, -0.888671875, 0.30419921875, 0.2244873046875, -0.155029296875, -0.07269287109375, -0.64404296875, -0.982421875, 0.351806640625, -0.30517578125, -0.076416015625, 0.66015625, -0.7685546875, 0.01485443115234375, -0.52880859375, 0.75439453125, -0.389404296875, 0.413330078125, 0.11993408203125, -0.67578125, -0.439208984375, 0.61865234375, -0.25732421875, 0.5185546875, 0.0028533935546875, 1.0986328125, -0.07440185546875, 1.4306640625, 0.83935546875, -0.320068359375, 0.211669921875, 0.473388671875, -0.2188720703125, -0.444091796875, -0.71630859375, -0.49951171875, 0.1947021484375, -0.55419921875, -0.5400390625, -0.042236328125, 1.083984375, -0.03485107421875, -1.2470703125, -0.591796875, 0.1669921875, -1.1484375, 0.2174072265625, 0.51171875, 0.431396484375, -0.1143798828125, -0.12115478515625, -0.036529541015625, -0.6591796875, 0.477294921875, -0.9609375, 0.24658203125, -0.383056640625, -0.44189453125, -0.53857421875, -0.66259765625, -0.51025390625, -0.192138671875, -0.234375, -0.974609375, 0.525390625, 0.397705078125, 0.74560546875, 0.305908203125, -0.294677734375, 0.30615234375, 1.0361328125, 1.28125, 0.07830810546875, 0.6943359375, 0.5029296875, -0.383544921875, 0.253662109375, -0.4599609375, 0.2108154296875, -0.14111328125, 0.53076171875, -0.35546875, 0.368896484375, -0.84423828125, -1.2216796875, -0.197998046875, 0.5498046875, 0.2442626953125, -0.66259765625, -0.95703125, -0.2734375, -0.96923828125, -0.33740234375, -0.67333984375, 0.78369140625, -0.35986328125, 0.147705078125, 0.1817626953125, -1.2412109375, 4.390625, 1.09375, 0.9404296875, 0.45361328125, 0.25634765625, 1.0673828125, 0.224365234375, -0.444580078125, -0.1875, -0.297119140625, 0.3115234375, -0.51708984375, -0.028961181640625, 0.80810546875, 0.1041259765625, 0.354248046875, -0.60400390625, -0.014129638671875, -0.16845703125, -0.8447265625, -0.51611328125, 0.1051025390625, -0.1497802734375, 0.4052734375, 0.2274169921875, 0.160400390625, 0.378662109375, -0.83984375, -0.432861328125, -0.568359375, 0.344970703125, -0.58544921875, 0.90380859375, 0.345458984375, -0.2152099609375, 0.58984375, -0.265625, -0.5185546875, -0.085693359375, 0.06634521484375, -0.258056640625, 0.51025390625, 0.6103515625, -0.7158203125, -0.329833984375, 0.43896484375, -0.71435546875, 0.38916015625, 0.1259765625, -1.1103515625, 0.8095703125, -0.34375, 0.572265625, -0.80322265625, -0.79296875, 0.498291015625, 0.1243896484375, 0.11480712890625, -0.4287109375, 0.54443359375, 0.59033203125, 0.318359375, 0.34228515625, 0.7333984375, -1.34375, 0.58203125, -0.1776123046875, 0.428955078125, -0.5439453125, 0.102294921875, -0.1783447265625, -0.277099609375, -0.273681640625, -0.401123046875, 0.5322265625, 0.474853515625, -0.2432861328125, 0.978515625, 0.49365234375, -0.81884765625, 0.048675537109375, -0.0018157958984375, -0.1951904296875, -0.419921875, 0.8544921875, 1.2626953125, -0.467041015625, -0.071044921875, -0.446533203125, 0.810546875, 0.8056640625, 0.71240234375, 0.0011663436889648438, -0.37158203125, -0.071044921875 ]
6
Provide tags and a correct Python 3 solution for this coding contest problem. This problem is different from the easy version. In this version Ujan makes at most 2n swaps. In addition, k ≤ 1000, n ≤ 50 and it is necessary to print swaps themselves. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems. After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first. Ujan has two distinct strings s and t of length n consisting of only of lowercase English characters. He wants to make them equal. Since Ujan is lazy, he will perform the following operation at most 2n times: he takes two positions i and j (1 ≤ i,j ≤ n, the values i and j can be equal or different), and swaps the characters s_i and t_j. Ujan's goal is to make the strings s and t equal. He does not need to minimize the number of performed operations: any sequence of operations of length 2n or shorter is suitable. Input The first line contains a single integer k (1 ≤ k ≤ 1000), the number of test cases. For each of the test cases, the first line contains a single integer n (2 ≤ n ≤ 50), the length of the strings s and t. Each of the next two lines contains the strings s and t, each having length exactly n. The strings consist only of lowercase English letters. It is guaranteed that strings are different. Output For each test case, output "Yes" if Ujan can make the two strings equal with at most 2n operations and "No" otherwise. You can print each letter in any case (upper or lower). In the case of "Yes" print m (1 ≤ m ≤ 2n) on the next line, where m is the number of swap operations to make the strings equal. Then print m lines, each line should contain two integers i, j (1 ≤ i, j ≤ n) meaning that Ujan swaps s_i and t_j during the corresponding operation. You do not need to minimize the number of operations. Any sequence of length not more than 2n is suitable. Example Input 4 5 souse houhe 3 cat dog 2 aa az 3 abc bca Output Yes 1 1 4 No No Yes 3 1 2 3 1 2 3 Tags: strings Correct Solution: ``` from sys import stdin, stdout from collections import Counter, deque from bisect import bisect_left from itertools import product #input = stdin.buffer.readline T = int(input()) for _ in range(T): n = int(input()) a, b = list(input()), list(input()) cc = Counter(a+b) if any([u%2 for u in cc.values()]): print("No"); continue res = [] for i in range(n): if a[i] == b[i]: continue if a[i] in a[i+1:]: p = a[i+1:].index(a[i]) b[i], a[i+p+1] = a[i+p+1], b[i] res.append((i+p+1, i)) else: p = b[i+1:].index(a[i]) a[i+1], b[i+p+1] = b[i+p+1], a[i+1] a[i+1], b[i] = b[i], a[i+1] res.append((i+1, i+p+1)) res.append((i+1, i)) print("Yes") print(len(res)) for u, v in res: print(str(u+1)+' '+str(v+1)) ```
130
[ 0.28955078125, -0.09613037109375, -0.1514892578125, -0.057098388671875, -0.62646484375, -0.5537109375, 0.038604736328125, -0.0033721923828125, 0.071533203125, 1.01953125, 0.978515625, 0.06304931640625, 0.2388916015625, -1.1875, -0.63916015625, -0.00443267822265625, -0.4404296875, -0.497314453125, -0.415283203125, -0.288330078125, 0.1864013671875, -0.291259765625, -1.4765625, -0.1077880859375, -0.293701171875, 0.7734375, 0.32421875, -0.142822265625, 0.79736328125, 1.1728515625, 0.034332275390625, -0.037689208984375, 0.369873046875, -1.111328125, -0.15087890625, -0.40234375, 0.50634765625, -0.453125, -0.298828125, -0.53515625, 0.31787109375, -0.85595703125, 0.30517578125, -0.658203125, -1.115234375, 0.11724853515625, -0.5478515625, -0.31640625, -0.09149169921875, -0.5546875, 0.38427734375, -0.287353515625, 0.74609375, 0.0259552001953125, 0.10565185546875, 0.37109375, -0.1683349609375, -0.2379150390625, -0.6650390625, 0.1639404296875, 0.201416015625, 0.1649169921875, -0.2064208984375, -0.61572265625, -0.1292724609375, 0.006328582763671875, 0.0188751220703125, -0.34326171875, 0.0814208984375, -1.0888671875, -0.3544921875, 0.269287109375, -0.31982421875, -0.413330078125, -0.388671875, 0.308349609375, 0.26904296875, -0.347412109375, -0.7685546875, 0.80029296875, -0.1287841796875, 1.0234375, 0.139404296875, 0.00463104248046875, -0.71728515625, -0.37255859375, 0.245361328125, 0.337646484375, 0.31982421875, -0.01922607421875, -0.0472412109375, 0.62890625, -0.513671875, 0.0716552734375, 0.5888671875, 0.568359375, -0.256103515625, 0.369140625, 0.43896484375, -0.09429931640625, 0.64697265625, 0.646484375, -0.5966796875, 1.1181640625, -0.485107421875, -0.160400390625, 0.052001953125, -0.148193359375, -0.160888671875, 0.04840087890625, -0.14013671875, -0.29736328125, 0.982421875, 0.40283203125, -0.474365234375, 0.623046875, 0.160888671875, 0.4384765625, -0.76513671875, 0.402099609375, 0.69677734375, -0.1361083984375, 0.67431640625, -0.1473388671875, -0.05010986328125, -0.22119140625, -0.382080078125, 0.89306640625, -0.50537109375, 0.041473388671875, 0.333251953125, -0.2275390625, -0.0165252685546875, 0.33251953125, -0.342529296875, 1.072265625, -0.26025390625, 0.71240234375, 0.382568359375, -0.416259765625, 0.4697265625, -0.2423095703125, 0.039703369140625, 1.6279296875, 0.484375, -0.036712646484375, 0.9677734375, 0.44580078125, -0.64892578125, 0.09979248046875, -0.94287109375, 0.5986328125, 0.14306640625, 0.51513671875, -0.1693115234375, -0.08648681640625, -0.3515625, 0.33154296875, 0.309814453125, 0.2496337890625, -0.25439453125, 0.113525390625, -0.11273193359375, 0.69287109375, -0.07489013671875, 1.138671875, -0.4482421875, -0.2069091796875, -0.10089111328125, -0.4658203125, 0.1990966796875, -0.339111328125, -0.34375, 0.72900390625, 0.6689453125, 1.01953125, 0.9677734375, -0.1910400390625, 0.04498291015625, 0.2059326171875, -0.3349609375, 0.373046875, 0.0738525390625, 0.6552734375, 0.125244140625, 0.06671142578125, 0.281005859375, -0.257080078125, -0.481689453125, -0.416259765625, 0.14892578125, 0.791015625, -0.494140625, -0.0284576416015625, 0.269775390625, 0.25390625, -0.73193359375, 0.0214691162109375, -0.331787109375, -0.7705078125, -0.486572265625, 0.245849609375, -0.18115234375, 0.57861328125, -0.439697265625, -0.75, 0.445556640625, 0.67333984375, -0.3076171875, -0.22265625, 0.40869140625, 0.4423828125, -0.379150390625, 0.315673828125, -0.076416015625, 0.03582763671875, -0.372802734375, 0.8955078125, -0.313720703125, 0.042816162109375, 0.42431640625, 0.75830078125, 0.5498046875, 0.486572265625, -0.2432861328125, -0.1485595703125, 0.94287109375, 1.2294921875, -0.003391265869140625, 0.428466796875, 0.147705078125, 0.88330078125, 0.9853515625, 0.9365234375, 0.919921875, -0.0026092529296875, 0.66357421875, 0.87841796875, 0.2239990234375, 0.1536865234375, 0.46728515625, 0.3896484375, 0.406005859375, 0.677734375, -0.00873565673828125, 0.293212890625, -0.31982421875, 0.490234375, -0.324951171875, 0.240234375, -0.261474609375, 0.775390625, 0.25537109375, 0.4248046875, -0.3828125, -0.474365234375, 0.331298828125, 0.884765625, -0.88330078125, -0.619140625, -0.2476806640625, 0.0826416015625, 0.0985107421875, -0.288818359375, 0.49560546875, 0.3037109375, 0.21435546875, 0.482421875, -0.278564453125, -0.495361328125, -1.328125, -0.8603515625, -0.9892578125, -0.41650390625, -0.916015625, 0.124267578125, 0.35009765625, -0.8115234375, 0.294189453125, -0.41943359375, -0.237548828125, 0.1826171875, -0.64794921875, 0.59521484375, 0.0143890380859375, 0.498779296875, -0.5087890625, 0.76220703125, 0.54248046875, 0.94287109375, -0.7412109375, -0.11431884765625, -0.396240234375, -0.53369140625, 0.186767578125, 0.13330078125, 0.468017578125, -0.08514404296875, -0.61962890625, -0.6083984375, -0.80126953125, -0.51953125, -0.65771484375, -0.09912109375, -0.328369140625, 0.84716796875, 0.5263671875, -0.67431640625, 0.43115234375, 1.0927734375, -0.28173828125, 0.263916015625, 0.0018148422241210938, 0.0060272216796875, -0.73291015625, 1.0712890625, 0.1822509765625, 0.5927734375, -0.38330078125, -0.267822265625, -0.2490234375, 0.2120361328125, 0.1536865234375, -0.45556640625, -0.24462890625, 0.335693359375, -0.0263671875, -1.0009765625, 0.45068359375, -0.87890625, -0.46435546875, -0.2474365234375, -0.68603515625, 0.5, 0.92919921875, -0.08306884765625, -0.1705322265625, 0.06671142578125, 0.08599853515625, 0.67724609375, 0.38330078125, -0.55322265625, 0.11932373046875, 0.279296875, 0.17138671875, -0.263671875, 0.435546875, -0.568359375, -0.0297698974609375, -0.0679931640625, 0.49755859375, 0.68994140625, 0.1962890625, 0.57861328125, 0.492919921875, 0.9091796875, -0.492431640625, -0.279296875, -0.035675048828125, 0.623046875, 0.38037109375, 0.662109375, 0.3515625, -0.439697265625, -0.78369140625, -1.287109375, 0.45947265625, 0.2471923828125, 0.82373046875, -0.859375, 0.7119140625, 0.05029296875, -0.446044921875, 0.263916015625, -0.61767578125, -0.08978271484375, 1.078125, -0.1929931640625, 0.83740234375, -0.64697265625, 0.384033203125, -0.1923828125, -0.038818359375, 0.5927734375, 0.340087890625, 0.46826171875, -0.498046875, -0.54443359375, -0.58349609375, 0.25830078125, -0.2393798828125, -0.39306640625, 0.1536865234375, -0.464599609375, -0.14892578125, -0.87939453125, 0.6279296875, 0.58740234375, 0.57470703125, -0.11962890625, 0.564453125, 0.53662109375, 0.51318359375, 0.4267578125, -0.6328125, 0.302734375, -0.810546875, 0.5908203125, 0.217041015625, -0.35107421875, -0.42626953125, -0.45263671875, -0.444580078125, 0.2052001953125, 0.2301025390625, -0.218994140625, -0.93212890625, 0.57421875, -0.1793212890625, 0.58740234375, -0.42431640625, -0.240966796875, -0.63720703125, 0.419921875, 0.60986328125, -0.89501953125, 0.53466796875, -0.6572265625, 0.7998046875, 0.4541015625, -0.181640625, -0.2171630859375, -0.4560546875, -0.6474609375, -0.492431640625, 0.0482177734375, 0.99560546875, -0.04327392578125, 0.087646484375, -1.0322265625, 0.25439453125, 0.2437744140625, -0.47705078125, 0.10113525390625, -0.181640625, 0.38427734375, 0.1453857421875, 0.705078125, -0.360107421875, -0.311279296875, 0.124267578125, -1.34375, 0.401123046875, -0.51806640625, 0.5029296875, -0.316650390625, -0.0947265625, 0.12371826171875, 0.51953125, -0.428955078125, -0.33447265625, -0.278076171875, 0.5859375, -0.92333984375, -0.79345703125, 0.389404296875, -0.311767578125, -0.2113037109375, 0.92431640625, -0.369140625, -0.2841796875, 0.286376953125, 0.8671875, -0.456787109375, 0.3134765625, -0.4033203125, 0.465087890625, -0.52734375, -0.7177734375, -0.2041015625, -0.65576171875, 0.966796875, 0.06689453125, -0.671875, -0.3544921875, -1.1240234375, -0.156494140625, 0.1876220703125, -0.63818359375, 0.158203125, 0.2431640625, 0.0106048583984375, -0.3291015625, -0.421875, -0.3330078125, -0.2734375, -0.81396484375, -0.36474609375, 0.341064453125, 0.59912109375, 0.47119140625, -0.354248046875, -0.54052734375, -0.06396484375, -0.2197265625, 0.0360107421875, -0.3720703125, -0.431884765625, -0.235595703125, -0.07244873046875, -0.302490234375, 0.1182861328125, 0.020782470703125, 0.07135009765625, 0.6455078125, -0.1256103515625, 0.51953125, 0.1602783203125, -0.69482421875, 1.029296875, -0.04766845703125, -1.0283203125, -0.378662109375, 0.16748046875, 0.1739501953125, 0.54541015625, 0.3154296875, -0.771484375, -0.80224609375, -1.0146484375, 0.1500244140625, -0.666015625, -0.074951171875, -0.892578125, -0.01439666748046875, -0.6318359375, 0.630859375, -0.1673583984375, -0.6787109375, 0.13427734375, -0.9755859375, 0.152587890625, -0.68359375, -0.232177734375, -0.75, -0.517578125, -0.56005859375, 0.865234375, 0.23681640625, 0.484130859375, -0.178955078125, -0.2335205078125, 0.29638671875, -0.06390380859375, -0.5859375, -0.331787109375, -0.07672119140625, 0.46435546875, -0.51806640625, -0.249755859375, -0.469970703125, 0.67724609375, -0.8603515625, 0.2783203125, -0.293701171875, -0.377685546875, -0.05657958984375, -0.1854248046875, 1.181640625, -0.158203125, 0.3486328125, -0.420654296875, 0.87158203125, 0.7197265625, -0.54052734375, -0.65869140625, -0.904296875, -0.86376953125, -0.8251953125, 0.450927734375, -0.671875, 0.22509765625, -0.66796875, -0.1658935546875, 1.0625, -0.53857421875, 0.27783203125, 1.109375, 0.2125244140625, 0.64599609375, -0.802734375, 0.58056640625, 0.20068359375, -0.787109375, 0.0073394775390625, 0.2305908203125, -0.5888671875, 0.033538818359375, -0.1719970703125, -0.8583984375, -0.6708984375, 0.370849609375, 1.3828125, -0.369873046875, 0.63427734375, -0.058441162109375, -0.8896484375, -0.7314453125, 0.71923828125, 0.276611328125, 0.33837890625, 1.0390625, -0.2088623046875, 0.07501220703125, -0.376953125, 0.18359375, -0.206298828125, -0.5595703125, 0.9599609375, -0.1632080078125, -0.6142578125, 0.87451171875, 0.90576171875, -1.0556640625, -0.724609375, -0.09893798828125, -0.03448486328125, -0.20849609375, -0.634765625, -0.255615234375, 0.49951171875, -0.51220703125, 0.14892578125, 0.5126953125, -0.1190185546875, 0.324462890625, -0.050140380859375, 0.0751953125, -0.486328125, 0.60546875, 0.525390625, -0.425537109375, -0.1278076171875, -1.0771484375, -0.5068359375, -0.3759765625, 0.046142578125, 0.54833984375, -0.422607421875, 0.321044921875, 0.49755859375, -0.035858154296875, 0.703125, -0.329345703125, -0.51123046875, 0.425537109375, -0.90185546875, -0.51953125, -0.0946044921875, 0.10833740234375, -0.2239990234375, 0.230224609375, -0.376220703125, 0.44677734375, -0.008575439453125, 0.51513671875, -0.389404296875, -1.1474609375, -0.251953125, -1.2177734375, -0.30908203125, -0.60595703125, -0.337158203125, -0.0654296875, 0.2230224609375, 0.27490234375, -0.43701171875, 0.09161376953125, 0.459716796875, -0.5556640625, 0.69384765625, -0.5537109375, 0.307373046875, -0.7373046875, -0.456787109375, -0.7177734375, 0.12286376953125, -0.5791015625, -0.01486968994140625, -0.6455078125, 0.21875, -0.0450439453125, 0.420654296875, -0.06683349609375, 0.52001953125, -0.22314453125, -0.591796875, 0.21337890625, 0.0404052734375, -0.1343994140625, 0.490966796875, 0.54638671875, -0.12109375, 0.3896484375, -0.07470703125, -0.239501953125, -0.64208984375, 0.662109375, 0.43115234375, -0.00144195556640625, -0.21875, -0.0244293212890625, 0.360107421875, -0.927734375, 0.583984375, -0.1585693359375, 0.00012552738189697266, -0.02777099609375, -0.410888671875, 0.3623046875, 1.2763671875, -0.14013671875, 0.62353515625, -0.1910400390625, 0.1009521484375, 0.27734375, 0.056549072265625, -0.1444091796875, 0.4638671875, -0.08258056640625, -0.15869140625, -0.009613037109375, 0.52880859375, 0.046844482421875, 0.6962890625, -0.3427734375, -0.87890625, -0.88720703125, -0.4326171875, 0.10009765625, 0.25439453125, 0.53466796875, -0.28857421875, -0.01666259765625, -0.2061767578125, -0.193359375, 0.449462890625, -1.0830078125, -1.048828125, 0.3046875, -0.080810546875, -0.662109375, -0.2391357421875, -0.75341796875, -0.53759765625, -0.0017499923706054688, 0.318603515625, -0.61572265625, 0.474609375, 0.027801513671875, 0.85791015625, -0.4833984375, 0.286865234375, 0.060577392578125, 0.56591796875, -0.53955078125, -0.441650390625, -0.040374755859375, 1.0703125, 0.1668701171875, -0.296142578125, -0.49072265625, 0.43603515625, 0.010040283203125, 0.288330078125, -0.1439208984375, 0.07098388671875, -0.40234375, 0.73046875, -1.0830078125, 0.037445068359375, -0.175048828125, 0.38037109375, -0.0782470703125, -0.5478515625, -0.47412109375, 1.1298828125, 0.6513671875, -0.156982421875, 0.5810546875, 0.0276641845703125, 0.47119140625, -0.1917724609375, 0.06683349609375, -0.33447265625, 0.8251953125, 0.484130859375, 0.9619140625, -0.359619140625, 0.09954833984375, 0.56982421875, 0.07568359375, -0.388671875, 0.03375244140625, -0.013427734375, -0.06256103515625, 0.453125, -0.2685546875, -0.089111328125, -0.016326904296875, -0.74365234375, 0.439697265625, -0.42333984375, -0.036041259765625, -0.171630859375, -0.95361328125, 0.92724609375, -0.450439453125, 0.0308074951171875, 0.6591796875, -0.368896484375, -0.05450439453125, 0.63134765625, -0.0902099609375, -0.4404296875, 0.7333984375, 0.724609375, 0.469482421875, 0.5732421875, 0.61669921875, 0.47119140625, -0.888671875, 0.30419921875, 0.2244873046875, -0.155029296875, -0.07269287109375, -0.64404296875, -0.982421875, 0.351806640625, -0.30517578125, -0.076416015625, 0.66015625, -0.7685546875, 0.01485443115234375, -0.52880859375, 0.75439453125, -0.389404296875, 0.413330078125, 0.11993408203125, -0.67578125, -0.439208984375, 0.61865234375, -0.25732421875, 0.5185546875, 0.0028533935546875, 1.0986328125, -0.07440185546875, 1.4306640625, 0.83935546875, -0.320068359375, 0.211669921875, 0.473388671875, -0.2188720703125, -0.444091796875, -0.71630859375, -0.49951171875, 0.1947021484375, -0.55419921875, -0.5400390625, -0.042236328125, 1.083984375, -0.03485107421875, -1.2470703125, -0.591796875, 0.1669921875, -1.1484375, 0.2174072265625, 0.51171875, 0.431396484375, -0.1143798828125, -0.12115478515625, -0.036529541015625, -0.6591796875, 0.477294921875, -0.9609375, 0.24658203125, -0.383056640625, -0.44189453125, -0.53857421875, -0.66259765625, -0.51025390625, -0.192138671875, -0.234375, -0.974609375, 0.525390625, 0.397705078125, 0.74560546875, 0.305908203125, -0.294677734375, 0.30615234375, 1.0361328125, 1.28125, 0.07830810546875, 0.6943359375, 0.5029296875, -0.383544921875, 0.253662109375, -0.4599609375, 0.2108154296875, -0.14111328125, 0.53076171875, -0.35546875, 0.368896484375, -0.84423828125, -1.2216796875, -0.197998046875, 0.5498046875, 0.2442626953125, -0.66259765625, -0.95703125, -0.2734375, -0.96923828125, -0.33740234375, -0.67333984375, 0.78369140625, -0.35986328125, 0.147705078125, 0.1817626953125, -1.2412109375, 4.390625, 1.09375, 0.9404296875, 0.45361328125, 0.25634765625, 1.0673828125, 0.224365234375, -0.444580078125, -0.1875, -0.297119140625, 0.3115234375, -0.51708984375, -0.028961181640625, 0.80810546875, 0.1041259765625, 0.354248046875, -0.60400390625, -0.014129638671875, -0.16845703125, -0.8447265625, -0.51611328125, 0.1051025390625, -0.1497802734375, 0.4052734375, 0.2274169921875, 0.160400390625, 0.378662109375, -0.83984375, -0.432861328125, -0.568359375, 0.344970703125, -0.58544921875, 0.90380859375, 0.345458984375, -0.2152099609375, 0.58984375, -0.265625, -0.5185546875, -0.085693359375, 0.06634521484375, -0.258056640625, 0.51025390625, 0.6103515625, -0.7158203125, -0.329833984375, 0.43896484375, -0.71435546875, 0.38916015625, 0.1259765625, -1.1103515625, 0.8095703125, -0.34375, 0.572265625, -0.80322265625, -0.79296875, 0.498291015625, 0.1243896484375, 0.11480712890625, -0.4287109375, 0.54443359375, 0.59033203125, 0.318359375, 0.34228515625, 0.7333984375, -1.34375, 0.58203125, -0.1776123046875, 0.428955078125, -0.5439453125, 0.102294921875, -0.1783447265625, -0.277099609375, -0.273681640625, -0.401123046875, 0.5322265625, 0.474853515625, -0.2432861328125, 0.978515625, 0.49365234375, -0.81884765625, 0.048675537109375, -0.0018157958984375, -0.1951904296875, -0.419921875, 0.8544921875, 1.2626953125, -0.467041015625, -0.071044921875, -0.446533203125, 0.810546875, 0.8056640625, 0.71240234375, 0.0011663436889648438, -0.37158203125, -0.071044921875 ]
6
Provide tags and a correct Python 3 solution for this coding contest problem. This problem is different from the easy version. In this version Ujan makes at most 2n swaps. In addition, k ≤ 1000, n ≤ 50 and it is necessary to print swaps themselves. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems. After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first. Ujan has two distinct strings s and t of length n consisting of only of lowercase English characters. He wants to make them equal. Since Ujan is lazy, he will perform the following operation at most 2n times: he takes two positions i and j (1 ≤ i,j ≤ n, the values i and j can be equal or different), and swaps the characters s_i and t_j. Ujan's goal is to make the strings s and t equal. He does not need to minimize the number of performed operations: any sequence of operations of length 2n or shorter is suitable. Input The first line contains a single integer k (1 ≤ k ≤ 1000), the number of test cases. For each of the test cases, the first line contains a single integer n (2 ≤ n ≤ 50), the length of the strings s and t. Each of the next two lines contains the strings s and t, each having length exactly n. The strings consist only of lowercase English letters. It is guaranteed that strings are different. Output For each test case, output "Yes" if Ujan can make the two strings equal with at most 2n operations and "No" otherwise. You can print each letter in any case (upper or lower). In the case of "Yes" print m (1 ≤ m ≤ 2n) on the next line, where m is the number of swap operations to make the strings equal. Then print m lines, each line should contain two integers i, j (1 ≤ i, j ≤ n) meaning that Ujan swaps s_i and t_j during the corresponding operation. You do not need to minimize the number of operations. Any sequence of length not more than 2n is suitable. Example Input 4 5 souse houhe 3 cat dog 2 aa az 3 abc bca Output Yes 1 1 4 No No Yes 3 1 2 3 1 2 3 Tags: strings Correct Solution: ``` for _ in range(int(input())): n = int(input()) na = list(input()) nb = list(input()) k=0 zz = len(na) ans = [] for i in range(zz): f = 0 if(na[i]==nb[i]): f= 1 if(not f): for j in range(i+1,zz): if(na[j]==na[i]): ans.append((j+1,i+1)) na[j] = nb[i] f = 1 break if(not f): for j in range(i+1,zz): if(na[i]==nb[j]): ans.append((j+1,j+1)) ans.append((j+1,i+1)) nb[j] = na[j] na[j] = nb[i] f = 1 break #print(na,nb) if(not f): k =1 break if(k): print("NO") else: print("YES") print(len(ans)) for t in ans: print(t[0],t[1]) ```
131
[ 0.28955078125, -0.09613037109375, -0.1514892578125, -0.057098388671875, -0.62646484375, -0.5537109375, 0.038604736328125, -0.0033721923828125, 0.071533203125, 1.01953125, 0.978515625, 0.06304931640625, 0.2388916015625, -1.1875, -0.63916015625, -0.00443267822265625, -0.4404296875, -0.497314453125, -0.415283203125, -0.288330078125, 0.1864013671875, -0.291259765625, -1.4765625, -0.1077880859375, -0.293701171875, 0.7734375, 0.32421875, -0.142822265625, 0.79736328125, 1.1728515625, 0.034332275390625, -0.037689208984375, 0.369873046875, -1.111328125, -0.15087890625, -0.40234375, 0.50634765625, -0.453125, -0.298828125, -0.53515625, 0.31787109375, -0.85595703125, 0.30517578125, -0.658203125, -1.115234375, 0.11724853515625, -0.5478515625, -0.31640625, -0.09149169921875, -0.5546875, 0.38427734375, -0.287353515625, 0.74609375, 0.0259552001953125, 0.10565185546875, 0.37109375, -0.1683349609375, -0.2379150390625, -0.6650390625, 0.1639404296875, 0.201416015625, 0.1649169921875, -0.2064208984375, -0.61572265625, -0.1292724609375, 0.006328582763671875, 0.0188751220703125, -0.34326171875, 0.0814208984375, -1.0888671875, -0.3544921875, 0.269287109375, -0.31982421875, -0.413330078125, -0.388671875, 0.308349609375, 0.26904296875, -0.347412109375, -0.7685546875, 0.80029296875, -0.1287841796875, 1.0234375, 0.139404296875, 0.00463104248046875, -0.71728515625, -0.37255859375, 0.245361328125, 0.337646484375, 0.31982421875, -0.01922607421875, -0.0472412109375, 0.62890625, -0.513671875, 0.0716552734375, 0.5888671875, 0.568359375, -0.256103515625, 0.369140625, 0.43896484375, -0.09429931640625, 0.64697265625, 0.646484375, -0.5966796875, 1.1181640625, -0.485107421875, -0.160400390625, 0.052001953125, -0.148193359375, -0.160888671875, 0.04840087890625, -0.14013671875, -0.29736328125, 0.982421875, 0.40283203125, -0.474365234375, 0.623046875, 0.160888671875, 0.4384765625, -0.76513671875, 0.402099609375, 0.69677734375, -0.1361083984375, 0.67431640625, -0.1473388671875, -0.05010986328125, -0.22119140625, -0.382080078125, 0.89306640625, -0.50537109375, 0.041473388671875, 0.333251953125, -0.2275390625, -0.0165252685546875, 0.33251953125, -0.342529296875, 1.072265625, -0.26025390625, 0.71240234375, 0.382568359375, -0.416259765625, 0.4697265625, -0.2423095703125, 0.039703369140625, 1.6279296875, 0.484375, -0.036712646484375, 0.9677734375, 0.44580078125, -0.64892578125, 0.09979248046875, -0.94287109375, 0.5986328125, 0.14306640625, 0.51513671875, -0.1693115234375, -0.08648681640625, -0.3515625, 0.33154296875, 0.309814453125, 0.2496337890625, -0.25439453125, 0.113525390625, -0.11273193359375, 0.69287109375, -0.07489013671875, 1.138671875, -0.4482421875, -0.2069091796875, -0.10089111328125, -0.4658203125, 0.1990966796875, -0.339111328125, -0.34375, 0.72900390625, 0.6689453125, 1.01953125, 0.9677734375, -0.1910400390625, 0.04498291015625, 0.2059326171875, -0.3349609375, 0.373046875, 0.0738525390625, 0.6552734375, 0.125244140625, 0.06671142578125, 0.281005859375, -0.257080078125, -0.481689453125, -0.416259765625, 0.14892578125, 0.791015625, -0.494140625, -0.0284576416015625, 0.269775390625, 0.25390625, -0.73193359375, 0.0214691162109375, -0.331787109375, -0.7705078125, -0.486572265625, 0.245849609375, -0.18115234375, 0.57861328125, -0.439697265625, -0.75, 0.445556640625, 0.67333984375, -0.3076171875, -0.22265625, 0.40869140625, 0.4423828125, -0.379150390625, 0.315673828125, -0.076416015625, 0.03582763671875, -0.372802734375, 0.8955078125, -0.313720703125, 0.042816162109375, 0.42431640625, 0.75830078125, 0.5498046875, 0.486572265625, -0.2432861328125, -0.1485595703125, 0.94287109375, 1.2294921875, -0.003391265869140625, 0.428466796875, 0.147705078125, 0.88330078125, 0.9853515625, 0.9365234375, 0.919921875, -0.0026092529296875, 0.66357421875, 0.87841796875, 0.2239990234375, 0.1536865234375, 0.46728515625, 0.3896484375, 0.406005859375, 0.677734375, -0.00873565673828125, 0.293212890625, -0.31982421875, 0.490234375, -0.324951171875, 0.240234375, -0.261474609375, 0.775390625, 0.25537109375, 0.4248046875, -0.3828125, -0.474365234375, 0.331298828125, 0.884765625, -0.88330078125, -0.619140625, -0.2476806640625, 0.0826416015625, 0.0985107421875, -0.288818359375, 0.49560546875, 0.3037109375, 0.21435546875, 0.482421875, -0.278564453125, -0.495361328125, -1.328125, -0.8603515625, -0.9892578125, -0.41650390625, -0.916015625, 0.124267578125, 0.35009765625, -0.8115234375, 0.294189453125, -0.41943359375, -0.237548828125, 0.1826171875, -0.64794921875, 0.59521484375, 0.0143890380859375, 0.498779296875, -0.5087890625, 0.76220703125, 0.54248046875, 0.94287109375, -0.7412109375, -0.11431884765625, -0.396240234375, -0.53369140625, 0.186767578125, 0.13330078125, 0.468017578125, -0.08514404296875, -0.61962890625, -0.6083984375, -0.80126953125, -0.51953125, -0.65771484375, -0.09912109375, -0.328369140625, 0.84716796875, 0.5263671875, -0.67431640625, 0.43115234375, 1.0927734375, -0.28173828125, 0.263916015625, 0.0018148422241210938, 0.0060272216796875, -0.73291015625, 1.0712890625, 0.1822509765625, 0.5927734375, -0.38330078125, -0.267822265625, -0.2490234375, 0.2120361328125, 0.1536865234375, -0.45556640625, -0.24462890625, 0.335693359375, -0.0263671875, -1.0009765625, 0.45068359375, -0.87890625, -0.46435546875, -0.2474365234375, -0.68603515625, 0.5, 0.92919921875, -0.08306884765625, -0.1705322265625, 0.06671142578125, 0.08599853515625, 0.67724609375, 0.38330078125, -0.55322265625, 0.11932373046875, 0.279296875, 0.17138671875, -0.263671875, 0.435546875, -0.568359375, -0.0297698974609375, -0.0679931640625, 0.49755859375, 0.68994140625, 0.1962890625, 0.57861328125, 0.492919921875, 0.9091796875, -0.492431640625, -0.279296875, -0.035675048828125, 0.623046875, 0.38037109375, 0.662109375, 0.3515625, -0.439697265625, -0.78369140625, -1.287109375, 0.45947265625, 0.2471923828125, 0.82373046875, -0.859375, 0.7119140625, 0.05029296875, -0.446044921875, 0.263916015625, -0.61767578125, -0.08978271484375, 1.078125, -0.1929931640625, 0.83740234375, -0.64697265625, 0.384033203125, -0.1923828125, -0.038818359375, 0.5927734375, 0.340087890625, 0.46826171875, -0.498046875, -0.54443359375, -0.58349609375, 0.25830078125, -0.2393798828125, -0.39306640625, 0.1536865234375, -0.464599609375, -0.14892578125, -0.87939453125, 0.6279296875, 0.58740234375, 0.57470703125, -0.11962890625, 0.564453125, 0.53662109375, 0.51318359375, 0.4267578125, -0.6328125, 0.302734375, -0.810546875, 0.5908203125, 0.217041015625, -0.35107421875, -0.42626953125, -0.45263671875, -0.444580078125, 0.2052001953125, 0.2301025390625, -0.218994140625, -0.93212890625, 0.57421875, -0.1793212890625, 0.58740234375, -0.42431640625, -0.240966796875, -0.63720703125, 0.419921875, 0.60986328125, -0.89501953125, 0.53466796875, -0.6572265625, 0.7998046875, 0.4541015625, -0.181640625, -0.2171630859375, -0.4560546875, -0.6474609375, -0.492431640625, 0.0482177734375, 0.99560546875, -0.04327392578125, 0.087646484375, -1.0322265625, 0.25439453125, 0.2437744140625, -0.47705078125, 0.10113525390625, -0.181640625, 0.38427734375, 0.1453857421875, 0.705078125, -0.360107421875, -0.311279296875, 0.124267578125, -1.34375, 0.401123046875, -0.51806640625, 0.5029296875, -0.316650390625, -0.0947265625, 0.12371826171875, 0.51953125, -0.428955078125, -0.33447265625, -0.278076171875, 0.5859375, -0.92333984375, -0.79345703125, 0.389404296875, -0.311767578125, -0.2113037109375, 0.92431640625, -0.369140625, -0.2841796875, 0.286376953125, 0.8671875, -0.456787109375, 0.3134765625, -0.4033203125, 0.465087890625, -0.52734375, -0.7177734375, -0.2041015625, -0.65576171875, 0.966796875, 0.06689453125, -0.671875, -0.3544921875, -1.1240234375, -0.156494140625, 0.1876220703125, -0.63818359375, 0.158203125, 0.2431640625, 0.0106048583984375, -0.3291015625, -0.421875, -0.3330078125, -0.2734375, -0.81396484375, -0.36474609375, 0.341064453125, 0.59912109375, 0.47119140625, -0.354248046875, -0.54052734375, -0.06396484375, -0.2197265625, 0.0360107421875, -0.3720703125, -0.431884765625, -0.235595703125, -0.07244873046875, -0.302490234375, 0.1182861328125, 0.020782470703125, 0.07135009765625, 0.6455078125, -0.1256103515625, 0.51953125, 0.1602783203125, -0.69482421875, 1.029296875, -0.04766845703125, -1.0283203125, -0.378662109375, 0.16748046875, 0.1739501953125, 0.54541015625, 0.3154296875, -0.771484375, -0.80224609375, -1.0146484375, 0.1500244140625, -0.666015625, -0.074951171875, -0.892578125, -0.01439666748046875, -0.6318359375, 0.630859375, -0.1673583984375, -0.6787109375, 0.13427734375, -0.9755859375, 0.152587890625, -0.68359375, -0.232177734375, -0.75, -0.517578125, -0.56005859375, 0.865234375, 0.23681640625, 0.484130859375, -0.178955078125, -0.2335205078125, 0.29638671875, -0.06390380859375, -0.5859375, -0.331787109375, -0.07672119140625, 0.46435546875, -0.51806640625, -0.249755859375, -0.469970703125, 0.67724609375, -0.8603515625, 0.2783203125, -0.293701171875, -0.377685546875, -0.05657958984375, -0.1854248046875, 1.181640625, -0.158203125, 0.3486328125, -0.420654296875, 0.87158203125, 0.7197265625, -0.54052734375, -0.65869140625, -0.904296875, -0.86376953125, -0.8251953125, 0.450927734375, -0.671875, 0.22509765625, -0.66796875, -0.1658935546875, 1.0625, -0.53857421875, 0.27783203125, 1.109375, 0.2125244140625, 0.64599609375, -0.802734375, 0.58056640625, 0.20068359375, -0.787109375, 0.0073394775390625, 0.2305908203125, -0.5888671875, 0.033538818359375, -0.1719970703125, -0.8583984375, -0.6708984375, 0.370849609375, 1.3828125, -0.369873046875, 0.63427734375, -0.058441162109375, -0.8896484375, -0.7314453125, 0.71923828125, 0.276611328125, 0.33837890625, 1.0390625, -0.2088623046875, 0.07501220703125, -0.376953125, 0.18359375, -0.206298828125, -0.5595703125, 0.9599609375, -0.1632080078125, -0.6142578125, 0.87451171875, 0.90576171875, -1.0556640625, -0.724609375, -0.09893798828125, -0.03448486328125, -0.20849609375, -0.634765625, -0.255615234375, 0.49951171875, -0.51220703125, 0.14892578125, 0.5126953125, -0.1190185546875, 0.324462890625, -0.050140380859375, 0.0751953125, -0.486328125, 0.60546875, 0.525390625, -0.425537109375, -0.1278076171875, -1.0771484375, -0.5068359375, -0.3759765625, 0.046142578125, 0.54833984375, -0.422607421875, 0.321044921875, 0.49755859375, -0.035858154296875, 0.703125, -0.329345703125, -0.51123046875, 0.425537109375, -0.90185546875, -0.51953125, -0.0946044921875, 0.10833740234375, -0.2239990234375, 0.230224609375, -0.376220703125, 0.44677734375, -0.008575439453125, 0.51513671875, -0.389404296875, -1.1474609375, -0.251953125, -1.2177734375, -0.30908203125, -0.60595703125, -0.337158203125, -0.0654296875, 0.2230224609375, 0.27490234375, -0.43701171875, 0.09161376953125, 0.459716796875, -0.5556640625, 0.69384765625, -0.5537109375, 0.307373046875, -0.7373046875, -0.456787109375, -0.7177734375, 0.12286376953125, -0.5791015625, -0.01486968994140625, -0.6455078125, 0.21875, -0.0450439453125, 0.420654296875, -0.06683349609375, 0.52001953125, -0.22314453125, -0.591796875, 0.21337890625, 0.0404052734375, -0.1343994140625, 0.490966796875, 0.54638671875, -0.12109375, 0.3896484375, -0.07470703125, -0.239501953125, -0.64208984375, 0.662109375, 0.43115234375, -0.00144195556640625, -0.21875, -0.0244293212890625, 0.360107421875, -0.927734375, 0.583984375, -0.1585693359375, 0.00012552738189697266, -0.02777099609375, -0.410888671875, 0.3623046875, 1.2763671875, -0.14013671875, 0.62353515625, -0.1910400390625, 0.1009521484375, 0.27734375, 0.056549072265625, -0.1444091796875, 0.4638671875, -0.08258056640625, -0.15869140625, -0.009613037109375, 0.52880859375, 0.046844482421875, 0.6962890625, -0.3427734375, -0.87890625, -0.88720703125, -0.4326171875, 0.10009765625, 0.25439453125, 0.53466796875, -0.28857421875, -0.01666259765625, -0.2061767578125, -0.193359375, 0.449462890625, -1.0830078125, -1.048828125, 0.3046875, -0.080810546875, -0.662109375, -0.2391357421875, -0.75341796875, -0.53759765625, -0.0017499923706054688, 0.318603515625, -0.61572265625, 0.474609375, 0.027801513671875, 0.85791015625, -0.4833984375, 0.286865234375, 0.060577392578125, 0.56591796875, -0.53955078125, -0.441650390625, -0.040374755859375, 1.0703125, 0.1668701171875, -0.296142578125, -0.49072265625, 0.43603515625, 0.010040283203125, 0.288330078125, -0.1439208984375, 0.07098388671875, -0.40234375, 0.73046875, -1.0830078125, 0.037445068359375, -0.175048828125, 0.38037109375, -0.0782470703125, -0.5478515625, -0.47412109375, 1.1298828125, 0.6513671875, -0.156982421875, 0.5810546875, 0.0276641845703125, 0.47119140625, -0.1917724609375, 0.06683349609375, -0.33447265625, 0.8251953125, 0.484130859375, 0.9619140625, -0.359619140625, 0.09954833984375, 0.56982421875, 0.07568359375, -0.388671875, 0.03375244140625, -0.013427734375, -0.06256103515625, 0.453125, -0.2685546875, -0.089111328125, -0.016326904296875, -0.74365234375, 0.439697265625, -0.42333984375, -0.036041259765625, -0.171630859375, -0.95361328125, 0.92724609375, -0.450439453125, 0.0308074951171875, 0.6591796875, -0.368896484375, -0.05450439453125, 0.63134765625, -0.0902099609375, -0.4404296875, 0.7333984375, 0.724609375, 0.469482421875, 0.5732421875, 0.61669921875, 0.47119140625, -0.888671875, 0.30419921875, 0.2244873046875, -0.155029296875, -0.07269287109375, -0.64404296875, -0.982421875, 0.351806640625, -0.30517578125, -0.076416015625, 0.66015625, -0.7685546875, 0.01485443115234375, -0.52880859375, 0.75439453125, -0.389404296875, 0.413330078125, 0.11993408203125, -0.67578125, -0.439208984375, 0.61865234375, -0.25732421875, 0.5185546875, 0.0028533935546875, 1.0986328125, -0.07440185546875, 1.4306640625, 0.83935546875, -0.320068359375, 0.211669921875, 0.473388671875, -0.2188720703125, -0.444091796875, -0.71630859375, -0.49951171875, 0.1947021484375, -0.55419921875, -0.5400390625, -0.042236328125, 1.083984375, -0.03485107421875, -1.2470703125, -0.591796875, 0.1669921875, -1.1484375, 0.2174072265625, 0.51171875, 0.431396484375, -0.1143798828125, -0.12115478515625, -0.036529541015625, -0.6591796875, 0.477294921875, -0.9609375, 0.24658203125, -0.383056640625, -0.44189453125, -0.53857421875, -0.66259765625, -0.51025390625, -0.192138671875, -0.234375, -0.974609375, 0.525390625, 0.397705078125, 0.74560546875, 0.305908203125, -0.294677734375, 0.30615234375, 1.0361328125, 1.28125, 0.07830810546875, 0.6943359375, 0.5029296875, -0.383544921875, 0.253662109375, -0.4599609375, 0.2108154296875, -0.14111328125, 0.53076171875, -0.35546875, 0.368896484375, -0.84423828125, -1.2216796875, -0.197998046875, 0.5498046875, 0.2442626953125, -0.66259765625, -0.95703125, -0.2734375, -0.96923828125, -0.33740234375, -0.67333984375, 0.78369140625, -0.35986328125, 0.147705078125, 0.1817626953125, -1.2412109375, 4.390625, 1.09375, 0.9404296875, 0.45361328125, 0.25634765625, 1.0673828125, 0.224365234375, -0.444580078125, -0.1875, -0.297119140625, 0.3115234375, -0.51708984375, -0.028961181640625, 0.80810546875, 0.1041259765625, 0.354248046875, -0.60400390625, -0.014129638671875, -0.16845703125, -0.8447265625, -0.51611328125, 0.1051025390625, -0.1497802734375, 0.4052734375, 0.2274169921875, 0.160400390625, 0.378662109375, -0.83984375, -0.432861328125, -0.568359375, 0.344970703125, -0.58544921875, 0.90380859375, 0.345458984375, -0.2152099609375, 0.58984375, -0.265625, -0.5185546875, -0.085693359375, 0.06634521484375, -0.258056640625, 0.51025390625, 0.6103515625, -0.7158203125, -0.329833984375, 0.43896484375, -0.71435546875, 0.38916015625, 0.1259765625, -1.1103515625, 0.8095703125, -0.34375, 0.572265625, -0.80322265625, -0.79296875, 0.498291015625, 0.1243896484375, 0.11480712890625, -0.4287109375, 0.54443359375, 0.59033203125, 0.318359375, 0.34228515625, 0.7333984375, -1.34375, 0.58203125, -0.1776123046875, 0.428955078125, -0.5439453125, 0.102294921875, -0.1783447265625, -0.277099609375, -0.273681640625, -0.401123046875, 0.5322265625, 0.474853515625, -0.2432861328125, 0.978515625, 0.49365234375, -0.81884765625, 0.048675537109375, -0.0018157958984375, -0.1951904296875, -0.419921875, 0.8544921875, 1.2626953125, -0.467041015625, -0.071044921875, -0.446533203125, 0.810546875, 0.8056640625, 0.71240234375, 0.0011663436889648438, -0.37158203125, -0.071044921875 ]
6
Provide tags and a correct Python 3 solution for this coding contest problem. This problem is different from the easy version. In this version Ujan makes at most 2n swaps. In addition, k ≤ 1000, n ≤ 50 and it is necessary to print swaps themselves. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems. After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first. Ujan has two distinct strings s and t of length n consisting of only of lowercase English characters. He wants to make them equal. Since Ujan is lazy, he will perform the following operation at most 2n times: he takes two positions i and j (1 ≤ i,j ≤ n, the values i and j can be equal or different), and swaps the characters s_i and t_j. Ujan's goal is to make the strings s and t equal. He does not need to minimize the number of performed operations: any sequence of operations of length 2n or shorter is suitable. Input The first line contains a single integer k (1 ≤ k ≤ 1000), the number of test cases. For each of the test cases, the first line contains a single integer n (2 ≤ n ≤ 50), the length of the strings s and t. Each of the next two lines contains the strings s and t, each having length exactly n. The strings consist only of lowercase English letters. It is guaranteed that strings are different. Output For each test case, output "Yes" if Ujan can make the two strings equal with at most 2n operations and "No" otherwise. You can print each letter in any case (upper or lower). In the case of "Yes" print m (1 ≤ m ≤ 2n) on the next line, where m is the number of swap operations to make the strings equal. Then print m lines, each line should contain two integers i, j (1 ≤ i, j ≤ n) meaning that Ujan swaps s_i and t_j during the corresponding operation. You do not need to minimize the number of operations. Any sequence of length not more than 2n is suitable. Example Input 4 5 souse houhe 3 cat dog 2 aa az 3 abc bca Output Yes 1 1 4 No No Yes 3 1 2 3 1 2 3 Tags: strings Correct Solution: ``` T = int(input()) for t in range(T): N = int(input()) s = list(input()) t = list(input()) i = 0 possible = True res = [] while i < N: # print("i : ", i) # print("res : ", res) # print("s[i], t[i] : ", s[i], t[i]) if s[i] != t[i]: # Find index j such that s[i] == s[j] or s[i] == t[j] # If no such j, then impossible j = i + 1 found = False while j < N: # print("j : ", j) # Then we just swap sj with ti if s[i] == s[j]: res.append((j, i)) s[j], t[i] = t[i], s[j] found = True break # Then we first swap sj with tj # Then sj with ti elif s[i] == t[j]: res.append((j, j)) s[j], t[j] = t[j], s[j] res.append((j, i)) s[j], t[i] = t[i], s[j] found = True break j += 1 if not (found): possible = False break i += 1 if possible: print("Yes") print(len(res)) for i, j in res: print(i + 1, j + 1) else: print("No") ```
132
[ 0.28955078125, -0.09613037109375, -0.1514892578125, -0.057098388671875, -0.62646484375, -0.5537109375, 0.038604736328125, -0.0033721923828125, 0.071533203125, 1.01953125, 0.978515625, 0.06304931640625, 0.2388916015625, -1.1875, -0.63916015625, -0.00443267822265625, -0.4404296875, -0.497314453125, -0.415283203125, -0.288330078125, 0.1864013671875, -0.291259765625, -1.4765625, -0.1077880859375, -0.293701171875, 0.7734375, 0.32421875, -0.142822265625, 0.79736328125, 1.1728515625, 0.034332275390625, -0.037689208984375, 0.369873046875, -1.111328125, -0.15087890625, -0.40234375, 0.50634765625, -0.453125, -0.298828125, -0.53515625, 0.31787109375, -0.85595703125, 0.30517578125, -0.658203125, -1.115234375, 0.11724853515625, -0.5478515625, -0.31640625, -0.09149169921875, -0.5546875, 0.38427734375, -0.287353515625, 0.74609375, 0.0259552001953125, 0.10565185546875, 0.37109375, -0.1683349609375, -0.2379150390625, -0.6650390625, 0.1639404296875, 0.201416015625, 0.1649169921875, -0.2064208984375, -0.61572265625, -0.1292724609375, 0.006328582763671875, 0.0188751220703125, -0.34326171875, 0.0814208984375, -1.0888671875, -0.3544921875, 0.269287109375, -0.31982421875, -0.413330078125, -0.388671875, 0.308349609375, 0.26904296875, -0.347412109375, -0.7685546875, 0.80029296875, -0.1287841796875, 1.0234375, 0.139404296875, 0.00463104248046875, -0.71728515625, -0.37255859375, 0.245361328125, 0.337646484375, 0.31982421875, -0.01922607421875, -0.0472412109375, 0.62890625, -0.513671875, 0.0716552734375, 0.5888671875, 0.568359375, -0.256103515625, 0.369140625, 0.43896484375, -0.09429931640625, 0.64697265625, 0.646484375, -0.5966796875, 1.1181640625, -0.485107421875, -0.160400390625, 0.052001953125, -0.148193359375, -0.160888671875, 0.04840087890625, -0.14013671875, -0.29736328125, 0.982421875, 0.40283203125, -0.474365234375, 0.623046875, 0.160888671875, 0.4384765625, -0.76513671875, 0.402099609375, 0.69677734375, -0.1361083984375, 0.67431640625, -0.1473388671875, -0.05010986328125, -0.22119140625, -0.382080078125, 0.89306640625, -0.50537109375, 0.041473388671875, 0.333251953125, -0.2275390625, -0.0165252685546875, 0.33251953125, -0.342529296875, 1.072265625, -0.26025390625, 0.71240234375, 0.382568359375, -0.416259765625, 0.4697265625, -0.2423095703125, 0.039703369140625, 1.6279296875, 0.484375, -0.036712646484375, 0.9677734375, 0.44580078125, -0.64892578125, 0.09979248046875, -0.94287109375, 0.5986328125, 0.14306640625, 0.51513671875, -0.1693115234375, -0.08648681640625, -0.3515625, 0.33154296875, 0.309814453125, 0.2496337890625, -0.25439453125, 0.113525390625, -0.11273193359375, 0.69287109375, -0.07489013671875, 1.138671875, -0.4482421875, -0.2069091796875, -0.10089111328125, -0.4658203125, 0.1990966796875, -0.339111328125, -0.34375, 0.72900390625, 0.6689453125, 1.01953125, 0.9677734375, -0.1910400390625, 0.04498291015625, 0.2059326171875, -0.3349609375, 0.373046875, 0.0738525390625, 0.6552734375, 0.125244140625, 0.06671142578125, 0.281005859375, -0.257080078125, -0.481689453125, -0.416259765625, 0.14892578125, 0.791015625, -0.494140625, -0.0284576416015625, 0.269775390625, 0.25390625, -0.73193359375, 0.0214691162109375, -0.331787109375, -0.7705078125, -0.486572265625, 0.245849609375, -0.18115234375, 0.57861328125, -0.439697265625, -0.75, 0.445556640625, 0.67333984375, -0.3076171875, -0.22265625, 0.40869140625, 0.4423828125, -0.379150390625, 0.315673828125, -0.076416015625, 0.03582763671875, -0.372802734375, 0.8955078125, -0.313720703125, 0.042816162109375, 0.42431640625, 0.75830078125, 0.5498046875, 0.486572265625, -0.2432861328125, -0.1485595703125, 0.94287109375, 1.2294921875, -0.003391265869140625, 0.428466796875, 0.147705078125, 0.88330078125, 0.9853515625, 0.9365234375, 0.919921875, -0.0026092529296875, 0.66357421875, 0.87841796875, 0.2239990234375, 0.1536865234375, 0.46728515625, 0.3896484375, 0.406005859375, 0.677734375, -0.00873565673828125, 0.293212890625, -0.31982421875, 0.490234375, -0.324951171875, 0.240234375, -0.261474609375, 0.775390625, 0.25537109375, 0.4248046875, -0.3828125, -0.474365234375, 0.331298828125, 0.884765625, -0.88330078125, -0.619140625, -0.2476806640625, 0.0826416015625, 0.0985107421875, -0.288818359375, 0.49560546875, 0.3037109375, 0.21435546875, 0.482421875, -0.278564453125, -0.495361328125, -1.328125, -0.8603515625, -0.9892578125, -0.41650390625, -0.916015625, 0.124267578125, 0.35009765625, -0.8115234375, 0.294189453125, -0.41943359375, -0.237548828125, 0.1826171875, -0.64794921875, 0.59521484375, 0.0143890380859375, 0.498779296875, -0.5087890625, 0.76220703125, 0.54248046875, 0.94287109375, -0.7412109375, -0.11431884765625, -0.396240234375, -0.53369140625, 0.186767578125, 0.13330078125, 0.468017578125, -0.08514404296875, -0.61962890625, -0.6083984375, -0.80126953125, -0.51953125, -0.65771484375, -0.09912109375, -0.328369140625, 0.84716796875, 0.5263671875, -0.67431640625, 0.43115234375, 1.0927734375, -0.28173828125, 0.263916015625, 0.0018148422241210938, 0.0060272216796875, -0.73291015625, 1.0712890625, 0.1822509765625, 0.5927734375, -0.38330078125, -0.267822265625, -0.2490234375, 0.2120361328125, 0.1536865234375, -0.45556640625, -0.24462890625, 0.335693359375, -0.0263671875, -1.0009765625, 0.45068359375, -0.87890625, -0.46435546875, -0.2474365234375, -0.68603515625, 0.5, 0.92919921875, -0.08306884765625, -0.1705322265625, 0.06671142578125, 0.08599853515625, 0.67724609375, 0.38330078125, -0.55322265625, 0.11932373046875, 0.279296875, 0.17138671875, -0.263671875, 0.435546875, -0.568359375, -0.0297698974609375, -0.0679931640625, 0.49755859375, 0.68994140625, 0.1962890625, 0.57861328125, 0.492919921875, 0.9091796875, -0.492431640625, -0.279296875, -0.035675048828125, 0.623046875, 0.38037109375, 0.662109375, 0.3515625, -0.439697265625, -0.78369140625, -1.287109375, 0.45947265625, 0.2471923828125, 0.82373046875, -0.859375, 0.7119140625, 0.05029296875, -0.446044921875, 0.263916015625, -0.61767578125, -0.08978271484375, 1.078125, -0.1929931640625, 0.83740234375, -0.64697265625, 0.384033203125, -0.1923828125, -0.038818359375, 0.5927734375, 0.340087890625, 0.46826171875, -0.498046875, -0.54443359375, -0.58349609375, 0.25830078125, -0.2393798828125, -0.39306640625, 0.1536865234375, -0.464599609375, -0.14892578125, -0.87939453125, 0.6279296875, 0.58740234375, 0.57470703125, -0.11962890625, 0.564453125, 0.53662109375, 0.51318359375, 0.4267578125, -0.6328125, 0.302734375, -0.810546875, 0.5908203125, 0.217041015625, -0.35107421875, -0.42626953125, -0.45263671875, -0.444580078125, 0.2052001953125, 0.2301025390625, -0.218994140625, -0.93212890625, 0.57421875, -0.1793212890625, 0.58740234375, -0.42431640625, -0.240966796875, -0.63720703125, 0.419921875, 0.60986328125, -0.89501953125, 0.53466796875, -0.6572265625, 0.7998046875, 0.4541015625, -0.181640625, -0.2171630859375, -0.4560546875, -0.6474609375, -0.492431640625, 0.0482177734375, 0.99560546875, -0.04327392578125, 0.087646484375, -1.0322265625, 0.25439453125, 0.2437744140625, -0.47705078125, 0.10113525390625, -0.181640625, 0.38427734375, 0.1453857421875, 0.705078125, -0.360107421875, -0.311279296875, 0.124267578125, -1.34375, 0.401123046875, -0.51806640625, 0.5029296875, -0.316650390625, -0.0947265625, 0.12371826171875, 0.51953125, -0.428955078125, -0.33447265625, -0.278076171875, 0.5859375, -0.92333984375, -0.79345703125, 0.389404296875, -0.311767578125, -0.2113037109375, 0.92431640625, -0.369140625, -0.2841796875, 0.286376953125, 0.8671875, -0.456787109375, 0.3134765625, -0.4033203125, 0.465087890625, -0.52734375, -0.7177734375, -0.2041015625, -0.65576171875, 0.966796875, 0.06689453125, -0.671875, -0.3544921875, -1.1240234375, -0.156494140625, 0.1876220703125, -0.63818359375, 0.158203125, 0.2431640625, 0.0106048583984375, -0.3291015625, -0.421875, -0.3330078125, -0.2734375, -0.81396484375, -0.36474609375, 0.341064453125, 0.59912109375, 0.47119140625, -0.354248046875, -0.54052734375, -0.06396484375, -0.2197265625, 0.0360107421875, -0.3720703125, -0.431884765625, -0.235595703125, -0.07244873046875, -0.302490234375, 0.1182861328125, 0.020782470703125, 0.07135009765625, 0.6455078125, -0.1256103515625, 0.51953125, 0.1602783203125, -0.69482421875, 1.029296875, -0.04766845703125, -1.0283203125, -0.378662109375, 0.16748046875, 0.1739501953125, 0.54541015625, 0.3154296875, -0.771484375, -0.80224609375, -1.0146484375, 0.1500244140625, -0.666015625, -0.074951171875, -0.892578125, -0.01439666748046875, -0.6318359375, 0.630859375, -0.1673583984375, -0.6787109375, 0.13427734375, -0.9755859375, 0.152587890625, -0.68359375, -0.232177734375, -0.75, -0.517578125, -0.56005859375, 0.865234375, 0.23681640625, 0.484130859375, -0.178955078125, -0.2335205078125, 0.29638671875, -0.06390380859375, -0.5859375, -0.331787109375, -0.07672119140625, 0.46435546875, -0.51806640625, -0.249755859375, -0.469970703125, 0.67724609375, -0.8603515625, 0.2783203125, -0.293701171875, -0.377685546875, -0.05657958984375, -0.1854248046875, 1.181640625, -0.158203125, 0.3486328125, -0.420654296875, 0.87158203125, 0.7197265625, -0.54052734375, -0.65869140625, -0.904296875, -0.86376953125, -0.8251953125, 0.450927734375, -0.671875, 0.22509765625, -0.66796875, -0.1658935546875, 1.0625, -0.53857421875, 0.27783203125, 1.109375, 0.2125244140625, 0.64599609375, -0.802734375, 0.58056640625, 0.20068359375, -0.787109375, 0.0073394775390625, 0.2305908203125, -0.5888671875, 0.033538818359375, -0.1719970703125, -0.8583984375, -0.6708984375, 0.370849609375, 1.3828125, -0.369873046875, 0.63427734375, -0.058441162109375, -0.8896484375, -0.7314453125, 0.71923828125, 0.276611328125, 0.33837890625, 1.0390625, -0.2088623046875, 0.07501220703125, -0.376953125, 0.18359375, -0.206298828125, -0.5595703125, 0.9599609375, -0.1632080078125, -0.6142578125, 0.87451171875, 0.90576171875, -1.0556640625, -0.724609375, -0.09893798828125, -0.03448486328125, -0.20849609375, -0.634765625, -0.255615234375, 0.49951171875, -0.51220703125, 0.14892578125, 0.5126953125, -0.1190185546875, 0.324462890625, -0.050140380859375, 0.0751953125, -0.486328125, 0.60546875, 0.525390625, -0.425537109375, -0.1278076171875, -1.0771484375, -0.5068359375, -0.3759765625, 0.046142578125, 0.54833984375, -0.422607421875, 0.321044921875, 0.49755859375, -0.035858154296875, 0.703125, -0.329345703125, -0.51123046875, 0.425537109375, -0.90185546875, -0.51953125, -0.0946044921875, 0.10833740234375, -0.2239990234375, 0.230224609375, -0.376220703125, 0.44677734375, -0.008575439453125, 0.51513671875, -0.389404296875, -1.1474609375, -0.251953125, -1.2177734375, -0.30908203125, -0.60595703125, -0.337158203125, -0.0654296875, 0.2230224609375, 0.27490234375, -0.43701171875, 0.09161376953125, 0.459716796875, -0.5556640625, 0.69384765625, -0.5537109375, 0.307373046875, -0.7373046875, -0.456787109375, -0.7177734375, 0.12286376953125, -0.5791015625, -0.01486968994140625, -0.6455078125, 0.21875, -0.0450439453125, 0.420654296875, -0.06683349609375, 0.52001953125, -0.22314453125, -0.591796875, 0.21337890625, 0.0404052734375, -0.1343994140625, 0.490966796875, 0.54638671875, -0.12109375, 0.3896484375, -0.07470703125, -0.239501953125, -0.64208984375, 0.662109375, 0.43115234375, -0.00144195556640625, -0.21875, -0.0244293212890625, 0.360107421875, -0.927734375, 0.583984375, -0.1585693359375, 0.00012552738189697266, -0.02777099609375, -0.410888671875, 0.3623046875, 1.2763671875, -0.14013671875, 0.62353515625, -0.1910400390625, 0.1009521484375, 0.27734375, 0.056549072265625, -0.1444091796875, 0.4638671875, -0.08258056640625, -0.15869140625, -0.009613037109375, 0.52880859375, 0.046844482421875, 0.6962890625, -0.3427734375, -0.87890625, -0.88720703125, -0.4326171875, 0.10009765625, 0.25439453125, 0.53466796875, -0.28857421875, -0.01666259765625, -0.2061767578125, -0.193359375, 0.449462890625, -1.0830078125, -1.048828125, 0.3046875, -0.080810546875, -0.662109375, -0.2391357421875, -0.75341796875, -0.53759765625, -0.0017499923706054688, 0.318603515625, -0.61572265625, 0.474609375, 0.027801513671875, 0.85791015625, -0.4833984375, 0.286865234375, 0.060577392578125, 0.56591796875, -0.53955078125, -0.441650390625, -0.040374755859375, 1.0703125, 0.1668701171875, -0.296142578125, -0.49072265625, 0.43603515625, 0.010040283203125, 0.288330078125, -0.1439208984375, 0.07098388671875, -0.40234375, 0.73046875, -1.0830078125, 0.037445068359375, -0.175048828125, 0.38037109375, -0.0782470703125, -0.5478515625, -0.47412109375, 1.1298828125, 0.6513671875, -0.156982421875, 0.5810546875, 0.0276641845703125, 0.47119140625, -0.1917724609375, 0.06683349609375, -0.33447265625, 0.8251953125, 0.484130859375, 0.9619140625, -0.359619140625, 0.09954833984375, 0.56982421875, 0.07568359375, -0.388671875, 0.03375244140625, -0.013427734375, -0.06256103515625, 0.453125, -0.2685546875, -0.089111328125, -0.016326904296875, -0.74365234375, 0.439697265625, -0.42333984375, -0.036041259765625, -0.171630859375, -0.95361328125, 0.92724609375, -0.450439453125, 0.0308074951171875, 0.6591796875, -0.368896484375, -0.05450439453125, 0.63134765625, -0.0902099609375, -0.4404296875, 0.7333984375, 0.724609375, 0.469482421875, 0.5732421875, 0.61669921875, 0.47119140625, -0.888671875, 0.30419921875, 0.2244873046875, -0.155029296875, -0.07269287109375, -0.64404296875, -0.982421875, 0.351806640625, -0.30517578125, -0.076416015625, 0.66015625, -0.7685546875, 0.01485443115234375, -0.52880859375, 0.75439453125, -0.389404296875, 0.413330078125, 0.11993408203125, -0.67578125, -0.439208984375, 0.61865234375, -0.25732421875, 0.5185546875, 0.0028533935546875, 1.0986328125, -0.07440185546875, 1.4306640625, 0.83935546875, -0.320068359375, 0.211669921875, 0.473388671875, -0.2188720703125, -0.444091796875, -0.71630859375, -0.49951171875, 0.1947021484375, -0.55419921875, -0.5400390625, -0.042236328125, 1.083984375, -0.03485107421875, -1.2470703125, -0.591796875, 0.1669921875, -1.1484375, 0.2174072265625, 0.51171875, 0.431396484375, -0.1143798828125, -0.12115478515625, -0.036529541015625, -0.6591796875, 0.477294921875, -0.9609375, 0.24658203125, -0.383056640625, -0.44189453125, -0.53857421875, -0.66259765625, -0.51025390625, -0.192138671875, -0.234375, -0.974609375, 0.525390625, 0.397705078125, 0.74560546875, 0.305908203125, -0.294677734375, 0.30615234375, 1.0361328125, 1.28125, 0.07830810546875, 0.6943359375, 0.5029296875, -0.383544921875, 0.253662109375, -0.4599609375, 0.2108154296875, -0.14111328125, 0.53076171875, -0.35546875, 0.368896484375, -0.84423828125, -1.2216796875, -0.197998046875, 0.5498046875, 0.2442626953125, -0.66259765625, -0.95703125, -0.2734375, -0.96923828125, -0.33740234375, -0.67333984375, 0.78369140625, -0.35986328125, 0.147705078125, 0.1817626953125, -1.2412109375, 4.390625, 1.09375, 0.9404296875, 0.45361328125, 0.25634765625, 1.0673828125, 0.224365234375, -0.444580078125, -0.1875, -0.297119140625, 0.3115234375, -0.51708984375, -0.028961181640625, 0.80810546875, 0.1041259765625, 0.354248046875, -0.60400390625, -0.014129638671875, -0.16845703125, -0.8447265625, -0.51611328125, 0.1051025390625, -0.1497802734375, 0.4052734375, 0.2274169921875, 0.160400390625, 0.378662109375, -0.83984375, -0.432861328125, -0.568359375, 0.344970703125, -0.58544921875, 0.90380859375, 0.345458984375, -0.2152099609375, 0.58984375, -0.265625, -0.5185546875, -0.085693359375, 0.06634521484375, -0.258056640625, 0.51025390625, 0.6103515625, -0.7158203125, -0.329833984375, 0.43896484375, -0.71435546875, 0.38916015625, 0.1259765625, -1.1103515625, 0.8095703125, -0.34375, 0.572265625, -0.80322265625, -0.79296875, 0.498291015625, 0.1243896484375, 0.11480712890625, -0.4287109375, 0.54443359375, 0.59033203125, 0.318359375, 0.34228515625, 0.7333984375, -1.34375, 0.58203125, -0.1776123046875, 0.428955078125, -0.5439453125, 0.102294921875, -0.1783447265625, -0.277099609375, -0.273681640625, -0.401123046875, 0.5322265625, 0.474853515625, -0.2432861328125, 0.978515625, 0.49365234375, -0.81884765625, 0.048675537109375, -0.0018157958984375, -0.1951904296875, -0.419921875, 0.8544921875, 1.2626953125, -0.467041015625, -0.071044921875, -0.446533203125, 0.810546875, 0.8056640625, 0.71240234375, 0.0011663436889648438, -0.37158203125, -0.071044921875 ]
6
Provide tags and a correct Python 3 solution for this coding contest problem. This problem is different from the easy version. In this version Ujan makes at most 2n swaps. In addition, k ≤ 1000, n ≤ 50 and it is necessary to print swaps themselves. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems. After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first. Ujan has two distinct strings s and t of length n consisting of only of lowercase English characters. He wants to make them equal. Since Ujan is lazy, he will perform the following operation at most 2n times: he takes two positions i and j (1 ≤ i,j ≤ n, the values i and j can be equal or different), and swaps the characters s_i and t_j. Ujan's goal is to make the strings s and t equal. He does not need to minimize the number of performed operations: any sequence of operations of length 2n or shorter is suitable. Input The first line contains a single integer k (1 ≤ k ≤ 1000), the number of test cases. For each of the test cases, the first line contains a single integer n (2 ≤ n ≤ 50), the length of the strings s and t. Each of the next two lines contains the strings s and t, each having length exactly n. The strings consist only of lowercase English letters. It is guaranteed that strings are different. Output For each test case, output "Yes" if Ujan can make the two strings equal with at most 2n operations and "No" otherwise. You can print each letter in any case (upper or lower). In the case of "Yes" print m (1 ≤ m ≤ 2n) on the next line, where m is the number of swap operations to make the strings equal. Then print m lines, each line should contain two integers i, j (1 ≤ i, j ≤ n) meaning that Ujan swaps s_i and t_j during the corresponding operation. You do not need to minimize the number of operations. Any sequence of length not more than 2n is suitable. Example Input 4 5 souse houhe 3 cat dog 2 aa az 3 abc bca Output Yes 1 1 4 No No Yes 3 1 2 3 1 2 3 Tags: strings Correct Solution: ``` for _ in range(int(input())): n = int(input()) lis=[0]*2 lis[0]=list(input()) lis[1]=list(input()) ans=[] gg=0 for i in range(n): a=lis[0][i] ind=-1 for j in range(i+1,n): if a==lis[0][j]: ind=j break if ind!=-1: ans.append([ind+1,i+1]) lis[1][i],lis[0][ind]=lis[0][ind],lis[1][i] else: for j in range(i,n): if a==lis[1][j]: ind=j break if ind!=-1: ans.append([n,ind+1]) ans.append([n,i+1]) lis[1][ind],lis[0][n-1]=lis[0][n-1],lis[1][ind] lis[1][i],lis[0][n-1]=lis[0][n-1],lis[1][i] else: print("No") gg=1 break if gg==0: print("Yes") print(len(ans)) for i in range(len(ans)): print(*ans[i]) ```
133
[ 0.28955078125, -0.09613037109375, -0.1514892578125, -0.057098388671875, -0.62646484375, -0.5537109375, 0.038604736328125, -0.0033721923828125, 0.071533203125, 1.01953125, 0.978515625, 0.06304931640625, 0.2388916015625, -1.1875, -0.63916015625, -0.00443267822265625, -0.4404296875, -0.497314453125, -0.415283203125, -0.288330078125, 0.1864013671875, -0.291259765625, -1.4765625, -0.1077880859375, -0.293701171875, 0.7734375, 0.32421875, -0.142822265625, 0.79736328125, 1.1728515625, 0.034332275390625, -0.037689208984375, 0.369873046875, -1.111328125, -0.15087890625, -0.40234375, 0.50634765625, -0.453125, -0.298828125, -0.53515625, 0.31787109375, -0.85595703125, 0.30517578125, -0.658203125, -1.115234375, 0.11724853515625, -0.5478515625, -0.31640625, -0.09149169921875, -0.5546875, 0.38427734375, -0.287353515625, 0.74609375, 0.0259552001953125, 0.10565185546875, 0.37109375, -0.1683349609375, -0.2379150390625, -0.6650390625, 0.1639404296875, 0.201416015625, 0.1649169921875, -0.2064208984375, -0.61572265625, -0.1292724609375, 0.006328582763671875, 0.0188751220703125, -0.34326171875, 0.0814208984375, -1.0888671875, -0.3544921875, 0.269287109375, -0.31982421875, -0.413330078125, -0.388671875, 0.308349609375, 0.26904296875, -0.347412109375, -0.7685546875, 0.80029296875, -0.1287841796875, 1.0234375, 0.139404296875, 0.00463104248046875, -0.71728515625, -0.37255859375, 0.245361328125, 0.337646484375, 0.31982421875, -0.01922607421875, -0.0472412109375, 0.62890625, -0.513671875, 0.0716552734375, 0.5888671875, 0.568359375, -0.256103515625, 0.369140625, 0.43896484375, -0.09429931640625, 0.64697265625, 0.646484375, -0.5966796875, 1.1181640625, -0.485107421875, -0.160400390625, 0.052001953125, -0.148193359375, -0.160888671875, 0.04840087890625, -0.14013671875, -0.29736328125, 0.982421875, 0.40283203125, -0.474365234375, 0.623046875, 0.160888671875, 0.4384765625, -0.76513671875, 0.402099609375, 0.69677734375, -0.1361083984375, 0.67431640625, -0.1473388671875, -0.05010986328125, -0.22119140625, -0.382080078125, 0.89306640625, -0.50537109375, 0.041473388671875, 0.333251953125, -0.2275390625, -0.0165252685546875, 0.33251953125, -0.342529296875, 1.072265625, -0.26025390625, 0.71240234375, 0.382568359375, -0.416259765625, 0.4697265625, -0.2423095703125, 0.039703369140625, 1.6279296875, 0.484375, -0.036712646484375, 0.9677734375, 0.44580078125, -0.64892578125, 0.09979248046875, -0.94287109375, 0.5986328125, 0.14306640625, 0.51513671875, -0.1693115234375, -0.08648681640625, -0.3515625, 0.33154296875, 0.309814453125, 0.2496337890625, -0.25439453125, 0.113525390625, -0.11273193359375, 0.69287109375, -0.07489013671875, 1.138671875, -0.4482421875, -0.2069091796875, -0.10089111328125, -0.4658203125, 0.1990966796875, -0.339111328125, -0.34375, 0.72900390625, 0.6689453125, 1.01953125, 0.9677734375, -0.1910400390625, 0.04498291015625, 0.2059326171875, -0.3349609375, 0.373046875, 0.0738525390625, 0.6552734375, 0.125244140625, 0.06671142578125, 0.281005859375, -0.257080078125, -0.481689453125, -0.416259765625, 0.14892578125, 0.791015625, -0.494140625, -0.0284576416015625, 0.269775390625, 0.25390625, -0.73193359375, 0.0214691162109375, -0.331787109375, -0.7705078125, -0.486572265625, 0.245849609375, -0.18115234375, 0.57861328125, -0.439697265625, -0.75, 0.445556640625, 0.67333984375, -0.3076171875, -0.22265625, 0.40869140625, 0.4423828125, -0.379150390625, 0.315673828125, -0.076416015625, 0.03582763671875, -0.372802734375, 0.8955078125, -0.313720703125, 0.042816162109375, 0.42431640625, 0.75830078125, 0.5498046875, 0.486572265625, -0.2432861328125, -0.1485595703125, 0.94287109375, 1.2294921875, -0.003391265869140625, 0.428466796875, 0.147705078125, 0.88330078125, 0.9853515625, 0.9365234375, 0.919921875, -0.0026092529296875, 0.66357421875, 0.87841796875, 0.2239990234375, 0.1536865234375, 0.46728515625, 0.3896484375, 0.406005859375, 0.677734375, -0.00873565673828125, 0.293212890625, -0.31982421875, 0.490234375, -0.324951171875, 0.240234375, -0.261474609375, 0.775390625, 0.25537109375, 0.4248046875, -0.3828125, -0.474365234375, 0.331298828125, 0.884765625, -0.88330078125, -0.619140625, -0.2476806640625, 0.0826416015625, 0.0985107421875, -0.288818359375, 0.49560546875, 0.3037109375, 0.21435546875, 0.482421875, -0.278564453125, -0.495361328125, -1.328125, -0.8603515625, -0.9892578125, -0.41650390625, -0.916015625, 0.124267578125, 0.35009765625, -0.8115234375, 0.294189453125, -0.41943359375, -0.237548828125, 0.1826171875, -0.64794921875, 0.59521484375, 0.0143890380859375, 0.498779296875, -0.5087890625, 0.76220703125, 0.54248046875, 0.94287109375, -0.7412109375, -0.11431884765625, -0.396240234375, -0.53369140625, 0.186767578125, 0.13330078125, 0.468017578125, -0.08514404296875, -0.61962890625, -0.6083984375, -0.80126953125, -0.51953125, -0.65771484375, -0.09912109375, -0.328369140625, 0.84716796875, 0.5263671875, -0.67431640625, 0.43115234375, 1.0927734375, -0.28173828125, 0.263916015625, 0.0018148422241210938, 0.0060272216796875, -0.73291015625, 1.0712890625, 0.1822509765625, 0.5927734375, -0.38330078125, -0.267822265625, -0.2490234375, 0.2120361328125, 0.1536865234375, -0.45556640625, -0.24462890625, 0.335693359375, -0.0263671875, -1.0009765625, 0.45068359375, -0.87890625, -0.46435546875, -0.2474365234375, -0.68603515625, 0.5, 0.92919921875, -0.08306884765625, -0.1705322265625, 0.06671142578125, 0.08599853515625, 0.67724609375, 0.38330078125, -0.55322265625, 0.11932373046875, 0.279296875, 0.17138671875, -0.263671875, 0.435546875, -0.568359375, -0.0297698974609375, -0.0679931640625, 0.49755859375, 0.68994140625, 0.1962890625, 0.57861328125, 0.492919921875, 0.9091796875, -0.492431640625, -0.279296875, -0.035675048828125, 0.623046875, 0.38037109375, 0.662109375, 0.3515625, -0.439697265625, -0.78369140625, -1.287109375, 0.45947265625, 0.2471923828125, 0.82373046875, -0.859375, 0.7119140625, 0.05029296875, -0.446044921875, 0.263916015625, -0.61767578125, -0.08978271484375, 1.078125, -0.1929931640625, 0.83740234375, -0.64697265625, 0.384033203125, -0.1923828125, -0.038818359375, 0.5927734375, 0.340087890625, 0.46826171875, -0.498046875, -0.54443359375, -0.58349609375, 0.25830078125, -0.2393798828125, -0.39306640625, 0.1536865234375, -0.464599609375, -0.14892578125, -0.87939453125, 0.6279296875, 0.58740234375, 0.57470703125, -0.11962890625, 0.564453125, 0.53662109375, 0.51318359375, 0.4267578125, -0.6328125, 0.302734375, -0.810546875, 0.5908203125, 0.217041015625, -0.35107421875, -0.42626953125, -0.45263671875, -0.444580078125, 0.2052001953125, 0.2301025390625, -0.218994140625, -0.93212890625, 0.57421875, -0.1793212890625, 0.58740234375, -0.42431640625, -0.240966796875, -0.63720703125, 0.419921875, 0.60986328125, -0.89501953125, 0.53466796875, -0.6572265625, 0.7998046875, 0.4541015625, -0.181640625, -0.2171630859375, -0.4560546875, -0.6474609375, -0.492431640625, 0.0482177734375, 0.99560546875, -0.04327392578125, 0.087646484375, -1.0322265625, 0.25439453125, 0.2437744140625, -0.47705078125, 0.10113525390625, -0.181640625, 0.38427734375, 0.1453857421875, 0.705078125, -0.360107421875, -0.311279296875, 0.124267578125, -1.34375, 0.401123046875, -0.51806640625, 0.5029296875, -0.316650390625, -0.0947265625, 0.12371826171875, 0.51953125, -0.428955078125, -0.33447265625, -0.278076171875, 0.5859375, -0.92333984375, -0.79345703125, 0.389404296875, -0.311767578125, -0.2113037109375, 0.92431640625, -0.369140625, -0.2841796875, 0.286376953125, 0.8671875, -0.456787109375, 0.3134765625, -0.4033203125, 0.465087890625, -0.52734375, -0.7177734375, -0.2041015625, -0.65576171875, 0.966796875, 0.06689453125, -0.671875, -0.3544921875, -1.1240234375, -0.156494140625, 0.1876220703125, -0.63818359375, 0.158203125, 0.2431640625, 0.0106048583984375, -0.3291015625, -0.421875, -0.3330078125, -0.2734375, -0.81396484375, -0.36474609375, 0.341064453125, 0.59912109375, 0.47119140625, -0.354248046875, -0.54052734375, -0.06396484375, -0.2197265625, 0.0360107421875, -0.3720703125, -0.431884765625, -0.235595703125, -0.07244873046875, -0.302490234375, 0.1182861328125, 0.020782470703125, 0.07135009765625, 0.6455078125, -0.1256103515625, 0.51953125, 0.1602783203125, -0.69482421875, 1.029296875, -0.04766845703125, -1.0283203125, -0.378662109375, 0.16748046875, 0.1739501953125, 0.54541015625, 0.3154296875, -0.771484375, -0.80224609375, -1.0146484375, 0.1500244140625, -0.666015625, -0.074951171875, -0.892578125, -0.01439666748046875, -0.6318359375, 0.630859375, -0.1673583984375, -0.6787109375, 0.13427734375, -0.9755859375, 0.152587890625, -0.68359375, -0.232177734375, -0.75, -0.517578125, -0.56005859375, 0.865234375, 0.23681640625, 0.484130859375, -0.178955078125, -0.2335205078125, 0.29638671875, -0.06390380859375, -0.5859375, -0.331787109375, -0.07672119140625, 0.46435546875, -0.51806640625, -0.249755859375, -0.469970703125, 0.67724609375, -0.8603515625, 0.2783203125, -0.293701171875, -0.377685546875, -0.05657958984375, -0.1854248046875, 1.181640625, -0.158203125, 0.3486328125, -0.420654296875, 0.87158203125, 0.7197265625, -0.54052734375, -0.65869140625, -0.904296875, -0.86376953125, -0.8251953125, 0.450927734375, -0.671875, 0.22509765625, -0.66796875, -0.1658935546875, 1.0625, -0.53857421875, 0.27783203125, 1.109375, 0.2125244140625, 0.64599609375, -0.802734375, 0.58056640625, 0.20068359375, -0.787109375, 0.0073394775390625, 0.2305908203125, -0.5888671875, 0.033538818359375, -0.1719970703125, -0.8583984375, -0.6708984375, 0.370849609375, 1.3828125, -0.369873046875, 0.63427734375, -0.058441162109375, -0.8896484375, -0.7314453125, 0.71923828125, 0.276611328125, 0.33837890625, 1.0390625, -0.2088623046875, 0.07501220703125, -0.376953125, 0.18359375, -0.206298828125, -0.5595703125, 0.9599609375, -0.1632080078125, -0.6142578125, 0.87451171875, 0.90576171875, -1.0556640625, -0.724609375, -0.09893798828125, -0.03448486328125, -0.20849609375, -0.634765625, -0.255615234375, 0.49951171875, -0.51220703125, 0.14892578125, 0.5126953125, -0.1190185546875, 0.324462890625, -0.050140380859375, 0.0751953125, -0.486328125, 0.60546875, 0.525390625, -0.425537109375, -0.1278076171875, -1.0771484375, -0.5068359375, -0.3759765625, 0.046142578125, 0.54833984375, -0.422607421875, 0.321044921875, 0.49755859375, -0.035858154296875, 0.703125, -0.329345703125, -0.51123046875, 0.425537109375, -0.90185546875, -0.51953125, -0.0946044921875, 0.10833740234375, -0.2239990234375, 0.230224609375, -0.376220703125, 0.44677734375, -0.008575439453125, 0.51513671875, -0.389404296875, -1.1474609375, -0.251953125, -1.2177734375, -0.30908203125, -0.60595703125, -0.337158203125, -0.0654296875, 0.2230224609375, 0.27490234375, -0.43701171875, 0.09161376953125, 0.459716796875, -0.5556640625, 0.69384765625, -0.5537109375, 0.307373046875, -0.7373046875, -0.456787109375, -0.7177734375, 0.12286376953125, -0.5791015625, -0.01486968994140625, -0.6455078125, 0.21875, -0.0450439453125, 0.420654296875, -0.06683349609375, 0.52001953125, -0.22314453125, -0.591796875, 0.21337890625, 0.0404052734375, -0.1343994140625, 0.490966796875, 0.54638671875, -0.12109375, 0.3896484375, -0.07470703125, -0.239501953125, -0.64208984375, 0.662109375, 0.43115234375, -0.00144195556640625, -0.21875, -0.0244293212890625, 0.360107421875, -0.927734375, 0.583984375, -0.1585693359375, 0.00012552738189697266, -0.02777099609375, -0.410888671875, 0.3623046875, 1.2763671875, -0.14013671875, 0.62353515625, -0.1910400390625, 0.1009521484375, 0.27734375, 0.056549072265625, -0.1444091796875, 0.4638671875, -0.08258056640625, -0.15869140625, -0.009613037109375, 0.52880859375, 0.046844482421875, 0.6962890625, -0.3427734375, -0.87890625, -0.88720703125, -0.4326171875, 0.10009765625, 0.25439453125, 0.53466796875, -0.28857421875, -0.01666259765625, -0.2061767578125, -0.193359375, 0.449462890625, -1.0830078125, -1.048828125, 0.3046875, -0.080810546875, -0.662109375, -0.2391357421875, -0.75341796875, -0.53759765625, -0.0017499923706054688, 0.318603515625, -0.61572265625, 0.474609375, 0.027801513671875, 0.85791015625, -0.4833984375, 0.286865234375, 0.060577392578125, 0.56591796875, -0.53955078125, -0.441650390625, -0.040374755859375, 1.0703125, 0.1668701171875, -0.296142578125, -0.49072265625, 0.43603515625, 0.010040283203125, 0.288330078125, -0.1439208984375, 0.07098388671875, -0.40234375, 0.73046875, -1.0830078125, 0.037445068359375, -0.175048828125, 0.38037109375, -0.0782470703125, -0.5478515625, -0.47412109375, 1.1298828125, 0.6513671875, -0.156982421875, 0.5810546875, 0.0276641845703125, 0.47119140625, -0.1917724609375, 0.06683349609375, -0.33447265625, 0.8251953125, 0.484130859375, 0.9619140625, -0.359619140625, 0.09954833984375, 0.56982421875, 0.07568359375, -0.388671875, 0.03375244140625, -0.013427734375, -0.06256103515625, 0.453125, -0.2685546875, -0.089111328125, -0.016326904296875, -0.74365234375, 0.439697265625, -0.42333984375, -0.036041259765625, -0.171630859375, -0.95361328125, 0.92724609375, -0.450439453125, 0.0308074951171875, 0.6591796875, -0.368896484375, -0.05450439453125, 0.63134765625, -0.0902099609375, -0.4404296875, 0.7333984375, 0.724609375, 0.469482421875, 0.5732421875, 0.61669921875, 0.47119140625, -0.888671875, 0.30419921875, 0.2244873046875, -0.155029296875, -0.07269287109375, -0.64404296875, -0.982421875, 0.351806640625, -0.30517578125, -0.076416015625, 0.66015625, -0.7685546875, 0.01485443115234375, -0.52880859375, 0.75439453125, -0.389404296875, 0.413330078125, 0.11993408203125, -0.67578125, -0.439208984375, 0.61865234375, -0.25732421875, 0.5185546875, 0.0028533935546875, 1.0986328125, -0.07440185546875, 1.4306640625, 0.83935546875, -0.320068359375, 0.211669921875, 0.473388671875, -0.2188720703125, -0.444091796875, -0.71630859375, -0.49951171875, 0.1947021484375, -0.55419921875, -0.5400390625, -0.042236328125, 1.083984375, -0.03485107421875, -1.2470703125, -0.591796875, 0.1669921875, -1.1484375, 0.2174072265625, 0.51171875, 0.431396484375, -0.1143798828125, -0.12115478515625, -0.036529541015625, -0.6591796875, 0.477294921875, -0.9609375, 0.24658203125, -0.383056640625, -0.44189453125, -0.53857421875, -0.66259765625, -0.51025390625, -0.192138671875, -0.234375, -0.974609375, 0.525390625, 0.397705078125, 0.74560546875, 0.305908203125, -0.294677734375, 0.30615234375, 1.0361328125, 1.28125, 0.07830810546875, 0.6943359375, 0.5029296875, -0.383544921875, 0.253662109375, -0.4599609375, 0.2108154296875, -0.14111328125, 0.53076171875, -0.35546875, 0.368896484375, -0.84423828125, -1.2216796875, -0.197998046875, 0.5498046875, 0.2442626953125, -0.66259765625, -0.95703125, -0.2734375, -0.96923828125, -0.33740234375, -0.67333984375, 0.78369140625, -0.35986328125, 0.147705078125, 0.1817626953125, -1.2412109375, 4.390625, 1.09375, 0.9404296875, 0.45361328125, 0.25634765625, 1.0673828125, 0.224365234375, -0.444580078125, -0.1875, -0.297119140625, 0.3115234375, -0.51708984375, -0.028961181640625, 0.80810546875, 0.1041259765625, 0.354248046875, -0.60400390625, -0.014129638671875, -0.16845703125, -0.8447265625, -0.51611328125, 0.1051025390625, -0.1497802734375, 0.4052734375, 0.2274169921875, 0.160400390625, 0.378662109375, -0.83984375, -0.432861328125, -0.568359375, 0.344970703125, -0.58544921875, 0.90380859375, 0.345458984375, -0.2152099609375, 0.58984375, -0.265625, -0.5185546875, -0.085693359375, 0.06634521484375, -0.258056640625, 0.51025390625, 0.6103515625, -0.7158203125, -0.329833984375, 0.43896484375, -0.71435546875, 0.38916015625, 0.1259765625, -1.1103515625, 0.8095703125, -0.34375, 0.572265625, -0.80322265625, -0.79296875, 0.498291015625, 0.1243896484375, 0.11480712890625, -0.4287109375, 0.54443359375, 0.59033203125, 0.318359375, 0.34228515625, 0.7333984375, -1.34375, 0.58203125, -0.1776123046875, 0.428955078125, -0.5439453125, 0.102294921875, -0.1783447265625, -0.277099609375, -0.273681640625, -0.401123046875, 0.5322265625, 0.474853515625, -0.2432861328125, 0.978515625, 0.49365234375, -0.81884765625, 0.048675537109375, -0.0018157958984375, -0.1951904296875, -0.419921875, 0.8544921875, 1.2626953125, -0.467041015625, -0.071044921875, -0.446533203125, 0.810546875, 0.8056640625, 0.71240234375, 0.0011663436889648438, -0.37158203125, -0.071044921875 ]
6
Provide tags and a correct Python 3 solution for this coding contest problem. This problem is different from the easy version. In this version Ujan makes at most 2n swaps. In addition, k ≤ 1000, n ≤ 50 and it is necessary to print swaps themselves. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems. After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first. Ujan has two distinct strings s and t of length n consisting of only of lowercase English characters. He wants to make them equal. Since Ujan is lazy, he will perform the following operation at most 2n times: he takes two positions i and j (1 ≤ i,j ≤ n, the values i and j can be equal or different), and swaps the characters s_i and t_j. Ujan's goal is to make the strings s and t equal. He does not need to minimize the number of performed operations: any sequence of operations of length 2n or shorter is suitable. Input The first line contains a single integer k (1 ≤ k ≤ 1000), the number of test cases. For each of the test cases, the first line contains a single integer n (2 ≤ n ≤ 50), the length of the strings s and t. Each of the next two lines contains the strings s and t, each having length exactly n. The strings consist only of lowercase English letters. It is guaranteed that strings are different. Output For each test case, output "Yes" if Ujan can make the two strings equal with at most 2n operations and "No" otherwise. You can print each letter in any case (upper or lower). In the case of "Yes" print m (1 ≤ m ≤ 2n) on the next line, where m is the number of swap operations to make the strings equal. Then print m lines, each line should contain two integers i, j (1 ≤ i, j ≤ n) meaning that Ujan swaps s_i and t_j during the corresponding operation. You do not need to minimize the number of operations. Any sequence of length not more than 2n is suitable. Example Input 4 5 souse houhe 3 cat dog 2 aa az 3 abc bca Output Yes 1 1 4 No No Yes 3 1 2 3 1 2 3 Tags: strings Correct Solution: ``` import sys for t in range(int(sys.stdin.readline())): n = int(sys.stdin.readline()) s1 = [ord(c) - 97 for c in sys.stdin.readline().strip()] s2 = [ord(c) - 97 for c in sys.stdin.readline().strip()] pl = [] orde = True for i in range(26): st1 = {j for j in range(n) if s1[j] == i} st2 = {j for j in range(n) if s2[j] == i} if len(st2) > len(st1): st1, st2 = st2, st1 s1, s2 = s2, s1 orde = not orde # stb = set() rml = [] for el in st2: if el in st1: rml.append(el) for el in rml: st1.remove(el) st2.remove(el) tot = len(st1) + len(st2) if (tot) & 1: pl = [] break # op = -1 # for j in range(25): # if s2[j] != i: # op = j # break # if op == -1: # continue # k = len(st1)//2 # for j in range(k): # k1 = st1.pop() # k2 = st1.pop() # op1 = -1 # while len(st1) > 2: # k1 = st1.pop() # k2 = st1.pop() # pl.append((k1, k2) if orde else (k2, k1)) # s1[k1], s2[k2] = s2[k2], s1[k1] for k in st2: st1.add(k) pl.append((k, k)) s1[k], s2[k] = s2[k], s1[k] for j in range(tot//2): k1 = st1.pop() k2 = st1.pop() pl.append((k1, k2) if orde else (k2, k1)) s1[k1], s2[k2] = s2[k2], s1[k1] if pl == []: print("No") else: print(f"Yes\n{len(pl)}\n" + "".join([f"{tup[0] + 1} {tup[1] + 1}\n" for tup in pl])) ```
134
[ 0.28955078125, -0.09613037109375, -0.1514892578125, -0.057098388671875, -0.62646484375, -0.5537109375, 0.038604736328125, -0.0033721923828125, 0.071533203125, 1.01953125, 0.978515625, 0.06304931640625, 0.2388916015625, -1.1875, -0.63916015625, -0.00443267822265625, -0.4404296875, -0.497314453125, -0.415283203125, -0.288330078125, 0.1864013671875, -0.291259765625, -1.4765625, -0.1077880859375, -0.293701171875, 0.7734375, 0.32421875, -0.142822265625, 0.79736328125, 1.1728515625, 0.034332275390625, -0.037689208984375, 0.369873046875, -1.111328125, -0.15087890625, -0.40234375, 0.50634765625, -0.453125, -0.298828125, -0.53515625, 0.31787109375, -0.85595703125, 0.30517578125, -0.658203125, -1.115234375, 0.11724853515625, -0.5478515625, -0.31640625, -0.09149169921875, -0.5546875, 0.38427734375, -0.287353515625, 0.74609375, 0.0259552001953125, 0.10565185546875, 0.37109375, -0.1683349609375, -0.2379150390625, -0.6650390625, 0.1639404296875, 0.201416015625, 0.1649169921875, -0.2064208984375, -0.61572265625, -0.1292724609375, 0.006328582763671875, 0.0188751220703125, -0.34326171875, 0.0814208984375, -1.0888671875, -0.3544921875, 0.269287109375, -0.31982421875, -0.413330078125, -0.388671875, 0.308349609375, 0.26904296875, -0.347412109375, -0.7685546875, 0.80029296875, -0.1287841796875, 1.0234375, 0.139404296875, 0.00463104248046875, -0.71728515625, -0.37255859375, 0.245361328125, 0.337646484375, 0.31982421875, -0.01922607421875, -0.0472412109375, 0.62890625, -0.513671875, 0.0716552734375, 0.5888671875, 0.568359375, -0.256103515625, 0.369140625, 0.43896484375, -0.09429931640625, 0.64697265625, 0.646484375, -0.5966796875, 1.1181640625, -0.485107421875, -0.160400390625, 0.052001953125, -0.148193359375, -0.160888671875, 0.04840087890625, -0.14013671875, -0.29736328125, 0.982421875, 0.40283203125, -0.474365234375, 0.623046875, 0.160888671875, 0.4384765625, -0.76513671875, 0.402099609375, 0.69677734375, -0.1361083984375, 0.67431640625, -0.1473388671875, -0.05010986328125, -0.22119140625, -0.382080078125, 0.89306640625, -0.50537109375, 0.041473388671875, 0.333251953125, -0.2275390625, -0.0165252685546875, 0.33251953125, -0.342529296875, 1.072265625, -0.26025390625, 0.71240234375, 0.382568359375, -0.416259765625, 0.4697265625, -0.2423095703125, 0.039703369140625, 1.6279296875, 0.484375, -0.036712646484375, 0.9677734375, 0.44580078125, -0.64892578125, 0.09979248046875, -0.94287109375, 0.5986328125, 0.14306640625, 0.51513671875, -0.1693115234375, -0.08648681640625, -0.3515625, 0.33154296875, 0.309814453125, 0.2496337890625, -0.25439453125, 0.113525390625, -0.11273193359375, 0.69287109375, -0.07489013671875, 1.138671875, -0.4482421875, -0.2069091796875, -0.10089111328125, -0.4658203125, 0.1990966796875, -0.339111328125, -0.34375, 0.72900390625, 0.6689453125, 1.01953125, 0.9677734375, -0.1910400390625, 0.04498291015625, 0.2059326171875, -0.3349609375, 0.373046875, 0.0738525390625, 0.6552734375, 0.125244140625, 0.06671142578125, 0.281005859375, -0.257080078125, -0.481689453125, -0.416259765625, 0.14892578125, 0.791015625, -0.494140625, -0.0284576416015625, 0.269775390625, 0.25390625, -0.73193359375, 0.0214691162109375, -0.331787109375, -0.7705078125, -0.486572265625, 0.245849609375, -0.18115234375, 0.57861328125, -0.439697265625, -0.75, 0.445556640625, 0.67333984375, -0.3076171875, -0.22265625, 0.40869140625, 0.4423828125, -0.379150390625, 0.315673828125, -0.076416015625, 0.03582763671875, -0.372802734375, 0.8955078125, -0.313720703125, 0.042816162109375, 0.42431640625, 0.75830078125, 0.5498046875, 0.486572265625, -0.2432861328125, -0.1485595703125, 0.94287109375, 1.2294921875, -0.003391265869140625, 0.428466796875, 0.147705078125, 0.88330078125, 0.9853515625, 0.9365234375, 0.919921875, -0.0026092529296875, 0.66357421875, 0.87841796875, 0.2239990234375, 0.1536865234375, 0.46728515625, 0.3896484375, 0.406005859375, 0.677734375, -0.00873565673828125, 0.293212890625, -0.31982421875, 0.490234375, -0.324951171875, 0.240234375, -0.261474609375, 0.775390625, 0.25537109375, 0.4248046875, -0.3828125, -0.474365234375, 0.331298828125, 0.884765625, -0.88330078125, -0.619140625, -0.2476806640625, 0.0826416015625, 0.0985107421875, -0.288818359375, 0.49560546875, 0.3037109375, 0.21435546875, 0.482421875, -0.278564453125, -0.495361328125, -1.328125, -0.8603515625, -0.9892578125, -0.41650390625, -0.916015625, 0.124267578125, 0.35009765625, -0.8115234375, 0.294189453125, -0.41943359375, -0.237548828125, 0.1826171875, -0.64794921875, 0.59521484375, 0.0143890380859375, 0.498779296875, -0.5087890625, 0.76220703125, 0.54248046875, 0.94287109375, -0.7412109375, -0.11431884765625, -0.396240234375, -0.53369140625, 0.186767578125, 0.13330078125, 0.468017578125, -0.08514404296875, -0.61962890625, -0.6083984375, -0.80126953125, -0.51953125, -0.65771484375, -0.09912109375, -0.328369140625, 0.84716796875, 0.5263671875, -0.67431640625, 0.43115234375, 1.0927734375, -0.28173828125, 0.263916015625, 0.0018148422241210938, 0.0060272216796875, -0.73291015625, 1.0712890625, 0.1822509765625, 0.5927734375, -0.38330078125, -0.267822265625, -0.2490234375, 0.2120361328125, 0.1536865234375, -0.45556640625, -0.24462890625, 0.335693359375, -0.0263671875, -1.0009765625, 0.45068359375, -0.87890625, -0.46435546875, -0.2474365234375, -0.68603515625, 0.5, 0.92919921875, -0.08306884765625, -0.1705322265625, 0.06671142578125, 0.08599853515625, 0.67724609375, 0.38330078125, -0.55322265625, 0.11932373046875, 0.279296875, 0.17138671875, -0.263671875, 0.435546875, -0.568359375, -0.0297698974609375, -0.0679931640625, 0.49755859375, 0.68994140625, 0.1962890625, 0.57861328125, 0.492919921875, 0.9091796875, -0.492431640625, -0.279296875, -0.035675048828125, 0.623046875, 0.38037109375, 0.662109375, 0.3515625, -0.439697265625, -0.78369140625, -1.287109375, 0.45947265625, 0.2471923828125, 0.82373046875, -0.859375, 0.7119140625, 0.05029296875, -0.446044921875, 0.263916015625, -0.61767578125, -0.08978271484375, 1.078125, -0.1929931640625, 0.83740234375, -0.64697265625, 0.384033203125, -0.1923828125, -0.038818359375, 0.5927734375, 0.340087890625, 0.46826171875, -0.498046875, -0.54443359375, -0.58349609375, 0.25830078125, -0.2393798828125, -0.39306640625, 0.1536865234375, -0.464599609375, -0.14892578125, -0.87939453125, 0.6279296875, 0.58740234375, 0.57470703125, -0.11962890625, 0.564453125, 0.53662109375, 0.51318359375, 0.4267578125, -0.6328125, 0.302734375, -0.810546875, 0.5908203125, 0.217041015625, -0.35107421875, -0.42626953125, -0.45263671875, -0.444580078125, 0.2052001953125, 0.2301025390625, -0.218994140625, -0.93212890625, 0.57421875, -0.1793212890625, 0.58740234375, -0.42431640625, -0.240966796875, -0.63720703125, 0.419921875, 0.60986328125, -0.89501953125, 0.53466796875, -0.6572265625, 0.7998046875, 0.4541015625, -0.181640625, -0.2171630859375, -0.4560546875, -0.6474609375, -0.492431640625, 0.0482177734375, 0.99560546875, -0.04327392578125, 0.087646484375, -1.0322265625, 0.25439453125, 0.2437744140625, -0.47705078125, 0.10113525390625, -0.181640625, 0.38427734375, 0.1453857421875, 0.705078125, -0.360107421875, -0.311279296875, 0.124267578125, -1.34375, 0.401123046875, -0.51806640625, 0.5029296875, -0.316650390625, -0.0947265625, 0.12371826171875, 0.51953125, -0.428955078125, -0.33447265625, -0.278076171875, 0.5859375, -0.92333984375, -0.79345703125, 0.389404296875, -0.311767578125, -0.2113037109375, 0.92431640625, -0.369140625, -0.2841796875, 0.286376953125, 0.8671875, -0.456787109375, 0.3134765625, -0.4033203125, 0.465087890625, -0.52734375, -0.7177734375, -0.2041015625, -0.65576171875, 0.966796875, 0.06689453125, -0.671875, -0.3544921875, -1.1240234375, -0.156494140625, 0.1876220703125, -0.63818359375, 0.158203125, 0.2431640625, 0.0106048583984375, -0.3291015625, -0.421875, -0.3330078125, -0.2734375, -0.81396484375, -0.36474609375, 0.341064453125, 0.59912109375, 0.47119140625, -0.354248046875, -0.54052734375, -0.06396484375, -0.2197265625, 0.0360107421875, -0.3720703125, -0.431884765625, -0.235595703125, -0.07244873046875, -0.302490234375, 0.1182861328125, 0.020782470703125, 0.07135009765625, 0.6455078125, -0.1256103515625, 0.51953125, 0.1602783203125, -0.69482421875, 1.029296875, -0.04766845703125, -1.0283203125, -0.378662109375, 0.16748046875, 0.1739501953125, 0.54541015625, 0.3154296875, -0.771484375, -0.80224609375, -1.0146484375, 0.1500244140625, -0.666015625, -0.074951171875, -0.892578125, -0.01439666748046875, -0.6318359375, 0.630859375, -0.1673583984375, -0.6787109375, 0.13427734375, -0.9755859375, 0.152587890625, -0.68359375, -0.232177734375, -0.75, -0.517578125, -0.56005859375, 0.865234375, 0.23681640625, 0.484130859375, -0.178955078125, -0.2335205078125, 0.29638671875, -0.06390380859375, -0.5859375, -0.331787109375, -0.07672119140625, 0.46435546875, -0.51806640625, -0.249755859375, -0.469970703125, 0.67724609375, -0.8603515625, 0.2783203125, -0.293701171875, -0.377685546875, -0.05657958984375, -0.1854248046875, 1.181640625, -0.158203125, 0.3486328125, -0.420654296875, 0.87158203125, 0.7197265625, -0.54052734375, -0.65869140625, -0.904296875, -0.86376953125, -0.8251953125, 0.450927734375, -0.671875, 0.22509765625, -0.66796875, -0.1658935546875, 1.0625, -0.53857421875, 0.27783203125, 1.109375, 0.2125244140625, 0.64599609375, -0.802734375, 0.58056640625, 0.20068359375, -0.787109375, 0.0073394775390625, 0.2305908203125, -0.5888671875, 0.033538818359375, -0.1719970703125, -0.8583984375, -0.6708984375, 0.370849609375, 1.3828125, -0.369873046875, 0.63427734375, -0.058441162109375, -0.8896484375, -0.7314453125, 0.71923828125, 0.276611328125, 0.33837890625, 1.0390625, -0.2088623046875, 0.07501220703125, -0.376953125, 0.18359375, -0.206298828125, -0.5595703125, 0.9599609375, -0.1632080078125, -0.6142578125, 0.87451171875, 0.90576171875, -1.0556640625, -0.724609375, -0.09893798828125, -0.03448486328125, -0.20849609375, -0.634765625, -0.255615234375, 0.49951171875, -0.51220703125, 0.14892578125, 0.5126953125, -0.1190185546875, 0.324462890625, -0.050140380859375, 0.0751953125, -0.486328125, 0.60546875, 0.525390625, -0.425537109375, -0.1278076171875, -1.0771484375, -0.5068359375, -0.3759765625, 0.046142578125, 0.54833984375, -0.422607421875, 0.321044921875, 0.49755859375, -0.035858154296875, 0.703125, -0.329345703125, -0.51123046875, 0.425537109375, -0.90185546875, -0.51953125, -0.0946044921875, 0.10833740234375, -0.2239990234375, 0.230224609375, -0.376220703125, 0.44677734375, -0.008575439453125, 0.51513671875, -0.389404296875, -1.1474609375, -0.251953125, -1.2177734375, -0.30908203125, -0.60595703125, -0.337158203125, -0.0654296875, 0.2230224609375, 0.27490234375, -0.43701171875, 0.09161376953125, 0.459716796875, -0.5556640625, 0.69384765625, -0.5537109375, 0.307373046875, -0.7373046875, -0.456787109375, -0.7177734375, 0.12286376953125, -0.5791015625, -0.01486968994140625, -0.6455078125, 0.21875, -0.0450439453125, 0.420654296875, -0.06683349609375, 0.52001953125, -0.22314453125, -0.591796875, 0.21337890625, 0.0404052734375, -0.1343994140625, 0.490966796875, 0.54638671875, -0.12109375, 0.3896484375, -0.07470703125, -0.239501953125, -0.64208984375, 0.662109375, 0.43115234375, -0.00144195556640625, -0.21875, -0.0244293212890625, 0.360107421875, -0.927734375, 0.583984375, -0.1585693359375, 0.00012552738189697266, -0.02777099609375, -0.410888671875, 0.3623046875, 1.2763671875, -0.14013671875, 0.62353515625, -0.1910400390625, 0.1009521484375, 0.27734375, 0.056549072265625, -0.1444091796875, 0.4638671875, -0.08258056640625, -0.15869140625, -0.009613037109375, 0.52880859375, 0.046844482421875, 0.6962890625, -0.3427734375, -0.87890625, -0.88720703125, -0.4326171875, 0.10009765625, 0.25439453125, 0.53466796875, -0.28857421875, -0.01666259765625, -0.2061767578125, -0.193359375, 0.449462890625, -1.0830078125, -1.048828125, 0.3046875, -0.080810546875, -0.662109375, -0.2391357421875, -0.75341796875, -0.53759765625, -0.0017499923706054688, 0.318603515625, -0.61572265625, 0.474609375, 0.027801513671875, 0.85791015625, -0.4833984375, 0.286865234375, 0.060577392578125, 0.56591796875, -0.53955078125, -0.441650390625, -0.040374755859375, 1.0703125, 0.1668701171875, -0.296142578125, -0.49072265625, 0.43603515625, 0.010040283203125, 0.288330078125, -0.1439208984375, 0.07098388671875, -0.40234375, 0.73046875, -1.0830078125, 0.037445068359375, -0.175048828125, 0.38037109375, -0.0782470703125, -0.5478515625, -0.47412109375, 1.1298828125, 0.6513671875, -0.156982421875, 0.5810546875, 0.0276641845703125, 0.47119140625, -0.1917724609375, 0.06683349609375, -0.33447265625, 0.8251953125, 0.484130859375, 0.9619140625, -0.359619140625, 0.09954833984375, 0.56982421875, 0.07568359375, -0.388671875, 0.03375244140625, -0.013427734375, -0.06256103515625, 0.453125, -0.2685546875, -0.089111328125, -0.016326904296875, -0.74365234375, 0.439697265625, -0.42333984375, -0.036041259765625, -0.171630859375, -0.95361328125, 0.92724609375, -0.450439453125, 0.0308074951171875, 0.6591796875, -0.368896484375, -0.05450439453125, 0.63134765625, -0.0902099609375, -0.4404296875, 0.7333984375, 0.724609375, 0.469482421875, 0.5732421875, 0.61669921875, 0.47119140625, -0.888671875, 0.30419921875, 0.2244873046875, -0.155029296875, -0.07269287109375, -0.64404296875, -0.982421875, 0.351806640625, -0.30517578125, -0.076416015625, 0.66015625, -0.7685546875, 0.01485443115234375, -0.52880859375, 0.75439453125, -0.389404296875, 0.413330078125, 0.11993408203125, -0.67578125, -0.439208984375, 0.61865234375, -0.25732421875, 0.5185546875, 0.0028533935546875, 1.0986328125, -0.07440185546875, 1.4306640625, 0.83935546875, -0.320068359375, 0.211669921875, 0.473388671875, -0.2188720703125, -0.444091796875, -0.71630859375, -0.49951171875, 0.1947021484375, -0.55419921875, -0.5400390625, -0.042236328125, 1.083984375, -0.03485107421875, -1.2470703125, -0.591796875, 0.1669921875, -1.1484375, 0.2174072265625, 0.51171875, 0.431396484375, -0.1143798828125, -0.12115478515625, -0.036529541015625, -0.6591796875, 0.477294921875, -0.9609375, 0.24658203125, -0.383056640625, -0.44189453125, -0.53857421875, -0.66259765625, -0.51025390625, -0.192138671875, -0.234375, -0.974609375, 0.525390625, 0.397705078125, 0.74560546875, 0.305908203125, -0.294677734375, 0.30615234375, 1.0361328125, 1.28125, 0.07830810546875, 0.6943359375, 0.5029296875, -0.383544921875, 0.253662109375, -0.4599609375, 0.2108154296875, -0.14111328125, 0.53076171875, -0.35546875, 0.368896484375, -0.84423828125, -1.2216796875, -0.197998046875, 0.5498046875, 0.2442626953125, -0.66259765625, -0.95703125, -0.2734375, -0.96923828125, -0.33740234375, -0.67333984375, 0.78369140625, -0.35986328125, 0.147705078125, 0.1817626953125, -1.2412109375, 4.390625, 1.09375, 0.9404296875, 0.45361328125, 0.25634765625, 1.0673828125, 0.224365234375, -0.444580078125, -0.1875, -0.297119140625, 0.3115234375, -0.51708984375, -0.028961181640625, 0.80810546875, 0.1041259765625, 0.354248046875, -0.60400390625, -0.014129638671875, -0.16845703125, -0.8447265625, -0.51611328125, 0.1051025390625, -0.1497802734375, 0.4052734375, 0.2274169921875, 0.160400390625, 0.378662109375, -0.83984375, -0.432861328125, -0.568359375, 0.344970703125, -0.58544921875, 0.90380859375, 0.345458984375, -0.2152099609375, 0.58984375, -0.265625, -0.5185546875, -0.085693359375, 0.06634521484375, -0.258056640625, 0.51025390625, 0.6103515625, -0.7158203125, -0.329833984375, 0.43896484375, -0.71435546875, 0.38916015625, 0.1259765625, -1.1103515625, 0.8095703125, -0.34375, 0.572265625, -0.80322265625, -0.79296875, 0.498291015625, 0.1243896484375, 0.11480712890625, -0.4287109375, 0.54443359375, 0.59033203125, 0.318359375, 0.34228515625, 0.7333984375, -1.34375, 0.58203125, -0.1776123046875, 0.428955078125, -0.5439453125, 0.102294921875, -0.1783447265625, -0.277099609375, -0.273681640625, -0.401123046875, 0.5322265625, 0.474853515625, -0.2432861328125, 0.978515625, 0.49365234375, -0.81884765625, 0.048675537109375, -0.0018157958984375, -0.1951904296875, -0.419921875, 0.8544921875, 1.2626953125, -0.467041015625, -0.071044921875, -0.446533203125, 0.810546875, 0.8056640625, 0.71240234375, 0.0011663436889648438, -0.37158203125, -0.071044921875 ]
6
Provide tags and a correct Python 3 solution for this coding contest problem. This problem is different from the easy version. In this version Ujan makes at most 2n swaps. In addition, k ≤ 1000, n ≤ 50 and it is necessary to print swaps themselves. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems. After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first. Ujan has two distinct strings s and t of length n consisting of only of lowercase English characters. He wants to make them equal. Since Ujan is lazy, he will perform the following operation at most 2n times: he takes two positions i and j (1 ≤ i,j ≤ n, the values i and j can be equal or different), and swaps the characters s_i and t_j. Ujan's goal is to make the strings s and t equal. He does not need to minimize the number of performed operations: any sequence of operations of length 2n or shorter is suitable. Input The first line contains a single integer k (1 ≤ k ≤ 1000), the number of test cases. For each of the test cases, the first line contains a single integer n (2 ≤ n ≤ 50), the length of the strings s and t. Each of the next two lines contains the strings s and t, each having length exactly n. The strings consist only of lowercase English letters. It is guaranteed that strings are different. Output For each test case, output "Yes" if Ujan can make the two strings equal with at most 2n operations and "No" otherwise. You can print each letter in any case (upper or lower). In the case of "Yes" print m (1 ≤ m ≤ 2n) on the next line, where m is the number of swap operations to make the strings equal. Then print m lines, each line should contain two integers i, j (1 ≤ i, j ≤ n) meaning that Ujan swaps s_i and t_j during the corresponding operation. You do not need to minimize the number of operations. Any sequence of length not more than 2n is suitable. Example Input 4 5 souse houhe 3 cat dog 2 aa az 3 abc bca Output Yes 1 1 4 No No Yes 3 1 2 3 1 2 3 Tags: strings Correct Solution: ``` from collections import defaultdict # input = sys.stdin.readline def case(): n = int(input()) s = input() s = [i for i in s] t = input() t = [i for i in t] d= defaultdict(int) for i in s: d[i]+=1 for i in t: d[i]+=1 for i in d.values(): if i%2: print("NO") return ans = [] for i in range(n): flag = 0 for j in range(i+1, n): if s[i] == s[j]: t[i], s[j] = s[j], t[i] ans.append([j+1, i+1]) flag = 1 break if flag: continue for j in range(i+1, n): if s[i] == t[j]: s[j], t[j] = t[j], s[j] ans.append([j+1, j+1]) t[i], s[j] = s[j], t[i] ans.append([j+1, i+1]) flag = 1 break if flag: continue print("YES") print(len(ans)) for i in ans: print(*i) for _ in range(int(input())): case() ```
135
[ 0.28955078125, -0.09613037109375, -0.1514892578125, -0.057098388671875, -0.62646484375, -0.5537109375, 0.038604736328125, -0.0033721923828125, 0.071533203125, 1.01953125, 0.978515625, 0.06304931640625, 0.2388916015625, -1.1875, -0.63916015625, -0.00443267822265625, -0.4404296875, -0.497314453125, -0.415283203125, -0.288330078125, 0.1864013671875, -0.291259765625, -1.4765625, -0.1077880859375, -0.293701171875, 0.7734375, 0.32421875, -0.142822265625, 0.79736328125, 1.1728515625, 0.034332275390625, -0.037689208984375, 0.369873046875, -1.111328125, -0.15087890625, -0.40234375, 0.50634765625, -0.453125, -0.298828125, -0.53515625, 0.31787109375, -0.85595703125, 0.30517578125, -0.658203125, -1.115234375, 0.11724853515625, -0.5478515625, -0.31640625, -0.09149169921875, -0.5546875, 0.38427734375, -0.287353515625, 0.74609375, 0.0259552001953125, 0.10565185546875, 0.37109375, -0.1683349609375, -0.2379150390625, -0.6650390625, 0.1639404296875, 0.201416015625, 0.1649169921875, -0.2064208984375, -0.61572265625, -0.1292724609375, 0.006328582763671875, 0.0188751220703125, -0.34326171875, 0.0814208984375, -1.0888671875, -0.3544921875, 0.269287109375, -0.31982421875, -0.413330078125, -0.388671875, 0.308349609375, 0.26904296875, -0.347412109375, -0.7685546875, 0.80029296875, -0.1287841796875, 1.0234375, 0.139404296875, 0.00463104248046875, -0.71728515625, -0.37255859375, 0.245361328125, 0.337646484375, 0.31982421875, -0.01922607421875, -0.0472412109375, 0.62890625, -0.513671875, 0.0716552734375, 0.5888671875, 0.568359375, -0.256103515625, 0.369140625, 0.43896484375, -0.09429931640625, 0.64697265625, 0.646484375, -0.5966796875, 1.1181640625, -0.485107421875, -0.160400390625, 0.052001953125, -0.148193359375, -0.160888671875, 0.04840087890625, -0.14013671875, -0.29736328125, 0.982421875, 0.40283203125, -0.474365234375, 0.623046875, 0.160888671875, 0.4384765625, -0.76513671875, 0.402099609375, 0.69677734375, -0.1361083984375, 0.67431640625, -0.1473388671875, -0.05010986328125, -0.22119140625, -0.382080078125, 0.89306640625, -0.50537109375, 0.041473388671875, 0.333251953125, -0.2275390625, -0.0165252685546875, 0.33251953125, -0.342529296875, 1.072265625, -0.26025390625, 0.71240234375, 0.382568359375, -0.416259765625, 0.4697265625, -0.2423095703125, 0.039703369140625, 1.6279296875, 0.484375, -0.036712646484375, 0.9677734375, 0.44580078125, -0.64892578125, 0.09979248046875, -0.94287109375, 0.5986328125, 0.14306640625, 0.51513671875, -0.1693115234375, -0.08648681640625, -0.3515625, 0.33154296875, 0.309814453125, 0.2496337890625, -0.25439453125, 0.113525390625, -0.11273193359375, 0.69287109375, -0.07489013671875, 1.138671875, -0.4482421875, -0.2069091796875, -0.10089111328125, -0.4658203125, 0.1990966796875, -0.339111328125, -0.34375, 0.72900390625, 0.6689453125, 1.01953125, 0.9677734375, -0.1910400390625, 0.04498291015625, 0.2059326171875, -0.3349609375, 0.373046875, 0.0738525390625, 0.6552734375, 0.125244140625, 0.06671142578125, 0.281005859375, -0.257080078125, -0.481689453125, -0.416259765625, 0.14892578125, 0.791015625, -0.494140625, -0.0284576416015625, 0.269775390625, 0.25390625, -0.73193359375, 0.0214691162109375, -0.331787109375, -0.7705078125, -0.486572265625, 0.245849609375, -0.18115234375, 0.57861328125, -0.439697265625, -0.75, 0.445556640625, 0.67333984375, -0.3076171875, -0.22265625, 0.40869140625, 0.4423828125, -0.379150390625, 0.315673828125, -0.076416015625, 0.03582763671875, -0.372802734375, 0.8955078125, -0.313720703125, 0.042816162109375, 0.42431640625, 0.75830078125, 0.5498046875, 0.486572265625, -0.2432861328125, -0.1485595703125, 0.94287109375, 1.2294921875, -0.003391265869140625, 0.428466796875, 0.147705078125, 0.88330078125, 0.9853515625, 0.9365234375, 0.919921875, -0.0026092529296875, 0.66357421875, 0.87841796875, 0.2239990234375, 0.1536865234375, 0.46728515625, 0.3896484375, 0.406005859375, 0.677734375, -0.00873565673828125, 0.293212890625, -0.31982421875, 0.490234375, -0.324951171875, 0.240234375, -0.261474609375, 0.775390625, 0.25537109375, 0.4248046875, -0.3828125, -0.474365234375, 0.331298828125, 0.884765625, -0.88330078125, -0.619140625, -0.2476806640625, 0.0826416015625, 0.0985107421875, -0.288818359375, 0.49560546875, 0.3037109375, 0.21435546875, 0.482421875, -0.278564453125, -0.495361328125, -1.328125, -0.8603515625, -0.9892578125, -0.41650390625, -0.916015625, 0.124267578125, 0.35009765625, -0.8115234375, 0.294189453125, -0.41943359375, -0.237548828125, 0.1826171875, -0.64794921875, 0.59521484375, 0.0143890380859375, 0.498779296875, -0.5087890625, 0.76220703125, 0.54248046875, 0.94287109375, -0.7412109375, -0.11431884765625, -0.396240234375, -0.53369140625, 0.186767578125, 0.13330078125, 0.468017578125, -0.08514404296875, -0.61962890625, -0.6083984375, -0.80126953125, -0.51953125, -0.65771484375, -0.09912109375, -0.328369140625, 0.84716796875, 0.5263671875, -0.67431640625, 0.43115234375, 1.0927734375, -0.28173828125, 0.263916015625, 0.0018148422241210938, 0.0060272216796875, -0.73291015625, 1.0712890625, 0.1822509765625, 0.5927734375, -0.38330078125, -0.267822265625, -0.2490234375, 0.2120361328125, 0.1536865234375, -0.45556640625, -0.24462890625, 0.335693359375, -0.0263671875, -1.0009765625, 0.45068359375, -0.87890625, -0.46435546875, -0.2474365234375, -0.68603515625, 0.5, 0.92919921875, -0.08306884765625, -0.1705322265625, 0.06671142578125, 0.08599853515625, 0.67724609375, 0.38330078125, -0.55322265625, 0.11932373046875, 0.279296875, 0.17138671875, -0.263671875, 0.435546875, -0.568359375, -0.0297698974609375, -0.0679931640625, 0.49755859375, 0.68994140625, 0.1962890625, 0.57861328125, 0.492919921875, 0.9091796875, -0.492431640625, -0.279296875, -0.035675048828125, 0.623046875, 0.38037109375, 0.662109375, 0.3515625, -0.439697265625, -0.78369140625, -1.287109375, 0.45947265625, 0.2471923828125, 0.82373046875, -0.859375, 0.7119140625, 0.05029296875, -0.446044921875, 0.263916015625, -0.61767578125, -0.08978271484375, 1.078125, -0.1929931640625, 0.83740234375, -0.64697265625, 0.384033203125, -0.1923828125, -0.038818359375, 0.5927734375, 0.340087890625, 0.46826171875, -0.498046875, -0.54443359375, -0.58349609375, 0.25830078125, -0.2393798828125, -0.39306640625, 0.1536865234375, -0.464599609375, -0.14892578125, -0.87939453125, 0.6279296875, 0.58740234375, 0.57470703125, -0.11962890625, 0.564453125, 0.53662109375, 0.51318359375, 0.4267578125, -0.6328125, 0.302734375, -0.810546875, 0.5908203125, 0.217041015625, -0.35107421875, -0.42626953125, -0.45263671875, -0.444580078125, 0.2052001953125, 0.2301025390625, -0.218994140625, -0.93212890625, 0.57421875, -0.1793212890625, 0.58740234375, -0.42431640625, -0.240966796875, -0.63720703125, 0.419921875, 0.60986328125, -0.89501953125, 0.53466796875, -0.6572265625, 0.7998046875, 0.4541015625, -0.181640625, -0.2171630859375, -0.4560546875, -0.6474609375, -0.492431640625, 0.0482177734375, 0.99560546875, -0.04327392578125, 0.087646484375, -1.0322265625, 0.25439453125, 0.2437744140625, -0.47705078125, 0.10113525390625, -0.181640625, 0.38427734375, 0.1453857421875, 0.705078125, -0.360107421875, -0.311279296875, 0.124267578125, -1.34375, 0.401123046875, -0.51806640625, 0.5029296875, -0.316650390625, -0.0947265625, 0.12371826171875, 0.51953125, -0.428955078125, -0.33447265625, -0.278076171875, 0.5859375, -0.92333984375, -0.79345703125, 0.389404296875, -0.311767578125, -0.2113037109375, 0.92431640625, -0.369140625, -0.2841796875, 0.286376953125, 0.8671875, -0.456787109375, 0.3134765625, -0.4033203125, 0.465087890625, -0.52734375, -0.7177734375, -0.2041015625, -0.65576171875, 0.966796875, 0.06689453125, -0.671875, -0.3544921875, -1.1240234375, -0.156494140625, 0.1876220703125, -0.63818359375, 0.158203125, 0.2431640625, 0.0106048583984375, -0.3291015625, -0.421875, -0.3330078125, -0.2734375, -0.81396484375, -0.36474609375, 0.341064453125, 0.59912109375, 0.47119140625, -0.354248046875, -0.54052734375, -0.06396484375, -0.2197265625, 0.0360107421875, -0.3720703125, -0.431884765625, -0.235595703125, -0.07244873046875, -0.302490234375, 0.1182861328125, 0.020782470703125, 0.07135009765625, 0.6455078125, -0.1256103515625, 0.51953125, 0.1602783203125, -0.69482421875, 1.029296875, -0.04766845703125, -1.0283203125, -0.378662109375, 0.16748046875, 0.1739501953125, 0.54541015625, 0.3154296875, -0.771484375, -0.80224609375, -1.0146484375, 0.1500244140625, -0.666015625, -0.074951171875, -0.892578125, -0.01439666748046875, -0.6318359375, 0.630859375, -0.1673583984375, -0.6787109375, 0.13427734375, -0.9755859375, 0.152587890625, -0.68359375, -0.232177734375, -0.75, -0.517578125, -0.56005859375, 0.865234375, 0.23681640625, 0.484130859375, -0.178955078125, -0.2335205078125, 0.29638671875, -0.06390380859375, -0.5859375, -0.331787109375, -0.07672119140625, 0.46435546875, -0.51806640625, -0.249755859375, -0.469970703125, 0.67724609375, -0.8603515625, 0.2783203125, -0.293701171875, -0.377685546875, -0.05657958984375, -0.1854248046875, 1.181640625, -0.158203125, 0.3486328125, -0.420654296875, 0.87158203125, 0.7197265625, -0.54052734375, -0.65869140625, -0.904296875, -0.86376953125, -0.8251953125, 0.450927734375, -0.671875, 0.22509765625, -0.66796875, -0.1658935546875, 1.0625, -0.53857421875, 0.27783203125, 1.109375, 0.2125244140625, 0.64599609375, -0.802734375, 0.58056640625, 0.20068359375, -0.787109375, 0.0073394775390625, 0.2305908203125, -0.5888671875, 0.033538818359375, -0.1719970703125, -0.8583984375, -0.6708984375, 0.370849609375, 1.3828125, -0.369873046875, 0.63427734375, -0.058441162109375, -0.8896484375, -0.7314453125, 0.71923828125, 0.276611328125, 0.33837890625, 1.0390625, -0.2088623046875, 0.07501220703125, -0.376953125, 0.18359375, -0.206298828125, -0.5595703125, 0.9599609375, -0.1632080078125, -0.6142578125, 0.87451171875, 0.90576171875, -1.0556640625, -0.724609375, -0.09893798828125, -0.03448486328125, -0.20849609375, -0.634765625, -0.255615234375, 0.49951171875, -0.51220703125, 0.14892578125, 0.5126953125, -0.1190185546875, 0.324462890625, -0.050140380859375, 0.0751953125, -0.486328125, 0.60546875, 0.525390625, -0.425537109375, -0.1278076171875, -1.0771484375, -0.5068359375, -0.3759765625, 0.046142578125, 0.54833984375, -0.422607421875, 0.321044921875, 0.49755859375, -0.035858154296875, 0.703125, -0.329345703125, -0.51123046875, 0.425537109375, -0.90185546875, -0.51953125, -0.0946044921875, 0.10833740234375, -0.2239990234375, 0.230224609375, -0.376220703125, 0.44677734375, -0.008575439453125, 0.51513671875, -0.389404296875, -1.1474609375, -0.251953125, -1.2177734375, -0.30908203125, -0.60595703125, -0.337158203125, -0.0654296875, 0.2230224609375, 0.27490234375, -0.43701171875, 0.09161376953125, 0.459716796875, -0.5556640625, 0.69384765625, -0.5537109375, 0.307373046875, -0.7373046875, -0.456787109375, -0.7177734375, 0.12286376953125, -0.5791015625, -0.01486968994140625, -0.6455078125, 0.21875, -0.0450439453125, 0.420654296875, -0.06683349609375, 0.52001953125, -0.22314453125, -0.591796875, 0.21337890625, 0.0404052734375, -0.1343994140625, 0.490966796875, 0.54638671875, -0.12109375, 0.3896484375, -0.07470703125, -0.239501953125, -0.64208984375, 0.662109375, 0.43115234375, -0.00144195556640625, -0.21875, -0.0244293212890625, 0.360107421875, -0.927734375, 0.583984375, -0.1585693359375, 0.00012552738189697266, -0.02777099609375, -0.410888671875, 0.3623046875, 1.2763671875, -0.14013671875, 0.62353515625, -0.1910400390625, 0.1009521484375, 0.27734375, 0.056549072265625, -0.1444091796875, 0.4638671875, -0.08258056640625, -0.15869140625, -0.009613037109375, 0.52880859375, 0.046844482421875, 0.6962890625, -0.3427734375, -0.87890625, -0.88720703125, -0.4326171875, 0.10009765625, 0.25439453125, 0.53466796875, -0.28857421875, -0.01666259765625, -0.2061767578125, -0.193359375, 0.449462890625, -1.0830078125, -1.048828125, 0.3046875, -0.080810546875, -0.662109375, -0.2391357421875, -0.75341796875, -0.53759765625, -0.0017499923706054688, 0.318603515625, -0.61572265625, 0.474609375, 0.027801513671875, 0.85791015625, -0.4833984375, 0.286865234375, 0.060577392578125, 0.56591796875, -0.53955078125, -0.441650390625, -0.040374755859375, 1.0703125, 0.1668701171875, -0.296142578125, -0.49072265625, 0.43603515625, 0.010040283203125, 0.288330078125, -0.1439208984375, 0.07098388671875, -0.40234375, 0.73046875, -1.0830078125, 0.037445068359375, -0.175048828125, 0.38037109375, -0.0782470703125, -0.5478515625, -0.47412109375, 1.1298828125, 0.6513671875, -0.156982421875, 0.5810546875, 0.0276641845703125, 0.47119140625, -0.1917724609375, 0.06683349609375, -0.33447265625, 0.8251953125, 0.484130859375, 0.9619140625, -0.359619140625, 0.09954833984375, 0.56982421875, 0.07568359375, -0.388671875, 0.03375244140625, -0.013427734375, -0.06256103515625, 0.453125, -0.2685546875, -0.089111328125, -0.016326904296875, -0.74365234375, 0.439697265625, -0.42333984375, -0.036041259765625, -0.171630859375, -0.95361328125, 0.92724609375, -0.450439453125, 0.0308074951171875, 0.6591796875, -0.368896484375, -0.05450439453125, 0.63134765625, -0.0902099609375, -0.4404296875, 0.7333984375, 0.724609375, 0.469482421875, 0.5732421875, 0.61669921875, 0.47119140625, -0.888671875, 0.30419921875, 0.2244873046875, -0.155029296875, -0.07269287109375, -0.64404296875, -0.982421875, 0.351806640625, -0.30517578125, -0.076416015625, 0.66015625, -0.7685546875, 0.01485443115234375, -0.52880859375, 0.75439453125, -0.389404296875, 0.413330078125, 0.11993408203125, -0.67578125, -0.439208984375, 0.61865234375, -0.25732421875, 0.5185546875, 0.0028533935546875, 1.0986328125, -0.07440185546875, 1.4306640625, 0.83935546875, -0.320068359375, 0.211669921875, 0.473388671875, -0.2188720703125, -0.444091796875, -0.71630859375, -0.49951171875, 0.1947021484375, -0.55419921875, -0.5400390625, -0.042236328125, 1.083984375, -0.03485107421875, -1.2470703125, -0.591796875, 0.1669921875, -1.1484375, 0.2174072265625, 0.51171875, 0.431396484375, -0.1143798828125, -0.12115478515625, -0.036529541015625, -0.6591796875, 0.477294921875, -0.9609375, 0.24658203125, -0.383056640625, -0.44189453125, -0.53857421875, -0.66259765625, -0.51025390625, -0.192138671875, -0.234375, -0.974609375, 0.525390625, 0.397705078125, 0.74560546875, 0.305908203125, -0.294677734375, 0.30615234375, 1.0361328125, 1.28125, 0.07830810546875, 0.6943359375, 0.5029296875, -0.383544921875, 0.253662109375, -0.4599609375, 0.2108154296875, -0.14111328125, 0.53076171875, -0.35546875, 0.368896484375, -0.84423828125, -1.2216796875, -0.197998046875, 0.5498046875, 0.2442626953125, -0.66259765625, -0.95703125, -0.2734375, -0.96923828125, -0.33740234375, -0.67333984375, 0.78369140625, -0.35986328125, 0.147705078125, 0.1817626953125, -1.2412109375, 4.390625, 1.09375, 0.9404296875, 0.45361328125, 0.25634765625, 1.0673828125, 0.224365234375, -0.444580078125, -0.1875, -0.297119140625, 0.3115234375, -0.51708984375, -0.028961181640625, 0.80810546875, 0.1041259765625, 0.354248046875, -0.60400390625, -0.014129638671875, -0.16845703125, -0.8447265625, -0.51611328125, 0.1051025390625, -0.1497802734375, 0.4052734375, 0.2274169921875, 0.160400390625, 0.378662109375, -0.83984375, -0.432861328125, -0.568359375, 0.344970703125, -0.58544921875, 0.90380859375, 0.345458984375, -0.2152099609375, 0.58984375, -0.265625, -0.5185546875, -0.085693359375, 0.06634521484375, -0.258056640625, 0.51025390625, 0.6103515625, -0.7158203125, -0.329833984375, 0.43896484375, -0.71435546875, 0.38916015625, 0.1259765625, -1.1103515625, 0.8095703125, -0.34375, 0.572265625, -0.80322265625, -0.79296875, 0.498291015625, 0.1243896484375, 0.11480712890625, -0.4287109375, 0.54443359375, 0.59033203125, 0.318359375, 0.34228515625, 0.7333984375, -1.34375, 0.58203125, -0.1776123046875, 0.428955078125, -0.5439453125, 0.102294921875, -0.1783447265625, -0.277099609375, -0.273681640625, -0.401123046875, 0.5322265625, 0.474853515625, -0.2432861328125, 0.978515625, 0.49365234375, -0.81884765625, 0.048675537109375, -0.0018157958984375, -0.1951904296875, -0.419921875, 0.8544921875, 1.2626953125, -0.467041015625, -0.071044921875, -0.446533203125, 0.810546875, 0.8056640625, 0.71240234375, 0.0011663436889648438, -0.37158203125, -0.071044921875 ]
6
Provide tags and a correct Python 3 solution for this coding contest problem. This problem is different from the easy version. In this version Ujan makes at most 2n swaps. In addition, k ≤ 1000, n ≤ 50 and it is necessary to print swaps themselves. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems. After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first. Ujan has two distinct strings s and t of length n consisting of only of lowercase English characters. He wants to make them equal. Since Ujan is lazy, he will perform the following operation at most 2n times: he takes two positions i and j (1 ≤ i,j ≤ n, the values i and j can be equal or different), and swaps the characters s_i and t_j. Ujan's goal is to make the strings s and t equal. He does not need to minimize the number of performed operations: any sequence of operations of length 2n or shorter is suitable. Input The first line contains a single integer k (1 ≤ k ≤ 1000), the number of test cases. For each of the test cases, the first line contains a single integer n (2 ≤ n ≤ 50), the length of the strings s and t. Each of the next two lines contains the strings s and t, each having length exactly n. The strings consist only of lowercase English letters. It is guaranteed that strings are different. Output For each test case, output "Yes" if Ujan can make the two strings equal with at most 2n operations and "No" otherwise. You can print each letter in any case (upper or lower). In the case of "Yes" print m (1 ≤ m ≤ 2n) on the next line, where m is the number of swap operations to make the strings equal. Then print m lines, each line should contain two integers i, j (1 ≤ i, j ≤ n) meaning that Ujan swaps s_i and t_j during the corresponding operation. You do not need to minimize the number of operations. Any sequence of length not more than 2n is suitable. Example Input 4 5 souse houhe 3 cat dog 2 aa az 3 abc bca Output Yes 1 1 4 No No Yes 3 1 2 3 1 2 3 Tags: strings Correct Solution: ``` import sys input = sys.stdin.readline for q in range(int(input())): N = int(input()) s = list(input().rstrip()) t = list(input().rstrip()) ans = [] for i in range(N-1): if s[i] != t[i]: for j in range(i + 1, N): if s[j] == s[i]: ans.append((j + 1, i + 1)) s[j], t[i] = t[i], s[j] break if t[j] == s[i]: ans.append((i + 2, j + 1)) s[i + 1], t[j] = t[j], s[i + 1] ans.append((i + 2, i + 1)) s[i + 1], t[i] = t[i], s[i + 1] break flag = True for i in range(N): if s[i] != t[i]: flag = False if flag and ans: print("Yes") print(len(ans)) for u,v in ans: print(u, v) else: print("No") ```
136
[ 0.28955078125, -0.09613037109375, -0.1514892578125, -0.057098388671875, -0.62646484375, -0.5537109375, 0.038604736328125, -0.0033721923828125, 0.071533203125, 1.01953125, 0.978515625, 0.06304931640625, 0.2388916015625, -1.1875, -0.63916015625, -0.00443267822265625, -0.4404296875, -0.497314453125, -0.415283203125, -0.288330078125, 0.1864013671875, -0.291259765625, -1.4765625, -0.1077880859375, -0.293701171875, 0.7734375, 0.32421875, -0.142822265625, 0.79736328125, 1.1728515625, 0.034332275390625, -0.037689208984375, 0.369873046875, -1.111328125, -0.15087890625, -0.40234375, 0.50634765625, -0.453125, -0.298828125, -0.53515625, 0.31787109375, -0.85595703125, 0.30517578125, -0.658203125, -1.115234375, 0.11724853515625, -0.5478515625, -0.31640625, -0.09149169921875, -0.5546875, 0.38427734375, -0.287353515625, 0.74609375, 0.0259552001953125, 0.10565185546875, 0.37109375, -0.1683349609375, -0.2379150390625, -0.6650390625, 0.1639404296875, 0.201416015625, 0.1649169921875, -0.2064208984375, -0.61572265625, -0.1292724609375, 0.006328582763671875, 0.0188751220703125, -0.34326171875, 0.0814208984375, -1.0888671875, -0.3544921875, 0.269287109375, -0.31982421875, -0.413330078125, -0.388671875, 0.308349609375, 0.26904296875, -0.347412109375, -0.7685546875, 0.80029296875, -0.1287841796875, 1.0234375, 0.139404296875, 0.00463104248046875, -0.71728515625, -0.37255859375, 0.245361328125, 0.337646484375, 0.31982421875, -0.01922607421875, -0.0472412109375, 0.62890625, -0.513671875, 0.0716552734375, 0.5888671875, 0.568359375, -0.256103515625, 0.369140625, 0.43896484375, -0.09429931640625, 0.64697265625, 0.646484375, -0.5966796875, 1.1181640625, -0.485107421875, -0.160400390625, 0.052001953125, -0.148193359375, -0.160888671875, 0.04840087890625, -0.14013671875, -0.29736328125, 0.982421875, 0.40283203125, -0.474365234375, 0.623046875, 0.160888671875, 0.4384765625, -0.76513671875, 0.402099609375, 0.69677734375, -0.1361083984375, 0.67431640625, -0.1473388671875, -0.05010986328125, -0.22119140625, -0.382080078125, 0.89306640625, -0.50537109375, 0.041473388671875, 0.333251953125, -0.2275390625, -0.0165252685546875, 0.33251953125, -0.342529296875, 1.072265625, -0.26025390625, 0.71240234375, 0.382568359375, -0.416259765625, 0.4697265625, -0.2423095703125, 0.039703369140625, 1.6279296875, 0.484375, -0.036712646484375, 0.9677734375, 0.44580078125, -0.64892578125, 0.09979248046875, -0.94287109375, 0.5986328125, 0.14306640625, 0.51513671875, -0.1693115234375, -0.08648681640625, -0.3515625, 0.33154296875, 0.309814453125, 0.2496337890625, -0.25439453125, 0.113525390625, -0.11273193359375, 0.69287109375, -0.07489013671875, 1.138671875, -0.4482421875, -0.2069091796875, -0.10089111328125, -0.4658203125, 0.1990966796875, -0.339111328125, -0.34375, 0.72900390625, 0.6689453125, 1.01953125, 0.9677734375, -0.1910400390625, 0.04498291015625, 0.2059326171875, -0.3349609375, 0.373046875, 0.0738525390625, 0.6552734375, 0.125244140625, 0.06671142578125, 0.281005859375, -0.257080078125, -0.481689453125, -0.416259765625, 0.14892578125, 0.791015625, -0.494140625, -0.0284576416015625, 0.269775390625, 0.25390625, -0.73193359375, 0.0214691162109375, -0.331787109375, -0.7705078125, -0.486572265625, 0.245849609375, -0.18115234375, 0.57861328125, -0.439697265625, -0.75, 0.445556640625, 0.67333984375, -0.3076171875, -0.22265625, 0.40869140625, 0.4423828125, -0.379150390625, 0.315673828125, -0.076416015625, 0.03582763671875, -0.372802734375, 0.8955078125, -0.313720703125, 0.042816162109375, 0.42431640625, 0.75830078125, 0.5498046875, 0.486572265625, -0.2432861328125, -0.1485595703125, 0.94287109375, 1.2294921875, -0.003391265869140625, 0.428466796875, 0.147705078125, 0.88330078125, 0.9853515625, 0.9365234375, 0.919921875, -0.0026092529296875, 0.66357421875, 0.87841796875, 0.2239990234375, 0.1536865234375, 0.46728515625, 0.3896484375, 0.406005859375, 0.677734375, -0.00873565673828125, 0.293212890625, -0.31982421875, 0.490234375, -0.324951171875, 0.240234375, -0.261474609375, 0.775390625, 0.25537109375, 0.4248046875, -0.3828125, -0.474365234375, 0.331298828125, 0.884765625, -0.88330078125, -0.619140625, -0.2476806640625, 0.0826416015625, 0.0985107421875, -0.288818359375, 0.49560546875, 0.3037109375, 0.21435546875, 0.482421875, -0.278564453125, -0.495361328125, -1.328125, -0.8603515625, -0.9892578125, -0.41650390625, -0.916015625, 0.124267578125, 0.35009765625, -0.8115234375, 0.294189453125, -0.41943359375, -0.237548828125, 0.1826171875, -0.64794921875, 0.59521484375, 0.0143890380859375, 0.498779296875, -0.5087890625, 0.76220703125, 0.54248046875, 0.94287109375, -0.7412109375, -0.11431884765625, -0.396240234375, -0.53369140625, 0.186767578125, 0.13330078125, 0.468017578125, -0.08514404296875, -0.61962890625, -0.6083984375, -0.80126953125, -0.51953125, -0.65771484375, -0.09912109375, -0.328369140625, 0.84716796875, 0.5263671875, -0.67431640625, 0.43115234375, 1.0927734375, -0.28173828125, 0.263916015625, 0.0018148422241210938, 0.0060272216796875, -0.73291015625, 1.0712890625, 0.1822509765625, 0.5927734375, -0.38330078125, -0.267822265625, -0.2490234375, 0.2120361328125, 0.1536865234375, -0.45556640625, -0.24462890625, 0.335693359375, -0.0263671875, -1.0009765625, 0.45068359375, -0.87890625, -0.46435546875, -0.2474365234375, -0.68603515625, 0.5, 0.92919921875, -0.08306884765625, -0.1705322265625, 0.06671142578125, 0.08599853515625, 0.67724609375, 0.38330078125, -0.55322265625, 0.11932373046875, 0.279296875, 0.17138671875, -0.263671875, 0.435546875, -0.568359375, -0.0297698974609375, -0.0679931640625, 0.49755859375, 0.68994140625, 0.1962890625, 0.57861328125, 0.492919921875, 0.9091796875, -0.492431640625, -0.279296875, -0.035675048828125, 0.623046875, 0.38037109375, 0.662109375, 0.3515625, -0.439697265625, -0.78369140625, -1.287109375, 0.45947265625, 0.2471923828125, 0.82373046875, -0.859375, 0.7119140625, 0.05029296875, -0.446044921875, 0.263916015625, -0.61767578125, -0.08978271484375, 1.078125, -0.1929931640625, 0.83740234375, -0.64697265625, 0.384033203125, -0.1923828125, -0.038818359375, 0.5927734375, 0.340087890625, 0.46826171875, -0.498046875, -0.54443359375, -0.58349609375, 0.25830078125, -0.2393798828125, -0.39306640625, 0.1536865234375, -0.464599609375, -0.14892578125, -0.87939453125, 0.6279296875, 0.58740234375, 0.57470703125, -0.11962890625, 0.564453125, 0.53662109375, 0.51318359375, 0.4267578125, -0.6328125, 0.302734375, -0.810546875, 0.5908203125, 0.217041015625, -0.35107421875, -0.42626953125, -0.45263671875, -0.444580078125, 0.2052001953125, 0.2301025390625, -0.218994140625, -0.93212890625, 0.57421875, -0.1793212890625, 0.58740234375, -0.42431640625, -0.240966796875, -0.63720703125, 0.419921875, 0.60986328125, -0.89501953125, 0.53466796875, -0.6572265625, 0.7998046875, 0.4541015625, -0.181640625, -0.2171630859375, -0.4560546875, -0.6474609375, -0.492431640625, 0.0482177734375, 0.99560546875, -0.04327392578125, 0.087646484375, -1.0322265625, 0.25439453125, 0.2437744140625, -0.47705078125, 0.10113525390625, -0.181640625, 0.38427734375, 0.1453857421875, 0.705078125, -0.360107421875, -0.311279296875, 0.124267578125, -1.34375, 0.401123046875, -0.51806640625, 0.5029296875, -0.316650390625, -0.0947265625, 0.12371826171875, 0.51953125, -0.428955078125, -0.33447265625, -0.278076171875, 0.5859375, -0.92333984375, -0.79345703125, 0.389404296875, -0.311767578125, -0.2113037109375, 0.92431640625, -0.369140625, -0.2841796875, 0.286376953125, 0.8671875, -0.456787109375, 0.3134765625, -0.4033203125, 0.465087890625, -0.52734375, -0.7177734375, -0.2041015625, -0.65576171875, 0.966796875, 0.06689453125, -0.671875, -0.3544921875, -1.1240234375, -0.156494140625, 0.1876220703125, -0.63818359375, 0.158203125, 0.2431640625, 0.0106048583984375, -0.3291015625, -0.421875, -0.3330078125, -0.2734375, -0.81396484375, -0.36474609375, 0.341064453125, 0.59912109375, 0.47119140625, -0.354248046875, -0.54052734375, -0.06396484375, -0.2197265625, 0.0360107421875, -0.3720703125, -0.431884765625, -0.235595703125, -0.07244873046875, -0.302490234375, 0.1182861328125, 0.020782470703125, 0.07135009765625, 0.6455078125, -0.1256103515625, 0.51953125, 0.1602783203125, -0.69482421875, 1.029296875, -0.04766845703125, -1.0283203125, -0.378662109375, 0.16748046875, 0.1739501953125, 0.54541015625, 0.3154296875, -0.771484375, -0.80224609375, -1.0146484375, 0.1500244140625, -0.666015625, -0.074951171875, -0.892578125, -0.01439666748046875, -0.6318359375, 0.630859375, -0.1673583984375, -0.6787109375, 0.13427734375, -0.9755859375, 0.152587890625, -0.68359375, -0.232177734375, -0.75, -0.517578125, -0.56005859375, 0.865234375, 0.23681640625, 0.484130859375, -0.178955078125, -0.2335205078125, 0.29638671875, -0.06390380859375, -0.5859375, -0.331787109375, -0.07672119140625, 0.46435546875, -0.51806640625, -0.249755859375, -0.469970703125, 0.67724609375, -0.8603515625, 0.2783203125, -0.293701171875, -0.377685546875, -0.05657958984375, -0.1854248046875, 1.181640625, -0.158203125, 0.3486328125, -0.420654296875, 0.87158203125, 0.7197265625, -0.54052734375, -0.65869140625, -0.904296875, -0.86376953125, -0.8251953125, 0.450927734375, -0.671875, 0.22509765625, -0.66796875, -0.1658935546875, 1.0625, -0.53857421875, 0.27783203125, 1.109375, 0.2125244140625, 0.64599609375, -0.802734375, 0.58056640625, 0.20068359375, -0.787109375, 0.0073394775390625, 0.2305908203125, -0.5888671875, 0.033538818359375, -0.1719970703125, -0.8583984375, -0.6708984375, 0.370849609375, 1.3828125, -0.369873046875, 0.63427734375, -0.058441162109375, -0.8896484375, -0.7314453125, 0.71923828125, 0.276611328125, 0.33837890625, 1.0390625, -0.2088623046875, 0.07501220703125, -0.376953125, 0.18359375, -0.206298828125, -0.5595703125, 0.9599609375, -0.1632080078125, -0.6142578125, 0.87451171875, 0.90576171875, -1.0556640625, -0.724609375, -0.09893798828125, -0.03448486328125, -0.20849609375, -0.634765625, -0.255615234375, 0.49951171875, -0.51220703125, 0.14892578125, 0.5126953125, -0.1190185546875, 0.324462890625, -0.050140380859375, 0.0751953125, -0.486328125, 0.60546875, 0.525390625, -0.425537109375, -0.1278076171875, -1.0771484375, -0.5068359375, -0.3759765625, 0.046142578125, 0.54833984375, -0.422607421875, 0.321044921875, 0.49755859375, -0.035858154296875, 0.703125, -0.329345703125, -0.51123046875, 0.425537109375, -0.90185546875, -0.51953125, -0.0946044921875, 0.10833740234375, -0.2239990234375, 0.230224609375, -0.376220703125, 0.44677734375, -0.008575439453125, 0.51513671875, -0.389404296875, -1.1474609375, -0.251953125, -1.2177734375, -0.30908203125, -0.60595703125, -0.337158203125, -0.0654296875, 0.2230224609375, 0.27490234375, -0.43701171875, 0.09161376953125, 0.459716796875, -0.5556640625, 0.69384765625, -0.5537109375, 0.307373046875, -0.7373046875, -0.456787109375, -0.7177734375, 0.12286376953125, -0.5791015625, -0.01486968994140625, -0.6455078125, 0.21875, -0.0450439453125, 0.420654296875, -0.06683349609375, 0.52001953125, -0.22314453125, -0.591796875, 0.21337890625, 0.0404052734375, -0.1343994140625, 0.490966796875, 0.54638671875, -0.12109375, 0.3896484375, -0.07470703125, -0.239501953125, -0.64208984375, 0.662109375, 0.43115234375, -0.00144195556640625, -0.21875, -0.0244293212890625, 0.360107421875, -0.927734375, 0.583984375, -0.1585693359375, 0.00012552738189697266, -0.02777099609375, -0.410888671875, 0.3623046875, 1.2763671875, -0.14013671875, 0.62353515625, -0.1910400390625, 0.1009521484375, 0.27734375, 0.056549072265625, -0.1444091796875, 0.4638671875, -0.08258056640625, -0.15869140625, -0.009613037109375, 0.52880859375, 0.046844482421875, 0.6962890625, -0.3427734375, -0.87890625, -0.88720703125, -0.4326171875, 0.10009765625, 0.25439453125, 0.53466796875, -0.28857421875, -0.01666259765625, -0.2061767578125, -0.193359375, 0.449462890625, -1.0830078125, -1.048828125, 0.3046875, -0.080810546875, -0.662109375, -0.2391357421875, -0.75341796875, -0.53759765625, -0.0017499923706054688, 0.318603515625, -0.61572265625, 0.474609375, 0.027801513671875, 0.85791015625, -0.4833984375, 0.286865234375, 0.060577392578125, 0.56591796875, -0.53955078125, -0.441650390625, -0.040374755859375, 1.0703125, 0.1668701171875, -0.296142578125, -0.49072265625, 0.43603515625, 0.010040283203125, 0.288330078125, -0.1439208984375, 0.07098388671875, -0.40234375, 0.73046875, -1.0830078125, 0.037445068359375, -0.175048828125, 0.38037109375, -0.0782470703125, -0.5478515625, -0.47412109375, 1.1298828125, 0.6513671875, -0.156982421875, 0.5810546875, 0.0276641845703125, 0.47119140625, -0.1917724609375, 0.06683349609375, -0.33447265625, 0.8251953125, 0.484130859375, 0.9619140625, -0.359619140625, 0.09954833984375, 0.56982421875, 0.07568359375, -0.388671875, 0.03375244140625, -0.013427734375, -0.06256103515625, 0.453125, -0.2685546875, -0.089111328125, -0.016326904296875, -0.74365234375, 0.439697265625, -0.42333984375, -0.036041259765625, -0.171630859375, -0.95361328125, 0.92724609375, -0.450439453125, 0.0308074951171875, 0.6591796875, -0.368896484375, -0.05450439453125, 0.63134765625, -0.0902099609375, -0.4404296875, 0.7333984375, 0.724609375, 0.469482421875, 0.5732421875, 0.61669921875, 0.47119140625, -0.888671875, 0.30419921875, 0.2244873046875, -0.155029296875, -0.07269287109375, -0.64404296875, -0.982421875, 0.351806640625, -0.30517578125, -0.076416015625, 0.66015625, -0.7685546875, 0.01485443115234375, -0.52880859375, 0.75439453125, -0.389404296875, 0.413330078125, 0.11993408203125, -0.67578125, -0.439208984375, 0.61865234375, -0.25732421875, 0.5185546875, 0.0028533935546875, 1.0986328125, -0.07440185546875, 1.4306640625, 0.83935546875, -0.320068359375, 0.211669921875, 0.473388671875, -0.2188720703125, -0.444091796875, -0.71630859375, -0.49951171875, 0.1947021484375, -0.55419921875, -0.5400390625, -0.042236328125, 1.083984375, -0.03485107421875, -1.2470703125, -0.591796875, 0.1669921875, -1.1484375, 0.2174072265625, 0.51171875, 0.431396484375, -0.1143798828125, -0.12115478515625, -0.036529541015625, -0.6591796875, 0.477294921875, -0.9609375, 0.24658203125, -0.383056640625, -0.44189453125, -0.53857421875, -0.66259765625, -0.51025390625, -0.192138671875, -0.234375, -0.974609375, 0.525390625, 0.397705078125, 0.74560546875, 0.305908203125, -0.294677734375, 0.30615234375, 1.0361328125, 1.28125, 0.07830810546875, 0.6943359375, 0.5029296875, -0.383544921875, 0.253662109375, -0.4599609375, 0.2108154296875, -0.14111328125, 0.53076171875, -0.35546875, 0.368896484375, -0.84423828125, -1.2216796875, -0.197998046875, 0.5498046875, 0.2442626953125, -0.66259765625, -0.95703125, -0.2734375, -0.96923828125, -0.33740234375, -0.67333984375, 0.78369140625, -0.35986328125, 0.147705078125, 0.1817626953125, -1.2412109375, 4.390625, 1.09375, 0.9404296875, 0.45361328125, 0.25634765625, 1.0673828125, 0.224365234375, -0.444580078125, -0.1875, -0.297119140625, 0.3115234375, -0.51708984375, -0.028961181640625, 0.80810546875, 0.1041259765625, 0.354248046875, -0.60400390625, -0.014129638671875, -0.16845703125, -0.8447265625, -0.51611328125, 0.1051025390625, -0.1497802734375, 0.4052734375, 0.2274169921875, 0.160400390625, 0.378662109375, -0.83984375, -0.432861328125, -0.568359375, 0.344970703125, -0.58544921875, 0.90380859375, 0.345458984375, -0.2152099609375, 0.58984375, -0.265625, -0.5185546875, -0.085693359375, 0.06634521484375, -0.258056640625, 0.51025390625, 0.6103515625, -0.7158203125, -0.329833984375, 0.43896484375, -0.71435546875, 0.38916015625, 0.1259765625, -1.1103515625, 0.8095703125, -0.34375, 0.572265625, -0.80322265625, -0.79296875, 0.498291015625, 0.1243896484375, 0.11480712890625, -0.4287109375, 0.54443359375, 0.59033203125, 0.318359375, 0.34228515625, 0.7333984375, -1.34375, 0.58203125, -0.1776123046875, 0.428955078125, -0.5439453125, 0.102294921875, -0.1783447265625, -0.277099609375, -0.273681640625, -0.401123046875, 0.5322265625, 0.474853515625, -0.2432861328125, 0.978515625, 0.49365234375, -0.81884765625, 0.048675537109375, -0.0018157958984375, -0.1951904296875, -0.419921875, 0.8544921875, 1.2626953125, -0.467041015625, -0.071044921875, -0.446533203125, 0.810546875, 0.8056640625, 0.71240234375, 0.0011663436889648438, -0.37158203125, -0.071044921875 ]
6
Provide tags and a correct Python 3 solution for this coding contest problem. The Little Girl loves problems on games very much. Here's one of them. Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: * The players move in turns; In one move the player can remove an arbitrary letter from string s. * If the player before his turn can reorder the letters in string s so as to get a palindrome, this player wins. A palindrome is a string that reads the same both ways (from left to right, and vice versa). For example, string "abba" is a palindrome and string "abc" isn't. Determine which player will win, provided that both sides play optimally well — the one who moves first or the one who moves second. Input The input contains a single line, containing string s (1 ≤ |s| ≤ 103). String s consists of lowercase English letters. Output In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes. Examples Input aba Output First Input abca Output Second Tags: games, greedy Correct Solution: ``` from collections import Counter s=input() dic=Counter(s) count=0 for val in dic.values(): if val%2!=0: count+=1 if count==0: print("First") elif count%2==0: print("Second") else: print("First") ```
286
[ -0.05926513671875, -0.02166748046875, -0.0196075439453125, 0.052215576171875, -0.450927734375, -0.7783203125, 0.09783935546875, -0.270263671875, 0.10504150390625, 0.57373046875, 0.467529296875, 0.044158935546875, 0.09722900390625, -0.6591796875, -0.7041015625, -0.381103515625, -0.8291015625, -0.7705078125, -0.587890625, -0.1549072265625, 0.187744140625, -0.0191497802734375, -1.5478515625, 0.020721435546875, 0.17578125, 1.0791015625, 0.6494140625, 0.1087646484375, 0.94482421875, 1.15625, -0.00966644287109375, -0.16552734375, 0.52587890625, -1.056640625, -0.0902099609375, -0.49365234375, 0.787109375, -0.8408203125, -0.33837890625, -0.40283203125, 0.1583251953125, -0.339111328125, 0.455322265625, -0.875, -1.0634765625, -0.244140625, -0.55859375, -0.53662109375, -0.0498046875, -0.5341796875, 0.11370849609375, -0.409423828125, 0.433349609375, 0.005889892578125, -0.2093505859375, 0.058013916015625, 0.146240234375, 0.2091064453125, -0.6591796875, 0.67919921875, 0.49951171875, 0.051239013671875, -0.1304931640625, -0.6591796875, -0.2529296875, -0.035919189453125, -0.03155517578125, -0.2310791015625, -0.01032257080078125, -0.92138671875, -0.252197265625, 0.139892578125, -0.379150390625, -0.484619140625, -0.351806640625, 0.285400390625, 0.223388671875, 0.08795166015625, -0.71337890625, 1.0439453125, 0.027435302734375, 1.3310546875, 0.407958984375, 0.01511383056640625, -0.266845703125, -0.333740234375, 0.18408203125, 0.05096435546875, 0.218994140625, -0.10888671875, -0.055450439453125, 0.7958984375, -0.88525390625, 0.302490234375, 0.410400390625, 0.822265625, -0.1365966796875, 0.0121002197265625, 0.4326171875, -0.054290771484375, 0.5244140625, 0.97119140625, -0.55078125, 1.0224609375, -0.67529296875, 0.0095672607421875, 0.358642578125, 0.0142669677734375, -0.26806640625, -0.029144287109375, -0.403564453125, -0.129638671875, 0.70849609375, 0.0999755859375, -0.2095947265625, 1.1767578125, 0.047393798828125, 0.2125244140625, -0.8701171875, 0.51806640625, 0.434326171875, 0.342529296875, 0.77978515625, -0.20166015625, 0.305419921875, 0.13623046875, -0.3017578125, 1.076171875, -0.75341796875, -0.029693603515625, 0.68994140625, 0.0877685546875, 0.26318359375, 0.1473388671875, -0.191650390625, 0.97021484375, -0.407470703125, 0.70654296875, 0.591796875, -0.437255859375, 0.83349609375, 0.010498046875, -0.1033935546875, 1.4384765625, 0.1580810546875, 0.01235198974609375, 0.814453125, 0.57861328125, -0.8427734375, 0.478515625, -0.98486328125, 0.689453125, 0.16552734375, 0.3623046875, -0.11328125, 0.1929931640625, -0.317138671875, 0.4990234375, 0.1480712890625, 0.3408203125, -0.76708984375, 0.1512451171875, -0.34423828125, 1.1396484375, -0.491455078125, 0.92431640625, -0.2294921875, -0.50927734375, 0.100341796875, -0.417724609375, 0.02679443359375, -0.45751953125, -0.00022733211517333984, 0.76513671875, 0.277099609375, 0.98779296875, 1.173828125, -0.23291015625, 0.301025390625, 0.2291259765625, -0.282470703125, 0.342529296875, 0.400390625, 0.6796875, 0.2161865234375, 0.384521484375, 0.13818359375, -0.255859375, -0.8056640625, -0.498291015625, -0.08795166015625, 0.64794921875, -0.50048828125, 0.321044921875, 0.33984375, 0.10430908203125, -0.7353515625, -0.031402587890625, -0.1993408203125, -1.115234375, 0.041351318359375, 0.53955078125, -0.1595458984375, 0.59765625, -0.446044921875, -0.54931640625, 0.580078125, 1.0576171875, -0.52734375, -0.2705078125, 0.351318359375, 0.295654296875, -0.51416015625, 0.218994140625, -0.0323486328125, -0.02490234375, -0.6962890625, 0.89208984375, -0.346435546875, 0.01271820068359375, 0.1556396484375, 0.59521484375, 0.51318359375, 0.6611328125, -0.229736328125, -0.08966064453125, 0.6669921875, 0.8154296875, 0.1624755859375, 0.254638671875, 0.30615234375, 0.8935546875, 0.311279296875, 0.81591796875, 0.6552734375, 0.1436767578125, -0.016510009765625, 0.7392578125, 0.1162109375, 0.037109375, 0.22216796875, 0.294921875, 0.433349609375, 0.402587890625, 0.215576171875, 0.64697265625, 0.0570068359375, 0.0889892578125, -0.450927734375, 0.31689453125, -0.1669921875, 0.69970703125, 0.568359375, 0.513671875, -0.259521484375, -0.3017578125, 0.468505859375, 0.7802734375, -0.8994140625, -0.564453125, 0.03668212890625, -0.04150390625, 0.0186004638671875, -0.212890625, 0.5263671875, 0.61376953125, 0.42822265625, 0.1116943359375, -0.403564453125, -0.833984375, -0.92138671875, -0.962890625, -0.7607421875, -0.27880859375, -0.7353515625, -0.19580078125, 0.385986328125, -0.85400390625, 0.207275390625, -0.30224609375, -0.595703125, 0.1351318359375, -0.5810546875, 0.69677734375, -0.050201416015625, 0.81005859375, -0.6787109375, 0.5908203125, 0.468017578125, 1.255859375, -0.4697265625, -0.202392578125, -0.1947021484375, -0.6416015625, 0.12115478515625, -0.10675048828125, 0.40625, -0.2418212890625, -0.71142578125, -0.9619140625, -0.52783203125, 0.352783203125, -0.459228515625, 0.5166015625, -0.247802734375, 0.6826171875, 0.63134765625, -0.517578125, 0.6376953125, 1.1015625, -0.72216796875, 0.5380859375, -0.00870513916015625, -0.07861328125, -0.56005859375, 1.4990234375, 0.2384033203125, 0.351318359375, -0.79736328125, -0.299072265625, -0.52783203125, -0.0007419586181640625, 0.252685546875, -0.4697265625, -0.212890625, 0.52880859375, 0.2230224609375, -1.0791015625, 0.64111328125, -0.81982421875, -0.56982421875, -0.399169921875, -0.390380859375, 0.884765625, 1.0625, 0.1435546875, -0.0938720703125, -0.50830078125, -0.0396728515625, 0.54931640625, 0.332763671875, -0.49755859375, 0.2054443359375, 0.4267578125, -0.0657958984375, 0.168701171875, 0.53515625, -0.0267333984375, -0.252197265625, -0.005588531494140625, 0.10308837890625, 0.58740234375, 0.12042236328125, 0.27294921875, 0.26611328125, 0.4052734375, -0.7890625, -0.10601806640625, -0.325439453125, 0.623046875, 0.3056640625, 0.62890625, 0.187744140625, -0.60986328125, -0.344970703125, -1.318359375, 0.494384765625, 0.23583984375, 0.8115234375, -0.72216796875, 0.9814453125, 0.08831787109375, -0.412109375, 0.46533203125, -0.9072265625, -0.32666015625, 1.1044921875, -0.369384765625, 0.98681640625, -0.75830078125, 0.66650390625, -0.2470703125, 0.01155853271484375, 0.259033203125, 0.5537109375, 0.21533203125, -0.40771484375, -0.61474609375, -0.56396484375, -0.248291015625, -0.03814697265625, -0.71728515625, 0.41552734375, -0.375244140625, -0.357177734375, -0.55322265625, 0.33154296875, 0.403076171875, 0.56787109375, -0.022308349609375, 0.403076171875, -0.091064453125, 0.57373046875, 0.4306640625, -0.33837890625, 0.23779296875, -0.447021484375, 0.5703125, -0.09686279296875, -0.436767578125, -0.7578125, -0.0047454833984375, -0.218505859375, -0.0139923095703125, 0.1986083984375, -0.39697265625, -1.1572265625, 0.5693359375, -0.00412750244140625, 0.493408203125, -0.39453125, -0.37255859375, -0.295166015625, 0.587890625, 0.1710205078125, -1.0185546875, 0.52490234375, -0.78857421875, 0.80419921875, 0.3603515625, 0.041473388671875, -0.0927734375, -0.488525390625, -0.876953125, -0.52001953125, -0.0234832763671875, 0.7734375, 0.1282958984375, 0.51123046875, -1.1494140625, 0.57568359375, 0.09136962890625, -0.000965118408203125, 0.2376708984375, -0.398193359375, 0.035736083984375, 0.1572265625, 0.62353515625, -0.53662109375, -0.4736328125, 0.15478515625, -1.2529296875, 0.61865234375, -0.310546875, 0.165771484375, -0.201904296875, -0.06890869140625, -0.2197265625, 0.253173828125, -0.5009765625, 0.3701171875, -0.138671875, 0.376220703125, -0.86279296875, -0.693359375, 0.421875, -0.442138671875, -0.2177734375, 0.93603515625, -0.11370849609375, -0.43017578125, 0.5947265625, 0.7041015625, -0.44775390625, 0.159423828125, -0.269775390625, 0.568359375, -0.252197265625, -0.5009765625, -0.2783203125, -0.3310546875, 0.814453125, 0.17041015625, -0.92236328125, -0.2001953125, -1.412109375, -0.0926513671875, -0.322021484375, 0.046844482421875, 0.3798828125, -0.00308990478515625, 0.14501953125, -0.12548828125, -0.2509765625, -0.1422119140625, -0.390380859375, -0.8896484375, 0.002685546875, 0.2176513671875, 0.6318359375, 0.5712890625, -0.163330078125, -0.297119140625, -0.2373046875, 0.26904296875, -0.07415771484375, -0.4013671875, -0.323974609375, -0.09918212890625, -0.12176513671875, -0.364013671875, 0.51025390625, 0.10650634765625, 0.556640625, 1.046875, 0.1480712890625, 0.48046875, 0.295166015625, -0.5498046875, 1.0302734375, 0.09466552734375, -1.1787109375, -1.0654296875, 0.2041015625, -0.11248779296875, 0.61767578125, 0.332763671875, -0.75390625, -0.58984375, -1.01953125, 0.039886474609375, -0.56689453125, -0.114013671875, -1.2724609375, -0.4287109375, -0.35986328125, 0.3642578125, -0.41943359375, -0.75048828125, 0.379638671875, -0.97314453125, 0.292236328125, -0.76318359375, -0.006542205810546875, -0.92041015625, -0.65380859375, -0.0606689453125, 1.10546875, 0.53125, 0.56298828125, 0.08477783203125, -0.2822265625, 0.1356201171875, 0.001636505126953125, -0.650390625, -0.1322021484375, -0.2418212890625, 0.45751953125, -0.0240631103515625, -0.4208984375, -0.443603515625, 0.7705078125, -0.7685546875, -0.141845703125, -0.1339111328125, -0.462890625, -0.1590576171875, -0.349365234375, 1.0595703125, -0.5029296875, 0.12335205078125, -0.615234375, 0.55224609375, 0.830078125, -0.310791015625, -0.4345703125, -0.87939453125, -0.505859375, -1.0576171875, 0.7998046875, -0.60205078125, 0.2178955078125, -0.8046875, -0.147216796875, 1.5087890625, -0.5068359375, 0.56396484375, 1.087890625, 0.08441162109375, 0.0010175704956054688, -0.79052734375, 0.73486328125, 0.61376953125, -0.29931640625, -0.204345703125, 0.1629638671875, -0.7001953125, 0.1407470703125, 0.059173583984375, -0.98583984375, -0.71630859375, 0.465087890625, 1.419921875, -0.2373046875, 0.68798828125, 0.01444244384765625, -1.0029296875, -0.91064453125, 0.7783203125, 0.1829833984375, 0.60595703125, 1.138671875, 0.0227203369140625, -0.22216796875, 0.2841796875, 0.328857421875, -0.334228515625, -0.467041015625, 0.97900390625, -0.5654296875, -0.51318359375, 0.78955078125, 0.82373046875, -1.08203125, -0.810546875, -0.323974609375, -0.1842041015625, -0.258544921875, -0.5595703125, 0.1961669921875, 0.63330078125, -0.5869140625, -0.12432861328125, 0.361083984375, -0.1597900390625, 0.31396484375, -0.06787109375, 0.232666015625, -0.57666015625, 0.69677734375, 0.3310546875, -0.32763671875, -0.301025390625, -1.05078125, -0.33544921875, -0.174560546875, -0.1517333984375, 0.6640625, -0.38916015625, 0.024139404296875, 0.17529296875, -0.07745361328125, 0.43408203125, -0.3837890625, -0.7451171875, 0.378662109375, -0.80615234375, -0.498046875, -0.260986328125, 0.5439453125, -0.2103271484375, 0.318359375, -0.58740234375, 0.0060882568359375, 0.11083984375, 0.1873779296875, -0.35986328125, -0.845703125, -0.222900390625, -0.95654296875, -0.560546875, -0.66064453125, -0.8271484375, 0.03753662109375, 0.0479736328125, -0.137939453125, -0.481689453125, 0.080322265625, 0.362548828125, -0.5634765625, 0.85888671875, -0.564453125, 0.37841796875, -0.7314453125, -0.3818359375, -0.337890625, 0.11700439453125, -0.52099609375, -0.0262603759765625, -0.83447265625, 0.208984375, -0.194091796875, 0.42626953125, -0.1160888671875, 0.327392578125, -0.287841796875, -0.625, 0.2042236328125, 0.260009765625, -0.303955078125, 0.7880859375, 0.6025390625, 0.069091796875, 0.47998046875, -0.2425537109375, -0.64697265625, -0.60009765625, 0.572265625, 0.54345703125, -0.29638671875, 0.03765869140625, -0.256103515625, 0.25146484375, -0.8916015625, 0.313232421875, -0.2210693359375, 0.0284881591796875, 0.1397705078125, -0.24462890625, 0.2132568359375, 1.3984375, -0.44287109375, 0.626953125, 0.058258056640625, 0.2919921875, 0.1947021484375, 0.0501708984375, -0.12353515625, 0.640625, 0.0931396484375, -0.351806640625, -0.332275390625, 0.39208984375, 0.236083984375, 0.11297607421875, 0.004039764404296875, -0.8134765625, -0.64306640625, -0.297119140625, -0.062347412109375, 0.1483154296875, 0.50146484375, -0.470458984375, 0.134521484375, -0.363037109375, -0.440185546875, -0.1773681640625, -0.998046875, -0.8544921875, 0.2401123046875, 0.10150146484375, -0.7412109375, -0.3798828125, -0.465576171875, -0.34228515625, 0.051727294921875, 0.417724609375, -0.50927734375, 0.54248046875, -0.339599609375, 0.497802734375, -0.1829833984375, -0.06927490234375, 0.11163330078125, 0.415771484375, -0.326171875, -0.46875, 0.23291015625, 1.0517578125, 0.09576416015625, -0.18701171875, -0.5673828125, 0.2294921875, -0.0231170654296875, 0.2088623046875, -0.55517578125, 0.1968994140625, -0.043487548828125, 0.416259765625, -0.93359375, 0.1693115234375, -0.1708984375, 0.2822265625, 0.059234619140625, -0.55126953125, -0.45849609375, 1.05859375, 0.58642578125, -0.38232421875, 0.5205078125, -0.1676025390625, 0.300537109375, -0.39990234375, -0.1044921875, -0.157958984375, 0.92431640625, 0.43701171875, 0.66455078125, -0.23876953125, 0.2335205078125, 0.55126953125, -0.10040283203125, -0.1424560546875, -0.1361083984375, -0.2408447265625, 0.11614990234375, 0.36083984375, -0.16064453125, -0.11865234375, -0.036224365234375, -0.96484375, 0.611328125, -0.5078125, 0.27880859375, -0.151123046875, -0.599609375, 0.79052734375, -0.286376953125, -0.16259765625, 0.336181640625, -0.48681640625, 0.281005859375, 0.6162109375, -0.01380157470703125, -0.054351806640625, 0.9423828125, 0.73779296875, 0.42578125, 0.56103515625, 0.375244140625, 0.60595703125, -0.546875, 0.048004150390625, 0.325927734375, -0.349609375, -0.56298828125, -0.322509765625, -0.96630859375, 0.38916015625, -0.248046875, -0.317138671875, 0.6611328125, -0.489013671875, 0.429443359375, -0.2318115234375, 0.72412109375, -0.301025390625, 0.1168212890625, 0.349365234375, -0.385498046875, -0.56298828125, 0.63916015625, -0.296142578125, 0.4501953125, -0.2646484375, 1.3583984375, -0.07781982421875, 1.302734375, 0.367431640625, -0.208251953125, -0.0068511962890625, 0.25439453125, -0.2021484375, -0.5654296875, -0.34326171875, -0.426025390625, 0.131103515625, -0.71142578125, -0.4736328125, -0.444580078125, 0.83837890625, -0.05291748046875, -0.904296875, -0.03057861328125, 0.211669921875, -0.802734375, 0.4814453125, 0.1573486328125, -0.0947265625, -0.054840087890625, -0.09234619140625, -0.2371826171875, -0.330322265625, 0.340576171875, -0.7705078125, 0.18017578125, -0.85791015625, -0.4599609375, -0.6171875, -0.8115234375, -0.7431640625, -0.05126953125, -0.1265869140625, -1.09765625, 0.5146484375, 0.1510009765625, 0.385986328125, 0.341064453125, -0.040252685546875, 0.1923828125, 0.9072265625, 1.015625, 0.050750732421875, 0.63720703125, 0.121826171875, -0.96484375, 0.32421875, -0.642578125, 0.477783203125, 0.1478271484375, 0.324462890625, -0.58544921875, 0.333740234375, -1.01953125, -1.515625, 0.09381103515625, 0.61669921875, 0.6171875, -0.35107421875, -0.9814453125, 0.162109375, -0.82861328125, -0.11187744140625, -0.48095703125, 0.9072265625, -0.268798828125, 0.29052734375, -0.288818359375, -1.16796875, 4.41015625, 0.9375, 1.0419921875, 0.42919921875, 0.162109375, 0.86962890625, 0.4140625, -0.611328125, -0.30126953125, -0.02447509765625, 0.7392578125, -0.263427734375, -0.06988525390625, 0.7744140625, -0.030609130859375, 0.435791015625, -0.4814453125, 0.55078125, -0.033935546875, -0.720703125, -0.51220703125, 0.316162109375, -0.1204833984375, 0.5087890625, 0.1298828125, 0.13134765625, 0.491943359375, -0.86669921875, -0.12890625, -0.654296875, 0.1373291015625, -0.3115234375, 0.8974609375, 0.173828125, -0.09149169921875, 0.7275390625, -0.322998046875, -0.41845703125, 0.003086090087890625, 0.328125, -0.278076171875, -0.064697265625, 0.361328125, -0.806640625, -0.275634765625, 0.1505126953125, -0.66943359375, 0.2744140625, -0.1605224609375, -0.76123046875, 0.73583984375, 0.284912109375, 0.57080078125, -0.92578125, -0.59423828125, 0.048736572265625, 0.30029296875, -0.28076171875, -0.41064453125, 0.49951171875, 0.447265625, 0.5654296875, 0.1357421875, 0.394775390625, -0.826171875, 1.091796875, 0.015899658203125, 0.495361328125, -0.80029296875, 0.160888671875, -0.042755126953125, -0.412841796875, -0.5634765625, -0.43896484375, 0.5625, 0.062744140625, 0.03509521484375, 0.494384765625, 0.366943359375, -0.76953125, 0.05535888671875, -0.31005859375, -0.2587890625, -0.2435302734375, 0.75634765625, 1.048828125, -0.319580078125, -0.2509765625, -0.2578125, 0.492919921875, 0.43701171875, 0.388671875, 0.101318359375, -0.6435546875, -0.1849365234375 ]
6
Provide tags and a correct Python 3 solution for this coding contest problem. The Little Girl loves problems on games very much. Here's one of them. Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: * The players move in turns; In one move the player can remove an arbitrary letter from string s. * If the player before his turn can reorder the letters in string s so as to get a palindrome, this player wins. A palindrome is a string that reads the same both ways (from left to right, and vice versa). For example, string "abba" is a palindrome and string "abc" isn't. Determine which player will win, provided that both sides play optimally well — the one who moves first or the one who moves second. Input The input contains a single line, containing string s (1 ≤ |s| ≤ 103). String s consists of lowercase English letters. Output In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes. Examples Input aba Output First Input abca Output Second Tags: games, greedy Correct Solution: ``` from collections import Counter def iswin(c): if c == c[::-1]: return True, None else: co = Counter(c) ae = 0 k1 = c[0] for k, v in co.items(): if v%2==0: ae += 1 k1 = k if ae == len(co) or len(co)%2==1 and ae == len(co)-1: return True, None else: return False, k1 s = input() p = True res = '' while s: # print(s) r, k = iswin(s) if not r: i = s.index(k) s = s[:i] + s[min(i+1, len(s)-1):] else: if p: res = 'First' else: res = 'Second' break p = not p print(res) ```
287
[ -0.058990478515625, 0.04998779296875, -0.04571533203125, 0.0178375244140625, -0.456298828125, -0.7587890625, 0.0537109375, -0.1953125, 0.0712890625, 0.578125, 0.54736328125, 0.0281982421875, 0.02008056640625, -0.72607421875, -0.62646484375, -0.3623046875, -0.80859375, -0.78271484375, -0.49072265625, -0.228759765625, 0.09368896484375, -0.12030029296875, -1.5419921875, 0.0079345703125, 0.221923828125, 1.0068359375, 0.6025390625, 0.09088134765625, 1.0205078125, 1.1357421875, -0.0460205078125, -0.1890869140625, 0.5087890625, -0.90625, -0.2021484375, -0.50146484375, 0.771484375, -0.6806640625, -0.25, -0.450927734375, 0.13134765625, -0.256103515625, 0.458984375, -0.85888671875, -1.162109375, -0.1461181640625, -0.4306640625, -0.480712890625, -0.06573486328125, -0.46484375, 0.13037109375, -0.44921875, 0.424560546875, -0.1165771484375, -0.2142333984375, 0.12548828125, 0.10162353515625, 0.265625, -0.64794921875, 0.6689453125, 0.431396484375, 0.0205078125, -0.123291015625, -0.6630859375, -0.2037353515625, -0.0782470703125, 0.07550048828125, -0.2105712890625, 0.014068603515625, -0.9267578125, -0.202392578125, 0.0634765625, -0.339111328125, -0.49267578125, -0.380859375, 0.284912109375, 0.1817626953125, 0.1522216796875, -0.71337890625, 1.0458984375, 0.052032470703125, 1.2939453125, 0.4833984375, -0.039520263671875, -0.28369140625, -0.361083984375, 0.2861328125, 0.1617431640625, 0.208984375, -0.1441650390625, -0.0025634765625, 0.75634765625, -0.90625, 0.2169189453125, 0.437255859375, 0.697265625, 0.00894927978515625, -0.06536865234375, 0.345947265625, 0.015228271484375, 0.5166015625, 1.0234375, -0.53369140625, 0.9521484375, -0.72119140625, 0.0799560546875, 0.422607421875, 0.031890869140625, -0.3095703125, -0.052215576171875, -0.341064453125, -0.1429443359375, 0.7353515625, 0.11114501953125, -0.219970703125, 1.1064453125, 0.07861328125, 0.1839599609375, -0.70361328125, 0.50634765625, 0.38037109375, 0.231201171875, 0.70361328125, -0.019989013671875, 0.3671875, 0.07830810546875, -0.406982421875, 1.0537109375, -0.755859375, -0.06378173828125, 0.77099609375, 0.08038330078125, 0.2486572265625, 0.06561279296875, -0.1864013671875, 0.94775390625, -0.37646484375, 0.7705078125, 0.5537109375, -0.4375, 0.73681640625, 0.021392822265625, -0.005855560302734375, 1.357421875, 0.23828125, 0.00249481201171875, 0.88720703125, 0.494140625, -0.88623046875, 0.452880859375, -0.90478515625, 0.7255859375, 0.1407470703125, 0.30224609375, -0.192626953125, 0.14013671875, -0.382568359375, 0.465087890625, 0.234619140625, 0.326171875, -0.67138671875, 0.307861328125, -0.384521484375, 1.0732421875, -0.43115234375, 0.90869140625, -0.16796875, -0.491943359375, 0.07476806640625, -0.3759765625, -0.038055419921875, -0.44970703125, 0.060089111328125, 0.79638671875, 0.260009765625, 0.9951171875, 1.1064453125, -0.281982421875, 0.35498046875, 0.280029296875, -0.3251953125, 0.3359375, 0.38916015625, 0.6826171875, 0.21240234375, 0.412109375, 0.1397705078125, -0.2333984375, -0.8427734375, -0.44140625, -0.03826904296875, 0.66015625, -0.50634765625, 0.281005859375, 0.36865234375, 0.147216796875, -0.75244140625, 0.04144287109375, -0.053497314453125, -1.1884765625, -0.053497314453125, 0.6044921875, -0.1519775390625, 0.48486328125, -0.441650390625, -0.55078125, 0.6376953125, 1.015625, -0.54345703125, -0.099853515625, 0.333984375, 0.318115234375, -0.5087890625, 0.1707763671875, -0.0467529296875, -0.038970947265625, -0.68505859375, 0.98388671875, -0.28173828125, 0.0246734619140625, 0.16943359375, 0.69140625, 0.5048828125, 0.6298828125, -0.24560546875, -0.18017578125, 0.5634765625, 0.8876953125, 0.25, 0.2197265625, 0.261474609375, 0.92041015625, 0.27587890625, 0.9580078125, 0.701171875, 0.186279296875, 0.042999267578125, 0.7724609375, 0.09698486328125, 0.033111572265625, 0.2353515625, 0.2186279296875, 0.5009765625, 0.464599609375, 0.18505859375, 0.57861328125, 0.034271240234375, 0.12115478515625, -0.439453125, 0.287353515625, -0.228271484375, 0.75146484375, 0.51513671875, 0.60205078125, -0.28515625, -0.296630859375, 0.481201171875, 0.80322265625, -1.017578125, -0.58642578125, -0.03619384765625, 0.01953125, -0.07037353515625, -0.211669921875, 0.53759765625, 0.6376953125, 0.4423828125, 0.1588134765625, -0.35400390625, -0.86962890625, -0.94287109375, -0.86962890625, -0.75634765625, -0.273193359375, -0.74853515625, -0.221923828125, 0.354248046875, -0.880859375, 0.27490234375, -0.39794921875, -0.56396484375, 0.2177734375, -0.61328125, 0.73583984375, -0.026611328125, 0.77197265625, -0.71826171875, 0.66162109375, 0.445556640625, 1.2431640625, -0.55908203125, -0.2318115234375, -0.2359619140625, -0.69921875, 0.1446533203125, -0.2178955078125, 0.42041015625, -0.216796875, -0.76171875, -0.8603515625, -0.411376953125, 0.33447265625, -0.44775390625, 0.53515625, -0.3544921875, 0.63623046875, 0.64501953125, -0.4951171875, 0.58837890625, 1.11328125, -0.78955078125, 0.50634765625, 0.01297760009765625, -0.0660400390625, -0.58837890625, 1.48046875, 0.3017578125, 0.265625, -0.74853515625, -0.337646484375, -0.5498046875, -0.07281494140625, 0.2841796875, -0.40869140625, -0.296630859375, 0.53369140625, 0.1412353515625, -1.0830078125, 0.62744140625, -0.83203125, -0.5166015625, -0.33251953125, -0.3154296875, 0.9794921875, 1.0078125, 0.207275390625, -0.0035343170166015625, -0.50341796875, -0.04010009765625, 0.685546875, 0.2685546875, -0.5244140625, 0.235595703125, 0.337158203125, -0.0249176025390625, 0.15185546875, 0.525390625, -0.1383056640625, -0.1976318359375, -0.032745361328125, 0.10699462890625, 0.62451171875, 0.09149169921875, 0.1865234375, 0.384521484375, 0.4990234375, -0.8095703125, -0.14111328125, -0.431396484375, 0.7119140625, 0.255859375, 0.77099609375, 0.3349609375, -0.52490234375, -0.4267578125, -1.2431640625, 0.488037109375, 0.252197265625, 0.8037109375, -0.66650390625, 0.9345703125, 0.10101318359375, -0.40234375, 0.39208984375, -0.85400390625, -0.37646484375, 1.078125, -0.2666015625, 0.91943359375, -0.82568359375, 0.66748046875, -0.33154296875, 0.05108642578125, 0.301513671875, 0.50244140625, 0.33056640625, -0.399169921875, -0.59814453125, -0.47216796875, -0.32275390625, -0.07232666015625, -0.71875, 0.3876953125, -0.380126953125, -0.4873046875, -0.63037109375, 0.29150390625, 0.406494140625, 0.49072265625, -0.052276611328125, 0.391357421875, -0.1348876953125, 0.68359375, 0.4384765625, -0.337158203125, 0.196533203125, -0.463623046875, 0.54931640625, -0.0865478515625, -0.3271484375, -0.70068359375, -0.01776123046875, -0.27294921875, -0.10784912109375, 0.19677734375, -0.39404296875, -1.181640625, 0.47216796875, 0.010009765625, 0.537109375, -0.423095703125, -0.392822265625, -0.33544921875, 0.62353515625, 0.141845703125, -1.0029296875, 0.521484375, -0.71630859375, 0.798828125, 0.42626953125, 0.11273193359375, -0.07672119140625, -0.417236328125, -0.85205078125, -0.64794921875, 0.04742431640625, 0.77197265625, 0.08331298828125, 0.368896484375, -1.2236328125, 0.5146484375, 0.11334228515625, 0.036376953125, 0.26806640625, -0.315673828125, 0.0830078125, 0.1923828125, 0.56982421875, -0.65185546875, -0.54052734375, 0.1995849609375, -1.234375, 0.654296875, -0.351318359375, 0.149169921875, -0.278076171875, -0.1005859375, -0.1717529296875, 0.361328125, -0.4833984375, 0.419189453125, -0.0504150390625, 0.426025390625, -0.92236328125, -0.71923828125, 0.366943359375, -0.3876953125, -0.255615234375, 0.86279296875, -0.19287109375, -0.37548828125, 0.6201171875, 0.57470703125, -0.486572265625, 0.18603515625, -0.329345703125, 0.583984375, -0.1817626953125, -0.492431640625, -0.2548828125, -0.418701171875, 0.81689453125, 0.1724853515625, -0.94482421875, -0.270263671875, -1.294921875, -0.123291015625, -0.294677734375, 0.0986328125, 0.376220703125, 0.040130615234375, 0.183349609375, -0.1654052734375, -0.30712890625, -0.1781005859375, -0.302978515625, -0.78515625, -0.014129638671875, 0.2042236328125, 0.56298828125, 0.541015625, -0.12457275390625, -0.27001953125, -0.27099609375, 0.32958984375, -0.043701171875, -0.425537109375, -0.3447265625, -0.1378173828125, -0.136474609375, -0.301025390625, 0.4638671875, 0.089599609375, 0.52001953125, 1.076171875, 0.21875, 0.4267578125, 0.28076171875, -0.5986328125, 1.0126953125, 0.074462890625, -1.1689453125, -1.072265625, 0.14990234375, -0.0433349609375, 0.60791015625, 0.31494140625, -0.7822265625, -0.5615234375, -1.0166015625, 0.0206298828125, -0.50732421875, -0.05328369140625, -1.2421875, -0.36328125, -0.369140625, 0.41259765625, -0.3564453125, -0.80126953125, 0.288330078125, -1.029296875, 0.2958984375, -0.7685546875, -0.049774169921875, -0.884765625, -0.556640625, -0.058746337890625, 1.091796875, 0.55419921875, 0.496826171875, 0.0989990234375, -0.349609375, 0.1556396484375, -0.042236328125, -0.6572265625, -0.2100830078125, -0.1556396484375, 0.368408203125, -0.09332275390625, -0.4833984375, -0.4951171875, 0.69189453125, -0.73046875, -0.036773681640625, -0.1522216796875, -0.34228515625, -0.202392578125, -0.333984375, 1.064453125, -0.45849609375, 0.12744140625, -0.60205078125, 0.55908203125, 0.8564453125, -0.398193359375, -0.43359375, -0.787109375, -0.4169921875, -1.1015625, 0.71484375, -0.6572265625, 0.1912841796875, -0.7802734375, -0.278564453125, 1.4755859375, -0.46533203125, 0.56005859375, 1.0712890625, 0.11175537109375, -0.014617919921875, -0.73828125, 0.6923828125, 0.5517578125, -0.329345703125, -0.161376953125, 0.0882568359375, -0.7373046875, 0.1014404296875, -0.003536224365234375, -0.919921875, -0.69921875, 0.5107421875, 1.396484375, -0.31201171875, 0.7705078125, 0.06878662109375, -0.95947265625, -0.837890625, 0.74755859375, 0.235107421875, 0.59423828125, 1.1513671875, 0.0513916015625, -0.2225341796875, 0.258544921875, 0.25048828125, -0.264892578125, -0.44873046875, 0.98095703125, -0.46630859375, -0.45068359375, 0.8193359375, 0.77099609375, -1.1298828125, -0.87548828125, -0.198974609375, -0.1259765625, -0.1759033203125, -0.5126953125, 0.312744140625, 0.462646484375, -0.5, -0.1126708984375, 0.332763671875, -0.164306640625, 0.30859375, -0.1407470703125, 0.28271484375, -0.55224609375, 0.703125, 0.35498046875, -0.31787109375, -0.2215576171875, -1.10546875, -0.405517578125, -0.2232666015625, -0.12066650390625, 0.63671875, -0.3076171875, 0.11151123046875, 0.2060546875, -0.06427001953125, 0.472900390625, -0.394287109375, -0.73681640625, 0.34619140625, -0.7978515625, -0.490234375, -0.376708984375, 0.52294921875, -0.1763916015625, 0.271484375, -0.5166015625, 0.0386962890625, 0.0408935546875, 0.260009765625, -0.2529296875, -0.7900390625, -0.286865234375, -1.0205078125, -0.572265625, -0.5576171875, -0.81396484375, 0.04296875, 0.1300048828125, -0.18798828125, -0.45556640625, 0.06842041015625, 0.30859375, -0.5166015625, 0.88720703125, -0.56787109375, 0.365966796875, -0.76318359375, -0.348388671875, -0.31689453125, 0.16552734375, -0.51318359375, 0.03228759765625, -0.72412109375, 0.271728515625, -0.2034912109375, 0.41943359375, -0.175537109375, 0.267822265625, -0.17041015625, -0.58984375, 0.1473388671875, 0.267333984375, -0.28759765625, 0.79296875, 0.63037109375, 0.0843505859375, 0.50732421875, -0.298828125, -0.5908203125, -0.65380859375, 0.54541015625, 0.58203125, -0.2423095703125, 0.0367431640625, -0.2177734375, 0.12274169921875, -0.9130859375, 0.290771484375, -0.251953125, 0.0667724609375, 0.173583984375, -0.196044921875, 0.19091796875, 1.2939453125, -0.365234375, 0.57275390625, 0.006206512451171875, 0.31640625, 0.1280517578125, -0.046783447265625, -0.047149658203125, 0.64990234375, 0.12030029296875, -0.32373046875, -0.21142578125, 0.52294921875, 0.27001953125, 0.03228759765625, -0.10540771484375, -0.87841796875, -0.669921875, -0.2822265625, -0.052398681640625, 0.1527099609375, 0.54052734375, -0.513671875, 0.1162109375, -0.347412109375, -0.474365234375, -0.07318115234375, -1.04296875, -0.72900390625, 0.1900634765625, 0.043121337890625, -0.69970703125, -0.378662109375, -0.55908203125, -0.320556640625, 0.039031982421875, 0.420654296875, -0.52197265625, 0.5166015625, -0.2919921875, 0.5146484375, -0.1458740234375, -0.08367919921875, 0.09857177734375, 0.356201171875, -0.43017578125, -0.48779296875, 0.1900634765625, 1.0439453125, 0.187744140625, -0.135009765625, -0.6298828125, 0.221923828125, 0.07403564453125, 0.293701171875, -0.58740234375, 0.1414794921875, -0.1396484375, 0.41015625, -0.98583984375, 0.1624755859375, -0.1502685546875, 0.264892578125, 0.1033935546875, -0.4580078125, -0.50341796875, 0.92724609375, 0.54248046875, -0.39990234375, 0.52783203125, -0.11865234375, 0.43505859375, -0.31494140625, -0.09307861328125, -0.1552734375, 0.9013671875, 0.52392578125, 0.65576171875, -0.1480712890625, 0.2139892578125, 0.572265625, -0.1480712890625, -0.2376708984375, -0.10479736328125, -0.187744140625, 0.16259765625, 0.28759765625, -0.1734619140625, -0.060760498046875, -0.0538330078125, -0.93115234375, 0.54052734375, -0.5029296875, 0.2076416015625, -0.1932373046875, -0.63818359375, 0.703125, -0.1383056640625, -0.0736083984375, 0.31005859375, -0.52587890625, 0.30419921875, 0.64013671875, -0.01311492919921875, -0.10760498046875, 0.94140625, 0.6943359375, 0.3984375, 0.56396484375, 0.347412109375, 0.5400390625, -0.56591796875, 0.042938232421875, 0.32763671875, -0.32861328125, -0.529296875, -0.21923828125, -0.94189453125, 0.394775390625, -0.28271484375, -0.32666015625, 0.6083984375, -0.5400390625, 0.484375, -0.259765625, 0.740234375, -0.314208984375, 0.091552734375, 0.33984375, -0.348388671875, -0.638671875, 0.53857421875, -0.28173828125, 0.541015625, -0.144775390625, 1.400390625, -0.08795166015625, 1.2216796875, 0.308349609375, -0.2315673828125, -0.0582275390625, 0.1929931640625, -0.07757568359375, -0.5380859375, -0.259765625, -0.46728515625, 0.1549072265625, -0.86474609375, -0.55712890625, -0.49560546875, 0.78515625, -0.09759521484375, -0.927734375, -0.0504150390625, 0.2061767578125, -0.85888671875, 0.49072265625, 0.17578125, -0.11590576171875, -0.0662841796875, -0.07025146484375, -0.226806640625, -0.461181640625, 0.283935546875, -0.7685546875, 0.1854248046875, -0.7900390625, -0.43310546875, -0.6005859375, -0.77294921875, -0.724609375, -0.09368896484375, -0.1334228515625, -1.09375, 0.490966796875, 0.2646484375, 0.42919921875, 0.322509765625, -0.140380859375, 0.2164306640625, 0.9052734375, 0.94189453125, 0.04193115234375, 0.64111328125, 0.1990966796875, -0.95361328125, 0.294189453125, -0.6787109375, 0.3798828125, 0.11798095703125, 0.2261962890625, -0.46875, 0.319580078125, -1.0791015625, -1.453125, 0.024322509765625, 0.57080078125, 0.52099609375, -0.42236328125, -1.052734375, 0.13232421875, -0.78857421875, -0.09747314453125, -0.400634765625, 0.86376953125, -0.2432861328125, 0.1546630859375, -0.313720703125, -1.20703125, 4.453125, 0.849609375, 1.0185546875, 0.476318359375, 0.18505859375, 0.923828125, 0.389892578125, -0.53759765625, -0.3515625, 0.038543701171875, 0.72265625, -0.31494140625, -0.0148773193359375, 0.765625, -0.10162353515625, 0.3681640625, -0.462646484375, 0.478271484375, -0.05120849609375, -0.84912109375, -0.53125, 0.308837890625, -0.01898193359375, 0.494873046875, 0.184326171875, 0.05938720703125, 0.428955078125, -0.87646484375, -0.133544921875, -0.6083984375, 0.17333984375, -0.1802978515625, 0.95361328125, 0.16650390625, -0.08538818359375, 0.72900390625, -0.2626953125, -0.399658203125, -0.0531005859375, 0.362548828125, -0.25390625, -0.0325927734375, 0.358154296875, -0.76708984375, -0.263671875, 0.25927734375, -0.6865234375, 0.356689453125, -0.11376953125, -0.6904296875, 0.71142578125, 0.1939697265625, 0.65576171875, -0.84912109375, -0.56201171875, 0.084228515625, 0.1956787109375, -0.23388671875, -0.4130859375, 0.5380859375, 0.32421875, 0.50146484375, 0.059295654296875, 0.407958984375, -0.88330078125, 1.060546875, 0.0266265869140625, 0.4560546875, -0.765625, 0.072998046875, -0.12359619140625, -0.43603515625, -0.52978515625, -0.405517578125, 0.51220703125, 0.001201629638671875, 0.013885498046875, 0.541015625, 0.35107421875, -0.697265625, 0.042205810546875, -0.33544921875, -0.36767578125, -0.18359375, 0.92431640625, 1.033203125, -0.28515625, -0.260009765625, -0.4541015625, 0.615234375, 0.42919921875, 0.3193359375, 0.135498046875, -0.703125, -0.201171875 ]
6
Provide tags and a correct Python 3 solution for this coding contest problem. The Little Girl loves problems on games very much. Here's one of them. Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: * The players move in turns; In one move the player can remove an arbitrary letter from string s. * If the player before his turn can reorder the letters in string s so as to get a palindrome, this player wins. A palindrome is a string that reads the same both ways (from left to right, and vice versa). For example, string "abba" is a palindrome and string "abc" isn't. Determine which player will win, provided that both sides play optimally well — the one who moves first or the one who moves second. Input The input contains a single line, containing string s (1 ≤ |s| ≤ 103). String s consists of lowercase English letters. Output In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes. Examples Input aba Output First Input abca Output Second Tags: games, greedy Correct Solution: ``` if __name__ == '__main__': s = input() c = [s.count(x) for x in set(s)] total = 0 for x in c: if x % 2 != 0: total += 1 if total % 2 == 0 and total != 0: print("Second") else: print("First") ```
288
[ -0.0165557861328125, 0.034942626953125, -0.0272216796875, 0.042144775390625, -0.454833984375, -0.7890625, 0.053314208984375, -0.215576171875, 0.113525390625, 0.56787109375, 0.529296875, 0.049713134765625, 0.07135009765625, -0.63720703125, -0.65185546875, -0.384765625, -0.78076171875, -0.7861328125, -0.56396484375, -0.1798095703125, 0.19580078125, -0.0361328125, -1.552734375, 0.0147857666015625, 0.1922607421875, 1.04296875, 0.61962890625, 0.06732177734375, 0.95263671875, 1.109375, -0.039886474609375, -0.1708984375, 0.5419921875, -1.013671875, -0.1024169921875, -0.49462890625, 0.77587890625, -0.82177734375, -0.3515625, -0.449462890625, 0.2130126953125, -0.321533203125, 0.42724609375, -0.85693359375, -1.033203125, -0.2117919921875, -0.5400390625, -0.47265625, -0.07965087890625, -0.50146484375, 0.177978515625, -0.38525390625, 0.381591796875, -0.04010009765625, -0.2095947265625, 0.11676025390625, 0.1427001953125, 0.1837158203125, -0.69775390625, 0.6787109375, 0.481689453125, 0.01494598388671875, -0.1551513671875, -0.7158203125, -0.213623046875, -0.0355224609375, 0.0210723876953125, -0.2188720703125, 0.033843994140625, -0.90673828125, -0.2242431640625, 0.1209716796875, -0.379638671875, -0.4765625, -0.34228515625, 0.255126953125, 0.207763671875, 0.11114501953125, -0.7158203125, 1.0830078125, 0.032562255859375, 1.3193359375, 0.410888671875, -0.0229644775390625, -0.255126953125, -0.34619140625, 0.25, 0.07989501953125, 0.2059326171875, -0.141845703125, -0.0283050537109375, 0.7568359375, -0.87255859375, 0.293701171875, 0.393310546875, 0.7900390625, -0.1307373046875, -0.047088623046875, 0.428466796875, -0.0310821533203125, 0.55126953125, 0.9921875, -0.576171875, 1.009765625, -0.71533203125, -0.01393890380859375, 0.381103515625, 0.0033702850341796875, -0.237548828125, -0.057830810546875, -0.38134765625, -0.11328125, 0.70947265625, 0.10638427734375, -0.258544921875, 1.1123046875, 0.1309814453125, 0.245849609375, -0.859375, 0.51904296875, 0.39794921875, 0.31201171875, 0.77294921875, -0.1671142578125, 0.34765625, 0.115966796875, -0.353515625, 1.078125, -0.724609375, 0.007129669189453125, 0.71875, 0.10986328125, 0.2454833984375, 0.1380615234375, -0.226318359375, 1.009765625, -0.394775390625, 0.724609375, 0.57666015625, -0.45849609375, 0.8193359375, 0.0181121826171875, -0.08355712890625, 1.41015625, 0.18017578125, -0.002559661865234375, 0.83984375, 0.58837890625, -0.87841796875, 0.431396484375, -0.96142578125, 0.70751953125, 0.1221923828125, 0.376953125, -0.11676025390625, 0.199462890625, -0.333984375, 0.445556640625, 0.16162109375, 0.33984375, -0.79833984375, 0.1705322265625, -0.306640625, 1.1494140625, -0.4775390625, 0.93408203125, -0.1650390625, -0.5146484375, 0.050079345703125, -0.4130859375, 0.0279541015625, -0.468994140625, 0.0382080078125, 0.76953125, 0.2452392578125, 1.0224609375, 1.1396484375, -0.2293701171875, 0.289794921875, 0.23291015625, -0.3466796875, 0.33740234375, 0.398681640625, 0.6943359375, 0.211181640625, 0.380615234375, 0.16455078125, -0.19677734375, -0.79248046875, -0.515625, -0.07403564453125, 0.572265625, -0.51904296875, 0.350830078125, 0.35205078125, 0.13720703125, -0.767578125, -0.10003662109375, -0.193359375, -1.1298828125, 0.007747650146484375, 0.537109375, -0.1688232421875, 0.5986328125, -0.458740234375, -0.56005859375, 0.5595703125, 1.0029296875, -0.533203125, -0.27685546875, 0.36376953125, 0.3232421875, -0.51318359375, 0.1973876953125, -0.00662994384765625, -0.02923583984375, -0.6640625, 0.90869140625, -0.318115234375, -0.0222625732421875, 0.1729736328125, 0.57861328125, 0.52001953125, 0.658203125, -0.274658203125, -0.11273193359375, 0.611328125, 0.85107421875, 0.1656494140625, 0.30908203125, 0.291259765625, 0.87939453125, 0.342041015625, 0.904296875, 0.6728515625, 0.1343994140625, -0.001216888427734375, 0.7705078125, 0.131103515625, -0.006740570068359375, 0.2587890625, 0.271484375, 0.430908203125, 0.427978515625, 0.20458984375, 0.64111328125, 0.0745849609375, 0.049072265625, -0.42822265625, 0.2135009765625, -0.1982421875, 0.7265625, 0.54541015625, 0.5439453125, -0.2451171875, -0.304443359375, 0.488037109375, 0.80419921875, -0.9384765625, -0.5556640625, -0.01285552978515625, -0.0005936622619628906, -0.042633056640625, -0.2197265625, 0.5439453125, 0.599609375, 0.36669921875, 0.117919921875, -0.41650390625, -0.79052734375, -0.94677734375, -0.95703125, -0.8154296875, -0.26806640625, -0.74169921875, -0.2236328125, 0.40087890625, -0.8955078125, 0.265625, -0.28466796875, -0.564453125, 0.1798095703125, -0.59375, 0.7490234375, -0.06787109375, 0.7900390625, -0.67724609375, 0.6064453125, 0.427001953125, 1.2353515625, -0.51904296875, -0.20556640625, -0.20263671875, -0.64453125, 0.11651611328125, -0.132080078125, 0.384521484375, -0.251708984375, -0.76416015625, -0.919921875, -0.467529296875, 0.376220703125, -0.4541015625, 0.57177734375, -0.275390625, 0.65185546875, 0.66845703125, -0.52783203125, 0.6103515625, 1.0556640625, -0.712890625, 0.5400390625, 0.0292510986328125, -0.0777587890625, -0.57666015625, 1.5185546875, 0.283935546875, 0.37255859375, -0.8076171875, -0.3125, -0.52392578125, -0.026947021484375, 0.257080078125, -0.40185546875, -0.23583984375, 0.483154296875, 0.1981201171875, -1.04296875, 0.61328125, -0.7890625, -0.53271484375, -0.38720703125, -0.40380859375, 0.8837890625, 1.0498046875, 0.17333984375, -0.049652099609375, -0.470947265625, -0.03131103515625, 0.58056640625, 0.3544921875, -0.52001953125, 0.26416015625, 0.378173828125, -0.05828857421875, 0.1446533203125, 0.59521484375, -0.0880126953125, -0.2568359375, -0.031890869140625, 0.11962890625, 0.5234375, 0.10723876953125, 0.23583984375, 0.299560546875, 0.443359375, -0.7744140625, -0.1395263671875, -0.352783203125, 0.6181640625, 0.31298828125, 0.7158203125, 0.2291259765625, -0.60009765625, -0.3740234375, -1.2587890625, 0.479736328125, 0.2568359375, 0.84423828125, -0.74462890625, 0.9111328125, 0.09344482421875, -0.43408203125, 0.448486328125, -0.8916015625, -0.3505859375, 1.10546875, -0.312744140625, 0.95458984375, -0.71728515625, 0.65087890625, -0.22265625, 0.034942626953125, 0.309814453125, 0.51904296875, 0.24853515625, -0.444580078125, -0.59765625, -0.53173828125, -0.264892578125, -0.0184326171875, -0.72607421875, 0.4208984375, -0.316650390625, -0.33349609375, -0.58447265625, 0.318359375, 0.40966796875, 0.53466796875, -0.006031036376953125, 0.459716796875, -0.1512451171875, 0.60302734375, 0.392822265625, -0.35791015625, 0.2366943359375, -0.41650390625, 0.5625, -0.08770751953125, -0.431396484375, -0.7529296875, 0.021392822265625, -0.1865234375, -0.032012939453125, 0.208740234375, -0.4638671875, -1.171875, 0.5537109375, -0.06591796875, 0.50146484375, -0.39892578125, -0.391845703125, -0.3037109375, 0.587890625, 0.2421875, -0.94677734375, 0.537109375, -0.81689453125, 0.86962890625, 0.377197265625, 0.034698486328125, -0.06536865234375, -0.45458984375, -0.84326171875, -0.54345703125, 0.0025920867919921875, 0.77197265625, 0.11859130859375, 0.454345703125, -1.109375, 0.56005859375, 0.09521484375, -0.0006136894226074219, 0.287841796875, -0.375244140625, 0.068115234375, 0.141357421875, 0.61376953125, -0.52587890625, -0.455322265625, 0.1971435546875, -1.255859375, 0.626953125, -0.26416015625, 0.1309814453125, -0.28173828125, -0.0687255859375, -0.1651611328125, 0.250244140625, -0.447021484375, 0.355712890625, -0.10382080078125, 0.369140625, -0.857421875, -0.71826171875, 0.384765625, -0.431396484375, -0.222900390625, 0.87890625, -0.1375732421875, -0.38330078125, 0.61279296875, 0.72265625, -0.424560546875, 0.16064453125, -0.211181640625, 0.5849609375, -0.2333984375, -0.496826171875, -0.2841796875, -0.349609375, 0.80224609375, 0.1673583984375, -0.88720703125, -0.2347412109375, -1.400390625, -0.05596923828125, -0.308349609375, 0.0849609375, 0.387939453125, 0.0268707275390625, 0.1671142578125, -0.1314697265625, -0.32568359375, -0.134765625, -0.364990234375, -0.830078125, -0.03070068359375, 0.19189453125, 0.62109375, 0.625, -0.167724609375, -0.285400390625, -0.21875, 0.25341796875, -0.07476806640625, -0.388427734375, -0.343017578125, -0.12176513671875, -0.143310546875, -0.37255859375, 0.477783203125, 0.067626953125, 0.5390625, 1.037109375, 0.12188720703125, 0.4560546875, 0.24072265625, -0.57666015625, 1.0791015625, 0.1051025390625, -1.1357421875, -1.0751953125, 0.1766357421875, -0.051055908203125, 0.5751953125, 0.386962890625, -0.7529296875, -0.572265625, -1.009765625, 0.06298828125, -0.5517578125, -0.07318115234375, -1.2587890625, -0.404541015625, -0.393798828125, 0.349365234375, -0.394287109375, -0.7197265625, 0.355224609375, -0.95947265625, 0.276123046875, -0.7841796875, 0.0009508132934570312, -0.95263671875, -0.62109375, -0.0032329559326171875, 1.087890625, 0.56201171875, 0.5556640625, 0.043243408203125, -0.32958984375, 0.12744140625, -0.05792236328125, -0.60546875, -0.1981201171875, -0.243896484375, 0.478271484375, -0.02825927734375, -0.427490234375, -0.437255859375, 0.712890625, -0.7138671875, -0.056365966796875, -0.107177734375, -0.42724609375, -0.16357421875, -0.341552734375, 1.091796875, -0.48681640625, 0.153564453125, -0.59619140625, 0.544921875, 0.83056640625, -0.360595703125, -0.462646484375, -0.82861328125, -0.483154296875, -1.0361328125, 0.78271484375, -0.60595703125, 0.197998046875, -0.83056640625, -0.1549072265625, 1.4736328125, -0.4775390625, 0.56298828125, 1.0927734375, 0.053192138671875, 0.032012939453125, -0.7861328125, 0.763671875, 0.57177734375, -0.285400390625, -0.2509765625, 0.1483154296875, -0.74365234375, 0.122314453125, 0.0377197265625, -0.9150390625, -0.6767578125, 0.451904296875, 1.39453125, -0.2783203125, 0.68896484375, 0.034576416015625, -0.978515625, -0.86376953125, 0.796875, 0.2025146484375, 0.61669921875, 1.15625, 0.056884765625, -0.203125, 0.21484375, 0.298583984375, -0.296142578125, -0.47900390625, 0.93896484375, -0.53759765625, -0.4736328125, 0.79248046875, 0.841796875, -1.091796875, -0.81298828125, -0.292724609375, -0.1624755859375, -0.2288818359375, -0.50341796875, 0.19482421875, 0.6064453125, -0.60107421875, -0.129638671875, 0.3369140625, -0.205078125, 0.33447265625, -0.095458984375, 0.281982421875, -0.564453125, 0.73291015625, 0.3212890625, -0.273193359375, -0.2479248046875, -1.068359375, -0.372802734375, -0.2044677734375, -0.08428955078125, 0.67626953125, -0.346923828125, 0.0235748291015625, 0.178466796875, -0.07806396484375, 0.420166015625, -0.39892578125, -0.7236328125, 0.33447265625, -0.80322265625, -0.47021484375, -0.32421875, 0.56787109375, -0.1641845703125, 0.25732421875, -0.60546875, 0.0275115966796875, 0.07928466796875, 0.2320556640625, -0.317138671875, -0.8330078125, -0.231201171875, -0.97802734375, -0.57421875, -0.61376953125, -0.8134765625, 0.00243377685546875, 0.03570556640625, -0.132568359375, -0.454345703125, 0.07720947265625, 0.33935546875, -0.55712890625, 0.84912109375, -0.54833984375, 0.378662109375, -0.7548828125, -0.38330078125, -0.3232421875, 0.12493896484375, -0.5224609375, -0.03228759765625, -0.8115234375, 0.2266845703125, -0.23486328125, 0.408447265625, -0.1158447265625, 0.303466796875, -0.255126953125, -0.68115234375, 0.1605224609375, 0.25341796875, -0.35498046875, 0.78466796875, 0.61279296875, 0.057830810546875, 0.5224609375, -0.2467041015625, -0.59814453125, -0.61474609375, 0.58154296875, 0.51708984375, -0.278076171875, 0.0318603515625, -0.2156982421875, 0.262939453125, -0.865234375, 0.344482421875, -0.2032470703125, 0.07110595703125, 0.110595703125, -0.23193359375, 0.212158203125, 1.36328125, -0.35009765625, 0.5888671875, 0.03448486328125, 0.30615234375, 0.1961669921875, -0.039306640625, -0.116943359375, 0.62548828125, 0.09063720703125, -0.3447265625, -0.2724609375, 0.447509765625, 0.25390625, 0.108642578125, 0.007762908935546875, -0.861328125, -0.62158203125, -0.2939453125, -0.043914794921875, 0.17529296875, 0.48046875, -0.5009765625, 0.11700439453125, -0.36865234375, -0.425537109375, -0.10784912109375, -1.017578125, -0.7822265625, 0.1988525390625, 0.07623291015625, -0.7177734375, -0.344482421875, -0.4990234375, -0.33544921875, 0.04815673828125, 0.401611328125, -0.51220703125, 0.57470703125, -0.331787109375, 0.5283203125, -0.205078125, -0.066650390625, 0.0955810546875, 0.419921875, -0.36767578125, -0.485595703125, 0.255126953125, 1.013671875, 0.11334228515625, -0.157470703125, -0.625, 0.2298583984375, 0.0006589889526367188, 0.2197265625, -0.58154296875, 0.2315673828125, -0.04949951171875, 0.435302734375, -0.9658203125, 0.173095703125, -0.215087890625, 0.259765625, 0.100341796875, -0.57080078125, -0.43896484375, 1.033203125, 0.6005859375, -0.404052734375, 0.47314453125, -0.2119140625, 0.33154296875, -0.426513671875, -0.063232421875, -0.144775390625, 0.904296875, 0.477783203125, 0.6904296875, -0.196533203125, 0.2335205078125, 0.58056640625, -0.09832763671875, -0.167724609375, -0.09185791015625, -0.223876953125, 0.12451171875, 0.3828125, -0.1962890625, -0.08184814453125, -0.055450439453125, -0.96337890625, 0.54736328125, -0.487548828125, 0.282470703125, -0.1514892578125, -0.65966796875, 0.8037109375, -0.2230224609375, -0.1337890625, 0.385009765625, -0.51953125, 0.2705078125, 0.61376953125, -0.042236328125, -0.0740966796875, 0.91162109375, 0.72509765625, 0.418212890625, 0.59814453125, 0.321533203125, 0.54736328125, -0.53125, 0.07373046875, 0.26806640625, -0.3798828125, -0.5400390625, -0.3056640625, -0.939453125, 0.415771484375, -0.1990966796875, -0.3203125, 0.67236328125, -0.49462890625, 0.438232421875, -0.2022705078125, 0.7353515625, -0.244140625, 0.127197265625, 0.378173828125, -0.388671875, -0.5810546875, 0.63525390625, -0.245361328125, 0.423095703125, -0.29296875, 1.3603515625, -0.07965087890625, 1.26953125, 0.38134765625, -0.2274169921875, -0.06524658203125, 0.273681640625, -0.2005615234375, -0.5859375, -0.298095703125, -0.43603515625, 0.135498046875, -0.75341796875, -0.484130859375, -0.4794921875, 0.796875, -0.07891845703125, -0.92919921875, -0.042236328125, 0.2021484375, -0.86376953125, 0.455322265625, 0.153564453125, -0.0809326171875, -0.0498046875, -0.06402587890625, -0.257568359375, -0.385986328125, 0.3427734375, -0.81884765625, 0.14404296875, -0.87841796875, -0.4326171875, -0.5947265625, -0.806640625, -0.744140625, -0.08660888671875, -0.12115478515625, -1.0888671875, 0.5439453125, 0.1898193359375, 0.399169921875, 0.362060546875, -0.032379150390625, 0.1552734375, 0.8955078125, 0.97509765625, 0.0284423828125, 0.59521484375, 0.10284423828125, -0.97119140625, 0.280029296875, -0.7060546875, 0.431396484375, 0.1968994140625, 0.322998046875, -0.56005859375, 0.345947265625, -1.0068359375, -1.4599609375, 0.1156005859375, 0.6044921875, 0.57177734375, -0.344970703125, -0.9892578125, 0.1910400390625, -0.87158203125, -0.163330078125, -0.46630859375, 0.87744140625, -0.269775390625, 0.2318115234375, -0.365478515625, -1.19140625, 4.4375, 0.8896484375, 1.0517578125, 0.449951171875, 0.164794921875, 0.83984375, 0.399658203125, -0.546875, -0.315673828125, -0.0194854736328125, 0.7265625, -0.2486572265625, -0.060882568359375, 0.78466796875, -0.052947998046875, 0.404541015625, -0.486572265625, 0.52880859375, -0.032806396484375, -0.74853515625, -0.47265625, 0.332275390625, -0.07952880859375, 0.52392578125, 0.1474609375, 0.10992431640625, 0.455322265625, -0.873046875, -0.12396240234375, -0.68115234375, 0.140380859375, -0.3056640625, 0.90576171875, 0.2347412109375, -0.0789794921875, 0.73486328125, -0.31396484375, -0.432861328125, -0.0269012451171875, 0.298583984375, -0.31103515625, -0.049041748046875, 0.351806640625, -0.78662109375, -0.264404296875, 0.1549072265625, -0.6796875, 0.310302734375, -0.1593017578125, -0.76904296875, 0.7041015625, 0.2303466796875, 0.55322265625, -0.97802734375, -0.5439453125, 0.06048583984375, 0.2344970703125, -0.261474609375, -0.4267578125, 0.51708984375, 0.40234375, 0.51904296875, 0.09051513671875, 0.3955078125, -0.869140625, 1.0673828125, -0.0269012451171875, 0.427001953125, -0.84521484375, 0.1629638671875, -0.08770751953125, -0.4384765625, -0.53173828125, -0.44921875, 0.51953125, 0.03448486328125, 0.020172119140625, 0.52685546875, 0.40478515625, -0.7431640625, 0.004150390625, -0.349365234375, -0.27978515625, -0.220947265625, 0.73193359375, 1.060546875, -0.28125, -0.2373046875, -0.33447265625, 0.5400390625, 0.408447265625, 0.31640625, 0.1201171875, -0.677734375, -0.1875 ]
6
End of preview. Expand in Data Studio

Dataset Card for "python3-standardized_cluster_6"

More Information needed

Downloads last month
1