# ジャッジコード import sqlite3 import random import sys #run_type = "generator" run_type = "judge" argvs = sys.argv argc = len(argvs) #assert(argc > 2) print(argvs, file=sys.stderr) n,q,w,h,seed = map(int, open(argvs[1],"r").read().split()) print(n,q,seed, file=sys.stderr) assert((w+1)*(h+1) >= n) random.seed( seed ) s = set() #generate points while len(s) < n : s.add( (random.randint(0,w), random.randint(0,h)) ) #initialize database conn = sqlite3.connect(":memory:") cur = conn.cursor() cur.execute(""" CREATE TABLE point( id INTEGER PRIMARY KEY, x INTEGER, y INTEGER); """) for p in s : cur.execute("""INSERT INTO point(x,y) VALUES(?,?);""", [(p[0]),(p[1])]) print(p, file=sys.stderr) if run_type == "judge" : print(q) for i in range(q) : xl = random.randint(0,w) xh = random.randint(0,w) yl = random.randint(0,h) yh = random.randint(0,h) if xl > xh : xl, xh = xh, xl if yl > yh : yl, yh = yh, yl assert(xl<=xh) assert(yl<=yh) if run_type == "judge" : print(xl,xh,yl,yh) else : cur.execute("""SELECT count(*) FROM point WHERE (x BETWEEN ? and ?) and (y BETWEEN ? and ?);""", [(xl),(xh),(yl),(yh)]) print(cur.fetchone()[0]) if run_type == "judge" : res = [] sql_scripts = sys.stdin.read().split(';') for scr in sql_scripts : cur.execute(scr + ";") var = cur.fetchone() while var != None : res.append(var[0]) var = cur.fetchone() ans = list( map(int, open(argvs[2], "r").read().split() ) ) print(res, file=sys.stderr) print(ans, file=sys.stderr) assert(res == ans)