about summary refs log tree commit diff
path: root/codechef
diff options
context:
space:
mode:
Diffstat (limited to 'codechef')
-rwxr-xr-xcodechef/hrdseq.py9
-rwxr-xr-xcodechef/sc31.py6
-rw-r--r--codechef/sc31.raku1
3 files changed, 16 insertions, 0 deletions
diff --git a/codechef/hrdseq.py b/codechef/hrdseq.py
new file mode 100755
index 0000000..a47ef2d
--- /dev/null
+++ b/codechef/hrdseq.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+seq = [0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3, 0, 3, 2, 9,
+       0, 4, 9, 3, 6, 14, 0, 6, 3, 5, 15, 0, 5, 3, 5, 2, 17, 0, 6, 11, 0, 3, 8,
+       0, 3, 3, 1, 42, 0, 5, 15, 20, 0, 4, 32, 0, 3, 11, 18, 0, 4, 7, 0, 3, 7,
+       3, 2, 31, 0, 6, 31, 3, 6, 3, 2, 8, 33, 0, 9, 56, 0, 3, 8, 7, 19, 0, 5,
+       37, 0, 3, 8, 8, 1, 46, 0, 6, 23, 0, 3, 9, 21, 0, 4, 42, 56, 25, 0, 5,
+       21, 8, 18, 52, 0, 6, 18, 4, 13, 0, 5, 11, 62, 0, 4, 7]
+for t in range(int(input())):
+    print((lambda n: seq[:n].count(seq[n-1]))(int(input())))
diff --git a/codechef/sc31.py b/codechef/sc31.py
new file mode 100755
index 0000000..470c294
--- /dev/null
+++ b/codechef/sc31.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+from functools import reduce
+
+for t in range(int(input())):
+    print(bin(reduce(int.__xor__, (int(input(), 2)
+                                   for i in range(int(input()))))).count('1'))
diff --git a/codechef/sc31.raku b/codechef/sc31.raku
new file mode 100644
index 0000000..6aab576
--- /dev/null
+++ b/codechef/sc31.raku
@@ -0,0 +1 @@
+put [+] ([+^] (^get).map: {:2(get)}).base(2).comb for ^get