Problem: 2057C - Trip to the Olympiad
Language: Go

Previous submission (verdict: Wrong answer on test 1):
package main

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

const (
	mod = 998244353
)

var (
	__input io.Reader
	__buf   []byte
	__index int
	__out   *bufio.Writer
)

func read_byte() byte {
	if __index == len(__buf) {
		Len, _ := __input.Read(__buf)
		if Len == 0 {
			return 31
		}
		__index = 0
	}
	b := __buf[__index]
	__index++
	return b
}
func read() (x int) {
	var b byte
	flag := 1
	for {
		b = read_byte()
		if '0' <= b && b <= '9' {
			break
		}
		if b == '-' {
			flag = -1
		}
	}
	for ; '0' <= b && b <= '9'; b = read_byte() {
		x = x*10 + int(b&15)
	}
	x *= flag
	return
}
func getchar() byte {
	var b byte
	for {
		b = read_byte()
		if 32 < b && b < 127 {
			break
		}
	}
	return b
}
func read_word() (s []byte) {
	var b byte
	for {
		b = read_byte()
		if 32 < b && b < 127 {
			break
		}
	}
	for 32 < b && b < 127 {
		s = append(s, b)
		b = read_byte()
	}
	return
}
func print(x ...interface{}) {
	_, _ = fmt.Fprint(__out, x...)
}
func println(x ...interface{}) {
	_, _ = fmt.Fprintln(__out, x...)
}
func debug(xs ...interface{}) {
	for i := range xs {
		_, _ = fmt.Fprintf(__out, "%+v ", xs[i])
	}
	println()
}

type set[T comparable] struct {
	mp map[T]struct{}
}

