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

first = sys.stdin.readline().strip().split()
N = int(first[0])  # 数列の要素数
M = int(first[1])  # 数列の最大値
Q = int(first[2])

inp = list()

for _ in range(Q):
    inp.append(sys.stdin.readline().strip())


max_score = 0
As = list()


def loop(row, start, idx):

    global max_score

    if idx == N:
        # As.append(row)
        score = 0
        for item in inp:
            a, b, c, d = map(int, item.split())
            if row[b - 1] - row[a - 1] == c:
                score += d
        max_score = max(score, max_score)

    else:
        for i in range(start, M+1):
            loop(row + [i], i, idx+1)


loop([], 1, 0)

print(max_score)


Fixed submission:
import sys

first = sys.stdin.readline().strip().split()
N = int(first[0])  # 数列の要素数
M = int(first[1])  # 数列の最大値
Q = int(first[2])

inp = list()

for _ in range(Q):
    inp.append(sys.stdin.readline().strip())


max_score = 0
As = list()


def loop(row, start, idx):

    global max_score

    if idx == N:
        # As.append(row)
        score = 0
        for item in inp:
            a, b, c, d = map(int, item.split())
            if row[b - 1] - row[a - 1] == c:
                score += d
        max_score = max(score, max_score)

    else:
        for i in range(start, M+1):
            loop(row + [i], i, idx+1)


loop([], 1, 0)

print(max_score)

Buggy python submission (verdict: Time Limit Exceeded):
import sys

first = sys.stdin.readline().strip().split()
N = int(first[0])  # 数列の要素数
M = int(first[1])  # 数列の最大値
Q = int(first[2])

inp = list()

for _ in range(Q):
    inp.append(sys.stdin.readline().strip())


max_score = 0
As = list()


def loop(row, start, idx):

    if idx == N:
        As.append(row)
    else:
        for i in range(start, M+1):
            loop(row + [i], i, idx+1)


loop([], 1, 0)

for A in As:
    score = 0
    for item in inp:
        a, b, c, d = map(int, item.split())
        if A[b-1] - A[a-1] == c:
            score += d
    max_score = max(score, max_score)

print(max_score)


Fixed submission:
import sys

first = sys.stdin.readline().strip().split()
N = int(first[0])  # 数列の要素数
M = int(first[1])  # 数列の最大値
Q = int(first[2])

inp = list()

for _ in range(Q):
    inp.append(sys.stdin.readline().strip())


max_score = 0
As = list()


def loop(row, start, idx):

    global max_score

    if idx == N:
        # As.append(row)
        score = 0
        for item in inp:
            a, b, c, d = map(int, item.split())
            if row[b - 1] - row[a - 1] == c:
                score += d
        max_score = max(score, max_score)

    else:
        for i in range(start, M+1):
            loop(row + [i], i, idx+1)


loop([], 1, 0)

print(max_score)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict

lines = 1
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())


s = inp[0]
n = len(s)

tmp = defaultdict(int)
tmp[0] = 1

b = 0

for i in range(1, n + 1):
    a = int(s[n - i])
    b = ((10 ** (i-1)) * a + b) % 2019
    tmp[b] += 1

result = 0

for v in tmp.values():
    result += int(v * (v - 1) / 2)

print(result)


Fixed submission:
import sys
from collections import defaultdict

lines = 1
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())


s = inp[0]
n = len(s)

tmp = defaultdict(int)
tmp[0] = 1

b = 0
d = 1

for i in range(1, n + 1):
    a = int(s[n - i])
    b = ((d * a) + b) % 2019
    tmp[b] += 1
    d = (d * 10) % 2019

result = 0

for v in tmp.values():
    result += int(v * (v - 1) / 2)

print(result)

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

lines = 1
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())


s = inp[0]
n = len(s)

tmp = defaultdict(int)
tmp[0] = 1

for k in range(1, n + 1):
    t = int(s[n-k:n])
    tmp[t % 2019] += 1


result = 0

for v in tmp.values():
    result += int(v * (v - 1) / 2)


print(n - len(tmp) + 1)


Fixed submission:
import sys
from collections import defaultdict

lines = 1
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())


s = inp[0]
n = len(s)

tmp = defaultdict(int)
tmp[0] = 1

b = 0
d = 1

for i in range(1, n + 1):
    a = int(s[n - i])
    b = ((d * a) + b) % 2019
    tmp[b] += 1
    d = (d * 10) % 2019

result = 0

for v in tmp.values():
    result += int(v * (v - 1) / 2)

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import sys

lines = 1
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())


s = inp[0]
n = len(s)

tmp = set()
tmp.add(0)

