Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    A = list(map(int, input().split()))

    A = [0] + A
    b = A[:]
    n = N // 2 + 1
    m = sum(b[n:])
    for i in range(n - 1, 0, -1):
        sum_ = sum([v for j, v in enumerate(b) if not j % i])
        if A[i] != sum_ % 2:
            b[i] = (b[i] + 1) % 2
        m += b[i]

    print(m)
    if m:
        print(*[i for i, v in enumerate(b) if v])


main()


Fixed submission:
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    A = list(map(int, input().split()))

    A = [0] + A
    b = A[:]
    n = N // 2 + 1
    m = sum(b[n:])
    for i in range(n - 1, 0, -1):
        sum_ = sum([b[j] for j in range(i, N + 1, i)])
        if A[i] != sum_ % 2:
            b[i] = (b[i] + 1) % 2
        m += b[i]

    print(m)
    if m:
        print(*[i for i, v in enumerate(b) if v])


main()
Buggy python submission (verdict: Runtime Error):
from collections import Counter
from sys import stdin

def main():
    N = int(input())
    A = map(int, input().split())

    cnt = Counter(A).most_common()
    n = N // 3
    l = len(cnt)
    if cnt[0][0] == 0 and l == 1:
        print('Yes')
        return
    if cnt[1][0] == 0 and cnt[1][1] == n and l == 2:
        print('Yes')
        return
    if N % 3:
        print('No')
        return

    if cnt[0][0] ^ cnt[1][0] == cnt[2][0] and cnt[0][1] == cnt[1][1] == n:
        print('Yes')
    else:
        print('No')

input = lambda: stdin.readline()
main()


Fixed submission:
from collections import Counter
from sys import stdin

def main():
    N = int(input())
    A = map(int, input().split())

    cnt = Counter(A).most_common()
    n = N // 3
    l = len(cnt)
    if l == 1:
        if cnt[0][0] == 0:
            print('Yes')
        else:
            print('No')
        return
    if l == 2:
        if cnt[1][0] == 0 and cnt[1][1] == n:
            print('Yes')
        else:
            print('No')
        return
    if l > 3 or N % 3:
        print('No')
        return

    if cnt[0][0] ^ cnt[1][0] == cnt[2][0] and cnt[0][1] == cnt[1][1] == n:
        print('Yes')
    else:
        print('No')

input = lambda: stdin.readline()
main()
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from sys import stdin

def main():
    N = int(input())
    XY = [tuple(map(int, input().split())) for _ in [0] * N]

    XY.sort()
    cnt = defaultdict(int)
    x1, y1 = XY[0]
    for x2, y2 in XY[1:]:
        x = x2 - x1
        y = y2 - y1
        cnt[(x, y)] += 1
        x1, y1 = x2, y2
    print(N - max(cnt.values()))

input = lambda: stdin.readline()
main()


Fixed submission:
from collections import defaultdict
from sys import stdin

def main():
    N = int(input())
    XY = [tuple(map(int, input().split())) for _ in [0] * N]

    if N == 1:
        print(1)
        return

    XY.sort()
    cnt = defaultdict(int)
    for i in range(N):
        x1, y1 = XY[i]
        for j in range(i + 1, N):
            x2, y2 = XY[j]
            p = x2 - x1
            q = y2 - y1
            cnt[(p, q)] += 1
    print(N - max(cnt.values()))

input = lambda: stdin.readline()
main()
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define sorted(a) sort(a.begin(), a.end());
#define ALL(a) (a).begin(), (a).end()
typedef long long unsigned int ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int A, B;
  cin >> A >> B;

  if (A > 12) {
    cout << B << endl;
  } else if (A < 6) {
    cout << 0 << endl;
  } else {
    cout << B / 2 << endl;
  }

  return 0;
}


Fixed submission:
from sys import stdin

