Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

vlen = 0
for l1 in range(N):
    for l2 in range(l1+1, N):
        i = 0
        while l1 + i < l2 and l2 + i < N:
            if S[l1 + i] != S[l2 + i]:
                break
            i += 1
        vlen = max(i, vlen)
print(vlen)


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

dp = [[None for j in range(N)] for i in range(N)]
vlen = 0
for i in range(N-1):
    for j in range(i + 1, N):
        if S[i] != S[j]:
            dp[i][j] = 0
        elif i - 1 >= 0 and j - 1 >= 0:
            dp[i][j] = dp[i - 1][j - 1] + 1
        else:
            dp[i][j] = 1
        if i + dp[i][j] <= j:
            vlen = max(vlen, dp[i][j])
print(vlen)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

for vlen in range(N // 2, -1, -1):
    for l1 in range(N - vlen * 2 + 1):
        for l2 in range(l1 + vlen, N):
            if S[l1:l1 + vlen] == S[l2:l2 + vlen]:
                print(vlen)
                exit()
print(0)


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

dp = [[None for j in range(N)] for i in range(N)]
vlen = 0
for i in range(N-1):
    for j in range(i + 1, N):
        if S[i] != S[j]:
            dp[i][j] = 0
        elif i - 1 >= 0 and j - 1 >= 0:
            dp[i][j] = dp[i - 1][j - 1] + 1
        else:
            dp[i][j] = 1
        if i + dp[i][j] <= j:
            vlen = max(vlen, dp[i][j])
print(vlen)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

for vlen in range(N // 2, -1, -1):
    for l1 in range(N - vlen + 1):
        for l2 in range(l1 + vlen, N):
            if S[l1:l1 + vlen] == S[l2:l2 + vlen]:
                print(vlen)
                exit()
print(0)


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

dp = [[None for j in range(N)] for i in range(N)]
vlen = 0
for i in range(N-1):
    for j in range(i + 1, N):
        if S[i] != S[j]:
            dp[i][j] = 0
        elif i - 1 >= 0 and j - 1 >= 0:
            dp[i][j] = dp[i - 1][j - 1] + 1
        else:
            dp[i][j] = 1
        if i + dp[i][j] <= j:
            vlen = max(vlen, dp[i][j])
print(vlen)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
num_children = [0] * len(s)

for i in range(len(s)):
    rest = 10**100
    pos = i
    while rest > 0:
        if s[pos] == 'R' and s[pos + 1] == 'L':
            if rest % 2 == 0:
                rest = 0
                continue
            else:
                pos += 1
                rest = 0
                continue
        if s[pos] == 'R':
            pos += 1
            rest -= 1
            continue
        if s[pos] == 'L':
            pos -= 1
            rest -= 1
            continue
    num_children[pos] += 1
print(' '.join((str(v) for v in num_children)))


Fixed submission:
s = input()
children_after_move = [0] * len(s)

children = 1
last_r_pos = 0
for i in range(1, len(s)):
    if s[i] == s[i - 1]:
        children += 1
    elif s[i] == 'L' and s[i - 1] == 'R':
        children_after_move[i] += children // 2
        children_after_move[i - 1] += children - children // 2
        children = 1
        last_r_pos = i - 1
    elif s[i] == 'R' and s[i - 1] == 'L':
        children_after_move[last_r_pos] += children // 2
        children_after_move[last_r_pos + 1] += children - children // 2
        children = 1
children_after_move[last_r_pos] += children // 2
children_after_move[last_r_pos + 1] += children - children // 2

print(' '.join((str(v) for v in children_after_move)))
Buggy python submission (verdict: Time Limit Exceeded):
def ncr(n, r):
    ret = 1
    for i in range(n, n-r, -1):
        ret *= i
    for i in range(1, r+1):
        ret //= i
    return ret


rem = 10**9 + 7
n, k = (int(v) for v in input().split())
for opcnt in range(1, k+1):
    print((ncr(k-1, opcnt-1) * ncr(n-k+1, opcnt)) % rem)


Fixed submission:
mod = 10**9 + 7
vmax = 2000
fac = [1, 1] + [0] * (vmax - 1)
finv = [1, 1] + [0] * (vmax - 1)
inv = [0, 1] + [0] * (vmax - 1)
for i in range(2, vmax+1):
    fac[i] = fac[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod


def com(n, k):
    if n < k or n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod


n, k = (int(v) for v in input().split())
for opcnt in range(1, k+1):
    print((com(k-1, opcnt-1) * com(n-k+1, opcnt)) % mod)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)

i = 0
while i < len(S) - 1:
    if S[i] == S[i + 1]:
        i += 1
        continue
    S = S[:i] + S[i + 2:]
    if i > 0:
        i -= 1

print(N - len(S))


Fixed submission:
S = input()

numred = 0
numblue = 0

for c in S:
    if c == '0':
        numred += 1
    else:
        numblue += 1

print(2 * min(numred, numblue))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [float('inf')] * N
dp[0] = 0
for i in range(1, N):
    for j in range(max(0, i - K), i):
        dp[i] = min(dp[i], dp[j] + abs(h[j] - h[i]))
print(dp[N - 1])

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [float('inf')] * N
dp[0] = 0
for i in range(1, N):
    for j in range(max(0, i - K), i):
        dp[i] = min(dp[i], dp[j] + abs(h[j] - h[i]))
print(dp[N - 1])
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cv, cw in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cv + v[i]] = min(
            dp.get(cv + v[i], float('inf')),
            cw + w[i])
print(max(dp))

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

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cw, cv in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cw + w[i]] = max(
            dp.get(cw + w[i], 0),
            cv + v[i])
