

from .imports import is_tqdm_available


if is_tqdm_available():
			from tqdm.auto import tqdm as _tqdm

from ..state import PartialState

def 			lowerCamelCase__			(       _a = True				,      *_a				,      **_a):
	if not is_tqdm_available():
		raise ImportError("Accelerate's `tqdm` module requires `tqdm` to be installed. Please run `pip install tqdm`.")
	SCREAMING_SNAKE_CASE :   List[Any]					  =							False
	if main_process_only:
		SCREAMING_SNAKE_CASE :   Optional[int]					  =							PartialState().local_process_index == 0
	return _tqdm(*_a				,      **_a				,      disable=_a)


def 			lowerCamelCase__			(       _a				,      _a):
	SCREAMING_SNAKE_CASE :   Optional[int]					  =							0
	while b > 0:
		if b & 1:
			res += a

		a += a
		b >>= 1

	return res

def 			lowerCamelCase__			(       _a				,      _a				,      _a):
	SCREAMING_SNAKE_CASE :   Optional[int]					  =							0
	while b > 0:
		if b & 1:
			SCREAMING_SNAKE_CASE :   Optional[Any]					  =							((res % c) + (a % c)) % c

		a += a
		b >>= 1

	return res