diff --git a/index.html b/index.html index a1ef10e..2438afd 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ .gdesc-inner { font-size: 0.75rem; } body[data-md-color-scheme="slate"] .gdesc-inner { background: var(--md-default-bg-color);} body[data-md-color-scheme="slate"] .gslide-title { color: var(--md-default-fg-color);} - body[data-md-color-scheme="slate"] .gslide-desc { color: var(--md-default-fg-color);}
Skip to content

Logo

kattis

About the solutions to Kattis Problem Archive

Summary by Difficulty

{ "data": { "values": [ {"Difficulty": "Easy", "Count": 568}, {"Difficulty": "Medium", "Count": 35} ] }, "mark": {"type": "bar", "tooltip": true}, "encoding": { "x": {"field": "Difficulty", "type": "nominal", "axis": {"labelAngle": 0}, "sort": "-y"}, "y": {"field": "Count", "type": "quantitative"}, "color": {"field": "Difficulty", "legend": null} } }

Summary by Initial

{ "data": { "values": [ {"Initial": "S", "Count": 71}, {"Initial": "T", "Count": 46}, {"Initial": "C", "Count": 46}, {"Initial": "P", "Count": 46}, {"Initial": "B", "Count": 43}, {"Initial": "A", "Count": 41}, {"Initial": "M", "Count": 35}, {"Initial": "H", "Count": 31}, {"Initial": "F", "Count": 29}, {"Initial": "D", "Count": 27}, {"Initial": "E", "Count": 22}, {"Initial": "R", "Count": 20}, {"Initial": "L", "Count": 19}, {"Initial": "G", "Count": 17}, {"Initial": "K", "Count": 16}, {"Initial": "I", "Count": 14}, {"Initial": "O", "Count": 11}, {"Initial": "J", "Count": 11}, {"Initial": "W", "Count": 10}, {"Initial": "V", "Count": 10}, {"Initial": "N", "Count": 10}, {"Initial": "U", "Count": 6}, {"Initial": "Q", "Count": 5}, {"Initial": "Z", "Count": 3}, {"Initial": "Ö", "Count": 2}, {"Initial": "Y", "Count": 2}, {"Initial": "1", "Count": 2}, {"Initial": "Ú", "Count": 2}, {"Initial": "Ó", "Count": 1}, {"Initial": "Á", "Count": 1}, {"Initial": "3", "Count": 1}, {"Initial": "k", "Count": 1}, {"Initial": "4", "Count": 1}, {"Initial": "9", "Count": 1} ] }, "mark": {"type": "bar", "tooltip": true}, "encoding": { "x": {"field": "Initial", "type": "nominal", "axis": {"labelAngle": 0}, "sort": "-y"}, "y": {"field": "Count", "type": "quantitative"}, "color": {"field": "Initial", "legend": null} } }

Summary by Language

{ "data": { "values": [ {"Language": "Python", "Count": 600}, {"Language": "Lua", "Count": 111}, {"Language": "Go", "Count": 48}, {"Language": "Java", "Count": 29}, {"Language": "C++", "Count": 24}, {"Language": "JavaScript", "Count": 11}, {"Language": "Kotlin", "Count": 11}, {"Language": "Ruby", "Count": 6}, {"Language": "Julia", "Count": 4}, {"Language": "Haskell", "Count": 4}, {"Language": "Rust", "Count": 3} ] }, "mark": {"type": "bar", "tooltip": true}, "encoding": { "x": {"field": "Language", "type": "nominal", "axis": {"labelAngle": 0}, "sort": "-y"}, "y": {"field": "Count", "type": "quantitative"}, "color": {"field": "Language", "legend": null} } }


Thanks to all 6 contributors.


Last update: 2024-08-28

Skip to content

Logo

kattis

About the solutions to Kattis Problem Archive

Summary by Difficulty

{ "data": { "values": [ {"Difficulty": "Easy", "Count": 570}, {"Difficulty": "Medium", "Count": 35} ] }, "mark": {"type": "bar", "tooltip": true}, "encoding": { "x": {"field": "Difficulty", "type": "nominal", "axis": {"labelAngle": 0}, "sort": "-y"}, "y": {"field": "Count", "type": "quantitative"}, "color": {"field": "Difficulty", "legend": null} } }

Summary by Initial

{ "data": { "values": [ {"Initial": "S", "Count": 72}, {"Initial": "C", "Count": 47}, {"Initial": "T", "Count": 46}, {"Initial": "P", "Count": 46}, {"Initial": "B", "Count": 43}, {"Initial": "A", "Count": 41}, {"Initial": "M", "Count": 35}, {"Initial": "H", "Count": 31}, {"Initial": "F", "Count": 29}, {"Initial": "D", "Count": 27}, {"Initial": "E", "Count": 22}, {"Initial": "R", "Count": 20}, {"Initial": "L", "Count": 19}, {"Initial": "G", "Count": 17}, {"Initial": "K", "Count": 16}, {"Initial": "I", "Count": 14}, {"Initial": "O", "Count": 11}, {"Initial": "J", "Count": 11}, {"Initial": "W", "Count": 10}, {"Initial": "V", "Count": 10}, {"Initial": "N", "Count": 10}, {"Initial": "U", "Count": 6}, {"Initial": "Q", "Count": 5}, {"Initial": "Z", "Count": 3}, {"Initial": "Ö", "Count": 2}, {"Initial": "Y", "Count": 2}, {"Initial": "1", "Count": 2}, {"Initial": "Ú", "Count": 2}, {"Initial": "Ó", "Count": 1}, {"Initial": "Á", "Count": 1}, {"Initial": "3", "Count": 1}, {"Initial": "k", "Count": 1}, {"Initial": "4", "Count": 1}, {"Initial": "9", "Count": 1} ] }, "mark": {"type": "bar", "tooltip": true}, "encoding": { "x": {"field": "Initial", "type": "nominal", "axis": {"labelAngle": 0}, "sort": "-y"}, "y": {"field": "Count", "type": "quantitative"}, "color": {"field": "Initial", "legend": null} } }

Summary by Language

{ "data": { "values": [ {"Language": "Python", "Count": 602}, {"Language": "Lua", "Count": 112}, {"Language": "Go", "Count": 48}, {"Language": "Java", "Count": 29}, {"Language": "C++", "Count": 24}, {"Language": "JavaScript", "Count": 11}, {"Language": "Kotlin", "Count": 11}, {"Language": "Ruby", "Count": 6}, {"Language": "Julia", "Count": 4}, {"Language": "Haskell", "Count": 4}, {"Language": "Rust", "Count": 3} ] }, "mark": {"type": "bar", "tooltip": true}, "encoding": { "x": {"field": "Language", "type": "nominal", "axis": {"labelAngle": 0}, "sort": "-y"}, "y": {"field": "Count", "type": "quantitative"}, "color": {"field": "Language", "legend": null} } }


Thanks to all 6 contributors.


Last update: 2024-08-28

Skip to content

603 Problems, 851 Solutions, 11 Languages

🟡 10 Kinds of People

Solution in Python
 1
+    body[data-md-color-scheme="slate"] .gslide-desc { color: var(--md-default-fg-color);}      

605 Problems, 854 Solutions, 11 Languages

🟡 10 Kinds of People

Solution in Python
 1
  2
  3
  4
@@ -8154,85 +8154,21 @@
         c += 1
     t = v
 print(c)
-

🟡 Running Race

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
l, k, _ = [int(d) for d in input().split()]
-
-record = {}
-for _ in range(l):
-    i, t = input().split()
-    mm, ss = [int(d) for d in t.split(".")]
-    s = mm * 60 + ss
-    if i in record:
-        record[i].append(s)
-    else:
-        record[i] = [s]
-
-delete = [i for i in record if len(record[i]) != k]
-for i in delete:
-    record.pop(i)
-
-sorted_i = sorted(record, key=lambda i: (sum(record[i]), int(i)))
-print("\n".join(sorted_i))
-

🟢 Karte

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
from collections import Counter
-
-s = input()
-cards = {
-    "P": Counter(),
-    "K": Counter(),
-    "H": Counter(),
-    "T": Counter(),
-}
-duplicated = False
-for i in range(0, len(s), 3):
-    suit = s[i]
-    card = s[i + 1 : i + 3]
-    if cards[suit][card]:
-        duplicated = True
-        break
-    cards[suit][card] += 1
-
-if not duplicated:
-    print(" ".join([str(13 - len(c)) for c in cards.values()]))
-else:
-    print("GRESKA")
-

🟢 kcuD dlanoD

Solution in Python
 1
+

🟢 Cookies

Solutions in 2 languages
1
+2
+3
+4
+5
+6
n = io.read("*n")
+ans = 0
+for _ = 1, n do
+    ans = ans + io.read("*n")
+end
+print(ans)
+
1
+2
_ = input()
+print(sum(int(d) for d in input().split()))
+

🟡 Running Race

Solution in Python
 1
  2
  3
  4
@@ -8249,25 +8185,25 @@
 15
 16
 17
-18
a, b = input().split()
-a = list(a)[::-1]
-for i in range(len(a)):
-    if a[i] == "5":
-        a[i] = "2"
-    elif a[i] == "2":
-        a[i] = "5"
-b = list(b)[::-1]
-for i in range(len(b)):
-    if b[i] == "5":
-        b[i] = "2"
-    elif b[i] == "2":
-        b[i] = "5"
-a, b = int("".join(a)), int("".join(b))
-if a > b:
-    print(1)
-else:
-    print(2)
-

🟢 Kemija

Solutions in 2 languages
l, k, _ = [int(d) for d in input().split()]
+
+record = {}
+for _ in range(l):
+    i, t = input().split()
+    mm, ss = [int(d) for d in t.split(".")]
+    s = mm * 60 + ss
+    if i in record:
+        record[i].append(s)
+    else:
+        record[i] = [s]
+
+delete = [i for i in record if len(record[i]) != k]
+for i in delete:
+    record.pop(i)
+
+sorted_i = sorted(record, key=lambda i: (sum(record[i]), int(i)))
+print("\n".join(sorted_i))
+

🟢 Karte

Solution in Python
 1
  2
  3
  4
@@ -8276,28 +8212,76 @@
  7
  8
  9
-10
const readline = require("readline");
-const rl = readline.createInterface(process.stdin, process.stdout);
-
-rl.question("", (line) => {
-  for (let c of "aeiou") {
-    const regex = new RegExp(`${c}p${c}`, "g");
-    line = line.replace(regex, c);
-  }
-  console.log(line);
-});
-
1
-2
-3
-4
-5
-6
s = input()
-
-for c in "aeiou":
-    s = s.replace(f"{c}p{c}", c)
-
-print(s)
-

🟢 Keylogger

Solution in Python
 1
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
from collections import Counter
+
+s = input()
+cards = {
+    "P": Counter(),
+    "K": Counter(),
+    "H": Counter(),
+    "T": Counter(),
+}
+duplicated = False
+for i in range(0, len(s), 3):
+    suit = s[i]
+    card = s[i + 1 : i + 3]
+    if cards[suit][card]:
+        duplicated = True
+        break
+    cards[suit][card] += 1
+
+if not duplicated:
+    print(" ".join([str(13 - len(c)) for c in cards.values()]))
+else:
+    print("GRESKA")
+

🟢 kcuD dlanoD

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
a, b = input().split()
+a = list(a)[::-1]
+for i in range(len(a)):
+    if a[i] == "5":
+        a[i] = "2"
+    elif a[i] == "2":
+        a[i] = "5"
+b = list(b)[::-1]
+for i in range(len(b)):
+    if b[i] == "5":
+        b[i] = "2"
+    elif b[i] == "2":
+        b[i] = "5"
+a, b = int("".join(a)), int("".join(b))
+if a > b:
+    print(1)
+else:
+    print(2)
+

🟢 Kemija

Solutions in 2 languages
 1
  2
  3
  4
@@ -8306,108 +8290,28 @@
  7
  8
  9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
n = int(input())
-mapping = {
-    "clank": "a",
-    "bong": "b",
-    "click": "c",
-    "tap": "d",
-    "poing": "e",
-    "clonk": "f",
-    "clack": "g",
-    "ping": "h",
-    "tip": "i",
-    "cloing": "j",
-    "tic": "k",
-    "cling": "l",
-    "bing": "m",
-    "pong": "n",
-    "clang": "o",
-    "pang": "p",
-    "clong": "q",
-    "tac": "r",
-    "boing": "s",
-    "boink": "t",
-    "cloink": "u",
-    "rattle": "v",
-    "clock": "w",
-    "toc": "x",
-    "clink": "y",
-    "tuc": "z",
-    "whack": " ",
-}
-cap = False
-shift = False
-res = ""
-for _ in range(n):
-    s = input()
-    if s == "bump":
-        cap = not cap
-    elif s == "dink":
-        shift = True
-    elif s == "thumb":
-        shift = False
-    elif s == "pop":
-        res = res[:-1]
-    else:
-        c = mapping.get(s)
-        res = res + (c.upper() if (cap and not shift) or (shift and not cap) else c)
-print(res)
-

🟢 Keys, Phone, Wallet

Solution in Python
1
+10
const readline = require("readline");
+const rl = readline.createInterface(process.stdin, process.stdout);
+
+rl.question("", (line) => {
+  for (let c of "aeiou") {
+    const regex = new RegExp(`${c}p${c}`, "g");
+    line = line.replace(regex, c);
+  }
+  console.log(line);
+});
+
1
 2
 3
 4
 5
-6
-7
-8
-9
n = int(input())
-items = [input() for _ in range(n)]
-ready = True
-for item in ["keys", "phone", "wallet"]:
-    if item not in items:
-        print(item)
-        ready = False
-if ready:
-    print("ready")
-

🟢 The Key to Cryptography

Solution in Python
 1
+6
s = input()
+
+for c in "aeiou":
+    s = s.replace(f"{c}p{c}", c)
+
+print(s)
+

🟢 Keylogger

Solution in Python
 1
  2
  3
  4
@@ -8430,38 +8334,94 @@
 21
 22
 23
-24
import string
-
-uppers = string.ascii_uppercase
-
-
-def decrypt(c, k):
-    index = (uppers.index(c) - uppers.index(k)) % 26
-    return uppers[index]
-
-
-m, w = input(), input()
-
-size_w = len(w)
-size_m = len(m)
-o = []
-for i in range(0, size_m, size_w):
-    if i + size_w < size_m:
-        l = zip(m[i : i + size_w], w)
-    else:
-        l = zip(m[i:], w)
-    t = "".join([decrypt(c, k) for c, k in l])
-    o.append(t)
-    w = t
-print("".join(o))
-

🟢 Keywords

Solution in Python
1
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
n = int(input())
+mapping = {
+    "clank": "a",
+    "bong": "b",
+    "click": "c",
+    "tap": "d",
+    "poing": "e",
+    "clonk": "f",
+    "clack": "g",
+    "ping": "h",
+    "tip": "i",
+    "cloing": "j",
+    "tic": "k",
+    "cling": "l",
+    "bing": "m",
+    "pong": "n",
+    "clang": "o",
+    "pang": "p",
+    "clong": "q",
+    "tac": "r",
+    "boing": "s",
+    "boink": "t",
+    "cloink": "u",
+    "rattle": "v",
+    "clock": "w",
+    "toc": "x",
+    "clink": "y",
+    "tuc": "z",
+    "whack": " ",
+}
+cap = False
+shift = False
+res = ""
+for _ in range(n):
+    s = input()
+    if s == "bump":
+        cap = not cap
+    elif s == "dink":
+        shift = True
+    elif s == "thumb":
+        shift = False
+    elif s == "pop":
+        res = res[:-1]
+    else:
+        c = mapping.get(s)
+        res = res + (c.upper() if (cap and not shift) or (shift and not cap) else c)
+print(res)
+

🟢 Keys, Phone, Wallet

Solution in Python
1
 2
 3
-4
keywords = set()
-for _ in range(int(input())):
-    keywords.add(input().lower().replace("-", " "))
-print(len(keywords))
-

🟢 Kiki Boba

Solutions in 2 languages
 1
+4
+5
+6
+7
+8
+9
n = int(input())
+items = [input() for _ in range(n)]
+ready = True
+for item in ["keys", "phone", "wallet"]:
+    if item not in items:
+        print(item)
+        ready = False
+if ready:
+    print("ready")
+

🟢 The Key to Cryptography

Solution in Python
 1
  2
  3
  4
@@ -8482,53 +8442,83 @@
 19
 20
 21
-22
package main
+22
+23
+24
import string
 
