Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import Counter

def check(A):
    N = len(A)
    even = Counter()
    odd = Counter()
    for i, a in enumerate(A):
        if i % 2 == 0:
            odd[a] += 1
        else:
            even[a] += 1
    
    even = even.most_common() + [(None, 0)]
    odd = odd.most_common() + [(None, 0)]
    
    if even[0][0] != odd[0][0]:
        return N - even[0][1] - odd[0][1]
    else:
        return min(N - even[0][1] - odd[1][1], N - odd[0][1] - even[1][1])
    
A = map(int, raw_input.split())
ans = check(A)
print A

Fixed submission:
from collections import Counter


def check(A):
    N = len(A)
    even = Counter()
    odd = Counter()
    for i, a in enumerate(A):
        if i % 2 == 0:
            odd[a] += 1
        else:
            even[a] += 1
    
    even = even.most_common() + [(None, 0)]
    odd = odd.most_common() + [(None, 0)]
    
    if even[0][0] != odd[0][0]:
        return N - even[0][1] - odd[0][1]
    else:
        return min(N - even[0][1] - odd[1][1], N - odd[0][1] - even[1][1])

N = int(raw_input())
A = map(int, raw_input().split())

ans = check(A)
print ans
Buggy python submission (verdict: Runtime Error):
import sys

S = sys.stdin.readline().strip()

pl = 0
pr = len(S)

res = 0

while pl < pr:
    cnt = 0

    while S[pl] == 'x':
        cnt += 1
        pl += 1

    while S[pr - 1] == 'x':
        cnt -= 1
        pr -= 1

    res += abs(cnt)

    if S[pl] != S[pr - 1]:
        print(-1)
        sys.exit()

    pl += 1
    pr -= 1

print(res)


Fixed submission:
import sys

S = sys.stdin.readline().strip()

N = len(S)

pl = 0
pr = N

res = 0

while pl < pr:
    cnt = 0

    while pl < N and S[pl] == 'x':
        cnt += 1
        pl += 1

    while 0 < pr and S[pr - 1] == 'x':
        cnt -= 1
        pr -= 1

    res += abs(cnt)

    if 0 < pr and pl < N and S[pl] != S[pr - 1]:
        print(-1)
        sys.exit()

    pl += 1
    pr -= 1

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations

def input_list():
    return list(map(int, input().split()))

n, m, r = input_list()
rlist = input_list()
rlist = [r-1 for r in rlist]
d = [[float('inf')]*n for i in range(n)]
for i in range(n):
    d[i][i] = 0
    
for i in range(m):
    a, b, c = input_list()
    d[a-1][b-1] = c
    d[b-1][a-1] = c

for k in range(n):
    for i in range(n):
        for j in range(n):
            distance = d[i][k]+d[k][j]
            if d[i][j] > distance:
                d[i][j] = distance

ans = float('inf')
for p in permutations(rlist):
    distance = 0
    for i in range(r-1):
        distance += d[p[i]][p[i+1]]

    if ans > distance:
        ans = distance

print(ans)
        


Fixed submission:
from itertools import permutations

def input_list():
    return list(map(int, input().split()))

def main():
    n, m, r = input_list()
    rlist = input_list()
    rlist = [r-1 for r in rlist]
    d = [[float('inf')]*n for i in range(n)]
    for i in range(n):
        d[i][i] = 0
    
    for i in range(m):
        a, b, c = input_list()
        d[a-1][b-1] = c
        d[b-1][a-1] = c

    for k in range(n):
        for i in range(n):
            for j in range(n):
                distance = d[i][k]+d[k][j]
                if d[i][j] > distance:
                    d[i][j] = distance

    ans = float('inf')
    for p in permutations(rlist):
        distance = 0
        for i in range(r-1):
            distance += d[p[i]][p[i+1]]

        if ans > distance:
            ans = distance

    print(ans)

