- Mathematical, Modular Arithmetic, number-theory

Solve Linear Congruences Ax = B (mod N) for values of x in range [0, N-1]

#include using namespace std;  long long ExtendedEuclidAlgo(    long long a, long long b,    long long& x, long long& y){        if (b == 0) {        x = 1;        y = 0;        return a;    }    else {                  long long x1, y1;        long long gcd            = ExtendedEuclidAlgo(b, a % b, x1, y1);                          x = y1;        y = x1 – floor(a / b) * y1;          return gcd;    }}  void linearCongruence(long long A,                      long long B,                      long long N){    A = A % N;    B = B % N;      long long u = 0, v = 0;              long long d = ExtendedEuclidAlgo(A, N, u, v);          if (B % d != 0) {        cout