#include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair P; #define fi first #define se second #define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++) #define rep(i,n) repl(i,0,n) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<y?x:y) #define mmin(x,y) (x>n>>d; vector a; repl(w,1,n+1)repl(z,1,n+1){ a.push_back(w*w-z*z+d); } sort(all(a)); ll res=0; repl(x,1,n+1)repl(y,1,n+1){ res+=upper_bound(all(a),x*x+y*y)-lower_bound(all(a),x*x+y*y); } cout<