This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import shutil | |
p = Path("lost+found") | |
for f in p.iterdir(): | |
if f.is_dir(): | |
package = f / "desc" | |
if package.exists(): | |
with package.open("rt") as fh: | |
for line in fh: | |
line = line.rstrip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import shutil | |
p = Path("lost+found") | |
for f in p.iterdir(): | |
if f.is_dir(): | |
package = f / "desc" | |
if package.exists(): | |
with package.open("rt") as fh: | |
for line in fh: | |
line = line.rstrip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A: | |
def foo(self): | |
A.bar(self) | |
def bar(self): | |
print("from A") | |
class B(A): | |
def bar(self): | |
print("from B") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import floor | |
from bisect import bisect_left | |
import sys | |
def rounding(N): | |
r = [] | |
for i in range(1, N): | |
if 100 * i/N - floor(100 * i /N) >= 0.5: | |
r.append(i) | |
return r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 | |
20 | |
7 0 7 6 0 7 3 0 4 4 7 2 6 8 3 8 5 1 5 4 | |
20 | |
6 9 5 7 6 6 1 9 4 9 8 3 5 4 5 9 1 3 1 3 | |
20 | |
4 5 2 2 5 5 8 8 6 7 9 3 8 6 6 2 8 3 0 7 | |
20 | |
0 9 9 1 5 7 9 4 1 6 7 6 1 9 3 7 1 5 2 9 | |
20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 | |
200 | |
30 51 52 22 94 90 31 7 77 56 80 31 83 12 92 11 27 50 7 65 77 28 92 45 81 23 33 7 20 94 86 89 12 83 71 0 11 82 7 86 44 80 29 53 82 87 40 57 13 77 8 86 61 58 65 84 35 79 77 59 26 78 31 15 29 92 63 82 53 82 6 19 97 77 10 88 43 32 79 66 80 12 39 57 63 55 93 23 31 72 52 23 73 2 41 74 47 77 62 56 93 27 90 48 60 31 39 70 38 40 32 18 65 69 78 75 26 37 80 26 46 78 69 78 94 58 57 71 60 5 86 3 77 88 70 63 26 21 74 80 33 82 84 72 48 36 58 11 74 47 60 9 65 58 12 52 14 95 9 78 62 65 86 0 55 65 68 60 16 51 23 89 58 20 21 36 21 72 98 66 53 88 2 39 96 68 0 59 77 70 1 22 93 34 0 53 70 78 45 67 | |
200 | |
87 83 67 4 47 49 2 73 49 41 43 79 34 99 40 36 34 11 78 63 81 20 43 23 36 50 51 90 41 21 20 4 20 93 4 17 9 25 33 53 90 25 68 54 10 20 24 93 95 97 53 44 51 87 50 71 6 6 65 85 11 60 45 24 1 62 43 13 11 95 24 49 47 30 42 44 10 87 86 56 38 10 21 71 20 6 77 60 40 77 48 4 54 16 11 27 94 47 30 80 62 28 50 5 74 14 64 91 36 70 22 31 90 92 74 39 61 30 69 33 78 11 72 83 23 54 53 94 69 33 3 11 65 19 16 20 66 54 35 4 63 55 99 6 23 16 35 13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 | |
1000 | |
94 36 83 48 64 49 18 2 55 38 50 97 14 63 44 33 95 4 54 97 60 8 17 11 78 45 98 84 86 36 92 79 69 53 22 40 67 89 57 94 64 85 6 11 86 7 53 26 77 25 29 1 62 81 50 24 94 83 44 51 99 14 1 79 87 33 56 30 21 48 1 97 43 8 65 70 37 67 49 1 53 60 12 22 69 46 25 90 42 49 45 78 80 33 18 33 16 48 78 91 59 18 99 86 24 83 91 39 36 6 50 7 62 80 20 82 91 16 83 77 31 29 24 55 53 17 44 15 56 15 52 48 52 88 58 74 43 86 97 88 9 61 55 74 87 68 86 54 99 77 34 89 6 21 76 91 89 16 83 45 11 59 34 40 10 58 44 32 48 1 77 81 69 27 12 41 30 6 51 40 33 22 84 99 67 35 30 55 38 29 81 81 66 83 10 18 29 14 98 90 71 87 89 44 11 90 97 14 67 84 61 33 53 4 90 76 90 42 99 33 58 47 9 4 42 1 46 22 26 94 71 79 1 1 43 11 49 25 42 80 23 82 9 98 18 29 88 79 76 12 18 60 23 17 30 44 85 86 11 13 50 6 86 70 18 78 61 84 80 16 15 57 5 46 63 34 78 15 9 53 91 2 8 25 86 16 6 29 87 71 21 70 40 27 55 29 15 32 65 99 54 23 73 88 27 45 74 99 54 42 39 55 81 75 32 0 97 4 57 69 94 24 23 88 46 49 83 92 48 69 7 27 95 59 93 30 38 87 71 94 11 58 27 87 82 32 20 76 95 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 | |
5 | |
5 6 8 4 3 | |
3 | |
8 9 7 | |
5 | |
5 3 6 6 4 | |
6 | |
2 5 1 4 7 6 | |
5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solve(l): | |
r = sorted(enumerate(l), key=lambda x:x[1]) | |
for i, (sigma, _) in enumerate(r): | |
if (sigma - i) % 2 != 0: | |
return i | |
else: | |
return "OK" | |
T = int(input()) | |
for i in range(T): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
for line in sys.stdin: | |
print(line.rstrip()) |