iidai/codenet huggingface dataset:
Language: Java

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] = "#" + scanner.next() + "#";
        }
        System.out.println(String.valueOf(new char[w + 2]).replace('\0', '#'));
        for (String s : ans) {
            System.out.println(s);
        }
        System.out.println(String.valueOf(new char[w + 2]).replace('\0', '#'));
    }
}


Example test case(s):
input: 2 3
abc
arc

output: #####
#abc#
#arc#
#####
Language: Java

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');
        }
        System.out.println(c);
    }
}


Example test case(s):
input: 2
ABCXYZ

output: CDEZAB
Language: Java

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 t1 = h1 * 60 + m1;
        int t2 = h2 * 60 + m2;
        System.out.println(t2 - t1 - k);
    }
}


Example test case(s):
input: 10 0 15 0 30

output: 270
Language: Java

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 = 0;
        for (long i = k; i <= n + 1; i++) {
            long max = i * (2 * n - i + 1) / 2;
            long min = i * (i - 1) / 2;
            ans += (max - min + 1) % DEVISOR;
        }
        System.out.println(ans % DEVISOR);
    }
}


Example test case(s):
input: 3 2

output: 10
Language: Java

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 += 32;
                System.out.print(c);
            } else if (Character.isLowerCase(c)) {
                c -= 32;
                System.out.print(c);
            } else System.out.print(c);
        }
        System.out.println();
        sc.close();
    }
}


Example test case(s):
input: fAIR, LATER, OCCASIONALLY CLOUDY.

output: Fair, later, occasionally cloudy.
Language: Java

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 ((numlist[4] - numlist[0]) > k) {
            System.out.println(":(");
        } else {
            System.out.println("Yay!");
        }
    }
}


Example test case(s):
input: 1
2
4
8
9
15

output: Yay!
Language: Java

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


Example test case(s):
input: 100 17

output: 83
Language: Java

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);
        } else if (X < t) {
            System.out.print(0);
        }
    }
}


Example test case(s):
input: 100 17

output: 83
Language: Java

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


Example test case(s):
input: 3

output: 6
Language: Java

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 void run() {
        for (; sc.hasNext(); ) {
            int my1 = sc.nextInt();
            int my2 = sc.nextInt();
            int enemy1 = sc.nextInt();
            boolean[] used = new boolean[11];
            used[my1] = true;
            used[my2] = true;
            used[enemy1] = true;
            int all = 0;
            int safe = 0;
            for (int i = 1; i <= 10; i++)
                if (!used[i]) {
                    all++;
                    if (my1 + my2 + i <= 20) safe++;
                }
            if (safe * 2 >= all) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }

    char solve(int[][] a) {
        char[] s = {'d', 'o', 'x'};
        for (int side = 1; side <= 2; side++) {
            for (int i = 0; i < 3; i++) {
                if (a[i][0] == side && a[i][1] == side && a[i][2] == side) return s[side];
                if (a[0][i] == side && a[1][i] == side && a[2][i] == side) return s[side];
            }
            if (a[0][0] == side && a[1][1] == side && a[2][2] == side) return s[side];
            if (a[0][2] == side && a[1][1] == side && a[2][0] == side) return s[side];
        }
        return 'd';
    }
}


Example test case(s):
input: 1 2 3
5 6 9
8 9 10

output: YES
YES
NO
Language: Java

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) == 'A' && s.charAt(i) == 'C') {
                pre[i] = 1;
            }
        }

        for (int i = 1; i < N; i++) {
            pre[i] += pre[i - 1];
        }

        while (Q-- > 0) {
            int l = sc.nextInt(), r = sc.nextInt();
            r--;
            System.out.println(pre[r] - pre[l - 1]);
        }
    }
}


Example test case(s):
input: 8 3
ACACTACG
3 7
2 3
1 8