main()
Buggy python submission (verdict: Runtime Error):
import functools
import math

def gcd(x,y):
    a,b = max(x,y), min(x,y)
    while a % b != 0:
        a,b = b,a%b

    return b

def lcm2(x,y):
    return int(x*y / gcd(x,y))
    
N = int(input())
T = []
for i in range(N):
    ti = int(input())
    T.append(ti)

result = 1
for t in T:
    result = lcm2(result, t)

print(result)


    

Fixed submission:
import functools
import math

def gcd(x,y):
    a,b = max(x,y), min(x,y)
    while b != 0:
        a,b = b,a%b

    return a

def lcm2(x,y):
    return x*y // gcd(x,y)
    
N = int(input())
T = []
for i in range(N):
    ti = int(input())
    T.append(ti)

result = 1
for t in T:
    result = lcm2(result, t)

print(result)

Buggy python submission (verdict: Runtime Error):
import functools
import math

def gcd(x,y):
    a,b = max(x,y), min(x,y)
    while a % b != 0:
        a,b = b,a%b

    return b
    

def lcm2(x,y):
    return int(x*y / gcd(x,y))

def lcm_lot(nums):
    return functools.reduce(lcm2, nums, 1)

N = int(input())
T = []
for i in range(N):
    ti = int(input())
    T.append(ti)

print(lcm_lot(T))


    


Fixed submission:
import functools
import math

def gcd(x,y):
    a,b = max(x,y), min(x,y)
    while b != 0:
        a,b = b,a%b

    return a

def lcm2(x,y):
    return x*y // gcd(x,y)
    
N = int(input())
T = []
for i in range(N):
    ti = int(input())
    T.append(ti)

result = 1
for t in T:
    result = lcm2(result, t)

print(result)

Buggy python submission (verdict: Runtime Error):
import functools
import math

def lcm2(x,y):
    return x*y // math.gcd(x,y)

def lcm_lot(nums):
    return functools.reduce(lcm2, nums, 1)

N = int(input())
T = []
for i in range(N):
    ti = int(input())
    T.append(ti)

print(lcm_lot(T))

Fixed submission:
import functools
import math

def gcd(x,y):
    a,b = max(x,y), min(x,y)
    while b != 0:
        a,b = b,a%b

    return a

def lcm2(x,y):
    return x*y // gcd(x,y)
    
N = int(input())
T = []
for i in range(N):
    ti = int(input())
    T.append(ti)

result = 1
for t in T:
    result = lcm2(result, t)

print(result)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import scipy.special as ss
N, A, B = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
v = np.array(v)
##print(v)
ansarray = v[0:A]
##print(ansarray)
ave = np.mean(ansarray)
print(float(ave))
mi = min(ansarray)
ma = max(ansarray)
biggerarray = v[v>mi]
m = len(biggerarray)
numminarray = v[v==mi]
a = len(numminarray)
##print(nummin)
##print(num_kouho)
ans = 0
if ma == mi:
    if m+a <= B:
        for i in range(A-m,a+1):
            ans+=ss.comb(a,i)
    else:
        for i in range(A-m,B-m+1):
            ans+=ss.comb(a,i)

else:
    ans = a
#print('a=',a)
#print('m=',m)
print(int(ans))
    


Fixed submission:
import numpy as np
import math
def ncm(n,m):
    return math.factorial(n)/(math.factorial(m) * math.factorial(n-m))

N, A, B = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
v = np.array(v)
##print(v)
ansarray = v[0:A]
##print(ansarray)
ave = np.mean(ansarray)
print(float(ave))
mi = min(ansarray)
ma = max(ansarray)
biggerarray = v[v>mi]
m = len(biggerarray)
numminarray = v[v==mi]
a = len(numminarray)
##print(nummin)
##print(num_kouho)
ans = 0
if ma == mi:
    if m+a <= B:
        for i in range(A-m,a+1):
            ans+=ncm(a,i)
    else:
        for i in range(A-m,B-m+1):
            ans+=ncm(a,i)