func (s *set[T]) insert(x T) {
	s.mp[x] = struct{}{}
}
func (s *set[T]) count(x T) bool {
	_, ok := s.mp[x]
	return ok
}
func (s *set[T]) size() int {
	return len(s.mp)
}
func (s *set[T]) empty() bool {
	return len(s.mp) == 0
}
func (s *set[T]) erase(x T) {
	delete(s.mp, x)
}
func (s *set[T]) begin() T {
	if s.empty() {
		panic("s is empty")
	}
	var x T
	for key := range s.mp {
		return key
	}
	return x
}
func newSet[T comparable]() *set[T] {
	return &set[T]{mp: make(map[T]struct{})}
}
func max(a ...int) int {
	n := len(a)
	if n == 0 {
		return -1e18
	}
	ret := a[0]
	for i := 1; i < n; i++ {
		if a[i] > ret {
			ret = a[i]
		}
	}
	return ret
}
func min(a ...int) int {
	n := len(a)
	if n == 0 {
		return 1e18
	}
	ret := a[0]
	for i := 1; i < n; i++ {
		if a[i] < ret {
			ret = a[i]
		}
	}
	return ret
}
func __sum(a ...int) int {
	ret := 0
	for _, val := range a {
		ret += val
	}
	return ret
}
func __gcd(x, y int) int {
	for x > 0 && y > 0 {
		if x > y {
			x %= y
		} else {
			y %= x
		}
	}
	if x == 0 {
		return y
	}
	return x
}
func abs(x int) int {
	if x > 0 {
		return x
	}
	return -1 * x
}
func unique(a []int) []int {
	n := len(a)
	cnt := 0
	for i := 0; i < n; i++ {
		j := i
		for j+1 < n && a[j+1] == a[i] {
			j++
		}
		i = j
		a[cnt] = a[i]
		cnt++
	}
	return a[:cnt]
}
func lower_bound(a []int, x int) int {
	if a == nil || len(a) == 0 {
		return -1
	}
	l, r := 0, len(a)-1
	for l < r {
		mid := (l + r) >> 1
		if a[mid] >= x {
			r = mid
		} else {
			l = mid + 1
		}
	}
	if a[l] >= x {
		return l
	}
	return -1
}
func f_lower_bound(a []int, x int) int {
	if a == nil || len(a) == 0 {
		return -1
	}
	l, r := 0, len(a)-1
	for l < r {
		mid := (l + r + 1) >> 1
		if a[mid] <= x {
			l = mid
		} else {
			r = mid - 1
		}
	}
	if a[l] <= x {
		return l
	}
	return -1
}
func upper_bound(a []int, x int) int {
	if a == nil || len(a) == 0 {
		return -1
	}
	l, r := 0, len(a)-1
	for l < r {
		mid := (l + r) >> 1
		if a[mid] > x {
			r = mid
		} else {
			l = mid + 1
		}
	}
	if a[l] > x {
		return l
	}
	return -1
}
func binary_search(a []int, x int) bool {
	if a == nil || len(a) == 0 {
		return false
	}
	l, r := 0, len(a)-1
	for l < r {
		mid := (l + r) >> 1
		if a[mid] >= x {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return a[l] == x
}
func atoi(s string) int {
	ret := 0
	for _, val := range s {
		ret = ret*10 + int(val-'0')
	}
	return ret
}
func bool_to_int(x bool) int {
	if x {
		return 1
	}
	return 0
}
func reverse[T comparable](a []T) {
	for i := 0; i < len(a)/2; i++ {
		a[i], a[len(a)-1-i] = a[len(a)-1-i], a[i]
	}
}
func count[T comparable](a []T, opt func(x T) bool) int {
	ans := 0
	for i := range a {
		if opt(a[i]) {
			ans++
		}
	}
	return ans
}
func isSorted[T any](a []T, less func(T, T) bool) bool {
	for i := 0; i+1 < len(a); i++ {
		if !less(a[i], a[i+1]) {
			return false
		}
	}
	return true
}
func fill[T comparable](a []T, val T) {
	n := len(a)
	for i := 0; i < n; i++ {
		a[i] = val
	}
}

func solve() {
	// 感觉不难，单看每一位就行，比如 1 1 0，最后结果就是 2. 1 0 0 也是，只要三个数不全相同就 ok
	// 所以思路是看 l 这一位加多少，可以得到变化
	l, r := read(), read()
	a, b, c := l, 0, l+2
	l_low := 0
	for i := 0; i < 30; i++ {
		if 1<<i-l_low <= r-l {
			b = (l>>i&1 ^ 1) << i
		}
		l_low |= l >> i & 1 << i
	}
	if b == c {
		c = l + 1
	}
	println(a, b, c)
	// println((a ^ b) + (b ^ c) + (a ^ c))
	// println()
}

func init() {
	__buf = make([]byte, 4096)
	__index = len(__buf)
	__input = os.Stdin
	__out = bufio.NewWriter(os.Stdout)
}

func main() {
	defer __out.Flush()
	tt := 1
	tt = read()
	for tt > 0 {
		tt--
		solve()
	}
}


Submission (verdict: Wrong answer on test 1):
package main

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

const (
	mod = 998244353
)

var (
	__input io.Reader
	__buf   []byte
	__index int
	__out   *bufio.Writer
)

func read_byte() byte {
	if __index == len(__buf) {
		Len, _ := __input.Read(__buf)
		if Len == 0 {
			return 31
		}
		__index = 0
	}
	b := __buf[__index]
	__index++
	return b
}
func read() (x int) {
	var b byte
	flag := 1
	for {
		b = read_byte()
		if '0' <= b && b <= '9' {
			break
		}
		if b == '-' {
			flag = -1
		}
	}
	for ; '0' <= b && b <= '9'; b = read_byte() {
		x = x*10 + int(b&15)
	}
	x *= flag
	return
}
func getchar() byte {
	var b byte
	for {
		b = read_byte()
		if 32 < b && b < 127 {
			break
		}
	}
	return b
}
func read_word() (s []byte) {
	var b byte
	for {
		b = read_byte()
		if 32 < b && b < 127 {
			break
		}
	}
	for 32 < b && b < 127 {
		s = append(s, b)
		b = read_byte()
	}
	return
}
func print(x ...interface{}) {
	_, _ = fmt.Fprint(__out, x...)
}
func println(x ...interface{}) {
	_, _ = fmt.Fprintln(__out, x...)
}
func debug(xs ...interface{}) {
	for i := range xs {
		_, _ = fmt.Fprintf(__out, "%+v ", xs[i])
	}
	println()
}

type set[T comparable] struct {
	mp map[T]struct{}
}

func (s *set[T]) insert(x T) {
	s.mp[x] = struct{}{}
}
func (s *set[T]) count(x T) bool {
	_, ok := s.mp[x]
	return ok
}
func (s *set[T]) size() int {
	return len(s.mp)
}
func (s *set[T]) empty() bool {
	return len(s.mp) == 0
}
func (s *set[T]) erase(x T) {
	delete(s.mp, x)
}
func (s *set[T]) begin() T {
	if s.empty() {
		panic("s is empty")
	}
	var x T
	for key := range s.mp {
		return key
	}
	return x
}
func newSet[T comparable]() *set[T] {
	return &set[T]{mp: make(map[T]struct{})}
}
func max(a ...int) int {
	n := len(a)
	if n == 0 {
		return -1e18
	}
	ret := a[0]
	for i := 1; i < n; i++ {
		if a[i] > ret {
			ret = a[i]
		}
	}
	return ret
}
func min(a ...int) int {
	n := len(a)
	if n == 0 {
		return 1e18
	}
	ret := a[0]
	for i := 1; i < n; i++ {
		if a[i] < ret {
			ret = a[i]
		}
	}
	return ret
}
func __sum(a ...int) int {
	ret := 0
	for _, val := range a {
		ret += val
	}
	return ret
}
func __gcd(x, y int) int {
	for x > 0 && y > 0 {
		if x > y {
			x %= y
		} else {
			y %= x
		}
	}
	if x == 0 {
		return y
	}
	return x
}
func abs(x int) int {
	if x > 0 {
		return x
	}
	return -1 * x
}
func unique(a []int) []int {
	n := len(a)
	cnt := 0
	for i := 0; i < n; i++ {
		j := i
		for j+1 < n && a[j+1] == a[i] {
			j++
		}
		i = j
		a[cnt] = a[i]
		cnt++
	}
	return a[:cnt]
}
func lower_bound(a []int, x int) int {
	if a == nil || len(a) == 0 {
		return -1
	}
	l, r := 0, len(a)-1
	for l < r {
		mid := (l + r) >> 1
		if a[mid] >= x {
			r = mid
		} else {
			l = mid + 1
		}
	}
	if a[l] >= x {
		return l
	}
	return -1
}
func f_lower_bound(a []int, x int) int {
	if a == nil || len(a) == 0 {
		return -1
	}
	l, r := 0, len(a)-1
	for l < r {
		mid := (l + r + 1) >> 1
		if a[mid] <= x {
			l = mid
		} else {
			r = mid - 1
		}
	}
	if a[l] <= x {
		return l
	}
	return -1
}
func upper_bound(a []int, x int) int {
	if a == nil || len(a) == 0 {
		return -1
	}
	l, r := 0, len(a)-1
	for l < r {
		mid := (l + r) >> 1
		if a[mid] > x {
			r = mid
		} else {
			l = mid + 1
		}
	}
	if a[l] > x {
		return l
	}
	return -1
}
func binary_search(a []int, x int) bool {
	if a == nil || len(a) == 0 {
		return false
	}
	l, r := 0, len(a)-1
	for l < r {
		mid := (l + r) >> 1
		if a[mid] >= x {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return a[l] == x
}
func atoi(s string) int {
	ret := 0
	for _, val := range s {
		ret = ret*10 + int(val-'0')
	}
	return ret
}
func bool_to_int(x bool) int {
	if x {
		return 1
	}
	return 0
}
func reverse[T comparable](a []T) {
	for i := 0; i < len(a)/2; i++ {
		a[i], a[len(a)-1-i] = a[len(a)-1-i], a[i]
	}
}
func count[T comparable](a []T, opt func(x T) bool) int {
	ans := 0
	for i := range a {
		if opt(a[i]) {
			ans++
		}
	}
	return ans
}
func isSorted[T any](a []T, less func(T, T) bool) bool {
	for i := 0; i+1 < len(a); i++ {
		if !less(a[i], a[i+1]) {
			return false
		}
	}
	return true
}
func fill[T comparable](a []T, val T) {
	n := len(a)
	for i := 0; i < n; i++ {
		a[i] = val
	}
}

func solve() {
	// 感觉不难，单看每一位就行，比如 1 1 0，最后结果就是 2. 1 0 0 也是，只要三个数不全相同就 ok
	// 所以思路是看 l 这一位加多少，可以得到变化

	// 昨晚想了一半哈哈，现在补上另一半，这一位想给他加没错，但是累计值可能会超，所以分摊在两个数上面。
	// 等等，有没有可能三个数，不管了，先交一发再说

	// 贪一次 感觉要 wa2
	l, r := read(), read()
	a, b, c := l, l, r
	use_a, use_b, use_c := 0, 0, 0
	for i := 0; i < 30; i++ {
		cost := 1 << i
		if use_b+cost <= r-l {
			b = b ^ (1 << i)
			use_b += cost
		} else if use_a+cost <= r-l {
			a = a ^ (1 << i)
			use_a += cost
		} else if use_c+cost <= r-l {
			c = c ^ (1 << i)
			use_c += cost
		}
	}
	if a == c {
		c--
	}
	if b == c {
		c--
	}

	println(a, b, c)
	// println((a ^ b) + (b ^ c) + (a ^ c))
	// println()
}

func init() {
	__buf = make([]byte, 4096)
	__index = len(__buf)
	__input = os.Stdin
	__out = bufio.NewWriter(os.Stdout)
}

func main() {
	defer __out.Flush()
	tt := 1
	tt = read()
	for tt > 0 {
		tt--
		solve()
	}
}