output: 2
0
3
Language: Java

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[z] = sc.nextInt();
        }
        Arrays.sort(a);
        if (N == 1 && a[0] > 1) {
            ans = 1;
        } else {
            for (int j = 0; N > j; j++) {
                if (j == 0 || a[j] != a[j - 1]) {
                    tmp = 1;
                    for (int i = j + 1; N > i; i++) {
                        if (a[j] == a[i]) {
                            tmp++;
                        } else {
                            break;
                        }
                    }

                    if (tmp > a[j]) {
                        ans += tmp - a[j];
                    } else if (tmp < a[j]) {
                        ans += tmp;
                    }
                }
            }
        }
        System.out.println(ans);
    }
}


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

output: 1
Language: Java

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; i++) {
            System.out.println(count[i]);
        }
    }
}


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

output: 2
2
0
0
0
Language: Java

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


Example test case(s):
input: 2018
218

output: Yes
Language: Java

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

        Arrays.sort(array);

        String a = array[0];
        cnt++;
        for (int i = 0; i < n; i++) {

            if (a.equals(array[i])) {

            } else {
                cnt++;
            }
            a = array[i];
        }
        System.out.println(cnt);
    }
}


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

output: 2
Language: Java

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");
        } else {
            System.out.println("No");
        }
    }
}


Example test case(s):
input: 1118

output: Yes
Language: Java

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 d = sc.nextInt();

            System.out.println(Answer(y, m, d));
        }
    }

    public static int Answer(int y, int m, int d) {
        int result = 1;

        if (y % 3 == 0) {
            result += 20 - d;
        } else if (m % 2 == 0) {
            result += 19 - d;
        } else {
            result += 20 - d;
        }

        for (m += 1; m <= 10; m++) {
            if (y % 3 == 0) {
                result += 20;
            } else {
                if (m % 2 == 0) {
                    result += 19;
                } else {
                    result += 20;
                }
            }
        }

        for (y += 1; y < 1000; y++) {
            if (y % 3 == 0) {
                result += 200;
            } else {
                result += 195;
            }
        }
        return result;
    }
}


Example test case(s):
input: 8
1 1 1
344 3 1
696 5 1
182 9 5
998 8 7
344 2 19
696 4 19
999 10 20

output: 196470
128976
59710
160715
252
128977
59712
1
Language: Java

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 = 0; i < size; i++) {
            id = scan.nextInt();
            cols = scan.nextInt();
            row = new int[size];
            for (int j = 0; j < cols; j++) row[scan.nextInt() - 1] = 1;
            graph[id - 1] = row;
        }

        for (int i = 0; i < graph.length; i++) {
            for (int j = 0; j < graph[i].length; j++) {
                System.out.print(graph[i][j]);
                if (j < graph[i].length - 1) System.out.print(" ");
            }
            System.out.println();
        }
    }
}


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

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

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


Example test case(s):
input: 4 12

output: 16
Language: Java

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


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

output: 3 1 2
Language: Java

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 text = sc.nextLine();
            for (int j = 0; j < W; j++) {
                S[i][j] = text.charAt(j);
            }
        }
        sc.close();

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (S[i][j] == '.') {
                    int count = 0;
                    for (int a = -1; a <= 1; a++) {
                        if (i + a < 0 || H <= i + a) {
                            continue;
                        }
                        for (int b = -1; b <= 1; b++) {
                            if (j + b < 0 || W <= j + b) {
                                continue;
                            }
                            if (S[i + a][j + b] == '#') {
                                count++;
                            }
                        }
                    }
                    S[i][j] = (char) (count + 48);
                }
                System.out.printf("%c", S[i][j]);
            }
            System.out.printf("\n");
        }
    }
}


Example test case(s):
input: 3 5
.....
.#.#.
.....

output: 11211
1#2#1
11211
Language: Java

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


Example test case(s):
input: 81 58

