A set $S$ consists of $k$ sequences of $0,1,2$ of length $n$. For any two sequences $(a_i),(b_i)\in S$ we can construct a new sequence $(c_i)$ such that $c_i=\left\lfloor\frac{a_i+b_i+1}2\right\rfloor$ and include it in $S$. Assume that after performing finitely many such operations we obtain all the $3n$ sequences of $0,1,2$ of length $n$. Find the least possible value of $k$.
To solve this problem, we need to find the least possible value of \( k \) such that the set \( S \) initially contains \( k \) sequences of \( 0, 1, 2 \) of length \( n \), and after performing the given operation finitely many times, we can obtain all \( 3^n \) sequences of \( 0, 1, 2 \) of length \( n \).

1. **Initial Sequences in \( S \)**:
   - We start by including the sequence \((0, 0, \dots, 0)\) in \( S \). This is because the sequence of all zeros is fundamental and can help generate other sequences.
   - Define \((x_i) = (0, 0, \dots, 0, 2, 0, \dots, 0)\), where \( 2 \) is the \( i \)-th term of the sequence. We include all such sequences \((x_1), (x_2), \dots, (x_n)\) in \( S \).

2. **Constructing New Sequences**:
   - For any two sequences \((a_i), (b_i) \in S\), we can construct a new sequence \((c_i)\) such that \( c_i = \left\lfloor \frac{a_i + b_i + 1}{2} \right\rfloor \).
   - We need to show that starting with the sequences \((0, 0, \dots, 0)\) and \((x_1), (x_2), \dots, (x_n)\), we can generate all possible sequences of length \( n \) with elements \( 0, 1, 2 \).

3. **Generating Sequences**:
   - Consider the sequence \((2, 0, 0, \dots, 0)\). The only way to get this sequence is if it is already in \( S \) from the beginning. This is because the operation \( c_i = \left\lfloor \frac{a_i + b_i + 1}{2} \right\rfloor \) cannot generate a \( 2 \) unless one of the sequences already has a \( 2 \) in the corresponding position.
   - By including \((x_1), (x_2), \dots, (x_n)\) in \( S \), we ensure that we have sequences with a \( 2 \) in each possible position.

4. **Combining Sequences**:
   - Using the sequences \((0, 0, \dots, 0)\) and \((x_i)\), we can generate sequences with \( 1 \)s. For example, combining \((0, 0, \dots, 0)\) and \((0, 0, \dots, 2, 0, \dots, 0)\) will give us sequences with \( 1 \)s in the desired positions.
   - By iteratively applying the operation, we can generate all possible combinations of \( 0, 1, 2 \) in each position.

5. **Conclusion**:
   - The set \( S = \{(0, 0, \dots, 0), (x_1), (x_2), \dots, (x_n)\} \) contains \( n + 1 \) sequences.
   - Therefore, the least possible value of \( k \) is \( n + 1 \).

The final answer is \( \boxed{n + 1} \).