iidai/codenet huggingface dataset:
Language: Java

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

        int N = scanner.nextInt();

        scanner.nextLine();

        String s = scanner.nextLine();

        boolean flag = false;
        int ans = 0;
        int hen = 0;
        int sha = 0;
        int dot = 0;
        int temp = 0;
        boolean first = true;
        for (int i = 0; i < N; i++) {

            if (s.charAt(i) == '#') {
                first = false;
                if (sha <= dot) {

                    ans += sha;
                    sha = 0;
                    dot = 0;
                    first = true;

                } else {

                }

                sha++;
            } else {

                dot++;
            }
        }

        if (sha <= dot) {
            ans += sha;
            dot = 0;
        } else {

        }

        System.out.println(ans + dot);
    }
}


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

output: 1
Language: Java

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) {
                minN = h;
            } else if (minN == h - 1) {
                minN = h - 1;
            } else if (minN < h - 1) {
                minN = h - 1;
            } else if (minN > h) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}


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

output: Yes
Language: Java

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.length(); i++) {
            s = new StringBuilder(Rotate(s));
            if (t.toString().equals(s.toString())) {
                flag = true;
                break;
            }
        }
        if (flag == true) System.out.println("Yes");
        else System.out.println("No");
    }

    public static StringBuilder Rotate(StringBuilder str) {
        int len = str.length();
        char t = str.charAt(0);
        for (int i = 0; i < len - 1; i++) {
            str.setCharAt(i, str.charAt(i + 1));
        }
        str.setCharAt(len - 1, t);
        return str;
    }
}


Example test case(s):
input: kyoto
tokyo

output: Yes
Language: Java

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] = ryuka[i - 1] + ryuka[i - 2];
        }
        System.out.println(ryuka[n]);
    }
}


Example test case(s):
input: 5

output: 11
Language: Java

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;
        for (int i = 0; i < N; i++) {
            s[i] = sc.next();
            if (s[i].substring(0, 1).equals("B")) {
                b_num++;
            }
            if (s[i].substring(s[i].length() - 1, s[i].length()).equals("A")) {
                a_num++;
            }
            if (s[i].substring(0, 1).equals("B")
                    || s[i].substring(s[i].length() - 1, s[i].length()).equals("A")) {
                if (!(s[i].substring(0, 1).equals("B")
                        && s[i].substring(s[i].length() - 1, s[i].length()).equals("A"))) {
                    flag = false;
                }
            }
            for (int j = 0; j < s[i].length() - 1; j++) {
                if (s[i].substring(j, j + 2).equals("AB")) ans++;
            }
        }
        ans += Math.min(a_num, b_num);
        if (Math.min(a_num, b_num) != 0 && flag) {
            ans--;
        }
        System.out.println(ans);
    }
}


Example test case(s):
input: 3
ABCA
XBAZ
BAD

output: 2
Language: Java

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");
                System.out.println(Y - 1867);
            } else if (Y <= 1925) {
                System.out.print("T");
                System.out.println(Y - 1911);
            } else if (Y <= 1988) {
                System.out.print("S");
                System.out.println(Y - 1925);
            } else {
                System.out.print("H");
                System.out.println(Y - 1988);
            }
        } else if (E == 1) {
            System.out.println(1867 + Y);
        } else if (E == 2) {
            System.out.println(1911 + Y);
        } else if (E == 3) {
            System.out.println(1925 + Y);
        } else {
            System.out.println(1988 + Y);
        }
    }
}


Example test case(s):
input: 0 2015

output: H27
Language: Java

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

    private static void log(String str) {
        System.out.println(str);
    }

    private static void log(int str) {
        System.out.println(str);
    }
}


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

output: 10
Language: Java

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();
            if (W == 0 && H == 0) return;
            char[][] map = new char[H][W];

            for (int h = 0; h < H; h++) {
                map[h] = sc.next().toCharArray();
            }

            BigInteger[][] dp = new BigInteger[H][W];

            for (int h = 0; h < H; h++)
                for (int w = 0; w < W; w++) {
                    BigInteger hprev = BigInteger.ZERO;
                    if (h >= 1) {
                        hprev = dp[h - 1][w];
                    }
                    BigInteger wprev = BigInteger.ZERO;
                    if (w >= 1) {
                        wprev = dp[h][w - 1];
                    }
                    if (Character.isDigit(map[h][w])) {
                        BigInteger max;
                        if (hprev.compareTo(wprev) > 0) {
                            max = hprev;
                        } else {
                            max = wprev;
                        }
                        dp[h][w] = max.multiply(BigInteger.TEN).add(new BigInteger(map[h][w] + ""));
                    } else {
                        dp[h][w] = BigInteger.ZERO;
                    }
                }
            BigInteger max = BigInteger.ZERO;
            for (int h = 0; h < H; h++)
                for (int w = 0; w < W; w++) {
                    if (dp[h][w].compareTo(max) > 0) max = dp[h][w];
                }
            ln(max);
        }
    }

    public static void main(String[] args) {
        new s880132387().run();
    }

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

    public static void pr(Object o) {
        out.print(o);
    }

    public static void ln(Object o) {
        out.println(o);
    }

    public static void ln() {
        out.println();
    }
}


Example test case(s):
input: 7 4
9R2A993
0E314A0
8A900DE
820R037
6 7
JH03HE
ID7722
0DA1AH
30C9G5
99971A
CA7EAI
AHLBEM
20 2
A1234567891234CBDEGH
BDEDF908034265091499
0 0

output: 23900037
771971
12345908034265091499
Language: Java

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] || a[2] == a[0]) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}


Example test case(s):
input: bac

output: Yes
Language: Java

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 (op.equals("+")) System.out.println(a + b);
            if (op.equals("-")) System.out.println(a - b);
            if (op.equals("*")) System.out.println(a * b);
            if (op.equals("/")) System.out.println(a / b);
        }
    }
}


Example test case(s):
input: 1 + 2
56 - 18
13 * 2
100 / 10
27 + 81
0 ? 0

output: 3
38
26
10
108
Language: Java

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) {
                i = next * 10 - 1;
                next *= 100;
            }
        }
        System.out.println(count);
    }
}


Example test case(s):
input: 11

output: 9
Language: Java

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.out.println(h / a + 1);
        }
    }
}


Example test case(s):
input: 10 4

output: 3
Language: Java

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


Example test case(s):
input: 3

output: 6
Language: Java

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


Example test case(s):
input: 4

output: 48
Language: Java

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) {
            ans = sa / 2;
        } else {
            long AAA = Math.min((n - a), (a - 1));
            long BBB = Math.min((n - b), (b - 1));

            ans = Math.min(AAA, BBB);

            sa -= 1;
            ans += 1;

            ans += sa / 2;
        }

        System.out.println(ans);
    }

    static String next() {
        return sc.next();
    }

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

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

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

    static String[] splitString(String s) {
        return s.split("");
    }

    static char[] splitChar(String s) {
        return s.toCharArray();
    }

    static int charToInt(char aaa) {
        return aaa - 48;
    }

    public static int maxInt(int[] a, int lng) {
        int max = a[0];
        for (int i = 1; i < lng; i++) {
            max = Math.max(max, a[i]);
        }
        return max;
    }

    public static int minInt(int[] a, int lng) {
        int min = a[0];
        for (int i = 1; i < lng; i++) {
            min = Math.min(min, a[i]);
        }
        return min;
    }

    public static long maxLong(long[] a, int lng) {
        long max = a[0];
        for (int i = 1; i < lng; i++) {
            max = Math.max(max, a[i]);
        }
        return max;
    }

    public static long minLong(long[] a, int lng) {
        long min = a[0];
        for (int i = 1; i < lng; i++) {
            min = Math.min(min, a[i]);
        }
        return min;
    }
}


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

output: 1
Language: Java

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;

        for (int i = 0; i < b; i++) {
            int n = sc.nextInt();
            String res = sc.next();

            if (res.equals("WA") && ju[n - 1] != true) {
                pe[n - 1]++;
            }

            if (res.equals("AC")) {
                ju[n - 1] = true;
            }
        }

        for (int i = 0; i < a; i++) {
            if (ju[i]) {
                ac++;
                wa += pe[i];
            }
        }

        System.out.println("" + ac + " " + wa);
    }
}


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.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];
        Arrays.fill(dp, -1);
        dp[0] = 1;
        System.out.println(dfs(s));
    }

    static long dfs(int s) {
        if (dp[s] != -1) {
            return dp[s];
        }

        long ret = 0;
        for (int i = s - 3; i >= 0; i--) {
            ret += dfs(i);
            ret %= mod;
        }
        return dp[s] = ret;
    }
}


Example test case(s):
input: 7

output: 3
Language: Java

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) {
                count1++;
            } else if (a % 2 == 0 && (a / 2) % 2 == 1) {
                count2++;
            }
        }
        if (count1 >= N / 2) {
            System.out.println("Yes");
        } else if (((N / 2 - count1) * 2 + N % 2) == count2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Example test case(s):
input: 3
1 10 100

output: Yes
Language: Java

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

        long x = k - (a - 1);
        long ans = a + (x / 2) * (b - a) + (x % 2);

        System.out.println(ans);
    }
}


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

output: 7
Language: Java

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 InputStreamReader(System.in));
        int ans;

        while (true) {

            try {
                String inputed = br.readLine();
                if (inputed.length() == 1 && inputed.equals("0")) break;

                ans = 0;
                for (int i = 0; i < inputed.length(); i++) {
                    ans += inputed.charAt(i) - '0';
                }

                System.out.printf("%d\n", ans);

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


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

output: 6
10
1
Language: Java

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(a + b);
        } else {
            System.out.println(b - a);
        }
        return;
    }

    private static String readLine() {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try {
            return reader.readLine();
        } catch (Exception e) {
            return e.getMessage();
        }
    }
}


Example test case(s):
input: 4 12

output: 16
Language: Java

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--) {
            boolean check2 = true;
            for (int j = 0; j < t.length; j++) {
                if (s[i + j] != '?' && s[i + j] != t[j]) {
                    check2 = false;
                }
            }
            if (check2) {
                check = true;
                for (int j = 0; j < t.length; j++) {
                    s[i + j] = t[j];
                }
            }
            if (check) {
                break;
            }
        }
        if (check) {
            for (int i = 0; i < s.length; i++) {
                if (s[i] == '?') {
                    System.out.print("a");
                } else {
                    System.out.print(s[i]);
                }
            }
            System.out.println();
        } else {
            System.out.println("UNRESTORABLE");
        }
    }
}


Example test case(s):
input: ?tc????
coder

output: atcoder
Language: Java

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


Example test case(s):
input: oder atc

output: atcoder
Language: Java

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 < intLoop; i++) {
            strTaro = scan.next();
            strHana = scan.next();
            int intJudge = strTaro.compareTo(strHana);
            if (intJudge < 0) {
                intHana += 3;
            } else if (intJudge == 0) {
                intTaro++;
                intHana++;
            } else if (0 < intJudge) {
                intTaro += 3;
            }
        }
        System.out.println(intTaro + " " + intHana);
        scan.close();
    }
}


Example test case(s):
input: 3
cat dog
fish fish
lion tiger

output: 1 7
Language: Java

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[i];
        }
        Arrays.sort(po);
        System.out.println(n + m / po[0]);
    }
}


Example test case(s):
input: 3 1000
120
100
140

output: 9
Language: Java

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


Example test case(s):
input: 50 100 120

output: Yes
Language: Java

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--) {
            for (int b = 0; b < a; b++) {
                if (Num[b] < Num[b + 1]) {
                    Num[10] = Num[b];
                    Num[b] = Num[b + 1];
                    Num[b + 1] = Num[10];
                }
            }
        }

        System.out.println(Num[0]);
        System.out.println(Num[1]);
        System.out.println(Num[2]);
    }
}


Example test case(s):
input: 1819
2003
876
2840
1723
1673
3776
2848
1592
922

output: 3776
2848
2840
Language: Java

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 {
            c = scan.nextInt();
            mark = scan.next();
            b = scan.nextInt();
            if (mark.equals("?")) {
                a[x] = 2000001;
                break;
            } else if (mark.equals("+")) {
                a[x] = c + b;
            } else if (mark.equals("-")) {
                a[x] = c - b;
            } else if (mark.equals("*")) {
                a[x] = c * b;
            } else if (mark.equals("/")) {
                a[x] = c / b;
            }
            x++;
        } while (true);
        x = 0;
        do {
            if (a[x] == 2000001) break;
            System.out.println(a[x]);
            x++;
        } while (true);
        scan.close();
    }
}


Example test case(s):
input: 1 + 2
56 - 18
13 * 2
100 / 10
27 + 81
0 ? 0

output: 3
38
26
10
108
Language: Java

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.out.println(A.multiply(B).setScale(0, BigDecimal.ROUND_DOWN));
    }
}


Example test case(s):
input: 198 1.10

output: 217