else:
    ans = ncm(a,A-m)
#print('a=',a)
#print('m=',m)
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import numpy as np
import scipy.special as ss
N, A, B = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
v = np.array(v)
##print(v)
ansarray = v[0:A]
##print(ansarray)
ave = np.mean(ansarray)
print(ave)
mi = min(ansarray)
ma = max(ansarray)
biggerarray = v[v>mi]
m = len(biggerarray)
numminarray = v[v==mi]
a = len(numminarray)
##print(nummin)
##print(num_kouho)
ans = 0
if ma == mi:
    if m+a <= B:
        for i in range(A-m,a+1):
            ans+=ss.comb(a,i)
    else:
        for i in range(A-m,B-m+1):
            ans+=ss.comb(a,i)

else:
    ans = a
#print('a=',a)
#print('m=',m)
print(int(ans))

Fixed submission:
import numpy as np
import math
def ncm(n,m):
    return math.factorial(n)/(math.factorial(m) * math.factorial(n-m))

N, A, B = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
v = np.array(v)
##print(v)
ansarray = v[0:A]
##print(ansarray)
ave = np.mean(ansarray)
print(float(ave))
mi = min(ansarray)
ma = max(ansarray)
biggerarray = v[v>mi]
m = len(biggerarray)
numminarray = v[v==mi]
a = len(numminarray)
##print(nummin)
##print(num_kouho)
ans = 0
if ma == mi:
    if m+a <= B:
        for i in range(A-m,a+1):
            ans+=ncm(a,i)
    else:
        for i in range(A-m,B-m+1):
            ans+=ncm(a,i)

else:
    ans = ncm(a,A-m)
#print('a=',a)
#print('m=',m)
print(int(ans))
Buggy python submission (verdict: Runtime Error):
nmax = 8
def dfs(v, N, visited):
    all_visited=True
    for i in range(N):
        if visited[i]==False:
            all_visited=False

    if all_visited==True:
        return 1

    ret=0
    for i in range(N):
        if graph[v][i]==False:
            continue
        if visited[i]==True:
            continue

        visited[i]=True
        ret+=dfs(i,N,visited)
        visited[i]=False

    return ret

N, M = map(int, input().split())
graph = [[False]*M for i in range(N)]
for i in range(M):
    A, B = map(int, input().split())
    graph[A-1][B-1]=True
    graph[B-1][A-1]=True

visited = [False]*N

visited[0]=True
print(dfs(0,N,visited))

Fixed submission:
nmax = 8
def dfs(v, N, visited):
    all_visited=True
    for i in range(N):
        if visited[i]==False:
            all_visited=False

    if all_visited==True:
        return 1

    ret=0
    for i in range(N):
        if graph[v][i]==False:
            continue
        if visited[i]==True:
            continue

        visited[i]=True
        ret+=dfs(i,N,visited)
        visited[i]=False

    return ret

N, M = map(int, input().split())
graph = [[False]*N for i in range(N)]
for i in range(M):
    A, B = map(int, input().split())
    graph[A-1][B-1]=True
    graph[B-1][A-1]=True

visited = [False]*N

visited[0]=True
print(dfs(0,N,visited))
Buggy python submission (verdict: Runtime Error):
input = raw_input
range = xrange

n, m = map(int,input().split())
grid = [input() for i in range(n)]

use = [False]*n
cur = []
def backtrack(i, rem):
    if rem == 0: return check(cur)
    if use[i]: return backtrack(i+1, rem)
    if rem == 1:
        use[i] = True; cur.append(i)
        backtrack(i+1, 0)
        use[i] = False; cur.pop()
    use[i] = True; cur.append(i)
    for j in range(i+1, n):
        if use[j]: continue
        use[j] = True; cur.append(j)
        backtrack(i+1, rem-2)
        use[j] = False; cur.pop()
    use[i] = False; cur.pop()

