iidai/codenet huggingface dataset:
Language: Java

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);
    }
}


Example test case(s):
input: 725

output: 7
Language: Java

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();
            if (a == 0) {
                System.out.println(list.pop());
            } else {
                list.push(a);
            }
        }
    }
}


Example test case(s):
input: 1
6
0
8
10
0
0
0

output: 6
10
8
1
Language: Java

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 (s.charAt(i) == s.charAt(j)) {
                    total++;
                }
            }
        }

        System.out.println(total == 2 ? "Yes" : "No");
    }
}


Example test case(s):
input: ASSA

output: Yes
Language: Java

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 + 1;
        }
        int count = in.nextInt();
        Pattern pt = Pattern.compile("(\\d+),(\\d+)");
        int line[] = new int[2];
        for (int i = 0; i < count; i++) {
            String next = in.next(pt);
            for (int j = 0; j < line.length; j++) {
                Matcher matcher = pt.matcher(next);
                matcher.matches();
                line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
            }
            int change = num[line[0]];
            num[line[0]] = num[line[1]];
            num[line[1]] = change;
        }
        for (int i = 0; i < num.length; i++) {
            System.out.println(num[i]);
        }
    }
}


Example test case(s):
input: 5
4
2,4
3,5
1,2
3,4

output: 4
1
2
5
3
Language: Java

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 <= 100; x++) {
                for (int y = 1; y <= 100; y++) {
                    for (int z = 1; z <= 100; z++) {
                        int value = x * x + y * y + z * z + x * y + x * z + y * z;
                        if (value > n) {
                            break;
                        }
                        countArr[value]++;
                    }
                }
            }

            for (int i = 1; i <= n; i++) {
                out.println(countArr[i]);
            }
        }
    }

    private static void sort(double[] arr) {
        Double[] objArr = Arrays.stream(arr).boxed().toArray(Double[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(int[] arr) {
        Integer[] objArr = Arrays.stream(arr).boxed().toArray(Integer[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(long[] arr) {
        Long[] objArr = Arrays.stream(arr).boxed().toArray(Long[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task task = new Task();
        task.solve(1, in, out);
        out.close();
    }

    public static void main(String[] args) {
        new Thread(null, () -> solve(), "1", 1 << 26).start();
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}


Example test case(s):
input: 20

output: 0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0
Language: Java

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 = 1000000007;

        for (int i = 1; i < a.length; i++) {
            a[i] = sc.nextInt();
        }

        int num = 1;
        if (m > 0) {
            if (a[1] == 1) {
                cnt[1] = 0;
                if (num < m) {
                    num++;
                }
            } else {
                cnt[1] = 1;
            }
        } else {
            cnt[1] = 1;
        }

        for (int i = 2; i < cnt.length; i++) {

            cnt[i] = cnt[i - 2] + cnt[i - 1];
            cnt[i] %= MOD;
            if (m > 0) {
                if (i == a[num]) {
                    cnt[i] = 0;
                    if (num < m) {
                        num++;
                    }
                }
            }
        }

        System.out.println(cnt[n]);
        sc.close();
    }
}


Example test case(s):
input: 6 1
3

output: 4
Language: Java

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_VALUE;
        int countNegatives = 0;
        long sum = 0;
        for (int num : nums) {
            int abs = Math.abs(num);
            sum += abs;
            min = Math.min(min, abs);
            if (num < 0) {
                countNegatives++;
            }
        }

        System.out.println(countNegatives % 2 == 0 ? sum : sum - (min * 2));
    }
}


Example test case(s):
input: 3
-10 5 -4

output: 19
Language: Java

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] = Integer.parseInt(sc.next());
        }

        for (int i = count - 1; 0 <= i; i--) {

            System.out.print(givingNumbers[i]);

            if (i > 0) {
                System.out.print(" ");
            }
        }

        System.out.println();

        sc.close();
    }
}


Example test case(s):
input: 5
1 2 3 4 5

output: 5 4 3 2 1
Language: Java

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 (int i = 0; i < 10; i++) {
                l[i] = Integer.parseInt(strArr[i]);
                d += l[i];
            }
            int[] v = {Integer.parseInt(strArr[10]), Integer.parseInt(strArr[11])};
            double t = (double) d / (v[0] + v[1]);
            d = 0;
            for (int i = 0; i < 11; i++) {
                if (v[0] * t <= d) {
                    System.out.println(i);
                    break;
                } else {
                    d += l[i];
                }
            }
        }
    }
}


