How to compute gcd(a,b)%p?

can i write gcd(a,b)%p=gcd(a%p,b%p)%p, where p is prime and a,b are very very large??
If not, then how to approach for gcd(a,b)%p???

No, you can’t. Say,
p = 1000000007, a = 1000000006, b = 1000000008
gcd(a,b)%p = gcd( 1000000006, 1000000008)% 1000000007 = 2%1000000007 = 2.
But gcd(a%p, b%p)%p = gcd( 1000000006, 1)% 1000000007 = 1 (wrong).

If you can’t figure out the solution, we’ll discuss it after the contest ends :stuck_out_tongue_winking_eye:

use this property
if
a=(b%m)
then
gcd(a,m)=gcd(b,m)