304 North Cardinal St.
Dorchester Center, MA 02124

# Yet Another Constructive Problem CodeChef Solution

## Yet Another Constructive Problem CodeChef Solution in C++17

``````#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lld long double
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define loop(i,a,b) for(int i=a; i<b; i++)
#define bloop(i,a,b) for(int i=a; i>=b; i--)
#define tc(t) int t; cin>>t; while(t--)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define vpi vector<pi>
#define all(a) a.begin(),a.end()
#define rall(a) a.end(),a.begin()

#define py cout<<"YES\n";
#define pn cout<<"NO\n";
#define PI 3.141592653589793238
#define mod (int) 1000000007
#define infinity (int) (1e18)

int main(){
tc(t){
ll x;
cin>>x;
if(x==1){
cout<<0<<" "<<1<<" "<<3<<endl;
continue;
}
if(x%2==0){
cout<<x<<" "<<x+1<<" "<<x+2<<endl;
}
else
cout<<x-2<<" "<<x-1<<" "<<x<<endl;

}

return 0;
}``````

## Yet Another Constructive Problem CodeChef Solution in C++14

``````#include<bits/stdc++.h>
using namespace std;

int main() {
int t;
cin>>t;
while(t--)
{
int x;
cin>>x;
int a=0;
int b=x;
int c=log2(x);
c=(2<<(c+1))+b;
cout<<a<<" "<<b<<" "<<c<<endl;
}
}``````

## Yet Another Constructive Problem CodeChef Solution in PYTH 3

``````# cook your dish here
for _ in range(int(input())):
x= int(input())

if x == 1:
print(1, 5, 9)
else:
if x%2 == 0:
print(x, x+1, x+2)
else:
print(1, x-1, x)``````

## Yet Another Constructive Problem CodeChef Solution in C

``````#include <stdio.h>
int main()
{
int T ;
scanf("%d", &T) ;
while(T--) {
int N ;
scanf("%d", &N) ;
int B = N | (1 << 28) ;
int C = N ;

printf("0 %d %d \n", B, C) ;
}
return 0;
}
``````

## Yet Another Constructive Problem CodeChef Solution in JAVA

``````/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while(t-- > 0){
int x = in.nextInt();

int a = x;
int b = x^(1<<26);
int c = x^(1<<25);

System.out.println(x+" "+b+" "+c);
}

}
}``````

## Yet Another Constructive Problem CodeChef Solution in PYPY 3

``````for _ in range(int(input())):
x=int(input())
print(x , (x | (1<<28)) , (x | (1<<29)))
``````

## Yet Another Constructive Problem CodeChef Solution in PYTH

``````t = int(raw_input())
for i in range(t):
X = int(raw_input())
n = 1
while n <= X:
n = n*2
# endwhile
A = X+n
B = X+2*n
C = X+4*n
st = str(A) + ' ' + str(B) + ' ' + str(C)
print st
# endfor i
``````

## Yet Another Constructive Problem CodeChef Solution in C#

``````using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Numerics;

public class Test
{
public static int GetInt() => int.Parse(Console.ReadLine());
public static long GetLong() => long.Parse(Console.ReadLine());

public static int[] GetIntArray() =>  Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
public static long[] GetLongArray() =>  Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();

public static string[] GetLines(int n)
{
var ans = new string[n];
for(int i=0; i<n; i++)
{
}
return ans;
}

public static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a%b);
public static int Gcd(int[] n) => n.Aggregate((a,b) => Gcd(a,b));

public static void Main()
{
var t=GetInt(); for(int i = 0; i<t; i++) { Solve(); }
// Solve();
}

public static void Solve()
{
var arr = GetIntArray();
int x = arr[0];

int y = x + (1 <<28);

Console.WriteLine(\$"0 {x} {y}");
}
}``````

## Yet Another Constructive Problem CodeChef Solution in NODEJS

``````"use strict";

const main = arg => {
const input = arg.trim().split("\n");

const TT = parseInt(input[0].split(" ")[0]);

for (let loop = 0 ; loop < TT ; loop++){
const X = parseInt(input[loop+1].split(" ")[0]);
let A = 0;
let B = X;
let C = 2**29-1;

console.log(A + " " + B + " " + C );
}
}

/*

*/``````

## Yet Another Constructive Problem CodeChef Solution in GO

``````package main

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

func main() {

var buf bytes.Buffer
for tc > 0 {
tc--
res := solve(x)
buf.WriteString(fmt.Sprintf("%d %d %d\n", res[0], res[1], res[2]))
}
fmt.Print(buf.String())
}

func readUint64(bytes []byte, from int, val *uint64) int {
i := from

var tmp uint64
for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
tmp = tmp*10 + uint64(bytes[i]-'0')
i++
}
*val = tmp

return i
}

func readInt(bytes []byte, from int, val *int) int {
i := from
sign := 1
if bytes[i] == '-' {
sign = -1
i++
}
tmp := 0
for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
tmp = tmp*10 + int(bytes[i]-'0')
i++
}
*val = tmp * sign
return i
}

for i := 0; i < len(s); i++ {
if s[i] == '\n' {
return s[:i]
}
}
return s
}

return
}

a, b = res[0], res[1]
return
}

a, b, c = res[0], res[1], res[2]
return
}

res := make([]int, n)
x := 0
for i := 0; i < n; i++ {
for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
x++
}
}
return res
}

func solve(x int) []int {
// (A | B) & (B | C) & (A | C) = x
// if digit(x, i) == 1, then at least two of (A, B, C) has to be 1 at digit i
// if digit(x, i) == 0, then at least two of (A, B, C) has to be 0 at digit i
if x&(x-1) == 0 {
// a power of 2
// a = 2, b = 6, c = 0
// a | b = 6, b | c = 6, c | a = 2
return []int{x, x*2 + x, x * 4}
}
a := x & -x
b := x - a
c := x
return []int{a, b, c}
}``````
##### Yet Another Constructive Problem CodeChef Solution Review:

In our experience, we suggest you solve this Yet Another Constructive Problem CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Yet Another Constructive Problem CodeChef Solution.

Find on CodeChef

##### Conclusion:

I hope this Yet Another Constructive Problem CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Programming Language in a business context; there are no prerequisites.

Keep Learning!