-import (
-    "fmt"
-    "strings"
-)
-
-func main() {
-    var w string
-    fmt.Scan(&w)
-    b := strings.Count(w, "b")
-    k := strings.Count(w, "k")
-    if b > k {
-        fmt.Println("boba")
-    } else if b < k {
-        fmt.Println("kiki")
-    } else if b > 0 {
-        fmt.Println("boki")
-    } else {
-        fmt.Println("none")
-    }
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
w = input()
-b, k = w.count("b"), w.count("k")
-if not b and not k:
-    print("none")
-elif b == k:
-    print("boki")
-elif b > k:
-    print("boba")
-else:
-    print("kiki")
-

🟢 Kínahvísl

Solution in Python
1
-2
-3
s1 = input()
-s2 = input()
-print(sum(a != b for a, b in zip(s1, s2)) + 1)
-

🟢 Kitten on a Tree

Solution in Python
 1
+uppers = string.ascii_uppercase
+
+
+def decrypt(c, k):
+    index = (uppers.index(c) - uppers.index(k)) % 26
+    return uppers[index]
+
+
+m, w = input(), input()
+
+size_w = len(w)
+size_m = len(m)
+o = []
+for i in range(0, size_m, size_w):
+    if i + size_w < size_m:
+        l = zip(m[i : i + size_w], w)
+    else:
+        l = zip(m[i:], w)
+    t = "".join([decrypt(c, k) for c, k in l])
+    o.append(t)
+    w = t
+print("".join(o))
+

🟢 Keywords

Solution in Python
1
+2
+3
+4
keywords = set()
+for _ in range(int(input())):
+    keywords.add(input().lower().replace("-", " "))
+print(len(keywords))
+

🟢 Kiki Boba

Solutions in 2 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
package main
+
+import (
+    "fmt"
+    "strings"
+)
+
+func main() {
+    var w string
+    fmt.Scan(&w)
+    b := strings.Count(w, "b")
+    k := strings.Count(w, "k")
+    if b > k {
+        fmt.Println("boba")
+    } else if b < k {
+        fmt.Println("kiki")
+    } else if b > 0 {
+        fmt.Println("boki")
+    } else {
+        fmt.Println("none")
+    }
+}
+
 1
  2
  3
  4
@@ -8537,255 +8527,191 @@
  7
  8
  9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
k = input()
-b = []
-while True:
-    line = input()
-    if line == "-1":
-        break
-    b.append(line.split())
-
-p = [k]
-t = k
-while True:
-    found = False
-    for row in b:
-        if t in row[1:]:
-            p.append(row[0])
-            found = True
-            t = row[0]
-            break
-    if not found:
-        break
-
-print(" ".join(p))
-

🟢 Kleptography

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
from string import ascii_lowercase as l
-
-n, m = [int(d) for d in input().split()]
-p = input()
-c = input()
-p = p[::-1]
-c = c[::-1]
-
-ans = ""
-for i in range(0, m, n):
-    if i + n < m:
-        part = c[i : i + n]
-    else:
-        part = c[i:]
-
-    ans += p
-    p = "".join([l[(l.index(a) - l.index(b)) % 26] for a, b in zip(part, p)])
-
-ans += p
-print(ans[::-1][n:])
-

🟢 Klósettröð

Solution in Python
1
-2
-3
-4
n = int(input())
-a = [int(d) for d in input().split()]
-m = dict(zip(range(1, n + 1), a))
-print(*sorted(m, key=lambda v: -m[v]))
-

🟢 Knight Packing

Solutions in 3 languages
1
-2
-3
-4
-5
-6
-7
fun main() {
-    if (readLine()!!.toInt() % 2 == 1) {
-        println("first")
-    } else {
-        println("second")
-    }
-}
-
1
+10
w = input()
+b, k = w.count("b"), w.count("k")
+if not b and not k:
+    print("none")
+elif b == k:
+    print("boki")
+elif b > k:
+    print("boba")
+else:
+    print("kiki")
+

🟢 Kínahvísl

Solution in Python
1
+2
+3
s1 = input()
+s2 = input()
+print(sum(a != b for a, b in zip(s1, s2)) + 1)
+

🟢 Kitten on a Tree

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
k = input()
+b = []
+while True:
+    line = input()
+    if line == "-1":
+        break
+    b.append(line.split())
+
+p = [k]
+t = k
+while True:
+    found = False
+    for row in b:
+        if t in row[1:]:
+            p.append(row[0])
+            found = True
+            t = row[0]
+            break
+    if not found:
+        break
+
+print(" ".join(p))
+

🟢 Kleptography

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
from string import ascii_lowercase as l
+
+n, m = [int(d) for d in input().split()]
+p = input()
+c = input()
+p = p[::-1]
+c = c[::-1]
+
+ans = ""
+for i in range(0, m, n):
+    if i + n < m:
+        part = c[i : i + n]
+    else:
+        part = c[i:]
+
+    ans += p
+    p = "".join([l[(l.index(a) - l.index(b)) % 26] for a, b in zip(part, p)])
+
+ans += p
+print(ans[::-1][n:])
+

🟢 Klósettröð

Solution in Python
1
 2
 3
-4
-5
if io.read("*n") % 2 == 1 then
-    print("first")
-else
-    print("second")
-end
-
1
+4
n = int(input())
+a = [int(d) for d in input().split()]
+m = dict(zip(range(1, n + 1), a))
+print(*sorted(m, key=lambda v: -m[v]))
+

🟢 Knight Packing

Solutions in 3 languages
1
 2
 3
-4
if int(input()) % 2:
-    print("first")
-else:
-    print("second")
-

🟢 Knot Knowledge

Solution in Python
1
+4
+5
+6
+7
fun main() {
+    if (readLine()!!.toInt() % 2 == 1) {
+        println("first")
+    } else {
+        println("second")
+    }
+}
+
1
 2
 3
-4
input()
-total = set(input().split())
-known = set(input().split())
-print((total - known).pop())
-

🟢 Kornislav

Solution in Python
1
-2
numbers = sorted([int(d) for d in input().split()])
-print(numbers[0] * numbers[2])
-

🟢 Križaljka

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
a, b = input().split()
-for i in range(len(a)):
-    if a[i] in b:
-        j = b.index(a[i])
-        break
-
-rows = []
-
-for k in range(j):
-    rows.append("." * i + b[k] + "." * (len(a) - i - 1))
-
-rows.append(a)
-
-for k in range(j + 1, len(b)):
-    rows.append("." * i + b[k] + "." * (len(a) - i - 1))
-
-print("\n".join(rows))
-

🟢 Kveðja

Solution in Python
print(f"Kvedja,\n{input()}")
-

🟢 Ladder

Solution in Python
1
-2
-3
-4
import math
-
-h, v = [int(d) for d in input().split()]
-print(math.ceil(h / math.sin(math.radians(v))))
-

🟢 Lægð yfir landinu

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
n, m = [int(d) for d in input().split()]
-p = []
-for _ in range(n):
-    p.append([int(d) for d in input().split()])
-
-f = False
-for i in range(1, n - 1):
-    for j in range(1, m - 1):
-        c = []
-        c.append(p[i - 1][j])
-        c.append(p[i][j - 1])
-        c.append(p[i + 1][j])
-        c.append(p[i][j + 1])
-        if all(v > p[i][j] for v in c):
-            f = True
-            break
-    if f:
-        break
-
-print("Jebb" if f else "Neibb")
-

🟡 Lamps

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
h, p = [int(d) for d in input().split()]
+4
+5
if io.read("*n") % 2 == 1 then
+    print("first")
+else
+    print("second")
+end
+
1
+2
+3
+4
if int(input()) % 2:
+    print("first")
+else:
+    print("second")
+

🟢 Knot Knowledge

Solution in Python
1
+2
+3
+4
input()
+total = set(input().split())
+known = set(input().split())
+print((total - known).pop())
+

🟢 Kornislav

Solution in Python
1
+2
numbers = sorted([int(d) for d in input().split()])
+print(numbers[0] * numbers[2])
+

🟢 Križaljka

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
a, b = input().split()
+for i in range(len(a)):
+    if a[i] in b:
+        j = b.index(a[i])
+        break
+
+rows = []
+
+for k in range(j):
+    rows.append("." * i + b[k] + "." * (len(a) - i - 1))
+
+rows.append(a)
+
+for k in range(j + 1, len(b)):
+    rows.append("." * i + b[k] + "." * (len(a) - i - 1))
+
+print("\n".join(rows))
+

🟢 Kveðja

Solution in Python
print(f"Kvedja,\n{input()}")
+

🟢 Ladder

Solution in Python
1
+2
+3
+4
import math
 
-days = 0
-cost_bulb, cost_lamp = 5, 60
-used_bulb, used_lamp = 0, 0
-
-while True:
-    days += 1
-    cost_bulb += 60 * h * p / 100000
-    cost_lamp += 11 * h * p / 100000
-    used_bulb += h
-    used_lamp += h
-
-    if used_bulb > 1000:
-        cost_bulb += 5
-        used_bulb -= 1000
-
-    if used_lamp > 8000:
-        cost_lamp += 60
-        used_lamp -= 8000
-
-    if cost_bulb > cost_lamp:
-        break
-
-print(days)
-

🟢 Laptop Sticker

Solutions in 4 languages
 1
+h, v = [int(d) for d in input().split()]
+print(math.ceil(h / math.sin(math.radians(v))))
+

🟢 Lægð yfir landinu

Solution in Python
 1
  2
  3
  4
@@ -8802,25 +8728,29 @@
 15
 16
 17
-18
#include <iostream>
-
-using namespace std;
-
-int main()
-{
-    int wc, hc, ws, hs;
-    cin >> wc >> hc >> ws >> hs;
-    if (wc - 2 >= ws && hc - 2 >= hs)
-    {
-        cout << 1 << endl;
-    }
-    else
-    {
-        cout << 0 << endl;
-    }
-    return 0;
-}
-
 1
+18
+19
+20
n, m = [int(d) for d in input().split()]
+p = []
+for _ in range(n):
+    p.append([int(d) for d in input().split()])
+
+f = False
+for i in range(1, n - 1):
+    for j in range(1, m - 1):
+        c = []
+        c.append(p[i - 1][j])
+        c.append(p[i][j - 1])
+        c.append(p[i + 1][j])
+        c.append(p[i][j + 1])
+        if all(v > p[i][j] for v in c):
+            f = True
+            break
+    if f:
+        break
+
+print("Jebb" if f else "Neibb")
+

🟡 Lamps

Solution in Python
 1
  2
  3
  4
@@ -8839,163 +8769,157 @@
 17
 18
 19
-20
package main
+20
+21
+22
+23
+24
+25
h, p = [int(d) for d in input().split()]
 
-import "fmt"
-
-func main() {
-    var wc, hc, ws, hs int
-    fmt.Scan(&wc)
-    fmt.Scan(&hc)
-    fmt.Scan(&ws)
-    fmt.Scan(&hs)
-    if wc-2 >= ws && hc-2 >= hs {
-
-        fmt.Println(1)
-
-    } else {
-
-        fmt.Println(0)
-
-    }
-}
-
1
-2
-3
-4
-5
-6
wc, hc, ws, hs = io.read("*n", "*n", "*n", "*n")
-if wc - 2 >= ws and hc - 2 >= hs then
-    print(1)
-else
-    print(0)
-end
-
1
-2
-3
-4
-5
wc, hc, ws, hs = [int(d) for d in input().split()]
-if wc - 2 >= ws and hc - 2 >= hs:
-    print(1)
-else:
-    print(0)
-

🟢 Last Factorial Digit

Solutions in 2 languages
1
+days = 0
+cost_bulb, cost_lamp = 5, 60
+used_bulb, used_lamp = 0, 0
+
+while True:
+    days += 1
+    cost_bulb += 60 * h * p / 100000
+    cost_lamp += 11 * h * p / 100000
+    used_bulb += h
+    used_lamp += h
+
+    if used_bulb > 1000:
+        cost_bulb += 5
+        used_bulb -= 1000
+
+    if used_lamp > 8000:
+        cost_lamp += 60
+        used_lamp -= 8000
+
+    if cost_bulb > cost_lamp:
+        break
+
+print(days)
+

🟢 Laptop Sticker

Solutions in 4 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
#include <iostream>
+
+using namespace std;
+
+int main()
+{
+    int wc, hc, ws, hs;
+    cin >> wc >> hc >> ws >> hs;
+    if (wc - 2 >= ws && hc - 2 >= hs)
+    {
+        cout << 1 << endl;
+    }
+    else
+    {
+        cout << 0 << endl;
+    }
+    return 0;
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
package main
+
+import "fmt"
+
+func main() {
+    var wc, hc, ws, hs int
+    fmt.Scan(&wc)
+    fmt.Scan(&hc)
+    fmt.Scan(&ws)
+    fmt.Scan(&hs)
+    if wc-2 >= ws && hc-2 >= hs {
+
+        fmt.Println(1)
+
+    } else {
+
+        fmt.Println(0)
+
+    }
+}
+
1
 2
 3
 4
 5
-6
-7
-8
for _ = 1, io.read("*n") do
-    n = io.read("*n")
-    number = 1
-    for i = 1, n do
-        number = number * i
-    end
-    print(number % 10)
-end
+6
wc, hc, ws, hs = io.read("*n", "*n", "*n", "*n")
+if wc - 2 >= ws and hc - 2 >= hs then
+    print(1)
+else
+    print(0)
+end
 
1
 2
 3
 4
-5
-6
for _ in range(int(input())):
-    n = int(input())
-    number = 1
-    for i in range(1, n + 1):
-        number *= i
-    print(number % 10)
-

🟢 Left Beehind

Solutions in 3 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
package main
-
-import "fmt"
-
-func main() {
-    var x, y int
-    for true {
-        fmt.Scan(&x)
-        fmt.Scan(&y)
-        if x == 0 && y == 0 {
-            break
-        }
-        if x+y == 13 {
-            fmt.Println("Never speak again.")
-        } else if x > y {
-            fmt.Println("To the convention.")
-        } else if x == y {
-            fmt.Println("Undecided.")
-        } else {
-            fmt.Println("Left beehind.")
-        }
-    }
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
import java.util.Scanner;
-
-class LeftBeehind {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        while (true) {
-            int x = s.nextInt();
-            int y = s.nextInt();
-            if (x == 0 && y == 0) {
-                break;
-            }
-            if (x + y == 13) {
-                System.out.println("Never speak again.");
-            } else if (x > y) {
-                System.out.println("To the convention.");
-            } else if (x == y) {
-                System.out.println("Undecided.");
-            } else {
-                System.out.println("Left beehind.");
-            }
-        }
-    }
-}
-
 1
+5
wc, hc, ws, hs = [int(d) for d in input().split()]
+if wc - 2 >= ws and hc - 2 >= hs:
+    print(1)
+else:
+    print(0)
+

🟢 Last Factorial Digit

Solutions in 2 languages
1
+2
+3
+4
+5
+6
+7
+8
for _ = 1, io.read("*n") do
+    n = io.read("*n")
+    number = 1
+    for i = 1, n do
+        number = number * i
+    end
+    print(number % 10)
+end
+
1
+2
+3
+4
+5
+6
for _ in range(int(input())):
+    n = int(input())
+    number = 1
+    for i in range(1, n + 1):
+        number *= i
+    print(number % 10)
+

🟢 Left Beehind

Solutions in 3 languages
 1
  2
  3
  4
@@ -9006,19 +8930,41 @@
  9
 10
 11
-12
while True:
-    x, y = [int(d) for d in input().split()]
-    if not x and not y:
-        break
-    if x + y == 13:
-        print("Never speak again.")
-    elif x > y:
-        print("To the convention.")
-    elif x == y:
-        print("Undecided.")
-    else:
-        print("Left beehind.")
-

🟢 Leggja saman

Solutions in 3 languages
 1
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
package main
+
+import "fmt"
+
+func main() {
+    var x, y int
+    for true {
+        fmt.Scan(&x)
+        fmt.Scan(&y)
+        if x == 0 && y == 0 {
+            break
+        }
+        if x+y == 13 {
+            fmt.Println("Never speak again.")
+        } else if x > y {
+            fmt.Println("To the convention.")
+        } else if x == y {
+            fmt.Println("Undecided.")
+        } else {
+            fmt.Println("Left beehind.")
+        }
+    }
+}
+
 1
  2
  3
  4
@@ -9027,137 +8973,161 @@
  7
  8
  9
-10
package main
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
import java.util.Scanner;
 
-import "fmt"
-
-func main() {
-    var n, m int
-    fmt.Scan(&n)
-    fmt.Scan(&m)
-    fmt.Println(n + m)
-}
-
1
-2
n, m = io.read("*n", "*n")
-print(n + m)
-
1
-2
-3
m = int(input())
-n = int(input())
-print(m + n)
-

🟢 Less vs. Fewer

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
n, p = [int(d) for d in input().split()]
-nouns = dict(tuple(input().split()) for _ in range(n))
-phrases = []
-for _ in range(p):
-    row = input().split()
-    row[-1] = nouns[row[-1]]
-    phrases.append(" ".join(row))
-rules = (
-    "number of c",
-    "amount of m",
-    "most c",
-    "most m",
-    "fewest c",
-    "least m",
-    "more c",
-    "more m",
-    "fewer c",
-    "less m",
-    "many c",
-    "much m",
-    "few c",
-    "little m",
-)
-for row in phrases:
-    if row in rules:
-        print("Correct!")
-    else:
-        print("Not on my watch!")
-

🟢 Leyniþjónusta

Solution in Python
1
-2
s = input()
-print("".join(c for c in s if c != " "))
-

🟢 License to Launch

Solution in Python
1
-2
-3
_ = input()
-junks = [int(d) for d in input().split()]
-print(junks.index(min(junks)))
-

🟢 Liðaskipting 2

Solution in Python
1
-2
-3
n = int(input())
-print(n)
-print(n // 3 + (1 if n % 3 else 0))
-

🟢 Lines Per Hour

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
n, lph = [int(d) for d in input().split()]
-loc = sorted([int(input()) for _ in range(n)])
-s, l = 0, 0
-for v in loc:
-    if l + v <= 5 * lph:
-        l += v
-        s += 1
-    else:
-        break
-print(s)
-

🟢 Line Them Up

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
n = int(input())
-names = []
-for _ in range(n):
-    names.append(input())
-order = []
-for i in range(1, n):
-    order.append(names[i] > names[i - 1])
-if all(order):
-    print("INCREASING")
-elif not any(order):
-    print("DECREASING")
-else:
-    print("NEITHER")
-

🟡 A List Game

Solution in Python
 1
+class LeftBeehind {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        while (true) {
+            int x = s.nextInt();
+            int y = s.nextInt();
+            if (x == 0 && y == 0) {
+                break;
+            }
+            if (x + y == 13) {
+                System.out.println("Never speak again.");
+            } else if (x > y) {
+                System.out.println("To the convention.");
+            } else if (x == y) {
+                System.out.println("Undecided.");
+            } else {
+                System.out.println("Left beehind.");
+            }
+        }
+    }
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
while True:
+    x, y = [int(d) for d in input().split()]
+    if not x and not y:
+        break
+    if x + y == 13:
+        print("Never speak again.")
+    elif x > y:
+        print("To the convention.")
+    elif x == y:
+        print("Undecided.")
+    else:
+        print("Left beehind.")
+

🟢 Leggja saman

Solutions in 3 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
package main
+
+import "fmt"
+
+func main() {
+    var n, m int
+    fmt.Scan(&n)
+    fmt.Scan(&m)
+    fmt.Println(n + m)
+}
+
1
+2
n, m = io.read("*n", "*n")
+print(n + m)
+
1
+2
+3
m = int(input())
+n = int(input())
+print(m + n)
+

🟢 Less vs. Fewer

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
n, p = [int(d) for d in input().split()]
+nouns = dict(tuple(input().split()) for _ in range(n))
+phrases = []
+for _ in range(p):
+    row = input().split()
+    row[-1] = nouns[row[-1]]
+    phrases.append(" ".join(row))
+rules = (
+    "number of c",
+    "amount of m",
+    "most c",
+    "most m",
+    "fewest c",
+    "least m",
+    "more c",
+    "more m",
+    "fewer c",
+    "less m",
+    "many c",
+    "much m",
+    "few c",
+    "little m",
+)
+for row in phrases:
+    if row in rules:
+        print("Correct!")
+    else:
+        print("Not on my watch!")
+

🟢 Leyniþjónusta

Solution in Python
1
+2
s = input()
+print("".join(c for c in s if c != " "))
+

🟢 License to Launch

Solution in Python
1
+2
+3
_ = input()
+junks = [int(d) for d in input().split()]
+print(junks.index(min(junks)))
+

🟢 Liðaskipting 2

Solution in Python
1
+2
+3
n = int(input())
+print(n)
+print(n // 3 + (1 if n % 3 else 0))
+

🟢 Lines Per Hour

Solution in Python
 1
  2
  3
  4
@@ -9166,68 +9136,42 @@
  7
  8
  9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
import math
-
-x = int(input())
-
-p = 1
-total = 0
-
-while x % 2 == 0:
-    p = 2
-    x /= 2
-    total += 1
-
-
-for i in range(3, math.ceil(math.sqrt(x)) + 1, 2):
-    while x % i == 0:
-        p = i
-        x /= i
-        total += 1
-if x > 1:
-    total += 1
-
-
-if p == 1:
-    total = 1
-
-
-print(total)
-

🟢 Locust Locus

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
from math import gcd
-
-n = int(input())
-l = []
-for _ in range(n):
-    y, c1, c2 = [int(d) for d in input().split()]
-    g = gcd(c1, c2)
-    l.append(y + g * (c1 // g) * (c2 // g))
-print(min(l))
-

🟢 Logic Functions

Solution in C++
n, lph = [int(d) for d in input().split()]
+loc = sorted([int(input()) for _ in range(n)])
+s, l = 0, 0
+for v in loc:
+    if l + v <= 5 * lph:
+        l += v
+        s += 1
+    else:
+        break
+print(s)
+

🟢 Line Them Up

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
n = int(input())
+names = []
+for _ in range(n):
+    names.append(input())
+order = []
+for i in range(1, n):
+    order.append(names[i] > names[i - 1])
+if all(order):
+    print("INCREASING")
+elif not any(order):
+    print("DECREASING")
+else:
+    print("NEITHER")
+

🟡 A List Game

Solution in Python
 1
  2
  3
  4
@@ -9252,137 +9196,163 @@
 23
 24
 25
-26
#include "logicfunctions.h"
+26
+27
import math
 
-// Compute xor
-void exclusive(bool x, bool y, bool &ans)
-{
-    ans = x != y;
-}
-
-// Compute implication
-void implies(bool x, bool y, bool &ans)
-{
-    if (x && !y)
-    {
-        ans = false;
-    }
-    else
-    {
-        ans = true;
-    }
-}
+x = int(input())
+
+p = 1
+total = 0
+
+while x % 2 == 0:
+    p = 2
+    x /= 2
+    total += 1
+
+
+for i in range(3, math.ceil(math.sqrt(x)) + 1, 2):
+    while x % i == 0:
+        p = i
+        x /= i
+        total += 1
+if x > 1:
+    total += 1
 
-// Compute equivalence
-void equivalence(bool x, bool y, bool &ans)
-{
-    ans = x == y;
-}
-

🟢 Longest Prime Sum

Solutions in 3 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
package main
+
+if p == 1:
+    total = 1
+
+
+print(total)
+

🟢 Locust Locus

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
from math import gcd
 
-import (
-    "fmt"
-)
-
-func main() {
-    var n int
-    fmt.Scan(&n)
-    fmt.Println(n / 2)
-}
-
print(io.read("*n")//2)
-
print(int(input()) // 2)
-

🟢 Lost Lineup

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
n = int(input())
-order = [int(d) for d in input().split()]
-d = range(1, n)
-order = dict(zip(d, order))
-ranges = range(1, n + 1)
-result = ["1"]
-for k in sorted(order, key=lambda x: order[x]):
-    result.append(str(ranges[k]))
-print(" ".join(result))
-

🟢 Lubbi Lærir

Solution in Python
print(input()[0])
-

🟢 Luhn's Checksum Algorithm

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
for _ in range(int(input())):
-    n = input()[::-1]
-    checksum = 0
-    for i in range(len(n)):
-        s = int(n[i]) * (i % 2 + 1)
-        if s > 9:
-            s = sum([int(d) for d in str(s)])
-        checksum += s
-
-    print("FAIL" if checksum % 10 else "PASS")
-

🟢 Mæting

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
from collections import Counter
-
-d = Counter()
-for _ in range(int(input())):
-    d[input()] = 0
-
-for _ in range(int(input())):
-    l = input().split()
-    if len(l) == 1:
-        continue
-    for n in l[1:]:
-        d[n] += 1
-
-for k in sorted(d, key=lambda k: -d[k]):
-    print(d[k], k)
-

🟢 Mætingarlisti

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
n, r, c = [int(d) for d in input().split()]
-a = [input().split() for _ in range(r)]
-for i in range(r):
-    b = [input() for _ in range(c)]
-    if a[i] == b:
-        print("left")
-    else:
-        print("right")
-

🟢 Magic Trick

Solution in Python
 1
+n = int(input())
+l = []
+for _ in range(n):
+    y, c1, c2 = [int(d) for d in input().split()]
+    g = gcd(c1, c2)
+    l.append(y + g * (c1 // g) * (c2 // g))
+print(min(l))
+

🟢 Logic Functions

Solution in C++
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
#include "logicfunctions.h"
+
+// Compute xor
+void exclusive(bool x, bool y, bool &ans)
+{
+    ans = x != y;
+}
+
+// Compute implication
+void implies(bool x, bool y, bool &ans)
+{
+    if (x && !y)
+    {
+        ans = false;
+    }
+    else
+    {
+        ans = true;
+    }
+}
+
+// Compute equivalence
+void equivalence(bool x, bool y, bool &ans)
+{
+    ans = x == y;
+}
+

🟢 Longest Prime Sum

Solutions in 3 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
package main
+
+import (
+    "fmt"
+)
+
+func main() {
+    var n int
+    fmt.Scan(&n)
+    fmt.Println(n / 2)
+}
+
print(io.read("*n")//2)
+
print(int(input()) // 2)
+

🟢 Lost Lineup

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
n = int(input())
+order = [int(d) for d in input().split()]
+d = range(1, n)
+order = dict(zip(d, order))
+ranges = range(1, n + 1)
+result = ["1"]
+for k in sorted(order, key=lambda x: order[x]):
+    result.append(str(ranges[k]))
+print(" ".join(result))
+

🟢 Lubbi Lærir

Solution in Python
print(input()[0])
+

🟢 Luhn's Checksum Algorithm

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
for _ in range(int(input())):
+    n = input()[::-1]
+    checksum = 0
+    for i in range(len(n)):
+        s = int(n[i]) * (i % 2 + 1)
+        if s > 9:
+            s = sum([int(d) for d in str(s)])
+        checksum += s
+
+    print("FAIL" if checksum % 10 else "PASS")
+

🟢 Mæting

Solution in Python
 1
  2
  3
  4
@@ -9391,97 +9361,67 @@
  7
  8
  9
-10
s = input()
-counter = {}
-guess = 1
-for c in s:
-    if c in counter:
-        guess = 0
-        break
-    else:
-        counter[c] = None
-print(guess)
-

🟢 Making A Meowth

Solutions in 2 languages
1
-2
n, p, x, y = io.read("*n", "*n", "*n", "*n")
-print(p * x + p // (n - 1) * y)
-
1
-2
n, p, x, y = [int(d) for d in input().split()]
-print(p * x + p // (n - 1) * y)
-

🟢 Identifying Map Tiles

Solutions in 2 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
package main
-
-import (
-    "fmt"
-    "math"
-)
-
-func main() {
-    var s string
-    fmt.Scanln(&s)
-    zoom := len(s)
-    var x, y float64
-    for i := 0; i < zoom; i++ {
-        d := math.Pow(2, float64(zoom)-float64(i)-1)
-        if s[i] == '1' {
-            x += d
-        } else if s[i] == '2' {
-            y += d
-        } else if s[i] == '3' {
-            x += d
-            y += d
-        }
-    }
-    fmt.Printf("%d %d %d", zoom, int64(x), int64(y))
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
s = input()
-x, y = 0, 0
-zoom = len(s)
-for i in range(len(s)):
-    d = 2 ** (zoom - i - 1)
-    if s[i] == "1":
-        x += d
-    elif s[i] == "2":
-        y += d
-    elif s[i] == "3":
-        x += d
-        y += d
-print(f"{zoom} {x} {y}")
-

🟢 Marko

Solution in Python
 1
+10
+11
+12
+13
+14
+15
from collections import Counter
+
+d = Counter()
+for _ in range(int(input())):
+    d[input()] = 0
+
+for _ in range(int(input())):
+    l = input().split()
+    if len(l) == 1:
+        continue
+    for n in l[1:]:
+        d[n] += 1
+
+for k in sorted(d, key=lambda k: -d[k]):
+    print(d[k], k)
+

🟢 Mætingarlisti

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
n, r, c = [int(d) for d in input().split()]
+a = [input().split() for _ in range(r)]
+for i in range(r):
+    b = [input() for _ in range(c)]
+    if a[i] == b:
+        print("left")
+    else:
+        print("right")
+

🟢 Magic Trick

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
s = input()
+counter = {}
+guess = 1
+for c in s:
+    if c in counter:
+        guess = 0
+        break
+    else:
+        counter[c] = None
+print(guess)
+

🟢 Making A Meowth

Solutions in 2 languages
1
+2
n, p, x, y = io.read("*n", "*n", "*n", "*n")
+print(p * x + p // (n - 1) * y)
+
1
+2
n, p, x, y = [int(d) for d in input().split()]
+print(p * x + p // (n - 1) * y)
+

🟢 Identifying Map Tiles

Solutions in 2 languages
 1
  2
  3
  4
@@ -9503,82 +9443,118 @@
 20
 21
 22
-23
mapping = {
-    "2": "abc",
-    "3": "def",
-    "4": "ghi",
-    "5": "jkl",
-    "6": "mno",
-    "7": "pqrs",
-    "8": "tuv",
-    "9": "wxyz",
-}
-n = []
-for _ in range(int(input())):
-    w = input()
-    t = ""
-    for c in w:
-        for d, r in mapping.items():
-            if c in r:
-                t += d
-                break
-    n.append(t)
-
-d = input()
-print(sum([d == t for t in n]))
-

🟢 Mars Window

Solutions in 2 languages
1
-2
-3
-4
-5
-6
y = io.read("*n")
-if 26 - ((y - 2018) * 12 - 4) % 26 <= 12 then
-    print("YES")
-else
-    print("NO")
-end
-
1
-2
y = int(input())
-print("YES" if 26 - ((y - 2018) * 12 - 4) % 26 <= 12 else "NO")
-

🟢 Math Homework

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
b, d, c, l = [int(d) for d in input().split()]
-solved = False
-for i in range(l // b + 1):
-    for j in range((l - b * i) // d + 1):
-        for k in range((l - b * i - d * j) // c + 1):
-            if b * i + d * j + c * k == l:
-                print(i, j, k)
-                solved = True
-if not solved:
-    print("impossible")
-

🟢 Mean Words

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
n = int(input())
-words = []
-for _ in range(n):
-    words.append(input())
-m = max([len(w) for w in words])
-ans = []
-for i in range(m):
-    values = [ord(w[i]) for w in words if len(w) > i]
-    ans.append(sum(values) // len(values))
-print("".join(chr(d) for d in ans))
-

🟢 Imperial Measurement

Solution in Python
 1
+23
+24
+25
package main
+
+import (
+    "fmt"
+    "math"
+)
+
+func main() {
+    var s string
+    fmt.Scanln(&s)
+    zoom := len(s)
+    var x, y float64
+    for i := 0; i < zoom; i++ {
+        d := math.Pow(2, float64(zoom)-float64(i)-1)
+        if s[i] == '1' {
+            x += d
+        } else if s[i] == '2' {
+            y += d
+        } else if s[i] == '3' {
+            x += d
+            y += d
+        }
+    }
+    fmt.Printf("%d %d %d", zoom, int64(x), int64(y))
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
s = input()
+x, y = 0, 0
+zoom = len(s)
+for i in range(len(s)):
+    d = 2 ** (zoom - i - 1)
+    if s[i] == "1":
+        x += d
+    elif s[i] == "2":
+        y += d
+    elif s[i] == "3":
+        x += d
+        y += d
+print(f"{zoom} {x} {y}")
+

🟢 Marko

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
mapping = {
+    "2": "abc",
+    "3": "def",
+    "4": "ghi",
+    "5": "jkl",
+    "6": "mno",
+    "7": "pqrs",
+    "8": "tuv",
+    "9": "wxyz",
+}
+n = []
+for _ in range(int(input())):
+    w = input()
+    t = ""
+    for c in w:
+        for d, r in mapping.items():
+            if c in r:
+                t += d
+                break
+    n.append(t)
+
+d = input()
+print(sum([d == t for t in n]))
+

🟢 Mars Window

Solutions in 2 languages
1
+2
+3
+4
+5
+6
y = io.read("*n")
+if 26 - ((y - 2018) * 12 - 4) % 26 <= 12 then
+    print("YES")
+else
+    print("NO")
+end
+
1
+2
y = int(input())
+print("YES" if 26 - ((y - 2018) * 12 - 4) % 26 <= 12 else "NO")
+

🟢 Math Homework

Solution in Python
 1
  2
  3
  4
@@ -9587,60 +9563,36 @@
  7
  8
  9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
mapping = {
-    "th": "thou",
-    "in": "inch",
-    "ft": "foot",
-    "yd": "yard",
-    "ch": "chain",
-    "fur": "furlong",
-    "mi": "mile",
-    "lea": "league",
-}
-names = list(mapping.values())
-scale = [1, 1000, 12, 3, 22, 10, 8, 3]
-
-v, a, _, b = input().split()
-v = int(v)
-na, nb = mapping.get(a, a), mapping.get(b, b)
-ia, ib = names.index(na), names.index(nb)
-
-rate = 1
-for s in scale[min(ia, ib) + 1 : max(ia, ib) + 1]:
-    rate *= s
-
-print(v * rate if ia > ib else v / rate)
-

🟢 Message

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
n, m = [int(d) for d in input().split()]
-cells = []
+10
b, d, c, l = [int(d) for d in input().split()]
+solved = False
+for i in range(l // b + 1):
+    for j in range((l - b * i) // d + 1):
+        for k in range((l - b * i - d * j) // c + 1):
+            if b * i + d * j + c * k == l:
+                print(i, j, k)
+                solved = True
+if not solved:
+    print("impossible")
+

🟢 Mean Words

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
n = int(input())
+words = []
 for _ in range(n):
-    cells.append(input())
-message = ""
-for j in range(m):
-    for i in range(n):
-        message += cells[i][j] if cells[i][j] != "." else ""
-print(message)
-

🟡 Meow Factor

Solution in Python
 1
+    words.append(input())
+m = max([len(w) for w in words])
+ans = []
+for i in range(m):
+    values = [ord(w[i]) for w in words if len(w) > i]
+    ans.append(sum(values) // len(values))
+print("".join(chr(d) for d in ans))
+

🟢 Imperial Measurement

Solution in Python
 1
  2
  3
  4
@@ -9656,254 +9608,286 @@
 14
 15
 16
-17
from collections import Counter
-from math import ceil, sqrt
-
-c = Counter({1: 9})
-n = int(input())
-for i in range(2, ceil(sqrt(n))):
-    while n % i == 0:
-        c[i] += 1
-        n //= i
-    if i**9 >= n:
-        break
-
-t = 1
-for k, v in c.items():
-    if v >= 9:
-        t *= k ** (v // 9)
-print(t)
-

🟢 Metaprogramming

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
c = {}
-while True:
-    try:
-        s = input()
-    except:
-        break
-    parts = s.split()
-    if parts[0] == "define":
-        v, n = parts[1:]
-        c[n] = int(v)
-    elif parts[0] == "eval":
-        x, y, z = parts[1:]
-        if x not in c or z not in c:
-            print("undefined")
-        elif y == "=":
-            print("true" if c[x] == c[z] else "false")
-        elif y == ">":
-            print("true" if c[x] > c[z] else "false")
-        elif y == "<":
-            print("true" if c[x] < c[z] else "false")
-

🟢 Methodic Multiplication

Solution in Python
1
-2
-3
a, b = input(), input()
-t = a.count("S") * b.count("S")
-print("S(" * t + "0" + ")" * t)
-

🟢 Metronome

Solutions in 2 languages
1
-2
n = io.read("*n")
-print(string.format("%.2f", n / 4))
-
1
-2
n = int(input())
-print(f"{n/4:.2f}")
-

🟢 Mia

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
def score(a, b):
-    roll = set([a, b])
-    if roll == {1, 2}:
-        return (3, None)
-    elif len(roll) == 1:
-        return (2, a)
-    else:
-        a, b = min(a, b), max(b, a)
-        return (1, 10 * b + a)
-
-
-while True:
-    rolls = [int(d) for d in input().split()]
-    if not any(rolls):
-        break
-    score1 = score(*rolls[:2])
-    score2 = score(*rolls[2:])
-    if score1 == score2:
-        print("Tie.")
-    elif score1[0] == score2[0]:
-        print(f"Player {1 if score1[1] > score2[1] else 2} wins.")
-    else:
-        print(f"Player {1 if score1[0] > score2[0] else 2} wins.")
-

🟢 Miði

Solution in Python
1
-2
-3
-4
-5
n = int(input())
-parts = []
-for _ in range(n):
-    parts.append(input())
-print("".join(p[::-1] for p in parts[::-1]))
-

🟢 Millifærsla

Solution in Python
1
-2
-3
-4
names, fees = ["Monnei", "Fjee", "Dolladollabilljoll"], []
-for _ in range(3):
-    fees.append(int(input()))
-print(names[fees.index(min(fees))])
-

🟢 Minesweeper

Solution in Python
1
+17
+18
+19
+20
+21
+22
+23
mapping = {
+    "th": "thou",
+    "in": "inch",
+    "ft": "foot",
+    "yd": "yard",
+    "ch": "chain",
+    "fur": "furlong",
+    "mi": "mile",
+    "lea": "league",
+}
+names = list(mapping.values())
+scale = [1, 1000, 12, 3, 22, 10, 8, 3]
+
+v, a, _, b = input().split()
+v = int(v)
+na, nb = mapping.get(a, a), mapping.get(b, b)
+ia, ib = names.index(na), names.index(nb)
+
+rate = 1
+for s in scale[min(ia, ib) + 1 : max(ia, ib) + 1]:
+    rate *= s
+
+print(v * rate if ia > ib else v / rate)
+

🟢 Message

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
n, m = [int(d) for d in input().split()]
+cells = []
+for _ in range(n):
+    cells.append(input())
+message = ""
+for j in range(m):
+    for i in range(n):
+        message += cells[i][j] if cells[i][j] != "." else ""
+print(message)
+

🟡 Meow Factor

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
from collections import Counter
+from math import ceil, sqrt
+
+c = Counter({1: 9})
+n = int(input())
+for i in range(2, ceil(sqrt(n))):
+    while n % i == 0:
+        c[i] += 1
+        n //= i
+    if i**9 >= n:
+        break
+
+t = 1
+for k, v in c.items():
+    if v >= 9:
+        t *= k ** (v // 9)
+print(t)
+

🟢 Metaprogramming

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
c = {}
+while True:
+    try:
+        s = input()
+    except:
+        break
+    parts = s.split()
+    if parts[0] == "define":
+        v, n = parts[1:]
+        c[n] = int(v)
+    elif parts[0] == "eval":
+        x, y, z = parts[1:]
+        if x not in c or z not in c:
+            print("undefined")
+        elif y == "=":
+            print("true" if c[x] == c[z] else "false")
+        elif y == ">":
+            print("true" if c[x] > c[z] else "false")
+        elif y == "<":
+            print("true" if c[x] < c[z] else "false")
+

🟢 Methodic Multiplication

Solution in Python
1
+2
+3
a, b = input(), input()
+t = a.count("S") * b.count("S")
+print("S(" * t + "0" + ")" * t)
+

🟢 Metronome

Solutions in 2 languages
1
+2
n = io.read("*n")
+print(string.format("%.2f", n / 4))
+
1
+2
n = int(input())
+print(f"{n/4:.2f}")
+

🟢 Mia

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
def score(a, b):
+    roll = set([a, b])
+    if roll == {1, 2}:
+        return (3, None)
+    elif len(roll) == 1:
+        return (2, a)
+    else:
+        a, b = min(a, b), max(b, a)
+        return (1, 10 * b + a)
+
+
+while True:
+    rolls = [int(d) for d in input().split()]
+    if not any(rolls):
+        break
+    score1 = score(*rolls[:2])
+    score2 = score(*rolls[2:])
+    if score1 == score2:
+        print("Tie.")
+    elif score1[0] == score2[0]:
+        print(f"Player {1 if score1[1] > score2[1] else 2} wins.")
+    else:
+        print(f"Player {1 if score1[0] > score2[0] else 2} wins.")
+

🟢 Miði

Solution in Python
1
 2
 3
 4
-5
-6
-7
-8
n, m, k = [int(d) for d in input().split()]
-b = []
+5
n = int(input())
+parts = []
 for _ in range(n):
-    b.append(list("." * m))
-for _ in range(k):
-    i, j = [int(d) - 1 for d in input().split()]
-    b[i][j] = "*"
-print("\n".join("".join(r) for r in b))
-

🟢 Minimum Scalar Product

Solution in Python
1
+    parts.append(input())
+print("".join(p[::-1] for p in parts[::-1]))
+

🟢 Millifærsla

Solution in Python
1
 2
 3
-4
-5
-6
-7
t = int(input())
-for i in range(t):
-    _ = input()
-    a = sorted([int(d) for d in input().split()])
-    b = sorted([int(d) for d in input().split()], reverse=True)
-    v = sum(x * y for x, y in zip(a, b))
-    print(f"Case #{i+1}: {v}")
-

🟢 Missing Numbers

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
numbers = []
-for _ in range(int(input())):
-    numbers.append(int(input()))
-
-is_good_job = True
-for i in range(1, max(numbers) + 1):
-    if i not in numbers:
-        is_good_job = False
-        print(i)
-
-if is_good_job:
-    print("good job")
-

🟢 Mixed Fractions

Solution in Python
1
+4
names, fees = ["Monnei", "Fjee", "Dolladollabilljoll"], []
+for _ in range(3):
+    fees.append(int(input()))
+print(names[fees.index(min(fees))])
+

🟢 Minesweeper

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
n, m, k = [int(d) for d in input().split()]
+b = []
+for _ in range(n):
+    b.append(list("." * m))
+for _ in range(k):
+    i, j = [int(d) - 1 for d in input().split()]
+    b[i][j] = "*"
+print("\n".join("".join(r) for r in b))
+

🟢 Minimum Scalar Product

Solution in Python
1
 2
 3
 4
 5
 6
-7
while True:
-    m, n = [int(d) for d in input().split()]
-    if not m and not n:
-        break
-    a = m // n
-    b = m % n
-    print(f"{a} {b} / {n}")
-

🟢 Mjehuric

Solution in Python
1
-2
-3
-4
-5
-6
f = input().split()
-while f != [str(d) for d in range(1, 6)]:
-    for i in range(4):
-        if f[i] > f[i + 1]:
-            f[i], f[i + 1] = f[i + 1], f[i]
-            print(" ".join(f))
-

🟢 Moderate Pace

Solution in Python
1
+7
t = int(input())
+for i in range(t):
+    _ = input()
+    a = sorted([int(d) for d in input().split()])
+    b = sorted([int(d) for d in input().split()], reverse=True)
+    v = sum(x * y for x, y in zip(a, b))
+    print(f"Case #{i+1}: {v}")
+

🟢 Missing Numbers

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
numbers = []
+for _ in range(int(input())):
+    numbers.append(int(input()))
+
+is_good_job = True
+for i in range(1, max(numbers) + 1):
+    if i not in numbers:
+        is_good_job = False
+        print(i)
+
+if is_good_job:
+    print("good job")
+

🟢 Mixed Fractions

Solution in Python
1
 2
 3
-4
n = int(input())
-distances = [[int(d) for d in input().split()] for _ in range(3)]
-plan = [sorted([d[i] for d in distances])[1] for i in range(n)]
-print(" ".join([str(d) for d in plan]))
-

🟢 Modulo

Solution in Python
1
+4
+5
+6
+7
while True:
+    m, n = [int(d) for d in input().split()]
+    if not m and not n:
+        break
+    a = m // n
+    b = m % n
+    print(f"{a} {b} / {n}")
+

🟢 Mjehuric

Solution in Python
1
 2
 3
-4
n = set()
-for _ in range(10):
-    n.add(int(input()) % 42)
-print(len(n))
-

🟢 Monopoly

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
n = int(input())
-a = [int(d) for d in input().split()]
-t = 0
-m = 0
-for i in range(1, 7):
-    for j in range(1, 7):
-        t += 1
-        if i + j in a:
-            m += 1
-print(m / t)
-

🟢 Moscow Dream

Solution in Python
1
+4
+5
+6
f = input().split()
+while f != [str(d) for d in range(1, 6)]:
+    for i in range(4):
+        if f[i] > f[i + 1]:
+            f[i], f[i + 1] = f[i + 1], f[i]
+            print(" ".join(f))
+

🟢 Moderate Pace

Solution in Python
1
+2
+3
+4
n = int(input())
+distances = [[int(d) for d in input().split()] for _ in range(3)]
+plan = [sorted([d[i] for d in distances])[1] for i in range(n)]
+print(" ".join([str(d) for d in plan]))
+

🟢 Modulo

Solution in Python
1
 2
 3
-4
-5
-6
a, b, c, n = [int(d) for d in input().split()]
-
-if not all(d > 0 for d in [a, b, c]):
-    print("NO")
-else:
-    print("YES" if a + b + c >= n and n >= 3 else "NO")
-

🟢 Mosquito Multiplication

Solution in Python
 1
+4
n = set()
+for _ in range(10):
+    n.add(int(input()) % 42)
+print(len(n))
+

🟢 Monopoly

Solution in Python
 1
  2
  3
  4
@@ -9912,124 +9896,124 @@
  7
  8
  9
-10
-11
while True:
-    try:
-        m, p, l, e, r, s, n = [int(d) for d in input().split()]
-    except:
-        break
-    for _ in range(n):
-        pp = p
-        p = l // r
-        l = e * m
-        m = pp // s
-    print(m)
-

🟢 Moving Day

Solutions in 2 languages
1
+10
n = int(input())
+a = [int(d) for d in input().split()]
+t = 0
+m = 0
+for i in range(1, 7):
+    for j in range(1, 7):
+        t += 1
+        if i + j in a:
+            m += 1
+print(m / t)
+

🟢 Moscow Dream

Solution in Python
1
 2
 3
 4
 5
-6
-7
n, v = io.read("*n", "*n")
-b = {}
-for i = 1, n do
-    l, w, h = io.read("*n", "*n", "*n")
-    b[i] = (l * w * h)
-end
-print(math.max(table.unpack(b)) - v)
-
1
-2
-3
-4
-5
-6
n, v = [int(d) for d in input().split()]
-b = []
-for _ in range(n):
-    l, w, h = [int(d) for d in input().split()]
-    b.append(l * w * h)
-print(max(b) - v)
-

🟢 MrCodeFormatGrader

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
def f(numbers):
-    prev = numbers[0]
-    ans = {prev: 1}
-    for i in range(1, len(numbers)):
-        if numbers[i] == prev + ans[prev]:
-            ans[prev] += 1
-        else:
-            prev = numbers[i]
-            ans[prev] = 1
-
-    parts = [
-        f"{key}-{key+value-1}"
-        if value > 1
-        else " ".join([str(d) for d in range(key, key + value)])
-        for key, value in ans.items()
-    ]
-
-    return ", ".join(parts[:-1]) + " and " + parts[-1]
-
-
-c, n = [int(d) for d in input().split()]
-errors = [int(d) for d in input().split()]
-correct = [i for i in range(1, 1 + c) if i not in errors]
-
-print("Errors:", f(errors))
-print("Correct:", f(correct))
-

🟢 Mult!

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
n = int(input())
-b = None
+6
a, b, c, n = [int(d) for d in input().split()]
+
+if not all(d > 0 for d in [a, b, c]):
+    print("NO")
+else:
+    print("YES" if a + b + c >= n and n >= 3 else "NO")
+

🟢 Mosquito Multiplication

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
while True:
+    try:
+        m, p, l, e, r, s, n = [int(d) for d in input().split()]
+    except:
+        break
+    for _ in range(n):
+        pp = p
+        p = l // r
+        l = e * m
+        m = pp // s
+    print(m)
+

🟢 Moving Day

Solutions in 2 languages
1
+2
+3
+4
+5
+6
+7
n, v = io.read("*n", "*n")
+b = {}
+for i = 1, n do
+    l, w, h = io.read("*n", "*n", "*n")
+    b[i] = (l * w * h)
+end
+print(math.max(table.unpack(b)) - v)
+
1
+2
+3
+4
+5
+6
n, v = [int(d) for d in input().split()]
+b = []
 for _ in range(n):
-    d = int(input())
-    if not b:
-        b = d
-        continue
-
-    if d % b == 0:
-        print(d)
-        b = None
-

🟢 Multiplication

Solution in Python
1
-2
-3
-4
-5
n = int(input())
-p = 1
-for _ in range(n):
-    p *= int(input())
-print(p % (10**9 + 7))
-

🟢 Mumble Rap

Solution in Python
 1
+    l, w, h = [int(d) for d in input().split()]
+    b.append(l * w * h)
+print(max(b) - v)
+

🟢 MrCodeFormatGrader

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
def f(numbers):
+    prev = numbers[0]
+    ans = {prev: 1}
+    for i in range(1, len(numbers)):
+        if numbers[i] == prev + ans[prev]:
+            ans[prev] += 1
+        else:
+            prev = numbers[i]
+            ans[prev] = 1
+
+    parts = [
+        f"{key}-{key+value-1}"
+        if value > 1
+        else " ".join([str(d) for d in range(key, key + value)])
+        for key, value in ans.items()
+    ]
+
+    return ", ".join(parts[:-1]) + " and " + parts[-1]
+
+
+c, n = [int(d) for d in input().split()]
+errors = [int(d) for d in input().split()]
+correct = [i for i in range(1, 1 + c) if i not in errors]
+
+print("Errors:", f(errors))
+print("Correct:", f(correct))
+

🟢 Mult!

Solution in Python
 1
  2
  3
  4
@@ -10039,59 +10023,27 @@
  8
  9
 10
-11
-12
-13
-14
-15
-16
-17
-18
n = int(input())
-s = input()
-a = []
-d = ""
-import string
-
-for i in range(n):
-    if s[i] in string.digits:
-        d += s[i]
-
-    else:
-        if d:
-            a.append(int(d))
-            d = ""
-if d:
-    a.append(int(d))
-
-print(max(a))
-

🟢 Musical Scales

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
notes = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]
-offset = [2, 2, 1, 2, 2, 2]
-majors = {}
-for i in range(len(notes)):
-    name = notes[i]
-    progression = [name]
-    for i in offset:
-        index = (notes.index(progression[-1]) + i) % len(notes)
-        progression.append(notes[index])
-    majors[name] = progression
-
-_ = input()
-scales = set(input().split())
-print(" ".join([n for n in majors if scales < set(majors[n])]) or "none")
-

🟢 Music Your Way

Solution in Python
n = int(input())
+b = None
+for _ in range(n):
+    d = int(input())
+    if not b:
+        b = d
+        continue
+
+    if d % b == 0:
+        print(d)
+        b = None
+

🟢 Multiplication

Solution in Python
1
+2
+3
+4
+5
n = int(input())
+p = 1
+for _ in range(n):
+    p *= int(input())
+print(p % (10**9 + 7))
+

🟢 Mumble Rap

Solution in Python
 1
  2
  3
  4
@@ -10104,21 +10056,29 @@
 11
 12
 13
-14
cols = input().split()
-m = int(input())
-songs = [input().split() for _ in range(m)]
-n = int(input())
-
-for i in range(n):
-    col = input()
-    index = cols.index(col)
-    songs = sorted(songs, key=lambda k: k[index])
-    print(" ".join(cols))
-    for song in songs:
-        print(" ".join(song))
-    if i < n - 1:
-        print()
-

🟢 Mylla

Solution in Python
 1
+14
+15
+16
+17
+18
n = int(input())
+s = input()
+a = []
+d = ""
+import string
+
+for i in range(n):
+    if s[i] in string.digits:
+        d += s[i]
+
+    else:
+        if d:
+            a.append(int(d))
+            d = ""
+if d:
+    a.append(int(d))
+
+print(max(a))
+

🟢 Musical Scales

Solution in Python
 1
  2
  3
  4
@@ -10131,41 +10091,21 @@
 11
 12
 13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
board = []
-for _ in range(3):
-    board.append(list(input()))
-
-winner = ""
-for i in range(3):
-    if board[i][0] == board[i][1] == board[i][2] and board[i][0] != "_":
-        winner = board[i][0]
-        break
-    elif board[0][i] == board[1][i] == board[2][i] and board[0][i] != "_":
-        winner = board[0][i]
-        break
-
-if board[0][0] == board[1][1] == board[2][2] and board[1][1] != "_":
-    winner = board[1][1]
-elif board[0][2] == board[1][1] == board[2][0] and board[1][1] != "_":
-    winner = board[1][1]
-
-if winner == "O":
-    winner = "Jebb"
-else:
-    winner = "Neibb"
-
-print(winner)
-

🟡 Name Generation

Solution in Python
notes = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]
+offset = [2, 2, 1, 2, 2, 2]
+majors = {}
+for i in range(len(notes)):
+    name = notes[i]
+    progression = [name]
+    for i in offset:
+        index = (notes.index(progression[-1]) + i) % len(notes)
+        progression.append(notes[index])
+    majors[name] = progression
+
+_ = input()
+scales = set(input().split())
+print(" ".join([n for n in majors if scales < set(majors[n])]) or "none")
+

🟢 Music Your Way

Solution in Python
 1
  2
  3
  4
@@ -10178,53 +10118,21 @@
 11
 12
 13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
import string
-from random import choice, randint
-
-vowels = set("aeiou")
-consonants = set(string.ascii_lowercase) - vowels
-names = set()
-
-
-def f(w):
-    return "".join([choice(list(consonants)) if c else choice(list(vowels)) for c in w])
-
-
-for _ in range(int(input())):
-    s = randint(3, 20)
-    w = []
-    for i in range(s):
-        if i < 2:
-            w.append(randint(0, 1))
-        else:
-            if w[-1] == w[-2]:
-                w.append((w[-2] + 1) % 2)
-            else:
-                w.append(randint(0, 1))
-
-    name = f(w)
-    while name in names:
-        name = f(w)
-    names.add(name)
-
-    print(name)
-

🟢 Namnsdag

Solution in Python
cols = input().split()
+m = int(input())
+songs = [input().split() for _ in range(m)]
+n = int(input())
+
+for i in range(n):
+    col = input()
+    index = cols.index(col)
+    songs = sorted(songs, key=lambda k: k[index])
+    print(" ".join(cols))
+    for song in songs:
+        print(" ".join(song))
+    if i < n - 1:
+        print()
+

🟢 Mylla

Solution in Python
 1
  2
  3
  4
@@ -10233,17 +10141,45 @@
  7
  8
  9
-10
s = input()
-n = int(input())
-names = [input() for _ in range(n)]
-for i in range(n):
-    if len(s) != len(names[i]):
-        continue
-
-    if sum(a != b for a, b in zip(s, names[i])) <= 1:
-        print(i + 1)
-        break
-

🟢 Nasty Hacks

Solutions in 3 languages
 1
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
board = []
+for _ in range(3):
+    board.append(list(input()))
+
+winner = ""
+for i in range(3):
+    if board[i][0] == board[i][1] == board[i][2] and board[i][0] != "_":
+        winner = board[i][0]
+        break
+    elif board[0][i] == board[1][i] == board[2][i] and board[0][i] != "_":
+        winner = board[0][i]
+        break
+
+if board[0][0] == board[1][1] == board[2][2] and board[1][1] != "_":
+    winner = board[1][1]
+elif board[0][2] == board[1][1] == board[2][0] and board[1][1] != "_":
+    winner = board[1][1]
+
+if winner == "O":
+    winner = "Jebb"
+else:
+    winner = "Neibb"
+
+print(winner)
+

🟡 Name Generation

Solution in Python
 1
  2
  3
  4
@@ -10268,33 +10204,41 @@
 23
 24
 25
-26
#include <iostream>
-
-using namespace std;
-
-int main()
-{
-    int n, r, e, c;
-    cin >> n;
-
-    for (int i = 0; i < n; i++)
-    {
-        cin >> r >> e >> c;
-        if ((e - c) > r)
-        {
-            cout << "advertise";
-        }
-        else if ((e - c) < r)
-        {
-            cout << "do not advertise";
-        }
-        else
-        {
-            cout << "does not matter";
-        }
-    }
-}
-
 1
+26
+27
+28
+29
+30
import string
+from random import choice, randint
+
+vowels = set("aeiou")
+consonants = set(string.ascii_lowercase) - vowels
+names = set()
+
+
+def f(w):
+    return "".join([choice(list(consonants)) if c else choice(list(vowels)) for c in w])
+
+
+for _ in range(int(input())):
+    s = randint(3, 20)
+    w = []
+    for i in range(s):
+        if i < 2:
+            w.append(randint(0, 1))
+        else:
+            if w[-1] == w[-2]:
+                w.append((w[-2] + 1) % 2)
+            else:
+                w.append(randint(0, 1))
+
+    name = f(w)
+    while name in names:
+        name = f(w)
+    names.add(name)
+
+    print(name)
+

🟢 Namnsdag

Solution in Python
 1
  2
  3
  4
@@ -10303,32 +10247,68 @@
  7
  8
  9
-10
for _ = 1, io.read("*n") do
-    r, e, c = io.read("*n", "*n", "*n")
-    if e > r + c then
-        print("advertise")
-    elseif e < r + c then
-        print("do not advertise")
-    else
-        print("does not matter")
-    end
-end
-
1
-2
-3
-4
-5
-6
-7
-8
for _ in range(int(input())):
-    r, e, c = [int(d) for d in input().split()]
-    if e > r + c:
-        print("advertise")
-    elif e < r + c:
-        print("do not advertise")
-    else:
-        print("does not matter")
-

🟢 No Duplicates

Solution in Python
s = input()
+n = int(input())
+names = [input() for _ in range(n)]
+for i in range(n):
+    if len(s) != len(names[i]):
+        continue
+
+    if sum(a != b for a, b in zip(s, names[i])) <= 1:
+        print(i + 1)
+        break
+

🟢 Nasty Hacks

Solutions in 3 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
#include <iostream>
+
+using namespace std;
+
+int main()
+{
+    int n, r, e, c;
+    cin >> n;
+
+    for (int i = 0; i < n; i++)
+    {
+        cin >> r >> e >> c;
+        if ((e - c) > r)
+        {
+            cout << "advertise";
+        }
+        else if ((e - c) < r)
+        {
+            cout << "do not advertise";
+        }
+        else
+        {
+            cout << "does not matter";
+        }
+    }
+}
+
 1
  2
  3
  4
@@ -10337,58 +10317,32 @@
  7
  8
  9
-10
-11
-12
-13
-14
words = input().split()
-
-counter = {}
-repeated = False
-for w in words:
-    if w in counter:
-        repeated = True
-        break
-    else:
-        counter[w] = None
-if repeated:
-    print("no")
-else:
-    print("yes")
-

🟢 NOP

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
s = input()
-i, m, p = 0, {}, None
-
-for c in s:
-    if c.isupper():
-        m[i] = 1
-        p = i
-        i += 1
-    else:
-        m[p] += 1
-
-print(
-    sum(
-        4 - m[k] % 4 if m[k] % 4 else (4 if not m[k] else 0)
-        for k in list(m.keys())[:-1]
-    )
-)
-

🟢 Not Amused

Solution in Python
for _ = 1, io.read("*n") do
+    r, e, c = io.read("*n", "*n", "*n")
+    if e > r + c then
+        print("advertise")
+    elseif e < r + c then
+        print("do not advertise")
+    else
+        print("does not matter")
+    end
+end
+
1
+2
+3
+4
+5
+6
+7
+8
for _ in range(int(input())):
+    r, e, c = [int(d) for d in input().split()]
+    if e > r + c:
+        print("advertise")
+    elif e < r + c:
+        print("do not advertise")
+    else:
+        print("does not matter")
+

🟢 No Duplicates

Solution in Python
 1
  2
  3
  4
@@ -10401,37 +10355,21 @@
 11
 12
 13
-14
-15
-16
-17
-18
-19
-20
-21
-22
from collections import Counter
+14
words = input().split()
 
-d = 1
-while True:
-    try:
-        s = input().split()
-
-        if "OPEN" in s:
-            book = {}
-            t = Counter()
-        elif "ENTER" in s:
-            book[s[1]] = int(s[2])
-        elif "EXIT" in s:
-            t[s[1]] += int(s[2]) - book.pop(s[1])
-        elif "CLOSE" in s:
-            print(f"Day {d}")
-            for k in sorted(t):
-                print(f"{k} ${t[k]/10:.2f}")
-            print()
-            d += 1
-    except:
-        break
-

🟢 No Thanks!

Solution in Python
 1
+counter = {}
+repeated = False
+for w in words:
+    if w in counter:
+        repeated = True
+        break
+    else:
+        counter[w] = None
+if repeated:
+    print("no")
+else:
+    print("yes")
+

🟢 NOP

Solution in Python
 1
  2
  3
  4
@@ -10443,20 +10381,28 @@
 10
 11
 12
-13
n = int(input())
-v = sorted([int(d) for d in input().split()])
+13
+14
+15
+16
+17
s = input()
+i, m, p = 0, {}, None
 
-prev = v[0]
-ans = {prev: 1}
-for i in range(1, n):
-    if v[i] == prev + ans[prev]:
-        ans[prev] += 1
+for c in s:
+    if c.isupper():
+        m[i] = 1
+        p = i
+        i += 1
     else:
-        prev = v[i]
-        ans[prev] = 1
-
-print(sum(ans.keys()))
-

🟢 N-sum

Solutions in 2 languages
 1
+        m[p] += 1
+
+print(
+    sum(
+        4 - m[k] % 4 if m[k] % 4 else (4 if not m[k] else 0)
+        for k in list(m.keys())[:-1]
+    )
+)
+

🟢 Not Amused

Solution in Python
 1
  2
  3
  4
@@ -10468,293 +10414,309 @@
 10
 11
 12
-13
import java.util.Scanner;
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
from collections import Counter
 
-class NSum {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int n = s.nextInt();
-        int ans = 0;
-        for (int i = 0; i < n; i++) {
-            ans += s.nextInt();
-        }
-        System.out.println(ans);
-    }
-}
-
1
-2
-3
-4
-5
_ = int(input())
-numbers = []
-for d in input().split():
-    numbers.append(int(d))
-print(sum(numbers))
-

🟢 Number Fun

Solutions in 2 languages
1
-2
-3
-4
-5
-6
-7
-8
for _ = 1, io.read("*n") do
-    a, b, c = io.read("*n", "*n", "*n")
-    if a + b == c or a * b == c or a - b == c or b - a == c or a == b * c or b == a * c then
-        print("Possible")
-    else
-        print("Impossible")
-    end
-end
+d = 1
+while True:
+    try:
+        s = input().split()
+
+        if "OPEN" in s:
+            book = {}
+            t = Counter()
+        elif "ENTER" in s:
+            book[s[1]] = int(s[2])
+        elif "EXIT" in s:
+            t[s[1]] += int(s[2]) - book.pop(s[1])
+        elif "CLOSE" in s:
+            print(f"Day {d}")
+            for k in sorted(t):
+                print(f"{k} ${t[k]/10:.2f}")
+            print()
+            d += 1
+    except:
+        break
+

🟢 No Thanks!

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
n = int(input())
+v = sorted([int(d) for d in input().split()])
+
+prev = v[0]
+ans = {prev: 1}
+for i in range(1, n):
+    if v[i] == prev + ans[prev]:
+        ans[prev] += 1
+    else:
+        prev = v[i]
+        ans[prev] = 1
+
+print(sum(ans.keys()))
+

🟢 N-sum

Solutions in 2 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
import java.util.Scanner;
+
+class NSum {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int n = s.nextInt();
+        int ans = 0;
+        for (int i = 0; i < n; i++) {
+            ans += s.nextInt();
+        }
+        System.out.println(ans);
+    }
+}
 
1
 2
 3
 4
-5
-6
for _ in range(int(input())):
-    a, b, c = [int(d) for d in input().split()]
-    if a + b == c or a * b == c or a - b == c or b - a == c or a / b == c or b / a == c:
-        print("Possible")
-    else:
-        print("Impossible")
-

🟢 Numbers On a Tree

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
items = input().split()
-if len(items) == 2:
-    h, s = items
-else:
-    h, s = items[0], ""
-
-total, i = 2 ** (int(h) + 1), 1
-
-for c in s:
-    i *= 2
-    if c == "R":
-        i += 1
-
-print(total - i)
-

🟢 Odd Echo

Solution in Python
1
+5
_ = int(input())
+numbers = []
+for d in input().split():
+    numbers.append(int(d))
+print(sum(numbers))
+

🟢 Number Fun

Solutions in 2 languages
1
+2
+3
+4
+5
+6
+7
+8
for _ = 1, io.read("*n") do
+    a, b, c = io.read("*n", "*n", "*n")
+    if a + b == c or a * b == c or a - b == c or b - a == c or a == b * c or b == a * c then
+        print("Possible")
+    else
+        print("Impossible")
+    end
+end
+
1
 2
 3
 4
 5
-6
n = int(input())
-words = []
-for _ in range(n):
-    words.append(input())
-for i in range(0, n, 2):
-    print(words[i])
-

🟢 Odd Gnome

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
n = int(input())
-for _ in range(n):
-    g = [int(d) for d in input().split()][1:]
-    prev = g[0]
-    for i in range(1, len(g)):
-        if g[i] != prev + 1:
-            break
-        prev = g[i]
-    print(i + 1)
-

🟢 Oddities

Solutions in 2 languages
1
+6
for _ in range(int(input())):
+    a, b, c = [int(d) for d in input().split()]
+    if a + b == c or a * b == c or a - b == c or b - a == c or a / b == c or b / a == c:
+        print("Possible")
+    else:
+        print("Impossible")
+

🟢 Numbers On a Tree

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
items = input().split()
+if len(items) == 2:
+    h, s = items
+else:
+    h, s = items[0], ""
+
+total, i = 2 ** (int(h) + 1), 1
+
+for c in s:
+    i *= 2
+    if c == "R":
+        i += 1
+
+print(total - i)
+

🟢 Odd Echo

Solution in Python
1
 2
 3
 4
 5
-6
-7
-8
-9
for _ = 1, io.read("*n") do
-    x = io.read("*n")
-    if x % 2 == 1 then
-        ans = 'odd'
-    else
-        ans = 'even'
-    end
-    print(string.format("%d is %s", x, ans))
-end
-
1
+6
n = int(input())
+words = []
+for _ in range(n):
+    words.append(input())
+for i in range(0, n, 2):
+    print(words[i])
+

🟢 Odd Gnome

Solution in Python
1
 2
 3
 4
 5
 6
 7
-8
n = int(input())
+8
+9
n = int(input())
 for _ in range(n):
-    x = int(input())
-    if x % 2:
-        res = "odd"
-    else:
-        res = "even"
-    print(f"{x} is {res}")
-

🟢 Odd Man Out

Solution in Python
1
+    g = [int(d) for d in input().split()][1:]
+    prev = g[0]
+    for i in range(1, len(g)):
+        if g[i] != prev + 1:
+            break
+        prev = g[i]
+    print(i + 1)
+

🟢 Oddities

Solutions in 2 languages
1
 2
 3
 4
 5
 6
-7
from collections import Counter
-
-n = int(input())
-for i in range(n):
-    _ = input()
-    c = Counter(input().split())
-    print(f"Case #{i+1}: {' '.join(v for v in c if c[v]==1)}")
-

🟢 Off-World Records

Solutions in 3 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
import java.util.Scanner;
-
-class OffWorldRecords {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int n = s.nextInt();
-        int c = s.nextInt();
-        int p = s.nextInt();
-        int ans = 0;
-
-        for (int i = 0; i < n; i++) {
-            int h = s.nextInt();
-            if (h > c + p) {
-                ans += 1;
-                p = c;
-                c = h;
-            }
-        }
-        System.out.println(ans);
-    }
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
n, c, p = io.read("*n", "*n", "*n")
-ans = 0
-for _ = 1, n do
-    h = io.read("*n")
-    if h > c + p then
-        ans = ans + 1
-        c, p = h, c
-    end
-end
-print(ans)
-
1
-2
-3
-4
-5
-6
-7
-8
n, c, p = [int(d) for d in input().split()]
-ans = 0
-for _ in range(n):
-    h = int(input())
-    if h > c + p:
-        ans += 1
-        c, p = h, c
-print(ans)
-

🟢 Öfugsnúið

Solution in Python
1
-2
-3
-4
-5
-6
n = int(input())
-numbers = []
-for _ in range(n):
-    numbers.append(int(input()))
-for d in numbers[::-1]:
-    print(d)
-

🟢 Oktalni

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
import math
-
-mapping = {
-    "000": "0",
-    "001": "1",
-    "010": "2",
-    "011": "3",
-    "100": "4",
-    "101": "5",
-    "110": "6",
-    "111": "7",
-}
-b = input()
-length = 3 * math.ceil(len(b) / 3)
-b = b.zfill(length)
-
-print("".join([mapping[b[i : i + 3]] for i in range(0, length, 3)]))
-

🟢 One Chicken Per Person!

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
n, m = [int(d) for d in input().split()]
-
-diff = n - m
-if diff > 0:
-    print(f"Dr. Chaz needs {diff} more piece{'s' if diff >1 else ''} of chicken!")
-else:
-    diff = abs(diff)
-    print(
-        f"Dr. Chaz will have {diff} piece{'s' if diff >1 else ''} of chicken left over!"
-    )
-

🟢 Ordered Problem Set

Solution in Python
 1
+7
+8
+9
for _ = 1, io.read("*n") do
+    x = io.read("*n")
+    if x % 2 == 1 then
+        ans = 'odd'
+    else
+        ans = 'even'
+    end
+    print(string.format("%d is %s", x, ans))
+end
+
1
+2
+3
+4
+5
+6
+7
+8
n = int(input())
+for _ in range(n):
+    x = int(input())
+    if x % 2:
+        res = "odd"
+    else:
+        res = "even"
+    print(f"{x} is {res}")
+

🟢 Odd Man Out

Solution in Python
1
+2
+3
+4
+5
+6
+7
from collections import Counter
+
+n = int(input())
+for i in range(n):
+    _ = input()
+    c = Counter(input().split())
+    print(f"Case #{i+1}: {' '.join(v for v in c if c[v]==1)}")
+

🟢 Off-World Records

Solutions in 3 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
import java.util.Scanner;
+
+class OffWorldRecords {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int n = s.nextInt();
+        int c = s.nextInt();
+        int p = s.nextInt();
+        int ans = 0;
+
+        for (int i = 0; i < n; i++) {
+            int h = s.nextInt();
+            if (h > c + p) {
+                ans += 1;
+                p = c;
+                c = h;
+            }
+        }
+        System.out.println(ans);
+    }
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
n, c, p = io.read("*n", "*n", "*n")
+ans = 0
+for _ = 1, n do
+    h = io.read("*n")
+    if h > c + p then
+        ans = ans + 1
+        c, p = h, c
+    end
+end
+print(ans)
+
1
+2
+3
+4
+5
+6
+7
+8
n, c, p = [int(d) for d in input().split()]
+ans = 0
+for _ in range(n):
+    h = int(input())
+    if h > c + p:
+        ans += 1
+        c, p = h, c
+print(ans)
+

🟢 Öfugsnúið

Solution in Python
1
+2
+3
+4
+5
+6
n = int(input())
+numbers = []
+for _ in range(n):
+    numbers.append(int(input()))
+for d in numbers[::-1]:
+    print(d)
+

🟢 Oktalni

Solution in Python
 1
  2
  3
  4
@@ -10768,39 +10730,45 @@
 12
 13
 14
-15
n = int(input())
-d = [int(input()) for _ in range(n)]
-ans = []
-for i in range(2, n + 1):
-    if n % i:
-        continue
-    f = True
-    k = n // i
-    for j in range(k, n, k):
-        if max(d[j - k : j]) >= min(d[j : j + k]):
-            f = False
-            break
-    if f:
-        ans.append(str(i))
-print("\n".join(ans) if ans else -1)
-

🟢 Ordinals

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
def f(n):
-    if n == 0:
-        return "{}"
-    else:
-        ans = ",".join([f(i) for i in range(n)])
-        return "{" + ans + "}"
-
-
-print(f(int(input())))
-

🟢 Ornaments

Solution in Python
 1
+15
+16
+17
import math
+
+mapping = {
+    "000": "0",
+    "001": "1",
+    "010": "2",
+    "011": "3",
+    "100": "4",
+    "101": "5",
+    "110": "6",
+    "111": "7",
+}
+b = input()
+length = 3 * math.ceil(len(b) / 3)
+b = b.zfill(length)
+
+print("".join([mapping[b[i : i + 3]] for i in range(0, length, 3)]))
+

🟢 One Chicken Per Person!

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
n, m = [int(d) for d in input().split()]
+
+diff = n - m
+if diff > 0:
+    print(f"Dr. Chaz needs {diff} more piece{'s' if diff >1 else ''} of chicken!")
+else:
+    diff = abs(diff)
+    print(
+        f"Dr. Chaz will have {diff} piece{'s' if diff >1 else ''} of chicken left over!"
+    )
+

🟢 Ordered Problem Set

Solution in Python
 1
  2
  3
  4
@@ -10810,29 +10778,43 @@
  8
  9
 10
-11
import math
-
-while True:
-    r, h, s = [int(d) for d in input().split()]
-    if not r and not h and not s:
-        break
-    l = math.sqrt(h**2 - r**2) * 2
-    a = math.pi - math.acos(r / h)
-    l += 2 * math.pi * r * (a / math.pi)
-    l *= 1 + s / 100
-    print(f"{l:.2f}")
-

🟢 Östgötska

Solution in Python
1
+11
+12
+13
+14
+15
n = int(input())
+d = [int(input()) for _ in range(n)]
+ans = []
+for i in range(2, n + 1):
+    if n % i:
+        continue
+    f = True
+    k = n // i
+    for j in range(k, n, k):
+        if max(d[j - k : j]) >= min(d[j : j + k]):
+            f = False
+            break
+    if f:
+        ans.append(str(i))
+print("\n".join(ans) if ans else -1)
+

🟢 Ordinals

Solution in Python
1
 2
 3
 4
 5
-6
sentence = input()
-words = sentence.split()
-if len([w for w in words if "ae" in w]) / len(words) >= 0.4:
-    print("dae ae ju traeligt va")
-else:
-    print("haer talar vi rikssvenska")
-

🟢 Overdraft

Solutions in 2 languages
 1
+6
+7
+8
+9
def f(n):
+    if n == 0:
+        return "{}"
+    else:
+        ans = ",".join([f(i) for i in range(n)])
+        return "{" + ans + "}"
+
+
+print(f(int(input())))
+

🟢 Ornaments

Solution in Python
 1
  2
  3
  4
@@ -10842,51 +10824,29 @@
  8
  9
 10
-11
-12
-13
-14
-15
n = io.read("*n")
-s = 0
-b = 0
-for _ = 1, n do
-    t = io.read("*n")
-    if t > 0 then
-        b = b + t
-    elseif b + t < 0 then
-        s = s - (b + t)
-        b = 0
-    else
-        b = b + t
-    end
-end
-print(s)
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
n = int(input())
-s = 0
-b = 0
-for _ in range(n):
-    t = int(input())
-    if t > 0:
-        b += t
-    elif b + t < 0:
-        s -= b + t
-        b = 0
-    else:
-        b += t
-print(s)
-

🟢 Óvissa

Solutions in 3 languages
import math
+
+while True:
+    r, h, s = [int(d) for d in input().split()]
+    if not r and not h and not s:
+        break
+    l = math.sqrt(h**2 - r**2) * 2
+    a = math.pi - math.acos(r / h)
+    l += 2 * math.pi * r * (a / math.pi)
+    l *= 1 + s / 100
+    print(f"{l:.2f}")
+

🟢 Östgötska

Solution in Python
1
+2
+3
+4
+5
+6
sentence = input()
+words = sentence.split()
+if len([w for w in words if "ae" in w]) / len(words) >= 0.4:
+    print("dae ae ju traeligt va")
+else:
+    print("haer talar vi rikssvenska")
+

🟢 Overdraft

Solutions in 2 languages
 1
  2
  3
  4
@@ -10897,115 +10857,79 @@
  9
 10
 11
-12
package main
-
-import (
-    "fmt"
-    "strings"
-)
-
-func main() {
-    var s string
-    fmt.Scan(&s)
-    fmt.Println(strings.Count(s, "u"))
-}
-
1
-2
-3
s = io.read()
-_, count = string.gsub(s, "u", "")
-print(count)
-
print(input().count("u"))
-

🟢 The Owl and the Fox

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
def sd(n):
-    return sum([int(d) for d in str(n)])
-
-
-for _ in range(int(input())):
-    n = int(input())
-    s = sd(n) - 1
-    d = n - 1
-    while True:
-        if sd(d) == s:
-            break
-        d -= 1
-    print(d)
-

🟢 Pachyderm Peanut Packing

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
def inbox(coords, x, y):
-    if x >= coords[0] and x <= coords[2] and y >= coords[1] and y <= coords[3]:
-        return True
-    return False
-
-
-while True:
-    n = int(input())
-    if not n:
-        break
-    box = {}
-    for i in range(n):
-        desc = input().split()
-        size = desc[-1]
-        coords = [float(d) for d in desc[:-1]]
-        box[i] = (coords, size)
-    m = int(input())
-    for _ in range(m):
-        desc = input().split()
-        size = desc[-1]
-        x, y = [float(d) for d in desc[:-1]]
-        floor = True
-        for i in range(n):
-            coords, box_size = box[i]
-            if inbox(coords, x, y):
-                floor = False
-                break
-        if floor:
-            status = "floor"
-        else:
-            status = "correct" if box_size == size else box_size
-        print(size, status)
-    print()
-

🟢 Packagemanager

Solution in Python
 1
+12
+13
+14
+15
n = io.read("*n")
+s = 0
+b = 0
+for _ = 1, n do
+    t = io.read("*n")
+    if t > 0 then
+        b = b + t
+    elseif b + t < 0 then
+        s = s - (b + t)
+        b = 0
+    else
+        b = b + t
+    end
+end
+print(s)
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
n = int(input())
+s = 0
+b = 0
+for _ in range(n):
+    t = int(input())
+    if t > 0:
+        b += t
+    elif b + t < 0:
+        s -= b + t
+        b = 0
+    else:
+        b += t
+print(s)
+

🟢 Óvissa

Solutions in 3 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
package main
+
+import (
+    "fmt"
+    "strings"
+)
+
+func main() {
+    var s string
+    fmt.Scan(&s)
+    fmt.Println(strings.Count(s, "u"))
+}
+
1
+2
+3
s = io.read()
+_, count = string.gsub(s, "u", "")
+print(count)
+
print(input().count("u"))
+

🟢 The Owl and the Fox

Solution in Python
 1
  2
  3
  4
@@ -11017,22 +10941,20 @@
 10
 11
 12
-13
-14
t, b = [int(d) for d in input().split()]
-s = [int(d) for d in input().split()]
-p = {}
-for _ in range(t):
-    k, v = input().split()
-    v = int(v)
-    p[k] = v
-for n in s:
-    res = 0
-    for _ in range(n):
-        k, v = input().split()
-        v = int(v)
-        res += p[k] - v
-    print(res)
-

🟢 Pallatölur

Solutions in 3 languages
def sd(n):
+    return sum([int(d) for d in str(n)])
+
+
+for _ in range(int(input())):
+    n = int(input())
+    s = sd(n) - 1
+    d = n - 1
+    while True:
+        if sd(d) == s:
+            break
+        d -= 1
+    print(d)
+

🟢 Pachyderm Peanut Packing

Solution in Python
 1
  2
  3
  4
@@ -11047,95 +10969,139 @@
 13
 14
 15
-16
package main
-
-import "fmt"
-
-func main() {
-    var a, b int
-    fmt.Scan(&a)
-    fmt.Scan(&b)
-
-    if (a <= 2) && (2 <= b) {
-        fmt.Println("1")
-        fmt.Println("2")
-    } else {
-        fmt.Println(":(")
-    }
-}
-
1
-2
-3
-4
-5
-6
-7
a, b = io.read("*n", "*n")
-if (a <= 2) and (2 <= b) then
-    print(1)
-    print(2)
-else
-    print(":(")
-end
-
1
-2
-3
-4
-5
-6
a, b = int(input()), int(input())
-if 2 in range(a, b + 1):
-    print(1)
-    print(2)
-else:
-    print(":(")
-

🟢 Parent Gap

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
from datetime import datetime
-
-year = int(input())
-
-mother = datetime(year, 5, 1).isoweekday()
-father = datetime(year, 6, 1).isoweekday()
-
-x = 7 - mother
-y = 7 - father
-daymother = 1 + x + 7
-dayfather = 1 + y + 14
-
-daymother = datetime(year, 5, daymother)
-dayfather = datetime(year, 6, dayfather)
-
-print(((dayfather - daymother).days) // 7, "weeks")
-

🟢 Parket

Solution in Python
1
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
def inbox(coords, x, y):
+    if x >= coords[0] and x <= coords[2] and y >= coords[1] and y <= coords[3]:
+        return True
+    return False
+
+
+while True:
+    n = int(input())
+    if not n:
+        break
+    box = {}
+    for i in range(n):
+        desc = input().split()
+        size = desc[-1]
+        coords = [float(d) for d in desc[:-1]]
+        box[i] = (coords, size)
+    m = int(input())
+    for _ in range(m):
+        desc = input().split()
+        size = desc[-1]
+        x, y = [float(d) for d in desc[:-1]]
+        floor = True
+        for i in range(n):
+            coords, box_size = box[i]
+            if inbox(coords, x, y):
+                floor = False
+                break
+        if floor:
+            status = "floor"
+        else:
+            status = "correct" if box_size == size else box_size
+        print(size, status)
+    print()
+

🟢 Packagemanager

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
t, b = [int(d) for d in input().split()]
+s = [int(d) for d in input().split()]
+p = {}
+for _ in range(t):
+    k, v = input().split()
+    v = int(v)
+    p[k] = v
+for n in s:
+    res = 0
+    for _ in range(n):
+        k, v = input().split()
+        v = int(v)
+        res += p[k] - v
+    print(res)
+

🟢 Pallatölur

Solutions in 3 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
package main
+
+import "fmt"
+
+func main() {
+    var a, b int
+    fmt.Scan(&a)
+    fmt.Scan(&b)
+
+    if (a <= 2) && (2 <= b) {
+        fmt.Println("1")
+        fmt.Println("2")
+    } else {
+        fmt.Println(":(")
+    }
+}
+
1
+2
+3
+4
+5
+6
+7
a, b = io.read("*n", "*n")
+if (a <= 2) and (2 <= b) then
+    print(1)
+    print(2)
+else
+    print(":(")
+end
+
1
 2
 3
 4
 5
-6
-7
-8
-9
import math
-
-r, b = [int(d) for d in input().split()]
-w = math.floor((r + b) ** 0.5)
-while w:
-    if (r + b) / w == (r + 4) / 2 - w:
-        print((r + 4) // 2 - w, w)
-        break
-    w -= 1
-

🟢 Parking

Solution in Python
 1
+6
a, b = int(input()), int(input())
+if 2 in range(a, b + 1):
+    print(1)
+    print(2)
+else:
+    print(":(")
+

🟢 Parent Gap

Solution in Python
 1
  2
  3
  4
@@ -11150,30 +11116,40 @@
 13
 14
 15
-16
a, b, c = [int(d) for d in input().split()]
-t = [0] * 100
-for _ in range(3):
-    start, end = [int(d) - 1 for d in input().split()]
-    for i in range(start, end):
-        t[i] += 1
+16
from datetime import datetime
+
+year = int(input())
+
+mother = datetime(year, 5, 1).isoweekday()
+father = datetime(year, 6, 1).isoweekday()
 
-total = 0
-mapping = {
-    3: c,
-    2: b,
-    1: a,
-}
-for s in t:
-    total += mapping.get(s, 0) * s
-print(total)
-

🟢 Parking

Solution in Python
1
+x = 7 - mother
+y = 7 - father
+daymother = 1 + x + 7
+dayfather = 1 + y + 14
+
+daymother = datetime(year, 5, daymother)
+dayfather = datetime(year, 6, dayfather)
+
+print(((dayfather - daymother).days) // 7, "weeks")
+

🟢 Parket

Solution in Python
1
 2
 3
-4
for _ in range(int(input())):
-    _ = input()
-    positions = [int(d) for d in input().split()]
-    print(2 * (max(positions) - min(positions)))
-

🟢 Parsing Hex

Solution in Python
 1
+4
+5
+6
+7
+8
+9
import math
+
+r, b = [int(d) for d in input().split()]
+w = math.floor((r + b) ** 0.5)
+while w:
+    if (r + b) / w == (r + 4) / 2 - w:
+        print((r + 4) // 2 - w, w)
+        break
+    w -= 1
+

🟢 Parking

Solution in Python
 1
  2
  3
  4
@@ -11183,43 +11159,35 @@
  8
  9
 10
-11
import re
-
-h = []
-while True:
-    try:
-        s = input()
-        h.extend(re.findall(r"0[xX][0-9a-fA-F]+", s))
-    except:
-        break
-for n in h:
-    print(n, int(n, 0))
-

🟡 Pascal

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
import math
-
-n = int(input())
-
-f = False
-for i in range(2, math.ceil(math.sqrt(n)) + 1):
-    if n % i == 0:
-        f = True
-        break
-if f:
-    print(n - n // i)
-else:
-    print(n - 1)
-

🟢 Patuljci

Solution in Python
 1
+11
+12
+13
+14
+15
+16
a, b, c = [int(d) for d in input().split()]
+t = [0] * 100
+for _ in range(3):
+    start, end = [int(d) - 1 for d in input().split()]
+    for i in range(start, end):
+        t[i] += 1
+
+total = 0
+mapping = {
+    3: c,
+    2: b,
+    1: a,
+}
+for s in t:
+    total += mapping.get(s, 0) * s
+print(total)
+

🟢 Parking

Solution in Python
1
+2
+3
+4
for _ in range(int(input())):
+    _ = input()
+    positions = [int(d) for d in input().split()]
+    print(2 * (max(positions) - min(positions)))
+

🟢 Parsing Hex

Solution in Python
 1
  2
  3
  4
@@ -11229,18 +11197,18 @@
  8
  9
 10
-11
d = [int(input()) for _ in range(9)]
-diff = sum(d) - 100
-end = False
-for i in range(8):
-    for j in range(i + 1, 9):
-        if d[i] + d[j] == diff:
-            end = True
-            break
-    if end:
-        break
-print("\n".join([str(d[k]) for k in range(9) if k not in [i, j]]))
-

🟢 Paul Eigon

Solutions in 2 languages
import re
+
+h = []
+while True:
+    try:
+        s = input()
+        h.extend(re.findall(r"0[xX][0-9a-fA-F]+", s))
+    except:
+        break
+for n in h:
+    print(n, int(n, 0))
+

🟡 Pascal

Solution in Python
 1
  2
  3
  4
@@ -11252,167 +11220,151 @@
 10
 11
 12
-13
-14
-15
package main
+13
import math
 
-import "fmt"
+n = int(input())
 
-func main() {
-    var n, p, q int
-    fmt.Scan(&n)
-    fmt.Scan(&p)
-    fmt.Scan(&q)
-    if ((p+q)/n)%2 == 0 {
-        fmt.Println("paul")
-    } else {
-        fmt.Println("opponent")
-    }
-}
-
1
-2
-3
-4
-5
-6
n, p, q = [int(d) for d in input().split()]
-
-if ((p + q) // n) % 2 == 0:
-    print("paul")
-else:
-    print("opponent")
-

🟢 Peach Powder Polygon

Solutions in 2 languages
1
-2
-3
-4
-5
if io.read("*n") % 4 > 0 then
-    print("Yes")
-else
-    print("No")
-end
+f = False
+for i in range(2, math.ceil(math.sqrt(n)) + 1):
+    if n % i == 0:
+        f = True
+        break
+if f:
+    print(n - n // i)
+else:
+    print(n - 1)
+

🟢 Patuljci

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
d = [int(input()) for _ in range(9)]
+diff = sum(d) - 100
+end = False
+for i in range(8):
+    for j in range(i + 1, 9):
+        if d[i] + d[j] == diff:
+            end = True
+            break
+    if end:
+        break
+print("\n".join([str(d[k]) for k in range(9) if k not in [i, j]]))
+

🟢 Paul Eigon

Solutions in 2 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
package main
+
+import "fmt"
+
+func main() {
+    var n, p, q int
+    fmt.Scan(&n)
+    fmt.Scan(&p)
+    fmt.Scan(&q)
+    if ((p+q)/n)%2 == 0 {
+        fmt.Println("paul")
+    } else {
+        fmt.Println("opponent")
+    }
+}
 
1
-2
n = int(input())
-print("Yes" if n % 4 else "No")
-

🟡 Pea Soup and Pancakes

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
found = False
-for _ in range(int(input())):
-    k = int(input())
-
-    name = input()
-    items = [input() for _ in range(k)]
-    if "pea soup" in items and "pancakes" in items:
-        found = True
-        print(name)
-        break
-
-if not found:
-    print("Anywhere is fine I guess")
-

🟢 Pencil Crayons

Solution in Python
1
-2
-3
-4
-5
n, k = [int(d) for d in input().split()]
-t = 0
-for _ in range(n):
-    t += k - len(set(input().split()))
-print(t)
-

🟢 Peningar

Solution in Python
1
-2
-3
-4
-5
-6
import math
-
-n, d = [int(d) for d in input().split()]
-v = [int(d) for d in input().split()]
-lcm = n * d // math.gcd(n, d)
-print(sum(v[i % n] for i in range(0, lcm, d)))
-

🟢 Peragrams

Solution in Python
1
+2
+3
+4
+5
+6
n, p, q = [int(d) for d in input().split()]
+
+if ((p + q) // n) % 2 == 0:
+    print("paul")
+else:
+    print("opponent")
+

🟢 Peach Powder Polygon

Solutions in 2 languages
1
+2
+3
+4
+5
if io.read("*n") % 4 > 0 then
+    print("Yes")
+else
+    print("No")
+end
+
1
+2
n = int(input())
+print("Yes" if n % 4 else "No")
+

🟡 Pea Soup and Pancakes

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
found = False
+for _ in range(int(input())):
+    k = int(input())
+
+    name = input()
+    items = [input() for _ in range(k)]
+    if "pea soup" in items and "pancakes" in items:
+        found = True
+        print(name)
+        break
+
+if not found:
+    print("Anywhere is fine I guess")
+

🟢 Pencil Crayons

Solution in Python
1
 2
 3
 4
-5
-6
-7
from collections import Counter
-
-s = Counter(input())
-v = [d for d in s.values() if d % 2]
-v = sorted(v)[:-1]
-
-print(len(v))
-

🟢 Perket

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
from itertools import combinations
+5
n, k = [int(d) for d in input().split()]
+t = 0
+for _ in range(n):
+    t += k - len(set(input().split()))
+print(t)
+

🟢 Peningar

Solution in Python
1
+2
+3
+4
+5
+6
import math
 
-n = int(input())
-l = [[int(d) for d in input().split()] for _ in range(n)]
-
-c = []
-for i in range(1, n + 1):
-    c.extend(list(combinations(l, i)))
-
-d = []
-for i in c:
-    s, b = 1, 0
-    for x, y in i:
-        s *= x
-        b += y
-    d.append(abs(s - b))
-
-print(min(d))
-

🟢 Permuted Arithmetic Sequence

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
def arithmetic(n):
-    d = [n[i] - n[i + 1] for i in range(len(n) - 1)]
-    return True if len(set(d)) == 1 else False
-
-
-for _ in range(int(input())):
-    s = input().split()
-    n = [int(d) for d in s[1:]]
-    if arithmetic(n):
-        print("arithmetic")
-    elif arithmetic(sorted(n)):
-        print("permuted arithmetic")
-    else:
-        print("non-arithmetic")
-

🟢 Pervasive Heart Monitor

Solution in Python
 1
+n, d = [int(d) for d in input().split()]
+v = [int(d) for d in input().split()]
+lcm = n * d // math.gcd(n, d)
+print(sum(v[i % n] for i in range(0, lcm, d)))
+

🟢 Peragrams

Solution in Python
1
+2
+3
+4
+5
+6
+7
from collections import Counter
+
+s = Counter(input())
+v = [d for d in s.values() if d % 2]
+v = sorted(v)[:-1]
+
+print(len(v))
+

🟢 Perket

Solution in Python
 1
  2
  3
  4
@@ -11426,395 +11378,355 @@
 12
 13
 14
-15
while True:
-    try:
-        line = input().split()
-    except:
-        break
-
-    name, rate = [], []
-    for p in line:
-        if p.isalpha():
-            name.append(p)
-        else:
-            rate.append(float(p))
-    name = " ".join(name)
-    rate = sum(rate) / len(rate)
-    print(f"{rate:.6f} {name}")
-

🟢 Pet

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
winner, max_score = 0, 0
-for i in range(5):
-    score = sum([int(d) for d in input().split()])
-    if score > max_score:
-        max_score = score
-        winner = i + 1
-
-print(winner, max_score)
-

🟢 Piece of Cake!

Solutions in 2 languages
1
-2
n, h, v = io.read("*n", "*n", "*n")
-print(4 * math.max(h * v, (n - h) * (n - v), h * (n - v), v * (n - h)))
-
1
-2
n, h, v = [int(d) for d in input().split()]
-print(4 * max(h * v, (n - h) * (n - v), h * (n - v), v * (n - h)))
-

🟢 Pig Latin

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
def translate(w):
-    if w[0] in "aeiouy":
-        return w + "yay"
-    else:
-        i = 1
-        while i < len(w):
-            if w[i] in "aeiouy":
-                break
-            i += 1
-        return w[i:] + w[:i] + "ay"
-
-
-while True:
-    try:
-        text = input()
-        print(" ".join([translate(w) for w in text.split()]))
-    except:
-        break
-

🟡 A Vicious Pikeman (Easy)

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
def f(n, time, l):
-    total_time, penalty = 0, 0
-    for i, t in enumerate(sorted(l)):
-        if total_time + t > time:
-            return i, penalty
-        total_time += t
-        penalty = (penalty + total_time) % 1_000_000_007
-    return n, penalty
-
-
-n, t = [int(d) for d in input().split()]
-a, b, c, t0 = [int(d) for d in input().split()]
-l = [t0]
-for _ in range(n - 1):
-    l.append(((a * l[-1] + b) % c) + 1)
-
-
-n, penalty = f(n, t, l)
-print(n, penalty)
-

🟢 Pinni Frændi

Solution in Python
1
-2
n = int(input())
-print(f"0.{'0'*(n-1)}1")
-

🟢 Pizza Crust

Solutions in 2 languages
1
-2
r, c = io.read("*n", "*n")
-print(string.format("%.6f", (r - c) ^ 2 / r ^ 2 * 100))
-
1
-2
r, c = [int(d) for d in input().split()]
-print(f"{(r-c)**2 / r**2 * 100:.6f}")
-

🟢 Pizzubestun

Solution in Python
1
-2
-3
-4
-5
-6
n = int(input())
-prices = [int(input().split()[-1]) for _ in range(n)]
-if n % 2:
-    prices.append(0)
-prices = sorted(prices, reverse=True)
-print(sum(prices[i] for i in range(0, len(prices), 2)))
-

🟢 Planetaris

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
_, a = [int(d) for d in input().split()]
-e = sorted([int(d) + 1 for d in input().split()])
-
-t = 0
-for s in e:
-    if a >= s:
-        t += 1
-        a -= s
-    else:
-        break
-print(t)
-

🟢 Planina

Solution in Python
1
+15
+16
+17
+18
from itertools import combinations
+
+n = int(input())
+l = [[int(d) for d in input().split()] for _ in range(n)]
+
+c = []
+for i in range(1, n + 1):
+    c.extend(list(combinations(l, i)))
+
+d = []
+for i in c:
+    s, b = 1, 0
+    for x, y in i:
+        s *= x
+        b += y
+    d.append(abs(s - b))
+
+print(min(d))
+

🟢 Permuted Arithmetic Sequence

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
def arithmetic(n):
+    d = [n[i] - n[i + 1] for i in range(len(n) - 1)]
+    return True if len(set(d)) == 1 else False
+
+
+for _ in range(int(input())):
+    s = input().split()
+    n = [int(d) for d in s[1:]]
+    if arithmetic(n):
+        print("arithmetic")
+    elif arithmetic(sorted(n)):
+        print("permuted arithmetic")
+    else:
+        print("non-arithmetic")
+

🟢 Pervasive Heart Monitor

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
while True:
+    try:
+        line = input().split()
+    except:
+        break
+
+    name, rate = [], []
+    for p in line:
+        if p.isalpha():
+            name.append(p)
+        else:
+            rate.append(float(p))
+    name = " ".join(name)
+    rate = sum(rate) / len(rate)
+    print(f"{rate:.6f} {name}")
+

🟢 Pet

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
winner, max_score = 0, 0
+for i in range(5):
+    score = sum([int(d) for d in input().split()])
+    if score > max_score:
+        max_score = score
+        winner = i + 1
+
+print(winner, max_score)
+

🟢 Piece of Cake!

Solutions in 2 languages
1
+2
n, h, v = io.read("*n", "*n", "*n")
+print(4 * math.max(h * v, (n - h) * (n - v), h * (n - v), v * (n - h)))
+
1
+2
n, h, v = [int(d) for d in input().split()]
+print(4 * max(h * v, (n - h) * (n - v), h * (n - v), v * (n - h)))
+

🟢 Pig Latin

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
def translate(w):
+    if w[0] in "aeiouy":
+        return w + "yay"
+    else:
+        i = 1
+        while i < len(w):
+            if w[i] in "aeiouy":
+                break
+            i += 1
+        return w[i:] + w[:i] + "ay"
+
+
+while True:
+    try:
+        text = input()
+        print(" ".join([translate(w) for w in text.split()]))
+    except:
+        break
+

🟡 A Vicious Pikeman (Easy)

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
def f(n, time, l):
+    total_time, penalty = 0, 0
+    for i, t in enumerate(sorted(l)):
+        if total_time + t > time:
+            return i, penalty
+        total_time += t
+        penalty = (penalty + total_time) % 1_000_000_007
+    return n, penalty
+
+
+n, t = [int(d) for d in input().split()]
+a, b, c, t0 = [int(d) for d in input().split()]
+l = [t0]
+for _ in range(n - 1):
+    l.append(((a * l[-1] + b) % c) + 1)
+
+
+n, penalty = f(n, t, l)
+print(n, penalty)
+

🟢 Pinni Frændi

Solution in Python
1
+2
n = int(input())
+print(f"0.{'0'*(n-1)}1")
+

🟢 Pizza Crust

Solutions in 2 languages
1
+2
r, c = io.read("*n", "*n")
+print(string.format("%.6f", (r - c) ^ 2 / r ^ 2 * 100))
+
1
+2
r, c = [int(d) for d in input().split()]
+print(f"{(r-c)**2 / r**2 * 100:.6f}")
+

🟢 Pizzubestun

Solution in Python
1
 2
 3
 4
 5
-6
-7
-8
-9
def p(n):
-    if n == 1:
-        return 3
-    else:
-        return p(n - 1) * 2 - 1
-
-
-n = int(input())
-print(p(n) ** 2)
-

🟢 Planting Trees

Solution in Python
1
-2
-3
-4
-5
n = int(input())
-t = [int(d) for d in input().split()]
+6
n = int(input())
+prices = [int(input().split()[-1]) for _ in range(n)]
+if n % 2:
+    prices.append(0)
+prices = sorted(prices, reverse=True)
+print(sum(prices[i] for i in range(0, len(prices), 2)))
+

🟢 Planetaris

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
_, a = [int(d) for d in input().split()]
+e = sorted([int(d) + 1 for d in input().split()])
 
-days = [v + d for v, d in zip(sorted(t, reverse=True), range(1, n + 1))]
-print(max(days) + 1)
-

🟢 Pokechat

Solution in Python
1
+t = 0
+for s in e:
+    if a >= s:
+        t += 1
+        a -= s
+    else:
+        break
+print(t)
+

🟢 Planina

Solution in Python
1
 2
 3
-4
chars = input()
-ids = input()
-ids = [int(ids[i : i + 3]) - 1 for i in range(0, len(ids), 3)]
-print("".join([chars[i] for i in ids]))
-

🟢 Poker Hand

Solution in Python
1
+4
+5
+6
+7
+8
+9
def p(n):
+    if n == 1:
+        return 3
+    else:
+        return p(n - 1) * 2 - 1
+
+
+n = int(input())
+print(p(n) ** 2)
+

🟢 Planting Trees

Solution in Python
1
 2
 3
-4
from collections import Counter
-
-hands = [h[0] for h in input().split()]
-print(max(Counter(hands).values()))
-

🟢 Polygon Area

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
while True:
-    n = int(input())
-    if not n:
-        break
-    p = [[int(d) for d in input().split()] for _ in range(n)]
-    a, b = 0, 0
-    for i in range(n - 1):
-        a += (p[i + 1][0] - p[i][0]) * (p[i + 1][1] + p[i][1])
-        b += p[i][0] * p[i + 1][1] - p[i][1] * p[i + 1][0]
-
-    a += (p[0][0] - p[-1][0]) * (p[0][1] + p[-1][1])
-    b += p[-1][0] * p[0][1] - p[-1][1] * p[0][0]
-
-    print("CCW" if a < 0 else "CW", f"{abs(b/2):.1f}")
-

🟢 Polynomial Multiplication 1

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
from collections import Counter
+4
+5
n = int(input())
+t = [int(d) for d in input().split()]
+
+days = [v + d for v, d in zip(sorted(t, reverse=True), range(1, n + 1))]
+print(max(days) + 1)
+

🟢 Pokechat

Solution in Python
1
+2
+3
+4
chars = input()
+ids = input()
+ids = [int(ids[i : i + 3]) - 1 for i in range(0, len(ids), 3)]
+print("".join([chars[i] for i in ids]))
+

🟢 Poker Hand

Solution in Python
1
+2
+3
+4
from collections import Counter
 
-for _ in range(int(input())):
-    n = int(input())
-    a = [int(d) for d in input().split()]
-    m = int(input())
-    b = [int(d) for d in input().split()]
-    p = Counter()
-    for i in range(n + 1):
-        for j in range(m + 1):
-            p[i + j] += a[i] * b[j]
-    keys = max([k for k in p.keys() if p[k] != 0])
-    print(keys)
-    print(" ".join([str(p[k]) for k in range(keys + 1)]))
-

🟢 Popularity Contest

Solution in Python
1
-2
-3
-4
-5
-6
-7
n, m = [int(d) for d in input().split()]
-p = [0] * n
-for _ in range(m):
-    a, b = [int(d) - 1 for d in input().split()]
-    p[a] += 1
-    p[b] += 1
-print(" ".join([str(a - b) for a, b in zip(p, range(1, 1 + n))]))
-

🟢 Pot

Solution in Python
1
-2
-3
-4
-5
-6
-7
n = int(input())
-total = 0
-for _ in range(n):
-    line = input()
-    n, p = int(line[:-1]), int(line[-1])
-    total += n**p
-print(total)
-

🟢 Saving Princess Peach

Solution in Python
1
+hands = [h[0] for h in input().split()]
+print(max(Counter(hands).values()))
+

🟢 Polygon Area

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
while True:
+    n = int(input())
+    if not n:
+        break
+    p = [[int(d) for d in input().split()] for _ in range(n)]
+    a, b = 0, 0
+    for i in range(n - 1):
+        a += (p[i + 1][0] - p[i][0]) * (p[i + 1][1] + p[i][1])
+        b += p[i][0] * p[i + 1][1] - p[i][1] * p[i + 1][0]
+
+    a += (p[0][0] - p[-1][0]) * (p[0][1] + p[-1][1])
+    b += p[-1][0] * p[0][1] - p[-1][1] * p[0][0]
+
+    print("CCW" if a < 0 else "CW", f"{abs(b/2):.1f}")
+

🟢 Polynomial Multiplication 1

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
from collections import Counter
+
+for _ in range(int(input())):
+    n = int(input())
+    a = [int(d) for d in input().split()]
+    m = int(input())
+    b = [int(d) for d in input().split()]
+    p = Counter()
+    for i in range(n + 1):
+        for j in range(m + 1):
+            p[i + j] += a[i] * b[j]
+    keys = max([k for k in p.keys() if p[k] != 0])
+    print(keys)
+    print(" ".join([str(p[k]) for k in range(keys + 1)]))
+

🟢 Popularity Contest

Solution in Python
1
 2
 3
 4
 5
 6
-7
-8
-9
n, y = [int(d) for d in input().split()]
-found = []
-for _ in range(y):
-    found.append(int(input()))
-found = set(found)
-for i in range(n):
-    if i not in found:
-        print(i)
-print(f"Mario got {len(found)} of the dangerous obstacles.")
-

🟢 Printing Costs

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
t = """
-    0        !   9        "   6        #  24        $  29        %  22
-&  24        '   3        (  12        )  12        *  17        +  13
-,   7        -   7        .   4        /  10        0  22        1  19
-2  22        3  23        4  21        5  27        6  26        7  16
-8  23        9  26        :   8        ;  11        <  10        =  14
->  10        ?  15        @  32        A  24        B  29        C  20
-D  26        E  26        F  20        G  25        H  25        I  18
-J  18        K  21        L  16        M  28        N  25        O  26
-P  23        Q  31        R  28        S  25        T  16        U  23
-V  19        W  26        X  18        Y  14        Z  22        [  18
-\  10        ]  18        ^   7        _   8        `   3        a  23
-b  25        c  17        d  25        e  23        f  18        g  30
-h  21        i  15        j  20        k  21        l  16        m  22
-n  18        o  20        p  25        q  25        r  13        s  21
-t  17        u  17        v  13        w  19        x  13        y  24
-z  19        {  18        |  12        }  18        ~   9
-"""
-
-m = []
-for row in t.splitlines():
-    if not row:
-        continue
-    values = row.split()
-    if len(values) % 2:
-        values.insert(0, " ")
-
-    for i in range(0, len(values), 2):
-        m.append((values[i], int(values[i + 1])))
-m = dict(m)
-
-while True:
-    try:
-        s = input()
-    except:
-        break
-    print(sum([m[c] for c in s]))
-

🟢 Prjónamynstur

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
mapping = {
-    ".": 20,
-    "O": 10,
-    "\\": 25,
-    "/": 25,
-    "A": 35,
-    "^": 5,
-    "v": 22,
-}
-n, _ = input().split()
-cost = 0
-for _ in range(int(n)):
-    for c in input():
-        cost += mapping[c]
-print(cost)
-

🟢 Provinces and Gold

Solution in Python
 1
+7
n, m = [int(d) for d in input().split()]
+p = [0] * n
+for _ in range(m):
+    a, b = [int(d) - 1 for d in input().split()]
+    p[a] += 1
+    p[b] += 1
+print(" ".join([str(a - b) for a, b in zip(p, range(1, 1 + n))]))
+

🟢 Pot

Solution in Python
1
+2
+3
+4
+5
+6
+7
n = int(input())
+total = 0
+for _ in range(n):
+    line = input()
+    n, p = int(line[:-1]), int(line[-1])
+    total += n**p
+print(total)
+

🟢 Saving Princess Peach

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
n, y = [int(d) for d in input().split()]
+found = []
+for _ in range(y):
+    found.append(int(input()))
+found = set(found)
+for i in range(n):
+    if i not in found:
+        print(i)
+print(f"Mario got {len(found)} of the dangerous obstacles.")
+

🟢 Printing Costs

Solution in Python
 1
  2
  3
  4
@@ -11833,27 +11745,61 @@
 17
 18
 19
-20
g, s, c = [int(d) for d in input().split()]
-
-buying = 3 * g + 2 * s + 1 * c
-result = []
-
-if buying >= 8:
-    result.append("Province")
-elif buying >= 5:
-    result.append("Duchy")
-elif buying >= 2:
-    result.append("Estate")
-
-if buying >= 6:
-    result.append("Gold")
-elif buying >= 3:
-    result.append("Silver")
-else:
-    result.append("Copper")
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
t = """
+    0        !   9        "   6        #  24        $  29        %  22
+&  24        '   3        (  12        )  12        *  17        +  13
+,   7        -   7        .   4        /  10        0  22        1  19
+2  22        3  23        4  21        5  27        6  26        7  16
+8  23        9  26        :   8        ;  11        <  10        =  14
+>  10        ?  15        @  32        A  24        B  29        C  20
+D  26        E  26        F  20        G  25        H  25        I  18
+J  18        K  21        L  16        M  28        N  25        O  26
+P  23        Q  31        R  28        S  25        T  16        U  23
+V  19        W  26        X  18        Y  14        Z  22        [  18
+\  10        ]  18        ^   7        _   8        `   3        a  23
+b  25        c  17        d  25        e  23        f  18        g  30
+h  21        i  15        j  20        k  21        l  16        m  22
+n  18        o  20        p  25        q  25        r  13        s  21
+t  17        u  17        v  13        w  19        x  13        y  24
+z  19        {  18        |  12        }  18        ~   9
+"""
 
-print(" or ".join(result))
-

🟢 Prsteni

Solution in Python
 1
+m = []
+for row in t.splitlines():
+    if not row:
+        continue
+    values = row.split()
+    if len(values) % 2:
+        values.insert(0, " ")
+
+    for i in range(0, len(values), 2):
+        m.append((values[i], int(values[i + 1])))
+m = dict(m)
+
+while True:
+    try:
+        s = input()
+    except:
+        break
+    print(sum([m[c] for c in s]))
+

🟢 Prjónamynstur

Solution in Python
 1
  2
  3
  4
@@ -11863,18 +11809,26 @@
  8
  9
 10
-11
import math
-
-_ = input()
-numbers = [int(d) for d in input().split()]
-
-base = numbers.pop(0)
-
-gcd = [math.gcd(base, n) for n in numbers]
-
-for g, n in zip(gcd, numbers):
-    print(f"{int(base/g)}/{int(n/g)}")
-

🟢 Prva

Solution in Python
 1
+11
+12
+13
+14
+15
mapping = {
+    ".": 20,
+    "O": 10,
+    "\\": 25,
+    "/": 25,
+    "A": 35,
+    "^": 5,
+    "v": 22,
+}
+n, _ = input().split()
+cost = 0
+for _ in range(int(n)):
+    for c in input():
+        cost += mapping[c]
+print(cost)
+

🟢 Provinces and Gold

Solution in Python
 1
  2
  3
  4
@@ -11886,20 +11840,34 @@
 10
 11
 12
-13
r, c = [int(d) for d in input().split()]
-puzzle = []
-for _ in range(r):
-    puzzle.append(input())
+13
+14
+15
+16
+17
+18
+19
+20
g, s, c = [int(d) for d in input().split()]
+
+buying = 3 * g + 2 * s + 1 * c
+result = []
 
-words = set()
-for row in puzzle:
-    words.update([w for w in row.split("#") if len(w) > 1])
-for i in range(c):
-    col = "".join([row[i] for row in puzzle])
-    words.update([w for w in col.split("#") if len(w) > 1])
+if buying >= 8:
+    result.append("Province")
+elif buying >= 5:
+    result.append("Duchy")
+elif buying >= 2:
+    result.append("Estate")
 
-print(sorted(words)[0])
-

🟢 Ptice

Solution in Python
 1
+if buying >= 6:
+    result.append("Gold")
+elif buying >= 3:
+    result.append("Silver")
+else:
+    result.append("Copper")
+
+print(" or ".join(result))
+

🟢 Prsteni

Solution in Python
 1
  2
  3
  4
@@ -11909,185 +11877,197 @@
  8
  9
 10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
def adrian(n):
-    if n == 0:
-        return ""
-    elif n == 1:
-        return "A"
-    elif n == 2:
-        return "AB"
-    elif n == 3:
-        return "ABC"
-    else:
-        duplicate = n // 3
-        return adrian(3) * duplicate + adrian(n % 3)
-
-
-def bruno(n):
-    if n == 0:
-        return ""
-    elif n == 1:
-        return "B"
-    elif n == 2:
-        return "BA"
-    elif n == 3:
-        return "BAB"
-    elif n == 4:
-        return "BABC"
-    else:
-        duplicate = n // 4
-        return bruno(4) * duplicate + bruno(n % 4)
-
-
-def goran(n):
-    if n == 0:
-        return ""
-    elif n in [1, 2]:
-        return "C" * n
-    elif n in [3, 4]:
-        return "CC" + "A" * (n - 2)
-    elif n in [5, 6]:
-        return "CCAA" + "B" * (n - 4)
-    else:
-        duplicate = n // 6
-        return goran(6) * duplicate + goran(n % 6)
-
-
-def get_score(ans, guess):
-    return sum([a == g for a, g in zip(ans, guess)])
-
-
-n = int(input())
-ans = input()
-
-result = {}
-result["Adrian"] = get_score(ans, adrian(n))
-result["Bruno"] = get_score(ans, bruno(n))
-result["Goran"] = get_score(ans, goran(n))
-
-best = max(result.values())
-print(best)
-
-for name, score in result.items():
-    if score == best:
-        print(name)
-

🟢 Pub Crawl

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
n = int(input())
-m = {}
-for _ in range(n):
-    name, k, t = input().split()
-    m[name] = (int(k) + 1) * int(t)
-
-ans = max(m, key=lambda k: m[k])
-print(ans, m[ans])
-

🟢 Plants vs Bad Guys

Solutions in 2 languages
1
-2
-3
-4
-5
-6
-7
n = io.read("*n")
-local min = math.huge
-for i = 1, n do
-    value = io.read("*n")
-    min   = min < value and min or value
-end
-print(1 + min)
-
1
-2
_ = input()
-print(1 + min(int(d) for d in input().split()))
-

🟢 Building Pyramids

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
n = int(input())
-
-height = 0
-while True:
-    height += 1
-    blocks = (2 * height - 1) ** 2
-    if blocks > n:
-        height -= 1
-        break
-    n -= blocks
-
-print(height)
-

🟢 Quality-Adjusted Life-Year

Solution in Python
1
-2
-3
-4
-5
-6
qaly = 0
-for _ in range(int(input())):
-    q, y = input().split()
-    q, y = float(q), float(y)
-    qaly += q * y
-print(qaly)
-

🟢 Quadrant Selection

Solutions in 4 languages
import math
+
+_ = input()
+numbers = [int(d) for d in input().split()]
+
+base = numbers.pop(0)
+
+gcd = [math.gcd(base, n) for n in numbers]
+
+for g, n in zip(gcd, numbers):
+    print(f"{int(base/g)}/{int(n/g)}")
+

🟢 Prva

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
r, c = [int(d) for d in input().split()]
+puzzle = []
+for _ in range(r):
+    puzzle.append(input())
+
+words = set()
+for row in puzzle:
+    words.update([w for w in row.split("#") if len(w) > 1])
+for i in range(c):
+    col = "".join([row[i] for row in puzzle])
+    words.update([w for w in col.split("#") if len(w) > 1])
+
+print(sorted(words)[0])
+

🟢 Ptice

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
def adrian(n):
+    if n == 0:
+        return ""
+    elif n == 1:
+        return "A"
+    elif n == 2:
+        return "AB"
+    elif n == 3:
+        return "ABC"
+    else:
+        duplicate = n // 3
+        return adrian(3) * duplicate + adrian(n % 3)
+
+
+def bruno(n):
+    if n == 0:
+        return ""
+    elif n == 1:
+        return "B"
+    elif n == 2:
+        return "BA"
+    elif n == 3:
+        return "BAB"
+    elif n == 4:
+        return "BABC"
+    else:
+        duplicate = n // 4
+        return bruno(4) * duplicate + bruno(n % 4)
+
+
+def goran(n):
+    if n == 0:
+        return ""
+    elif n in [1, 2]:
+        return "C" * n
+    elif n in [3, 4]:
+        return "CC" + "A" * (n - 2)
+    elif n in [5, 6]:
+        return "CCAA" + "B" * (n - 4)
+    else:
+        duplicate = n // 6
+        return goran(6) * duplicate + goran(n % 6)
+
+
+def get_score(ans, guess):
+    return sum([a == g for a, g in zip(ans, guess)])
+
+
+n = int(input())
+ans = input()
+
+result = {}
+result["Adrian"] = get_score(ans, adrian(n))
+result["Bruno"] = get_score(ans, bruno(n))
+result["Goran"] = get_score(ans, goran(n))
+
+best = max(result.values())
+print(best)
+
+for name, score in result.items():
+    if score == best:
+        print(name)
+

🟢 Pub Crawl

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
n = int(input())
+m = {}
+for _ in range(n):
+    name, k, t = input().split()
+    m[name] = (int(k) + 1) * int(t)
+
+ans = max(m, key=lambda k: m[k])
+print(ans, m[ans])
+

🟢 Plants vs Bad Guys

Solutions in 2 languages
1
+2
+3
+4
+5
+6
+7
n = io.read("*n")
+local min = math.huge
+for i = 1, n do
+    value = io.read("*n")
+    min   = min < value and min or value
+end
+print(1 + min)
+
1
+2
_ = input()
+print(1 + min(int(d) for d in input().split()))
+

🟢 Building Pyramids

Solution in Python
 1
  2
  3
  4
@@ -12098,86 +12078,30 @@
  9
 10
 11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
package main
+12
n = int(input())
 
-import "fmt"
-
-func main() {
-    var x, y int
-    fmt.Scan(&x)
-    fmt.Scan(&y)
-    if x > 0 {
-        if y > 0 {
-            fmt.Println(1)
-        } else {
-            fmt.Println(4)
-        }
-    } else {
-        if y > 0 {
-            fmt.Println(2)
-        } else {
-            fmt.Println(3)
-        }
-    }
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
import java.util.Scanner;
-
-class QuadrantSelection {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int x = s.nextInt();
-        int y = s.nextInt();
-
-        if (x > 0) {
-            if (y > 0) {
-                System.out.println(1);
-            } else {
-                System.out.println(4);
-            }
-        } else {
-            if (y > 0) {
-                System.out.println(2);
-            } else {
-                System.out.println(3);
-            }
-        }
-
-    }
-}
-
 1
+height = 0
+while True:
+    height += 1
+    blocks = (2 * height - 1) ** 2
+    if blocks > n:
+        height -= 1
+        break
+    n -= blocks
+
+print(height)
+

🟢 Quality-Adjusted Life-Year

Solution in Python
1
+2
+3
+4
+5
+6
qaly = 0
+for _ in range(int(input())):
+    q, y = input().split()
+    q, y = float(q), float(y)
+    qaly += q * y
+print(qaly)
+

🟢 Quadrant Selection

Solutions in 4 languages
 1
  2
  3
  4
@@ -12188,18 +12112,38 @@
  9
 10
 11
-12
x = int(input())
-y = int(input())
-if x > 0:
-    if y > 0:
-        print(1)
-    else:
-        print(4)
-else:
-    if y > 0:
-        print(2)
-    else:
-        print(3)
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
package main
+
+import "fmt"
+
+func main() {
+    var x, y int
+    fmt.Scan(&x)
+    fmt.Scan(&y)
+    if x > 0 {
+        if y > 0 {
+            fmt.Println(1)
+        } else {
+            fmt.Println(4)
+        }
+    } else {
+        if y > 0 {
+            fmt.Println(2)
+        } else {
+            fmt.Println(3)
+        }
+    }
+}
 
 1
  2
  3
@@ -12222,30 +12166,32 @@
 20
 21
 22
-23
fn main() {
-    let mut line1 = String::new();
-    std::io::stdin().read_line(&mut line1).unwrap();
-    let x: i32 = line1.trim().parse().unwrap();
-
-    let mut line2 = String::new();
-    std::io::stdin().read_line(&mut line2).unwrap();
-    let y: i32 = line2.trim().parse().unwrap();
-
-    if x > 0 {
-        if y > 0 {
-            println!("1");
-        } else {
-            println!("4");
-        }
-    } else {
-        if y > 0 {
-            println!("2");
-        } else {
-            println!("3");
+23
+24
import java.util.Scanner;
+
+class QuadrantSelection {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int x = s.nextInt();
+        int y = s.nextInt();
+
+        if (x > 0) {
+            if (y > 0) {
+                System.out.println(1);
+            } else {
+                System.out.println(4);
+            }
+        } else {
+            if (y > 0) {
+                System.out.println(2);
+            } else {
+                System.out.println(3);
+            }
         }
-    }
-}
-

🟢 Quick Brown Fox

Solution in Python
 1
+
+    }
+}
+
 1
  2
  3
  4
@@ -12254,17 +12200,21 @@
  7
  8
  9
-10
import string
-
-for _ in range(int(input())):
-    p = set([c for c in input().lower() if c.isalpha()])
-    if len(p) == 26:
-        print("pangram")
-    else:
-        print(
-            f"missing {''.join([c for c in string.ascii_lowercase[:26] if c not in p])}"
-        )
-

🟢 Quick Estimates

Solutions in 2 languages
 1
+10
+11
+12
x = int(input())
+y = int(input())
+if x > 0:
+    if y > 0:
+        print(1)
+    else:
+        print(4)
+else:
+    if y > 0:
+        print(2)
+    else:
+        print(3)
+
 1
  2
  3
  4
@@ -12275,22 +12225,60 @@
  9
 10
 11
-12
import java.util.Scanner;
-
-class QuickEstimates {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int n = s.nextInt();
-        for (int i = 0; i < n; i++) {
-            String cost = s.next();
-            System.out.println(cost.length());
-        }
-    }
-}
-
1
-2
for _ in range(int(input())):
-    print(len(input()))
-

🟢 Quite a Problem

Solution in Python
 1
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
fn main() {
+    let mut line1 = String::new();
+    std::io::stdin().read_line(&mut line1).unwrap();
+    let x: i32 = line1.trim().parse().unwrap();
+
+    let mut line2 = String::new();
+    std::io::stdin().read_line(&mut line2).unwrap();
+    let y: i32 = line2.trim().parse().unwrap();
+
+    if x > 0 {
+        if y > 0 {
+            println!("1");
+        } else {
+            println!("4");
+        }
+    } else {
+        if y > 0 {
+            println!("2");
+        } else {
+            println!("3");
+        }
+    }
+}
+

🟢 Quick Brown Fox

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
import string
+
+for _ in range(int(input())):
+    p = set([c for c in input().lower() if c.isalpha()])
+    if len(p) == 26:
+        print("pangram")
+    else:
+        print(
+            f"missing {''.join([c for c in string.ascii_lowercase[:26] if c not in p])}"
+        )
+

🟢 Quick Estimates

Solutions in 2 languages
 1
  2
  3
  4
@@ -12299,38 +12287,24 @@
  7
  8
  9
-10
while True:
-    try:
-        line = input()
-    except:
-        break
-
-    if "problem" in line.lower():
-        print("yes")
-    else:
-        print("no")
-

🟢 R2

Solutions in 5 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
#include <iostream>
-
-using namespace std;
-
-int main()
-{
-    int r1, s;
-    cin >> r1 >> s;
-    cout << 2 * s - r1 << endl;
-    return 0;
-}
-
 1
+10
+11
+12
import java.util.Scanner;
+
+class QuickEstimates {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int n = s.nextInt();
+        for (int i = 0; i < n; i++) {
+            String cost = s.next();
+            System.out.println(cost.length());
+        }
+    }
+}
+
1
+2
for _ in range(int(input())):
+    print(len(input()))
+

🟢 Quite a Problem

Solution in Python
 1
  2
  3
  4
@@ -12339,17 +12313,17 @@
  7
  8
  9
-10
package main
-
-import "fmt"
-
-func main() {
-    var r1, s int
-    fmt.Scan(&r1)
-    fmt.Scan(&s)
-    fmt.Println(2*s - r1)
-}
-
while True:
+    try:
+        line = input()
+    except:
+        break
+
+    if "problem" in line.lower():
+        print("yes")
+    else:
+        print("no")
+

🟢 R2

Solutions in 5 languages
 1
  2
  3
  4
@@ -12358,96 +12332,98 @@
  7
  8
  9
-10
import java.util.Scanner;
+10
+11
#include <iostream>
 
-class R2 {
-    public static void main(String[] args) {
-        Scanner scanner = new Scanner(System.in);
-        int r1 = scanner.nextInt();
-        int s = scanner.nextInt();
-        System.out.println(2 * s - r1);
-    }
-}
-
1
-2
-3
-4
r1 = io.read("*n")
-s = io.read("*n")
-r2 = 2 * s - r1
-print(r2)
-
1
-2
-3
r1, s = [int(d) for d in input().split()]
-r2 = 2 * s - r1
-print(r2)
-

🟢 Racing Around the Alphabet

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
import math
-
-tokens = dict([(chr(c), c - ord("A") + 1) for c in range(ord("A"), ord("Z") + 1)])
-tokens[" "] = 27
-tokens["'"] = 28
-t = math.pi * 60 / (28 * 15)
-for _ in range(int(input())):
-    m = input()
-    total = 1
-    prev = m[0]
-    for c in m[1:]:
-        dist = abs(tokens[prev] - tokens[c])
-        total += 1 + t * min(dist, 28 - dist)
-        prev = c
-    print(total)
-

🟢 Raðgreining 1

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
n, m = [int(d) for d in input().split()]
-ans = ["?"] * n
-valid = True
-for _ in range(m):
-    s, k = input().split()
-    s = int(s)
-    for a, b in zip(ans[s - 1 : s - 1 + len(k)], list(k)):
-        if a != "?" and a != b:
-            valid = False
-    ans[s - 1 : s - 1 + len(k)] = list(k)
-print("".join(ans) if valid else "Villa")
-

🟢 Ragged Right

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
l = []
-while True:
-    try:
-        s = input()
-    except:
-        break
-    l.append(len(s))
-m = max(l)
-print(sum([(n - m) ** 2 for n in l[:-1]]))
-

🟢 Railroad

Solutions in 4 languages
 1
+using namespace std;
+
+int main()
+{
+    int r1, s;
+    cin >> r1 >> s;
+    cout << 2 * s - r1 << endl;
+    return 0;
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
package main
+
+import "fmt"
+
+func main() {
+    var r1, s int
+    fmt.Scan(&r1)
+    fmt.Scan(&s)
+    fmt.Println(2*s - r1)
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
import java.util.Scanner;
+
+class R2 {
+    public static void main(String[] args) {
+        Scanner scanner = new Scanner(System.in);
+        int r1 = scanner.nextInt();
+        int s = scanner.nextInt();
+        System.out.println(2 * s - r1);
+    }
+}
+
1
+2
+3
+4
r1 = io.read("*n")
+s = io.read("*n")
+r2 = 2 * s - r1
+print(r2)
+
1
+2
+3
r1, s = [int(d) for d in input().split()]
+r2 = 2 * s - r1
+print(r2)
+

🟢 Racing Around the Alphabet

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
import math
+
+tokens = dict([(chr(c), c - ord("A") + 1) for c in range(ord("A"), ord("Z") + 1)])
+tokens[" "] = 27
+tokens["'"] = 28
+t = math.pi * 60 / (28 * 15)
+for _ in range(int(input())):
+    m = input()
+    total = 1
+    prev = m[0]
+    for c in m[1:]:
+        dist = abs(tokens[prev] - tokens[c])
+        total += 1 + t * min(dist, 28 - dist)
+        prev = c
+    print(total)
+

🟢 Raðgreining 1

Solution in Python
 1
  2
  3
  4
@@ -12457,132 +12433,128 @@
  8
  9
 10
-11
-12
-13
-14
package main
-
-import "fmt"
-
-func main() {
-    var x, y int
-    fmt.Scan(&x)
-    fmt.Scan(&y)
-    if y%2 == 1 {
-        fmt.Println("impossible")
-    } else {
-        fmt.Println("possible")
-    }
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
import java.util.Scanner;
-
-class Railroad {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int x = s.nextInt();
-        int y = s.nextInt();
-        if (y % 2 == 1) {
-            System.out.println("impossible");
-        } else {
-            System.out.println("possible");
-        }
-    }
-}
-
1
-2
-3
-4
-5
-6
-7
x = io.read("*n")
-y = io.read("*n")
-if y % 2 == 1 then
-    print("impossible")
-else
-    print("possible")
-end
-
1
-2
-3
-4
-5
_, y = [int(d) for d in input().split()]
-if y % 2:
-    print("impossible")
-else:
-    print("possible")
-

🟢 A Rank Problem

Solution in Python
1
+11
n, m = [int(d) for d in input().split()]
+ans = ["?"] * n
+valid = True
+for _ in range(m):
+    s, k = input().split()
+    s = int(s)
+    for a, b in zip(ans[s - 1 : s - 1 + len(k)], list(k)):
+        if a != "?" and a != b:
+            valid = False
+    ans[s - 1 : s - 1 + len(k)] = list(k)
+print("".join(ans) if valid else "Villa")
+

🟢 Ragged Right

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
l = []
+while True:
+    try:
+        s = input()
+    except:
+        break
+    l.append(len(s))
+m = max(l)
+print(sum([(n - m) ** 2 for n in l[:-1]]))
+

🟢 Railroad

Solutions in 4 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
package main
+
+import "fmt"
+
+func main() {
+    var x, y int
+    fmt.Scan(&x)
+    fmt.Scan(&y)
+    if y%2 == 1 {
+        fmt.Println("impossible")
+    } else {
+        fmt.Println("possible")
+    }
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
import java.util.Scanner;
+
+class Railroad {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int x = s.nextInt();
+        int y = s.nextInt();
+        if (y % 2 == 1) {
+            System.out.println("impossible");
+        } else {
+            System.out.println("possible");
+        }
+    }
+}
+
1
 2
 3
 4
 5
 6
-7
-8
-9
n, m = [int(d) for d in input().split()]
-ranking = [f"T{i}" for i in range(1, 1 + n)]
-for _ in range(m):
-    i, j = input().split()
-    if ranking.index(i) < ranking.index(j):
-        continue
-    ranking.remove(j)
-    ranking.insert(ranking.index(i) + 1, j)
-print(" ".join(ranking))
-

🟢 Rating Problems

Solutions in 2 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
import java.util.Scanner;
-
-class RatingProblems {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int n = s.nextInt();
-        int k = s.nextInt();
-        int score = 0;
-        for (int i = 0; i < k; i++) {
-            score += s.nextInt();
-        }
-        float min = (score - 3 * (n - k)) / (float) n;
-        float max = (score + 3 * (n - k)) / (float) n;
-        System.out.println(min + " " + max);
-    }
-}
-
1
+7
x = io.read("*n")
+y = io.read("*n")
+if y % 2 == 1 then
+    print("impossible")
+else
+    print("possible")
+end
+
1
+2
+3
+4
+5
_, y = [int(d) for d in input().split()]
+if y % 2:
+    print("impossible")
+else:
+    print("possible")
+

🟢 A Rank Problem

Solution in Python
1
 2
 3
 4
 5
-6
n, k = [int(d) for d in input().split()]
-score = 0
-for _ in range(k):
-    score += int(input())
-
-print((score - 3 * (n - k)) / n, (score + 3 * (n - k)) / n)
-

🟢 A Rational Sequence 2

Solution in Python
 1
+6
+7
+8
+9
n, m = [int(d) for d in input().split()]
+ranking = [f"T{i}" for i in range(1, 1 + n)]
+for _ in range(m):
+    i, j = input().split()
+    if ranking.index(i) < ranking.index(j):
+        continue
+    ranking.remove(j)
+    ranking.insert(ranking.index(i) + 1, j)
+print(" ".join(ranking))
+

🟢 Rating Problems

Solutions in 2 languages
 1
  2
  3
  4
@@ -12594,53 +12566,37 @@
 10
 11
 12
-13
def f(l, r):
-    if l == r:
-        return 1
-    elif l > r:
-        return 2 * f(l - r, r) + 1
-    else:
-        return 2 * f(l, r - l)
-
-
-for _ in range(int(input())):
-    k, v = input().split()
-    l, r = [int(d) for d in v.split("/")]
-    print(f"{k} {f(l,r)}")
-

🟢 Scaling Recipes

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
for i in range(int(input())):
-    r, p, d = [int(d) for d in input().split()]
-    recipe = {}
-    main = None
-    for _ in range(r):
-        name, weight, percent = input().split()
-        weight = float(weight)
-        percent = float(percent)
-        if percent == 100.0:
-            main = name
-        recipe[name] = (weight, percent)
-    scale = d / p
-    print(f"Recipe # {i+1}")
-    dw = recipe[main][0] * scale
-    for k in recipe:
-        print(k, f"{recipe[k][1] * dw / 100:.1f}")
-    print("-" * 40)
-

🟢 Recount

Solution in Python
 1
+13
+14
+15
+16
import java.util.Scanner;
+
+class RatingProblems {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int n = s.nextInt();
+        int k = s.nextInt();
+        int score = 0;
+        for (int i = 0; i < k; i++) {
+            score += s.nextInt();
+        }
+        float min = (score - 3 * (n - k)) / (float) n;
+        float max = (score + 3 * (n - k)) / (float) n;
+        System.out.println(min + " " + max);
+    }
+}
+
1
+2
+3
+4
+5
+6
n, k = [int(d) for d in input().split()]
+score = 0
+for _ in range(k):
+    score += int(input())
+
+print((score - 3 * (n - k)) / n, (score + 3 * (n - k)) / n)
+

🟢 A Rational Sequence 2

Solution in Python
 1
  2
  3
  4
@@ -12652,25 +12608,53 @@
 10
 11
 12
-13
from collections import Counter
-
-c = Counter()
-while True:
-    try:
-        name = input()
-    except:
-        break
-    c[name] += 1
-
-highest = max(c.values())
-names = [k for k in c if c[k] == highest]
-print("Runoff!" if len(names) > 1 else names.pop())
-

🟢 Rectangle Area

Solution in Python
1
-2
-3
x1, y1, x2, y2 = [float(d) for d in input().split()]
-
-print(abs((x1 - x2) * (y1 - y2)))
-

🟢 Reduced ID Numbers

Solution in Python
def f(l, r):
+    if l == r:
+        return 1
+    elif l > r:
+        return 2 * f(l - r, r) + 1
+    else:
+        return 2 * f(l, r - l)
+
+
+for _ in range(int(input())):
+    k, v = input().split()
+    l, r = [int(d) for d in v.split("/")]
+    print(f"{k} {f(l,r)}")
+

🟢 Scaling Recipes

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
for i in range(int(input())):
+    r, p, d = [int(d) for d in input().split()]
+    recipe = {}
+    main = None
+    for _ in range(r):
+        name, weight, percent = input().split()
+        weight = float(weight)
+        percent = float(percent)
+        if percent == 100.0:
+            main = name
+        recipe[name] = (weight, percent)
+    scale = d / p
+    print(f"Recipe # {i+1}")
+    dw = recipe[main][0] * scale
+    for k in recipe:
+        print(k, f"{recipe[k][1] * dw / 100:.1f}")
+    print("-" * 40)
+

🟢 Recount

Solution in Python
 1
  2
  3
  4
@@ -12682,90 +12666,70 @@
 10
 11
 12
-13
g = int(input())
-ids = []
-for _ in range(g):
-    ids.append(int(input()))
-
-m = 1
-while True:
-    v = [d % m for d in ids]
-    if g == len(set(v)):
-        break
-    m += 1
-
-print(m)
-

🟢 Reduplication

Solution in Python
1
+13
from collections import Counter
+
+c = Counter()
+while True:
+    try:
+        name = input()
+    except:
+        break
+    c[name] += 1
+
+highest = max(c.values())
+names = [k for k in c if c[k] == highest]
+print("Runoff!" if len(names) > 1 else names.pop())
+

🟢 Rectangle Area

Solution in Python
1
 2
-3
s = input()
-n = int(input())
-print(s * n)
-

🟢 Relocation

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
n, q = [int(d) for d in input().split()]
-x = [int(d) for d in input().split()]
-for _ in range(q):
-    req = [int(d) for d in input().split()]
-    if req[0] == 1:
-        x[req[1] - 1] = req[2]
-    elif req[0] == 2:
-        print(abs(x[req[1] - 1] - x[req[2] - 1]))
-

🟢 Restaurant Opening

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
from itertools import product
-
-n, m = [int(d) for d in input().split()]
-
-g = []
-for _ in range(n):
-    g.append([int(d) for d in input().split()])
-
-l = list(product(range(n), range(m)))
-
-c = []
-for i, j in l:
-    s = 0
-    for a, b in l:
-        s += g[a][b] * (abs(i - a) + abs(j - b))
-    c.append(s)
-
-print(min(c))
-

🟢 Reversed Binary Numbers

Solution in Python
1
+3
x1, y1, x2, y2 = [float(d) for d in input().split()]
+
+print(abs((x1 - x2) * (y1 - y2)))
+

🟢 Reduced ID Numbers

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
g = int(input())
+ids = []
+for _ in range(g):
+    ids.append(int(input()))
+
+m = 1
+while True:
+    v = [d % m for d in ids]
+    if g == len(set(v)):
+        break
+    m += 1
+
+print(m)
+

🟢 Reduplication

Solution in Python
1
+2
+3
s = input()
+n = int(input())
+print(s * n)
+

🟢 Relocation

Solution in Python
1
 2
 3
 4
 5
 6
 7
-8
n = int(input())
-
-b = []
-while n:
-    b.append(n % 2)
-    n //= 2
-
-print(sum([d * (2**p) for d, p in zip(b, reversed(range(len(b))))]))
-

🟢 Reverse Rot

Solution in Python
 1
+8
n, q = [int(d) for d in input().split()]
+x = [int(d) for d in input().split()]
+for _ in range(q):
+    req = [int(d) for d in input().split()]
+    if req[0] == 1:
+        x[req[1] - 1] = req[2]
+    elif req[0] == 2:
+        print(abs(x[req[1] - 1] - x[req[2] - 1]))
+

🟢 Restaurant Opening

Solution in Python
 1
  2
  3
  4
@@ -12781,45 +12745,41 @@
 14
 15
 16
-17
import string
+17
+18
from itertools import product
 
-rotations = string.ascii_uppercase + "_."
+n, m = [int(d) for d in input().split()]
 
-
-def rotate(c, n):
-    index = (rotations.index(c) + n) % 28
-    return rotations[index]
-
+g = []
+for _ in range(n):
+    g.append([int(d) for d in input().split()])
+
+l = list(product(range(n), range(m)))
 
-while True:
-    line = input()
-    if line == "0":
-        break
-    n, m = line.split()
-    n = int(n)
-    print("".join([rotate(c, n) for c in m[::-1]]))
-

🟢 Revision Control

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
n = int(input())
-e = set()
-res = []
-for v in input().split():
-    v = int(v)
-    if v not in e:
-        res.append(1)
-        e.add(v)
-    else:
-        res.append(0)
-print(*res)
-

🟢 Riječi

Solutions in 4 languages
 1
+c = []
+for i, j in l:
+    s = 0
+    for a, b in l:
+        s += g[a][b] * (abs(i - a) + abs(j - b))
+    c.append(s)
+
+print(min(c))
+

🟢 Reversed Binary Numbers

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
n = int(input())
+
+b = []
+while n:
+    b.append(n % 2)
+    n //= 2
+
+print(sum([d * (2**p) for d, p in zip(b, reversed(range(len(b))))]))
+

🟢 Reverse Rot

Solution in Python
 1
  2
  3
  4
@@ -12832,21 +12792,27 @@
 11
 12
 13
-14
package main
+14
+15
+16
+17
import string
 
-import "fmt"
+rotations = string.ascii_uppercase + "_."
 
-func main() {
-    var n int
-    fmt.Scan(&n)
-    a := 1
-    b := 0
-    for i := 0; i < n; i++ {
-        a, b = b, b+a
-    }
-    fmt.Println(a, b)
-}
-
 1
+
+def rotate(c, n):
+    index = (rotations.index(c) + n) % 28
+    return rotations[index]
+
+
+while True:
+    line = input()
+    if line == "0":
+        break
+    n, m = line.split()
+    n = int(n)
+    print("".join([rotate(c, n) for c in m[::-1]]))
+

🟢 Revision Control

Solution in Python
 1
  2
  3
  4
@@ -12856,127 +12822,125 @@
  8
  9
 10
-11
-12
-13
-14
-15
-16
-17
-18
import java.util.Scanner;
-
-class Rijeci {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int k = s.nextInt();
-        int a = 1;
-        int b = 0;
-        for (int i = 0; i < k; i++) {
-            int t = b;
-            b = a + b;
-            a = t;
-
-        }
-
-        System.out.println(a + " " + b);
-    }
-}
-
1
-2
-3
-4
-5
-6
k = io.read("*n")
-local a, b = 1, 0
-for i = 1, k do
-    a, b = b, b + a
-end
-print(a, b)
-
1
-2
-3
-4
-5
-6
k = int(input())
-a, b = 1, 0
-for _ in range(k):
-    a, b = b, b + a
-
-print(a, b)
-

🟢 Roaming Romans

Solutions in 3 languages
1
+11
n = int(input())
+e = set()
+res = []
+for v in input().split():
+    v = int(v)
+    if v not in e:
+        res.append(1)
+        e.add(v)
+    else:
+        res.append(0)
+print(*res)
+

🟢 Riječi

Solutions in 4 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
package main
+
+import "fmt"
+
+func main() {
+    var n int
+    fmt.Scan(&n)
+    a := 1
+    b := 0
+    for i := 0; i < n; i++ {
+        a, b = b, b+a
+    }
+    fmt.Println(a, b)
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
import java.util.Scanner;
+
+class Rijeci {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int k = s.nextInt();
+        int a = 1;
+        int b = 0;
+        for (int i = 0; i < k; i++) {
+            int t = b;
+            b = a + b;
+            a = t;
+
+        }
+
+        System.out.println(a + " " + b);
+    }
+}
+
1
 2
 3
 4
 5
-6
-7
-8
-9
package main
-
-import "fmt"
-
-func main() {
-    var x float64
-    fmt.Scan(&x)
-    fmt.Println(int(x*1000*5280/4854 + 0.5))
-}
+6
k = io.read("*n")
+local a, b = 1, 0
+for i = 1, k do
+    a, b = b, b + a
+end
+print(a, b)
 
1
-2
x = io.read("*n")
-print(math.floor(x * 1000 * 5280 / 4854 + .5))
-
1
-2
x = float(input())
-print(int(x * 1000 * 5280 / 4854 + 0.5))
-

🟢 Run-Length Encoding, Run!

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
action, s = input().split()
-if action == "D":
-    print("".join([s[i] * int(s[i + 1]) for i in range(0, len(s), 2)]))
-elif action == "E":
-    parts = []
-    prev, t = s[0], 1
-    for c in s[1:]:
-        if c != prev:
-            parts.append((prev, t))
-            t = 1
-            prev = c
-        else:
-            t += 1
-    parts.append((prev, t))
-
-    print("".join([f"{k}{v}" for k, v in parts]))
-

🟢 Same Digits (Easy)

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
a, b = [int(d) for d in input().split()]
-pairs = []
-for x in range(a, b + 1):
-    for y in range(x, b + 1):
-        xy = x * y
-        if sorted(str(xy)) == sorted(str(x) + str(y)):
-            pairs.append((x, y, xy))
-print(f"{len(pairs)} digit-preserving pair(s)")
-for x, y, xy in pairs:
-    print(f"x = {x}, y = {y}, xy = {xy}")
-

🟢 Same Digits (Hard)

Solution in Python
 1
+2
+3
+4
+5
+6
k = int(input())
+a, b = 1, 0
+for _ in range(k):
+    a, b = b, b + a
+
+print(a, b)
+

🟢 Roaming Romans

Solutions in 3 languages
1
+2
+3
+4
+5
+6
+7
+8
+9
package main
+
+import "fmt"
+
+func main() {
+    var x float64
+    fmt.Scan(&x)
+    fmt.Println(int(x*1000*5280/4854 + 0.5))
+}
+
1
+2
x = io.read("*n")
+print(math.floor(x * 1000 * 5280 / 4854 + .5))
+
1
+2
x = float(input())
+print(int(x * 1000 * 5280 / 4854 + 0.5))
+

🟢 Run-Length Encoding, Run!

Solution in Python
 1
  2
  3
  4
@@ -12990,111 +12954,89 @@
 12
 13
 14
-15
a, b = [int(d) for d in input().split()]
-pairs = []
-for x in range(a, b + 1):
-    for y in range(x, b + 1):
-        xy = x * y
-        if x * y > b:
-            break
-        if sorted(str(xy)) == sorted(str(x) + str(y)):
-            pairs.append((x, y, xy))
-    if x * x > b:
-        break
-
-print(f"{len(pairs)} digit-preserving pair(s)")
-for x, y, xy in pairs:
-    print(f"x = {x}, y = {y}, xy = {xy}")
-

🟢 Sanic

Solutions in 2 languages
print(io.read("*n") - 1)
-
print(float(input()) - 1)
-

🟢 Saving Daylight

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
while True:
-    try:
-        s = input().split()
-    except:
-        break
-
-    t1, t2 = s[-2:]
-
-    h1, m1 = [int(d) for d in t1.split(":")]
-    h2, m2 = [int(d) for d in t2.split(":")]
-
-    mins = (h2 - h1) * 60 + (m2 - m1)
-    h = mins // 60
-    m = mins % 60
-
-    ans = s[:-2]
-    ans.extend([str(h), "hours", str(m), "minutes"])
-
-    print(" ".join(ans))
-

🟢 Saving For Retirement

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
import math
-
-B, Br, Bs, A, As = [int(d) for d in input().split()]
-rate = Bs * (Br - B) / As
-Ar = math.ceil(rate) + A
-if rate.is_integer():
-    Ar += 1
-print(Ar)
-

🟢 Scaling Recipe

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
import math
-
-n, x, y = [int(d) for d in input().split()]
-i = [int(input()) for _ in range(n)]
-
-# for python 3.9+ (https://docs.python.org/3.9/library/math.html#math.gcd)
-# s = math.gcd(x, *i)
-
-s = math.gcd(x, i[0])
-for k in range(1, n):
-    s = math.gcd(s, i[k])
-
-x /= s
-i = [v / s for v in i]
-
-scale = y / x
-for v in i:
-    print(int(scale * v))
-

🟢 School Spirit

Solution in Python
 1
+15
+16
action, s = input().split()
+if action == "D":
+    print("".join([s[i] * int(s[i + 1]) for i in range(0, len(s), 2)]))
+elif action == "E":
+    parts = []
+    prev, t = s[0], 1
+    for c in s[1:]:
+        if c != prev:
+            parts.append((prev, t))
+            t = 1
+            prev = c
+        else:
+            t += 1
+    parts.append((prev, t))
+
+    print("".join([f"{k}{v}" for k, v in parts]))
+

🟢 Same Digits (Easy)

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
a, b = [int(d) for d in input().split()]
+pairs = []
+for x in range(a, b + 1):
+    for y in range(x, b + 1):
+        xy = x * y
+        if sorted(str(xy)) == sorted(str(x) + str(y)):
+            pairs.append((x, y, xy))
+print(f"{len(pairs)} digit-preserving pair(s)")
+for x, y, xy in pairs:
+    print(f"x = {x}, y = {y}, xy = {xy}")
+

🟢 Same Digits (Hard)

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
a, b = [int(d) for d in input().split()]
+pairs = []
+for x in range(a, b + 1):
+    for y in range(x, b + 1):
+        xy = x * y
+        if x * y > b:
+            break
+        if sorted(str(xy)) == sorted(str(x) + str(y)):
+            pairs.append((x, y, xy))
+    if x * x > b:
+        break
+
+print(f"{len(pairs)} digit-preserving pair(s)")
+for x, y, xy in pairs:
+    print(f"x = {x}, y = {y}, xy = {xy}")
+

🟢 Songbook

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
t, n = [int(d) for d in input().split()]
+s = sorted([int(d) for d in input().split()])
+res = 0
+for v in s:
+    if res + v > t * 60:
+        break
+    res += v
+print(res)
+

🟢 Sanic

Solutions in 2 languages
print(io.read("*n") - 1)
+
print(float(input()) - 1)
+

🟢 Saving Daylight

Solution in Python
 1
  2
  3
  4
@@ -13111,36 +13053,42 @@
 15
 16
 17
-18
n = int(input())
-s = []
-for _ in range(n):
-    s.append(int(input()))
-
+18
+19
while True:
+    try:
+        s = input().split()
+    except:
+        break
 
-def group_score(s):
-    gs = 0
-    for i in range(len(s)):
-        gs += s[i] * (0.8**i)
-    return 0.2 * gs
-
-
-print(group_score(s))
-new_gs = []
-for i in range(n):
-    new_gs.append(group_score([s[j] for j in range(n) if j != i]))
-print(sum(new_gs) / len(new_gs))
-

🟢 A Second Opinion

Solution in Python
1
+    t1, t2 = s[-2:]
+
+    h1, m1 = [int(d) for d in t1.split(":")]
+    h2, m2 = [int(d) for d in t2.split(":")]
+
+    mins = (h2 - h1) * 60 + (m2 - m1)
+    h = mins // 60
+    m = mins % 60
+
+    ans = s[:-2]
+    ans.extend([str(h), "hours", str(m), "minutes"])
+
+    print(" ".join(ans))
+

🟢 Saving For Retirement

Solution in Python
1
 2
 3
 4
 5
-6
s = int(input())
-h = s // 3600
-s = s % 3600
-m = s // 60
-s = s % 60
-print(f"{h} : {m} : {s}")
-

🟢 Secret Message

Solution in Python
 1
+6
+7
+8
import math
+
+B, Br, Bs, A, As = [int(d) for d in input().split()]
+rate = Bs * (Br - B) / As
+Ar = math.ceil(rate) + A
+if rate.is_integer():
+    Ar += 1
+print(Ar)
+

🟢 Scaling Recipe

Solution in Python
 1
  2
  3
  4
@@ -13152,210 +13100,226 @@
 10
 11
 12
-13
import math
+13
+14
+15
+16
+17
+18
import math
 
-for _ in range(int(input())):
-    m = input()
-    k = math.ceil(len(m) ** 0.5)
-
-    m += "*" * (k * k - len(m))
-    rows = [m[i : i + k] for i in range(0, len(m), k)]
-
-    s = []
-    for i in range(k):
-        s.append("".join([row[i] for row in rows if row[i] != "*"][::-1]))
-    print("".join(s))
-

🟢 Secure Doors

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
pool = set()
-for _ in range(int(input())):
-    action, name = input().split()
-    if action == "entry":
-        print(name, "entered", "(ANOMALY)" if name in pool else "")
-        pool.add(name)
-    elif action == "exit":
-        print(name, "exited", "(ANOMALY)" if name not in pool else "")
-        pool.discard(name)
-

🟢 Server

Solution in Python
1
+n, x, y = [int(d) for d in input().split()]
+i = [int(input()) for _ in range(n)]
+
+# for python 3.9+ (https://docs.python.org/3.9/library/math.html#math.gcd)
+# s = math.gcd(x, *i)
+
+s = math.gcd(x, i[0])
+for k in range(1, n):
+    s = math.gcd(s, i[k])
+
+x /= s
+i = [v / s for v in i]
+
+scale = y / x
+for v in i:
+    print(int(scale * v))
+

🟢 School Spirit

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
n = int(input())
+s = []
+for _ in range(n):
+    s.append(int(input()))
+
+
+def group_score(s):
+    gs = 0
+    for i in range(len(s)):
+        gs += s[i] * (0.8**i)
+    return 0.2 * gs
+
+
+print(group_score(s))
+new_gs = []
+for i in range(n):
+    new_gs.append(group_score([s[j] for j in range(n) if j != i]))
+print(sum(new_gs) / len(new_gs))
+

🟢 A Second Opinion

Solution in Python
1
 2
 3
 4
 5
-6
-7
-8
-9
_, t = [int(d) for d in input().split()]
-total, used = 0, 0
-for v in [int(d) for d in input().split()]:
-    if used + v <= t:
-        total += 1
-        used += v
-    else:
-        break
-print(total)
-

🟢 Seven Wonders

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
from collections import Counter
+6
s = int(input())
+h = s // 3600
+s = s % 3600
+m = s // 60
+s = s % 60
+print(f"{h} : {m} : {s}")
+

🟢 Secret Message

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
import math
 
-c = Counter(input())
-score = 0
-for value in c.values():
-    score += value**2
-if len(c.values()) == 3:
-    score += 7 * min(c.values())
-print(score)
-

🟢 Shandy

Solutions in 2 languages
1
-2
b, l = io.read("*n", "*n")
-print(math.min(b, l) * 2)
-
1
+for _ in range(int(input())):
+    m = input()
+    k = math.ceil(len(m) ** 0.5)
+
+    m += "*" * (k * k - len(m))
+    rows = [m[i : i + k] for i in range(0, len(m), k)]
+
+    s = []
+    for i in range(k):
+        s.append("".join([row[i] for row in rows if row[i] != "*"][::-1]))
+    print("".join(s))
+

🟢 Secure Doors

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
pool = set()
+for _ in range(int(input())):
+    action, name = input().split()
+    if action == "entry":
+        print(name, "entered", "(ANOMALY)" if name in pool else "")
+        pool.add(name)
+    elif action == "exit":
+        print(name, "exited", "(ANOMALY)" if name not in pool else "")
+        pool.discard(name)
+

🟢 Server

Solution in Python
1
 2
-3
b = int(input())
-l = int(input())
-print(min(b, l) * 2)
-

🟢 Shattered Cake

Solution in Python
1
+3
+4
+5
+6
+7
+8
+9
_, t = [int(d) for d in input().split()]
+total, used = 0, 0
+for v in [int(d) for d in input().split()]:
+    if used + v <= t:
+        total += 1
+        used += v
+    else:
+        break
+print(total)
+

🟢 Seven Wonders

Solution in Python
1
 2
 3
 4
 5
-6
w, n = int(input()), int(input())
-total = 0
-for _ in range(n):
-    _w, _l = [int(d) for d in input().split()]
-    total += _w * _l
-print(int(total / w))
-

🟢 Shopaholic

Solution in Python
1
-2
-3
-4
-5
-6
-7
n = int(input())
-c = [int(d) for d in input().split()]
-
-c = sorted(c, reverse=True)
-groups = [c[i : i + 3] if i + 3 < n else c[i:] for i in range(0, n, 3)]
-
-print(sum(g[-1] if len(g) == 3 else 0 for g in groups))
-

🟢 Shopping List (Easy)

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
n, m = [int(d) for d in input().split()]
-items = []
-for _ in range(n):
-    items.append(set(input().split()))
-
-ans = items[0]
-ans = ans.intersection(*items[1:])
-
-print(len(ans))
-print("\n".join(sorted(list(ans))))
-

🟢 A Shortcut to What?

Solutions in 2 languages
1
-2
n = io.read("*n")
-print((n + 5) * 3 - 10)
-
1
-2
n = int(input())
-print((n + 5) * 3 - 10)
-

🟢 Sibice

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
import math
-
-n, w, h = [int(d) for d in input().split()]
-for _ in range(n):
-    line = int(input())
-    if line <= math.sqrt(w**2 + h**2):
-        print("DA")
-    else:
-        print("NE")
-

🟢 Sideways Sorting

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
while True:
-    r, c = [int(d) for d in input().split()]
-    if not r and not c:
-        break
-    s = []
-    for _ in range(r):
-        s.append(input())
-    items = []
-    for i in range(c):
-        items.append("".join(s[j][i] for j in range(r)))
-    items = sorted(items, key=lambda t: t.lower())
-    for i in range(r):
-        print("".join(items[j][i] for j in range(c)))
-

🟢 Digit Product

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
def digit_product(x):
-    ans = 1
-    while x:
-        ans *= x % 10 or 1
-        x //= 10
-    return ans
-
-
-x = int(input())
-while True:
-    x = digit_product(x)
-    if x < 10:
-        break
-print(x)
-

🟢 Simon Says

Solution in Python
1
+6
+7
+8
+9
from collections import Counter
+
+c = Counter(input())
+score = 0
+for value in c.values():
+    score += value**2
+if len(c.values()) == 3:
+    score += 7 * min(c.values())
+print(score)
+

🟢 Shandy

Solutions in 2 languages
1
+2
b, l = io.read("*n", "*n")
+print(math.min(b, l) * 2)
+
1
+2
+3
b = int(input())
+l = int(input())
+print(min(b, l) * 2)
+

🟢 Shattered Cake

Solution in Python
1
+2
+3
+4
+5
+6
w, n = int(input()), int(input())
+total = 0
+for _ in range(n):
+    _w, _l = [int(d) for d in input().split()]
+    total += _w * _l
+print(int(total / w))
+

🟢 Shopaholic

Solution in Python
1
+2
+3
+4
+5
+6
+7
n = int(input())
+c = [int(d) for d in input().split()]
+
+c = sorted(c, reverse=True)
+groups = [c[i : i + 3] if i + 3 < n else c[i:] for i in range(0, n, 3)]
+
+print(sum(g[-1] if len(g) == 3 else 0 for g in groups))
+

🟢 Shopping List (Easy)

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
n, m = [int(d) for d in input().split()]
+items = []
+for _ in range(n):
+    items.append(set(input().split()))
+
+ans = items[0]
+ans = ans.intersection(*items[1:])
+
+print(len(ans))
+print("\n".join(sorted(list(ans))))
+

🟢 A Shortcut to What?

Solutions in 2 languages
1
+2
n = io.read("*n")
+print((n + 5) * 3 - 10)
+
1
+2
n = int(input())
+print((n + 5) * 3 - 10)
+

🟢 Sibice

Solution in Python
1
 2
 3
 4
 5
 6
-7
for _ in range(int(input())):
-    command = input()
-    start = "simon says "
-    if command.startswith(start):
-        print(command[len(start) :])
-    else:
-        print()
-

🟢 Simone

Solution in Python
 1
+7
+8
+9
import math
+
+n, w, h = [int(d) for d in input().split()]
+for _ in range(n):
+    line = int(input())
+    if line <= math.sqrt(w**2 + h**2):
+        print("DA")
+    else:
+        print("NE")
+

🟢 Sideways Sorting

Solution in Python
 1
  2
  3
  4
@@ -13367,106 +13331,102 @@
 10
 11
 12
-13
-14
-15
-16
-17
from collections import Counter
-
-n, k = [int(d) for d in input().split()]
-
-s = Counter(int(d) for d in input().split())
-
-least = min(s.values())
-if len(s.values()) < k:
-    least = 0
-ans = 0
-c = []
-for i in range(k):
-    if s[i + 1] == least:
-        c.append(str(i + 1))
-        ans += 1
-print(ans)
-print(" ".join(c))
-

🟢 Simon Says

Solution in Python
1
-2
-3
-4
-5
for _ in range(int(input())):
-    command = input()
-    start = "Simon says "
-    if command.startswith(start):
-        print(command[len(start) :])
-

🟡 Simple Addition

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
a, b = input(), input()
-
-a = a[::-1]
-b = b[::-1]
-i = 0
-ans = ""
-carry = 0
-while i < len(a) or i < len(b):
-    if i < len(a) and i < len(b):
-        s = int(a[i]) + int(b[i]) + carry
-
-    elif i < len(a):
-        s = int(a[i]) + carry
-
-    else:
-        s = int(b[i]) + carry
-    ans += str(s % 10)
-    carry = s // 10
-    i += 1
-if carry:
-    ans += str(carry)
-print(ans[::-1])
-
-# or simply
-# print(int(a) + int(b))
-

🟢 Simple Factoring

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
for _ in range(int(input())):
-    a, b, c = [int(d) for d in input().split()]
-    import math
+13
while True:
+    r, c = [int(d) for d in input().split()]
+    if not r and not c:
+        break
+    s = []
+    for _ in range(r):
+        s.append(input())
+    items = []
+    for i in range(c):
+        items.append("".join(s[j][i] for j in range(r)))
+    items = sorted(items, key=lambda t: t.lower())
+    for i in range(r):
+        print("".join(items[j][i] for j in range(c)))
+

🟢 Digit Product

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
def digit_product(x):
+    ans = 1
+    while x:
+        ans *= x % 10 or 1
+        x //= 10
+    return ans
+
+
+x = int(input())
+while True:
+    x = digit_product(x)
+    if x < 10:
+        break
+print(x)
+

🟢 Simon Says

Solution in Python
1
+2
+3
+4
+5
+6
+7
for _ in range(int(input())):
+    command = input()
+    start = "simon says "
+    if command.startswith(start):
+        print(command[len(start) :])
+    else:
+        print()
+

🟢 Simone

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
from collections import Counter
+
+n, k = [int(d) for d in input().split()]
 
-    if not b**2 - 4 * a * c < 0 and math.sqrt(b**2 - 4 * a * c).is_integer():
-        print("YES")
-    else:
-        print("NO")
-

🟢 Simplicity

Solution in Python
1
+s = Counter(int(d) for d in input().split())
+
+least = min(s.values())
+if len(s.values()) < k:
+    least = 0
+ans = 0
+c = []
+for i in range(k):
+    if s[i + 1] == least:
+        c.append(str(i + 1))
+        ans += 1
+print(ans)
+print(" ".join(c))
+

🟢 Simon Says

Solution in Python
1
 2
-3
from collections import Counter
-
-print(sum([v for _, v in Counter(input()).most_common()[2:]]))
-

🟢 Sith

Solution in Python
 1
+3
+4
+5
for _ in range(int(input())):
+    command = input()
+    start = "Simon says "
+    if command.startswith(start):
+        print(command[len(start) :])
+

🟡 Simple Addition

Solution in Python
 1
  2
  3
  4
@@ -13475,115 +13435,143 @@
  7
  8
  9
-10
_ = input()
-a = int(input())
-b = int(input())
-diff = int(input())
-if diff <= 0:
-    print("JEDI")
-elif a < b:
-    print("SITH")
-else:
-    print("VEIT EKKI")
-

🟢 Sjecista

Solution in Python
1
-2
n = int(input())
-print((n - 3) * (n - 2) * (n - 1) * (n) // 24)
-

🟢 Skák

Solutions in 2 languages
1
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
a, b = input(), input()
+
+a = a[::-1]
+b = b[::-1]
+i = 0
+ans = ""
+carry = 0
+while i < len(a) or i < len(b):
+    if i < len(a) and i < len(b):
+        s = int(a[i]) + int(b[i]) + carry
+
+    elif i < len(a):
+        s = int(a[i]) + carry
+
+    else:
+        s = int(b[i]) + carry
+    ans += str(s % 10)
+    carry = s // 10
+    i += 1
+if carry:
+    ans += str(carry)
+print(ans[::-1])
+
+# or simply
+# print(int(a) + int(b))
+

🟢 Simple Factoring

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
for _ in range(int(input())):
+    a, b, c = [int(d) for d in input().split()]
+    import math
+
+    if not b**2 - 4 * a * c < 0 and math.sqrt(b**2 - 4 * a * c).is_integer():
+        print("YES")
+    else:
+        print("NO")
+

🟢 Simplicity

Solution in Python
1
 2
-3
-4
-5
-6
-7
xh, yh = io.read("*n", "*n")
-xp, yp = io.read("*n", "*n")
-if xh == xp or yh == yp then
-    print(1)
-else
-    print(2)
-end
-
1
-2
-3
-4
-5
-6
xh, yh = [int(d) for d in input().split()]
-xp, yp = [int(d) for d in input().split()]
-if xh == xp or yh == yp:
-    print(1)
-else:
-    print(2)
-

🟢 Skammstöfun

Solution in Python
1
-2
-3
_ = input()
-words = input().split()
-print("".join([w[0] for w in words if w[0].isupper()]))
-

🟢 Skener

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
r, _, zr, zc = [int(d) for d in input().split()]
-matrix = []
-for _ in range(r):
-    matrix.append(input())
-
-ans = []
-
-for row in matrix:
-    for i in range(zr):
-        ans.append(row)
-
-for row in ans:
-    print("".join([col * zc for col in row]))
-

🟢 Skocimis

Solutions in 3 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
package main
-
-import "fmt"
-
-func main() {
-    var a, b, c int
-    fmt.Scan(&a)
-    fmt.Scan(&b)
-    fmt.Scan(&c)
-    x := b - a
-    y := c - b
-    ans := x
-    if ans < y {
-        ans = y
-    }
-    ans -= 1
-    fmt.Println(ans)
-}
-
1
-2
a, b, c = io.read("*n", "*n", "*n")
-print(math.max(b - a, c - b) - 1)
-
1
-2
a, b, c = [int(d) for d in input().split()]
-print(max(b - a, c - b) - 1)
-

🟢 Skotleikur

Solution in Python
 1
+3
from collections import Counter
+
+print(sum([v for _, v in Counter(input()).most_common()[2:]]))
+

🟢 Sith

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
_ = input()
+a = int(input())
+b = int(input())
+diff = int(input())
+if diff <= 0:
+    print("JEDI")
+elif a < b:
+    print("SITH")
+else:
+    print("VEIT EKKI")
+

🟢 Sjecista

Solution in Python
1
+2
n = int(input())
+print((n - 3) * (n - 2) * (n - 1) * (n) // 24)
+

🟢 Skák

Solutions in 2 languages
1
+2
+3
+4
+5
+6
+7
xh, yh = io.read("*n", "*n")
+xp, yp = io.read("*n", "*n")
+if xh == xp or yh == yp then
+    print(1)
+else
+    print(2)
+end
+
1
+2
+3
+4
+5
+6
xh, yh = [int(d) for d in input().split()]
+xp, yp = [int(d) for d in input().split()]
+if xh == xp or yh == yp:
+    print(1)
+else:
+    print(2)
+

🟢 Skammstöfun

Solution in Python
1
+2
+3
_ = input()
+words = input().split()
+print("".join([w[0] for w in words if w[0].isupper()]))
+

🟢 Skener

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
r, _, zr, zc = [int(d) for d in input().split()]
+matrix = []
+for _ in range(r):
+    matrix.append(input())
+
+ans = []
+
+for row in matrix:
+    for i in range(zr):
+        ans.append(row)
+
+for row in ans:
+    print("".join([col * zc for col in row]))
+

🟢 Skocimis

Solutions in 3 languages
 1
  2
  3
  4
@@ -13592,37 +13580,39 @@
  7
  8
  9
-10
k = int(input())
-a = int(input())
-b = int(input())
-ans = []
-for i in range(0, k // a + 1):
-    if (k - a * i) % b == 0:
-        ans.append((i, (k - a * i) // b))
-print(len(ans))
-for i, j in ans:
-    print(i, j)
-

🟢 Turn It Up!

Solution in Python
1
-2
-3
-4
-5
-6
-7
volume = 7
-for _ in range(int(input())):
-    if input() == "Skru op!":
-        volume = min(volume + 1, 10)
-    else:
-        volume = max(volume - 1, 0)
-print(volume)
-

🟢 Slatkisi

Solution in Python
1
-2
-3
-4
c, k = [int(d) for d in input().split()]
-d = 10**k
-c = (c // d) * d + (d if (c % d) / d >= 0.5 else 0)
-print(c)
-

🟢 SMIL

Solutions in 2 languages
 1
+10
+11
+12
+13
+14
+15
+16
+17
+18
package main
+
+import "fmt"
+
+func main() {
+    var a, b, c int
+    fmt.Scan(&a)
+    fmt.Scan(&b)
+    fmt.Scan(&c)
+    x := b - a
+    y := c - b
+    ans := x
+    if ans < y {
+        ans = y
+    }
+    ans -= 1
+    fmt.Println(ans)
+}
+
1
+2
a, b, c = io.read("*n", "*n", "*n")
+print(math.max(b - a, c - b) - 1)
+
1
+2
a, b, c = [int(d) for d in input().split()]
+print(max(b - a, c - b) - 1)
+

🟢 Skotleikur

Solution in Python
 1
  2
  3
  4
@@ -13631,112 +13621,86 @@
  7
  8
  9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
import java.util.Scanner;
-
-class SMIL {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        String m = s.nextLine();
-        int size = m.length();
-        int i = 0;
-        while (i < size) {
-            if (m.charAt(i) == ':' || m.charAt(i) == ';') {
-                if (i + 1 < size && m.charAt(i + 1) == ')') {
-                    System.out.println(i);
-                    i += 2;
-                    continue;
-                }
-                if (i + 2 < size && m.charAt(i + 1) == '-' && m.charAt(i + 2) == ')') {
-                    System.out.println(i);
-                    i += 3;
-                    continue;
-                }
-            }
-            i += 1;
-        }
-    }
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
s = input()
-
-i = 0
-size = len(s)
-while i < size:
-    if s[i] in [":", ";"]:
-        if i + 1 < size and s[i + 1] == ")":
-            print(i)
-            i += 2
-            continue
-        if i + 2 < size and s[i + 1] == "-" and s[i + 2] == ")":
-            print(i)
-            i += 3
-            continue
-
-    i += 1
-

🟢 Snapper Chain (Easy)

Solution in Python
1
+10
k = int(input())
+a = int(input())
+b = int(input())
+ans = []
+for i in range(0, k // a + 1):
+    if (k - a * i) % b == 0:
+        ans.append((i, (k - a * i) // b))
+print(len(ans))
+for i, j in ans:
+    print(i, j)
+

🟢 Turn It Up!

Solution in Python
1
+2
+3
+4
+5
+6
+7
volume = 7
+for _ in range(int(input())):
+    if input() == "Skru op!":
+        volume = min(volume + 1, 10)
+    else:
+        volume = max(volume - 1, 0)
+print(volume)
+

🟢 Slatkisi

Solution in Python
1
 2
 3
-4
-5
-6
-7
-8
-9
t = int(input())
-for i in range(t):
-    n, k = [int(d) for d in input().split()]
-    on = True
-    for _ in range(n):
-        if not k % 2:
-            on = False
-        k //= 2
-    print(f'Case #{i+1}: {"ON" if on else "OFF"}')
-

🟢 Snapper Chain (Hard)

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
t = int(input())
-for i in range(t):
-    n, k = [int(d) for d in input().split()]
-    on = True
-    for _ in range(n):
-        if not k % 2:
-            on = False
-        k //= 2
-    print(f'Case #{i+1}: {"ON" if on else "OFF"}')
-

🟢 Soda Slurper

Solutions in 2 languages
 1
+4
c, k = [int(d) for d in input().split()]
+d = 10**k
+c = (c // d) * d + (d if (c % d) / d >= 0.5 else 0)
+print(c)
+

🟢 SMIL

Solutions in 2 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
import java.util.Scanner;
+
+class SMIL {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        String m = s.nextLine();
+        int size = m.length();
+        int i = 0;
+        while (i < size) {
+            if (m.charAt(i) == ':' || m.charAt(i) == ';') {
+                if (i + 1 < size && m.charAt(i + 1) == ')') {
+                    System.out.println(i);
+                    i += 2;
+                    continue;
+                }
+                if (i + 2 < size && m.charAt(i + 1) == '-' && m.charAt(i + 2) == ')') {
+                    System.out.println(i);
+                    i += 3;
+                    continue;
+                }
+            }
+            i += 1;
+        }
+    }
+}
+
 1
  2
  3
  4
@@ -13751,93 +13715,103 @@
 13
 14
 15
-16
-17
package main
+16
s = input()
 
-import "fmt"
-
-func main() {
-    var e, f, c int
-    fmt.Scan(&e)
-    fmt.Scan(&f)
-    fmt.Scan(&c)
-    total := 0
-    s := e + f
-    for s >= c {
-        total += s / c
-        s = s%c + s/c
-    }
-    fmt.Println(total)
-}
-
1
+i = 0
+size = len(s)
+while i < size:
+    if s[i] in [":", ";"]:
+        if i + 1 < size and s[i + 1] == ")":
+            print(i)
+            i += 2
+            continue
+        if i + 2 < size and s[i + 1] == "-" and s[i + 2] == ")":
+            print(i)
+            i += 3
+            continue
+
+    i += 1
+

🟢 Snapper Chain (Easy)

Solution in Python
1
 2
 3
 4
 5
 6
-7
e, f, c = [int(d) for d in input().split()]
-total = 0
-s = e + f
-while s >= c:
-    total += s // c
-    s = s % c + s // c
-print(total)
-

🟢 Soft Passwords

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
from string import ascii_lowercase, ascii_uppercase, digits
-
-s = input()
-p = input()
-m = dict(zip(ascii_lowercase + ascii_uppercase, ascii_uppercase + ascii_lowercase))
-
-if s == p:
-    print("Yes")
-elif s[-1] in digits and s[:-1] == p:
-    print("Yes")
-elif s[0] in digits and s[1:] == p:
-    print("Yes")
-elif s == "".join(m.get(c, c) for c in p):
-    print("Yes")
-else:
-    print("No")
-

🟢 Sok

Solution in Python
1
-2
-3
-4
a, b, c = [int(d) for d in input().split()]
-i, j, k = [int(d) for d in input().split()]
-s = min(a / i, b / j, c / k)
-print(a - i * s, b - j * s, c - k * s)
-

🟢 Some Sum

Solution in Python
1
+7
+8
+9
t = int(input())
+for i in range(t):
+    n, k = [int(d) for d in input().split()]
+    on = True
+    for _ in range(n):
+        if not k % 2:
+            on = False
+        k //= 2
+    print(f'Case #{i+1}: {"ON" if on else "OFF"}')
+

🟢 Snapper Chain (Hard)

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
t = int(input())
+for i in range(t):
+    n, k = [int(d) for d in input().split()]
+    on = True
+    for _ in range(n):
+        if not k % 2:
+            on = False
+        k //= 2
+    print(f'Case #{i+1}: {"ON" if on else "OFF"}')
+

🟢 Soda Slurper

Solutions in 2 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
package main
+
+import "fmt"
+
+func main() {
+    var e, f, c int
+    fmt.Scan(&e)
+    fmt.Scan(&f)
+    fmt.Scan(&c)
+    total := 0
+    s := e + f
+    for s >= c {
+        total += s / c
+        s = s%c + s/c
+    }
+    fmt.Println(total)
+}
+
1
 2
 3
 4
 5
 6
-7
-8
-9
n = int(input())
-if n == 1:
-    print("Either")
-elif n == 2:
-    print("Odd")
-elif n % 2 == 0:
-    print("Even" if (n / 2) % 2 == 0 else "Odd")
-else:
-    print("Either")
-

🟢 Sort

Solution in Python
 1
+7
e, f, c = [int(d) for d in input().split()]
+total = 0
+s = e + f
+while s >= c:
+    total += s // c
+    s = s % c + s // c
+print(total)
+

🟢 Soft Passwords

Solution in Python
 1
  2
  3
  4
@@ -13852,81 +13826,47 @@
 13
 14
 15
-16
from collections import Counter
+16
from string import ascii_lowercase, ascii_uppercase, digits
 
-n, c = [int(d) for d in input().split()]
-num = [int(d) for d in input().split()]
-
-freq = Counter(num)
-print(
-    " ".join(
-        [
-            str(d)
-            for d in sorted(
-                num, key=lambda k: (freq[k], n - num.index(k)), reverse=True
-            )
-        ]
-    )
-)
-

🟢 Sort of Sorting

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
first = True
-while True:
-    n = int(input())
-    if not n:
-        break
-    else:
-        if not first:
-            print()
-    first = False
-    names = []
-    for _ in range(n):
-        names.append(input())
-    print("\n".join(sorted(names, key=lambda k: k[:2])))
-

🟢 Sort Two Numbers

Solutions in 4 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
#include <iostream>
-
-using namespace std;
-
-int main()
-{
-    int a = 0, b = 0;
-    cin >> a >> b;
-    if (a < b)
-    {
-        cout << a << " " << b;
-    }
-    else
-    {
-        cout << b << " " << a;
-    }
-}
-
 1
+s = input()
+p = input()
+m = dict(zip(ascii_lowercase + ascii_uppercase, ascii_uppercase + ascii_lowercase))
+
+if s == p:
+    print("Yes")
+elif s[-1] in digits and s[:-1] == p:
+    print("Yes")
+elif s[0] in digits and s[1:] == p:
+    print("Yes")
+elif s == "".join(m.get(c, c) for c in p):
+    print("Yes")
+else:
+    print("No")
+

🟢 Sok

Solution in Python
1
+2
+3
+4
a, b, c = [int(d) for d in input().split()]
+i, j, k = [int(d) for d in input().split()]
+s = min(a / i, b / j, c / k)
+print(a - i * s, b - j * s, c - k * s)
+

🟢 Some Sum

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
n = int(input())
+if n == 1:
+    print("Either")
+elif n == 2:
+    print("Odd")
+elif n % 2 == 0:
+    print("Even" if (n / 2) % 2 == 0 else "Odd")
+else:
+    print("Either")
+

🟢 Sort

Solution in Python
 1
  2
  3
  4
@@ -13939,43 +13879,83 @@
 11
 12
 13
-14
package main
+14
+15
+16
from collections import Counter
 
-import "fmt"
-
-func main() {
-    var a, b int
-    fmt.Scan(&a)
-    fmt.Scan(&b)
-    if a < b {
-        fmt.Printf("%d %d\n", a, b)
-    } else {
-        fmt.Printf("%d %d\n", b, a)
-    }
-}
-
1
-2
-3
-4
-5
-6
a, b = io.read("*n", "*n")
-if a < b then
-    print(a, b)
-else
-    print(b, a)
-end
-
1
-2
-3
-4
-5
-6
line = input()
-a, b = [int(d) for d in line.split()]
-if a < b:
-    print(a, b)
-else:
-    print(b, a)
-

🟢 Sóttkví

Solutions in 3 languages
 1
+n, c = [int(d) for d in input().split()]
+num = [int(d) for d in input().split()]
+
+freq = Counter(num)
+print(
+    " ".join(
+        [
+            str(d)
+            for d in sorted(
+                num, key=lambda k: (freq[k], n - num.index(k)), reverse=True
+            )
+        ]
+    )
+)
+

🟢 Sort of Sorting

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
first = True
+while True:
+    n = int(input())
+    if not n:
+        break
+    else:
+        if not first:
+            print()
+    first = False
+    names = []
+    for _ in range(n):
+        names.append(input())
+    print("\n".join(sorted(names, key=lambda k: k[:2])))
+

🟢 Sort Two Numbers

Solutions in 4 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
#include <iostream>
+
+using namespace std;
+
+int main()
+{
+    int a = 0, b = 0;
+    cin >> a >> b;
+    if (a < b)
+    {
+        cout << a << " " << b;
+    }
+    else
+    {
+        cout << b << " " << a;
+    }
+}
+
 1
  2
  3
  4
@@ -13988,61 +13968,43 @@
 11
 12
 13
-14
-15
-16
-17
-18
-19
import java.util.Scanner;
+14
package main
 
-class Sottkvi {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int n = s.nextInt();
-        int k = s.nextInt();
-        int today = s.nextInt();
-        int ans = 0;
-        for (int i = 0; i < n; i++) {
-            int d = s.nextInt();
-            if (d + 14 - today <= k) {
-                ans += 1;
-            }
-        }
-        System.out.println(ans);
-
-    }
-}
+import "fmt"
+
+func main() {
+    var a, b int
+    fmt.Scan(&a)
+    fmt.Scan(&b)
+    if a < b {
+        fmt.Printf("%d %d\n", a, b)
+    } else {
+        fmt.Printf("%d %d\n", b, a)
+    }
+}
 
1
 2
 3
 4
 5
-6
-7
-8
-9
n, k, today = io.read("*n", "*n", "*n")
-res = 0
-for _ = 1, n do
-    d = io.read("*n")
-    if d + 14 - today <= k then
-        res = res + 1
-    end
-end
-print(res)
+6
a, b = io.read("*n", "*n")
+if a < b then
+    print(a, b)
+else
+    print(b, a)
+end
 
1
 2
 3
 4
 5
-6
-7
n, k, today = [int(d) for d in input().split()]
-res = 0
-for _ in range(n):
-    d = int(input())
-    if d + 14 - today <= k:
-        res += 1
-print(res)
-

🟢 Soundex

Solution in Python
 1
+6
line = input()
+a, b = [int(d) for d in line.split()]
+if a < b:
+    print(a, b)
+else:
+    print(b, a)
+

🟢 Sóttkví

Solutions in 3 languages
 1
  2
  3
  4
@@ -14060,80 +14022,56 @@
 16
 17
 18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
m = {
-    "B": 1,
-    "F": 1,
-    "P": 1,
-    "V": 1,
-    "C": 2,
-    "G": 2,
-    "J": 2,
-    "K": 2,
-    "Q": 2,
-    "S": 2,
-    "X": 2,
-    "Z": 2,
-    "D": 3,
-    "T": 3,
-    "L": 4,
-    "M": 5,
-    "N": 5,
-    "R": 6,
-}
-
-while True:
-    try:
-        s = input()
-        s = [str(m.get(c, "")) for c in s]
-        prev = s[0]
-        ans = [prev]
-        for c in s[1:]:
-            if c != prev:
-                ans.append(c)
-                prev = c
-        print("".join(ans))
-    except:
-        break
-

🟢 Soylent

Solution in Python
1
+19
import java.util.Scanner;
+
+class Sottkvi {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int n = s.nextInt();
+        int k = s.nextInt();
+        int today = s.nextInt();
+        int ans = 0;
+        for (int i = 0; i < n; i++) {
+            int d = s.nextInt();
+            if (d + 14 - today <= k) {
+                ans += 1;
+            }
+        }
+        System.out.println(ans);
+
+    }
+}
+
1
 2
 3
 4
-5
import math
-
-for _ in range(int(input())):
-    n = int(input())
-    print(math.ceil(n / 400))
-

🟢 Space Race

Solution in Python
1
+5
+6
+7
+8
+9
n, k, today = io.read("*n", "*n", "*n")
+res = 0
+for _ = 1, n do
+    d = io.read("*n")
+    if d + 14 - today <= k then
+        res = res + 1
+    end
+end
+print(res)
+
1
 2
 3
 4
 5
 6
-7
-8
n = int(input())
-_ = input()
-d = {}
-for _ in range(n):
-    entry = input().split()
-    d[entry[0]] = float(entry[-1])
-
-print(min(d, key=lambda k: d[k]))
-

🟢 Spavanac

Solutions in 3 languages
 1
+7
n, k, today = [int(d) for d in input().split()]
+res = 0
+for _ in range(n):
+    d = int(input())
+    if d + 14 - today <= k:
+        res += 1
+print(res)
+

🟢 Soundex

Solution in Python
 1
  2
  3
  4
@@ -14156,101 +14094,75 @@
 21
 22
 23
-24
#include <iostream>
-
-using namespace std;
-
-int main()
-{
-    int h, m;
-    cin >> h >> m;
-
-    int mm = m - 45;
-    int borrow = 0;
-    if (mm < 0)
-    {
-        mm += 60;
-        borrow = 1;
-    }
-    int hh = h - borrow;
-    if (hh < 0)
-    {
-        hh += 24;
-    }
-    cout << hh << " " << mm << endl;
-    return 0;
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
import java.util.Scanner;
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
m = {
+    "B": 1,
+    "F": 1,
+    "P": 1,
+    "V": 1,
+    "C": 2,
+    "G": 2,
+    "J": 2,
+    "K": 2,
+    "Q": 2,
+    "S": 2,
+    "X": 2,
+    "Z": 2,
+    "D": 3,
+    "T": 3,
+    "L": 4,
+    "M": 5,
+    "N": 5,
+    "R": 6,
+}
+
+while True:
+    try:
+        s = input()
+        s = [str(m.get(c, "")) for c in s]
+        prev = s[0]
+        ans = [prev]
+        for c in s[1:]:
+            if c != prev:
+                ans.append(c)
+                prev = c
+        print("".join(ans))
+    except:
+        break
+

🟢 Soylent

Solution in Python
1
+2
+3
+4
+5
import math
 
-class Spavanac {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int h = s.nextInt();
-        int m = s.nextInt();
-
-        int mm = m - 45;
-        int borrow = 0;
-        if (mm < 0) {
-            mm += 60;
-            borrow = 1;
-        }
-
-        int hh = h - borrow;
-        if (hh < 0) {
-            hh += 24;
-        }
-        System.out.println(hh + " " + mm);
-    }
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
h, m = [int(d) for d in input().split()]
-
-mm = m - 45
-
-borrow = 0
-if mm < 0:
-    mm += 60
-    borrow = 1
-
-hh = h - borrow
-if hh < 0:
-    hh += 24
-
-print(hh, mm)
-

🟢 Speeding

Solution in Python
 1
+for _ in range(int(input())):
+    n = int(input())
+    print(math.ceil(n / 400))
+

🟢 Space Race

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
n = int(input())
+_ = input()
+d = {}
+for _ in range(n):
+    entry = input().split()
+    d[entry[0]] = float(entry[-1])
+
+print(min(d, key=lambda k: d[k]))
+

🟢 Spavanac

Solutions in 3 languages
 1
  2
  3
  4
@@ -14260,18 +14172,44 @@
  8
  9
 10
-11
n = int(input())
-mile, time, max_speed = 0, 0, 0
-for _ in range(n):
-    t, s = [int(d) for d in input().split()]
-    if not t and not s:
-        continue
-    speed = int((s - mile) / (t - time))
-    if speed > max_speed:
-        max_speed = speed
-    mile, time = s, t
-print(max_speed)
-

🟢 Speed Limit

Solution in Python
 1
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
#include <iostream>
+
+using namespace std;
+
+int main()
+{
+    int h, m;
+    cin >> h >> m;
+
+    int mm = m - 45;
+    int borrow = 0;
+    if (mm < 0)
+    {
+        mm += 60;
+        borrow = 1;
+    }
+    int hh = h - borrow;
+    if (hh < 0)
+    {
+        hh += 24;
+    }
+    cout << hh << " " << mm << endl;
+    return 0;
+}
+
 1
  2
  3
  4
@@ -14281,18 +14219,40 @@
  8
  9
 10
-11
while True:
-    n = int(input())
-    if n == -1:
-        break
-    miles = 0
-    elapsed = 0
-    for _ in range(n):
-        s, t = [int(d) for d in input().split()]
-        miles += s * (t - elapsed)
-        elapsed = t
-    print(f"{miles} miles")
-

🟢 Spelling Bee

Solution in Python
 1
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
import java.util.Scanner;
+
+class Spavanac {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int h = s.nextInt();
+        int m = s.nextInt();
+
+        int mm = m - 45;
+        int borrow = 0;
+        if (mm < 0) {
+            mm += 60;
+            borrow = 1;
+        }
+
+        int hh = h - borrow;
+        if (hh < 0) {
+            hh += 24;
+        }
+        System.out.println(hh + " " + mm);
+    }
+}
+
 1
  2
  3
  4
@@ -14301,41 +14261,67 @@
  7
  8
  9
-10
hexagon = input()
-c = hexagon[0]
-hexagon = set(list(hexagon))
-n = int(input())
-valid = []
-for _ in range(n):
-    w = input()
-    if c in w and len(w) >= 4 and set(list(w)) <= hexagon:
-        valid.append(w)
-print("\n".join(valid))
-

🟢 Spritt

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
n, x = [int(d) for d in input().split()]
-for _ in range(n):
-    x -= int(input())
-    if x < 0:
-        print("Neibb")
-        break
-if x >= 0:
-    print("Jebb")
-

🟢 Square Peg

Solution in Python
1
-2
-3
-4
-5
l, r = [int(d) for d in input().split()]
-if 2 * (l / 2) ** 2 <= r**2:
-    print("fits")
-else:
-    print("nope")
-

🟢 Illuminated City

Solution in Python
 1
+10
+11
+12
+13
+14
h, m = [int(d) for d in input().split()]
+
+mm = m - 45
+
+borrow = 0
+if mm < 0:
+    mm += 60
+    borrow = 1
+
+hh = h - borrow
+if hh < 0:
+    hh += 24
+
+print(hh, mm)
+

🟢 Speeding

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
n = int(input())
+mile, time, max_speed = 0, 0, 0
+for _ in range(n):
+    t, s = [int(d) for d in input().split()]
+    if not t and not s:
+        continue
+    speed = int((s - mile) / (t - time))
+    if speed > max_speed:
+        max_speed = speed
+    mile, time = s, t
+print(max_speed)
+

🟢 Speed Limit

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
while True:
+    n = int(input())
+    if n == -1:
+        break
+    miles = 0
+    elapsed = 0
+    for _ in range(n):
+        s, t = [int(d) for d in input().split()]
+        miles += s * (t - elapsed)
+        elapsed = t
+    print(f"{miles} miles")
+

🟢 Spelling Bee

Solution in Python
 1
  2
  3
  4
@@ -14344,358 +14330,310 @@
  7
  8
  9
-10
-11
-12
-13
n = int(input())
-x = int(input())
-y = int(input())
-l = sorted([int(d) for d in input().split()])
-
-total, c = 0, 0
-for d in l:
-    if (total + d * x) / (c + 1) <= y:
-        total += d * x
-        c += 1
-    else:
-        break
-print(c)
-

🟢 Stafur

Solution in Python
1
+10
hexagon = input()
+c = hexagon[0]
+hexagon = set(list(hexagon))
+n = int(input())
+valid = []
+for _ in range(n):
+    w = input()
+    if c in w and len(w) >= 4 and set(list(w)) <= hexagon:
+        valid.append(w)
+print("\n".join(valid))
+

🟢 Spritt

Solution in Python
1
 2
 3
 4
 5
 6
-7
l = input()
-if l in "AEIOU":
-    print("Jebb")
-elif l == "Y":
-    print("Kannski")
-else:
-    print("Neibb")
-

🟢 Statistics

Solution in Python
1
+7
+8
n, x = [int(d) for d in input().split()]
+for _ in range(n):
+    x -= int(input())
+    if x < 0:
+        print("Neibb")
+        break
+if x >= 0:
+    print("Jebb")
+

🟢 Square Peg

Solution in Python
1
 2
 3
 4
-5
-6
-7
-8
-9
case_num = 0
-while True:
-    try:
-        line = input()
-    except:
-        break
-    case_num += 1
-    numbers = [int(d) for d in line.split()[1:]]
-    print(f"Case {case_num}: {min(numbers)} {max(numbers)} {max(numbers)-min(numbers)}")
-

🟢 Sticky Keys

Solution in Python
1
-2
-3
-4
-5
-6
-7
message = input()
-
-l = [message[0]]
-for i in message[1:]:
-    if i != l[-1]:
-        l.append(i)
-print("".join(l))
-

🟢 Messy lists

Solution in Python
1
+5
l, r = [int(d) for d in input().split()]
+if 2 * (l / 2) ** 2 <= r**2:
+    print("fits")
+else:
+    print("nope")
+

🟢 Illuminated City

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
n = int(input())
+x = int(input())
+y = int(input())
+l = sorted([int(d) for d in input().split()])
+
+total, c = 0, 0
+for d in l:
+    if (total + d * x) / (c + 1) <= y:
+        total += d * x
+        c += 1
+    else:
+        break
+print(c)
+

🟢 Stafur

Solution in Python
1
 2
 3
-4
n = int(input())
-a = [int(d) for d in input().split()]
-s = sorted(a)
-print(sum([i != j for i, j in zip(a, s)]))
-

🟢 Stopwatch

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
n = int(input())
-times = []
-for _ in range(n):
-    times.append(int(input()))
-if n % 2:
-    print("still running")
-else:
-    seconds = 0
-    for i in range(0, n, 2):
-        seconds += times[i + 1] - times[i]
-    print(seconds)
-

🟢 Stórafmæli

Solutions in 2 languages
1
+4
+5
+6
+7
l = input()
+if l in "AEIOU":
+    print("Jebb")
+elif l == "Y":
+    print("Kannski")
+else:
+    print("Neibb")
+

🟢 Statistics

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
case_num = 0
+while True:
+    try:
+        line = input()
+    except:
+        break
+    case_num += 1
+    numbers = [int(d) for d in line.split()[1:]]
+    print(f"Case {case_num}: {min(numbers)} {max(numbers)} {max(numbers)-min(numbers)}")
+

🟢 Sticky Keys

Solution in Python
1
 2
 3
 4
 5
-6
n = io.read("*n")
-if n % 10 == 0 then
-    print('Jebb')
-else
-    print('Neibb')
-end
-
1
-2
n = int(input())
-print("Jebb" if n % 10 == 0 else "Neibb")
-

🟢 Streets Ahead

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
n, q = [int(d) for d in input().split()]
-
-s = {}
-for i in range(n):
-    s[input()] = i
-
-for _ in range(q):
-    a, b = input().split()
-    print(abs(s[a] - s[b]) - 1)
-

🟢 Successful Zoom

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
n = int(input())
-x = [int(d) for d in input().split()]
-found = False
-for k in range(1, n // 2 + 1):
-    v = [x[i] for i in range(k - 1, n, k)]
-    if all([v[i] < v[i + 1] for i in range(len(v) - 1)]):
-        print(k)
-        found = True
-        break
-if not found:
-    print("ABORT!")
-

🟢 Sum Kind of Problem

Solution in Python
1
-2
-3
-4
-5
-6
for _ in range(int(input())):
-    k, n = [int(d) for d in input().split()]
-    s1 = sum(range(1, n + 1))
-    s2 = sum(range(1, 2 * n + 1, 2))
-    s3 = sum(range(2, 2 * (n + 1), 2))
-    print(k, s1, s2, s3)
-

🟢 Sum of the Others

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
while True:
-    try:
-        n = [int(d) for d in input().split()]
-    except:
-        break
+6
+7
message = input()
+
+l = [message[0]]
+for i in message[1:]:
+    if i != l[-1]:
+        l.append(i)
+print("".join(l))
+

🟢 Messy lists

Solution in Python
1
+2
+3
+4
n = int(input())
+a = [int(d) for d in input().split()]
+s = sorted(a)
+print(sum([i != j for i, j in zip(a, s)]))
+

🟢 Stopwatch

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
n = int(input())
+times = []
+for _ in range(n):
+    times.append(int(input()))
+if n % 2:
+    print("still running")
+else:
+    seconds = 0
+    for i in range(0, n, 2):
+        seconds += times[i + 1] - times[i]
+    print(seconds)
+

🟢 Stórafmæli

Solutions in 2 languages
1
+2
+3
+4
+5
+6
n = io.read("*n")
+if n % 10 == 0 then
+    print('Jebb')
+else
+    print('Neibb')
+end
+
1
+2
n = int(input())
+print("Jebb" if n % 10 == 0 else "Neibb")
+

🟢 Streets Ahead

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
n, q = [int(d) for d in input().split()]
+
+s = {}
+for i in range(n):
+    s[input()] = i
 
-    for i in range(len(n)):
-        if n[i] == sum([n[j] for j in range(len(n)) if j != i]):
-            print(n[i])
-            break
-

🟢 Sum Squared Digits Function

Solution in Python
1
-2
-3
-4
-5
-6
-7
for _ in range(int(input())):
-    k, b, n = [int(d) for d in input().split()]
-    ssd = 0
-    while n:
-        ssd += (n % b) ** 2
-        n //= b
-    print(k, ssd)
-

🟢 Sun and Moon

Solutions in 2 languages
1
+for _ in range(q):
+    a, b = input().split()
+    print(abs(s[a] - s[b]) - 1)
+

🟢 Successful Zoom

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
n = int(input())
+x = [int(d) for d in input().split()]
+found = False
+for k in range(1, n // 2 + 1):
+    v = [x[i] for i in range(k - 1, n, k)]
+    if all([v[i] < v[i + 1] for i in range(len(v) - 1)]):
+        print(k)
+        found = True
+        break
+if not found:
+    print("ABORT!")
+

🟢 Sum Kind of Problem

Solution in Python
1
 2
 3
 4
 5
-6
-7
-8
ds, dy, dm, ym = io.read("*n", "*n", "*n", "*n")
-
-for t = 1, 5000 do
-    if (t + ds) % dy == 0 and (t + dm) % ym == 0 then
-        print(t)
-        break
-    end
-end
-
1
-2
-3
-4
-5
-6
-7
sun_years_ago, sun_cycle = [int(v) for v in input().split()]
-moon_years_ago, moon_cycle = [int(v) for v in input().split()]
-
-for t in range(1, 5001):
-    if (t + sun_years_ago) % sun_cycle == 0 and (t + moon_years_ago) % moon_cycle == 0:
-        print(t)
-        break
-

🟢 Superyatzy

Solution in Python
1
+6
for _ in range(int(input())):
+    k, n = [int(d) for d in input().split()]
+    s1 = sum(range(1, n + 1))
+    s2 = sum(range(1, 2 * n + 1, 2))
+    s3 = sum(range(2, 2 * (n + 1), 2))
+    print(k, s1, s2, s3)
+

🟢 Sum of the Others

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
while True:
+    try:
+        n = [int(d) for d in input().split()]
+    except:
+        break
+
+    for i in range(len(n)):
+        if n[i] == sum([n[j] for j in range(len(n)) if j != i]):
+            print(n[i])
+            break
+

🟢 Sum Squared Digits Function

Solution in Python
1
 2
 3
 4
-5
from collections import Counter
-
-n, m = [int(d) for d in input().split()]
-t = Counter([int(input()) for _ in range(n)])
-print("Ja" if max(t.values()) + m >= n else "Nej")
-

🟢 Symmetric Order

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
set_num = 0
-while True:
-    size = int(input())
-    if size == 0:
-        break
-
-    names = []
-    for _ in range(size):
-        names.append(input())
-
-    set_num += 1
-    print(f"SET {set_num}")
-
-    top, bottom = [], []
-    for i in range(1, size, 2):
-        bottom.append(names[i])
-    for i in range(0, size, 2):
-        top.append(names[i])
-    names = top + bottom[::-1]
-    for name in names:
-        print(name)
-

🟢 Synchronizing Lists

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
while True:
-    n = int(input())
-    if not n:
-        break
-    a, b = [], []
-    for _ in range(n):
-        a.append(int(input()))
-    for _ in range(n):
-        b.append(int(input()))
-    mapping = dict(zip(sorted(a), sorted(b)))
-    for key in a:
-        print(mapping[key])
-    print()
-

🟢 T9 Spelling

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
n = int(input())
-mapping = {
-    "2": "abc",
-    "3": "def",
-    "4": "ghi",
-    "5": "jkl",
-    "6": "mno",
-    "7": "pqrs",
-    "8": "tuv",
-    "9": "wxyz",
-    "0": " ",
-}
-
-for i in range(n):
-    ans = []
-    prev = ""
-    for c in input():
-        for d, r in mapping.items():
-            if c in r:
-                if d == prev:
-                    ans.append(" ")
-                ans.append(d * (r.index(c) + 1))
-                prev = d
-                break
-    print(f"Case #{i+1}: {''.join(ans)}")
-

🟢 Tai's formula

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
n = int(input())
-t1, v1 = [float(d) for d in input().split()]
-total = 0
-for _ in range(n - 1):
-    t2, v2 = [float(d) for d in input().split()]
-    total += (v1 + v2) * (t2 - t1) / 2
-    t1, v1 = t2, v2
-total /= 1000
-print(total)
-

🟢 Tajna

Solution in Python
 1
+5
+6
+7
for _ in range(int(input())):
+    k, b, n = [int(d) for d in input().split()]
+    ssd = 0
+    while n:
+        ssd += (n % b) ** 2
+        n //= b
+    print(k, ssd)
+

🟢 Sun and Moon

Solutions in 2 languages
1
+2
+3
+4
+5
+6
+7
+8
ds, dy, dm, ym = io.read("*n", "*n", "*n", "*n")
+
+for t = 1, 5000 do
+    if (t + ds) % dy == 0 and (t + dm) % ym == 0 then
+        print(t)
+        break
+    end
+end
+
1
+2
+3
+4
+5
+6
+7
sun_years_ago, sun_cycle = [int(v) for v in input().split()]
+moon_years_ago, moon_cycle = [int(v) for v in input().split()]
+
+for t in range(1, 5001):
+    if (t + sun_years_ago) % sun_cycle == 0 and (t + moon_years_ago) % moon_cycle == 0:
+        print(t)
+        break
+

🟢 Superyatzy

Solution in Python
1
+2
+3
+4
+5
from collections import Counter
+
+n, m = [int(d) for d in input().split()]
+t = Counter([int(input()) for _ in range(n)])
+print("Ja" if max(t.values()) + m >= n else "Nej")
+

🟢 Symmetric Order

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
set_num = 0
+while True:
+    size = int(input())
+    if size == 0:
+        break
+
+    names = []
+    for _ in range(size):
+        names.append(input())
+
+    set_num += 1
+    print(f"SET {set_num}")
+
+    top, bottom = [], []
+    for i in range(1, size, 2):
+        bottom.append(names[i])
+    for i in range(0, size, 2):
+        top.append(names[i])
+    names = top + bottom[::-1]
+    for name in names:
+        print(name)
+

🟢 Synchronizing Lists

Solution in Python
 1
  2
  3
  4
@@ -14705,166 +14643,214 @@
  8
  9
 10
-11
s = input()
-
-l = len(s)
-r = int(l**0.5)
-while l % r:
-    r -= 1
-c = l // r
-
-parts = [s[i : i + r] for i in range(0, l, r)]
-
-print("".join(["".join([row[i] for row in parts]) for i in range(r)]))
-

🟢 Takkar

Solutions in 2 languages
1
-2
-3
-4
-5
-6
-7
-8
-9
a = io.read("*n")
-b = io.read("*n")
-if a < b then
-    print("FAKE NEWS!")
-elseif a == b then
-    print("WORLD WAR 3!")
-else
-    print("MAGA!")
-end
-
1
+11
+12
+13
while True:
+    n = int(input())
+    if not n:
+        break
+    a, b = [], []
+    for _ in range(n):
+        a.append(int(input()))
+    for _ in range(n):
+        b.append(int(input()))
+    mapping = dict(zip(sorted(a), sorted(b)))
+    for key in a:
+        print(mapping[key])
+    print()
+

🟢 T9 Spelling

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
n = int(input())
+mapping = {
+    "2": "abc",
+    "3": "def",
+    "4": "ghi",
+    "5": "jkl",
+    "6": "mno",
+    "7": "pqrs",
+    "8": "tuv",
+    "9": "wxyz",
+    "0": " ",
+}
+
+for i in range(n):
+    ans = []
+    prev = ""
+    for c in input():
+        for d, r in mapping.items():
+            if c in r:
+                if d == prev:
+                    ans.append(" ")
+                ans.append(d * (r.index(c) + 1))
+                prev = d
+                break
+    print(f"Case #{i+1}: {''.join(ans)}")
+

🟢 Tai's formula

Solution in Python
1
 2
 3
 4
 5
 6
 7
-8
a = int(input())
-b = int(input())
-if a < b:
-    print("FAKE NEWS!")
-elif a == b:
-    print("WORLD WAR 3!")
-else:
-    print("MAGA!")
-

🟢 Takk fyrir mig

Solution in Python
1
-2
-3
n = int(input())
-for _ in range(n):
-    print(f"Takk {input()}")
-

🟢 Taktsveðjur

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
n = int(input())
-m = 1
-s = 0
-h = 0
-while n:
-    a = int(input())
-    if a > 0:
-        h += 1
-        if h == 2 * m:
-            m = min(m * 2, 8)
-            h = 0
-    else:
-        m = m // 2 or 1
-        h = 0
-
-    s += m * a
-    n -= 1
-print(s)
-

🟢 Tarifa

Solutions in 2 languages
1
+8
+9
n = int(input())
+t1, v1 = [float(d) for d in input().split()]
+total = 0
+for _ in range(n - 1):
+    t2, v2 = [float(d) for d in input().split()]
+    total += (v1 + v2) * (t2 - t1) / 2
+    t1, v1 = t2, v2
+total /= 1000
+print(total)
+

🟢 Tajna

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
s = input()
+
+l = len(s)
+r = int(l**0.5)
+while l % r:
+    r -= 1
+c = l // r
+
+parts = [s[i : i + r] for i in range(0, l, r)]
+
+print("".join(["".join([row[i] for row in parts]) for i in range(r)]))
+

🟢 Takkar

Solutions in 2 languages
1
+2
+3
+4
+5
+6
+7
+8
+9
a = io.read("*n")
+b = io.read("*n")
+if a < b then
+    print("FAKE NEWS!")
+elseif a == b then
+    print("WORLD WAR 3!")
+else
+    print("MAGA!")
+end
+
1
 2
 3
 4
 5
 6
-7
x = io.read("*n")
-n = io.read("*n")
-local used = 0
-for i = 1, n do
-    used = used + io.read("*n")
-end
-print(x * (n + 1) - used)
-
1
+7
+8
a = int(input())
+b = int(input())
+if a < b:
+    print("FAKE NEWS!")
+elif a == b:
+    print("WORLD WAR 3!")
+else:
+    print("MAGA!")
+

🟢 Takk fyrir mig

Solution in Python
1
 2
-3
-4
-5
-6
x = int(input())
-n = int(input())
-used = 0
-for _ in range(n):
-    used += int(input())
-print(x * (n + 1) - used)
-

🟢 Time Travelling Temperatures

Solution in Python
1
-2
-3
-4
-5
x, y = [int(d) for d in input().split()]
-if y == 1:
-    print("ALL GOOD" if not x else "IMPOSSIBLE")
-else:
-    print(-x / (y - 1))
-

🟡 Temperature Confusion

Solution in Python
1
+3
n = int(input())
+for _ in range(n):
+    print(f"Takk {input()}")
+

🟢 Taktsveðjur

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
n = int(input())
+m = 1
+s = 0
+h = 0
+while n:
+    a = int(input())
+    if a > 0:
+        h += 1
+        if h == 2 * m:
+            m = min(m * 2, 8)
+            h = 0
+    else:
+        m = m // 2 or 1
+        h = 0
+
+    s += m * a
+    n -= 1
+print(s)
+

🟢 Tarifa

Solutions in 2 languages
1
 2
 3
 4
 5
 6
-7
-8
-9
import math
-
-a, b = [int(d) for d in input().split("/")]
-x, y = 5 * a - 160 * b, 9 * b
-gcd = math.gcd(x, y)
-x //= gcd
-y //= gcd
-
-print(f"{x}/{y}")
-

🟢 Test Drive

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
a, b, c = [int(d) for d in input().split()]
-x, y = b - a, c - b
-if x == y:
-    print("cruised")
-elif x * y < 0:
-    print("turned")
-elif abs(y) > abs(x):
-    print("accelerated")
-else:
-    print("braked")
-

🟢 Tetration

Solution in Python
1
+7
x = io.read("*n")
+n = io.read("*n")
+local used = 0
+for i = 1, n do
+    used = used + io.read("*n")
+end
+print(x * (n + 1) - used)
+
1
+2
+3
+4
+5
+6
x = int(input())
+n = int(input())
+used = 0
+for _ in range(n):
+    used += int(input())
+print(x * (n + 1) - used)
+

🟢 Time Travelling Temperatures

Solution in Python
1
 2
 3
-4
import math
-
-n = float(input())
-print(f"{math.pow(n,1/n):.6f}")
-

🟢 Thanos

Solutions in 2 languages
1
+4
+5
x, y = [int(d) for d in input().split()]
+if y == 1:
+    print("ALL GOOD" if not x else "IMPOSSIBLE")
+else:
+    print(-x / (y - 1))
+

🟡 Temperature Confusion

Solution in Python
1
 2
 3
 4
@@ -14872,87 +14858,101 @@
 6
 7
 8
-9
for _ = 1, io.read("*n") do
-    p, r, f = io.read("*n", "*n", "*n")
-    y = 0
-    while p <= f do
-        p = p * r
-        y = y + 1
-    end
-    print(y)
-end
-
1
-2
-3
-4
-5
-6
-7
for _ in range(int(input())):
-    p, r, f = [int(d) for d in input().split()]
-    y = 0
-    while p <= f:
-        p *= r
-        y += 1
-    print(y)
-

🟢 The Grand Adventure

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
mapping = {"b": "$", "t": "|", "j": "*"}
-for _ in range(int(input())):
-    a = input()
-    bag = []
-    early_fail = False
-    for i in a:
-        if i in mapping.values():
-            bag.append(i)
-        elif i in mapping:
-            if not bag or bag.pop() != mapping[i]:
-                print("NO")
-                early_fail = True
-                break
-    if not early_fail:
-        print("YES" if not bag else "NO")
-

🟢 The Last Problem

Solutions in 3 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
package main
-
-import (
-    "bufio"
-    "fmt"
-    "os"
-)
-
-func main() {
-    scanner := bufio.NewScanner(os.Stdin)
-    scanner.Scan()
-    s := scanner.Text()
-    fmt.Println("Thank you,", s+",", "and farewell!")
-}
-
print(string.format("Thank you, %s, and farewell!", io.read()))
-
print(f"Thank you, {input()}, and farewell!")
-

🟢 The Plank

Solutions in 4 languages
 1
+9
import math
+
+a, b = [int(d) for d in input().split("/")]
+x, y = 5 * a - 160 * b, 9 * b
+gcd = math.gcd(x, y)
+x //= gcd
+y //= gcd
+
+print(f"{x}/{y}")
+

🟢 Test Drive

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
a, b, c = [int(d) for d in input().split()]
+x, y = b - a, c - b
+if x == y:
+    print("cruised")
+elif x * y < 0:
+    print("turned")
+elif abs(y) > abs(x):
+    print("accelerated")
+else:
+    print("braked")
+

🟢 Tetration

Solution in Python
1
+2
+3
+4
import math
+
+n = float(input())
+print(f"{math.pow(n,1/n):.6f}")
+

🟢 Thanos

Solutions in 2 languages
1
+2
+3
+4
+5
+6
+7
+8
+9
for _ = 1, io.read("*n") do
+    p, r, f = io.read("*n", "*n", "*n")
+    y = 0
+    while p <= f do
+        p = p * r
+        y = y + 1
+    end
+    print(y)
+end
+
1
+2
+3
+4
+5
+6
+7
for _ in range(int(input())):
+    p, r, f = [int(d) for d in input().split()]
+    y = 0
+    while p <= f:
+        p *= r
+        y += 1
+    print(y)
+

🟢 The Grand Adventure

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
mapping = {"b": "$", "t": "|", "j": "*"}
+for _ in range(int(input())):
+    a = input()
+    bag = []
+    early_fail = False
+    for i in a:
+        if i in mapping.values():
+            bag.append(i)
+        elif i in mapping:
+            if not bag or bag.pop() != mapping[i]:
+                print("NO")
+                early_fail = True
+                break
+    if not early_fail:
+        print("YES" if not bag else "NO")
+

🟢 The Last Problem

Solutions in 3 languages
 1
  2
  3
  4
@@ -14965,140 +14965,84 @@
 11
 12
 13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
#include <iostream>
+14
package main
 
-using namespace std;
-
-int f(int n)
-{
-    if (n == 0)
-    {
-        return 1;
-    }
-    else if (n == 1)
-    {
-        return 1;
-    }
-    else if (n == 2)
-    {
-        return 2;
-    }
-    else
-    {
-        return f(n - 1) + f(n - 2) + f(n - 3);
-    }
-}
-
-int main()
-{
-    int n;
-    cin >> n;
-    cout << f(n) << endl;
-    return 0;
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
package main
-
-import "fmt"
-
-func f(n int) int {
-    if n == 0 {
-        return 1
-    } else if n == 1 {
-        return 1
-    } else if n == 2 {
-        return 2
-    } else {
-        return f(n-1) + f(n-2) + f(n-3)
-    }
-
-}
-
-func main() {
-    var n int
-    fmt.Scan(&n)
-    fmt.Println(f(n))
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
function f(n)
-  if n == 0 then
-    return 1
-  elseif n == 1 then
-    return 1
-  elseif n == 2 then
-    return 2
-  else
-    return f(n - 1) + f(n - 2) + f(n - 3)
-  end
-end
-
-n = io.read("*n")
-print(f(n))
-
1
-2
-3
-4
-5
-6
-7
-8
def f(n):
-    if n < 3:
-        return {0: 1, 1: 1, 2: 2}[n]
-    else:
-        return f(n - 1) + f(n - 2) + f(n - 3)
-
-
-print(f(int(input())))
-

🟢 This Ain't Your Grandpa's Checkerboard

Solution in Python
 1
+import (
+    "bufio"
+    "fmt"
+    "os"
+)
+
+func main() {
+    scanner := bufio.NewScanner(os.Stdin)
+    scanner.Scan()
+    s := scanner.Text()
+    fmt.Println("Thank you,", s+",", "and farewell!")
+}
+
print(string.format("Thank you, %s, and farewell!", io.read()))
+
print(f"Thank you, {input()}, and farewell!")
+

🟢 The Plank

Solutions in 4 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
#include <iostream>
+
+using namespace std;
+
+int f(int n)
+{
+    if (n == 0)
+    {
+        return 1;
+    }
+    else if (n == 1)
+    {
+        return 1;
+    }
+    else if (n == 2)
+    {
+        return 2;
+    }
+    else
+    {
+        return f(n - 1) + f(n - 2) + f(n - 3);
+    }
+}
+
+int main()
+{
+    int n;
+    cin >> n;
+    cout << f(n) << endl;
+    return 0;
+}
+
 1
  2
  3
  4
@@ -15119,264 +15063,226 @@
 19
 20
 21
-22
-23
-24
-25
-26
-27
-28
-29
-30
n = int(input())
-b = []
-for _ in range(n):
-    b.append(input())
-
-
-def check(b, n):
-    for row in b:
-        if row.count("W") != row.count("B"):
-            return False
-
-        for j in range(0, n - 3):
-            if row[j] == row[j + 1] == row[j + 2]:
-                return False
+22
package main
+
+import "fmt"
+
+func f(n int) int {
+    if n == 0 {
+        return 1
+    } else if n == 1 {
+        return 1
+    } else if n == 2 {
+        return 2
+    } else {
+        return f(n-1) + f(n-2) + f(n-3)
+    }
 
-    for i in range(n):
-        col = ["".join(row[i]) for row in b]
-
-        if col.count("W") != col.count("B"):
-            return False
-
-        for j in range(0, n - 3):
-            if col[j] == col[j + 1] == col[j + 2]:
-                return False
-
-    return True
-
-
-valid = check(b, n)
-print(1 if valid else 0)
-

🟢 Thoring test

Solution in Python
1
-2
-3
-4
-5
-6
-7
-8
-9
n = int(input())
-w = [input().lower() for _ in range(n)]
-s = input().split()
-f = True
-for t in s:
-    if t.lower() not in w:
-        f = False
-        break
-print("Hi, how do I look today?" if f and s else "Thore has left the chat")
-

🟢 Til hamingju

Solutions in 8 languages
1
+}
+
+func main() {
+    var n int
+    fmt.Scan(&n)
+    fmt.Println(f(n))
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
function f(n)
+  if n == 0 then
+    return 1
+  elseif n == 1 then
+    return 1
+  elseif n == 2 then
+    return 2
+  else
+    return f(n - 1) + f(n - 2) + f(n - 3)
+  end
+end
+
+n = io.read("*n")
+print(f(n))
+
1
 2
 3
 4
 5
 6
-7
package main
-
-import "fmt"
-
-func main() {
-    fmt.Println("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!")
-}
-
1
-2
-3
-4
-5
class Tilhamingju {
-    public static void main(String[] args) {
-        System.out.println("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!");
-    }
-}
-
print("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!")
-
console.log("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!");
+7
+8
def f(n):
+    if n < 3:
+        return {0: 1, 1: 1, 2: 2}[n]
+    else:
+        return f(n - 1) + f(n - 2) + f(n - 3)
+
+
+print(f(int(input())))
+

🟢 This Ain't Your Grandpa's Checkerboard

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
n = int(input())
+b = []
+for _ in range(n):
+    b.append(input())
+
+
+def check(b, n):
+    for row in b:
+        if row.count("W") != row.count("B"):
+            return False
+
+        for j in range(0, n - 3):
+            if row[j] == row[j + 1] == row[j + 2]:
+                return False
+
+    for i in range(n):
+        col = ["".join(row[i]) for row in b]
+
+        if col.count("W") != col.count("B"):
+            return False
+
+        for j in range(0, n - 3):
+            if col[j] == col[j + 1] == col[j + 2]:
+                return False
+
+    return True
+
+
+valid = check(b, n)
+print(1 if valid else 0)
+

🟢 Thoring test

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
n = int(input())
+w = [input().lower() for _ in range(n)]
+s = input().split()
+f = True
+for t in s:
+    if t.lower() not in w:
+        f = False
+        break
+print("Hi, how do I look today?" if f and s else "Thore has left the chat")
+

🟢 Til hamingju

Solutions in 8 languages
1
+2
+3
+4
+5
+6
+7
package main
+
+import "fmt"
+
+func main() {
+    fmt.Println("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!")
+}
 
1
 2
-3
fun main() {
-    println("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!")
-}
-
print("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!")
-
print("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!")
-
puts "TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!"
-

🟢 Stuck In A Time Loop

Solutions in 3 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
#include <iostream>
-
-using namespace std;
-
-int main()
-{
-    int a;
-    cin >> a;
-    for (int i = 0; i < a; i++)
-    {
-        cout << i + 1 << " Abracadabra" << endl;
-    }
-}
-
1
-2
-3
for i = 1, io.read("*n") do
-    print(string.format("%d Abracadabra", i))
-end
-
1
-2
-3
n = int(input())
-for i in range(n):
-    print(f"{i+1} Abracadabra")
-

🟢 Title Cost

Solution in Python
1
-2
-3
s, c = input().split()
-c = float(c)
-print(min(c, len(s)))
-

🟢 Töflur

Solution in Python
1
+3
+4
+5
class Tilhamingju {
+    public static void main(String[] args) {
+        System.out.println("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!");
+    }
+}
+
print("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!")
+
console.log("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!");
+
1
+2
+3
fun main() {
+    println("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!")
+}
+
print("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!")
+
print("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!")
+
puts "TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!"
+

🟢 Stuck In A Time Loop

Solutions in 3 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
#include <iostream>
+
+using namespace std;
+
+int main()
+{
+    int a;
+    cin >> a;
+    for (int i = 0; i < a; i++)
+    {
+        cout << i + 1 << " Abracadabra" << endl;
+    }
+}
+
1
 2
-3
-4
n = int(input())
-a = sorted([int(d) for d in input().split()])
-score = sum([(a[j] - a[j + 1]) ** 2 for j in range(n - 1)])
-print(score)
-

🟢 Toilet Seat

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
t = input()
-
-
-def u(pos, preference):
-    if pos == preference == "U":
-        return 0
-    elif pos == preference == "D":
-        return 1
-    elif pos == "U" and preference == "D":
-        return 2
-    else:
-        return 1
-
-
-def l(pos, preference):
-    if pos == preference == "U":
-        return 1
-    elif pos == preference == "D":
-        return 0
-    elif pos == "U" and preference == "D":
-        return 1
-    else:
-        return 2
-
-
-def b(pos, preference):
-    if pos == preference:
-        return 0
-    else:
-        return 1
-
-
-pu = [u(pos, preference) for pos, preference in zip(t[0] + "U" * (len(t) - 2), t[1:])]
-pl = [l(pos, preference) for pos, preference in zip(t[0] + "D" * (len(t) - 2), t[1:])]
-pb = [b(pos, preference) for pos, preference in zip(t[0] + t[1:-1], t[1:])]
-
-print(sum(pu))
-print(sum(pl))
-print(sum(pb))
-

🟢 Tok Tik

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
n = int(input())
-d = {}
-for _ in range(n):
-    s, v = input().split()
-    v = int(v)
-    if s not in d:
-        d[s] = v
-    else:
-        d[s] += v
-print(max(d, key=lambda k: d[k]))
-

🟢 ToLower

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
p, t = [int(d) for d in input().split()]
-score = 0
-for _ in range(p):
-    solved = True
-    for _ in range(t):
-        s = input()
-        if solved:
-            s = s[0].lower() + s[1:]
-            if s.lower() == s:
-                continue
-        solved = False
-    if solved:
-        score += 1
-print(score)
-

🟢 Tölvunarfræðingar telja

Solutions in 5 languages
 1
+3
for i = 1, io.read("*n") do
+    print(string.format("%d Abracadabra", i))
+end
+
1
+2
+3
n = int(input())
+for i in range(n):
+    print(f"{i+1} Abracadabra")
+

🟢 Title Cost

Solution in Python
1
+2
+3
s, c = input().split()
+c = float(c)
+print(min(c, len(s)))
+

🟢 Töflur

Solution in Python
1
+2
+3
+4
n = int(input())
+a = sorted([int(d) for d in input().split()])
+score = sum([(a[j] - a[j + 1]) ** 2 for j in range(n - 1)])
+print(score)
+

🟢 Toilet Seat

Solution in Python
 1
  2
  3
  4
@@ -15386,141 +15292,167 @@
  8
  9
 10
-11
#include <iostream>
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
t = input()
 
-using namespace std;
-
-int main()
-{
-    int n;
-    cin >> n;
-    cout << n - 1 << endl;
-    return 0;
-}
-
1
-2
-3
-4
-5
-6
-7
-8
-9
package main
-
-import "fmt"
-
-func main() {
-    var n int
-    fmt.Scan(&n)
-    fmt.Println(n-1)
-}
-
1
-2
-3
fun main() {
-    println(readLine()!!.toInt() - 1)
-}
-
1
-2
n = io.read("*n")
-print(n - 1)
-
print(int(input()) - 1)
-

🟢 Tower Construction

Solutions in 2 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
n = io.read("*n")
-t = 0
-top = 0
-for _ = 1, n do
-    d = io.read("*n")
-    if top == 0 or d > top then
-        t = t + 1
-    end
-    top = d
-end
-print(t)
+
+def u(pos, preference):
+    if pos == preference == "U":
+        return 0
+    elif pos == preference == "D":
+        return 1
+    elif pos == "U" and preference == "D":
+        return 2
+    else:
+        return 1
+
+
+def l(pos, preference):
+    if pos == preference == "U":
+        return 1
+    elif pos == preference == "D":
+        return 0
+    elif pos == "U" and preference == "D":
+        return 1
+    else:
+        return 2
+
+
+def b(pos, preference):
+    if pos == preference:
+        return 0
+    else:
+        return 1
+
+
+pu = [u(pos, preference) for pos, preference in zip(t[0] + "U" * (len(t) - 2), t[1:])]
+pl = [l(pos, preference) for pos, preference in zip(t[0] + "D" * (len(t) - 2), t[1:])]
+pb = [b(pos, preference) for pos, preference in zip(t[0] + t[1:-1], t[1:])]
+
+print(sum(pu))
+print(sum(pl))
+print(sum(pb))
+

🟢 Tok Tik

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
n = int(input())
+d = {}
+for _ in range(n):
+    s, v = input().split()
+    v = int(v)
+    if s not in d:
+        d[s] = v
+    else:
+        d[s] += v
+print(max(d, key=lambda k: d[k]))
+

🟢 ToLower

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
p, t = [int(d) for d in input().split()]
+score = 0
+for _ in range(p):
+    solved = True
+    for _ in range(t):
+        s = input()
+        if solved:
+            s = s[0].lower() + s[1:]
+            if s.lower() == s:
+                continue
+        solved = False
+    if solved:
+        score += 1
+print(score)
+

🟢 Tölvunarfræðingar telja

Solutions in 5 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
#include <iostream>
+
+using namespace std;
+
+int main()
+{
+    int n;
+    cin >> n;
+    cout << n - 1 << endl;
+    return 0;
+}
+
1
+2
+3
+4
+5
+6
+7
+8
+9
package main
+
+import "fmt"
+
+func main() {
+    var n int
+    fmt.Scan(&n)
+    fmt.Println(n-1)
+}
+
1
+2
+3
fun main() {
+    println(readLine()!!.toInt() - 1)
+}
 
1
-2
-3
-4
-5
-6
-7
-8
-9
_ = input()
-n = 0
-top = 0
-for d in [int(d) for d in input().split()]:
-    if not top or d > top:
-        n += 1
-    top = d
-
-print(n)
-

🟢 Touchscreen Keyboard

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
k = [
-    "qwertyuiop",
-    "asdfghjkl",
-    "zxcvbnm",
-]
-
-
-def d(a, b):
-    for r1 in range(3):
-        if a in k[r1]:
-            c1 = k[r1].index(a)
-            break
-    for r2 in range(3):
-        if b in k[r2]:
-            c2 = k[r2].index(b)
-            break
-
-    return abs(c1 - c2) + abs(r1 - r2)
-
-
-for _ in range(int(input())):
-    x, n = input().split()
-    n, w = int(n), []
-
-    for _ in range(n):
-        y = input()
-        dist = sum([d(a, b) for a, b in zip(list(x), list(y))])
-        w.append([y, dist])
-
-    print("\n".join([f"{k} {v}" for k, v in sorted(w, key=lambda k: (k[1], k[0]))]))
-

🟢 Tracking Shares

Solution in Python
 1
+2
n = io.read("*n")
+print(n - 1)
+
print(int(input()) - 1)
+

🟢 Tower Construction

Solutions in 2 languages
 1
  2
  3
  4
@@ -15530,155 +15462,181 @@
  8
  9
 10
-11
-12
-13
-14
-15
-16
-17
-18
-19
c = int(input())
-shares = {}
-days = set()
-for i in range(c):
-    k = int(input())
-    record = {}
-    for _ in range(k):
-        n, d = [int(d) for d in input().split()]
-        days.add(d)
-        record[d] = n
-    shares[i] = record
-
-days = sorted(list(days))
-ans = [0] * c
-for i in range(len(days)):
-    d = days[i]
-    a = list(shares[j].get(d, ans[j]) for j in shares)
-    ans = a
-    print(sum(a), end=" ")
-

🟢 Training

Solutions in 2 languages
1
+11
n = io.read("*n")
+t = 0
+top = 0
+for _ = 1, n do
+    d = io.read("*n")
+    if top == 0 or d > top then
+        t = t + 1
+    end
+    top = d
+end
+print(t)
+
1
 2
 3
 4
 5
 6
 7
-8
n, s = io.read("*n", "*n")
-for _ = 1, n do
-    a, b = io.read("*n", "*n")
-    if s >= a and s <= b then
-        s = s + 1
-    end
-end
-print(s)
-
1
-2
-3
-4
-5
-6
n, s = [int(d) for d in input().split()]
-for _ in range(n):
-    a, b = [int(d) for d in input().split()]
-    if s >= a and s <= b:
-        s += 1
-print(s)
-

🟢 Tram

Solutions in 2 languages
1
-2
-3
-4
-5
-6
-7
n = io.read("*n")
-d = 0
-for i = 1, n do
-    x, y = io.read("*n", "*n")
-    d = d + 2 * (x - y)
-end
-print(-d / (2 * n))
-
1
+8
+9
_ = input()
+n = 0
+top = 0
+for d in [int(d) for d in input().split()]:
+    if not top or d > top:
+        n += 1
+    top = d
+
+print(n)
+

🟢 Touchscreen Keyboard

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
k = [
+    "qwertyuiop",
+    "asdfghjkl",
+    "zxcvbnm",
+]
+
+
+def d(a, b):
+    for r1 in range(3):
+        if a in k[r1]:
+            c1 = k[r1].index(a)
+            break
+    for r2 in range(3):
+        if b in k[r2]:
+            c2 = k[r2].index(b)
+            break
+
+    return abs(c1 - c2) + abs(r1 - r2)
+
+
+for _ in range(int(input())):
+    x, n = input().split()
+    n, w = int(n), []
+
+    for _ in range(n):
+        y = input()
+        dist = sum([d(a, b) for a, b in zip(list(x), list(y))])
+        w.append([y, dist])
+
+    print("\n".join([f"{k} {v}" for k, v in sorted(w, key=lambda k: (k[1], k[0]))]))
+

🟢 Tracking Shares

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
c = int(input())
+shares = {}
+days = set()
+for i in range(c):
+    k = int(input())
+    record = {}
+    for _ in range(k):
+        n, d = [int(d) for d in input().split()]
+        days.add(d)
+        record[d] = n
+    shares[i] = record
+
+days = sorted(list(days))
+ans = [0] * c
+for i in range(len(days)):
+    d = days[i]
+    a = list(shares[j].get(d, ans[j]) for j in shares)
+    ans = a
+    print(sum(a), end=" ")
+

🟢 Training

Solutions in 2 languages
1
 2
 3
 4
 5
-6
n = int(input())
-d = 0
-for _ in range(n):
-    x, y = [int(i) for i in input().split()]
-    d += 2 * (x - y)
-print(-d / (2 * n))
-

🟢 Transit Woes

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
s, t, n = [int(d) for d in input().split()]
-ds = [int(d) for d in input().split()]
-bs = [int(d) for d in input().split()]
-cs = [int(d) for d in input().split()]
-
-for i in range(n):
-    s += ds[i]
-    if not s % cs[i]:
-        wait_b = 0
-    else:
-        wait_b = cs[i] - s % cs[i]
-    s += wait_b + bs[i]
-
-s += ds[n]
-
-if s <= t:
-    print("yes")
-else:
-    print("no")
-

🟢 Translation

Solution in Python
1
+6
+7
+8
n, s = io.read("*n", "*n")
+for _ = 1, n do
+    a, b = io.read("*n", "*n")
+    if s >= a and s <= b then
+        s = s + 1
+    end
+end
+print(s)
+
1
+2
+3
+4
+5
+6
n, s = [int(d) for d in input().split()]
+for _ in range(n):
+    a, b = [int(d) for d in input().split()]
+    if s >= a and s <= b:
+        s += 1
+print(s)
+

🟢 Tram

Solutions in 2 languages
1
 2
 3
 4
 5
 6
-7
-8
_ = input()
-w = input().split()
-m = int(input())
-d = {}
-for _ in range(m):
-    k, v = input().split()
-    d[k] = v
-print(*[d[k] for k in w])
-

🟢 Trapizza

Solutions in 2 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
d, a, b, h = io.read("*n", "*n", "*n", "*n")
-m = math.pi * d * d / 4
-t = (a + b) * h / 2
-if m == t then
-    print('Jafn storar!')
-elseif m > t then
-    print('Mahjong!')
-else
-    print('Trapizza!')
-end
-
 1
+7
n = io.read("*n")
+d = 0
+for i = 1, n do
+    x, y = io.read("*n", "*n")
+    d = d + 2 * (x - y)
+end
+print(-d / (2 * n))
+
1
+2
+3
+4
+5
+6
n = int(input())
+d = 0
+for _ in range(n):
+    x, y = [int(i) for i in input().split()]
+    d += 2 * (x - y)
+print(-d / (2 * n))
+

🟢 Transit Woes

Solution in Python
 1
  2
  3
  4
@@ -15691,38 +15649,46 @@
 11
 12
 13
-14
from math import pi
-
-d = int(input())
-a = int(input())
-b = int(input())
-h = int(input())
-m = pi * d * d / 4
-t = (a + b) * h / 2
-if m == t:
-    print("Jafn storar!")
-elif m > t:
-    print("Mahjong!")
-else:
-    print("Trapizza!")
-

🟢 Three in a Row

Solution in Python
1
+14
+15
+16
+17
+18
+19
s, t, n = [int(d) for d in input().split()]
+ds = [int(d) for d in input().split()]
+bs = [int(d) for d in input().split()]
+cs = [int(d) for d in input().split()]
+
+for i in range(n):
+    s += ds[i]
+    if not s % cs[i]:
+        wait_b = 0
+    else:
+        wait_b = cs[i] - s % cs[i]
+    s += wait_b + bs[i]
+
+s += ds[n]
+
+if s <= t:
+    print("yes")
+else:
+    print("no")
+

🟢 Translation

Solution in Python
1
 2
 3
 4
 5
 6
 7
-8
-9
import math
-
-n = int(input())
-
-t = 0
-for i in range(1, math.ceil(n ** (1 / 3))):
-    if i * (i + 1) * (i + 2) < n:
-        t += 1
-print(t)
-

🟢 Tri

Solution in Python
 1
+8
_ = input()
+w = input().split()
+m = int(input())
+d = {}
+for _ in range(m):
+    k, v = input().split()
+    d[k] = v
+print(*[d[k] for k in w])
+

🟢 Trapizza

Solutions in 2 languages
 1
  2
  3
  4
@@ -15731,29 +15697,17 @@
  7
  8
  9
-10
-11
-12
-13
-14
-15
-16
from operator import add, mul, sub, truediv
-
-a, b, c = [int(d) for d in input().split()]
-ops = {
-    "+": add,
-    "-": sub,
-    "*": mul,
-    "/": truediv,
-}
-
-for op, func in ops.items():
-    if a == func(b, c):
-        print(f"{a}={b}{op}{c}")
-        break
-    if func(a, b) == c:
-        print(f"{a}{op}{b}={c}")
-

🟢 Triangle Area

Solutions in 5 languages
d, a, b, h = io.read("*n", "*n", "*n", "*n")
+m = math.pi * d * d / 4
+t = (a + b) * h / 2
+if m == t then
+    print('Jafn storar!')
+elseif m > t then
+    print('Mahjong!')
+else
+    print('Trapizza!')
+end
+
 1
  2
  3
  4
@@ -15763,37 +15717,41 @@
  8
  9
 10
-11
#include <iostream>
+11
+12
+13
+14
from math import pi
 
-using namespace std;
-
-int main()
-{
-    int h, b;
-    cin >> h >> b;
-    cout << float(h) * b / 2 << endl;
-    return 0;
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
package main
+d = int(input())
+a = int(input())
+b = int(input())
+h = int(input())
+m = pi * d * d / 4
+t = (a + b) * h / 2
+if m == t:
+    print("Jafn storar!")
+elif m > t:
+    print("Mahjong!")
+else:
+    print("Trapizza!")
+

🟢 Three in a Row

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
import math
 
-import "fmt"
+n = int(input())
 
-func main() {
-    var a, b int
-    fmt.Scan(&a)
-    fmt.Scan(&b)
-    fmt.Println(float32(a) * float32(b) / 2)
-}
-
 1
+t = 0
+for i in range(1, math.ceil(n ** (1 / 3))):
+    if i * (i + 1) * (i + 2) < n:
+        t += 1
+print(t)
+

🟢 Tri

Solution in Python
 1
  2
  3
  4
@@ -15802,23 +15760,69 @@
  7
  8
  9
-10
import java.util.Scanner;
+10
+11
+12
+13
+14
+15
+16
from operator import add, mul, sub, truediv
 
-class TriangleArea {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        float a = s.nextFloat();
-        int b = s.nextInt();
-        System.out.println(a * b / 2);
-    }
-}
-
1
-2
a, b = io.read("*n", "*n")
-print(a * b / 2)
-
1
-2
a, b = [int(d) for d in input().split()]
-print(a * b / 2)
-

🟢 Trik

Solution in Python
 1
+a, b, c = [int(d) for d in input().split()]
+ops = {
+    "+": add,
+    "-": sub,
+    "*": mul,
+    "/": truediv,
+}
+
+for op, func in ops.items():
+    if a == func(b, c):
+        print(f"{a}={b}{op}{c}")
+        break
+    if func(a, b) == c:
+        print(f"{a}{op}{b}={c}")
+

🟢 Triangle Area

Solutions in 5 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
#include <iostream>
+
+using namespace std;
+
+int main()
+{
+    int h, b;
+    cin >> h >> b;
+    cout << float(h) * b / 2 << endl;
+    return 0;
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
package main
+
+import "fmt"
+
+func main() {
+    var a, b int
+    fmt.Scan(&a)
+    fmt.Scan(&b)
+    fmt.Println(float32(a) * float32(b) / 2)
+}
+
 1
  2
  3
  4
@@ -15827,93 +15831,57 @@
  7
  8
  9
-10
-11
-12
-13
-14
-15
-16
moves = input()
-ball = [1, 0, 0]
-for move in moves:
-    if move == "A":
-        ball[0], ball[1] = ball[1], ball[0]
-    if move == "B":
-        ball[1], ball[2] = ball[2], ball[1]
-    if move == "C":
-        ball[0], ball[2] = ball[2], ball[0]
-
-if ball[0]:
-    print(1)
-elif ball[1]:
-    print(2)
-else:
-    print(3)
-

🟢 Triple Sevens

Solution in Python
1
-2
_ = input()
-print(777 if all("7" in input().split() for _ in range(3)) else 0)
-

🟢 Triple Texting

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
from collections import Counter
-
-s = input()
-times = 3
-size = len(s) // times
-messages = []
-for i in range(0, len(s), size):
-    messages.append(s[i : i + size])
-
-original = ""
-for i in range(size):
-    chars = [m[i] for m in messages]
-    if len(set(chars)) == 1:
-        original += chars[0]
-    else:
-        c = Counter(chars)
-        original += max(c, key=lambda k: c[k])
-
-print(original)
-

🟢 Troll Hunt

Solutions in 2 languages
1
-2
-3
-4
-5
-6
-7
b, k, g = io.read("*n", "*n", "*n")
-b = b - 1
-d = b // (k // g)
-if b % (k // g) > 0 then
-    d = d + 1
-end
-print(d)
-
1
-2
-3
-4
-5
-6
b, k, g = [int(d) for d in input().split()]
-b -= 1
-d = b // (k // g)
-if b % (k // g):
-    d += 1
-print(d)
-

🟢 Take Two Stones

Solutions in 7 languages
import java.util.Scanner;
+
+class TriangleArea {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        float a = s.nextFloat();
+        int b = s.nextInt();
+        System.out.println(a * b / 2);
+    }
+}
+
1
+2
a, b = io.read("*n", "*n")
+print(a * b / 2)
+
1
+2
a, b = [int(d) for d in input().split()]
+print(a * b / 2)
+

🟢 Trik

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
moves = input()
+ball = [1, 0, 0]
+for move in moves:
+    if move == "A":
+        ball[0], ball[1] = ball[1], ball[0]
+    if move == "B":
+        ball[1], ball[2] = ball[2], ball[1]
+    if move == "C":
+        ball[0], ball[2] = ball[2], ball[0]
+
+if ball[0]:
+    print(1)
+elif ball[1]:
+    print(2)
+else:
+    print(3)
+

🟢 Triple Sevens

Solution in Python
1
+2
_ = input()
+print(777 if all("7" in input().split() for _ in range(3)) else 0)
+

🟢 Triple Texting

Solution in Python
 1
  2
  3
  4
@@ -15925,56 +15893,56 @@
 10
 11
 12
-13
package main
+13
+14
+15
+16
+17
+18
+19
from collections import Counter
 
-import "fmt"
-
-func main() {
-    var n int
-    fmt.Scan(&n)
-    if n%2 == 1 {
-        fmt.Println("Alice")
-    } else {
-        fmt.Println("Bob")
-    }
-}
-
1
+s = input()
+times = 3
+size = len(s) // times
+messages = []
+for i in range(0, len(s), size):
+    messages.append(s[i : i + size])
+
+original = ""
+for i in range(size):
+    chars = [m[i] for m in messages]
+    if len(set(chars)) == 1:
+        original += chars[0]
+    else:
+        c = Counter(chars)
+        original += max(c, key=lambda k: c[k])
+
+print(original)
+

🟢 Troll Hunt

Solutions in 2 languages
1
 2
 3
 4
 5
-6
main = do
-    input <- getLine
-    let n = (read input :: Int)
-    if  n `mod` 2  ==  1
-    then putStrLn "Alice"
-        else putStrLn "Bob"
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
import java.util.Scanner;
-
-class TakeTwoStones {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int n = s.nextInt();
-        if (n % 2 == 1) {
-            System.out.println("Alice");
-        } else {
-            System.out.println("Bob");
-        }
-    }
-}
-
 1
+6
+7
b, k, g = io.read("*n", "*n", "*n")
+b = b - 1
+d = b // (k // g)
+if b % (k // g) > 0 then
+    d = d + 1
+end
+print(d)
+
1
+2
+3
+4
+5
+6
b, k, g = [int(d) for d in input().split()]
+b -= 1
+d = b // (k // g)
+if b % (k // g):
+    d += 1
+print(d)
+

🟢 Take Two Stones

Solutions in 7 languages
 1
  2
  3
  4
@@ -15983,248 +15951,220 @@
  7
  8
  9
-10
const readline = require("readline");
-const rl = readline.createInterface(process.stdin, process.stdout);
-
-rl.question("", (n) => {
-  if (parseInt(n) % 2) {
-    console.log("Alice");
-  } else {
-    console.log("Bob");
-  }
-});
+10
+11
+12
+13
package main
+
+import "fmt"
+
+func main() {
+    var n int
+    fmt.Scan(&n)
+    if n%2 == 1 {
+        fmt.Println("Alice")
+    } else {
+        fmt.Println("Bob")
+    }
+}
 
1
 2
 3
 4
 5
-6
-7
fun main() {
-    if (readLine()!!.toInt() % 2 == 1) {
-        println("Alice")
-    } else {
-        println("Bob")
-    }
-}
-
1
-2
-3
-4
-5
if io.read("*n") % 2 > 0 then
-    print("Alice")
-else
-    print("Bob")
-end
-
1
-2
-3
-4
if int(input()) % 2:
-    print("Alice")
-else:
-    print("Bob")
-

🟢 Two-sum

Solutions in 5 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
#include <iostream>
-
-using namespace std;
-
-int main()
-{
-    int a, b;
-    cin >> a >> b;
-    cout << a + b << endl;
-    return 0;
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
package main
-
-import "fmt"
-
-func main() {
-    var a, b int
-    fmt.Scan(&a)
-    fmt.Scan(&b)
-    fmt.Println(a + b)
-}
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
import java.util.Scanner;
-
-class TwoSum {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int a = s.nextInt();
-        int b = s.nextInt();
-        System.out.println(a + b);
-    }
-}
-
1
-2
a, b = io.read("*n", "*n")
-print(a + b)
-
1
-2
-3
line = input()
-a, b = [int(d) for d in line.split()]
-print(a + b)
-

🟢 Úllen dúllen doff

Solution in Python
1
-2
-3
-4
-5
-6
-7
n = int(input())
-names = input().split()
-if n < 13:
-    i = 13 % n - 1
-else:
-    i = 12
-print(names[i])
-

🟢 Úllen Dúllen Doff 2

Solution in Python
1
-2
-3
-4
-5
n = int(input())
-names = [input() for _ in range(n)]
-s = 12 if n >= 13 else 13 % n - 1
-names[0], names[s] = names[s], names[0]
-print("\n".join(names))
-

🟢 Ultimate Binary Watch

Solution in Python
1
+6
main = do
+    input <- getLine
+    let n = (read input :: Int)
+    if  n `mod` 2  ==  1
+    then putStrLn "Alice"
+        else putStrLn "Bob"
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
import java.util.Scanner;
+
+class TakeTwoStones {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int n = s.nextInt();
+        if (n % 2 == 1) {
+            System.out.println("Alice");
+        } else {
+            System.out.println("Bob");
+        }
+    }
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
const readline = require("readline");
+const rl = readline.createInterface(process.stdin, process.stdout);
+
+rl.question("", (n) => {
+  if (parseInt(n) % 2) {
+    console.log("Alice");
+  } else {
+    console.log("Bob");
+  }
+});
+
1
+2
+3
+4
+5
+6
+7
fun main() {
+    if (readLine()!!.toInt() % 2 == 1) {
+        println("Alice")
+    } else {
+        println("Bob")
+    }
+}
+
1
+2
+3
+4
+5
if io.read("*n") % 2 > 0 then
+    print("Alice")
+else
+    print("Bob")
+end
+
1
+2
+3
+4
if int(input()) % 2:
+    print("Alice")
+else:
+    print("Bob")
+

🟢 Two-sum

Solutions in 5 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
#include <iostream>
+
+using namespace std;
+
+int main()
+{
+    int a, b;
+    cin >> a >> b;
+    cout << a + b << endl;
+    return 0;
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
package main
+
+import "fmt"
+
+func main() {
+    var a, b int
+    fmt.Scan(&a)
+    fmt.Scan(&b)
+    fmt.Println(a + b)
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
import java.util.Scanner;
+
+class TwoSum {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int a = s.nextInt();
+        int b = s.nextInt();
+        System.out.println(a + b);
+    }
+}
+
1
+2
a, b = io.read("*n", "*n")
+print(a + b)
+
1
 2
-3
-4
-5
-6
-7
t = [int(d) for d in input()]
-b = [f"{d:b}".zfill(4) for d in t]
-
-for r in range(4):
-    row = ["." if b[i][r] == "0" else "*" for i in range(4)]
-    row.insert(2, " ")
-    print(" ".join(row))
-

🟢 Umferð

Solution in Python
1
+3
line = input()
+a, b = [int(d) for d in line.split()]
+print(a + b)
+

🟢 Úllen dúllen doff

Solution in Python
1
 2
 3
 4
 5
-6
m = int(input())
-n = int(input())
-cars = 0
-for _ in range(n):
-    cars += input().count(".")
-print(cars / (m * n))
-

🟢 Undead or Alive

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
s = input()
-
-smiley = ":)" in s
-
-frowny = ":(" in s
-
-if not frowny and smiley:
-    print("alive")
-
-elif frowny and not smiley:
-    print("undead")
-
-elif frowny and smiley:
-    print("double agent")
-
-else:
-    print("machine")
-

🟢 Unlock Pattern

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
import math
-
+6
+7
n = int(input())
+names = input().split()
+if n < 13:
+    i = 13 % n - 1
+else:
+    i = 12
+print(names[i])
+

🟢 Úllen Dúllen Doff 2

Solution in Python
1
+2
+3
+4
+5
n = int(input())
+names = [input() for _ in range(n)]
+s = 12 if n >= 13 else 13 % n - 1
+names[0], names[s] = names[s], names[0]
+print("\n".join(names))
+

🟢 Ultimate Binary Watch

Solution in Python
1
+2
+3
+4
+5
+6
+7
t = [int(d) for d in input()]
+b = [f"{d:b}".zfill(4) for d in t]
 
-def dist(a, b):
-    return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
-
-
-coords = {}
-for i in range(3):
-    n = [int(d) for d in input().split()]
-    for j in range(3):
-        coords[n[j]] = (i, j)
-
-values = [coords[k] for k in sorted(coords)]
-total, prev = 0, 0
-for i in range(1, 9):
-    total += dist(values[i], values[prev])
-    prev = i
-print(total)
-

🟢 Arrangement

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
import math
-
-n, m = int(input()), int(input())
-
-k = math.ceil(m / n)
-
-for _ in range(n - (n * k - m)):
-    print("*" * k)
-for _ in range(n * k - m):
-    print("*" * (k - 1))
-

🟢 UTF-8

Solution in Python
 1
+for r in range(4):
+    row = ["." if b[i][r] == "0" else "*" for i in range(4)]
+    row.insert(2, " ")
+    print(" ".join(row))
+

🟢 Umferð

Solution in Python
1
+2
+3
+4
+5
+6
m = int(input())
+n = int(input())
+cars = 0
+for _ in range(n):
+    cars += input().count(".")
+print(cars / (m * n))
+

🟢 Undead or Alive

Solution in Python
 1
  2
  3
  4
@@ -16240,58 +16180,24 @@
 14
 15
 16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
n = int(input())
-s = []
-for _ in range(n):
-    s.append(input())
-
-i = 0
-num = 0
-err = False
-t = [0] * 4
-while i < n:
-    a = s[i]
-    if a.startswith("0") and not num:
-        num = 0
-        t[0] += 1
-    elif a.startswith("110") and not num:
-        t[1] += 1
-        num = 1
-    elif a.startswith("1110") and not num:
-        t[2] += 1
-        num = 2
-    elif a.startswith("11110") and not num:
-        t[3] += 1
-        num = 3
-    elif a.startswith("10") and num:
-        num -= 1
-    else:
-        err = True
-        break
-    i += 1
-
-if err or num:
-    print("invalid")
-else:
-    print("\n".join([str(d) for d in t]))
-

🟡 Vaccine Efficacy

Solution in Python
s = input()
+
+smiley = ":)" in s
+
+frowny = ":(" in s
+
+if not frowny and smiley:
+    print("alive")
+
+elif frowny and not smiley:
+    print("undead")
+
+elif frowny and smiley:
+    print("double agent")
+
+else:
+    print("machine")
+

🟢 Unlock Pattern

Solution in Python
 1
  2
  3
  4
@@ -16309,130 +16215,26 @@
 16
 17
 18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
participants = int(input())
+19
import math
 
-vaccinated = 0
-control = 0
-infected_control_a = 0
-infected_vaccinated_a = 0
-infected_control_b = 0
-infected_vaccinated_b = 0
-infected_control_c = 0
-infected_vaccinated_c = 0
-
-for p in range(participants):
-    record = input()
-    v, a, b, c = list(record)
-
-    if v == "N":
-        control += 1
-    else:
-        vaccinated += 1
-
-    if a == "Y":
-        if v == "N":
-            infected_control_a += 1
-        else:
-            infected_vaccinated_a += 1
-
-    if b == "Y":
-        if v == "N":
-            infected_control_b += 1
-        else:
-            infected_vaccinated_b += 1
-
-    if c == "Y":
-        if v == "N":
-            infected_control_c += 1
-        else:
-            infected_vaccinated_c += 1
-
-
-def get_vaccine_efficacy(infected_vaccinated, vaccinated, infected_control, control):
-    infection_rate_vaccinated = infected_vaccinated / vaccinated
-    infection_rate_control = infected_control / control
-    return 1 - infection_rate_vaccinated / infection_rate_control
-
-
-vaccine_efficacy = [
-    get_vaccine_efficacy(
-        infected_vaccinated_a,
-        vaccinated,
-        infected_control_a,
-        control,
-    ),
-    get_vaccine_efficacy(
-        infected_vaccinated_b,
-        vaccinated,
-        infected_control_b,
-        control,
-    ),
-    get_vaccine_efficacy(
-        infected_vaccinated_c,
-        vaccinated,
-        infected_control_c,
-        control,
-    ),
-]
-
-for value in vaccine_efficacy:
-    if value <= 0:
-        print("Not Effective")
-    else:
-        print(f"{value*100:.6f}")
-

🟢 Right-of-Way

Solution in Python
 1
+
+def dist(a, b):
+    return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
+
+
+coords = {}
+for i in range(3):
+    n = [int(d) for d in input().split()]
+    for j in range(3):
+        coords[n[j]] = (i, j)
+
+values = [coords[k] for k in sorted(coords)]
+total, prev = 0, 0
+for i in range(1, 9):
+    total += dist(values[i], values[prev])
+    prev = i
+print(total)
+

🟢 Arrangement

Solution in Python
 1
  2
  3
  4
@@ -16441,29 +16243,17 @@
  7
  8
  9
-10
-11
-12
-13
-14
-15
-16
d = ["North", "East", "South", "West"]
-a, b, c = input().split()
-ia = d.index(a)
-ib = d.index(b)
-ic = d.index(c)
+10
import math
+
+n, m = int(input()), int(input())
+
+k = math.ceil(m / n)
 
-ib = (ib - ia) % 4
-ic = (ic - ia) % 4
-ia -= ia
-
-if ib == 2:
-    print("Yes" if ic == 3 else "No")
-elif ib == 1:
-    print("Yes" if ic in [2, 3] else "No")
-else:
-    print("No")
-

🟢 Variable Arithmetic

Solution in Python
 1
+for _ in range(n - (n * k - m)):
+    print("*" * k)
+for _ in range(n * k - m):
+    print("*" * (k - 1))
+

🟢 UTF-8

Solution in Python
 1
  2
  3
  4
@@ -16485,30 +16275,52 @@
 20
 21
 22
-23
context = {}
-while True:
-    s = input()
-    if s == "0":
-        break
-
-    if "=" in s:
-        x, y = [d.strip() for d in s.split("=")]
-        context[x] = int(y)
-    else:
-        v = [d.strip() for d in s.split("+")]
-        t = 0
-        n = []
-        for d in v:
-            if d.isdigit():
-                t += int(d)
-            elif d in context:
-                t += context[d]
-            else:
-                n.append(d)
-        if len(n) < len(v):
-            n = [str(t)] + n
-        print(" + ".join(n))
-

🟢 Veci

Solution in Python
 1
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
n = int(input())
+s = []
+for _ in range(n):
+    s.append(input())
+
+i = 0
+num = 0
+err = False
+t = [0] * 4
+while i < n:
+    a = s[i]
+    if a.startswith("0") and not num:
+        num = 0
+        t[0] += 1
+    elif a.startswith("110") and not num:
+        t[1] += 1
+        num = 1
+    elif a.startswith("1110") and not num:
+        t[2] += 1
+        num = 2
+    elif a.startswith("11110") and not num:
+        t[3] += 1
+        num = 3
+    elif a.startswith("10") and num:
+        num -= 1
+    else:
+        err = True
+        break
+    i += 1
+
+if err or num:
+    print("invalid")
+else:
+    print("\n".join([str(d) for d in t]))
+

🟡 Vaccine Efficacy

Solution in Python
 1
  2
  3
  4
@@ -16518,18 +16330,138 @@
  8
  9
 10
-11
from itertools import permutations
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
participants = int(input())
 
-x = input()
-
-values = sorted(set([int("".join(v)) for v in permutations(x, len(x))]))
-
-index = values.index(int(x))
-if index + 1 < len(values):
-    print(values[index + 1])
-else:
-    print(0)
-

🟡 Vector Functions

Solution in C++
 1
+vaccinated = 0
+control = 0
+infected_control_a = 0
+infected_vaccinated_a = 0
+infected_control_b = 0
+infected_vaccinated_b = 0
+infected_control_c = 0
+infected_vaccinated_c = 0
+
+for p in range(participants):
+    record = input()
+    v, a, b, c = list(record)
+
+    if v == "N":
+        control += 1
+    else:
+        vaccinated += 1
+
+    if a == "Y":
+        if v == "N":
+            infected_control_a += 1
+        else:
+            infected_vaccinated_a += 1
+
+    if b == "Y":
+        if v == "N":
+            infected_control_b += 1
+        else:
+            infected_vaccinated_b += 1
+
+    if c == "Y":
+        if v == "N":
+            infected_control_c += 1
+        else:
+            infected_vaccinated_c += 1
+
+
+def get_vaccine_efficacy(infected_vaccinated, vaccinated, infected_control, control):
+    infection_rate_vaccinated = infected_vaccinated / vaccinated
+    infection_rate_control = infected_control / control
+    return 1 - infection_rate_vaccinated / infection_rate_control
+
+
+vaccine_efficacy = [
+    get_vaccine_efficacy(
+        infected_vaccinated_a,
+        vaccinated,
+        infected_control_a,
+        control,
+    ),
+    get_vaccine_efficacy(
+        infected_vaccinated_b,
+        vaccinated,
+        infected_control_b,
+        control,
+    ),
+    get_vaccine_efficacy(
+        infected_vaccinated_c,
+        vaccinated,
+        infected_control_c,
+        control,
+    ),
+]
+
+for value in vaccine_efficacy:
+    if value <= 0:
+        print("Not Effective")
+    else:
+        print(f"{value*100:.6f}")
+

🟢 Right-of-Way

Solution in Python
 1
  2
  3
  4
@@ -16544,96 +16476,68 @@
 13
 14
 15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
#include "vectorfunctions.h"
-#include <algorithm>
-
-void backwards(std::vector<int> &vec)
-{
-    vec = std::vector<int>(vec.rbegin(), vec.rend());
-}
-
-std::vector<int> everyOther(const std::vector<int> &vec)
-{
-    std::vector<int> ans;
-
-    for (int i = 0; i < vec.size(); i += 2)
-        ans.push_back(vec[i]);
-
-    return ans;
-}
-
-int smallest(const std::vector<int> &vec)
-{
-    return *min_element(vec.begin(), vec.end());
-}
-
-int sum(const std::vector<int> &vec)
-{
-    int ans = 0;
-
-    for (auto it = begin(vec); it != end(vec); ++it)
-    {
-        ans += *it;
-    }
-
-    return ans;
-}
-
-int veryOdd(const std::vector<int> &suchVector)
-{
-    int ans = 0;
-    for (int i = 1; i < suchVector.size(); i += 2)
-    {
-        if (suchVector[i] % 2 == 1)
-            ans++;
-    }
-
-    return ans;
-}
-

🟢 Veður - Lokaðar heiðar

Solution in Python
1
-2
-3
-4
-5
-6
-7
v = int(input())
-for _ in range(int(input())):
-    s, k = input().split()
-    if int(k) >= v:
-        print(s, "opin")
-    else:
-        print(s, "lokud")
-

🟢 Veður - Vindhraði

Solution in Python
d = ["North", "East", "South", "West"]
+a, b, c = input().split()
+ia = d.index(a)
+ib = d.index(b)
+ic = d.index(c)
+
+ib = (ib - ia) % 4
+ic = (ic - ia) % 4
+ia -= ia
+
+if ib == 2:
+    print("Yes" if ic == 3 else "No")
+elif ib == 1:
+    print("Yes" if ic in [2, 3] else "No")
+else:
+    print("No")
+

🟢 Variable Arithmetic

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
context = {}
+while True:
+    s = input()
+    if s == "0":
+        break
+
+    if "=" in s:
+        x, y = [d.strip() for d in s.split("=")]
+        context[x] = int(y)
+    else:
+        v = [d.strip() for d in s.split("+")]
+        t = 0
+        n = []
+        for d in v:
+            if d.isdigit():
+                t += int(d)
+            elif d in context:
+                t += context[d]
+            else:
+                n.append(d)
+        if len(n) < len(v):
+            n = [str(t)] + n
+        print(" + ".join(n))
+

🟢 Veci

Solution in Python
 1
  2
  3
  4
@@ -16643,266 +16547,314 @@
  8
  9
 10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
k = float(input())
-if k < 0.3:
-    print("logn")
-elif k < 1.6:
-    print("Andvari")
-elif k < 3.4:
-    print("Kul")
-elif k < 5.5:
-    print("Gola")
-elif k < 8.0:
-    print("Stinningsgola")
-elif k < 10.8:
-    print("Kaldi")
-elif k < 13.9:
-    print("Stinningskaldi")
-elif k < 17.2:
-    print("Allhvass vindur")
-elif k < 20.8:
-    print("Hvassvidri")
-elif k < 24.5:
-    print("Stormur")
-elif k < 28.5:
-    print("Rok")
-
-elif k < 32.7:
-    print("Ofsavedur")
-else:
-    print("Farvidri")
-

🟢 Vefþjónatjón

Solution in Python
1
-2
-3
-4
-5
-6
-7
n = int(input())
-parts = [0, 0, 0]
-for _ in range(n):
-    for i, value in enumerate(input().split()):
-        if value == "J":
-            parts[i] += 1
-print(min(parts))
-

🟢 Velkomin!

Solutions in 9 languages
1
+11
from itertools import permutations
+
+x = input()
+
+values = sorted(set([int("".join(v)) for v in permutations(x, len(x))]))
+
+index = values.index(int(x))
+if index + 1 < len(values):
+    print(values[index + 1])
+else:
+    print(0)
+

🟡 Vector Functions

Solution in C++
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
#include "vectorfunctions.h"
+#include <algorithm>
+
+void backwards(std::vector<int> &vec)
+{
+    vec = std::vector<int>(vec.rbegin(), vec.rend());
+}
+
+std::vector<int> everyOther(const std::vector<int> &vec)
+{
+    std::vector<int> ans;
+
+    for (int i = 0; i < vec.size(); i += 2)
+        ans.push_back(vec[i]);
+
+    return ans;
+}
+
+int smallest(const std::vector<int> &vec)
+{
+    return *min_element(vec.begin(), vec.end());
+}
+
+int sum(const std::vector<int> &vec)
+{
+    int ans = 0;
+
+    for (auto it = begin(vec); it != end(vec); ++it)
+    {
+        ans += *it;
+    }
+
+    return ans;
+}
+
+int veryOdd(const std::vector<int> &suchVector)
+{
+    int ans = 0;
+    for (int i = 1; i < suchVector.size(); i += 2)
+    {
+        if (suchVector[i] % 2 == 1)
+            ans++;
+    }
+
+    return ans;
+}
+

🟢 Veður - Lokaðar heiðar

Solution in Python
1
 2
 3
 4
 5
 6
-7
#include <iostream>
-
-int main()
-{
-    std::cout << "VELKOMIN!";
-    return 0;
-}
-
1
-2
-3
-4
-5
-6
-7
package main
-
-import "fmt"
-
-func main() {
-    fmt.Println("VELKOMIN!")
-}
-
1
+7
v = int(input())
+for _ in range(int(input())):
+    s, k = input().split()
+    if int(k) >= v:
+        print(s, "opin")
+    else:
+        print(s, "lokud")
+

🟢 Veður - Vindhraði

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
k = float(input())
+if k < 0.3:
+    print("logn")
+elif k < 1.6:
+    print("Andvari")
+elif k < 3.4:
+    print("Kul")
+elif k < 5.5:
+    print("Gola")
+elif k < 8.0:
+    print("Stinningsgola")
+elif k < 10.8:
+    print("Kaldi")
+elif k < 13.9:
+    print("Stinningskaldi")
+elif k < 17.2:
+    print("Allhvass vindur")
+elif k < 20.8:
+    print("Hvassvidri")
+elif k < 24.5:
+    print("Stormur")
+elif k < 28.5:
+    print("Rok")
+
+elif k < 32.7:
+    print("Ofsavedur")
+else:
+    print("Farvidri")
+

🟢 Vefþjónatjón

Solution in Python
1
 2
 3
 4
-5
class Velkomin {
-    public static void main(String[] args) {
-        System.out.println("VELKOMIN!");
-    }
-}
-
print("VELKOMIN!")
-
console.log("VELKOMIN!");
+5
+6
+7
n = int(input())
+parts = [0, 0, 0]
+for _ in range(n):
+    for i, value in enumerate(input().split()):
+        if value == "J":
+            parts[i] += 1
+print(min(parts))
+

🟢 Velkomin!

Solutions in 9 languages
1
+2
+3
+4
+5
+6
+7
#include <iostream>
+
+int main()
+{
+    std::cout << "VELKOMIN!";
+    return 0;
+}
+
1
+2
+3
+4
+5
+6
+7
package main
+
+import "fmt"
+
+func main() {
+    fmt.Println("VELKOMIN!")
+}
 
1
 2
-3
fun main() {
-    println("VELKOMIN!")
-}
-
print("VELKOMIN!")
-
print("VELKOMIN!")
-
puts "VELKOMIN!"
-

🟢 Who wins?

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
board = []
-for _ in range(3):
-    board.append(input().split())
-
-winner = ""
-for i in range(3):
-    if board[i][0] == board[i][1] == board[i][2] and board[i][0] != "_":
-        winner = board[i][0]
-        break
-    elif board[0][i] == board[1][i] == board[2][i] and board[0][i] != "_":
-        winner = board[0][i]
-        break
-
-if board[0][0] == board[1][1] == board[2][2] and board[1][1] != "_":
-    winner = board[1][1]
-elif board[0][2] == board[1][1] == board[2][0] and board[1][1] != "_":
-    winner = board[1][1]
-
-if not winner:
-    winner = "ingen"
-elif winner == "X":
-    winner = "Johan"
-else:
-    winner = "Abdullah"
-
-print(f"{winner} har vunnit")
-

🟢 Video Speedup

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
n, p, k = [int(d) for d in input().split()]
-i = [int(d) for d in input().split()]
-
-start, total = 0, 0
-speed = 1
-for ti in i:
-    total += speed * (ti - start)
-    start = ti
-    speed += p / 100
-total += speed * (k - start)
-print(f"{total:.3f}")
-

🟢 Viðsnúningur

Solutions in 3 languages
1
-2
-3
fun main() {
-    println(StringBuilder(readLine()).reverse())
-}
-
print(io.read():reverse())
-
print(input()[::-1])
-
Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
for _ in range(int(input())):
-    n = int(input())
-    votes = [int(input()) for _ in range(n)]
-    largest = max(votes)
-    if votes.count(largest) > 1:
-        print("no winner")
-    else:
-        total = sum(votes)
-        winner = votes.index(largest)
-        print(
-            "majority" if votes[winner] > total / 2 else "minority",
-            "winner",
-            winner + 1,
-        )
-

🟢 Warehouse

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
for _ in range(int(input())):
-    n = int(input())
-    warehouse = {}
-    for _ in range(n):
-        s = input().split()
-        name, quantity = s[0], int(s[1])
-        if name not in warehouse:
-            warehouse[name] = quantity
-        else:
-            warehouse[name] += quantity
-    print(len(warehouse))
-    names = sorted(warehouse)
-    for name in sorted(
-        warehouse, key=lambda k: (warehouse[k], -names.index(k)), reverse=True
-    ):
-        print(name, warehouse[name])
-

🟢 Water Journal

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
n, a, b = [int(d) for d in input().split()]
-w = [int(input()) for _ in range(n - 1)]
-if a in w and b in w:
-    print("\n".join([str(d) for d in range(a, b + 1)]))
-elif a in w and b not in w:
-    print(b)
-elif a not in w and b in w:
-    print(a)
-else:
-    print(-1)
-

🟢 Weak Vertices

Solution in Python
 1
+3
+4
+5
class Velkomin {
+    public static void main(String[] args) {
+        System.out.println("VELKOMIN!");
+    }
+}
+
print("VELKOMIN!")
+
console.log("VELKOMIN!");
+
1
+2
+3
fun main() {
+    println("VELKOMIN!")
+}
+
print("VELKOMIN!")
+
print("VELKOMIN!")
+
puts "VELKOMIN!"
+

🟢 Who wins?

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
board = []
+for _ in range(3):
+    board.append(input().split())
+
+winner = ""
+for i in range(3):
+    if board[i][0] == board[i][1] == board[i][2] and board[i][0] != "_":
+        winner = board[i][0]
+        break
+    elif board[0][i] == board[1][i] == board[2][i] and board[0][i] != "_":
+        winner = board[0][i]
+        break
+
+if board[0][0] == board[1][1] == board[2][2] and board[1][1] != "_":
+    winner = board[1][1]
+elif board[0][2] == board[1][1] == board[2][0] and board[1][1] != "_":
+    winner = board[1][1]
+
+if not winner:
+    winner = "ingen"
+elif winner == "X":
+    winner = "Johan"
+else:
+    winner = "Abdullah"
+
+print(f"{winner} har vunnit")
+

🟢 Video Speedup

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
n, p, k = [int(d) for d in input().split()]
+i = [int(d) for d in input().split()]
+
+start, total = 0, 0
+speed = 1
+for ti in i:
+    total += speed * (ti - start)
+    start = ti
+    speed += p / 100
+total += speed * (k - start)
+print(f"{total:.3f}")
+

🟢 Viðsnúningur

Solutions in 3 languages
1
+2
+3
fun main() {
+    println(StringBuilder(readLine()).reverse())
+}
+
print(io.read():reverse())
+
print(input()[::-1])
+
Solution in Python
 1
  2
  3
  4
@@ -16915,51 +16867,21 @@
 11
 12
 13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
from itertools import combinations
-
-while True:
-    n = int(input())
-    if n == -1:
-        break
-    graph = {}
-    for i in range(n):
-        graph[str(i)] = [str(v) for v, e in zip(range(n), input().split()) if e == "1"]
-
-    # listing the weak vertices ordered from least to greatest
-    # I guess it means vertex number, not the weakness
-    # keys = sorted(graph, key=lambda x: len(graph[x]), reverse=True)
-
-    keys = graph.keys()
-
-    result = []
-
-    for key in keys:
-        has_triangle = False
-        for a, b in combinations(graph[key], 2):
-            if a in graph[b] and b in graph[a]:
-                has_triangle = True
-                break
-
-        if not has_triangle:
-            result.append(key)
-
-    print(" ".join(result))
-

🟡 WERTYU

Solution in Python
for _ in range(int(input())):
+    n = int(input())
+    votes = [int(input()) for _ in range(n)]
+    largest = max(votes)
+    if votes.count(largest) > 1:
+        print("no winner")
+    else:
+        total = sum(votes)
+        winner = votes.index(largest)
+        print(
+            "majority" if votes[winner] > total / 2 else "minority",
+            "winner",
+            winner + 1,
+        )
+

🟢 Warehouse

Solution in Python
 1
  2
  3
  4
@@ -16974,105 +16896,23 @@
 13
 14
 15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
mapping = {
-    # row 1
-    "1": "`",
-    "2": "1",
-    "3": "2",
-    "4": "3",
-    "5": "4",
-    "6": "5",
-    "7": "6",
-    "8": "7",
-    "9": "8",
-    "0": "9",
-    "-": "0",
-    "=": "-",
-    # row 2
-    "W": "Q",
-    "E": "W",
-    "R": "E",
-    "T": "R",
-    "Y": "T",
-    "U": "Y",
-    "I": "U",
-    "O": "I",
-    "P": "O",
-    "[": "P",
-    "]": "[",
-    "\\": "]",
-    # row 3
-    "S": "A",
-    "D": "S",
-    "F": "D",
-    "G": "F",
-    "H": "G",
-    "J": "H",
-    "K": "J",
-    "L": "K",
-    ";": "L",
-    "'": ";",
-    # row 4
-    "X": "Z",
-    "C": "X",
-    "V": "C",
-    "B": "V",
-    "N": "B",
-    "M": "N",
-    ",": "M",
-    ".": ",",
-    "/": ".",
-    " ": " ",
-}
-
-while True:
-    try:
-        s = input()
-    except:
-        break
-    print("".join([mapping[c] for c in s]))
-

🟢 What does the fox say?

Solution in Python
for _ in range(int(input())):
+    n = int(input())
+    warehouse = {}
+    for _ in range(n):
+        s = input().split()
+        name, quantity = s[0], int(s[1])
+        if name not in warehouse:
+            warehouse[name] = quantity
+        else:
+            warehouse[name] += quantity
+    print(len(warehouse))
+    names = sorted(warehouse)
+    for name in sorted(
+        warehouse, key=lambda k: (warehouse[k], -names.index(k)), reverse=True
+    ):
+        print(name, warehouse[name])
+

🟢 Water Journal

Solution in Python
 1
  2
  3
  4
@@ -17081,17 +16921,17 @@
  7
  8
  9
-10
for _ in range(int(input())):
-    words = input().split()
-    others = set()
-    while True:
-        line = input()
-        if line == "what does the fox say?":
-            break
-        w = line.split()[-1]
-        others.add(w)
-    print(" ".join(w for w in words if w not in others))
-

🟢 Which is Greater?

Solutions in 6 languages
n, a, b = [int(d) for d in input().split()]
+w = [int(input()) for _ in range(n - 1)]
+if a in w and b in w:
+    print("\n".join([str(d) for d in range(a, b + 1)]))
+elif a in w and b not in w:
+    print(b)
+elif a not in w and b in w:
+    print(a)
+else:
+    print(-1)
+

🟢 Weak Vertices

Solution in Python
 1
  2
  3
  4
@@ -17102,19 +16942,53 @@
  9
 10
 11
-12
#include <iostream>
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
from itertools import combinations
 
-using namespace std;
-
-int main()
-{
-    int a, b;
-    cin >> a >> b;
-    int ans = (a > b) ? 1 : 0;
-    cout << ans << endl;
-    return 0;
-}
-
 1
+while True:
+    n = int(input())
+    if n == -1:
+        break
+    graph = {}
+    for i in range(n):
+        graph[str(i)] = [str(v) for v, e in zip(range(n), input().split()) if e == "1"]
+
+    # listing the weak vertices ordered from least to greatest
+    # I guess it means vertex number, not the weakness
+    # keys = sorted(graph, key=lambda x: len(graph[x]), reverse=True)
+
+    keys = graph.keys()
+
+    result = []
+
+    for key in keys:
+        has_triangle = False
+        for a, b in combinations(graph[key], 2):
+            if a in graph[b] and b in graph[a]:
+                has_triangle = True
+                break
+
+        if not has_triangle:
+            result.append(key)
+
+    print(" ".join(result))
+

🟡 WERTYU

Solution in Python
 1
  2
  3
  4
@@ -17127,21 +17001,107 @@
 11
 12
 13
-14
package main
-
-import "fmt"
-
-func main() {
-    var a, b int
-    fmt.Scan(&a)
-    fmt.Scan(&b)
-    if a > b {
-        fmt.Println(1)
-    } else {
-        fmt.Println(0)
-    }
-}
-
 1
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
mapping = {
+    # row 1
+    "1": "`",
+    "2": "1",
+    "3": "2",
+    "4": "3",
+    "5": "4",
+    "6": "5",
+    "7": "6",
+    "8": "7",
+    "9": "8",
+    "0": "9",
+    "-": "0",
+    "=": "-",
+    # row 2
+    "W": "Q",
+    "E": "W",
+    "R": "E",
+    "T": "R",
+    "Y": "T",
+    "U": "Y",
+    "I": "U",
+    "O": "I",
+    "P": "O",
+    "[": "P",
+    "]": "[",
+    "\\": "]",
+    # row 3
+    "S": "A",
+    "D": "S",
+    "F": "D",
+    "G": "F",
+    "H": "G",
+    "J": "H",
+    "K": "J",
+    "L": "K",
+    ";": "L",
+    "'": ";",
+    # row 4
+    "X": "Z",
+    "C": "X",
+    "V": "C",
+    "B": "V",
+    "N": "B",
+    "M": "N",
+    ",": "M",
+    ".": ",",
+    "/": ".",
+    " ": " ",
+}
+
+while True:
+    try:
+        s = input()
+    except:
+        break
+    print("".join([mapping[c] for c in s]))
+

🟢 What does the fox say?

Solution in Python
 1
  2
  3
  4
@@ -17150,25 +17110,17 @@
  7
  8
  9
-10
-11
-12
-13
-14
import java.util.Scanner;
-
-class WhichisGreater {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int a = s.nextInt();
-        int b = s.nextInt();
-        if (a>b){
-            System.out.println(1);
-        }else{
-            System.out.println(0);
-        }
-    }
-}
-
for _ in range(int(input())):
+    words = input().split()
+    others = set()
+    while True:
+        line = input()
+        if line == "what does the fox say?":
+            break
+        w = line.split()[-1]
+        others.add(w)
+    print(" ".join(w for w in words if w not in others))
+

🟢 Which is Greater?

Solutions in 6 languages
 1
  2
  3
  4
@@ -17179,200 +17131,146 @@
  9
 10
 11
-12
-13
-14
const readline = require("readline");
-const rl = readline.createInterface(process.stdin, process.stdout);
-
-rl.question("", (line) => {
-  [a, b] = line
-    .trim()
-    .split(" ")
-    .map((e) => parseInt(e));
-  if (a > b) {
-    console.log(1);
-  } else {
-    console.log(0);
-  }
-});
-
1
-2
-3
-4
-5
-6
a, b = io.read("*n", "*n")
-if a > b then
-    print(1)
-else
-    print(0)
-end
-
1
-2
-3
-4
-5
a, b = [int(d) for d in input().split()]
-if a > b:
-    print(1)
-else:
-    print(0)
-

🟢 Wizard of Odds

Solutions in 2 languages
1
-2
-3
-4
-5
-6
n, k = io.read("*n", "*n")
-if math.log(n, 2) <= k then
-    print("Your wish is granted!")
-else
-    print("You will become a flying monkey!")
-end
+12
#include <iostream>
+
+using namespace std;
+
+int main()
+{
+    int a, b;
+    cin >> a >> b;
+    int ans = (a > b) ? 1 : 0;
+    cout << ans << endl;
+    return 0;
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
package main
+
+import "fmt"
+
+func main() {
+    var a, b int
+    fmt.Scan(&a)
+    fmt.Scan(&b)
+    if a > b {
+        fmt.Println(1)
+    } else {
+        fmt.Println(0)
+    }
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
import java.util.Scanner;
+
+class WhichisGreater {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int a = s.nextInt();
+        int b = s.nextInt();
+        if (a>b){
+            System.out.println(1);
+        }else{
+            System.out.println(0);
+        }
+    }
+}
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
const readline = require("readline");
+const rl = readline.createInterface(process.stdin, process.stdout);
+
+rl.question("", (line) => {
+  [a, b] = line
+    .trim()
+    .split(" ")
+    .map((e) => parseInt(e));
+  if (a > b) {
+    console.log(1);
+  } else {
+    console.log(0);
+  }
+});
 
1
 2
 3
 4
 5
-6
-7
-8
import math
-
-n, k = [int(d) for d in input().split()]
-ans = math.log(n, 2) <= k
-if ans:
-    print("Your wish is granted!")
-else:
-    print("You will become a flying monkey!")
-

🟡 Words for Numbers

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
mapping = {
-    0: "zero",
-    1: "one",
-    2: "two",
-    3: "three",
-    4: "four",
-    5: "five",
-    6: "six",
-    7: "seven",
-    8: "eight",
-    9: "nine",
-    10: "ten",
-    11: "eleven",
-    12: "twelve",
-}
-
-
-def f(d):
-    if d < 13:
-        return mapping[d]
-
-    ones = d % 10
-    if d < 20:
-        return {3: "thir", 5: "fif", 8: "eigh"}.get(ones, mapping[ones]) + "teen"
-
-    tens = d // 10
-    return (
-        {2: "twen", 3: "thir", 4: "for", 5: "fif", 8: "eigh"}.get(tens, mapping[tens])
-        + "ty"
-        + ("-" + mapping[ones] if ones else "")
-    )
-
-
-def t(w):
-    if w.isdigit():
-        return f(int(w))
-    else:
-        return w
-
-
-while True:
-    try:
-        words = input()
-    except:
-        break
-    print(" ".join([t(w) for w in words.split()]))
-

🟢 Yin and Yang Stones

Solution in Python
1
-2
s = input()
-print(1 if s.count("W") == s.count("B") else 0)
-

🟢 Yoda

Solution in Python
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
a, b = input(), input()
-size = max(len(a), len(b))
-
-a = [int(d) for d in a.zfill(size)]
-b = [int(d) for d in b.zfill(size)]
-
-ans_a = [d1 for d1, d2 in zip(a, b) if d1 >= d2]
-ans_b = [d2 for d1, d2 in zip(a, b) if d2 >= d1]
-
-
-def f(ans):
-    if not ans:
-        return "YODA"
-    else:
-        return int("".join([str(d) for d in ans]))
-
-
-print(f(ans_a))
-print(f(ans_b))
-

🟢 Zamka

Solution in Python
 1
+6
a, b = io.read("*n", "*n")
+if a > b then
+    print(1)
+else
+    print(0)
+end
+
1
+2
+3
+4
+5
a, b = [int(d) for d in input().split()]
+if a > b:
+    print(1)
+else:
+    print(0)
+

🟢 Wizard of Odds

Solutions in 2 languages
1
+2
+3
+4
+5
+6
n, k = io.read("*n", "*n")
+if math.log(n, 2) <= k then
+    print("Your wish is granted!")
+else
+    print("You will become a flying monkey!")
+end
+
1
+2
+3
+4
+5
+6
+7
+8
import math
+
+n, k = [int(d) for d in input().split()]
+ans = math.log(n, 2) <= k
+if ans:
+    print("Your wish is granted!")
+else:
+    print("You will become a flying monkey!")
+

🟡 Words for Numbers

Solution in Python
 1
  2
  3
  4
@@ -17383,73 +17281,127 @@
  9
 10
 11
-12
l, d, x = input(), input(), input()
-l, d, x = int(l), int(d), int(x)
-
-for i in range(l, d + 1):
-    if sum([int(d) for d in str(i)]) == x:
-        print(i)
-        break
-
-for i in range(d, l - 1, -1):
-    if sum([int(d) for d in str(i)]) == x:
-        print(i)
-        break
-

🟢 Stand on Zanzibar

Solutions in 2 languages
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
import java.util.Scanner;
-
-class StandOnZanzibar {
-    public static void main(String[] args) {
-        Scanner s = new Scanner(System.in);
-        int t = s.nextInt();
-        for (int i = 0; i < t; i++) {
-            int total = 0;
-            int n = 0;
-            int init = 1;
-            while (true) {
-                n = s.nextInt();
-                if (n == 0) {
-                    break;
-                }
-                total += Math.max(n - 2 * init, 0);
-                init = n;
-            }
-            System.out.println(total);
-        }
-    }
-}
-
1
-2
-3
-4
-5
-6
for _ in range(int(input())):
-    numbers = [int(d) for d in input().split()[:-1]]
-    total = 0
-    for i in range(1, len(numbers)):
-        total += max(numbers[i] - 2 * numbers[i - 1], 0)
-    print(total)
-

🟢 Un-bear-able Zoo

Solution in Python
 1
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
mapping = {
+    0: "zero",
+    1: "one",
+    2: "two",
+    3: "three",
+    4: "four",
+    5: "five",
+    6: "six",
+    7: "seven",
+    8: "eight",
+    9: "nine",
+    10: "ten",
+    11: "eleven",
+    12: "twelve",
+}
+
+
+def f(d):
+    if d < 13:
+        return mapping[d]
+
+    ones = d % 10
+    if d < 20:
+        return {3: "thir", 5: "fif", 8: "eigh"}.get(ones, mapping[ones]) + "teen"
+
+    tens = d // 10
+    return (
+        {2: "twen", 3: "thir", 4: "for", 5: "fif", 8: "eigh"}.get(tens, mapping[tens])
+        + "ty"
+        + ("-" + mapping[ones] if ones else "")
+    )
+
+
+def t(w):
+    if w.isdigit():
+        return f(int(w))
+    else:
+        return w
+
+
+while True:
+    try:
+        words = input()
+    except:
+        break
+    print(" ".join([t(w) for w in words.split()]))
+

🟢 Yin and Yang Stones

Solution in Python
1
+2
s = input()
+print(1 if s.count("W") == s.count("B") else 0)
+

🟢 Yoda

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
a, b = input(), input()
+size = max(len(a), len(b))
+
+a = [int(d) for d in a.zfill(size)]
+b = [int(d) for d in b.zfill(size)]
+
+ans_a = [d1 for d1, d2 in zip(a, b) if d1 >= d2]
+ans_b = [d2 for d1, d2 in zip(a, b) if d2 >= d1]
+
+
+def f(ans):
+    if not ans:
+        return "YODA"
+    else:
+        return int("".join([str(d) for d in ans]))
+
+
+print(f(ans_a))
+print(f(ans_b))
+

🟢 Zamka

Solution in Python
 1
  2
  3
  4
@@ -17460,44 +17412,121 @@
  9
 10
 11
-12
-13
-14
from collections import Counter
-
-lc = 0
-while True:
-    n = int(input())
-    if not n:
+12
l, d, x = input(), input(), input()
+l, d, x = int(l), int(d), int(x)
+
+for i in range(l, d + 1):
+    if sum([int(d) for d in str(i)]) == x:
+        print(i)
         break
-    lc += 1
-    l = Counter()
-    for _ in range(n):
-        animal = input().lower().split()
-        l[animal[-1]] += 1
-    print(f"List {lc}:")
-    print("\n".join([f"{k} | {l[k]}" for k in sorted(l)]))
-

🟢 Zoom

Solution in Python
1
-2
-3
n, k = [int(d) for d in input().split()]
-x = [int(d) for d in input().split()]
-print(" ".join([str(x[i]) for i in range(k - 1, n, k)]))
-

🟢 Zyxab

Solution in Python
1
+
+for i in range(d, l - 1, -1):
+    if sum([int(d) for d in str(i)]) == x:
+        print(i)
+        break
+

🟢 Stand on Zanzibar

Solutions in 2 languages
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
import java.util.Scanner;
+
+class StandOnZanzibar {
+    public static void main(String[] args) {
+        Scanner s = new Scanner(System.in);
+        int t = s.nextInt();
+        for (int i = 0; i < t; i++) {
+            int total = 0;
+            int n = 0;
+            int init = 1;
+            while (true) {
+                n = s.nextInt();
+                if (n == 0) {
+                    break;
+                }
+                total += Math.max(n - 2 * init, 0);
+                init = n;
+            }
+            System.out.println(total);
+        }
+    }
+}
+
1
 2
 3
 4
 5
-6
-7
-8
-9
n = int(input())
-names = [input() for _ in range(n)]
-names = [n for n in names if len(set(n)) == len(n) and len(n) >= 5]
-if names:
-    least = min(len(n) for n in names)
-    names = [n for n in names if len(n) == least]
-    print(max(names))
-else:
-    print("Neibb")
+6
for _ in range(int(input())):
+    numbers = [int(d) for d in input().split()[:-1]]
+    total = 0
+    for i in range(1, len(numbers)):
+        total += max(numbers[i] - 2 * numbers[i - 1], 0)
+    print(total)
+

🟢 Un-bear-able Zoo

Solution in Python
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
from collections import Counter
+
+lc = 0
+while True:
+    n = int(input())
+    if not n:
+        break
+    lc += 1
+    l = Counter()
+    for _ in range(n):
+        animal = input().lower().split()
+        l[animal[-1]] += 1
+    print(f"List {lc}:")
+    print("\n".join([f"{k} | {l[k]}" for k in sorted(l)]))
+

🟢 Zoom

Solution in Python
1
+2
+3
n, k = [int(d) for d in input().split()]
+x = [int(d) for d in input().split()]
+print(" ".join([str(x[i]) for i in range(k - 1, n, k)]))
+

🟢 Zyxab

Solution in Python
1
+2
+3
+4
+5
+6
+7
+8
+9
n = int(input())
+names = [input() for _ in range(n)]
+names = [n for n in names if len(set(n)) == len(n) and len(n) >= 5]
+if names:
+    least = min(len(n) for n in names)
+    names = [n for n in names if len(n) == least]
+    print(max(names))
+else:
+    print("Neibb")
 
\ No newline at end of file