a) 1. 0-0? (illegal)
1. Txb7! Ka6 2. Tb4
b) 1. 0-0 ... 2. Ta1+
Yoav Ben-Zvi, Solution:
All 6 missing Black pieces were captured by wPh7 and wPg4 including bBf8 which is released by bPg7-g6 after the completion of the fifth capture by wPg6xh7 so the bishop is the last Black piece captured on the dark square g3. The 5 captures by WPc2 on its way to h7 include the 2 missing bRs and bPh7 (directly or through its promotion). wPs a2,b2 did not capture so they could not promote and were captured on their original file. wBf1 was captured at home, wBc1 was captured on a dark square and the missing wN was captured on c6. bPg6 came from g7 as coming from h7 it would prevent access of wP to h7.
Looking backward: wPh7 could not uncapture bP on h7 since bPg6 must be retracted first from g7 which means bB needs to be retracted first from f8 but then the bRs that are uncaptured later will be locked out of h8. It also could not uncapture the bP later along the c2-h7 diagonal since this would require an uncapture by the uncaptured bP back along the same diagonal but only wBc1 is available which cannot be uncaptured on a light square. The above means bPh7 must be unpromoted either on g1 or h1
If bPh7 is unpromoted on g1 then this is by bPh2xBg1 (only wBc1 is available for uncapture on the dark square g1) but then bPh2 cannot retreat further until BB vacates h3 which requires retreat of wPg4 to g3 which locks in bBg1. Therefore bPh7 is unpromoted on h1 which means WRh1 moved so White cannot castle.
b) bBh3 to c8
bPh7 could be unpromoted on g1 so White can castle.
Retraction: wQf1—b2, bQg1—f8, bPh2xwBg1=Q, bPh3-h2, wBc1—g1, wQd1—f1, wPg3-g4, wPh2xBg3, bBf8—g3, bPg7-g6, wPc2xd3xe4xf5xg6xh7