print(max(dp.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cw, cv in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cw + w[i]] = max(
            dp.get(cw + w[i], 0),
            cv + v[i])
print(max(dp.values()))

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

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cw, cv in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cw + w[i]] = max(
            dp.get(cw + w[i], 0),
            cv + v[i])
print(max(dp.values()))
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cv, cw in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cv + v[i]] = min(
            dp.get(cv + v[i], float('inf')),
            cw + w[i])
print(max(dp))

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

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cv, cw in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cv + v[i]] = min(
            dp.get(cv + v[i], float('inf')),
            cw + w[i])
print(max(dp))

Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cw, cv in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cw + w[i]] = max(
            dp.get(cw + w[i], 0),
            cv + v[i])
print(max(dp.values()))

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

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cv, cw in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cv + v[i]] = min(
            dp.get(cv + v[i], float('inf')),
            cw + w[i])
print(max(dp))
Buggy python submission (verdict: Time Limit Exceeded):
N, X = map(int, input().split())
x = sorted(map(lambda s: abs(int(s) - X), input().split()))
x = x[0:1] + [x[i] for i in range(1, len(x)) if x[i] != x[i-1]]

for d in range(x[0], 1, -1):
    for xi in x:
        if xi % d != 0:
            break
    else:
        print(d)
        exit()
print(1)

Fixed submission:
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


N, X = map(int, input().split())
x = list(map(lambda s: abs(int(s) - X), input().split()))

if len(x) < 2:
    print(x[0])
    exit()
d = gcd(x[0], x[1])

for i in range(2, len(x)):
    d = gcd(d, x[i])
print(d)

Buggy python submission (verdict: Time Limit Exceeded):
N, X = map(int, input().split())
x = sorted(set(map(lambda s: abs(int(s) - X), input().split())))

for d in range(x[0], 1, -1):
    for xi in x:
        if xi % d != 0:
            break
    else:
        print(d)
        exit()
print(1)


Fixed submission:
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


N, X = map(int, input().split())
x = list(map(lambda s: abs(int(s) - X), input().split()))

if len(x) < 2:
    print(x[0])
    exit()
d = gcd(x[0], x[1])