Example test case(s):
input: 1,1,1,1,1,1,1,1,1,1,40,60
1,1,1,1,1,3,3,3,3,3,50,50
10,10,10,10,10,10,10,10,10,10,50,49

output: 4
7
6
Language: Java

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 == 1 || n == 6 || n == 8) System.out.println("pon");
        else System.out.println("hon");
        sc.close();
    }
}


Example test case(s):
input: 16

output: pon
Language: Java

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 i = 0; i < n; i++) {
            map.put(sc.nextLine(), "");
        }
        sc.close();

        System.out.println(map.size());
    }
}


Example test case(s):
input: 3
apple
orange
apple

output: 2
Language: Java

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 numlist1[] = new int[100000];
        int numlist2[] = new int[100000];
        for (int i = 0; i < 100000; i++) {
            numlist1[i] = 0;
            numlist2[i] = 0;
        }

        for (int i = 0; i < n; i += 2) {
            numlist1[list[i] - 1] += 1;
            numlist2[list[i + 1] - 1] += 1;
        }

        int max11 = 0, max12 = 0, max21 = 0, max22 = 0;
        int val1 = 0, val2 = 0;
        for (int i = 0; i < 100000; i++) {
            if (numlist1[i] >= max11) {
                max12 = max11;
                max11 = numlist1[i];
                val1 = i;
            } else if (numlist1[i] >= max12) {
                max12 = numlist1[i];
            }
            if (numlist2[i] >= max21) {
                max22 = max21;
                max21 = numlist2[i];
                val2 = i;
            } else if (numlist2[i] >= max22) {
                max22 = numlist2[i];
            }
        }

        if (val1 != val2) {
            ans = n - max11 - max21;
        } else {
            ans = n - Math.max(max12 + max21, max11 + max22);
        }

        System.out.println(ans);
    }
}


Example test case(s):
input: 4
3 1 3 2

output: 1
Language: Java

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) {
            long f = f(min);
            res = (2 * f * f) % MOD;
        } else if (min + 1 == max) {
            long f = f(min);
            res = (f * ((f * max) % MOD)) % MOD;
        } else {
            res = 0;
        }
        System.out.println(res);
    }

    long f(int n) {
        long res = 1;
        for (int i = 2; i <= n; i++) res = (res * i) % MOD;
        return res;
    }

    int toInt(String s) {
        return Integer.parseInt(s);
    }

    int[] toInts(String s) {
        String[] a = s.split(" ");
        int[] o = new int[a.length];
        for (int i = 0; i < a.length; i++) o[i] = toInt(a[i]);
        return o;
    }

    void e(Object o) {
        System.err.println(o);
    }

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        (new s393796709()).solve(in);
    }
}


Example test case(s):
input: 2 2

output: 8
Language: Java

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();
            a[1] = sc.nextInt();
            a[2] = sc.nextInt();
            Arrays.sort(a);
            if (Math.pow(a[2], 2) == Math.pow(a[0], 2) + Math.pow(a[1], 2))
                System.out.println("YES");
            else System.out.println("NO");
        }
    }
}


Example test case(s):
input: 3
4 3 5
4 3 6
8 8 8

output: YES
NO
NO
Language: Java

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;
        int bef = 0;
        for (int i = 1; i < n; i++) {
            if (a[i - 1] < a[i]) {
                now = 1;
            } else if (a[i - 1] > a[i]) {
                now = -1;
            } else {
                continue;
            }
            if (bef == 0) {
                bef = now;
            }
            if (bef != now) {
                count++;
                bef = 0;
            }
        }
        System.out.println(count);
    }
}


Example test case(s):
input: 6
1 2 3 2 2 1

output: 2
Language: Java

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();
    }
}


Example test case(s):
input: 1 2 3

output: 3 1 2
Language: Java

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");
    }
}


Example test case(s):
input: 1000

