🏡 index : github.com/captn3m0/codechef.git

---
{"category_name":"easy","problem_code":"REPEAT","problem_name":"Odd Repeat","problemComponents":{"constraints":"- $1 \\leq T \\leq 1000$\n- $1 \\leq N \\leq 10^4$\n- $1 \\leq S \\leq 10^9$\n- $2 \\leq K \\leq 10^4$","constraintsState":true,"subtasks":"","subtasksState":false,"inputFormat":"- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\n- The first and only line of each test case contains three space-separated integers $N, K, S$.\n","inputFormatState":true,"outputFormat":"For each test case, print a single line containing the integer which appeared $K$ times in Chef\u0027s array.\n","outputFormatState":true,"sampleTestCases":{"0":{"id":1,"input":"3\n3 2 14\n5 4 28\n2 3 10\n","output":"5\n1\n3\n","explanation":"**Test case $1$:**  Chef\u0027s array could be $[5, 3, 5, 1]$.\n\n**Test case $3$:** Chef\u0027s array could be $[3, 1, 3, 3]$.","isDeleted":false}}},"video_editorial_url":"https://youtu.be/No-7Mz4712M","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":0.5,"source_sizelimit":50000,"problem_author":"utkarsh_adm","problem_tester":"","date_added":"26-08-2021","tags":{"0":"simple","1":"simple","2":"start10","3":"start10","4":"utkarsh_adm"},"problem_difficulty_level":"Unavailable","best_tag":"","editorial_url":"https://discuss.codechef.com/problems/REPEAT","time":{"view_start_date":1630243800,"submit_start_date":1630243800,"visible_start_date":1630243800,"end_date":1735669800},"is_direct_submittable":false,"problemDiscussURL":"https://discuss.codechef.com/search?q=REPEAT","is_proctored":false,"visitedContests":{},"layout":"problem"}
---
Chef has an array consisting of $N + K - 1$ integers. The array contains only the first $N$ **positive odd numbers**. Each number appears **exactly once**, except for one number which appears **exactly $K$ times**. The sum of integers in Chef's array is equal to $S$.

For example, for $N = 3$, $K = 2$, the possible arrays could be $[1, 1, 3, 5]$, $[3, 1, 3, 5]$, $[5, 3, 5, 1]$. For $N = 1$, $K = 3$, there is only one possible array: $[1, 1, 1]$.

Chef gives you three integers $N$, $K$ and $S$ and asks you to find the only element which appears **$K$ times** in his array.

It is guaranteed that for the given input, there exists a valid array consisting of $N + K -1$ elements with a sum exactly equal to $S$.
<aside style='background: #f8f8f8;padding: 10px 15px;'><div>All submissions for this problem are available.</div></aside>