
'''simple docstring'''

import json
import sys


def        UpperCAmelCase_ (  lowerCamelCase_      ,			lowerCamelCase_			):







 """simple docstring"""


 with open(lowerCamelCase_      ,			encoding="utf-8"			) as f:
  lowerCAmelCase__     :   Any     		=	json.load(lowerCamelCase_			)

 lowerCAmelCase__     :   int     		=	["<details>", "<summary>Show updated benchmarks!</summary>", " "]

 for benchmark_name in sorted(lowerCamelCase_			):
  lowerCAmelCase__     :   str     		=	results[benchmark_name]

  lowerCAmelCase__     :   int     		=	benchmark_name.split("/"			)[-1]
  output_md.append(f'''### Benchmark: {benchmark_file_name}'''			)

  lowerCAmelCase__     :   List[Any]     		=	"| metric |"
  lowerCAmelCase__     :   int     		=	"|--------|"
  lowerCAmelCase__     :   int     		=	"| new / old (diff) |"
  for metric_name in sorted(lowerCamelCase_			):
   lowerCAmelCase__     :   List[str]     		=	benchmark_res[metric_name]
   lowerCAmelCase__     :   Tuple     		=	metric_vals["new"]
   lowerCAmelCase__     :   List[str]     		=	metric_vals.get("old"      ,			lowerCamelCase_			)
   lowerCAmelCase__     :   Any     		=	metric_vals.get("diff"      ,			lowerCamelCase_			)

   lowerCAmelCase__     :   int     		=	f''' {new_val:f}''' if isinstance(lowerCamelCase_      ,			(int, float)			) else "None"

   if old_val is not None:
    val_str += f''' / {old_val:f}''' if isinstance(lowerCamelCase_      ,			(int, float)			) else "None"
   if dif_val is not None:
    val_str += f''' ({dif_val:f})''' if isinstance(lowerCamelCase_      ,			(int, float)			) else "None"

   title += " " + metric_name + " |"
   lines += "---|"
   value += val_str + " |"

  output_md += [title, lines, value, " "]

 output_md.append("</details>"			)

 with open(lowerCamelCase_      ,			"w"      ,			encoding="utf-8"			) as f:
  f.writelines("\n".join(lowerCamelCase_			)			)


if __name__ == "__main__":
     snake_case									=    sys.argv[1]
     snake_case									=    sys.argv[2]

     format_json_to_md(input_json_file, output_md_file)







'''simple docstring'''

from __future__ import annotations

import pandas as pd


def        UpperCAmelCase_ (  lowerCamelCase_      ,			lowerCamelCase_      ,			lowerCamelCase_			):







 """simple docstring"""


 lowerCAmelCase__     :   Tuple     		=	[0] * no_of_processes
 lowerCAmelCase__     :   Any     		=	[0] * no_of_processes
 # Copy the burst time into remaining_time[]
 for i in range(lowerCamelCase_			):
  lowerCAmelCase__     :   Dict     		=	burst_time[i]

 lowerCAmelCase__     :   str     		=	0
 lowerCAmelCase__     :   Optional[Any]     		=	0
 lowerCAmelCase__     :   Optional[Any]     		=	9_9_9_9_9_9_9_9_9
 lowerCAmelCase__     :   int     		=	0
 lowerCAmelCase__     :   str     		=	False

 # Process until all processes are completed
 while complete != no_of_processes:
  for j in range(lowerCamelCase_			):
   if arrival_time[j] <= increment_time and remaining_time[j] > 0:
    if remaining_time[j] < minm:
     lowerCAmelCase__     :   Any     		=	remaining_time[j]
     lowerCAmelCase__     :   str     		=	j
     lowerCAmelCase__     :   List[Any]     		=	True

  if not check:
   increment_time += 1
   continue
  remaining_time[short] -= 1

  lowerCAmelCase__     :   Optional[Any]     		=	remaining_time[short]
  if minm == 0:
   lowerCAmelCase__     :   Optional[int]     		=	9_9_9_9_9_9_9_9_9

  if remaining_time[short] == 0:
   complete += 1
   lowerCAmelCase__     :   int     		=	False

   # Find finish time of current process
   lowerCAmelCase__     :   Tuple     		=	increment_time + 1

   # Calculate waiting time
   lowerCAmelCase__     :   Dict     		=	finish_time - arrival_time[short]
   lowerCAmelCase__     :   Optional[Any]     		=	finar - burst_time[short]

   if waiting_time[short] < 0:
    lowerCAmelCase__     :   Tuple     		=	0

        # Increment time
  increment_time += 1
 return waiting_time


def        UpperCAmelCase_ (  lowerCamelCase_      ,			lowerCamelCase_      ,			lowerCamelCase_			):







 """simple docstring"""


 lowerCAmelCase__     :   Optional[Any]     		=	[0] * no_of_processes
 for i in range(lowerCamelCase_			):
  lowerCAmelCase__     :   Dict     		=	burst_time[i] + waiting_time[i]
 return turn_around_time


def        UpperCAmelCase_ (  lowerCamelCase_      ,			lowerCamelCase_      ,			lowerCamelCase_			):







 """simple docstring"""


 lowerCAmelCase__     :   Union[str, Any]     		=	0
 lowerCAmelCase__     :   Optional[int]     		=	0
 for i in range(lowerCamelCase_			):
  lowerCAmelCase__     :   Tuple     		=	total_waiting_time + waiting_time[i]
  lowerCAmelCase__     :   str     		=	total_turn_around_time + turn_around_time[i]
 print(f'''Average waiting time = {total_waiting_time / no_of_processes:.5f}'''			)
 print("Average turn around time ="      ,			total_turn_around_time / no_of_processes			)


if __name__ == "__main__":
     print("""Enter how many process you want to analyze""")
     snake_case									=    int(input())
     snake_case									=    [0] * no_of_processes
     snake_case									=    [0] * no_of_processes
     snake_case									=    list(range(1, no_of_processes + 1))

     for i in range(no_of_processes):
          print("""Enter the arrival time and burst time for process:--""" + str(i + 1))
          snake_case					,					snake_case									=    map(int, input().split())

     snake_case									=    calculate_waitingtime(arrival_time, burst_time, no_of_processes)

     snake_case									=    burst_time
     snake_case									=    no_of_processes
     snake_case									=    waiting_time
     snake_case									=    calculate_turnaroundtime(bt, n, wt)

     calculate_average_times(waiting_time, turn_around_time, no_of_processes)

     snake_case									=    pd.DataFrame(
         list(zip(processes, burst_time, arrival_time, waiting_time, turn_around_time)),
         columns=[
             """Process""",
             """BurstTime""",
             """ArrivalTime""",
             """WaitingTime""",
             """TurnAroundTime""",
         ],
     )

     # Printing the dataFrame
     pd.set_option("""display.max_rows""", fcfs.shape[0] + 1)
     print(fcfs)





