Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
from _collections import deque materials = [int(x) for x in input().split()] magic_level = deque([int(x) for x in input().split()]) presents = {} while materials and magic_level: box = materials.pop() magic = magic_level.popleft() total_magic_level = box * magic if total_magic_level == 150: if "Doll" not in presents: presents["Doll"] = 0 presents["Doll"] += 1 elif total_magic_level == 250: if "Wooden train" not in presents: presents["Wooden train"] = 0 presents["Wooden train"] += 1 elif total_magic_level == 300: if "Teddy bear" not in presents: presents["Teddy bear"] = 0 presents["Teddy bear"] += 1 elif total_magic_level == 400: if "Bicycle" not in presents: presents["Bicycle"] = 0 presents["Bicycle"] += 1 else: if total_magic_level < 0: result = box + magic materials.append(result) if total_magic_level > 0 and total_magic_level != 150 and total_magic_level != 250 and total_magic_level != 300 and total_magic_level != 400: box += 15 materials.append(box) if box == 0 and magic == 0: continue if box == 0: magic_level.appendleft(magic) continue if magic == 0: materials.append(box) continue if "Doll" and "Wooden train" in presents or "Teddy bear" and "Bicycle" in presents: print("The presents are crafted! Merry Christmas!") else: print("No presents this Christmas!") if materials: materials_left = ', '.join([str(x) for x in reversed(materials)]) print(f"Materials left: {materials_left}") if magic_level: print(f"Magic left: {', '.join([str(x) for x in magic_level])}") for k, v in presents.items(): print(f"{k}: {v}")
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)