middle_initial = (n%2 == 0)
from collections import Counter
def check(cur):
    P = cur[::2] + cur[1::2][::-1]
    cols = Counter((''.join(grid[P[i]][j] for i in range(n))) for j in range(m))
    middle_filled = middle_initial
    rem = n
    while rem:
        w = next(iter(cols))
        cols[w]-= 1; rem-= 1
        if cols[w] == 0: del cols[w]
        w2 = w[::-1]
        if w2 in cols:
            assert cols[w2]
            cols[w2]-= 1; rem-= 1
            if cols[w2] == 0: del cols[w2]
        elif w == w[::-1] and not middle_filled:
            middle_filled = True
        else: return False
    print("YES"); exit()

backtrack(0, n)
print("NO")

Fixed submission:
input = raw_input
range = xrange

n, m = map(int,input().split())
grid = [input() for i in range(n)]

use = [False]*n
cur = []
def backtrack_even(i, rem, addwhat):
    if rem == 0:
        if addwhat != None: cur.append(addwhat)
        check(cur)
        if addwhat != None: cur.pop()
        return
    if use[i]: return backtrack_even(i+1, rem, addwhat)
    use[i] = True; cur.append(i)
    for j in range(i+1, n):
        if use[j]: continue
        use[j] = True; cur.append(j)
        backtrack_even(i+1, rem-2, addwhat)
        use[j] = False; cur.pop()
    use[i] = False; cur.pop()

def backtrack():
    if n%2 == 0: return backtrack_even(0, n, None)
    for i in range(n):
        use[i] = True
        backtrack_even((0 if i else 1), n-1, i)
        use[i] = False

middle_initial = (m%2 == 0)
from collections import Counter
def check(cur):
    P = cur[::2] + cur[1::2][::-1]
    cols = Counter((''.join(grid[P[i]][j] for i in range(n))) for j in range(m))
    #print(cur, P, cols)
    middle_filled = middle_initial
    rem = m
    while rem:
        w = next(iter(cols))
        cols[w]-= 1; rem-= 1
        if cols[w] == 0: del cols[w]
        w2 = w[::-1]
        if w2 in cols:
            assert cols[w2]
            cols[w2]-= 1; rem-= 1
            if cols[w2] == 0: del cols[w2]
        elif w == w[::-1] and not middle_filled:
            middle_filled = True
        else: return False
    print("YES"); exit()

backtrack()
print("NO")
Buggy python submission (verdict: Runtime Error):
input = __import__('sys').stdin.readline
MIS = lambda: map(int,input().split())

# f(a) = z                 a <= x1
#        a+z-x1      x1 <= a <= x2
#        x2+z-x1     x2 <= a
class Sandgraph:
    def __init__(_, X):
        _.z = _.x1 = 0
        _.x2 = X
    
    def __repr__(_):
        return f"<{_.z} {_.x1} {_.x2}>"
    
    def add(_, dt):
        # Go towards the ceiling
        d1 = min(dt, X-(_.x2+_.z-_.x1))
        _.z+= d1
        dt-= d1
        # Reduce the diagonal
        d1 = min(dt, _.x2-_.x1)
        _.z+= d1
        _.x2-= d1
    
    def sub(_, dt):
        # Go towards the floor
        d1 = min(dt, _.z)
        _.z-= d1
        dt-= d1
        # Reduce the diagonal
        d1 = min(dt, _.x2-_.x1)
        _.x1+= d1
    
    def __call__(_, a):
        if a <= _.x1: return _.z
        elif a <= _.x2: return a + _.z - _.x1
        else: return _.x2 + _.z - _.x1

X = int(input())
k = int(input())
rev = list(MIS())
Q = int(input())
sand = Sandgraph(X)

