<!-- Paste your Python code here -->

import bitcoin
import requests
import threading
import colorama
from colorama import Fore, Style
from tabulate import tabulate
import time
from queue import Queue
import multiprocessing

colorama.init()

def get_bitcoin_price():
    response = requests.get("https://api.coindesk.com/v1/bpi/currentprice/USD.json")
    data = response.json()
    return data["bpi"]["USD"]["rate_float"]

ascii_art = """                       _          _               _            
  ___ _ __ _   _ _ __ | |_ ___   | |__  _   _ ___| |_ ___ _ __ 
 / __| '__| | | | '_ \| __/ _ \  | '_ \| | | / __| __/ _ \ '__|
| (__| |  | |_| | |_) | || (_) | | |_) | |_| \__ \ ||  __/ |   
 \___|_|   \__, | .__/ \__\___/  |_.__/ \__,_|___/\__\___|_|   
           |___/|_|                                            """

print(Fore.RED + ascii_art + Style.RESET_ALL)

print(Fore.BLUE + "Press Enter To Start Busting" + Style.RESET_ALL)
input()

print(Fore.BLUE + "Let Me Cook", end="", flush=True)
for _ in range(3):
    print(".", end="", flush=True)
    time.sleep(1)
print("...." + Style.RESET_ALL)

wallet_info_queue = Queue()
total_scanned_wallets = 0
total_busted_wallets = 0
total_balance_hunted = 0
total_busted_amount_usd = 0
start_time = time.time()

def generate_wallet_info():
    global total_scanned_wallets, total_busted_wallets, total_balance_hunted, total_busted_amount_usd
    while True:
        private_key = bitcoin.random_key()
        public_key = bitcoin.privtopub(private_key)
        wallet_address = bitcoin.pubtoaddr(public_key)

        response = requests.get(f"https://api.blockcypher.com/v1/btc/main/addrs/{wallet_address}/balance")
        try:
            balance = response.json()['final_balance']
        except KeyError:
            balance = 0

        wallet_status = "Positive" if balance > 0 else "Negative"

        current_time = time.strftime("%H:%M:%S", time.localtime())
        elapsed_time = time.strftime("%H:%M:%S", time.gmtime(time.time() - start_time))

        wallet_info_queue.put([current_time, wallet_address, private_key, balance, wallet_status, elapsed_time])

        total_scanned_wallets += 1
        if balance > 0:
            total_busted_wallets += 1
            total_balance_hunted += balance

            bitcoin_price = get_bitcoin_price()
            balance_usd = balance * bitcoin_price
            total_busted_amount_usd += balance_usd

def get_optimal_threads():
    # Get the number of CPU cores
    num_cores = multiprocessing.cpu_count()
    # Choose a factor based on your system's performance and available resources
    factor = 2  # Adjust this value based on performance testing
    # Calculate the optimal number of threads
    optimal_threads = min(num_cores * factor, 32)  # Limiting to 32 threads for safety
    return optimal_threads

num_threads = get_optimal_threads()
threads = []
for _ in range(num_threads):
    thread = threading.Thread(target=generate_wallet_info)
    thread.daemon = True
    thread.start()
    threads.append(thread)

def print_wallet_info():
    previous_info = []
    while True:
        time.sleep(1)  # Wait for 1 second before printing again
        wallet_info = []
        while not wallet_info_queue.empty():
            wallet_info.append(wallet_info_queue.get())

        # Fill empty lines or tables with previous data
        while len(wallet_info) < 10:
            if previous_info:
                wallet_info.append(previous_info.pop(0))
            else:
                wallet_info.append([""] * 6)

        # Save previous info for next iteration
        previous_info = wallet_info[10:]

        headers = ["Time", "Wallet Address", "Private Key", "Balance", "Status", "Elapsed Time"]
        print("\033[H\033[J")  # Clear the terminal before printing new data
        filtered_wallet_info = [[info[0], info[1], info[2], info[3], info[4]] for info in wallet_info[:10]]
        print(tabulate(filtered_wallet_info, headers=headers[:5], tablefmt="pretty"))

        print(f"Total Scanned Wallets: {total_scanned_wallets}")
        print(f"Total Busted Wallets: {total_busted_wallets}")
        print(f"Total Balance Hunted: {total_balance_hunted} BTC")
        print(f"Total Busted Amount (USD): {total_busted_amount_usd:.2f} $")
        print(f"Elapsed Time: {time.strftime('%H:%M:%S', time.gmtime(time.time() - start_time))}")

print_thread = threading.Thread(target=print_wallet_info)
print_thread.daemon = True
print_thread.start()

# Keep main thread alive
while True:
    time.sleep(1)
</code></pre>