A logic problem, which involves math Imagine I'm walking in a tunnel and I stop, seeing that I am three eights of the way in. The tunnel is divided into eight equal length sections.
All of a sudden, I hear the engine noise of a train behind me. Now, the speed of the train is unknown. To survive, I have to run out of the tunnel as quickly as possible.
I have two choices, running forwards or backwards. If I run backwards in the direction of the train, I will be able to get out of the tunnel right at the moment the train comes in the tunnel. If I run forwards in the way the train is coming, the train will exit the tunnel at the same time as I do.
What is my speed?
 A: In the time it takes the train to reach the start of the tunnel, you can travel 3/8 the length of the tunnel. That means if you had instead run away from the train, you would be 3/4 of the way through the tunnel when the train reached the entrance. How fast would you have to go to traverse the remaining 1/4 of the tunnel in the time it takes the train to go through the whole tunnel?
A: All I can figure out is that the train is $4$ times faster than you.
Let's say that you can run with a speed $v$, and the train, $u$. Let's also assume that the tunnel has length $8L$, and that the train is originally a distance $x$ away from the entrance of the tunnel. Then we have $$\frac{3L}{v} = \frac{x}{u}$$ and $$\frac{5L}{v} = \frac{x+8L}{u}$$
We therefore have $$\frac{5}{3} \cdot \frac{x}{u} = \frac{x+8L}{u}$$
Solving this, we get $$\frac{2}{3} x = 8L \Rightarrow x = 12L$$
Plugging it back in, we get $$\frac{3L}{v} = \frac{12L}{u} \Rightarrow \frac{u}{v} = 4$$
A: According to the data you are giving, you die if you run. Either way, you leave the tunnel just as the train enters or exits. No time to leave the tracks. Big splash, that's it. 
Now some people calculated that you run at 1/4th the speed of the train. That's not quite right. You run either 3/8ths or 5/8ths of the tunnel, obviously at maximum speed. It is inevitable that your speed for 5/8ths of the tunnel will be lower because of exhaustion. If you can run 3/8ths of the tunnel at x meter/second, and 5/8ths of the tunnel at y meter/second, and the length of the tunnel is t meters, then your running time it (3t/8x) vs (5t/8y) seconds. The train therefore takes t/8 (5/y - 3/x) seconds to cross the tunnel, which means 8 / (5/y - 3/x) meter per seconds. The proportion of your speed divided by the speed of the train is (5x/y - 3) / 8 over the shorter distance, and (5 - 3y/x) / 8 over the longer distance. The first is a bit more than 1/4, the latter is a bit less, unless x = y.
Since the train is going quite slow, I'd recommend taking off any lose clothing as quickly as possible, then lying down as flat as possible between the tracks and praying while you let the train drive over you. 
A: 
"Imagine I'm walking in a tunnel and I stop [...] What is my speed?"

You stopped, your speed is zero. 