last_t = 0
i = 0 # even -, odd +
for QUERY in range(Q):
    t, a = MIS()
    while i<k and rev[i] <= t:
        dt = rev[i] - last_t
        if i%2 == 0: sand.sub(dt)
        else: sand.add(dt)
        last_t = rev[i]
        i+= 1
    dt = t - last_t
    if i%2 == 0: sand.sub(dt)
    else: sand.add(dt)
    print(sand(a))
    last_t = t

Fixed submission:
input = __import__('sys').stdin.readline
MIS = lambda: map(int,input().split())
 
# f(a) = z                 a <= x1
#        a+z-x1      x1 <= a <= x2
#        x2+z-x1     x2 <= a
class Sandgraph:
    def __init__(_, X):
        _.z = _.x1 = 0
        _.x2 = X
    
    def add(_, dt):
        # Go towards the ceiling
        d1 = min(dt, X-(_.x2+_.z-_.x1))
        _.z+= d1
        dt-= d1
        # Reduce the diagonal
        d1 = min(dt, _.x2-_.x1)
        _.z+= d1
        _.x2-= d1
    
    def sub(_, dt):
        # Go towards the floor
        d1 = min(dt, _.z)
        _.z-= d1
        dt-= d1
        # Reduce the diagonal
        d1 = min(dt, _.x2-_.x1)
        _.x1+= d1
    
    def __call__(_, a):
        if a <= _.x1: return _.z
        elif a <= _.x2: return a + _.z - _.x1
        else: return _.x2 + _.z - _.x1
 
X = int(input())
k = int(input())
rev = list(MIS())
Q = int(input())
sand = Sandgraph(X)
 
last_t = 0
i = 0 # even -, odd +
for QUERY in range(Q):
    t, a = MIS()
    while i<k and rev[i] <= t:
        dt = rev[i] - last_t
        if i%2 == 0: sand.sub(dt)
        else: sand.add(dt)
        last_t = rev[i]
        i+= 1
    dt = t - last_t
    if i%2 == 0: sand.sub(dt)
    else: sand.add(dt)
    print(sand(a))
    last_t = t
Buggy python submission (verdict: Runtime Error):
from __future__ import print_function
from collections import deque
from bisect import bisect_left as bl
input = raw_input
range = xrange

def goto(fr, to):
    i = bl(occ[to], fr+1)
    if i == len(occ[to]): return n+1
    return occ[to][i]

s = [-1]+[ord(c)-97 for c in input()]
n = len(s)-1
occ = [[] for i in range(26)]
for i in range(1, n+1):
    occ[s[i]].append(i)
visit = [None]*(n+2)
visit[0] = (-1, -1) # letter, lastindex
Q = deque()
Q.append(0)

while len(Q):
    p = Q.popleft()
    if p == n+1: break
    for q in range(26):
        qi = goto(p, q)
        if visit[qi]: continue
        visit[qi] = (q, p)
        Q.append(qi)
stack = []
i = n+1
while visit[i][0] != -1:
    stack.append(visit[i][0])
    i = visit[i][1]

for i in reversed(stack):
    print(chr(97+i), end='')

Fixed submission:
from collections import Counter
n = int(input())
C = Counter(map(int,input().split()))
quad = [i for i in C if C[i] >= 4]
if quad: maxa = max(quad)**2
else: maxa = 0

twice = [i for i in C if C[i] >= 2]
twice.sort()
if len(twice) >= 2: maxa = max(maxa, twice[-1]*twice[-2])
print(maxa)
Buggy python submission (verdict: Runtime Error):
h, w = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))

Fixed submission:
# one -> four
# two -> two, four
# four -> one, two, four

n = int(input())
one = 0
two = 0
four = 0

for a in map(int,input().split()):
    if a%2 != 0: one+= 1
    elif a%4 != 0: two+= 1
    else: four+= 1

def no():
    print("No")
    exit()

if two == 0:
    #1414141
    print("Yes" if four >= one-1 else "No")
