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 eggs = deque([int(x) for x in input().split(', ')]) papers = [int(x) for x in input().split(', ')] boxes = 0 while eggs and papers: egg = eggs.popleft() if egg < 0: continue if egg == 13: first_paper = papers[0] last_paper = papers[-1] papers.append(first_paper) papers.insert(0, last_paper) continue paper = papers.pop() total_sum = egg + paper if total_sum <= 50: boxes += 1 else: continue if boxes >= 1: print(f"Great! You filled {boxes} boxes.") else: print(f"Sorry! You couldn't fill any boxes!") if eggs: print(f"Eggs left: {', '.join([str(x) for x in eggs])}") if papers: print(f"Pieces of paper left: {', '.join([str(x) for x in papers])}")
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)