static byte[] input = new byte[1024];
static int size, position;
public static byte nextByte
() throws Exception { if (position == size) {
position = 0;
}
return input[position++];
}
public static int nextInt
() throws Exception { byte b = nextByte();
int n = 0;
while (!(b >= '0' && b <= '9')) {
b = nextByte();
}
while ((b >= '0' && b <= '9')) {
n = n * 10 + b - '0';
b = nextByte();
}
return n;
}
CXN0YXRpYyBieXRlW10gaW5wdXQgPSBuZXcgYnl0ZVsxMDI0XTsKCXN0YXRpYyBpbnQgc2l6ZSwgcG9zaXRpb247CgoJcHVibGljIHN0YXRpYyBieXRlIG5leHRCeXRlKCkgdGhyb3dzIEV4Y2VwdGlvbiB7CgkJaWYgKHBvc2l0aW9uID09IHNpemUpIHsKCQkJc2l6ZSA9IFN5c3RlbS5pbi5yZWFkKGlucHV0KTsKCQkJcG9zaXRpb24gPSAwOwoJCX0KCgkJcmV0dXJuIGlucHV0W3Bvc2l0aW9uKytdOwoKCX0KCglwdWJsaWMgc3RhdGljIGludCBuZXh0SW50KCkgdGhyb3dzIEV4Y2VwdGlvbiB7CgkJYnl0ZSBiID0gbmV4dEJ5dGUoKTsKCQlpbnQgbiA9IDA7CgoJCXdoaWxlICghKGIgPj0gJzAnICYmIGIgPD0gJzknKSkgewoJCQliID0gbmV4dEJ5dGUoKTsKCgkJfQoJCXdoaWxlICgoYiA+PSAnMCcgJiYgYiA8PSAnOScpKSB7CgkJCW4gPSBuICogMTAgKyBiIC0gJzAnOwoJCQliID0gbmV4dEJ5dGUoKTsKCgkJfQoKCQlyZXR1cm4gbjsKCgl9
Main.java:1: error: class, interface, or enum expected
static byte[] input = new byte[1024];
^
Main.java:2: error: class, interface, or enum expected
static int size, position;
^
Main.java:4: error: class, interface, or enum expected
public static byte nextByte() throws Exception {
^
Main.java:7: error: class, interface, or enum expected
position = 0;
^
Main.java:8: error: class, interface, or enum expected
}
^
Main.java:12: error: class, interface, or enum expected
}
^
Main.java:14: error: class, interface, or enum expected
public static int nextInt() throws Exception {
^
Main.java:16: error: class, interface, or enum expected
int n = 0;
^
Main.java:18: error: class, interface, or enum expected
while (!(b >= '0' && b <= '9')) {
^
Main.java:21: error: class, interface, or enum expected
}
^
Main.java:24: error: class, interface, or enum expected
b = nextByte();
^
Main.java:26: error: class, interface, or enum expected
}
^
Main.java:30: error: class, interface, or enum expected
}
^
13 errors