For problem statement at 1000-1999/1700-1799/1740-1749/1749/problemD.txt this is a correct solution, but verifier at 1000-1999/1700-1799/1740-1749/1749/verifierD.go ends with All tests passed can you fix the verifier? package main
import (
"fmt"
)
func power(base, exp int64) int64 {
res := int64(1)
base %= 998244353
for exp > 0 {
if exp%2 == 1 {
res = (res * base) % 998244353
}
base = (base * base) % 998244353
exp /= 2
}
return res
}
func isPrime(x int64) bool {
if x < 2 {
return false
}
for i := int64(2); i*i <= x; i++ {
if x%i == 0 {
return false
}
}
return true
}
func main() {
var n, m int64
if _, err := fmt.Scan(&n, &m); err != nil {
return
}
mod := int64(998244353)
mMod := m % mod
var totalSum int64
if mMod == 1 {
totalSum = n % mod
} else if mMod == 0 {
totalSum = 0
} else {
num := (power(mMod, n) - 1 + mod) % mod
den := power((mMod-1+mod)%mod, mod-2)
totalSum = (mMod * num) % mod * den % mod
}
P := int64(1)
Uk := int64(1)
USum := int64(0)
for k := int64(1); k <= n; k++ {
if isPrime(k) {
P *= k
}
if P > m {
break
}
count := (m / P) % mod
Uk = (Uk * count) % mod
USum = (USum + Uk) % mod
}
ans := (totalSum - USum + mod) % mod
fmt.Println(ans)
}