
import argparse
import json
import re
import string
import sys
from collections import Counter



def      _a     (   __UpperCamelCase       :  int    ):

			def remove_articles(__UpperCamelCase       :  int    ):
						return re.sub(R'''\b(a|an|the)\b'''	,''' '''	,__UpperCamelCase    )

			def white_space_fix(__UpperCamelCase       :  Dict    ):
						return " ".join(text.split()    )

			def remove_punc(__UpperCamelCase       :  Dict    ):
						lowerCAmelCase__ :    List[Any]				      =			set(string.punctuation    )
						return "".join(ch for ch in text if ch not in exclude    )

			def lower(__UpperCamelCase       :  Union[str, Any]    ):
						return text.lower()

			return white_space_fix(remove_articles(remove_punc(lower(__UpperCamelCase    )    )    )    )



def      _a     (   __UpperCamelCase       :  Optional[int]	,__UpperCamelCase       :  List[Any]    ):
			lowerCAmelCase__ :    str				      =			normalize_answer(__UpperCamelCase    ).split()
			lowerCAmelCase__ :    Optional[int]				      =			normalize_answer(__UpperCamelCase    ).split()
			lowerCAmelCase__ :    Tuple				      =			Counter(__UpperCamelCase    ) & Counter(__UpperCamelCase    )
			lowerCAmelCase__ :    List[Any]				      =			sum(common.values()    )
			if num_same == 0:
						return 0
			lowerCAmelCase__ :    Union[str, Any]				      =			1.0 * num_same / len(__UpperCamelCase    )
			lowerCAmelCase__ :    Union[str, Any]				      =			1.0 * num_same / len(__UpperCamelCase    )
			lowerCAmelCase__ :    Optional[int]				      =			(2 * precision * recall) / (precision + recall)
			return fa



def      _a     (   __UpperCamelCase       :  Dict	,__UpperCamelCase       :  List[Any]    ):
			return normalize_answer(__UpperCamelCase    ) == normalize_answer(__UpperCamelCase    )



def      _a     (   __UpperCamelCase       :  List[str]	,__UpperCamelCase       :  Union[str, Any]	,__UpperCamelCase       :  List[Any]    ):
			lowerCAmelCase__ :    List[Any]				      =			[]
			for ground_truth in ground_truths:
						lowerCAmelCase__ :    Any				      =			metric_fn(__UpperCamelCase	,__UpperCamelCase    )
						scores_for_ground_truths.append(__UpperCamelCase    )
			return max(__UpperCamelCase    )



def      _a     (   __UpperCamelCase       :  Any	,__UpperCamelCase       :  Dict    ):
			lowerCAmelCase__ :    Optional[int]				      =			0
			for article in dataset:
						for paragraph in article["paragraphs"]:
									for qa in paragraph["qas"]:
												total += 1
												if qa["id"] not in predictions:
															lowerCAmelCase__ :    str				      =			'''Unanswered question ''' + qa['''id'''] + ''' will receive score 0.'''
															print(__UpperCamelCase	,file=sys.stderr    )
															continue
												lowerCAmelCase__ :    Dict				      =			[x['''text'''] for x in qa['''answers''']]
												lowerCAmelCase__ :    Dict				      =			predictions[qa['''id''']]
												exact_match += metric_max_over_ground_truths(__UpperCamelCase	,__UpperCamelCase	,__UpperCamelCase    )
												fa += metric_max_over_ground_truths(__UpperCamelCase	,__UpperCamelCase	,__UpperCamelCase    )

			lowerCAmelCase__ :    str				      =			100.0 * exact_match / total
			lowerCAmelCase__ :    Union[str, Any]				      =			100.0 * fa / total

			return {"exact_match": exact_match, "f1": fa}


if __name__ == "__main__":
							A__       :   Any   						=					"""1.1"""
							A__       :   Dict   						=					argparse.ArgumentParser(description="""Evaluation for SQuAD """ + expected_version)
							parser.add_argument("""dataset_file""", help="""Dataset file""")
							parser.add_argument("""prediction_file""", help="""Prediction File""")
							A__       :   int   						=					parser.parse_args()
							with open(args.dataset_file) as dataset_file:
														A__       :   str   						=					json.load(dataset_file)
														if dataset_json["version"] != expected_version:
																					print(
																					    """Evaluation expects v-""" + expected_version + """, but got dataset with v-""" + dataset_json["""version"""],
																					    file=sys.stderr,
																					)
														A__       :   Tuple   						=					dataset_json["""data"""]
							with open(args.prediction_file) as prediction_file:
														A__       :   Optional[Any]   						=					json.load(prediction_file)
							print(json.dumps(evaluate(dataset, predictions)))





from math import radians as angle_to_radians
from math import sin

# Acceleration Constant on Earth (unit m/s^2)
A__       :   str   						=					9.8_0665



def      _a     (   __UpperCamelCase       :  float	,__UpperCamelCase       :  float    ):

			# Ensure valid instance
			if not isinstance(__UpperCamelCase	,(int, float)    ):
						raise TypeError('''Invalid velocity. Should be a positive number.'''    )

			if not isinstance(__UpperCamelCase	,(int, float)    ):
						raise TypeError('''Invalid angle. Range is 1-90 degrees.'''    )

			# Ensure valid angle
			if angle > 90 or angle < 1:
						raise ValueError('''Invalid angle. Range is 1-90 degrees.'''    )

			# Ensure valid velocity
			if init_velocity < 0:
						raise ValueError('''Invalid velocity. Should be a positive number.'''    )



def      _a     (   __UpperCamelCase       :  float	,__UpperCamelCase       :  float    ):
			check_args(__UpperCamelCase	,__UpperCamelCase    )
			lowerCAmelCase__ :    Union[str, Any]				      =			angle_to_radians(2 * angle    )
			return round(init_velocity**2 * sin(__UpperCamelCase    ) / g	,2    )



def      _a     (   __UpperCamelCase       :  float	,__UpperCamelCase       :  float    ):
			check_args(__UpperCamelCase	,__UpperCamelCase    )
			lowerCAmelCase__ :    List[str]				      =			angle_to_radians(__UpperCamelCase    )
			return round(init_velocity**2 * sin(__UpperCamelCase    ) ** 2 / (2 * g)	,2    )



def      _a     (   __UpperCamelCase       :  float	,__UpperCamelCase       :  float    ):
			check_args(__UpperCamelCase	,__UpperCamelCase    )
			lowerCAmelCase__ :    Dict				      =			angle_to_radians(__UpperCamelCase    )
			return round(2 * init_velocity * sin(__UpperCamelCase    ) / g	,2    )



def      _a     (   ):
			lowerCAmelCase__      ,				lowerCAmelCase__ :    List[Any]				      =			25, 20
			assert horizontal_distance(__UpperCamelCase	,__UpperCamelCase    ) == 40.97
			assert max_height(__UpperCamelCase	,__UpperCamelCase    ) == 3.73
			assert total_time(__UpperCamelCase	,__UpperCamelCase    ) == 1.74


if __name__ == "__main__":
							from doctest import testmod

							testmod()

							# Get input from user
							A__       :   List[Any]   						=					float(input("""Initial Velocity: """).strip())

							# Get input from user
							A__       :   Optional[Any]   						=					float(input("""angle: """).strip())

							# Print results
							print()
							print("""Results: """)
							print(f"""Horizontal Distance: {horizontal_distance(init_vel, angle)!s} [m]""")
							print(f"""Maximum Height: {max_height(init_vel, angle)!s} [m]""")
							print(f"""Total Time: {total_time(init_vel, angle)!s} [s]""")



