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.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; import java.util.stream.Collectors; public class s387083574 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); Map<Integer, Integer> map =...
s387083574
[ { "input": "3\n2 3 1\n", "output": "3 1 2\n" } ]
Java
codenet
import java.util.Scanner; class s601569023 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = sc.nextInt(); if (num < 1200) System.out.println("ABC"); else System.out.println("ARC"); } }
s601569023
[ { "input": "1000\n", "output": "ABC\n" } ]
Java
codenet
import static java.lang.System.*; import java.math.*; import java.util.*; public class s449886393 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] youbi = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; String s = sc.next(); int ans = 0; ...
s449886393
[ { "input": "SAT\n", "output": "1\n" } ]
Java
codenet
import java.util.Scanner; public class s513933260 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); long n = stdIn.nextLong(); System.out.println(n * (n + 1) / 2 - n); } }
s513933260
[ { "input": "2\n", "output": "1\n" } ]
Java
codenet
import java.util.Scanner; class s325080396 { static final int MAX = 200000; public static void main(String[] args) { int[] R = new int[MAX]; Scanner in = new Scanner(System.in); int n = in.nextInt(); for (int i = 0; i < n; i++) R[i] = in.nextInt(); int maxv = R[1] - R[0...
s325080396
[ { "input": "6\n5\n3\n1\n3\n4\n3\n", "output": "3\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.UncheckedIOException; import java.io.Writer; import java.nio.charset.Charset; import java...
s041542819
[ { "input": "2 3 4\n100\n600\n400\n900\n1000\n150\n2000\n899\n799\n", "output": "350\n1400\n301\n399\n" } ]
Java
codenet
import java.util.Scanner; public class s902370101 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] array = new int[n]; int max = 0; int min = 10000; for (int i = 0; i < array.length; i++) { array[...
s902370101
[ { "input": "4\n2 3 7 9\n", "output": "7\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s573993837 { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); ...
s573993837
[ { "input": "7 4\n", "output": "1\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s511234019 { public static void main(String[] args) throws java.lang.Exception { Scanner in = new Scanner(System.in); int a, b; a = in.nextInt(); b = in.nextInt(); if (a % 2 == 0 || b % 2 == 0) System.out.println("No"); ...
s511234019
[ { "input": "3 1\n", "output": "Yes\n" } ]
Java
codenet
import java.util.*; public class s494783955 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String C = sc.next(); System.out.println((char) (C.charAt(0) + 1)); } }
s494783955
[ { "input": "a\n", "output": "b\n" } ]
Java
codenet
import java.util.Scanner; public class s059916837 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String S = scanner.nextLine(); String T = scanner.nextLine(); int min = Integer.MAX_VALUE; for (int i = 0; i <= S.length() - T.length(); i++...
s059916837
[ { "input": "cabacc\nabc\n", "output": "1\n" } ]
Java
codenet
import java.util.Scanner; public class s458826999 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); String S = sc.next(); long MOD = 1000000007; long dp[][] = new long[S.length() + 1][13]; dp[0][0] = 1; for (int i = 0; i < S.length(); i+...
s458826999
[ { "input": "??2??5\n", "output": "768\n" } ]
Java
codenet
import java.util.*; public class s780604068 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] map = new int[N * 2]; for (int i = 0; i < N * 2; i++) { map[i] = sc.nextInt(); } Arrays.sort(map); ...
s780604068
[ { "input": "2\n1 3 1 2\n", "output": "3\n" } ]
Java
codenet
import java.util.Scanner; public class s685537842 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int t = sc.nextInt(); double time = 0; int count = 0; while (time < t + 0.5) { ...
s685537842
[ { "input": "3 5 7\n", "output": "10\n" } ]
Java
codenet
import java.util.*; class s319823779 { 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 x = sc.nextInt(); int res = 0; for (int i = 0; i <= a; i++) { ...
s319823779
[ { "input": "2\n2\n2\n100\n", "output": "2\n" } ]
Java
codenet
import java.io.*; import java.nio.charset.StandardCharsets; import java.util.*; public class s320655609 { List<Long> constraints = new ArrayList<>(); long N; long result; s320655609() throws IOException { InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8); ...
s320655609
[ { "input": "5\n3\n2\n4\n3\n5\n", "output": "7\n" } ]
Java
codenet
import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; public class s047401835 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); List<Integer> numbers = new ArrayList(); ...
s047401835
[ { "input": "3\n8 12 40\n", "output": "2\n" } ]
Java
codenet
import java.io.PrintStream; import java.util.Scanner; public class s831281137 { static final Scanner sc = new Scanner(System.in); static final PrintStream so = System.out; public static void main(String[] args) { int N = nint(); int W = nint(); int[] v = new int[N + 1]; in...
s831281137
[ { "input": "4 5\n4 2\n5 2\n2 1\n8 3\n", "output": "13\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s745776078 { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(), m = in.nextInt(), A[][] = new int[n][m], b[] = new int[m]; for (int i ...
s745776078
[ { "input": "3 4\n1 2 0 1\n0 3 0 1\n4 1 1 0\n1\n2\n3\n0\n", "output": "5\n6\n9\n" } ]
Java
codenet
import java.util.*; public class s826491904 { public static final void main(String[] args) { new s826491904().solve(); } private final Scanner sc = new Scanner(System.in); void solve() { int N = sc.nextInt(); int max, min; max = min = sc.nextInt(); for (int i ...
s826491904
[ { "input": "4\n2 3 7 9\n", "output": "7\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; import java.util.ArrayList; import java.util.Arrays; import java.util.Col...
s893190600
[ { "input": "3 3\n.#.\n###\n.#.\n", "output": "Yes\n" } ]
Java
codenet
import java.math.*; import java.util.*; class s739337307 { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { int n = Integer.parseInt(sc.next()); int m = Integer.parseInt(sc.next()); HashMap<Integer, Integer> map = new HashMap<>(); ...
s739337307
[ { "input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n", "output": "2 2\n" } ]
Java
codenet
import java.util.*; public class s596918302 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] arr = new int[n][3]; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) arr[i][j] = sc.nextInt(); } ...
s596918302
[ { "input": "3\n10 40 70\n20 50 80\n30 60 90\n", "output": "210\n" } ]
Java
codenet
import java.util.*; public class s701317277 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N]; int min = Integer.MAX_VALUE; int count = 0; long sum = 0; for (int i = 0; i < N; i++) { ...
s701317277
[ { "input": "3\n-10 5 -4\n", "output": "19\n" } ]
Java
codenet
import java.util.*; public class s125278297 { static Scanner scanner = new Scanner(System.in); public static void main(String[] $) { int h = scanner.nextInt(); int w = scanner.nextInt(); String[] ans = new String[h]; for (int i = 0; i < h; i++) { ans[i] = "#" + scan...
s125278297
[ { "input": "2 3\nabc\narc\n", "output": "#####\n#abc#\n#arc#\n#####\n" } ]
Java
codenet
import java.util.*; class s670290220 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); char c[] = sc.next().toCharArray(); for (int i = 0; i < c.length; i++) { c[i] = (char) ((c[i] - 'A' + N) % 26 + 'A'); } ...
s670290220
[ { "input": "2\nABCXYZ\n", "output": "CDEZAB\n" } ]
Java
codenet
import java.util.*; public class s552480860 { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int h1 = sc.nextInt(); int m1 = sc.nextInt(); int h2 = sc.nextInt(); int m2 = sc.nextInt(); int k = sc.nextInt(); int ...
s552480860
[ { "input": "10 0 15 0 30\n", "output": "270\n" } ]
Java
codenet
import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.NoSuchElementException; import java.util.Random; import java.util.Scanner; class UnionFind { int Parent[]; UnionFind(int n) { Parent = new int[n]; Arrays.fill(Parent, -1); } int root(int ...
s504715611
[ { "input": "sippuu\n", "output": "Yes\n" } ]
Java
codenet
import java.util.*; class s987117545 { final Scanner sc = new Scanner(System.in); final long DEVISOR = 1000000000 + 7; public static void main(String[] args) { new s987117545().run(); } private void run() { long n = sc.nextLong(); long k = sc.nextLong(); long ans ...
s987117545
[ { "input": "3 2\n", "output": "10\n" } ]
Java
codenet
import java.util.Scanner; public class s709681166 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (Character.isUpperCase(c)) { c...
s709681166
[ { "input": "fAIR, LATER, OCCASIONALLY CLOUDY.\n", "output": "Fair, later, occasionally cloudy.\n" } ]
Java
codenet
import java.util.*; public class s905556405 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] numlist = new int[5]; int k; for (int i = 0; i < 5; i++) { numlist[i] = sc.nextInt(); } k = sc.nextInt(); if ((numl...
s905556405
[ { "input": "1\n2\n4\n8\n9\n15\n", "output": "Yay!\n" } ]
Java
codenet
import java.util.Scanner; public class s943650310 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int X = sc.nextInt(); int t = sc.nextInt(); if (X - t >= 0) { System.out.println(X - t); } else { System.out.println(0);...
s943650310
[ { "input": "100 17\n", "output": "83\n" } ]
Java
codenet
import java.util.Scanner; public class s036404962 { public static void main(String[] args) { @SuppressWarnings("resource") Scanner scan = new Scanner(System.in); int X = scan.nextInt(); int t = scan.nextInt(); if (X >= t) { System.out.println(X - t); ...
s036404962
[ { "input": "100 17\n", "output": "83\n" } ]
Java
codenet
import java.util.*; public class s951567432 { public static void main(String[] args) { int count = new Scanner(System.in).nextInt(); int total = 0; for (int ix = 1; ix <= count; ix++) { total += ix; } System.out.println(total); } }
s951567432
[ { "input": "3\n", "output": "6\n" } ]
Java
codenet
import static java.util.Arrays.deepToString; import java.util.Scanner; public class s696692583 { public static void main(String[] args) { new s696692583().run(); } void tr(Object... os) { System.err.println(deepToString(os)); } Scanner sc = new Scanner(System.in); public voi...
s696692583
[ { "input": "1 2 3\n5 6 9\n8 9 10\n", "output": "YES\nYES\nNO\n" } ]
Java
codenet
import java.util.*; public class s378126458 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(), Q = sc.nextInt(); String s = sc.next(); int pre[] = new int[N + 1]; for (int i = 1; i < N; i++) { if (s.charAt(i - 1...
s378126458
[ { "input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n", "output": "2\n0\n3\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s456888268 { static void solve() { String tmp = ns(); char s[] = tmp.toCharArray(); int n = s.length; int ans = 0; int cnt = 0; for (int i = 0; i < n; i++) { if (s[i] == 'S') { cnt++; ...
s456888268
[ { "input": "TSTTSS\n", "output": "4\n" } ]
Java
codenet
import java.util.Arrays; import java.util.Scanner; public class s383412435 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long a[] = new long[N]; int tmp; int ans = 0; for (int z = 0; N > z; z++) { a...
s383412435
[ { "input": "4\n3 3 3 3\n", "output": "1\n" } ]
Java
codenet
import java.util.*; class s523386612 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int[] count = new int[t + 1]; for (int i = 2; i < t + 1; i++) { count[sc.nextInt()]++; } for (int i = 1; i < t + 1; ...
s523386612
[ { "input": "5\n1 1 2 2\n", "output": "2\n2\n0\n0\n0\n" } ]
Java
codenet
import java.util.*; public class s291405468 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println(sc.nextInt() % 500 <= sc.nextInt() ? "Yes" : "No"); } }
s291405468
[ { "input": "2018\n218\n", "output": "Yes\n" } ]
Java
codenet
import java.util.*; public class s799795787 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String array[] = new String[n]; int cnt = 0; int cnt2 = 0; for (int i = 0; i < n; i++) { array[i] = sc.next(...
s799795787
[ { "input": "3\napple\norange\napple\n", "output": "2\n" } ]
Java
codenet
import java.util.*; public class s857785109 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if ((n / 10) % 111 == 0) { System.out.println("Yes"); } else if ((n % 1000) % 111 == 0) { System.out.println("Yes...
s857785109
[ { "input": "1118\n", "output": "Yes\n" } ]
Java
codenet
import java.util.*; class s461257670 { public static void main(String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int count = sc.nextInt(); for (int i = 0; count > i; i++) { int y = sc.nextInt(); int m = sc.nextInt(); int ...
s461257670
[ { "input": "8\n1 1 1\n344 3 1\n696 5 1\n182 9 5\n998 8 7\n344 2 19\n696 4 19\n999 10 20\n", "output": "196470\n128976\n59710\n160715\n252\n128977\n59712\n1\n" } ]
Java
codenet
import java.util.Scanner; public class s575985145 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int size = scan.nextInt(); int[][] graph = new int[size][size]; int id = 0; int cols = 0; int[] row = new int[0]; for (int i ...
s575985145
[ { "input": "4\n1 2 2 4\n2 1 4\n3 0\n4 1 3\n", "output": "0 1 0 1\n0 0 0 1\n0 0 0 0\n0 0 1 0\n" } ]
Java
codenet
import java.util.*; public class s835214694 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); if (b % a == 0) System.out.println(a + b); else System.out.println(b - a); } }
s835214694
[ { "input": "4 12\n", "output": "16\n" } ]
Java
codenet
import java.util.*; public class s596709252 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); int z = sc.nextInt(); sc.close(); System.out.println(z + " " + x + " " + y); } }
s596709252
[ { "input": "1 2 3\n", "output": "3 1 2\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s657273562 { static PrintWriter pw; static Scanner sc; static ArrayList<Integer>[] adj; static boolean[] visit; static HashMap<Pair, Integer> dp; static long ceildiv(long x, long y) { return (x + y - 1) / y; } static int mod(l...
s657273562
[ { "input": "4\n2 2 1 3\n", "output": "7\n" } ]
Java
codenet
import java.util.Scanner; public class s453440639 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nextInt(); sc.nextLine(); char[][] S = new char[H][W]; for (int i = 0; i < H; i++) { String...
s453440639
[ { "input": "3 5\n.....\n.#.#.\n.....\n", "output": "11211\n1#2#1\n11211\n" } ]
Java
codenet
import java.util.Scanner; public class s127819686 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int hb = b / 2; System.out.println(a + hb); } }
s127819686
[ { "input": "81 58\n", "output": "110\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s302365683 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); St...
s302365683
[ { "input": "4\n3 3 3 3\n", "output": "1\n" } ]
Java
codenet
import java.util.Scanner; public class s789781857 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] c = new int[n - 1]; int[] s = new int[n - 1]; int[] f = new int[n - 1]; for (int i = 0; i < n - 1; i++) { ...
s789781857
[ { "input": "3\n6 5 1\n1 10 1\n", "output": "12\n11\n0\n" } ]
Java
codenet
import java.awt.*; import java.io.*; import java.math.*; import java.util.*; public class s316260310 implements Runnable { @Override public void run() { try { new Solver().solve(); System.exit(0); } catch (Exception | Error e) { e.printStackTrace(); ...
s316260310
[ { "input": "4 5\n3 2 4 1\n", "output": "4\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.AbstractMap; import java.util.StringTokenizer; public class s918596375 { public static void main(String[] args) { FastScanner sc = new FastS...
s918596375
[ { "input": "a\n", "output": "vowel\n" } ]
Java
codenet
import java.util.Scanner; public class s551454565 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); if (s.equals("Sunny")) { System.out.println("Cloudy"); } else if (s.equals("Cloudy")) { System.out.println...
s551454565
[ { "input": "Sunny\n", "output": "Cloudy\n" } ]
Java
codenet
import java.util.*; class calArea { int Area(int w, int h) { int area = w * h; return area; } } public class s428436430 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); List<Integer> arr = new ArrayList<>(); for (int i = 0; i < 4; i+...
s428436430
[ { "input": "3 5 2 7\n", "output": "15\n" } ]
Java
codenet
import java.util.Scanner; public class s607507157 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if (n % 10 == 9 || n / 10 == 9) { System.out.println("Yes"); } else { System.out.println("No"); } ...
s607507157
[ { "input": "29\n", "output": "Yes\n" } ]
Java
codenet
import java.awt.geom.*; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.*; public class s010698290 { public static void main(String args[]) { try { FastReader s = new...
s010698290
[ { "input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n", "output": "2 2\n" } ]
Java
codenet
import java.util.Scanner; public class s525447134 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); if (s.equals("Sunny")) { System.out.println("Cloudy"); } else if (s.equals("Cloudy")) { System.out.println...
s525447134
[ { "input": "Sunny\n", "output": "Cloudy\n" } ]
Java
codenet
import java.util.*; public class s867221485 { static int N; static int K; static long Q; static int A; static int B; static long C; static double min = 9999999; static long ans = 0; public static void main(String[] args) { Scanner scanner = new Scanner(System.in); ...
s867221485
[ { "input": "3\n#.#\n", "output": "1\n" } ]
Java
codenet
import java.util.*; public class s973587235 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int minN = sc.nextInt() - 1; for (int i = 0; i < n - 1; i++) { int h = sc.nextInt(); if (minN == h) { ...
s973587235
[ { "input": "5\n1 2 1 1 3\n", "output": "Yes\n" } ]
Java
codenet
import java.util.Scanner; public class s391272180 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder s, t; s = new StringBuilder(sc.next()); t = new StringBuilder(sc.next()); boolean flag = false; for (int i = 0; i < s.lengt...
s391272180
[ { "input": "kyoto\ntokyo\n", "output": "Yes\n" } ]
Java
codenet
import java.io.*; import java.math.*; import java.util.*; public class s888333881 { static class Graph0n { private ArrayList<Node0n> dt = new ArrayList<>(); Graph0n(int sz) { for (int i = 0; i < sz; i++) { Node0n node1 = new Node0n(); dt.add(node1); ...
s888333881
[ { "input": "3\n011\n", "output": "2\n1\n1\n" } ]
Java
codenet
import java.io.*; import java.math.*; import java.util.*; public class s910447421 { static int ans = 100; static int[][] balls; static int N; static boolean[] taken; public static void main(String[] args) { FastScanner I = new FastScanner(); OutPut O = new OutPut(); N = I....
s910447421
[ { "input": "2\n1 1\n2 2\n", "output": "1\n" } ]
Java
codenet
import java.util.Scanner; public class s836223717 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] ryuka = new long[n + 1]; ryuka[0] = 2; ryuka[1] = 1; for (int i = 2; i < n + 1; i++) { ryuka[i] ...
s836223717
[ { "input": "5\n", "output": "11\n" } ]
Java
codenet
import java.util.*; public class s163827828 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); String s[] = new String[N]; int a_num = 0; int b_num = 0; boolean flag = true; int ans = 0; ...
s163827828
[ { "input": "3\nABCA\nXBAZ\nBAD\n", "output": "2\n" } ]
Java
codenet
import java.util.*; public class s798589501 { public static void main(String[] args) throws Exception { Scanner s = new Scanner(System.in); int E = s.nextInt(); int Y = s.nextInt(); if (E == 0) { if (Y <= 1911) { System.out.print("M"); S...
s798589501
[ { "input": "0 2015\n", "output": "H27\n" } ]
Java
codenet
import java.util.Scanner; public class s858314534 { public static void main(String[] args) { @SuppressWarnings("resource") Scanner scanner = new Scanner(System.in); int A = scanner.nextInt(); int B = scanner.nextInt(); int T = scanner.nextInt(); log((T / A) * B);...
s858314534
[ { "input": "3 5 7\n", "output": "10\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class s233008404 { String[][] colorMtr; int h; int w; int k; public static void main(String[] args) throws IOException { s233008404 mainObj = new s23300840...
s233008404
[ { "input": "2 3 2\n..#\n###\n", "output": "5\n" } ]
Java
codenet
import static java.lang.System.*; import java.math.BigInteger; import java.util.*; class s880132387 { public static Scanner sc = new Scanner(in); public static Random rand = new Random(); public void run() { TCase: while (true) { int W = sc.nextInt(), H = sc.nextInt(); ...
s880132387
[ { "input": "7 4\n9R2A993\n0E314A0\n8A900DE\n820R037\n6 7\nJH03HE\nID7722\n0DA1AH\n30C9G5\n99971A\nCA7EAI\nAHLBEM\n20 2\nA1234567891234CBDEGH\nBDEDF908034265091499\n0 0\n", "output": "23900037\n771971\n12345908034265091499\n" } ]
Java
codenet
import java.util.Scanner; public class s066389476 { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in); ) { solve(sc); } } public static void solve(Scanner sc) { char[] a = sc.next().toCharArray(); if (a[0] == a[1] || a[1] == a[2] ...
s066389476
[ { "input": "bac\n", "output": "Yes\n" } ]
Java
codenet
import java.util.Scanner; class s927992720 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { int a = sc.nextInt(); String op = sc.next(); int b = sc.nextInt(); if (op.equals("?")) break; if (o...
s927992720
[ { "input": "1 + 2\n56 - 18\n13 * 2\n100 / 10\n27 + 81\n0 ? 0\n", "output": "3\n38\n26\n10\n108\n" } ]
Java
codenet
import java.util.*; public class s369598583 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int count = 0; int next = 10; for (int i = 1; i <= N; i++) { count++; if (i == next - 1) { ...
s369598583
[ { "input": "11\n", "output": "9\n" } ]
Java
codenet
import java.io.*; import java.util.*; class s967693306 { static final long INF = Long.MAX_VALUE / 2; static final int MOD = 1_000_000_007; static final int SIZE = 1_000_000; long[] fac = new long[SIZE]; long[] inv = new long[SIZE]; long[] finv = new long[SIZE]; FastScanner sc = new FastScan...
s967693306
[ { "input": "3 3\n1 7\n3 2\n1 7\n", "output": "702\n" } ]
Java
codenet
import java.util.Scanner; public class s910008321 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int h = scanner.nextInt(); int a = scanner.nextInt(); if (h % a == 0) { System.out.println(h / a); } else { System.o...
s910008321
[ { "input": "10 4\n", "output": "3\n" } ]
Java
codenet
import java.util.Scanner; public class s659026534 { public static void main(String[] args) { @SuppressWarnings("resource") Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int count = 0; for (int i = 1; i <= n; i++) { count += i; } ...
s659026534
[ { "input": "3\n", "output": "6\n" } ]
Java
codenet
import java.util.Scanner; public class s912747097 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int r = sc.nextInt(); System.out.println(3 * r * r); } }
s912747097
[ { "input": "4\n", "output": "48\n" } ]
Java
codenet
import java.util.*; public class s012761786 { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { long n = nextLong(); long a = nextLong(); long b = nextLong(); long sa = Math.abs(a - b); long ans = 0; if (sa % 2 == 0) { ...
s012761786
[ { "input": "5 2 4\n", "output": "1\n" } ]
Java
codenet
import java.util.*; public class s799557290 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); boolean ju[] = new boolean[100001]; int pe[] = new int[100001]; int wa = 0; int ac = 0; ...
s799557290
[ { "input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n", "output": "2 2\n" } ]
Java
codenet
import java.util.Arrays; import java.util.Scanner; public class s537034016 { static long[] dp; static int mod = 1000000007; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int s = sc.nextInt(); sc.close(); dp = new long[s + 1]...
s537034016
[ { "input": "7\n", "output": "3\n" } ]
Java
codenet
import java.util.*; public class s818271374 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int count1 = 0; int count2 = 0; for (int i = 0; i < N; i++) { int a = sc.nextInt(); if (a % 4 == 0) { ...
s818271374
[ { "input": "3\n1 10 100\n", "output": "Yes\n" } ]
Java
codenet
import java.util.Scanner; public class s518927375 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long k = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); if (b <= a + 2) { System.out.println(1 + k); r...
s518927375
[ { "input": "4 2 6\n", "output": "7\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class s518990279 { public static final int BIG_NUM = 2000000000; public static final int MOD = 1000000007; public static void main(String[] args) { BufferedReader br = new BufferedReader(new Input...
s518990279
[ { "input": "123\n55\n1000\n0\n", "output": "6\n10\n1\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.InputStreamReader; public class s287007304 { public static void main(String[] args) { String[] s = readLine().split(" "); int a = Integer.parseInt(s[0]); int b = Integer.parseInt(s[1]); if (b % a == 0) { System.out.println(...
s287007304
[ { "input": "4 12\n", "output": "16\n" } ]
Java
codenet
import java.util.Scanner; public class s302760734 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); char[] s = scanner.next().toCharArray(), t = scanner.next().toCharArray(); boolean check = false; for (int i = s.length - t.length; i >= 0; i--) { ...
s302760734
[ { "input": "?tc????\ncoder\n", "output": "atcoder\n" } ]
Java
codenet
import java.util.Scanner; class s022525398 { public static void main(String[] args) { Scanner in = new Scanner(System.in); String a = in.next(); String b = in.next(); System.out.println(b + a); } }
s022525398
[ { "input": "oder atc\n", "output": "atcoder\n" } ]
Java
codenet
import java.util.Scanner; public class s193347311 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int intLoop = scan.nextInt(); String strTaro = ""; String strHana = ""; int intTaro = 0; int intHana = 0; for (int i = 0; i < ...
s193347311
[ { "input": "3\ncat dog\nfish fish\nlion tiger\n", "output": "1 7\n" } ]
Java
codenet
import java.util.*; public class s498914558 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int po[] = new int[n]; for (int i = 0; i < n; i++) { po[i] = sc.nextInt(); m -= po[...
s498914558
[ { "input": "3 1000\n120\n100\n140\n", "output": "9\n" } ]
Java
codenet
import java.util.*; class s566905615 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); String answer = "No"; if (a + b >= c) { answer = "Yes"; } ...
s566905615
[ { "input": "50 100 120\n", "output": "Yes\n" } ]
Java
codenet
import java.util.Scanner; public class s967858671 { public static void main(String[] args) { int[] Num; Num = new int[11]; Scanner n = new Scanner(System.in); for (int i = 0; i < 10; i++) { Num[i] = n.nextInt(); } for (int a = 9; a >= 0; a--) { ...
s967858671
[ { "input": "1819\n2003\n876\n2840\n1723\n1673\n3776\n2848\n1592\n922\n", "output": "3776\n2848\n2840\n" } ]
Java
codenet
import java.io.IOException; import java.util.Scanner; public class s201062219 { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); String mark; int c = 0; int b = 0; int a[] = new int[100000]; int x = 0; do { ...
s201062219
[ { "input": "1 + 2\n56 - 18\n13 * 2\n100 / 10\n27 + 81\n0 ? 0\n", "output": "3\n38\n26\n10\n108\n" } ]
Java
codenet
import java.math.*; import java.util.*; public class s004995062 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); String sa = sc.next(); String sb = sc.next(); BigDecimal A = new BigDecimal(sa); BigDecimal B = new BigDecimal(sb); System....
s004995062
[ { "input": "198 1.10\n", "output": "217\n" } ]
Java
codenet
import java.util.Scanner; public class s185737640 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.nextLine(); sc.close(); if (S.length() % 2 == 1) { S = S.substring(0, S.length() - 1); } else { S = S.su...
s185737640
[ { "input": "abaababaab\n", "output": "6\n" } ]
Java
codenet
import static java.lang.Integer.parseInt; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class s612878490 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReade...
s612878490
[ { "input": "4 5\n1 7\n6 2\n3 5\n4 4\n0 8\n", "output": "4\n" } ]
Java
codenet
import java.util.Scanner; public class s312529015 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) { System.out.println("Possible"); } el...
s312529015
[ { "input": "4 5\n", "output": "Possible\n" } ]
Java
codenet
import java.util.Scanner; public class s699933302 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = Integer.parseInt(sc.next()); int b = Integer.parseInt(sc.next()); int c = Integer.parseInt(sc.next()); int count = 0; for (int i ...
s699933302
[ { "input": "5 14 80\n", "output": "3\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s493101281 { public static final long MOD = 1000000007; public static void main(String[] args) { FastScanner sc = new FastScanner(); PrintWriter out = new PrintWriter(System.out); Integer i, j, k, n = 0, m = 0, h = 0, w = 0, ans = 0; ...
s493101281
[ { "input": "6\n9 1 4 4 6 7\n", "output": "2\n" } ]
Java
codenet
import java.util.Scanner; public class s890213274 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A1 = sc.nextInt(); int A2 = sc.nextInt(); int A3 = sc.nextInt(); if ((A1 + A2 + A3) >= 22) { System.out.println("bust"); ...
s890213274
[ { "input": "5 7 9\n", "output": "win\n" } ]
Java
codenet
import java.util.Scanner; public class s264878779 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int n = s.length(); long ans = 0; for (int mask = 0; mask < 1 << (n - 1); mask++) { long sum = 0; S...
s264878779
[ { "input": "125\n", "output": "176\n" } ]
Java
codenet
import java.io.*; import java.util.*; public class s968213233 { public s968213233(FastScanner in, PrintWriter out, int test) { int N = in.nextInt(); int[] A = new int[N]; for (int i = 0; i < N; i++) A[i] = in.nextInt(); Arrays.sort(A); long res = 0; PriorityQueue<...
s968213233
[ { "input": "4\n2 2 1 3\n", "output": "7\n" } ]
Java
codenet
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class s445598069 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); ...
s445598069
[ { "input": "5\n1 2 1 3 7\n", "output": "3\n" } ]