diff --git a/game_of_thrones_1/game_of_thrones_1.py b/game_of_thrones_1/game_of_thrones_1.py index 42a1a38..af5f057 100644 --- a/game_of_thrones_1/game_of_thrones_1.py +++ b/game_of_thrones_1/game_of_thrones_1.py @@ -5,16 +5,16 @@ import sys def is_palindrome_anagram(str): - chars = [ False ] * 26 - for c in str: - chars[ord(c) - 97] ^= True - return sum(chars) <= 1 + chars = [ False ] * 26 + for c in str: + chars[ord(c) - 97] ^= True + return sum(chars) <= 1 def main(): - if is_palindrome_anagram(sys.stdin.readline().strip()): - print('YES') - else: - print('NO') + if is_palindrome_anagram(sys.stdin.readline().strip()): + print('YES') + else: + print('NO') if __name__ == '__main__': - main() \ No newline at end of file + main() \ No newline at end of file diff --git a/gem_stones/gem_stones.py b/gem_stones/gem_stones.py index c3cff06..0c86826 100644 --- a/gem_stones/gem_stones.py +++ b/gem_stones/gem_stones.py @@ -5,20 +5,20 @@ import sys def count_gems(str, gems): - tmp = [ False ] * 26 - for c in str: - tmp[ord(c) - 97] = True - for i in range(26): - if not tmp[i]: - gems[i] = False + tmp = [ False ] * 26 + for c in str: + tmp[ord(c) - 97] = True + for i in range(26): + if not tmp[i]: + gems[i] = False def main(): - N = int(sys.stdin.readline()) - gems = [ True ] * 26 - for _ in range(N): - str = sys.stdin.readline().strip() - count_gems(str, gems) - print(sum(gems)) + N = int(sys.stdin.readline()) + gems = [ True ] * 26 + for _ in range(N): + str = sys.stdin.readline().strip() + count_gems(str, gems) + print(sum(gems)) if __name__ == '__main__': - main() \ No newline at end of file + main() \ No newline at end of file diff --git a/hr b/hr index 76f3413..f181565 100644 --- a/hr +++ b/hr @@ -1,13 +1,13 @@ #!/bin/bash new() { - case "$1" in - "py") - mkdir "$2" && cp skel.py "$2/$2.py" ;; - esac + case "$1" in + "py") + mkdir "$2" && cp skel.py "$2/$2.py" ;; + esac } case "$1" in - "new") - new "${@:2}" ;; + "new") + new "${@:2}" ;; esac \ No newline at end of file diff --git a/love_letter/love_letter.py b/love_letter/love_letter.py index 6967853..3e2c12e 100644 --- a/love_letter/love_letter.py +++ b/love_letter/love_letter.py @@ -5,18 +5,18 @@ import sys def char_distance(ca,cb): - return abs(ord(ca) - ord(cb)) + return abs(ord(ca) - ord(cb)) def palindrome_distance(str): - length = len(str) - dist = 0 - for i in range(length // 2): - dist += char_distance(str[i], str[-i-1]) - return dist + length = len(str) + dist = 0 + for i in range(length // 2): + dist += char_distance(str[i], str[-i-1]) + return dist def main(): - T = int(sys.stdin.readline()) - for _ in range(T): - print(palindrome_distance(sys.stdin.readline().strip())) + T = int(sys.stdin.readline()) + for _ in range(T): + print(palindrome_distance(sys.stdin.readline().strip())) main() \ No newline at end of file diff --git a/max_xor/max_xor.py b/max_xor/max_xor.py index 2407763..107918e 100644 --- a/max_xor/max_xor.py +++ b/max_xor/max_xor.py @@ -5,17 +5,17 @@ import sys def max_xor(L,R): - res = 1 - n = L ^ R - while n > 0: - n >>=1 - res <<= 1 - return res - 1 + res = 1 + n = L ^ R + while n > 0: + n >>=1 + res <<= 1 + return res - 1 def main(): - L = int(sys.stdin.readline()) - R = int(sys.stdin.readline()) - print(max_xor(L,R)) + L = int(sys.stdin.readline()) + R = int(sys.stdin.readline()) + print(max_xor(L,R)) if __name__ == '__main__': - main() + main() diff --git a/service_lane/service_lane.py b/service_lane/service_lane.py index e99a01d..1d4a3c2 100644 --- a/service_lane/service_lane.py +++ b/service_lane/service_lane.py @@ -5,31 +5,31 @@ import sys def nextints(): - return [int(x) for x in sys.stdin.readline().split()] + return [int(x) for x in sys.stdin.readline().split()] def maxwidth_aux(width, i, j): - res = 3 - for w in width[i:j+1]: - if w == 1: - return 1 - res = min(res,w) - return res + res = 3 + for w in width[i:j+1]: + if w == 1: + return 1 + res = min(res,w) + return res def maxwidth(width, i, j, memo): - res = memo.get((i,j), None) - if res: - return res - res = maxwidth_aux(width, i, j) - memo[(i,j)] = res - return res + res = memo.get((i,j), None) + if res: + return res + res = maxwidth_aux(width, i, j) + memo[(i,j)] = res + return res def main(): - [N,T] = nextints() - width = nextints() - memo = dict() - for _ in range(T): - [i,j] = nextints() - print(maxwidth(width, i, j, memo)) + [N,T] = nextints() + width = nextints() + memo = dict() + for _ in range(T): + [i,j] = nextints() + print(maxwidth(width, i, j, memo)) main() - \ No newline at end of file + \ No newline at end of file diff --git a/skel.py b/skel.py index b40d65c..22fb127 100644 --- a/skel.py +++ b/skel.py @@ -7,7 +7,7 @@ import sys # INSERT CODE def main(): - pass + pass if __name__ == '__main__': - main() \ No newline at end of file + main() \ No newline at end of file diff --git a/utopian_tree/utopian_tree.py b/utopian_tree/utopian_tree.py index e9dbffb..3a289b0 100644 --- a/utopian_tree/utopian_tree.py +++ b/utopian_tree/utopian_tree.py @@ -5,14 +5,14 @@ import sys def calcsize(cycles): - tmp = 2**((cycles+3)//2) - if cycles % 2 == 1: - return tmp - 2 - return tmp - 1 + tmp = 2**((cycles+3)//2) + if cycles % 2 == 1: + return tmp - 2 + return tmp - 1 def main(): - total = int(sys.stdin.readline()) - for i in range(total): - print(calcsize(int(sys.stdin.readline()))) + total = int(sys.stdin.readline()) + for i in range(total): + print(calcsize(int(sys.stdin.readline()))) main() \ No newline at end of file