def main():
    A, B = map(int, input().split())

    if A > 12:
        print(B)
    elif 6 <= A <= 12:
        print(B // 2)
    else:
        print(0)

input = lambda: stdin.readline()
main()
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def main():
    N, Q = map(int, input().split())
    S = input()
    LR = [tuple(map(int, input().split())) for _ in [0] * Q]

    for l, r in LR:
        n = S[l-1:r].count('AC')
        print(n)

input = lambda: stdin.readline().rstrip()
main()


Fixed submission:
from sys import stdin

def main():
    N, Q = map(int, input().split())
    S = input()
    LR = [tuple(map(int, input().split())) for _ in [0] * Q]

    cnt = [0] * N
    prev = ''
    for i, s in enumerate(S):
        if prev + s == 'AC':
            cnt[i] = cnt[i-1] + 1
        else:
            cnt[i] = cnt[i-1]
        prev = s

    for l, r in LR:
        n = cnt[r-1] - cnt[l-1]
        print(n)

input = lambda: stdin.readline().rstrip()
main()
Buggy python submission (verdict: Runtime Error):
from sys import stdin

def main():
    N, M = map(int, input().split())
    X = list(map(int, input().split()))

    if N >= M:
        print(0)
        return

    X.sort()
    n = [(i + 1, X[i+1] - X[i]) for i in range(M - 1)]
    n.sort(reverse=1, key=lambda x: x[1])
    ans, s1 = 0, 0
    for i in range(N - 1):
        s2 = n[i][0]
        ans += X[s1:s2][-1] - X[s1:s2][0]
        s1 = s2
    ans += X[s1:][-1] - X[s1:][0]
    print(ans)

input = lambda: stdin.readline()
main()


Fixed submission:
from sys import stdin

def main():
    N, M = map(int, input().split())
    X = list(map(int, input().split()))

    if N >= M:
        print(0)
        return

    X.sort()
    n1 = [(i + 1, X[i+1] - X[i]) for i in range(M - 1)]
    n1.sort(reverse=1, key=lambda x: x[1])
    n2 = n1[:N-1]
    n2.sort()

    ans, i = 0, 0
    for j, _ in n2:
        ans += X[i:j][-1] - X[i:j][0]
        i = j
    ans += X[i:][-1] - X[i:][0]
    print(ans)

input = lambda: stdin.readline()
main()
Buggy python submission (verdict: Runtime Error):
from sys import stdin

def main():
    N = int(input())
    AB = [tuple(map(int, input().split())) for _ in [0] * N]

    disha = sorted(AB)
    dishb = sorted(disha, key=lambda x: x[1])
    taka, aoki = 0, 0
    dish = set()
    for i in range(N):
        if i % 2:
            while dishb[-1] in dish:
                dishb.pop(-1)
            aoki += dishb[-1][1]
            dish.add(dishb[-1])
            dishb.pop(-1)
        else:
            while disha[-1] in dish:
                disha.pop(-1)
            taka += disha[-1][0]
            dish.add(disha[-1])
            disha.pop(-1)
    print(taka - aoki)

input = lambda: stdin.readline()
main()


Fixed submission:
from sys import stdin
 
def main():
    N = int(input())
    AB = [tuple(map(int, input().split())) for _ in [0] * N]
 
    dish = sorted(AB, reverse=1, key=lambda x: sum(x))
    taka, aoki = 0, 0
    for i in range(N):
        aoki += dish[i][1]
        if not i % 2:
            taka += sum(dish[i])
    print(taka - aoki)
 
input = lambda: stdin.readline()
main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin

def main():
    N = int(input())
    AB = [tuple(map(int, input().split())) for _ in [0] * N]

    disha = sorted(AB)
    dishb = sorted(disha, key=lambda x: x[1])
    taka, aoki = 0, 0
    for i in range(N):
        if i % 2:
            if dishb[-1] == 0:
                dishb.pop(-1)
            aoki += dishb[-1][1]
            j = disha.index(dishb[-1])
            disha[j] = 0
            dishb.pop(-1)
        else:
            if disha[-1] == 0:
                disha.pop(-1)
            taka += disha[-1][0]
            j = dishb.index(disha[-1])
            dishb[j] = 0
            disha.pop(-1)
    print(taka - aoki)

input = lambda: stdin.readline()
main()


Fixed submission:
from sys import stdin
 
def main():
    N = int(input())
    AB = [tuple(map(int, input().split())) for _ in [0] * N]
 
    dish = sorted(AB, reverse=1, key=lambda x: sum(x))
    taka, aoki = 0, 0
    for i in range(N):
        aoki += dish[i][1]
        if not i % 2:
            taka += sum(dish[i])
    print(taka - aoki)
 
input = lambda: stdin.readline()
main()
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
from sys import stdin, stdout

input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    N, M = map(int, input().split())
    A = map(int, input().split())

    snacks = [0] + list(accumulate(A))
    cnt = 0
    for i in range(N + 1):
        for j in range(i + 1, N + 1):
            if not (snacks[j] - snacks[i]) % M:
                cnt += 1
    print(cnt)

main()


Fixed submission:
from collections import defaultdict
from sys import stdin, stdout

input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    N, M = map(int, input().split())
    A = tuple(map(int, input().split()))

    sum_ = [0] * (N + 1)
    for i in range(N):
        sum_[i+1] = (sum_[i] + A[i]) % M

    ans = 0
    mod = defaultdict(int)
    for i in range(N + 1):
        ans += mod[sum_[i]]
        mod[sum_[i]] += 1

    print(ans)

main()
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
println = stdout.write

def main():
    N, M = map(int, input().split())
    XYZ = [tuple(map(int, input().split())) for _ in [0] * N]

    ans = -float('inf')
    for cake in combinations(XYZ, M):
        x, y, z = 0, 0, 0
        for i, j, k in cake:
            x += i; y += j; z += k
        for xm in (x, -x):
            for ym in (y, -y):
                for zm in (z, -z):
                    ans = max(ans, xm + ym + zm)
    print(ans)

main()


Fixed submission:
from itertools import combinations, product
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
println = stdout.write

def main():
    N, M = map(int, input().split())
    XYZ = [tuple(map(int, input().split())) for _ in [0] * N]

    cake = [0] * N
    ans = -float('inf')
    for kx, ky, kz in product((1, -1), repeat=3):
        for i, (x, y, z) in enumerate(XYZ):
            cake[i] = sum((x * kx, y * ky, z * kz))
        cake.sort(reverse=1)
        ans = max(ans, sum(cake[:M]))
    print(ans)

main()

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
println = stdout.write

def main():
    N, M = map(int, input().split())
    XYZ = [tuple(map(int, input().split())) for _ in [0] * N]

    ans = -float('inf')
    for cake in combinations(XYZ, M):
        x, y, z = 0, 0, 0
        for i, j, k in cake:
            x += i; y += j; z += k
        for xm in (x, -x):
            for ym in (y, -y):
                for zm in (z, -z):
                    ans = max(ans, xm + ym + zm)
    print(ans)

main()


Fixed submission:
from itertools import combinations, product
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
println = stdout.write

def main():
    N, M = map(int, input().split())
    XYZ = [tuple(map(int, input().split())) for _ in [0] * N]

    cake = [0] * N
    ans = -float('inf')
    for kx, ky, kz in product((1, -1), repeat=3):
        for i, (x, y, z) in enumerate(XYZ):
            cake[i] = sum((x * kx, y * ky, z * kz))
        cake.sort(reverse=1)
        ans = max(ans, sum(cake[:M]))
    print(ans)

main()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

def main():
    S = input()
    K = int(input())

    lst = []
    apnd = lst.append
    l = len(S)
    for n in range(1, l + 1):
        for i in range(l - n + 1):
            apnd(S[i:i+n])

    lst = sorted(set(lst))
    print(lst[K-1])

main()


Fixed submission:
def main():
    S = input()
    K = int(input())

    lst = list(S)
    apnd = lst.append
    l = len(S)
    for n in range(2, 6):
        for i in range(l - n + 1):
            apnd(S[i:i+n])

    lst = sorted(set(lst))
    print(lst[K-1])

main()
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate

def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = [0] + list(accumulate(A))
    cnt = 0
    fin = set()
    for i in a:
        n = a.count(i) - 1
        if i not in fin:
            cnt += n * (n + 1) // 2
            fin.add(i)
    print(cnt)

main()


Fixed submission:
from itertools import accumulate
from collections import Counter

def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = [0] + list(accumulate(A))
    num = Counter(a)
    lst = set(a)
    cnt = 0
    for i in lst:
        n = num[i] - 1
        cnt += n * (n + 1) // 2
    print(cnt)

main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = list(map(int, input().split()))

    a = [0] + A + [0]
    dist = 0
    for i in range(N + 1):
        dist += abs(a[i] - a[i+1])

    for i in range(1, N + 1):
        cost = dist - abs(a[i-1] - a[i]) - abs(a[i] - a[i+1]) + abs(a[i-1] - a[i+1])
        print(cost)

main()


Fixed submission:
def main():
    N, X = map(int, input().split())
    M = tuple(int(input()) for _ in [0] * N)

    donuts = 0
    for i in M:
        X -= i
        donuts += 1
    donuts += X // min(M)
    print(donuts)

main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    H, W, D = map(int, input().split())
    A = tuple(tuple(map(int, input().split())) for _ in [0] * H)
    Q = int(input())
    LR = tuple(tuple(map(int, input().split())) for _ in [0] * Q)

    grid = dict()
    for i, a in enumerate(A):
        for j, b in enumerate(a):
            grid[b] = (i, j)

    for l, r in LR:
        power = 0
        while 1:
            if l == r:
                break
            else:
                i, j = grid[l]
                x, y = grid[l+D]
                power += abs(x - i) + abs(y - j)
                l += D
        print(power)

main()


Fixed submission:
def main():
    H, W, D = map(int, input().split())
    A = tuple(tuple(map(int, input().split())) for _ in [0] * H)
    Q = int(input())
    LR = tuple(tuple(map(int, input().split())) for _ in [0] * Q)

    grid = dict()
    for i, a in enumerate(A):
        for j, b in enumerate(a):
            grid[b] = (i + 1, j + 1)

    l = H * W
    dist = [0] * (l + 1)
    for i in range(l, 0, -1):
        if i + D <= l:
            dist[i] = abs(grid[i][0] - grid[i+D][0]) + abs(grid[i][1] - grid[i+D][1]) + dist[i+D]
        else:
            dist[i] = 0

    for l, r in LR:
        print(dist[l] - dist[r])

main()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
from collections import defaultdict
from collections import Counter
from itertools import permutations

def main():
    Q = int(input())
    LR = tuple(tuple(map(int, input().split())) for _ in [0] * Q)

    for l, r in LR:
        cnt = 0
        for i in range(l, r + 1, 2):
            x = (i + 1) // 2
            if is_prime(i) and is_prime(x):
                cnt += 1
        print(cnt)

def is_prime(n):
    if n < 2:
        return False
    else:
        for i in range(2, n):
            if i * i > n:
                break
            elif n % i == 0:
                return False
        return True

main()


Fixed submission:
import bisect

def main():
    Q = int(input())
    LR = tuple(tuple(map(int, input().split())) for _ in [0] * Q)

    l = min(LR)[0]
    r = max(LR, key=lambda x: x[1])[1]
    num = []
    apnd = num.append
    for i in range(l, r + 1, 2):
        x = (i + 1) // 2
        if is_prime(i) and is_prime(x):
            apnd(i)

    for l, r in LR:
        x = bisect.bisect_left(num, l)
        y = bisect.bisect_right(num, r)
        print(y - x)

def is_prime(n):
    if n < 2:
        return False
    else:
        for i in range(2, n):
            if i * i > n:
                break
            elif n % i == 0:
                return False
        return True

main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    m = 0
    xy = []
    apnd = xy.append
    if min(a) == max(a):
        print(0)
        return
    elif min(a) < 0 and max(a) >= 0:
        if abs(min(a)) > max(a):
            x = min(a)
        else:
            x = max(a)
        idx = a.index(x)

    for i, j in enumerate(a):
        if j != x:
            a[i] += x
            m += 1
            apnd((idx + 1, i + 1))

    if min(a) >= 0:
        for i in range(N - 1):
            a[i+1] += a[i]
            m += 1
            apnd((i + 1, i + 2))
    elif max(a) < 0:
        for i in range(N - 1, 0, -1):
            a[i-1] += a[i]
            m += 1
            apnd((i + 1, i))

    print(m)
    for x, y in xy:
        print(x, y)

main()


Fixed submission:
def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    m = 0
    xy = []
    apnd = xy.append
    if min(a) == max(a):
        print(0)
        return
    elif min(a) < 0 and max(a) >= 0:
        if abs(min(a)) > max(a):
            x = min(a)
        else:
            x = max(a)
        idx = a.index(x)
        for i, j in enumerate(a):
            if j != x:
                a[i] += x
                m += 1
                apnd((idx + 1, i + 1))

    if min(a) >= 0:
        for i in range(N - 1):
            a[i+1] += a[i]
            m += 1
            apnd((i + 1, i + 2))
    elif max(a) < 0:
        for i in range(N - 1, 0, -1):
            a[i-1] += a[i]
            m += 1
            apnd((i + 1, i))

    print(m)
    for x, y in xy:
        print(x, y)

main()
Buggy python submission (verdict: Runtime Error):
def main():
    X, Y = map(int, input().split())

    if X > Y:
        print('>')
    elif X < Y:
        print('<')
    else:
        print('=')

main()


Fixed submission:
def main():
    X, Y = input().split()

    if X > Y:
        print('>')
    elif X < Y:
        print('<')
    else:
        print('=')

main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    B = tuple(map(int, input().split()))
    C = tuple(map(int, input().split()))

    b = [0] * 100002
    for i in B:
        b[i] += 1

    cnt = 0
    for i in A:
        for j in C:
            if i < j:
                cnt += sum(b[i+1:j])

    print(cnt)

main()


Fixed submission:
import bisect

def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    B = tuple(map(int, input().split()))
    C = tuple(map(int, input().split()))

    a = sorted(A)
    c = sorted(C)
    cnt = 0
    for i in B:
        x = bisect.bisect_left(a, i)
        y = bisect.bisect_right(c, i)
        cnt += x * (N - y)

    print(cnt)

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    B = tuple(map(int, input().split()))
    C = tuple(map(int, input().split()))

    cnt = 0
    for c in C:
        b = [i for i in B if i < c]
        lenb = len(b)
        if not lenb:
            continue
        for bi in b:
            a = [i for i in A if i < bi]
            lena = len(a)
            if not lena:
                continue
            else:
                cnt += lena

    print(cnt)

main()


Fixed submission:
import bisect

def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    B = tuple(map(int, input().split()))
    C = tuple(map(int, input().split()))

    a = sorted(A)
    c = sorted(C)
    cnt = 0
    for i in B:
        x = bisect.bisect_left(a, i)
        y = bisect.bisect_right(c, i)
        cnt += x * (N - y)

    print(cnt)

main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = map(int, input().split())
    XY = (tuple(map(int, input().split())) for _ in [0] * N)

    x = [0] * N
    y = [0] * N
    for i, (j, k) in enumerate(XY):
        x[i] = j
        y[i] = k

    ans = float('inf')
    for xi in range(N):
        for xj in range(N):
            if x[xi] >= x[xj]: continue
            for yi in range(N):
                for yj in range(N):
                    if y[yi] >= y[yj]: continue
                    cnt = 0
                    for i in range(N):
                        if x[xi] <= x[i] <= x[xj] and y[yi] <= y[i] <= y[yj]:
                            cnt += 1
                    if cnt >= K:
                        ans = min(ans, (x[xj] - x[xi]) * (y[yj] - y[yi]))

    print(ans)

main()


Fixed submission:
def main():
    N, K = map(int, input().split())
    XY = (tuple(map(int, input().split())) for _ in [0] * N)

    x = [0] * N
    y = [0] * N
    for i, (j, k) in enumerate(XY):
        x[i] = j
        y[i] = k

    ans = float('inf')
    for xi in range(N):
        for xj in range(N):
            if x[xi] >= x[xj]: continue
            for yi in range(N):
                for yj in range(N):
                    if y[yi] >= y[yj]: continue
                    cnt = 0
                    for i in range(N):
                        if x[xi] <= x[i] <= x[xj] and y[yi] <= y[i] <= y[yj]:
                            cnt += 1
                    if cnt >= K:
                        ans = min(ans, (x[xj] - x[xi]) * (y[yj] - y[yi]))

    print(ans)

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = map(int, input().split())
    XY = (tuple(map(int, input().split())) for _ in [0] * N)

    x = [0] * N
    y = [0] * N
    for i, (j, k) in enumerate(XY):
        x[i] = j
        y[i] = k

    ans = float('inf')
    for xi in range(N):
        for xj in range(N):
            for yi in range(N):
                for yj in range(N):
                    cnt = 0
                    for i in range(N):
                        if x[xi] <= x[i] <= x[xj] and y[yi] <= y[i] <= y[yj]:
                            cnt += 1
                    if cnt >= K:
                        ans = min(ans, (x[xj] - x[xi]) * (y[yj] - y[yi]))

    print(ans)

main()


Fixed submission:
def main():
    N, K = map(int, input().split())
    XY = (tuple(map(int, input().split())) for _ in [0] * N)

    x = [0] * N
    y = [0] * N
    for i, (j, k) in enumerate(XY):
        x[i] = j
        y[i] = k

    ans = float('inf')
    for xi in range(N):
        for xj in range(N):
            if x[xi] >= x[xj]: continue
            for yi in range(N):
                for yj in range(N):
                    if y[yi] >= y[yj]: continue
                    cnt = 0
                    for i in range(N):
                        if x[xi] <= x[i] <= x[xj] and y[yi] <= y[i] <= y[yj]:
                            cnt += 1
                    if cnt >= K:
                        ans = min(ans, (x[xj] - x[xi]) * (y[yj] - y[yi]))

    print(ans)

main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    D = tuple(map(int, input().split()))
    M = int(input())
    T = tuple(map(int, input().split()))

    problem = dict()
    for i in D:
        problem[i] = problem.get(i, 0) + 1

    for i in T:
        if i in D:
            problem[i] -= 1
            if problem[i] < 0:
                ans = 'NO'
                break
        else:
            ans = 'NO'
            break
    else:
        ans = 'YES'

    print(ans)

main()


Fixed submission:
def main():
    N = int(input())
    D = tuple(map(int, input().split()))
    M = int(input())
    T = tuple(map(int, input().split()))

    d = dict()
    for i in D:
        d[i] = d.get(i, 0) + 1

    t = dict()
    for i in T:
        t[i] = t.get(i, 0) + 1

    for key, val in t.items():
        if key in d.keys():
            d[key] -= val
            if d[key] < 0:
                ans = 'NO'
                break
        else:
            ans = 'NO'
            break
    else:
        ans = 'YES'

    print(ans)

main()