Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
lst = list(map(int,input().split()))
mod = 10**9 + 7

col_lst = [0 , 0 , 0]
ans = 1

for i in range(n):
    tmp = lst[i]
    val = col_lst.count(tmp)
    ans = (ans * val) % mod
    col_lst[col_lst.index(tmp)] += 1
print(ans % mod)

Fixed submission:
n = int(input())
lst = list(map(int,input().split()))
mod = 10**9 + 7

col_lst = [0 , 0 , 0]
ans = 1

for i in range(n):
    tmp = lst[i]
    val = col_lst.count(tmp)
    if val == 0:
        print(0)
        exit()
    else:
        ans = (ans * val) % mod
        col_lst[col_lst.index(tmp)] += 1
print(ans % mod)

Buggy python submission (verdict: Runtime Error):
n = int(input())
lst = list(map(int,input().split()))
mod = 10**9 + 7

col_lst = [0 , 0 , 0]
ans = 1

for i in range(n):
    tmp = lst[i]
    val = col_lst.count(tmp)
    ans = ans * val % mod
    col_lst[col_lst.index(tmp)] += 1
print(ans)

Fixed submission:
n = int(input())
lst = list(map(int,input().split()))
mod = 10**9 + 7

col_lst = [0 , 0 , 0]
ans = 1

for i in range(n):
    tmp = lst[i]
    val = col_lst.count(tmp)
    if val == 0:
        print(0)
        exit()
    else:
        ans = (ans * val) % mod
        col_lst[col_lst.index(tmp)] += 1
print(ans % mod)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))
ans = float('inf')
for i in range(1, n):
    x = A[:i]
    y = A[i:]
    sum_x = sum(x)
    sum_y = sum(y)
    ans = min(ans, abs(sum_x - sum_y))
print(ans)

Fixed submission:
import numpy as np
import bisect
n = int(input())
A = list(map(int,input().split()))
cs = np.cumsum(A).tolist()
mid = sum(A)//2
idx = bisect.bisect_left(cs, mid)
ans = float('inf')
for i in range(max(1, idx-1), min(idx+2, n)):
    x = A[:i]
    y = A[i:]
    sum_x = sum(x)
    sum_y = sum(y)
    ans = min(ans, abs(sum_x - sum_y))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))
ans = float('inf')
for i in range(1, n):
    x = A[:i]
    y = A[i:]
    sum_x = sum(x)
    sum_y = sum(y)
    ans = min(ans, abs(sum_x - sum_y))
print(ans)

Fixed submission:
import numpy as np
import bisect
n = int(input())
A = list(map(int,input().split()))
cs = np.cumsum(A).tolist()
mid = sum(A)//2
idx = bisect.bisect_left(cs, mid)
ans = float('inf')
for i in range(max(1, idx-1), min(idx+2, n)):
    x = A[:i]
    y = A[i:]
    sum_x = sum(x)
    sum_y = sum(y)
    ans = min(ans, abs(sum_x - sum_y))
print(ans)
Buggy python submission (verdict: Runtime Error):
h,w,k = map(int,input().split())
lst = []
cut1 = []
for i in range(h):
    l = input()
    if '#' in l:
        cut1.append(i)
    lst.append(l)
res = [[float('inf')]*w for _ in range(h)]

cut2 = []
for c in cut1:
    tmp_cut = []
    for j in range(len(lst[c])):
        if lst[c][j]=='#':
            tmp_cut.append(j)
    cut2.append(tmp_cut)

cnt = 1
for e,i in enumerate(cut1):
    for j in cut2[e]:
        res[i][j] = cnt
        cnt += 1

for r in res:
    mn = min(r)
    mx = max(set(r) - {float('inf')})
    if mn==mx:
        for i in range(w):
            if r[i] == float('inf'):
                r[i] = mn
    else:
        for i in range(w):
            if r[i] == float('inf'):
                r[i] = mn
            else:
                mn = min(mx, r[i])

for i in range(w):
    tmp = []
    for j in range(h):
        if res[j][i] != float('inf'):
            tmp.append(res[j][i])
    num = min(tmp)
    for j in range(h):
        if res[j][i] == float('inf'):
            res[j][i] = num
        else:
            num = res[j][i]

