Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <stdio.h>#include <iostream>#include <algorithm>#include <vector>typedef long long ll;using namespace std;int gcd(ll a,ll b){if( b == 0) return a;return gcd(b,a%b);}int extgcd(ll a,ll b,ll& x,ll& y){ll d = a;if(b != 0){d = extgcd(b,a%b,y,x);y -= (a/b)*x;}else{x = 1;y = 0;}return d;}int mod_inverse(ll a , ll m){ll x,y;extgcd(a,m,x,y);return (m + x % m) % m;}pair<ll , ll> linear_congruence(const vector<ll>& A, const vector<ll>& B,