Skip to content

Instantly share code, notes, and snippets.

@Vishal1297
Last active May 24, 2020 19:02
Show Gist options
  • Save Vishal1297/0896a63b6e9a236435fadb77e2385d88 to your computer and use it in GitHub Desktop.
Save Vishal1297/0896a63b6e9a236435fadb77e2385d88 to your computer and use it in GitHub Desktop.
A Fast Input Output Java Template. v1.0
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
public class Template {
public static void main(String[] args) {
// System.in and System.out are input and output streams, respectively.
InputStream inputStream = System.in;
InputReader in = new InputReader(inputStream);
int n = in.nextInt();
int k = in.nextInt();
int ans = 0;
for (int i = 0; i < n; i++) {
int x = in.nextInt();
// some code here
}
System.out.println(ans);
}
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());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment