Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = [None]*n
for i in range(n):
    a[i] = int(input())
ans = a[0]-1
prev = 1
for i,num in enumerate(a[1:]):
    if prev+1<num:
        while num-(prev+1)>0:
            num -= (prev+1)
            ans += 1
            if num==prev+1:
                num = prev
                break
    prev = max(prev, num)
print(ans)

Fixed submission:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = [None]*n
for i in range(n):
    a[i] = int(input())
ans = a[0]-1
prev = 1
for i,num in enumerate(a[1:]):
    if prev+1<num:
        while num-(prev+1)>0:
            v = (num-1)//(prev+1)
            num -= v*(prev+1)
            ans += v
            if num==prev+1:
                num = prev
                break
    prev = max(prev, num)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
x = list(map(int, input().split()))
l = int(input())
q = int(input())
ps = [None]*n
# ps2 = [None]*n
j = 0
for i in range(n):
    if j<i:
        j = i
    while j+1<n and x[j+1]-x[i]<=l:
        j += 1
    ps[i] = j
# ダブリング
def double(ps):
    # global: n=psのサイズ
    k = 0
    n = len(ps)
    while pow(2,k)<n:
        k += 1
    prev = [[None]*n for _ in range(k)] # ノードjから2^i個上の上司
    for j in range(n):
        prev[0][j] = ps[j]
    for i in range(1,k):
        for j in range(n):
            p = prev[i-1][j]
            if p>=0:
                prev[i][j] = prev[i-1][p]
            else:
                prev[i][j] = p
    return prev
dl = double(ps)
ans = [None]*q
for i in range(q):
    a,b = map(lambda x: int(x)-1, input().split())
    a,b = min(a,b), max(a,b)
#     print(a,b)
    res = 0
    for k in range(len(dl)-1, -1, -1):
        if dl[k][a]<b:
            a = dl[k][a]
            res += pow(2,k)
        elif dl[k][a]==b:
            tmp = res+pow(2,k)
            break
        else:
            tmp = min(tmp, res+pow(2,k))
    ans[i] = tmp
write("\n".join(map(str, ans)))

Fixed submission:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
x = list(map(int, input().split()))
l = int(input())
q = int(input())
ps = [None]*n
# ps2 = [None]*n
j = 0
for i in range(n):
    if j<i:
        j = i
    while j+1<n and x[j+1]-x[i]<=l:
        j += 1
    ps[i] = j
# ダブリング
def double(ps):
    # global: n=psのサイズ
    k = 0
    n = len(ps)
    while pow(2,k)<n:
        k += 1
    prev = [[None]*n for _ in range(k)] # ノードjから2^i個上の上司
    for j in range(n):
        prev[0][j] = ps[j]
    for i in range(1,k):
        for j in range(n):
            p = prev[i-1][j]
            if p>=0:
                prev[i][j] = prev[i-1][p]
            else:
                prev[i][j] = p
    return prev
dl = double(ps)
ans = [None]*q
for i in range(q):
    a,b = map(lambda x: int(x)-1, input().split())
    a,b = min(a,b), max(a,b)
#     print(a,b)
    res = 0
    tmp = float("inf")
    for k in range(len(dl)-1, -1, -1):
        if dl[k][a]<b:
            a = dl[k][a]
            res += pow(2,k)
#         elif dl[k][a]==b:
#             tmp = res+pow(2,k)
#             break
        else:
            tmp = min(tmp, res+pow(2,k))
    ans[i] = tmp
write("\n".join(map(str, ans)))
Buggy python submission (verdict: Runtime Error):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


from collections import defaultdict
n,k = map(int, input().split())
ns = defaultdict(set)
for _ in range(n-1):
    u,v = map(int, input().split())
    u -= 1
    v -= 1
    ns[u].add(v)
    ns[v].add(u)
def bfs(start):
    from queue import deque
    q = deque([start])
    seen = [None] * n
    seen[start] = 0
    dist = defaultdict(list)
    dist[0].append(start)
    while q:
        u = q.pop()
        d = seen[u]
        for v in ns[u]:
            if seen[v] is None and v not in done:
                seen[v] = d + 1
                dist[d+1].append(v)
                q.appendleft(v)
    return seen, dist
ans = 0
done = set()
while True:
    start = 0
    while start in done:
        start += 1
    seen, dist1 = bfs(start)
    m = max(item for item in seen if item is not None)
    u = dist1[m][0]
    seen, dist1 = bfs(u)
    mm = max(item for item in seen if item is not None)
    if mm<=k:
        break
    ans += 1
    v = dist[mm][0]
    seen, dist2 = bfs(v)
    if dist1[mm]<dist2[mm]:
        done.add(v)
    else:
        done.add(u)
print(ans)

Fixed submission:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


from collections import defaultdict
n,k = map(int, input().split())
ns = defaultdict(set)
for _ in range(n-1):
    u,v = map(int, input().split())
    u -= 1
    v -= 1
    ns[u].add(v)
    ns[v].add(u)
def bfs(start):
    from queue import deque
    q = deque([start])
    seen = [None] * n
    seen[start] = 0
    dist = defaultdict(list)
    dist[0].append(start)
    while q:
        u = q.pop()
        d = seen[u]
        for v in ns[u]:
            if seen[v] is None and v not in done:
                seen[v] = d + 1
                dist[d+1].append(v)
                q.appendleft(v)
    return seen, dist
ans = 0
done = set()
while True:
    start = 0
    while start in done:
        start += 1
    seen, dist1 = bfs(start)
    m = max(item for item in seen if item is not None)
    u = dist1[m][0]
    seen, dist1 = bfs(u)
    mm = max(item for item in seen if item is not None)
    if mm<=k:
        break
    ans += 1
    v = dist1[mm][0]
    seen, dist2 = bfs(v)
    v1 = sum(len(dist1[u]) for u in range(k+1, mm+1))
    v2 = sum(len(dist2[u]) for u in range(k+1, mm+1))
    if v1<v2:
        done.add(v)
    else:
        done.add(u)
print(ans)
Buggy python submission (verdict: Runtime Error):
import bisect
n, k = map(int, input().split())
a = [int(input()) for _ in range(n)]
dp = [1 for _ in range(n)]
for i in range(n):
    for j in range(i-1, -1, -1):
        if abs(a[i] - a[j]) <= k:
            dp[i] = max(dp[i], dp[j]+1)
print(dp[-1])

Fixed submission:
print("ACL"*int(input()))
Buggy python submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())
a = [0 for _ in range(n)]
b = [0 for _ in range(n)]
Edge = [[] for _ in range(n)]
for i in range(m):
    a[i], b[i] = map(int, input().split())
    a[i] -= 1
    b[i] -= 1
    Edge[a[i]].append(b[i])
    Edge[b[i]].append(a[i])
looked = [1 for i in range(n)]
counter = 0
for i in range(n):
    if looked[i]:
        looked[i] = 0
        counter += 1
        queue = deque([i])
        while queue:
            now = deque.popleft(queue)
            for j in Edge[now]:
                if looked[j]:
                    deque.append(queue, j)
                    looked[j] = 0
print(counter-1)

Fixed submission:
from collections import deque
n, m = map(int, input().split())
Edge = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    Edge[a].append(b)
    Edge[b].append(a)
looked = [1 for i in range(n)]
counter = 0
for i in range(n):
    if looked[i]:
        looked[i] = 0
        counter += 1
        queue = deque([i])
        while queue:
            now = deque.popleft(queue)
            for j in Edge[now]:
                if looked[j]:
                    deque.append(queue, j)
                    looked[j] = 0
print(counter-1)

Buggy python submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())
a = [0 for _ in range(n)]
b = [0 for _ in range(n)]
Edge = [[] for _ in range(n)]
for i in range(m):
    a[i], b[i] = map(int, input().split())
    a[i] -= 1
    b[i] -= 1
    Edge[a[i]].append(b[i])
    Edge[b[i]].append(b[i])
looked = [1 for i in range(n)]
counter = 0
for i in range(n):
    if looked[i]:
        looked[i] = 0
        counter += 1
        queue = deque([i])
        while queue:
            now = deque.popleft(queue)
            for j in Edge[now]:
                if looked[j]:
                    deque.append(queue, j)
                    looked[j] = 0
