description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
b = bin(k)
k1 = int(b[:2] + "1" + b[2:], 2)
two = int(b[:2] + "1" + "0" * len(b[2:]), 2)
print(2, 3)
print(k1, k, 0)
print(two, k1, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER STRING VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER STRING BIN_OP STRING FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | ones = 262143
guard = 131072
k = int(input())
mat = [[ones, k], [ones - k, ones], [0, k]]
print(3, 2)
for row in mat:
print(*row) | ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST VAR VAR LIST BIN_OP VAR VAR VAR LIST NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
print(3, 3)
x = 1
while x <= k:
x *= 2
print(2 * x - 1, 0, 0)
print(2 * x - 1, k, 0)
print(x, x + k, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
s = bin(k)[2:]
l = len(s)
a = 2**l
b = k + a
matrix = [([b] * 3) for i in range(3)]
matrix[0][1] = k
matrix[1][0] = a
matrix[2][2] = k
print(3, 3)
for i in range(3):
print(" ".join(str(x) for x in matrix[i])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP LIST VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
ans = [([0] * 3) for _ in range(3)]
ans[0][0] = 2**18 - 1
ans[0][1] = 2**17
ans[1][0] = 2**17 - 1
ans[1][1] = 2**18 - 1
ans[1][2] = k
ans[2][1] = k
ans[2][2] = k
print(3, 3)
for ans_i in ans:
print(*ans_i) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
if k == 0:
print("1 1")
print("300000")
else:
print("3 2")
a = int(1 << 17)
print("%d %d" % (a + k, k))
print("%d %d" % (a, a + k))
print("%d %d" % (a, k)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP STRING BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
print("3 3")
print("{} {} {}".format((1 << 18) - 1, k, 0))
print("{} {} {}".format(1 << 17, (1 << 18) - 1, k))
print("{} {} {}".format(0, k, k)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING BIN_OP NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL STRING NUMBER VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
t = k
t = t | t >> 1
t = t | t >> 2
t = t | t >> 4
t = t | t >> 8
t = t | t >> 16
t = t | t >> 32
t = t + 1
temp = t | k
ans = [[temp, k], [t, temp], [0, k]]
print(3, 2)
for i in range(3):
print(*ans[i]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST LIST VAR VAR LIST VAR VAR LIST NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
k = int(sys.stdin.readline())
arr = [[(0) for _ in range(3)] for x in range(3)]
arr[2][2] = k
x = len(bin(k)) - 2
y = 2**x + k
arr[2][1] = y
arr[2][0] = k
arr[1][0] = k
arr[0][0] = y
arr[0][1] = 2**x
arr[0][2] = 2**x
arr[1][2] = 2**x
arr[1][1] = 2**x
print(3, 3)
for i in range(3):
print(*arr[i]) | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER VAR ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER VAR ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER VAR ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | I = lambda: list(map(int, input().split()))
(n,) = I()
x = 2**17
print(2, 3)
print(x + n, x, 0)
print(n, x + n, n) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
if k == 0:
print(1, 1)
print(300000)
exit()
print(2, 3)
print(2**18 - 1, 2**17, 2**17)
print(k, 2**18 - 1, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
input = lambda: sys.stdin.readline().rstrip()
k = int(input())
n = k.bit_length()
print(3, 4)
print(2**n + k, k, k, 0)
print(2**n, 0, k, 0)
print(2**n, 2**n, 2**n + k, k) | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP NUMBER VAR BIN_OP BIN_OP NUMBER VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
print(3, 3)
print(2**17 + k, k, 2**17)
print(2**17, 2**17 + k, k)
print(k, k, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER VAR VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
allone = 2**18 - 1
print(3, 2)
print(allone, k)
print(2**17, allone)
print(allone, allone - 2**17) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER VAR EXPR FUNC_CALL VAR VAR BIN_OP VAR BIN_OP NUMBER NUMBER |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | n = int(input())
k = len(bin(n)) - 2
A = [2 ** (k + 1) - 1, 2 ** (k + 1) - 1, 2**k]
B = [2 ** (k + 1) - 1, n, 2 ** (k + 1) - 1]
C = [2**k, 2 ** (k + 1) - 1, n]
print(3, 3)
print(*A)
print(*B)
print(*C) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER BIN_OP NUMBER VAR ASSIGN VAR LIST BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR LIST BIN_OP NUMBER VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
b = 1 << k.bit_length()
print(3, 4)
print(*[k + b, k, k, 0])
print(*[b, 0, k, 0])
print(*[b, b, k + b, k]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR LIST BIN_OP VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR LIST VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR LIST VAR VAR BIN_OP VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
def high(a):
ans = 1
a >>= 1
while a != 0:
a >>= 1
ans *= 2
return ans
if k == 0:
print(1, 1)
print(1)
else:
t = high(k)
t = t << 1
a = t + k
a1 = t
A = [[(0) for i in range(4)] for i in range(3)]
for i in range(3):
A[0][i] = k
for i in range(3):
A[i][0] = a1
for i in range(3):
A[-1][i] = a1
for i in range(3):
A[i][-2] = k
A[0][0] = a
A[-1][-1] = k
A[-1][-2] = a
print(3, 4)
for i in A:
for j in i:
print(j, end=" ")
print() | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER VAR NUMBER WHILE VAR NUMBER VAR NUMBER VAR NUMBER RETURN VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
n = len(bin(k)) - 2
mine = 2**n - 1
bob = k ^ mine
print(2, 3)
print(2**n + mine, 2**n + bob, bob)
print(mine, 2**n + mine, mine) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR VAR BIN_OP BIN_OP NUMBER VAR VAR VAR EXPR FUNC_CALL VAR VAR BIN_OP BIN_OP NUMBER VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | MOD = 998244353
T = 1
for t in range(1, T + 1):
k = int(input())
if k == 0:
print(1, 1)
print(1)
else:
print(3, 4)
x = 1 << 17
a = [[x + k, k, k, k], [x, k, k, x], [x, x, x + k, k]]
for i in range(3):
for j in range(4):
print(a[i][j], end=" ")
print("") | ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR LIST LIST BIN_OP VAR VAR VAR VAR VAR LIST VAR VAR VAR VAR LIST VAR VAR BIN_OP VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR STRING EXPR FUNC_CALL VAR STRING |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
input = sys.stdin.readline
k = int(input())
large = 2**17
small = k
ans = [[large | small, small, 0], [large, large | small, small]]
print(2, 3)
for line in ans:
print(*line) | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR LIST LIST BIN_OP VAR VAR VAR NUMBER LIST VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
b = k.bit_length()
all_1 = (1 << b + 1) - 1
first_1 = 1 << b
other_1 = first_1 - 1
a = [[all_1, first_1, 0], [other_1, all_1, k]]
print(2, 3)
for row in a:
print(*row) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LIST LIST VAR VAR NUMBER LIST VAR VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
t = int(input())
print("2 3")
print(str(131072 + t) + " " + str(t) + " " + str(131072))
print(str(131072) + " " + str(131072 + t) + " " + str(t)) | IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR BIN_OP NUMBER VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR NUMBER STRING FUNC_CALL VAR BIN_OP NUMBER VAR STRING FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | i = 0
ts = [1]
while ts[-1] <= 10**5:
i += 1
ts.append(2**i)
def slv(k):
if k == 0:
print(1, 1)
print(1)
return
t = 0
for i in ts:
if i > k:
t = i
break
t = t * 2 - 1
print(3, 3)
print(t, k, t)
print(t - k, t - k, t)
print(t, t, k)
k = int(input())
slv(k) | ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER WHILE VAR NUMBER BIN_OP NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR FUNC_DEF IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
input = lambda: sys.stdin.readline().strip()
ipnut = input
k = int(ipnut())
t = 1
if k == 1:
print("3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3")
exit(0)
while t <= k:
t *= 2
t1 = 2 * t - 1
print(2, 3)
print(t1, k, 0)
print(t, t1, k) | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER WHILE VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
mx18 = (1 << 18) - 1
mx17 = (1 << 17) - 1
print(2, 3)
print(mx18, k, mx17 + 1)
print(mx17 + 1, mx18, mx17) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
print(3, 4)
x = 131071 - k
print(262143, 131071, 131071, x)
print(131072, 262144, 131071, x)
print(262143, 262143, 262143, 131071) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER NUMBER NUMBER |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
print(3, 3)
print(2**18 - 1, k, k)
print(2**17, 2**17, 2**18 - 1)
print(0, 0, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR VAR EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
if k != 0:
print(3, 3)
print(2**18 - 1, 2**18 - 1 - k, 2**18 - 1 - k)
print(k, k, 2**18 - 1)
print(2**18 - 1 - k, 2**18 - 1 - k, k)
else:
print(1, 1)
print(300000) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER BIN_OP BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR BIN_OP BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR EXPR FUNC_CALL VAR VAR VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR BIN_OP BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
input = sys.stdin.readline
n = int(input())
print("2 3")
print((1 << 18) - 1, n, 0)
print(1 << 17, (1 << 18) - 1, n) | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
pow2 = 0
pow2x = 1
while pow2x <= k * 2:
pow2 += 1
pow2x *= 2
one = pow2x - 1
zer = pow2x // 2
kek = k
ans = [
[one, one, one, one, zer],
[one, 0, one, kek, zer],
[one, one, 0, kek, one],
[one, kek, kek, 0, kek],
[zer, zer, one, kek, kek],
]
print(5, 5)
for line in ans:
print(*line) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR LIST LIST VAR VAR VAR VAR VAR LIST VAR NUMBER VAR VAR VAR LIST VAR VAR NUMBER VAR VAR LIST VAR VAR VAR NUMBER VAR LIST VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
arr = [[0, k, 0], [0, 0, k]]
length = 0
t = k
while t > 0:
t >>= 1
length += 1
arr[1][1] = (1 << length) + k
arr[1][0] = (1 << length) + ((1 << length) - 1 ^ k)
arr[0][0] = (1 << length + 1) - 1
print(2, 3)
for i in arr:
print(*i) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER VAR NUMBER LIST NUMBER NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER VAR ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
input = sys.stdin.readline
k = int(input())
a = 1 << k.bit_length()
print(2, 3)
print(a | k, k, 0)
print(a, a | k, k) | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
if k < k ^ 2**18 - 1:
k ^= 2**18 - 1
print(2, 3)
print(2**18 - 1, k ^ 2**18 - 1, k)
print(k, 2**18 - 1, k ^ 2**18 - 1) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR BIN_OP VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER BIN_OP VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR EXPR FUNC_CALL VAR VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER BIN_OP VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | from sys import stdin, stdout
def outputmatrix(k):
if k == 0:
stdout.write("1 1\n")
stdout.write("1\n")
return
m = 1
while m <= k:
m *= 2
l = m - 1
o = l - k
n = l + m
r1 = [n, l, l, 0]
r2 = [m, 0, l, o]
r3 = [m, m, n, l]
stdout.write("3 4\n")
stdout.write(" ".join(map(str, r1)) + "\n")
stdout.write(" ".join(map(str, r2)) + "\n")
stdout.write(" ".join(map(str, r3)) + "\n")
k = int(stdin.readline())
outputmatrix(k) | FUNC_DEF IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST VAR VAR VAR NUMBER ASSIGN VAR LIST VAR NUMBER VAR VAR ASSIGN VAR LIST VAR VAR VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL STRING FUNC_CALL VAR VAR VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL STRING FUNC_CALL VAR VAR VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL STRING FUNC_CALL VAR VAR VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
A = (1 << 18) - 1
B = 1 << 17
ans = [[A, A, A], [B, k, B], [B, B + k, k]]
print(3, 3)
[print(*i) for i in ans] | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR LIST LIST VAR VAR VAR LIST VAR VAR VAR LIST VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
res = [[(0) for _ in range(4)] for _ in range(4)]
res[0][0] = (1 << 18) - 1
res[0][1] = (1 << 18) - 1
res[0][2] = 1 << 17
res[0][3] = 1 << 17
res[1][0] = 1 << 17
res[1][1] = (1 << 18) - 1
res[1][2] = k
res[1][3] = 1 << 17
res[2][0] = 1 << 17
res[2][1] = k
res[2][2] = (1 << 17) - 1
res[2][3] = 1 << 17
res[3][0] = 1 << 17
res[3][1] = 1 << 17
res[3][2] = (1 << 18) - 1
res[3][3] = (1 << 17) - 1
print(4, 4)
for i in res:
print(*i) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | a = int(input())
p = 1
while p <= a:
p *= 2
print(3, 3)
print(p + a, a, 0)
print(p, a, 0)
print(p + a, p + a, a) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | def findpow2(integer):
pow2 = 1
while pow2 <= integer:
pow2 *= 2
return pow2
k = int(input())
B = findpow2(k)
A = 2 * B
print(3, 3)
print(A - 1, A - 1, B - 1)
print(A - 1, B, A - 1)
print(B - 1, A - 1, k) | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
print(
"""4 4
262143 131071 131071 0
131072 0 131071 0
131072 131072 262143 0
0 0 131071 %d"""
% k
) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
lis = [([0] * 4) for i in range(3)]
a = 1 << 17
lis[0][0] = a + k
lis[0][1] = k
lis[0][2] = k
lis[0][3] = 0
lis[1][0] = a
lis[1][1] = 1
lis[1][2] = k
lis[1][3] = 0
lis[2][0] = a
lis[2][1] = a
lis[2][2] = k + a
lis[2][3] = k
print(3, 4)
for i in lis:
print(*i) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP VAR VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER BIN_OP VAR VAR ASSIGN VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
def main():
import sys
input = sys.stdin.readline
K = int(input())
print(3, 3)
X = (1 << K.bit_length() + 1) - 1
Y = 1 << K.bit_length()
print(X, K, 0)
print(Y, X, X)
print(0, X, K)
main() | IMPORT FUNC_DEF IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER VAR VAR EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
input = sys.stdin.readline
k = int(input())
base = 1
nk = base + k
while k != 0 and base | nk == nk:
base <<= 1
nk = base + k
big = 1 << 17
print("3 2")
print("{} {}".format(big | base | nk, nk))
print("{} {}".format(big | base, big | base | nk))
print("{} {}".format(0, base | nk)) | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR WHILE VAR NUMBER BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING BIN_OP BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING NUMBER BIN_OP VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | from sys import stdin
input = stdin.readline
def A():
t = int(input())
for _ in range(t):
a, b, c, d = map(int, input().split())
x, y, x1, y1, x2, y2 = map(int, input().split())
netr = b - a
netu = d - c
if x1 == x2 and (a > 0 or b > 0):
print("No")
continue
if y1 == y2 and (c > 0 or d > 0):
print("No")
continue
if netr + x < x1 or netr + x > x2:
print("No")
continue
if netu + y < y1 or netu + y > y2:
print("No")
continue
print("Yes")
def B():
t = int(input())
for _ in range(t):
m = int(input())
a = list(map(int, input().split()))
c = [0] * m
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
used = [False] * 11
for i in range(m):
j = 0
while a[i] % p[j] != 0:
j += 1
used[j] = True
c[i] = j
used[0] = int(used[0])
for i in range(1, 11):
used[i] = int(used[i]) + used[i - 1]
for i in range(m):
c[i] = used[c[i]]
print(max(used))
print(*c)
def C():
t = int(input())
for _ in range(t):
n, k = map(int, input().split())
s = [(ord(x) - 97) for x in input().rstrip()]
l = [[(0) for i in range(26)] for j in range(k)]
for i in range(n):
l[i % k][s[i]] += 1
for i in range(k // 2):
for j in range(26):
l[i][j] += l[k - i - 1][j]
for i in range((k + 1) // 2):
n -= max(l[i])
print(n)
def D():
k = int(input())
if k == 0:
print("1 1\n1")
else:
t = 1
while t <= 2 * k:
t *= 2
print("3 2")
print(str(t - 1) + " " + str(t // 2))
print(str(k) + " " + str(t - 1))
print("0 " + str(t // 2 - 1))
D() | ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER WHILE VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER STRING FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | def main():
k = int(input())
x = 2**17
print(2, 3)
print(x ^ k, x, 0)
print(k, x ^ k, k)
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
print(
"2 3\n"
+ str(k + 2**17)
+ " "
+ str(k)
+ " 0\n"
+ str(2**17)
+ " "
+ str(k + 2**17)
+ " "
+ str(k)
) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP STRING FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER NUMBER STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR BIN_OP NUMBER NUMBER STRING FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER NUMBER STRING FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
p = 1
while p <= k:
p *= 2
print(2, 3)
print(p + k, k, 0)
print(p, p * 2 - 1, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
n = 2**17
if k == 0:
print("{} {}".format(1, 1))
print(k)
else:
print("{} {}".format(2, 3))
print("{} {} {}".format(n + k, k, n))
print("{} {} {}".format(n, n + k, k)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR BIN_OP VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
s = bin(k)[2:]
a = (1 << len(s)) + k
b = 1 << len(s)
print(2, 3)
print(a, b, b)
print(k, a, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
print(3, 4)
inf = 2**18 - 1
x = inf ^ k
y = inf >> 1
pattern = [[inf, inf, inf, 0], [inf, 0, y, 0], [inf, x, inf, y]]
for i in range(3):
print(*pattern[i]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LIST LIST VAR VAR VAR NUMBER LIST VAR NUMBER VAR NUMBER LIST VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
input = sys.stdin.readline
K = int(input())
res = [([0] * 3) for _ in range(2)]
res[0][0] = (1 << 18) - 1
res[1][1] = (1 << 18) - 1
res[0][1] = K
res[-1][-1] = K
res[1][0] = (1 << 18) - 1 - K
print(2, 3)
print(*res[0])
print(*res[1]) | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
input = sys.stdin.readline
B = 262144
K = int(input())
print(3, 2)
print(B - 1, K)
print(B // 2, B - 1)
print(0, B // 2 - 1) | IMPORT ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
if k == 0:
print(1, 1)
print(1)
exit(0)
q = bin(100000)
t = pow(2, len(q) - 1) - 1
rem = bin(k)
rem = rem[2:]
rem = "0" * (len(bin(t)) - 2 - len(rem)) + rem
alpha = 0
for i in range(len(rem)):
if rem[i] == "0":
alpha += pow(2, len(rem) - i - 1)
ans = [t, k, 0]
gns = [alpha, t, 0]
tns = [0, k, k]
print(3, 3)
print(*ans)
print(*gns)
print(*tns) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR LIST VAR VAR NUMBER ASSIGN VAR LIST VAR VAR NUMBER ASSIGN VAR LIST NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | n = int(input())
d = 2
while d < 10**5:
d *= 2
print(2, 3)
print(n + d, d, d)
print(n, n + d, n) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
inp = sys.stdin.readline
def input():
return inp().strip()
def iin():
return int(input())
def lin():
return list(map(int, input().split()))
def main():
T = 1
while T:
T -= 1
k = iin()
print(2, 3)
mx = 262143
inv = mx - k
a = [[mx, k, 0], [inv, mx, k]]
for i in a:
print(*i)
main() | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST LIST VAR VAR NUMBER LIST VAR VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | printn = lambda x: print(x, end="")
inn = lambda: int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda: input().strip()
DBG = True
BIG = 10**18
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
k = inn()
if k == 0:
print("1 1")
print(3)
exit()
q = 2**17
print("3 4")
print("{} {} {} {}".format(q + k, k, k, 0))
print("{} {} {} {}".format(q, 0, k, 0))
print("{} {} {} {}".format(q, q, q + k, k)) | ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF IF VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING BIN_OP VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR VAR BIN_OP VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
k = bin(k)[2:]
l = len(k)
a = "1" * (l + 1)
a = int(a, 2)
k = int(k, 2)
p = a - k
if k == 0:
print(1, 1)
print(12)
else:
print(3, 4)
print(a, a, a, p)
print(p, 0, k, p)
print(p, p, a, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
input = sys.stdin.readline
def main():
K = int(input())
if K == 0:
print(1, 1)
print(300000)
else:
print(3, 3)
print(131072 + K, 131072 + K, 131072)
print(131072, K, 131072)
print(131072, 131072 + K, K)
main() | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | K = int(input())
a = 2**18 - 1
b = 2**17
c = 2**17 - 1
print(3, 4)
print(a, a, b, b)
print(b, K, c, b)
print(b, b, a, c) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | from sys import stderr
def print_mx(mx):
print(len(mx), len(mx[0]))
for row in mx:
print(*row)
def find_breaking_mx(k):
if k == 0:
return ((0,),)
i_bit = 0
while k >> i_bit & 1:
i_bit += 1
a = k | 1 << i_bit
a_prime = 1 << i_bit
while a >> i_bit:
i_bit += 1
b = 1 << i_bit
x = a | b
return (x, a, a, a - k), (b, 0, a, a - k), (x, x, x, a)
k = int(input())
print_mx(find_breaking_mx(k)) | FUNC_DEF EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER WHILE BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP NUMBER VAR WHILE BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR VAR RETURN VAR VAR VAR BIN_OP VAR VAR VAR NUMBER VAR BIN_OP VAR VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
dp = []
c = 2**17
dp.append([c + k, k, k])
dp.append([c, k + c, k + c])
dp.append([k, k + c, k])
print(3, 3)
for a, b, c in dp:
print(a, b, c) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR LIST BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR LIST VAR BIN_OP VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR LIST VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
matrix = [[262143, k, k, 0], [131072, 0, k, 0], [131072, 262143, 262143, k]]
print("3 4")
for x in matrix:
print(*x) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER VAR VAR NUMBER LIST NUMBER NUMBER VAR NUMBER LIST NUMBER NUMBER NUMBER VAR EXPR FUNC_CALL VAR STRING FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
c = 0
while k + 1 >= 2**c:
c += 1
holder = k + 1
if (k + 1) % 2 == 0:
holder = k + 2
solution = [
[2 ** (c + 1) - 1, holder, 1],
[2**c, k + 1, 1],
[2**c, 2**c + holder, holder],
]
print("3 3")
for i in range(3):
print(" ".join(map(str, solution[i]))) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMBER BIN_OP NUMBER VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LIST LIST BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER VAR NUMBER LIST BIN_OP NUMBER VAR BIN_OP VAR NUMBER NUMBER LIST BIN_OP NUMBER VAR BIN_OP BIN_OP NUMBER VAR VAR VAR EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input().strip())
print("2 3")
print("{} {} {}".format((2 << 16) + k, k, 0))
print("{} {} {}".format(2 << 16, (2 << 16) + k, k)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING BIN_OP BIN_OP NUMBER NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING BIN_OP NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | def pow(base, exp):
res = 1
while exp > 0:
if exp % 2:
res = res * base
exp //= 2
base = base * base
return res
def main():
maxi = pow(2, 18)
k = int(input())
a = [[] for i in range(4)]
a[0] = [(maxi - 1) for i in range(4)]
a[1] = [maxi // 2, maxi // 2, maxi // 2 - 1, maxi]
a[2] = [maxi - 1, maxi - 1, maxi - 1, k]
print(3, 4)
for i in a:
print(*i)
return
main() | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER LIST BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER LIST BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR RETURN EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
print(3, 4)
print(262143, k, k, 0)
print(131072, 0, k, 0)
print(131072, 131072, 262143, 131071) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER NUMBER NUMBER |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
print(3, 3)
a = [[(0) for _ in range(3)] for _ in range(3)]
CONST = 1
while CONST < 100000:
CONST = CONST << 1
CONST = CONST | 1
CONST = CONST << 1 | 1
a[0][0] = CONST
a[0][1] = CONST
a[1][0] = CONST
a[2][1] = CONST
a[1][1] = k
a[2][2] = k
a[2][0] = CONST ^ k
for i in range(len(a)):
for j in range(len(a[i])):
print(a[i][j], end=" ")
print() | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER BIN_OP VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR STRING EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
maxx = 262143
print(3, 4)
print(maxx, maxx, maxx, 0)
print(maxx ^ k, 0, k, 0)
print(maxx, maxx, maxx, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | from sys import stdin
input = stdin.readline
k = int(input())
if k == 0:
print(1, 1)
print(300000)
else:
print(3, 4)
print(2**18 - 1, 2**17 - 1, 2**17 - 1, 1)
print(2**17, 2**18, 2**17 - 1, 0)
print(2**18 - 1, 2**18 - 1, 2**18 - 1, k) | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
s = k.bit_length()
print(2, 3)
print(2**s + k, k, 0)
print(2**s, 2**s + k, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP BIN_OP NUMBER VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | d = int(input())
p = 1
while p - 1 < d:
p *= 2
p *= 2
full = p - 1
top = p // 2
print("3 3")
print(full, d, top)
print(top, d, top)
print(top, full, d) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
if k == 0:
print("1 1\n1")
else:
print("3 2")
upper = 1
while upper <= k:
upper = upper * 2
print(upper + k, k)
print(upper, upper * 2 - 1)
print(0, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
if k == 0:
print(1, 1)
print(1)
else:
st2 = 1
print(3, 4)
while st2 <= k:
st2 *= 2
a = [([0] * 4) for i in range(3)]
a = [
[2 * st2 - 1, st2 - 1, st2 - 1, 0],
[2 * st2 - 1 - k, 0, st2 - 1, 0],
[2 * st2 - 1, 2 * st2 - 1, 2 * st2 - 1, st2 - 1],
]
for i in a:
print(*i) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER WHILE VAR VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST LIST BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER LIST BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER NUMBER LIST BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | n = int(input())
print(2, 3)
print(n + 2**17, end=" ")
print(n, end=" ")
print(0)
print(2**17, end=" ")
print(n + 2**17, end=" ")
print(n) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER NUMBER STRING EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER NUMBER STRING EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
s = bin(k)[2:]
print(2, 3)
print(int("1" + s, 2), k, 0)
print(int("1" + "0" * len(s), 2), int("1" + s, 2), k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP STRING VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP STRING BIN_OP STRING FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR BIN_OP STRING VAR NUMBER VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
k_ = int("1" + "0" * (len(bin(k)) - 2), 2)
k_or = k_ | k
print("3 3")
print(str(k_or) + " " + str(k_) + " " + str(k_))
print(str(k) + " " + str(k_) + " " + str(k_))
print(str(k) + " " + str(k_or) + " " + str(k)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP STRING BIN_OP STRING BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
line = sys.stdin.readline()
n = int(line.strip())
def solve(n):
if n == 0:
print("1 1")
print("1")
return
print("3 3")
arr = [[(0) for _ in range(3)] for _ in range(3)]
p = len(bin(n)[2:])
arr[0][0] = 2 ** (p + 1) - 1
arr[0][1] = 2 ** (p + 1) - 1
arr[1][0] = 2 ** (p + 1) - 1
arr[1][2] = 2 ** (p + 1) - 1
arr[2][1] = 2 ** (p + 1) - 1
arr[1][1] = 2**p - 1
arr[2][2] = 2**p - 1
small = 2 ** (p + 1) - 1 - n
arr[0][2] = small
arr[2][0] = small
for i in range(3):
print(" ".join(map(str, arr[i])))
solve(n) | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING RETURN EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | def getMaxBinOnes(n):
f = n
b = 1
while b < n:
n = n | b
b *= 2
b *= 2
return b - 1, b - 1 - f
k = int(input())
bait, trap = getMaxBinOnes(k)
matrix = []
matrix.append([bait, bait, bait, 0])
matrix.append([trap, 0, k, 0])
matrix.append([bait, bait, bait, k])
if k == 0:
matrix = [[2, 2, 2, 2], [2, 2, 2, 2], [2, 2, 2, 2]]
elif k == 1:
matrix = [[7, 7, 7, 0], [4, 0, 1, 0], [7, 7, 7, 1]]
print("3 4")
for row in matrix:
for i in row:
print(i, end=" ")
print() | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER RETURN BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR LIST VAR VAR VAR NUMBER EXPR FUNC_CALL VAR LIST VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR LIST VAR VAR VAR VAR IF VAR NUMBER ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER IF VAR NUMBER ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR STRING FOR VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
A = 131071
B = A - k
C = 2 * A + 1
D = C - A
print(3, 3)
m = [[C, A, B], [D, C, B], [0, C, A]]
for l in m:
print(*l) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR LIST LIST VAR VAR VAR LIST VAR VAR VAR LIST NUMBER VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | n = 4
m = 4
k = int(input())
a = [
[131072 + k, k, k, k],
[131072, 0, k, k],
[131072, 0, k, 0],
[131072, 131072, 131072 + k, k],
]
print(n, m)
for row in a:
print(*row) | ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST BIN_OP NUMBER VAR VAR VAR VAR LIST NUMBER NUMBER VAR VAR LIST NUMBER NUMBER VAR NUMBER LIST NUMBER NUMBER BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
n, m = 2, 3
mat = [([0] * 3) for i in range(2)]
kbits = 0
x = k
while x:
x >>= 1
kbits += 1
start = 1
for i in range(kbits):
start = (start << 1) + 1
x = 1 << kbits
mat[0][0] = start
mat[0][1] = x
mat[1][0] = k
mat[1][1] = x + k
mat[1][2] = k
print(n, m)
for row in mat:
print(*row) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER BIN_OP VAR VAR ASSIGN VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
if k == 0:
print(1, 1)
print(100)
else:
print(3, 3)
print(2**18 - 1, 2**18 - 1, 2**17)
print(2**18 - 1, k, 2**17 + k)
print(2**17, 2**17 + k, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR BIN_OP BIN_OP NUMBER NUMBER VAR EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input(""))
print("2 3")
a = 2**17 + k
b = 2**17
x = k
c = 2**18 - 1
d = k
e = 0
print(str(a) + " " + str(b) + " " + str(e))
print(str(x) + " " + str(c) + " " + str(d)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
if k == 0:
print(1, 1)
print(1)
else:
temp = k
cnt = 0
while temp > 0:
cnt += 1
temp = temp >> 1
arr = []
for x in range(3):
arr.append([k, k, k, k])
arr[1][0] = arr[1][1] = 1 << cnt
arr[0][3] = arr[1][3] = 0
arr[0][0] = (1 << cnt + 1) - 1
arr[2][0] = arr[0][0]
arr[2][1] = arr[0][0]
arr[2][2] = arr[0][0]
print(3, 4)
for x in arr:
for y in x:
print(y, end=" ")
print() | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR LIST VAR VAR VAR VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER BIN_OP NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | def f():
k = int(input())
full = (1 << 18) - 1
fake = 1 << 17
M = [[full, fake, full], [k, full, full], [full, full, k]]
print("3 3")
for row in M:
print(" ".join(str(num) for num in row))
f() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR LIST LIST VAR VAR VAR LIST VAR VAR VAR LIST VAR VAR VAR EXPR FUNC_CALL VAR STRING FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | from sys import stdin, stdout
def main():
n = int(stdin.readline())
if n == 0:
stdout.write("1 1\n300")
else:
stdout.write("3 3\n")
pw = 1
while pw <= n:
pw *= 2
start = pw + n
stdout.write(str(start) + " " + str(pw) + " " + str(pw) + "\n")
stdout.write(str(n) + " " + str(pw) + " " + str(pw) + "\n")
stdout.write(str(n) + " " + str(start) + " " + str(n) + "\n")
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | n = int(input())
print(3, 4)
a = [
[262143, 262143, 262143, 1],
[262143, 262143, n, 131072],
[262143, 131072, 262143, n],
]
for i in a:
print(*i) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER VAR NUMBER LIST NUMBER NUMBER NUMBER VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | (K,) = map(int, input().split())
ln = len(bin(K)) - 2
print(3, 2)
print((1 << ln + 1) - 1, 1 << ln)
print(K, (1 << ln + 1) - 1)
print(0, K) | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
def input():
return sys.stdin.readline()[:-1]
k = int(input())
x = 2**17
print(2, 3)
print(x + k, x, 0)
print(k, x + k, k) | IMPORT FUNC_DEF RETURN FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
if k == 0:
print("1 1")
print("5")
else:
print("3 2")
p2 = 1
while p2 <= k:
p2 *= 2
ones = p2 * 2 - 1
print(ones, k)
print(p2, ones)
print(0, k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
trump = pow(2, 17)
mask = pow(2, 18) - 1
print(3, 3)
ans = [[(0) for i in range(3)] for j in range(3)]
ans[0][0] = mask
ans[0][1] = k
ans[0][2] = 0
ans[1][0] = trump
ans[1][1] = mask
ans[1][2] = k
ans[2][0] = 0
ans[2][1] = k
ans[2][2] = k
for i in range(3):
for j in range(3):
print(ans[i][j], end=" ")
print()
dp = [[(0) for i in range(4)] for j in range(4)]
dp[0][1] = mask
for i in range(1, 4):
for j in range(1, 4):
dp[i][j] = max(
dp[i - 1][j] & ans[i - 1][j - 1], dp[i][j - 1] & ans[i - 1][j - 1]
) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | import sys
def input():
return sys.stdin.readline().strip()
def iinput():
return int(input())
def rinput():
return map(int, input().split())
def rlinput():
return list(map(int, input().split()))
def main():
def pro(a, b, x, x1, x2):
if (a == -2 * b or x != x1 or x != x2 or b == 0) and x1 <= x - a + b <= x2:
return True
return False
k = iinput()
print(3, 2)
print(2**18 - 1, k)
print(2**17, 2**18 - 1)
print(0, k)
for i in range(1):
main() | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF FUNC_DEF IF VAR BIN_OP NUMBER VAR VAR VAR VAR VAR VAR NUMBER VAR BIN_OP BIN_OP VAR VAR VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | n = int(input())
print("3 3")
print(262143, end=" ")
print(262143, end=" ")
print(n)
print("0 131072 262143")
print("0 0", end=" ")
print(n) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING STRING EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
if k == 0:
print(1, 1)
print(0)
exit()
maxx = 3 * 10**5
for a in range(1, maxx):
if a + k <= maxx and a + k & a == a:
r = a + k
m = r + 1
p = m | r
if r & m < a:
print(3, 4)
print(p, r, r, r)
print(m, 0, r, a)
print(p, p, p, r)
exit() | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
if k == 0:
print(1, 1)
print(0)
else:
cnt = 1
while cnt <= k:
cnt *= 2
res = [[(0) for i in range(3)] for j in range(3)]
mx = pow(2, 18) - 1
res[0][2] = res[2][0] = cnt
res[1][2] = res[2][1] = mx
res[0][0] = res[0][1] = res[1][0] = mx
res[2][2] = res[1][1] = k
print(3, 3)
for i in range(3):
print(" ".join(map(str, res[i]))) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | n = int(input())
if n == 0:
print(1, 1)
print(1234)
exit()
b = bin(n)[2:]
c = len(b) * "0"
b = "1" + b
nw = int(b, 2)
c = "1" + c
nw1 = int(c, 2)
print(3, 3)
print(nw, n, n)
print(nw, nw1, nw)
print(nw, nw1, n) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR STRING ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | n = int(input())
q = 1 << 17
mat = [[q + n, n], [q, q + n], [q, q - 1]]
print(3, 2)
print(*mat[0])
print(*mat[1])
print(*mat[2]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR LIST LIST BIN_OP VAR VAR VAR LIST VAR BIN_OP VAR VAR LIST VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | k = int(input())
c = 1 << 17
x = c + k
l = [[x, k, k, 0], [c, 0, k, 0], [c, c, x, k]]
print(3, 4)
for r in l:
print(*r) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST LIST VAR VAR VAR NUMBER LIST VAR NUMBER VAR NUMBER LIST VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | n = int(input())
B = [0] * 4
for i in range(4):
B[i] = [0] * 4
x = 18
B[0][0] = (1 << x) - 1
for i in range(4):
for j in range(4):
B[i][j] = B[0][0]
B[1][1] = (1 << x - 1) - 1
B[2][0] = B[1][1] + 1
B[1][2] = 2 * B[2][0]
B[2][2] = n
print(3, 3)
for i in range(3):
for j in range(3):
print(B[i][j], end=" ")
print() | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER BIN_OP NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR STRING EXPR FUNC_CALL VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | from sys import stdin, stdout
def cout(x):
print(x, end=" ")
return
k = int(input())
a = 2**18 - 1
b = 2**17
print("3 3")
print(str(a) + " " + str(a) + " " + str(b))
print(str(b) + " " + str(k) + " " + str(a))
print(str(b) + " " + str(a) + " " + str(k)) | FUNC_DEF EXPR FUNC_CALL VAR VAR STRING RETURN ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR |
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To reach the goal, position (n,m), player can move right or down, i.e. move from (x,y) to (x,y+1) or (x+1,y), as long as player is still on the matrix.
However, each move changes player's score to the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the current score and the value at the position he moves to.
Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.
<image>
However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix A. Thus, for any given non-negative integer k, he wants to find out an n × m matrix A=(a_{i,j}) such that
* 1 ≤ n,m ≤ 500 (as Bob hates large matrix);
* 0 ≤ a_{i,j} ≤ 3 ⋅ 10^5 for all 1 ≤ i≤ n,1 ≤ j≤ m (as Bob hates large numbers);
* the difference between the maximum score he can get and the output of his algorithm is exactly k.
It can be shown that for any given integer k such that 0 ≤ k ≤ 10^5, there exists a matrix satisfying the above constraints.
Please help him with it!
Input
The only line of the input contains one single integer k (0 ≤ k ≤ 10^5).
Output
Output two integers n, m (1 ≤ n,m ≤ 500) in the first line, representing the size of the matrix.
Then output n lines with m integers in each line, a_{i,j} in the (i+1)-th row, j-th column.
Examples
Input
0
Output
1 1
300000
Input
1
Output
3 4
7 3 3 1
4 8 3 6
7 7 7 3
Note
In the first example, the maximum score Bob can achieve is 300000, while the output of his algorithm is 300000.
In the second example, the maximum score Bob can achieve is 7\&3\&3\&3\&7\&3=3, while the output of his algorithm is 2. | def isKthBitSet(n, k):
if n & 1 << k - 1:
return True
else:
return False
k = int(input())
ls = [(0) for i in range(18)]
for i in range(18):
if isKthBitSet(k, i + 1):
ls[i] = 1
k_ = 0
for i in range(18):
if ls[i] == 0:
k_ += 2**i
print(3, 3)
print(k + 2**17, k + 2**17, k_)
print(k_, k, k + 2**17)
print(k_, k + 2**17, k) | FUNC_DEF IF BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER NUMBER BIN_OP VAR BIN_OP NUMBER NUMBER VAR EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR BIN_OP NUMBER NUMBER VAR |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.