I saw you have submitted it successfully. You precomputed the powers of 10. Maybe its a difference in the strict time limits for different languages!
Yes there are three mistakes in the modulus part
First you forgot the modulus
for(ll i=0;s[i]!=‘\0’;i++)
m+= ( (s[i]-48) * ten[l-1-i] )%mod;
m%= mod;
Second
you forgot modulus of the multiplication (s[i]-48) * ten[l-1]) % mod
m=( ( (m-((s[i]-48) * ten[l-1]) % mod + mod ) %mod ) * 10 ) % mod (s[i]-48)%mod;
Third
you forgot adding modulus value for subtration { (a - b + mod) % mod is correct rather than (a-b)%mod}
(m-((s[i]-48) * ten[l-1]) % mod + mod ) %mod
Submitted your code here
https://www.codechef.com/viewsolution/22104741