for r in res:
    print(*r)

Fixed submission:
h,w,k = map(int,input().split())
lst = []
cut1 = []
for i in range(h):
    l = input()
    if '#' in l:
        cut1.append(i)
    lst.append(l)
res = [[float('inf')]*w for _ in range(h)]

cut2 = []
for c in cut1:
    tmp_cut = []
    for j in range(len(lst[c])):
        if lst[c][j]=='#':
            tmp_cut.append(j)
    cut2.append(tmp_cut)

cnt = 1
for e,i in enumerate(cut1):
    for j in cut2[e]:
        res[i][j] = cnt
        cnt += 1

for r in res:
    mn = min(r)
    mx = max(r)
    if (mn==mx) and (mn==float('inf')):
        pass
    else:
        mx = max(set(r) - {float('inf')})
        if mn==mx:
            for i in range(w):
                if r[i] == float('inf'):
                    r[i] = mn
        else:
            for i in range(w):
                if r[i] == float('inf'):
                    r[i] = mn
                else:
                    mn = min(mx, r[i])

for i in range(w):
    tmp = []
    for j in range(h):
        if res[j][i] != float('inf'):
            tmp.append(res[j][i])
    num = min(tmp)
    for j in range(h):
        if res[j][i] == float('inf'):
            res[j][i] = num
        else:
            num = res[j][i]

for r in res:
    print(*r)
Buggy python submission (verdict: Time Limit Exceeded):
n,w = map(int,input().split())
items = sorted([list(map(int,input().split())) for i in range(n)])
dp = [[0]*(w+1) for _ in range(n+2)]
for i in range(n):
    wi, vi = items[i]
    for j in range(w+1):
        if j+wi<=w:
            dp[i+1][j+wi] = max(dp[i+1][j+wi], dp[i][j]+vi)
        dp[i+1][j] = max(dp[i][j], dp[i+1][j])
ans = 0
for i, (wi, vi) in enumerate(items):
    ans = max(ans, dp[i][w-1]+vi)
print(ans)


Fixed submission:
n,w = map(int,input().split())
items = sorted([list(map(int,input().split())) for i in range(n)])
dp = [[0]*(w+1) for _ in range(n+2)]
for i in range(n):
    wi, vi = items[i]
    for j in range(w+1):
        if j+wi<=w:
            dp[i+1][j+wi] = max(dp[i+1][j+wi], dp[i][j]+vi)
        dp[i+1][j] = max(dp[i][j], dp[i+1][j])
ans = 0
for i, (wi, vi) in enumerate(items):
    ans = max(ans, dp[i][w-1]+vi)
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())

if x >= a*a*b/2:
    y = (-1)*b + 2*x/(a**2)
    if b != y:
        d = math.atan(a / (b-y))
    else:
        print(0)
        #exit()
else:
    y = 2*x/(a*b)
    d = math.atan(y/b)
print(90 - math.degrees(d))

Fixed submission:
import math
a,b,x = map(int,input().split())

if x >= a*a*b/2:
    y = (-1)*b + 2*x/(a**2)
    if b != y:
        d = math.atan(a / (b-y))
    else:
        print(0)
        exit()
else:
    y = 2*x/(a*b)
    d = math.atan(y/b)
print(90 - math.degrees(d))

Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())

if x >= (a**2)*b*1/2:
    y = (-1)*b + 2*x/(a**2)
    if y==0:
        print(45.0)
        exit()
    d = math.atan(a / (b-y))
else:
    y = 2*x/(a*b)
    d = math.atan(y/b)
print(90 - math.degrees(d))

Fixed submission:
import math
a,b,x = map(int,input().split())

if x >= a*a*b/2:
    y = (-1)*b + 2*x/(a**2)
    if b != y:
        d = math.atan(a / (b-y))
    else:
        print(0)
        exit()
else:
    y = 2*x/(a*b)
    d = math.atan(y/b)
print(90 - math.degrees(d))

Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())

if x >= (a**2)*b*1/2:
    y = (-1)*b + 2*x/(a**2)
    d = math.atan(a / (b-y))
else:
    y = 2*x/(a*b)
    d = math.atan(y/b)
print(90 - math.degrees(d))

