Buggy python submission (verdict: Runtime Error):
import numpy as np
n, m = (int(i) for i in input().split())
a = np.sort(np.array([float(i) for i in input().split()]))
b, c = np.zeros(m), np.zeros(m)
for i in range(m):
    b[i], c[i] = (float(i) for i in input().split())

b = b[np.argsort(-c)]
c = c[np.argsort(-c)]
i = 0
for bb, cc in zip(b, c):
    for cnt in range(int(bb)):
        if a[i] < cc:
            a[i] = cc
        else:
            break
        i = i + 1
    else:
        continue
    break
print(int(sum(a)))

Fixed submission:
import numpy as np
n, m = (int(i) for i in input().split())
a = np.sort(np.array([int(i) for i in input().split()], dtype='int64'))
b, c = np.zeros(m, dtype='int64'), np.zeros(m, dtype='int64')
for i in range(m):
    b[i], c[i] = (int(i) for i in input().split())

b = b[np.argsort(-c)]
c = c[np.argsort(-c)]
i = 0
for bb, cc in zip(b, c):
    for cnt in range(bb):
        if a[i] < cc:
            a[i] = cc
        else:
            break
        i = i + 1
        if i >= len(a):
            break
    else:
        continue
    break
print(int(sum(a)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n, m = (int(i) for i in input().split())
a = np.sort(np.array([int(i) for i in input().split()]))
b, c = np.zeros(m), np.zeros(m)
for i in range(m):
    b[i], c[i] = (int(i) for i in input().split())

b = b[np.argsort(-c)]
c = c[np.argsort(-c)]
i = 0
for bb, cc in zip(b, c):
    for cnt in range(int(bb)):
        if a[i] < cc:
            a[i] = cc
        else:
            break
        i = i + 1
    else:
        continue
    break
print(sum(a))

Fixed submission:
import numpy as np
n, m = (int(i) for i in input().split())
a = np.sort(np.array([int(i) for i in input().split()], dtype='int64'))
b, c = np.zeros(m, dtype='int64'), np.zeros(m, dtype='int64')
for i in range(m):
    b[i], c[i] = (int(i) for i in input().split())

b = b[np.argsort(-c)]
c = c[np.argsort(-c)]
i = 0
for bb, cc in zip(b, c):
    for cnt in range(bb):
        if a[i] < cc:
            a[i] = cc
        else:
            break
        i = i + 1
        if i >= len(a):
            break
    else:
        continue
    break
print(int(sum(a)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n, m = (int(i) for i in input().split())
a = np.sort(np.array([int(i) for i in input().split()]))
b, c = np.zeros(m), np.zeros(m)
for i in range(m):
    b[i], c[i] = (int(i) for i in input().split())

b = b[np.argsort(-c)]
c = c[np.argsort(-c)]
i = 0
for bb, cc in zip(b, c):
    for cnt in range(int(bb)):
        if a[i] < cc:
            a[i] = cc
        else:
            break
        i = i + 1
    else:
        continue
    break
print(sum(a))

Fixed submission:
import numpy as np
n, m = (int(i) for i in input().split())
a = np.sort(np.array([int(i) for i in input().split()], dtype='int64'))
b, c = np.zeros(m, dtype='int64'), np.zeros(m, dtype='int64')
for i in range(m):
    b[i], c[i] = (int(i) for i in input().split())

b = b[np.argsort(-c)]
c = c[np.argsort(-c)]
i = 0
for bb, cc in zip(b, c):
    for cnt in range(bb):
        if a[i] < cc:
            a[i] = cc
        else:
            break
        i = i + 1
        if i >= len(a):
            break
    else:
        continue
    break
print(int(sum(a)))