From 2d2769192d8378586ddb2bd1be744f27837e0d96 Mon Sep 17 00:00:00 2001 From: <> Date: Mon, 12 Aug 2024 05:18:18 +0000 Subject: [PATCH] Deployed 06898e6 with MkDocs version: 1.6.0 --- index.html | 2 +- search/search_index.json | 2 +- sitemap.xml.gz | Bin 127 -> 127 bytes solutions/index.html | 3967 +++++++++++++++++++------------------- 4 files changed, 1997 insertions(+), 1974 deletions(-) diff --git a/index.html b/index.html index a08224f..133fae7 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": 546}, {"Difficulty": "Medium", "Count": 36} ] }, "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": 70}, {"Initial": "C", "Count": 46}, {"Initial": "P", "Count": 45}, {"Initial": "T", "Count": 43}, {"Initial": "B", "Count": 41}, {"Initial": "A", "Count": 39}, {"Initial": "M", "Count": 32}, {"Initial": "F", "Count": 28}, {"Initial": "H", "Count": 27}, {"Initial": "D", "Count": 26}, {"Initial": "E", "Count": 22}, {"Initial": "R", "Count": 20}, {"Initial": "L", "Count": 19}, {"Initial": "G", "Count": 16}, {"Initial": "K", "Count": 15}, {"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": "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": "Ö", "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": 579}, {"Language": "Lua", "Count": 106}, {"Language": "Go", "Count": 47}, {"Language": "Java", "Count": 28}, {"Language": "C++", "Count": 24}, {"Language": "JavaScript", "Count": 11}, {"Language": "Kotlin", "Count": 11}, {"Language": "Ruby", "Count": 6}, {"Language": "Haskell", "Count": 4}, {"Language": "Julia", "Count": 3}, {"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-09

Skip to content

Logo

kattis

About the solutions to Kattis Problem Archive

Summary by Difficulty

{ "data": { "values": [ {"Difficulty": "Easy", "Count": 545}, {"Difficulty": "Medium", "Count": 37} ] }, "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": 70}, {"Initial": "C", "Count": 46}, {"Initial": "P", "Count": 45}, {"Initial": "T", "Count": 43}, {"Initial": "B", "Count": 41}, {"Initial": "A", "Count": 39}, {"Initial": "M", "Count": 32}, {"Initial": "F", "Count": 28}, {"Initial": "H", "Count": 27}, {"Initial": "D", "Count": 26}, {"Initial": "E", "Count": 22}, {"Initial": "R", "Count": 20}, {"Initial": "L", "Count": 19}, {"Initial": "G", "Count": 16}, {"Initial": "K", "Count": 15}, {"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": "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": "Ö", "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": 579}, {"Language": "Lua", "Count": 106}, {"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-12

Skip to content

582 Problems, 822 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);}      

582 Problems, 825 Solutions, 11 Languages

🟡 10 Kinds of People

Solution in Python
 1
  2
  3
  4
@@ -13492,7 +13492,7 @@
     print("Even" if (n / 2) % 2 == 0 else "Odd")
 else:
     print("Either")
-

🟢 Sort

Solution in Python
 1
+

🟡 Sort

Solution in Python
 1
  2
  3
  4
@@ -14745,186 +14745,86 @@
         f = False
         break
 print("Hi, how do I look today?" if f and s else "Thore has left the chat")
-

🟢 Til hamingju

Solutions in 5 languages
console.log("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!");
+

🟢 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
@@ -14934,141 +14834,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
@@ -15078,184 +15004,218 @@
  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")
-

🟢 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
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-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
-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
+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
+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")
+

🟢 Trapizza

Solutions in 2 languages
 1
  2
  3
  4
@@ -15264,29 +15224,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
@@ -15296,37 +15244,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
@@ -15335,23 +15287,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
@@ -15360,93 +15358,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
@@ -15458,56 +15420,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
@@ -15516,248 +15478,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
@@ -15773,58 +15707,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
@@ -15842,130 +15742,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
@@ -15974,29 +15770,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
@@ -16018,30 +15802,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
@@ -16051,18 +15857,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
@@ -16077,96 +16003,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
@@ -16176,266 +16074,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
@@ -16448,51 +16394,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
@@ -16507,105 +16423,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
@@ -16614,17 +16448,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
@@ -16635,19 +16469,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
@@ -16660,21 +16528,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
@@ -16683,25 +16637,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
@@ -16712,200 +16658,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
@@ -16916,73 +16808,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
@@ -16993,44 +16939,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