Fixed submission:
import math
a,b,x = map(int,input().split())

if x >= a*a*b/2:
    y = (-1)*b + 2*x/(a**2)
    if b != y:
        d = math.atan(a / (b-y))
    else:
        print(0)
        exit()
else:
    y = 2*x/(a*b)
    d = math.atan(y/b)
print(90 - math.degrees(d))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A.sort()
F.sort(reverse=True)
l,r = 0, 10**18
if sum(A)<=k:
    print(0)
else:
    while r-l!=1:
        mid = (r+l)//2
        ex = 0
        for i in range(n):
            need = mid // F[i]
            ex += max(0, A[i]-need)
        if ex <= k:
            r = mid
        else:
            l = mid
    print(r)

Fixed submission:
n,k = map(int,input().split())
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A.sort()
F.sort(reverse=True)
l,r = 0, 10**18
if sum(A)<=k:
    print(0)
else:
    while r-l!=1:
        mid = (r+l)//2
        ex = 0
        for i in range(n):
            need = mid // F[i]
            ex += max(0, A[i]-need)
        if ex <= k:
            r = mid
        else:
            l = mid
    print(r)
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left

n = int(input())
lst = list(map(int,input().split()))
ans = 0
lst.sort()
for i in range(n):
    for j in range(i+1,n):
        b,c = lst[i],lst[j]
        posr = bisect_left(lst,b+c)
        posl = max(j+1,bisect_left(lst,abs(b-c)))
        ans += (posr - posl)
print(ans)

Fixed submission:
from bisect import bisect_left
n = int(input())
lst = list(map(int,input().split()))
ans = 0

lst.sort()

for i in range(n):
    for j in range(i+1,n):
        b,c = lst[i],lst[j]
        posr = bisect_left(lst,b+c)
        posl = max(j+1,bisect_left(lst,abs(b-c)))
        ans += (posr - posl)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
n = int(input())
lst = list(map(int,input().split()))
ans = 0
lst.sort()
for i in range(n):
    for j in range(i+1,n):
        b,c = lst[i],lst[j]
        pos = bisect_left(lst,b+c)
        tmp = n - 1 - pos
        for k in range(j+1,pos):
            x,y,z = lst[i],lst[j],lst[k]
            if x+y>z and y+z>x and z+x>y:
                ans += 1  
print(ans)

Fixed submission:
from bisect import bisect_left
n = int(input())
lst = list(map(int,input().split()))
ans = 0

lst.sort()

for i in range(n):
    for j in range(i+1,n):
        b,c = lst[i],lst[j]
        posr = bisect_left(lst,b+c)
        posl = max(j+1,bisect_left(lst,abs(b-c)))
        ans += (posr - posl)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
dp = [float('inf')]*(1<<n)
dp[0] = 0
for _ in range(m):
    a,b = map(int,input().split())
    sc = 0
    for e in map(int,input().split()):
        bit += 1<<(e-1)
    for i in range(1<<n):
        dp[i|bit] = min(dp[i|bit], dp[i]+a)
if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1])

Fixed submission:
n,m = map(int,input().split())
dp = [float('inf')]*(1<<n)
dp[0] = 0
for _ in range(m):
    a,b = map(int,input().split())
    bit = 0
    for e in map(int,input().split()):
        bit += 1<<(e-1)
    for i in range(1<<n):
        dp[i|bit] = min(dp[i|bit], dp[i]+a)
if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1])

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
dp = [float('inf')]*(1<<n)
dp[0] = 0
for _ in range(m):
    a,b = map(int,input().split())
    sc = 0
    for e in map(int,input().split()):
        bit += 1<<(e-1)
    for i in range(1<<n):
        dp[i|bit] = min(dp[i|bit], dp[i]+a)
if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1])

Fixed submission:
n,m = map(int,input().split())
dp = [float('inf')]*(1<<n)
dp[0] = 0
for _ in range(m):
    a,b = map(int,input().split())
    bit = 0
    for e in map(int,input().split()):
        bit += 1<<(e-1)
    for i in range(1<<n):
        dp[i|bit] = min(dp[i|bit], dp[i]+a)
