Datasets:

language
stringclasses
5 values
dataset
stringclasses
1 value
code
stringlengths
26
25k
id
stringlengths
10
10
test_IO
listlengths
1
1
Java
codenet
import java.util.Scanner; public class s780275612 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int intA = sc.nextInt(); double dbAncer = Math.pow(intA, 3); int intAncer = (int) dbAncer; System.out.println(intAncer); } }
s780275612
[ { "input": "2\n", "output": "8\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s175590171 { public static void main(String[] args) { FastScanner fs = new FastScanner(); int n = fs.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = fs.nextInt(); } Arrays.sort(a); ...
s175590171
[ { "input": "3\n3 1 4\n", "output": "2\n" } ]
Java
codenet
import java.math.*; import java.util.Scanner; public class s500433274 { public static void main(String[] args) { BigInteger a, b, c; Scanner cin = new Scanner(System.in); while (cin.hasNext()) { a = cin.nextBigInteger(); b = cin.nextBigInteger(); c = a.m...
s500433274
[ { "input": "36\n24\n", "output": "GREATER\n" } ]
Java
codenet
import java.util.*; public class s314813282 { public static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); int m = scan.nextInt(); int n = scan.nextInt(); int x = scan.nextInt(); int y = scan.nextInt(); int[] a = new int[m]; ...
s314813282
[ { "input": "3 2 10 20\n8 15 13\n16 22\n", "output": "No War\n" } ]
Java
codenet
import java.util.Scanner; public class s173032907 implements Runnable { private static Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Thread(null, new s173032907(), "", 128 * 1024 * 1024).start(); } public void run() { int n = sc.nextInt(); ...
s173032907
[ { "input": "3\n3 5 -1\n", "output": "12\n8\n10\n" } ]
Java
codenet
import java.util.*; public class s898738430 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } int ans = 0; for (int i =...
s898738430
[ { "input": "5\n1 3 5 4 2\n", "output": "2\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class s527301188 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] strs = r...
s527301188
[ { "input": "1 2 +\n", "output": "3\n" } ]
Java
codenet
import java.util.Scanner; public class s356471394 { static Scanner sc = new Scanner(System.in); static String[] nums = sc.nextLine().split(" "); static int N = Integer.parseInt(nums[0]); static int M = Integer.parseInt(nums[1]); static char[][] room = new char[N][M]; static int D = Integer.pa...
s356471394
[ { "input": "3 5 2\n...#.\n#...#\n....#\n", "output": "12\n" } ]
Java
codenet
import java.util.*; public class s275359315 { public static void main(String... args) { Scanner scan = new Scanner(System.in); int r = scan.nextInt(); int res = (int) Math.pow(r, 2); System.out.println(res); } }
s275359315
[ { "input": "2\n", "output": "4\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class s640163137 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); ...
s640163137
[ { "input": "6\n5 6 4 2 1 3\n", "output": "1 2 3 4 5 6\n4\n" } ]
Java
codenet
import java.util.Scanner; public class s077706488 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int N = stdIn.nextInt(); int X = stdIn.nextInt(); int[] m = new int[N]; m[0] = stdIn.nextInt(); X -= m[0]; int min = m[0]; ...
s077706488
[ { "input": "3 1000\n120\n100\n140\n", "output": "9\n" } ]
Java
codenet
import java.util.Scanner; public class s476581255 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } int count = bubbleSort(a, n)...
s476581255
[ { "input": "5\n5 3 2 4 1\n", "output": "1 2 3 4 5\n8\n" } ]
Java
codenet
import java.util.*; public class s490798303 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); Map<Integer, List<Integer>> map = new HashMap<>(); for (int i = 0; i < k; i++) { ...
s490798303
[ { "input": "3 2\n2\n1 3\n1\n3\n", "output": "1\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s307170605 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); for (int i = 0; i < 5; i++) { if (sc.nextInt() == 0) { System.out.println(i + 1); break; } }...
s307170605
[ { "input": "0 2 3 4 5\n", "output": "1\n" } ]
Java
codenet
import static java.lang.System.out; import java.io.IOException; import java.io.InputStream; import java.util.NoSuchElementException; public class s100570405 { public static void main(String args[]) { new s100570405().run(); } MyInput in = new MyInput(); public void run() { String Sd ...
s100570405
[ { "input": "?tc????\ncoder\n", "output": "atcoder\n" } ]
Java
codenet
import java.util.*; class s399184958 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); if (A == B && B == C && C == A) System.out.println("Yes"); else System.out.println("...
s399184958
[ { "input": "2 2 2\n", "output": "Yes\n" } ]
Java
codenet
import java.io.*; import java.util.*; import java.util.stream.*; public class s888667117 { public static final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); public static final PrintStream out = System.out; public static final PrintStream err = System.err; ...
s888667117
[ { "input": "??2??5\n", "output": "768\n" } ]
Java
codenet
import java.io.*; import java.math.*; import java.util.*; public class s684030429 { Scanner sc; int max = 0, cur = 0; void solve() { int a = ni(); int b = ni(); System.out.println(Math.max(0, a - 2 * b)); } s684030429() { try { sc = new Scanner(System....
s684030429
[ { "input": "12 4\n", "output": "4\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; public class s799002881 { public static void main(String[] args) throws IOException { InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8); ...
s799002881
[ { "input": "4 5\n0 5\n-2 4\n3 4\n4 -4\n", "output": "3\n" } ]
Java
codenet
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; public class s514557145 { static final long MOD1 = 1000000007; static final long MOD2 = 998244353; static long[] tenmod; static final long inv9 = modInv(9); public static void main(String[] args...
s514557145
[ { "input": "8 5\n3 6 2\n1 4 7\n3 8 3\n2 2 2\n4 5 1\n", "output": "11222211\n77772211\n77333333\n72333333\n72311333\n" } ]
Java
codenet
import java.io.*; import java.util.Arrays; public class s629237879 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String sc = br.readLine(); int n = Integer.parseInt(sc); String[] str = new Stri...
s629237879
[ { "input": "47\nS 10\nS 11\nS 12\nS 13\nH 1\nH 2\nS 6\nS 7\nS 8\nS 9\nH 6\nH 8\nH 9\nH 10\nH 11\nH 4\nH 5\nS 2\nS 3\nS 4\nS 5\nH 12\nH 13\nC 1\nC 2\nD 1\nD 2\nD 3\nD 4\nD 5\nD 6\nD 7\nC 3\nC 4\nC 5\nC 6\nC 7\nC 8\nC 9\nC 10\nC 11\nC 13\nD 9\nD 10\nD 11\nD 12\nD 13\n", "output": "S 1\nH 3\nH 7\nC 12\nD 8\n" ...
Java
codenet
import java.io.*; import java.util.*; public class s749703010 { static class Pair { int l, r; Pair(int a, int b) { l = a; r = b; } @Override public String toString() { return l + " " + r; } } static int[][][] memo; ...
s749703010
[ { "input": "3\n3 4 3\n3 2 3\n", "output": "1\n" } ]
Java
codenet
import java.util.Scanner; public class s301480578 { public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] h = new int[n]; for (int i = 0; i < n; i++) { h[i] = sc.nextInt(); ...
s301480578
[ { "input": "5\n10 4 8 7 3\n", "output": "2\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s196249385 { private static Scanner sc; private static Printer pr; private static void solve() { int n = sc.nextInt(); int k = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextIn...
s196249385
[ { "input": "4 2\n2 5 2 5\n", "output": "12\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s918182055 { public static void main(String[] args) { MyWriter out = new MyWriter(System.out); MyScanner sc = new MyScanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); LinkedList<Integer>[] list = new LinkedLis...
s918182055
[ { "input": "3 4\n4 3\n4 1\n2 2\n", "output": "5\n" } ]
Java
codenet
import java.util.Scanner; public class s192812966 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int w = scanner.nextInt(), h = scanner.nextInt(), n = scanner.nextInt(); int[] x = new int[n]; int[] y = new int[n]; int[] a = new int[n]; ...
s192812966
[ { "input": "5 4 2\n2 1 1\n3 3 4\n", "output": "9\n" } ]
Java
codenet
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class s561914763 { static Set<String> ODD = new HashSet<>(); static Set<String> EVE = new HashSet<>(); static { ODD.add("R"); ODD.add("U"); ODD.add("D"); EVE.add("L"); EVE.add("U"); ...
s561914763
[ { "input": "RUDLUDR\n", "output": "Yes\n" } ]
Java
codenet
import java.util.Scanner; public class s442273167 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] l = new int[n]; int[] r = new int[n]; for (int i = 0; i < n; i++) { l[i] = sc.nextInt(); r[i]...
s442273167
[ { "input": "1\n24 30\n", "output": "7\n" } ]
Java
codenet
import java.util.*; class s440824480 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int c = 0; int flg = 0; while (n-- > 0) { int x = sc.nextInt(); int y = sc.nextInt(); if (x == y) {...
s440824480
[ { "input": "5\n1 2\n6 6\n4 4\n3 3\n3 2\n", "output": "Yes\n" } ]
Java
codenet
import java.util.Scanner; public class s481865042 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); long k = sc.nextLong(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < s.length(); i++) { if ((26 - ...
s481865042
[ { "input": "xyz\n4\n", "output": "aya\n" } ]
Java
codenet
import java.io.*; import java.math.*; import java.util.*; import java.util.concurrent.*; class s443066739 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static FastScanner sc = new FastScanner(br); static PrintWriter out = new PrintWriter(System.out); static Random r...
s443066739
[ { "input": "6\n1 2 3 4 5 6\n", "output": "1\n" } ]
Java
codenet
import java.util.HashSet; import java.util.Scanner; import java.util.Set; import java.util.stream.IntStream; public class s960387817 { public static void main(String[] args) { try (Scanner scanner = new Scanner(System.in)) { int n = scanner.nextInt(); Set<Integer> set = new HashSet...
s960387817
[ { "input": "4\n10\n8\n8\n6\n", "output": "3\n" } ]
Java
codenet
import java.util.Scanner; public class s832608243 { public static void main(final String[] args) { Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(), b = scanner.nextInt(); boolean flag = false; for (int i = 1; i <= 100000; i++) { if (Math.floor(1. * i ...
s832608243
[ { "input": "2 2\n", "output": "25\n" } ]
Java
codenet
public class s336166208 { public static void main(String[] args) { int[][][] info = new int[4][3][10]; for (int i = 0; i < 4; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 10; k++) { info[i][j][k] = 0; } } ...
s336166208
[ { "input": "3\n1 1 3 8\n3 2 2 7\n4 3 8 1\n", "output": " 0 0 8 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n####################\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n####################\n 0 0 0 0 0 0 0 0 0 0\n 0 7 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n##########...
Java
codenet
import java.util.*; public class s416486483 { private static long split(long n, long k) { long sum = 0; while (n > 0) { sum += n % k; n /= k; } return sum; } private static long solve(long n, long s) { long k; for (k = 2; k * k <= n |...
s416486483
[ { "input": "87654\n30\n", "output": "10\n" } ]
Java
codenet
import java.util.Scanner; class s821112618 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] s = ".,!? :abc:def:ghi:jkl:mno:pqrs:tuv:wxyz".split(":"); char[][] k = new char[9][]; for (int i = 0; i < 9; i++) { ...
s821112618
[ { "input": "5\n20\n220\n222220\n44033055505550666011011111090666077705550301110\n000555555550000330000444000080000200004440000\n", "output": "a\nb\nb\nhello, world!\nkeitai\n" } ]
Java
codenet
import java.io.PrintWriter; import java.util.Scanner; public class s452855095 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); int arr[] = new int[n]; for (int i = 0; i < n; i...
s452855095
[ { "input": "3\n8 12 40\n", "output": "2\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s916993080 { public static void main(String[] args) throws IOException { int n = sc.nextInt(); int[][] arr = new int[n][3]; for (int i = 0; i < n; ++i) for (int j = 0; j <= 2; ++j) arr[i][j] = sc.nextInt(); int[][] dp = new int[n][3...
s916993080
[ { "input": "3\n10 40 70\n20 50 80\n30 60 90\n", "output": "210\n" } ]
Java
codenet
import java.util.Scanner; public class s577060895 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = Long.parseLong(sc.nextLine()); double sqrt = Math.sqrt(n); double nearNum = Math.floor(sqrt); long ans = (long) Math.pow(nearNum, 2);...
s577060895
[ { "input": "10\n", "output": "9\n" } ]
Java
codenet
import java.util.Scanner; public class s681118763 { public static void main(String[] args) { Scanner in = new Scanner(System.in); String c = in.next(); Character letter = c.charAt(0); letter++; System.out.println(letter); } }
s681118763
[ { "input": "a\n", "output": "b\n" } ]
Java
codenet
import java.util.*; public class s321983475 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int w = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int answer = Math.max(a, b) - Math.min(a, b) - w; if (answer < 0) { ...
s321983475
[ { "input": "3 2 6\n", "output": "1\n" } ]
Java
codenet
import java.util.Scanner; public class s933313035 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int m = sc.nextInt(); Node tree = null; for (int i = 0; i < m; i++) { String command = sc.next(); if (command.equals("insert"...
s933313035
[ { "input": "8\ninsert 30\ninsert 88\ninsert 12\ninsert 1\ninsert 20\ninsert 17\ninsert 25\nprint\n", "output": " 1 12 17 20 25 30 88\n 30 12 1 20 17 25 88\n" } ]
Java
codenet
import java.util.Scanner; public class s257593977 { private static final int BASE = 3; public static void main(String[] args) { System.out.println((int) Math.pow(new Scanner(System.in).nextInt(), BASE)); } }
s257593977
[ { "input": "2\n", "output": "8\n" } ]
Java
codenet
import java.io.IOException; import java.io.InputStream; import java.util.*; import java.util.stream.IntStream; public class s081988820 { public static void main(String[] args) { s081988820 main = new s081988820(); main.solve(); } private void solve() { Scanner sc = new Scanner(Syst...
s081988820
[ { "input": "2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n", "output": "12\n" } ]
Java
codenet
import java.util.*; public class s063482767 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); PriorityQueue<Integer> queue = new PriorityQueue<>(); for (int i = 0; i < n; i++) { queue.add(sc.nextInt()); } ...
s063482767
[ { "input": "4\n3 8 5 1\n", "output": "Yes\n" } ]
Java
codenet
import java.util.*; public class s321216487 { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); String S = sc.next(); String begin; String end; String answer; for (int i = 0; i < S.length(); i++) { for (int...
s321216487
[ { "input": "keyofscience\n", "output": "YES\n" } ]
Java
codenet
import java.util.Scanner; public class s125837071 { @SuppressWarnings("resource") public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); long ans = 1; int mod = (int) Math.pow(10, 9) + 7; for (int i = 2; i <= n; i++...
s125837071
[ { "input": "3\n", "output": "4\n" } ]
Java
codenet
import java.util.Scanner; public class s937747608 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); if (a * b >= c * d) { System.out.pr...
s937747608
[ { "input": "3 5 2 7\n", "output": "15\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class s221078931 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); IntegralRect rects...
s221078931
[ { "input": "1 2\n1 3\n2 3\n1 4\n2 4\n5 6\n1 8\n4 7\n98 100\n99 100\n0 0\n", "output": "1 3\n2 3\n1 4\n2 4\n3 4\n1 8\n4 7\n2 8\n3 140\n89 109\n" } ]
Java
codenet
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; class s847387793 { static class Solver { final FastScanner sc; final PrintWriter writer; Solver(final FastScanner sc, final PrintWriter writer) { this.s...
s847387793
[ { "input": "3 4 3\n1 3 3 100\n1 2 2 10\n2 3 2 10\n", "output": "110\n" } ]
Java
codenet
import java.util.Scanner; public class s962361667 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int w = sc.nextInt(); int n = sc.nextInt(); int[] values = new int[w]; for (int i = 0; i < values.length; i++) { values[i] = i + 1; ...
s962361667
[ { "input": "5\n4\n2,4\n3,5\n1,2\n3,4\n", "output": "4\n1\n2\n5\n3\n" } ]
Java
codenet
import java.util.Scanner; public class s432314829 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int n = stdIn.nextInt(); int m = stdIn.nextInt(); int dp[] = new int[n + 2]; dp[n + 1] = 0; dp[n] = 1; for (int i = 0; i < m;...
s432314829
[ { "input": "6 1\n3\n", "output": "4\n" } ]
Java
codenet
import java.util.Scanner; public class s505375619 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = Integer.parseInt(s.next()); int[] v = new int[n]; int[] c = new int[n]; int[] dp = new int[n]; for (int i = 0; i < n; i++) { ...
s505375619
[ { "input": "3\n10 2 5\n6 3 4\n", "output": "5\n" } ]
Java
codenet
import java.util.ArrayList; import java.util.Scanner; public class s000087391 { public static void main(String[] args) { ArrayList<Integer> result = new ArrayList<Integer>(); Scanner insert = new Scanner(System.in); int n = -1; while (true) { String line = insert.nextLin...
s000087391
[ { "input": "7\n15 15 15 15 15 15 15\n4\n10 20 30 60\n10\n1 1 1 1 1 1 1 1 1 100\n7\n90 90 90 90 90 90 10\n7\n2 7 1 8 2 8 4\n0\n", "output": "7\n3\n9\n1\n4\n" } ]
Java
codenet
import static java.util.Comparator.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.AbstractMap; public class s380356166 { public static void main(String[] args) { ...
s380356166
[ { "input": "2 2\n", "output": "6\n" } ]
Java
codenet
import java.util.Scanner; public class s682242794 { int high; int low; int sa; public void solve() { Scanner sc = new Scanner(System.in); for (int i = 0; i < 7; i++) { high = sc.nextInt(); low = sc.nextInt(); sa = high - low; System.out.p...
s682242794
[ { "input": "30 19\n39 20\n19 18\n25 20\n22 21\n23 10\n10 -10\n", "output": "11\n19\n1\n5\n1\n13\n20\n" } ]
Java
codenet
import java.util.*; public class s936984238 { static Scanner sc = new Scanner(System.in); static int[] score; static int number; public static void main(String[] args) { while (read()) { slove(); } } static boolean read() { number = sc.nextInt(); ...
s936984238
[ { "input": "3\n1000\n342\n0\n5\n2\n2\n9\n11\n932\n5\n300\n1000\n0\n200\n400\n8\n353\n242\n402\n274\n283\n132\n402\n523\n0\n", "output": "342\n7\n300\n326\n" } ]
Java
codenet
import java.util.Scanner; public class s650785519 { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); sc.close(); int ans = (2199 - x) / 200; System.out.println(ans); } }
s650785519
[ { "input": "725\n", "output": "7\n" } ]
Java
codenet
import java.util.LinkedList; import java.util.Scanner; public class s851323333 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); LinkedList<Integer> list = new LinkedList<Integer>(); while (scan.hasNextInt() == true) { int a = scan.nextInt(); ...
s851323333
[ { "input": "1\n6\n0\n8\n10\n0\n0\n0\n", "output": "6\n10\n8\n1\n" } ]
Java
codenet
import java.util.Scanner; public class s606985261 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int total = 0; for (int i = 0; i < s.length(); i++) { for (int j = i + 1; j < s.length(); j++) { if (...
s606985261
[ { "input": "ASSA\n", "output": "Yes\n" } ]
Java
codenet
import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class s295587559 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int[] num = new int[in.nextInt()]; for (int i = 0; i < num.length; i++) { num[i] = i ...
s295587559
[ { "input": "5\n4\n2,4\n3,5\n1,2\n3,4\n", "output": "4\n1\n2\n5\n3\n" } ]
Java
codenet
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class s720527488 { static final InputStream in = System.in; static final PrintWriter out = new PrintWriter(System.out); static final int INF = Intege...
s720527488
[ { "input": "4 3\n180\n160\n170\n190\n2 100\n3 120\n4 250\n", "output": "480\n" } ]
Java
codenet
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class s022285498 { static class Task { public void solve(int testNumber, InputReader in, PrintWriter out) { int n = in.nextInt(); int[] countArr = new int[n + 1]; for (int x = 1; x <= 1...
s022285498
[ { "input": "20\n", "output": "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n" } ]
Java
codenet
import java.util.Scanner; public class s162740530 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] a = new int[m + 1]; int[] cnt = new int[n + 1]; cnt[0] = 1; final int MOD = ...
s162740530
[ { "input": "6 1\n3\n", "output": "4\n" } ]
Java
codenet
import java.util.*; public class s863488345 { static int mapNum; static int h; static int w; static char[][] battleTown; static int bomberActNum; static char[] bomberAct; static int[] tank = new int[2]; static int xOfTank; static int yOfTank; static int xOfBomber; static in...
s863488345
[ { "input": "4\n4 6\n*.*..*\n*.....\n..-...\n^.*#..\n10\nSRSSRRUSSR\n2 2\n<.\n..\n12\nDDSRRSUUSLLS\n3 5\n>-#**\n.-*#*\n.-**#\n15\nSSSDRSSSDRSSSUU\n5 5\nv****\n*****\n*****\n*****\n*****\n44\nSSSSDDRSDRSRDSULUURSSSSRRRRDSSSSDDLSDLSDLSSD\n", "output": "*....*\n......\n..-...\n..>#..\n\n<.\n..\n\n^-#**\n.-.#*\n...
Java
codenet
import java.util.*; public class s853705214 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] nums = new int[n]; for (int i = 0; i < n; i++) { nums[i] = sc.nextInt(); } int min = Integer.MAX_VALU...
s853705214
[ { "input": "3\n-10 5 -4\n", "output": "19\n" } ]
Java
codenet
import java.util.Scanner; public class s545439898 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = Integer.parseInt(sc.next()); int[] givingNumbers = new int[count]; for (int i = 0; i < count; i++) { givingNumbers[i] = Integ...
s545439898
[ { "input": "5\n1 2 3 4 5\n", "output": "5 4 3 2 1\n" } ]
Java
codenet
import java.util.*; class s059841225 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String str = sc.next(); String[] strArr = str.split(","); int[] l = new int[10]; int d = 0; for (in...
s059841225
[ { "input": "1,1,1,1,1,1,1,1,1,1,40,60\n1,1,1,1,1,3,3,3,3,3,50,50\n10,10,10,10,10,10,10,10,10,10,50,49\n", "output": "4\n7\n6\n" } ]
Java
codenet
import java.util.*; public class s318252319 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int n = Integer.parseInt(s.substring(s.length() - 1, s.length())); if (n == 3) System.out.println("bon"); else if (n == 0 || n =...
s318252319
[ { "input": "16\n", "output": "pon\n" } ]
Java
codenet
import java.util.HashMap; import java.util.Scanner; public class s773621585 { public static void main(String[] args) { HashMap<String, String> map = new HashMap<String, String>(); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String str = sc.nextLine(); for (int...
s773621585
[ { "input": "3\napple\norange\napple\n", "output": "2\n" } ]
Java
codenet
import java.util.*; public class s609591310 { public static void main(String[] args) { int ans = 0; Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int list[] = new int[n]; for (int i = 0; i < n; i++) { list[i] = sc.nextInt(); } int n...
s609591310
[ { "input": "4\n3 1 3 2\n", "output": "1\n" } ]
Java
codenet
import java.io.*; import java.util.*; @SuppressWarnings("unused") public class s283652523 { FastScanner in; PrintWriter out; static final int MOD = (int) 1e9 + 7; void solve() { int N = in.nextInt(); int[] A = in.nextIntArray(N); long ans = 0, sum = A[N - 1]; for (int ...
s283652523
[ { "input": "3\n1 2 3\n", "output": "11\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s393796709 { long MOD = 1000000007; void solve(BufferedReader in) throws Exception { int[] xx = toInts(in.readLine()); int min = Math.min(xx[0], xx[1]); int max = Math.max(xx[0], xx[1]); long res; if (min == max) { ...
s393796709
[ { "input": "2 2\n", "output": "8\n" } ]
Java
codenet
import java.lang.Math.*; import java.util.Arrays; import java.util.Scanner; class s998094687 { public static void main(String[] args) { final Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[3]; for (int i = 0; i < n; i++) { a[0] = sc.nextInt(...
s998094687
[ { "input": "3\n4 3 5\n4 3 6\n8 8 8\n", "output": "YES\nNO\nNO\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s409580149 { static int n, a[]; static double dp[][][]; static void solve() { n = ni(); a = na(n); dp = new double[n + 1][n + 1][n + 1]; for (int i = 0; i < n + 1; i++) fill(dp[i], -1); dp[0][0][0] = 0; int ...
s409580149
[ { "input": "3\n1 1 1\n", "output": "5.5\n" } ]
Java
codenet
import java.util.*; public class s656827329 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } int count = 1; int now = 0...
s656827329
[ { "input": "6\n1 2 3 2 2 1\n", "output": "2\n" } ]
Java
codenet
import java.util.Scanner; public class s965025950 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); int z = sc.nextInt(); System.out.println(z + " " + x + " " + y); sc.close(); } }
s965025950
[ { "input": "1 2 3\n", "output": "3 1 2\n" } ]
Java
codenet
import java.util.Scanner; public class s214067324 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = Integer.parseInt(sc.next()); System.out.println(x < 1200 ? "ABC" : "ARC"); } }
s214067324
[ { "input": "1000\n", "output": "ABC\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class s685734377 { public static void main(String[] args) { InputStream inputStream = Sy...
s685734377
[ { "input": "2\nab\nca\n", "output": "2\n" } ]
Java
codenet
import java.io.IOException; import java.util.Scanner; class s989561778 { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(""); int a, b, digit; while (sc.hasNextInt()) { a = sc.nextInt()...
s989561778
[ { "input": "5 7\n1 99\n1000 999\n", "output": "2\n3\n4\n" } ]
Java
codenet
import java.util.*; public class s151517960 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(); for (int i = 0; i < n; i++) { int a = sc.nextInt(); ...
s151517960
[ { "input": "3\n6\n2\n6\n", "output": "1\n" } ]
Java
codenet
import java.util.*; public class s466963472 { static Scanner sc = new Scanner(System.in); static int d; static boolean read() { if (!sc.hasNextInt()) return false; d = sc.nextInt(); return true; } static int solve() { int ans, n; ans = 0; for (int...
s466963472
[ { "input": "20\n10\n", "output": "68440000\n70210000\n" } ]
Java
codenet
import java.util.Scanner; public class s393629232 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int maxv = Integer.MIN_VALUE; int minv = sc.nextInt(); for (int i = 1; i < n; i++) { int ri = sc.nextInt(); ...
s393629232
[ { "input": "6\n5\n3\n1\n3\n4\n3\n", "output": "3\n" } ]
Java
codenet
import static java.lang.Integer.parseInt; import java.awt.geom.Point2D.Double; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class s016010007 { public static void main(String[] args) { new s016010007().run(); } public void run() { tr...
s016010007
[ { "input": "0 0 2 0\n2\n-1 1\n-1 -1\n", "output": "COUNTER_CLOCKWISE\nCLOCKWISE\n" } ]
Java
codenet
import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class s196451707 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] g = new int[n + 1][n + 1]; for (int i = 0; i < n; i++) { ...
s196451707
[ { "input": "4\n1 2 2 4\n2 1 4\n3 0\n4 1 3\n", "output": "1 0\n2 1\n3 2\n4 1\n" } ]
Java
codenet
import java.util.*; public class s897176066 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long A[] = new long[N]; for (int i = 0; i < N; i++) { A[i] = sc.nextLong(); } Arrays.sort(A); for (in...
s897176066
[ { "input": "5\n2 6 1 4 5\n", "output": "YES\n" } ]
Java
codenet
import java.util.Scanner; public class s648025110 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n; n = sc.nextInt(); int[] h = new int[n]; for (int i = 0; i < n; i++) { h[i] = sc.nextInt(); } int ans = 0; ...
s648025110
[ { "input": "4\n1 2 2 1\n", "output": "2\n" } ]
Java
codenet
import java.util.Scanner; public class s682993858 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { int sum = 0; String s = sc.next(); if (s.equals("0")) break; for (int i = 0; i < s.length(); i++) { ...
s682993858
[ { "input": "123\n55\n1000\n0\n", "output": "6\n10\n1\n" } ]
Java
codenet
import java.io.*; import java.util.*; class s332475184 { static int[] counter; static List<List<Integer>> graph; public static void main(String[] args) { FastScanner fs = new FastScanner(); int n = fs.nextInt(); int q = fs.nextInt(); graph = new ArrayList<>(); for (...
s332475184
[ { "input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n", "output": "100 110 111 110\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class s280174843 { private static BufferedReader buf; public static void main(String[] args) throws IOException { int[] abc = new int[3]; String str; String[] inp; buf = new BufferedRea...
s280174843
[ { "input": "1 3 8\n", "output": "Yes\n" } ]
Java
codenet
import java.util.Scanner; public class s584135649 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i = 0; for (i = 1; i <= 5; i++) { int n = sc.nextInt(); if (n == 0) { break; } } Syst...
s584135649
[ { "input": "0 2 3 4 5\n", "output": "1\n" } ]
Java
codenet
import java.util.*; class s379215956 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); String s1 = s.substring(0, 1); String s2 = s.substring(1, 2); String s3 = s.substring(2, 3); String s4 = s.substring(3, 4); ...
s379215956
[ { "input": "3776\n", "output": "Bad\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s580342216 { public static void main(String[] args) throws java.lang.Exception { new Solution(); } } class Solution { Scanner scanner; public Solution() { scanner = new Scanner(System.in); while (scanner.hasNext()) { ...
s580342216
[ { "input": "11 2\n", "output": "4\n" } ]
Java
codenet
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class s126744620 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i+...
s126744620
[ { "input": "5 2\n1 1 2 2 5\n", "output": "1\n" } ]
Java
codenet
import java.util.Scanner; class s450226252 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); short r = stdIn.nextShort(); if (r < 1200) { System.out.println("ABC"); return; } if (r < 2800) { System.out....
s450226252
[ { "input": "1199\n", "output": "ABC\n" } ]
Java
codenet
import java.io.*; import java.math.*; import java.util.*; public class s824230885 { static class InputIterator { ArrayList<String> inputLine = new ArrayList<String>(1024); int index = 0; int max; String read; InputIterator() { BufferedReader br = new BufferedRe...
s824230885
[ { "input": "4\n6 5 6 8\n", "output": "3\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s584572995 { static int mod = (int) 1e9 + 7; static List<ArrayList<Integer>> to; static int dp[]; public static void main(String[] args) { FastScanner fs = new FastScanner(System.in); int N = fs.nextInt(); to = new ArrayList<>(...
s584572995
[ { "input": "3\n1 2\n2 3\n", "output": "125000001\n" } ]
Java
codenet
import static java.lang.System.*; import java.util.*; public class s125881159 { public static void main(String[] $) { Scanner sc = new Scanner(in); int n = sc.nextInt(); int d = 0; for (int i = 0; i < n; i++) { d += sc.nextInt() % 2; } out.println(d % 2 ...
s125881159
[ { "input": "3\n1 2 3\n", "output": "YES\n" } ]
Java
codenet
import java.util.Scanner; class s725559666 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); int c = scan.nextInt(); scan.close(); if (a < b && b < c && a < c) { System.out.p...
s725559666
[ { "input": "1 3 8\n", "output": "Yes\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.util.StringTokenizer; public class s733150445 { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(Syst...
s733150445
[ { "input": "198 1.10\n", "output": "217\n" } ]