


"""simple docstring"""







from collections import defaultdict
from math import ceil, sqrt




def    UpperCAmelCase__       (lowerCAmelCase_ = 100_0000  ,						lowerCAmelCase_ = 10   ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE						   =				defaultdict(lowerCAmelCase_   )

					for outer_width in range(3  ,						(t_limit // 4) + 2   ):
										if outer_width * outer_width > t_limit:
															__SCREAMING_SNAKE_CASE						   =				max(
															    ceil(sqrt(outer_width * outer_width - t_limit   )   )  ,						1   )
										else:
															__SCREAMING_SNAKE_CASE						   =				1

										hole_width_lower_bound += (outer_width - hole_width_lower_bound) % 2

										for hole_width in range(lowerCAmelCase_  ,						outer_width - 1  ,						2   ):
															count[outer_width * outer_width - hole_width * hole_width] += 1

					return sum(1 for n in count.values() if 1 <= n <= 10   )


if __name__ == "__main__":
		print(F"{solution() = }")




"""simple docstring"""







import warnings

from ...utils import is_sklearn_available, requires_backends


if is_sklearn_available():
		from scipy.stats import pearsonr, spearmanr
		from sklearn.metrics import fa_score, matthews_corrcoef


a__				:							Any						=     (
    '''This metric will be removed from the library soon, metrics should be handled with the 🤗 Evaluate '''
    '''library. You can have a look at this example script for pointers: '''
    '''https://github.com/huggingface/transformers/blob/main/examples/pytorch/text-classification/run_glue.py'''
)




def    UpperCAmelCase__       (lowerCAmelCase_  ,						lowerCAmelCase_   ):




					'''simple docstring'''


					warnings.warn(lowerCAmelCase_  ,						lowerCAmelCase_   )
					requires_backends(lowerCAmelCase_  ,						"sklearn"   )
					return (preds == labels).mean()




def    UpperCAmelCase__       (lowerCAmelCase_  ,						lowerCAmelCase_   ):




					'''simple docstring'''


					warnings.warn(lowerCAmelCase_  ,						lowerCAmelCase_   )
					requires_backends(lowerCAmelCase_  ,						"sklearn"   )
					__SCREAMING_SNAKE_CASE						   =				simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )
					__SCREAMING_SNAKE_CASE						   =				fa_score(y_true=lowerCAmelCase_  ,						y_pred=lowerCAmelCase_   )
					return {
					    "acc": acc,
					    "f1": fa,
					    "acc_and_f1": (acc + fa) / 2,
					}




def    UpperCAmelCase__       (lowerCAmelCase_  ,						lowerCAmelCase_   ):




					'''simple docstring'''


					warnings.warn(lowerCAmelCase_  ,						lowerCAmelCase_   )
					requires_backends(lowerCAmelCase_  ,						"sklearn"   )
					__SCREAMING_SNAKE_CASE						   =				pearsonr(lowerCAmelCase_  ,						lowerCAmelCase_   )[0]
					__SCREAMING_SNAKE_CASE						   =				spearmanr(lowerCAmelCase_  ,						lowerCAmelCase_   )[0]
					return {
					    "pearson": pearson_corr,
					    "spearmanr": spearman_corr,
					    "corr": (pearson_corr + spearman_corr) / 2,
					}




def    UpperCAmelCase__       (lowerCAmelCase_  ,						lowerCAmelCase_  ,						lowerCAmelCase_   ):




					'''simple docstring'''


					warnings.warn(lowerCAmelCase_  ,						lowerCAmelCase_   )
					requires_backends(lowerCAmelCase_  ,						"sklearn"   )
					assert len(lowerCAmelCase_   ) == len(lowerCAmelCase_   ), f"""Predictions and labels have mismatched lengths {len(lowerCAmelCase_   )} and {len(lowerCAmelCase_   )}"""
					if task_name == "cola":
										return {"mcc": matthews_corrcoef(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "sst-2":
										return {"acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "mrpc":
										return acc_and_fa(lowerCAmelCase_  ,						lowerCAmelCase_   )
					elif task_name == "sts-b":
										return pearson_and_spearman(lowerCAmelCase_  ,						lowerCAmelCase_   )
					elif task_name == "qqp":
										return acc_and_fa(lowerCAmelCase_  ,						lowerCAmelCase_   )
					elif task_name == "mnli":
										return {"mnli/acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "mnli-mm":
										return {"mnli-mm/acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "qnli":
										return {"acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "rte":
										return {"acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "wnli":
										return {"acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "hans":
										return {"acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					else:
										raise KeyError(lowerCAmelCase_   )




def    UpperCAmelCase__       (lowerCAmelCase_  ,						lowerCAmelCase_  ,						lowerCAmelCase_   ):




					'''simple docstring'''


					warnings.warn(lowerCAmelCase_  ,						lowerCAmelCase_   )
					requires_backends(lowerCAmelCase_  ,						"sklearn"   )
					if len(lowerCAmelCase_   ) != len(lowerCAmelCase_   ):
										raise ValueError(f"""Predictions and labels have mismatched lengths {len(lowerCAmelCase_   )} and {len(lowerCAmelCase_   )}"""   )
					if task_name == "xnli":
										return {"acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					else:
										raise KeyError(lowerCAmelCase_   )
