#!/bin/python import sys q = int(raw_input().strip()) for a0 in xrange(q): len,c = raw_input().strip().split(' ') len,c = [int(len),int(c)] # your code goes here upBound = (len*(len-1))/2 lowBound = (len-1) if c>upBound or c