for k in range(1, len(s) + 1):
    t = int(s[n-k:len(s)])
    tmp.add(t % 2019)

print(n - len(tmp) + 1)


Fixed submission:
import sys
from collections import defaultdict

lines = 1
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())


s = inp[0]
n = len(s)

tmp = defaultdict(int)
tmp[0] = 1

b = 0
d = 1

for i in range(1, n + 1):
    a = int(s[n - i])
    b = ((d * a) + b) % 2019
    tmp[b] += 1
    d = (d * 10) % 2019

result = 0

for v in tmp.values():
    result += int(v * (v - 1) / 2)

print(result)
Buggy python submission (verdict: Runtime Error):
import itertools

N, M, Q = map(int, input().split())
comb = list(itertools.combinations(range(1,M+1), N))

ans = [0]*len(comb)
for i in range(Q):
    a,b,c,d = map(int, input().split())
    for j in range(len(comb)):
        if comb[j][b-1] - comb[j][a-1] == c:
            ans[j] += d
            
print(max(ans))

Fixed submission:
import itertools

N, M, Q = map(int, input().split())
comb = list(itertools.combinations_with_replacement(range(1,M+1), N))

ans = [0]*len(comb)
if ans == []:
    print(0)
else:
    for i in range(Q):
        a,b,c,d = map(int, input().split())
        for j in range(len(comb)):
            if comb[j][b-1] - comb[j][a-1] == c:
                ans[j] += d
    print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
N = int(input())
ans = [input()]

for i in range(N-1):
    Si = input()
    lef = bisect_left(ans, Si)
    if lef == len(ans):
        ans.append(Si)
    elif ans[lef] != Si:
            ans.insert(lef,Si)

print(len(ans))

Fixed submission:
N = int(input())
ans = set()
for i in range(N):
    Si = input()
    ans.add(Si)
print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = []

for i in range(N):
    Si = input()
    if Si in ans:
        continue
    else:
        ans.append(Si)

print(len(ans))

Fixed submission:
N = int(input())
ans = set()
for i in range(N):
    Si = input()
    ans.add(Si)
print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = []

for i in range(N):
    Si = input()
    if Si in ans:
        continue
    else:
        ans.append(Si)

print(len(ans))

Fixed submission:
N = int(input())
ans = set()
for i in range(N):
    Si = input()
    ans.add(Si)
print(len(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
 
ans = 0
minN = 0
maxN = N-1
flag = [1]*N
    
for i in range(N):
    maxpr = 0
    maxj = 0
    flagj = 0
    for j in range(N):
        if flag[j]:
            if maxN - j >= j - minN and A[j]*(maxN - j) > maxpr:
                maxpr = A[j]*(maxN - i)
                maxj = j
                flagj = 1
            elif  maxN - j <= j - minN and A[j]*(j - minN) > maxpr:
                maxpr = A[j]*(j - minN)
                maxj = j
                flagj = 0
    
    flag[maxj] = 0
    if flagj:
        maxN -= 1
    else:
        minN += 1
    ans += maxpr
    
print(ans)

Fixed submission:
import math
K = int(input())

print(2*math.pi*K)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = str(input())

num = [[0]*N for i in range(3)]
if S[N-1] == 'R':
    num[0][N-1] += 1
elif S[N-1] == 'G':
    num[1][N-1] += 1
else:
    num[2][N-1] += 1
    
for i in range(2,N+1):
    num[0][-i] = num[0][-i+1]
    num[1][-i] = num[1][-i+1]
    num[2][-i] = num[2][-i+1]
    if S[-i] == 'R':
        num[0][-i] += 1
    elif S[-i] == 'G':
        num[1][-i] += 1
    else:
        num[2][-i] += 1

ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        if S[i] != S[j]:
            if S[i] != 'R' and S[j] != 'R':
                ans += num[0][j+1]
                if 2*j - i < N:
                    if S[2*j - i] == 'R':
                        ans -= 1
                        
            elif S[i] != 'G' and S[j] != 'G':
                ans += num[1][j+1]
                if 2*j - i < N:
                    if S[2*j - i] == 'G':
                        ans -= 1
                        
            elif S[i] != 'B' and S[j] != 'B':
                ans += num[2][j+1]
                if 2*j - i < N:
                    if S[2*j - i] == 'B':
                        ans -= 1
                    
print(int(ans))

Fixed submission:
K = int(input())
flag = 0

for i in range(3):
    if K % 10 == 7:
        flag = 1
    K = int(K/10)
    
if flag:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
Nm = N % K
ans = Nm
A = [0]*(K+1)
A[Nm] = 1
while 1:
    if ans == 0:
        break
    elif A[abs(Nm-K)] != 1:
        if abs(Nm-K) < ans:
            ans = abs(Nm-K)
        A[abs(Nm-K)] = 1
        Nm = abs(Nm-K)
    else:
        break
    
print(ans)

Fixed submission:
N, K = map(int, input().split())
Nm = N % K
ans = Nm
A = [Nm]
while 1:
    if ans == 0:
        break
    elif abs(Nm-K) in A:
        break
    else:
        if abs(Nm-K) < ans:
            ans = abs(Nm-K)
        A.append(abs(Nm-K))
        Nm = abs(Nm-K)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())

frag = True
for i in range(N):
    A[i] = -1
for i in range(M):
    si = int(input())
    ci = int(input())
    if A[si] != -1 and A[si] != ci:
        frag = False
        break
    else if si == 1 and ci == 0:
        frag = False
        break
    else:
        A[si] = ci

ans = 0
for i in range(N):
    if A[N-i-1] == -1:
        A[N-i-1] = 0
    ans += A[N-i-1]*(10**i)
    
if frag:
    print(ans)
else:
    print(-1)

Fixed submission:
import numpy as np
N, M = map(int, input().split())

frag = True
A = np.zeros(N)
for i in range(N):
    A[i] = -1
for i in range(M):
    si,ci = map(int, input().split())
    if A[si-1] != -1 and A[si-1] != ci:
        frag = False
    elif si == 1 and ci == 0 and N != 1:
        frag = False
    else:
        A[si-1] = ci

ans = 0
for i in range(N):
    if A[N-i-1] == -1:
        A[N-i-1] = 0
    ans += A[N-i-1]*(10**i)
    
if ans == 0 and N == 1:
    pass
elif ans < 10**(N-1):
    ans += 10**(N-1)
    
if frag:
    print(int(ans))
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())

