public void solve() throws IOException {
    int cases = nextInt();
    for (int n = 0; n < cases; n++) {
      int num = nextInt();
      int length = nextInt();
      int total = 0;
      for (int a = 1; a <= length / 2; a++) {
        for (int b = a; b <= length - a - b; b++) {
          int c = length - a - b;
          if (a + b > c && b + c > a && a + c > b) {
            if (a != b && a != c && b != c)
              total++;
            total++;
          }
        }
      }
      System.out.println(num + " " + total);
    }
  }