// NOTE: it is recommended to use this even if you don't understand the following code. using System; using System.IO; using System.Linq; using System.Collections.Generic; namespace minimizeproduct { class Program { static void Main(String[] args) { StreamReader streamReader = new StreamReader(Console.OpenStandardInput()); StreamWriter streamWriter = new StreamWriter(Console.OpenStandardOutput()); // uncomment the two following lines if you want to read/write from files // streamReader = new StreamReader("input.txt"); // streamWriter = new StreamWriter("output.txt"); IEnumerator it = GetEnumerator(streamReader); int N = Convert.ToInt32(Next(it)); int Q = Convert.ToInt32(Next(it)); int[] arr = new int[N]; for (int i = 0; i < N; ++i) arr[i] = Convert.ToInt32(Next(it)); int[] l = new int[Q], r = new int[Q], k = new int[Q]; for (int i = 0; i < Q; ++i) { l[i] = Convert.ToInt32(Next(it)); r[i] = Convert.ToInt32(Next(it)); k[i] = Convert.ToInt32(Next(it)); } int[] ans = new int[Q]; // INSERT YOUR CODE HERE for (int i = 0; i < Q; ++i) streamWriter.WriteLine($"{ans[i]}"); streamReader.Close(); streamWriter.Close(); } static IEnumerator GetEnumerator(StreamReader sr) { String line; while ((line = sr.ReadLine()) != null) { String[] tokens = line.Split(' ').Where(t => t.Length > 0).ToArray(); foreach (String t in tokens) { yield return t; } } } static String Next(IEnumerator iterator) { return iterator.MoveNext() ? iterator.Current : null; } } }