else:
    #222222241414141
    print("Yes" if four >= one else "No")

Buggy python submission (verdict: Runtime Error):
h, w = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
grid = [[' ']*w for i in range(h)]

ci = 0
for i in range(h):
    for j in range(w):
        if not a[ci]: ci+= 1
        if i%2==0: grid[i][j] = ci+1
        else: grid[i][~j] = ci+1
        a[ci]-= 1
for row in grid: print(*row)

Fixed submission:
# one -> four
# two -> two, four
# four -> one, two, four

n = int(input())
one = 0
two = 0
four = 0

for a in map(int,input().split()):
    if a%2 != 0: one+= 1
    elif a%4 != 0: two+= 1
    else: four+= 1

def no():
    print("No")
    exit()

if two == 0:
    #1414141
    print("Yes" if four >= one-1 else "No")
else:
    #222222241414141
    print("Yes" if four >= one else "No")
Buggy python submission (verdict: Runtime Error):
x = int(input())
if x == 0:
    print(4)
    print(3, 3, 3, 3)
    1/0

x-= 1
phase = x//50
subphase = x%50
pstart = phase*50

left = 99+phase-(x-pstart)
right = 48+phase-(x-pstart)
ans = [left]*(1+subphase)+[right]*(49-subphase)
print(50)
print(*ans)

Fixed submission:
x = int(input())
if x == 0:
    print(4)
    print(3, 3, 3, 3)
    exit()

x-= 1
phase = x//50
subphase = x%50
pstart = phase*50

left = 99+phase-(x-pstart)
right = 48+phase-(x-pstart)
ans = [left]*(1+subphase)+[right]*(49-subphase)
print(50)
print(*ans)
Buggy python submission (verdict: Runtime Error):
N,i = map(int,input(),split())

print(N-i+1)

Fixed submission:
N,i = map(int,input().split())

print(N-i+1)
Buggy python submission (verdict: Runtime Error):
V

Fixed submission:
R = int(input())
G = int(input())

print(2*G-R)
Buggy python submission (verdict: Runtime Error):
N,A = map(int, input().split())

print(N**2-A)

Fixed submission:
N = int(input())
A = int(input())

print(N**2-A)
Buggy python submission (verdict: Runtime Error):
s=(input)
print("YES" if s[0]==s[2] else "No")

Fixed submission:
s=input()
print("Yes" if s[0]==s[2] else "No")

Buggy python submission (verdict: Runtime Error):
s=(input)
print("YES" if s[0]==s[2] else "No")

Fixed submission:
s=input()
print("Yes" if s[0]==s[2] else "No")

Buggy python submission (verdict: Runtime Error):
print("YES" if input()[0]==input()[2] else "No")

Fixed submission:
s=input()
print("Yes" if s[0]==s[2] else "No")
Buggy python submission (verdict: Runtime Error):
a,b = input().split(" ")
print("error" if a+b>=10 else a+b)

Fixed submission:
a,b = map(int,input().split())
print("error" if a+b>=10 else a+b)

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
print("error" if a+b>=10 else a+b)

Fixed submission:
a,b = map(int,input().split())
print("error" if a+b>=10 else a+b)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
print(A, B, C)
number = []
number.append([A, B, C])

number.sort()
print(number[2]*10 + number[1] + number[0])

Fixed submission:
A, B, C = map(int, input().split())
number = []
number.append(A)
number.append(B)
number.append(C)

number.sort()
print(number[2]*10 + number[1] + number[0])

Buggy python submission (verdict: Runtime Error):
from sys import stdin
a, b, c = [int(i) for i in stdin.readline().rstrip().split()]

print(max([10 * a + b + c, a + 10 * b + c, a + b + 10 * c])


Fixed submission:
from sys import stdin
a, b, c = [int(i) for i in stdin.readline().rstrip().split()]

print(max([10 * a + b + c, a + 10 * b + c, a + b + 10 * c]))
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())