print(counter-1)

Fixed submission:
from collections import deque
n, m = map(int, input().split())
Edge = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    Edge[a].append(b)
    Edge[b].append(a)
looked = [1 for i in range(n)]
counter = 0
for i in range(n):
    if looked[i]:
        looked[i] = 0
        counter += 1
        queue = deque([i])
        while queue:
            now = deque.popleft(queue)
            for j in Edge[now]:
                if looked[j]:
                    deque.append(queue, j)
                    looked[j] = 0
print(counter-1)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
print(max([a*c, a*d, b*c, c*d]))

Fixed submission:
x = int(input())
print(1 if x == 0 else 0)
Buggy python submission (verdict: Runtime Error):
x = map(int,input().split())
print(x.index(0)+1)

Fixed submission:
x = list(map(int,input().split()))
print(x.index(0)+1)

Buggy python submission (verdict: Runtime Error):
x = map(int,input().split())
print(x.index(0))

Fixed submission:
x = list(map(int,input().split()))
print(x.index(0)+1)

Buggy python submission (verdict: Runtime Error):
x = map(int,input(),split())
print(x.index(0))

Fixed submission:
x = list(map(int,input().split()))
print(x.index(0)+1)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
if n == 1:
    print(0)
    exit()
def makeprime(value):
    flag  = [True for _ in range(value)]
    ans = []
    for i in range(1,len(flag)):
        if flag[i]:
            ans.append(i+1)
            for j in range(i,len(flag),i+1):
                flag[j] = False
    return ans
for i in range(2,int(math.sqrt(n)+1)):
    if n%i == 0:
        flag = 1
        break
else:
    flag = 0
if flag:
    u = []
    r = n
    ans = 0
    rem = makeprime(int(math.sqrt(n)))
    for i in rem:
        o = 1
        while (i**o <= n):
            u.append(i**o)
            o += 1
    u.sort()
    for i in u:
        if n%i == 0:
            ans += 1
            n //= i
    print(ans)
else:
    print(1)

Fixed submission:
import math
import decimal
a,b = map(decimal.Decimal,input().split())
ans = a*b
print(math.floor(ans))

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(int(a*b))

Fixed submission:
import math
import decimal
a,b = map(decimal.Decimal,input().split())
ans = a*b
print(math.floor(ans))
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
d = [0 for _ in range(k)]
a = []
for i in range(k):
    d[i] = int(input())
    a.append(list(map(int,input().split())))
sn = [0 for _ in range(n)]
for i in range(k):
    for j in range(len(a[i])):
        sn[a[i][j]-1] += 1
ans = 0
for i in range(k):
    if sn[i] == 0:
        ans += 1
print(ans)

Fixed submission:
n,k = map(int,input().split())
d = [0 for _ in range(k)]
a = []
for i in range(k):
    d[i] = int(input())
    a.append(list(map(int,input().split())))
sn = [0 for _ in range(n)]
for i in range(k):
    for j in range(d[i]):
        sn[a[i][j]-1] = 1
ans = 0
print(sn.count(0))
Buggy python submission (verdict: Time Limit Exceeded):
import math
import itertools
k = int(input())
t = list(map(lambda x:list(x),itertools.product([i+1 for i in range(k)],repeat=3)))
ans = 0
for i in range(len(t)):
    ans += math.gcd(math.gcd(t[i][0],t[i][1]),t[i][2])
print(ans)

Fixed submission:
import math
import itertools
k = int(input())
t = list(map(lambda x:list(x),itertools.product([i+1 for i in range(k)],repeat=2)))
ans = 0
for i in range(len(t)):
    cu = math.gcd(t[i][0],t[i][1])
    for j in range(1,k+1):
        ans += math.gcd(j,cu)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y = map(int,input().split())
x -= 1
y -= 1
dis = [0 for i in range(n)]
for i in range(n):
    for j in range(i+1,n):
        dis[min(abs(j-i),min(abs(j-y)+abs(x-i)+1,abs(j-x)+abs(y-i)+1))] += 1
print("\n".join(map(str,dis[1:])))