for i in range(2, len(x)):
    d = gcd(d, x[i])
print(d)
Buggy python submission (verdict: Runtime Error):
from bisect import (
    bisect_left,
    bisect_right,
)


n, k = map(int, input().split())
x = list(map(int, input().split()))

zi = bisect_left(x, 0)
queue = []
queue.append((zi, zi, zi, 1, x[zi]))
if zi - 1 >= 0:
    queue.append((zi-1, zi-1, zi-1, 1, -x[zi-1]))

mind = 9999999999999999999999999999
while len(queue) > 0:
    i, li, ri, cnt, d = queue.pop()
    #print(i, li, ri, cnt, d)
    if cnt == k:
        mind = d if d < mind else mind
        continue
    if li - 1 >= 0:
        queue.append((li-1, li-1, ri, cnt+1, d+abs(x[li-1] - x[i])))
    if ri + 1 < n:
        queue.append((ri+1, li, ri+1, cnt+1, d+abs(x[ri+1] - x[i])))

print(mind)

Fixed submission:
n, k = (int(v) for v in input().split())
x = [int(v) for v in input().split()]

m = 99999999999999999999
for l in range(n-k+1):
    r = l + k - 1
    m = min(m, abs(x[l]) + abs(x[r] - x[l]))
    m = min(m, abs(x[r]) + abs(x[l] - x[r]))
print(m)
Buggy python submission (verdict: Runtime Error):
*s, = map(int, list(input()))
k = int(input())

i = 0
while s[i] == 1 and k > 0:
    k -= 1
    i += 1
print(s[i])

Fixed submission:
s = list(map(int, list(input())))
k = int(input())

i = 0
while s[i] == 1 and k != 1:
    k -= 1
    i += 1
print(s[i])

Buggy python submission (verdict: Runtime Error):
*s, = map(int, list(input()))
k = int(input())

while s[0] == 1 and k > 0:
    k -= 1
    s = s[1:]
print(s[0])

Fixed submission:
s = list(map(int, list(input())))
k = int(input())

i = 0
while s[i] == 1 and k != 1:
    k -= 1
    i += 1
print(s[i])
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left


n, m, q = map(int, input().split())
lrlist = [[int(x) for x in input().split()] for _ in range(m)]
pqlist = [[int(x) for x in input().split()] for _ in range(q)]

lrlist.sort(key=lambda lr: lr[1])
lrlist.sort(key=lambda lr: lr[0])
llist = [lr[0] for lr in lrlist]
rlist = [lr[1] for lr in lrlist]

pqilist = [[pqlist[i][0], pqlist[i][1], i] for i in range(q)]
pqilist.sort(key=lambda pqi: pqi[1])
pqilist.sort(key=lambda pqi: pqi[0])

cntlist = []
j = 0
for p, q, i in pqilist:
    cnt = 0
    j = bisect_left(llist, p, j)
    for r in rlist[j:]:
        if r <= q:
            cnt += 1
    cntlist.append((cnt, i))

cntlist.sort(key=lambda cnti: cnti[1])
for cnt, _ in cntlist:
    print(cnt)

Fixed submission:
n, m, q = map(int, input().split())

lr = [[0 for _ in range(n+1)] for _ in range(n+1)]
for _ in range(m):
    l, r = map(int, input().split())
    lr[l][r] += 1

sumlr = [[0 for _ in range(n+1)] for _ in range(n+1)]
for l, r in ((l, r) for l in range(1, n+1) for r in range(1, n+1)):
    sumlr[l][r] = lr[l][r] + sumlr[l-1][r] + sumlr[l][r-1] - sumlr[l-1][r-1]

for _ in range(q):
    p, q = map(int, input().split())
    print(sumlr[q][q] - sumlr[p-1][q] - sumlr[q][p-1] + sumlr[p-1][p-1])

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left


n, m, q = map(int, input().split())
lrlist = [[int(x) for x in input().split()] for _ in range(m)]
pqlist = [[int(x) for x in input().split()] for _ in range(q)]

