Guest User

Buźka

a guest
Mar 25th, 2026
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | Haiku | 0 0
  1. import sys
  2. import subprocess
  3.  
  4. def main():
  5.     if len(sys.argv) != 2:
  6.         print("python3 buzka.py <binary>")
  7.         return
  8.  
  9.     binary = sys.argv[1]
  10.  
  11.     n = 500_000
  12.     q = 100_000
  13.  
  14.     lines = []
  15.     lines.append(f"{n} {q}")
  16.     lines.extend(["0 2"] * n)
  17.     lines.extend([f"0 0 {n}"] * q)
  18.     input_data = "\n".join(lines) + "\n"
  19.  
  20.     try:
  21.         result = subprocess.run(
  22.             [binary],
  23.             input=input_data.encode(),
  24.             stdout=subprocess.DEVNULL,
  25.             stderr=subprocess.DEVNULL,
  26.             timeout=5
  27.         )
  28.  
  29.         if result.returncode == 0:
  30.             print(":)")
  31.         else:
  32.             print(":(")
  33.     except subprocess.TimeoutExpired:
  34.         print(":(")
  35.  
  36. if __name__ == "__main__":
  37.     main()
Advertisement
Add Comment
Please, Sign In to add comment