Fixed submission:
n,x,y = map(int,input().split())
x -= 1
y -= 1
dis = [0 for i in range(n)]
for i in range(n):
    for j in range(i+1,n):
        dis[min(abs(j-i),min(abs(j-y)+abs(x-i)+1,abs(j-x)+abs(y-i)+1))] += 1
print("\n".join(map(str,dis[1:])))

Buggy python submission (verdict: Time Limit Exceeded):
n,x,y = map(int,input().split())
x -= 1
y -= 1
dis = [[0 for i in range(n)]for j in range(n)]
for i in range(n):
    for j in range(i+1,n):
        dis[i][j] = min(abs(j-i),min(abs(j-y)+abs(x-i)+1,abs(j-x)+abs(y-i)+1))
d = [0 for i in range(n)]
for i in range(n):
    for j in range(n):
        d[dis[i][j]] += 1
print("\n".join(map(str,d[1:])))

Fixed submission:
n,x,y = map(int,input().split())
x -= 1
y -= 1
dis = [0 for i in range(n)]
for i in range(n):
    for j in range(i+1,n):
        dis[min(abs(j-i),min(abs(j-y)+abs(x-i)+1,abs(j-x)+abs(y-i)+1))] += 1
print("\n".join(map(str,dis[1:])))

Buggy python submission (verdict: Time Limit Exceeded):
n,x,y = map(int,input().split())
x -= 1
y -= 1
dis = [[0 for i in range(n)]for j in range(n)]
for i in range(n):
    for j in range(n):
        dis[i][j] = min(abs(j-i),min(abs(j-y)+abs(x-i)+1,abs(j-x)+abs(y-i)+1))
d = [0 for i in range(n)]
for i in range(n):
    for j in range(n):
        d[dis[i][j]] += 1