output: ABC
Language: Java

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 = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            char[][] a = new char[n][n];
            long P = 37, Q = 47;
            long[] powP = new long[n + 1], powQ = new long[n + 1];
            powP[0] = powQ[0] = 1;
            for (int i = 1; i <= n; i++) {
                powP[i] = powP[i - 1] * P;
                powQ[i] = powQ[i - 1] * Q;
            }
            for (int i = 0; i < n; i++) {
                a[i] = in.next().toCharArray();
            }

            long[][] hashRow = new long[n][n];
            long[][] hashCol = new long[n][n];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        hashRow[i][k] += a[i][j] * powP[(j - k + n) % n];
                        hashCol[j][k] += a[i][j] * powP[(i - k + n) % n];
                    }
                }
            }

            int ans = 0;
            for (int A = 0; A < n; A++) {
                for (int B = 0; B < n; B++) {
                    boolean ok = true;
                    for (int i = 0; i < n; i++) {
                        ok &= hashRow[(i + A) % n][B] == hashCol[(i + B) % n][A];
                    }
                    ans += ok ? 1 : 0;
                }
            }
            out.println(ans);
        }
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }
    }
}


Example test case(s):
input: 2
ab
ca

output: 2
Language: Java

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();
            b = sc.nextInt();
            digit = (int) Math.log10(a + b) + 1;
            sb.append(digit);
            sb.append('\n');
        }
        System.out.print(sb);
    }
}


Example test case(s):
input: 5 7
1 99
1000 999

output: 2
3
4
Language: Java

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();
            if (map.containsKey(a)) {
                map.put(a, map.get(a) + 1);
            } else {
                map.put(a, 1);
            }
        }
        int ans = 0;
        for (int key : map.keySet()) {
            if ((map.get(key) % 2) == 1) ans++;
        }
        System.out.println(ans);
    }
}


Example test case(s):
input: 3
6
2
6

output: 1
Language: Java

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 i = 1; i * d < 600; i++) {
            int x = i * d;
            int y = x * x;
            ans += y * d;
        }
        return ans;
    }

    public static void main(String[] args) {
        while (read()) {
            System.out.println(solve());
        }
    }
}


Example test case(s):
input: 20
10

output: 68440000
70210000
Language: Java

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();
            maxv = Math.max(maxv, ri - minv);
            minv = Math.min(minv, ri);
        }
        System.out.println(maxv);
        sc.close();
    }
}


Example test case(s):
input: 6
5
3
1
3
4
3

output: 3
Language: Java

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++) {
            int u = sc.nextInt();
            int k = sc.nextInt();
            for (int j = 0; j < k; j++) {
                int v = sc.nextInt();
                g[u][v] = 1;
            }
        }

        int[] d = new int[n + 1];
        for (int i = 0; i <= n; i++) {
            d[i] = -1;
        }
        Queue<Integer> que = new LinkedList<Integer>();
        que.add(1);
        d[1] = 0;
        while (!que.isEmpty()) {
            int top = que.poll();
            for (int j = 1; j <= n; j++) {
                if (g[top][j] == 1 && d[j] == -1) {
                    que.add(j);
                    d[j] = d[top] + 1;
                }
            }
        }

        for (int i = 1; i <= n; i++) {
            System.out.println(i + " " + d[i]);
        }
    }
}


Example test case(s):
input: 4
1 2 2 4
2 1 4
3 0
4 1 3

output: 1 0
2 1
3 2
4 1
Language: Java

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 (int j = 1; j < N; j++) {
            if (A[j] == A[j - 1]) {
                System.out.println("NO");
                System.exit(0);
            }
        }
        System.out.println("YES");
    }
}


Example test case(s):
input: 5
2 6 1 4 5

output: YES
Language: Java

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;
        int out = 0;

        for (int i = 0; i < h.length; i++) {
            if (out < h[i]) {
                ans += h[i] - out;
                out = h[i];
            } else {
                out = h[i];
            }
        }

        System.out.println(ans);
    }
}


Example test case(s):
input: 4
1 2 2 1

output: 2
Language: Java

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++) {
                char a = s.charAt(i);
                sum += a - '0';
            }
            System.out.printf("%d\n", sum);
        }
    }
}


Example test case(s):
input: 123
55
1000
0

output: 6
10
1
Language: Java

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 BufferedReader(new InputStreamReader(System.in));
        str = buf.readLine();
        inp = str.split(" ", -1);
        for (int i = 0; i < inp.length; i++) abc[i] = Integer.parseInt(inp[i]);
        if (abc[0] < abc[1] && abc[1] < abc[2]) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Example test case(s):
input: 1 3 8

output: Yes