if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
dp = [float('inf')]*(1<<n)
dp[0] = 0
for _ in range(m):
    a,b = map(int,input().split())
    bit = 0
    for e in map(int,input().split()):
        bit += 1<<(e-1)
    for i in range(1<<n):
        dp[i|bit] = min(dp[i|bit], dp[i]+a)
if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1])

Fixed submission:
n,m = map(int,input().split())
dp = [float('inf')]*(1<<n)
dp[0] = 0
for _ in range(m):
    a,b = map(int,input().split())
    bit = 0
    for e in map(int,input().split()):
        bit += 1<<(e-1)
    for i in range(1<<n):
        dp[i|bit] = min(dp[i|bit], dp[i]+a)
if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):

def LCS(s,t):
    ret = ''
    ls,lt = len(s), len(t)
    
    # dp[i][j] : s_i, t_iでのLCS
    dp = [[0]*(lt+1) for _ in range(ls+1)]
    for i in range(ls):
        for j in range(lt):
            if s[i]==t[j]:
                dp[i+1][j+1] = dp[i][j]+1
            else:
                dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])
    
    if dp[ls][lt]==0:
        return ret
    i,j = ls, lt
    while i>0 and j>0:
        if s[i-1] == t[j-1]:
            ret += s[i-1]
            i -= 1
            j -= 1
        else:
            if dp[i-1][j] > dp[i][j-1]:
                i -= 1
            else:
                j -= 1
    return ret[::-1]

n = int(input())
S = input()
ans = 0
for i in range(1, n//2 + 2):
    s = S[:i]
    t = S[i:]
    ans = max(ans, len(LCS(s,t)))
print(ans)

Fixed submission:
n = int(input())
s = input()
dp = [[0]*5005 for _ in range(5005)]
for i in range(n)[::-1]:
    for j in range(n)[::-1]:
        if s[i]!=s[j]:
            dp[i][j] = 0
        else:
            dp[i][j] = dp[i+1][j+1] + 1
ans = 0
for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        now = min(dp[i][j], j-i)
        ans = max(ans, now)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def LCS(s,t):
    ret = ''
    ls,lt = len(s), len(t)
    
    # dp[i][j] : s_i, t_iでのLCS
    dp = [[0]*(lt+1) for _ in range(ls+1)]
    for i in range(ls):
        for j in range(lt):
            if s[i]==t[j]:
                dp[i+1][j+1] = dp[i][j]+1
            else:
                dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])
    
    if dp[ls][lt]==0:
        return ret
    i,j = ls, lt
    while i>0 and j>0:
        if s[i-1] == t[j-1]:
            ret += s[i-1]
            i -= 1
            j -= 1
        else:
            if dp[i-1][j] > dp[i][j-1]:
                i -= 1
            else:
                j -= 1
    return ret[::-1]

n = int(input())
S = input()
ans = 0
for i in range(1, n):
    s = S[:i]
    t = S[i:]
    ans = max(ans, len(LCS(s,t)))
print(ans)

Fixed submission:
n = int(input())
s = input()
dp = [[0]*5005 for _ in range(5005)]
for i in range(n)[::-1]:
    for j in range(n)[::-1]:
        if s[i]!=s[j]:
            dp[i][j] = 0
        else:
            dp[i][j] = dp[i+1][j+1] + 1
ans = 0
for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        now = min(dp[i][j], j-i)
        ans = max(ans, now)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

ans = None
for i in range(len(t)):
    if t[i] not in s:
        ans = -1
        break
else:
    ss = s * len(t)
    tg = 0
    ans = 0
    for i in range(len(ss)):
        ans += 1 
        if tg == len(t):
            break
        if ss[i] == t[tg]:
            tg += 1
print(ans-1)

Fixed submission:
import bisect
s = list(input())
t = list(input())
dic = {}
for i, j in enumerate(s):
    if j in dic:
        dic[j].append(i)
    else:
        dic[j] = [i]
loop = 0
if set(t) <= set(s):
    for i in range(len(t)):
        if i==0:
            idx = dic[t[0]][0]
        else:
            lis = dic[t[i]]
            idx2 = bisect.bisect_right(lis, idx)
            if idx2 == len(lis):
                loop += 1
                idx = lis[0]
            else:
                idx = lis[idx2]
    print(loop*len(s) + idx + 1)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
