Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class Input {
- class $R {
- InputStream in; byte b; byte[] buf; int bi, bz;
- $R(InputStream I) { in=I; buf=new byte[65536]; bi=bz=0; read(); }
- void skip() { while (b >= 0 && b <= 32) read(); }
- void read() {
- if (bi==bz) {
- bi=0; try { bz=in.read(buf); } catch(Exception e) { bz=-1; } }
- b = bz == -1 ? -1 : buf[bi++]; }
- // Optional methods
- boolean hasNext() { skip(); return b >= 0; }
- String next() {
- StringBuilder sb = new StringBuilder();
- for (skip(); b > 32; read()) sb.append((char)b);
- return sb.length() == 0 ? null : sb.toString(); }
- int nextInt() {
- int i=0; boolean s=false; skip();
- if (b == '-') { s=true; read(); }
- for (; b > 32; read()) i = i*10 + b-48; return s ? -i : i; }
- long nextLong() {
- long i=0; boolean s=false; skip();
- if (b == '-') { s=true; read(); }
- for (; b > 32; read()) i = i*10 + b-48; return s ? -i : i; }
- String nextLine() {
- StringBuilder sb = new StringBuilder();
- for (; b != 10 && b != 13; read()) sb.append((char)b);
- while (b == 10 || b == 13) read(); return sb.toString(); }
- String nextRealLine() {
- StringBuilder sb = new StringBuilder();
- for (; b != 10 && b != 13; read()) sb.append((char)b);
- byte p = b; read();
- if ((p == 10 && b == 13) || (p == 13 && b == 10)) read();
- return sb.toString(); }
- }
- class $W extends PrintWriter {
- $W() { super(new BufferedOutputStream(System.out)); }
- }
- void run() {
- $R $r = new $R(System.in);
- $W $w = new $W();
- $w.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement