Skip to content

Instantly share code, notes, and snippets.

@dharanad
Created March 9, 2021 00:18
Show Gist options
  • Save dharanad/4120b63f6c32199e9a51bcd30b43fc90 to your computer and use it in GitHub Desktop.
Save dharanad/4120b63f6c32199e9a51bcd30b43fc90 to your computer and use it in GitHub Desktop.
Java Fast IO
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
public static void main(String[] args) {
FastReader fs = new FastReader();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment