zccneil/codelingua_dataset huggingface dataset:
assistant: ABC = tuple(map(int, input().split()))
if ABC.count(5) == 2:
    print('YES' if sum(ABC) == 17 else 'NO')
else:
    print('NO')


user: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class atcoder_ABC042_A {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String[] list = line.split(" ");
        int x = Integer.parseInt(list[0]);
        int a = Integer.parseInt(list[1]);
        int y = Integer.parseInt(list[2]);
        String h = "NO";
        if (x == 5 | x == 7 | a == 5 | a == 7 | y == 5 | y == 7) {
            if (x + y + a == 17) {
                h = "YES";
            }
        }
        System.out.println(h);
    }
}
assistant: s = str(input())
my_str = ''
for c in s:
    if c == '0' or c == '1':
        my_str += c
    elif c == 'B' and len(my_str) != 0:
        my_str = my_str[: len(my_str) - 1]
print(my_str)


user: 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.io.UncheckedIOException;
import java.util.StringTokenizer;

public class atcoder_ABC043_B {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BUnhappyHackingABCEdit solver = new BUnhappyHackingABCEdit();
        solver.solve(1, in, out);
        out.close();
    }

    static class BUnhappyHackingABCEdit {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            String s = in.string();
            StringBuilder d = new StringBuilder();
            for (char c : s.toCharArray()) {
                switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                }
            }
            out.println(d);
        }
    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }
    }
}
assistant: print(input().replace(",", " "))


user: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.*;
import java.util.*;

public class atcoder_ABC051_A {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        String a = br.readLine();
        sb.append(a.replace(",", " "));
        System.out.println(sb);
    }
}
assistant: A = list(map(int, input().split()))
if A[1] <= A[2] or A[3] <= A[0]:
    print(0)
else:
    A.sort()
    print(A[2] - A[1])


user: 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.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;

public class atcoder_ABC070_B {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        if (c > b) {
            System.out.println(0);
        } else if (a > d) {
            System.out.println(0);
        } else if (a < c) {
            System.out.println(Math.min(b, d) - c);
        } else {
            List<Integer> l = new ArrayList<>();
            l.add(a);
            l.add(b);
            l.add(c);
            l.add(d);
            Collections.sort(l);
            System.out.println(l.get(2) - l.get(1));
        }
    }

    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());
        }
    }
}
assistant: import numpy as np
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(* (MAP() for _ in range(n)))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
N = INT()
S = [input() for _ in range(N)]
march = ["M", "A", "R", "C", "H"]
march_lis = [0] * 5
for s in S:
    if s[0].upper() in march:
        march_lis[march.index(s[0].upper())] += 1
ans = 0
for x, y, z in combinations(march_lis, 3):
    ans += x * y * z
print(ans)


user: import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class atcoder_ABC089_C {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long[] cnt = new long[5];
            Arrays.fill(cnt, 0);
            for (int i = 0; i < n; ++i) {
                String str = in.next();
                if (str.charAt(0) == 'M') {
                    cnt[0]++;
                } else if (str.charAt(0) == 'A') {
                    cnt[1]++;
                } else if (str.charAt(0) == 'R') {
                    cnt[2]++;
                } else if (str.charAt(0) == 'C') {
                    cnt[3]++;
                } else if (str.charAt(0) == 'H') {
                    cnt[4]++;
                }
            }
            long res =
                    cnt[0] * cnt[1] * cnt[2]
                            + cnt[0] * cnt[1] * cnt[3]
                            + cnt[0] * cnt[1] * cnt[4]
                            + cnt[0] * cnt[2] * cnt[3]
                            + cnt[0] * cnt[2] * cnt[4]
                            + cnt[0] * cnt[3] * cnt[4]
                            + cnt[1] * cnt[2] * cnt[3]
                            + cnt[1] * cnt[2] * cnt[4]
                            + cnt[1] * cnt[3] * cnt[4]
                            + cnt[2] * cnt[3] * cnt[4];
            out.println(res);
        }
    }
}
assistant: D, G = map(int, input().split())
PC = [tuple(map(int, input().split())) for _ in range(D)]
ans = 10 ** 9
for i in range(2 ** D):
    score = 0
    problem = 0
    for j in range(D):
        if (i >> j) & 1:
            score += 100 * (j + 1) * PC[j][0] + PC[j][1]
            problem += PC[j][0]
    if score > G:
        continue
    left = G - score
    for j in range(D):
        if (i >> j) & 1:
            continue
        if left > 100 * (j + 1) * PC[j][0] + PC[j][1]:
            pass
        else:
            tmp = (left + (100 * (j + 1)) - 1) // (100 * (j + 1))
            ans = min(ans, problem + min(tmp, PC[j][0]))
print(ans)


user: import java.util.Scanner;

public class atcoder_ABC104_C {
    static final int INF = 100000;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int D = sc.nextInt();
        long G = sc.nextLong();
        int[] p = new int[D];
        int[] c = new int[D];
        for (int i = 0; i < D; i++) {
            p[i] = sc.nextInt();
            c[i] = sc.nextInt();
        }
        int min = INF;
        for (int bit = 0; bit < (1 << D); bit++) {
            int score = 0;
            int solve_num = 0;
            for (int i = 0; i < D; i++) {
                if ((bit & (1 << i)) != 0) {
                    score += 100 * (i + 1) * p[i] + c[i];
                    solve_num += p[i];
                }
            }
            if (score < G) {
                loop:
                for (int i = D - 1; i >= 0; i--) {
                    if ((bit & (1 << i)) == 0) {
                        for (int j = 0; j < p[i] - 1; j++) {
                            score += 100 * (i + 1);
                            solve_num++;
                            if (score >= G) {
                                break loop;
                            }
                        }
                    }
                }
            }
            if (score >= G) {
                min = Math.min(min, solve_num);
            }
        }
        System.out.println(min);
        sc.close();
    }
}
assistant: from sys import stdin
from collections import Counter
import numpy as np
N, M = [int(x) for x in stdin.readline().split()]
A = np.array([int(a) for a in stdin.readline().split()], dtype=np.int64)
cum_remainders = (np.hstack([0, A]) % M).cumsum() % M
remainder_counts = Counter(cum_remainders)
combinations = 0
for count in remainder_counts.values():
    combinations += count * (count - 1) // 2
print(combinations)


user: 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.HashMap;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class atcoder_ABC105_D {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int[] a = in.nextIntArray(n);
            HashMap<Integer, Integer> dp = new HashMap<>();
            long ans = 0;
            int base = 0;
            for (int i = 0; i < n; i++) {
                base = (base - a[i] % m + m) % m;
                dp.merge((base + a[i]) % m, 1, Integer::sum);
                ans += dp.getOrDefault(base, 0);
            }
            out.println(ans);
        }
    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

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

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }
    }
}
assistant: import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
import copy
import functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(- 1, 0), (0, 1), (1, 0), (0, - 1)]
ddn = [(- 1, 0), (- 1, 1), (0, 1), (1, 1),
       (1, 0), (1, - 1), (0, - 1), (- 1, - 1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    s = S()
    k = I()
    l = 0
    for c in s:
        if c != '1':
            break
        l += 1
    if l >= k:
        return 1
    return s[l]


print(main())


user: import java.util.*;

public class atcoder_ABC106_C {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char[] c = str.toCharArray();
        long k = sc.nextLong();
        int n = str.length();
        for (int i = 0; i < k; i++) {
            if (c[i] == '1') {
                if (i == k - 1) {
                    System.out.println(1);
                    return;
                }
            } else {
                System.out.println(c[i]);
                return;
            }
        }
    }
}
assistant: import sys
N, K = map(int, input().split())
lst = list(map(int, input().split()))
lst_p = []
lst_m = []
for i in range(N):
    if lst[i] == 0:
        K -= 1
    if lst[i] > 0:
        lst_p += [lst[i]]
    elif lst[i] < 0:
        lst_m += [lst[i]]
p = 0
m = 0
x, y = 0, len(lst_m) - 1
lastx = len(lst_p)
lasty = len(lst_m)


def check(k):
    ans = 10 ** 9
    for j in range(0, k + 1):
        if j > lastx or k - j > lasty:
            pass
        else:
            if j == 0:
                p = 0
            else:
                p = lst_p[j - 1]
            if k - j == 0:
                m = 0
            else:
                m = lst_m[lasty - (k - j)]
            ans = min(ans, 2 * p + abs(m), p + 2 * abs(m))
    return ans


print(check(K))


user: import java.util.Scanner;

public class atcoder_ABC107_C {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int S[] = new int[N];
        for (int i = 0; i < N; i++) S[i] = sc.nextInt();
        int temp = 0;
        int ans = 1000000000;
        if (K == 1) {
            for (int i = 0; i < N; i++) {
                temp = S[i];
                ans = Math.min(Math.abs(temp), ans);
            }
            System.out.println(ans);
        } else if (N - K != 0) {
            for (int i = 0; i <= N - K; i++) {
                int min = S[i];
                int max = S[i + K - 1];
                if (min < 0 && max > 0) temp = Math.min(2 * (-min) + max, (-min) + 2 * max);
                else temp = Math.max(Math.abs(min), Math.abs(max));
                ans = Math.min(ans, temp);
            }
            System.out.println(ans);
        } else {
            int min = S[0];
            int max = S[N - 1];
            if (min < 0 && max > 0)
                System.out.println(Math.min(2 * (-min) + max, (-min) + 2 * max));
            else System.out.println(Math.max(Math.abs(min), Math.abs(max)));
        }
        sc.close();
    }
}
assistant: class BIT:
    def __init__(self, N):
        self.size = N
        self.tree = [0] * (N + 1)
        self.depth = n.bit_length()

    def _bitsum(self, i):
        ret = 0
        while i:
            ret += self.tree[i]
            i ^= i & - i
        return ret

    def bitsum(self, l, r=None):
        if r is None:
            return self._bitsum(l)
        else:
            return self._bitsum(r) - self._bitsum(l)

    def bitadd(self, i, x):
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & - i
        return


n = int(input())
m = n * (n + 1) // 4
a = list(map(int, input().split()))
d = dict()
_a = sorted(set(a + [0]))
for i, x in enumerate(_a):
    d[x] = i
a = [d[x] for x in a]


def check(X):
    b = [0] + [(y >= X) * 2 - 1 for y in a]
    for i in range(n):
        b[i + 1] += b[i]
    c = min(b)
    b = [x - c for x in b]
    bit = BIT(max(b) + 2)
    ans = 0
    for x in b:
        ans += bit.bitsum(x + 1)
        bit.bitadd(x, 1)
    return ans >= m


t = [len(_a), 0]
while t[0] - t[1] > 1:
    mid = (t[0] + t[1]) // 2
    t[check(mid)] = mid
print(_a[t[1]])


user: import java.io.BufferedInputStream;
import java.util.Arrays;
import java.util.Scanner;

public class atcoder_ABC107_D {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedInputStream(System.in));
        int N = scan.nextInt();
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) arr[i] = scan.nextInt();
        Task tsk = new Task();
        System.out.println(tsk.solve(arr));
    }

    static class Task {
        public int solve(int[] arr) {
            int n = arr.length;
            int[] sorted = Arrays.copyOf(arr, n);
            Arrays.sort(sorted);
            long total = (long) n * (n + 1) / 2;
            int l = 0, r = n - 1;
            while (l < r) {
                int mid = l + (r - l) / 2;
                int target = sorted[mid];
                int cur = 0;
                long cnt = 0;
                long[] bit = new long[2 * n + 2];
                for (int x = n + 1; x < bit.length; x += x & -x) bit[x]++;
                for (int i = 0; i < n; i++) {
                    cur += arr[i] <= target ? 1 : -1;
                    for (int x = cur + n + 1; x < bit.length; x += x & -x) bit[x]++;
                    for (int x = cur + n; x > 0; x -= x & -x) cnt += bit[x];
                }
                if (cnt >= total / 2 + 1) r = mid;
                else l = mid + 1;
            }
            return sorted[l];
        }
    }
}
assistant: p = input().split(" ")
x1 = int(p[0])
y1 = int(p[1])
x2 = int(p[2])
y2 = int(p[3])
DIF1 = x2 - x1
DIF2 = y2 - y1
x3 = x2 - DIF2
y3 = y2 + DIF1
x4 = x1 - DIF2
y4 = y1 + DIF1
print(str(x3) + " " + str(y3) + " " + str(x4) + " " + str(y4))


