---
{"category_name":"easy","problem_code":"TASKTIME","problem_name":"Task Times","problemComponents":{"constraints":"- $1 \\leq T \\leq 10^4$\n- $1 \\leq N \\leq 10^5$\n- $1 \\leq M \\leq N$\n- $1 \\leq K \\leq 10^9$\n- $1 \\leq C_i \\leq M$\n- $1 \\leq T_i \\leq 10^9$\n- Sum of $N$ over all test cases does not exceed $5\\cdot10^5$.","constraintsState":true,"subtasks":"","subtasksState":false,"inputFormat":"- The first line of input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\n- Each test case contains three lines of input.\n- The first line of each test case contains three space-separated integers $N, M, K$.\n- The second line contains $N$ space-separated integers $C_1, C_2, \\dots, C_N$.\n- The third line contains $N$ space-separated integers $T_1, T_2, \\dots, T_N$.\n","inputFormatState":true,"outputFormat":"For each test case, print a single line containing one integer - the maximum marks Chef can score.\n","outputFormatState":true,"sampleTestCases":{"0":{"id":1,"input":"3\n3 2 2\n1 1 2\n1 1 2\n4 3 2\n1 1 2 2\n1 1 2 1\n5 3 10\n1 1 1 2 3\n1 5 2 5 1","output":"1\n2\n3\n","explanation":"**Test case $1$**: Chef covers the $1^{st}$ and $2^{nd}$ topic in $1 + 1 = 2$ hours. Both topics belongs to $1^{st}$ subject. He does not cover any topic of the second subject. By doing so, Chef gets $\\lceil \\frac{2}{2} \\ \\rceil + \\lceil \\frac{0}{2} \\ \\rceil$ = $\\lceil \\ 1 \\ \\rceil + \\lceil \\ 0 \\ \\rceil = 1$ marks.\n\n**Test case $2$**: Chef covers the $1^{st}$ topic which belongs to the first subject and $4^{th}$ topic which belongs to the second subject in $1 + 1 = 2$ hours. There is no topic from the third subject. So Chef gets $\\lceil \\frac{1}{2} \\ \\rceil + \\lceil \\frac{1}{2} \\ \\rceil$ = $\\lceil \\ 0.5 \\ \\rceil + \\lceil \\ 0.5 \\ \\rceil = 1 + 1 = 2$ marks.","isDeleted":false}}},"video_editorial_url":"","languages_supported":{"0":"CPP14","1":"C","2":"JAVA","3":"PYTH 3.6","4":"CPP17","5":"PYTH","6":"PYP3","7":"CS2","8":"ADA","9":"PYPY","10":"TEXT","11":"PAS fpc","12":"NODEJS","13":"RUBY","14":"PHP","15":"GO","16":"HASK","17":"TCL","18":"PERL","19":"SCALA","20":"LUA","21":"kotlin","22":"BASH","23":"JS","24":"LISP sbcl","25":"rust","26":"PAS gpc","27":"BF","28":"CLOJ","29":"R","30":"D","31":"CAML","32":"FORT","33":"ASM","34":"swift","35":"FS","36":"WSPC","37":"LISP clisp","38":"SQL","39":"SCM guile","40":"PERL6","41":"ERL","42":"CLPS","43":"ICK","44":"NICE","45":"PRLG","46":"ICON","47":"COB","48":"SCM chicken","49":"PIKE","50":"SCM qobi","51":"ST","52":"SQLQ","53":"NEM"},"max_timelimit":1,"source_sizelimit":50000,"problem_author":"soumyadeep_21","problem_tester":"","date_added":"6-09-2021","tags":{"0":"ceil","1":"easy","2":"heap","3":"soumyadeep_21","4":"start14"},"problem_difficulty_level":"Unavailable","best_tag":"","editorial_url":"https://discuss.codechef.com/problems/TASKTIME","time":{"view_start_date":1632936600,"submit_start_date":1632936600,"visible_start_date":1632936600,"end_date":1735669800},"is_direct_submittable":false,"problemDiscussURL":"https://discuss.codechef.com/search?q=TASKTIME","is_proctored":false,"visitedContests":{},"layout":"problem"}
---
Chef's exam is near. There is a total of $M$ subjects in his syllabus. Each subject consists of several topics. However, the questions will be set only from $N$ topics. These topics are numbered $1$ through $N$. The $i^{th}$ topic belongs to $C_i^{th}$ subject and takes $T_i$ hours to cover.
Chef has only $K$ hours left before the exam and wants to score the maximum marks. If Chef covers $x_1$ number of topics of the $1^{st}$ subject, $x_2$ number of topics of the $2^{nd}$ subject, and so on upto $x_M$ number of topics of the $M^{th}$ subject in the remaining $K$ hours, he will get a total of $\lceil \frac{x_1}{2} \ \rceil + \lceil \frac{x_2}{2} \ \rceil + \cdots + \lceil \frac{x_M}{2} \ \rceil$ marks in the exam. So Chef chooses the topics optimally.
Determine the maximum possible marks Chef can score in the exam.
**Note:** $\lceil x \rceil$ : Returns the smallest integer that is greater than or equal to $x$ (i.e rounds up to the nearest integer). For example, $\lceil 1.5 \rceil = 2$, $\lceil 5 \rceil = 5$.
<aside style='background: #f8f8f8;padding: 10px 15px;'><div>All submissions for this problem are available.</div></aside>