f=open('2023.02.27_22.csv') d={} for line in f: p=line.replace('"','').strip().split(';') p=list(map(int, p)) d[p[0]]=p[1:] times = {} for proc_id in d: proc_time = d[proc_id][0] dep = d[proc_id][1:] total_time = proc_time max_time = 0 if d[proc_id][1] != 0: for pid in dep: max_time = max(times[pid], max_time) times[proc_id] = total_time + max_time print(max(list(times.values())))