ret = 0
for x in range(k + 1):
    for y in range(k + 1):
        for z in range(k + 1):
            if x + y + z == s:
                ret += 1
print(ret)                

Fixed submission:
k, s = map(int, input().split())
ret = 0

for x in range(k + 1):
    for y in range(k + 1):
        if x + y <= s and x + y + k >= s:
            ret += 1
print(ret)
Buggy python submission (verdict: Runtime Error):
A, B, K = [int(i) for i in input().split()]

S = set()
for i in range(A, A+K):
    if i > B:
        break
    S.add(i)
for i in range(B-K+1, B+1):
    if i < A:
        break
    S.add(i)
for i in sorted(S):
    print(i)

Fixed submission:
S = input()
if S.count('a') and S.count('b') and S.count('c'):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
A, B, K = [int(i) for i in input().split()]

S = set()
for i in range(A, A+K):
    if i > B:
        break
    S.add(i)
for i in range(B-K+1, B+1):
    if i < A:
        break
    S.add(i)
for i in sorted(S):
    print(i)

Fixed submission:
S = input()
if S.count('a') and S.count('b') and S.count('c'):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N,  M = [int(i) for i in input().split()]
cities = {}
for i in range(M):
    cities[i+1] = 0
for i in range(M):
    for c in [int(i) for i in input().split()]:
        cities[c] += 1
for key, val in sorted(cities.items()):
    print(val)

Fixed submission:
N,  M = [int(i) for i in input().split()]
cities = {}
for i in range(N):
    cities[i+1] = 0
for i in range(M):
    for c in [int(i) for i in input().split()]:
        cities[c] += 1
for key, val in sorted(cities.items()):
    print(val)
Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
AA = "%-101s", A
BB = "%-101s", B
if AA == BB:
    print("EQUAL")
elif AA>BB:
    print("GREATER")
else:
    print("LESS")

Fixed submission:
A, B, C = input().split()
print(A[0].upper()+B[0].upper()+C[0].upper())

Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
AA = "%101s", A
BB = "%101s", B
if AA == BB:
    print("EQUAL")
elif AA>BB:
    print("GREATER")
else:
    print("LESS")

Fixed submission:
A, B, C = input().split()
print(A[0].upper()+B[0].upper()+C[0].upper())
Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
AA = f"{A:>101}"
BB = f"{B:>101}"
if AA == BB:
    print("EQUAL")
elif AA>BB:
    print("GREATER")
else:
    print("LESS")

Fixed submission:
A = input()
B = input()
AA = "%101s" % A
BB = "%101s" % B
if AA == BB:
    print("EQUAL")
elif AA>BB:
    print("GREATER")
else:
    print("LESS")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = 1
for i in range(1, N+1):
    P *= i
_, ans = divmod(P, 1000000007)
print(ans)

Fixed submission:
N = int(input())
ans = 1
for i in range(1, N+1):
    _, ans = divmod(ans * i, 1000000007)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = [ int(i) for i in input().split() ]
count = 0
for X in range(K+1):
    for Y in range(K+1):
        for Z in range(K+1):
            if X + Y + Z == S:
                count += 1
print(count)

Fixed submission:
K, S = [ int(i) for i in input().split() ]
count = 0
for X in range(K+1):
    for Y in range(K+1):
        if (X + Y) <= S and S - (X+Y) <= K:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
a = input().split()
a = [int(i) for i in a]
print(a)
amax = a[0]
for i in range(1,3):
    if a[i] > amax:
        amax = a[i]
        count = i
    else:
        pass
a.pop(count)
print(amax*10+a[0]+a[1])

Fixed submission:
a = input().split()
a = [int(i) for i in a]
amax = a[0]
count = 0
for i in range(1,3):
    if a[i] > amax:
        amax = a[i]
        count = i
    else:
        pass
a.pop(count)
print(amax*10+a[0]+a[1])