"Disease Spread" challenge
Already answered by @Thomasky:

double dt = ((double)tm) / n;


There are some common subexpressions, multiplications, you need to do only once. like b*(s0*i0) (integer multiplication first).

The while loop would better go as (more precise, faster):

for (int j = 0; j &lt; n; ++j) {
    double bsi = dt*b*(s0*i0);
    double ai = dt*a*i0
    s0 -= (int) -bsi;
    i0 += (int) (bsi - ai);
    //r += ai; // As unused?
}


Variables can (and should) be declared as locally as possible, a declaration in a loop does not do more work as outside; there is just one slot reserved on the function stack.

The cast of (int) does no rounding.
As you might imagine, n*dt increases the approximation error in dt by n-fold. However more precision, a correction, would cost time.

Maybe using doubles, say double s1 = s0; double i1 = i0; instead of s0 and i0 would give a better solution. No idea.

And finally this task is solvable with a bit of math.