Linear Hash gives WA , Double Hash gives TLE How can I solve ? [SSTORY] [SOLVED]

Question : “SSTORY Problem - CodeChef

Linear Hash : “CodeChef: Practical coding for everyone” [WA]

Double Hash : “CodeChef: Practical coding for everyone” [TLE]

Help @everule1 @ssjgz @galencolin @ay2306

Solved using unordered set of pair after 8 penalities.

Use pair as a key in std::unordered_set in C++ | Techie Delight

My solution : “CodeChef: Practical coding for everyone