dic = {}
for _ in range(N):
    A = input()
    if A in dic:
        dic[A] += 1
    else:
        dic[A] = 1

dic_sorted = sorted(dic.items(), key=lambda x:x[1], reverse = True)
ans = []
flag = 0
num = 0
for i in range(N):
    if dic_sorted[i][1] < flag:
        break
    else:
        flag = dic_sorted[i][1]
        ans.append(dic_sorted[i][0])
        num += 1

ans.sort()
for i in range(num):
    print(ans[i])

Fixed submission:
N = int(input())

dic = {}
for _ in range(N):
    A = input()
    if A in dic:
        dic[A] += 1
    else:
        dic[A] = 1

dic_sorted = sorted(dic.items(), key=lambda x:x[1], reverse = True)
ans = []
flag = 0
for i in range(len(dic_sorted)):
    if dic_sorted[i][1] < flag:
        break
    else:
        flag = dic_sorted[i][1]
        ans.append(dic_sorted[i][0])

ans.sort()
for i in range(len(ans)):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
p = list(map(int, input().split()))

st = 0
i = 0
sa = 0
while i+K < N:
    sa += p[i+K]-p[i]
    if sa > 0:
        st = i+1
        sa = 0
    i += 1

psum = p[st:st+K]
for i in range(K):
    psum[i] = (psum[i]+1)/2
