@@ -0,0 +1,1585 @@
+// https://codeforces.com/problemset/problem/234/B%0A%0Aimport java.io.File;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.FileOutputStream;%0Aimport java.io.PrintWriter;%0Aimport java.util.ArrayList;%0Aimport java.util.Collections;%0Aimport java.util.Comparator;%0Aimport java.util.List;%0Aimport java.util.Scanner;%0A%0Aimport javafx.util.Pair;%0A%0Apublic class Solution %7B%0A%0A%09public static void main(String%5B%5D args) %0A%09%09throws FileNotFoundException %0A%09%7B%0A%09%09File file = new File(%22input.txt%22);%0A%09%09Scanner read = new Scanner(file);%0A%09%09%0A%09%09int n = read.nextInt();%0A%09%09int k = read.nextInt();%0A%0A%09%09List%3C Pair%3CInteger, Integer%3E %3E lightLevels = new ArrayList%3C Pair%3CInteger, Integer%3E %3E();%0A%09%09for (int i = 1; i %3C= n; ++i) %7B%0A%09%09%09lightLevels.add( new Pair%3CInteger, Integer%3E(read.nextInt(), i) );%0A%09%09%7D%0A%09%09%0A%09%09Collections.sort(lightLevels, new Comparator%3CPair%3CInteger, Integer%3E%3E() %7B%0A%09%09%09@Override%0A%09%09%09public int compare(Pair%3CInteger, Integer%3E a, Pair%3CInteger, Integer%3E b) %7B%0A%09%09%09%09if (a.getKey() %3C b.getKey()) %7B%0A%09%09%09%09%09return -1;%0A%09%09%09%09%7D%0A%09%09%09%09else if (a.getKey() == b.getKey()) %7B%0A%09%09%09%09%09return 0;%0A%09%09%09%09%7D%0A%09%09%09%09else %7B%0A%09%09%09%09%09return 1;%0A%09%09%09%09%7D%0A%09        %7D%0A%09%09%7D);%0A%09%09%0A%09%09FileOutputStream fileOutputStream = new FileOutputStream(new File(%22output.txt%22));%0A%09%09boolean appendToFile = true;%0A%09%09try (PrintWriter output = new PrintWriter(fileOutputStream, appendToFile)) %7B%0A%09%09%09Integer minLightLevel = (Integer) lightLevels.get(n-k).getKey();%0A%09%09%09output.println(minLightLevel);%0A%09%09%09for (int i = n-k; i %3C n; ++i) %7B%0A%09%09%09%09if (k == 0) %7B%0A%09%09%09%09%09break;%0A%09%09%09%09%7D%0A%09%09%09%09output.print( lightLevels.get(i).getValue() + %22 %22 );%0A%09%09%09%09k--;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09// Close scanner%0A%09%09read.close();%0A%09%7D%0A%0A%7D%0A

Create Reading.java