Skip to content

Instantly share code, notes, and snippets.

@azhidkov
Last active October 9, 2021 15:49
Show Gist options
  • Save azhidkov/14f44b64a644181da2ad458b124a283f to your computer and use it in GitHub Desktop.
Save azhidkov/14f44b64a644181da2ad458b124a283f to your computer and use it in GitHub Desktop.
Java competitive programming template
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
new Task().solve(in, out);
out.close();
}
private static class Task {
private void solve(InputReader in, PrintWriter out) {
final int n = 1; // NOTE: write if needed
for (int it = 0; it < n; it++) {
solveOne(in, out);
}
}
private void solveOne(InputReader in, PrintWriter out) {
// TODO: write code here
}
}
private static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment