← Home
For problem statement at 0-999/700-799/710-719/711/problemE.txt this is a correct solution, but verifier at 0-999/700-799/710-719/711/verifierE.go ends with All tests passed can you fix the verifier? ```go
package main

import (
	"bufio"
	"fmt"
	"math/bits"
	"os"
)

const P int64 = 1000003

func modPow(a, e, mod int64) int64 {
	a %= mod
	if a < 0 {
		a += mod
	}
	res := int64(1)
	for e > 0 {
		if e&1 == 1 {
			res = (res * a) % mod
		}
		a = (a * a) % mod
		e >>= 1
	}
	return res
}

func main() {
	in := bufio.NewReader(os.Stdin)
	var n, k uint64
	if _, err := fmt.Fscan(in, &n, &k); err != nil {
		return
	}

	// If k > 2^n -> probability is 1
	if n < 60 {
		if k > (uint64(1) << n) {
			fmt.Println("1 1")
			return
		}
	}

	// Compute s = n + v2((k-1)!) and work mod (P-1) for exponents
	nmod := int64(n % uint64(P-1))
	kmod := int64(k % uint64(P-1))
	k1mod := int64((k - 1) % uint64(P-1))
	pop := int64(bits.OnesCount64(k - 1))
	smod := (nmod + k1mod - (pop % (P - 1))) % (P - 1)
	if smod < 0 {
		smod += (P - 1)
	}

	// x = 2^n mod P
	x := modPow(2, nmod, P)

	// N mod P = product_{i=0}^{k-1} (x - i) mod P
	var Nmod int64
	if k >= uint64(P) {
		Nmod = 0
	} else {
		res := int64(1)
		for i := int64(0); i < int64(k); i++ {
			t := (x - i) % P
			if t < 0 {
				t += P
			}
			res = (res * t) % P
			if res == 0 {
				break
			}
		}
		Nmod = res
	}

	// Divide N by 2^s (mod P)
	inv2s := modPow(modPow(2, smod, P), P-2, P)
	Np := (Nmod * inv2s) % P

	// D' = 2^{n*k - s} mod P
	eD := (nmod * kmod) % (P - 1)
	eD = (eD - smod) % (P - 1)
	if eD < 0 {
		eD += (P - 1)
	}
	Dp := modPow(2, eD, P)

	A := (Dp - Np) % P
	if A < 0 {
		A += P
	}
	B := Dp

	fmt.Println(A, B)
}
```