d = list(map(lambda x:x//2,d))
print("\n".join(map(str,d[1:])))

Fixed submission:
n,x,y = map(int,input().split())
x -= 1
y -= 1
dis = [0 for i in range(n)]
for i in range(n):
    for j in range(i+1,n):
        dis[min(abs(j-i),min(abs(j-y)+abs(x-i)+1,abs(j-x)+abs(y-i)+1))] += 1
print("\n".join(map(str,dis[1:])))

Buggy python submission (verdict: Time Limit Exceeded):
n,x,y = map(int,input().split())
dis = [[0 for _ in range(n)]for p in range(n)]
dis[0][1] = 1
dis[n-1][n-2] = 1
dis[x-1][y-1] = 1
dis[y-1][x-1] = 1
for i in range(1,n-1):
    dis[i][i-1] = 1
    dis[i][i+1] = 1

def bfs(start):
    queue = [start]
    disq = [0]
    searched = [start]
    while(len(queue)):
        now = queue.pop(0)
        dnow = disq.pop(0)
        for goal in range(n):
            if not goal in searched:
                if dis[now][goal] == 1:
                    queue.append(goal)
                    disq.append(dnow + 1)
                    if dis[start][goal] == 0:
                        dis[start][goal] = dnow + 1
                    else:
                        dis[start][goal] = min(dnow + 1,dis[start][goal])
                    searched.append(now)

for i in range(n):
    bfs(i)

dissum = [0 for _ in range(n-1)]

for i in range(n):
    for j in range(i):
        dissum[dis[i][j]-1] += 1

for i in range(len(dissum)):
    print(dissum[i])

Fixed submission:
n,x,y = map(int,input().split())
x -= 1
y -= 1
dis = [0 for i in range(n)]
for i in range(n):
    for j in range(i+1,n):
        dis[min(abs(j-i),min(abs(j-y)+abs(x-i)+1,abs(j-x)+abs(y-i)+1))] += 1
print("\n".join(map(str,dis[1:])))
Buggy python submission (verdict: Runtime Error):
s = str(input())
t = s[::-1]
if(s != t):
    print("No")
    exit
c = ""
for i in range((len(s)-1)//2):
    c += s[i]
e = c[::-1]
if(e != c):
    print("No")
    exit()
r = ""
for i in range(((len(s)+3)//2)-1,len(s),1):
    r += s[i]
y = r[::-1]
if(r != y):
    print("No")
    exit()
"""
print("Yes")
print(s,t)
print(e,c)
print(r,y)

Fixed submission:
s = str(input())
t = s[::-1]
if(s != t):
    print("No")
    exit()
c = ""
for i in range((len(s)-1)//2):
    c += s[i]
e = c[::-1]
if(e != c):
    print("No")
    exit()
r = ""
for i in range(((len(s)+3)//2)-1,len(s),1):
    r += s[i]
y = r[::-1]
if(r != y):
    print("No")
    exit()
print("Yes")
"""
print(s,t)
print(e,c)
print(r,y)
"""
Buggy python submission (verdict: Time Limit Exceeded):
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = [0 for _ in range(m)]
y = [0 for _ in range(m)]
c = [0 for _ in range(m)]
for i in range(m):
    x[i],y[i],c[i] = map(int,input().split())

ans = 10000000000

for i in range(A):
    for j in range(B):
        for k in range(m):
            if(i+1 == x[k] and j+1 == y[k]):
                price = a[i] + b[j] - c[k]
            else:
                price = a[i] + b[j]
            ans = min(ans,price)
print(ans)

Fixed submission:
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = [0 for _ in range(m)]
y = [0 for _ in range(m)]
c = [0 for _ in range(m)]
for i in range(m):
    x[i],y[i],c[i] = map(int,input().split())

ans = min(a)+min(b)

for i in range(m):
    ans = min(ans,(a[x[i]-1] + b[y[i]-1]) - c[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b = map(int,input().split())
ans = []
while(len(ans) < n):
    for i in range(a):
        if(len(ans) >= n):
            break
        ans.append(1)
    for i in range(b):
        ans.append(0)
print(sum(ans))

Fixed submission:
n,a,b = map(int,input().split())
print(a*(n//(a+b)) + min(n%(a+b),a))
Buggy python submission (verdict: Runtime Error):
import math
n,k = map(int,input().split())
print(math.ceil(1/math.log(k,n)))

Fixed submission:
n,k = map(int,input().split())
count = 1
while(n >= k):
    count += 1
    n /= k
print(count)

Buggy python submission (verdict: Runtime Error):
import math
n,k = map(int,input().split())
print(int(math.ceil(1/math.log(k,n))))

Fixed submission:
n,k = map(int,input().split())
count = 1
while(n >= k):
    count += 1
    n /= k
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = ["" for i in range(n)]
for j in range(n):
    s[j] = str(input())
s.sort()
count = [0 for _ in range(len(set(s)))]
l = 0
name = list(sorted(set(s)))
for k in range(n-1):
    count[l] += 1
    if(s[k] != s[k+1]):
        l += 1
if(s[-1] == s[-2]):
    count[-1] += 1
else:
    count.append(1)

m_v = max(count)
ansnum = []

for h in range(len(count)):
    if(count[h] == m_v):
        ansnum.append(name[h])

print(sorted(ansnum))

Fixed submission:
n = int(input())
s = ["" for i in range(n)]
for j in range(n):
    s[j] = str(input())
s.sort()
count = [0 for _ in range(len(set(s)))]
l = 0
name = list(sorted(set(s)))
for k in range(n-1):
    count[l] += 1
    if(s[k] != s[k+1]):
        l += 1

count[-1] += 1

m_v = max(count)
ansnum = []

for h in range(len(count)):
    if(count[h] == m_v):
        ansnum.append(name[h])

print("\n".join(sorted(ansnum)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b,count = [],0
for i in range(0,n,1):
    b.append(a[i])
    if(a[i] == min(b)):
        count += 1
print(count)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b,count = [],0
mv = a[0]
for i in range(0,n,1):
    b.append(a[i])
    if(a[i] <= mv):
        count += 1
        mv = a[i]
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int, input().split())
for i in range(k):
    if (a > 0):
        a -= 1
    elif(b > 0):
        b -= 1
print(max(a,0),max(b,0))


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

if (a > k):
    a = a-k
    k = 0
else:
    k -= a
    a = 0
    
if (b > k):
    b -= k
    k = 0
else:
    b = 0
    
print(a,b)
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int, input().split())
i = max(a,b)
s = 0
while(i <= a*b):
    if (i%a == 0 and i%b == 0):
        s = i
        break
    i += 1
print(i)

Fixed submission:
a,b = map(int, input().split())
i = min(a,b)
s = 0
while(i <= a*b):
    if (i%a == 0 and i%b == 0):
        s = i
        break
    i += min(a,b)
print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
	if(int(i * 1.08) == n):
      print(i)
      exit()
print(":(")

Fixed submission:
n = int(input())
for i in range(1,n+1):
  if(int(i*1.08) == n):
    print(i)
    exit()
print(":(")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
for i in range(n):
    if s[i] == "Z":
        print("A",end="")
    else:
        print(chr(ord(s[i])+1),end="")
print()

Fixed submission:
n = int(input())
s = str(input())
for i in range(len(s)):
    r = ord(s[i])+n
    if 90 < r:
        print(chr(r-26),end="")
    else:
        print(chr(r),end="")
print()
Buggy python submission (verdict: Time Limit Exceeded):
import math
x = int(input())
i = int(math.sqrt(x))
while (i < x):
    if (x%i == 0):
        print (int((x/i)+i)-2)
        break
    i += 1

Fixed submission:
import math
x = int(input())
i = int(math.sqrt(x))
while (i < x):
    if (x%i == 0):
        print (int((x/i)+i)-2)
        break
    i -= 1
Buggy python submission (verdict: Runtime Error):
x = int(input())
slime = str(input())
i = 0
scount = 0
while(i < n-1):
    if(slime[i] != slime[i+1]):
        scount += 1
    i += 1
print(scount)

Fixed submission:
x = int(input())
slime = str(input())
i = 0
scount = 1
while(i < x-1):
    if(slime[i] != slime[i+1]):
        scount += 1
    i += 1
print(scount)
Buggy python submission (verdict: Runtime Error):
import itertools
n = int(input())
a = list(map(int,input().split()))
s = itertools.permutations(n,3)
count = 0
for i in range(len(s)):
  r = [a[s[0]],a[s[1]],a[s[2]]]
  if (sum(r) - max(r)) >= max(r):
    count += 1
print(count)

Fixed submission:
import bisect
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        r = bisect.bisect_left(l,l[i]+l[j])
        ans += r-(j+1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
a = [0 for  _ in range(q)]
point = [k for _ in range(n)]
for i in range(q):
    a[i] = int(input())

for i in range(q):
    for j in range(len(point)):
        point[j] -= 1
    point[a[i]-1] += 1

for i in range(n):
    if(point[i] > 0):
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q = map(int,input().split())
a = [0 for  _ in range(q)]
point = [0 for _ in range(n)]

for i in range(q):
    a[i] = int(input())

for i in range(q):
    point[a[i]-1] += 1

for i in range(n):
    if(point[i] > q-k):
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
i = 0
p = list(map(int, input().split()))
n = p[0]
k = p[1]
q = p[2]
a = []
point = []
for i in range(q):
    a.append(int(input()))
j = 0
u = 0
for u in range(n):
    point.append(k)
while (j < q):
    m = 0
    while(m < n):
        if (m != a[j-1]):
            point[m-1] -= 1
        m += 1
    j += 1
g = 0
while(g < n):
    if(point[g] > 0):
        print("Yes")
    else:
        print("No")
    g += 1

Fixed submission:
n,k,q = map(int,input().split())
a = [0 for  _ in range(q)]
point = [0 for _ in range(n)]

for i in range(q):
    a[i] = int(input())

for i in range(q):
    point[a[i]-1] += 1

for i in range(n):
    if(point[i] > q-k):
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
count = -1
ans = []
a = list(map(int,input().split()))
for i in range(n-1):
    if(a[i] >= a[i+1]):
        count += 1
        ans.append(count+1)
    else:
        count = -1
        ans.append(count+1)
print(max(ans))

Fixed submission:
n = int(input())
count = -1
ans = []
a = list(map(int,input().split()))
for i in range(n-1):
    if(a[i] >= a[i+1]):
        count += 1
        ans.append(count+1)
    else:
        count = -1
        ans.append(count+1)
if(len(a) == 1):
    print(0)
else:
    print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(0,n):
  ans += i
print(ans)

Fixed submission:
n = int(input())
print((n*(n-1))//2)