print(sum(psum)

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

st = 0
i = 0
sa = 0
while i+K < N:
    sa += p[i+K]-p[i]
    if sa > 0:
        st = i+1
        sa = 0
    i += 1

psum = p[st:st+K]
for i in range(K):
    psum[i] = (psum[i]+1)/2
print(sum(psum))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,K = map(int, input().split())
p = np.array(list(map(int, input().split())))
p = (p+1)/2

ans,i = 0,0
while i+K <= N:
    psum = sum(p[i:i+K])
    if psum > ans:
        ans = psum
    i += 1

print(ans)

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

st = 0
i = 0
sa = 0
while i+K < N:
    sa += p[i+K]-p[i]
    if sa > 0:
        st = i+1
        sa = 0
    i += 1

psum = p[st:st+K]
for i in range(K):
    psum[i] = (psum[i]+1)/2
print(sum(psum))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
p = list(map(int, input().split()))
for i in range(N):
    p[i] = 0.5*(p[i]+1)

ans,i = 0,0
while i+K <= N:
    psum = sum(p[i:i+K])
    if psum > ans:
        ans = psum
    i += 1

print(ans)

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

st = 0
i = 0
sa = 0
while i+K < N:
    sa += p[i+K]-p[i]
    if sa > 0:
        st = i+1
        sa = 0
    i += 1

psum = p[st:st+K]
for i in range(K):
    psum[i] = (psum[i]+1)/2
print(sum(psum))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = list(map(int, input().split()))
grid = []
for i in range(M):
    array = list(map(int, input().strip().split()))
    grid.append(array)

flag = 0
X = 0

for a in range(1, N+1):
    for b in grid:
        if b[0] == a:
            if H[b[1]-1] >= H[a-1]:
                break
        elif b[1] == a:
            if H[b[0]-1] >= H[a-1]:
                break
    else:
        X += 1

print(X)

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
grid = []
for i in range(M):
    array = list(map(int, input().strip().split()))
    grid.append(array)

flag = 0
X = 0

S = [1] * N


# for a in range(1, N+1):
#     for b in grid:
#         if b[0] == a:
#             if H[b[1]-1] >= H[a-1]:
#                 break
#         elif b[1] == a:
#             if H[b[0]-1] >= H[a-1]:
#                 break
#     else:
#         X += 1

for b in grid:
    if H[b[0]-1] > H[b[1]-1]:
        S[b[1]-1] = 0
    elif H[b[0]-1] < H[b[1]-1]:
        S[b[0]-1] = 0
    elif H[b[0]-1] == H[b[1]-1]:
        S[b[0] - 1] = 0
        S[b[1] - 1] = 0

X = sum(S)

print(X)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = list(map(int, input().split()))
grid = []
for i in range(M):
    array = list(map(int, input().strip().split()))
    grid.append(array)

flag = 0
X = 0

for a in range(1, N+1): #
    for b in grid:
        if b[0] == a:
            if H[b[1]-1] >= H[a-1]:
                flag = 1
        elif b[1] == a:
            if H[b[0]-1] >= H[a-1]:
                flag = 1

    if flag == 0:
        X += 1

    flag = 0

print(X)

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
grid = []
for i in range(M):
    array = list(map(int, input().strip().split()))
    grid.append(array)

flag = 0
X = 0

S = [1] * N


# for a in range(1, N+1):
#     for b in grid:
#         if b[0] == a:
#             if H[b[1]-1] >= H[a-1]:
#                 break
#         elif b[1] == a:
#             if H[b[0]-1] >= H[a-1]:
#                 break
#     else:
#         X += 1

for b in grid:
    if H[b[0]-1] > H[b[1]-1]:
        S[b[1]-1] = 0
    elif H[b[0]-1] < H[b[1]-1]:
        S[b[0]-1] = 0
    elif H[b[0]-1] == H[b[1]-1]:
        S[b[0] - 1] = 0
        S[b[1] - 1] = 0

X = sum(S)

print(X)
Buggy python submission (verdict: Time Limit Exceeded):
import math

A, B, N = map(int, input().split())
max = 0
temp = 0
bk_temp = 0

if B <= N:
    max = math.floor(A * (B - 1) / B) - (A * math.floor((B - 1) / B))
else:
    for i in range(1, N + 1):
        temp = math.floor(A*i/B) - (A * math.floor(i/B))
        # print(str(i) + ' ' + str(temp))
        if bk_temp > temp:
            max = bk_temp
            break
        if max < temp:
            max = temp
        bk_temp = temp

print(max)

Fixed submission:
import math

A, B, N = map(int, input().split())
max = 0
temp = 0
bk_temp = 0

if B <= N:
    max = math.floor(A * (B - 1) / B) - (A * math.floor((B - 1) / B))
else:
    # for i in range(1, N + 1):
    #     temp = math.floor(A*i/B) - (A * math.floor(i/B))
    #     print(str(i) + ' ' + str(temp))
    #     if bk_temp > temp:
    #         max = bk_temp
    #         break
    #     if max < temp:
    #         max = temp
    #     bk_temp = temp
    max = math.floor(A * N / B) - (A * math.floor((N) / B))

print(max)

Buggy python submission (verdict: Time Limit Exceeded):
import math

A, B, N = map(int, input().split())
max = 0
temp = 0
bk_temp = 0

for i in range(1, N + 1):
    temp = math.floor(A*i/B) - (A * math.floor(i/B))
    if bk_temp > temp:
        max = bk_temp
        break
    if max < temp:
        max = temp
    bk_temp = temp

print(max)

Fixed submission:
import math

A, B, N = map(int, input().split())
max = 0
temp = 0
bk_temp = 0

if B <= N:
    max = math.floor(A * (B - 1) / B) - (A * math.floor((B - 1) / B))
else:
    # for i in range(1, N + 1):
    #     temp = math.floor(A*i/B) - (A * math.floor(i/B))
    #     print(str(i) + ' ' + str(temp))
    #     if bk_temp > temp:
    #         max = bk_temp
    #         break
    #     if max < temp:
    #         max = temp
    #     bk_temp = temp
    max = math.floor(A * N / B) - (A * math.floor((N) / B))

print(max)

Buggy python submission (verdict: Time Limit Exceeded):
import math

A, B, N = map(int, input().split())
max = 0
temp = 0

for i in range(1, N + 1):
    temp = math.floor(A*i/B) - (A * math.floor(i/B))
    if max < temp:
        max = temp

print(max)

Fixed submission:
import math

A, B, N = map(int, input().split())
max = 0
temp = 0
bk_temp = 0

if B <= N:
    max = math.floor(A * (B - 1) / B) - (A * math.floor((B - 1) / B))
else:
    # for i in range(1, N + 1):
    #     temp = math.floor(A*i/B) - (A * math.floor(i/B))
    #     print(str(i) + ' ' + str(temp))
    #     if bk_temp > temp:
    #         max = bk_temp
    #         break
    #     if max < temp:
    #         max = temp
    #     bk_temp = temp
    max = math.floor(A * N / B) - (A * math.floor((N) / B))

print(max)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

for i in range(1, N+1):
    print(A.count(i))

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

B = [0] * N

for i in A:
    B[i-1] = B[i-1] + 1

for j in B:
    print(str(j))
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

X = ''
Y = 1

while len(X) < N:
    if Y%2 == 1:
        X = X + 'b' * A
    elif Y%2 == 0:
        X = X + 'r' * B
    Y += 1

print(X[0:N].count('b'))

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

X = N//(A+B)
Y = N%(A+B)

if A == 0:
    print(0)
else:
    if Y <= A:
        print(A * X + Y)
    else:
        print(A * X + A)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = list(map(int, input().split()))
i = 0


H.sort(reverse=True)

while K > 0 and len(H) > 0:
    H.pop(0)
    K -= 1

i += sum(H)

print(i)

Fixed submission:
N, K = map(int, input().split())
H = list(map(int, input().split()))
i = 0

H.sort(reverse=True)

if len(H) <= K:
    print(i)
else:
    del H[:K]
    i += sum(H)
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

counter = 1

for i in range(2, len(P) + 1, 1):
    l = sorted(P[slice(i)])
    b = l[0]
    if b >= P[i-1]:
        counter += 1
    else:
        pass

# for i in range(2, len(P) + 1, 1):
#     sl = slice(i)
#     # print(P[sl])
#     # print(P[i-1])
#     if all(elem >= P[i-1] for elem in P[sl]):
#         counter += 1

print(counter)


Fixed submission:
N = int(input())

nums = input().split()
nums = [int(x) for x in nums]

min = None
count = 0

for idx, num in enumerate(nums):
    if idx == 0:
        min = num
        count += 1
        continue

    if min >= num:
        count += 1
        min = num

print(count)

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

counter = 1

for i in range(2, len(P) + 1, 1):
    sl = slice(i)
    if min(P[sl]) >= P[i-1]:
        counter += 1
    else:
        pass

# for i in range(2, len(P) + 1, 1):
#     sl = slice(i)
#     # print(P[sl])
#     # print(P[i-1])
#     if all(elem >= P[i-1] for elem in P[sl]):
#         counter += 1

print(counter)


Fixed submission:
N = int(input())

nums = input().split()
nums = [int(x) for x in nums]

min = None
count = 0

for idx, num in enumerate(nums):
    if idx == 0:
        min = num
        count += 1
        continue

    if min >= num:
        count += 1
        min = num

print(count)

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

counter = 1

# for i in range(2, len(P) + 1, 1):
#     for j in range(i):
#         if P[j] < P[i-1]:
#             break
#     else:
#         counter += 1

for i in range(2, len(P) + 1, 1):
    sl = slice(i)
    # print(P[sl])
    # print(P[i-1])
    if all(elem >= P[i-1] for elem in P[sl]):
        counter += 1

print(counter)

Fixed submission:
N = int(input())

nums = input().split()
nums = [int(x) for x in nums]

min = None
count = 0

for idx, num in enumerate(nums):
    if idx == 0:
        min = num
        count += 1
        continue

    if min >= num:
        count += 1
        min = num

print(count)

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

counter = 1

for i in range(2, len(P) + 1, 1):
    for j in range(i):
        if P[j] < P[i-1]:
            break
    else:
        counter += 1

print(counter)

Fixed submission:
N = int(input())

nums = input().split()
nums = [int(x) for x in nums]

min = None
count = 0

for idx, num in enumerate(nums):
    if idx == 0:
        min = num
        count += 1
        continue

    if min >= num:
        count += 1
        min = num

print(count)