Best Python code snippet using molotov_python
main.py
Source:main.py
1#!/usr/bin/env python2# -*- coding: utf-8 -*-3import sys4sys.setrecursionlimit(10**7)5from pprint import pprint as pp6from pprint import pformat as pf7# @pysnooper.snoop()8#import pysnooper # debug9import math10#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder11import bisect12# Queue is very slow13# use global: counts14# use global: not_connected: 15# yet: bit set of yet determined16# this is fast enough for 72 vertex17def independent_set_count(yet):18 if yet in counts:19 return counts[yet]20 youngest = yet & -1 * yet21 not_me = yet ^ youngest22 yes_me = yet & not_connected[youngest.bit_length() - 1]23 #print("yet", bin(yet)[2:]) # debug24 #print("not_me", bin(not_me)[2:]) # debug25 #print("yes_me", bin(yes_me)[2:]) # debug26 counts[yet] = independent_set_count(not_me) + independent_set_count(yes_me)27 return counts[yet]28if __name__ == '__main__':29 n = 330 not_connected = [ # graph size 3 e 0 231 int("010", 2),32 int("101", 2),33 int("010", 2),34 ]35 #print("not_connected", not_connected) # debug36 counts = {0: 1}37 ans = independent_set_count((1 << n) - 1)38 #print('ans') # debug39 print(ans)...
other_func.py
Source:other_func.py
1# - *- coding: utf- 8 - *-2import requests3from aiogram import Dispatcher4from data import config5from data.config import admins6from loader import bot7# Уведомление и пÑовеÑка Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ Ð¿Ñи запÑÑке ÑкÑипÑа8async def on_startup_notify(dp: Dispatcher):9 if len(admins) >= 1:10 await send_all_admin(f"<b>â
ÐÐ¾Ñ Ð±Ñл ÑÑпеÑно запÑÑен</b>")11# РаÑÑÑлка ÑообÑÐµÐ½Ð¸Ñ Ð²Ñем админиÑÑÑаÑоÑам12async def send_all_admin(message, markup=None, not_me=0):13 if markup is None:14 for admin in admins:15 try:16 if str(admin) != str(not_me):17 await bot.send_message(admin, message, disable_web_page_preview=True)18 except:19 pass20 else:21 for admin in admins:22 try:23 if str(admin) != str(not_me):24 await bot.send_message(admin, message, reply_markup=markup, disable_web_page_preview=True)25 except:...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!