user: import java.util.Scanner;

public class atcoder_ABC108_B {
    public static int[] revpos(int[] p, int[] q) {
        int[] vec = {0, 0};
        for (int i = 0; i < vec.length; i++) {
            vec[i] = p[i] - q[i];
        }
        int tmp = 0;
        tmp = vec[0];
        vec[0] = vec[1];
        vec[1] = -tmp;
        int[] newpos = {0, 0};
        for (int i = 0; i < newpos.length; i++) {
            newpos[i] = q[i] + vec[i];
        }
        return newpos;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] input = {0, 0, 0, 0};
        for (int i = 0; i < input.length; i++) {
            input[i] = scan.nextInt();
        }
        scan.close();
        int[][] position = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
        position[0][0] = input[0];
        position[0][1] = input[1];
        position[1][0] = input[2];
        position[1][1] = input[3];
        position[2] = revpos(position[0], position[1]);
        position[3] = revpos(position[1], position[2]);
        if (position[0] == revpos(position[2], position[3])) {
            System.out.println("OK");
        }
        int[] output = {0, 0, 0, 0};
        output[0] = position[2][0];
        output[1] = position[2][1];
        output[2] = position[3][0];
        output[3] = position[3][1];
        for (int i : output) {
            System.out.println(i);
        }
    }
}
assistant: from collections import defaultdict
n = int(input())
s = defaultdict(lambda: 0)
l = list([input() for i in range(n)])
f = 'Yes'
i = - 1
for v in l:
    s[v] += 1
    if s[v] >= 2:
        f = 'No'
    if i != - 1 and l[i][- 1] != v[0]:
        f = 'No'
    i += 1
print(f)


user: import java.util.HashMap;
import java.util.Scanner;

public class atcoder_ABC109_B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        HashMap<Integer, String> map = new HashMap<>();
        for (int i = 0; i < N; i++) {
            map.put(i, sc.next());
        }
        boolean ans = true;
        HashMap<Integer, String> past = new HashMap<>();
        String next = "";
        for (int i = 0; i < N; i++) {
            if (past.containsValue(map.get(i))) {
                ans = false;
                break;
            }
            past.put(i, map.get(i));
            if (i != 0) {
                if (!next.equals(map.get(i).substring(0, 1))) {
                    ans = false;
                    break;
                }
            }
            next = map.get(i).substring(map.get(i).length() - 1, map.get(i).length());
        }
        if (ans) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
assistant: import collections


def run(s, t):
    ss = sorted(list(collections.Counter(s).values()))
    tt = sorted(list(collections.Counter(t).values()))
    if ss == tt:
        return 'Yes'
    else:
        return 'No'


def main():
    s = input()
    t = input()
    print(run(s, t))


if __name__ == '__main__':
    main()


user: import java.util.Scanner;

public class atcoder_ABC110_C {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        sc.close();
        String[] A = {
            "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q",
            "r", "s", "t", "u", "v", "w", "x", "y", "z"
        };
        boolean res = true;
        for (String s : A) {
            int sIdx = S.indexOf(s);
            if (sIdx < 0) continue;
            String t = String.valueOf(T.charAt(sIdx));
            int idx = 0;
            while (idx < S.length()) {
                if (S.indexOf(s, idx) >= 0) {
                    if (S.indexOf(s, idx) != T.indexOf(t, idx)) {
                        res = false;
                        break;
                    } else {
                        idx = S.indexOf(s, idx) + 1;
                    }
                } else if (T.indexOf(t, idx) >= 0) {
                    res = false;
                    break;
                } else break;
            }
            if (!res) break;
        }
        if (res) System.out.println("Yes");
        else System.out.println("No");
    }
}