#pragma once
/**
* Author: Unknown
* Date: 2002-09-15
* Source: predates tinyKACTL
* Description: Finds two integers $x$ and $y$,such that $ax+by=\gcd(a,b)$. If
* you just need gcd, use the built in \texttt{\_\_gcd} instead.
* If $a$ and $b$ are coprime, then $x$ is the inverse of $a \pmod{b}$.
* $x = x_0 + k * (b / g)$
* $y = y_0 - k * (a / g)$
*/lleuclid(lla,llb,ll&x,ll&y){if(!b)returnx=1,y=0,a;lld=euclid(b,a%b,y,x);returny-=a/b*x,d;}
#line 2 "src/number-theory/euclid.hpp"
/**
* Author: Unknown
* Date: 2002-09-15
* Source: predates tinyKACTL
* Description: Finds two integers $x$ and $y$,such that $ax+by=\gcd(a,b)$. If
* you just need gcd, use the built in \texttt{\_\_gcd} instead.
* If $a$ and $b$ are coprime, then $x$ is the inverse of $a \pmod{b}$.
* $x = x_0 + k * (b / g)$
* $y = y_0 - k * (a / g)$
*/lleuclid(lla,llb,ll&x,ll&y){if(!b)returnx=1,y=0,a;lld=euclid(b,a%b,y,x);returny-=a/b*x,d;}