lrlist.sort(key=lambda lr: lr[1])
lrlist.sort(key=lambda lr: lr[0])

llist = [lr[0] for lr in lrlist]
rlist = [lr[1] for lr in lrlist]

for p, q in pqlist:
    cnt = 0
    i = bisect_left(llist, p)
    for r in rlist[i:]:
        if r <= q:
            cnt += 1
    print(cnt)

Fixed submission:
n, m, q = map(int, input().split())

lr = [[0 for _ in range(n+1)] for _ in range(n+1)]
for _ in range(m):
    l, r = map(int, input().split())
    lr[l][r] += 1

sumlr = [[0 for _ in range(n+1)] for _ in range(n+1)]
for l, r in ((l, r) for l in range(1, n+1) for r in range(1, n+1)):
    sumlr[l][r] = lr[l][r] + sumlr[l-1][r] + sumlr[l][r-1] - sumlr[l-1][r-1]

for _ in range(q):
    p, q = map(int, input().split())
    print(sumlr[q][q] - sumlr[p-1][q] - sumlr[q][p-1] + sumlr[p-1][p-1])
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()

if a == 'H':
    if b == 'H':
        print('H')
    elif b == 'D':
        print('D')

elif a == 'D':
    if b == 'H':
        print('D')
    elif b == 'D':
        print('H')

Fixed submission:
a, b = input().split()

if a == 'H':
    if b == 'H':
        print('H')
    elif b == 'D':
        print('D')

elif a == 'D':
    if b == 'H':
        print('D')
    elif b == 'D':
        print('H')
Buggy python submission (verdict: Runtime Error):
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


a,b=map(int,input().split())

ansa=prime_factorize(a)
ansb=prime_factorize(b)
count=0

for i in range(len(ansa)):
    if ansa[i] in ansb:
        count+=1
    


print(count)


Fixed submission:
n=int(input())
count=0
for i in range(1,n+1,2):
    count+=1
print(count/n)
Buggy python submission (verdict: Runtime Error):

            a=list()
b=list()
a="R", "U","D"
b="L", "U", "D"
s=input()
count=0
ans=True
for i in s:
    if count%2==0:
        if i not in a:
            ans=False
    if count%2!=0:
        if i not in b:
            ans=False
    count+=1

if ans==True:
    print('Yes')
else:
    print('No')
            

Fixed submission:
a=list()
b=list()
a="R", "U","D"
b="L", "U", "D"
s=input()
count=0
ans=True
for i in s:
    if count%2==0:
        if i not in a:
            ans=False
    if count%2!=0:
        if i not in b:
            ans=False
    count+=1

if ans==True:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
a= list(map(int,input().split()))
a=[i-1 for i in a]
b= list(map(int,input().split()))
c= list(map(int,input().split()))

count=0

for i in a:
    if i==cook:
        count+=c[i-1]
    
    count+=b[i] 
    cook=i+1
    
print(count)
    

Fixed submission:
n=int(input())
a= list(map(int,input().split()))
a=[i-1 for i in a]
b= list(map(int,input().split()))
c= list(map(int,input().split()))

count=0
cook=-4
for i in a:
    if i==cook:
        count+=c[i-1]
    
    count+=b[i] 
    cook=i+1
    
print(count)
Buggy python submission (verdict: Runtime Error):
def count_inversion(sequence):
    return sum(sum(m<n for m in sequence[i+1:]) for i,n in enumerate(sequence))
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(k-1):
    a+=a

 
 
print(count_inversion(a)%100000007)

Fixed submission:
m,d=map(int,input().split())
count=0

for i in range(1,m+1):
    for j in range(22,d+1):
        d1,d2=map(int,str(j))
        if i==(d1*d2) and d2>=2:
            count+=1
            
print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())
lista=list(map(int,input().split()))
lista=sorted(lista)
for i in range(n-1):
    lista.append((lista[i]+lista[i+1])/2)
    lista.pop(i+1)
    lista.pop(i)