from math import factorial
n = int(input())
lst = [input() for _ in range(n)]
for i in range(n):
    lst[i] = str(sorted(lst[i])).replace(', ','').replace("'",'').replace('[','').replace(']','')
numlst = Counter(lst)
ans = 0
for v in numlst.values():
    if v >= 2:
        ans += factorial(v) / factorial(2) / factorial(v-2)
print(int(ans))

Fixed submission:
from collections import Counter

N = int(input())
S = [input() for i in range(N)]

sorted_S =  [''.join(sorted(s)) for s in S]
c = Counter(sorted_S)

print(sum([n * (n-1)//2 for n in  list(c.values())]))

Buggy python submission (verdict: Runtime Error):
from collections import Counter
from math import factorial

n = int(input())
lst = [input() for _ in range(n)]
for i in range(n):
    lst[i] = str(sorted(lst[i])).replace(', ','').replace("'",'').replace('[','').replace(']','')

numlst = Counter(lst)

ans = 0
for v in numlst.values():
    if v==1:
        continue
    else:
        ans += factorial(v) / factorial(2) / factorial(v-2)
print(int(ans))

Fixed submission:
from collections import Counter

N = int(input())
S = [input() for i in range(N)]

sorted_S =  [''.join(sorted(s)) for s in S]
c = Counter(sorted_S)

print(sum([n * (n-1)//2 for n in  list(c.values())]))

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

n = int(input())
lst = []
lstn = [] 
cnt = 0

def nCr(n,r):
    r = min(r,n-r)
    numerator = 1
    for i in range(n,n-r,-1):
        numerator *= i
    denomination = 1
    for i in range(r,1,-1):
        denomination *= i
    return numerator // denomination

for i in range(n):
    s = input()
    c = Counter(s)
    if c not in lst:
        lst.append(c)
        lstn.append(1)
    else:
        k = lst.index(c)
        lstn[k] += 1

for x in lstn:
    if x >= 2:
        cnt += nCr(x,2)
print(cnt)

Fixed submission:
from collections import Counter

N = int(input())
S = [input() for i in range(N)]

sorted_S =  [''.join(sorted(s)) for s in S]
c = Counter(sorted_S)

print(sum([n * (n-1)//2 for n in  list(c.values())]))

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

n = int(input())
lst = []
lstn = [0] *10**5
cnt = 0
j = 0

def nCr(n,r):
    r = min(r,n-r)
    numerator = 1
    for i in range(n,n-r,-1):
        numerator *= i
    denomination = 1
    for i in range(r,1,-1):
        denomination *= i
    return numerator // denomination


for i in range(n):
    s = input()
    c = Counter(s)
    if c not in lst:
        lst.append(c)
        lstn[j] = 1
        j += 1
    else:
        k = lst.index(c)
        lstn[k] += 1

for x in lstn:
    if x >= 2:
        cnt += nCr(x,2)
print(cnt)

Fixed submission:
from collections import Counter

N = int(input())
S = [input() for i in range(N)]

sorted_S =  [''.join(sorted(s)) for s in S]
c = Counter(sorted_S)

print(sum([n * (n-1)//2 for n in  list(c.values())]))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
lst = [list(map(int,input().split())) for _ in range(n)]

lst.sort(key = lambda x:x[0],reverse = True)
lst.sort(key = lambda x:x[1],reverse = True)

done = [0 for _ in range(n)]
gain = 0

for i in reversed(range(1,m+1)): #i:残り日数
    for j in range(n): #j:候補から優先度順で探索
        if lst[j][0] <= i and done[j] == 0: #必要な日数>残り日数 かつ undone
            gain += lst[j][1]
            done[j] = 1 #undone:0,done:1として分類
            break #働いたら次の日へ

print(gain)

Fixed submission:
import heapq
n,m = list(map(int,input().split()))
jobs = [[] for _ in range(m)]
for i in range(n):
    d,r = list(map(int,input().split()))
    if d-1 < m:
        jobs[d-1].append(-r)
rewords = 0
heap = []
for i in range(m):
    for reword in jobs[i]:
        heapq.heappush(heap,reword)
    if len(heap) > 0:
        reword = heapq.heappop(heap)
        rewords += -reword
print(rewords)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
lst = [list(map(int,input().split())) for _ in range(n)]

lst.sort(key = lambda x:x[0],reverse = True)
lst.sort(key = lambda x:x[1],reverse = True)

done = [0 for _ in range(n)]
gain = 0

for i in reversed(range(1,m+1)): #i:残り日数
    for j in range(n): #j:候補から優先度順で探索
        if lst[j][0] <= i and done[j] == 0: #必要な日数>残り日数 かつ undone
            gain += lst[j][1]
            done[j] = 1　#undone:0,done:1として分類
            break #働いたら次の日へ

print(gain)

Fixed submission:
import heapq
n,m = list(map(int,input().split()))
jobs = [[] for _ in range(m)]
for i in range(n):
    d,r = list(map(int,input().split()))
    if d-1 < m:
        jobs[d-1].append(-r)
rewords = 0
heap = []
for i in range(m):
    for reword in jobs[i]:
        heapq.heappush(heap,reword)
    if len(heap) > 0:
        reword = heapq.heappop(heap)
        rewords += -reword
print(rewords)
Buggy python submission (verdict: Runtime Error):
n = input()
le = len(n)

def count(x):
    k = len(str(x)) // 2
    for i in range(k):
        if i==0:
            ans = '9'
        else:
            ans += '09'
    return (int(ans))

if le%2==0:
    ans = count(n)
else:
    nn = n[1:]
    ans = count(nn)
    ans += int(n) - 10**(le-1) + 1
print(ans)

Fixed submission:
n = input()
le = len(n)

def count(x):
    k = len(x) // 2
    for i in range(k):
        if i==0:
            ans = '9'
        else:
            ans += '09'
    return (int(ans))

if le == 1:
    print(int(n))
    exit()

elif le % 2 == 0:
    ans = count(n)
else:
    nn = n[1:]
    ans = count(nn)
    ans += int(n) - 10**(le-1) + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
s = int(input())
inf = 10**9
S = s * 2

def is_prime(num):
    if num < 2:
        return True
    else:
        num_sqrt = math.floor(math.sqrt(num))
        for prime in range(2,num_sqrt+1):
            if num%prime == 0:
                return False
                break
            return True

def division(num):
    for i in range(1,int(num**0.5)+1):
        if num%i == 0:
            if i <= inf and num%i <= inf:
                return x,y
    return 0,0

if is_prime(s):
    x,y = s,2
else:
    x,y = division(S)
print(0,0,x,0,0,y)

Fixed submission:
s = int(input())
inf = 10**9

if s==10**18:
  print(0,0,inf,1,0,inf)
  exit()

x = inf - s%inf
y = s // inf + 1

print(0,0,inf,1,x,y)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = [int(input()) for _ in range(n)]
lst_rev = lst[::-1]
visited = [False]*n
cnt = 0
for i in range(n):
    if visited[i]:
        continue
    else:
        visited[i] = True
        cnt += 1
        tmp = lst_rev[i]
        for j in range(i+1, n):
            if not visited[j] and lst_rev[j] < tmp:
                visited[j] = True
                tmp = lst_rev[j]
print(cnt)

Fixed submission:
import bisect
from collections import deque

n = int(input())
la = [int(input()) for _ in range(n)]
result = deque([])

for a in la:
    idx = bisect.bisect_left(result, a)
    if idx==0:
        result.appendleft(a)
    else:
        result[idx - 1] = a
print(len(result))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = [int(input()) for _ in range(n)]
lst_rev = lst[::-1]

visited = [False]*n
cnt = 0

for i in range(n):
    if visited[i]:
        continue
    else:
        visited[i] = True
        cnt += 1
        tmp = lst_rev[i]
        for j in range(i+1, n):
            if not visited[j] and lst_rev[j] < tmp:
                visited[j] = True
                tmp = lst_rev[j]
print(cnt)

Fixed submission:
import bisect
from collections import deque

n = int(input())
la = [int(input()) for _ in range(n)]
result = deque([])

for a in la:
    idx = bisect.bisect_left(result, a)
    if idx==0:
        result.appendleft(a)
    else:
        result[idx - 1] = a
print(len(result))