Just my 2 cents:
After reading this thread I decided to give it try (very tempting with its 0% solutions) and just started with a program that just reads input (not that trivial).
Anyway, if I would find an error in the input the program would hang itself and that is exactly what I got (TLE) which does not surprise me after reading this thread. Still, it could be an error in my program (it happened before

) and maybe we should post some test inputs just to check eachother?
This one should be easy:
4
3
Person 2 2
PID I
PName S
1 ABCDEF
2 ZYXWVU
Book 2 5
BID I
BName S
1 TheQuickBrownFox
2 HelloWorld
3 JumpJumpJump
4 RockTheWorld
5 LazyDog
Borrows 2 6
FKPID I
FKBID I
1 1
1 3
2 1
2 4
2 5
1 2
SELECT *
FROM (Borrows INNER JOIN Book ON FKBID = BID) INNER JOIN Person ON FKPID = PID
WHERE PName = "ABCDEF"
3
Person 2 2
PID I
PName S
1 ABCDEF
2 ZYXWVU
Book 2 5
BID I
BName S
1 TheQuickBrownFox
2 HelloWorld
3 JumpJumpJump
4 RockTheWorld
5 LazyDog
Borrows 2 6
FKPID I
FKBID I
1 1
1 3
2 1
2 4
2 5
1 2
SELECT *
FROM Person INNER JOIN (Borrows INNER JOIN Book ON FKBID = BID) ON PID = FKPID
WHERE PName = "ABCDEF"
1
WHERE 2 3
FROM I
ORDER S
1 XXX
2 YYY
3 ZZZ
SELECT FROM, ORDER
FROM WHERE
WHERE FROM = 2 AND ORDER = 3 OR 0 = 1
4
AccountInfo 4 3
Account I
LastName S
FirstName S
Balance I
1 Ivanov Petr 2500
2 Petrov Ivan 2000
3 Ivanov Ivan 3000
AccountTransfers 3 4
From I
To I
Amount I
1 2 1000
2 3 2000
3 1 3000
2 1 10
OrigAccountInfo 4 3
OAccount I
OLastName S
OFirstName S
OBalance I
1 Ivanov Petr 2500
2 Petrov Ivan 2000
3 Ivanov Ivan 3000
OrigAccountTransfers 3 4
OFrom I
OTo I
OAmount I
1 2 1000
2 3 2000
3 1 3000
2 1 10
SELECT *
FROM
(AccountInfo INNER JOIN AccountTransfers ON Account=From)
INNER JOIN
(OrigAccountInfo INNER JOIN OrigAccountTransfers ON OAccount=OFrom)
ON LastName = OLastName
WHERE FirstName<>"Petr"
ORDER BY LastName DESCENDING, Amount