← Home
```go
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var t int
	if _, err := fmt.Fscan(in, &t); err != nil {
		return
	}

	for i := 0; i < t; i++ {
		var l, r int
		fmt.Fscan(in, &l, &r)

		// Calculate the number of odd integers in the range [l, r].
		// The number of odd integers in [1, x] is given by (x + 1) / 2.
		// Thus, the number of odd integers in [l, r] is count(r) - count(l - 1).
		// count(l - 1) = (l - 1 + 1) / 2 = l / 2.
		oddCount := (r+1)/2 - l/2

		// We can form at most oddCount / 2 operations.
		// This is because each operation (selecting 3 pairwise coprime integers)
		// must consume at least 2 odd integers (since we can have at most 1 even integer).
		// A greedy strategy of taking consecutive (odd, even, odd) triples achieves this bound.
		fmt.Fprintln(out, oddCount/2)
	}
}
```