It takes A 196.9 seconds to run 1000 m.

.

We have two races.

Race 1 is 1000 meter for A and 900 meter for B. A wins by 20 seconds.

Race 2 is 970 meter for A and 1000 meter for B.

.

t = time (sec), v = speed (m/s), a and b are for A and B. And time = distance / speed

.

This gives us the following equations:

For race 1:

t1 = time for B to finish the race

t1 - 20 = 1000 / va

t1 = 900 / vb

Thus: 900 / vb = 1000 / va + 20

.

For race 2:

t2 = time for B to finish the race (excluding the head start)

t2 = 970 / va

t2 + 50 = 1000 / vb

Thus: 970 / va = 1000 / vb - 50

This can be rewritten to: 900 / vb = 873 / va + 45

.

Now we have 900 / vb = 1000 / va + 20 = 873 / va + 45

Rewrite to: 127 / va = 25 => va = 127 / 25 = 5.08 meter/second.

vb then is 4.15 m/s

.

Let's check:

Race 1: A runs the 1000 m in 197 seconds. B runs the 900 m in 217 seconds => 20 second difference.

Race 2: B runs the 1000 m in 241 seconds. Subtracting the head starts means A runs for 191 seconds. In that time A runs 970 meter and loses by 30 meter.