output: 110
Language: Java

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)));
        StringTokenizer s = new StringTokenizer(br.readLine());

        int n = Integer.parseInt(s.nextToken());
        HashMap<Integer, Integer> hm = new HashMap<>();
        s = new StringTokenizer(br.readLine());
        for (int i = 0; i < n; i++) {
            int val = Integer.parseInt(s.nextToken());
            hm.put(val, hm.getOrDefault(val, 0) + 1);
        }
        int ans = 0;
        for (int val : hm.keySet()) {
            int num = hm.get(val);
            if (num > val) ans += num - val;
            else if (num < val) ans += num;
        }
        pw.println(ans);
        pw.close();
    }
}


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

output: 1
Language: Java

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++) {
            c[i] = in.nextInt();
            s[i] = in.nextInt();
            f[i] = in.nextInt();
        }

        for (int i = 0; i < n - 1; i++) {
            int time = s[i] + c[i];
            for (int j = i + 1; j < n - 1; j++) {
                if (time % f[j] != 0) {
                    time += f[j] - (time % f[j]);
                }

                if (time < s[j]) {
                    time = s[j];
                }

                time += c[j];
            }

            System.out.println(time);
        }
        System.out.println(0);
    }
}


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

output: 12
11
0
Language: Java

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 FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        solve(sc, out);

        out.flush();
    }

    public static void solve(FastScanner sc, PrintWriter out) {
        String s = sc.next();

        String[] a = {"a", "e", "i", "o", "u"};

        for (String str : a) {
            if (str.equalsIgnoreCase(s)) {
                out.println("vowel");
                return;
            }
        }

        out.println("consonant");
    }

    public static int gcd(int a, int b) {
        if (a < b) return gcd(b, a);
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static long gcd(long a, long b) {
        if (a < b) return gcd(b, a);
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static int lcm(int a, int b) {
        return (a * b) / gcd(a, b);
    }
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
        return new Pair<V, K>(getValue(), getKey());
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

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

        return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    }
}


Example test case(s):
input: a

output: vowel
Language: Java

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("Rainy");
        } else {
            System.out.println("Sunny");
        }
        sc.close();
    }
}


Example test case(s):
input: Sunny

output: Cloudy
Language: Java

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++) {
            arr.add(Integer.parseInt(sc.next()));
        }

        calArea ab = new calArea();
        int area1 = ab.Area(arr.get(0), arr.get(1));
        int area2 = ab.Area(arr.get(2), arr.get(3));

        if (area1 > area2) {
            System.out.println(area1);
        } else if (area1 < area2) {
            System.out.println(area2);
        } else if (area1 == area2) {
            System.out.println(area1);
        }
    }
}


Example test case(s):
input: 3 5 2 7

output: 15
Language: Java

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


Example test case(s):
input: 29

output: Yes
Language: Java

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 FastReader();
            BufferedWriter w = new BufferedWriter(new OutputStreamWriter(System.out));
            int i, j;
            int m, n, t, max, k, x, y, min, correct_ans, num, num_penal;
            long a, b, sum;

            String str;

            n = s.nextInt();
            m = s.nextInt();

            int penal[] = new int[n + 1];
            boolean solved[] = new boolean[n + 1];
            Arrays.fill(solved, false);

            for (i = 0; i < m; i++) {
                num = s.nextInt();
                str = s.next();
                if (str.charAt(0) == 'A') {
                    solved[num] = true;
                } else if (solved[num] == false) penal[num]++;
            }

            correct_ans = 0;
            num_penal = 0;
            for (i = 1; i <= n; i++) {
                if (solved[i] == true) {
                    correct_ans++;
                    num_penal += penal[i];
                }
            }

            w.write(correct_ans + " " + num_penal + "\n");
            w.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

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

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

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

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

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}


Example test case(s):
input: 2 5
1 WA
1 AC
2 WA
2 AC
2 WA

output: 2 2
Language: Java

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("Rainy");
        } else {
            System.out.println("Sunny");
        }
    }
}


Example test case(s):
input: Sunny

output: Cloudy