print(lista[0])

Fixed submission:
import numpy as np
n=int(input())
lista=list(map(int,input().split()))
lista.sort()

for i in range(n-1):
    lista.append((lista[0]+lista[1])/2)
    lista.pop(0)
    lista.pop(0)
    lista.sort()
    
print(lista[0])

Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())
lista=list(map(int,input().split()))
lista=sorted(lista)
for i in range(n-1):
    lista.append((lista[i]+lista[i+1])/2)
    lista.pop(i+1)
    lista.pop(i)
print(lista)

Fixed submission:
import numpy as np
n=int(input())
lista=list(map(int,input().split()))
lista.sort()

for i in range(n-1):
    lista.append((lista[0]+lista[1])/2)
    lista.pop(0)
    lista.pop(0)
    lista.sort()
    
print(lista[0])
Buggy python submission (verdict: Runtime Error):
n = int(input())
p=list(map(int,input().split()))
z=0
for i in range(n):
    if p[i]!=i+1:
        z+=1
if z>2:print(NO)
else:
    print(YES)


Fixed submission:
n = int(input())
p=list(map(int,input().split()))
z=0
for i in range(n):
    if p[i]!=i+1:
        z+=1
if z>2:print("NO")
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ma=max(a)-min(a)
print(ma

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ma=max(a)-min(a)
print(ma)
Buggy python submission (verdict: Runtime Error):
n,maxg=map(int,input().split())
lista =[int(input()) for i in range(n)]
count=count+n
nokori=maxg-sum(lista)
print(count)
while nokori-min(lista)>=0:
    nokori=nokori-min(lista)
    count+=1
print(count)

Fixed submission:
n,maxg=map(int,input().split())
lista =[int(input()) for i in range(n)]
count=n
nokori=maxg-sum(lista)

while nokori-min(lista)>=0:
    nokori=nokori-min(lista)
    count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
if a*b==0 :
  print("even")
elese:print("odd")

Fixed submission:
a,b=map(int,input().split())
if (a*b)%2 :
    print("Odd")
else:
    print("Even")
Buggy python submission (verdict: Time Limit Exceeded):
n,y=map(int,input().split())
for i in range(n+1):
    for r in range(n+1):
        for x in range(n+1):
            total = 10000*i+5000*r+1000*x
            if total==y and i+r+x==n:
                print(i,r,x)
                exit(0)
print(-1,-1,-1)
                

Fixed submission:
n,y=map(int,input().split())
for i in range(n+1):
    for r in range(n+1-i):
        x=n-r-i
        total = 10000*i+5000*r+1000*x
        if total==y and i+r+x==n:
            print(i,r,x)
            exit(0)
print(-1,-1,-1)
Buggy python submission (verdict: Runtime Error):
s=sorted(input())
t=sorted(input(),reverse=True)

lista=list()

for i in s:
    c=c+i
for x in t:
    d=d+x
lista.append(c)
lista.append(d)
if s==t:
    print("No")
elif lista==sorted(lista):
    print("Yes")
else:
    print("No")

Fixed submission:
s=input()
t=input()
c=""
d=""
lista=list()
sa=sorted(s)
ta=sorted(t,reverse=True)
for i in sa:
    c=c+i
for x in ta:
    d=d+x
lista.append(c)
lista.append(d)
if s==t:
    print("No")
elif lista==sorted(lista):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
c=list(map(int,input().split()))
c = collections.Counter(c)
count=0
for x in c:
    if x==c[x]:
        continue
    elif x>c[x]:
        count+=c[x]
    else:
        count=count+(c[x]-x)
print(count)

Fixed submission:
import collections
n=int(input())
c=list(map(int,input().split()))
c = collections.Counter(c)
count=0
for x in c:
    if x==c[x]:
        continue
    elif x>c[x]:
        count+=c[x]
    else:
        count=count+(c[x]-x)
print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n,m=map(int,input().split())
road=[list(map(int,input().split())) for i in range(m)]
road.sort()
ans=np.unique(road,return_counts=True)
for i in range(n):
    print(ans[1][i])


Fixed submission:
n,m=map(int,input().split())
road=[list(map(int,input().split())) for i in range(m)]

c=[flatten for inner in road for flatten in inner]

for i in range(1,n+1):
    print(c.count(i))

Buggy python submission (verdict: Runtime Error):
import numpy as np

n,m=map(int,input().split())
road=[list(input().split()) for i in range(m)]
road.sort()
ans=np.unique(road,return_counts=True)
for i in range(n):
    print(ans[1][i])

Fixed submission:
n,m=map(int,input().split())
road=[list(map(int,input().split())) for i in range(m)]

c=[flatten for inner in road for flatten in inner]

for i in range(1,n+1):
    print(c.count(i))

Buggy python submission (verdict: Runtime Error):
import numpy as np

n,m=map(int,input().split())
road=[list(input().split()) for i in range(m)]
road.sort()
ans=np.unique(road,return_counts=True)
for i in range(n):
    print(ans[1][i])

Fixed submission:
n,m=map(int,input().split())
road=[list(map(int,input().split())) for i in range(m)]

c=[flatten for inner in road for flatten in inner]

for i in range(1,n+1):
    print(c.count(i))
Buggy python submission (verdict: Runtime Error):
n=int(input())
lista=list(map(int,input().split()))

goukei=0
count=0

for i in range(n):
    number=lista[i]+goukei
    if i%2==0:
        if number>=0:
            count=count+number+1
            goukei=-1
        else:
            goukei=number
    else:
        if number<=0:
            count=count+abs(number)+1
            goukei=1
        else:
            goukei=number

count1=count

goukei=0
count=0

for i in range(n):
    number=lista[i]+goukei
    if i%2==1:
        if number>=0:
            count=count+number+1
            goukei=-1
        else:
            goukei=number
    else:
        if number<=0:
            count=count+abs(number)+1
            goukei=1
        else:
            goukei=number
print(min(count,count1))

Fixed submission:
a,b,c=input().split()
ans=a[0]+b[0]+c[0]
print(ans.upper())
Buggy python submission (verdict: Runtime Error):
n,c,k=map(int,input().split())
lista=[int(input())for i in range(n)]
listb=sorted(lista)
count=0
bustime=0
buspeople=0
for i in listb:
    if buspeople==0 or bustime<i:
        count+=1
        buspeople=c-1
        bustime=i+k
    else :
        buspeople-=1
print(count)

Fixed submission:
n = int(input())
lista=list(map(int,input().split()))

count=0
zougen=""
for i in range(n-1):
    if zougen=="":
        if lista[i]<lista[i+1]:
            zougen="up"
        if lista[i]>lista[i+1]:
            zougen="down"
    elif  zougen=="up":
        if lista[i]>lista[i+1]:
            count+=1
            zougen=""
    elif zougen=="down":
        if lista[i]<lista[i+1]:
            count+=1
            zougen=""
print(count+1)
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
count=0
for i in range(k+1):
    for j in range(k+1):
        for k in range(k+1):
            if i+j+k==s:
                count+=1
print(count)

Fixed submission:
k,s=map(int,input().split())
count=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if z>=0 and z<=k:
            count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
count=0
for i in range(k+1):
    for j in range(k+1):
        for k in range(k+1):
            if i+j+k==s:
                count+=1
print(count)

Fixed submission:
k,s=map(int,input().split())
count=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if z>=0 and z<=k:
            count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
lista=list(map(int,input().split()))
lista.sort()
if lista==[5,5,7]:
    print("YES")
else:
    ptinr("NO")

Fixed submission:
lista=list(map(int,input().split()))
lista.sort()
if lista==[5,5,7]:
    print("YES")
else:
    print("NO")