Getting the Sum of Discounted Price
Formatting
This may be a copy and paste error, but generally int main() will start in the first column like the #include does. Other the rest of the indentation needs to be based on that. This was correctly done in your earlier question.

#include &lt;stdio.h&gt;

int main()
{
    int T;
    scanf("%d", &amp;T);

    ...

}


Functions
You may not have run into difficult problems yet, but as the programs get more complex the best way to solve them will be to break it up into smaller pieces where each particular task is easy to solve. In this case the outer for loop would make a good function. Perhaps the inner loop would make a second good function.

Variable Names
Variable names should be meaningful to make the code more readable, easier to understand and maintainable.

The problem statement gives you the variable names T, N, M and K which are currently being used in the code, however, it also gives you what the variables are used for. It might be better to use names such as testCount for T, maxPrice for N, minPrice for M and itemCount for K.

The variable name halfPrice could be misleading be it won't always be half of the maximum price.

Mixing Types in Comparisons
There is the possibility of Floating Point Error in the code because of this comparison: 

            halfPrice = (halfPrice &lt; M) ? M : halfPrice;


While the minimum price is input as an integer it might be better to convert it to a float and use that in the comparison. This conversion should only be done once per test case.

In many cases banks work around this by keeping amounts in 2 integer values, one for dollars and one for cents (units are USA, units may differ based on location).