#include using namespace std; //repetition #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define rep(i, n) for(ll i = 0; i < (ll)(n); i++) //container util #define all(x) (x).begin(),(x).end() //typedef typedef long long ll; typedef vector VI; typedef vector VVI; typedef vector VLL; typedef vector VVLL; typedef vector VS; typedef pair PII; typedef pair PLL; //const value //const ll MOD = 1e9 + 7; //const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1}; //const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1}; //conversion inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;} template inline string toString(T x) {ostringstream sout;sout<> n >> m; memset(board,0,sizeof(board)); FOR(i,1,m+1)FOR(j,1,m+1) cin >> board[i][j]; rep(i,m+1)rep(j,m+1) board[i][j+1] += board[i][j]; rep(i,m+1)rep(j,m+1) board[j+1][i] += board[j][i]; rep(_,n){ int x , y; cin >> y >> x; ll cnt = 0; FOR(si,1,m+1) FOR(ei,si,m+1) FOR(sj,1,m+1) FOR(ej,sj,m+1){ if(si <= y && y <= ei && sj <= x && x <= ej){ if(imos2(ej ,ei, sj, si) == 0) { cnt++; // cout << si << "," << sj << " " << ei << "," << ej << endl; } } } cout << cnt << endl; } return 0; }