solve the following question and send me the code in NAME_1:

An organization has two servers, P and F.
There are n tasks to be executed. You are given a list of integers, named "time", and another list of integers, named "cost". For ith task to be executed on NAME_2 P, it will take time[i] seconds and cost[i] dollars to.
NAME_2 F can also execute a task, but only when a task is already running on NAME_2 P. For any task, NAME_2 F takes 1 second and 0 dollars. But NAME_2 F can only run anything when NAME_2 P is already being utilized.

Find the minimum cost to complete all tasks if scheduled optimally.

example, n = 4, cost = [4,1,3,1], time = [3,1,2,3]
the fourth task should be executed on NAME_2 P. it will take 3 seconds to complete and the cost is 1 dollar. In the meanwhile, other 3 tasks will be executed by NAME_2 F taking 1 second each at 0 dollars. So the total cost = 1$

another example, n = 4, cost = [1,2,3,2], time = [1,2,3,2]
the first two task should be executed on NAME_2 P. it will take 5 seconds to complete those 2 tasks and the cost is 3 dollars. In the meanwhile, other 2 tasks will be executed by NAME_2 F taking 1 second each at 0 dollars. So the total cost = 3

another example, n = 4, cost = [2,3,4,2], time = [1,1,1,1]
the first and last task should be executed on NAME_2 P. it will take 2 seconds to complete those 2 tasks and the cost is 4 dollars. In the meanwhile, other 2 tasks will be executed by NAME_2 F taking 1 second each at 0 dollars. So the total cost = 4


write the code in NAME_1 without any comments or explanation thinking of all use cases and edge cases. 